diff options
Diffstat (limited to 'arch/arm/mach-at91')
-rw-r--r-- | arch/arm/mach-at91/board-afeb-9260v1.c | 6 | ||||
-rw-r--r-- | arch/arm/mach-at91/board-sam9g20ek.c | 63 | ||||
-rw-r--r-- | arch/arm/mach-at91/board-sam9rlek.c | 6 | ||||
-rw-r--r-- | arch/arm/mach-at91/clock.c | 151 | ||||
-rw-r--r-- | arch/arm/mach-at91/include/mach/at91_pmc.h | 26 | ||||
-rw-r--r-- | arch/arm/mach-at91/include/mach/at_hdmac.h | 102 |
6 files changed, 306 insertions, 48 deletions
diff --git a/arch/arm/mach-at91/board-afeb-9260v1.c b/arch/arm/mach-at91/board-afeb-9260v1.c index e263fda3e2d1..970fd6b6753e 100644 --- a/arch/arm/mach-at91/board-afeb-9260v1.c +++ b/arch/arm/mach-at91/board-afeb-9260v1.c | |||
@@ -156,6 +156,8 @@ static struct atmel_nand_data __initdata afeb9260_nand_data = { | |||
156 | * MCI (SD/MMC) | 156 | * MCI (SD/MMC) |
157 | */ | 157 | */ |
158 | static struct at91_mmc_data __initdata afeb9260_mmc_data = { | 158 | static struct at91_mmc_data __initdata afeb9260_mmc_data = { |
159 | .det_pin = AT91_PIN_PC9, | ||
160 | .wp_pin = AT91_PIN_PC4, | ||
159 | .slot_b = 1, | 161 | .slot_b = 1, |
160 | .wire4 = 1, | 162 | .wire4 = 1, |
161 | }; | 163 | }; |
@@ -164,6 +166,8 @@ static struct at91_mmc_data __initdata afeb9260_mmc_data = { | |||
164 | 166 | ||
165 | static struct i2c_board_info __initdata afeb9260_i2c_devices[] = { | 167 | static struct i2c_board_info __initdata afeb9260_i2c_devices[] = { |
166 | { | 168 | { |
169 | I2C_BOARD_INFO("tlv320aic23", 0x1a), | ||
170 | }, { | ||
167 | I2C_BOARD_INFO("fm3130", 0x68), | 171 | I2C_BOARD_INFO("fm3130", 0x68), |
168 | }, { | 172 | }, { |
169 | I2C_BOARD_INFO("24c64", 0x50), | 173 | I2C_BOARD_INFO("24c64", 0x50), |
@@ -196,6 +200,8 @@ static void __init afeb9260_board_init(void) | |||
196 | /* I2C */ | 200 | /* I2C */ |
197 | at91_add_device_i2c(afeb9260_i2c_devices, | 201 | at91_add_device_i2c(afeb9260_i2c_devices, |
198 | ARRAY_SIZE(afeb9260_i2c_devices)); | 202 | ARRAY_SIZE(afeb9260_i2c_devices)); |
203 | /* Audio */ | ||
204 | at91_add_device_ssc(AT91SAM9260_ID_SSC, ATMEL_SSC_TX); | ||
199 | } | 205 | } |
200 | 206 | ||
201 | MACHINE_START(AFEB9260, "Custom afeb9260 board") | 207 | MACHINE_START(AFEB9260, "Custom afeb9260 board") |
diff --git a/arch/arm/mach-at91/board-sam9g20ek.c b/arch/arm/mach-at91/board-sam9g20ek.c index 438efbb17482..a55398ed1211 100644 --- a/arch/arm/mach-at91/board-sam9g20ek.c +++ b/arch/arm/mach-at91/board-sam9g20ek.c | |||
@@ -24,6 +24,8 @@ | |||
24 | #include <linux/platform_device.h> | 24 | #include <linux/platform_device.h> |
25 | #include <linux/spi/spi.h> | 25 | #include <linux/spi/spi.h> |
26 | #include <linux/spi/at73c213.h> | 26 | #include <linux/spi/at73c213.h> |
27 | #include <linux/gpio_keys.h> | ||
28 | #include <linux/input.h> | ||
27 | #include <linux/clk.h> | 29 | #include <linux/clk.h> |
28 | 30 | ||
29 | #include <mach/hardware.h> | 31 | #include <mach/hardware.h> |
@@ -218,6 +220,63 @@ static struct gpio_led ek_leds[] = { | |||
218 | } | 220 | } |
219 | }; | 221 | }; |
220 | 222 | ||
223 | |||
224 | /* | ||
225 | * GPIO Buttons | ||
226 | */ | ||
227 | #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE) | ||
228 | static struct gpio_keys_button ek_buttons[] = { | ||
229 | { | ||
230 | .gpio = AT91_PIN_PA30, | ||
231 | .code = BTN_3, | ||
232 | .desc = "Button 3", | ||
233 | .active_low = 1, | ||
234 | .wakeup = 1, | ||
235 | }, | ||
236 | { | ||
237 | .gpio = AT91_PIN_PA31, | ||
238 | .code = BTN_4, | ||
239 | .desc = "Button 4", | ||
240 | .active_low = 1, | ||
241 | .wakeup = 1, | ||
242 | } | ||
243 | }; | ||
244 | |||
245 | static struct gpio_keys_platform_data ek_button_data = { | ||
246 | .buttons = ek_buttons, | ||
247 | .nbuttons = ARRAY_SIZE(ek_buttons), | ||
248 | }; | ||
249 | |||
250 | static struct platform_device ek_button_device = { | ||
251 | .name = "gpio-keys", | ||
252 | .id = -1, | ||
253 | .num_resources = 0, | ||
254 | .dev = { | ||
255 | .platform_data = &ek_button_data, | ||
256 | } | ||
257 | }; | ||
258 | |||
259 | static void __init ek_add_device_buttons(void) | ||
260 | { | ||
261 | at91_set_gpio_input(AT91_PIN_PA30, 1); /* btn3 */ | ||
262 | at91_set_deglitch(AT91_PIN_PA30, 1); | ||
263 | at91_set_gpio_input(AT91_PIN_PA31, 1); /* btn4 */ | ||
264 | at91_set_deglitch(AT91_PIN_PA31, 1); | ||
265 | |||
266 | platform_device_register(&ek_button_device); | ||
267 | } | ||
268 | #else | ||
269 | static void __init ek_add_device_buttons(void) {} | ||
270 | #endif | ||
271 | |||
272 | |||
273 | static struct i2c_board_info __initdata ek_i2c_devices[] = { | ||
274 | { | ||
275 | I2C_BOARD_INFO("24c512", 0x50), | ||
276 | }, | ||
277 | }; | ||
278 | |||
279 | |||
221 | static void __init ek_board_init(void) | 280 | static void __init ek_board_init(void) |
222 | { | 281 | { |
223 | /* Serial */ | 282 | /* Serial */ |
@@ -235,9 +294,11 @@ static void __init ek_board_init(void) | |||
235 | /* MMC */ | 294 | /* MMC */ |
236 | at91_add_device_mmc(0, &ek_mmc_data); | 295 | at91_add_device_mmc(0, &ek_mmc_data); |
237 | /* I2C */ | 296 | /* I2C */ |
238 | at91_add_device_i2c(NULL, 0); | 297 | at91_add_device_i2c(ek_i2c_devices, ARRAY_SIZE(ek_i2c_devices)); |
239 | /* LEDs */ | 298 | /* LEDs */ |
240 | at91_gpio_leds(ek_leds, ARRAY_SIZE(ek_leds)); | 299 | at91_gpio_leds(ek_leds, ARRAY_SIZE(ek_leds)); |
300 | /* Push Buttons */ | ||
301 | ek_add_device_buttons(); | ||
241 | /* PCK0 provides MCLK to the WM8731 */ | 302 | /* PCK0 provides MCLK to the WM8731 */ |
242 | at91_set_B_periph(AT91_PIN_PC1, 0); | 303 | at91_set_B_periph(AT91_PIN_PC1, 0); |
243 | /* SSC (for WM8731) */ | 304 | /* SSC (for WM8731) */ |
diff --git a/arch/arm/mach-at91/board-sam9rlek.c b/arch/arm/mach-at91/board-sam9rlek.c index 35e12a49d1a6..f6b5672cabd6 100644 --- a/arch/arm/mach-at91/board-sam9rlek.c +++ b/arch/arm/mach-at91/board-sam9rlek.c | |||
@@ -186,19 +186,21 @@ static struct fb_monspecs at91fb_default_monspecs = { | |||
186 | static void at91_lcdc_power_control(int on) | 186 | static void at91_lcdc_power_control(int on) |
187 | { | 187 | { |
188 | if (on) | 188 | if (on) |
189 | at91_set_gpio_value(AT91_PIN_PA30, 0); /* power up */ | 189 | at91_set_gpio_value(AT91_PIN_PC1, 0); /* power up */ |
190 | else | 190 | else |
191 | at91_set_gpio_value(AT91_PIN_PA30, 1); /* power down */ | 191 | at91_set_gpio_value(AT91_PIN_PC1, 1); /* power down */ |
192 | } | 192 | } |
193 | 193 | ||
194 | /* Driver datas */ | 194 | /* Driver datas */ |
195 | static struct atmel_lcdfb_info __initdata ek_lcdc_data = { | 195 | static struct atmel_lcdfb_info __initdata ek_lcdc_data = { |
196 | .lcdcon_is_backlight = true, | ||
196 | .default_bpp = 16, | 197 | .default_bpp = 16, |
197 | .default_dmacon = ATMEL_LCDC_DMAEN, | 198 | .default_dmacon = ATMEL_LCDC_DMAEN, |
198 | .default_lcdcon2 = AT91SAM9RL_DEFAULT_LCDCON2, | 199 | .default_lcdcon2 = AT91SAM9RL_DEFAULT_LCDCON2, |
199 | .default_monspecs = &at91fb_default_monspecs, | 200 | .default_monspecs = &at91fb_default_monspecs, |
200 | .atmel_lcdfb_power_control = at91_lcdc_power_control, | 201 | .atmel_lcdfb_power_control = at91_lcdc_power_control, |
201 | .guard_time = 1, | 202 | .guard_time = 1, |
203 | .lcd_wiring_mode = ATMEL_LCDC_WIRING_RGB, | ||
202 | }; | 204 | }; |
203 | 205 | ||
204 | #else | 206 | #else |
diff --git a/arch/arm/mach-at91/clock.c b/arch/arm/mach-at91/clock.c index e4345106ee57..bac578fe0d3d 100644 --- a/arch/arm/mach-at91/clock.c +++ b/arch/arm/mach-at91/clock.c | |||
@@ -43,6 +43,25 @@ | |||
43 | #define clk_is_sys(x) ((x)->type & CLK_TYPE_SYSTEM) | 43 | #define clk_is_sys(x) ((x)->type & CLK_TYPE_SYSTEM) |
44 | 44 | ||
45 | 45 | ||
46 | /* | ||
47 | * Chips have some kind of clocks : group them by functionality | ||
48 | */ | ||
49 | #define cpu_has_utmi() ( cpu_is_at91cap9() \ | ||
50 | || cpu_is_at91sam9rl()) | ||
51 | |||
52 | #define cpu_has_800M_plla() (cpu_is_at91sam9g20()) | ||
53 | |||
54 | #define cpu_has_pllb() (!cpu_is_at91sam9rl()) | ||
55 | |||
56 | #define cpu_has_upll() (0) | ||
57 | |||
58 | /* USB host HS & FS */ | ||
59 | #define cpu_has_uhp() (!cpu_is_at91sam9rl()) | ||
60 | |||
61 | /* USB device FS only */ | ||
62 | #define cpu_has_udpfs() (!cpu_is_at91sam9rl()) | ||
63 | |||
64 | |||
46 | static LIST_HEAD(clocks); | 65 | static LIST_HEAD(clocks); |
47 | static DEFINE_SPINLOCK(clk_lock); | 66 | static DEFINE_SPINLOCK(clk_lock); |
48 | 67 | ||
@@ -140,7 +159,7 @@ static struct clk utmi_clk = { | |||
140 | }; | 159 | }; |
141 | static struct clk uhpck = { | 160 | static struct clk uhpck = { |
142 | .name = "uhpck", | 161 | .name = "uhpck", |
143 | .parent = &pllb, | 162 | /*.parent = ... we choose parent at runtime */ |
144 | .mode = pmc_sys_mode, | 163 | .mode = pmc_sys_mode, |
145 | }; | 164 | }; |
146 | 165 | ||
@@ -173,7 +192,11 @@ static struct clk __init *at91_css_to_clk(unsigned long css) | |||
173 | case AT91_PMC_CSS_PLLA: | 192 | case AT91_PMC_CSS_PLLA: |
174 | return &plla; | 193 | return &plla; |
175 | case AT91_PMC_CSS_PLLB: | 194 | case AT91_PMC_CSS_PLLB: |
176 | return &pllb; | 195 | if (cpu_has_upll()) |
196 | /* CSS_PLLB == CSS_UPLL */ | ||
197 | return &utmi_clk; | ||
198 | else if (cpu_has_pllb()) | ||
199 | return &pllb; | ||
177 | } | 200 | } |
178 | 201 | ||
179 | return NULL; | 202 | return NULL; |
@@ -322,7 +345,7 @@ int clk_set_rate(struct clk *clk, unsigned long rate) | |||
322 | u32 pckr; | 345 | u32 pckr; |
323 | 346 | ||
324 | pckr = at91_sys_read(AT91_PMC_PCKR(clk->id)); | 347 | pckr = at91_sys_read(AT91_PMC_PCKR(clk->id)); |
325 | pckr &= AT91_PMC_CSS_PLLB; /* clock selection */ | 348 | pckr &= AT91_PMC_CSS; /* clock selection */ |
326 | pckr |= prescale << 2; | 349 | pckr |= prescale << 2; |
327 | at91_sys_write(AT91_PMC_PCKR(clk->id), pckr); | 350 | at91_sys_write(AT91_PMC_PCKR(clk->id), pckr); |
328 | clk->rate_hz = actual; | 351 | clk->rate_hz = actual; |
@@ -361,7 +384,7 @@ int clk_set_parent(struct clk *clk, struct clk *parent) | |||
361 | } | 384 | } |
362 | EXPORT_SYMBOL(clk_set_parent); | 385 | EXPORT_SYMBOL(clk_set_parent); |
363 | 386 | ||
364 | /* establish PCK0..PCK3 parentage and rate */ | 387 | /* establish PCK0..PCKN parentage and rate */ |
365 | static void __init init_programmable_clock(struct clk *clk) | 388 | static void __init init_programmable_clock(struct clk *clk) |
366 | { | 389 | { |
367 | struct clk *parent; | 390 | struct clk *parent; |
@@ -389,11 +412,13 @@ static int at91_clk_show(struct seq_file *s, void *unused) | |||
389 | seq_printf(s, "MOR = %8x\n", at91_sys_read(AT91_CKGR_MOR)); | 412 | seq_printf(s, "MOR = %8x\n", at91_sys_read(AT91_CKGR_MOR)); |
390 | seq_printf(s, "MCFR = %8x\n", at91_sys_read(AT91_CKGR_MCFR)); | 413 | seq_printf(s, "MCFR = %8x\n", at91_sys_read(AT91_CKGR_MCFR)); |
391 | seq_printf(s, "PLLA = %8x\n", at91_sys_read(AT91_CKGR_PLLAR)); | 414 | seq_printf(s, "PLLA = %8x\n", at91_sys_read(AT91_CKGR_PLLAR)); |
392 | if (!cpu_is_at91sam9rl()) | 415 | if (cpu_has_pllb()) |
393 | seq_printf(s, "PLLB = %8x\n", at91_sys_read(AT91_CKGR_PLLBR)); | 416 | seq_printf(s, "PLLB = %8x\n", at91_sys_read(AT91_CKGR_PLLBR)); |
394 | if (cpu_is_at91cap9() || cpu_is_at91sam9rl()) | 417 | if (cpu_has_utmi()) |
395 | seq_printf(s, "UCKR = %8x\n", uckr = at91_sys_read(AT91_CKGR_UCKR)); | 418 | seq_printf(s, "UCKR = %8x\n", uckr = at91_sys_read(AT91_CKGR_UCKR)); |
396 | seq_printf(s, "MCKR = %8x\n", at91_sys_read(AT91_PMC_MCKR)); | 419 | seq_printf(s, "MCKR = %8x\n", at91_sys_read(AT91_PMC_MCKR)); |
420 | if (cpu_has_upll()) | ||
421 | seq_printf(s, "USB = %8x\n", at91_sys_read(AT91_PMC_USB)); | ||
397 | seq_printf(s, "SR = %8x\n", sr = at91_sys_read(AT91_PMC_SR)); | 422 | seq_printf(s, "SR = %8x\n", sr = at91_sys_read(AT91_PMC_SR)); |
398 | 423 | ||
399 | seq_printf(s, "\n"); | 424 | seq_printf(s, "\n"); |
@@ -554,16 +579,60 @@ static struct clk *const standard_pmc_clocks[] __initdata = { | |||
554 | &clk32k, | 579 | &clk32k, |
555 | &main_clk, | 580 | &main_clk, |
556 | &plla, | 581 | &plla, |
557 | &pllb, | ||
558 | |||
559 | /* PLLB children (USB) */ | ||
560 | &udpck, | ||
561 | &uhpck, | ||
562 | 582 | ||
563 | /* MCK */ | 583 | /* MCK */ |
564 | &mck | 584 | &mck |
565 | }; | 585 | }; |
566 | 586 | ||
587 | /* PLLB generated USB full speed clock init */ | ||
588 | static void __init at91_pllb_usbfs_clock_init(unsigned long main_clock) | ||
589 | { | ||
590 | /* | ||
591 | * USB clock init: choose 48 MHz PLLB value, | ||
592 | * disable 48MHz clock during usb peripheral suspend. | ||
593 | * | ||
594 | * REVISIT: assumes MCK doesn't derive from PLLB! | ||
595 | */ | ||
596 | uhpck.parent = &pllb; | ||
597 | |||
598 | at91_pllb_usb_init = at91_pll_calc(main_clock, 48000000 * 2) | AT91_PMC_USB96M; | ||
599 | pllb.rate_hz = at91_pll_rate(&pllb, main_clock, at91_pllb_usb_init); | ||
600 | if (cpu_is_at91rm9200()) { | ||
601 | uhpck.pmc_mask = AT91RM9200_PMC_UHP; | ||
602 | udpck.pmc_mask = AT91RM9200_PMC_UDP; | ||
603 | at91_sys_write(AT91_PMC_SCER, AT91RM9200_PMC_MCKUDP); | ||
604 | } else if (cpu_is_at91sam9260() || cpu_is_at91sam9261() || cpu_is_at91sam9263() || cpu_is_at91sam9g20()) { | ||
605 | uhpck.pmc_mask = AT91SAM926x_PMC_UHP; | ||
606 | udpck.pmc_mask = AT91SAM926x_PMC_UDP; | ||
607 | } else if (cpu_is_at91cap9()) { | ||
608 | uhpck.pmc_mask = AT91CAP9_PMC_UHP; | ||
609 | } | ||
610 | at91_sys_write(AT91_CKGR_PLLBR, 0); | ||
611 | |||
612 | udpck.rate_hz = at91_usb_rate(&pllb, pllb.rate_hz, at91_pllb_usb_init); | ||
613 | uhpck.rate_hz = at91_usb_rate(&pllb, pllb.rate_hz, at91_pllb_usb_init); | ||
614 | } | ||
615 | |||
616 | /* UPLL generated USB full speed clock init */ | ||
617 | static void __init at91_upll_usbfs_clock_init(unsigned long main_clock) | ||
618 | { | ||
619 | /* | ||
620 | * USB clock init: choose 480 MHz from UPLL, | ||
621 | */ | ||
622 | unsigned int usbr = AT91_PMC_USBS_UPLL; | ||
623 | |||
624 | /* Setup divider by 10 to reach 48 MHz */ | ||
625 | usbr |= ((10 - 1) << 8) & AT91_PMC_OHCIUSBDIV; | ||
626 | |||
627 | at91_sys_write(AT91_PMC_USB, usbr); | ||
628 | |||
629 | /* Now set uhpck values */ | ||
630 | uhpck.parent = &utmi_clk; | ||
631 | uhpck.pmc_mask = AT91SAM926x_PMC_UHP; | ||
632 | uhpck.rate_hz = utmi_clk.parent->rate_hz; | ||
633 | uhpck.rate_hz /= 1 + ((at91_sys_read(AT91_PMC_USB) & AT91_PMC_OHCIUSBDIV) >> 8); | ||
634 | } | ||
635 | |||
567 | int __init at91_clock_init(unsigned long main_clock) | 636 | int __init at91_clock_init(unsigned long main_clock) |
568 | { | 637 | { |
569 | unsigned tmp, freq, mckr; | 638 | unsigned tmp, freq, mckr; |
@@ -585,43 +654,37 @@ int __init at91_clock_init(unsigned long main_clock) | |||
585 | 654 | ||
586 | /* report if PLLA is more than mildly overclocked */ | 655 | /* report if PLLA is more than mildly overclocked */ |
587 | plla.rate_hz = at91_pll_rate(&plla, main_clock, at91_sys_read(AT91_CKGR_PLLAR)); | 656 | plla.rate_hz = at91_pll_rate(&plla, main_clock, at91_sys_read(AT91_CKGR_PLLAR)); |
588 | if ((!cpu_is_at91sam9g20() && plla.rate_hz > 209000000) | 657 | if ((!cpu_has_800M_plla() && plla.rate_hz > 209000000) |
589 | || (cpu_is_at91sam9g20() && plla.rate_hz > 800000000)) | 658 | || (cpu_has_800M_plla() && plla.rate_hz > 800000000)) |
590 | pr_info("Clocks: PLLA overclocked, %ld MHz\n", plla.rate_hz / 1000000); | 659 | pr_info("Clocks: PLLA overclocked, %ld MHz\n", plla.rate_hz / 1000000); |
591 | 660 | ||
592 | /* | 661 | |
593 | * USB clock init: choose 48 MHz PLLB value, | 662 | if (cpu_has_upll() && !cpu_has_pllb()) { |
594 | * disable 48MHz clock during usb peripheral suspend. | 663 | /* setup UTMI clock as the fourth primary clock |
595 | * | 664 | * (instead of pllb) */ |
596 | * REVISIT: assumes MCK doesn't derive from PLLB! | 665 | utmi_clk.type |= CLK_TYPE_PRIMARY; |
597 | */ | 666 | utmi_clk.id = 3; |
598 | at91_pllb_usb_init = at91_pll_calc(main_clock, 48000000 * 2) | AT91_PMC_USB96M; | ||
599 | pllb.rate_hz = at91_pll_rate(&pllb, main_clock, at91_pllb_usb_init); | ||
600 | if (cpu_is_at91rm9200()) { | ||
601 | uhpck.pmc_mask = AT91RM9200_PMC_UHP; | ||
602 | udpck.pmc_mask = AT91RM9200_PMC_UDP; | ||
603 | at91_sys_write(AT91_PMC_SCER, AT91RM9200_PMC_MCKUDP); | ||
604 | } else if (cpu_is_at91sam9260() || cpu_is_at91sam9261() || cpu_is_at91sam9263() || cpu_is_at91sam9g20()) { | ||
605 | uhpck.pmc_mask = AT91SAM926x_PMC_UHP; | ||
606 | udpck.pmc_mask = AT91SAM926x_PMC_UDP; | ||
607 | } else if (cpu_is_at91cap9()) { | ||
608 | uhpck.pmc_mask = AT91CAP9_PMC_UHP; | ||
609 | } | 667 | } |
610 | at91_sys_write(AT91_CKGR_PLLBR, 0); | ||
611 | 668 | ||
612 | udpck.rate_hz = at91_usb_rate(&pllb, pllb.rate_hz, at91_pllb_usb_init); | ||
613 | uhpck.rate_hz = at91_usb_rate(&pllb, pllb.rate_hz, at91_pllb_usb_init); | ||
614 | 669 | ||
615 | /* | 670 | /* |
616 | * USB HS clock init | 671 | * USB HS clock init |
617 | */ | 672 | */ |
618 | if (cpu_is_at91cap9() || cpu_is_at91sam9rl()) { | 673 | if (cpu_has_utmi()) |
619 | /* | 674 | /* |
620 | * multiplier is hard-wired to 40 | 675 | * multiplier is hard-wired to 40 |
621 | * (obtain the USB High Speed 480 MHz when input is 12 MHz) | 676 | * (obtain the USB High Speed 480 MHz when input is 12 MHz) |
622 | */ | 677 | */ |
623 | utmi_clk.rate_hz = 40 * utmi_clk.parent->rate_hz; | 678 | utmi_clk.rate_hz = 40 * utmi_clk.parent->rate_hz; |
624 | } | 679 | |
680 | /* | ||
681 | * USB FS clock init | ||
682 | */ | ||
683 | if (cpu_has_pllb()) | ||
684 | at91_pllb_usbfs_clock_init(main_clock); | ||
685 | if (cpu_has_upll()) | ||
686 | /* assumes that we choose UPLL for USB and not PLLA */ | ||
687 | at91_upll_usbfs_clock_init(main_clock); | ||
625 | 688 | ||
626 | /* | 689 | /* |
627 | * MCK and CPU derive from one of those primary clocks. | 690 | * MCK and CPU derive from one of those primary clocks. |
@@ -631,21 +694,31 @@ int __init at91_clock_init(unsigned long main_clock) | |||
631 | mck.parent = at91_css_to_clk(mckr & AT91_PMC_CSS); | 694 | mck.parent = at91_css_to_clk(mckr & AT91_PMC_CSS); |
632 | freq = mck.parent->rate_hz; | 695 | freq = mck.parent->rate_hz; |
633 | freq /= (1 << ((mckr & AT91_PMC_PRES) >> 2)); /* prescale */ | 696 | freq /= (1 << ((mckr & AT91_PMC_PRES) >> 2)); /* prescale */ |
634 | if (cpu_is_at91rm9200()) | 697 | if (cpu_is_at91rm9200()) { |
635 | mck.rate_hz = freq / (1 + ((mckr & AT91_PMC_MDIV) >> 8)); /* mdiv */ | 698 | mck.rate_hz = freq / (1 + ((mckr & AT91_PMC_MDIV) >> 8)); /* mdiv */ |
636 | else if (cpu_is_at91sam9g20()) { | 699 | } else if (cpu_is_at91sam9g20()) { |
637 | mck.rate_hz = (mckr & AT91_PMC_MDIV) ? | 700 | mck.rate_hz = (mckr & AT91_PMC_MDIV) ? |
638 | freq / ((mckr & AT91_PMC_MDIV) >> 7) : freq; /* mdiv ; (x >> 7) = ((x >> 8) * 2) */ | 701 | freq / ((mckr & AT91_PMC_MDIV) >> 7) : freq; /* mdiv ; (x >> 7) = ((x >> 8) * 2) */ |
639 | if (mckr & AT91_PMC_PDIV) | 702 | if (mckr & AT91_PMC_PDIV) |
640 | freq /= 2; /* processor clock division */ | 703 | freq /= 2; /* processor clock division */ |
641 | } else | 704 | } else { |
642 | mck.rate_hz = freq / (1 << ((mckr & AT91_PMC_MDIV) >> 8)); /* mdiv */ | 705 | mck.rate_hz = freq / (1 << ((mckr & AT91_PMC_MDIV) >> 8)); /* mdiv */ |
706 | } | ||
643 | 707 | ||
644 | /* Register the PMC's standard clocks */ | 708 | /* Register the PMC's standard clocks */ |
645 | for (i = 0; i < ARRAY_SIZE(standard_pmc_clocks); i++) | 709 | for (i = 0; i < ARRAY_SIZE(standard_pmc_clocks); i++) |
646 | list_add_tail(&standard_pmc_clocks[i]->node, &clocks); | 710 | list_add_tail(&standard_pmc_clocks[i]->node, &clocks); |
647 | 711 | ||
648 | if (cpu_is_at91cap9() || cpu_is_at91sam9rl()) | 712 | if (cpu_has_pllb()) |
713 | list_add_tail(&pllb.node, &clocks); | ||
714 | |||
715 | if (cpu_has_uhp()) | ||
716 | list_add_tail(&uhpck.node, &clocks); | ||
717 | |||
718 | if (cpu_has_udpfs()) | ||
719 | list_add_tail(&udpck.node, &clocks); | ||
720 | |||
721 | if (cpu_has_utmi()) | ||
649 | list_add_tail(&utmi_clk.node, &clocks); | 722 | list_add_tail(&utmi_clk.node, &clocks); |
650 | 723 | ||
651 | /* MCK and CPU clock are "always on" */ | 724 | /* MCK and CPU clock are "always on" */ |
diff --git a/arch/arm/mach-at91/include/mach/at91_pmc.h b/arch/arm/mach-at91/include/mach/at91_pmc.h index 9561e33b8a9a..64589eaaaee8 100644 --- a/arch/arm/mach-at91/include/mach/at91_pmc.h +++ b/arch/arm/mach-at91/include/mach/at91_pmc.h | |||
@@ -23,7 +23,7 @@ | |||
23 | #define AT91_PMC_PCK (1 << 0) /* Processor Clock */ | 23 | #define AT91_PMC_PCK (1 << 0) /* Processor Clock */ |
24 | #define AT91RM9200_PMC_UDP (1 << 1) /* USB Devcice Port Clock [AT91RM9200 only] */ | 24 | #define AT91RM9200_PMC_UDP (1 << 1) /* USB Devcice Port Clock [AT91RM9200 only] */ |
25 | #define AT91RM9200_PMC_MCKUDP (1 << 2) /* USB Device Port Master Clock Automatic Disable on Suspend [AT91RM9200 only] */ | 25 | #define AT91RM9200_PMC_MCKUDP (1 << 2) /* USB Device Port Master Clock Automatic Disable on Suspend [AT91RM9200 only] */ |
26 | #define AT91CAP9_PMC_DDR (1 << 2) /* DDR Clock [AT91CAP9 revC only] */ | 26 | #define AT91CAP9_PMC_DDR (1 << 2) /* DDR Clock [CAP9 revC & some SAM9 only] */ |
27 | #define AT91RM9200_PMC_UHP (1 << 4) /* USB Host Port Clock [AT91RM9200 only] */ | 27 | #define AT91RM9200_PMC_UHP (1 << 4) /* USB Host Port Clock [AT91RM9200 only] */ |
28 | #define AT91SAM926x_PMC_UHP (1 << 6) /* USB Host Port Clock [AT91SAM926x only] */ | 28 | #define AT91SAM926x_PMC_UHP (1 << 6) /* USB Host Port Clock [AT91SAM926x only] */ |
29 | #define AT91CAP9_PMC_UHP (1 << 6) /* USB Host Port Clock [AT91CAP9 only] */ | 29 | #define AT91CAP9_PMC_UHP (1 << 6) /* USB Host Port Clock [AT91CAP9 only] */ |
@@ -39,11 +39,11 @@ | |||
39 | #define AT91_PMC_PCDR (AT91_PMC + 0x14) /* Peripheral Clock Disable Register */ | 39 | #define AT91_PMC_PCDR (AT91_PMC + 0x14) /* Peripheral Clock Disable Register */ |
40 | #define AT91_PMC_PCSR (AT91_PMC + 0x18) /* Peripheral Clock Status Register */ | 40 | #define AT91_PMC_PCSR (AT91_PMC + 0x18) /* Peripheral Clock Status Register */ |
41 | 41 | ||
42 | #define AT91_CKGR_UCKR (AT91_PMC + 0x1C) /* UTMI Clock Register [SAM9RL, CAP9] */ | 42 | #define AT91_CKGR_UCKR (AT91_PMC + 0x1C) /* UTMI Clock Register [some SAM9, CAP9] */ |
43 | #define AT91_PMC_UPLLEN (1 << 16) /* UTMI PLL Enable */ | 43 | #define AT91_PMC_UPLLEN (1 << 16) /* UTMI PLL Enable */ |
44 | #define AT91_PMC_UPLLCOUNT (0xf << 20) /* UTMI PLL Start-up Time */ | 44 | #define AT91_PMC_UPLLCOUNT (0xf << 20) /* UTMI PLL Start-up Time */ |
45 | #define AT91_PMC_BIASEN (1 << 24) /* UTMI BIAS Enable */ | 45 | #define AT91_PMC_BIASEN (1 << 24) /* UTMI BIAS Enable */ |
46 | #define AT91_PMC_BIASCOUNT (0xf << 28) /* UTMI PLL Start-up Time */ | 46 | #define AT91_PMC_BIASCOUNT (0xf << 28) /* UTMI BIAS Start-up Time */ |
47 | 47 | ||
48 | #define AT91_CKGR_MOR (AT91_PMC + 0x20) /* Main Oscillator Register [not on SAM9RL] */ | 48 | #define AT91_CKGR_MOR (AT91_PMC + 0x20) /* Main Oscillator Register [not on SAM9RL] */ |
49 | #define AT91_PMC_MOSCEN (1 << 0) /* Main Oscillator Enable */ | 49 | #define AT91_PMC_MOSCEN (1 << 0) /* Main Oscillator Enable */ |
@@ -72,6 +72,7 @@ | |||
72 | #define AT91_PMC_CSS_MAIN (1 << 0) | 72 | #define AT91_PMC_CSS_MAIN (1 << 0) |
73 | #define AT91_PMC_CSS_PLLA (2 << 0) | 73 | #define AT91_PMC_CSS_PLLA (2 << 0) |
74 | #define AT91_PMC_CSS_PLLB (3 << 0) | 74 | #define AT91_PMC_CSS_PLLB (3 << 0) |
75 | #define AT91_PMC_CSS_UPLL (3 << 0) /* [some SAM9 only] */ | ||
75 | #define AT91_PMC_PRES (7 << 2) /* Master Clock Prescaler */ | 76 | #define AT91_PMC_PRES (7 << 2) /* Master Clock Prescaler */ |
76 | #define AT91_PMC_PRES_1 (0 << 2) | 77 | #define AT91_PMC_PRES_1 (0 << 2) |
77 | #define AT91_PMC_PRES_2 (1 << 2) | 78 | #define AT91_PMC_PRES_2 (1 << 2) |
@@ -88,12 +89,25 @@ | |||
88 | #define AT91SAM9_PMC_MDIV_1 (0 << 8) /* [SAM9,CAP9 only] */ | 89 | #define AT91SAM9_PMC_MDIV_1 (0 << 8) /* [SAM9,CAP9 only] */ |
89 | #define AT91SAM9_PMC_MDIV_2 (1 << 8) | 90 | #define AT91SAM9_PMC_MDIV_2 (1 << 8) |
90 | #define AT91SAM9_PMC_MDIV_4 (2 << 8) | 91 | #define AT91SAM9_PMC_MDIV_4 (2 << 8) |
91 | #define AT91SAM9_PMC_MDIV_6 (3 << 8) | 92 | #define AT91SAM9_PMC_MDIV_6 (3 << 8) /* [some SAM9 only] */ |
93 | #define AT91SAM9_PMC_MDIV_3 (3 << 8) /* [some SAM9 only] */ | ||
92 | #define AT91_PMC_PDIV (1 << 12) /* Processor Clock Division [some SAM9 only] */ | 94 | #define AT91_PMC_PDIV (1 << 12) /* Processor Clock Division [some SAM9 only] */ |
93 | #define AT91_PMC_PDIV_1 (0 << 12) | 95 | #define AT91_PMC_PDIV_1 (0 << 12) |
94 | #define AT91_PMC_PDIV_2 (1 << 12) | 96 | #define AT91_PMC_PDIV_2 (1 << 12) |
97 | #define AT91_PMC_PLLADIV2 (1 << 12) /* PLLA divisor by 2 [some SAM9 only] */ | ||
98 | #define AT91_PMC_PLLADIV2_OFF (0 << 12) | ||
99 | #define AT91_PMC_PLLADIV2_ON (1 << 12) | ||
95 | 100 | ||
96 | #define AT91_PMC_PCKR(n) (AT91_PMC + 0x40 + ((n) * 4)) /* Programmable Clock 0-3 Registers */ | 101 | #define AT91_PMC_USB (AT91_PMC + 0x38) /* USB Clock Register [some SAM9 only] */ |
102 | #define AT91_PMC_USBS (0x1 << 0) /* USB OHCI Input clock selection */ | ||
103 | #define AT91_PMC_USBS_PLLA (0 << 0) | ||
104 | #define AT91_PMC_USBS_UPLL (1 << 0) | ||
105 | #define AT91_PMC_OHCIUSBDIV (0xF << 8) /* Divider for USB OHCI Clock */ | ||
106 | |||
107 | #define AT91_PMC_PCKR(n) (AT91_PMC + 0x40 + ((n) * 4)) /* Programmable Clock 0-N Registers */ | ||
108 | #define AT91_PMC_CSSMCK (0x1 << 8) /* CSS or Master Clock Selection */ | ||
109 | #define AT91_PMC_CSSMCK_CSS (0 << 8) | ||
110 | #define AT91_PMC_CSSMCK_MCK (1 << 8) | ||
97 | 111 | ||
98 | #define AT91_PMC_IER (AT91_PMC + 0x60) /* Interrupt Enable Register */ | 112 | #define AT91_PMC_IER (AT91_PMC + 0x60) /* Interrupt Enable Register */ |
99 | #define AT91_PMC_IDR (AT91_PMC + 0x64) /* Interrupt Disable Register */ | 113 | #define AT91_PMC_IDR (AT91_PMC + 0x64) /* Interrupt Disable Register */ |
@@ -102,7 +116,7 @@ | |||
102 | #define AT91_PMC_LOCKA (1 << 1) /* PLLA Lock */ | 116 | #define AT91_PMC_LOCKA (1 << 1) /* PLLA Lock */ |
103 | #define AT91_PMC_LOCKB (1 << 2) /* PLLB Lock */ | 117 | #define AT91_PMC_LOCKB (1 << 2) /* PLLB Lock */ |
104 | #define AT91_PMC_MCKRDY (1 << 3) /* Master Clock */ | 118 | #define AT91_PMC_MCKRDY (1 << 3) /* Master Clock */ |
105 | #define AT91_PMC_LOCKU (1 << 6) /* UPLL Lock [AT91CAP9 only] */ | 119 | #define AT91_PMC_LOCKU (1 << 6) /* UPLL Lock [some SAM9, AT91CAP9 only] */ |
106 | #define AT91_PMC_OSCSEL (1 << 7) /* Slow Clock Oscillator [AT91CAP9 revC only] */ | 120 | #define AT91_PMC_OSCSEL (1 << 7) /* Slow Clock Oscillator [AT91CAP9 revC only] */ |
107 | #define AT91_PMC_PCK0RDY (1 << 8) /* Programmable Clock 0 */ | 121 | #define AT91_PMC_PCK0RDY (1 << 8) /* Programmable Clock 0 */ |
108 | #define AT91_PMC_PCK1RDY (1 << 9) /* Programmable Clock 1 */ | 122 | #define AT91_PMC_PCK1RDY (1 << 9) /* Programmable Clock 1 */ |
diff --git a/arch/arm/mach-at91/include/mach/at_hdmac.h b/arch/arm/mach-at91/include/mach/at_hdmac.h new file mode 100644 index 000000000000..187cb58345c0 --- /dev/null +++ b/arch/arm/mach-at91/include/mach/at_hdmac.h | |||
@@ -0,0 +1,102 @@ | |||
1 | /* | ||
2 | * Header file for the Atmel AHB DMA Controller driver | ||
3 | * | ||
4 | * Copyright (C) 2008 Atmel Corporation | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | */ | ||
11 | #ifndef AT_HDMAC_H | ||
12 | #define AT_HDMAC_H | ||
13 | |||
14 | #include <linux/dmaengine.h> | ||
15 | |||
16 | /** | ||
17 | * struct at_dma_platform_data - Controller configuration parameters | ||
18 | * @nr_channels: Number of channels supported by hardware (max 8) | ||
19 | * @cap_mask: dma_capability flags supported by the platform | ||
20 | */ | ||
21 | struct at_dma_platform_data { | ||
22 | unsigned int nr_channels; | ||
23 | dma_cap_mask_t cap_mask; | ||
24 | }; | ||
25 | |||
26 | /** | ||
27 | * enum at_dma_slave_width - DMA slave register access width. | ||
28 | * @AT_DMA_SLAVE_WIDTH_8BIT: Do 8-bit slave register accesses | ||
29 | * @AT_DMA_SLAVE_WIDTH_16BIT: Do 16-bit slave register accesses | ||
30 | * @AT_DMA_SLAVE_WIDTH_32BIT: Do 32-bit slave register accesses | ||
31 | */ | ||
32 | enum at_dma_slave_width { | ||
33 | AT_DMA_SLAVE_WIDTH_8BIT = 0, | ||
34 | AT_DMA_SLAVE_WIDTH_16BIT, | ||
35 | AT_DMA_SLAVE_WIDTH_32BIT, | ||
36 | }; | ||
37 | |||
38 | /** | ||
39 | * struct at_dma_slave - Controller-specific information about a slave | ||
40 | * @dma_dev: required DMA master device | ||
41 | * @tx_reg: physical address of data register used for | ||
42 | * memory-to-peripheral transfers | ||
43 | * @rx_reg: physical address of data register used for | ||
44 | * peripheral-to-memory transfers | ||
45 | * @reg_width: peripheral register width | ||
46 | * @cfg: Platform-specific initializer for the CFG register | ||
47 | * @ctrla: Platform-specific initializer for the CTRLA register | ||
48 | */ | ||
49 | struct at_dma_slave { | ||
50 | struct device *dma_dev; | ||
51 | dma_addr_t tx_reg; | ||
52 | dma_addr_t rx_reg; | ||
53 | enum at_dma_slave_width reg_width; | ||
54 | u32 cfg; | ||
55 | u32 ctrla; | ||
56 | }; | ||
57 | |||
58 | |||
59 | /* Platform-configurable bits in CFG */ | ||
60 | #define ATC_SRC_PER(h) (0xFU & (h)) /* Channel src rq associated with periph handshaking ifc h */ | ||
61 | #define ATC_DST_PER(h) ((0xFU & (h)) << 4) /* Channel dst rq associated with periph handshaking ifc h */ | ||
62 | #define ATC_SRC_REP (0x1 << 8) /* Source Replay Mod */ | ||
63 | #define ATC_SRC_H2SEL (0x1 << 9) /* Source Handshaking Mod */ | ||
64 | #define ATC_SRC_H2SEL_SW (0x0 << 9) | ||
65 | #define ATC_SRC_H2SEL_HW (0x1 << 9) | ||
66 | #define ATC_DST_REP (0x1 << 12) /* Destination Replay Mod */ | ||
67 | #define ATC_DST_H2SEL (0x1 << 13) /* Destination Handshaking Mod */ | ||
68 | #define ATC_DST_H2SEL_SW (0x0 << 13) | ||
69 | #define ATC_DST_H2SEL_HW (0x1 << 13) | ||
70 | #define ATC_SOD (0x1 << 16) /* Stop On Done */ | ||
71 | #define ATC_LOCK_IF (0x1 << 20) /* Interface Lock */ | ||
72 | #define ATC_LOCK_B (0x1 << 21) /* AHB Bus Lock */ | ||
73 | #define ATC_LOCK_IF_L (0x1 << 22) /* Master Interface Arbiter Lock */ | ||
74 | #define ATC_LOCK_IF_L_CHUNK (0x0 << 22) | ||
75 | #define ATC_LOCK_IF_L_BUFFER (0x1 << 22) | ||
76 | #define ATC_AHB_PROT_MASK (0x7 << 24) /* AHB Protection */ | ||
77 | #define ATC_FIFOCFG_MASK (0x3 << 28) /* FIFO Request Configuration */ | ||
78 | #define ATC_FIFOCFG_LARGESTBURST (0x0 << 28) | ||
79 | #define ATC_FIFOCFG_HALFFIFO (0x1 << 28) | ||
80 | #define ATC_FIFOCFG_ENOUGHSPACE (0x2 << 28) | ||
81 | |||
82 | /* Platform-configurable bits in CTRLA */ | ||
83 | #define ATC_SCSIZE_MASK (0x7 << 16) /* Source Chunk Transfer Size */ | ||
84 | #define ATC_SCSIZE_1 (0x0 << 16) | ||
85 | #define ATC_SCSIZE_4 (0x1 << 16) | ||
86 | #define ATC_SCSIZE_8 (0x2 << 16) | ||
87 | #define ATC_SCSIZE_16 (0x3 << 16) | ||
88 | #define ATC_SCSIZE_32 (0x4 << 16) | ||
89 | #define ATC_SCSIZE_64 (0x5 << 16) | ||
90 | #define ATC_SCSIZE_128 (0x6 << 16) | ||
91 | #define ATC_SCSIZE_256 (0x7 << 16) | ||
92 | #define ATC_DCSIZE_MASK (0x7 << 20) /* Destination Chunk Transfer Size */ | ||
93 | #define ATC_DCSIZE_1 (0x0 << 20) | ||
94 | #define ATC_DCSIZE_4 (0x1 << 20) | ||
95 | #define ATC_DCSIZE_8 (0x2 << 20) | ||
96 | #define ATC_DCSIZE_16 (0x3 << 20) | ||
97 | #define ATC_DCSIZE_32 (0x4 << 20) | ||
98 | #define ATC_DCSIZE_64 (0x5 << 20) | ||
99 | #define ATC_DCSIZE_128 (0x6 << 20) | ||
100 | #define ATC_DCSIZE_256 (0x7 << 20) | ||
101 | |||
102 | #endif /* AT_HDMAC_H */ | ||