From patchwork Wed Dec 8 12:46:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roger Quadros X-Patchwork-Id: 12664371 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AE9E1C433EF for ; Wed, 8 Dec 2021 12:46:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233631AbhLHMtz (ORCPT ); Wed, 8 Dec 2021 07:49:55 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:44644 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231921AbhLHMtx (ORCPT ); Wed, 8 Dec 2021 07:49:53 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 37E7AB820EA; Wed, 8 Dec 2021 12:46:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 27E00C00446; Wed, 8 Dec 2021 12:46:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1638967578; bh=DFWSlBQApudaZyIitt6ZnYtGk6Slx0oJzrBSIjiftMw=; h=From:To:Cc:Subject:Date:From; b=jWsFbhfE/03Mjt0c3JTa3BFsOfXr/SFmFE7h8mNZ5UNdHxt6thLjtgi69OUb3VLG8 CnIKAo3ZJ64eAIi41qgY29BqTiwwRQIYDlcw1tZNzpgXIbzEFiK5zj6KL8B/Ta/PA3 zMtc38v7smm2VS4q4594LCSwsdegV2NS2YJxVd/nUjdQSyspNtB3ACFpLKqJZdZ5Zc HEzLp7rWSA9zEgU/BgrFFu3WCaXqtkzKoPuZnePtQPTn8n4ACYLL4JL+ZwuqVbRz52 Fq7lCtNcusYbVf0J4VEKGww+tMXkvNRggUZtDJCYDlIMbT3H0yoNSUpz1HOUDyVowY sP7fthj54nJBg== From: Roger Quadros To: krzysztof.kozlowski@canonical.com, tony@atomide.com Cc: kishon@ti.com, nm@ti.com, vigneshr@ti.com, linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Roger Quadros , Rob Herring Subject: [PATCH v2 1/4] dt-bindings: memory-controllers: ti,gpmc: Add compatible for AM64 Date: Wed, 8 Dec 2021 14:46:08 +0200 Message-Id: <20211208124611.16843-1-rogerq@kernel.org> X-Mailer: git-send-email 2.17.1 Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org AM64 SoC contains the GPMC module. Add compatible for it. Newer SoCs don't necessarily map GPMC data region at the same place as legacy SoCs. Add reg-names "data", to provide this information to the device driver. Cc: Rob Herring Signed-off-by: Roger Quadros Reviewed-by: Rob Herring --- .../bindings/memory-controllers/ti,gpmc.yaml | 23 ++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/memory-controllers/ti,gpmc.yaml b/Documentation/devicetree/bindings/memory-controllers/ti,gpmc.yaml index 25b42d68f9b3..64dc9d398d9a 100644 --- a/Documentation/devicetree/bindings/memory-controllers/ti,gpmc.yaml +++ b/Documentation/devicetree/bindings/memory-controllers/ti,gpmc.yaml @@ -23,13 +23,20 @@ properties: items: - enum: - ti,am3352-gpmc + - ti,am64-gpmc - ti,omap2420-gpmc - ti,omap2430-gpmc - ti,omap3430-gpmc - ti,omap4430-gpmc reg: - maxItems: 1 + minItems: 1 + maxItems: 2 + + reg-names: + items: + - const: cfg + - const: data interrupts: maxItems: 1 @@ -44,6 +51,9 @@ properties: items: - const: fck + power-domains: + maxItems: 1 + dmas: items: - description: DMA channel for GPMC NAND prefetch @@ -133,6 +143,17 @@ required: - "#address-cells" - "#size-cells" +allOf: + - if: + properties: + compatible: + contains: + const: ti,am64-gpmc + then: + required: + - reg-names + - power-domains + additionalProperties: false examples: From patchwork Wed Dec 8 12:46:09 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roger Quadros X-Patchwork-Id: 12664373 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 189EFC43217 for ; Wed, 8 Dec 2021 12:46:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233676AbhLHMt5 (ORCPT ); Wed, 8 Dec 2021 07:49:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45228 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233662AbhLHMt4 (ORCPT ); Wed, 8 Dec 2021 07:49:56 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 40FFBC061746; Wed, 8 Dec 2021 04:46:24 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 00225B81F79; Wed, 8 Dec 2021 12:46:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 54F97C341CB; Wed, 8 Dec 2021 12:46:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1638967581; bh=MeirT4xGsKt7osRpBz1wQ0uIbtgu/8LH4Sy26maoJnk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oGlN/97yWbTKVJrFno55L5j1wjZdFwWoeKQGFEQXOjqwa3zlF7HLQ+okCom0Hbz39 RTpYamAOB8dy4f5ha9ZYOOvGOdouOMiFVbEKDnA9DCi9kzDZLGosKSbAFLUWFJKOPd oAXz3T9tVoc8rxQmSRUOrMW/4zmVg525G9crr+ukBwGTPOcKxsgYVBMR3+hCYuEvzj 4ogg/NtJRXgg+CaDaf7OEeH4YBe+rNKy5FijyGQor4g4XD7Rhd0rDTEzwU2lZhZlKs N/+8+gbEGdlPSALYgtLGmstSbFlf4fNBqPY2tpIsC/gMbAkOJaa79vBh6Gt7veA5Sl xMf1ozFpH/7rQ== From: Roger Quadros To: krzysztof.kozlowski@canonical.com, tony@atomide.com Cc: kishon@ti.com, nm@ti.com, vigneshr@ti.com, linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Roger Quadros Subject: [PATCH v2 2/4] memory: omap-gpmc: Add support for GPMC on AM64 SoC Date: Wed, 8 Dec 2021 14:46:09 +0200 Message-Id: <20211208124611.16843-2-rogerq@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20211208124611.16843-1-rogerq@kernel.org> References: <20211208124611.16843-1-rogerq@kernel.org> Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org The TI's AM64 SoC has the GPMC module. Add compatible for it. Traditionally GPMC external addresses have always been mapped to first 1GB physical address. However newer platforms, can have it mapped at different locations. Support this address provision via device tree. Signed-off-by: Roger Quadros --- drivers/memory/omap-gpmc.c | 40 ++++++++++++++++++++++++++++---------- 1 file changed, 30 insertions(+), 10 deletions(-) diff --git a/drivers/memory/omap-gpmc.c b/drivers/memory/omap-gpmc.c index be0858bff4d3..624153048182 100644 --- a/drivers/memory/omap-gpmc.c +++ b/drivers/memory/omap-gpmc.c @@ -237,6 +237,7 @@ struct gpmc_device { struct omap3_gpmc_regs context; int nirqs; unsigned int is_suspended:1; + struct resource *data; }; static struct irq_domain *gpmc_irq_domain; @@ -1456,12 +1457,18 @@ static void gpmc_mem_exit(void) } } -static void gpmc_mem_init(void) +static void gpmc_mem_init(struct gpmc_device *gpmc) { int cs; - gpmc_mem_root.start = GPMC_MEM_START; - gpmc_mem_root.end = GPMC_MEM_END; + if (!gpmc->data) { + /* All legacy devices have same data IO window */ + gpmc_mem_root.start = GPMC_MEM_START; + gpmc_mem_root.end = GPMC_MEM_END; + } else { + gpmc_mem_root.start = gpmc->data->start; + gpmc_mem_root.end = gpmc->data->end; + } /* Reserve all regions that has been set up by bootloader */ for (cs = 0; cs < gpmc_cs_num; cs++) { @@ -1888,6 +1895,7 @@ static const struct of_device_id gpmc_dt_ids[] = { { .compatible = "ti,omap3430-gpmc" }, /* omap3430 & omap3630 */ { .compatible = "ti,omap4430-gpmc" }, /* omap4430 & omap4460 & omap543x */ { .compatible = "ti,am3352-gpmc" }, /* am335x devices */ + { .compatible = "ti,am64-gpmc" }, { } }; @@ -2502,13 +2510,25 @@ static int gpmc_probe(struct platform_device *pdev) gpmc->dev = &pdev->dev; platform_set_drvdata(pdev, gpmc); - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!res) - return -ENOENT; + res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "cfg"); + if (!res) { + /* legacy DT */ + gpmc_base = devm_platform_ioremap_resource(pdev, 0); + if (IS_ERR(gpmc_base)) + return PTR_ERR(gpmc_base); + } else { + gpmc_base = devm_ioremap_resource(&pdev->dev, res); + if (IS_ERR(gpmc_base)) + return PTR_ERR(gpmc_base); + + res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "data"); + if (!res) { + dev_err(&pdev->dev, "couldn't get data reg resource\n"); + return -ENOENT; + } - gpmc_base = devm_ioremap_resource(&pdev->dev, res); - if (IS_ERR(gpmc_base)) - return PTR_ERR(gpmc_base); + gpmc->data = res; + } res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); if (!res) { @@ -2562,7 +2582,7 @@ static int gpmc_probe(struct platform_device *pdev) dev_info(gpmc->dev, "GPMC revision %d.%d\n", GPMC_REVISION_MAJOR(l), GPMC_REVISION_MINOR(l)); - gpmc_mem_init(); + gpmc_mem_init(gpmc); rc = gpmc_gpio_init(gpmc); if (rc) goto gpio_init_failed; From patchwork Wed Dec 8 12:46:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roger Quadros X-Patchwork-Id: 12664375 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B8C8FC433FE for ; Wed, 8 Dec 2021 12:46:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233686AbhLHMt7 (ORCPT ); Wed, 8 Dec 2021 07:49:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45242 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233683AbhLHMt6 (ORCPT ); Wed, 8 Dec 2021 07:49:58 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1F24BC0617A1; Wed, 8 Dec 2021 04:46:27 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id E0FC4B81F79; Wed, 8 Dec 2021 12:46:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4B9AFC341C7; Wed, 8 Dec 2021 12:46:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1638967584; bh=qOak39y2UEAkUcWUmmEsOSdOVVwbNbLIXTN1949QVzw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eA02PeOvYp9E2APv9D7iHgwK7X/dHdpLAWQjVFxpSiecQfgA1CluPieCYaRlijyD+ MjiW94IYqeBhliZlAj02fGSX22w9Hk4BP9NFJME+/iPvPGdNHtYDBqJC6QIOMQdG8T rpxp01IBAur5VhEP/X5ED/SvQBNJL0IX6xe/MjivknpXp141TO2YP6L8/y5waUEw8I 74U59PvCRP341FzVna/boE0mFgKQyximrF9PfoTU96SyX3SYNZJbF9guGy+wzrxLL4 LrWtpdmarVM8Ac9dpo6BDu78vP6xIyzMFawTFaxGfE2JCYPwfqlvL4wOb20qDOwk2k YFslcUamV3RKQ== From: Roger Quadros To: krzysztof.kozlowski@canonical.com, tony@atomide.com Cc: kishon@ti.com, nm@ti.com, vigneshr@ti.com, linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Roger Quadros Subject: [PATCH v2 3/4] memory: omap-gpmc: check for nand node name instead of just compatibility Date: Wed, 8 Dec 2021 14:46:10 +0200 Message-Id: <20211208124611.16843-3-rogerq@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20211208124611.16843-1-rogerq@kernel.org> References: <20211208124611.16843-1-rogerq@kernel.org> Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org We have added new compatibles for controller so just checking for "ti,omap2-nand" compatible is not enough. Check for "nand" node name as well. Signed-off-by: Roger Quadros --- drivers/memory/omap-gpmc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/memory/omap-gpmc.c b/drivers/memory/omap-gpmc.c index 624153048182..9f0062a262db 100644 --- a/drivers/memory/omap-gpmc.c +++ b/drivers/memory/omap-gpmc.c @@ -2183,7 +2183,8 @@ static int gpmc_probe_generic_child(struct platform_device *pdev, } } - if (of_device_is_compatible(child, "ti,omap2-nand")) { + if (of_device_is_compatible(child, "ti,omap2-nand") || + of_node_name_eq(child, "nand")) { /* NAND specific setup */ val = 8; of_property_read_u32(child, "nand-bus-width", &val); From patchwork Wed Dec 8 12:46:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roger Quadros X-Patchwork-Id: 12664377 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 44137C433EF for ; Wed, 8 Dec 2021 12:46:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233711AbhLHMuD (ORCPT ); Wed, 8 Dec 2021 07:50:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45272 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233662AbhLHMuC (ORCPT ); Wed, 8 Dec 2021 07:50:02 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 21800C061746; Wed, 8 Dec 2021 04:46:30 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id DFB3CB81F79; Wed, 8 Dec 2021 12:46:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3E570C341C3; Wed, 8 Dec 2021 12:46:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1638967587; bh=uf6JxDdnzyqJElQbsppbLQiVy+i5ap0eM73vSTE5d94=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=p9jQomTAPi9TsgGgqYNNVfKKHiDmpjZM9GJCQDnLj9BAopHck6E6GsczJ7gN+IIiz /hPbWVQ+GHSe5kAkDsVKhOU31SNC+TVekRnBhnj73bYTSGFDkQrxSo3a7hnNByRDim ATKylPzARZ8Nm5oKnTmthQfsheC5me91tVMUFRRPNqdlkV0kU88cw6NDIhx3CqxZaS naM7MJ60xGJVDPow/6Cza8D/tOwrsLAKx9LTZcK/I/wQGd1FbSY/7s4l4U5d4laNS/ 1LSags3INEDIsc7paGenzcWjnEDtSSdo0DSB/0/XGbF+773BbPgy12UqLcSoLbFcuG rDu9jwi6nY5uw== From: Roger Quadros To: krzysztof.kozlowski@canonical.com, tony@atomide.com Cc: kishon@ti.com, nm@ti.com, vigneshr@ti.com, linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Roger Quadros Subject: [PATCH v2 4/4] arm64: arch_k3: Select GPMC device driver Date: Wed, 8 Dec 2021 14:46:11 +0200 Message-Id: <20211208124611.16843-4-rogerq@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20211208124611.16843-1-rogerq@kernel.org> References: <20211208124611.16843-1-rogerq@kernel.org> Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org The GPMC controller is present on some K3 SoCs. It provides access to NOR/NAND flashes and asynchronous SRAM-like memories and ASICs. Signed-off-by: Roger Quadros --- arch/arm64/Kconfig.platforms | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm64/Kconfig.platforms b/arch/arm64/Kconfig.platforms index 1aa8b7073218..f447b120f863 100644 --- a/arch/arm64/Kconfig.platforms +++ b/arch/arm64/Kconfig.platforms @@ -122,6 +122,7 @@ config ARCH_K3 select TI_SCI_INTR_IRQCHIP select TI_SCI_INTA_IRQCHIP select TI_K3_SOCINFO + select OMAP_GPMC help This enables support for Texas Instruments' K3 multicore SoC architecture.