linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: shc_work@mail.ru (Alexander Shiyan)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v3 15/18] ARM: clps711x: edb7211: Add support for NOR-Flash
Date: Sat, 17 Nov 2012 17:57:21 +0400	[thread overview]
Message-ID: <1353160644-22446-16-git-send-email-shc_work@mail.ru> (raw)
In-Reply-To: <1353160644-22446-1-git-send-email-shc_work@mail.ru>


Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
---
 arch/arm/mach-clps711x/edb7211.c               |   45 ++++++++++++++++++-----
 arch/arm/mach-clps711x/include/mach/hardware.h |    4 --
 2 files changed, 35 insertions(+), 14 deletions(-)

diff --git a/arch/arm/mach-clps711x/edb7211.c b/arch/arm/mach-clps711x/edb7211.c
index d5832b3..71aa5cf 100644
--- a/arch/arm/mach-clps711x/edb7211.c
+++ b/arch/arm/mach-clps711x/edb7211.c
@@ -16,6 +16,9 @@
 #include <linux/backlight.h>
 #include <linux/platform_device.h>
 
+#include <linux/mtd/physmap.h>
+#include <linux/mtd/partitions.h>
+
 #include <asm/setup.h>
 #include <asm/mach/map.h>
 #include <asm/mach/arch.h>
@@ -33,6 +36,8 @@
 #define EDB7211_LCDEN		CLPS711X_GPIO(3, 2)
 #define EDB7211_LCDBL		CLPS711X_GPIO(3, 3)
 
+#define EDB7211_FLASH0_BASE	(CS0_PHYS_BASE)
+#define EDB7211_FLASH1_BASE	(CS1_PHYS_BASE)
 #define EDB7211_CS8900_BASE	(CS2_PHYS_BASE + 0x300)
 #define EDB7211_CS8900_IRQ	(IRQ_EINT3)
 
@@ -41,6 +46,35 @@ static struct resource edb7211_cs8900_resource[] __initdata = {
 	DEFINE_RES_IRQ(EDB7211_CS8900_IRQ),
 };
 
