linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 2/2] TXx9: Add TX4939 ATA support (v2)
@ 2008-09-17 15:13 Atsushi Nemoto
  2008-09-20 15:48 ` Sergei Shtylyov
  0 siblings, 1 reply; 7+ messages in thread
From: Atsushi Nemoto @ 2008-09-17 15:13 UTC (permalink / raw)
  To: linux-mips; +Cc: linux-ide, Bartlomiej Zolnierkiewicz, ralf, sshtylyov

Add a helper routine to register tx4939ide driver and use it on
RBTX4939 board.

Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
---
This patch is against linux-next 20080916.

Changes since v1:
* Use static resource arrays and platform_device array.

 arch/mips/txx9/generic/setup_tx4939.c |   46 +++++++++++++++++++++++++++++++++
 arch/mips/txx9/rbtx4939/setup.c       |    1 +
 include/asm-mips/txx9/tx4939.h        |    1 +
 3 files changed, 48 insertions(+), 0 deletions(-)

diff --git a/arch/mips/txx9/generic/setup_tx4939.c b/arch/mips/txx9/generic/setup_tx4939.c
index f14a497..6c0049a 100644
--- a/arch/mips/txx9/generic/setup_tx4939.c
+++ b/arch/mips/txx9/generic/setup_tx4939.c
@@ -20,6 +20,7 @@
 #include <linux/param.h>
 #include <linux/ptrace.h>
 #include <linux/mtd/physmap.h>
+#include <linux/platform_device.h>
 #include <asm/bootinfo.h>
 #include <asm/reboot.h>
 #include <asm/traps.h>
@@ -389,6 +390,51 @@ void __init tx4939_mtd_init(int ch)
 	txx9_physmap_flash_init(ch, start, size, &pdata);
 }
 
+#define TX4939_ATA_REG_PHYS(ch) (TX4939_ATA_REG(ch) & 0xfffffffffULL)
+void __init tx4939_ata_init(void)
+{
+	static struct resource ata0_res[] = {
+		{
+			.start = TX4939_ATA_REG_PHYS(0),
+			.end = TX4939_ATA_REG_PHYS(0) + 0x1000 - 1,
+			.flags = IORESOURCE_MEM,
+		}, {
+			.start = TXX9_IRQ_BASE + TX4939_IR_ATA(0),
+			.flags = IORESOURCE_IRQ,
+		},
+	};
+	static struct resource ata1_res[] = {
+		{
+			.start = TX4939_ATA_REG_PHYS(1),
+			.end = TX4939_ATA_REG_PHYS(1) + 0x1000 - 1,
+			.flags = IORESOURCE_MEM,
+		}, {
+			.start = TXX9_IRQ_BASE + TX4939_IR_ATA(1),
+			.flags = IORESOURCE_IRQ,
+		},
+	};
+	static struct platform_device ata0_dev = {
+		.name = "tx4939ide",
+		.id = 0,
+		.num_resources = ARRAY_SIZE(ata0_res),
+		.resource = ata0_res,
+	};
+	static struct platform_device ata1_dev = {
+		.name = "tx4939ide",
+		.id = 1,
+		.num_resources = ARRAY_SIZE(ata1_res),
+		.resource = ata1_res,
+	};
+	__u64 pcfg = __raw_readq(&tx4939_ccfgptr->pcfg);
+
+	if (pcfg & TX4939_PCFG_ATA0MODE)
+		platform_device_register(&ata0_dev);
+	if ((pcfg & (TX4939_PCFG_ATA1MODE |
+		     TX4939_PCFG_ET1MODE |
+		     TX4939_PCFG_ET0MODE)) == TX4939_PCFG_ATA1MODE)
+		platform_device_register(&ata1_dev);
+}
+
 static void __init tx4939_stop_unused_modules(void)
 {
 	__u64 pcfg, rst = 0, ckd = 0;
diff --git a/arch/mips/txx9/rbtx4939/setup.c b/arch/mips/txx9/rbtx4939/setup.c
index 277864d..9855d7b 100644
--- a/arch/mips/txx9/rbtx4939/setup.c
+++ b/arch/mips/txx9/rbtx4939/setup.c
@@ -264,6 +264,7 @@ static void __init rbtx4939_device_init(void)
 #endif
 	rbtx4939_led_setup();
 	tx4939_wdt_init();
+	tx4939_ata_init();
 }
 
 static void __init rbtx4939_setup(void)
diff --git a/include/asm-mips/txx9/tx4939.h b/include/asm-mips/txx9/tx4939.h
index 7ce2dff..88badb4 100644
--- a/include/asm-mips/txx9/tx4939.h
+++ b/include/asm-mips/txx9/tx4939.h
@@ -540,5 +540,6 @@ void tx4939_setup_pcierr_irq(void);
 void tx4939_irq_init(void);
 int tx4939_irq(void);
 void tx4939_mtd_init(int ch);
+void tx4939_ata_init(void);
 
 #endif /* __ASM_TXX9_TX4939_H */
-- 
1.5.6.3

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/2] TXx9: Add TX4939 ATA support (v2)
  2008-09-17 15:13 [PATCH 2/2] TXx9: Add TX4939 ATA support (v2) Atsushi Nemoto
@ 2008-09-20 15:48 ` Sergei Shtylyov
  2008-09-22 14:56   ` Atsushi Nemoto
  0 siblings, 1 reply; 7+ messages in thread
From: Sergei Shtylyov @ 2008-09-20 15:48 UTC (permalink / raw)
  To: Atsushi Nemoto; +Cc: linux-mips, linux-ide, Bartlomiej Zolnierkiewicz, ralf

Hello.

Atsushi Nemoto wrote:

> Add a helper routine to register tx4939ide driver and use it on
> RBTX4939 board.
>   

  BTW, how about supporting IDE aboard RBTX4938, not worth the trouble?

> Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>

Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>

MBR, Sergei



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/2] TXx9: Add TX4939 ATA support (v2)
  2008-09-20 15:48 ` Sergei Shtylyov
