From patchwork Tue Nov 23 10:26:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roger Quadros X-Patchwork-Id: 12633861 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 AA84CC4332F for ; Tue, 23 Nov 2021 10:26:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235353AbhKWK30 (ORCPT ); Tue, 23 Nov 2021 05:29:26 -0500 Received: from mail.kernel.org ([198.145.29.99]:45334 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235333AbhKWK3X (ORCPT ); Tue, 23 Nov 2021 05:29:23 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 1650160FED; Tue, 23 Nov 2021 10:26:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1637663176; bh=GkkzDrPN3gvbRpySqrAoi0o0ncoxYPPz7mEl7oQUqHE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dD3kfBjrm0CDAbNIsdpi0TMkuc20/msC8rBhB92D8d80CHceBtHzk2u2UpnxwEVVJ BmIKV4xLI70pw1TyWTIrVkmFq0kNXABcKTOq+KxsnfCHB/c7goQKcRKwcTOSgRXQrT F76o+Lq7RzbJKg5qNuYIc4IHgsAeINjS450KLRncotv0dtmYo6b1zUeyE2hfKmlyuQ lyyDls3Y9ZeRay9CyOSRiqp53EeClkzzkEsowLxooRyux/loOMHf1k9+dyujQ59yhF pQ2QtBXfGUkTWzB1UlXI0nb01Xba8l9AvU90O0I188sejN4V4ro97g9AmjUaq4B3mF Nw+HdvSE8Q4sQ== 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-kernel@vger.kernel.org, devicetree@vger.kernel.org, Roger Quadros , Rob Herring Subject: [PATCH 1/4] dt-bindings: memory-controllers: ti,gpmc: Add compatible for AM64 Date: Tue, 23 Nov 2021 12:26:02 +0200 Message-Id: <20211123102607.13002-2-rogerq@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20211123102607.13002-1-rogerq@kernel.org> References: <20211123102607.13002-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. Cc: Rob Herring Signed-off-by: Roger Quadros --- .../bindings/memory-controllers/ti,gpmc.yaml | 12 +++++++++++- 1 file changed, 11 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..1869cc6f949b 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 From patchwork Tue Nov 23 10:26:03 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roger Quadros X-Patchwork-Id: 12633863 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 3EC53C433EF for ; Tue, 23 Nov 2021 10:26:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229847AbhKWK30 (ORCPT ); Tue, 23 Nov 2021 05:29:26 -0500 Received: from mail.kernel.org ([198.145.29.99]:45420 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235346AbhKWK30 (ORCPT ); Tue, 23 Nov 2021 05:29:26 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 77F056102A; Tue, 23 Nov 2021 10:26:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1637663178; bh=H9X1abjHl74goFDJmGzOnSvlKUx52sUOVNBBILp1Zpw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bs2Ubfsva/+nTuqEMkfjqO99vjHfLxR72YKz0ElP4uUtrWOmh1NLxTfIyojdAftNu qbf0i1SR4nIzeBNOvfYnaWLYdAOB3EZ05JXYMd0+gzvuJnDm0sz7kchCAB7xFiFUGh VWdofRIvNCWlQ7EJfSrgAlvxHOp9WjYyK4CDJ5nnabitVQkYv8EbJpFbV70fYnDHU2 NLg9lXYMlUOJ+5cSiDay86ybpIHMbJkOh+JREGycSlxGTV9O6YGSGByD4ESllVTIwE fhMLSBcKd+hCbLnwUJKYliHvY4hvx7vebIpHN2UHLrjvlVyvOFZRJ9uohKReMf0bQo k5YSu8/urIbSA== 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-kernel@vger.kernel.org, devicetree@vger.kernel.org, Roger Quadros Subject: [PATCH 2/4] memory: gpmc: Fix menuconfig visibility Date: Tue, 23 Nov 2021 12:26:03 +0200 Message-Id: <20211123102607.13002-3-rogerq@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20211123102607.13002-1-rogerq@kernel.org> References: <20211123102607.13002-1-rogerq@kernel.org> Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org GPMC was not being visible if COMPILE_TEST is not enabled. Signed-off-by: Roger Quadros --- drivers/memory/Kconfig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/memory/Kconfig b/drivers/memory/Kconfig index 30bff6cb1b8d..da2af9c38fe3 100644 --- a/drivers/memory/Kconfig +++ b/drivers/memory/Kconfig @@ -103,8 +103,8 @@ config TI_EMIF temperature changes config OMAP_GPMC - bool "Texas Instruments OMAP SoC GPMC driver" if COMPILE_TEST - depends on OF_ADDRESS + bool "Texas Instruments OMAP SoC GPMC driver" + depends on OF_ADDRESS || COMPILE_TEST select GPIOLIB help This driver is for the General Purpose Memory Controller (GPMC) From patchwork Tue Nov 23 10:26:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roger Quadros X-Patchwork-Id: 12633867 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 251B8C4332F for ; Tue, 23 Nov 2021 10:26:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235485AbhKWK3c (ORCPT ); Tue, 23 Nov 2021 05:29:32 -0500 Received: from mail.kernel.org ([198.145.29.99]:45560 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235420AbhKWK3a (ORCPT ); Tue, 23 Nov 2021 05:29:30 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 1A4FE60F24; Tue, 23 Nov 2021 10:26:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1637663182; bh=MeirT4xGsKt7osRpBz1wQ0uIbtgu/8LH4Sy26maoJnk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Fb32FDXZMGuw2BLfTGGea6MWbsE5bSwgmliZ6uqv1BEloffv6xHM++ggK6y8PfxPd UbRiC+AOna1HTR3J3kCSSzMrXw6nhy4lZhix/KyeeTKTI0smSZoyzFJs80X8s4HRnd Yz44yTasg1GbZJ9Ghft6UZhPvQSIU72nmW1JcgNA9ScpELArDthV3TOhFDKK6pFQtd 6F0KtlBgMMUZ8Mg42qId1cWE4e9rwghhyL9CGIOoOO5pn0tHo2tqqY2jEHJX6WrB9w l0gSYp8LspY0gqvBFyacrdBlhXU2hfjUt3Omii671jQ8stNr99qguy/18GFkbtb9U7 jXOP0EsoN8dLw== 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-kernel@vger.kernel.org, devicetree@vger.kernel.org, Roger Quadros Subject: [PATCH 3/4] memory: omap-gpmc: Add support for GPMC on AM64 SoC Date: Tue, 23 Nov 2021 12:26:05 +0200 Message-Id: <20211123102607.13002-5-rogerq@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20211123102607.13002-1-rogerq@kernel.org> References: <20211123102607.13002-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 Tue Nov 23 10:26:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roger Quadros X-Patchwork-Id: 12633871 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 5BA91C433F5 for ; Tue, 23 Nov 2021 10:26:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235542AbhKWK3k (ORCPT ); Tue, 23 Nov 2021 05:29:40 -0500 Received: from mail.kernel.org ([198.145.29.99]:45678 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235531AbhKWK3f (ORCPT ); Tue, 23 Nov 2021 05:29:35 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 8915961028; Tue, 23 Nov 2021 10:26:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1637663187; bh=qOak39y2UEAkUcWUmmEsOSdOVVwbNbLIXTN1949QVzw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Jz1O/2tGK4lNTWSu3YXh7d5HifIfqk6bH2P6W54aVhuC2E5AlTpYzOMvpkFSXTiEo Bm1/IUkB8zfcft2gnWx4JOBSnH5wtBCBY/hUpemuK2n8s8tFKYUA+DBg26xHphgjAU BKp1A4xLJ8Dx2YxzqDohMJupeBV/sFy9p/imsMn6MMokP4EIXKJURNcueNs+6KB5I9 YrSu5whrs90gTTdN4takLWyH/xrWYbhChRMZABQIzYswE75Nil+rM5HgMe5kiG8nwJ ahYMsOttE3Shjr7EUq5Qy480n2y5BFIOq61juvYKrudIQCPVzY9iqDqmQ1mBQD/KtA 38IPku7s+5fWw== 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-kernel@vger.kernel.org, devicetree@vger.kernel.org, Roger Quadros Subject: [PATCH 4/4] memory: omap-gpmc: check for nand node name instead of just compatibility Date: Tue, 23 Nov 2021 12:26:07 +0200 Message-Id: <20211123102607.13002-7-rogerq@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20211123102607.13002-1-rogerq@kernel.org> References: <20211123102607.13002-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);