From patchwork Tue Dec 21 13:17:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roger Quadros X-Patchwork-Id: 526678 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 DDCE8C433F5 for ; Tue, 21 Dec 2021 13:18:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238106AbhLUNSP (ORCPT ); Tue, 21 Dec 2021 08:18:15 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:53182 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235070AbhLUNSO (ORCPT ); Tue, 21 Dec 2021 08:18:14 -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 72967B80E74; Tue, 21 Dec 2021 13:18:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6040BC36AE2; Tue, 21 Dec 2021 13:18:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1640092692; bh=MeirT4xGsKt7osRpBz1wQ0uIbtgu/8LH4Sy26maoJnk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Zit+Yb7cyDorZ9iSV0bEmdgRNfYpo1kgVyNVeWRoq85n99EIDL8cXIoqMS4XSEtYS nyDFrZQkLxbTMKvd/ZxzariP9NNduubecXv8OSHbqp8MbxambWpfIOP42Y+gD/W+2Y mjij64Ils7tm8CA9O2SXLNurgnEoM/UwYxD2cUlDU7t/PslPHCHkpr1nBvtIvA0pmO eVE5ZjG+GlJB7S0okPMdqGxmOreAKO4yVHs1Ra/3frMyu5WQv/DpXIpQbj8Ajp44Pv pkWj9buEalxcPlxcGYaGreT6cYmxaO/b7Wzfc+emfwhudKDdE+OhU/IdYGxMLQGKvC MVPOsj9UTf61A== From: Roger Quadros To: krzysztof.kozlowski@canonical.com, miquel.raynal@bootlin.com, tony@atomide.com Cc: robh@kernel.org, kishon@ti.com, nm@ti.com, vigneshr@ti.com, linux-mtd@lists.infradead.org, linux-omap@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Roger Quadros Subject: [PATCH v4 2/4] memory: omap-gpmc: Add support for GPMC on AM64 SoC Date: Tue, 21 Dec 2021 15:17:55 +0200 Message-Id: <20211221131757.2030-3-rogerq@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20211221131757.2030-1-rogerq@kernel.org> References: <20211221131757.2030-1-rogerq@kernel.org> Precedence: bulk List-ID: X-Mailing-List: devicetree@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 Dec 21 13:17:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roger Quadros X-Patchwork-Id: 526677 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 E6724C433F5 for ; Tue, 21 Dec 2021 13:18:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238134AbhLUNSW (ORCPT ); Tue, 21 Dec 2021 08:18:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57546 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235070AbhLUNSV (ORCPT ); Tue, 21 Dec 2021 08:18:21 -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 900FBC061574; Tue, 21 Dec 2021 05:18:21 -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 39DB5B816B8; Tue, 21 Dec 2021 13:18:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 27243C36AEB; Tue, 21 Dec 2021 13:18:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1640092699; bh=rmNCe/Fcv2Cch+PQTMUw4LOnj/3R7KOxvik2UJk4xCI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pEIoMBrrKnxFBsjjGjh+jvTnZ/d73gaJabQeSpd+S2Ca2PwMsYNNELGBItT1QPg7Y 2I+CR++g4v7Udhme+dzwaT94Q8yUqdPJn9zMMgJLbSRZagbWtjPM7RsmLvFriYHiSj Lwn/duPfkwmi7k8y7un0OQ34F2MKktBhmnpczr+zaEdZlXBpGmvAid1Kr7vGqbMqHD kumI7u3W6+S8eULAF5ywElvzwozEGUKddGcHIC8h4Nw4nqDJU7x3XSjixQ7nPOD6qE bSBI7wWVzrZowFMP7ssHjruyqArqJpnr8ZeXVZTAC1veUwC/DsWiBZPSDth6UqXEBy pv+wgGOWX9oNw== From: Roger Quadros To: krzysztof.kozlowski@canonical.com, miquel.raynal@bootlin.com, tony@atomide.com Cc: robh@kernel.org, kishon@ti.com, nm@ti.com, vigneshr@ti.com, linux-mtd@lists.infradead.org, linux-omap@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Roger Quadros Subject: [PATCH v4 4/4] mtd: rawnand: omap2: Select GPMC device driver for ARCH_K3 Date: Tue, 21 Dec 2021 15:17:57 +0200 Message-Id: <20211221131757.2030-5-rogerq@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20211221131757.2030-1-rogerq@kernel.org> References: <20211221131757.2030-1-rogerq@kernel.org> Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org The GPMC device driver is required for NAND controller to work on K3 Architecture. Select it if required. Cc: Miquel Raynal Signed-off-by: Roger Quadros --- drivers/mtd/nand/raw/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/mtd/nand/raw/Kconfig b/drivers/mtd/nand/raw/Kconfig index 67b7cb67c030..587f20c6184f 100644 --- a/drivers/mtd/nand/raw/Kconfig +++ b/drivers/mtd/nand/raw/Kconfig @@ -42,6 +42,7 @@ config MTD_NAND_OMAP2 tristate "OMAP2, OMAP3, OMAP4 and Keystone NAND controller" depends on ARCH_OMAP2PLUS || ARCH_KEYSTONE || COMPILE_TEST depends on HAS_IOMEM + select OMAP_GPMC if ARCH_K3 help Support for NAND flash on Texas Instruments OMAP2, OMAP3, OMAP4 and Keystone platforms.