@ 2008-09-22 14:56   ` Atsushi Nemoto
  2008-09-22 15:01     ` Sergei Shtylyov
  0 siblings, 1 reply; 7+ messages in thread
From: Atsushi Nemoto @ 2008-09-22 14:56 UTC (permalink / raw)
  To: sshtylyov; +Cc: linux-mips, linux-ide, bzolnier, ralf

On Sat, 20 Sep 2008 19:48:24 +0400, Sergei Shtylyov <sshtylyov@ru.mvista.com> wrote:
> > Add a helper routine to register tx4939ide driver and use it on
> > RBTX4939 board.
> 
>   BTW, how about supporting IDE aboard RBTX4938, not worth the trouble?

Yes, next plan.  It should be much simpler than the tx4939ide driver.

---
Atsushi Nemoto

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/2] TXx9: Add TX4939 ATA support (v2)
  2008-09-22 14:56   ` Atsushi Nemoto
@ 2008-09-22 15:01     ` Sergei Shtylyov
  2008-09-22 15:16       ` Atsushi Nemoto
  0 siblings, 1 reply; 7+ messages in thread
From: Sergei Shtylyov @ 2008-09-22 15:01 UTC (permalink / raw)
  To: Atsushi Nemoto; +Cc: linux-mips, linux-ide, bzolnier, ralf

Hello.

Atsushi Nemoto wrote:

>>>Add a helper routine to register tx4939ide driver and use it on
>>>RBTX4939 board.

>>  BTW, how about supporting IDE aboard RBTX4938, not worth the trouble?

> Yes, next plan.  It should be much simpler than the tx4939ide driver.

    I suspect {ide|pata}_platform could be able to cover it... though I got 
muddled in the timing diagrams for the TX4938 external bus...

> ---
> Atsushi Nemoto

WBR, Sergei

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/2] TXx9: Add TX4939 ATA support (v2)
  2008-09-22 15:01     ` Sergei Shtylyov
