diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-12-15 12:01:00 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-12-15 12:01:00 -0500 |
commit | 050cbb09dac0402672edeaeac06094ef8ff1749a (patch) | |
tree | 89cbe4ac48e8e8f80ff5849e2cc33f045f5ccd52 /arch/avr32/mach-at32ap | |
parent | 17c330f98383629cfd359ee62b3adde1d2a3ff7c (diff) | |
parent | 0386f9e68fc92a3650088b86d908b07de4fb1744 (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/hskinnemoen/avr32-2.6
* 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
Diffstat (limited to 'arch/avr32/mach-at32ap')
-rw-r--r-- | arch/avr32/mach-at32ap/at32ap700x.c | 35 | ||||
-rw-r--r-- | arch/avr32/mach-at32ap/include/mach/board.h | 1 |
2 files changed, 20 insertions, 16 deletions
diff --git a/arch/avr32/mach-at32ap/at32ap700x.c b/arch/avr32/mach-at32ap/at32ap700x.c index b40ff39e0ac8..1aa1ea5e9212 100644 --- a/arch/avr32/mach-at32ap/at32ap700x.c +++ b/arch/avr32/mach-at32ap/at32ap700x.c | |||
@@ -1183,19 +1183,32 @@ static struct resource atmel_spi1_resource[] = { | |||
1183 | DEFINE_DEV(atmel_spi, 1); | 1183 | DEFINE_DEV(atmel_spi, 1); |
1184 | DEV_CLK(spi_clk, atmel_spi1, pba, 1); | 1184 | DEV_CLK(spi_clk, atmel_spi1, pba, 1); |
1185 | 1185 | ||
1186 | static void __init | 1186 | void __init |
1187 | at32_spi_setup_slaves(unsigned int bus_num, struct spi_board_info *b, | 1187 | at32_spi_setup_slaves(unsigned int bus_num, struct spi_board_info *b, unsigned int n) |
1188 | unsigned int n, const u8 *pins) | ||
1189 | { | 1188 | { |
1189 | /* | ||
1190 | * Manage the chipselects as GPIOs, normally using the same pins | ||
1191 | * the SPI controller expects; but boards can use other pins. | ||
1192 | */ | ||
1193 | static u8 __initdata spi_pins[][4] = { | ||
1194 | { GPIO_PIN_PA(3), GPIO_PIN_PA(4), | ||
1195 | GPIO_PIN_PA(5), GPIO_PIN_PA(20) }, | ||
1196 | { GPIO_PIN_PB(2), GPIO_PIN_PB(3), | ||
1197 | GPIO_PIN_PB(4), GPIO_PIN_PA(27) }, | ||
1198 | }; | ||
1190 | unsigned int pin, mode; | 1199 | unsigned int pin, mode; |
1191 | 1200 | ||
1201 | /* There are only 2 SPI controllers */ | ||
1202 | if (bus_num > 1) | ||
1203 | return; | ||
1204 | |||
1192 | for (; n; n--, b++) { | 1205 | for (; n; n--, b++) { |
1193 | b->bus_num = bus_num; | 1206 | b->bus_num = bus_num; |
1194 | if (b->chip_select >= 4) | 1207 | if (b->chip_select >= 4) |
1195 | continue; | 1208 | continue; |
1196 | pin = (unsigned)b->controller_data; | 1209 | pin = (unsigned)b->controller_data; |
1197 | if (!pin) { | 1210 | if (!pin) { |
1198 | pin = pins[b->chip_select]; | 1211 | pin = spi_pins[bus_num][b->chip_select]; |
1199 | b->controller_data = (void *)pin; | 1212 | b->controller_data = (void *)pin; |
1200 | } | 1213 | } |
1201 | mode = AT32_GPIOF_OUTPUT; | 1214 | mode = AT32_GPIOF_OUTPUT; |
@@ -1208,16 +1221,6 @@ at32_spi_setup_slaves(unsigned int bus_num, struct spi_board_info *b, | |||
1208 | struct platform_device *__init | 1221 | struct platform_device *__init |
1209 | at32_add_device_spi(unsigned int id, struct spi_board_info *b, unsigned int n) | 1222 | at32_add_device_spi(unsigned int id, struct spi_board_info *b, unsigned int n) |
1210 | { | 1223 | { |
1211 | /* | ||
1212 | * Manage the chipselects as GPIOs, normally using the same pins | ||
1213 | * the SPI controller expects; but boards can use other pins. | ||
1214 | */ | ||
1215 | static u8 __initdata spi0_pins[] = | ||
1216 | { GPIO_PIN_PA(3), GPIO_PIN_PA(4), | ||
1217 | GPIO_PIN_PA(5), GPIO_PIN_PA(20), }; | ||
1218 | static u8 __initdata spi1_pins[] = | ||
1219 | { GPIO_PIN_PB(2), GPIO_PIN_PB(3), | ||
1220 | GPIO_PIN_PB(4), GPIO_PIN_PA(27), }; | ||
1221 | struct platform_device *pdev; | 1224 | struct platform_device *pdev; |
1222 | u32 pin_mask; | 1225 | u32 pin_mask; |
1223 | 1226 | ||
@@ -1230,7 +1233,7 @@ at32_add_device_spi(unsigned int id, struct spi_board_info *b, unsigned int n) | |||
1230 | select_peripheral(PIOA, (1 << 0), PERIPH_A, AT32_GPIOF_PULLUP); | 1233 | select_peripheral(PIOA, (1 << 0), PERIPH_A, AT32_GPIOF_PULLUP); |
1231 | select_peripheral(PIOA, pin_mask, PERIPH_A, 0); | 1234 | select_peripheral(PIOA, pin_mask, PERIPH_A, 0); |
1232 | 1235 | ||
1233 | at32_spi_setup_slaves(0, b, n, spi0_pins); | 1236 | at32_spi_setup_slaves(0, b, n); |
1234 | break; | 1237 | break; |
1235 | 1238 | ||
1236 | case 1: | 1239 | case 1: |
@@ -1241,7 +1244,7 @@ at32_add_device_spi(unsigned int id, struct spi_board_info *b, unsigned int n) | |||
1241 | select_peripheral(PIOB, (1 << 0), PERIPH_B, AT32_GPIOF_PULLUP); | 1244 | select_peripheral(PIOB, (1 << 0), PERIPH_B, AT32_GPIOF_PULLUP); |
1242 | select_peripheral(PIOB, pin_mask, PERIPH_B, 0); | 1245 | select_peripheral(PIOB, pin_mask, PERIPH_B, 0); |
1243 | 1246 | ||
1244 | at32_spi_setup_slaves(1, b, n, spi1_pins); | 1247 | at32_spi_setup_slaves(1, b, n); |
1245 | break; | 1248 | break; |
1246 | 1249 | ||
1247 | default: | 1250 | default: |
diff --git a/arch/avr32/mach-at32ap/include/mach/board.h b/arch/avr32/mach-at32ap/include/mach/board.h index ddedb471f33e..c7f25bb1d068 100644 --- a/arch/avr32/mach-at32ap/include/mach/board.h +++ b/arch/avr32/mach-at32ap/include/mach/board.h | |||
@@ -49,6 +49,7 @@ at32_add_device_eth(unsigned int id, struct eth_platform_data *data); | |||
49 | struct spi_board_info; | 49 | struct spi_board_info; |
50 | struct platform_device * | 50 | struct platform_device * |
51 | at32_add_device_spi(unsigned int id, struct spi_board_info *b, unsigned int n); | 51 | at32_add_device_spi(unsigned int id, struct spi_board_info *b, unsigned int n); |
52 | void at32_spi_setup_slaves(unsigned int bus_num, struct spi_board_info *b, unsigned int n); | ||
52 | 53 | ||
53 | struct atmel_lcdfb_info; | 54 | struct atmel_lcdfb_info; |
54 | struct platform_device * | 55 | struct platform_device * |