]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - arch/arm/mach-at91/at91cap9_devices.c
Merge branch 'imx-fixes' of git://git.pengutronix.de/git/imx/linux-2.6 into fixes
[karo-tx-linux.git] / arch / arm / mach-at91 / at91cap9_devices.c
index f87f5040e78ef18d7e2fca5b355684e9b121bc3e..d298fb7cb210379a771ee52c98b05260a378769c 100644 (file)
@@ -76,10 +76,16 @@ void __init at91_add_device_usbh(struct at91_usbh_data *data)
 
        /* Enable VBus control for UHP ports */
        for (i = 0; i < data->ports; i++) {
-               if (data->vbus_pin[i])
+               if (gpio_is_valid(data->vbus_pin[i]))
                        at91_set_gpio_output(data->vbus_pin[i], 0);
        }
 
+       /* Enable overcurrent notification */
+       for (i = 0; i < data->ports; i++) {
+               if (data->overcurrent_pin[i])
+                       at91_set_gpio_input(data->overcurrent_pin[i], 1);
+       }
+
        usbh_data = *data;
        platform_device_register(&at91_usbh_device);
 }
@@ -92,7 +98,7 @@ void __init at91_add_device_usbh(struct at91_usbh_data *data) {}
  *  USB HS Device (Gadget)
  * -------------------------------------------------------------------- */
 