@ 2008-09-22 15:16       ` Atsushi Nemoto
  2008-09-22 15:27         ` Sergei Shtylyov
  2008-09-22 18:47         ` Alan Cox
  0 siblings, 2 replies; 7+ messages in thread
From: Atsushi Nemoto @ 2008-09-22 15:16 UTC (permalink / raw)
  To: sshtylyov; +Cc: linux-mips, linux-ide, bzolnier, ralf

On Mon, 22 Sep 2008 19:01:57 +0400, Sergei Shtylyov <sshtylyov@ru.mvista.com> wrote:
> >>  BTW, how about supporting IDE aboard RBTX4938, not worth the trouble?
> 
> > Yes, next plan.  It should be much simpler than the tx4939ide driver.
> 
>     I suspect {ide|pata}_platform could be able to cover it... though I got 
> muddled in the timing diagrams for the TX4938 external bus...

We need .set_pio_mode routine to get best PIO speed, but current
{ide|pata}_platform driver does not provide a hook for it (please
correct me if I was wrong).  So current code I have does not use
ide_platform...

---
Atsushi Nemoto

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/2] TXx9: Add TX4939 ATA support (v2)
  2008-09-22 15:16       ` Atsushi Nemoto
@ 2008-09-22 15:27         ` Sergei Shtylyov
  2008-09-22 18:47         ` Alan Cox
  1 sibling, 0 replies; 7+ messages in thread
From: Sergei Shtylyov @ 2008-09-22 15:27 UTC (permalink / raw)
  To: Atsushi Nemoto; +Cc: linux-mips, linux-ide, bzolnier, ralf

Atsushi Nemoto wrote:

>>>> BTW, how about supporting IDE aboard RBTX4938, not worth the trouble?

>>>Yes, next plan.  It should be much simpler than the tx4939ide driver.

>>    I suspect {ide|pata}_platform could be able to cover it... though I got 
>>muddled in the timing diagrams for the TX4938 external bus...

> We need .set_pio_mode routine to get best PIO speed, but current

    Hm, didn't realize this is porogrammable on TX4938... 2.6.10 driver we 
have doesn't have tuneproc() method too.

WBR, Sergei

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/2] TXx9: Add TX4939 ATA support (v2)
  2008-09-22 15:16       ` Atsushi Nemoto
  2008-09-22 15:27         ` Sergei Shtylyov
@ 2008-09-22 18:47         ` Alan Cox
  1 sibling, 0 replies; 7+ messages in thread
From: Alan Cox @ 2008-09-22 18:47 UTC (permalink / raw)
  To: Atsushi Nemoto; +Cc: sshtylyov, linux-mips, linux-ide, bzolnier, ralf

On Tue, 23 Sep 2008 00:16:02 +0900 (JST)
Atsushi Nemoto <anemo@mba.ocn.ne.jp> wrote:

> On Mon, 22 Sep 2008 19:01:57 +0400, Sergei Shtylyov <sshtylyov@ru.mvista.com> wrote:
> > >>  BTW, how about supporting IDE aboard RBTX4938, not worth the trouble?
> > 
> > > Yes, next plan.  It should be much simpler than the tx4939ide driver.
> > 
> >     I suspect {ide|pata}_platform could be able to cover it... though I got 
> > muddled in the timing diagrams for the TX4938 external bus...
> 
> We need .set_pio_mode routine to get best PIO speed, but current
> {ide|pata}_platform driver does not provide a hook for it (please
> correct me if I was wrong).  So current code I have does not use
> ide_platform...

You are correct. The platform driver is intended to be totally dumb. It's
not clear at what point having a specific driver is more sensible as a
libata driver is tiny anyway (especially with tejuns inherited ops stuff)

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2008-09-22 18:53 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-09-17 15:13 [PATCH 2/2] TXx9: Add TX4939 ATA support (v2) Atsushi Nemoto
2008-09-20 15:48 ` Sergei Shtylyov
2008-09-22 14:56   ` Atsushi Nemoto
2008-09-22 15:01     ` Sergei Shtylyov
2008-09-22 15:16       ` Atsushi Nemoto
2008-09-22 15:27         ` Sergei Shtylyov
2008-09-22 18:47         ` Alan Cox

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).