aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm
diff options
context:
space:
mode:
authorAndrew Victor <linux@maxim.org.za>2008-04-02 17:18:35 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2008-04-04 04:52:27 -0400
commit5e9df924dd51beaf007ffba42b5deb47e1c6249b (patch)
treebf4a34790a09100321f5f6857bf7a0d5fc251285 /arch/arm
parente5f40bfaf309ec4cc27b717d48fb0824313e5ef8 (diff)
[ARM] 4910/1: [AT91] AT73C213 audio on SAM9260-EK and SAM9261-EK boards
Add support for AT73C213 audio DAC on the Atmel SAM9260-EK and SAM9261-EK boards. Signed-off-by: Sedji Gaouaou <sedji.gaouaou@atmel.com> Signed-off-by: Andrew Victor <linux@maxim.org.za> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm')
-rw-r--r--arch/arm/mach-at91/board-sam9260ek.c37
-rw-r--r--arch/arm/mach-at91/board-sam9261ek.c38
2 files changed, 74 insertions, 1 deletions
diff --git a/arch/arm/mach-at91/board-sam9260ek.c b/arch/arm/mach-at91/board-sam9260ek.c
index 440553632b53..40c3e95690a9 100644
--- a/arch/arm/mach-at91/board-sam9260ek.c
+++ b/arch/arm/mach-at91/board-sam9260ek.c
@@ -25,6 +25,8 @@
25#include <linux/module.h> 25#include <linux/module.h>
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/at73c213.h>
29#include <linux/clk.h>
28 30
29#include <asm/hardware.h> 31#include <asm/hardware.h>
30#include <asm/setup.h> 32#include <asm/setup.h>
@@ -37,7 +39,6 @@
37 39
38#include <asm/arch/board.h> 40#include <asm/arch/board.h>
39#include <asm/arch/gpio.h> 41#include <asm/arch/gpio.h>
40#include <asm/arch/at91sam9_smc.h>
41 42
42#include "generic.h" 43#include "generic.h"
43 44
@@ -85,6 +86,35 @@ static struct at91_udc_data __initdata ek_udc_data = {
85 86
86 87
87/* 88/*
89 * Audio
90 */
91static struct at73c213_board_info at73c213_data = {
92 .ssc_id = 0,
93 .shortname = "AT91SAM9260-EK external DAC",
94};
95
96#if defined(CONFIG_SND_AT73C213) || defined(CONFIG_SND_AT73C213_MODULE)
97static void __init at73c213_set_clk(struct at73c213_board_info *info)
98{
99 struct clk *pck0;
100 struct clk *plla;
101
102 pck0 = clk_get(NULL, "pck0");
103 plla = clk_get(NULL, "plla");
104
105 /* AT73C213 MCK Clock */
106 at91_set_B_periph(AT91_PIN_PC1, 0); /* PCK0 */
107
108 clk_set_parent(pck0, plla);
109 clk_put(plla);
110
111 info->dac_clk = pck0;
112}
113#else
114static void __init at73c213_set_clk(struct at73c213_board_info *info) {}
115#endif
116
117/*
88 * SPI devices. 118 * SPI devices.
89 */ 119 */
90static struct spi_board_info ek_spi_devices[] = { 120static struct spi_board_info ek_spi_devices[] = {
@@ -110,6 +140,8 @@ static struct spi_board_info ek_spi_devices[] = {
110 .chip_select = 0, 140 .chip_select = 0,
111 .max_speed_hz = 10 * 1000 * 1000, 141 .max_speed_hz = 10 * 1000 * 1000,
112 .bus_num = 1, 142 .bus_num = 1,
143 .mode = SPI_MODE_1,
144 .platform_data = &at73c213_data,
113 }, 145 },
114#endif 146#endif
115}; 147};
@@ -190,6 +222,9 @@ static void __init ek_board_init(void)
190 at91_add_device_mmc(0, &ek_mmc_data); 222 at91_add_device_mmc(0, &ek_mmc_data);
191 /* I2C */ 223 /* I2C */
192 at91_add_device_i2c(NULL, 0); 224 at91_add_device_i2c(NULL, 0);
225 /* SSC (to AT73C213) */
226 at73c213_set_clk(&at73c213_data);
227 at91_add_device_ssc(AT91SAM9260_ID_SSC, ATMEL_SSC_TX);
193} 228}
194 229
195MACHINE_START(AT91SAM9260EK, "Atmel AT91SAM9260-EK") 230MACHINE_START(AT91SAM9260EK, "Atmel AT91SAM9260-EK")
diff --git a/arch/arm/mach-at91/board-sam9261ek.c b/arch/arm/mach-at91/board-sam9261ek.c
index 3c73825b58de..ce512d74e6e9 100644
--- a/arch/arm/mach-at91/board-sam9261ek.c
+++ b/arch/arm/mach-at91/board-sam9261ek.c
@@ -26,6 +26,8 @@
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/spi/at73c213.h>
30#include <linux/clk.h>
29#include <linux/dm9000.h> 31#include <linux/dm9000.h>
30#include <linux/fb.h> 32#include <linux/fb.h>
31#include <linux/gpio_keys.h> 33#include <linux/gpio_keys.h>
@@ -231,6 +233,35 @@ static void __init ek_add_device_ts(void) {}
231#endif 233#endif
232 234
233/* 235/*
236 * Audio
237 */
238static struct at73c213_board_info at73c213_data = {
239 .ssc_id = 1,
240 .shortname = "AT91SAM9261-EK external DAC",
241};
242
243#if defined(CONFIG_SND_AT73C213) || defined(CONFIG_SND_AT73C213_MODULE)
244static void __init at73c213_set_clk(struct at73c213_board_info *info)
245{
246 struct clk *pck2;
247 struct clk *plla;
248
249 pck2 = clk_get(NULL, "pck2");
250 plla = clk_get(NULL, "plla");
251
252 /* AT73C213 MCK Clock */
253 at91_set_B_periph(AT91_PIN_PB31, 0); /* PCK2 */
254
255 clk_set_parent(pck2, plla);
256 clk_put(plla);
257
258 info->dac_clk = pck2;
259}
260#else
261static void __init at73c213_set_clk(struct at73c213_board_info *info) {}
262#endif
263
264/*
234 * SPI devices 265 * SPI devices
235 */ 266 */
236static struct spi_board_info ek_spi_devices[] = { 267static struct spi_board_info ek_spi_devices[] = {
@@ -248,6 +279,7 @@ static struct spi_board_info ek_spi_devices[] = {
248 .bus_num = 0, 279 .bus_num = 0,
249 .platform_data = &ads_info, 280 .platform_data = &ads_info,
250 .irq = AT91SAM9261_ID_IRQ0, 281 .irq = AT91SAM9261_ID_IRQ0,
282 .controller_data = (void *) AT91_PIN_PA28, /* CS pin */
251 }, 283 },
252#endif 284#endif
253#if defined(CONFIG_MTD_AT91_DATAFLASH_CARD) 285#if defined(CONFIG_MTD_AT91_DATAFLASH_CARD)
@@ -263,6 +295,9 @@ static struct spi_board_info ek_spi_devices[] = {
263 .chip_select = 3, 295 .chip_select = 3,
264 .max_speed_hz = 10 * 1000 * 1000, 296 .max_speed_hz = 10 * 1000 * 1000,
265 .bus_num = 0, 297 .bus_num = 0,
298 .mode = SPI_MODE_1,
299 .platform_data = &at73c213_data,
300 .controller_data = (void*) AT91_PIN_PA29, /* default for CS3 is PA6, but it must be PA29 */
266 }, 301 },
267#endif 302#endif
268}; 303};
@@ -473,6 +508,9 @@ static void __init ek_board_init(void)
473 at91_add_device_spi(ek_spi_devices, ARRAY_SIZE(ek_spi_devices)); 508 at91_add_device_spi(ek_spi_devices, ARRAY_SIZE(ek_spi_devices));
474 /* Touchscreen */ 509 /* Touchscreen */
475 ek_add_device_ts(); 510 ek_add_device_ts();
511 /* SSC (to AT73C213) */
512 at73c213_set_clk(&at73c213_data);
513 at91_add_device_ssc(AT91SAM9261_ID_SSC1, ATMEL_SSC_TX);
476#else 514#else
477 /* MMC */ 515 /* MMC */
478 at91_add_device_mmc(0, &ek_mmc_data); 516 at91_add_device_mmc(0, &ek_mmc_data);