[ARM] 4768/2: ixp4xx: Button and LED updates for the nas100d board
[firefly-linux-kernel-4.4.55.git] / arch / arm / mach-ixp4xx / nas100d-setup.c
index 9a31444d9214e82aea76b803c6bff835ce187829..213a4cea9117b04c3d8cd88188ff80ff95f3688f 100644 (file)
@@ -16,6 +16,7 @@
 #include <linux/serial.h>
 #include <linux/serial_8250.h>
 #include <linux/leds.h>
+#include <linux/i2c-gpio.h>
 
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
@@ -42,20 +43,20 @@ static struct platform_device nas100d_flash = {
 static struct resource nas100d_led_resources[] = {
        {
                .name           = "wlan",   /* green led */
-               .start          = 0,
-               .end            = 0,
+               .start          = NAS100D_LED_WLAN_GPIO,
+               .end            = NAS100D_LED_WLAN_GPIO,
                .flags          = IXP4XX_GPIO_LOW,
        },
        {
-               .name           = "ready",  /* blue power led (off is flashing!) */
-               .start          = 15,
-               .end            = 15,
+               .name           = "power",  /* blue power led (off=flashing) */
+               .start          = NAS100D_LED_PWR_GPIO,
+               .end            = NAS100D_LED_PWR_GPIO,
                .flags          = IXP4XX_GPIO_LOW,
        },
        {
                .name           = "disk",   /* yellow led */
-               .start          = 3,
-               .end            = 3,
+               .start          = NAS100D_LED_DISK_GPIO,
+               .end            = NAS100D_LED_DISK_GPIO,
                .flags          = IXP4XX_GPIO_LOW,
        },
 };
@@ -68,16 +69,17 @@ static struct platform_device nas100d_leds = {
 };
 #endif
 
-static struct ixp4xx_i2c_pins nas100d_i2c_gpio_pins = {
+static struct i2c_gpio_platform_data nas100d_i2c_gpio_data = {
        .sda_pin                = NAS100D_SDA_PIN,
        .scl_pin                = NAS100D_SCL_PIN,
 };
 
-static struct platform_device nas100d_i2c_controller = {
-       .name                   = "IXP4XX-I2C",
+static struct platform_device nas100d_i2c_gpio = {
+       .name                   = "i2c-gpio",
        .id                     = 0,
-       .dev.platform_data      = &nas100d_i2c_gpio_pins,
-       .num_resources          = 0,
+       .dev     = {
+               .platform_data  = &nas100d_i2c_gpio_data,
+       },
 };
 
 static struct resource nas100d_uart_resources[] = {
@@ -124,7 +126,7 @@ static struct platform_device nas100d_uart = {
 };
 
 static struct platform_device *nas100d_devices[] __initdata = {
-       &nas100d_i2c_controller,
+       &nas100d_i2c_gpio,
        &nas100d_flash,
 #ifdef CONFIG_LEDS_IXP4XX
        &nas100d_leds,
@@ -155,7 +157,8 @@ static void __init nas100d_init(void)
 
        pm_power_off = nas100d_power_off;
 
-       /* This is only useful on a modified machine, but it is valuable
+       /*
+        * This is only useful on a modified machine, but it is valuable
         * to have it first in order to see debug messages, and so that
         * it does *not* get removed if platform_add_devices fails!
         */