aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAtsushi Nemoto <anemo@mba.ocn.ne.jp>2008-10-23 17:22:08 -0400
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-10-23 17:22:08 -0400
commit5d1d2f8c26f2d197df1f4b6a7f4c0088b190343e (patch)
tree7afc785b49f604111c6ebc78ec68208cee22abbb
parent37897989232e6533772b0e24369b35ee9f56c8b6 (diff)
TXx9: Add TX4938 ATA support (v3)
Add a helper routine to register tx4938ide driver and use it on RBTX4938 board. Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp> Acked-by: Ralf Baechle <ralf@linux-mips.org> Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
-rw-r--r--arch/mips/include/asm/txx9/tx4938.h13
-rw-r--r--arch/mips/txx9/generic/setup_tx4938.c47
-rw-r--r--arch/mips/txx9/rbtx4938/setup.c1
3 files changed, 61 insertions, 0 deletions
diff --git a/arch/mips/include/asm/txx9/tx4938.h b/arch/mips/include/asm/txx9/tx4938.h
index 989e7751135a..0b068154054c 100644
--- a/arch/mips/include/asm/txx9/tx4938.h
+++ b/arch/mips/include/asm/txx9/tx4938.h
@@ -292,4 +292,17 @@ void tx4938_setup_pcierr_irq(void);
292void tx4938_irq_init(void); 292void tx4938_irq_init(void);
293void tx4938_mtd_init(int ch); 293void tx4938_mtd_init(int ch);
294 294
295struct tx4938ide_platform_info {
296 /*
297 * I/O port shift, for platforms with ports that are
298 * constantly spaced and need larger than the 1-byte
299 * spacing used by ata_std_ports().
300 */
301 unsigned int ioport_shift;
302 unsigned int gbus_clock; /* 0 means no PIO mode tuning. */
303 unsigned int ebus_ch;
304};
305
306void tx4938_ata_init(unsigned int irq, unsigned int shift, int tune);
307
295#endif 308#endif
diff --git a/arch/mips/txx9/generic/setup_tx4938.c b/arch/mips/txx9/generic/setup_tx4938.c
index af724e53ef91..25819ff1c350 100644
--- a/arch/mips/txx9/generic/setup_tx4938.c
+++ b/arch/mips/txx9/generic/setup_tx4938.c
@@ -16,6 +16,7 @@
16#include <linux/param.h> 16#include <linux/param.h>
17#include <linux/ptrace.h> 17#include <linux/ptrace.h>
18#include <linux/mtd/physmap.h> 18#include <linux/mtd/physmap.h>
19#include <linux/platform_device.h>
19#include <asm/reboot.h> 20#include <asm/reboot.h>
20#include <asm/traps.h> 21#include <asm/traps.h>
21#include <asm/txx9irq.h> 22#include <asm/txx9irq.h>
@@ -335,6 +336,52 @@ void __init tx4938_mtd_init(int ch)
335 txx9_physmap_flash_init(ch, start, size, &pdata); 336 txx9_physmap_flash_init(ch, start, size, &pdata);
336} 337}
337 338
339void __init tx4938_ata_init(unsigned int irq, unsigned int shift, int tune)
340{
341 struct platform_device *pdev;
342 struct resource res[] = {
343 {
344 /* .start and .end are filled in later */
345 .flags = IORESOURCE_MEM,
346 }, {
347 .start = irq,
348 .flags = IORESOURCE_IRQ,
349 },
350 };
351 struct tx4938ide_platform_info pdata = {
352 .ioport_shift = shift,
353 /*
354 * The IDE driver should not change bus timings if other ISA
355 * devices existed.
356 */
357 .gbus_clock = tune ? txx9_gbus_clock : 0,
358 };
359 u64 ebccr;
360 int i;
361
362 if ((__raw_readq(&tx4938_ccfgptr->pcfg) &
363 (TX4938_PCFG_ATA_SEL | TX4938_PCFG_NDF_SEL))
364 != TX4938_PCFG_ATA_SEL)
365 return;
366 for (i = 0; i < 8; i++) {
367 /* check EBCCRn.ISA, EBCCRn.BSZ, EBCCRn.ME */
368 ebccr = __raw_readq(&tx4938_ebuscptr->cr[i]);
369 if ((ebccr & 0x00f00008) == 0x00e00008)
370 break;
371 }
372 if (i == 8)
373 return;
374 pdata.ebus_ch = i;
375 res[0].start = ((ebccr >> 48) << 20) + 0x10000;
376 res[0].end = res[0].start + 0x20000 - 1;
377 pdev = platform_device_alloc("tx4938ide", -1);
378 if (!pdev ||
379 platform_device_add_resources(pdev, res, ARRAY_SIZE(res)) ||
380 platform_device_add_data(pdev, &pdata, sizeof(pdata)) ||
381 platform_device_add(pdev))
382 platform_device_put(pdev);
383}
384
338static void __init tx4938_stop_unused_modules(void) 385static void __init tx4938_stop_unused_modules(void)
339{ 386{
340 __u64 pcfg, rst = 0, ckd = 0; 387 __u64 pcfg, rst = 0, ckd = 0;
diff --git a/arch/mips/txx9/rbtx4938/setup.c b/arch/mips/txx9/rbtx4938/setup.c
index e077cc4d3a59..547ff2920bf0 100644
--- a/arch/mips/txx9/rbtx4938/setup.c
+++ b/arch/mips/txx9/rbtx4938/setup.c
@@ -352,6 +352,7 @@ static void __init rbtx4938_device_init(void)
352 rbtx4938_ne_init(); 352 rbtx4938_ne_init();
353 tx4938_wdt_init(); 353 tx4938_wdt_init();
354 rbtx4938_mtd_init(); 354 rbtx4938_mtd_init();
355 tx4938_ata_init(RBTX4938_IRQ_IOC_ATA, 0, 1);
355 txx9_iocled_init(RBTX4938_LED_ADDR - IO_BASE, -1, 8, 1, "green", NULL); 356 txx9_iocled_init(RBTX4938_LED_ADDR - IO_BASE, -1, 8, 1, "green", NULL);
356} 357}
357 358