From patchwork Mon Jan 4 18:30:21 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Lechner X-Patchwork-Id: 11997331 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E07B9C433E0 for ; Mon, 4 Jan 2021 18:33:17 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8EE1721D94 for ; Mon, 4 Jan 2021 18:33:17 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8EE1721D94 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=lechnology.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=+vw9uEZB6jqJ4Cl8/uoaf/bOHJpFAIJcGQk5ATS2Vb8=; b=xwVLeM3hSKDNGdSwW3Q+HhDLy DFqPRbWxOUfIkLZRwjSk2gdjCiFuMRetDRWl4Xem4zUly+UmegkcPSb4+4fIzfpW2hMTYrzNxzVV1 Q7r/abVWAwW/D98j8n6dQ7qZnVnw8Rfg2qOcoNPoRMDzr7ZisnPOHCauTkoCJ1PNrhQBYm3Dw3e8z ORcTcZ4TvgDn7ZY4HQQI0LmQzI2BYJZ/2TTHBUxdErlVZwRUahuyDswvQZDy1/OQEIS32FZO8zAON aIYs7zsqoYkdzGilm9TnB0Ew4v5Z9FwQ6eOXXBWMRtop8JLFoBoSHs15R2IPvPhvWkAZmunu/Vpit 2gFKpTGLw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kwUdr-0006Om-SR; Mon, 04 Jan 2021 18:31:43 +0000 Received: from vern.gendns.com ([98.142.107.122]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kwUdj-0005z3-FV for linux-arm-kernel@lists.infradead.org; Mon, 04 Jan 2021 18:31:37 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lechnology.com; s=default; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=oDfcvjDf7SJg3FG/ecf6b0KnLwiHt36+ZCw6OZhhnAA=; b=JbCeEfUDhwi+v51kylqnDgrs8P 0spEItpSo98mL2zbfV+gjsgpBh6NNNlmQM3IBcJvjSVnhOSbZj5An5otTVZ7aiHCko7t+65wweGKh tANEqB5TltFIBrpAh4iLzdN4nTrcwyXC8u0QYwohx88GcHHOSY26Z9HADsnJPEOK3Sllsm7Qw+ZRo lqQ4ZdTbEry5NOUtWUSwgRu5Chs0D4zLTfqJMQqYYUoixgF9A6EGeE5/1jkoXS33Aj7T000aGTxgL VF6nnXvwqDGGLV78Loc8qvtIEKsljVXwLS5cEeG/8ca7duZd2Kq++7TDVvX7jNJrfWXoEfAjBKdId JhsxqTsw==; Received: from 108-198-5-147.lightspeed.okcbok.sbcglobal.net ([108.198.5.147]:51064 helo=freyr.lechnology.com) by vern.gendns.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.93) (envelope-from ) id 1kwUd2-0002rB-Pr; Mon, 04 Jan 2021 13:30:52 -0500 From: David Lechner To: linux-arm-kernel@lists.infradead.org Subject: [PATCH 2/2] soc: ti: pruss: add support for AM18XX/OMAP-L138 PRUSS Date: Mon, 4 Jan 2021 12:30:21 -0600 Message-Id: <20210104183021.330112-3-david@lechnology.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210104183021.330112-1-david@lechnology.com> References: <20210104183021.330112-1-david@lechnology.com> MIME-Version: 1.0 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - vern.gendns.com X-AntiAbuse: Original Domain - lists.infradead.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - lechnology.com X-Get-Message-Sender-Via: vern.gendns.com: authenticated_id: davidmain+lechnology.com/only user confirmed/virtual account not confirmed X-Authenticated-Sender: vern.gendns.com: davidmain@lechnology.com X-Source: X-Source-Args: X-Source-Dir: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210104_133135_696447_BA1C0CA0 X-CRM114-Status: GOOD ( 14.38 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, Grzegorz Jaszczyk , David Lechner , Sekhar Nori , linux-kernel@vger.kernel.org, Bartosz Golaszewski , Rob Herring , Santosh Shilimkar Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org This adds support for the PRUSS found in AM18XX/OMAP-L138. This PRUSS doesn't have a CFG register, so that is made optional as selected by the device tree compatible string. ARCH_DAVINCI is added in the Kconfig so that the driver can be selected on that platform. Signed-off-by: David Lechner --- drivers/soc/ti/Kconfig | 2 +- drivers/soc/ti/pruss.c | 76 ++++++++++++++++++++++++------------------ 2 files changed, 45 insertions(+), 33 deletions(-) diff --git a/drivers/soc/ti/Kconfig b/drivers/soc/ti/Kconfig index 7e2fb1c16af1..7a692a21480a 100644 --- a/drivers/soc/ti/Kconfig +++ b/drivers/soc/ti/Kconfig @@ -85,7 +85,7 @@ config TI_K3_SOCINFO config TI_PRUSS tristate "TI PRU-ICSS Subsystem Platform drivers" - depends on SOC_AM33XX || SOC_AM43XX || SOC_DRA7XX || ARCH_KEYSTONE || ARCH_K3 + depends on ARCH_DAVINCI || SOC_AM33XX || SOC_AM43XX || SOC_DRA7XX || ARCH_KEYSTONE || ARCH_K3 select MFD_SYSCON help TI PRU-ICSS Subsystem platform specific support. diff --git a/drivers/soc/ti/pruss.c b/drivers/soc/ti/pruss.c index 5d6e7132a5c4..bfaf3ff74b01 100644 --- a/drivers/soc/ti/pruss.c +++ b/drivers/soc/ti/pruss.c @@ -24,10 +24,12 @@ * struct pruss_private_data - PRUSS driver private data * @has_no_sharedram: flag to indicate the absence of PRUSS Shared Data RAM * @has_core_mux_clock: flag to indicate the presence of PRUSS core clock + * @has_cfg: flag to indicate the presence of PRUSS CFG registers */ struct pruss_private_data { bool has_no_sharedram; bool has_core_mux_clock; + bool has_cfg; }; static void pruss_of_free_clk_provider(void *data) @@ -239,42 +241,44 @@ static int pruss_probe(struct platform_device *pdev) goto rpm_disable; } - child = of_get_child_by_name(np, "cfg"); - if (!child) { - dev_err(dev, "%pOF is missing its 'cfg' node\n", child); - ret = -ENODEV; - goto rpm_put; - } + if (data->has_cfg) { + child = of_get_child_by_name(np, "cfg"); + if (!child) { + dev_err(dev, "%pOF is missing its 'cfg' node\n", child); + ret = -ENODEV; + goto rpm_put; + } - if (of_address_to_resource(child, 0, &res)) { - ret = -ENOMEM; - goto node_put; - } + if (of_address_to_resource(child, 0, &res)) { + ret = -ENOMEM; + goto node_put; + } - pruss->cfg_base = devm_ioremap(dev, res.start, resource_size(&res)); - if (!pruss->cfg_base) { - ret = -ENOMEM; - goto node_put; - } + pruss->cfg_base = devm_ioremap(dev, res.start, resource_size(&res)); + if (!pruss->cfg_base) { + ret = -ENOMEM; + goto node_put; + } - regmap_conf.name = kasprintf(GFP_KERNEL, "%pOFn@%llx", child, - (u64)res.start); - regmap_conf.max_register = resource_size(&res) - 4; - - pruss->cfg_regmap = devm_regmap_init_mmio(dev, pruss->cfg_base, - ®map_conf); - kfree(regmap_conf.name); - if (IS_ERR(pruss->cfg_regmap)) { - dev_err(dev, "regmap_init_mmio failed for cfg, ret = %ld\n", - PTR_ERR(pruss->cfg_regmap)); - ret = PTR_ERR(pruss->cfg_regmap); - goto node_put; - } + regmap_conf.name = kasprintf(GFP_KERNEL, "%pOFn@%llx", child, + (u64)res.start); + regmap_conf.max_register = resource_size(&res) - 4; + + pruss->cfg_regmap = devm_regmap_init_mmio(dev, pruss->cfg_base, + ®map_conf); + kfree(regmap_conf.name); + if (IS_ERR(pruss->cfg_regmap)) { + dev_err(dev, "regmap_init_mmio failed for cfg, ret = %ld\n", + PTR_ERR(pruss->cfg_regmap)); + ret = PTR_ERR(pruss->cfg_regmap); + goto node_put; + } - ret = pruss_clk_init(pruss, child); - if (ret) { - dev_err(dev, "failed to setup coreclk-mux\n"); - goto node_put; + ret = pruss_clk_init(pruss, child); + if (ret) { + dev_err(dev, "failed to setup coreclk-mux\n"); + goto node_put; + } } ret = devm_of_platform_populate(dev); @@ -309,19 +313,27 @@ static int pruss_remove(struct platform_device *pdev) } /* instance-specific driver private data */ +static const struct pruss_private_data am18xx_pruss_data = { + .has_no_sharedram = true, +}; + static const struct pruss_private_data am437x_pruss1_data = { .has_no_sharedram = false, + .has_cfg = true, }; static const struct pruss_private_data am437x_pruss0_data = { .has_no_sharedram = true, + .has_cfg = true, }; static const struct pruss_private_data am65x_j721e_pruss_data = { .has_core_mux_clock = true, + .has_cfg = true, }; static const struct of_device_id pruss_of_match[] = { + { .compatible = "ti,am1806-pruss", .data = &am18xx_pruss_data, }, { .compatible = "ti,am3356-pruss" }, { .compatible = "ti,am4376-pruss0", .data = &am437x_pruss0_data, }, { .compatible = "ti,am4376-pruss1", .data = &am437x_pruss1_data, },