From: Roger Quadros <rogerq@ti.com> To: <tony@atomide.com>, <dwmw2@infradead.org>, <computersforpeace@gmail.com>, <bcousson@baylibre.com> Cc: <ezequiel@vanguardiasur.com.ar>, <linux-mtd@lists.infradead.org>, <linux-omap@vger.kernel.org>, <devicetree@vger.kernel.org>, <linux-kernel@vger.kernel.org>, Roger Quadros <rogerq@ti.com> Subject: [PATCH 10/12] memory: omap-gpmc: Prevent mapping into 1st 16MB Date: Fri, 10 Jul 2015 15:23:37 +0300 [thread overview] Message-ID: <1436531019-18088-11-git-send-email-rogerq@ti.com> (raw) In-Reply-To: <1436531019-18088-1-git-send-email-rogerq@ti.com> We have been preventing mapping GPMC children in the first 1MB but really it has to be the first 16MB as the minimum GPMC partition size is 16MB. Also print an error message if CS mapping fails due to DT requesting address outside the GPMC map. Signed-off-by: Roger Quadros <rogerq@ti.com> --- drivers/memory/omap-gpmc.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/drivers/memory/omap-gpmc.c b/drivers/memory/omap-gpmc.c index f19edc2..8b434fc 100644 --- a/drivers/memory/omap-gpmc.c +++ b/drivers/memory/omap-gpmc.c @@ -80,6 +80,14 @@ #define GPMC_CS_SIZE 0x30 #define GPMC_BCH_SIZE 0x10 +/* + * The first 1MB of GPMC address space is typically mapped to + * the internal ROM. Never allocate the first page, to + * facilitate bug detection; even if we didn't boot from ROM. + * As GPMC minimum partition size is 16MB we can only start from + * there. + */ +#define GPMC_MEM_START 0x1000000 #define GPMC_MEM_END 0x3FFFFFFF #define GPMC_CHUNK_SHIFT 24 /* 16 MB */ @@ -1012,12 +1020,7 @@ static void gpmc_mem_init(void) { int cs; - /* - * The first 1MB of GPMC address space is typically mapped to - * the internal ROM. Never allocate the first page, to - * facilitate bug detection; even if we didn't boot from ROM. - */ - gpmc_mem_root.start = SZ_1M; + gpmc_mem_root.start = GPMC_MEM_START; gpmc_mem_root.end = GPMC_MEM_END; /* Reserve all regions that has been set up by bootloader */ @@ -1671,6 +1674,15 @@ static int gpmc_probe_generic_child(struct platform_device *pdev, if (ret < 0) { dev_err(&pdev->dev, "cannot remap GPMC CS %d to %pa\n", cs, &res.start); + if (res.start < GPMC_MEM_START) { + dev_info(&pdev->dev, + "GPMC CS %d start cannot be lesser than 0x%x\n", + cs, GPMC_MEM_START); + } else if (res.end > GPMC_MEM_END) { + dev_info(&pdev->dev, + "GPMC CS %d end cannot be greater than 0x%x\n", + cs, GPMC_MEM_END); + } goto err; } -- 2.1.4
WARNING: multiple messages have this Message-ID (diff)
From: Roger Quadros <rogerq@ti.com> To: tony@atomide.com, dwmw2@infradead.org, computersforpeace@gmail.com, bcousson@baylibre.com Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mtd@lists.infradead.org, ezequiel@vanguardiasur.com.ar, linux-omap@vger.kernel.org, Roger Quadros <rogerq@ti.com> Subject: [PATCH 10/12] memory: omap-gpmc: Prevent mapping into 1st 16MB Date: Fri, 10 Jul 2015 15:23:37 +0300 [thread overview] Message-ID: <1436531019-18088-11-git-send-email-rogerq@ti.com> (raw) In-Reply-To: <1436531019-18088-1-git-send-email-rogerq@ti.com> We have been preventing mapping GPMC children in the first 1MB but really it has to be the first 16MB as the minimum GPMC partition size is 16MB. Also print an error message if CS mapping fails due to DT requesting address outside the GPMC map. Signed-off-by: Roger Quadros <rogerq@ti.com> --- drivers/memory/omap-gpmc.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/drivers/memory/omap-gpmc.c b/drivers/memory/omap-gpmc.c index f19edc2..8b434fc 100644 --- a/drivers/memory/omap-gpmc.c +++ b/drivers/memory/omap-gpmc.c @@ -80,6 +80,14 @@ #define GPMC_CS_SIZE 0x30 #define GPMC_BCH_SIZE 0x10 +/* + * The first 1MB of GPMC address space is typically mapped to + * the internal ROM. Never allocate the first page, to + * facilitate bug detection; even if we didn't boot from ROM. + * As GPMC minimum partition size is 16MB we can only start from + * there. + */ +#define GPMC_MEM_START 0x1000000 #define GPMC_MEM_END 0x3FFFFFFF #define GPMC_CHUNK_SHIFT 24 /* 16 MB */ @@ -1012,12 +1020,7 @@ static void gpmc_mem_init(void) { int cs; - /* - * The first 1MB of GPMC address space is typically mapped to - * the internal ROM. Never allocate the first page, to - * facilitate bug detection; even if we didn't boot from ROM. - */ - gpmc_mem_root.start = SZ_1M; + gpmc_mem_root.start = GPMC_MEM_START; gpmc_mem_root.end = GPMC_MEM_END; /* Reserve all regions that has been set up by bootloader */ @@ -1671,6 +1674,15 @@ static int gpmc_probe_generic_child(struct platform_device *pdev, if (ret < 0) { dev_err(&pdev->dev, "cannot remap GPMC CS %d to %pa\n", cs, &res.start); + if (res.start < GPMC_MEM_START) { + dev_info(&pdev->dev, + "GPMC CS %d start cannot be lesser than 0x%x\n", + cs, GPMC_MEM_START); + } else if (res.end > GPMC_MEM_END) { + dev_info(&pdev->dev, + "GPMC CS %d end cannot be greater than 0x%x\n", + cs, GPMC_MEM_END); + } goto err; } -- 2.1.4 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/
next prev parent reply other threads:[~2015-07-10 12:25 UTC|newest] Thread overview: 68+ messages / expand[flat|nested] mbox.gz Atom feed top 2015-07-10 12:23 [PATCH 00/12] ARM: omap: mtd: nand: Support GPMC NAND on non-OMAP platforms Roger Quadros 2015-07-10 12:23 ` Roger Quadros 2015-07-10 12:23 ` [PATCH 01/12] ARM: OMAP2+: gpmc: Add platform data Roger Quadros 2015-07-10 12:23 ` Roger Quadros 2015-07-10 12:23 ` [PATCH 02/12] ARM: OMAP2+: gpmc: Add gpmc timings and settings to " Roger Quadros 2015-07-10 12:23 ` Roger Quadros 2015-07-13 13:31 ` Tony Lindgren 2015-07-13 13:31 ` Tony Lindgren 2015-07-13 13:34 ` Roger Quadros 2015-07-13 13:34 ` Roger Quadros 2015-07-10 12:23 ` [PATCH 03/12] mtd: nand: omap: Move IRQ handling from GPMC to NAND driver Roger Quadros 2015-07-10 12:23 ` Roger Quadros 2015-07-13 7:10 ` Tony Lindgren 2015-07-13 10:04 ` Roger Quadros 2015-07-13 10:04 ` Roger Quadros 2015-07-13 12:40 ` Tony Lindgren 2015-07-13 12:51 ` nick 2015-07-13 12:51 ` nick 2015-07-13 13:01 ` Tony Lindgren 2015-07-13 13:01 ` Tony Lindgren 2015-07-13 13:03 ` nick 2015-07-13 13:03 ` nick 2015-07-13 13:12 ` Roger Quadros 2015-07-13 13:12 ` Roger Quadros 2015-07-13 13:15 ` nick 2015-07-13 13:15 ` nick 2015-07-13 13:21 ` Roger Quadros 2015-07-13 13:21 ` Roger Quadros 2015-07-13 13:32 ` nick 2015-07-13 13:32 ` nick 2015-07-13 13:35 ` Roger Quadros 2015-07-13 13:35 ` Roger Quadros 2015-07-29 12:06 ` Roger Quadros 2015-07-29 12:06 ` Roger Quadros 2015-07-29 12:13 ` nick 2015-07-29 12:13 ` nick 2015-07-29 13:52 ` Roger Quadros 2015-07-29 13:52 ` Roger Quadros 2015-07-29 14:08 ` nick 2015-07-29 14:08 ` nick 2015-07-29 15:12 ` Roger Quadros 2015-07-29 15:12 ` Roger Quadros 2015-07-29 15:26 ` nick 2015-07-29 15:26 ` nick 2015-07-29 15:39 ` Roger Quadros 2015-07-29 15:39 ` Roger Quadros 2015-07-31 10:21 ` Roger Quadros 2015-07-31 10:21 ` Roger Quadros 2015-08-03 13:08 ` Tony Lindgren 2015-08-03 13:08 ` Tony Lindgren 2015-07-10 12:23 ` [PATCH 04/12] mtd: nand: omap: Move gpmc_update_nand_reg to nand driver Roger Quadros 2015-07-10 12:23 ` Roger Quadros 2015-07-10 12:23 ` [PATCH 05/12] mtd: nand: omap: Move NAND write protect code from GPMC to NAND driver Roger Quadros 2015-07-10 12:23 ` Roger Quadros 2015-07-10 12:23 ` [PATCH 06/12] mtd: nand: omap: Copy platform data parameters to omap_nand_info data Roger Quadros 2015-07-10 12:23 ` Roger Quadros 2015-07-10 12:23 ` [PATCH 07/12] mtd: nand: omap: Clean up device tree support Roger Quadros 2015-07-10 12:23 ` Roger Quadros 2015-07-10 12:23 ` [PATCH 08/12] mtd: nand: omap: Update DT binding documentation Roger Quadros 2015-07-10 12:23 ` Roger Quadros 2015-07-10 12:23 ` [PATCH 09/12] memory: omap-gpmc: use module_platform_driver() Roger Quadros 2015-07-10 12:23 ` Roger Quadros 2015-07-10 12:23 ` Roger Quadros [this message] 2015-07-10 12:23 ` [PATCH 10/12] memory: omap-gpmc: Prevent mapping into 1st 16MB Roger Quadros 2015-07-10 12:23 ` [PATCH 11/12] ARM: dts: OMAP2+: Fix NAND device nodes Roger Quadros 2015-07-10 12:23 ` Roger Quadros 2015-07-10 12:23 ` [PATCH 12/12] ARM: dts: omap3: Fix gpmc memory resource size Roger Quadros 2015-07-10 12:23 ` Roger Quadros
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=1436531019-18088-11-git-send-email-rogerq@ti.com \ --to=rogerq@ti.com \ --cc=bcousson@baylibre.com \ --cc=computersforpeace@gmail.com \ --cc=devicetree@vger.kernel.org \ --cc=dwmw2@infradead.org \ --cc=ezequiel@vanguardiasur.com.ar \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-mtd@lists.infradead.org \ --cc=linux-omap@vger.kernel.org \ --cc=tony@atomide.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.