Missing implementation of omap3evm_flash_init()
Subsystems (3)
PATCH 1/1 Missing implementation of omap3evm_flash_init()
The function omap3evm_flash_init() earlier implemented in board-omap3evm-flash.c did not find its way into the board-omap3evm.c during the latest migration.
This patch brings in the earlier implementation with appropriate changes as necessary on current head.
--- arch/arm/mach-omap2/board-omap3evm.c | 176 +++++++++++++++++++++++++++++++++- 1 files changed, 175 insertions(+), 1 deletions(-)
arch/arm/mach-omap2/board-omap3evm.c +175 -1
@@ -26,23 +26,197 @@#include <linux/spi/ads7846.h> #include <linux/i2c/twl4030.h> +#include <linux/mtd/mtd.h> +#include <linux/mtd/partitions.h> +#include <linux/mtd/nand.h> +#include <mach/hardware.h> #include <asm/mach-types.h> #include <asm/mach/arch.h> #include <asm/mach/map.h> +#include <asm/mach/flash.h> +#include <mach/common.h> #include <mach/board.h> #include <mach/mux.h> +#include <mach/gpmc.h> +#include <mach/nand.h> +#include <mach/onenand.h> #include <mach/usb.h> -#include <mach/common.h> #include <mach/mcspi.h> #include <mach/keypad.h> #include "sdram-micron-mt46h32m32lf-6.h" #include "mmc-twl4030.h" +#define GPMC_CS0_BASE 0x60 +#define GPMC_CS_SIZE 0x30 +#define OMAP3_EVM_TS_GPIO 175 +/* +* MTD - NAND, OneNAND +*/ +#define NAND_BLOCK_SIZE SZ_128K + +static struct mtd_partition omap3evm_nand_partitions[] = { +/* All the partition sizes are listed in terms of NAND block size */ + { + .name ="xloader-nand" , + .offset =0 , + .size =4 *NAND_BLOCK_SIZE , + .mask_flags =MTD_WRITEABLE + }, + { + .name ="uboot-nand" , + .offset =MTDPART_OFS_APPEND , + .size =14 *NAND_BLOCK_SIZE , + .mask_flags =MTD_WRITEABLE + }, + { + .name ="params-nand" , + + .offset =MTDPART_OFS_APPEND , + .size =2 *NAND_BLOCK_SIZE + }, + { + .name ="linux-nand" , + .offset =MTDPART_OFS_APPEND , + .size =40 *NAND_BLOCK_SIZE , + }, + { + .name ="jffs2-nand" , + .size =MTDPART_SIZ_FULL , + .offset =MTDPART_OFS_APPEND , + }, +}; + +static struct omap_nand_platform_data omap3evm_nand_data = { + .parts = omap3evm_nand_partitions, + .nr_parts =ARRAY_SIZE (omap3evm_nand_partitions), + .nand_setup =NULL , + .dma_channel =-1 ,/* disable DMA in OMAP NAND driver */ + .nand_setup =NULL , + .dev_ready =NULL , +}; + +static struct resource omap3evm_nand_resource = { + .flags =IORESOURCE_MEM , +}; + +static struct platform_device omap3evm_nand_device = { + .name ="omap2-nand" , + .id =0 , + .dev = { + .platform_data = &omap3evm_nand_data, + }, + .num_resources =1 , + .resource = &omap3evm_nand_resource, +}; + +#define ONENAND_MAP 0x20000000 +#define ONENAND_BLOCK_SIZE (64*2048) + +static struct mtd_partition omap3evm_onenand_partitions[] = { + { + .name ="xloader-onenand" , + .offset =0 , + .size =4 *ONENAND_BLOCK_SIZE , + .mask_flags =MTD_WRITEABLE + }, + { + .name ="uboot-onenand" , + .offset =MTDPART_OFS_APPEND , + .size =15 *ONENAND_BLOCK_SIZE , + .mask_flags =MTD_WRITEABLE + }, + { + .name ="params-onenand" , + .offset =MTDPART_OFS_APPEND , + .size =1 *ONENAND_BLOCK_SIZE , + }, + { + .name ="linux-onenand" , + .offset =MTDPART_OFS_APPEND , + .size =40 *ONENAND_BLOCK_SIZE , + }, + { + .name ="jffs2-onenand" , + .offset =MTDPART_OFS_APPEND , + .size =MTDPART_SIZ_FULL , + }, +}; + +static struct omap_onenand_platform_data omap3evm_onenand_data = { + .parts = omap3evm_onenand_partitions, + .nr_parts =ARRAY_SIZE (omap3evm_onenand_partitions), + .onenand_setup =NULL , + .dma_channel =-1 ,/* disable DMA in OMAP OneNAND driver */ +}; + +static struct platform_device omap3evm_onenand_device = { + .name ="omap2-onenand" , + .id =-1 , + .dev = { + .platform_data = &omap3evm_onenand_data, + }, +}; + +void __init omap3evm_flash_init (void ) +{ +u8 cs =0 ; +u8 onenandcs =GPMC_CS_NUM +1 , nandcs =GPMC_CS_NUM +1 ; +u32 gpmc_base_add =OMAP34XX_GPMC_VIRT ; + +while (cs <GPMC_CS_NUM ) { +u32 ret =0 ; + ret =gpmc_cs_read_reg (cs,GPMC_CS_CONFIG1 ); + +/* +* xloader/Uboot would have programmed the NAND/oneNAND +* base address for us This is a ugly hack. The proper +* way of doing this is to pass the setup of u-boot up +* to kernel using kernel params - something on the +* lines of machineID. Check if NAND/oneNAND is configured +*/ +if ((ret &0xC00 ) ==0x800 ) { +/* Found it!! */ +if (nandcs >GPMC_CS_NUM ) + nandcs = cs; + }else { + ret =gpmc_cs_read_reg (cs,GPMC_CS_CONFIG7 ); +if ((ret &0x3F ) == (ONENAND_MAP >>24 )) + onenandcs = cs; + } + cs++; + } +if ((nandcs >GPMC_CS_NUM ) && (onenandcs >GPMC_CS_NUM )) { +printk (KERN_INFO "NAND/OneNAND: Unable to find configuration " +" in GPMC\n " ); +return ; + } + +if (nandcs <GPMC_CS_NUM ) { + omap3evm_nand_data.cs = nandcs; + omap3evm_nand_data.gpmc_cs_baseaddr = (void *)(gpmc_base_add + +GPMC_CS0_BASE + nandcs*GPMC_CS_SIZE ); + omap3evm_nand_data.gpmc_baseaddr = (void *) (gpmc_base_add); + +if (platform_device_register (&omap3evm_nand_device) <0 ) { +printk (KERN_ERR "Unable to register NAND device\n" ); + } + } + +if (onenandcs <GPMC_CS_NUM ) { + omap3evm_onenand_data.cs = onenandcs; +if (platform_device_register (&omap3evm_onenand_device) <0 ) +printk (KERN_ERR "Unable to register OneNAND device\n" ); + } +} + +/* +* Ethernet +*/ #define OMAP3EVM_ETHR_START 0x2c000000#define OMAP3EVM_ETHR_SIZE 1024#define OMAP3EVM_ETHR_GPIO_IRQ 176
Signature · 1 line
1.6.2.2
Tony Lindgren
maintainerHi,
Quoted 175 lines · Sanjeev Premi
The function
omap3evm_flash_init()earlier implemented inboard-omap3evm-flash.cdid not find its way into theboard-omap3evm.cduring the latest migration.This patch brings in the earlier implementation with appropriate changes as necessary on current head.
Signed-off-by Sanjeev Premi <[email protected]>--- arch/arm/mach-omap2/board-omap3evm.c | 176 +++++++++++++++++++++++++++++++++- 1 files changed, 175 insertions(+), 1 deletions(-)arch/arm/mach-omap2/board-omap3evm.c +138
-1@@ -26,23 +26,197 @@#include <linux/spi/ads7846.h> #include <linux/i2c/twl4030.h> +#include <linux/mtd/mtd.h> +#include <linux/mtd/partitions.h> +#include <linux/mtd/nand.h> +#include <mach/hardware.h> #include <asm/mach-types.h> #include <asm/mach/arch.h> #include <asm/mach/map.h> +#include <asm/mach/flash.h> +#include <mach/common.h> #include <mach/board.h> #include <mach/mux.h> +#include <mach/gpmc.h> +#include <mach/nand.h> +#include <mach/onenand.h> #include <mach/usb.h> -#include <mach/common.h> #include <mach/mcspi.h> #include <mach/keypad.h> #include "sdram-micron-mt46h32m32lf-6.h" #include "mmc-twl4030.h" +#define GPMC_CS0_BASE 0x60 +#define GPMC_CS_SIZE 0x30 +#define OMAP3_EVM_TS_GPIO 175 +/* +* MTD - NAND, OneNAND +*/ +#define NAND_BLOCK_SIZE SZ_128K + +static struct mtd_partition omap3evm_nand_partitions[] = { +/* All the partition sizes are listed in terms of NAND block size */ + { + .name ="xloader-nand" , + .offset =0 , + .size =4 *NAND_BLOCK_SIZE , + .mask_flags =MTD_WRITEABLE + }, + { + .name ="uboot-nand" , + .offset =MTDPART_OFS_APPEND , + .size =14 *NAND_BLOCK_SIZE , + .mask_flags =MTD_WRITEABLE + }, + { + .name ="params-nand" , + + .offset =MTDPART_OFS_APPEND , + .size =2 *NAND_BLOCK_SIZE + }, + { + .name ="linux-nand" , + .offset =MTDPART_OFS_APPEND , + .size =40 *NAND_BLOCK_SIZE , + }, + { + .name ="jffs2-nand" , + .size =MTDPART_SIZ_FULL , + .offset =MTDPART_OFS_APPEND , + }, +}; + +static struct omap_nand_platform_data omap3evm_nand_data = { + .parts = omap3evm_nand_partitions, + .nr_parts =ARRAY_SIZE (omap3evm_nand_partitions), + .nand_setup =NULL , + .dma_channel =-1 ,/* disable DMA in OMAP NAND driver */ + .nand_setup =NULL , + .dev_ready =NULL , +}; + +static struct resource omap3evm_nand_resource = { + .flags =IORESOURCE_MEM , +}; + +static struct platform_device omap3evm_nand_device = { + .name ="omap2-nand" , + .id =0 , + .dev = { + .platform_data = &omap3evm_nand_data, + }, + .num_resources =1 , + .resource = &omap3evm_nand_resource, +}; + +#define ONENAND_MAP 0x20000000 +#define ONENAND_BLOCK_SIZE (64*2048) + +static struct mtd_partition omap3evm_onenand_partitions[] = { + { + .name ="xloader-onenand" , + .offset =0 , + .size =4 *ONENAND_BLOCK_SIZE , + .mask_flags =MTD_WRITEABLE + }, + { + .name ="uboot-onenand" , + .offset =MTDPART_OFS_APPEND , + .size =15 *ONENAND_BLOCK_SIZE , + .mask_flags =MTD_WRITEABLE + }, + { + .name ="params-onenand" , + .offset =MTDPART_OFS_APPEND , + .size =1 *ONENAND_BLOCK_SIZE , + }, + { + .name ="linux-onenand" , + .offset =MTDPART_OFS_APPEND , + .size =40 *ONENAND_BLOCK_SIZE , + }, + { + .name ="jffs2-onenand" , + .offset =MTDPART_OFS_APPEND , + .size =MTDPART_SIZ_FULL , + }, +}; + +static struct omap_onenand_platform_data omap3evm_onenand_data = { + .parts = omap3evm_onenand_partitions, + .nr_parts =ARRAY_SIZE (omap3evm_onenand_partitions), + .onenand_setup =NULL , + .dma_channel =-1 ,/* disable DMA in OMAP OneNAND driver */ +}; + +static struct platform_device omap3evm_onenand_device = { + .name ="omap2-onenand" , + .id =-1 , + .dev = { + .platform_data = &omap3evm_onenand_data, + }, +}; + +void __init omap3evm_flash_init (void ) +{ +u8 cs =0 ; +u8 onenandcs =GPMC_CS_NUM +1 , nandcs =GPMC_CS_NUM +1 ; +u32 gpmc_base_add =OMAP34XX_GPMC_VIRT ; + +while (cs <GPMC_CS_NUM ) { +u32 ret =0 ; + ret =gpmc_cs_read_reg (cs,GPMC_CS_CONFIG1 ); + +/* +* xloader/Uboot would have programmed the NAND/oneNAND +* base address for us This is a ugly hack. The proper +* way of doing this is to pass the setup of u-boot up +* to kernel using kernel params - something on the +* lines of machineID. Check if NAND/oneNAND is configured +*/ +if ((ret &0xC00 ) ==0x800 ) {
arch/arm/mach-omap2/board-omap3evm.c line 192
Quoted 10 lines
arch/arm/mach-omap2/board-omap3evm.c +10
-0+/* Found it!! */ +if (nandcs >GPMC_CS_NUM ) + nandcs = cs; + }else { + ret =gpmc_cs_read_reg (cs,GPMC_CS_CONFIG7 ); +if ((ret &0x3F ) == (ONENAND_MAP >>24 )) + onenandcs = cs; + } + cs++; + }
We already have code that initializes the GPMC for onenand in kernel. And I posted a patch to enable onenand for the SDP boards last week [1]. And this is yet another copy of the same code that was duplicated for multiple boards. So how about making the following changes:
- Pass the onenand chip select for GPMC in platform data. I doubt that the chip select is changing?
- If you still need to probe for onenand, please create a generic function in gpmc-onenand.c to probe for onenand
Regards,
Tony
Quoted 37 lines
arch/arm/mach-omap2/board-omap3evm.c +27
-0+if ((nandcs >GPMC_CS_NUM ) && (onenandcs >GPMC_CS_NUM )) { +printk (KERN_INFO "NAND/OneNAND: Unable to find configuration " +" in GPMC\n " ); +return ; + } + +if (nandcs <GPMC_CS_NUM ) { + omap3evm_nand_data.cs = nandcs; + omap3evm_nand_data.gpmc_cs_baseaddr = (void *)(gpmc_base_add + +GPMC_CS0_BASE + nandcs*GPMC_CS_SIZE ); + omap3evm_nand_data.gpmc_baseaddr = (void *) (gpmc_base_add); + +if (platform_device_register (&omap3evm_nand_device) <0 ) { +printk (KERN_ERR "Unable to register NAND device\n" ); + } + } + +if (onenandcs <GPMC_CS_NUM ) { + omap3evm_onenand_data.cs = onenandcs; +if (platform_device_register (&omap3evm_onenand_device) <0 ) +printk (KERN_ERR "Unable to register OneNAND device\n" ); + } +} + +/* +* Ethernet +*/ #define OMAP3EVM_ETHR_START 0x2c000000#define OMAP3EVM_ETHR_SIZE 1024#define OMAP3EVM_ETHR_GPIO_IRQ 176Signature · 6 lines
1.6.2.2 -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 189 lines
-----Original Message-----
From: Tony Lindgren [mailto:[email protected]]
Sent: Monday, June 22, 2009 2:37 PM
To: Premi, Sanjeev
Cc: [email protected]
Subject: Re: [PATCH] Missing implementation ofomap3evm_flash_init()Hi,
Quoted 10 lines · Sanjeev Premi
The function
omap3evm_flash_init()earlier implemented inboard-omap3evm-flash.cdid not find its way into theboard-omap3evm.cduring the latest migration.This patch brings in the earlier implementation with appropriate changes as necessary on current head.
Signed-off-by Sanjeev Premi <[email protected]>--- arch/arm/mach-omap2/board-omap3evm.c | 176+++++++++++++++++++++++++++++++++-
Review
Quoted 3 lines
1 files changed, 175 insertions(+), 1 deletions(-)(quoted diff) +0
-0
b/arch/arm/mach-omap2/board-omap3evm.cQuoted 33 lines
index 1b7a797..5084b67 100644
arch/arm/mach-omap2/board-omap3evm.c +11
-1@@ -26,23 +26,197 @@#include <linux/spi/ads7846.h> #include <linux/i2c/twl4030.h> +#include <linux/mtd/mtd.h> +#include <linux/mtd/partitions.h> +#include <linux/mtd/nand.h> +#include <mach/hardware.h> #include <asm/mach-types.h> #include <asm/mach/arch.h> #include <asm/mach/map.h> +#include <asm/mach/flash.h> +#include <mach/common.h> #include <mach/board.h> #include <mach/mux.h> +#include <mach/gpmc.h> +#include <mach/nand.h> +#include <mach/onenand.h> #include <mach/usb.h> -#include <mach/common.h> #include <mach/mcspi.h> #include <mach/keypad.h> #include "sdram-micron-mt46h32m32lf-6.h" #include "mmc-twl4030.h" +#define GPMC_CS0_BASE 0x60 +#define GPMC_CS_SIZE 0x30arch/arm/mach-omap2/board-omap3evm.c line 63
Quoted 10 lines
arch/arm/mach-omap2/board-omap3evm.c +8
-0+#define OMAP3_EVM_TS_GPIO 175 +/* +* MTD - NAND, OneNAND +*/ +#define NAND_BLOCK_SIZE SZ_128K + +static struct mtd_partition omap3evm_nand_partitions[] = { +/* All the partition sizes are listed in terms of NAND block size */
Quoted 25 lines
arch/arm/mach-omap2/board-omap3evm.c +25
-0+ { + .name = "xloader-nand", + .offset = 0, + .size = 4 * NAND_BLOCK_SIZE, + .mask_flags =MTD_WRITEABLE + }, + { + .name = "uboot-nand", + .offset = MTDPART_OFS_APPEND, + .size = 14 * NAND_BLOCK_SIZE, + .mask_flags =MTD_WRITEABLE + }, + { + .name = "params-nand", + + .offset = MTDPART_OFS_APPEND, + .size =2 *NAND_BLOCK_SIZE + }, + { + .name = "linux-nand", + .offset = MTDPART_OFS_APPEND, + .size = 40 * NAND_BLOCK_SIZE, + }, + { + .name = "jffs2-nand",arch/arm/mach-omap2/board-omap3evm.c
Quoted 10 lines
arch/arm/mach-omap2/board-omap3evm.c +10
-0+ .size = MTDPART_SIZ_FULL, + .offset = MTDPART_OFS_APPEND, + }, +}; + +static struct omap_nand_platform_data omap3evm_nand_data = { + .parts = omap3evm_nand_partitions, + .nr_parts =ARRAY_SIZE (omap3evm_nand_partitions), + .nand_setup =NULL , + .dma_channel =-1 ,/* disable DMA in OMAP NAND driver */
Quoted 60 lines
arch/arm/mach-omap2/board-omap3evm.c +60
-0+ .nand_setup = NULL, + .dev_ready = NULL, +}; + +static struct resource omap3evm_nand_resource = { + .flags =IORESOURCE_MEM , +}; + +static struct platform_device omap3evm_nand_device = { + .name ="omap2-nand" , + .id =0 , + .dev = { + .platform_data = &omap3evm_nand_data, + }, + .num_resources =1 , + .resource = &omap3evm_nand_resource, +}; + +#define ONENAND_MAP 0x20000000 +#define ONENAND_BLOCK_SIZE (64*2048) + +static struct mtd_partition omap3evm_onenand_partitions[] = { + { + .name ="xloader-onenand" , + .offset =0 , + .size =4 *ONENAND_BLOCK_SIZE , + .mask_flags =MTD_WRITEABLE + }, + { + .name ="uboot-onenand" , + .offset =MTDPART_OFS_APPEND , + .size =15 *ONENAND_BLOCK_SIZE , + .mask_flags =MTD_WRITEABLE + }, + { + .name ="params-onenand" , + .offset =MTDPART_OFS_APPEND , + .size =1 *ONENAND_BLOCK_SIZE , + }, + { + .name ="linux-onenand" , + .offset =MTDPART_OFS_APPEND , + .size =40 *ONENAND_BLOCK_SIZE , + }, + { + .name ="jffs2-onenand" , + .offset =MTDPART_OFS_APPEND , + .size =MTDPART_SIZ_FULL , + }, +}; + +static struct omap_onenand_platform_data omap3evm_onenand_data = { + .parts = omap3evm_onenand_partitions, + .nr_parts =ARRAY_SIZE (omap3evm_onenand_partitions), + .onenand_setup =NULL , + .dma_channel =-1 ,/* disable DMA in OMAP OneNAND driver */ +}; + +static struct platform_device omap3evm_onenand_device = { + .name ="omap2-onenand" ,arch/arm/mach-omap2/board-omap3evm.c
Quoted 10 lines
arch/arm/mach-omap2/board-omap3evm.c +10
-0+ .id = -1, + .dev = { + .platform_data = &omap3evm_onenand_data, + }, +}; + +void __init omap3evm_flash_init (void ) +{ +u8 cs =0 ; + u8 onenandcs = GPMC_CS_NUM + 1, nandcs =
GPMC_CS_NUM+ 1;arch/arm/mach-omap2/board-omap3evm.c
Quoted 12 lines
arch/arm/mach-omap2/board-omap3evm.c +12
-0+u32 gpmc_base_add =OMAP34XX_GPMC_VIRT ; + +while (cs <GPMC_CS_NUM ) { +u32 ret =0 ; + ret =gpmc_cs_read_reg (cs,GPMC_CS_CONFIG1 ); + +/* +* xloader/Uboot would have programmed the NAND/oneNAND +* base address for us This is a ugly hack. The proper +* way of doing this is to pass the setup of u-boot up +* to kernel using kernel params - something on the +* lines of machineID. Check if NAND/oneNAND is configured
Quoted 16 lines
arch/arm/mach-omap2/board-omap3evm.c line 192
Quoted 12 lines
arch/arm/mach-omap2/board-omap3evm.c +12
-0+*/ +if ((ret &0xC00 ) ==0x800 ) { +/* Found it!! */ +if (nandcs >GPMC_CS_NUM ) + nandcs = cs; + }else { + ret =gpmc_cs_read_reg (cs,GPMC_CS_CONFIG7 ); +if ((ret &0x3F ) == (ONENAND_MAP >>24 )) + onenandcs = cs; + } + cs++; + }We already have code that initializes the GPMC for onenand in kernel. And I posted a patch to enable onenand for the SDP boards last week [1].
Did not see it; before creating the patch; lookig at this now...
Quoted 11 lines
And this is yet another copy of the same code that was duplicated for multiple boards. So how about making the following changes:
- Pass the onenand chip select for GPMC in platform data. I doubt that the
chip select is changing?- If you still need to probe for onenand, please create a generic function
ingpmc-onenand.cto probe for onenand
Some EVMs have OneNAND and others have NAND. How/ Where do you suggest this check sould go?
~sanjeev
Quoted 57 lines
Regards,
Tony
[1] http://patchwork.kernel.org/patch/30311/
arch/arm/mach-omap2/board-omap3evm.c line 194
Quoted 2 lines
arch/arm/mach-omap2/board-omap3evm.c +2
-0+ if ((nandcs > GPMC_CS_NUM) && (onenandcs > GPMC_CS_NUM)) { + printk(KERN_INFO "NAND/OneNAND: Unable to findconfiguration "
arch/arm/mach-omap2/board-omap3evm.c
Quoted 7 lines
arch/arm/mach-omap2/board-omap3evm.c +7
-0+ " in GPMC\n "); +return ; + } + +if (nandcs <GPMC_CS_NUM ) { + omap3evm_nand_data.cs = nandcs; + omap3evm_nand_data.gpmc_cs_baseaddr = (void*)(gpmc_base_add +
arch/arm/mach-omap2/board-omap3evm.c line 202
Quoted 1 line
arch/arm/mach-omap2/board-omap3evm.c +1
-0+ GPMC_CS0_BASE +nandcs*GPMC_CS_SIZE);
arch/arm/mach-omap2/board-omap3evm.c line 203
Quoted 1 line
arch/arm/mach-omap2/board-omap3evm.c +1
-0+ omap3evm_nand_data.gpmc_baseaddr = (void *)(
gpmc_base_add);arch/arm/mach-omap2/board-omap3evm.c line 205
Quoted 2 lines
arch/arm/mach-omap2/board-omap3evm.c +2
-0+ + if(
platform_device_register(&omap3evm_nand_device)< 0) {arch/arm/mach-omap2/board-omap3evm.c line 206
Quoted 1 line
arch/arm/mach-omap2/board-omap3evm.c +1
-0+ printk(KERN_ERR "Unable to registerNAND device\n");
arch/arm/mach-omap2/board-omap3evm.c
Quoted 6 lines
arch/arm/mach-omap2/board-omap3evm.c +6
-0+ } + } + +if (onenandcs <GPMC_CS_NUM ) { + omap3evm_onenand_data.cs = onenandcs; + if(
platform_device_register(&omap3evm_onenand_device)< 0)arch/arm/mach-omap2/board-omap3evm.c line 213
Quoted 1 line
arch/arm/mach-omap2/board-omap3evm.c +1
-0+ printk(KERN_ERR "Unable to registerOneNAND device\n");
Quoted 14 lines
arch/arm/mach-omap2/board-omap3evm.c +6
-0+ } +} + +/* +* Ethernet +*/ #define OMAP3EVM_ETHR_START 0x2c000000#define OMAP3EVM_ETHR_SIZE 1024#define OMAP3EVM_ETHR_GPIO_IRQ 176Signature · 4 lines
1.6.2.2 -- To unsubscribe from this list: send the line "unsubscribelinux-omap" in
Quoted 2 lines
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Tony Lindgren
maintainerQuoted 206 lines · Premi, Sanjeev
Quoted 189 lines
-----Original Message-----
From: Tony Lindgren [mailto:[email protected]]
Sent: Monday, June 22, 2009 2:37 PM
To: Premi, Sanjeev
Cc: [email protected]
Subject: Re: [PATCH] Missing implementation ofomap3evm_flash_init()Hi,
Quoted 10 lines · Sanjeev Premi
The function
omap3evm_flash_init()earlier implemented inboard-omap3evm-flash.cdid not find its way into theboard-omap3evm.cduring the latest migration.This patch brings in the earlier implementation with appropriate changes as necessary on current head.
Signed-off-by Sanjeev Premi <[email protected]>--- arch/arm/mach-omap2/board-omap3evm.c | 176+++++++++++++++++++++++++++++++++-
Review
Quoted 3 lines
1 files changed, 175 insertions(+), 1 deletions(-)(quoted diff) +0
-0
b/arch/arm/mach-omap2/board-omap3evm.cQuoted 33 lines
index 1b7a797..5084b67 100644
arch/arm/mach-omap2/board-omap3evm.c +11
-1@@ -26,23 +26,197 @@#include <linux/spi/ads7846.h> #include <linux/i2c/twl4030.h> +#include <linux/mtd/mtd.h> +#include <linux/mtd/partitions.h> +#include <linux/mtd/nand.h> +#include <mach/hardware.h> #include <asm/mach-types.h> #include <asm/mach/arch.h> #include <asm/mach/map.h> +#include <asm/mach/flash.h> +#include <mach/common.h> #include <mach/board.h> #include <mach/mux.h> +#include <mach/gpmc.h> +#include <mach/nand.h> +#include <mach/onenand.h> #include <mach/usb.h> -#include <mach/common.h> #include <mach/mcspi.h> #include <mach/keypad.h> #include "sdram-micron-mt46h32m32lf-6.h" #include "mmc-twl4030.h" +#define GPMC_CS0_BASE 0x60 +#define GPMC_CS_SIZE 0x30arch/arm/mach-omap2/board-omap3evm.c line 63
Quoted 10 lines
arch/arm/mach-omap2/board-omap3evm.c +8
-0+#define OMAP3_EVM_TS_GPIO 175 +/* +* MTD - NAND, OneNAND +*/ +#define NAND_BLOCK_SIZE SZ_128K + +static struct mtd_partition omap3evm_nand_partitions[] = { +/* All the partition sizes are listed in terms of NAND block size */
Quoted 25 lines
arch/arm/mach-omap2/board-omap3evm.c +25
-0+ { + .name = "xloader-nand", + .offset = 0, + .size = 4 * NAND_BLOCK_SIZE, + .mask_flags =MTD_WRITEABLE + }, + { + .name = "uboot-nand", + .offset = MTDPART_OFS_APPEND, + .size = 14 * NAND_BLOCK_SIZE, + .mask_flags =MTD_WRITEABLE + }, + { + .name = "params-nand", + + .offset = MTDPART_OFS_APPEND, + .size =2 *NAND_BLOCK_SIZE + }, + { + .name = "linux-nand", + .offset = MTDPART_OFS_APPEND, + .size = 40 * NAND_BLOCK_SIZE, + }, + { + .name = "jffs2-nand",arch/arm/mach-omap2/board-omap3evm.c
Quoted 10 lines
arch/arm/mach-omap2/board-omap3evm.c +10
-0+ .size = MTDPART_SIZ_FULL, + .offset = MTDPART_OFS_APPEND, + }, +}; + +static struct omap_nand_platform_data omap3evm_nand_data = { + .parts = omap3evm_nand_partitions, + .nr_parts =ARRAY_SIZE (omap3evm_nand_partitions), + .nand_setup =NULL , + .dma_channel =-1 ,/* disable DMA in OMAP NAND driver */
Quoted 60 lines
arch/arm/mach-omap2/board-omap3evm.c +60
-0+ .nand_setup = NULL, + .dev_ready = NULL, +}; + +static struct resource omap3evm_nand_resource = { + .flags =IORESOURCE_MEM , +}; + +static struct platform_device omap3evm_nand_device = { + .name ="omap2-nand" , + .id =0 , + .dev = { + .platform_data = &omap3evm_nand_data, + }, + .num_resources =1 , + .resource = &omap3evm_nand_resource, +}; + +#define ONENAND_MAP 0x20000000 +#define ONENAND_BLOCK_SIZE (64*2048) + +static struct mtd_partition omap3evm_onenand_partitions[] = { + { + .name ="xloader-onenand" , + .offset =0 , + .size =4 *ONENAND_BLOCK_SIZE , + .mask_flags =MTD_WRITEABLE + }, + { + .name ="uboot-onenand" , + .offset =MTDPART_OFS_APPEND , + .size =15 *ONENAND_BLOCK_SIZE , + .mask_flags =MTD_WRITEABLE + }, + { + .name ="params-onenand" , + .offset =MTDPART_OFS_APPEND , + .size =1 *ONENAND_BLOCK_SIZE , + }, + { + .name ="linux-onenand" , + .offset =MTDPART_OFS_APPEND , + .size =40 *ONENAND_BLOCK_SIZE , + }, + { + .name ="jffs2-onenand" , + .offset =MTDPART_OFS_APPEND , + .size =MTDPART_SIZ_FULL , + }, +}; + +static struct omap_onenand_platform_data omap3evm_onenand_data = { + .parts = omap3evm_onenand_partitions, + .nr_parts =ARRAY_SIZE (omap3evm_onenand_partitions), + .onenand_setup =NULL , + .dma_channel =-1 ,/* disable DMA in OMAP OneNAND driver */ +}; + +static struct platform_device omap3evm_onenand_device = { + .name ="omap2-onenand" ,arch/arm/mach-omap2/board-omap3evm.c
Quoted 10 lines
arch/arm/mach-omap2/board-omap3evm.c +10
-0+ .id = -1, + .dev = { + .platform_data = &omap3evm_onenand_data, + }, +}; + +void __init omap3evm_flash_init (void ) +{ +u8 cs =0 ; + u8 onenandcs = GPMC_CS_NUM + 1, nandcs =
GPMC_CS_NUM+ 1;arch/arm/mach-omap2/board-omap3evm.c
Quoted 12 lines
arch/arm/mach-omap2/board-omap3evm.c +12
-0+u32 gpmc_base_add =OMAP34XX_GPMC_VIRT ; + +while (cs <GPMC_CS_NUM ) { +u32 ret =0 ; + ret =gpmc_cs_read_reg (cs,GPMC_CS_CONFIG1 ); + +/* +* xloader/Uboot would have programmed the NAND/oneNAND +* base address for us This is a ugly hack. The proper +* way of doing this is to pass the setup of u-boot up +* to kernel using kernel params - something on the +* lines of machineID. Check if NAND/oneNAND is configured
Quoted 16 lines
arch/arm/mach-omap2/board-omap3evm.c line 192
Quoted 12 lines
arch/arm/mach-omap2/board-omap3evm.c +12
-0+*/ +if ((ret &0xC00 ) ==0x800 ) { +/* Found it!! */ +if (nandcs >GPMC_CS_NUM ) + nandcs = cs; + }else { + ret =gpmc_cs_read_reg (cs,GPMC_CS_CONFIG7 ); +if ((ret &0x3F ) == (ONENAND_MAP >>24 )) + onenandcs = cs; + } + cs++; + }We already have code that initializes the GPMC for onenand in kernel. And I posted a patch to enable onenand for the SDP boards last week [1].
Quoted 1 line
Did not see it; before creating the patch; lookig at this now...
OK, thanks.
Quoted 7 lines
Quoted 7 lines
And this is yet another copy of the same code that was duplicated for multiple boards. So how about making the following changes:
- Pass the onenand chip select for GPMC in platform data. I doubt that the
chip select is changing?
Quoted 7 lines
Quoted 4 lines
- If you still need to probe for onenand, please create a generic function
ingpmc-onenand.cto probe for onenandSome EVMs have OneNAND and others have NAND. How/ Where do you suggest this check sould go?
If it's based on just checking the GPMC registers, you could put it into gpmc.c.
Regards,
Tony
Quoted 60 lines
~sanjeev
Quoted 57 lines
Regards,
Tony
[1] http://patchwork.kernel.org/patch/30311/
arch/arm/mach-omap2/board-omap3evm.c line 194
Quoted 2 lines
arch/arm/mach-omap2/board-omap3evm.c +2
-0+ if ((nandcs > GPMC_CS_NUM) && (onenandcs > GPMC_CS_NUM)) { + printk(KERN_INFO "NAND/OneNAND: Unable to findconfiguration "
arch/arm/mach-omap2/board-omap3evm.c
Quoted 7 lines
arch/arm/mach-omap2/board-omap3evm.c +7
-0+ " in GPMC\n "); +return ; + } + +if (nandcs <GPMC_CS_NUM ) { + omap3evm_nand_data.cs = nandcs; + omap3evm_nand_data.gpmc_cs_baseaddr = (void*)(gpmc_base_add +
arch/arm/mach-omap2/board-omap3evm.c line 202
Quoted 1 line
arch/arm/mach-omap2/board-omap3evm.c +1
-0+ GPMC_CS0_BASE +nandcs*GPMC_CS_SIZE);
arch/arm/mach-omap2/board-omap3evm.c line 203
Quoted 1 line
arch/arm/mach-omap2/board-omap3evm.c +1
-0+ omap3evm_nand_data.gpmc_baseaddr = (void *)(
gpmc_base_add);arch/arm/mach-omap2/board-omap3evm.c line 205
Quoted 2 lines
arch/arm/mach-omap2/board-omap3evm.c +2
-0+ + if(
platform_device_register(&omap3evm_nand_device)< 0) {arch/arm/mach-omap2/board-omap3evm.c line 206
Quoted 1 line
arch/arm/mach-omap2/board-omap3evm.c +1
-0+ printk(KERN_ERR "Unable to registerNAND device\n");
arch/arm/mach-omap2/board-omap3evm.c
Quoted 6 lines
arch/arm/mach-omap2/board-omap3evm.c +6
-0+ } + } + +if (onenandcs <GPMC_CS_NUM ) { + omap3evm_onenand_data.cs = onenandcs; + if(
platform_device_register(&omap3evm_onenand_device)< 0)arch/arm/mach-omap2/board-omap3evm.c line 213
Quoted 1 line
arch/arm/mach-omap2/board-omap3evm.c +1
-0+ printk(KERN_ERR "Unable to registerOneNAND device\n");
Quoted 14 lines
arch/arm/mach-omap2/board-omap3evm.c +6
-0+ } +} + +/* +* Ethernet +*/ #define OMAP3EVM_ETHR_START 0x2c000000#define OMAP3EVM_ETHR_SIZE 1024#define OMAP3EVM_ETHR_GPIO_IRQ 176Signature · 4 lines
1.6.2.2 -- To unsubscribe from this list: send the line "unsubscribelinux-omap" in
Quoted 2 lines
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 7 lines
-----Original Message-----
From: Tony Lindgren [mailto:[email protected]]
Sent: Monday, June 22, 2009 7:04 PM
To: Premi, Sanjeev
Cc: [email protected]
Subject: Re: [PATCH] Missing implementation ofomap3evm_flash_init()
Quoted 9 lines
Quoted 6 lines · Premi, Sanjeev
Quoted 6 lines
-----Original Message-----
From: Tony Lindgren [mailto:[email protected]]
Sent: Monday, June 22, 2009 2:37 PM
To: Premi, Sanjeev
Cc: [email protected]
Subject: Re: [PATCH] Missing implementation of
omap3evm_flash_init()Quoted 1 line
Quoted 1 line
<snip>--<snip>
Tony,
I had a few follow-up queries below:
Quoted 6 lines
Quoted 2 lines
Quoted 2 lines
We already have code that initializes the GPMC for
onenand in kernel.
Quoted 3 lines
Quoted 2 lines
And I posted a patch to enable onenand for the SDP boards last week [1].
Quoted 15 lines
Quoted 1 line
Did not see it; before creating the patch; lookig at this now...
OK, thanks.
Quoted 1 line
Quoted 1 line
And this is yet another copy of the same code that was
duplicated for
Quoted 9 lines
Quoted 9 lines
multiple boards. So how about making the following changes:
- Pass the onenand chip select for GPMC in platform data. I doubt that the
chip select is changing?- If you still need to probe for onenand, please create a generic function
ingpmc-onenand.cto probe for onenand
I always see "onenand_base" being passed as argument. Where is it initialized?
I did implement this function to probe for nand/onenand - based on the code that existed in board-omap3evm-flash.c; but ran into some problems with the setting base address.
Looking at the gpmc-onenand.c do you believe we would need a gpmc-nand.c on same lines? Or an implementation within the board-omap3evm.c is okay for now?
Best regards,
Sanjeev
Quoted 6 lines
Quoted 3 lines
Quoted 1 line
Some EVMs have OneNAND and others have NAND. How/ Where do
you suggest
Quoted 1 line
this check sould go?
Quoted 10 lines
If it's based on just checking the GPMC registers, you could put it into
gpmc.c.Regards,
Tony
<snip>--<snip>--<snip till end>
Tony Lindgren
maintainerQuoted 41 lines · Premi, Sanjeev
Quoted 7 lines
-----Original Message-----
From: Tony Lindgren [mailto:[email protected]]
Sent: Monday, June 22, 2009 7:04 PM
To: Premi, Sanjeev
Cc: [email protected]
Subject: Re: [PATCH] Missing implementation ofomap3evm_flash_init()Quoted 9 lines
Quoted 6 lines · Premi, Sanjeev
Quoted 6 lines
-----Original Message-----
From: Tony Lindgren [mailto:[email protected]]
Sent: Monday, June 22, 2009 2:37 PM
To: Premi, Sanjeev
Cc: [email protected]
Subject: Re: [PATCH] Missing implementation of
omap3evm_flash_init()Quoted 1 line
Quoted 1 line
<snip>--<snip>
Tony,
I had a few follow-up queries below:
Quoted 18 lines
Quoted 2 lines
Quoted 2 lines
We already have code that initializes the GPMC for
onenand in kernel.
Quoted 4 lines
Quoted 2 lines
And I posted a patch to enable onenand for the SDP boards last week [1].
Did not see it; before creating the patch; lookig at this now...
OK, thanks.
Quoted 1 line
Quoted 1 line
And this is yet another copy of the same code that was
duplicated for
Quoted 6 lines
Quoted 6 lines
multiple boards. So how about making the following changes:
- Pass the onenand chip select for GPMC in platform data. I doubt that the
chip select is changing?
Quoted 6 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
- If you still need to probe for onenand, please create a generic function
ingpmc-onenand.cto probe for onenandI always see "
onenand_base" being passed as argument. Where is it initialized?
That is allocated with gpmc_cs_request() based on the cs in the struct omap_onenand_platform_data.
Quoted 3 lines
I did implement this function to probe for nand/onenand - based on the code that existed in
board-omap3evm-flash.c; but ran into some problems with the setting base address.
I guess the probe is only looking at the GPMC configuration registers though?
Quoted 3 lines
Looking at the
gpmc-onenand.cdo you believe we would need agpmc-nand.con same lines? Or an implementation within theboard-omap3evm.cis okay for now?
Well if you can figure out how to do a common gpmc-nand.c, I'm sure it would make things easier to bring up new boards (and omaps).
Regards,
Tony
Quoted 24 lines
Best regards,
SanjeevQuoted 6 lines
Quoted 3 lines
Quoted 1 line
Some EVMs have OneNAND and others have NAND. How/ Where do
you suggest
Quoted 1 line
this check sould go?
Quoted 10 lines
If it's based on just checking the GPMC registers, you could put it into
gpmc.c.Regards,
Tony
<snip>--<snip>--<snip till end>
Quoted 56 lines
-----Original Message-----
From: Tony Lindgren [mailto:[email protected]]
Sent: Wednesday, June 24, 2009 7:07 PM
To: Premi, Sanjeev
Cc: [email protected]
Subject: Re: [PATCH] Missing implementation ofomap3evm_flash_init()Quoted 6 lines · Premi, Sanjeev
Quoted 6 lines
-----Original Message-----
From: Tony Lindgren [mailto:[email protected]]
Sent: Monday, June 22, 2009 7:04 PM
To: Premi, Sanjeev
Cc: [email protected]
Subject: Re: [PATCH] Missing implementation of
omap3evm_flash_init()Quoted 39 lines
Quoted 10 lines · Premi, Sanjeev
Quoted 6 lines
Quoted 6 lines
-----Original Message-----
From: Tony Lindgren [mailto:[email protected]]
Sent: Monday, June 22, 2009 2:37 PM
To: Premi, Sanjeev
Cc: [email protected]
Subject: Re: [PATCH] Missing implementation of
omap3evm_flash_init()Quoted 1 line
Quoted 1 line
<snip>--<snip>
Tony,
I had a few follow-up queries below:
Quoted 21 lines
Quoted 2 lines
Quoted 2 lines
We already have code that initializes the GPMC for
onenand in kernel.
Quoted 4 lines
Quoted 2 lines
And I posted a patch to enable onenand for the SDP boards last week [1].
Did not see it; before creating the patch; lookig at this now...
OK, thanks.
Quoted 1 line
Quoted 1 line
And this is yet another copy of the same code that was
duplicated for
Quoted 9 lines
Quoted 9 lines
multiple boards. So how about making the following changes:
- Pass the onenand chip select for GPMC in platform data. I doubt that the
chip select is changing?- If you still need to probe for onenand, please create a generic function
ingpmc-onenand.cto probe for onenand
Quoted 5 lines
Quoted 2 lines
I always see "
onenand_base" being passed as argument. Where is it initialized?That is allocated with
gpmc_cs_request()based on the cs in the structomap_onenand_platform_data.
Thanks. Will look into this...
Quoted 8 lines
Quoted 4 lines
I did implement this function to probe for nand/onenand - based on the code that existed in
board-omap3evm-flash.c; but ran into some problems with the setting base address.I guess the probe is only looking at the GPMC configuration registers though?
Quoted 6 lines
Quoted 3 lines
Looking at the
gpmc-onenand.cdo you believe we would need agpmc-nand.con same lines? Or an implementation within theboard-omap3evm.cis okay for now?Well if you can figure out how to do a common
gpmc-nand.c, I'm sure it would make things easier to bring up new boards (and omaps).
MTD devices aren't something that I have been working with :( I am not sure if I could really do justice to all boards; but I will submit a patch and you can decide if it could be a goot start point.
~sanjeev
Quoted 32 lines
Regards,
Tony
Quoted 24 lines
Best regards,
SanjeevQuoted 6 lines
Quoted 3 lines
Quoted 1 line
Some EVMs have OneNAND and others have NAND. How/ Where do
you suggest
Quoted 1 line
this check sould go?
Quoted 10 lines
If it's based on just checking the GPMC registers, you could put it into
gpmc.c.Regards,
Tony
<snip>--<snip>--<snip till end>