aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-at91
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-05-22 19:34:21 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-05-22 19:34:21 -0400
commitfb09bafda67041b74a668dc9d77735e36bd33d3b (patch)
tree2dd32b65062a95045468fdcab366ecdb8e4fcac6 /arch/arm/mach-at91
parent94b5aff4c6f72fee6b0f49d49e4fa8b204e8ded9 (diff)
parentc3c6cc91b0ae7b3d598488ad0b593bafba4a0817 (diff)
Merge tag 'staging-3.5-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging
Pull staging tree changes from Greg Kroah-Hartman: "Here is the big staging tree pull request for the 3.5-rc1 merge window. Loads of changes here, and we just narrowly added more lines than we added: 622 files changed, 28356 insertions(+), 26059 deletions(-) But, good news is that there is a number of subsystems that moved out of the staging tree, to their respective "real" portions of the kernel. Code that moved out was: - iio core code - mei driver - vme core and bridge drivers There was one broken network driver that moved into staging as a step before it is removed from the tree (pc300), and there was a few new drivers added to the tree: - new iio drivers - gdm72xx wimax USB driver - ipack subsystem and 2 drivers All of the movements around have acks from the various subsystem maintainers, and all of this has been in the linux-next tree for a while. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>" Fixed up various trivial conflicts, along with a non-trivial one found in -next and pointed out by Olof Johanssen: a clean - but incorrect - merge of the arch/arm/boot/dts/at91sam9g20.dtsi file. Fix up manually as per Stephen Rothwell. * tag 'staging-3.5-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging: (536 commits) Staging: bcm: Remove two unused variables from Adapter.h Staging: bcm: Removes the volatile type definition from Adapter.h Staging: bcm: Rename all "INT" to "int" in Adapter.h Staging: bcm: Fix warning: __packed vs. __attribute__((packed)) in Adapter.h Staging: bcm: Correctly format all comments in Adapter.h Staging: bcm: Fix all whitespace issues in Adapter.h Staging: bcm: Properly format braces in Adapter.h Staging: ipack/bridges/tpci200: remove unneeded casts Staging: ipack/bridges/tpci200: remove TPCI200_SHORTNAME constant Staging: ipack: remove board_name and bus_name fields from struct ipack_device Staging: ipack: improve the register of a bus and a device in the bus. staging: comedi: cleanup all the comedi_driver 'detach' functions staging: comedi: remove all 'default N' in Kconfig staging: line6/config.h: Delete unused header staging: gdm72xx depends on NET staging: gdm72xx: Set up parent link in sysfs for gdm72xx devices staging: drm/omap: initial dmabuf/prime import support staging: drm/omap: dmabuf/prime mmap support pstore/ram: Add ECC support pstore/ram: Switch to persistent_ram routines ...
Diffstat (limited to 'arch/arm/mach-at91')
-rw-r--r--arch/arm/mach-at91/at91sam9260.c8
-rw-r--r--arch/arm/mach-at91/at91sam9260_devices.c90
-rw-r--r--arch/arm/mach-at91/at91sam9g45.c9
-rw-r--r--arch/arm/mach-at91/at91sam9g45_devices.c101
-rw-r--r--arch/arm/mach-at91/at91sam9x5.c6
-rw-r--r--arch/arm/mach-at91/board-sam9g20ek.c14
-rw-r--r--arch/arm/mach-at91/board-sam9m10g45ek.c12
7 files changed, 240 insertions, 0 deletions
diff --git a/arch/arm/mach-at91/at91sam9260.c b/arch/arm/mach-at91/at91sam9260.c
index a27bbec50ca3..2b1e438ed878 100644
--- a/arch/arm/mach-at91/at91sam9260.c
+++ b/arch/arm/mach-at91/at91sam9260.c
@@ -55,6 +55,13 @@ static struct clk adc_clk = {
55 .pmc_mask = 1 << AT91SAM9260_ID_ADC, 55 .pmc_mask = 1 << AT91SAM9260_ID_ADC,
56 .type = CLK_TYPE_PERIPHERAL, 56 .type = CLK_TYPE_PERIPHERAL,
57}; 57};
58
59static struct clk adc_op_clk = {
60 .name = "adc_op_clk",
61 .type = CLK_TYPE_PERIPHERAL,
62 .rate_hz = 5000000,
63};
64
58static struct clk usart0_clk = { 65static struct clk usart0_clk = {
59 .name = "usart0_clk", 66 .name = "usart0_clk",
60 .pmc_mask = 1 << AT91SAM9260_ID_US0, 67 .pmc_mask = 1 << AT91SAM9260_ID_US0,
@@ -166,6 +173,7 @@ static struct clk *periph_clocks[] __initdata = {
166 &pioB_clk, 173 &pioB_clk,
167 &pioC_clk, 174 &pioC_clk,
168 &adc_clk, 175 &adc_clk,
176 &adc_op_clk,
169 &usart0_clk, 177 &usart0_clk,
170 &usart1_clk, 178 &usart1_clk,
171 &usart2_clk, 179 &usart2_clk,
diff --git a/arch/arm/mach-at91/at91sam9260_devices.c b/arch/arm/mach-at91/at91sam9260_devices.c
index d556de141114..0ded951f785a 100644
--- a/arch/arm/mach-at91/at91sam9260_devices.c
+++ b/arch/arm/mach-at91/at91sam9260_devices.c
@@ -17,12 +17,15 @@
17#include <linux/platform_device.h> 17#include <linux/platform_device.h>
18#include <linux/i2c-gpio.h> 18#include <linux/i2c-gpio.h>
19 19
20#include <linux/platform_data/at91_adc.h>
21
20#include <mach/board.h> 22#include <mach/board.h>
21#include <mach/cpu.h> 23#include <mach/cpu.h>
22#include <mach/at91sam9260.h> 24#include <mach/at91sam9260.h>
23#include <mach/at91sam9260_matrix.h> 25#include <mach/at91sam9260_matrix.h>
24#include <mach/at91_matrix.h> 26#include <mach/at91_matrix.h>
25#include <mach/at91sam9_smc.h> 27#include <mach/at91sam9_smc.h>
28#include <mach/at91_adc.h>
26 29
27#include "generic.h" 30#include "generic.h"
28 31
@@ -1340,6 +1343,93 @@ void __init at91_add_device_cf(struct at91_cf_data *data)
1340void __init at91_add_device_cf(struct at91_cf_data * data) {} 1343void __init at91_add_device_cf(struct at91_cf_data * data) {}
1341#endif 1344#endif
1342 1345
1346/* --------------------------------------------------------------------
1347 * ADCs
1348 * -------------------------------------------------------------------- */
1349
1350#if IS_ENABLED(CONFIG_AT91_ADC)
1351static struct at91_adc_data adc_data;
1352
1353static struct resource adc_resources[] = {
1354 [0] = {
1355 .start = AT91SAM9260_BASE_ADC,
1356 .end = AT91SAM9260_BASE_ADC + SZ_16K - 1,
1357 .flags = IORESOURCE_MEM,
1358 },
1359 [1] = {
1360 .start = AT91SAM9260_ID_ADC,
1361 .end = AT91SAM9260_ID_ADC,
1362 .flags = IORESOURCE_IRQ,
1363 },
1364};
1365
1366static struct platform_device at91_adc_device = {
1367 .name = "at91_adc",
1368 .id = -1,
1369 .dev = {
1370 .platform_data = &adc_data,
1371 },
1372 .resource = adc_resources,
1373 .num_resources = ARRAY_SIZE(adc_resources),
1374};
1375
1376static struct at91_adc_trigger at91_adc_triggers[] = {
1377 [0] = {
1378 .name = "timer-counter-0",
1379 .value = AT91_ADC_TRGSEL_TC0 | AT91_ADC_TRGEN,
1380 },
1381 [1] = {
1382 .name = "timer-counter-1",
1383 .value = AT91_ADC_TRGSEL_TC1 | AT91_ADC_TRGEN,
1384 },
1385 [2] = {
1386 .name = "timer-counter-2",
1387 .value = AT91_ADC_TRGSEL_TC2 | AT91_ADC_TRGEN,
1388 },
1389 [3] = {
1390 .name = "external",
1391 .value = AT91_ADC_TRGSEL_EXTERNAL | AT91_ADC_TRGEN,
1392 .is_external = true,
1393 },
1394};
1395
1396static struct at91_adc_reg_desc at91_adc_register_g20 = {
1397 .channel_base = AT91_ADC_CHR(0),
1398 .drdy_mask = AT91_ADC_DRDY,
1399 .status_register = AT91_ADC_SR,
1400 .trigger_register = AT91_ADC_MR,
1401};
1402
1403void __init at91_add_device_adc(struct at91_adc_data *data)
1404{
1405 if (!data)
1406 return;
1407
1408 if (test_bit(0, &data->channels_used))
1409 at91_set_A_periph(AT91_PIN_PC0, 0);
1410 if (test_bit(1, &data->channels_used))
1411 at91_set_A_periph(AT91_PIN_PC1, 0);
1412 if (test_bit(2, &data->channels_used))
1413 at91_set_A_periph(AT91_PIN_PC2, 0);
1414 if (test_bit(3, &data->channels_used))
1415 at91_set_A_periph(AT91_PIN_PC3, 0);
1416
1417 if (data->use_external_triggers)
1418 at91_set_A_periph(AT91_PIN_PA22, 0);
1419
1420 data->num_channels = 4;
1421 data->startup_time = 10;
1422 data->registers = &at91_adc_register_g20;
1423 data->trigger_number = 4;
1424 data->trigger_list = at91_adc_triggers;
1425
1426 adc_data = *data;
1427 platform_device_register(&at91_adc_device);
1428}
1429#else
1430void __init at91_add_device_adc(struct at91_adc_data *data) {}
1431#endif
1432
1343/* -------------------------------------------------------------------- */ 1433/* -------------------------------------------------------------------- */
1344/* 1434/*
1345 * These devices are always present and don't need any board-specific 1435 * These devices are always present and don't need any board-specific
diff --git a/arch/arm/mach-at91/at91sam9g45.c b/arch/arm/mach-at91/at91sam9g45.c
index f2054495a655..4792682d52b9 100644
--- a/arch/arm/mach-at91/at91sam9g45.c
+++ b/arch/arm/mach-at91/at91sam9g45.c
@@ -176,6 +176,12 @@ static struct clk vdec_clk = {
176 .type = CLK_TYPE_PERIPHERAL, 176 .type = CLK_TYPE_PERIPHERAL,
177}; 177};
178 178
179static struct clk adc_op_clk = {
180 .name = "adc_op_clk",
181 .type = CLK_TYPE_PERIPHERAL,
182 .rate_hz = 13200000,
183};
184
179static struct clk *periph_clocks[] __initdata = { 185static struct clk *periph_clocks[] __initdata = {
180 &pioA_clk, 186 &pioA_clk,
181 &pioB_clk, 187 &pioB_clk,
@@ -204,6 +210,7 @@ static struct clk *periph_clocks[] __initdata = {
204 &isi_clk, 210 &isi_clk,
205 &udphs_clk, 211 &udphs_clk,
206 &mmc1_clk, 212 &mmc1_clk,
213 &adc_op_clk,
207 // irq0 214 // irq0
208}; 215};
209 216
@@ -242,6 +249,8 @@ static struct clk_lookup periph_clocks_lookups[] = {
242 CLKDEV_CON_ID("pioC", &pioC_clk), 249 CLKDEV_CON_ID("pioC", &pioC_clk),
243 CLKDEV_CON_ID("pioD", &pioDE_clk), 250 CLKDEV_CON_ID("pioD", &pioDE_clk),
244 CLKDEV_CON_ID("pioE", &pioDE_clk), 251 CLKDEV_CON_ID("pioE", &pioDE_clk),
252 /* Fake adc clock */
253 CLKDEV_CON_ID("adc_clk", &tsc_clk),
245}; 254};
246 255
247static struct clk_lookup usart_clocks_lookups[] = { 256static struct clk_lookup usart_clocks_lookups[] = {
diff --git a/arch/arm/mach-at91/at91sam9g45_devices.c b/arch/arm/mach-at91/at91sam9g45_devices.c
index 35bd42d02195..f6747246d649 100644
--- a/arch/arm/mach-at91/at91sam9g45_devices.c
+++ b/arch/arm/mach-at91/at91sam9g45_devices.c
@@ -19,9 +19,12 @@
19#include <linux/i2c-gpio.h> 19#include <linux/i2c-gpio.h>
20#include <linux/atmel-mci.h> 20#include <linux/atmel-mci.h>
21 21
22#include <linux/platform_data/at91_adc.h>
23
22#include <linux/fb.h> 24#include <linux/fb.h>
23#include <video/atmel_lcdc.h> 25#include <video/atmel_lcdc.h>
24 26
27#include <mach/at91_adc.h>
25#include <mach/board.h> 28#include <mach/board.h>
26#include <mach/at91sam9g45.h> 29#include <mach/at91sam9g45.h>
27#include <mach/at91sam9g45_matrix.h> 30#include <mach/at91sam9g45_matrix.h>
@@ -1182,6 +1185,104 @@ void __init at91_add_device_tsadcc(struct at91_tsadcc_data *data) {}
1182 1185
1183 1186
1184/* -------------------------------------------------------------------- 1187/* --------------------------------------------------------------------
1188 * ADC
1189 * -------------------------------------------------------------------- */
1190
1191#if IS_ENABLED(CONFIG_AT91_ADC)
1192static struct at91_adc_data adc_data;
1193
1194static struct resource adc_resources[] = {
1195 [0] = {
1196 .start = AT91SAM9G45_BASE_TSC,
1197 .end = AT91SAM9G45_BASE_TSC + SZ_16K - 1,
1198 .flags = IORESOURCE_MEM,
1199 },
1200 [1] = {
1201 .start = AT91SAM9G45_ID_TSC,
1202 .end = AT91SAM9G45_ID_TSC,
1203 .flags = IORESOURCE_IRQ,
1204 }
1205};
1206
1207static struct platform_device at91_adc_device = {
1208 .name = "at91_adc",
1209 .id = -1,
1210 .dev = {
1211 .platform_data = &adc_data,
1212 },
1213 .resource = adc_resources,
1214 .num_resources = ARRAY_SIZE(adc_resources),
1215};
1216
1217static struct at91_adc_trigger at91_adc_triggers[] = {
1218 [0] = {
1219 .name = "external-rising",
1220 .value = 1,
1221 .is_external = true,
1222 },
1223 [1] = {
1224 .name = "external-falling",
1225 .value = 2,
1226 .is_external = true,
1227 },
1228 [2] = {
1229 .name = "external-any",
1230 .value = 3,
1231 .is_external = true,
1232 },
1233 [3] = {
1234 .name = "continuous",
1235 .value = 6,
1236 .is_external = false,
1237 },
1238};
1239
1240static struct at91_adc_reg_desc at91_adc_register_g45 = {
1241 .channel_base = AT91_ADC_CHR(0),
1242 .drdy_mask = AT91_ADC_DRDY,
1243 .status_register = AT91_ADC_SR,
1244 .trigger_register = 0x08,
1245};
1246
1247void __init at91_add_device_adc(struct at91_adc_data *data)
1248{
1249 if (!data)
1250 return;
1251
1252 if (test_bit(0, &data->channels_used))
1253 at91_set_gpio_input(AT91_PIN_PD20, 0);
1254 if (test_bit(1, &data->channels_used))
1255 at91_set_gpio_input(AT91_PIN_PD21, 0);
1256 if (test_bit(2, &data->channels_used))
1257 at91_set_gpio_input(AT91_PIN_PD22, 0);
1258 if (test_bit(3, &data->channels_used))
1259 at91_set_gpio_input(AT91_PIN_PD23, 0);
1260 if (test_bit(4, &data->channels_used))
1261 at91_set_gpio_input(AT91_PIN_PD24, 0);
1262 if (test_bit(5, &data->channels_used))
1263 at91_set_gpio_input(AT91_PIN_PD25, 0);
1264 if (test_bit(6, &data->channels_used))
1265 at91_set_gpio_input(AT91_PIN_PD26, 0);
1266 if (test_bit(7, &data->channels_used))
1267 at91_set_gpio_input(AT91_PIN_PD27, 0);
1268
1269 if (data->use_external_triggers)
1270 at91_set_A_periph(AT91_PIN_PD28, 0);
1271
1272 data->num_channels = 8;
1273 data->startup_time = 40;
1274 data->registers = &at91_adc_register_g45;
1275 data->trigger_number = 4;
1276 data->trigger_list = at91_adc_triggers;
1277
1278 adc_data = *data;
1279 platform_device_register(&at91_adc_device);
1280}
1281#else
1282void __init at91_add_device_adc(struct at91_adc_data *data) {}
1283#endif
1284
1285/* --------------------------------------------------------------------
1185 * RTT 1286 * RTT
1186 * -------------------------------------------------------------------- */ 1287 * -------------------------------------------------------------------- */
1187 1288
diff --git a/arch/arm/mach-at91/at91sam9x5.c b/arch/arm/mach-at91/at91sam9x5.c
index 13c8cae60462..1b144b4d3ce1 100644
--- a/arch/arm/mach-at91/at91sam9x5.c
+++ b/arch/arm/mach-at91/at91sam9x5.c
@@ -120,6 +120,11 @@ static struct clk adc_clk = {
120 .pmc_mask = 1 << AT91SAM9X5_ID_ADC, 120 .pmc_mask = 1 << AT91SAM9X5_ID_ADC,
121 .type = CLK_TYPE_PERIPHERAL, 121 .type = CLK_TYPE_PERIPHERAL,
122}; 122};
123static struct clk adc_op_clk = {
124 .name = "adc_op_clk",
125 .type = CLK_TYPE_PERIPHERAL,
126 .rate_hz = 5000000,
127};
123static struct clk dma0_clk = { 128static struct clk dma0_clk = {
124 .name = "dma0_clk", 129 .name = "dma0_clk",
125 .pmc_mask = 1 << AT91SAM9X5_ID_DMA0, 130 .pmc_mask = 1 << AT91SAM9X5_ID_DMA0,
@@ -205,6 +210,7 @@ static struct clk *periph_clocks[] __initdata = {
205 &tcb0_clk, 210 &tcb0_clk,
206 &pwm_clk, 211 &pwm_clk,
207 &adc_clk, 212 &adc_clk,
213 &adc_op_clk,
208 &dma0_clk, 214 &dma0_clk,
209 &dma1_clk, 215 &dma1_clk,
210 &uhphs_clk, 216 &uhphs_clk,
diff --git a/arch/arm/mach-at91/board-sam9g20ek.c b/arch/arm/mach-at91/board-sam9g20ek.c
index 3d615532ae5c..6860d3451100 100644
--- a/arch/arm/mach-at91/board-sam9g20ek.c
+++ b/arch/arm/mach-at91/board-sam9g20ek.c
@@ -32,6 +32,8 @@
32#include <linux/regulator/fixed.h> 32#include <linux/regulator/fixed.h>
33#include <linux/regulator/consumer.h> 33#include <linux/regulator/consumer.h>
34 34
35#include <linux/platform_data/at91_adc.h>
36
35#include <mach/hardware.h> 37#include <mach/hardware.h>
36#include <asm/setup.h> 38#include <asm/setup.h>
37#include <asm/mach-types.h> 39#include <asm/mach-types.h>
@@ -304,6 +306,16 @@ static void __init ek_add_device_buttons(void)
304static void __init ek_add_device_buttons(void) {} 306static void __init ek_add_device_buttons(void) {}
305#endif 307#endif
306 308
309/*
310 * ADCs
311 */
312
313static struct at91_adc_data ek_adc_data = {
314 .channels_used = BIT(0) | BIT(1) | BIT(2) | BIT(3),
315 .use_external_triggers = true,
316 .vref = 3300,
317};
318
307#if defined(CONFIG_REGULATOR_FIXED_VOLTAGE) || defined(CONFIG_REGULATOR_FIXED_VOLTAGE_MODULE) 319#if defined(CONFIG_REGULATOR_FIXED_VOLTAGE) || defined(CONFIG_REGULATOR_FIXED_VOLTAGE_MODULE)
308static struct regulator_consumer_supply ek_audio_consumer_supplies[] = { 320static struct regulator_consumer_supply ek_audio_consumer_supplies[] = {
309 REGULATOR_SUPPLY("AVDD", "0-001b"), 321 REGULATOR_SUPPLY("AVDD", "0-001b"),
@@ -389,6 +401,8 @@ static void __init ek_board_init(void)
389 ek_add_device_gpio_leds(); 401 ek_add_device_gpio_leds();
390 /* Push Buttons */ 402 /* Push Buttons */
391 ek_add_device_buttons(); 403 ek_add_device_buttons();
404 /* ADCs */
405 at91_add_device_adc(&ek_adc_data);
392 /* PCK0 provides MCLK to the WM8731 */ 406 /* PCK0 provides MCLK to the WM8731 */
393 at91_set_B_periph(AT91_PIN_PC1, 0); 407 at91_set_B_periph(AT91_PIN_PC1, 0);
394 /* SSC (for WM8731) */ 408 /* SSC (for WM8731) */
diff --git a/arch/arm/mach-at91/board-sam9m10g45ek.c b/arch/arm/mach-at91/board-sam9m10g45ek.c
index 9a87f0b072f8..63163dc7df46 100644
--- a/arch/arm/mach-at91/board-sam9m10g45ek.c
+++ b/arch/arm/mach-at91/board-sam9m10g45ek.c
@@ -27,6 +27,8 @@
27#include <linux/atmel-mci.h> 27#include <linux/atmel-mci.h>
28#include <linux/delay.h> 28#include <linux/delay.h>
29 29
30#include <linux/platform_data/at91_adc.h>
31
30#include <mach/hardware.h> 32#include <mach/hardware.h>
31#include <video/atmel_lcdc.h> 33#include <video/atmel_lcdc.h>
32#include <media/soc_camera.h> 34#include <media/soc_camera.h>
@@ -305,6 +307,14 @@ static struct at91_tsadcc_data ek_tsadcc_data = {
305 .ts_sample_hold_time = 0x0a, 307 .ts_sample_hold_time = 0x0a,
306}; 308};
307 309
310/*
311 * ADCs
312 */
313static struct at91_adc_data ek_adc_data = {
314 .channels_used = BIT(0) | BIT(1) | BIT(2) | BIT(3) | BIT(4) | BIT(5) | BIT(6) | BIT(7),
315 .use_external_triggers = true,
316 .vref = 3300,
317};
308 318
309/* 319/*
310 * GPIO Buttons 320 * GPIO Buttons
@@ -476,6 +486,8 @@ static void __init ek_board_init(void)
476 at91_add_device_lcdc(&ek_lcdc_data); 486 at91_add_device_lcdc(&ek_lcdc_data);
477 /* Touch Screen */ 487 /* Touch Screen */
478 at91_add_device_tsadcc(&ek_tsadcc_data); 488 at91_add_device_tsadcc(&ek_tsadcc_data);
489 /* ADC */
490 at91_add_device_adc(&ek_adc_data);
479 /* Push Buttons */ 491 /* Push Buttons */
480 ek_add_device_buttons(); 492 ek_add_device_buttons();
481 /* AC97 */ 493 /* AC97 */