-#if defined(CONFIG_USB_GADGET_ATMEL_USBA) || defined(CONFIG_USB_GADGET_ATMEL_USBA_MODULE)
+#if defined(CONFIG_USB_ATMEL_USBA) || defined(CONFIG_USB_ATMEL_USBA_MODULE)
 
 static struct resource usba_udc_resources[] = {
        [0] = {
@@ -173,7 +179,7 @@ void __init at91_add_device_usba(struct usba_platform_data *data)
        usba_udc_data.pdata.num_ep = ARRAY_SIZE(usba_udc_ep);
        memcpy(usba_udc_data.ep, usba_udc_ep, sizeof(usba_udc_ep));
 
-       if (data && data->vbus_pin > 0) {
+       if (data && gpio_is_valid(data->vbus_pin)) {
                at91_set_gpio_input(data->vbus_pin, 0);
                at91_set_deglitch(data->vbus_pin, 1);
                usba_udc_data.pdata.vbus_pin = data->vbus_pin;
@@ -194,7 +200,7 @@ void __init at91_add_device_usba(struct usba_platform_data *data) {}
 
 #if defined(CONFIG_MACB) || defined(CONFIG_MACB_MODULE)
 static u64 eth_dmamask = DMA_BIT_MASK(32);
-static struct at91_eth_data eth_data;
+static struct macb_platform_data eth_data;
 
 static struct resource eth_resources[] = {
        [0] = {
@@ -221,12 +227,12 @@ static struct platform_device at91cap9_eth_device = {
        .num_resources  = ARRAY_SIZE(eth_resources),
 };
 
-void __init at91_add_device_eth(struct at91_eth_data *data)
+void __init at91_add_device_eth(struct macb_platform_data *data)
 {
        if (!data)
                return;
 
-       if (data->phy_irq_pin) {
+       if (gpio_is_valid(data->phy_irq_pin)) {
                at91_set_gpio_input(data->phy_irq_pin, 0);
                at91_set_deglitch(data->phy_irq_pin, 1);
        }
@@ -258,7 +264,7 @@ void __init at91_add_device_eth(struct at91_eth_data *data)
        platform_device_register(&at91cap9_eth_device);
 }
 #else
-void __init at91_add_device_eth(struct at91_eth_data *data) {}
+void __init at91_add_device_eth(struct macb_platform_data *data) {}
 #endif
 
 
@@ -326,13 +332,13 @@ void __init at91_add_device_mmc(short mmc_id, struct at91_mmc_data *data)
                return;
 
        /* input/irq */
-       if (data->det_pin) {
+       if (gpio_is_valid(data->det_pin)) {
                at91_set_gpio_input(data->det_pin, 1);
                at91_set_deglitch(data->det_pin, 1);
        }
-       if (data->wp_pin)
+       if (gpio_is_valid(data->wp_pin))
                at91_set_gpio_input(data->wp_pin, 1);
-       if (data->vcc_pin)
+       if (gpio_is_valid(data->vcc_pin))
                at91_set_gpio_output(data->vcc_pin, 0);
 
        if (mmc_id == 0) {              /* MCI0 */
@@ -392,8 +398,8 @@ static struct resource nand_resources[] = {
                .flags  = IORESOURCE_MEM,
        },
        [1] = {
-               .start  = AT91_BASE_SYS + AT91_ECC,
-               .end    = AT91_BASE_SYS + AT91_ECC + SZ_512 - 1,
+               .start  = AT91CAP9_BASE_ECC,
+               .end    = AT91CAP9_BASE_ECC + SZ_512 - 1,
                .flags  = IORESOURCE_MEM,
        }
 };
@@ -419,15 +425,15 @@ void __init at91_add_device_nand(struct atmel_nand_data *data)
        at91_sys_write(AT91_MATRIX_EBICSA, csa | AT91_MATRIX_EBI_CS3A_SMC_SMARTMEDIA);
 
        /* enable pin */
-       if (data->enable_pin)
+       if (gpio_is_valid(data->enable_pin))
                at91_set_gpio_output(data->enable_pin, 1);
 
        /* ready/busy pin */
-       if (data->rdy_pin)
+       if (gpio_is_valid(data->rdy_pin))
                at91_set_gpio_input(data->rdy_pin, 1);
 
        /* card detect pin */
-       if (data->det_pin)
+       if (gpio_is_valid(data->det_pin))
                at91_set_gpio_input(data->det_pin, 1);
 
        nand_data = *data;
@@ -664,8 +670,8 @@ static void __init at91_add_device_tc(void) { }
 
 static struct resource rtt_resources[] = {
        {
-               .start  = AT91_BASE_SYS + AT91_RTT,
-               .end    = AT91_BASE_SYS + AT91_RTT + SZ_16 - 1,
+               .start  = AT91CAP9_BASE_RTT,
+               .end    = AT91CAP9_BASE_RTT + SZ_16 - 1,
                .flags  = IORESOURCE_MEM,
        }
 };
@@ -688,10 +694,19 @@ static void __init at91_add_device_rtt(void)
  * -------------------------------------------------------------------- */
 
 #if defined(CONFIG_AT91SAM9X_WATCHDOG) || defined(CONFIG_AT91SAM9X_WATCHDOG_MODULE)
+static struct resource wdt_resources[] = {
+       {
+               .start  = AT91CAP9_BASE_WDT,
+               .end    = AT91CAP9_BASE_WDT + SZ_16 - 1,
+               .flags  = IORESOURCE_MEM,
+       }
+};
+
 static struct platform_device at91cap9_wdt_device = {
        .name           = "at91_wdt",
        .id             = -1,
-       .num_resources  = 0,
+       .resource       = wdt_resources,
+       .num_resources  = ARRAY_SIZE(wdt_resources),
 };
 
 static void __init at91_add_device_watchdog(void)
@@ -801,7 +816,7 @@ void __init at91_add_device_ac97(struct ac97c_platform_data *data)
        at91_set_A_periph(AT91_PIN_PA9, 0);     /* AC97RX */
 
        /* reset */
-       if (data->reset_pin)
+       if (gpio_is_valid(data->reset_pin))
                at91_set_gpio_output(data->reset_pin, 0);
 
        ac97_data = *data;
@@ -1015,8 +1030,8 @@ void __init at91_add_device_ssc(unsigned id, unsigned pins) {}
 #if defined(CONFIG_SERIAL_ATMEL)
 static struct resource dbgu_resources[] = {
        [0] = {
-               .start  = AT91_VA_BASE_SYS + AT91_DBGU,
-               .end    = AT91_VA_BASE_SYS + AT91_DBGU + SZ_512 - 1,
+               .start  = AT91CAP9_BASE_DBGU,
+               .end    = AT91CAP9_BASE_DBGU + SZ_512 - 1,
                .flags  = IORESOURCE_MEM,
        },
        [1] = {
@@ -1029,7 +1044,6 @@ static struct resource dbgu_resources[] = {
 static struct atmel_uart_data dbgu_data = {
        .use_dma_tx     = 0,
        .use_dma_rx     = 0,            /* DBGU not capable of receive DMA */
-       .regs           = (void __iomem *)(AT91_VA_BASE_SYS + AT91_DBGU),
 };
 
 static u64 dbgu_dmamask = DMA_BIT_MASK(32);