diff mbox

[1/1] r2dplus: add cfi flash support and enable it

Message ID 1240764162-24117-1-git-send-email-plagnioj@jcrosoft.com (mailing list archive)
State Accepted
Headers show

Commit Message

Jean-Christophe PLAGNIOL-VILLARD April 26, 2009, 4:42 p.m. UTC
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 arch/sh/boards/mach-r2d/setup.c          |   49 ++++++++++++++++
 arch/sh/configs/rts7751r2dplus_defconfig |   91 +++++++++++++++++++++++++++++-
 2 files changed, 137 insertions(+), 3 deletions(-)

Comments

Paul Mundt April 27, 2009, 12:32 a.m. UTC | #1
On Sun, Apr 26, 2009 at 06:42:42PM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> +static struct resource flash_resource = {
> +	.start		= 0x00000000,
> +	.end		= 0x02000000,
> +	.flags		= IORESOURCE_MEM,
> +};
> +
> +static struct platform_device flash_device = {
> +	.name		= "physmap-flash",
> +	.id		= -1,
> +	.resource	= &flash_resource,
> +	.num_resources	= 1,
> +	.dev		= {
> +		.platform_data = &flash_data,
> +	},
> +};
> +
>  static struct platform_device *rts7751r2d_devices[] __initdata = {
>  	&sm501_device,
>  	&heartbeat_device,
>  	&spi_sh_sci_device,
> +	&flash_device,
>  };
>  
On RTS7751R2D-1 this is at least pretty bogus. By default the platform
has a socket-mounted MBM29F040 that is precisely 1MB, shadowed all the
way up to 0x04000000, with a fixed 16-bit bus width. There is the
possibility to hook up a larger flash to CN8 which will map directly over
top of that chip select space, but at least on RTS7751R2D-1, that is not
the default configuration.

I don't have an R2D+ manual handy at the moment, so I'll have to check
what the default configuration there is. We may have to conditionalize
the platform devices depending on revision of the board if they do in
fact ship with different flash configurations by default.
--
To unsubscribe from this list: send the line "unsubscribe linux-sh" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Jean-Christophe PLAGNIOL-VILLARD April 27, 2009, 6:19 a.m. UTC | #2
On 09:32 Mon 27 Apr     , Paul Mundt wrote:
> On Sun, Apr 26, 2009 at 06:42:42PM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > +static struct resource flash_resource = {
> > +	.start		= 0x00000000,
> > +	.end		= 0x02000000,
> > +	.flags		= IORESOURCE_MEM,
> > +};
> > +
> > +static struct platform_device flash_device = {
> > +	.name		= "physmap-flash",
> > +	.id		= -1,
> > +	.resource	= &flash_resource,
> > +	.num_resources	= 1,
> > +	.dev		= {
> > +		.platform_data = &flash_data,
> > +	},
> > +};
> > +
> >  static struct platform_device *rts7751r2d_devices[] __initdata = {
> >  	&sm501_device,
> >  	&heartbeat_device,
> >  	&spi_sh_sci_device,
> > +	&flash_device,
> >  };
> >  
> On RTS7751R2D-1 this is at least pretty bogus. By default the platform
> has a socket-mounted MBM29F040 that is precisely 1MB, shadowed all the
> way up to 0x04000000, with a fixed 16-bit bus width. There is the
> possibility to hook up a larger flash to CN8 which will map directly over
> top of that chip select space, but at least on RTS7751R2D-1, that is not
> the default configuration.
> 
on the R2dplus it's a s29gl256p

