diff options
Diffstat (limited to 'arch/arm/mach-omap2/board-igep0020.c')
| -rw-r--r-- | arch/arm/mach-omap2/board-igep0020.c | 114 | 
1 files changed, 40 insertions, 74 deletions
diff --git a/arch/arm/mach-omap2/board-igep0020.c b/arch/arm/mach-omap2/board-igep0020.c index 740cee9369b..7a274098f67 100644 --- a/arch/arm/mach-omap2/board-igep0020.c +++ b/arch/arm/mach-omap2/board-igep0020.c @@ -24,6 +24,8 @@  #include <linux/i2c/twl.h>  #include <linux/mmc/host.h> +#include <linux/mtd/nand.h> +  #include <asm/mach-types.h>  #include <asm/mach/arch.h> @@ -32,13 +34,15 @@  #include <plat/gpmc.h>  #include <plat/usb.h>  #include <video/omapdss.h> -#include <video/omap-panel-dvi.h> +#include <video/omap-panel-tfp410.h>  #include <plat/onenand.h>  #include "mux.h"  #include "hsmmc.h"  #include "sdram-numonyx-m65kxxxxam.h"  #include "common-board-devices.h" +#include "board-flash.h" +#include "control.h"  #define IGEP2_SMSC911X_CS       5  #define IGEP2_SMSC911X_GPIO     176 @@ -60,6 +64,10 @@  #define IGEP3_GPIO_LED1_RED	16  #define IGEP3_GPIO_USBH_NRESET  183 +#define IGEP_SYSBOOT_MASK           0x1f +#define IGEP_SYSBOOT_NAND           0x0f +#define IGEP_SYSBOOT_ONENAND        0x10 +  /*   * IGEP2 Hardware Revision Table   * @@ -110,8 +118,10 @@ static void __init igep2_get_revision(void)  	gpio_free(IGEP2_GPIO_LED1_RED);  } -#if defined(CONFIG_MTD_ONENAND_OMAP2) || \ -	defined(CONFIG_MTD_ONENAND_OMAP2_MODULE) +#if defined(CONFIG_MTD_ONENAND_OMAP2) ||		\ +	defined(CONFIG_MTD_ONENAND_OMAP2_MODULE) ||	\ +	defined(CONFIG_MTD_NAND_OMAP2) ||		\ +	defined(CONFIG_MTD_NAND_OMAP2_MODULE)  #define ONENAND_MAP             0x20000000 @@ -123,7 +133,7 @@ static void __init igep2_get_revision(void)   * So MTD regards it as 4KiB page size and 256KiB block size 64*(2*2048)   */ -static struct mtd_partition igep_onenand_partitions[] = { +static struct mtd_partition igep_flash_partitions[] = {  	{  		.name           = "X-Loader",  		.offset         = 0, @@ -151,50 +161,28 @@ static struct mtd_partition igep_onenand_partitions[] = {  	},  }; -static struct omap_onenand_platform_data igep_onenand_data = { -	.parts = igep_onenand_partitions, -	.nr_parts = ARRAY_SIZE(igep_onenand_partitions), -	.dma_channel	= -1,	/* disable DMA in OMAP OneNAND driver */ -}; - -static struct platform_device igep_onenand_device = { -	.name		= "omap2-onenand", -	.id		= -1, -	.dev = { -		.platform_data = &igep_onenand_data, -	}, -}; +static inline u32 igep_get_sysboot_value(void) +{ +	return omap_ctrl_readl(OMAP343X_CONTROL_STATUS) & IGEP_SYSBOOT_MASK; +}  static void __init igep_flash_init(void)  { -	u8 cs = 0; -	u8 onenandcs = GPMC_CS_NUM + 1; +	u32 mux; +	mux = igep_get_sysboot_value(); -	for (cs = 0; cs < GPMC_CS_NUM; cs++) { -		u32 ret; -		ret = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG1); - -		/* Check if NAND/oneNAND is configured */ -		if ((ret & 0xC00) == 0x800) -			/* NAND found */ -			pr_err("IGEP: Unsupported NAND found\n"); -		else { -			ret = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG7); -			if ((ret & 0x3F) == (ONENAND_MAP >> 24)) -				/* ONENAND found */ -				onenandcs = cs; -		} -	} - -	if (onenandcs > GPMC_CS_NUM) { -		pr_err("IGEP: Unable to find configuration in GPMC\n"); -		return; +	if (mux == IGEP_SYSBOOT_NAND) { +		pr_info("IGEP: initializing NAND memory device\n"); +		board_nand_init(igep_flash_partitions, +				ARRAY_SIZE(igep_flash_partitions), +				0, NAND_BUSWIDTH_16); +	} else if (mux == IGEP_SYSBOOT_ONENAND) { +		pr_info("IGEP: initializing OneNAND memory device\n"); +		board_onenand_init(igep_flash_partitions, +				   ARRAY_SIZE(igep_flash_partitions), 0); +	} else { +		pr_err("IGEP: Flash: unsupported sysboot sequence found\n");  	} - -	igep_onenand_data.cs = onenandcs; - -	if (platform_device_register(&igep_onenand_device) < 0) -		pr_err("IGEP: Unable to register OneNAND device\n");  }  #else @@ -444,28 +432,15 @@ static struct twl4030_gpio_platform_data igep_twl4030_gpio_pdata = {  	.setup		= igep_twl_gpio_setup,  }; -static int igep2_enable_dvi(struct omap_dss_device *dssdev) -{ -	gpio_direction_output(IGEP2_GPIO_DVI_PUP, 1); - -	return 0; -} - -static void igep2_disable_dvi(struct omap_dss_device *dssdev) -{ -	gpio_direction_output(IGEP2_GPIO_DVI_PUP, 0); -} - -static struct panel_dvi_platform_data dvi_panel = { -	.platform_enable	= igep2_enable_dvi, -	.platform_disable	= igep2_disable_dvi, -	.i2c_bus_num = 3, +static struct tfp410_platform_data dvi_panel = { +	.i2c_bus_num		= 3, +	.power_down_gpio	= IGEP2_GPIO_DVI_PUP,  };  static struct omap_dss_device igep2_dvi_device = {  	.type			= OMAP_DISPLAY_TYPE_DPI,  	.name			= "dvi", -	.driver_name		= "dvi", +	.driver_name		= "tfp410",  	.data			= &dvi_panel,  	.phy.dpi.data_lines	= 24,  }; @@ -480,14 +455,6 @@ static struct omap_dss_board_info igep2_dss_data = {  	.default_device	= &igep2_dvi_device,  }; -static void __init igep2_display_init(void) -{ -	int err = gpio_request_one(IGEP2_GPIO_DVI_PUP, GPIOF_OUT_INIT_HIGH, -				   "GPIO_DVI_PUP"); -	if (err) -		pr_err("IGEP v2: Could not obtain gpio GPIO_DVI_PUP\n"); -} -  static struct platform_device *igep_devices[] __initdata = {  	&igep_vwlan_device,  }; @@ -540,7 +507,10 @@ static void __init igep_i2c_init(void)  {  	int ret; -	omap3_pmic_get_config(&igep_twldata, TWL_COMMON_PDATA_USB, 0); +	omap3_pmic_get_config(&igep_twldata, TWL_COMMON_PDATA_USB, +			      TWL_COMMON_REGULATOR_VPLL2); +	igep_twldata.vpll2->constraints.apply_uV = true; +	igep_twldata.vpll2->constraints.name = "VDVI";  	if (machine_is_igep0020()) {  		/* @@ -554,10 +524,7 @@ static void __init igep_i2c_init(void)  		igep_twldata.keypad	= &igep2_keypad_pdata;  		/* Get common pmic data */ -		omap3_pmic_get_config(&igep_twldata, TWL_COMMON_PDATA_AUDIO, -				      TWL_COMMON_REGULATOR_VPLL2); -		igep_twldata.vpll2->constraints.apply_uV = true; -		igep_twldata.vpll2->constraints.name = "VDVI"; +		omap3_pmic_get_config(&igep_twldata, TWL_COMMON_PDATA_AUDIO, 0);  	}  	omap3_pmic_init("twl4030", &igep_twldata); @@ -668,7 +635,6 @@ static void __init igep_init(void)  	if (machine_is_igep0020()) {  		omap_display_init(&igep2_dss_data); -		igep2_display_init();  		igep2_init_smsc911x();  		usbhs_init(&igep2_usbhs_bdata);  	} else {  |