diff options
| author | David S. Miller <davem@davemloft.net> | 2010-04-06 23:53:30 -0700 | 
|---|---|---|
| committer | David S. Miller <davem@davemloft.net> | 2010-04-06 23:53:30 -0700 | 
| commit | 4a35ecf8bf1c4b039503fa554100fe85c761de76 (patch) | |
| tree | 9b75f5d5636004d9a9aa496924377379be09aa1f /arch/arm/mach-omap2/board-n8x0.c | |
| parent | b4d562e3c3553ac58c7120555c4e4aefbb090a2a (diff) | |
| parent | fb9e2d887243499b8d28efcf80821c4f6a092395 (diff) | |
| download | olio-linux-3.10-4a35ecf8bf1c4b039503fa554100fe85c761de76.tar.xz olio-linux-3.10-4a35ecf8bf1c4b039503fa554100fe85c761de76.zip  | |
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
Conflicts:
	drivers/net/bonding/bond_main.c
	drivers/net/via-velocity.c
	drivers/net/wireless/iwlwifi/iwl-agn.c
Diffstat (limited to 'arch/arm/mach-omap2/board-n8x0.c')
| -rw-r--r-- | arch/arm/mach-omap2/board-n8x0.c | 98 | 
1 files changed, 98 insertions, 0 deletions
diff --git a/arch/arm/mach-omap2/board-n8x0.c b/arch/arm/mach-omap2/board-n8x0.c index 4cab0522d7c..da9bcb89899 100644 --- a/arch/arm/mach-omap2/board-n8x0.c +++ b/arch/arm/mach-omap2/board-n8x0.c @@ -37,6 +37,103 @@ static int slot1_cover_open;  static int slot2_cover_open;  static struct device *mmc_device; +#define TUSB6010_ASYNC_CS	1 +#define TUSB6010_SYNC_CS	4 +#define TUSB6010_GPIO_INT	58 +#define TUSB6010_GPIO_ENABLE	0 +#define TUSB6010_DMACHAN	0x3f + +#if defined(CONFIG_USB_TUSB6010) || \ +	defined(CONFIG_USB_TUSB6010_MODULE) +/* + * Enable or disable power to TUSB6010. When enabling, turn on 3.3 V and + * 1.5 V voltage regulators of PM companion chip. Companion chip will then + * provide then PGOOD signal to TUSB6010 which will release it from reset. + */ +static int tusb_set_power(int state) +{ +	int i, retval = 0; + +	if (state) { +		gpio_set_value(TUSB6010_GPIO_ENABLE, 1); +		msleep(1); + +		/* Wait until TUSB6010 pulls INT pin down */ +		i = 100; +		while (i && gpio_get_value(TUSB6010_GPIO_INT)) { +			msleep(1); +			i--; +		} + +		if (!i) { +			printk(KERN_ERR "tusb: powerup failed\n"); +			retval = -ENODEV; +		} +	} else { +		gpio_set_value(TUSB6010_GPIO_ENABLE, 0); +		msleep(10); +	} + +	return retval; +} + +static struct musb_hdrc_config musb_config = { +	.multipoint	= 1, +	.dyn_fifo	= 1, +	.num_eps	= 16, +	.ram_bits	= 12, +}; + +static struct musb_hdrc_platform_data tusb_data = { +#if defined(CONFIG_USB_MUSB_OTG) +	.mode		= MUSB_OTG, +#elif defined(CONFIG_USB_MUSB_PERIPHERAL) +	.mode		= MUSB_PERIPHERAL, +#else /* defined(CONFIG_USB_MUSB_HOST) */ +	.mode		= MUSB_HOST, +#endif +	.set_power	= tusb_set_power, +	.min_power	= 25,	/* x2 = 50 mA drawn from VBUS as peripheral */ +	.power		= 100,	/* Max 100 mA VBUS for host mode */ +	.config		= &musb_config, +}; + +static void __init n8x0_usb_init(void) +{ +	int ret = 0; +	static char	announce[] __initdata = KERN_INFO "TUSB 6010\n"; + +	/* PM companion chip power control pin */ +	ret = gpio_request(TUSB6010_GPIO_ENABLE, "TUSB6010 enable"); +	if (ret != 0) { +		printk(KERN_ERR "Could not get TUSB power GPIO%i\n", +		       TUSB6010_GPIO_ENABLE); +		return; +	} +	gpio_direction_output(TUSB6010_GPIO_ENABLE, 0); + +	tusb_set_power(0); + +	ret = tusb6010_setup_interface(&tusb_data, TUSB6010_REFCLK_19, 2, +					TUSB6010_ASYNC_CS, TUSB6010_SYNC_CS, +					TUSB6010_GPIO_INT, TUSB6010_DMACHAN); +	if (ret != 0) +		goto err; + +	printk(announce); + +	return; + +err: +	gpio_free(TUSB6010_GPIO_ENABLE); +} +#else + +static void __init n8x0_usb_init(void) {} + +#endif /*CONFIG_USB_TUSB6010 */ + +  static struct omap2_mcspi_device_config p54spi_mcspi_config = {  	.turbo_mode	= 0,  	.single_channel = 1, @@ -562,6 +659,7 @@ static void __init n8x0_init_machine(void)  	n8x0_menelaus_init();  	n8x0_onenand_init();  	n8x0_mmc_init(); +	n8x0_usb_init();  }  MACHINE_START(NOKIA_N800, "Nokia N800")  |