diff options
Diffstat (limited to 'arch/avr32/boards/atngw100/setup.c')
-rw-r--r-- | arch/avr32/boards/atngw100/setup.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/arch/avr32/boards/atngw100/setup.c b/arch/avr32/boards/atngw100/setup.c index a398be284966..a51bb9fb3c89 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> |
@@ -25,6 +27,13 @@ | |||
25 | #include <asm/arch/init.h> | 27 | #include <asm/arch/init.h> |
26 | #include <asm/arch/portmux.h> | 28 | #include <asm/arch/portmux.h> |
27 | 29 | ||
30 | /* Oscillator frequencies. These are board-specific */ | ||
31 | unsigned long at32_board_osc_rates[3] = { | ||
32 | [0] = 32768, /* 32.768 kHz on RTC osc */ | ||
33 | [1] = 20000000, /* 20 MHz on osc0 */ | ||
34 | [2] = 12000000, /* 12 MHz on osc1 */ | ||
35 | }; | ||
36 | |||
28 | /* Initialized by bootloader-specific startup code. */ | 37 | /* Initialized by bootloader-specific startup code. */ |
29 | struct tag *bootloader_tags __initdata; | 38 | struct tag *bootloader_tags __initdata; |
30 | 39 | ||
@@ -140,6 +149,10 @@ static struct platform_device i2c_gpio_device = { | |||
140 | }, | 149 | }, |
141 | }; | 150 | }; |
142 | 151 | ||
152 | static struct i2c_board_info __initdata i2c_info[] = { | ||
153 | /* NOTE: original ATtiny24 firmware is at address 0x0b */ | ||
154 | }; | ||
155 | |||
143 | static int __init atngw100_init(void) | 156 | static int __init atngw100_init(void) |
144 | { | 157 | { |
145 | unsigned i; | 158 | unsigned i; |
@@ -165,12 +178,28 @@ static int __init atngw100_init(void) | |||
165 | } | 178 | } |
166 | platform_device_register(&ngw_gpio_leds); | 179 | platform_device_register(&ngw_gpio_leds); |
167 | 180 | ||
181 | /* all these i2c/smbus pins should have external pullups for | ||
182 | * open-drain sharing among all I2C devices. SDA and SCL do; | ||
183 | * PB28/EXTINT3 doesn't; it should be SMBALERT# (for PMBus), | ||
184 | * but it's not available off-board. | ||
185 | */ | ||
186 | at32_select_periph(GPIO_PIN_PB(28), 0, AT32_GPIOF_PULLUP); | ||
168 | at32_select_gpio(i2c_gpio_data.sda_pin, | 187 | at32_select_gpio(i2c_gpio_data.sda_pin, |
169 | AT32_GPIOF_MULTIDRV | AT32_GPIOF_OUTPUT | AT32_GPIOF_HIGH); | 188 | AT32_GPIOF_MULTIDRV | AT32_GPIOF_OUTPUT | AT32_GPIOF_HIGH); |
170 | at32_select_gpio(i2c_gpio_data.scl_pin, | 189 | at32_select_gpio(i2c_gpio_data.scl_pin, |
171 | AT32_GPIOF_MULTIDRV | AT32_GPIOF_OUTPUT | AT32_GPIOF_HIGH); | 190 | AT32_GPIOF_MULTIDRV | AT32_GPIOF_OUTPUT | AT32_GPIOF_HIGH); |
172 | platform_device_register(&i2c_gpio_device); | 191 | platform_device_register(&i2c_gpio_device); |
192 | i2c_register_board_info(0, i2c_info, ARRAY_SIZE(i2c_info)); | ||
173 | 193 | ||
174 | return 0; | 194 | return 0; |
175 | } | 195 | } |
176 | postcore_initcall(atngw100_init); | 196 | postcore_initcall(atngw100_init); |
197 | |||
198 | static int __init atngw100_arch_init(void) | ||
199 | { | ||
200 | /* set_irq_type() after the arch_initcall for EIC has run, and | ||
201 | * before the I2C subsystem could try using this IRQ. | ||
202 | */ | ||
203 | return set_irq_type(AT32_EXTINT(3), IRQ_TYPE_EDGE_FALLING); | ||
204 | } | ||
205 | arch_initcall(atngw100_arch_init); | ||