summaryrefslogtreecommitdiffstats
path: root/board
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2010-07-05 12:32:14 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2010-07-05 12:43:03 +0200
commitac234173cc3d11b671a893463d94ec9c4707ee4d (patch)
tree2a52791c2d34c5e994d0cb56ebba9c7115de7761 /board
parentcb0d50e1a25d76b05f425c8ca9e05814f2d488fa (diff)
downloadbarebox-ac234173cc3d11b671a893463d94ec9c4707ee4d.tar.gz
barebox-ac234173cc3d11b671a893463d94ec9c4707ee4d.tar.xz
omap nand: cleanup
- Move oob layout to driver - make hwecc support nonoptional but selectable by the board. - let the boards decide which buswidth / ecc type to use. They know better than the user which gets confused by too many kconfig options. - Let the boards explicitly register the nand device. I tried to seperate this further, but failed because of too many dependencies in the code. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'board')
-rw-r--r--board/omap/Kconfig69
-rw-r--r--board/omap/Makefile2
-rw-r--r--board/omap/board-beagle.c2
-rw-r--r--board/omap/devices-gpmc-nand.c63
4 files changed, 16 insertions, 120 deletions
diff --git a/board/omap/Kconfig b/board/omap/Kconfig
index 361bed436f..d612064710 100644
--- a/board/omap/Kconfig
+++ b/board/omap/Kconfig
@@ -90,73 +90,4 @@ config MACH_OMAP_ADVANCED_MUX
config HAS_OMAP_NAND
bool
-
-menuconfig MACH_OMAP_GPMC_NAND
- tristate "Enable NAND device support for GPMC"
- depends on HAS_OMAP_NAND
- default n
- help
- Say Y here if you would like to have NAND device support
-
-if MACH_OMAP_GPMC_NAND
-# Single definition used to club all generic definitions together
-config MACH_OMAP_GPMC_GENERICNAND
- bool
-
-choice
- prompt "Select NAND Device"
-
-config MACH_OMAP_GPMC_GENERICNAND_LP_X8
- tristate "Enable 8 bit Large page nand"
- depends on MACH_OMAP_GPMC_NAND
- select MACH_OMAP_GPMC_GENERICNAND
- help
- Say Y here if you would support for 8 bit NAND
- with large page
- NOTE: The timing parameter are the most relaxed
- If you need optimized timing, selec appropriate
- supported NAND flash
-
-config MACH_OMAP_GPMC_GENERICNAND_LP_X16
- tristate "Enable 16 bit Large page nand"
- depends on MACH_OMAP_GPMC_NAND
- select MACH_OMAP_GPMC_GENERICNAND
- help
- Say Y here if you would support for 16 bit NAND
- with large page
- NOTE: The timing parameter are the most relaxed
- If you need optimized timing, selec appropriate
- supported NAND flash
-
-config MACH_OMAP_GPMC_GENERICNAND_SP_X8
- tristate "Enable 8 bit Small page nand"
- depends on MACH_OMAP_GPMC_NAND
- select MACH_OMAP_GPMC_GENERICNAND
- help
- Say Y here if you would support for 8 bit NAND
- with small page
- NOTE: The timing parameter are the most relaxed
- If you need optimized timing, selec appropriate
- supported NAND flash
-
-config MACH_OMAP_GPMC_GENERICNAND_SP_X16
- tristate "Enable 16 bit Small page nand"
- depends on MACH_OMAP_GPMC_NAND
- select MACH_OMAP_GPMC_GENERICNAND
- help
- Say Y here if you would support for 16 bit NAND
- with small page
- NOTE: The timing parameter are the most relaxed
- If you need optimized timing, selec appropriate
- supported NAND flash
-endchoice
-
-config MACH_OMAP_CS
- hex "NAND CS"
- depends on MACH_OMAP_GPMC_NAND
- default 0x0
- help
- Provide the Chip select of the NAND flash
-endif
-
endmenu
diff --git a/board/omap/Makefile b/board/omap/Makefile
index b4bb3e1d05..1e74e241b4 100644
--- a/board/omap/Makefile
+++ b/board/omap/Makefile
@@ -24,5 +24,5 @@ obj-$(CONFIG_MACH_DO_LOWLEVEL_INIT) += platform.o
obj-$(CONFIG_MACH_OMAP343xSDP) += board-sdp343x.o
obj-$(CONFIG_MACH_BEAGLE) += board-beagle.o
obj-$(CONFIG_MACH_OMAP3EVM) += board-omap3evm.o
-obj-$(CONFIG_MACH_OMAP_GPMC_GENERICNAND) += devices-gpmc-nand.o
+obj-y += devices-gpmc-nand.o
diff --git a/board/omap/board-beagle.c b/board/omap/board-beagle.c
index 866d8325e5..93092ccc00 100644
--- a/board/omap/board-beagle.c
+++ b/board/omap/board-beagle.c
@@ -259,10 +259,12 @@ static int beagle_devices_init(void)
ret = register_device(&sdram_dev);
if (ret)
goto failed;
+
#ifdef CONFIG_GPMC
/* WP is made high and WAIT1 active Low */
gpmc_generic_init(0x10);
#endif
+ gpmc_generic_nand_devices_init(0, 16, 1);
armlinux_add_dram(&sdram_dev);
failed:
return ret;
diff --git a/board/omap/devices-gpmc-nand.c b/board/omap/devices-gpmc-nand.c
index bbcceafe88..e8b34caf4d 100644
--- a/board/omap/devices-gpmc-nand.c
+++ b/board/omap/devices-gpmc-nand.c
@@ -37,47 +37,14 @@
#include <mach/gpmc.h>
#include <mach/gpmc_nand.h>
-#ifdef CONFIG_MACH_OMAP_GPMC_GENERICNAND
-
#define GPMC_CONF1_VALx8 0x00000800
#define GPMC_CONF1_VALx16 0x00001800
/* Set up the generic params */
-#ifdef CONFIG_MACH_OMAP_GPMC_GENERICNAND_LP_X8
-#define GPMC_NAND_ECC_LAYOUT GPMC_NAND_ECC_LP_x8_LAYOUT
-#define GPMC_CONF1_VAL GPMC_CONF1_VALx8
-#define GPMC_NAND_DEV_WIDTH 8
-#endif
-
-#ifdef CONFIG_MACH_OMAP_GPMC_GENERICNAND_LP_X16
-#define GPMC_NAND_ECC_LAYOUT GPMC_NAND_ECC_LP_x16_LAYOUT
-#define GPMC_CONF1_VAL GPMC_CONF1_VALx16
-#define GPMC_NAND_DEV_WIDTH 16
-#endif
-
-#ifdef CONFIG_MACH_OMAP_GPMC_GENERICNAND_SP_X8
-#define GPMC_NAND_ECC_LAYOUT GPMC_NAND_ECC_SP_x8_LAYOUT
-#define GPMC_CONF1_VAL GPMC_CONF1_VALx8
-#define GPMC_NAND_DEV_WIDTH 8
-#endif
-
-#ifdef CONFIG_MACH_OMAP_GPMC_GENERICNAND_SP_X16
-#define GPMC_NAND_ECC_LAYOUT GPMC_NAND_ECC_SP_x16_LAYOUT
-#define GPMC_CONF1_VAL GPMC_CONF1_VALx16
-#define GPMC_NAND_DEV_WIDTH 16
-#endif
-
-#ifdef CONFIG_NAND_OMAP_GPMC_HWECC
-/**
- * The following is the organization of ECC as expected by BootROM.
- * Based on the type of device, this can vary. select the config accordingly
- */
-static struct nand_ecclayout boot_rom_ecc = GPMC_NAND_ECC_LAYOUT;
-#endif
/** GPMC timing for our nand device */
static struct gpmc_config nand_cfg = {
.cfg = {
- GPMC_CONF1_VAL, /*CONF1 */
+ 0, /*CONF1 */
0x00141400, /*CONF2 */
0x00141400, /*CONF3 */
0x0F010F01, /*CONF4 */
@@ -97,16 +64,9 @@ static struct gpmc_config nand_cfg = {
/** NAND platform specific settings settings */
static struct gpmc_nand_platform_data nand_plat = {
- .cs = CONFIG_MACH_OMAP_CS,
- .device_width = GPMC_NAND_DEV_WIDTH,
+ .cs = 0,
.max_timeout = MSECOND,
.wait_mon_pin = 0,
-#ifdef CONFIG_NAND_OMAP_GPMC_HWECC
- .plat_options = NAND_HWECC_ENABLE,
- .oob = &boot_rom_ecc,
-#else
- .plat_options = NAND_HWECC_DISABLE,
-#endif
.priv = (void *)&nand_cfg,
};
@@ -123,16 +83,19 @@ static struct device_d gpmc_generic_nand_nand_device = {
*
* @return success/fail based on device funtion
*/
-static int gpmc_generic_nand_devices_init(void)
+int gpmc_generic_nand_devices_init(int cs, int width, int hwecc)
{
+ nand_plat.cs = cs;
+
+ if (width == 16)
+ nand_cfg.cfg[0] = GPMC_CONF1_VALx16;
+ else
+ nand_cfg.cfg[0] = GPMC_CONF1_VALx8;
+
+ nand_plat.device_width = width;
+ nand_plat.plat_options = hwecc ? NAND_HWECC_ENABLE : 0;
+
/* Configure GPMC CS before register */
gpmc_cs_config(nand_plat.cs, &nand_cfg);
return register_device(&gpmc_generic_nand_nand_device);
}
-
-device_initcall(gpmc_generic_nand_devices_init);
-
-#endif /* CONFIG_MACH_OMAP_GPMC_GENERICNAND */
-
-/* All specific optimized nand configurations for GPMC NAND comes here */
-