aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorKristoffer Nyborg Gregertsen <kngregertsen@norway.atmel.com>2007-08-16 07:45:00 -0400
committerHaavard Skinnemoen <hskinnemoen@atmel.com>2007-10-23 05:19:05 -0400
commit48021bd93ca339fcafe9b043d05f5d3a58be7c0a (patch)
tree25a4f0a3880a62b948295ad73c5f81ec8cacddf4 /arch
parent55b70a0300b873c0ec7ea6e33752af56f41250ce (diff)
[AVR32] Platform code for pata_at32
This patch adds platform code for PATA devices on the AP7000. [hskinnemoen@atmel.com: board code left out for now since stk1000 doesn't support IDE out of the box] Signed-off-by: Kristoffer Nyborg Gregertsen <kngregertsen@norway.atmel.com> Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/avr32/mach-at32ap/at32ap7000.c65
1 files changed, 65 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 = {