aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-at91
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-at91')
-rw-r--r--arch/arm/mach-at91/at91rm9200_devices.c1
-rw-r--r--arch/arm/mach-at91/at91sam9260_devices.c12
-rw-r--r--arch/arm/mach-at91/at91sam9261_devices.c2
-rw-r--r--arch/arm/mach-at91/at91sam9263_devices.c1
-rw-r--r--arch/arm/mach-at91/at91sam9g45.c2
-rw-r--r--arch/arm/mach-at91/at91sam9g45_devices.c64
-rw-r--r--arch/arm/mach-at91/at91sam9rl.c7
-rw-r--r--arch/arm/mach-at91/at91sam9rl_devices.c84
-rw-r--r--arch/arm/mach-at91/board-1arm.c2
-rw-r--r--arch/arm/mach-at91/board-afeb-9260v1.c1
-rw-r--r--arch/arm/mach-at91/board-cam60.c1
-rw-r--r--arch/arm/mach-at91/board-carmeva.c1
-rw-r--r--arch/arm/mach-at91/board-cpu9krea.c1
-rw-r--r--arch/arm/mach-at91/board-cpuat91.c2
-rw-r--r--arch/arm/mach-at91/board-csb337.c2
-rw-r--r--arch/arm/mach-at91/board-csb637.c1
-rw-r--r--arch/arm/mach-at91/board-eb9200.c1
-rw-r--r--arch/arm/mach-at91/board-ecbat91.c1
-rw-r--r--arch/arm/mach-at91/board-eco920.c2
-rw-r--r--arch/arm/mach-at91/board-flexibity.c1
-rw-r--r--arch/arm/mach-at91/board-foxg20.c1
-rw-r--r--arch/arm/mach-at91/board-gsia18s.c1
-rw-r--r--arch/arm/mach-at91/board-kafa.c1
-rw-r--r--arch/arm/mach-at91/board-kb9202.c1
-rw-r--r--arch/arm/mach-at91/board-pcontrol-g20.c1
-rw-r--r--arch/arm/mach-at91/board-picotux200.c1
-rw-r--r--arch/arm/mach-at91/board-rm9200ek.c1
-rw-r--r--arch/arm/mach-at91/board-rsi-ews.c1
-rw-r--r--arch/arm/mach-at91/board-sam9-l9260.c1
-rw-r--r--arch/arm/mach-at91/board-sam9260ek.c1
-rw-r--r--arch/arm/mach-at91/board-sam9261ek.c1
-rw-r--r--arch/arm/mach-at91/board-sam9263ek.c1
-rw-r--r--arch/arm/mach-at91/board-sam9g20ek.c1
-rw-r--r--arch/arm/mach-at91/board-sam9m10g45ek.c17
-rw-r--r--arch/arm/mach-at91/board-sam9rlek.c17
-rw-r--r--arch/arm/mach-at91/board-snapper9260.c1
-rw-r--r--arch/arm/mach-at91/board-stamp9g20.c1
-rw-r--r--arch/arm/mach-at91/board-yl-9200.c1
-rw-r--r--arch/arm/mach-at91/board.h3
-rw-r--r--arch/arm/mach-at91/gpio.c1
-rw-r--r--arch/arm/mach-at91/gpio.h (renamed from arch/arm/mach-at91/include/mach/gpio.h)8
-rw-r--r--arch/arm/mach-at91/include/mach/at91_adc.h107
-rw-r--r--arch/arm/mach-at91/include/mach/hardware.h15
-rw-r--r--arch/arm/mach-at91/leds.c1
-rw-r--r--arch/arm/mach-at91/pm.c1
45 files changed, 136 insertions, 239 deletions
diff --git a/arch/arm/mach-at91/at91rm9200_devices.c b/arch/arm/mach-at91/at91rm9200_devices.c
index f3f19f21352a..4860918b411e 100644
--- a/arch/arm/mach-at91/at91rm9200_devices.c
+++ b/arch/arm/mach-at91/at91rm9200_devices.c
@@ -25,6 +25,7 @@
25 25
26#include "board.h" 26#include "board.h"
27#include "generic.h" 27#include "generic.h"
28#include "gpio.h"
28 29
29 30
30/* -------------------------------------------------------------------- 31/* --------------------------------------------------------------------
diff --git a/arch/arm/mach-at91/at91sam9260_devices.c b/arch/arm/mach-at91/at91sam9260_devices.c
index a0282928e9c1..14a6e35801ff 100644
--- a/arch/arm/mach-at91/at91sam9260_devices.c
+++ b/arch/arm/mach-at91/at91sam9260_devices.c
@@ -24,12 +24,11 @@
24#include <mach/at91sam9260_matrix.h> 24#include <mach/at91sam9260_matrix.h>
25#include <mach/at91_matrix.h> 25#include <mach/at91_matrix.h>
26#include <mach/at91sam9_smc.h> 26#include <mach/at91sam9_smc.h>
27#include <mach/at91_adc.h>
28#include <mach/hardware.h> 27#include <mach/hardware.h>
29 28
30#include "board.h" 29#include "board.h"
31#include "generic.h" 30#include "generic.h"
32 31#include "gpio.h"
33 32
34/* -------------------------------------------------------------------- 33/* --------------------------------------------------------------------
35 * USB Host 34 * USB Host
@@ -1325,13 +1324,6 @@ static struct at91_adc_trigger at91_adc_triggers[] = {
1325 }, 1324 },
1326}; 1325};
1327 1326
1328static struct at91_adc_reg_desc at91_adc_register_g20 = {
1329 .channel_base = AT91_ADC_CHR(0),
1330 .drdy_mask = AT91_ADC_DRDY,
1331 .status_register = AT91_ADC_SR,
1332 .trigger_register = AT91_ADC_MR,
1333};
1334
1335void __init at91_add_device_adc(struct at91_adc_data *data) 1327void __init at91_add_device_adc(struct at91_adc_data *data)
1336{ 1328{
1337 if (!data) 1329 if (!data)
@@ -1349,9 +1341,7 @@ void __init at91_add_device_adc(struct at91_adc_data *data)
1349 if (data->use_external_triggers) 1341 if (data->use_external_triggers)
1350 at91_set_A_periph(AT91_PIN_PA22, 0); 1342 at91_set_A_periph(AT91_PIN_PA22, 0);
1351 1343
1352 data->num_channels = 4;
1353 data->startup_time = 10; 1344 data->startup_time = 10;
1354 data->registers = &at91_adc_register_g20;
1355 data->trigger_number = 4; 1345 data->trigger_number = 4;
1356 data->trigger_list = at91_adc_triggers; 1346 data->trigger_list = at91_adc_triggers;
1357 1347
diff --git a/arch/arm/mach-at91/at91sam9261_devices.c b/arch/arm/mach-at91/at91sam9261_devices.c
index 80e35895d28f..43b21f456f6e 100644
--- a/arch/arm/mach-at91/at91sam9261_devices.c
+++ b/arch/arm/mach-at91/at91sam9261_devices.c
@@ -29,7 +29,7 @@
29 29
30#include "board.h" 30#include "board.h"
31#include "generic.h" 31#include "generic.h"
32 32#include "gpio.h"
33 33
34/* -------------------------------------------------------------------- 34/* --------------------------------------------------------------------
35 * USB Host 35 * USB Host
diff --git a/arch/arm/mach-at91/at91sam9263_devices.c b/arch/arm/mach-at91/at91sam9263_devices.c
index 43d53d6156dd..953616e5dbcb 100644
--- a/arch/arm/mach-at91/at91sam9263_devices.c
+++ b/arch/arm/mach-at91/at91sam9263_devices.c
@@ -28,6 +28,7 @@
28 28
29#include "board.h" 29#include "board.h"
30#include "generic.h" 30#include "generic.h"
31#include "gpio.h"
31 32
32 33
33/* -------------------------------------------------------------------- 34/* --------------------------------------------------------------------
diff --git a/arch/arm/mach-at91/at91sam9g45.c b/arch/arm/mach-at91/at91sam9g45.c
index 5e6f498db0a8..9d3d544ac19c 100644
--- a/arch/arm/mach-at91/at91sam9g45.c
+++ b/arch/arm/mach-at91/at91sam9g45.c
@@ -182,7 +182,7 @@ static struct clk vdec_clk = {
182static struct clk adc_op_clk = { 182static struct clk adc_op_clk = {
183 .name = "adc_op_clk", 183 .name = "adc_op_clk",
184 .type = CLK_TYPE_PERIPHERAL, 184 .type = CLK_TYPE_PERIPHERAL,
185 .rate_hz = 13200000, 185 .rate_hz = 300000,
186}; 186};
187 187
188/* AES/TDES/SHA clock - Only for sam9m11/sam9g56 */ 188/* AES/TDES/SHA clock - Only for sam9m11/sam9g56 */
diff --git a/arch/arm/mach-at91/at91sam9g45_devices.c b/arch/arm/mach-at91/at91sam9g45_devices.c
index dab362c06487..d943363c1845 100644
--- a/arch/arm/mach-at91/at91sam9g45_devices.c
+++ b/arch/arm/mach-at91/at91sam9g45_devices.c
@@ -25,7 +25,6 @@
25#include <linux/fb.h> 25#include <linux/fb.h>
26#include <video/atmel_lcdc.h> 26#include <video/atmel_lcdc.h>
27 27
28#include <mach/at91_adc.h>
29#include <mach/at91sam9g45.h> 28#include <mach/at91sam9g45.h>
30#include <mach/at91sam9g45_matrix.h> 29#include <mach/at91sam9g45_matrix.h>
31#include <mach/at91_matrix.h> 30#include <mach/at91_matrix.h>
@@ -39,6 +38,7 @@
39#include "board.h" 38#include "board.h"
40#include "generic.h" 39#include "generic.h"
41#include "clock.h" 40#include "clock.h"
41#include "gpio.h"
42 42
43 43
44/* -------------------------------------------------------------------- 44/* --------------------------------------------------------------------
@@ -1133,58 +1133,7 @@ static void __init at91_add_device_rtc(void) {}
1133 1133
1134 1134
1135/* -------------------------------------------------------------------- 1135/* --------------------------------------------------------------------
1136 * Touchscreen 1136 * ADC and touchscreen
1137 * -------------------------------------------------------------------- */
1138
1139#if defined(CONFIG_TOUCHSCREEN_ATMEL_TSADCC) || defined(CONFIG_TOUCHSCREEN_ATMEL_TSADCC_MODULE)
1140static u64 tsadcc_dmamask = DMA_BIT_MASK(32);
1141static struct at91_tsadcc_data tsadcc_data;
1142
1143static struct resource tsadcc_resources[] = {
1144 [0] = {
1145 .start = AT91SAM9G45_BASE_TSC,
1146 .end = AT91SAM9G45_BASE_TSC + SZ_16K - 1,
1147 .flags = IORESOURCE_MEM,
1148 },
1149 [1] = {
1150 .start = NR_IRQS_LEGACY + AT91SAM9G45_ID_TSC,
1151 .end = NR_IRQS_LEGACY + AT91SAM9G45_ID_TSC,
1152 .flags = IORESOURCE_IRQ,
1153 }
1154};
1155
1156static struct platform_device at91sam9g45_tsadcc_device = {
1157 .name = "atmel_tsadcc",
1158 .id = -1,
1159 .dev = {
1160 .dma_mask = &tsadcc_dmamask,
1161 .coherent_dma_mask = DMA_BIT_MASK(32),
1162 .platform_data = &tsadcc_data,
1163 },
1164 .resource = tsadcc_resources,
1165 .num_resources = ARRAY_SIZE(tsadcc_resources),
1166};
1167
1168void __init at91_add_device_tsadcc(struct at91_tsadcc_data *data)
1169{
1170 if (!data)
1171 return;
1172
1173 at91_set_gpio_input(AT91_PIN_PD20, 0); /* AD0_XR */
1174 at91_set_gpio_input(AT91_PIN_PD21, 0); /* AD1_XL */
1175 at91_set_gpio_input(AT91_PIN_PD22, 0); /* AD2_YT */
1176 at91_set_gpio_input(AT91_PIN_PD23, 0); /* AD3_TB */
1177
1178 tsadcc_data = *data;
1179 platform_device_register(&at91sam9g45_tsadcc_device);
1180}
1181#else
1182void __init at91_add_device_tsadcc(struct at91_tsadcc_data *data) {}
1183#endif
1184
1185
1186/* --------------------------------------------------------------------
1187 * ADC
1188 * -------------------------------------------------------------------- */ 1137 * -------------------------------------------------------------------- */
1189 1138
1190#if IS_ENABLED(CONFIG_AT91_ADC) 1139#if IS_ENABLED(CONFIG_AT91_ADC)
@@ -1236,13 +1185,6 @@ static struct at91_adc_trigger at91_adc_triggers[] = {
1236 }, 1185 },
1237}; 1186};
1238 1187
1239static struct at91_adc_reg_desc at91_adc_register_g45 = {
1240 .channel_base = AT91_ADC_CHR(0),
1241 .drdy_mask = AT91_ADC_DRDY,
1242 .status_register = AT91_ADC_SR,
1243 .trigger_register = 0x08,
1244};
1245
1246void __init at91_add_device_adc(struct at91_adc_data *data) 1188void __init at91_add_device_adc(struct at91_adc_data *data)
1247{ 1189{
1248 if (!data) 1190 if (!data)
@@ -1268,9 +1210,7 @@ void __init at91_add_device_adc(struct at91_adc_data *data)
1268 if (data->use_external_triggers) 1210 if (data->use_external_triggers)
1269 at91_set_A_periph(AT91_PIN_PD28, 0); 1211 at91_set_A_periph(AT91_PIN_PD28, 0);
1270 1212
1271 data->num_channels = 8;
1272 data->startup_time = 40; 1213 data->startup_time = 40;
1273 data->registers = &at91_adc_register_g45;
1274 data->trigger_number = 4; 1214 data->trigger_number = 4;
1275 data->trigger_list = at91_adc_triggers; 1215 data->trigger_list = at91_adc_triggers;
1276 1216
diff --git a/arch/arm/mach-at91/at91sam9rl.c b/arch/arm/mach-at91/at91sam9rl.c
index 57f12d86c0e6..a79960f57e6a 100644
--- a/arch/arm/mach-at91/at91sam9rl.c
+++ b/arch/arm/mach-at91/at91sam9rl.c
@@ -153,6 +153,11 @@ static struct clk ac97_clk = {
153 .pmc_mask = 1 << AT91SAM9RL_ID_AC97C, 153 .pmc_mask = 1 << AT91SAM9RL_ID_AC97C,
154 .type = CLK_TYPE_PERIPHERAL, 154 .type = CLK_TYPE_PERIPHERAL,
155}; 155};
156static struct clk adc_op_clk = {
157 .name = "adc_op_clk",
158 .type = CLK_TYPE_PERIPHERAL,
159 .rate_hz = 1000000,
160};
156 161
157static struct clk *periph_clocks[] __initdata = { 162static struct clk *periph_clocks[] __initdata = {
158 &pioA_clk, 163 &pioA_clk,
@@ -178,6 +183,7 @@ static struct clk *periph_clocks[] __initdata = {
178 &udphs_clk, 183 &udphs_clk,
179 &lcdc_clk, 184 &lcdc_clk,
180 &ac97_clk, 185 &ac97_clk,
186 &adc_op_clk,
181 // irq0 187 // irq0
182}; 188};
183 189
@@ -216,6 +222,7 @@ static struct clk_lookup periph_clocks_lookups[] = {
216 CLKDEV_CON_DEV_ID(NULL, "fffff600.gpio", &pioB_clk), 222 CLKDEV_CON_DEV_ID(NULL, "fffff600.gpio", &pioB_clk),
217 CLKDEV_CON_DEV_ID(NULL, "fffff800.gpio", &pioC_clk), 223 CLKDEV_CON_DEV_ID(NULL, "fffff800.gpio", &pioC_clk),
218 CLKDEV_CON_DEV_ID(NULL, "fffffa00.gpio", &pioD_clk), 224 CLKDEV_CON_DEV_ID(NULL, "fffffa00.gpio", &pioD_clk),
225 CLKDEV_CON_ID("adc_clk", &tsc_clk),
219}; 226};
220 227
221static struct clk_lookup usart_clocks_lookups[] = { 228static struct clk_lookup usart_clocks_lookups[] = {
diff --git a/arch/arm/mach-at91/at91sam9rl_devices.c b/arch/arm/mach-at91/at91sam9rl_devices.c
index 428fc412aaf1..044ad8bc6963 100644
--- a/arch/arm/mach-at91/at91sam9rl_devices.c
+++ b/arch/arm/mach-at91/at91sam9rl_devices.c
@@ -23,9 +23,11 @@
23#include <mach/at91sam9_smc.h> 23#include <mach/at91sam9_smc.h>
24#include <mach/hardware.h> 24#include <mach/hardware.h>
25#include <linux/platform_data/dma-atmel.h> 25#include <linux/platform_data/dma-atmel.h>
26#include <linux/platform_data/at91_adc.h>
26 27
27#include "board.h" 28#include "board.h"
28#include "generic.h" 29#include "generic.h"
30#include "gpio.h"
29 31
30 32
31/* -------------------------------------------------------------------- 33/* --------------------------------------------------------------------
@@ -608,14 +610,13 @@ static void __init at91_add_device_tc(void) { }
608 610
609 611
610/* -------------------------------------------------------------------- 612/* --------------------------------------------------------------------
611 * Touchscreen 613 * ADC and Touchscreen
612 * -------------------------------------------------------------------- */ 614 * -------------------------------------------------------------------- */
613 615
614#if defined(CONFIG_TOUCHSCREEN_ATMEL_TSADCC) || defined(CONFIG_TOUCHSCREEN_ATMEL_TSADCC_MODULE) 616#if IS_ENABLED(CONFIG_AT91_ADC)
615static u64 tsadcc_dmamask = DMA_BIT_MASK(32); 617static struct at91_adc_data adc_data;
616static struct at91_tsadcc_data tsadcc_data;
617 618
618static struct resource tsadcc_resources[] = { 619static struct resource adc_resources[] = {
619 [0] = { 620 [0] = {
620 .start = AT91SAM9RL_BASE_TSC, 621 .start = AT91SAM9RL_BASE_TSC,
621 .end = AT91SAM9RL_BASE_TSC + SZ_16K - 1, 622 .end = AT91SAM9RL_BASE_TSC + SZ_16K - 1,
@@ -628,36 +629,71 @@ static struct resource tsadcc_resources[] = {
628 } 629 }
629}; 630};
630 631
631static struct platform_device at91sam9rl_tsadcc_device = { 632static struct platform_device at91_adc_device = {
632 .name = "atmel_tsadcc", 633 .name = "at91sam9rl-adc",
633 .id = -1, 634 .id = -1,
634 .dev = { 635 .dev = {
635 .dma_mask = &tsadcc_dmamask, 636 .platform_data = &adc_data,
636 .coherent_dma_mask = DMA_BIT_MASK(32),
637 .platform_data = &tsadcc_data,
638 }, 637 },
639 .resource = tsadcc_resources, 638 .resource = adc_resources,
640 .num_resources = ARRAY_SIZE(tsadcc_resources), 639 .num_resources = ARRAY_SIZE(adc_resources),
641}; 640};
642 641
643void __init at91_add_device_tsadcc(struct at91_tsadcc_data *data) 642static struct at91_adc_trigger at91_adc_triggers[] = {
643 [0] = {
644 .name = "external-rising",
645 .value = 1,
646 .is_external = true,
647 },
648 [1] = {
649 .name = "external-falling",
650 .value = 2,
651 .is_external = true,
652 },
653 [2] = {
654 .name = "external-any",
655 .value = 3,
656 .is_external = true,
657 },
658 [3] = {
659 .name = "continuous",
660 .value = 6,
661 .is_external = false,
662 },
663};
664
665void __init at91_add_device_adc(struct at91_adc_data *data)
644{ 666{
645 if (!data) 667 if (!data)
646 return; 668 return;
647 669
648 at91_set_A_periph(AT91_PIN_PA17, 0); /* AD0_XR */ 670 if (test_bit(0, &data->channels_used))
649 at91_set_A_periph(AT91_PIN_PA18, 0); /* AD1_XL */ 671 at91_set_A_periph(AT91_PIN_PA17, 0);
650 at91_set_A_periph(AT91_PIN_PA19, 0); /* AD2_YT */ 672 if (test_bit(1, &data->channels_used))
651 at91_set_A_periph(AT91_PIN_PA20, 0); /* AD3_TB */ 673 at91_set_A_periph(AT91_PIN_PA18, 0);
652 674 if (test_bit(2, &data->channels_used))
653 tsadcc_data = *data; 675 at91_set_A_periph(AT91_PIN_PA19, 0);
654 platform_device_register(&at91sam9rl_tsadcc_device); 676 if (test_bit(3, &data->channels_used))
677 at91_set_A_periph(AT91_PIN_PA20, 0);
678 if (test_bit(4, &data->channels_used))
679 at91_set_A_periph(AT91_PIN_PD6, 0);
680 if (test_bit(5, &data->channels_used))
681 at91_set_A_periph(AT91_PIN_PD7, 0);
682
683 if (data->use_external_triggers)
684 at91_set_A_periph(AT91_PIN_PB15, 0);
685
686 data->startup_time = 40;
687 data->trigger_number = 4;
688 data->trigger_list = at91_adc_triggers;
689
690 adc_data = *data;
691 platform_device_register(&at91_adc_device);
655} 692}
656#else 693#else
657void __init at91_add_device_tsadcc(struct at91_tsadcc_data *data) {} 694void __init at91_add_device_adc(struct at91_adc_data *data) {}
658#endif 695#endif
659 696
660
661/* -------------------------------------------------------------------- 697/* --------------------------------------------------------------------
662 * RTC 698 * RTC
663 * -------------------------------------------------------------------- */ 699 * -------------------------------------------------------------------- */
diff --git a/arch/arm/mach-at91/board-1arm.c b/arch/arm/mach-at91/board-1arm.c
index 35ab632bbf68..3f6dbcc34022 100644
--- a/arch/arm/mach-at91/board-1arm.c
+++ b/arch/arm/mach-at91/board-1arm.c
@@ -39,7 +39,7 @@
39#include "at91_aic.h" 39#include "at91_aic.h"
40#include "board.h" 40#include "board.h"
41#include "generic.h" 41#include "generic.h"
42 42#include "gpio.h"
43 43
44static void __init onearm_init_early(void) 44static void __init onearm_init_early(void)
45{ 45{
diff --git a/arch/arm/mach-at91/board-afeb-9260v1.c b/arch/arm/mach-at91/board-afeb-9260v1.c
index f95e31cda4b3..597c649170aa 100644
--- a/arch/arm/mach-at91/board-afeb-9260v1.c
+++ b/arch/arm/mach-at91/board-afeb-9260v1.c
@@ -46,6 +46,7 @@
46#include "at91_aic.h" 46#include "at91_aic.h"
47#include "board.h" 47#include "board.h"
48#include "generic.h" 48#include "generic.h"
49#include "gpio.h"
49 50
50 51
51static void __init afeb9260_init_early(void) 52static void __init afeb9260_init_early(void)
diff --git a/arch/arm/mach-at91/board-cam60.c b/arch/arm/mach-at91/board-cam60.c
index 112e867c4abe..a30502c8d379 100644
--- a/arch/arm/mach-at91/board-cam60.c
+++ b/arch/arm/mach-at91/board-cam60.c
@@ -44,6 +44,7 @@
44#include "board.h" 44#include "board.h"
45#include "sam9_smc.h" 45#include "sam9_smc.h"
46#include "generic.h" 46#include "generic.h"
47#include "gpio.h"
47 48
48 49
49static void __init cam60_init_early(void) 50static void __init cam60_init_early(void)
diff --git a/arch/arm/mach-at91/board-carmeva.c b/arch/arm/mach-at91/board-carmeva.c
index 92983050a9bd..47313d3ee037 100644
--- a/arch/arm/mach-at91/board-carmeva.c
+++ b/arch/arm/mach-at91/board-carmeva.c
@@ -39,6 +39,7 @@
39#include "at91_aic.h" 39#include "at91_aic.h"
40#include "board.h" 40#include "board.h"
41#include "generic.h" 41#include "generic.h"
42#include "gpio.h"
42 43
43 44
44static void __init carmeva_init_early(void) 45static void __init carmeva_init_early(void)
diff --git a/arch/arm/mach-at91/board-cpu9krea.c b/arch/arm/mach-at91/board-cpu9krea.c
index 008527efdbcf..2037f78c84e7 100644
--- a/arch/arm/mach-at91/board-cpu9krea.c
+++ b/arch/arm/mach-at91/board-cpu9krea.c
@@ -48,6 +48,7 @@
48#include "board.h" 48#include "board.h"
49#include "sam9_smc.h" 49#include "sam9_smc.h"
50#include "generic.h" 50#include "generic.h"
51#include "gpio.h"
51 52
52static void __init cpu9krea_init_early(void) 53static void __init cpu9krea_init_early(void)
53{ 54{
diff --git a/arch/arm/mach-at91/board-cpuat91.c b/arch/arm/mach-at91/board-cpuat91.c
index 42f1353a4baf..c094350c9314 100644
--- a/arch/arm/mach-at91/board-cpuat91.c
+++ b/arch/arm/mach-at91/board-cpuat91.c
@@ -43,6 +43,8 @@
43#include "at91_aic.h" 43#include "at91_aic.h"
44#include "board.h" 44#include "board.h"
45#include "generic.h" 45#include "generic.h"
46#include "gpio.h"
47
46 48
47static struct gpio_led cpuat91_leds[] = { 49static struct gpio_led cpuat91_leds[] = {
48 { 50 {
diff --git a/arch/arm/mach-at91/board-csb337.c b/arch/arm/mach-at91/board-csb337.c
index e5fde215225b..0e35a45cf8d4 100644
--- a/arch/arm/mach-at91/board-csb337.c
+++ b/arch/arm/mach-at91/board-csb337.c
@@ -42,7 +42,7 @@
42#include "at91_aic.h" 42#include "at91_aic.h"
43#include "board.h" 43#include "board.h"
44#include "generic.h" 44#include "generic.h"
45 45#include "gpio.h"
46 46
47static void __init csb337_init_early(void) 47static void __init csb337_init_early(void)
48{ 48{
diff --git a/arch/arm/mach-at91/board-csb637.c b/arch/arm/mach-at91/board-csb637.c
index fdf11061c577..18d027f529a8 100644
--- a/arch/arm/mach-at91/board-csb637.c
+++ b/arch/arm/mach-at91/board-csb637.c
@@ -39,6 +39,7 @@
39#include "at91_aic.h" 39#include "at91_aic.h"
40#include "board.h" 40#include "board.h"
41#include "generic.h" 41#include "generic.h"
42#include "gpio.h"
42 43
43 44
44static void __init csb637_init_early(void) 45static void __init csb637_init_early(void)
diff --git a/arch/arm/mach-at91/board-eb9200.c b/arch/arm/mach-at91/board-eb9200.c
index f9be8161bbfa..aa457a8b22f5 100644
--- a/arch/arm/mach-at91/board-eb9200.c
+++ b/arch/arm/mach-at91/board-eb9200.c
@@ -38,6 +38,7 @@
38#include "at91_aic.h" 38#include "at91_aic.h"
39#include "board.h" 39#include "board.h"
40#include "generic.h" 40#include "generic.h"
41#include "gpio.h"
41 42
42 43
43static void __init eb9200_init_early(void) 44static void __init eb9200_init_early(void)
diff --git a/arch/arm/mach-at91/board-ecbat91.c b/arch/arm/mach-at91/board-ecbat91.c
index b2fcd71262ba..ede1373ccaba 100644
--- a/arch/arm/mach-at91/board-ecbat91.c
+++ b/arch/arm/mach-at91/board-ecbat91.c
@@ -42,6 +42,7 @@
42#include "at91_aic.h" 42#include "at91_aic.h"
43#include "board.h" 43#include "board.h"
44#include "generic.h" 44#include "generic.h"
45#include "gpio.h"
45 46
46 47
47static void __init ecb_at91init_early(void) 48static void __init ecb_at91init_early(void)
diff --git a/arch/arm/mach-at91/board-eco920.c b/arch/arm/mach-at91/board-eco920.c
index 77de410efc90..4e75321a8f2a 100644
--- a/arch/arm/mach-at91/board-eco920.c
+++ b/arch/arm/mach-at91/board-eco920.c
@@ -31,6 +31,8 @@
31#include "at91_aic.h" 31#include "at91_aic.h"
32#include "board.h" 32#include "board.h"
33#include "generic.h" 33#include "generic.h"
34#include "gpio.h"
35
34 36
35static void __init eco920_init_early(void) 37static void __init eco920_init_early(void)
36{ 38{
diff --git a/arch/arm/mach-at91/board-flexibity.c b/arch/arm/mach-at91/board-flexibity.c
index 737c08563628..68f1ab6bd08f 100644
--- a/arch/arm/mach-at91/board-flexibity.c
+++ b/arch/arm/mach-at91/board-flexibity.c
@@ -37,6 +37,7 @@
37#include "at91_aic.h" 37#include "at91_aic.h"
38#include "board.h" 38#include "board.h"
39#include "generic.h" 39#include "generic.h"
40#include "gpio.h"
40 41
41static void __init flexibity_init_early(void) 42static void __init flexibity_init_early(void)
42{ 43{
diff --git a/arch/arm/mach-at91/board-foxg20.c b/arch/arm/mach-at91/board-foxg20.c
index c20a870ea9c9..8b22c60bb238 100644
--- a/arch/arm/mach-at91/board-foxg20.c
+++ b/arch/arm/mach-at91/board-foxg20.c
@@ -47,6 +47,7 @@
47#include "board.h" 47#include "board.h"
48#include "sam9_smc.h" 48#include "sam9_smc.h"
49#include "generic.h" 49#include "generic.h"
50#include "gpio.h"
50 51
51/* 52/*
52 * The FOX Board G20 hardware comes as the "Netus G20" board with 53 * The FOX Board G20 hardware comes as the "Netus G20" board with
diff --git a/arch/arm/mach-at91/board-gsia18s.c b/arch/arm/mach-at91/board-gsia18s.c
index 416bae8435ee..b729dd1271bf 100644
--- a/arch/arm/mach-at91/board-gsia18s.c
+++ b/arch/arm/mach-at91/board-gsia18s.c
@@ -39,6 +39,7 @@
39#include "generic.h" 39#include "generic.h"
40#include "gsia18s.h" 40#include "gsia18s.h"
41#include "stamp9g20.h" 41#include "stamp9g20.h"
42#include "gpio.h"
42 43
43static void __init gsia18s_init_early(void) 44static void __init gsia18s_init_early(void)
44{ 45{
diff --git a/arch/arm/mach-at91/board-kafa.c b/arch/arm/mach-at91/board-kafa.c
index 88e2f5d2d16d..93b1df42f639 100644
--- a/arch/arm/mach-at91/board-kafa.c
+++ b/arch/arm/mach-at91/board-kafa.c
@@ -39,6 +39,7 @@
39#include "at91_aic.h" 39#include "at91_aic.h"
40#include "board.h" 40#include "board.h"
41#include "generic.h" 41#include "generic.h"
42#include "gpio.h"
42 43
43 44
44static void __init kafa_init_early(void) 45static void __init kafa_init_early(void)
diff --git a/arch/arm/mach-at91/board-kb9202.c b/arch/arm/mach-at91/board-kb9202.c
index 0c519d9ebffc..d58d36225e08 100644
--- a/arch/arm/mach-at91/board-kb9202.c
+++ b/arch/arm/mach-at91/board-kb9202.c
@@ -42,6 +42,7 @@
42#include "at91_aic.h" 42#include "at91_aic.h"
43#include "board.h" 43#include "board.h"
44#include "generic.h" 44#include "generic.h"
45#include "gpio.h"
45 46
46 47
47static void __init kb9202_init_early(void) 48static void __init kb9202_init_early(void)
diff --git a/arch/arm/mach-at91/board-pcontrol-g20.c b/arch/arm/mach-at91/board-pcontrol-g20.c
index 5f25fa54eb93..b48d95ec5152 100644
--- a/arch/arm/mach-at91/board-pcontrol-g20.c
+++ b/arch/arm/mach-at91/board-pcontrol-g20.c
@@ -37,6 +37,7 @@
37#include "sam9_smc.h" 37#include "sam9_smc.h"
38#include "generic.h" 38#include "generic.h"
39#include "stamp9g20.h" 39#include "stamp9g20.h"
40#include "gpio.h"
40 41
41 42
42static void __init pcontrol_g20_init_early(void) 43static void __init pcontrol_g20_init_early(void)
diff --git a/arch/arm/mach-at91/board-picotux200.c b/arch/arm/mach-at91/board-picotux200.c
index ab2b2ec36c14..2c0f2d554d84 100644
--- a/arch/arm/mach-at91/board-picotux200.c
+++ b/arch/arm/mach-at91/board-picotux200.c
@@ -43,6 +43,7 @@
43#include "at91_aic.h" 43#include "at91_aic.h"
44#include "board.h" 44#include "board.h"
45#include "generic.h" 45#include "generic.h"
46#include "gpio.h"
46 47
47 48
48static void __init picotux200_init_early(void) 49static void __init picotux200_init_early(void)
diff --git a/arch/arm/mach-at91/board-rm9200ek.c b/arch/arm/mach-at91/board-rm9200ek.c
index 8b17dadc1aba..953cea416754 100644
--- a/arch/arm/mach-at91/board-rm9200ek.c
+++ b/arch/arm/mach-at91/board-rm9200ek.c
@@ -45,6 +45,7 @@
45#include "at91_aic.h" 45#include "at91_aic.h"
46#include "board.h" 46#include "board.h"
47#include "generic.h" 47#include "generic.h"
48#include "gpio.h"
48 49
49 50
50static void __init ek_init_early(void) 51static void __init ek_init_early(void)
diff --git a/arch/arm/mach-at91/board-rsi-ews.c b/arch/arm/mach-at91/board-rsi-ews.c
index f6d7f1958c7e..f28e8b74df4b 100644
--- a/arch/arm/mach-at91/board-rsi-ews.c
+++ b/arch/arm/mach-at91/board-rsi-ews.c
@@ -31,6 +31,7 @@
31#include "at91_aic.h" 31#include "at91_aic.h"
32#include "board.h" 32#include "board.h"
33#include "generic.h" 33#include "generic.h"
34#include "gpio.h"
34 35
35static void __init rsi_ews_init_early(void) 36static void __init rsi_ews_init_early(void)
36{ 37{
diff --git a/arch/arm/mach-at91/board-sam9-l9260.c b/arch/arm/mach-at91/board-sam9-l9260.c
index 43ee4dc43b50..d24dda67e2d3 100644
--- a/arch/arm/mach-at91/board-sam9-l9260.c
+++ b/arch/arm/mach-at91/board-sam9-l9260.c
@@ -43,6 +43,7 @@
43#include "board.h" 43#include "board.h"
44#include "sam9_smc.h" 44#include "sam9_smc.h"
45#include "generic.h" 45#include "generic.h"
46#include "gpio.h"
46 47
47 48
48static void __init ek_init_early(void) 49static void __init ek_init_early(void)
diff --git a/arch/arm/mach-at91/board-sam9260ek.c b/arch/arm/mach-at91/board-sam9260ek.c
index f4f8735315da..65dea12d685e 100644
--- a/arch/arm/mach-at91/board-sam9260ek.c
+++ b/arch/arm/mach-at91/board-sam9260ek.c
@@ -49,6 +49,7 @@
49#include "board.h" 49#include "board.h"
50#include "sam9_smc.h" 50#include "sam9_smc.h"
51#include "generic.h" 51#include "generic.h"
52#include "gpio.h"
52 53
53 54
54static void __init ek_init_early(void) 55static void __init ek_init_early(void)
diff --git a/arch/arm/mach-at91/board-sam9261ek.c b/arch/arm/mach-at91/board-sam9261ek.c
index 473546b9408b..4637432de08f 100644
--- a/arch/arm/mach-at91/board-sam9261ek.c
+++ b/arch/arm/mach-at91/board-sam9261ek.c
@@ -53,6 +53,7 @@
53#include "board.h" 53#include "board.h"
54#include "sam9_smc.h" 54#include "sam9_smc.h"
55#include "generic.h" 55#include "generic.h"
56#include "gpio.h"
56 57
57 58
58static void __init ek_init_early(void) 59static void __init ek_init_early(void)
diff --git a/arch/arm/mach-at91/board-sam9263ek.c b/arch/arm/mach-at91/board-sam9263ek.c
index 2f931915c80c..cd2726ee5add 100644
--- a/arch/arm/mach-at91/board-sam9263ek.c
+++ b/arch/arm/mach-at91/board-sam9263ek.c
@@ -52,6 +52,7 @@
52#include "board.h" 52#include "board.h"
53#include "sam9_smc.h" 53#include "sam9_smc.h"
54#include "generic.h" 54#include "generic.h"
55#include "gpio.h"
55 56
56 57
57static void __init ek_init_early(void) 58static void __init ek_init_early(void)
diff --git a/arch/arm/mach-at91/board-sam9g20ek.c b/arch/arm/mach-at91/board-sam9g20ek.c
index f9cd1f2c7146..e1be6e25b380 100644
--- a/arch/arm/mach-at91/board-sam9g20ek.c
+++ b/arch/arm/mach-at91/board-sam9g20ek.c
@@ -50,6 +50,7 @@
50#include "board.h" 50#include "board.h"
51#include "sam9_smc.h" 51#include "sam9_smc.h"
52#include "generic.h" 52#include "generic.h"
53#include "gpio.h"
53 54
54/* 55/*
55 * board revision encoding 56 * board revision encoding
diff --git a/arch/arm/mach-at91/board-sam9m10g45ek.c b/arch/arm/mach-at91/board-sam9m10g45ek.c
index ef39078c8ce2..1ea61328f30d 100644
--- a/arch/arm/mach-at91/board-sam9m10g45ek.c
+++ b/arch/arm/mach-at91/board-sam9m10g45ek.c
@@ -50,6 +50,7 @@
50#include "board.h" 50#include "board.h"
51#include "sam9_smc.h" 51#include "sam9_smc.h"
52#include "generic.h" 52#include "generic.h"
53#include "gpio.h"
53 54
54 55
55static void __init ek_init_early(void) 56static void __init ek_init_early(void)
@@ -300,21 +301,13 @@ static struct atmel_lcdfb_pdata __initdata ek_lcdc_data;
300 301
301 302
302/* 303/*
303 * Touchscreen 304 * ADCs and touchscreen
304 */
305static struct at91_tsadcc_data ek_tsadcc_data = {
306 .adc_clock = 300000,
307 .pendet_debounce = 0x0d,
308 .ts_sample_hold_time = 0x0a,
309};
310
311/*
312 * ADCs
313 */ 305 */
314static struct at91_adc_data ek_adc_data = { 306static struct at91_adc_data ek_adc_data = {
315 .channels_used = BIT(0) | BIT(1) | BIT(2) | BIT(3) | BIT(4) | BIT(5) | BIT(6) | BIT(7), 307 .channels_used = BIT(0) | BIT(1) | BIT(2) | BIT(3) | BIT(4) | BIT(5) | BIT(6) | BIT(7),
316 .use_external_triggers = true, 308 .use_external_triggers = true,
317 .vref = 3300, 309 .vref = 3300,
310 .touchscreen_type = ATMEL_ADC_TOUCHSCREEN_4WIRE,
318}; 311};
319 312
320/* 313/*
@@ -485,9 +478,7 @@ static void __init ek_board_init(void)
485 at91_add_device_isi(&isi_data, true); 478 at91_add_device_isi(&isi_data, true);
486 /* LCD Controller */ 479 /* LCD Controller */
487 at91_add_device_lcdc(&ek_lcdc_data); 480 at91_add_device_lcdc(&ek_lcdc_data);
488 /* Touch Screen */ 481 /* ADC and touchscreen */
489 at91_add_device_tsadcc(&ek_tsadcc_data);
490 /* ADC */
491 at91_add_device_adc(&ek_adc_data); 482 at91_add_device_adc(&ek_adc_data);
492 /* Push Buttons */ 483 /* Push Buttons */
493 ek_add_device_buttons(); 484 ek_add_device_buttons();
diff --git a/arch/arm/mach-at91/board-sam9rlek.c b/arch/arm/mach-at91/board-sam9rlek.c
index 604eecf6cd70..b64648b4a1fc 100644
--- a/arch/arm/mach-at91/board-sam9rlek.c
+++ b/arch/arm/mach-at91/board-sam9rlek.c
@@ -18,6 +18,7 @@
18#include <linux/clk.h> 18#include <linux/clk.h>
19#include <linux/input.h> 19#include <linux/input.h>
20#include <linux/gpio_keys.h> 20#include <linux/gpio_keys.h>
21#include <linux/platform_data/at91_adc.h>
21 22
22#include <video/atmel_lcdc.h> 23#include <video/atmel_lcdc.h>
23 24
@@ -38,6 +39,7 @@
38#include "board.h" 39#include "board.h"
39#include "sam9_smc.h" 40#include "sam9_smc.h"
40#include "generic.h" 41#include "generic.h"
42#include "gpio.h"
41 43
42 44
43static void __init ek_init_early(void) 45static void __init ek_init_early(void)
@@ -229,12 +231,13 @@ static struct gpio_led ek_leds[] = {
229 231
230 232
231/* 233/*
232 * Touchscreen 234 * ADC + Touchscreen
233 */ 235 */
234static struct at91_tsadcc_data ek_tsadcc_data = { 236static struct at91_adc_data ek_adc_data = {
235 .adc_clock = 1000000, 237 .channels_used = BIT(0) | BIT(1) | BIT(2) | BIT(3) | BIT(4) | BIT(5),
236 .pendet_debounce = 0x0f, 238 .use_external_triggers = true,
237 .ts_sample_hold_time = 0x03, 239 .vref = 3300,
240 .touchscreen_type = ATMEL_ADC_TOUCHSCREEN_4WIRE,
238}; 241};
239 242
240 243
@@ -310,8 +313,8 @@ static void __init ek_board_init(void)
310 at91_add_device_lcdc(&ek_lcdc_data); 313 at91_add_device_lcdc(&ek_lcdc_data);
311 /* AC97 */ 314 /* AC97 */
312 at91_add_device_ac97(&ek_ac97_data); 315 at91_add_device_ac97(&ek_ac97_data);
313 /* Touch Screen Controller */ 316 /* Touch Screen Controller + ADC */
314 at91_add_device_tsadcc(&ek_tsadcc_data); 317 at91_add_device_adc(&ek_adc_data);
315 /* LEDs */ 318 /* LEDs */
316 at91_gpio_leds(ek_leds, ARRAY_SIZE(ek_leds)); 319 at91_gpio_leds(ek_leds, ARRAY_SIZE(ek_leds));
317 /* Push Buttons */ 320 /* Push Buttons */
diff --git a/arch/arm/mach-at91/board-snapper9260.c b/arch/arm/mach-at91/board-snapper9260.c
index f1d49e929ccb..1b870e6def0c 100644
--- a/arch/arm/mach-at91/board-snapper9260.c
+++ b/arch/arm/mach-at91/board-snapper9260.c
@@ -38,6 +38,7 @@
38#include "board.h" 38#include "board.h"
39#include "sam9_smc.h" 39#include "sam9_smc.h"
40#include "generic.h" 40#include "generic.h"
41#include "gpio.h"
41 42
42#define SNAPPER9260_IO_EXP_GPIO(x) (NR_BUILTIN_GPIO + (x)) 43#define SNAPPER9260_IO_EXP_GPIO(x) (NR_BUILTIN_GPIO + (x))
43 44
diff --git a/arch/arm/mach-at91/board-stamp9g20.c b/arch/arm/mach-at91/board-stamp9g20.c
index e4a5ac17cdbc..3b575036ff96 100644
--- a/arch/arm/mach-at91/board-stamp9g20.c
+++ b/arch/arm/mach-at91/board-stamp9g20.c
@@ -32,6 +32,7 @@
32#include "board.h" 32#include "board.h"
33#include "sam9_smc.h" 33#include "sam9_smc.h"
34#include "generic.h" 34#include "generic.h"
35#include "gpio.h"
35 36
36 37
37void __init stamp9g20_init_early(void) 38void __init stamp9g20_init_early(void)
diff --git a/arch/arm/mach-at91/board-yl-9200.c b/arch/arm/mach-at91/board-yl-9200.c
index be083771df2e..46fdb0c68a68 100644
--- a/arch/arm/mach-at91/board-yl-9200.c
+++ b/arch/arm/mach-at91/board-yl-9200.c
@@ -50,6 +50,7 @@
50#include "at91_aic.h" 50#include "at91_aic.h"
51#include "board.h" 51#include "board.h"
52#include "generic.h" 52#include "generic.h"
53#include "gpio.h"
53 54
54 55
55static void __init yl9200_init_early(void) 56static void __init yl9200_init_early(void)
diff --git a/arch/arm/mach-at91/board.h b/arch/arm/mach-at91/board.h
index 6c08b341167d..4e773b55bc2d 100644
--- a/arch/arm/mach-at91/board.h
+++ b/arch/arm/mach-at91/board.h
@@ -118,9 +118,6 @@ struct isi_platform_data;
118extern void __init at91_add_device_isi(struct isi_platform_data *data, 118extern void __init at91_add_device_isi(struct isi_platform_data *data,
119 bool use_pck_as_mck); 119 bool use_pck_as_mck);
120 120
121 /* Touchscreen Controller */
122extern void __init at91_add_device_tsadcc(struct at91_tsadcc_data *data);
123
124/* CAN */ 121/* CAN */
125extern void __init at91_add_device_can(struct at91_can_data *data); 122extern void __init at91_add_device_can(struct at91_can_data *data);
126 123
diff --git a/arch/arm/mach-at91/gpio.c b/arch/arm/mach-at91/gpio.c
index a5afcf76550e..12ed05bbdc5c 100644
--- a/arch/arm/mach-at91/gpio.c
+++ b/arch/arm/mach-at91/gpio.c
@@ -29,6 +29,7 @@
29#include <mach/at91_pio.h> 29#include <mach/at91_pio.h>
30 30
31#include "generic.h" 31#include "generic.h"
32#include "gpio.h"
32 33
33#define MAX_NB_GPIO_PER_BANK 32 34#define MAX_NB_GPIO_PER_BANK 32
34 35
diff --git a/arch/arm/mach-at91/include/mach/gpio.h b/arch/arm/mach-at91/gpio.h
index 5fc23771c154..eed465ab0dd7 100644
--- a/arch/arm/mach-at91/include/mach/gpio.h
+++ b/arch/arm/mach-at91/gpio.h
@@ -209,14 +209,6 @@ extern int at91_get_gpio_value(unsigned pin);
209extern void at91_gpio_suspend(void); 209extern void at91_gpio_suspend(void);
210extern void at91_gpio_resume(void); 210extern void at91_gpio_resume(void);
211 211
212#ifdef CONFIG_PINCTRL_AT91
213extern void at91_pinctrl_gpio_suspend(void);
214extern void at91_pinctrl_gpio_resume(void);
215#else
216static inline void at91_pinctrl_gpio_suspend(void) {}
217static inline void at91_pinctrl_gpio_resume(void) {}
218#endif
219
220#endif /* __ASSEMBLY__ */ 212#endif /* __ASSEMBLY__ */
221 213
222#endif 214#endif
diff --git a/arch/arm/mach-at91/include/mach/at91_adc.h b/arch/arm/mach-at91/include/mach/at91_adc.h
deleted file mode 100644
index c287307b9a3b..000000000000
--- a/arch/arm/mach-at91/include/mach/at91_adc.h
+++ /dev/null
@@ -1,107 +0,0 @@
1/*
2 * arch/arm/mach-at91/include/mach/at91_adc.h
3 *
4 * Copyright (C) SAN People
5 *
6 * Analog-to-Digital Converter (ADC) registers.
7 * Based on AT91SAM9260 datasheet revision D.
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 as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 */
14
15#ifndef AT91_ADC_H
16#define AT91_ADC_H
17
18#define AT91_ADC_CR 0x00 /* Control Register */
19#define AT91_ADC_SWRST (1 << 0) /* Software Reset */
20#define AT91_ADC_START (1 << 1) /* Start Conversion */
21
22#define AT91_ADC_MR 0x04 /* Mode Register */
23#define AT91_ADC_TRGEN (1 << 0) /* Trigger Enable */
24#define AT91_ADC_TRGSEL (7 << 1) /* Trigger Selection */
25#define AT91_ADC_TRGSEL_TC0 (0 << 1)
26#define AT91_ADC_TRGSEL_TC1 (1 << 1)
27#define AT91_ADC_TRGSEL_TC2 (2 << 1)
28#define AT91_ADC_TRGSEL_EXTERNAL (6 << 1)
29#define AT91_ADC_LOWRES (1 << 4) /* Low Resolution */
30#define AT91_ADC_SLEEP (1 << 5) /* Sleep Mode */
31#define AT91_ADC_PRESCAL_9260 (0x3f << 8) /* Prescalar Rate Selection */
32#define AT91_ADC_PRESCAL_9G45 (0xff << 8)
33#define AT91_ADC_PRESCAL_(x) ((x) << 8)
34#define AT91_ADC_STARTUP_9260 (0x1f << 16) /* Startup Up Time */
35#define AT91_ADC_STARTUP_9G45 (0x7f << 16)
36#define AT91_ADC_STARTUP_9X5 (0xf << 16)
37#define AT91_ADC_STARTUP_(x) ((x) << 16)
38#define AT91_ADC_SHTIM (0xf << 24) /* Sample & Hold Time */
39#define AT91_ADC_SHTIM_(x) ((x) << 24)
40
41#define AT91_ADC_CHER 0x10 /* Channel Enable Register */
42#define AT91_ADC_CHDR 0x14 /* Channel Disable Register */
43#define AT91_ADC_CHSR 0x18 /* Channel Status Register */
44#define AT91_ADC_CH(n) (1 << (n)) /* Channel Number */
45
46#define AT91_ADC_SR 0x1C /* Status Register */
47#define AT91_ADC_EOC(n) (1 << (n)) /* End of Conversion on Channel N */
48#define AT91_ADC_OVRE(n) (1 << ((n) + 8))/* Overrun Error on Channel N */
49#define AT91_ADC_DRDY (1 << 16) /* Data Ready */
50#define AT91_ADC_GOVRE (1 << 17) /* General Overrun Error */
51#define AT91_ADC_ENDRX (1 << 18) /* End of RX Buffer */
52#define AT91_ADC_RXFUFF (1 << 19) /* RX Buffer Full */
53
54#define AT91_ADC_SR_9X5 0x30 /* Status Register for 9x5 */
55#define AT91_ADC_SR_DRDY_9X5 (1 << 24) /* Data Ready */
56
57#define AT91_ADC_LCDR 0x20 /* Last Converted Data Register */
58#define AT91_ADC_LDATA (0x3ff)
59
60#define AT91_ADC_IER 0x24 /* Interrupt Enable Register */
61#define AT91_ADC_IDR 0x28 /* Interrupt Disable Register */
62#define AT91_ADC_IMR 0x2C /* Interrupt Mask Register */
63#define AT91_ADC_IER_PEN (1 << 29)
64#define AT91_ADC_IER_NOPEN (1 << 30)
65#define AT91_ADC_IER_XRDY (1 << 20)
66#define AT91_ADC_IER_YRDY (1 << 21)
67#define AT91_ADC_IER_PRDY (1 << 22)
68#define AT91_ADC_ISR_PENS (1 << 31)
69
70#define AT91_ADC_CHR(n) (0x30 + ((n) * 4)) /* Channel Data Register N */
71#define AT91_ADC_DATA (0x3ff)
72
73#define AT91_ADC_CDR0_9X5 (0x50) /* Channel Data Register 0 for 9X5 */
74
75#define AT91_ADC_ACR 0x94 /* Analog Control Register */
76#define AT91_ADC_ACR_PENDETSENS (0x3 << 0) /* pull-up resistor */
77
78#define AT91_ADC_TSMR 0xB0
79#define AT91_ADC_TSMR_TSMODE (3 << 0) /* Touch Screen Mode */
80#define AT91_ADC_TSMR_TSMODE_NONE (0 << 0)
81#define AT91_ADC_TSMR_TSMODE_4WIRE_NO_PRESS (1 << 0)
82#define AT91_ADC_TSMR_TSMODE_4WIRE_PRESS (2 << 0)
83#define AT91_ADC_TSMR_TSMODE_5WIRE (3 << 0)
84#define AT91_ADC_TSMR_TSAV (3 << 4) /* Averages samples */
85#define AT91_ADC_TSMR_TSAV_(x) ((x) << 4)
86#define AT91_ADC_TSMR_SCTIM (0x0f << 16) /* Switch closure time */
87#define AT91_ADC_TSMR_PENDBC (0x0f << 28) /* Pen Debounce time */
88#define AT91_ADC_TSMR_PENDBC_(x) ((x) << 28)
89#define AT91_ADC_TSMR_NOTSDMA (1 << 22) /* No Touchscreen DMA */
90#define AT91_ADC_TSMR_PENDET_DIS (0 << 24) /* Pen contact detection disable */
91#define AT91_ADC_TSMR_PENDET_ENA (1 << 24) /* Pen contact detection enable */
92
93#define AT91_ADC_TSXPOSR 0xB4
94#define AT91_ADC_TSYPOSR 0xB8
95#define AT91_ADC_TSPRESSR 0xBC
96
97#define AT91_ADC_TRGR_9260 AT91_ADC_MR
98#define AT91_ADC_TRGR_9G45 0x08
99#define AT91_ADC_TRGR_9X5 0xC0
100
101/* Trigger Register bit field */
102#define AT91_ADC_TRGR_TRGPER (0xffff << 16)
103#define AT91_ADC_TRGR_TRGPER_(x) ((x) << 16)
104#define AT91_ADC_TRGR_TRGMOD (0x7 << 0)
105#define AT91_ADC_TRGR_MOD_PERIOD_TRIG (5 << 0)
106
107#endif
diff --git a/arch/arm/mach-at91/include/mach/hardware.h b/arch/arm/mach-at91/include/mach/hardware.h
index f17aa3150019..56338245653a 100644
--- a/arch/arm/mach-at91/include/mach/hardware.h
+++ b/arch/arm/mach-at91/include/mach/hardware.h
@@ -104,5 +104,20 @@
104/* Clocks */ 104/* Clocks */
105#define AT91_SLOW_CLOCK 32768 /* slow clock */ 105#define AT91_SLOW_CLOCK 32768 /* slow clock */
106 106
107/*
108 * FIXME: this is needed to communicate between the pinctrl driver and
109 * the PM implementation in the machine. Possibly part of the PM
110 * implementation should be moved down into the pinctrl driver and get
111 * called as part of the generic suspend/resume path.
112 */
113#ifndef __ASSEMBLY__
114#ifdef CONFIG_PINCTRL_AT91
115extern void at91_pinctrl_gpio_suspend(void);
116extern void at91_pinctrl_gpio_resume(void);
117#else
118static inline void at91_pinctrl_gpio_suspend(void) {}
119static inline void at91_pinctrl_gpio_resume(void) {}
120#endif
121#endif
107 122
108#endif 123#endif
diff --git a/arch/arm/mach-at91/leds.c b/arch/arm/mach-at91/leds.c
index 3e22978b5547..77c4d8fd03fd 100644
--- a/arch/arm/mach-at91/leds.c
+++ b/arch/arm/mach-at91/leds.c
@@ -16,6 +16,7 @@
16#include <linux/platform_device.h> 16#include <linux/platform_device.h>
17 17
18#include "board.h" 18#include "board.h"
19#include "gpio.h"
19 20
20 21
21/* ------------------------------------------------------------------------- */ 22/* ------------------------------------------------------------------------- */
diff --git a/arch/arm/mach-at91/pm.c b/arch/arm/mach-at91/pm.c
index 8bda1cefdf96..e95554532987 100644
--- a/arch/arm/mach-at91/pm.c
+++ b/arch/arm/mach-at91/pm.c
@@ -32,6 +32,7 @@
32#include "at91_aic.h" 32#include "at91_aic.h"
33#include "generic.h" 33#include "generic.h"
34#include "pm.h" 34#include "pm.h"
35#include "gpio.h"
35 36
36/* 37/*
37 * Show the reason for the previous system reset. 38 * Show the reason for the previous system reset.