From patchwork Fri Dec 17 10:29:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roger Quadros X-Patchwork-Id: 525393 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 B82D3C433F5 for ; Fri, 17 Dec 2021 10:29:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234986AbhLQK37 (ORCPT ); Fri, 17 Dec 2021 05:29:59 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:46938 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234984AbhLQK36 (ORCPT ); Fri, 17 Dec 2021 05:29:58 -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 61799B82787; Fri, 17 Dec 2021 10:29:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B5A8CC36AEB; Fri, 17 Dec 2021 10:29:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1639736996; bh=u60Gy+HM2Cz89/HOSt7nvfcnD1OA0GjqWTWcgPWp9g8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TyH9WORJA9a0ANLDyP5GYNJJNM3NDiOk2limKfOvgDEOzPLLZTWKtcjQtHC4VbmyB ae5Qm2s/mjcNM5RUY5UkXr9p7RyjafFQ0E2HkGSznnYK5emM68/7eEJPBUwaoV6OCx EQ5Jd748wk3GMWQwR/xJjnejO59cFlR/pdrsflWX89scF9+m7XWs2gG3Ln1JCSrRr6 SC2KgpEVdpXGP+mQ1ik/Vxg6W9KW7wN5vX/7GbBrbwMvPAHIJx3GKCt9g6sx33u05P lLdNupglN+COedh8lQdkuMtMqk8RqZ6A2Em8e+Xm4anvNpBo/6XXh/bOcR5OcND9wh FguEj1hcbV4Xw== From: Roger Quadros To: krzysztof.kozlowski@canonical.com, tony@atomide.com Cc: robh@kernel.org, kishon@ti.com, nm@ti.com, vigneshr@ti.com, linux-omap@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Roger Quadros Subject: [PATCH v3 1/4] dt-bindings: memory-controllers: ti,gpmc: Add compatible for AM64 Date: Fri, 17 Dec 2021 12:29:42 +0200 Message-Id: <20211217102945.17432-2-rogerq@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20211217102945.17432-1-rogerq@kernel.org> References: <20211217102945.17432-1-rogerq@kernel.org> 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. 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 Fri Dec 17 10:29:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roger Quadros X-Patchwork-Id: 525964 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 C55B0C433FE for ; Fri, 17 Dec 2021 10:30:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235025AbhLQKaC (ORCPT ); Fri, 17 Dec 2021 05:30:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43298 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234998AbhLQKaB (ORCPT ); Fri, 17 Dec 2021 05:30:01 -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 87893C06173E; Fri, 17 Dec 2021 02:30:01 -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 51504B82787; Fri, 17 Dec 2021 10:30:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A2F7BC36AE1; Fri, 17 Dec 2021 10:29:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1639736999; bh=MeirT4xGsKt7osRpBz1wQ0uIbtgu/8LH4Sy26maoJnk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sbwo7JFWmmshN6xvIhp6y49zTWllXsbvLvYOP0ZotJzJjDWtVWNPSmzUqeCdFKG0s Yk5NIa63dlFwmTggoGOj06ZanK/eYCT/Zel0396hDXLKhRBih6XeqVREw4XANrkEJX ywhjDqjsyu3oNF3BgYg/ajfEWWGA2n1cJoQqzRgUCQcr4auFGuysKTk90DBO8jYOgA pFElyxL9uQKeXZhaJCiC99V17d5xCgFpGx+6Cpz18kKsza1XPZJA1uLH7dBmVKJ4tq hXTxpGLaD01mrq2djX1I2LO5RJ5CZwmlyrz0suZuz7amRl4yP6fsPFxXbBnyADhWdf hMHUIpe4kVZiQ== From: Roger Quadros To: krzysztof.kozlowski@canonical.com, tony@atomide.com Cc: robh@kernel.org, kishon@ti.com, nm@ti.com, vigneshr@ti.com, linux-omap@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Roger Quadros Subject: [PATCH v3 2/4] memory: omap-gpmc: Add support for GPMC on AM64 SoC Date: Fri, 17 Dec 2021 12:29:43 +0200 Message-Id: <20211217102945.17432-3-rogerq@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20211217102945.17432-1-rogerq@kernel.org> References: <20211217102945.17432-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 Fri Dec 17 10:29:44 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roger Quadros X-Patchwork-Id: 525392 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 92DF2C4332F for ; Fri, 17 Dec 2021 10:30:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235026AbhLQKaE (ORCPT ); Fri, 17 Dec 2021 05:30:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43302 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235014AbhLQKaD (ORCPT ); Fri, 17 Dec 2021 05:30:03 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 44586C06173E; Fri, 17 Dec 2021 02:30:03 -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 dfw.source.kernel.org (Postfix) with ESMTPS id D0CF4620F7; Fri, 17 Dec 2021 10:30:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8FF9AC36AE8; Fri, 17 Dec 2021 10:29:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1639737002; bh=33+oNgZLqDGwuRKfoQVGuh5cPLd3WugMokzWh54u7Sg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AOWtCCx9Lq5tSKEtfCacLJwWBVzGQF2dilHSi3qbWGnGMNv4rbPO6AkFPZOexePBT 0wZwikFaPw8nxQkiyTrzfOFIG+kiHs0UwnG2LRgAOcNCoUVWTz+H4sLj8yXTIRK2bl ypJFsCo+vC7/6DSpfYmoe4ta81PdTgwiM6LcmaASGO+dHs9HX/a1SPepYjyj1yyL8S ETm+pZsW9Z8Z9eiDMhcKHUEqowlNoGlajhA1/U7UVjDr3CYTvg7fgBTl5BxMaSxKP+ /mvvR98NJZRSi7Oy+I7nD0C1TZNcOh+KkntxFPQTSulsXtbCaM+UHheLZ7S8D863LY frfH2NnlnjjGg== From: Roger Quadros To: krzysztof.kozlowski@canonical.com, tony@atomide.com Cc: robh@kernel.org, kishon@ti.com, nm@ti.com, vigneshr@ti.com, linux-omap@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Roger Quadros Subject: [PATCH v3 3/4] memory: omap-gpmc: Use a compatible match table when checking for NAND controller Date: Fri, 17 Dec 2021 12:29:44 +0200 Message-Id: <20211217102945.17432-4-rogerq@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20211217102945.17432-1-rogerq@kernel.org> References: <20211217102945.17432-1-rogerq@kernel.org> Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org As more compatibles can be added to the GPMC NAND controller driver use a compatible match table. Signed-off-by: Roger Quadros --- drivers/memory/omap-gpmc.c | 8 +++++++- drivers/mtd/nand/raw/omap2.c | 2 +- include/linux/platform_data/mtd-nand-omap2.h | 5 +++++ 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/drivers/memory/omap-gpmc.c b/drivers/memory/omap-gpmc.c index 624153048182..814ddb45c13d 100644 --- a/drivers/memory/omap-gpmc.c +++ b/drivers/memory/omap-gpmc.c @@ -2091,6 +2091,7 @@ static int gpmc_probe_generic_child(struct platform_device *pdev, u32 val; struct gpio_desc *waitpin_desc = NULL; struct gpmc_device *gpmc = platform_get_drvdata(pdev); + bool is_nand = false; if (of_property_read_u32(child, "reg", &cs) < 0) { dev_err(&pdev->dev, "%pOF has no 'reg' property\n", @@ -2183,7 +2184,12 @@ static int gpmc_probe_generic_child(struct platform_device *pdev, } } - if (of_device_is_compatible(child, "ti,omap2-nand")) { +#if defined(CONFIG_MTD_NAND_OMAP2) + if (of_match_node(omap_nand_ids, child)) + is_nand = true; +#endif + + if (is_nand) { /* NAND specific setup */ val = 8; of_property_read_u32(child, "nand-bus-width", &val); diff --git a/drivers/mtd/nand/raw/omap2.c b/drivers/mtd/nand/raw/omap2.c index b26d4947af02..fff834ee726f 100644 --- a/drivers/mtd/nand/raw/omap2.c +++ b/drivers/mtd/nand/raw/omap2.c @@ -2352,7 +2352,7 @@ static int omap_nand_remove(struct platform_device *pdev) return ret; } -static const struct of_device_id omap_nand_ids[] = { +const struct of_device_id omap_nand_ids[] = { { .compatible = "ti,omap2-nand", }, {}, }; diff --git a/include/linux/platform_data/mtd-nand-omap2.h b/include/linux/platform_data/mtd-nand-omap2.h index de6ada739121..e1bb90a8db03 100644 --- a/include/linux/platform_data/mtd-nand-omap2.h +++ b/include/linux/platform_data/mtd-nand-omap2.h @@ -61,4 +61,9 @@ struct gpmc_nand_regs { void __iomem *gpmc_bch_result5[GPMC_BCH_NUM_REMAINDER]; void __iomem *gpmc_bch_result6[GPMC_BCH_NUM_REMAINDER]; }; + +#if defined(CONFIG_MTD_NAND_OMAP2) +extern const struct of_device_id omap_nand_ids[]; +#endif + #endif From patchwork Fri Dec 17 10:29:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roger Quadros X-Patchwork-Id: 525963 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 4C723C4332F for ; Fri, 17 Dec 2021 10:30:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235045AbhLQKaI (ORCPT ); Fri, 17 Dec 2021 05:30:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43332 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235046AbhLQKaG (ORCPT ); Fri, 17 Dec 2021 05:30:06 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3E2CDC061747; Fri, 17 Dec 2021 02:30:06 -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 dfw.source.kernel.org (Postfix) with ESMTPS id D10B0620F8; Fri, 17 Dec 2021 10:30:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C1615C36AE1; Fri, 17 Dec 2021 10:30:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1639737005; bh=uf6JxDdnzyqJElQbsppbLQiVy+i5ap0eM73vSTE5d94=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=j2m6fWD84gm/uWtxAAcW2R9O16n/+7XbldeZQqOoeKM8Sv99e+FwhvYigQkKj6KCI 1JE7p2aDk1nKqGb3+IRTahvh7SDoIH7tvTBwjRPGEHP69MJ9YFnyn2Xp6dWNqbxvSd +YFG8GR3/Rs5BGR1Dy1GTqPAAnCTvTJCkhRz/WSukc8KYLTGIXaikIEywRoG6K8Bg5 EYz20zdW2vgX0Euq4hFe81ewYnLKr/eZM8oAdpZeI99hnYfAKHBHLFw0ZbiZjy4dBl jNrX9BgEYweYB8aumuIGerkLuHphr4G9fId9zS4D+O5aPab7DEJeFxT1KEJiIkf5Oa N27AtkY13ckMQ== From: Roger Quadros To: krzysztof.kozlowski@canonical.com, tony@atomide.com Cc: robh@kernel.org, kishon@ti.com, nm@ti.com, vigneshr@ti.com, linux-omap@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Roger Quadros Subject: [PATCH v3 4/4] arm64: arch_k3: Select GPMC device driver Date: Fri, 17 Dec 2021 12:29:45 +0200 Message-Id: <20211217102945.17432-5-rogerq@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20211217102945.17432-1-rogerq@kernel.org> References: <20211217102945.17432-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.