Best Regards,
J.
--
To unsubscribe from this list: send the line "unsubscribe linux-sh" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Paul Mundt April 27, 2009, 8:53 a.m. UTC | #3
On Mon, Apr 27, 2009 at 08:19:57AM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> On 09:32 Mon 27 Apr     , Paul Mundt wrote:
> > On Sun, Apr 26, 2009 at 06:42:42PM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > > +static struct resource flash_resource = {
> > > +	.start		= 0x00000000,
> > > +	.end		= 0x02000000,
> > > +	.flags		= IORESOURCE_MEM,
> > > +};
> > > +
> > > +static struct platform_device flash_device = {
> > > +	.name		= "physmap-flash",
> > > +	.id		= -1,
> > > +	.resource	= &flash_resource,
> > > +	.num_resources	= 1,
> > > +	.dev		= {
> > > +		.platform_data = &flash_data,
> > > +	},
> > > +};
> > > +
> > >  static struct platform_device *rts7751r2d_devices[] __initdata = {
> > >  	&sm501_device,
> > >  	&heartbeat_device,
> > >  	&spi_sh_sci_device,
> > > +	&flash_device,
> > >  };
> > >  
> > On RTS7751R2D-1 this is at least pretty bogus. By default the platform
> > has a socket-mounted MBM29F040 that is precisely 1MB, shadowed all the
> > way up to 0x04000000, with a fixed 16-bit bus width. There is the
> > possibility to hook up a larger flash to CN8 which will map directly over
> > top of that chip select space, but at least on RTS7751R2D-1, that is not
> > the default configuration.
> > 
> on the R2dplus it's a s29gl256p
> 
Ok, I've added this just for r2d+ boards. It's not worth special casing
the r2d_1 flash.
--
To unsubscribe from this list: send the line "unsubscribe linux-sh" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/arch/sh/boards/mach-r2d/setup.c b/arch/sh/boards/mach-r2d/setup.c
index c585be0..1582d4e 100644
--- a/arch/sh/boards/mach-r2d/setup.c
+++ b/arch/sh/boards/mach-r2d/setup.c
@@ -10,6 +10,10 @@ 
  */
 #include <linux/init.h>
 #include <linux/platform_device.h>
+#include <linux/mtd/mtd.h>
+#include <linux/mtd/partitions.h>
+#include <linux/mtd/physmap.h>
+#include <linux/mtd/map.h>
 #include <linux/ata_platform.h>
 #include <linux/sm501.h>
 #include <linux/sm501-regs.h>
@@ -181,10 +185,55 @@  static struct platform_device sm501_device = {
 	.resource	= sm501_resources,
 };
 
