nand prefetch-irq support and ecc layout chanage
Subsystems (7)
v8 cover nand prefetch-irq support and ecc layout chanage
The following set of patches applies on linux-2.6.
The main motivations behind this patch series are -
1. support NAND I/O in irq mode.
2. support of different ECC schema.
3. also add support ecc layout as like in romcode ecc layout, but not enabled
v8: free_irq() added; usedtimeout for this while loop.
Rebase and resend of http://www.mail-archive.com/linux-omap at vger.kernel.org/msg41614.html
v7: NAND type (x16 or x8) is board specific and not omap specific; this passed form board file.
http://www.mail-archive.com/linux-omap at vger.kernel.org/msg41469.html
v6: configurable transfer type from board file;
#define irq number used for nand-irq
http://www.mail-archive.com/linux-omap at vger.kernel.org/msg39397.html
v5: http://www.mail-archive.com/linux-omap at vger.kernel.org/msg35860.html This address the input as to support the irq_chained in GPMC. And resend of
http://www.mail-archive.com/linux-omap at vger.kernel.org/msg35848.html
v4: http://www.mail-archive.com/linux-omap at vger.kernel.org/msg34882.html and resend of
http://www.mail-archive.com/linux-omap at vger.kernel.org/msg32689.html
v3: http://www.mail-archive.com/linux-omap at vger.kernel.org/msg32071.html Rebase on latest codebase and previous patch(posted).
http://www.mail-archive.com/linux-omap at vger.kernel.org/msg31963.html
v2: Rebase on latest codebase and previous patch(posted).
http://www.mail-archive.com/linux-omap at vger.kernel.org/msg31471.html
v1: http://www.mail-archive.com/linux-omap at vger.kernel.org/msg26666.html
Sukumar Ghorai (7):
omap3630: nand: fix device size to work in polled mode
omap3: nand: configurable transfer type per board
omap: gpmc: enable irq mode in gpmc
omap3: nand: prefetch in irq mode support
omap3: nand: configurable fifo threshold to gain the throughput
omap3: nand: ecc layout select from board file
omap3: nand: making ecc layout as compatible with romcode ecc
arch/arm/mach-omap2/board-2430sdp.c | 1 + arch/arm/mach-omap2/board-3430sdp.c | 3 +- arch/arm/mach-omap2/board-3630sdp.c | 4 +- arch/arm/mach-omap2/board-4430sdp.c | 2 + arch/arm/mach-omap2/board-am3517evm.c | 2 + arch/arm/mach-omap2/board-apollon.c | 1 + arch/arm/mach-omap2/board-cm-t35.c | 1 + arch/arm/mach-omap2/board-devkit8000.c | 1 + arch/arm/mach-omap2/board-flash.c | 13 +- arch/arm/mach-omap2/board-flash.h | 4 +- arch/arm/mach-omap2/board-generic.c | 2 + arch/arm/mach-omap2/board-h4.c | 1 + arch/arm/mach-omap2/board-igep0020.c | 1 + arch/arm/mach-omap2/board-ldp.c | 3 +- arch/arm/mach-omap2/board-n8x0.c | 2 + arch/arm/mach-omap2/board-omap3beagle.c | 1 + arch/arm/mach-omap2/board-omap3evm.c | 2 + arch/arm/mach-omap2/board-omap3pandora.c | 2 + arch/arm/mach-omap2/board-omap3stalker.c | 1 + arch/arm/mach-omap2/board-omap3touchbook.c | 1 + arch/arm/mach-omap2/board-omap4panda.c | 2 + arch/arm/mach-omap2/board-overo.c | 1 + arch/arm/mach-omap2/board-rx51.c | 1 + arch/arm/mach-omap2/board-zoom.c | 7 +- arch/arm/mach-omap2/gpmc-nand.c | 7 +- arch/arm/mach-omap2/gpmc.c | 50 ++++- arch/arm/mach-omap2/io.c | 3 - arch/arm/plat-omap/include/plat/gpmc.h | 17 ++- arch/arm/plat-omap/include/plat/irqs.h | 9 +- arch/arm/plat-omap/include/plat/nand.h | 11 + drivers/mtd/nand/Kconfig | 17 -- drivers/mtd/nand/omap2.c | 367 +++++++++++++++++++++------- 32 files changed, 411 insertions(+), 129 deletions(-)
PATCH RESEND v8 1/7 omap3630: nand: fix device size to work in polled mode
zoom3 and 3630-sdp having the x16 nand device.
This patch configure gpmc as x16 and select the currect function in driver for polled mode (without prefetch enable) transfer.
--- arch/arm/mach-omap2/board-3430sdp.c | 2 +- arch/arm/mach-omap2/board-3630sdp.c | 3 ++- arch/arm/mach-omap2/board-flash.c | 10 ++++++---- arch/arm/mach-omap2/board-flash.h | 4 ++-- arch/arm/mach-omap2/board-ldp.c | 2 +- arch/arm/mach-omap2/board-zoom.c | 5 +++-- arch/arm/mach-omap2/gpmc-nand.c | 7 +++++-- drivers/mtd/nand/omap2.c | 2 +- 8 files changed, 21 insertions(+), 14 deletions(-)
arch/arm/mach-omap2/board-3430sdp.c +1 -1
@@ -813,7 +813,7 @@ static void __init omap_3430sdp_init(void)omap_serial_init ();usb_musb_init (&musb_board_data);board_smc91x_init (); -board_flash_init (sdp_flash_partitions, chip_sel_3430); +board_flash_init (sdp_flash_partitions, chip_sel_3430,0 );sdp3430_display_init ();enable_board_wakeup_source ();usb_ehci_init (&ehci_pdata);
arch/arm/mach-omap2/board-3630sdp.c +2 -1
@@ -11,6 +11,7 @@#include <linux/platform_device.h> #include <linux/input.h> #include <linux/gpio.h> +#include <linux/mtd/nand.h> #include <asm/mach-types.h> #include <asm/mach/arch.h>
@@ -209,7 +210,7 @@ static void __init omap_sdp_init(void)zoom_peripherals_init ();zoom_display_init ();board_smc91x_init (); -board_flash_init (sdp_flash_partitions, chip_sel_sdp); +board_flash_init (sdp_flash_partitions, chip_sel_sdp,NAND_BUSWIDTH_16 );enable_board_wakeup_source ();usb_ehci_init (&ehci_pdata); }
arch/arm/mach-omap2/board-flash.c +6 -4
@@ -139,11 +139,13 @@ static struct omap_nand_platform_data board_nand_data = { };void -__init board_nand_init (struct mtd_partition *nand_parts,u8 nr_parts,u8 cs) +__init board_nand_init (struct mtd_partition *nand_parts, +u8 nr_parts,u8 cs,int nand_type) { board_nand_data.cs = cs; board_nand_data.parts = nand_parts; - board_nand_data.nr_parts = nr_parts; + board_nand_data.nr_parts = nr_parts; + board_nand_data.devsize = nand_type;gpmc_nand_init (&board_nand_data); }
@@ -194,7 +196,7 @@ unmap:* @return - void. */ void board_flash_init (struct flash_partitions partition_info[], -char chip_sel_board[][GPMC_CS_NUM ]) +char chip_sel_board[][GPMC_CS_NUM ],int nand_type) {u8 cs =0 ;u8 norcs =GPMC_CS_NUM +1 ;
@@ -250,5 +252,5 @@ void board_flash_init(struct flash_partitions partition_info[], "in GPMC\n"); else board_nand_init(partition_info[2].parts, - partition_info[2].nr_parts, nandcs); + partition_info[2].nr_parts, nandcs, nand_type); }
arch/arm/mach-omap2/board-flash.h +2 -2
@@ -25,6 +25,6 @@ struct flash_partitions { };extern void board_flash_init (struct flash_partitions [], -char chip_sel[][GPMC_CS_NUM ]); +char chip_sel[][GPMC_CS_NUM ],int nand_type);extern void board_nand_init (struct mtd_partition *nand_parts, -u8 nr_parts,u8 cs); +u8 nr_parts,u8 cs,int nand_type);
arch/arm/mach-omap2/board-ldp.c +1 -1
@@ -434,7 +434,7 @@ static void __init omap_ldp_init(void)omap_serial_init ();usb_musb_init (&musb_board_data);board_nand_init (ldp_nand_partitions, -ARRAY_SIZE (ldp_nand_partitions),ZOOM_NAND_CS ); +ARRAY_SIZE (ldp_nand_partitions),ZOOM_NAND_CS ,0 );omap2_hsmmc_init (mmc);/* link regulators to MMC adapters */
arch/arm/mach-omap2/board-zoom.c +3 -2
@@ -16,6 +16,7 @@#include <linux/input.h> #include <linux/gpio.h> #include <linux/i2c/twl.h> +#include <linux/mtd/nand.h> #include <asm/mach-types.h> #include <asm/mach/arch.h>
@@ -126,8 +127,8 @@ static void __init omap_zoom_init(void)usb_ehci_init (&ehci_pdata); } -board_nand_init (zoom_nand_partitions, -ARRAY_SIZE (zoom_nand_partitions),ZOOM_NAND_CS ); +board_nand_init (zoom_nand_partitions,ARRAY_SIZE (zoom_nand_partitions), +ZOOM_NAND_CS ,NAND_BUSWIDTH_16 );zoom_debugboard_init ();zoom_peripherals_init ();zoom_display_init ();
arch/arm/mach-omap2/gpmc-nand.c +5 -2
@@ -12,6 +12,7 @@#include <linux/kernel.h> #include <linux/platform_device.h> #include <linux/io.h> +#include <linux/mtd/nand.h> #include <asm/mach/flash.h>
@@ -69,8 +70,10 @@ static int omap2_nand_gpmc_retime(void) t.wr_cycle =gpmc_round_ns_to_ticks (gpmc_nand_data->gpmc_t->wr_cycle);/* Configure GPMC */ -gpmc_cs_configure (gpmc_nand_data->cs, -GPMC_CONFIG_DEV_SIZE , gpmc_nand_data->devsize); +if (gpmc_nand_data->devsize ==NAND_BUSWIDTH_16 ) +gpmc_cs_configure (gpmc_nand_data->cs,GPMC_CONFIG_DEV_SIZE ,1 ); +else +gpmc_cs_configure (gpmc_nand_data->cs,GPMC_CONFIG_DEV_SIZE ,0 );gpmc_cs_configure (gpmc_nand_data->cs,GPMC_CONFIG_DEV_TYPE ,GPMC_DEVICETYPE_NAND ); err =gpmc_cs_set_timings (gpmc_nand_data->cs, &t);
drivers/mtd/nand/omap2.c +1 -1
@@ -804,7 +804,7 @@ static int __devinit omap_nand_probe(struct platform_device *pdev) info->mtd.name =dev_name (&pdev->dev); info->mtd.owner =THIS_MODULE ; - info->nand.options |= pdata->devsize ?NAND_BUSWIDTH_16 :0 ; + info->nand.options = pdata->devsize; info->nand.options |=NAND_SKIP_BBTSCAN ;/* NAND write protect off */
Signature · 1 line
1.7.0.4
PATCH RESEND v8 2/7 omap3: nand: configurable transfer type per board
In reply to Sukumar Ghorainand transfer type (sDMA, Polled, prefetch) can be select from board file, enabling all transfer type in driver, by default.
this helps in multi-omap build and to select different transfer type for different board.
--- arch/arm/plat-omap/include/plat/nand.h | 7 +++ drivers/mtd/nand/Kconfig | 17 ------ drivers/mtd/nand/omap2.c | 94 ++++++++++++-------------------- 3 files changed, 41 insertions(+), 77 deletions(-)
arch/arm/plat-omap/include/plat/nand.h +7 -0
@@ -10,6 +10,12 @@#include <linux/mtd/partitions.h> +enum nand_io { +NAND_OMAP_PREFETCH_POLLED =0 ,/* prefetch polled mode, default */ +NAND_OMAP_POLLED ,/* polled mode, without prefetch */ +NAND_OMAP_PREFETCH_DMA /* prefetch enabled sDMA mode */ +}; +struct omap_nand_platform_data {unsigned int options;int cs;
@@ -20,6 +26,7 @@ struct omap_nand_platform_data {int (*nand_setup)(void );int (*dev_ready)(struct omap_nand_platform_data *);int dma_channel; +enum nand_io xfer_type;unsigned long phys_base;int devsize; };
drivers/mtd/nand/Kconfig +0 -17
@@ -106,23 +106,6 @@ config MTD_NAND_OMAP2 help Support for NAND flash on Texas Instruments OMAP2 and OMAP3 platforms. -config MTD_NAND_OMAP_PREFETCH - bool "GPMC prefetch support for NAND Flash device" - depends on MTD_NAND_OMAP2 - default y - help - The NAND device can be accessed for Read/Write using GPMC PREFETCH engine - to improve the performance. - -config MTD_NAND_OMAP_PREFETCH_DMA - depends on MTD_NAND_OMAP_PREFETCH - bool "DMA mode" - default n - help - The GPMC PREFETCH engine can be configured eigther in MPU interrupt mode - or in DMA interrupt mode. - Say y for DMA mode or MPU mode will be used - config MTD_NAND_IDS tristate
drivers/mtd/nand/omap2.c +34 -60
146 lines not on this page · raw message
Signature · 1 line
1.7.0.4
PATCH RESEND v8 3/7 omap: gpmc: enable irq mode in gpmc
In reply to Sukumar Ghoraiadd support the irq mode in GPMC.gpmc_init() function move after omap_init_irq() as it has dependecy on irq.
--- arch/arm/mach-omap2/board-2430sdp.c | 1 + arch/arm/mach-omap2/board-3430sdp.c | 1 + arch/arm/mach-omap2/board-3630sdp.c | 1 + arch/arm/mach-omap2/board-4430sdp.c | 2 + arch/arm/mach-omap2/board-am3517evm.c | 2 + arch/arm/mach-omap2/board-apollon.c | 1 + arch/arm/mach-omap2/board-cm-t35.c | 1 + arch/arm/mach-omap2/board-devkit8000.c | 1 + arch/arm/mach-omap2/board-generic.c | 2 + arch/arm/mach-omap2/board-h4.c | 1 + arch/arm/mach-omap2/board-igep0020.c | 1 + arch/arm/mach-omap2/board-ldp.c | 1 + arch/arm/mach-omap2/board-n8x0.c | 2 + arch/arm/mach-omap2/board-omap3beagle.c | 1 + arch/arm/mach-omap2/board-omap3evm.c | 2 + arch/arm/mach-omap2/board-omap3pandora.c | 2 + arch/arm/mach-omap2/board-omap3stalker.c | 1 + arch/arm/mach-omap2/board-omap3touchbook.c | 1 + arch/arm/mach-omap2/board-omap4panda.c | 2 + arch/arm/mach-omap2/board-overo.c | 1 + arch/arm/mach-omap2/board-rx51.c | 1 + arch/arm/mach-omap2/board-zoom.c | 2 + arch/arm/mach-omap2/gpmc.c | 39 ++++++++++++++++++++++++++- arch/arm/mach-omap2/io.c | 3 -- arch/arm/plat-omap/include/plat/gpmc.h | 4 +++ arch/arm/plat-omap/include/plat/irqs.h | 9 +++++- 26 files changed, 79 insertions(+), 6 deletions(-)
arch/arm/mach-omap2/board-2430sdp.c +1 -0
@@ -146,6 +146,7 @@ static void __init omap_2430sdp_init_irq(void)omap2_init_common_infrastructure ();omap2_init_common_devices (NULL ,NULL );omap_init_irq (); +gpmc_init (); }static struct twl4030_gpio_platform_data sdp2430_gpio_data = {
arch/arm/mach-omap2/board-3430sdp.c +1 -0
@@ -335,6 +335,7 @@ static void __init omap_3430sdp_init_irq(void)omap2_init_common_infrastructure ();omap2_init_common_devices (hyb18m512160af6_sdrc_params,NULL );omap_init_irq (); +gpmc_init (); }static int sdp3430_batt_table[] = {
arch/arm/mach-omap2/board-3630sdp.c +1 -0
@@ -78,6 +78,7 @@ static void __init omap_sdp_init_irq(void)omap2_init_common_devices (h8mbx00u0mer0em_sdrc_params, h8mbx00u0mer0em_sdrc_params);omap_init_irq (); +gpmc_init (); }#ifdef CONFIG_OMAP_MUX
arch/arm/mach-omap2/board-4430sdp.c +2 -0
@@ -35,6 +35,7 @@#include <plat/common.h> #include <plat/usb.h> #include <plat/mmc.h> +#include <plat/gpmc.h> #include "mux.h" #include "hsmmc.h"
@@ -249,6 +250,7 @@ static void __init omap_4430sdp_init_irq(void)omap2_gp_clockevent_set_gptimer (1 );#endif gic_init_irq (); +gpmc_init (); }static const struct ehci_hcd_omap_platform_data ehci_pdata__initconst = {
arch/arm/mach-omap2/board-am3517evm.c +2 -0
@@ -35,6 +35,7 @@#include <plat/common.h> #include <plat/usb.h> #include <plat/display.h> +#include <plat/gpmc.h> #include <plat/panel-generic-dpi.h> #include "mux.h"
@@ -403,6 +404,7 @@ static void __init am3517_evm_init_irq(void)omap2_init_common_infrastructure ();omap2_init_common_devices (NULL ,NULL );omap_init_irq (); +gpmc_init (); }static struct omap_musb_board_data musb_board_data = {
arch/arm/mach-omap2/board-apollon.c +1 -0
@@ -281,6 +281,7 @@ static void __init omap_apollon_init_irq(void)omap2_init_common_infrastructure ();omap2_init_common_devices (NULL ,NULL );omap_init_irq (); +gpmc_init (); }static void __init apollon_led_init (void )
arch/arm/mach-omap2/board-cm-t35.c +1 -0
@@ -692,6 +692,7 @@ static void __init cm_t35_init_irq(void)omap2_init_common_devices (mt46h32m32lf6_sdrc_params, mt46h32m32lf6_sdrc_params);omap_init_irq (); +gpmc_init (); }static struct omap_board_mux board_mux[]__initdata = {
arch/arm/mach-omap2/board-devkit8000.c +1 -0
@@ -458,6 +458,7 @@ static void __init devkit8000_init_irq(void)omap2_init_common_devices (mt46h32m32lf6_sdrc_params, mt46h32m32lf6_sdrc_params);omap_init_irq (); +gpmc_init ();#ifdef CONFIG_OMAP_32K_TIMER omap2_gp_clockevent_set_gptimer (12 );#endif
arch/arm/mach-omap2/board-generic.c +2 -0
@@ -29,6 +29,7 @@#include <plat/usb.h> #include <plat/board.h> #include <plat/common.h> +#include <plat/gpmc.h> static struct omap_board_config_kernel generic_config[] = { };
@@ -40,6 +41,7 @@ static void __init omap_generic_init_irq(void)omap2_init_common_infrastructure ();omap2_init_common_devices (NULL ,NULL );omap_init_irq (); +gpmc_init (); }static void __init omap_generic_init (void )
arch/arm/mach-omap2/board-h4.c +1 -0
@@ -297,6 +297,7 @@ static void __init omap_h4_init_irq(void)omap2_init_common_infrastructure ();omap2_init_common_devices (NULL ,NULL );omap_init_irq (); +gpmc_init ();h4_init_flash (); }
arch/arm/mach-omap2/board-igep0020.c +1 -0
@@ -531,6 +531,7 @@ static void __init igep2_init_irq(void)omap2_init_common_devices (m65kxxxxam_sdrc_params, m65kxxxxam_sdrc_params);omap_init_irq (); +gpmc_init (); }static struct twl4030_codec_audio_data igep2_audio_data = {
arch/arm/mach-omap2/board-ldp.c +1 -0
@@ -295,6 +295,7 @@ static void __init omap_ldp_init_irq(void)omap2_init_common_infrastructure ();omap2_init_common_devices (NULL ,NULL );omap_init_irq (); +gpmc_init (); }static struct twl4030_usb_data ldp_usb_data = {
arch/arm/mach-omap2/board-n8x0.c +2 -0
@@ -33,6 +33,7 @@#include <plat/onenand.h> #include <plat/mmc.h> #include <plat/serial.h> +#include <plat/gpmc.h> #include "mux.h"
@@ -633,6 +634,7 @@ static void __init n8x0_init_irq(void)omap2_init_common_infrastructure ();omap2_init_common_devices (NULL ,NULL );omap_init_irq (); +gpmc_init (); }#ifdef CONFIG_OMAP_MUX
arch/arm/mach-omap2/board-omap3beagle.c +1 -0
@@ -542,6 +542,7 @@ static void __init omap3_beagle_init_irq(void)omap2_init_common_devices (mt46h32m32lf6_sdrc_params, mt46h32m32lf6_sdrc_params);omap_init_irq (); +gpmc_init ();#ifdef CONFIG_OMAP_32K_TIMER omap2_gp_clockevent_set_gptimer (12 );#endif
arch/arm/mach-omap2/board-omap3evm.c +2 -0
@@ -43,6 +43,7 @@#include <plat/common.h> #include <plat/mcspi.h> #include <plat/display.h> +#include <plat/gpmc.h> #include <plat/panel-generic-dpi.h> #include "mux.h"
@@ -632,6 +633,7 @@ static void __init omap3_evm_init_irq(void)omap2_init_common_infrastructure ();omap2_init_common_devices (mt46h32m32lf6_sdrc_params,NULL );omap_init_irq (); +gpmc_init (); }static struct platform_device *omap3_evm_devices[]__initdata = {
arch/arm/mach-omap2/board-omap3pandora.c +2 -0
@@ -47,6 +47,7 @@#include <plat/mcspi.h> #include <plat/usb.h> #include <plat/display.h> +#include <plat/gpmc.h> #include <plat/nand.h> #include "mux.h"
@@ -640,6 +641,7 @@ static void __init omap3pandora_init_irq(void)omap2_init_common_devices (mt46h32m32lf6_sdrc_params, mt46h32m32lf6_sdrc_params);omap_init_irq (); +gpmc_init (); }static void __init pandora_wl1251_init (void )
arch/arm/mach-omap2/board-omap3stalker.c +1 -0
@@ -598,6 +598,7 @@ static void __init omap3_stalker_init_irq(void)omap2_init_common_infrastructure ();omap2_init_common_devices (mt46h32m32lf6_sdrc_params,NULL );omap_init_irq (); +gpmc_init ();#ifdef CONFIG_OMAP_32K_TIMER omap2_gp_clockevent_set_gptimer (12 );#endif
arch/arm/mach-omap2/board-omap3touchbook.c +1 -0
@@ -424,6 +424,7 @@ static void __init omap3_touchbook_init_irq(void)omap2_init_common_devices (mt46h32m32lf6_sdrc_params, mt46h32m32lf6_sdrc_params);omap_init_irq (); +gpmc_init ();#ifdef CONFIG_OMAP_32K_TIMER omap2_gp_clockevent_set_gptimer (12 );#endif
arch/arm/mach-omap2/board-omap4panda.c +2 -0
@@ -37,6 +37,7 @@#include <plat/common.h> #include <plat/usb.h> #include <plat/mmc.h> +#include <plat/gpmc.h> #include "timer-gp.h" #include "hsmmc.h"
@@ -81,6 +82,7 @@ static void __init omap4_panda_init_irq(void)omap2_init_common_infrastructure ();omap2_init_common_devices (NULL ,NULL );gic_init_irq (); +gpmc_init (); }static const struct ehci_hcd_omap_platform_data ehci_pdata__initconst = {
arch/arm/mach-omap2/board-overo.c +1 -0
@@ -417,6 +417,7 @@ static void __init overo_init_irq(void)omap2_init_common_devices (mt46h32m32lf6_sdrc_params, mt46h32m32lf6_sdrc_params);omap_init_irq (); +gpmc_init (); }static struct platform_device *overo_devices[]__initdata = {
arch/arm/mach-omap2/board-rx51.c +1 -0
@@ -109,6 +109,7 @@ static void __init rx51_init_irq(void) sdrc_params =nokia_get_sdram_timings ();omap2_init_common_devices (sdrc_params, sdrc_params);omap_init_irq (); +gpmc_init (); }extern void __init rx51_peripherals_init (void );
arch/arm/mach-omap2/board-zoom.c +2 -0
@@ -24,6 +24,7 @@#include <plat/common.h> #include <plat/board.h> #include <plat/usb.h> +#include <plat/gpmc.h> #include <mach/board-zoom.h>
@@ -45,6 +46,7 @@ static void __init omap_zoom_init_irq(void) h8mbx00u0mer0em_sdrc_params);omap_init_irq (); +gpmc_init (); }#ifdef CONFIG_OMAP_MUX
arch/arm/mach-omap2/gpmc.c +37 -2
@@ -14,6 +14,7 @@*/ #undef DEBUG +#include <linux/irq.h> #include <linux/kernel.h> #include <linux/init.h> #include <linux/err.h>
@@ -22,12 +23,12 @@#include <linux/spinlock.h> #include <linux/io.h> #include <linux/module.h> +#include <linux/interrupt.h> #include <asm/mach-types.h> #include <plat/gpmc.h> #include <plat/sdrc.h> -/* GPMC register offsets */ #define GPMC_REVISION 0x00#define GPMC_SYSCONFIG 0x10
@@ -100,6 +101,8 @@ static void __iomem *gpmc_base;static struct clk *gpmc_l3_clk; +static irqreturn_t gpmc_handle_irq (int irq,void *dev); +static void gpmc_write_reg (int idx,u32 val) {__raw_writel (val, gpmc_base + idx);
@@ -497,6 +500,10 @@ int gpmc_cs_configure(int cs, int cmd, int wval)u32 regval =0 ;switch (cmd) { +case GPMC_ENABLE_IRQ : +gpmc_write_reg (GPMC_IRQENABLE , wval); +break ; +case GPMC_SET_IRQ_STATUS :gpmc_write_reg (GPMC_IRQSTATUS , wval);break ;
@@ -680,7 +687,8 @@ static void __init gpmc_mem_init(void)void __init gpmc_init (void ) { -u32 l; +u32 l, irq; +int cs;char *ck =NULL ;if (cpu_is_omap24xx ()) {
@@ -723,6 +731,33 @@ void __init gpmc_init(void) l |= (0x02 <<3 ) | (1 <<0 );gpmc_write_reg (GPMC_SYSCONFIG , l);gpmc_mem_init (); + +/* initalize the irq_chained */ + irq =OMAP_GPMC_IRQ_BASE ; +for (cs =0 ; cs <GPMC_CS_NUM ; cs++) { +set_irq_handler (irq, handle_simple_irq); +set_irq_flags (irq,IRQF_VALID ); + irq++; + } + +if (request_irq (INT_34XX_GPMC_IRQ , + gpmc_handle_irq,IRQF_SHARED ,"gpmc" , gpmc_base)) +pr_err ("gpmc: irq-%d could not claim: err %d\n" , +INT_34XX_GPMC_IRQ , irq); +} + +static irqreturn_t gpmc_handle_irq (int irq,void *dev) +{ +u8 cs; + +if (irq !=INT_34XX_GPMC_IRQ ) +return IRQ_HANDLED ; +/* check cs to invoke the irq */ + cs = ((gpmc_read_reg (GPMC_PREFETCH_CONFIG1 )) >>CS_NUM_SHIFT ) &0x7 ; +if (OMAP_GPMC_IRQ_BASE +cs <=OMAP_GPMC_IRQ_END ) +generic_handle_irq (OMAP_GPMC_IRQ_BASE +cs); + +return IRQ_HANDLED ; }#ifdef CONFIG_ARCH_OMAP3
arch/arm/mach-omap2/io.c +0 -3
@@ -30,7 +30,6 @@#include <plat/sram.h> #include <plat/sdrc.h> -#include <plat/gpmc.h> #include <plat/serial.h> #include "clock2xxx.h"
@@ -408,8 +407,6 @@ void __init omap2_init_common_devices(struct omap_sdrc_params *sdrc_cs0,omap2_sdrc_init (sdrc_cs0, sdrc_cs1);_omap2_init_reprogram_sdrc (); } -gpmc_init (); -omap_irq_base_init (); }
arch/arm/plat-omap/include/plat/gpmc.h +4 -0
@@ -41,6 +41,8 @@#define GPMC_NAND_ADDRESS 0x0000000b#define GPMC_NAND_DATA 0x0000000c +#define GPMC_ENABLE_IRQ 0x0000000d +/* ECC commands */ #define GPMC_ECC_READ 0/* Reset Hardware ECC for read */ #define GPMC_ECC_WRITE 1/* Reset Hardware ECC for write */
@@ -78,6 +80,8 @@#define WR_RD_PIN_MONITORING 0x00600000#define GPMC_PREFETCH_STATUS_FIFO_CNT (val) ((val >> 24) & 0x7F)#define GPMC_PREFETCH_STATUS_COUNT (val) (val & 0x00003fff) +#define GPMC_IRQ_FIFOEVENTENABLE 0x01 +#define GPMC_IRQ_COUNT_EVENT 0x02/* * Note that all values in this struct are in nanoseconds except sync_clk
arch/arm/plat-omap/include/plat/irqs.h +8 -1
@@ -318,6 +318,7 @@#define INT_34XX_PRCM_MPU_IRQ 11#define INT_34XX_MCBSP1_IRQ 16#define INT_34XX_MCBSP2_IRQ 17 +#define INT_34XX_GPMC_IRQ 20#define INT_34XX_MCBSP3_IRQ 22#define INT_34XX_MCBSP4_IRQ 23#define INT_34XX_CAM_IRQ 24
@@ -411,7 +412,13 @@#define TWL_IRQ_END TWL6030_IRQ_END#endif -#define NR_IRQS TWL_IRQ_END +/* GPMC related */ +#define OMAP_GPMC_IRQ_BASE (TWL_IRQ_END) +#define OMAP_GPMC_NR_IRQS 7 +#define OMAP_GPMC_IRQ_END (OMAP_GPMC_IRQ_BASE + OMAP_GPMC_NR_IRQS) + + +#define NR_IRQS OMAP_GPMC_IRQ_END#define OMAP_IRQ_BIT (irq) (1 << ((irq) % 32))
Signature · 1 line
1.7.0.4
Tony Lindgren
maintainerPATCH RESEND v8 3/7 omap: gpmc: enable irq mode in gpmc
Quoted 20 lines · Sukumar Ghorai
add support the irq mode in GPMC.
gpmc_init()function move afteromap_init_irq()as it has dependecy on irq.arch/arm/mach-omap2/board-2430sdp.c +1
-0@@ -146,6 +146,7 @@ static void __init omap_2430sdp_init_irq(void)omap2_init_common_infrastructure ();omap2_init_common_devices (NULL ,NULL );omap_init_irq (); +gpmc_init (); }static struct twl4030_gpio_platform_data sdp2430_gpio_data = {arch/arm/mach-omap2/board-3430sdp.c +0
-0
arch/arm/mach-omap2/board-3430sdp.c static void __init omap_3430sdp_init_irq(void) · line 339
Quoted 5 lines
arch/arm/mach-omap2/board-3430sdp.c +1
-0@@ -335,6 +335,7 @@ static void __init omap_3430sdp_init_irq(void)omap2_init_common_infrastructure ();omap2_init_common_devices (hyb18m512160af6_sdrc_params,NULL );omap_init_irq (); +gpmc_init (); }
...
I think I've commented on this before, but why don't you make gpmc_init a subsys_initcall? There should be no reason to call this earlier. If something does not work because of that, then that issue must be fixed.
Tony
PATCH RESEND v8 3/7 omap: gpmc: enable irq mode in gpmc
Quoted 15 lines
-----Original Message-----
From: Tony Lindgren [mailto:tony at atomide.com]
Sent: Saturday, January 22, 2011 12:10 AM
To: Ghorai, Sukumar
Cc: linux-omap at vger.kernel.org; linux-mtd at lists.infradead.org; linux-arm- kernel at lists.infradead.org
Subject: Re: [PATCH RESEND v8 3/7] omap: gpmc: enable irq mode in gpmcQuoted 2 lines · Sukumar Ghorai
add support the irq mode in GPMC.
gpmc_init()function move afteromap_init_irq()as it has dependecy onirq.
Quoted 1 line
[..snip..]
Quoted 15 lines
arch/arm/mach-
Quoted 3 lines
static struct
twl4030_gpio_platform_datasdp2430_gpio_data= {arch/arm/mach- renamed from arch/arm/mach-omap2/board-3430sdp.c +0
-0
omap2/board-3430sdp.cQuoted 9 lines
index 8fb5f43..8304d16 100644
arch/arm/mach-omap2/board-3430sdp.c +1
-0@@ -335,6 +335,7 @@ static void __init omap_3430sdp_init_irq(void)omap2_init_common_infrastructure ();omap2_init_common_devices (hyb18m512160af6_sdrc_params,NULL );omap_init_irq (); +gpmc_init (); }...
Quoted 4 lines
I think I've commented on this before, but why don't you make
gpmc_initasubsys_initcall? There should be no reason to call this earlier. If something does not work because of that, then that issue must be fixed.
[Ghorai] You suggested the same in previous v5 and v6; and I mentioned the issues [1] that - nand_init()called before subsys_initcall(gpmc_init); Let me know if I am missing anything again.
[1] https://patchwork.kernel.org/patch/212452/
[2] https://patchwork.kernel.org/patch/359152/
Quoted 2 lines
Tony
Tony Lindgren
maintainerPATCH RESEND v8 3/7 omap: gpmc: enable irq mode in gpmc
Quoted 9 lines · Ghorai, Sukumar
Quoted 5 lines
I think I've commented on this before, but why don't you make
gpmc_initasubsys_initcall? There should be no reason to call this earlier. If something does not work because of that, then that issue must be fixed.[Ghorai] You suggested the same in previous v5 and v6; and I mentioned the issues [1] that - nand_init()called before
subsys_initcall(gpmc_init); Let me know if I am missing anything again.
There should not be any need to call nand_init early either. We want to initialize as much as possible late so we have proper console error messages.
Tony
PATCH RESEND v8 3/7 omap: gpmc: enable irq mode in gpmc
Quoted 18 lines
-----Original Message-----
From: Tony Lindgren [mailto:tony at atomide.com]
Sent: Tuesday, January 25, 2011 10:28 PM
To: Ghorai, Sukumar
Cc: linux-omap at vger.kernel.org; linux-mtd at lists.infradead.org; linux-arm- kernel at lists.infradead.org
Subject: Re: [PATCH RESEND v8 3/7] omap: gpmc: enable irq mode in gpmcQuoted 2 lines · Ghorai, Sukumar
Quoted 2 lines
I think I've commented on this before, but why don't you make
gpmc_initQuoted 4 lines
Quoted 3 lines
a
subsys_initcall? There should be no reason to call this earlier. If something does not work because of that, then that issue must be fixed.
Quoted 8 lines
Quoted 2 lines
[Ghorai] You suggested the same in previous v5 and v6; and I mentioned the issues [1] that - nand_init()called before
subsys_initcall(gpmc_init);Quoted 1 line
Let me know if I am missing anything again.
There should not be any need to call
nand_initearly either. We want to initialize as much as possible late so we have proper console error messages.
[Ghorai] thanks...
changed to postcore_initcall() and it solved the problem I mentioned earlier. And it simplifies the overall modification in different board files. postcore_initcall(gpmc_init);
Quoted 2 lines
Tony
Tony Lindgren
maintainerPATCH RESEND v8 3/7 omap: gpmc: enable irq mode in gpmc
Quoted 23 lines · Ghorai, Sukumar
Quoted 23 lines
-----Original Message-----
From: Tony Lindgren [mailto:tony at atomide.com]
Sent: Tuesday, January 25, 2011 10:28 PM
To: Ghorai, Sukumar
Cc: linux-omap at vger.kernel.org; linux-mtd at lists.infradead.org; linux-arm- kernel at lists.infradead.org
Subject: Re: [PATCH RESEND v8 3/7] omap: gpmc: enable irq mode in gpmcQuoted 2 lines · Ghorai, Sukumar
Quoted 2 lines
I think I've commented on this before, but why don't you make
gpmc_initQuoted 6 lines
Quoted 3 lines
a
subsys_initcall? There should be no reason to call this earlier. If something does not work because of that, then that issue must be fixed.[Ghorai] You suggested the same in previous v5 and v6; and I mentioned the issues [1] that - nand_init()called before
subsys_initcall(gpmc_init);Quoted 1 line
Let me know if I am missing anything again.
Quoted 7 lines
Quoted 3 lines
There should not be any need to call
nand_initearly either. We want to initialize as much as possible late so we have proper console error messages.[Ghorai] thanks...
changed topostcore_initcall()and it solved the problem I mentioned earlier. And it simplifies the overall modification in different board files.postcore_initcall(gpmc_init);
OK great. I will check the order of initcalls anyways over next few weeks, so whatever works for the initcall is fine for now.
Regards,
Tony
PATCH RESEND v8 4/7 omap3: nand: prefetch in irq mode support
In reply to Sukumar GhoraiThis patch enable prefetch-irq mode for nand transfer(read, write)
--- arch/arm/mach-omap2/board-flash.c | 2 + arch/arm/plat-omap/include/plat/nand.h | 4 +- drivers/mtd/nand/omap2.c | 198 ++++++++++++++++++++++++++++++-- 3 files changed, 194 insertions(+), 10 deletions(-)
arch/arm/mach-omap2/board-flash.c +2 -0
@@ -16,6 +16,7 @@#include <linux/platform_device.h> #include <linux/mtd/physmap.h> #include <linux/io.h> +#include <plat/irqs.h> #include <plat/gpmc.h> #include <plat/nand.h>
@@ -147,6 +148,7 @@ __init board_nand_init(struct mtd_partition *nand_parts, board_nand_data.nr_parts = nr_parts; board_nand_data.devsize = nand_type; + board_nand_data.gpmc_irq =OMAP_GPMC_IRQ_BASE + cs; gpmc_nand_init(&board_nand_data); }#else
arch/arm/plat-omap/include/plat/nand.h +3 -1
@@ -13,7 +13,8 @@enum nand_io {NAND_OMAP_PREFETCH_POLLED =0 ,/* prefetch polled mode, default */ NAND_OMAP_POLLED ,/* polled mode, without prefetch */ -NAND_OMAP_PREFETCH_DMA /* prefetch enabled sDMA mode */ +NAND_OMAP_PREFETCH_DMA ,/* prefetch enabled sDMA mode */ +NAND_OMAP_PREFETCH_IRQ /* prefetch enabled irq mode */ };struct omap_nand_platform_data {
@@ -26,6 +27,7 @@ struct omap_nand_platform_data {int (*nand_setup)(void );int (*dev_ready)(struct omap_nand_platform_data *);int dma_channel; +int gpmc_irq;enum nand_io xfer_type;unsigned long phys_base;int devsize;
drivers/mtd/nand/omap2.c +189 -9
271 lines not on this page · raw message
Signature · 1 line
1.7.0.4
PATCH RESEND v8 5/7 omap3: nand: configurable fifo threshold to gain the throughput
In reply to Sukumar GhoraiConfigure the FIFO THREASHOLD value different for read and write to keep busy both filling and to drain out of FIFO at reading and writing.
--- arch/arm/mach-omap2/gpmc.c | 11 +++++++---- arch/arm/plat-omap/include/plat/gpmc.h | 5 ++++- drivers/mtd/nand/omap2.c | 22 ++++++++++++++-------- 3 files changed, 25 insertions(+), 13 deletions(-)
arch/arm/mach-omap2/gpmc.c +7 -4
@@ -59,7 +59,6 @@#define GPMC_CHUNK_SHIFT 24/* 16 MB */ #define GPMC_SECTION_SHIFT 28/* 128 MB */ -#define PREFETCH_FIFOTHRESHOLD (0x40 << 8)#define CS_NUM_SHIFT 24#define ENABLE_PREFETCH (0x1 << 7)#define DMA_MPU_MODE 2
@@ -605,15 +604,19 @@ EXPORT_SYMBOL(gpmc_nand_write);/** * gpmc_prefetch_enable - configures and starts prefetch transfer * @cs: cs (chip select) number +* @fifo_th: fifo threshold to be used for read/ write * @dma_mode: dma mode enable (1) or disable (0) * @u32_count: number of bytes to be transferred * @is_write: prefetch read(0) or write post(1) mode */ -int gpmc_prefetch_enable (int cs,int dma_mode, +int gpmc_prefetch_enable (int cs,int fifo_th,int dma_mode,unsigned int u32_count,int is_write) { -if (!(gpmc_read_reg (GPMC_PREFETCH_CONTROL ))) { +if (fifo_th >PREFETCH_FIFOTHRESHOLD_MAX ) { +pr_err ("gpmc: fifo threshold is not supported\n" ); +return -1 ; + }else if (!(gpmc_read_reg (GPMC_PREFETCH_CONTROL ))) {/* Set the amount of bytes to be prefetched */ gpmc_write_reg (GPMC_PREFETCH_CONFIG2 , u32_count);
@@ -621,7 +624,7 @@ int gpmc_prefetch_enable(int cs, int dma_mode,* enable the engine. Set which cs is has requested for. */ gpmc_write_reg (GPMC_PREFETCH_CONFIG1 , ((cs <<CS_NUM_SHIFT ) | -PREFETCH_FIFOTHRESHOLD | +PREFETCH_FIFOTHRESHOLD (fifo_th) |ENABLE_PREFETCH | (dma_mode <<DMA_MPU_MODE ) | (0x1 & is_write)));
arch/arm/plat-omap/include/plat/gpmc.h +4 -1
@@ -83,6 +83,9 @@#define GPMC_IRQ_FIFOEVENTENABLE 0x01#define GPMC_IRQ_COUNT_EVENT 0x02 +#define PREFETCH_FIFOTHRESHOLD_MAX 0x40 +#define PREFETCH_FIFOTHRESHOLD (val) ((val) << 8) +/* * Note that all values in this struct are in nanoseconds except sync_clk * (which is in picoseconds), while the register values are in gpmc_fck cycles.
@@ -134,7 +137,7 @@ extern int gpmc_cs_request(int cs, unsigned long size, unsigned long *base);extern void gpmc_cs_free (int cs);extern int gpmc_cs_set_reserved (int cs,int reserved);extern int gpmc_cs_reserved (int cs); -extern int gpmc_prefetch_enable (int cs,int dma_mode, +extern int gpmc_prefetch_enable (int cs,int fifo_th,int dma_mode,unsigned int u32_count,int is_write);extern int gpmc_prefetch_reset (int cs);extern void omap3_gpmc_save_context (void );
drivers/mtd/nand/omap2.c +14 -8
@@ -244,7 +244,8 @@ static void omap_read_buf_pref(struct mtd_info *mtd, u_char *buf, int len) }/* configure and start prefetch transfer */ - ret =gpmc_prefetch_enable (info->gpmc_cs,0x0 , len,0x0 ); + ret =gpmc_prefetch_enable (info->gpmc_cs, +PREFETCH_FIFOTHRESHOLD_MAX ,0x0 , len,0x0 );if (ret) {/* PFPW engine is busy, use cpu copy method */ if (info->nand.options &NAND_BUSWIDTH_16 )
@@ -289,7 +290,8 @@ static void omap_write_buf_pref(struct mtd_info *mtd, }/* configure and start prefetch transfer */ - ret =gpmc_prefetch_enable (info->gpmc_cs,0x0 , len,0x1 ); + ret =gpmc_prefetch_enable (info->gpmc_cs, +PREFETCH_FIFOTHRESHOLD_MAX ,0x0 , len,0x1 );if (ret) {/* PFPW engine is busy, use cpu copy method */ if (info->nand.options &NAND_BUSWIDTH_16 )
@@ -345,8 +347,9 @@ static inline int omap_nand_dma_transfer(struct mtd_info *mtd, void *addr,int ret;unsigned long tim, limit; -/* The fifo depth is 64 bytes. We have a sync at each frame and frame -* length is 64 bytes. +/* The fifo depth is 64 bytes max. +* But configure the FIFO-threahold to 32 to get a sync at each frame +* and frame length is 32 bytes. */ int buf_len = len >>6 ;
@@ -387,7 +390,8 @@ static inline int omap_nand_dma_transfer(struct mtd_info *mtd, void *addr, OMAP24XX_DMA_GPMC, OMAP_DMA_SRC_SYNC); }/* configure and start prefetch transfer */ - ret =gpmc_prefetch_enable (info->gpmc_cs,0x1 , len, is_write); + ret =gpmc_prefetch_enable (info->gpmc_cs, +PREFETCH_FIFOTHRESHOLD_MAX ,0x1 , len, is_write);if (ret)/* PFPW engine is busy, use cpu copy method */ goto out_copy;
@@ -522,7 +526,8 @@ static void omap_read_buf_irq_pref(struct mtd_info *mtd, u_char *buf, int len)init_completion (&info->comp);/* configure and start prefetch transfer */ - ret =gpmc_prefetch_enable (info->gpmc_cs,0x0 , len,0x0 ); + ret =gpmc_prefetch_enable (info->gpmc_cs, +PREFETCH_FIFOTHRESHOLD_MAX /2 ,0x0 , len,0x0 );if (ret)/* PFPW engine is busy, use cpu copy method */ goto out_copy;
@@ -569,8 +574,9 @@ static void omap_write_buf_irq_pref(struct mtd_info *mtd, info->buf = (u_char *) buf;init_completion (&info->comp); -/* configure and start prefetch transfer */ - ret =gpmc_prefetch_enable (info->gpmc_cs,0x0 , len,0x1 ); +/* configure and start prefetch transfer : size=24 */ + ret =gpmc_prefetch_enable (info->gpmc_cs, + (PREFETCH_FIFOTHRESHOLD_MAX *3 ) /8 ,0x0 , len,0x1 );if (ret)/* PFPW engine is busy, use cpu copy method */ goto out_copy;
Signature · 1 line
1.7.0.4
PATCH RESEND v8 6/7 omap3: nand: ecc layout select from board file
In reply to Sukumar GhoraiThis patch makes it possible to select sw or hw (different layout options) ecc scheme supported by omap nand driver.
--- arch/arm/mach-omap2/board-flash.c | 1 + arch/arm/plat-omap/include/plat/gpmc.h | 6 ++++++ arch/arm/plat-omap/include/plat/nand.h | 2 ++ drivers/mtd/nand/omap2.c | 26 +++++++++++--------------- 4 files changed, 20 insertions(+), 15 deletions(-)
arch/arm/mach-omap2/board-flash.c +1 -0
@@ -148,6 +148,7 @@ __init board_nand_init(struct mtd_partition *nand_parts, board_nand_data.nr_parts = nr_parts; board_nand_data.devsize = nand_type; + board_nand_data.ecc_opt =OMAP_ECC_HAMMING_CODE_DEFAULT ; board_nand_data.gpmc_irq =OMAP_GPMC_IRQ_BASE + cs;gpmc_nand_init (&board_nand_data); }
arch/arm/plat-omap/include/plat/gpmc.h +6 -0
@@ -86,6 +86,12 @@#define PREFETCH_FIFOTHRESHOLD_MAX 0x40#define PREFETCH_FIFOTHRESHOLD (val) ((val) << 8) +enum omap_ecc { +/* 1-bit ecc: stored@end of spare area */ +OMAP_ECC_HAMMING_CODE_DEFAULT =0 ,/* Default, s/w method */ +OMAP_ECC_HAMMING_CODE_HW ,/* gpmc to detect the error */ +}; +/* * Note that all values in this struct are in nanoseconds except sync_clk * (which is in picoseconds), while the register values are in gpmc_fck cycles.
arch/arm/plat-omap/include/plat/nand.h +2 -0
@@ -8,6 +8,7 @@* published by the Free Software Foundation. */ +#include <plat/gpmc.h> #include <linux/mtd/partitions.h> enum nand_io {
@@ -31,6 +32,7 @@ struct omap_nand_platform_data {enum nand_io xfer_type;unsigned long phys_base;int devsize; +enum omap_ecc ecc_opt; };/* minimum size for IO mapping */
drivers/mtd/nand/omap2.c +11 -15
@@ -626,8 +626,6 @@ static int omap_verify_buf(struct mtd_info *mtd, const u_char * buf, int len)return 0 ; } -#ifdef CONFIG_MTD_NAND_OMAP_HWECC -/** * gen_true_ecc - This function will generate true ECC value * @ecc_buf: buffer to store ecc code
@@ -847,8 +845,6 @@ static void omap_enable_hwecc(struct mtd_info *mtd, int mode)gpmc_enable_hwecc (info->gpmc_cs, mode, dev_width, info->nand.ecc.size); } -#endif -/** * omap_wait - wait until the command is done * @mtd: MTD device structure
@@ -1038,17 +1034,17 @@ static int __devinit omap_nand_probe(struct platform_device *pdev) info->nand.verify_buf = omap_verify_buf; -#ifdef CONFIG_MTD_NAND_OMAP_HWECC - info->nand.ecc.bytes =3 ; - info->nand.ecc.size =512 ; - info->nand.ecc.calculate = omap_calculate_ecc; - info->nand.ecc.hwctl = omap_enable_hwecc; - info->nand.ecc.correct = omap_correct_data; - info->nand.ecc.mode =NAND_ECC_HW ; - -#else - info->nand.ecc.mode =NAND_ECC_SOFT ; -#endif +/* selsect the ecc type */ +if (pdata->ecc_opt ==OMAP_ECC_HAMMING_CODE_DEFAULT ) + info->nand.ecc.mode =NAND_ECC_SOFT ; +else if (pdata->ecc_opt ==OMAP_ECC_HAMMING_CODE_HW ) { + info->nand.ecc.bytes =3 ; + info->nand.ecc.size =512 ; + info->nand.ecc.calculate = omap_calculate_ecc; + info->nand.ecc.hwctl = omap_enable_hwecc; + info->nand.ecc.correct = omap_correct_data; + info->nand.ecc.mode =NAND_ECC_HW ; + }/* DIP switches on some boards change between 8 and 16 bit * bus widths for flash. Try the other width if the first try fails.
Signature · 1 line
1.7.0.4
PATCH RESEND v8 7/7 omap3: nand: making ecc layout as compatible with romcode ecc
In reply to Sukumar GhoraiThis patch overrides nand ecc layout and bad block descriptor (for 8-bit device) to support hw ecc in romcode layout. So as to have in sync with ecc layout throughout; i.e. x-loader, u-boot and kernel.
This enables to flash x-loader, u-boot, kernel, FS images from kernel itself and compatiable with other tools.
This patch does not enables this feature by default and need to pass from board file to enable for any board.
--- arch/arm/plat-omap/include/plat/gpmc.h | 2 + drivers/mtd/nand/omap2.c | 37 +++++++++++++++++++++++++++++++- 2 files changed, 38 insertions(+), 1 deletions(-)
arch/arm/plat-omap/include/plat/gpmc.h +2 -0
@@ -90,6 +90,8 @@ enum omap_ecc {/* 1-bit ecc: stored at end of spare area */ OMAP_ECC_HAMMING_CODE_DEFAULT =0 ,/* Default, s/w method */ OMAP_ECC_HAMMING_CODE_HW ,/* gpmc to detect the error */ +/* 1-bit ecc: stored at begining of spare area as romcode */ + OMAP_ECC_HAMMING_CODE_HW_ROMCODE, /* gpmc method & romcode layout */ };/*
drivers/mtd/nand/omap2.c +36 -1
@@ -98,6 +98,20 @@static const char *part_probes[] = {"cmdlinepart" ,NULL };#endif +/* oob info generated runtime depending on ecc algorithm and layout selected */ +static struct nand_ecclayout omap_oobinfo; +/* Define some generic bad / good block scan pattern which are used +* while scanning a device for factory marked good / bad blocks +*/ +static uint8_t scan_ff_pattern[] = {0xff }; +static struct nand_bbt_descr bb_descrip_flashbased = { + .options =NAND_BBT_SCANEMPTY |NAND_BBT_SCANALLPAGES , + .offs =0 , + .len =1 , + .pattern = scan_ff_pattern, +}; + +struct omap_nand_info {struct nand_hw_control controller;struct omap_nand_platform_data *pdata;
@@ -914,6 +928,7 @@ static int __devinit omap_nand_probe(struct platform_device *pdev)struct omap_nand_info *info;struct omap_nand_platform_data *pdata;int err; +int i, offset; pdata = pdev->dev.platform_data;if (pdata ==NULL ) {
@@ -1037,7 +1052,8 @@ static int __devinit omap_nand_probe(struct platform_device *pdev)/* selsect the ecc type */ if (pdata->ecc_opt ==OMAP_ECC_HAMMING_CODE_DEFAULT ) info->nand.ecc.mode =NAND_ECC_SOFT ; -else if (pdata->ecc_opt ==OMAP_ECC_HAMMING_CODE_HW ) { +else if ((pdata->ecc_opt ==OMAP_ECC_HAMMING_CODE_HW ) || + (pdata->ecc_opt ==OMAP_ECC_HAMMING_CODE_HW_ROMCODE )) { info->nand.ecc.bytes =3 ; info->nand.ecc.size =512 ; info->nand.ecc.calculate = omap_calculate_ecc;
@@ -1057,6 +1073,25 @@ static int __devinit omap_nand_probe(struct platform_device *pdev) } } +/* rom code layout */ +if (pdata->ecc_opt ==OMAP_ECC_HAMMING_CODE_HW_ROMCODE ) { + +if (info->nand.options &NAND_BUSWIDTH_16 ) + offset =2 ; +else { + offset =1 ; + info->nand.badblock_pattern = &bb_descrip_flashbased; + } + omap_oobinfo.eccbytes =3 * (info->mtd.oobsize/16 ); +for (i =0 ; i < omap_oobinfo.eccbytes; i++) + omap_oobinfo.eccpos[i] = i+offset; + + omap_oobinfo.oobfree->offset = offset + omap_oobinfo.eccbytes; + omap_oobinfo.oobfree->length = info->mtd.oobsize - + (offset + omap_oobinfo.eccbytes); + + info->nand.ecc.layout = &omap_oobinfo; + }#ifdef CONFIG_MTD_PARTITIONS err =parse_mtd_partitions (&info->mtd, part_probes, &info->parts,0 );
Signature · 1 line
1.7.0.4