|  | @@ -219,3 +219,145 @@ static void __init d2net_gpio_leds_init(void)
 | 
	
		
			
				|  |  |  /****************************************************************************
 | 
	
		
			
				|  |  |   * GPIO keys
 | 
	
		
			
				|  |  |   ****************************************************************************/
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +#define D2NET_GPIO_PUSH_BUTTON		18
 | 
	
		
			
				|  |  | +#define D2NET_GPIO_POWER_SWITCH_ON	8
 | 
	
		
			
				|  |  | +#define D2NET_GPIO_POWER_SWITCH_OFF	9
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +#define D2NET_SWITCH_POWER_ON		0x1
 | 
	
		
			
				|  |  | +#define D2NET_SWITCH_POWER_OFF		0x2
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +static struct gpio_keys_button d2net_buttons[] = {
 | 
	
		
			
				|  |  | +	{
 | 
	
		
			
				|  |  | +		.type		= EV_SW,
 | 
	
		
			
				|  |  | +		.code		= D2NET_SWITCH_POWER_OFF,
 | 
	
		
			
				|  |  | +		.gpio		= D2NET_GPIO_POWER_SWITCH_OFF,
 | 
	
		
			
				|  |  | +		.desc		= "Power rocker switch (auto|off)",
 | 
	
		
			
				|  |  | +		.active_low	= 0,
 | 
	
		
			
				|  |  | +	},
 | 
	
		
			
				|  |  | +	{
 | 
	
		
			
				|  |  | +		.type		= EV_SW,
 | 
	
		
			
				|  |  | +		.code		= D2NET_SWITCH_POWER_ON,
 | 
	
		
			
				|  |  | +		.gpio		= D2NET_GPIO_POWER_SWITCH_ON,
 | 
	
		
			
				|  |  | +		.desc		= "Power rocker switch (on|auto)",
 | 
	
		
			
				|  |  | +		.active_low	= 0,
 | 
	
		
			
				|  |  | +	},
 | 
	
		
			
				|  |  | +	{
 | 
	
		
			
				|  |  | +		.type		= EV_KEY,
 | 
	
		
			
				|  |  | +		.code		= KEY_POWER,
 | 
	
		
			
				|  |  | +		.gpio		= D2NET_GPIO_PUSH_BUTTON,
 | 
	
		
			
				|  |  | +		.desc		= "Front Push Button",
 | 
	
		
			
				|  |  | +		.active_low	= 0,
 | 
	
		
			
				|  |  | +	},
 | 
	
		
			
				|  |  | +};
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +static struct gpio_keys_platform_data d2net_button_data = {
 | 
	
		
			
				|  |  | +	.buttons	= d2net_buttons,
 | 
	
		
			
				|  |  | +	.nbuttons	= ARRAY_SIZE(d2net_buttons),
 | 
	
		
			
				|  |  | +};
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +static struct platform_device d2net_gpio_buttons = {
 | 
	
		
			
				|  |  | +	.name		= "gpio-keys",
 | 
	
		
			
				|  |  | +	.id		= -1,
 | 
	
		
			
				|  |  | +	.dev		= {
 | 
	
		
			
				|  |  | +		.platform_data	= &d2net_button_data,
 | 
	
		
			
				|  |  | +	},
 | 
	
		
			
				|  |  | +};
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +/*****************************************************************************
 | 
	
		
			
				|  |  | + * General Setup
 | 
	
		
			
				|  |  | + ****************************************************************************/
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +static unsigned int d2net_mpp_modes[] __initdata = {
 | 
	
		
			
				|  |  | +	MPP0_GPIO,	/* Board ID (bit 0) */
 | 
	
		
			
				|  |  | +	MPP1_GPIO,	/* Board ID (bit 1) */
 | 
	
		
			
				|  |  | +	MPP2_GPIO,	/* Board ID (bit 2) */
 | 
	
		
			
				|  |  | +	MPP3_GPIO,	/* SATA 0 power */
 | 
	
		
			
				|  |  | +	MPP4_UNUSED,
 | 
	
		
			
				|  |  | +	MPP5_GPIO,	/* Fan fail detection */
 | 
	
		
			
				|  |  | +	MPP6_GPIO,	/* Red front LED */
 | 
	
		
			
				|  |  | +	MPP7_UNUSED,
 | 
	
		
			
				|  |  | +	MPP8_GPIO,	/* Rear power switch (on|auto) */
 | 
	
		
			
				|  |  | +	MPP9_GPIO,	/* Rear power switch (auto|off) */
 | 
	
		
			
				|  |  | +	MPP10_UNUSED,
 | 
	
		
			
				|  |  | +	MPP11_UNUSED,
 | 
	
		
			
				|  |  | +	MPP12_GPIO,	/* SATA 1 power */
 | 
	
		
			
				|  |  | +	MPP13_UNUSED,
 | 
	
		
			
				|  |  | +	MPP14_SATA_LED,	/* SATA 0 active */
 | 
	
		
			
				|  |  | +	MPP15_SATA_LED,	/* SATA 1 active */
 | 
	
		
			
				|  |  | +	MPP16_GPIO,	/* Blue front LED blink control */
 | 
	
		
			
				|  |  | +	MPP17_UNUSED,
 | 
	
		
			
				|  |  | +	MPP18_GPIO,	/* Front button (0 = Released, 1 = Pushed ) */
 | 
	
		
			
				|  |  | +	MPP19_UNUSED,
 | 
	
		
			
				|  |  | +	0,
 | 
	
		
			
				|  |  | +	/* 22: USB port 1 fuse (0 = Fail, 1 = Ok) */
 | 
	
		
			
				|  |  | +	/* 23: Blue front LED off */
 | 
	
		
			
				|  |  | +	/* 24: Inhibit board power off (0 = Disabled, 1 = Enabled) */
 | 
	
		
			
				|  |  | +};
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +#define D2NET_GPIO_INHIBIT_POWER_OFF    24
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +static void __init d2net_init(void)
 | 
	
		
			
				|  |  | +{
 | 
	
		
			
				|  |  | +	/*
 | 
	
		
			
				|  |  | +	 * Setup basic Orion functions. Need to be called early.
 | 
	
		
			
				|  |  | +	 */
 | 
	
		
			
				|  |  | +	orion5x_init();
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +	orion5x_mpp_conf(d2net_mpp_modes);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +	/*
 | 
	
		
			
				|  |  | +	 * Configure peripherals.
 | 
	
		
			
				|  |  | +	 */
 | 
	
		
			
				|  |  | +	orion5x_ehci0_init();
 | 
	
		
			
				|  |  | +	orion5x_eth_init(&d2net_eth_data);
 | 
	
		
			
				|  |  | +	orion5x_i2c_init();
 | 
	
		
			
				|  |  | +	orion5x_uart0_init();
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +	d2net_sata_power_init();
 | 
	
		
			
				|  |  | +	orion5x_sata_init(&d2net_sata_data);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +	orion5x_setup_dev_boot_win(D2NET_NOR_BOOT_BASE,
 | 
	
		
			
				|  |  | +				D2NET_NOR_BOOT_SIZE);
 | 
	
		
			
				|  |  | +	platform_device_register(&d2net_nor_flash);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +	platform_device_register(&d2net_gpio_buttons);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +	d2net_gpio_leds_init();
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +	pr_notice("d2net: Flash write are not yet supported.\n");
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +	i2c_register_board_info(0, d2net_i2c_devices,
 | 
	
		
			
				|  |  | +				ARRAY_SIZE(d2net_i2c_devices));
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +	orion_gpio_set_valid(D2NET_GPIO_INHIBIT_POWER_OFF, 1);
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +/* Warning: LaCie use a wrong mach-type (0x20e=526) in their bootloader. */
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +#ifdef CONFIG_MACH_D2NET
 | 
	
		
			
				|  |  | +MACHINE_START(D2NET, "LaCie d2 Network")
 | 
	
		
			
				|  |  | +	.atag_offset	= 0x100,
 | 
	
		
			
				|  |  | +	.init_machine	= d2net_init,
 | 
	
		
			
				|  |  | +	.map_io		= orion5x_map_io,
 | 
	
		
			
				|  |  | +	.init_early	= orion5x_init_early,
 | 
	
		
			
				|  |  | +	.init_irq	= orion5x_init_irq,
 | 
	
		
			
				|  |  | +	.timer		= &orion5x_timer,
 | 
	
		
			
				|  |  | +	.fixup		= tag_fixup_mem32,
 | 
	
		
			
				|  |  | +	.restart	= orion5x_restart,
 | 
	
		
			
				|  |  | +MACHINE_END
 | 
	
		
			
				|  |  | +#endif
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +#ifdef CONFIG_MACH_BIGDISK
 | 
	
		
			
				|  |  | +MACHINE_START(BIGDISK, "LaCie Big Disk Network")
 | 
	
		
			
				|  |  | +	.atag_offset	= 0x100,
 | 
	
		
			
				|  |  | +	.init_machine	= d2net_init,
 | 
	
		
			
				|  |  | +	.map_io		= orion5x_map_io,
 | 
	
		
			
				|  |  | +	.init_early	= orion5x_init_early,
 | 
	
		
			
				|  |  | +	.init_irq	= orion5x_init_irq,
 | 
	
		
			
				|  |  | +	.timer		= &orion5x_timer,
 | 
	
		
			
				|  |  | +	.fixup		= tag_fixup_mem32,
 | 
	
		
			
				|  |  | +	.restart	= orion5x_restart,
 | 
	
		
			
				|  |  | +MACHINE_END
 | 
	
		
			
				|  |  | +#endif
 | 
	
		
			
				|  |  | +
 |