+static struct mtd_partition r2d_partitions[] = {
+	{
+		.name		= "U-Boot",
+		.offset		= 0x00000000,
+		.size		= 0x00040000,
+		.mask_flags	= MTD_WRITEABLE,
+	}, {
+		.name		= "Environment",
+		.offset		= MTDPART_OFS_NXTBLK,
+		.size		= 0x00040000,
+		.mask_flags	= MTD_WRITEABLE,
+	}, {
+		.name		= "Kernel",
+		.offset		= MTDPART_OFS_NXTBLK,
+		.size		= 0x001c0000,
+	}, {
+		.name		= "Flash_FS",
+		.offset		= MTDPART_OFS_NXTBLK,
+		.size		= MTDPART_SIZ_FULL,
+	}
+};
+
+static struct physmap_flash_data flash_data = {
+	.width		= 2,
+	.nr_parts	= ARRAY_SIZE(r2d_partitions),
+	.parts		= r2d_partitions,
+};
+
+static struct resource flash_resource = {
+	.start		= 0x00000000,
+	.end		= 0x02000000,
+	.flags		= IORESOURCE_MEM,
+};
+
+static struct platform_device flash_device = {
+	.name		= "physmap-flash",
+	.id		= -1,
+	.resource	= &flash_resource,
+	.num_resources	= 1,
+	.dev		= {
+		.platform_data = &flash_data,
+	},
+};
+
 static struct platform_device *rts7751r2d_devices[] __initdata = {
 	&sm501_device,
 	&heartbeat_device,
 	&spi_sh_sci_device,
+	&flash_device,
 };
 
 /*
diff --git a/arch/sh/configs/rts7751r2dplus_defconfig b/arch/sh/configs/rts7751r2dplus_defconfig
index 8feef62..4f7fa32 100644
--- a/arch/sh/configs/rts7751r2dplus_defconfig
+++ b/arch/sh/configs/rts7751r2dplus_defconfig
@@ -1,7 +1,7 @@ 
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.29
-# Thu Apr  2 18:34:12 2009
+# Linux kernel version: 2.6.30-rc3
+# Sun Apr 26 17:56:14 2009
 #
 CONFIG_SUPERH=y
 CONFIG_SUPERH32=y
@@ -424,7 +424,92 @@  CONFIG_FIRMWARE_IN_KERNEL=y
 CONFIG_EXTRA_FIRMWARE=""
 # CONFIG_SYS_HYPERVISOR is not set
 # CONFIG_CONNECTOR is not set
-# CONFIG_MTD is not set
+CONFIG_MTD=y
+# CONFIG_MTD_DEBUG is not set
+CONFIG_MTD_CONCAT=y
+CONFIG_MTD_PARTITIONS=y
+# CONFIG_MTD_TESTS is not set
+# CONFIG_MTD_REDBOOT_PARTS is not set
+CONFIG_MTD_CMDLINE_PARTS=y
+# CONFIG_MTD_AR7_PARTS is not set
+
+#
+# User Modules And Translation Layers
+#
+CONFIG_MTD_CHAR=y
+# CONFIG_MTD_BLKDEVS is not set
+# CONFIG_MTD_BLOCK is not set
+# CONFIG_MTD_BLOCK_RO is not set
+# CONFIG_FTL is not set
+# CONFIG_NFTL is not set
+# CONFIG_INFTL is not set
+# CONFIG_RFD_FTL is not set
+# CONFIG_SSFDC is not set
+# CONFIG_MTD_OOPS is not set
+
+#
+# RAM/ROM/Flash chip drivers
+#
+CONFIG_MTD_CFI=y
+# CONFIG_MTD_JEDECPROBE is not set
+CONFIG_MTD_GEN_PROBE=y
+# CONFIG_MTD_CFI_ADV_OPTIONS is not set
+CONFIG_MTD_MAP_BANK_WIDTH_1=y
+CONFIG_MTD_MAP_BANK_WIDTH_2=y
+CONFIG_MTD_MAP_BANK_WIDTH_4=y
+# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
+# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
+# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
+CONFIG_MTD_CFI_I1=y
+CONFIG_MTD_CFI_I2=y
+# CONFIG_MTD_CFI_I4 is not set
+# CONFIG_MTD_CFI_I8 is not set
+# CONFIG_MTD_CFI_INTELEXT is not set
+CONFIG_MTD_CFI_AMDSTD=y
+# CONFIG_MTD_CFI_STAA is not set
+CONFIG_MTD_CFI_UTIL=y
+# CONFIG_MTD_RAM is not set
+# CONFIG_MTD_ROM is not set
+# CONFIG_MTD_ABSENT is not set
+
+#
+# Mapping drivers for chip access
+#
+# CONFIG_MTD_COMPLEX_MAPPINGS is not set
+CONFIG_MTD_PHYSMAP=y
+# CONFIG_MTD_PHYSMAP_COMPAT is not set
+# CONFIG_MTD_INTEL_VR_NOR is not set
+# CONFIG_MTD_PLATRAM is not set
+
+#
+# Self-contained MTD device drivers
+#
+# CONFIG_MTD_PMC551 is not set
+# CONFIG_MTD_DATAFLASH is not set
+# CONFIG_MTD_M25P80 is not set
+# CONFIG_MTD_SLRAM is not set
+# CONFIG_MTD_PHRAM is not set
+# CONFIG_MTD_MTDRAM is not set
+# CONFIG_MTD_BLOCK2MTD is not set
+
+#
+# Disk-On-Chip Device Drivers
+#
+# CONFIG_MTD_DOC2000 is not set
+# CONFIG_MTD_DOC2001 is not set
+# CONFIG_MTD_DOC2001PLUS is not set
+# CONFIG_MTD_NAND is not set
+# CONFIG_MTD_ONENAND is not set
+
+#
+# LPDDR flash memory drivers
+#
+# CONFIG_MTD_LPDDR is not set
+
+#
+# UBI - Unsorted block images
+#
+# CONFIG_MTD_UBI is not set
 # CONFIG_PARPORT is not set
 CONFIG_BLK_DEV=y
 # CONFIG_BLK_CPQ_CISS_DA is not set