diff options
Diffstat (limited to 'arch/avr32/mach-at32ap/at32ap7000.c')
-rw-r--r-- | arch/avr32/mach-at32ap/at32ap7000.c | 60 |
1 files changed, 49 insertions, 11 deletions
diff --git a/arch/avr32/mach-at32ap/at32ap7000.c b/arch/avr32/mach-at32ap/at32ap7000.c index 48f4ef38c70e..c1e477ec7576 100644 --- a/arch/avr32/mach-at32ap/at32ap7000.c +++ b/arch/avr32/mach-at32ap/at32ap7000.c | |||
@@ -496,9 +496,16 @@ static struct resource pio3_resource[] = { | |||
496 | DEFINE_DEV(pio, 3); | 496 | DEFINE_DEV(pio, 3); |
497 | DEV_CLK(mck, pio3, pba, 13); | 497 | DEV_CLK(mck, pio3, pba, 13); |
498 | 498 | ||
499 | static struct resource pio4_resource[] = { | ||
500 | PBMEM(0xffe03800), | ||
501 | IRQ(17), | ||
502 | }; | ||
503 | DEFINE_DEV(pio, 4); | ||
504 | DEV_CLK(mck, pio4, pba, 14); | ||
505 | |||
499 | void __init at32_add_system_devices(void) | 506 | void __init at32_add_system_devices(void) |
500 | { | 507 | { |
501 | system_manager.eim_first_irq = NR_INTERNAL_IRQS; | 508 | system_manager.eim_first_irq = EIM_IRQ_BASE; |
502 | 509 | ||
503 | platform_device_register(&at32_sm_device); | 510 | platform_device_register(&at32_sm_device); |
504 | platform_device_register(&at32_intc0_device); | 511 | platform_device_register(&at32_intc0_device); |
@@ -509,6 +516,7 @@ void __init at32_add_system_devices(void) | |||
509 | platform_device_register(&pio1_device); | 516 | platform_device_register(&pio1_device); |
510 | platform_device_register(&pio2_device); | 517 | platform_device_register(&pio2_device); |
511 | platform_device_register(&pio3_device); | 518 | platform_device_register(&pio3_device); |
519 | platform_device_register(&pio4_device); | ||
512 | } | 520 | } |
513 | 521 | ||
514 | /* -------------------------------------------------------------------- | 522 | /* -------------------------------------------------------------------- |
@@ -521,7 +529,7 @@ static struct atmel_uart_data atmel_usart0_data = { | |||
521 | }; | 529 | }; |
522 | static struct resource atmel_usart0_resource[] = { | 530 | static struct resource atmel_usart0_resource[] = { |
523 | PBMEM(0xffe00c00), | 531 | PBMEM(0xffe00c00), |
524 | IRQ(7), | 532 | IRQ(6), |
525 | }; | 533 | }; |
526 | DEFINE_DEV_DATA(atmel_usart, 0); | 534 | DEFINE_DEV_DATA(atmel_usart, 0); |
527 | DEV_CLK(usart, atmel_usart0, pba, 4); | 535 | DEV_CLK(usart, atmel_usart0, pba, 4); |
@@ -583,7 +591,7 @@ static inline void configure_usart3_pins(void) | |||
583 | select_peripheral(PB(17), PERIPH_B, 0); /* TXD */ | 591 | select_peripheral(PB(17), PERIPH_B, 0); /* TXD */ |
584 | } | 592 | } |
585 | 593 | ||
586 | static struct platform_device *at32_usarts[4]; | 594 | static struct platform_device *__initdata at32_usarts[4]; |
587 | 595 | ||
588 | void __init at32_map_usart(unsigned int hw_id, unsigned int line) | 596 | void __init at32_map_usart(unsigned int hw_id, unsigned int line) |
589 | { | 597 | { |
@@ -728,12 +736,19 @@ at32_add_device_eth(unsigned int id, struct eth_platform_data *data) | |||
728 | /* -------------------------------------------------------------------- | 736 | /* -------------------------------------------------------------------- |
729 | * SPI | 737 | * SPI |
730 | * -------------------------------------------------------------------- */ | 738 | * -------------------------------------------------------------------- */ |
731 | static struct resource spi0_resource[] = { | 739 | static struct resource atmel_spi0_resource[] = { |
732 | PBMEM(0xffe00000), | 740 | PBMEM(0xffe00000), |
733 | IRQ(3), | 741 | IRQ(3), |
734 | }; | 742 | }; |
735 | DEFINE_DEV(spi, 0); | 743 | DEFINE_DEV(atmel_spi, 0); |
736 | DEV_CLK(mck, spi0, pba, 0); | 744 | DEV_CLK(spi_clk, atmel_spi0, pba, 0); |
745 | |||
746 | static struct resource atmel_spi1_resource[] = { | ||
747 | PBMEM(0xffe00400), | ||
748 | IRQ(4), | ||
749 | }; | ||
750 | DEFINE_DEV(atmel_spi, 1); | ||
751 | DEV_CLK(spi_clk, atmel_spi1, pba, 1); | ||
737 | 752 | ||
738 | struct platform_device *__init at32_add_device_spi(unsigned int id) | 753 | struct platform_device *__init at32_add_device_spi(unsigned int id) |
739 | { | 754 | { |
@@ -741,13 +756,33 @@ struct platform_device *__init at32_add_device_spi(unsigned int id) | |||
741 | 756 | ||
742 | switch (id) { | 757 | switch (id) { |
743 | case 0: | 758 | case 0: |
744 | pdev = &spi0_device; | 759 | pdev = &atmel_spi0_device; |
745 | select_peripheral(PA(0), PERIPH_A, 0); /* MISO */ | 760 | select_peripheral(PA(0), PERIPH_A, 0); /* MISO */ |
746 | select_peripheral(PA(1), PERIPH_A, 0); /* MOSI */ | 761 | select_peripheral(PA(1), PERIPH_A, 0); /* MOSI */ |
747 | select_peripheral(PA(2), PERIPH_A, 0); /* SCK */ | 762 | select_peripheral(PA(2), PERIPH_A, 0); /* SCK */ |
748 | select_peripheral(PA(3), PERIPH_A, 0); /* NPCS0 */ | 763 | |
749 | select_peripheral(PA(4), PERIPH_A, 0); /* NPCS1 */ | 764 | /* NPCS[2:0] */ |
750 | select_peripheral(PA(5), PERIPH_A, 0); /* NPCS2 */ | 765 | at32_select_gpio(GPIO_PIN_PA(3), |
766 | AT32_GPIOF_OUTPUT | AT32_GPIOF_HIGH); | ||
767 | at32_select_gpio(GPIO_PIN_PA(4), | ||
768 | AT32_GPIOF_OUTPUT | AT32_GPIOF_HIGH); | ||
769 | at32_select_gpio(GPIO_PIN_PA(5), | ||
770 | AT32_GPIOF_OUTPUT | AT32_GPIOF_HIGH); | ||
771 | break; | ||
772 | |||
773 | case 1: | ||
774 | pdev = &atmel_spi1_device; | ||
775 | select_peripheral(PB(0), PERIPH_B, 0); /* MISO */ | ||
776 | select_peripheral(PB(1), PERIPH_B, 0); /* MOSI */ | ||
777 | select_peripheral(PB(5), PERIPH_B, 0); /* SCK */ | ||
778 | |||
779 | /* NPCS[2:0] */ | ||
780 | at32_select_gpio(GPIO_PIN_PB(2), | ||
781 | AT32_GPIOF_OUTPUT | AT32_GPIOF_HIGH); | ||
782 | at32_select_gpio(GPIO_PIN_PB(3), | ||
783 | AT32_GPIOF_OUTPUT | AT32_GPIOF_HIGH); | ||
784 | at32_select_gpio(GPIO_PIN_PB(4), | ||
785 | AT32_GPIOF_OUTPUT | AT32_GPIOF_HIGH); | ||
751 | break; | 786 | break; |
752 | 787 | ||
753 | default: | 788 | default: |
@@ -860,6 +895,7 @@ struct clk *at32_clock_list[] = { | |||
860 | &pio1_mck, | 895 | &pio1_mck, |
861 | &pio2_mck, | 896 | &pio2_mck, |
862 | &pio3_mck, | 897 | &pio3_mck, |
898 | &pio4_mck, | ||
863 | &atmel_usart0_usart, | 899 | &atmel_usart0_usart, |
864 | &atmel_usart1_usart, | 900 | &atmel_usart1_usart, |
865 | &atmel_usart2_usart, | 901 | &atmel_usart2_usart, |
@@ -868,7 +904,8 @@ struct clk *at32_clock_list[] = { | |||
868 | &macb0_pclk, | 904 | &macb0_pclk, |
869 | &macb1_hclk, | 905 | &macb1_hclk, |
870 | &macb1_pclk, | 906 | &macb1_pclk, |
871 | &spi0_mck, | 907 | &atmel_spi0_spi_clk, |
908 | &atmel_spi1_spi_clk, | ||
872 | &lcdc0_hclk, | 909 | &lcdc0_hclk, |
873 | &lcdc0_pixclk, | 910 | &lcdc0_pixclk, |
874 | }; | 911 | }; |
@@ -880,6 +917,7 @@ void __init at32_portmux_init(void) | |||
880 | at32_init_pio(&pio1_device); | 917 | at32_init_pio(&pio1_device); |
881 | at32_init_pio(&pio2_device); | 918 | at32_init_pio(&pio2_device); |
882 | at32_init_pio(&pio3_device); | 919 | at32_init_pio(&pio3_device); |
920 | at32_init_pio(&pio4_device); | ||
883 | } | 921 | } |
884 | 922 | ||
885 | void __init at32_clock_init(void) | 923 | void __init at32_clock_init(void) |