Merge git://git.kernel.org/pub/scm/linux/kernel/git/hskinnemoen/avr32-2.6
authorLinus Torvalds <torvalds@linux-foundation.org>
Tue, 15 Dec 2009 17:01:00 +0000 (09:01 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 15 Dec 2009 17:01:00 +0000 (09:01 -0800)
* git://git.kernel.org/pub/scm/linux/kernel/git/hskinnemoen/avr32-2.6:
  avr32: update default configurations for ATNGW100, ATSTK1002 and ATSTK1006
  avr32: add default configurations for ATNGW100 mkII and EVKLCD10X
  avr32: add support for ATNGW100 mkII board
  avr32: convert to asm-generic/hardirq.h
  avr32: add two new at91 to cpu.h definition
  avr32: clean up linker script using standard macros.
  avr32: MRMT: correct setup of SPI slaves
  avr32: function for independently setting up SPI slaves
  avr32: re-instate MCI WP/CD pin assignments for ATNGW100

1  2 
arch/avr32/Kconfig
arch/avr32/mach-at32ap/at32ap700x.c

diff --combined arch/avr32/Kconfig
@@@ -92,7 -92,6 +92,7 @@@ config PLATFORM_AT32A
        select PERFORMANCE_COUNTERS
        select ARCH_REQUIRE_GPIOLIB
        select GENERIC_ALLOCATOR
 +      select HAVE_FB_ATMEL
  
  #
  # CPU types
@@@ -112,6 -111,11 +112,11 @@@ config CPU_AT32AP700
        bool
        select CPU_AT32AP700X
  
+ # AP700X boards
+ config BOARD_ATNGW100_COMMON
+       bool
+       select CPU_AT32AP7000
  choice
        prompt "AVR32 board type"
        default BOARD_ATSTK1000
  config BOARD_ATSTK1000
        bool "ATSTK1000 evaluation board"
  
- config BOARD_ATNGW100
+ config BOARD_ATNGW100_MKI
        bool "ATNGW100 Network Gateway"
-       select CPU_AT32AP7000
+       select BOARD_ATNGW100_COMMON
+ config BOARD_ATNGW100_MKII
+       bool "ATNGW100 mkII Network Gateway"
+       select BOARD_ATNGW100_COMMON
  
  config BOARD_HAMMERHEAD
        bool "Hammerhead board"
@@@ -15,8 -15,6 +15,8 @@@
  #include <linux/gpio.h>
  #include <linux/spi/spi.h>
  #include <linux/usb/atmel_usba_udc.h>
 +
 +#include <mach/atmel-mci.h>
  #include <linux/atmel-mci.h>
  
  #include <asm/io.h>
@@@ -1183,19 -1181,32 +1183,32 @@@ static struct resource atmel_spi1_resou
  DEFINE_DEV(atmel_spi, 1);
  DEV_CLK(spi_clk, atmel_spi1, pba, 1);
  
- static void __init
- at32_spi_setup_slaves(unsigned int bus_num, struct spi_board_info *b,
-                     unsigned int n, const u8 *pins)
+ void __init
+ at32_spi_setup_slaves(unsigned int bus_num, struct spi_board_info *b, unsigned int n)
  {
+       /*
+        * Manage the chipselects as GPIOs, normally using the same pins
+        * the SPI controller expects; but boards can use other pins.
+        */
+       static u8 __initdata spi_pins[][4] = {
+               { GPIO_PIN_PA(3), GPIO_PIN_PA(4),
+                 GPIO_PIN_PA(5), GPIO_PIN_PA(20) },
+               { GPIO_PIN_PB(2), GPIO_PIN_PB(3),
+                 GPIO_PIN_PB(4), GPIO_PIN_PA(27) },
+       };
        unsigned int pin, mode;
  
+       /* There are only 2 SPI controllers */
+       if (bus_num > 1)
+               return;
        for (; n; n--, b++) {
                b->bus_num = bus_num;
                if (b->chip_select >= 4)
                        continue;
                pin = (unsigned)b->controller_data;
                if (!pin) {
-                       pin = pins[b->chip_select];
+                       pin = spi_pins[bus_num][b->chip_select];
                        b->controller_data = (void *)pin;
                }
                mode = AT32_GPIOF_OUTPUT;
  struct platform_device *__init
  at32_add_device_spi(unsigned int id, struct spi_board_info *b, unsigned int n)
  {
-       /*
-        * Manage the chipselects as GPIOs, normally using the same pins
-        * the SPI controller expects; but boards can use other pins.
-        */
-       static u8 __initdata spi0_pins[] =
-               { GPIO_PIN_PA(3), GPIO_PIN_PA(4),
-                 GPIO_PIN_PA(5), GPIO_PIN_PA(20), };
-       static u8 __initdata spi1_pins[] =
-               { GPIO_PIN_PB(2), GPIO_PIN_PB(3),
-                 GPIO_PIN_PB(4), GPIO_PIN_PA(27), };
        struct platform_device *pdev;
        u32 pin_mask;
  
                select_peripheral(PIOA, (1 << 0), PERIPH_A, AT32_GPIOF_PULLUP);
                select_peripheral(PIOA, pin_mask, PERIPH_A, 0);
  
-               at32_spi_setup_slaves(0, b, n, spi0_pins);
+               at32_spi_setup_slaves(0, b, n);
                break;
  
        case 1:
                select_peripheral(PIOB, (1 << 0), PERIPH_B, AT32_GPIOF_PULLUP);
                select_peripheral(PIOB, pin_mask, PERIPH_B, 0);
  
-               at32_spi_setup_slaves(1, b, n, spi1_pins);
+               at32_spi_setup_slaves(1, b, n);
                break;
  
        default:
@@@ -1322,7 -1323,7 +1325,7 @@@ struct platform_device *__ini
  at32_add_device_mci(unsigned int id, struct mci_platform_data *data)
  {
        struct platform_device          *pdev;
 -      struct dw_dma_slave             *dws = &data->dma_slave;
 +      struct mci_dma_slave            *slave;
        u32                             pioa_mask;
        u32                             piob_mask;
  
                                ARRAY_SIZE(atmel_mci0_resource)))
                goto fail;
  
 -      dws->dma_dev = &dw_dmac0_device.dev;
 -      dws->reg_width = DW_DMA_SLAVE_WIDTH_32BIT;
 -      dws->cfg_hi = (DWC_CFGH_SRC_PER(0)
 +      slave = kzalloc(sizeof(struct mci_dma_slave), GFP_KERNEL);
 +
 +      slave->sdata.dma_dev = &dw_dmac0_device.dev;
 +      slave->sdata.reg_width = DW_DMA_SLAVE_WIDTH_32BIT;
 +      slave->sdata.cfg_hi = (DWC_CFGH_SRC_PER(0)
                                | DWC_CFGH_DST_PER(1));
 -      dws->cfg_lo &= ~(DWC_CFGL_HS_DST_POL
 +      slave->sdata.cfg_lo &= ~(DWC_CFGL_HS_DST_POL
                                | DWC_CFGL_HS_SRC_POL);
  
 +      data->dma_slave = slave;
 +
        if (platform_device_add_data(pdev, data,
                                sizeof(struct mci_platform_data)))
                goto fail;
        return pdev;
  
  fail:
 +      data->dma_slave = NULL;
 +      kfree(slave);
        platform_device_put(pdev);
        return NULL;
  }