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=-15.5 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,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham 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 01435C433DB for ; Sat, 16 Jan 2021 00:54:09 +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 AE35C20776 for ; Sat, 16 Jan 2021 00:54:08 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AE35C20776 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=ti.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:In-Reply-To:MIME-Version:Date:Message-ID:From: References:To:Subject:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=QF6e863sP0Hb4COT+zmigZyQIlPbrcrIB+Fa/bHuQws=; b=XXZkY5ToKSlrE0Y3TUqelUpMN bpRx4HadQHgRcZPG15SOVClVd6TaF6qktRIM5r1Ym3L9VSpZCJm2H5NrdXDhSHwTvKOYzaO6nybwS VpuUm5+ygVpNm23w1qH4xbkxeR7dP7YirNa9Ft6IPbdN9XpmCjo+Z4u2trkeRwkqx1+WzngDQ++/9 8e6cSQmtCEBcpLSmVxXaQGUMCi/ziLlkGybDrTQ1YZu1r3MFA8/FaMkeSIIQPrPPa5fBU02DIle71 ah3tSAYj+1nUtZdXjSZbM+jmO7ntjrB2v4LVnumR92SfZub3pWsYjrDDBoc6Kxbl4nGdHjmL+m0Ti 08JD67lBA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l0Zpk-0001DM-9j; Sat, 16 Jan 2021 00:52:52 +0000 Received: from fllv0015.ext.ti.com ([198.47.19.141]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1l0Zph-0001Cr-4l for linux-arm-kernel@lists.infradead.org; Sat, 16 Jan 2021 00:52:50 +0000 Received: from fllv0034.itg.ti.com ([10.64.40.246]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id 10G0q3Hp126853; Fri, 15 Jan 2021 18:52:03 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1610758323; bh=DzUbwP7nb2tbbYzvsD7uYmHzOGYXMnQzBTsU5fUEmLc=; h=Subject:To:CC:References:From:Date:In-Reply-To; b=YiVhyya3xnv9/xRWTbhQF2BFkr+rVWx3I4B12TtoeZ89ACUycTOtwC3fNAGd6iJlP 8Sx71tUG82TVFf4ayS9E+0xwfcCHsH3h1IXEQYLwPyRY5Zuf8Ke8nGhp3sQH/VqXfK I4VEMS0RE9ucn5YWhfOuBs7iZ/hXzPj8B3rujoiw= Received: from DLEE108.ent.ti.com (dlee108.ent.ti.com [157.170.170.38]) by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 10G0q3ar055654 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 15 Jan 2021 18:52:03 -0600 Received: from DLEE115.ent.ti.com (157.170.170.26) by DLEE108.ent.ti.com (157.170.170.38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3; Fri, 15 Jan 2021 18:52:03 -0600 Received: from lelv0327.itg.ti.com (10.180.67.183) by DLEE115.ent.ti.com (157.170.170.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3 via Frontend Transport; Fri, 15 Jan 2021 18:52:03 -0600 Received: from [10.250.34.42] (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0327.itg.ti.com (8.15.2/8.15.2) with ESMTP id 10G0q2ib113879; Fri, 15 Jan 2021 18:52:02 -0600 Subject: Re: [PATCH 2/2] soc: ti: pruss: add support for AM18XX/OMAP-L138 PRUSS To: David Lechner , References: <20210104183021.330112-1-david@lechnology.com> <20210104183021.330112-3-david@lechnology.com> From: Suman Anna Message-ID: <4b60b60b-7e59-28fb-dc3a-f3f097e4cc8a@ti.com> Date: Fri, 15 Jan 2021 18:52:02 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20210104183021.330112-3-david@lechnology.com> Content-Language: en-US X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210115_195249_574940_F053D23B X-CRM114-Status: GOOD ( 28.59 ) 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 , Sekhar Nori , linux-kernel@vger.kernel.org, Bartosz Golaszewski , Rob Herring , Santosh Shilimkar Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi David, On 1/4/21 12:30 PM, David Lechner wrote: > 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 I recommend to change this to a negative flag as the Davinci platforms are the only ones that don't have CFG (being the very first SoCs with a PRUSS IP) sub-module. > */ > 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; > } > And use it here to skip all the cfg code parsing. All the below delta is just for the additional indentation for the flag. If you don't like goto's in non-error paths, then we can refactor the CFG parse code into a separate function. regards Suman > - 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, }, > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel