aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-at91
diff options
context:
space:
mode:
authorRussell King <rmk@dyn-67.arm.linux.org.uk>2008-10-09 16:31:58 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2008-10-09 16:31:58 -0400
commit9e165acf1b9e37af7c0fa39399b43d0bd8600039 (patch)
tree7ffdb0ad4c35ac9c19c4096b4f22ccc9b1eeefad /arch/arm/mach-at91
parent6a4690c22f5da1eb1c898b61b6a80da52fbd976f (diff)
parent791ccf2e4deeea8426b389fd0f5bb0e9167bb75d (diff)
Merge branch 'at91' into devel
Diffstat (limited to 'arch/arm/mach-at91')
-rw-r--r--arch/arm/mach-at91/Kconfig22
-rw-r--r--arch/arm/mach-at91/Makefile2
-rw-r--r--arch/arm/mach-at91/at91cap9.c6
-rw-r--r--arch/arm/mach-at91/at91cap9_devices.c54
-rw-r--r--arch/arm/mach-at91/at91sam9263.c6
-rw-r--r--arch/arm/mach-at91/at91sam9263_devices.c53
-rw-r--r--arch/arm/mach-at91/at91sam9rl.c6
-rw-r--r--arch/arm/mach-at91/at91sam9rl_devices.c98
-rw-r--r--arch/arm/mach-at91/board-afeb-9260v1.c210
-rw-r--r--arch/arm/mach-at91/board-cap9adk.c2
-rw-r--r--arch/arm/mach-at91/board-carmeva.c28
-rw-r--r--arch/arm/mach-at91/board-csb337.c12
-rw-r--r--arch/arm/mach-at91/board-csb637.c4
-rw-r--r--arch/arm/mach-at91/board-dk.c4
-rw-r--r--arch/arm/mach-at91/board-ecbat91.c2
-rw-r--r--arch/arm/mach-at91/board-ek.c4
-rw-r--r--arch/arm/mach-at91/board-picotux200.c2
-rw-r--r--arch/arm/mach-at91/board-qil-a9260.c14
-rw-r--r--arch/arm/mach-at91/board-sam9-l9260.c4
-rw-r--r--arch/arm/mach-at91/board-sam9260ek.c80
-rw-r--r--arch/arm/mach-at91/board-sam9261ek.c18
-rw-r--r--arch/arm/mach-at91/board-sam9263ek.c64
-rw-r--r--arch/arm/mach-at91/board-sam9g20ek.c8
-rw-r--r--arch/arm/mach-at91/board-sam9rlek.c8
-rw-r--r--arch/arm/mach-at91/board-usb-a9260.c14
-rw-r--r--arch/arm/mach-at91/board-usb-a9263.c14
-rw-r--r--arch/arm/mach-at91/board-yl-9200.c50
-rw-r--r--arch/arm/mach-at91/include/mach/at91_pit.h3
-rw-r--r--arch/arm/mach-at91/include/mach/at91_rstc.h3
-rw-r--r--arch/arm/mach-at91/include/mach/at91_rtt.h3
-rw-r--r--arch/arm/mach-at91/include/mach/at91_shdwc.h3
-rw-r--r--arch/arm/mach-at91/include/mach/at91_wdt.h3
-rw-r--r--arch/arm/mach-at91/include/mach/at91cap9_ddrsdr.h2
-rw-r--r--arch/arm/mach-at91/include/mach/at91sam9260_matrix.h2
-rw-r--r--arch/arm/mach-at91/include/mach/at91sam9261_matrix.h2
-rw-r--r--arch/arm/mach-at91/include/mach/at91sam9_sdramc.h3
-rw-r--r--arch/arm/mach-at91/include/mach/at91sam9_smc.h3
-rw-r--r--arch/arm/mach-at91/include/mach/board.h14
-rw-r--r--arch/arm/mach-at91/leds.c45
-rw-r--r--arch/arm/mach-at91/pm_slowclock.S283
40 files changed, 1045 insertions, 113 deletions
diff --git a/arch/arm/mach-at91/Kconfig b/arch/arm/mach-at91/Kconfig
index a048b92cb407..5aafb2e2ca7a 100644
--- a/arch/arm/mach-at91/Kconfig
+++ b/arch/arm/mach-at91/Kconfig
@@ -175,6 +175,15 @@ config MACH_SAM9_L9260
175 Select this if you are using Olimex's SAM9-L9260 board based on the Atmel AT91SAM9260. 175 Select this if you are using Olimex's SAM9-L9260 board based on the Atmel AT91SAM9260.
176 <http://www.olimex.com/dev/sam9-L9260.html> 176 <http://www.olimex.com/dev/sam9-L9260.html>
177 177
178config MACH_AFEB9260
179 bool "Custom afeb9260 board v1"
180 depends on ARCH_AT91SAM9260
181 help
182 Select this if you are using custom afeb9260 board based on
183 open hardware design. Select this for revision 1 of the board.
184 <svn://194.85.238.22/home/users/george/svn/arm9eb>
185 <http://groups.google.com/group/arm9fpga-evolution-board>
186
178config MACH_USB_A9260 187config MACH_USB_A9260
179 bool "CALAO USB-A9260" 188 bool "CALAO USB-A9260"
180 depends on ARCH_AT91SAM9260 189 depends on ARCH_AT91SAM9260
@@ -314,6 +323,19 @@ config AT91_PROGRAMMABLE_CLOCKS
314 Select this if you need to program one or more of the PCK0..PCK3 323 Select this if you need to program one or more of the PCK0..PCK3
315 programmable clock outputs. 324 programmable clock outputs.
316 325
326config AT91_SLOW_CLOCK
327 bool "Suspend-to-RAM disables main oscillator"
328 depends on SUSPEND
329 help
330 Select this if you want Suspend-to-RAM to save the most power
331 possible (without powering off the CPU) by disabling the PLLs
332 and main oscillator so that only the 32 KiHz clock is available.
333
334 When only that slow-clock is available, some peripherals lose
335 functionality. Many can't issue wakeup events unless faster
336 clocks are available. Some lose their operating state and
337 need to be completely re-initialized.
338
317config AT91_TIMER_HZ 339config AT91_TIMER_HZ
318 int "Kernel HZ (jiffies per second)" 340 int "Kernel HZ (jiffies per second)"
319 range 32 1024 341 range 32 1024
diff --git a/arch/arm/mach-at91/Makefile b/arch/arm/mach-at91/Makefile
index 7d641f97516b..cca612d97ca2 100644
--- a/arch/arm/mach-at91/Makefile
+++ b/arch/arm/mach-at91/Makefile
@@ -39,6 +39,7 @@ obj-$(CONFIG_MACH_CAM60) += board-cam60.o
39obj-$(CONFIG_MACH_SAM9_L9260) += board-sam9-l9260.o 39obj-$(CONFIG_MACH_SAM9_L9260) += board-sam9-l9260.o
40obj-$(CONFIG_MACH_USB_A9260) += board-usb-a9260.o 40obj-$(CONFIG_MACH_USB_A9260) += board-usb-a9260.o
41obj-$(CONFIG_MACH_QIL_A9260) += board-qil-a9260.o 41obj-$(CONFIG_MACH_QIL_A9260) += board-qil-a9260.o
42obj-$(CONFIG_MACH_AFEB9260) += board-afeb-9260v1.o
42 43
43# AT91SAM9261 board-specific support 44# AT91SAM9261 board-specific support
44obj-$(CONFIG_MACH_AT91SAM9261EK) += board-sam9261ek.o 45obj-$(CONFIG_MACH_AT91SAM9261EK) += board-sam9261ek.o
@@ -64,6 +65,7 @@ obj-y += leds.o
64 65
65# Power Management 66# Power Management
66obj-$(CONFIG_PM) += pm.o 67obj-$(CONFIG_PM) += pm.o
68obj-$(CONFIG_AT91_SLOW_CLOCK) += pm_slowclock.o
67 69
68ifeq ($(CONFIG_PM_DEBUG),y) 70ifeq ($(CONFIG_PM_DEBUG),y)
69CFLAGS_pm.o += -DDEBUG 71CFLAGS_pm.o += -DDEBUG
diff --git a/arch/arm/mach-at91/at91cap9.c b/arch/arm/mach-at91/at91cap9.c
index 638948c16770..0fc0adaebd58 100644
--- a/arch/arm/mach-at91/at91cap9.c
+++ b/arch/arm/mach-at91/at91cap9.c
@@ -141,8 +141,8 @@ static struct clk tcb_clk = {
141 .pmc_mask = 1 << AT91CAP9_ID_TCB, 141 .pmc_mask = 1 << AT91CAP9_ID_TCB,
142 .type = CLK_TYPE_PERIPHERAL, 142 .type = CLK_TYPE_PERIPHERAL,
143}; 143};
144static struct clk pwmc_clk = { 144static struct clk pwm_clk = {
145 .name = "pwmc_clk", 145 .name = "pwm_clk",
146 .pmc_mask = 1 << AT91CAP9_ID_PWMC, 146 .pmc_mask = 1 << AT91CAP9_ID_PWMC,
147 .type = CLK_TYPE_PERIPHERAL, 147 .type = CLK_TYPE_PERIPHERAL,
148}; 148};
@@ -207,7 +207,7 @@ static struct clk *periph_clocks[] __initdata = {
207 &ssc1_clk, 207 &ssc1_clk,
208 &ac97_clk, 208 &ac97_clk,
209 &tcb_clk, 209 &tcb_clk,
210 &pwmc_clk, 210 &pwm_clk,
211 &macb_clk, 211 &macb_clk,
212 &aestdes_clk, 212 &aestdes_clk,
213 &adc_clk, 213 &adc_clk,
diff --git a/arch/arm/mach-at91/at91cap9_devices.c b/arch/arm/mach-at91/at91cap9_devices.c
index abb4aac8fa98..5ebd4273d353 100644
--- a/arch/arm/mach-at91/at91cap9_devices.c
+++ b/arch/arm/mach-at91/at91cap9_devices.c
@@ -719,6 +719,60 @@ static void __init at91_add_device_watchdog(void) {}
719 719
720 720
721/* -------------------------------------------------------------------- 721/* --------------------------------------------------------------------
722 * PWM
723 * --------------------------------------------------------------------*/
724
725#if defined(CONFIG_ATMEL_PWM)
726static u32 pwm_mask;
727
728static struct resource pwm_resources[] = {
729 [0] = {
730 .start = AT91CAP9_BASE_PWMC,
731 .end = AT91CAP9_BASE_PWMC + SZ_16K - 1,
732 .flags = IORESOURCE_MEM,
733 },
734 [1] = {
735 .start = AT91CAP9_ID_PWMC,
736 .end = AT91CAP9_ID_PWMC,
737 .flags = IORESOURCE_IRQ,
738 },
739};
740
741static struct platform_device at91cap9_pwm0_device = {
742 .name = "atmel_pwm",
743 .id = -1,
744 .dev = {
745 .platform_data = &pwm_mask,
746 },
747 .resource = pwm_resources,
748 .num_resources = ARRAY_SIZE(pwm_resources),
749};
750
751void __init at91_add_device_pwm(u32 mask)
752{
753 if (mask & (1 << AT91_PWM0))
754 at91_set_A_periph(AT91_PIN_PB19, 1); /* enable PWM0 */
755
756 if (mask & (1 << AT91_PWM1))
757 at91_set_B_periph(AT91_PIN_PB8, 1); /* enable PWM1 */
758
759 if (mask & (1 << AT91_PWM2))
760 at91_set_B_periph(AT91_PIN_PC29, 1); /* enable PWM2 */
761
762 if (mask & (1 << AT91_PWM3))
763 at91_set_B_periph(AT91_PIN_PA11, 1); /* enable PWM3 */
764
765 pwm_mask = mask;
766
767 platform_device_register(&at91cap9_pwm0_device);
768}
769#else
770void __init at91_add_device_pwm(u32 mask) {}
771#endif
772
773
774
775/* --------------------------------------------------------------------
722 * AC97 776 * AC97
723 * -------------------------------------------------------------------- */ 777 * -------------------------------------------------------------------- */
724 778
diff --git a/arch/arm/mach-at91/at91sam9263.c b/arch/arm/mach-at91/at91sam9263.c
index 80bfab5680e2..ada4b6769107 100644
--- a/arch/arm/mach-at91/at91sam9263.c
+++ b/arch/arm/mach-at91/at91sam9263.c
@@ -129,8 +129,8 @@ static struct clk tcb_clk = {
129 .pmc_mask = 1 << AT91SAM9263_ID_TCB, 129 .pmc_mask = 1 << AT91SAM9263_ID_TCB,
130 .type = CLK_TYPE_PERIPHERAL, 130 .type = CLK_TYPE_PERIPHERAL,
131}; 131};
132static struct clk pwmc_clk = { 132static struct clk pwm_clk = {
133 .name = "pwmc_clk", 133 .name = "pwm_clk",
134 .pmc_mask = 1 << AT91SAM9263_ID_PWMC, 134 .pmc_mask = 1 << AT91SAM9263_ID_PWMC,
135 .type = CLK_TYPE_PERIPHERAL, 135 .type = CLK_TYPE_PERIPHERAL,
136}; 136};
@@ -187,7 +187,7 @@ static struct clk *periph_clocks[] __initdata = {
187 &ssc1_clk, 187 &ssc1_clk,
188 &ac97_clk, 188 &ac97_clk,
189 &tcb_clk, 189 &tcb_clk,
190 &pwmc_clk, 190 &pwm_clk,
191 &macb_clk, 191 &macb_clk,
192 &twodge_clk, 192 &twodge_clk,
193 &udc_clk, 193 &udc_clk,
diff --git a/arch/arm/mach-at91/at91sam9263_devices.c b/arch/arm/mach-at91/at91sam9263_devices.c
index c93992f55dc9..8b884083f76d 100644
--- a/arch/arm/mach-at91/at91sam9263_devices.c
+++ b/arch/arm/mach-at91/at91sam9263_devices.c
@@ -886,6 +886,59 @@ static void __init at91_add_device_watchdog(void) {}
886 886
887 887
888/* -------------------------------------------------------------------- 888/* --------------------------------------------------------------------
889 * PWM
890 * --------------------------------------------------------------------*/
891
892#if defined(CONFIG_ATMEL_PWM)
893static u32 pwm_mask;
894
895static struct resource pwm_resources[] = {
896 [0] = {
897 .start = AT91SAM9263_BASE_PWMC,
898 .end = AT91SAM9263_BASE_PWMC + SZ_16K - 1,
899 .flags = IORESOURCE_MEM,
900 },
901 [1] = {
902 .start = AT91SAM9263_ID_PWMC,
903 .end = AT91SAM9263_ID_PWMC,
904 .flags = IORESOURCE_IRQ,
905 },
906};
907
908static struct platform_device at91sam9263_pwm0_device = {
909 .name = "atmel_pwm",
910 .id = -1,
911 .dev = {
912 .platform_data = &pwm_mask,
913 },
914 .resource = pwm_resources,
915 .num_resources = ARRAY_SIZE(pwm_resources),
916};
917
918void __init at91_add_device_pwm(u32 mask)
919{
920 if (mask & (1 << AT91_PWM0))
921 at91_set_B_periph(AT91_PIN_PB7, 1); /* enable PWM0 */
922
923 if (mask & (1 << AT91_PWM1))
924 at91_set_B_periph(AT91_PIN_PB8, 1); /* enable PWM1 */
925
926 if (mask & (1 << AT91_PWM2))
927 at91_set_B_periph(AT91_PIN_PC29, 1); /* enable PWM2 */
928
929 if (mask & (1 << AT91_PWM3))
930 at91_set_B_periph(AT91_PIN_PB29, 1); /* enable PWM3 */
931
932 pwm_mask = mask;
933
934 platform_device_register(&at91sam9263_pwm0_device);
935}
936#else
937void __init at91_add_device_pwm(u32 mask) {}
938#endif
939
940
941/* --------------------------------------------------------------------
889 * SSC -- Synchronous Serial Controller 942 * SSC -- Synchronous Serial Controller
890 * -------------------------------------------------------------------- */ 943 * -------------------------------------------------------------------- */
891 944
diff --git a/arch/arm/mach-at91/at91sam9rl.c b/arch/arm/mach-at91/at91sam9rl.c
index 556bddf35b45..252e954b49fd 100644
--- a/arch/arm/mach-at91/at91sam9rl.c
+++ b/arch/arm/mach-at91/at91sam9rl.c
@@ -131,8 +131,8 @@ static struct clk tc2_clk = {
131 .pmc_mask = 1 << AT91SAM9RL_ID_TC2, 131 .pmc_mask = 1 << AT91SAM9RL_ID_TC2,
132 .type = CLK_TYPE_PERIPHERAL, 132 .type = CLK_TYPE_PERIPHERAL,
133}; 133};
134static struct clk pwmc_clk = { 134static struct clk pwm_clk = {
135 .name = "pwmc_clk", 135 .name = "pwm_clk",
136 .pmc_mask = 1 << AT91SAM9RL_ID_PWMC, 136 .pmc_mask = 1 << AT91SAM9RL_ID_PWMC,
137 .type = CLK_TYPE_PERIPHERAL, 137 .type = CLK_TYPE_PERIPHERAL,
138}; 138};
@@ -180,7 +180,7 @@ static struct clk *periph_clocks[] __initdata = {
180 &tc0_clk, 180 &tc0_clk,
181 &tc1_clk, 181 &tc1_clk,
182 &tc2_clk, 182 &tc2_clk,
183 &pwmc_clk, 183 &pwm_clk,
184 &tsc_clk, 184 &tsc_clk,
185 &dma_clk, 185 &dma_clk,
186 &udphs_clk, 186 &udphs_clk,
diff --git a/arch/arm/mach-at91/at91sam9rl_devices.c b/arch/arm/mach-at91/at91sam9rl_devices.c
index 620886341fb5..87deb1e1b529 100644
--- a/arch/arm/mach-at91/at91sam9rl_devices.c
+++ b/arch/arm/mach-at91/at91sam9rl_devices.c
@@ -527,6 +527,51 @@ static void __init at91_add_device_tc(void) { }
527 527
528 528
529/* -------------------------------------------------------------------- 529/* --------------------------------------------------------------------
530 * Touchscreen
531 * -------------------------------------------------------------------- */
532
533#if defined(CONFIG_TOUCHSCREEN_ATMEL_TSADCC) || defined(CONFIG_TOUCHSCREEN_ATMEL_TSADCC_MODULE)
534static u64 tsadcc_dmamask = DMA_BIT_MASK(32);
535
536static struct resource tsadcc_resources[] = {
537 [0] = {
538 .start = AT91SAM9RL_BASE_TSC,
539 .end = AT91SAM9RL_BASE_TSC + SZ_16K - 1,
540 .flags = IORESOURCE_MEM,
541 },
542 [1] = {
543 .start = AT91SAM9RL_ID_TSC,
544 .end = AT91SAM9RL_ID_TSC,
545 .flags = IORESOURCE_IRQ,
546 }
547};
548
549static struct platform_device at91sam9rl_tsadcc_device = {
550 .name = "atmel_tsadcc",
551 .id = -1,
552 .dev = {
553 .dma_mask = &tsadcc_dmamask,
554 .coherent_dma_mask = DMA_BIT_MASK(32),
555 },
556 .resource = tsadcc_resources,
557 .num_resources = ARRAY_SIZE(tsadcc_resources),
558};
559
560void __init at91_add_device_tsadcc(void)
561{
562 at91_set_A_periph(AT91_PIN_PA17, 0); /* AD0_XR */
563 at91_set_A_periph(AT91_PIN_PA18, 0); /* AD1_XL */
564 at91_set_A_periph(AT91_PIN_PA19, 0); /* AD2_YT */
565 at91_set_A_periph(AT91_PIN_PA20, 0); /* AD3_TB */
566
567 platform_device_register(&at91sam9rl_tsadcc_device);
568}
569#else
570void __init at91_add_device_tsadcc(void) {}
571#endif
572
573
574/* --------------------------------------------------------------------
530 * RTC 575 * RTC
531 * -------------------------------------------------------------------- */ 576 * -------------------------------------------------------------------- */
532 577
@@ -592,6 +637,59 @@ static void __init at91_add_device_watchdog(void) {}
592 637
593 638
594/* -------------------------------------------------------------------- 639/* --------------------------------------------------------------------
640 * PWM
641 * --------------------------------------------------------------------*/
642
643#if defined(CONFIG_ATMEL_PWM)
644static u32 pwm_mask;
645
646static struct resource pwm_resources[] = {
647 [0] = {
648 .start = AT91SAM9RL_BASE_PWMC,
649 .end = AT91SAM9RL_BASE_PWMC + SZ_16K - 1,
650 .flags = IORESOURCE_MEM,
651 },
652 [1] = {
653 .start = AT91SAM9RL_ID_PWMC,
654 .end = AT91SAM9RL_ID_PWMC,
655 .flags = IORESOURCE_IRQ,
656 },
657};
658
659static struct platform_device at91sam9rl_pwm0_device = {
660 .name = "atmel_pwm",
661 .id = -1,
662 .dev = {
663 .platform_data = &pwm_mask,
664 },
665 .resource = pwm_resources,
666 .num_resources = ARRAY_SIZE(pwm_resources),
667};
668
669void __init at91_add_device_pwm(u32 mask)
670{
671 if (mask & (1 << AT91_PWM0))
672 at91_set_B_periph(AT91_PIN_PB8, 1); /* enable PWM0 */
673
674 if (mask & (1 << AT91_PWM1))
675 at91_set_B_periph(AT91_PIN_PB9, 1); /* enable PWM1 */
676
677 if (mask & (1 << AT91_PWM2))
678 at91_set_B_periph(AT91_PIN_PD5, 1); /* enable PWM2 */
679
680 if (mask & (1 << AT91_PWM3))
681 at91_set_B_periph(AT91_PIN_PD8, 1); /* enable PWM3 */
682
683 pwm_mask = mask;
684
685 platform_device_register(&at91sam9rl_pwm0_device);
686}
687#else
688void __init at91_add_device_pwm(u32 mask) {}
689#endif
690
691
692/* --------------------------------------------------------------------
595 * SSC -- Synchronous Serial Controller 693 * SSC -- Synchronous Serial Controller
596 * -------------------------------------------------------------------- */ 694 * -------------------------------------------------------------------- */
597 695
diff --git a/arch/arm/mach-at91/board-afeb-9260v1.c b/arch/arm/mach-at91/board-afeb-9260v1.c
new file mode 100644
index 000000000000..9c040c78889a
--- /dev/null
+++ b/arch/arm/mach-at91/board-afeb-9260v1.c
@@ -0,0 +1,210 @@
1/*
2 * linux/arch/arm/mach-at91/board-afeb-9260v1.c
3 *
4 * Copyright (C) 2005 SAN People
5 * Copyright (C) 2006 Atmel
6 * Copyright (C) 2008 Sergey Lapin
7 *
8 * A custom board designed as open hardware; PCBs and various information
9 * is available at http://groups.google.com/group/arm9fpga-evolution-board/
10 * Subversion repository: svn://194.85.238.22/home/users/george/svn/arm9eb
11 *
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
16 *
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 */
26
27#include <linux/types.h>
28#include <linux/init.h>
29#include <linux/mm.h>
30#include <linux/module.h>
31#include <linux/platform_device.h>
32#include <linux/spi/spi.h>
33#include <linux/clk.h>
34#include <linux/dma-mapping.h>
35
36#include <mach/hardware.h>
37#include <asm/setup.h>
38#include <asm/mach-types.h>
39#include <asm/irq.h>
40
41#include <asm/mach/arch.h>
42#include <asm/mach/map.h>
43#include <asm/mach/irq.h>
44
45#include <mach/board.h>
46#include <mach/gpio.h>
47
48#include "generic.h"
49
50
51static void __init afeb9260_map_io(void)
52{
53 /* Initialize processor: 18.432 MHz crystal */
54 at91sam9260_initialize(18432000);
55
56 /* DGBU on ttyS0. (Rx & Tx only) */
57 at91_register_uart(0, 0, 0);
58
59 /* USART0 on ttyS1. (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */
60 at91_register_uart(AT91SAM9260_ID_US0, 1,
61 ATMEL_UART_CTS | ATMEL_UART_RTS
62 | ATMEL_UART_DTR | ATMEL_UART_DSR
63 | ATMEL_UART_DCD | ATMEL_UART_RI);
64
65 /* USART1 on ttyS2. (Rx, Tx, RTS, CTS) */
66 at91_register_uart(AT91SAM9260_ID_US1, 2,
67 ATMEL_UART_CTS | ATMEL_UART_RTS);
68
69 /* set serial console to ttyS0 (ie, DBGU) */
70 at91_set_serial_console(0);
71}
72
73static void __init afeb9260_init_irq(void)
74{
75 at91sam9260_init_interrupts(NULL);
76}
77
78
79/*
80 * USB Host port
81 */
82static struct at91_usbh_data __initdata afeb9260_usbh_data = {
83 .ports = 1,
84};
85
86/*
87 * USB Device port
88 */
89static struct at91_udc_data __initdata afeb9260_udc_data = {
90 .vbus_pin = AT91_PIN_PC5,
91 .pullup_pin = 0, /* pull-up driven by UDC */
92};
93
94
95
96/*
97 * SPI devices.
98 */
99static struct spi_board_info afeb9260_spi_devices[] = {
100 { /* DataFlash chip */
101 .modalias = "mtd_dataflash",
102 .chip_select = 1,
103 .max_speed_hz = 15 * 1000 * 1000,
104 .bus_num = 0,
105 },
106};
107
108
109/*
110 * MACB Ethernet device
111 */
112static struct at91_eth_data __initdata afeb9260_macb_data = {
113 .phy_irq_pin = AT91_PIN_PA9,
114 .is_rmii = 0,
115};
116
117
118/*
119 * NAND flash
120 */
121static struct mtd_partition __initdata afeb9260_nand_partition[] = {
122 {
123 .name = "bootloader",
124 .offset = 0,
125 .size = (640 * SZ_1K),
126 },
127 {
128 .name = "kernel",
129 .offset = MTDPART_OFS_NXTBLK,
130 .size = SZ_2M,
131 },
132 {
133 .name = "rootfs",
134 .offset = MTDPART_OFS_NXTBLK,
135 .size = MTDPART_SIZ_FULL,
136 },
137};
138
139static struct mtd_partition * __init nand_partitions(int size, int *num_partitions)
140{
141 *num_partitions = ARRAY_SIZE(afeb9260_nand_partition);
142 return afeb9260_nand_partition;
143}
144
145static struct atmel_nand_data __initdata afeb9260_nand_data = {
146 .ale = 21,
147 .cle = 22,
148 .rdy_pin = AT91_PIN_PC13,
149 .enable_pin = AT91_PIN_PC14,
150 .partition_info = nand_partitions,
151 .bus_width_16 = 0,
152};
153
154
155/*
156 * MCI (SD/MMC)
157 */
158static struct at91_mmc_data __initdata afeb9260_mmc_data = {
159 .slot_b = 1,
160 .wire4 = 1,
161};
162
163
164
165static struct i2c_board_info __initdata afeb9260_i2c_devices[] = {
166 {
167 I2C_BOARD_INFO("fm3130", 0x68),
168 I2C_BOARD_INFO("24c64", 0x50),
169 },
170};
171
172static void __init afeb9260_board_init(void)
173{
174 /* Serial */
175 at91_add_device_serial();
176 /* USB Host */
177 at91_add_device_usbh(&afeb9260_usbh_data);
178 /* USB Device */
179 at91_add_device_udc(&afeb9260_udc_data);
180 /* SPI */
181 at91_add_device_spi(afeb9260_spi_devices,
182 ARRAY_SIZE(afeb9260_spi_devices));
183 /* NAND */
184 at91_add_device_nand(&afeb9260_nand_data);
185 /* Ethernet */
186 at91_add_device_eth(&afeb9260_macb_data);
187
188 /* Standard function's pin assignments are not
189 * appropriate for us and generic code provide
190 * no API to configure these pins any other way */
191 at91_set_B_periph(AT91_PIN_PA10, 0); /* ETX2 */
192 at91_set_B_periph(AT91_PIN_PA11, 0); /* ETX3 */
193 /* MMC */
194 at91_add_device_mmc(0, &afeb9260_mmc_data);
195 /* I2C */
196 at91_add_device_i2c(afeb9260_i2c_devices,
197 ARRAY_SIZE(afeb9260_i2c_devices));
198}
199
200MACHINE_START(AFEB9260, "Custom afeb9260 board")
201 /* Maintainer: Sergey Lapin <slapin@ossfans.org> */
202 .phys_io = AT91_BASE_SYS,
203 .io_pg_offst = (AT91_VA_BASE_SYS >> 18) & 0xfffc,
204 .boot_params = AT91_SDRAM_BASE + 0x100,
205 .timer = &at91sam926x_timer,
206 .map_io = afeb9260_map_io,
207 .init_irq = afeb9260_init_irq,
208 .init_machine = afeb9260_board_init,
209MACHINE_END
210
diff --git a/arch/arm/mach-at91/board-cap9adk.c b/arch/arm/mach-at91/board-cap9adk.c
index 196199552eb6..201b89392dcc 100644
--- a/arch/arm/mach-at91/board-cap9adk.c
+++ b/arch/arm/mach-at91/board-cap9adk.c
@@ -214,7 +214,7 @@ static struct physmap_flash_data cap9adk_nor_data = {
214}; 214};
215 215
216#define NOR_BASE AT91_CHIPSELECT_0 216#define NOR_BASE AT91_CHIPSELECT_0
217#define NOR_SIZE 0x800000 217#define NOR_SIZE SZ_8M
218 218
219static struct resource nor_flash_resources[] = { 219static struct resource nor_flash_resources[] = {
220 { 220 {
diff --git a/arch/arm/mach-at91/board-carmeva.c b/arch/arm/mach-at91/board-carmeva.c
index afa1ff0e9577..db1f9544d2e0 100644
--- a/arch/arm/mach-at91/board-carmeva.c
+++ b/arch/arm/mach-at91/board-carmeva.c
@@ -25,7 +25,6 @@
25#include <linux/module.h> 25#include <linux/module.h>
26#include <linux/platform_device.h> 26#include <linux/platform_device.h>
27 27
28#include <mach/hardware.h>
29#include <asm/setup.h> 28#include <asm/setup.h>
30#include <asm/mach-types.h> 29#include <asm/mach-types.h>
31#include <asm/irq.h> 30#include <asm/irq.h>
@@ -34,6 +33,7 @@
34#include <asm/mach/map.h> 33#include <asm/mach/map.h>
35#include <asm/mach/irq.h> 34#include <asm/mach/irq.h>
36 35
36#include <mach/hardware.h>
37#include <mach/board.h> 37#include <mach/board.h>
38#include <mach/gpio.h> 38#include <mach/gpio.h>
39 39
@@ -114,6 +114,30 @@ static struct spi_board_info carmeva_spi_devices[] = {
114 }, 114 },
115}; 115};
116 116
117static struct gpio_led carmeva_leds[] = {
118 { /* "user led 1", LED9 */
119 .name = "led9",
120 .gpio = AT91_PIN_PA21,
121 .active_low = 1,
122 .default_trigger = "heartbeat",
123 },
124 { /* "user led 2", LED10 */
125 .name = "led10",
126 .gpio = AT91_PIN_PA25,
127 .active_low = 1,
128 },
129 { /* "user led 3", LED11 */
130 .name = "led11",
131 .gpio = AT91_PIN_PA26,
132 .active_low = 1,
133 },
134 { /* "user led 4", LED12 */
135 .name = "led12",
136 .gpio = AT91_PIN_PA18,
137 .active_low = 1,
138 }
139};
140
117static void __init carmeva_board_init(void) 141static void __init carmeva_board_init(void)
118{ 142{
119 /* Serial */ 143 /* Serial */
@@ -132,6 +156,8 @@ static void __init carmeva_board_init(void)
132// at91_add_device_cf(&carmeva_cf_data); 156// at91_add_device_cf(&carmeva_cf_data);
133 /* MMC */ 157 /* MMC */
134 at91_add_device_mmc(0, &carmeva_mmc_data); 158 at91_add_device_mmc(0, &carmeva_mmc_data);
159 /* LEDs */
160 at91_gpio_leds(carmeva_leds, ARRAY_SIZE(carmeva_leds));
135} 161}
136 162
137MACHINE_START(CARMEVA, "Carmeva") 163MACHINE_START(CARMEVA, "Carmeva")
diff --git a/arch/arm/mach-at91/board-csb337.c b/arch/arm/mach-at91/board-csb337.c
index cb7c9a8fa487..fea2529ebcf9 100644
--- a/arch/arm/mach-at91/board-csb337.c
+++ b/arch/arm/mach-at91/board-csb337.c
@@ -28,7 +28,6 @@
28#include <linux/input.h> 28#include <linux/input.h>
29#include <linux/gpio_keys.h> 29#include <linux/gpio_keys.h>
30 30
31#include <mach/hardware.h>
32#include <asm/setup.h> 31#include <asm/setup.h>
33#include <asm/mach-types.h> 32#include <asm/mach-types.h>
34#include <asm/irq.h> 33#include <asm/irq.h>
@@ -37,6 +36,7 @@
37#include <asm/mach/map.h> 36#include <asm/mach/map.h>
38#include <asm/mach/irq.h> 37#include <asm/mach/irq.h>
39 38
39#include <mach/hardware.h>
40#include <mach/board.h> 40#include <mach/board.h>
41#include <mach/gpio.h> 41#include <mach/gpio.h>
42 42
@@ -114,7 +114,7 @@ static struct spi_board_info csb337_spi_devices[] = {
114}; 114};
115 115
116#define CSB_FLASH_BASE AT91_CHIPSELECT_0 116#define CSB_FLASH_BASE AT91_CHIPSELECT_0
117#define CSB_FLASH_SIZE 0x800000 117#define CSB_FLASH_SIZE SZ_8M
118 118
119static struct mtd_partition csb_flash_partitions[] = { 119static struct mtd_partition csb_flash_partitions[] = {
120 { 120 {
@@ -193,11 +193,11 @@ static struct platform_device csb300_button_device = {
193 193
194static void __init csb300_add_device_buttons(void) 194static void __init csb300_add_device_buttons(void)
195{ 195{
196 at91_set_gpio_input(AT91_PIN_PB29, 0); /* sw0 */ 196 at91_set_gpio_input(AT91_PIN_PB29, 1); /* sw0 */
197 at91_set_deglitch(AT91_PIN_PB29, 1); 197 at91_set_deglitch(AT91_PIN_PB29, 1);
198 at91_set_gpio_input(AT91_PIN_PB28, 0); /* sw1 */ 198 at91_set_gpio_input(AT91_PIN_PB28, 1); /* sw1 */
199 at91_set_deglitch(AT91_PIN_PB28, 1); 199 at91_set_deglitch(AT91_PIN_PB28, 1);
200 at91_set_gpio_input(AT91_PIN_PA21, 0); /* sw2 */ 200 at91_set_gpio_input(AT91_PIN_PA21, 1); /* sw2 */
201 at91_set_deglitch(AT91_PIN_PA21, 1); 201 at91_set_deglitch(AT91_PIN_PA21, 1);
202 202
203 platform_device_register(&csb300_button_device); 203 platform_device_register(&csb300_button_device);
@@ -224,7 +224,7 @@ static struct gpio_led csb_leds[] = {
224 .gpio = AT91_PIN_PB0, 224 .gpio = AT91_PIN_PB0,
225 .active_low = 1, 225 .active_low = 1,
226 .default_trigger = "ide-disk", 226 .default_trigger = "ide-disk",
227 }, 227 }
228}; 228};
229 229
230 230
diff --git a/arch/arm/mach-at91/board-csb637.c b/arch/arm/mach-at91/board-csb637.c
index 8db8bd8babd9..cfa3f04b2205 100644
--- a/arch/arm/mach-at91/board-csb637.c
+++ b/arch/arm/mach-at91/board-csb637.c
@@ -25,7 +25,6 @@
25#include <linux/platform_device.h> 25#include <linux/platform_device.h>
26#include <linux/mtd/physmap.h> 26#include <linux/mtd/physmap.h>
27 27
28#include <mach/hardware.h>
29#include <asm/setup.h> 28#include <asm/setup.h>
30#include <asm/mach-types.h> 29#include <asm/mach-types.h>
31#include <asm/irq.h> 30#include <asm/irq.h>
@@ -34,6 +33,7 @@
34#include <asm/mach/map.h> 33#include <asm/mach/map.h>
35#include <asm/mach/irq.h> 34#include <asm/mach/irq.h>
36 35
36#include <mach/hardware.h>
37#include <mach/board.h> 37#include <mach/board.h>
38#include <mach/gpio.h> 38#include <mach/gpio.h>
39 39
@@ -72,7 +72,7 @@ static struct at91_udc_data __initdata csb637_udc_data = {
72}; 72};
73 73
74#define CSB_FLASH_BASE AT91_CHIPSELECT_0 74#define CSB_FLASH_BASE AT91_CHIPSELECT_0
75#define CSB_FLASH_SIZE 0x1000000 75#define CSB_FLASH_SIZE SZ_16M
76 76
77static struct mtd_partition csb_flash_partitions[] = { 77static struct mtd_partition csb_flash_partitions[] = {
78 { 78 {
diff --git a/arch/arm/mach-at91/board-dk.c b/arch/arm/mach-at91/board-dk.c
index 43e1aa7ecef7..0fd0f5bc77ea 100644
--- a/arch/arm/mach-at91/board-dk.c
+++ b/arch/arm/mach-at91/board-dk.c
@@ -29,7 +29,6 @@
29#include <linux/spi/spi.h> 29#include <linux/spi/spi.h>
30#include <linux/mtd/physmap.h> 30#include <linux/mtd/physmap.h>
31 31
32#include <mach/hardware.h>
33#include <asm/setup.h> 32#include <asm/setup.h>
34#include <asm/mach-types.h> 33#include <asm/mach-types.h>
35#include <asm/irq.h> 34#include <asm/irq.h>
@@ -38,6 +37,7 @@
38#include <asm/mach/map.h> 37#include <asm/mach/map.h>
39#include <asm/mach/irq.h> 38#include <asm/mach/irq.h>
40 39
40#include <mach/hardware.h>
41#include <mach/board.h> 41#include <mach/board.h>
42#include <mach/gpio.h> 42#include <mach/gpio.h>
43#include <mach/at91rm9200_mc.h> 43#include <mach/at91rm9200_mc.h>
@@ -157,7 +157,7 @@ static struct atmel_nand_data __initdata dk_nand_data = {
157}; 157};
158 158
159#define DK_FLASH_BASE AT91_CHIPSELECT_0 159#define DK_FLASH_BASE AT91_CHIPSELECT_0
160#define DK_FLASH_SIZE 0x200000 160#define DK_FLASH_SIZE SZ_2M
161 161
162static struct physmap_flash_data dk_flash_data = { 162static struct physmap_flash_data dk_flash_data = {
163 .width = 2, 163 .width = 2,
diff --git a/arch/arm/mach-at91/board-ecbat91.c b/arch/arm/mach-at91/board-ecbat91.c
index bfeee8a2af28..1d69908617f0 100644
--- a/arch/arm/mach-at91/board-ecbat91.c
+++ b/arch/arm/mach-at91/board-ecbat91.c
@@ -86,7 +86,7 @@ static struct mtd_partition __initdata my_flash0_partitions[] =
86 { /* 0x8400 */ 86 { /* 0x8400 */
87 .name = "Darrell-loader", 87 .name = "Darrell-loader",
88 .offset = 0, 88 .offset = 0,
89 .size = 12* 1056, 89 .size = 12 * 1056,
90 }, 90 },
91 { 91 {
92 .name = "U-boot", 92 .name = "U-boot",
diff --git a/arch/arm/mach-at91/board-ek.c b/arch/arm/mach-at91/board-ek.c
index 60626e7a3490..4cdfaac8e590 100644
--- a/arch/arm/mach-at91/board-ek.c
+++ b/arch/arm/mach-at91/board-ek.c
@@ -29,7 +29,6 @@
29#include <linux/spi/spi.h> 29#include <linux/spi/spi.h>
30#include <linux/mtd/physmap.h> 30#include <linux/mtd/physmap.h>
31 31
32#include <mach/hardware.h>
33#include <asm/setup.h> 32#include <asm/setup.h>
34#include <asm/mach-types.h> 33#include <asm/mach-types.h>
35#include <asm/irq.h> 34#include <asm/irq.h>
@@ -38,6 +37,7 @@
38#include <asm/mach/map.h> 37#include <asm/mach/map.h>
39#include <asm/mach/irq.h> 38#include <asm/mach/irq.h>
40 39
40#include <mach/hardware.h>
41#include <mach/board.h> 41#include <mach/board.h>
42#include <mach/gpio.h> 42#include <mach/gpio.h>
43#include <mach/at91rm9200_mc.h> 43#include <mach/at91rm9200_mc.h>
@@ -116,7 +116,7 @@ static struct i2c_board_info __initdata ek_i2c_devices[] = {
116}; 116};
117 117
118#define EK_FLASH_BASE AT91_CHIPSELECT_0 118#define EK_FLASH_BASE AT91_CHIPSELECT_0
119#define EK_FLASH_SIZE 0x200000 119#define EK_FLASH_SIZE SZ_2M
120 120
121static struct physmap_flash_data ek_flash_data = { 121static struct physmap_flash_data ek_flash_data = {
122 .width = 2, 122 .width = 2,
diff --git a/arch/arm/mach-at91/board-picotux200.c b/arch/arm/mach-at91/board-picotux200.c
index dbc912d633c7..859727e7ea30 100644
--- a/arch/arm/mach-at91/board-picotux200.c
+++ b/arch/arm/mach-at91/board-picotux200.c
@@ -105,7 +105,7 @@ static struct at91_mmc_data __initdata picotux200_mmc_data = {
105// }; 105// };
106 106
107#define PICOTUX200_FLASH_BASE AT91_CHIPSELECT_0 107#define PICOTUX200_FLASH_BASE AT91_CHIPSELECT_0
108#define PICOTUX200_FLASH_SIZE 0x400000 108#define PICOTUX200_FLASH_SIZE SZ_4M
109 109
110static struct physmap_flash_data picotux200_flash_data = { 110static struct physmap_flash_data picotux200_flash_data = {
111 .width = 2, 111 .width = 2,
diff --git a/arch/arm/mach-at91/board-qil-a9260.c b/arch/arm/mach-at91/board-qil-a9260.c
index 4c28413426c2..cfb4571a2e27 100644
--- a/arch/arm/mach-at91/board-qil-a9260.c
+++ b/arch/arm/mach-at91/board-qil-a9260.c
@@ -30,7 +30,6 @@
30#include <linux/input.h> 30#include <linux/input.h>
31#include <linux/clk.h> 31#include <linux/clk.h>
32 32
33#include <mach/hardware.h>
34#include <asm/setup.h> 33#include <asm/setup.h>
35#include <asm/mach-types.h> 34#include <asm/mach-types.h>
36#include <asm/irq.h> 35#include <asm/irq.h>
@@ -39,6 +38,7 @@
39#include <asm/mach/map.h> 38#include <asm/mach/map.h>
40#include <asm/mach/irq.h> 39#include <asm/mach/irq.h>
41 40
41#include <mach/hardware.h>
42#include <mach/board.h> 42#include <mach/board.h>
43#include <mach/gpio.h> 43#include <mach/gpio.h>
44#include <mach/at91_shdwc.h> 44#include <mach/at91_shdwc.h>
@@ -119,18 +119,18 @@ static struct at91_eth_data __initdata ek_macb_data = {
119static struct mtd_partition __initdata ek_nand_partition[] = { 119static struct mtd_partition __initdata ek_nand_partition[] = {
120 { 120 {
121 .name = "Uboot & Kernel", 121 .name = "Uboot & Kernel",
122 .offset = 0x00000000, 122 .offset = 0,
123 .size = 16 * 1024 * 1024, 123 .size = SZ_16M,
124 }, 124 },
125 { 125 {
126 .name = "Root FS", 126 .name = "Root FS",
127 .offset = 0x01000000, 127 .offset = MTDPART_OFS_NXTBLK,
128 .size = 120 * 1024 * 1024, 128 .size = 120 * SZ_1M,
129 }, 129 },
130 { 130 {
131 .name = "FS", 131 .name = "FS",
132 .offset = 0x08800000, 132 .offset = MTDPART_OFS_NXTBLK,
133 .size = 120 * 1024 * 1024, 133 .size = 120 * SZ_1M,
134 }, 134 },
135}; 135};
136 136
diff --git a/arch/arm/mach-at91/board-sam9-l9260.c b/arch/arm/mach-at91/board-sam9-l9260.c
index e4910cb26c16..99bb4cc23a09 100644
--- a/arch/arm/mach-at91/board-sam9-l9260.c
+++ b/arch/arm/mach-at91/board-sam9-l9260.c
@@ -126,11 +126,11 @@ static struct mtd_partition __initdata ek_nand_partition[] = {
126 { 126 {
127 .name = "Bootloader Area", 127 .name = "Bootloader Area",
128 .offset = 0, 128 .offset = 0,
129 .size = 10 * 1024 * 1024, 129 .size = 10 * SZ_1M,
130 }, 130 },
131 { 131 {
132 .name = "User Area", 132 .name = "User Area",
133 .offset = 10 * 1024 * 1024, 133 .offset = MTDPART_OFS_NXTBLK,
134 .size = MTDPART_SIZ_FULL, 134 .size = MTDPART_SIZ_FULL,
135 }, 135 },
136}; 136};
diff --git a/arch/arm/mach-at91/board-sam9260ek.c b/arch/arm/mach-at91/board-sam9260ek.c
index cb20e70b3b06..b49eb6e4918a 100644
--- a/arch/arm/mach-at91/board-sam9260ek.c
+++ b/arch/arm/mach-at91/board-sam9260ek.c
@@ -27,8 +27,10 @@
27#include <linux/spi/spi.h> 27#include <linux/spi/spi.h>
28#include <linux/spi/at73c213.h> 28#include <linux/spi/at73c213.h>
29#include <linux/clk.h> 29#include <linux/clk.h>
30#include <linux/i2c/at24.h>
31#include <linux/gpio_keys.h>
32#include <linux/input.h>
30 33
31#include <mach/hardware.h>
32#include <asm/setup.h> 34#include <asm/setup.h>
33#include <asm/mach-types.h> 35#include <asm/mach-types.h>
34#include <asm/irq.h> 36#include <asm/irq.h>
@@ -37,6 +39,7 @@
37#include <asm/mach/map.h> 39#include <asm/mach/map.h>
38#include <asm/mach/irq.h> 40#include <asm/mach/irq.h>
39 41
42#include <mach/hardware.h>
40#include <mach/board.h> 43#include <mach/board.h>
41#include <mach/gpio.h> 44#include <mach/gpio.h>
42 45
@@ -163,11 +166,11 @@ static struct mtd_partition __initdata ek_nand_partition[] = {
163 { 166 {
164 .name = "Partition 1", 167 .name = "Partition 1",
165 .offset = 0, 168 .offset = 0,
166 .size = 256 * 1024, 169 .size = SZ_256K,
167 }, 170 },
168 { 171 {
169 .name = "Partition 2", 172 .name = "Partition 2",
170 .offset = 256 * 1024, 173 .offset = MTDPART_OFS_NXTBLK,
171 .size = MTDPART_SIZ_FULL, 174 .size = MTDPART_SIZ_FULL,
172 }, 175 },
173}; 176};
@@ -222,6 +225,73 @@ static struct gpio_led ek_leds[] = {
222 } 225 }
223}; 226};
224 227
228/*
229 * I2C devices
230 */
231static struct at24_platform_data at24c512 = {
232 .byte_len = SZ_512K / 8,
233 .page_size = 128,
234 .flags = AT24_FLAG_ADDR16,
235};
236
237static struct i2c_board_info __initdata ek_i2c_devices[] = {
238 {
239 I2C_BOARD_INFO("24c512", 0x50),
240 .platform_data = &at24c512,
241 },
242 /* more devices can be added using expansion connectors */
243};
244
245
246/*
247 * GPIO Buttons
248 */
249#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
250static struct gpio_keys_button ek_buttons[] = {
251 {
252 .gpio = AT91_PIN_PA30,
253 .code = BTN_3,
254 .desc = "Button 3",
255 .active_low = 1,
256 .wakeup = 1,
257 },
258 {
259 .gpio = AT91_PIN_PA31,
260 .code = BTN_4,
261 .desc = "Button 4",
262 .active_low = 1,
263 .wakeup = 1,
264 }
265};
266
267static struct gpio_keys_platform_data ek_button_data = {
268 .buttons = ek_buttons,
269 .nbuttons = ARRAY_SIZE(ek_buttons),
270};
271
272static struct platform_device ek_button_device = {
273 .name = "gpio-keys",
274 .id = -1,
275 .num_resources = 0,
276 .dev = {
277 .platform_data = &ek_button_data,
278 }
279};
280
281static void __init ek_add_device_buttons(void)
282{
283 at91_set_gpio_input(AT91_PIN_PA30, 1); /* btn3 */
284 at91_set_deglitch(AT91_PIN_PA30, 1);
285 at91_set_gpio_input(AT91_PIN_PA31, 1); /* btn4 */
286 at91_set_deglitch(AT91_PIN_PA31, 1);
287
288 platform_device_register(&ek_button_device);
289}
290#else
291static void __init ek_add_device_buttons(void) {}
292#endif
293
294
225static void __init ek_board_init(void) 295static void __init ek_board_init(void)
226{ 296{
227 /* Serial */ 297 /* Serial */
@@ -239,12 +309,14 @@ static void __init ek_board_init(void)
239 /* MMC */ 309 /* MMC */
240 at91_add_device_mmc(0, &ek_mmc_data); 310 at91_add_device_mmc(0, &ek_mmc_data);
241 /* I2C */ 311 /* I2C */
242 at91_add_device_i2c(NULL, 0); 312 at91_add_device_i2c(ek_i2c_devices, ARRAY_SIZE(ek_i2c_devices));
243 /* SSC (to AT73C213) */ 313 /* SSC (to AT73C213) */
244 at73c213_set_clk(&at73c213_data); 314 at73c213_set_clk(&at73c213_data);
245 at91_add_device_ssc(AT91SAM9260_ID_SSC, ATMEL_SSC_TX); 315 at91_add_device_ssc(AT91SAM9260_ID_SSC, ATMEL_SSC_TX);
246 /* LEDs */ 316 /* LEDs */
247 at91_gpio_leds(ek_leds, ARRAY_SIZE(ek_leds)); 317 at91_gpio_leds(ek_leds, ARRAY_SIZE(ek_leds));
318 /* Push Buttons */
319 ek_add_device_buttons();
248} 320}
249 321
250MACHINE_START(AT91SAM9260EK, "Atmel AT91SAM9260-EK") 322MACHINE_START(AT91SAM9260EK, "Atmel AT91SAM9260-EK")
diff --git a/arch/arm/mach-at91/board-sam9261ek.c b/arch/arm/mach-at91/board-sam9261ek.c
index 1a9963b811c7..4977409d4fc6 100644
--- a/arch/arm/mach-at91/board-sam9261ek.c
+++ b/arch/arm/mach-at91/board-sam9261ek.c
@@ -35,7 +35,6 @@
35 35
36#include <video/atmel_lcdc.h> 36#include <video/atmel_lcdc.h>
37 37
38#include <mach/hardware.h>
39#include <asm/setup.h> 38#include <asm/setup.h>
40#include <asm/mach-types.h> 39#include <asm/mach-types.h>
41#include <asm/irq.h> 40#include <asm/irq.h>
@@ -44,6 +43,7 @@
44#include <asm/mach/map.h> 43#include <asm/mach/map.h>
45#include <asm/mach/irq.h> 44#include <asm/mach/irq.h>
46 45
46#include <mach/hardware.h>
47#include <mach/board.h> 47#include <mach/board.h>
48#include <mach/gpio.h> 48#include <mach/gpio.h>
49#include <mach/at91sam9_smc.h> 49#include <mach/at91sam9_smc.h>
@@ -168,11 +168,11 @@ static struct mtd_partition __initdata ek_nand_partition[] = {
168 { 168 {
169 .name = "Partition 1", 169 .name = "Partition 1",
170 .offset = 0, 170 .offset = 0,
171 .size = 256 * 1024, 171 .size = SZ_256K,
172 }, 172 },
173 { 173 {
174 .name = "Partition 2", 174 .name = "Partition 2",
175 .offset = 256 * 1024 , 175 .offset = MTDPART_OFS_NXTBLK,
176 .size = MTDPART_SIZ_FULL, 176 .size = MTDPART_SIZ_FULL,
177 }, 177 },
178}; 178};
@@ -435,24 +435,28 @@ static struct gpio_keys_button ek_buttons[] = {
435 .code = BTN_0, 435 .code = BTN_0,
436 .desc = "Button 0", 436 .desc = "Button 0",
437 .active_low = 1, 437 .active_low = 1,
438 .wakeup = 1,
438 }, 439 },
439 { 440 {
440 .gpio = AT91_PIN_PA26, 441 .gpio = AT91_PIN_PA26,
441 .code = BTN_1, 442 .code = BTN_1,
442 .desc = "Button 1", 443 .desc = "Button 1",
443 .active_low = 1, 444 .active_low = 1,
445 .wakeup = 1,
444 }, 446 },
445 { 447 {
446 .gpio = AT91_PIN_PA25, 448 .gpio = AT91_PIN_PA25,
447 .code = BTN_2, 449 .code = BTN_2,
448 .desc = "Button 2", 450 .desc = "Button 2",
449 .active_low = 1, 451 .active_low = 1,
452 .wakeup = 1,
450 }, 453 },
451 { 454 {
452 .gpio = AT91_PIN_PA24, 455 .gpio = AT91_PIN_PA24,
453 .code = BTN_3, 456 .code = BTN_3,
454 .desc = "Button 3", 457 .desc = "Button 3",
455 .active_low = 1, 458 .active_low = 1,
459 .wakeup = 1,
456 } 460 }
457}; 461};
458 462
@@ -472,13 +476,13 @@ static struct platform_device ek_button_device = {
472 476
473static void __init ek_add_device_buttons(void) 477static void __init ek_add_device_buttons(void)
474{ 478{
475 at91_set_gpio_input(AT91_PIN_PA27, 0); /* btn0 */ 479 at91_set_gpio_input(AT91_PIN_PA27, 1); /* btn0 */
476 at91_set_deglitch(AT91_PIN_PA27, 1); 480 at91_set_deglitch(AT91_PIN_PA27, 1);
477 at91_set_gpio_input(AT91_PIN_PA26, 0); /* btn1 */ 481 at91_set_gpio_input(AT91_PIN_PA26, 1); /* btn1 */
478 at91_set_deglitch(AT91_PIN_PA26, 1); 482 at91_set_deglitch(AT91_PIN_PA26, 1);
479 at91_set_gpio_input(AT91_PIN_PA25, 0); /* btn2 */ 483 at91_set_gpio_input(AT91_PIN_PA25, 1); /* btn2 */
480 at91_set_deglitch(AT91_PIN_PA25, 1); 484 at91_set_deglitch(AT91_PIN_PA25, 1);
481 at91_set_gpio_input(AT91_PIN_PA24, 0); /* btn3 */ 485 at91_set_gpio_input(AT91_PIN_PA24, 1); /* btn3 */
482 at91_set_deglitch(AT91_PIN_PA24, 1); 486 at91_set_deglitch(AT91_PIN_PA24, 1);
483 487
484 platform_device_register(&ek_button_device); 488 platform_device_register(&ek_button_device);
diff --git a/arch/arm/mach-at91/board-sam9263ek.c b/arch/arm/mach-at91/board-sam9263ek.c
index b1d11960a735..8354015c6a23 100644
--- a/arch/arm/mach-at91/board-sam9263ek.c
+++ b/arch/arm/mach-at91/board-sam9263ek.c
@@ -26,13 +26,14 @@
26#include <linux/platform_device.h> 26#include <linux/platform_device.h>
27#include <linux/spi/spi.h> 27#include <linux/spi/spi.h>
28#include <linux/spi/ads7846.h> 28#include <linux/spi/ads7846.h>
29#include <linux/i2c/at24.h>
29#include <linux/fb.h> 30#include <linux/fb.h>
30#include <linux/gpio_keys.h> 31#include <linux/gpio_keys.h>
31#include <linux/input.h> 32#include <linux/input.h>
33#include <linux/leds.h>
32 34
33#include <video/atmel_lcdc.h> 35#include <video/atmel_lcdc.h>
34 36
35#include <mach/hardware.h>
36#include <asm/setup.h> 37#include <asm/setup.h>
37#include <asm/mach-types.h> 38#include <asm/mach-types.h>
38#include <asm/irq.h> 39#include <asm/irq.h>
@@ -41,6 +42,7 @@
41#include <asm/mach/map.h> 42#include <asm/mach/map.h>
42#include <asm/mach/irq.h> 43#include <asm/mach/irq.h>
43 44
45#include <mach/hardware.h>
44#include <mach/board.h> 46#include <mach/board.h>
45#include <mach/gpio.h> 47#include <mach/gpio.h>
46#include <mach/at91sam9_smc.h> 48#include <mach/at91sam9_smc.h>
@@ -172,11 +174,11 @@ static struct mtd_partition __initdata ek_nand_partition[] = {
172 { 174 {
173 .name = "Partition 1", 175 .name = "Partition 1",
174 .offset = 0, 176 .offset = 0,
175 .size = 64 * 1024 * 1024, 177 .size = SZ_64M,
176 }, 178 },
177 { 179 {
178 .name = "Partition 2", 180 .name = "Partition 2",
179 .offset = 64 * 1024 * 1024, 181 .offset = MTDPART_OFS_NXTBLK,
180 .size = MTDPART_SIZ_FULL, 182 .size = MTDPART_SIZ_FULL,
181 }, 183 },
182}; 184};
@@ -203,12 +205,30 @@ static struct atmel_nand_data __initdata ek_nand_data = {
203 205
204 206
205/* 207/*
208 * I2C devices
209 */
210static struct at24_platform_data at24c512 = {
211 .byte_len = SZ_512K / 8,
212 .page_size = 128,
213 .flags = AT24_FLAG_ADDR16,
214};
215
216
217static struct i2c_board_info __initdata ek_i2c_devices[] = {
218 {
219 I2C_BOARD_INFO("24c512", 0x50),
220 .platform_data = &at24c512,
221 },
222 /* more devices can be added using expansion connectors */
223};
224
225/*
206 * LCD Controller 226 * LCD Controller
207 */ 227 */
208#if defined(CONFIG_FB_ATMEL) || defined(CONFIG_FB_ATMEL_MODULE) 228#if defined(CONFIG_FB_ATMEL) || defined(CONFIG_FB_ATMEL_MODULE)
209static struct fb_videomode at91_tft_vga_modes[] = { 229static struct fb_videomode at91_tft_vga_modes[] = {
210 { 230 {
211 .name = "TX09D50VM1CCA @ 60", 231 .name = "TX09D50VM1CCA @ 60",
212 .refresh = 60, 232 .refresh = 60,
213 .xres = 240, .yres = 320, 233 .xres = 240, .yres = 320,
214 .pixclock = KHZ2PICOS(4965), 234 .pixclock = KHZ2PICOS(4965),
@@ -224,7 +244,7 @@ static struct fb_videomode at91_tft_vga_modes[] = {
224 244
225static struct fb_monspecs at91fb_default_monspecs = { 245static struct fb_monspecs at91fb_default_monspecs = {
226 .manufacturer = "HIT", 246 .manufacturer = "HIT",
227 .monitor = "TX09D70VM1CCA", 247 .monitor = "TX09D70VM1CCA",
228 248
229 .modedb = at91_tft_vga_modes, 249 .modedb = at91_tft_vga_modes,
230 .modedb_len = ARRAY_SIZE(at91_tft_vga_modes), 250 .modedb_len = ARRAY_SIZE(at91_tft_vga_modes),
@@ -235,7 +255,7 @@ static struct fb_monspecs at91fb_default_monspecs = {
235}; 255};
236 256
237#define AT91SAM9263_DEFAULT_LCDCON2 (ATMEL_LCDC_MEMOR_LITTLE \ 257#define AT91SAM9263_DEFAULT_LCDCON2 (ATMEL_LCDC_MEMOR_LITTLE \
238 | ATMEL_LCDC_DISTYPE_TFT \ 258 | ATMEL_LCDC_DISTYPE_TFT \
239 | ATMEL_LCDC_CLKMOD_ALWAYSACTIVE) 259 | ATMEL_LCDC_CLKMOD_ALWAYSACTIVE)
240 260
241static void at91_lcdc_power_control(int on) 261static void at91_lcdc_power_control(int on)
@@ -277,7 +297,7 @@ static struct gpio_keys_button ek_buttons[] = {
277 .active_low = 1, 297 .active_low = 1,
278 .desc = "right_click", 298 .desc = "right_click",
279 .wakeup = 1, 299 .wakeup = 1,
280 }, 300 }
281}; 301};
282 302
283static struct gpio_keys_platform_data ek_button_data = { 303static struct gpio_keys_platform_data ek_button_data = {
@@ -296,9 +316,9 @@ static struct platform_device ek_button_device = {
296 316
297static void __init ek_add_device_buttons(void) 317static void __init ek_add_device_buttons(void)
298{ 318{
299 at91_set_GPIO_periph(AT91_PIN_PC5, 0); /* left button */ 319 at91_set_GPIO_periph(AT91_PIN_PC5, 1); /* left button */
300 at91_set_deglitch(AT91_PIN_PC5, 1); 320 at91_set_deglitch(AT91_PIN_PC5, 1);
301 at91_set_GPIO_periph(AT91_PIN_PC4, 0); /* right button */ 321 at91_set_GPIO_periph(AT91_PIN_PC4, 1); /* right button */
302 at91_set_deglitch(AT91_PIN_PC4, 1); 322 at91_set_deglitch(AT91_PIN_PC4, 1);
303 323
304 platform_device_register(&ek_button_device); 324 platform_device_register(&ek_button_device);
@@ -320,25 +340,32 @@ static struct atmel_ac97_data ek_ac97_data = {
320 * LEDs ... these could all be PWM-driven, for variable brightness 340 * LEDs ... these could all be PWM-driven, for variable brightness
321 */ 341 */
322static struct gpio_led ek_leds[] = { 342static struct gpio_led ek_leds[] = {
323 { /* "left" led, green, userled1, pwm1 */ 343 { /* "right" led, green, userled2 (could be driven by pwm2) */
324 .name = "ds1",
325 .gpio = AT91_PIN_PB8,
326 .active_low = 1,
327 .default_trigger = "mmc0",
328 },
329 { /* "right" led, green, userled2, pwm2 */
330 .name = "ds2", 344 .name = "ds2",
331 .gpio = AT91_PIN_PC29, 345 .gpio = AT91_PIN_PC29,
332 .active_low = 1, 346 .active_low = 1,
333 .default_trigger = "nand-disk", 347 .default_trigger = "nand-disk",
334 }, 348 },
335 { /* "power" led, yellow, pwm0 */ 349 { /* "power" led, yellow (could be driven by pwm0) */
336 .name = "ds3", 350 .name = "ds3",
337 .gpio = AT91_PIN_PB7, 351 .gpio = AT91_PIN_PB7,
338 .default_trigger = "heartbeat", 352 .default_trigger = "heartbeat",
339 } 353 }
340}; 354};
341 355
356/*
357 * PWM Leds
358 */
359static struct gpio_led ek_pwm_led[] = {
360 /* For now only DS1 is PWM-driven (by pwm1) */
361 {
362 .name = "ds1",
363 .gpio = 1, /* is PWM channel number */
364 .active_low = 1,
365 .default_trigger = "none",
366 }
367};
368
342 369
343static void __init ek_board_init(void) 370static void __init ek_board_init(void)
344{ 371{
@@ -360,7 +387,7 @@ static void __init ek_board_init(void)
360 /* NAND */ 387 /* NAND */
361 at91_add_device_nand(&ek_nand_data); 388 at91_add_device_nand(&ek_nand_data);
362 /* I2C */ 389 /* I2C */
363 at91_add_device_i2c(NULL, 0); 390 at91_add_device_i2c(ek_i2c_devices, ARRAY_SIZE(ek_i2c_devices));
364 /* LCD Controller */ 391 /* LCD Controller */
365 at91_add_device_lcdc(&ek_lcdc_data); 392 at91_add_device_lcdc(&ek_lcdc_data);
366 /* Push Buttons */ 393 /* Push Buttons */
@@ -369,6 +396,7 @@ static void __init ek_board_init(void)
369 at91_add_device_ac97(&ek_ac97_data); 396 at91_add_device_ac97(&ek_ac97_data);
370 /* LEDs */ 397 /* LEDs */
371 at91_gpio_leds(ek_leds, ARRAY_SIZE(ek_leds)); 398 at91_gpio_leds(ek_leds, ARRAY_SIZE(ek_leds));
399 at91_pwm_leds(ek_pwm_led, ARRAY_SIZE(ek_pwm_led));
372} 400}
373 401
374MACHINE_START(AT91SAM9263EK, "Atmel AT91SAM9263-EK") 402MACHINE_START(AT91SAM9263EK, "Atmel AT91SAM9263-EK")
diff --git a/arch/arm/mach-at91/board-sam9g20ek.c b/arch/arm/mach-at91/board-sam9g20ek.c
index d4eba5c0ce02..b588ead14d68 100644
--- a/arch/arm/mach-at91/board-sam9g20ek.c
+++ b/arch/arm/mach-at91/board-sam9g20ek.c
@@ -122,16 +122,16 @@ static struct mtd_partition __initdata ek_nand_partition[] = {
122 { 122 {
123 .name = "Bootstrap", 123 .name = "Bootstrap",
124 .offset = 0, 124 .offset = 0,
125 .size = 4 * 1024 * 1024, 125 .size = 4 * SZ_1M,
126 }, 126 },
127 { 127 {
128 .name = "Partition 1", 128 .name = "Partition 1",
129 .offset = 4 * 1024 * 1024, 129 .offset = MTDPART_OFS_NXTBLK,
130 .size = 60 * 1024 * 1024, 130 .size = 60 * SZ_1M,
131 }, 131 },
132 { 132 {
133 .name = "Partition 2", 133 .name = "Partition 2",
134 .offset = 64 * 1024 * 1024, 134 .offset = MTDPART_OFS_NXTBLK,
135 .size = MTDPART_SIZ_FULL, 135 .size = MTDPART_SIZ_FULL,
136 }, 136 },
137}; 137};
diff --git a/arch/arm/mach-at91/board-sam9rlek.c b/arch/arm/mach-at91/board-sam9rlek.c
index c6dce49c388c..270851864308 100644
--- a/arch/arm/mach-at91/board-sam9rlek.c
+++ b/arch/arm/mach-at91/board-sam9rlek.c
@@ -18,7 +18,6 @@
18 18
19#include <video/atmel_lcdc.h> 19#include <video/atmel_lcdc.h>
20 20
21#include <mach/hardware.h>
22#include <asm/setup.h> 21#include <asm/setup.h>
23#include <asm/mach-types.h> 22#include <asm/mach-types.h>
24#include <asm/irq.h> 23#include <asm/irq.h>
@@ -27,6 +26,7 @@
27#include <asm/mach/map.h> 26#include <asm/mach/map.h>
28#include <asm/mach/irq.h> 27#include <asm/mach/irq.h>
29 28
29#include <mach/hardware.h>
30#include <mach/board.h> 30#include <mach/board.h>
31#include <mach/gpio.h> 31#include <mach/gpio.h>
32#include <mach/at91sam9_smc.h> 32#include <mach/at91sam9_smc.h>
@@ -81,11 +81,11 @@ static struct mtd_partition __initdata ek_nand_partition[] = {
81 { 81 {
82 .name = "Partition 1", 82 .name = "Partition 1",
83 .offset = 0, 83 .offset = 0,
84 .size = 256 * 1024, 84 .size = SZ_256K,
85 }, 85 },
86 { 86 {
87 .name = "Partition 2", 87 .name = "Partition 2",
88 .offset = 256 * 1024 , 88 .offset = MTDPART_OFS_NXTBLK,
89 .size = MTDPART_SIZ_FULL, 89 .size = MTDPART_SIZ_FULL,
90 }, 90 },
91}; 91};
@@ -195,6 +195,8 @@ static void __init ek_board_init(void)
195 at91_add_device_mmc(0, &ek_mmc_data); 195 at91_add_device_mmc(0, &ek_mmc_data);
196 /* LCD Controller */ 196 /* LCD Controller */
197 at91_add_device_lcdc(&ek_lcdc_data); 197 at91_add_device_lcdc(&ek_lcdc_data);
198 /* Touch Screen Controller */
199 at91_add_device_tsadcc();
198} 200}
199 201
200MACHINE_START(AT91SAM9RLEK, "Atmel AT91SAM9RL-EK") 202MACHINE_START(AT91SAM9RLEK, "Atmel AT91SAM9RL-EK")
diff --git a/arch/arm/mach-at91/board-usb-a9260.c b/arch/arm/mach-at91/board-usb-a9260.c
index f9d0b65da40b..7c350357333a 100644
--- a/arch/arm/mach-at91/board-usb-a9260.c
+++ b/arch/arm/mach-at91/board-usb-a9260.c
@@ -30,7 +30,6 @@
30#include <linux/input.h> 30#include <linux/input.h>
31#include <linux/clk.h> 31#include <linux/clk.h>
32 32
33#include <mach/hardware.h>
34#include <asm/setup.h> 33#include <asm/setup.h>
35#include <asm/mach-types.h> 34#include <asm/mach-types.h>
36#include <asm/irq.h> 35#include <asm/irq.h>
@@ -39,6 +38,7 @@
39#include <asm/mach/map.h> 38#include <asm/mach/map.h>
40#include <asm/mach/irq.h> 39#include <asm/mach/irq.h>
41 40
41#include <mach/hardware.h>
42#include <mach/board.h> 42#include <mach/board.h>
43#include <mach/gpio.h> 43#include <mach/gpio.h>
44#include <mach/at91_shdwc.h> 44#include <mach/at91_shdwc.h>
@@ -93,18 +93,18 @@ static struct at91_eth_data __initdata ek_macb_data = {
93static struct mtd_partition __initdata ek_nand_partition[] = { 93static struct mtd_partition __initdata ek_nand_partition[] = {
94 { 94 {
95 .name = "Uboot & Kernel", 95 .name = "Uboot & Kernel",
96 .offset = 0x00000000, 96 .offset = 0,
97 .size = 16 * 1024 * 1024, 97 .size = SZ_16M,
98 }, 98 },
99 { 99 {
100 .name = "Root FS", 100 .name = "Root FS",
101 .offset = 0x01000000, 101 .offset = MTDPART_OFS_NXTBLK,
102 .size = 120 * 1024 * 1024, 102 .size = 120 * SZ_1M,
103 }, 103 },
104 { 104 {
105 .name = "FS", 105 .name = "FS",
106 .offset = 0x08800000, 106 .offset = MTDPART_OFS_NXTBLK,
107 .size = 120 * 1024 * 1024, 107 .size = 120 * SZ_1M,
108 } 108 }
109}; 109};
110 110
diff --git a/arch/arm/mach-at91/board-usb-a9263.c b/arch/arm/mach-at91/board-usb-a9263.c
index 673e5c27214d..391b566c4571 100644
--- a/arch/arm/mach-at91/board-usb-a9263.c
+++ b/arch/arm/mach-at91/board-usb-a9263.c
@@ -29,7 +29,6 @@
29#include <linux/gpio_keys.h> 29#include <linux/gpio_keys.h>
30#include <linux/input.h> 30#include <linux/input.h>
31 31
32#include <mach/hardware.h>
33#include <asm/setup.h> 32#include <asm/setup.h>
34#include <asm/mach-types.h> 33#include <asm/mach-types.h>
35#include <asm/irq.h> 34#include <asm/irq.h>
@@ -38,6 +37,7 @@
38#include <asm/mach/map.h> 37#include <asm/mach/map.h>
39#include <asm/mach/irq.h> 38#include <asm/mach/irq.h>
40 39
40#include <mach/hardware.h>
41#include <mach/board.h> 41#include <mach/board.h>
42#include <mach/gpio.h> 42#include <mach/gpio.h>
43#include <mach/at91_shdwc.h> 43#include <mach/at91_shdwc.h>
@@ -106,18 +106,18 @@ static struct at91_eth_data __initdata ek_macb_data = {
106static struct mtd_partition __initdata ek_nand_partition[] = { 106static struct mtd_partition __initdata ek_nand_partition[] = {
107 { 107 {
108 .name = "Linux Kernel", 108 .name = "Linux Kernel",
109 .offset = 0x00000000, 109 .offset = 0,
110 .size = 16 * 1024 * 1024, 110 .size = SZ_16M,
111 }, 111 },
112 { 112 {
113 .name = "Root FS", 113 .name = "Root FS",
114 .offset = 0x01000000, 114 .offset = MTDPART_OFS_NXTBLK,
115 .size = 120 * 1024 * 1024, 115 .size = 120 * SZ_1M,
116 }, 116 },
117 { 117 {
118 .name = "FS", 118 .name = "FS",
119 .offset = 0x08800000, 119 .offset = MTDPART_OFS_NXTBLK,
120 .size = 120 * 1024 * 1024, 120 .size = 120 * SZ_1M,
121 } 121 }
122}; 122};
123 123
diff --git a/arch/arm/mach-at91/board-yl-9200.c b/arch/arm/mach-at91/board-yl-9200.c
index 36b380aad006..e22bf051f835 100644
--- a/arch/arm/mach-at91/board-yl-9200.c
+++ b/arch/arm/mach-at91/board-yl-9200.c
@@ -33,7 +33,6 @@
33#include <linux/gpio_keys.h> 33#include <linux/gpio_keys.h>
34#include <linux/input.h> 34#include <linux/input.h>
35 35
36#include <mach/hardware.h>
37#include <asm/setup.h> 36#include <asm/setup.h>
38#include <asm/mach-types.h> 37#include <asm/mach-types.h>
39#include <asm/irq.h> 38#include <asm/irq.h>
@@ -42,6 +41,7 @@
42#include <asm/mach/map.h> 41#include <asm/mach/map.h>
43#include <asm/mach/irq.h> 42#include <asm/mach/irq.h>
44 43
44#include <mach/hardware.h>
45#include <mach/board.h> 45#include <mach/board.h>
46#include <mach/gpio.h> 46#include <mach/gpio.h>
47#include <mach/at91rm9200_mc.h> 47#include <mach/at91rm9200_mc.h>
@@ -150,27 +150,27 @@ static struct mtd_partition __initdata yl9200_nand_partition[] = {
150 { 150 {
151 .name = "AT91 NAND partition 1, boot", 151 .name = "AT91 NAND partition 1, boot",
152 .offset = 0, 152 .offset = 0,
153 .size = 1 * SZ_256K 153 .size = SZ_256K
154 }, 154 },
155 { 155 {
156 .name = "AT91 NAND partition 2, kernel", 156 .name = "AT91 NAND partition 2, kernel",
157 .offset = 1 * SZ_256K, 157 .offset = MTDPART_OFS_NXTBLK,
158 .size = 2 * SZ_1M - 1 * SZ_256K 158 .size = (2 * SZ_1M) - SZ_256K
159 }, 159 },
160 { 160 {
161 .name = "AT91 NAND partition 3, filesystem", 161 .name = "AT91 NAND partition 3, filesystem",
162 .offset = 2 * SZ_1M, 162 .offset = MTDPART_OFS_NXTBLK,
163 .size = 14 * SZ_1M 163 .size = 14 * SZ_1M
164 }, 164 },
165 { 165 {
166 .name = "AT91 NAND partition 4, storage", 166 .name = "AT91 NAND partition 4, storage",
167 .offset = 16 * SZ_1M, 167 .offset = MTDPART_OFS_NXTBLK,
168 .size = 16 * SZ_1M 168 .size = SZ_16M
169 }, 169 },
170 { 170 {
171 .name = "AT91 NAND partition 5, ext-fs", 171 .name = "AT91 NAND partition 5, ext-fs",
172 .offset = 32 * SZ_1M, 172 .offset = MTDPART_OFS_NXTBLK,
173 .size = 32 * SZ_1M 173 .size = SZ_32M
174 } 174 }
175}; 175};
176 176
@@ -193,24 +193,24 @@ static struct atmel_nand_data __initdata yl9200_nand_data = {
193 * NOR Flash 193 * NOR Flash
194 */ 194 */
195#define YL9200_FLASH_BASE AT91_CHIPSELECT_0 195#define YL9200_FLASH_BASE AT91_CHIPSELECT_0
196#define YL9200_FLASH_SIZE 0x1000000 196#define YL9200_FLASH_SIZE SZ_16M
197 197
198static struct mtd_partition yl9200_flash_partitions[] = { 198static struct mtd_partition yl9200_flash_partitions[] = {
199 { 199 {
200 .name = "Bootloader", 200 .name = "Bootloader",
201 .size = 0x00040000,
202 .offset = 0, 201 .offset = 0,
202 .size = SZ_256K,
203 .mask_flags = MTD_WRITEABLE, /* force read-only */ 203 .mask_flags = MTD_WRITEABLE, /* force read-only */
204 }, 204 },
205 { 205 {
206 .name = "Kernel", 206 .name = "Kernel",
207 .size = 0x001C0000, 207 .offset = MTDPART_OFS_NXTBLK,
208 .offset = 0x00040000, 208 .size = (2 * SZ_1M) - SZ_256K
209 }, 209 },
210 { 210 {
211 .name = "Filesystem", 211 .name = "Filesystem",
212 .size = MTDPART_SIZ_FULL, 212 .offset = MTDPART_OFS_NXTBLK,
213 .offset = 0x00200000 213 .size = MTDPART_SIZ_FULL
214 } 214 }
215}; 215};
216 216
@@ -390,10 +390,6 @@ static struct spi_board_info yl9200_spi_devices[] = {
390#if defined(CONFIG_FB_S1D135XX) || defined(CONFIG_FB_S1D13XXX_MODULE) 390#if defined(CONFIG_FB_S1D135XX) || defined(CONFIG_FB_S1D13XXX_MODULE)
391#include <video/s1d13xxxfb.h> 391#include <video/s1d13xxxfb.h>
392 392
393#define AT91_FB_REG_BASE 0x80000000L
394#define AT91_FB_REG_SIZE 0x200
395#define AT91_FB_VMEM_BASE 0x80200000L
396#define AT91_FB_VMEM_SIZE 0x200000L
397 393
398static void __init yl9200_init_video(void) 394static void __init yl9200_init_video(void)
399{ 395{
@@ -516,29 +512,33 @@ static struct s1d13xxxfb_regval yl9200_s1dfb_initregs[] =
516 {S1DREG_COM_DISP_MODE, 0x01}, /* Display Mode Register, LCD only*/ 512 {S1DREG_COM_DISP_MODE, 0x01}, /* Display Mode Register, LCD only*/
517}; 513};
518 514
519static u64 s1dfb_dmamask = DMA_BIT_MASK(32);
520
521static struct s1d13xxxfb_pdata yl9200_s1dfb_pdata = { 515static struct s1d13xxxfb_pdata yl9200_s1dfb_pdata = {
522 .initregs = yl9200_s1dfb_initregs, 516 .initregs = yl9200_s1dfb_initregs,
523 .initregssize = ARRAY_SIZE(yl9200_s1dfb_initregs), 517 .initregssize = ARRAY_SIZE(yl9200_s1dfb_initregs),
524 .platform_init_video = yl9200_init_video, 518 .platform_init_video = yl9200_init_video,
525}; 519};
526 520
521#define YL9200_FB_REG_BASE AT91_CHIPSELECT_7
522#define YL9200_FB_VMEM_BASE YL9200_FB_REG_BASE + SZ_2M
523#define YL9200_FB_VMEM_SIZE SZ_2M
524
527static struct resource yl9200_s1dfb_resource[] = { 525static struct resource yl9200_s1dfb_resource[] = {
528 [0] = { /* video mem */ 526 [0] = { /* video mem */
529 .name = "s1d13xxxfb memory", 527 .name = "s1d13xxxfb memory",
530 .start = AT91_FB_VMEM_BASE, 528 .start = YL9200_FB_VMEM_BASE,
531 .end = AT91_FB_VMEM_BASE + AT91_FB_VMEM_SIZE -1, 529 .end = YL9200_FB_VMEM_BASE + YL9200_FB_VMEM_SIZE -1,
532 .flags = IORESOURCE_MEM, 530 .flags = IORESOURCE_MEM,
533 }, 531 },
534 [1] = { /* video registers */ 532 [1] = { /* video registers */
535 .name = "s1d13xxxfb registers", 533 .name = "s1d13xxxfb registers",
536 .start = AT91_FB_REG_BASE, 534 .start = YL9200_FB_REG_BASE,
537 .end = AT91_FB_REG_BASE + AT91_FB_REG_SIZE -1, 535 .end = YL9200_FB_REG_BASE + SZ_512 -1,
538 .flags = IORESOURCE_MEM, 536 .flags = IORESOURCE_MEM,
539 }, 537 },
540}; 538};
541 539
540static u64 s1dfb_dmamask = DMA_BIT_MASK(32);
541
542static struct platform_device yl9200_s1dfb_device = { 542static struct platform_device yl9200_s1dfb_device = {
543 .name = "s1d13806fb", 543 .name = "s1d13806fb",
544 .id = -1, 544 .id = -1,
diff --git a/arch/arm/mach-at91/include/mach/at91_pit.h b/arch/arm/mach-at91/include/mach/at91_pit.h
index 0448ac36eadb..974d0bd05b5b 100644
--- a/arch/arm/mach-at91/include/mach/at91_pit.h
+++ b/arch/arm/mach-at91/include/mach/at91_pit.h
@@ -1,6 +1,9 @@
1/* 1/*
2 * arch/arm/mach-at91/include/mach/at91_pit.h 2 * arch/arm/mach-at91/include/mach/at91_pit.h
3 * 3 *
4 * Copyright (C) 2007 Andrew Victor
5 * Copyright (C) 2007 Atmel Corporation.
6 *
4 * Periodic Interval Timer (PIT) - System peripherals regsters. 7 * Periodic Interval Timer (PIT) - System peripherals regsters.
5 * Based on AT91SAM9261 datasheet revision D. 8 * Based on AT91SAM9261 datasheet revision D.
6 * 9 *
diff --git a/arch/arm/mach-at91/include/mach/at91_rstc.h b/arch/arm/mach-at91/include/mach/at91_rstc.h
index 7cd1b39aaa43..cbd2bf052c1f 100644
--- a/arch/arm/mach-at91/include/mach/at91_rstc.h
+++ b/arch/arm/mach-at91/include/mach/at91_rstc.h
@@ -1,6 +1,9 @@
1/* 1/*
2 * arch/arm/mach-at91/include/mach/at91_rstc.h 2 * arch/arm/mach-at91/include/mach/at91_rstc.h
3 * 3 *
4 * Copyright (C) 2007 Andrew Victor
5 * Copyright (C) 2007 Atmel Corporation.
6 *
4 * Reset Controller (RSTC) - System peripherals regsters. 7 * Reset Controller (RSTC) - System peripherals regsters.
5 * Based on AT91SAM9261 datasheet revision D. 8 * Based on AT91SAM9261 datasheet revision D.
6 * 9 *
diff --git a/arch/arm/mach-at91/include/mach/at91_rtt.h b/arch/arm/mach-at91/include/mach/at91_rtt.h
index 71782e5d2159..7ec75de8bbb6 100644
--- a/arch/arm/mach-at91/include/mach/at91_rtt.h
+++ b/arch/arm/mach-at91/include/mach/at91_rtt.h
@@ -1,6 +1,9 @@
1/* 1/*
2 * arch/arm/mach-at91/include/mach/at91_rtt.h 2 * arch/arm/mach-at91/include/mach/at91_rtt.h
3 * 3 *
4 * Copyright (C) 2007 Andrew Victor
5 * Copyright (C) 2007 Atmel Corporation.
6 *
4 * Real-time Timer (RTT) - System peripherals regsters. 7 * Real-time Timer (RTT) - System peripherals regsters.
5 * Based on AT91SAM9261 datasheet revision D. 8 * Based on AT91SAM9261 datasheet revision D.
6 * 9 *
diff --git a/arch/arm/mach-at91/include/mach/at91_shdwc.h b/arch/arm/mach-at91/include/mach/at91_shdwc.h
index 60be5ae624f1..c4ce07e8a8fa 100644
--- a/arch/arm/mach-at91/include/mach/at91_shdwc.h
+++ b/arch/arm/mach-at91/include/mach/at91_shdwc.h
@@ -1,6 +1,9 @@
1/* 1/*
2 * arch/arm/mach-at91/include/mach/at91_shdwc.h 2 * arch/arm/mach-at91/include/mach/at91_shdwc.h
3 * 3 *
4 * Copyright (C) 2007 Andrew Victor
5 * Copyright (C) 2007 Atmel Corporation.
6 *
4 * Shutdown Controller (SHDWC) - System peripherals regsters. 7 * Shutdown Controller (SHDWC) - System peripherals regsters.
5 * Based on AT91SAM9261 datasheet revision D. 8 * Based on AT91SAM9261 datasheet revision D.
6 * 9 *
diff --git a/arch/arm/mach-at91/include/mach/at91_wdt.h b/arch/arm/mach-at91/include/mach/at91_wdt.h
index 973b4526a98e..fecc2e9f0ca8 100644
--- a/arch/arm/mach-at91/include/mach/at91_wdt.h
+++ b/arch/arm/mach-at91/include/mach/at91_wdt.h
@@ -1,6 +1,9 @@
1/* 1/*
2 * arch/arm/mach-at91/include/mach/at91_wdt.h 2 * arch/arm/mach-at91/include/mach/at91_wdt.h
3 * 3 *
4 * Copyright (C) 2007 Andrew Victor
5 * Copyright (C) 2007 Atmel Corporation.
6 *
4 * Watchdog Timer (WDT) - System peripherals regsters. 7 * Watchdog Timer (WDT) - System peripherals regsters.
5 * Based on AT91SAM9261 datasheet revision D. 8 * Based on AT91SAM9261 datasheet revision D.
6 * 9 *
diff --git a/arch/arm/mach-at91/include/mach/at91cap9_ddrsdr.h b/arch/arm/mach-at91/include/mach/at91cap9_ddrsdr.h
index bca878f3bd87..1499b1cbffdd 100644
--- a/arch/arm/mach-at91/include/mach/at91cap9_ddrsdr.h
+++ b/arch/arm/mach-at91/include/mach/at91cap9_ddrsdr.h
@@ -1,6 +1,8 @@
1/* 1/*
2 * arch/arm/mach-at91/include/mach/at91cap9_ddrsdr.h 2 * arch/arm/mach-at91/include/mach/at91cap9_ddrsdr.h
3 * 3 *
4 * (C) 2008 Andrew Victor
5 *
4 * DDR/SDR Controller (DDRSDRC) - System peripherals registers. 6 * DDR/SDR Controller (DDRSDRC) - System peripherals registers.
5 * Based on AT91CAP9 datasheet revision B. 7 * Based on AT91CAP9 datasheet revision B.
6 * 8 *
diff --git a/arch/arm/mach-at91/include/mach/at91sam9260_matrix.h b/arch/arm/mach-at91/include/mach/at91sam9260_matrix.h
index f027de5df956..020f02ed921a 100644
--- a/arch/arm/mach-at91/include/mach/at91sam9260_matrix.h
+++ b/arch/arm/mach-at91/include/mach/at91sam9260_matrix.h
@@ -1,6 +1,8 @@
1/* 1/*
2 * arch/arm/mach-at91/include/mach/at91sam9260_matrix.h 2 * arch/arm/mach-at91/include/mach/at91sam9260_matrix.h
3 * 3 *
4 * Copyright (C) 2007 Atmel Corporation.
5 *
4 * Memory Controllers (MATRIX, EBI) - System peripherals registers. 6 * Memory Controllers (MATRIX, EBI) - System peripherals registers.
5 * Based on AT91SAM9260 datasheet revision B. 7 * Based on AT91SAM9260 datasheet revision B.
6 * 8 *
diff --git a/arch/arm/mach-at91/include/mach/at91sam9261_matrix.h b/arch/arm/mach-at91/include/mach/at91sam9261_matrix.h
index db62b1f18300..69c6501915d9 100644
--- a/arch/arm/mach-at91/include/mach/at91sam9261_matrix.h
+++ b/arch/arm/mach-at91/include/mach/at91sam9261_matrix.h
@@ -1,6 +1,8 @@
1/* 1/*
2 * arch/arm/mach-at91/include/mach/at91sam9261_matrix.h 2 * arch/arm/mach-at91/include/mach/at91sam9261_matrix.h
3 * 3 *
4 * Copyright (C) 2007 Atmel Corporation.
5 *
4 * Memory Controllers (MATRIX, EBI) - System peripherals registers. 6 * Memory Controllers (MATRIX, EBI) - System peripherals registers.
5 * Based on AT91SAM9261 datasheet revision D. 7 * Based on AT91SAM9261 datasheet revision D.
6 * 8 *
diff --git a/arch/arm/mach-at91/include/mach/at91sam9_sdramc.h b/arch/arm/mach-at91/include/mach/at91sam9_sdramc.h
index 1921181c63ca..b7260389f7ca 100644
--- a/arch/arm/mach-at91/include/mach/at91sam9_sdramc.h
+++ b/arch/arm/mach-at91/include/mach/at91sam9_sdramc.h
@@ -1,6 +1,9 @@
1/* 1/*
2 * arch/arm/mach-at91/include/mach/at91sam9_sdramc.h 2 * arch/arm/mach-at91/include/mach/at91sam9_sdramc.h
3 * 3 *
4 * Copyright (C) 2007 Andrew Victor
5 * Copyright (C) 2007 Atmel Corporation.
6 *
4 * SDRAM Controllers (SDRAMC) - System peripherals registers. 7 * SDRAM Controllers (SDRAMC) - System peripherals registers.
5 * Based on AT91SAM9261 datasheet revision D. 8 * Based on AT91SAM9261 datasheet revision D.
6 * 9 *
diff --git a/arch/arm/mach-at91/include/mach/at91sam9_smc.h b/arch/arm/mach-at91/include/mach/at91sam9_smc.h
index ec6ad1338b5a..57de6207e57e 100644
--- a/arch/arm/mach-at91/include/mach/at91sam9_smc.h
+++ b/arch/arm/mach-at91/include/mach/at91sam9_smc.h
@@ -1,6 +1,9 @@
1/* 1/*
2 * arch/arm/mach-at91/include/mach/at91sam9_smc.h 2 * arch/arm/mach-at91/include/mach/at91sam9_smc.h
3 * 3 *
4 * Copyright (C) 2007 Andrew Victor
5 * Copyright (C) 2007 Atmel Corporation.
6 *
4 * Static Memory Controllers (SMC) - System peripherals registers. 7 * Static Memory Controllers (SMC) - System peripherals registers.
5 * Based on AT91SAM9261 datasheet revision D. 8 * Based on AT91SAM9261 datasheet revision D.
6 * 9 *
diff --git a/arch/arm/mach-at91/include/mach/board.h b/arch/arm/mach-at91/include/mach/board.h
index acd60f2a0724..fb51f0e0a83f 100644
--- a/arch/arm/mach-at91/include/mach/board.h
+++ b/arch/arm/mach-at91/include/mach/board.h
@@ -133,6 +133,16 @@ struct atmel_uart_data {
133extern void __init at91_add_device_serial(void); 133extern void __init at91_add_device_serial(void);
134 134
135/* 135/*
136 * PWM
137 */
138#define AT91_PWM0 0
139#define AT91_PWM1 1
140#define AT91_PWM2 2
141#define AT91_PWM3 3
142
143extern void __init at91_add_device_pwm(u32 mask);
144
145/*
136 * SSC -- accessed through ssc_request(id). Drivers don't bind to SSC 146 * SSC -- accessed through ssc_request(id). Drivers don't bind to SSC
137 * platform devices. Their SSC ID is part of their configuration data, 147 * platform devices. Their SSC ID is part of their configuration data,
138 * along with information about which SSC signals they should use. 148 * along with information about which SSC signals they should use.
@@ -162,9 +172,13 @@ extern void __init at91_add_device_ac97(struct atmel_ac97_data *data);
162 /* ISI */ 172 /* ISI */
163extern void __init at91_add_device_isi(void); 173extern void __init at91_add_device_isi(void);
164 174
175 /* Touchscreen Controller */
176extern void __init at91_add_device_tsadcc(void);
177
165 /* LEDs */ 178 /* LEDs */
166extern void __init at91_init_leds(u8 cpu_led, u8 timer_led); 179extern void __init at91_init_leds(u8 cpu_led, u8 timer_led);
167extern void __init at91_gpio_leds(struct gpio_led *leds, int nr); 180extern void __init at91_gpio_leds(struct gpio_led *leds, int nr);
181extern void __init at91_pwm_leds(struct gpio_led *leds, int nr);
168 182
169/* FIXME: this needs a better location, but gets stuff building again */ 183/* FIXME: this needs a better location, but gets stuff building again */
170extern int at91_suspend_entering_slow_clock(void); 184extern int at91_suspend_entering_slow_clock(void);
diff --git a/arch/arm/mach-at91/leds.c b/arch/arm/mach-at91/leds.c
index fec03c59ff94..0415a839e1ad 100644
--- a/arch/arm/mach-at91/leds.c
+++ b/arch/arm/mach-at91/leds.c
@@ -12,6 +12,7 @@
12#include <linux/kernel.h> 12#include <linux/kernel.h>
13#include <linux/module.h> 13#include <linux/module.h>
14#include <linux/init.h> 14#include <linux/init.h>
15#include <linux/platform_device.h>
15 16
16#include <mach/board.h> 17#include <mach/board.h>
17#include <mach/gpio.h> 18#include <mach/gpio.h>
@@ -21,15 +22,13 @@
21 22
22#if defined(CONFIG_NEW_LEDS) 23#if defined(CONFIG_NEW_LEDS)
23 24
24#include <linux/platform_device.h>
25
26/* 25/*
27 * New cross-platform LED support. 26 * New cross-platform LED support.
28 */ 27 */
29 28
30static struct gpio_led_platform_data led_data; 29static struct gpio_led_platform_data led_data;
31 30
32static struct platform_device at91_leds = { 31static struct platform_device at91_gpio_leds_device = {
33 .name = "leds-gpio", 32 .name = "leds-gpio",
34 .id = -1, 33 .id = -1,
35 .dev.platform_data = &led_data, 34 .dev.platform_data = &led_data,
@@ -47,7 +46,7 @@ void __init at91_gpio_leds(struct gpio_led *leds, int nr)
47 46
48 led_data.leds = leds; 47 led_data.leds = leds;
49 led_data.num_leds = nr; 48 led_data.num_leds = nr;
50 platform_device_register(&at91_leds); 49 platform_device_register(&at91_gpio_leds_device);
51} 50}
52 51
53#else 52#else
@@ -57,6 +56,44 @@ void __init at91_gpio_leds(struct gpio_led *leds, int nr) {}
57 56
58/* ------------------------------------------------------------------------- */ 57/* ------------------------------------------------------------------------- */
59 58
59#if defined (CONFIG_LEDS_ATMEL_PWM)
60
61/*
62 * PWM Leds
63 */
64
65static struct gpio_led_platform_data pwm_led_data;
66
67static struct platform_device at91_pwm_leds_device = {
68 .name = "leds-atmel-pwm",
69 .id = -1,
70 .dev.platform_data = &pwm_led_data,
71};
72
73void __init at91_pwm_leds(struct gpio_led *leds, int nr)
74{
75 int i;
76 u32 pwm_mask = 0;
77
78 if (!nr)
79 return;
80
81 for (i = 0; i < nr; i++)
82 pwm_mask |= (1 << leds[i].gpio);
83
84 pwm_led_data.leds = leds;
85 pwm_led_data.num_leds = nr;
86
87 at91_add_device_pwm(pwm_mask);
88 platform_device_register(&at91_pwm_leds_device);
89}
90#else
91void __init at91_pwm_leds(struct gpio_led *leds, int nr){}
92#endif
93
94
95/* ------------------------------------------------------------------------- */
96
60#if defined(CONFIG_LEDS) 97#if defined(CONFIG_LEDS)
61 98
62#include <asm/leds.h> 99#include <asm/leds.h>
diff --git a/arch/arm/mach-at91/pm_slowclock.S b/arch/arm/mach-at91/pm_slowclock.S
new file mode 100644
index 000000000000..987fab3d846a
--- /dev/null
+++ b/arch/arm/mach-at91/pm_slowclock.S
@@ -0,0 +1,283 @@
1/*
2 * arch/arm/mach-at91/pm_slow_clock.S
3 *
4 * Copyright (C) 2006 Savin Zlobec
5 *
6 * AT91SAM9 support:
7 * Copyright (C) 2007 Anti Sullin <anti.sullin@artecdesign.ee
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 *
13 */
14
15#include <linux/linkage.h>
16#include <mach/hardware.h>
17#include <mach/at91_pmc.h>
18
19#ifdef CONFIG_ARCH_AT91RM9200
20#include <mach/at91rm9200_mc.h>
21#elif defined(CONFIG_ARCH_AT91CAP9)
22#include <mach/at91cap9_ddrsdr.h>
23#else
24#include <mach/at91sam9_sdramc.h>
25#endif
26
27
28#ifdef CONFIG_ARCH_AT91SAM9263
29/*
30 * FIXME either or both the SDRAM controllers (EB0, EB1) might be in use;
31 * handle those cases both here and in the Suspend-To-RAM support.
32 */
33#define AT91_SDRAMC AT91_SDRAMC0
34#warning Assuming EB1 SDRAM controller is *NOT* used
35#endif
36
37/*
38 * When SLOWDOWN_MASTER_CLOCK is defined we will also slow down the Master
39 * clock during suspend by adjusting its prescalar and divisor.
40 * NOTE: This hasn't been shown to be stable on SAM9s; and on the RM9200 there
41 * are errata regarding adjusting the prescalar and divisor.
42 */
43#undef SLOWDOWN_MASTER_CLOCK
44
45#define MCKRDY_TIMEOUT 1000
46#define MOSCRDY_TIMEOUT 1000
47#define PLLALOCK_TIMEOUT 1000
48#define PLLBLOCK_TIMEOUT 1000
49
50
51/*
52 * Wait until master clock is ready (after switching master clock source)
53 */
54 .macro wait_mckrdy
55 mov r4, #MCKRDY_TIMEOUT
561: sub r4, r4, #1
57 cmp r4, #0
58 beq 2f
59 ldr r3, [r1, #(AT91_PMC_SR - AT91_PMC)]
60 tst r3, #AT91_PMC_MCKRDY
61 beq 1b
622:
63 .endm
64
65/*
66 * Wait until master oscillator has stabilized.
67 */
68 .macro wait_moscrdy
69 mov r4, #MOSCRDY_TIMEOUT
701: sub r4, r4, #1
71 cmp r4, #0
72 beq 2f
73 ldr r3, [r1, #(AT91_PMC_SR - AT91_PMC)]
74 tst r3, #AT91_PMC_MOSCS
75 beq 1b
762:
77 .endm
78
79/*
80 * Wait until PLLA has locked.
81 */
82 .macro wait_pllalock
83 mov r4, #PLLALOCK_TIMEOUT
841: sub r4, r4, #1
85 cmp r4, #0
86 beq 2f
87 ldr r3, [r1, #(AT91_PMC_SR - AT91_PMC)]
88 tst r3, #AT91_PMC_LOCKA
89 beq 1b
902:
91 .endm
92
93/*
94 * Wait until PLLB has locked.
95 */
96 .macro wait_pllblock
97 mov r4, #PLLBLOCK_TIMEOUT
981: sub r4, r4, #1
99 cmp r4, #0
100 beq 2f
101 ldr r3, [r1, #(AT91_PMC_SR - AT91_PMC)]
102 tst r3, #AT91_PMC_LOCKB
103 beq 1b
1042:
105 .endm
106
107 .text
108
109ENTRY(at91_slow_clock)
110 /* Save registers on stack */
111 stmfd sp!, {r0 - r12, lr}
112
113 /*
114 * Register usage:
115 * R1 = Base address of AT91_PMC
116 * R2 = Base address of AT91_SDRAMC (or AT91_SYS on AT91RM9200)
117 * R3 = temporary register
118 * R4 = temporary register
119 */
120 ldr r1, .at91_va_base_pmc
121 ldr r2, .at91_va_base_sdramc
122
123 /* Drain write buffer */
124 mcr p15, 0, r0, c7, c10, 4
125
126#ifdef CONFIG_ARCH_AT91RM9200
127 /* Put SDRAM in self-refresh mode */
128 mov r3, #1
129 str r3, [r2, #AT91_SDRAMC_SRR]
130#elif defined(CONFIG_ARCH_AT91CAP9)
131 /* Enable SDRAM self-refresh mode */
132 ldr r3, [r2, #AT91_DDRSDRC_LPR - AT91_DDRSDRC]
133 str r3, .saved_sam9_lpr
134
135 mov r3, #AT91_DDRSDRC_LPCB_SELF_REFRESH
136 str r3, [r2, #AT91_DDRSDRC_LPR - AT91_DDRSDRC]
137#else
138 /* Enable SDRAM self-refresh mode */
139 ldr r3, [r2, #AT91_SDRAMC_LPR - AT91_SDRAMC]
140 str r3, .saved_sam9_lpr
141
142 mov r3, #AT91_SDRAMC_LPCB_SELF_REFRESH
143 str r3, [r2, #AT91_SDRAMC_LPR - AT91_SDRAMC]
144#endif
145
146 /* Save Master clock setting */
147 ldr r3, [r1, #(AT91_PMC_MCKR - AT91_PMC)]
148 str r3, .saved_mckr
149
150 /*
151 * Set the Master clock source to slow clock
152 */
153 bic r3, r3, #AT91_PMC_CSS
154 str r3, [r1, #(AT91_PMC_MCKR - AT91_PMC)]
155
156 wait_mckrdy
157
158#ifdef SLOWDOWN_MASTER_CLOCK
159 /*
160 * Set the Master Clock PRES and MDIV fields.
161 *
162 * See AT91RM9200 errata #27 and #28 for details.
163 */
164 mov r3, #0
165 str r3, [r1, #(AT91_PMC_MCKR - AT91_PMC)]
166
167 wait_mckrdy
168#endif
169
170 /* Save PLLA setting and disable it */
171 ldr r3, [r1, #(AT91_CKGR_PLLAR - AT91_PMC)]
172 str r3, .saved_pllar
173
174 mov r3, #AT91_PMC_PLLCOUNT
175 orr r3, r3, #(1 << 29) /* bit 29 always set */
176 str r3, [r1, #(AT91_CKGR_PLLAR - AT91_PMC)]
177
178 wait_pllalock
179
180 /* Save PLLB setting and disable it */
181 ldr r3, [r1, #(AT91_CKGR_PLLBR - AT91_PMC)]
182 str r3, .saved_pllbr
183
184 mov r3, #AT91_PMC_PLLCOUNT
185 str r3, [r1, #(AT91_CKGR_PLLBR - AT91_PMC)]
186
187 wait_pllblock
188
189 /* Turn off the main oscillator */
190 ldr r3, [r1, #(AT91_CKGR_MOR - AT91_PMC)]
191 bic r3, r3, #AT91_PMC_MOSCEN
192 str r3, [r1, #(AT91_CKGR_MOR - AT91_PMC)]
193
194 /* Wait for interrupt */
195 mcr p15, 0, r0, c7, c0, 4
196
197 /* Turn on the main oscillator */
198 ldr r3, [r1, #(AT91_CKGR_MOR - AT91_PMC)]
199 orr r3, r3, #AT91_PMC_MOSCEN
200 str r3, [r1, #(AT91_CKGR_MOR - AT91_PMC)]
201
202 wait_moscrdy
203
204 /* Restore PLLB setting */
205 ldr r3, .saved_pllbr
206 str r3, [r1, #(AT91_CKGR_PLLBR - AT91_PMC)]
207
208 wait_pllblock
209
210 /* Restore PLLA setting */
211 ldr r3, .saved_pllar
212 str r3, [r1, #(AT91_CKGR_PLLAR - AT91_PMC)]
213
214 wait_pllalock
215
216#ifdef SLOWDOWN_MASTER_CLOCK
217 /*
218 * First set PRES if it was not 0,
219 * than set CSS and MDIV fields.
220 *
221 * See AT91RM9200 errata #27 and #28 for details.
222 */
223 ldr r3, .saved_mckr
224 tst r3, #AT91_PMC_PRES
225 beq 2f
226 and r3, r3, #AT91_PMC_PRES
227 str r3, [r1, #(AT91_PMC_MCKR - AT91_PMC)]
228
229 wait_mckrdy
230#endif
231
232 /*
233 * Restore master clock setting
234 */
2352: ldr r3, .saved_mckr
236 str r3, [r1, #(AT91_PMC_MCKR - AT91_PMC)]
237
238 wait_mckrdy
239
240#ifdef CONFIG_ARCH_AT91RM9200
241 /* Do nothing - self-refresh is automatically disabled. */
242#elif defined(CONFIG_ARCH_AT91CAP9)
243 /* Restore LPR on AT91CAP9 */
244 ldr r3, .saved_sam9_lpr
245 str r3, [r2, #AT91_DDRSDRC_LPR - AT91_DDRSDRC]
246#else
247 /* Restore LPR on AT91SAM9 */
248 ldr r3, .saved_sam9_lpr
249 str r3, [r2, #AT91_SDRAMC_LPR - AT91_SDRAMC]
250#endif
251
252 /* Restore registers, and return */
253 ldmfd sp!, {r0 - r12, pc}
254
255
256.saved_mckr:
257 .word 0
258
259.saved_pllar:
260 .word 0
261
262.saved_pllbr:
263 .word 0
264
265.saved_sam9_lpr:
266 .word 0
267
268.at91_va_base_pmc:
269 .word AT91_VA_BASE_SYS + AT91_PMC
270
271#ifdef CONFIG_ARCH_AT91RM9200
272.at91_va_base_sdramc:
273 .word AT91_VA_BASE_SYS
274#elif defined(CONFIG_ARCH_AT91CAP9)
275.at91_va_base_sdramc:
276 .word AT91_VA_BASE_SYS + AT91_DDRSDRC
277#else
278.at91_va_base_sdramc:
279 .word AT91_VA_BASE_SYS + AT91_SDRAMC
280#endif
281
282ENTRY(at91_slow_clock_sz)
283 .word .-at91_slow_clock