dns320l-setup.c
changeset 3 f2f1be1cc4ba
parent 2 459c75093fd1
equal deleted inserted replaced
2:459c75093fd1 3:f2f1be1cc4ba
    27 #include <linux/i2c.h>
    27 #include <linux/i2c.h>
    28 #include <linux/gpio_keys.h>
    28 #include <linux/gpio_keys.h>
    29 #include <linux/gpio-fan.h>
    29 #include <linux/gpio-fan.h>
    30 #include <linux/input.h>
    30 #include <linux/input.h>
    31 
    31 
    32 #define DNS320L_GPIO_LED_SATA1          20
    32 #define DNS320L_GPIO_LED_SATA1_BLUE     20
    33 #define DNS320L_GPIO_LED_SATA0          21
    33 #define DNS320L_GPIO_LED_SATA0_BLUE     21
       
    34 #define DNS320L_GPIO_LED_SATA1_RED      22
       
    35 #define DNS320L_GPIO_LED_SATA0_RED      23
    34 #define DNS320L_GPIO_POWER_SATA         24
    36 #define DNS320L_GPIO_POWER_SATA         24
    35 #define DNS320L_GPIO_LED_USB_BLUE       25
    37 #define DNS320L_GPIO_LED_USB_BLUE       25
    36 #define DNS320L_GPIO_LED_USB_ORANGE     26
    38 #define DNS320L_GPIO_LED_USB_ORANGE     26
    37 #define DNS320L_GPIO_BUTTON_USB         27
    39 #define DNS320L_GPIO_BUTTON_USB         27
       
    40 #define DNS320L_GPIO_BUTTON_RESET       28
       
    41 #define DNS320L_GPIO_BUTTON_POWER       29
    38 
    42 
    39 static struct mtd_partition dns320l_nand_parts[] = {
    43 static struct mtd_partition dns320l_nand_parts[] = {
    40 	{
    44 	{
    41 		.name = "u-boot",
    45 		.name = "u-boot",
    42 		.offset = 0,
    46 		.offset = 0,
    92  * Buttons
    96  * Buttons
    93  ****************************************************************************/
    97  ****************************************************************************/
    94 
    98 
    95 static struct gpio_keys_button dns320l_button_pins[] = {
    99 static struct gpio_keys_button dns320l_button_pins[] = {
    96 	{
   100 	{
    97 		.code		= KEY_EJECTCD,
   101 		.code		= KEY_COPY,
       
   102 		.type       = EV_KEY,
    98 		.gpio		= DNS320L_GPIO_BUTTON_USB,
   103 		.gpio		= DNS320L_GPIO_BUTTON_USB,
    99 		.desc		= "USB unmount button",
   104 		.desc		= "USB Copy button",
   100 		.active_low	= 1,
   105 		.active_low	= 1,
   101 	}
   106 		.debounce_interval = 1000,
       
   107 	},
       
   108 	{ // This button does not (yet) work...
       
   109 	    .code       = KEY_POWER,
       
   110         .type       = EV_KEY,
       
   111 	    .gpio       = DNS320L_GPIO_BUTTON_POWER,
       
   112 	    .desc       = "Power Button",
       
   113         .active_low = 1,
       
   114         .debounce_interval = 1000,
       
   115 	},
       
   116 	{
       
   117 	    .code       = KEY_OPTION,
       
   118 	    .type       = EV_KEY,
       
   119 	    .gpio       = DNS320L_GPIO_BUTTON_RESET,
       
   120 	    .desc       = "Reset Button",
       
   121 	    .active_low = 1,
       
   122 	    .debounce_interval = 1000,
       
   123 	},
   102 };
   124 };
   103 
   125 
   104 static struct gpio_keys_platform_data dns320l_button_data = {
   126 static struct gpio_keys_platform_data dns320l_button_data = {
   105 	.buttons	= dns320l_button_pins,
   127 	.buttons	= dns320l_button_pins,
   106 	.nbuttons	= ARRAY_SIZE(dns320l_button_pins),
   128 	.nbuttons	= ARRAY_SIZE(dns320l_button_pins),
   107 };
   129 };
   108 
   130 
   109 static struct platform_device dns320l_button_device = {
   131 static struct platform_device dns320l_button_device = {
   110 	.name		= "gpio-keys",
   132 	.name		= "gpio-keys",
   111 	.id		= -1,
   133 	.id		= -1,
   112 	.num_resources	= 0,
       
   113 	.dev		= {
   134 	.dev		= {
   114 		.platform_data	= &dns320l_button_data,
   135 		.platform_data	= &dns320l_button_data,
   115 	}
   136 	}
   116 };
   137 };
   117 
   138 
   129 		.name	= "dns320l:orange:usb",
   150 		.name	= "dns320l:orange:usb",
   130 		.gpio	= DNS320L_GPIO_LED_USB_ORANGE,
   151 		.gpio	= DNS320L_GPIO_LED_USB_ORANGE,
   131 	},
   152 	},
   132 	{
   153 	{
   133 	    .name   = "dns320l:blue:sata0",
   154 	    .name   = "dns320l:blue:sata0",
   134 	    .gpio   = DNS320L_GPIO_LED_SATA0,
   155 	    .gpio   = DNS320L_GPIO_LED_SATA0_BLUE,
   135 	    .default_trigger = "ide-disk"
   156 	    .default_trigger = "ide-disk"
   136 	},
   157 	},
   137 	{
   158 	{
   138 	    .name   = "dns320l:blue:sata1",
   159 	    .name   = "dns320l:blue:sata1",
   139 	    .gpio   = DNS320L_GPIO_LED_SATA1,
   160 	    .gpio   = DNS320L_GPIO_LED_SATA1_BLUE,
   140 	    .default_trigger = "ide-disk"
   161 	    .default_trigger = "ide-disk"
   141 	},
   162 	},
   142 //	{
   163 	{
   143 //	    .name   = "dns320l:blue:power",
   164 	    .name   = "dns320l:red:sata0",
   144 //	    .gpio   = DNS320L_GPIO_LED_POWER,
   165 	    .gpio   = DNS320L_GPIO_LED_SATA0_RED,
   145 //	},
   166 	},
   146 	
   167 	{
       
   168 	    .name   = "dns320l:red:sata1",
       
   169 	    .gpio   = DNS320L_GPIO_LED_SATA1_RED,
       
   170 	},
   147 };
   171 };
   148 
   172 
   149 static struct gpio_led_platform_data dns320l_led_data = {
   173 static struct gpio_led_platform_data dns320l_led_data = {
   150 	.num_leds	= ARRAY_SIZE(dns320l_led_pins),
   174 	.num_leds	= ARRAY_SIZE(dns320l_led_pins),
   151 	.leds		= dns320l_led_pins,
   175 	.leds		= dns320l_led_pins,
   164  ****************************************************************************/
   188  ****************************************************************************/
   165 
   189 
   166 static unsigned int dns320l_mpp_config[] __initdata = {
   190 static unsigned int dns320l_mpp_config[] __initdata = {
   167     MPP13_UART1_TXD,
   191     MPP13_UART1_TXD,
   168 	MPP14_UART1_RXD,
   192 	MPP14_UART1_RXD,
   169 	MPP16_GPIO,
   193 	MPP20_GPIO,    // SATA LED BLUE
   170 	MPP17_GPIO,
   194 	MPP21_GPIO,    // SATA LED BLUE
   171 	MPP18_GPO,
   195 	MPP22_GPIO,    // SATA LED RED
   172 	MPP19_GPO,
   196 	MPP23_GPIO,    // SATA LED RED
   173 	MPP20_GPIO,    // SATA LED
       
   174 	MPP21_GPIO,    // SATA LED
       
   175 	MPP24_GPIO,    // SATA Power
   197 	MPP24_GPIO,    // SATA Power
   176 	MPP25_GPIO,    // USB LED Blue
   198 	MPP25_GPIO,    // USB LED Blue
   177 	MPP26_GPIO,	   // USB LED Orange
   199 	MPP26_GPIO,	   // USB LED Orange
   178 	MPP27_GPIO,	   // Button USB Copy
   200 	MPP27_GPIO,	   // Button USB Copy
   179 	MPP28_GPIO,	
   201 	MPP28_GPIO,	   // Button Reset
   180 	MPP29_GPIO,	 
   202 	MPP29_GPIO,	   // Button Power
   181 	MPP30_GPIO,
   203 	MPP30_GPIO,
   182 	MPP31_GPIO,
   204 	MPP31_GPIO,
   183 	MPP32_GPIO,
   205 	MPP32_GPIO,
   184 	MPP33_GPO,
   206 	MPP33_GPO,
   185 	MPP34_GPIO,	
   207 	MPP34_GPIO,	
   210     kirkwood_init();
   232     kirkwood_init();
   211     /* setup gpio pin select */
   233     /* setup gpio pin select */
   212     kirkwood_mpp_conf(dns320l_mpp_config);
   234     kirkwood_mpp_conf(dns320l_mpp_config);
   213     kirkwood_uart0_init();
   235     kirkwood_uart0_init();
   214     kirkwood_uart1_init();
   236     kirkwood_uart1_init();
   215     kirkwood_nand_init(ARRAY_AND_SIZE(dns320l_nand_parts), 60);
   237     kirkwood_nand_init(ARRAY_AND_SIZE(dns320l_nand_parts), 40);
   216 
   238 
   217     kirkwood_ehci_init();
   239     kirkwood_ehci_init();
   218     kirkwood_i2c_init();
   240     kirkwood_i2c_init();
   219     kirkwood_ge00_init(&dns320l_ge00_data);
   241     kirkwood_ge00_init(&dns320l_ge00_data);
   220     platform_device_register(&dns320l_led_device);
   242     platform_device_register(&dns320l_led_device);