diff options
Diffstat (limited to 'arch/avr32/boards/atngw100/setup.c')
-rw-r--r-- | arch/avr32/boards/atngw100/setup.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/arch/avr32/boards/atngw100/setup.c b/arch/avr32/boards/atngw100/setup.c index a398be284966..c7fe94d03a1e 100644 --- a/arch/avr32/boards/atngw100/setup.c +++ b/arch/avr32/boards/atngw100/setup.c | |||
@@ -9,6 +9,8 @@ | |||
9 | */ | 9 | */ |
10 | #include <linux/clk.h> | 10 | #include <linux/clk.h> |
11 | #include <linux/etherdevice.h> | 11 | #include <linux/etherdevice.h> |
12 | #include <linux/irq.h> | ||
13 | #include <linux/i2c.h> | ||
12 | #include <linux/i2c-gpio.h> | 14 | #include <linux/i2c-gpio.h> |
13 | #include <linux/init.h> | 15 | #include <linux/init.h> |
14 | #include <linux/linkage.h> | 16 | #include <linux/linkage.h> |
@@ -17,6 +19,7 @@ | |||
17 | #include <linux/leds.h> | 19 | #include <linux/leds.h> |
18 | #include <linux/spi/spi.h> | 20 | #include <linux/spi/spi.h> |
19 | 21 | ||
22 | #include <asm/atmel-mci.h> | ||
20 | #include <asm/io.h> | 23 | #include <asm/io.h> |
21 | #include <asm/setup.h> | 24 | #include <asm/setup.h> |
22 | 25 | ||
@@ -25,6 +28,13 @@ | |||
25 | #include <asm/arch/init.h> | 28 | #include <asm/arch/init.h> |
26 | #include <asm/arch/portmux.h> | 29 | #include <asm/arch/portmux.h> |
27 | 30 | ||
31 | /* Oscillator frequencies. These are board-specific */ | ||
32 | unsigned long at32_board_osc_rates[3] = { | ||
33 | [0] = 32768, /* 32.768 kHz on RTC osc */ | ||
34 | [1] = 20000000, /* 20 MHz on osc0 */ | ||
35 | [2] = 12000000, /* 12 MHz on osc1 */ | ||
36 | }; | ||
37 | |||
28 | /* Initialized by bootloader-specific startup code. */ | 38 | /* Initialized by bootloader-specific startup code. */ |
29 | struct tag *bootloader_tags __initdata; | 39 | struct tag *bootloader_tags __initdata; |
30 | 40 | ||
@@ -42,6 +52,11 @@ static struct spi_board_info spi0_board_info[] __initdata = { | |||
42 | }, | 52 | }, |
43 | }; | 53 | }; |
44 | 54 | ||
55 | static struct mci_platform_data __initdata mci0_data = { | ||
56 | .detect_pin = GPIO_PIN_PC(25), | ||
57 | .wp_pin = GPIO_PIN_PE(0), | ||
58 | }; | ||
59 | |||
45 | /* | 60 | /* |
46 | * The next two functions should go away as the boot loader is | 61 | * The next two functions should go away as the boot loader is |
47 | * supposed to initialize the macb address registers with a valid | 62 | * supposed to initialize the macb address registers with a valid |
@@ -140,6 +155,10 @@ static struct platform_device i2c_gpio_device = { | |||
140 | }, | 155 | }, |
141 | }; | 156 | }; |
142 | 157 | ||
158 | static struct i2c_board_info __initdata i2c_info[] = { | ||
159 | /* NOTE: original ATtiny24 firmware is at address 0x0b */ | ||
160 | }; | ||
161 | |||
143 | static int __init atngw100_init(void) | 162 | static int __init atngw100_init(void) |
144 | { | 163 | { |
145 | unsigned i; | 164 | unsigned i; |
@@ -157,6 +176,7 @@ static int __init atngw100_init(void) | |||
157 | set_hw_addr(at32_add_device_eth(1, ð_data[1])); | 176 | set_hw_addr(at32_add_device_eth(1, ð_data[1])); |
158 | 177 | ||
159 | at32_add_device_spi(0, spi0_board_info, ARRAY_SIZE(spi0_board_info)); | 178 | at32_add_device_spi(0, spi0_board_info, ARRAY_SIZE(spi0_board_info)); |
179 | at32_add_device_mci(0, &mci0_data); | ||
160 | at32_add_device_usba(0, NULL); | 180 | at32_add_device_usba(0, NULL); |
161 | 181 | ||
162 | for (i = 0; i < ARRAY_SIZE(ngw_leds); i++) { | 182 | for (i = 0; i < ARRAY_SIZE(ngw_leds); i++) { |
@@ -165,12 +185,28 @@ static int __init atngw100_init(void) | |||
165 | } | 185 | } |
166 | platform_device_register(&ngw_gpio_leds); | 186 | platform_device_register(&ngw_gpio_leds); |
167 | 187 | ||
188 | /* all these i2c/smbus pins should have external pullups for | ||
189 | * open-drain sharing among all I2C devices. SDA and SCL do; | ||
190 | * PB28/EXTINT3 doesn't; it should be SMBALERT# (for PMBus), | ||
191 | * but it's not available off-board. | ||
192 | */ | ||
193 | at32_select_periph(GPIO_PIN_PB(28), 0, AT32_GPIOF_PULLUP); | ||
168 | at32_select_gpio(i2c_gpio_data.sda_pin, | 194 | at32_select_gpio(i2c_gpio_data.sda_pin, |
169 | AT32_GPIOF_MULTIDRV | AT32_GPIOF_OUTPUT | AT32_GPIOF_HIGH); | 195 | AT32_GPIOF_MULTIDRV | AT32_GPIOF_OUTPUT | AT32_GPIOF_HIGH); |
170 | at32_select_gpio(i2c_gpio_data.scl_pin, | 196 | at32_select_gpio(i2c_gpio_data.scl_pin, |
171 | AT32_GPIOF_MULTIDRV | AT32_GPIOF_OUTPUT | AT32_GPIOF_HIGH); | 197 | AT32_GPIOF_MULTIDRV | AT32_GPIOF_OUTPUT | AT32_GPIOF_HIGH); |
172 | platform_device_register(&i2c_gpio_device); | 198 | platform_device_register(&i2c_gpio_device); |
199 | i2c_register_board_info(0, i2c_info, ARRAY_SIZE(i2c_info)); | ||
173 | 200 | ||
174 | return 0; | 201 | return 0; |
175 | } | 202 | } |
176 | postcore_initcall(atngw100_init); | 203 | postcore_initcall(atngw100_init); |
204 | |||
205 | static int __init atngw100_arch_init(void) | ||
206 | { | ||
207 | /* set_irq_type() after the arch_initcall for EIC has run, and | ||
208 | * before the I2C subsystem could try using this IRQ. | ||
209 | */ | ||
210 | return set_irq_type(AT32_EXTINT(3), IRQ_TYPE_EDGE_FALLING); | ||
211 | } | ||
212 | arch_initcall(atngw100_arch_init); | ||