aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/avr32/mach-at32ap/at32ap7000.c65
-rw-r--r--include/asm-avr32/arch-at32ap/board.h7
2 files changed, 72 insertions, 0 deletions
diff --git a/arch/avr32/mach-at32ap/at32ap7000.c b/arch/avr32/mach-at32ap/at32ap7000.c
index f6d154ca4d24..30aedc9473f7 100644
--- a/arch/avr32/mach-at32ap/at32ap7000.c
+++ b/arch/avr32/mach-at32ap/at32ap7000.c
@@ -1228,6 +1228,71 @@ out_free_pdev:
1228} 1228}
1229 1229
1230/* -------------------------------------------------------------------- 1230/* --------------------------------------------------------------------
1231 * IDE
1232 * -------------------------------------------------------------------- */
1233static struct ide_platform_data at32_ide0_data;
1234static struct resource at32_ide0_resource[] = {
1235 {
1236 .start = 0x04000000,
1237 .end = 0x07ffffff,
1238 .flags = IORESOURCE_MEM,
1239 },
1240 IRQ(~0UL), /* Magic IRQ will be overridden */
1241};
1242DEFINE_DEV_DATA(at32_ide, 0);
1243
1244struct platform_device *__init
1245at32_add_device_ide(unsigned int id, unsigned int extint,
1246 struct ide_platform_data *data)
1247{
1248 struct platform_device *pdev;
1249 unsigned int extint_pin;
1250
1251 switch (extint) {
1252 case 0:
1253 extint_pin = GPIO_PIN_PB(25);
1254 break;
1255 case 1:
1256 extint_pin = GPIO_PIN_PB(26);
1257 break;
1258 case 2:
1259 extint_pin = GPIO_PIN_PB(27);
1260 break;
1261 case 3:
1262 extint_pin = GPIO_PIN_PB(28);
1263 break;
1264 default:
1265 return NULL;
1266 }
1267
1268 switch (id) {
1269 case 0:
1270 pdev = &at32_ide0_device;
1271 select_peripheral(PE(19), PERIPH_A, 0); /* CFCE1 -> CS0_N */
1272 select_peripheral(PE(20), PERIPH_A, 0); /* CFCE2 -> CS1_N */
1273 select_peripheral(PE(21), PERIPH_A, 0); /* NCS4 -> OE_N */
1274 select_peripheral(PE(23), PERIPH_A, 0); /* CFRNW -> DIR */
1275 select_peripheral(PE(24), PERIPH_A, 0); /* NWAIT <- IORDY */
1276 set_ebi_sfr_bits(HMATRIX_BIT(CS4A));
1277 data->cs = 4;
1278 break;
1279 default:
1280 return NULL;
1281 }
1282
1283 at32_select_periph(extint_pin, GPIO_PERIPH_A, AT32_GPIOF_DEGLITCH);
1284
1285 pdev->resource[1].start = EIM_IRQ_BASE + extint;
1286 pdev->resource[1].end = pdev->resource[1].start;
1287
1288 memcpy(pdev->dev.platform_data, data, sizeof(struct ide_platform_data));
1289
1290 platform_device_register(pdev);
1291
1292 return pdev;
1293}
1294
1295/* --------------------------------------------------------------------
1231 * GCLK 1296 * GCLK
1232 * -------------------------------------------------------------------- */ 1297 * -------------------------------------------------------------------- */
1233static struct clk gclk0 = { 1298static struct clk gclk0 = {
diff --git a/include/asm-avr32/arch-at32ap/board.h b/include/asm-avr32/arch-at32ap/board.h
index 7dbd603c38cc..c18160f29cbd 100644
--- a/include/asm-avr32/arch-at32ap/board.h
+++ b/include/asm-avr32/arch-at32ap/board.h
@@ -44,6 +44,13 @@ struct usba_platform_data {
44struct platform_device * 44struct platform_device *
45at32_add_device_usba(unsigned int id, struct usba_platform_data *data); 45at32_add_device_usba(unsigned int id, struct usba_platform_data *data);
46 46
47struct ide_platform_data {
48 u8 cs;
49};
50struct platform_device *
51at32_add_device_ide(unsigned int id, unsigned int extint,
52 struct ide_platform_data *data);
53
47/* depending on what's hooked up, not all SSC pins will be used */ 54/* depending on what's hooked up, not all SSC pins will be used */
48#define ATMEL_SSC_TK 0x01 55#define ATMEL_SSC_TK 0x01
49#define ATMEL_SSC_TF 0x02 56#define ATMEL_SSC_TF 0x02