+static struct mtd_partition edb7211_flash_partitions[] __initdata = {
+	{
+		.name	= "Flash",
+		.offset	= 0,
+		.size	= MTDPART_SIZ_FULL,
+	},
+};
+
+static struct physmap_flash_data edb7211_flash_pdata __initdata = {
+	.width		= 4,
+	.parts		= edb7211_flash_partitions,
+	.nr_parts	= ARRAY_SIZE(edb7211_flash_partitions),
+};
+
+static struct resource edb7211_flash_resources[] __initdata = {
+	DEFINE_RES_MEM(EDB7211_FLASH0_BASE, SZ_8M),
+	DEFINE_RES_MEM(EDB7211_FLASH1_BASE, SZ_8M),
+};
+
+static struct platform_device edb7211_flash_pdev __initdata = {
+	.name		= "physmap-flash",
+	.id		= 0,
+	.resource	= edb7211_flash_resources,
+	.num_resources	= ARRAY_SIZE(edb7211_flash_resources),
+	.dev	= {
+		.platform_data	= &edb7211_flash_pdata,
+	},
+};
+
 static void edb7211_lcd_power_set(struct plat_lcd_data *pd, unsigned int power)
 {
 	if (power) {
@@ -82,16 +116,6 @@ static struct map_desc edb7211_io_desc[] __initdata = {
 		.pfn		= __phys_to_pfn(EP7211_PHYS_EXTKBD),
 		.length		= SZ_1M,
 		.type		= MT_DEVICE,
-	}, {	/* Flash bank 0 */
-		.virtual	= IO_ADDRESS(EP7211_PHYS_FLASH1),
-		.pfn		= __phys_to_pfn(EP7211_PHYS_FLASH1),
-		.length		= SZ_8M,
-		.type		= MT_DEVICE,
-	}, {	/* Flash bank 1 */
-		.virtual	= IO_ADDRESS(EP7211_PHYS_FLASH2),
-		.pfn		= __phys_to_pfn(EP7211_PHYS_FLASH2),
-		.length		= SZ_8M,
-		.type		= MT_DEVICE,
 	},
 };
 
@@ -129,6 +153,7 @@ static void __init edb7211_init(void)
 {
 	gpio_request_array(edb7211_gpios, ARRAY_SIZE(edb7211_gpios));
 
+	platform_device_register(&edb7211_flash_pdev);
 	platform_device_register_data(&platform_bus, "platform-lcd", 0,
 				      &edb7211_lcd_power_pdata,
 				      sizeof(edb7211_lcd_power_pdata));
diff --git a/arch/arm/mach-clps711x/include/mach/hardware.h b/arch/arm/mach-clps711x/include/mach/hardware.h
index 1ebf7b9..2f23dd5 100644
--- a/arch/arm/mach-clps711x/include/mach/hardware.h
+++ b/arch/arm/mach-clps711x/include/mach/hardware.h
@@ -75,10 +75,6 @@
 /* The extra 8 lines of the keyboard matrix are wired to chip select 3 */
 #define EP7211_PHYS_EXTKBD	CS3_PHYS_BASE
 
-/* The two flash banks are wired to chip selects 0 and 1 */
-#define EP7211_PHYS_FLASH1	CS0_PHYS_BASE
-#define EP7211_PHYS_FLASH2	CS1_PHYS_BASE
-
 #endif /* CONFIG_ARCH_EDB7211 */
 
 #endif
-- 
1.7.8.6

  parent reply	other threads:[~2012-11-17 13:57 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-17 13:57 [PATCH v3 00/18] ARM: Patchset for CLPS711X Alexander Shiyan
2012-11-17 13:57 ` [PATCH v3 01/18] ARM: clps711x: Using platform_driver for ethernet device Alexander Shiyan
2012-11-17 13:57 ` [PATCH v3 02/18] ARM: clps711x: p720t: Using "leds-gpio" driver for LED control Alexander Shiyan
2012-11-17 13:57 ` [PATCH v3 03/18] ARM: clps711x: Transform clps711x-framebuffer to platform driver and use it Alexander Shiyan
2012-11-17 13:57 ` [PATCH v3 04/18] ARM: clps711x: p720t: Unneeded inclusion of head-sa1100.S removed Alexander Shiyan
2012-11-17 13:57 ` [PATCH v3 05/18] ARM: clps711x: Always select AUTO_ZRELADDR for a platform Alexander Shiyan
2012-11-17 13:57 ` [PATCH v3 06/18] ARM: clps711x: cdb89712: Special driver for handling memory is removed Alexander Shiyan
2013-01-10 14:09   ` Uwe Kleine-König
2013-01-10 15:39     ` Alexander Shiyan
2013-01-10 16:20       ` Uwe Kleine-König
2012-11-17 13:57 ` [PATCH v3 07/18] ARM: clps711x: Implement usage "SPARSE_IRQ" kernel option for a platform Alexander Shiyan
2012-11-17 13:57 ` [PATCH v3 08/18] ARM: clps711x: Implement usage "MULTI_IRQ_HANDLER" " Alexander Shiyan
2012-11-17 13:57 ` [PATCH v3 09/18] ARM: clps711x: Add FIQ interrupt handling Alexander Shiyan
2012-11-17 13:57 ` [PATCH v3 10/18] ARM: clps711x: Unused empty "ACK" calls for IRQ-chips removed Alexander Shiyan
2012-11-17 13:57 ` [PATCH v3 11/18] ARM: clps711x: autcpu12: Special driver for handling NAND memory is removed Alexander Shiyan
2012-11-17 13:57 ` [PATCH v3 12/18] ARM: clps711x: Moving power management of framebuffer driver to the board Alexander Shiyan
2012-11-17 13:57 ` [PATCH v3 13/18] ARM: clps711x: p720t: Special driver for handling NAND memory is removed Alexander Shiyan
2012-11-17 13:57 ` [PATCH v3 14/18] ARM: clps711x: Moving backlight controls of framebuffer driver to the board Alexander Shiyan
2012-11-21  6:37   ` Olof Johansson
2012-11-17 13:57 ` Alexander Shiyan [this message]
2012-11-17 13:57 ` [PATCH v3 16/18] ARM: clps711x: Rename board files to match functionality Alexander Shiyan
2012-11-17 13:57 ` [PATCH v3 17/18] ARM: clps711x: Update defconfig due latest changes and new kernel symbols Alexander Shiyan
2012-11-17 13:57 ` [PATCH v3 18/18] MAINTAINERS: Add ARM CLPS711X entry Alexander Shiyan
2012-11-17 15:45 ` [PATCH v3 00/18] ARM: Patchset for CLPS711X Arnd Bergmann
2012-11-19 10:00   ` Linus Walleij
2012-11-21  6:36   ` Olof Johansson
2012-11-21  9:46     ` Linus Walleij
2012-11-21 10:18     ` Olof Johansson
2012-11-21 10:27       ` Olof Johansson

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=1353160644-22446-16-git-send-email-shc_work@mail.ru \
    --to=shc_work@mail.ru \
    --cc=linux-arm-kernel@lists.infradead.org \
    /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: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).