linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] TXx9: Add TX4938 ATA support (v2)
@ 2008-10-22 16:16 Atsushi Nemoto
  2008-10-23 13:37 ` Sergei Shtylyov
  0 siblings, 1 reply; 8+ messages in thread
From: Atsushi Nemoto @ 2008-10-22 16:16 UTC (permalink / raw)
  To: linux-mips; +Cc: linux-ide, Bartlomiej Zolnierkiewicz, ralf, sshtylyov

Add a helper routine to register tx4938ide driver and use it on
RBTX4938 board.

Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
---
Changes since v1:
* put the base address into platform_device resource.
* add a comment for usage of 'tune' argument.

 arch/mips/include/asm/txx9/tx4938.h   |   13 +++++++++
 arch/mips/txx9/generic/setup_tx4938.c |   47 +++++++++++++++++++++++++++++++++
 arch/mips/txx9/rbtx4938/setup.c       |    1 +
 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 989e775..3dada66 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);
 void tx4938_irq_init(void);
 void tx4938_mtd_init(int ch);
 
+struct tx4938ide_platform_info {
+	/*
+	 * I/O port shift, for platforms with ports that are
+	 * constantly spaced and need larger than the 1-byte
+	 * spacing used by ata_std_ports().
+	 */
+	unsigned int ioport_shift;
+	unsigned int gbus_clock;	/*  0 means no-autotune. */
+	unsigned int ebus_ch;
+};
+
+void tx4938_ata_init(unsigned int irq, unsigned int shift, int tune);
+
 #endif
diff --git a/arch/mips/txx9/generic/setup_tx4938.c b/arch/mips/txx9/generic/setup_tx4938.c
index af724e5..e6c558e 100644
--- a/arch/mips/txx9/generic/setup_tx4938.c
+++ b/arch/mips/txx9/generic/setup_tx4938.c
@@ -16,6 +16,7 @@
 #include <linux/param.h>
 #include <linux/ptrace.h>
 #include <linux/mtd/physmap.h>
+#include <linux/platform_device.h>
 #include <asm/reboot.h>
 #include <asm/traps.h>
 #include <asm/txx9irq.h>
@@ -335,6 +336,52 @@ void __init tx4938_mtd_init(int ch)
 	txx9_physmap_flash_init(ch, start, size, &pdata);
 }
 
+void __init tx4938_ata_init(unsigned int irq, unsigned int shift, int tune)
+{
+	struct platform_device *pdev;
+	struct resource res[] = {
+		{
+			/* .start and .end are filled in later */
+			.flags = IORESOURCE_MEM,
+		}, {
+			.start = irq,
+			.flags = IORESOURCE_IRQ,
+		},
+	};
+	struct tx4938ide_platform_info pdata = {
+		.ioport_shift = shift,
+		/*
+		 * The ide driver should not do autotune if other ISA
+		 * devices existed.
+		 */
+		.gbus_clock = tune ? txx9_gbus_clock : 0,
+	};
+	u64 ebccr;
+	int i;
+
+	if ((__raw_readq(&tx4938_ccfgptr->pcfg) &
+	     (TX4938_PCFG_ATA_SEL | TX4938_PCFG_NDF_SEL))
+	    != TX4938_PCFG_ATA_SEL)
+		return;
+	for (i = 0; i < 8; i++) {
+		/* check EBCCRn.ISA, EBCCRn.BSZ, EBCCRn.ME */
+		ebccr = __raw_readq(&tx4938_ebuscptr->cr[i]);
+		if ((ebccr & 0x00f00008) == 0x00e00008)
+			break;
+	}
+	if (i == 8)
+		return;
+	pdata.ebus_ch = i;
+	res[0].start = ((ebccr >> 48) << 20) + 0x10000;
+	res[0].end = res[0].start + 0x20000 - 1;
+	pdev = platform_device_alloc("tx4938ide", -1);
+	if (!pdev ||
+	    platform_device_add_resources(pdev, res, ARRAY_SIZE(res)) ||
+	    platform_device_add_data(pdev, &pdata, sizeof(pdata)) ||
+	    platform_device_add(pdev))
+		platform_device_put(pdev);
+}
+
 static void __init tx4938_stop_unused_modules(void)
 {
 	__u64 pcfg, rst = 0, ckd = 0;
diff --git a/arch/mips/txx9/rbtx4938/setup.c b/arch/mips/txx9/rbtx4938/setup.c
index e077cc4..547ff29 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)
 	rbtx4938_ne_init();
 	tx4938_wdt_init();
 	rbtx4938_mtd_init();
+	tx4938_ata_init(RBTX4938_IRQ_IOC_ATA, 0, 1);
 	txx9_iocled_init(RBTX4938_LED_ADDR - IO_BASE, -1, 8, 1, "green", NULL);
 }
 
-- 
1.5.6.3


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

* Re: [PATCH] TXx9: Add TX4938 ATA support (v2)
  2008-10-22 16:16 [PATCH] TXx9: Add TX4938 ATA support (v2) Atsushi Nemoto
@ 2008-10-23 13:37 ` Sergei Shtylyov
  2008-10-23 14:16   ` Atsushi Nemoto
  0 siblings, 1 reply; 8+ messages in thread
From: Sergei Shtylyov @ 2008-10-23 13:37 UTC (permalink / raw)
  To: Atsushi Nemoto; +Cc: linux-mips, linux-ide, Bartlomiej Zolnierkiewicz, ralf

Hello.

Atsushi Nemoto wrote:

> 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: Sergei Shtylyov <sshtylyov@ru.mvista.com>

> diff --git a/arch/mips/include/asm/txx9/tx4938.h b/arch/mips/include/asm/txx9/tx4938.h
> index 989e775..3dada66 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);
>  void tx4938_irq_init(void);
>  void tx4938_mtd_init(int ch);
>  
> +struct tx4938ide_platform_info {
> +	/*
> +	 * I/O port shift, for platforms with ports that are
> +	 * constantly spaced and need larger than the 1-byte
> +	 * spacing used by ata_std_ports().
> +	 */
> +	unsigned int ioport_shift;
> +	unsigned int gbus_clock;	/*  0 means no-autotune. */
>   

   I'd say "no PIO mode tuning" since the mode can also be changed via 
HDIO_SET_PIO_MODE which e.g. 'hdparm -p' calls...

> diff --git a/arch/mips/txx9/generic/setup_tx4938.c b/arch/mips/txx9/generic/setup_tx4938.c
> index af724e5..e6c558e 100644
> --- a/arch/mips/txx9/generic/setup_tx4938.c
> +++ b/arch/mips/txx9/generic/setup_tx4938.c
>   
[...]
> @@ -335,6 +336,52 @@ void __init tx4938_mtd_init(int ch)
>  	txx9_physmap_flash_init(ch, start, size, &pdata);
>  }
>  
> +void __init tx4938_ata_init(unsigned int irq, unsigned int shift, int tune)
> +{
> +	struct platform_device *pdev;
> +	struct resource res[] = {
> +		{
> +			/* .start and .end are filled in later */
> +			.flags = IORESOURCE_MEM,
> +		}, {
> +			.start = irq,
> +			.flags = IORESOURCE_IRQ,
> +		},
> +	};
> +	struct tx4938ide_platform_info pdata = {
> +		.ioport_shift = shift,
> +		/*
> +		 * The ide driver should not do autotune if other ISA
>   

  "The IDE driver should not change bus timings", I'd say.

MBR, Sergei



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

* Re: [PATCH] TXx9: Add TX4938 ATA support (v2)
  2008-10-23 13:37 ` Sergei Shtylyov
@ 2008-10-23 14:16   ` Atsushi Nemoto
  2008-10-23 16:56     ` Sergei Shtylyov
  0 siblings, 1 reply; 8+ messages in thread
From: Atsushi Nemoto @ 2008-10-23 14:16 UTC (permalink / raw)
  To: sshtylyov; +Cc: linux-mips, linux-ide, bzolnier, ralf

On Thu, 23 Oct 2008 17:37:59 +0400, Sergei Shtylyov <sshtylyov@ru.mvista.com> wrote:
> Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>

Thanks.  Here is v3 patch with just two comment changes.

------------------------------------------------------
From: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Subject: [PATCH] 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>
---
Change since v2:
* better comment wordings

 arch/mips/include/asm/txx9/tx4938.h   |   13 +++++++++
 arch/mips/txx9/generic/setup_tx4938.c |   47 +++++++++++++++++++++++++++++++++
 arch/mips/txx9/rbtx4938/setup.c       |    1 +
 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 989e775..0b06815 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);
 void tx4938_irq_init(void);
 void tx4938_mtd_init(int ch);
 
+struct tx4938ide_platform_info {
+	/*
+	 * I/O port shift, for platforms with ports that are
+	 * constantly spaced and need larger than the 1-byte
+	 * spacing used by ata_std_ports().
+	 */
+	unsigned int ioport_shift;
+	unsigned int gbus_clock;	/*  0 means no PIO mode tuning. */
+	unsigned int ebus_ch;
+};
+
+void tx4938_ata_init(unsigned int irq, unsigned int shift, int tune);
+
 #endif
diff --git a/arch/mips/txx9/generic/setup_tx4938.c b/arch/mips/txx9/generic/setup_tx4938.c
index af724e5..25819ff 100644
--- a/arch/mips/txx9/generic/setup_tx4938.c
+++ b/arch/mips/txx9/generic/setup_tx4938.c
@@ -16,6 +16,7 @@
 #include <linux/param.h>
 #include <linux/ptrace.h>
 #include <linux/mtd/physmap.h>
+#include <linux/platform_device.h>
 #include <asm/reboot.h>
 #include <asm/traps.h>
 #include <asm/txx9irq.h>
@@ -335,6 +336,52 @@ void __init tx4938_mtd_init(int ch)
 	txx9_physmap_flash_init(ch, start, size, &pdata);
 }
 
+void __init tx4938_ata_init(unsigned int irq, unsigned int shift, int tune)
+{
+	struct platform_device *pdev;
+	struct resource res[] = {
+		{
+			/* .start and .end are filled in later */
+			.flags = IORESOURCE_MEM,
+		}, {
+			.start = irq,
+			.flags = IORESOURCE_IRQ,
+		},
+	};
+	struct tx4938ide_platform_info pdata = {
+		.ioport_shift = shift,
+		/*
+		 * The IDE driver should not change bus timings if other ISA
+		 * devices existed.
+		 */
+		.gbus_clock = tune ? txx9_gbus_clock : 0,
+	};
+	u64 ebccr;
+	int i;
+
+	if ((__raw_readq(&tx4938_ccfgptr->pcfg) &
+	     (TX4938_PCFG_ATA_SEL | TX4938_PCFG_NDF_SEL))
+	    != TX4938_PCFG_ATA_SEL)
+		return;
+	for (i = 0; i < 8; i++) {
+		/* check EBCCRn.ISA, EBCCRn.BSZ, EBCCRn.ME */
+		ebccr = __raw_readq(&tx4938_ebuscptr->cr[i]);
+		if ((ebccr & 0x00f00008) == 0x00e00008)
+			break;
+	}
+	if (i == 8)
+		return;
+	pdata.ebus_ch = i;
+	res[0].start = ((ebccr >> 48) << 20) + 0x10000;
+	res[0].end = res[0].start + 0x20000 - 1;
+	pdev = platform_device_alloc("tx4938ide", -1);
+	if (!pdev ||
+	    platform_device_add_resources(pdev, res, ARRAY_SIZE(res)) ||
+	    platform_device_add_data(pdev, &pdata, sizeof(pdata)) ||
+	    platform_device_add(pdev))
+		platform_device_put(pdev);
+}
+
 static void __init tx4938_stop_unused_modules(void)
 {
 	__u64 pcfg, rst = 0, ckd = 0;
diff --git a/arch/mips/txx9/rbtx4938/setup.c b/arch/mips/txx9/rbtx4938/setup.c
index e077cc4..547ff29 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)
 	rbtx4938_ne_init();
 	tx4938_wdt_init();
 	rbtx4938_mtd_init();
+	tx4938_ata_init(RBTX4938_IRQ_IOC_ATA, 0, 1);
 	txx9_iocled_init(RBTX4938_LED_ADDR - IO_BASE, -1, 8, 1, "green", NULL);
 }
 
-- 
1.5.6.3


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

* Re: [PATCH] TXx9: Add TX4938 ATA support (v2)
  2008-10-23 14:16   ` Atsushi Nemoto
@ 2008-10-23 16:56     ` Sergei Shtylyov
  2008-10-23 20:06       ` Bartlomiej Zolnierkiewicz
  0 siblings, 1 reply; 8+ messages in thread
From: Sergei Shtylyov @ 2008-10-23 16:56 UTC (permalink / raw)
  To: Atsushi Nemoto; +Cc: linux-mips, linux-ide, bzolnier, ralf

Hello.

Atsushi Nemoto wrote:

> From: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
> Subject: [PATCH] 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>

    The patch already had my

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

MBR, Sergei

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

* Re: [PATCH] TXx9: Add TX4938 ATA support (v2)
  2008-10-23 16:56     ` Sergei Shtylyov
@ 2008-10-23 20:06       ` Bartlomiej Zolnierkiewicz
  2008-10-23 22:21         ` Sergei Shtylyov
  0 siblings, 1 reply; 8+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2008-10-23 20:06 UTC (permalink / raw)
  To: Sergei Shtylyov; +Cc: Atsushi Nemoto, linux-mips, linux-ide, ralf

On Thursday 23 October 2008, Sergei Shtylyov wrote:
> Hello.
> 
> Atsushi Nemoto wrote:
> 
> > From: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
> > Subject: [PATCH] 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>
> 
>     The patch already had my
> 
> Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>

applied

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

* Re: [PATCH] TXx9: Add TX4938 ATA support (v2)
  2008-10-23 20:06       ` Bartlomiej Zolnierkiewicz
@ 2008-10-23 22:21         ` Sergei Shtylyov
  2008-10-24 20:52           ` Bartlomiej Zolnierkiewicz
  0 siblings, 1 reply; 8+ messages in thread
From: Sergei Shtylyov @ 2008-10-23 22:21 UTC (permalink / raw)
  To: Bartlomiej Zolnierkiewicz; +Cc: Atsushi Nemoto, linux-mips, linux-ide, ralf

Hello.

Bartlomiej Zolnierkiewicz wrote:

>>> From: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
>>> Subject: [PATCH] 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>
>>>       
>>     The patch already had my
>>
>> Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
>>     
>
> applied
>   

   Hm, I thought that one was for Ralf...

MBR, Sergei



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

* Re: [PATCH] TXx9: Add TX4938 ATA support (v2)
  2008-10-23 22:21         ` Sergei Shtylyov
@ 2008-10-24 20:52           ` Bartlomiej Zolnierkiewicz
  2008-10-24 21:40             ` Ralf Baechle
  0 siblings, 1 reply; 8+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2008-10-24 20:52 UTC (permalink / raw)
  To: Sergei Shtylyov; +Cc: Atsushi Nemoto, linux-mips, linux-ide, ralf

On Friday 24 October 2008, Sergei Shtylyov wrote:
> Hello.
> 
> Bartlomiej Zolnierkiewicz wrote:
> 
> >>> From: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
> >>> Subject: [PATCH] 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>
> >>>       
> >>     The patch already had my
> >>
> >> Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
> >>     
> >
> > applied
> >   
> 
>    Hm, I thought that one was for Ralf...

Ralf ACK-ed the change and was fine with it going through ide tree.

Anyway it really doesn't matter through whose tree such patches are
going in as long as people are fine with them.

No need to add some more rigid kernel bureaucracy...

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

* Re: [PATCH] TXx9: Add TX4938 ATA support (v2)
  2008-10-24 20:52           ` Bartlomiej Zolnierkiewicz
@ 2008-10-24 21:40             ` Ralf Baechle
  0 siblings, 0 replies; 8+ messages in thread
From: Ralf Baechle @ 2008-10-24 21:40 UTC (permalink / raw)
  To: Bartlomiej Zolnierkiewicz
  Cc: Sergei Shtylyov, Atsushi Nemoto, linux-mips, linux-ide

On Fri, Oct 24, 2008 at 10:52:25PM +0200, Bartlomiej Zolnierkiewicz wrote:

> > > applied
> > >   
> > 
> >    Hm, I thought that one was for Ralf...
> 
> Ralf ACK-ed the change and was fine with it going through ide tree.
> 
> Anyway it really doesn't matter through whose tree such patches are
> going in as long as people are fine with them.
> 

To explain why - there were no ordering constraints but it's always nice
if all bits make it to kernel.org in one pull.  The arch part was rather
minor compared to the IDE part so this should preferably go through the
IDE tree.

> No need to add some more rigid kernel bureaucracy...

Wildy-acked-by: Ralf Baechle <ralf@linux-mips.org> :-)

  Ralf

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

end of thread, other threads:[~2008-10-24 21:41 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-10-22 16:16 [PATCH] TXx9: Add TX4938 ATA support (v2) Atsushi Nemoto
2008-10-23 13:37 ` Sergei Shtylyov
2008-10-23 14:16   ` Atsushi Nemoto
2008-10-23 16:56     ` Sergei Shtylyov
2008-10-23 20:06       ` Bartlomiej Zolnierkiewicz
2008-10-23 22:21         ` Sergei Shtylyov
2008-10-24 20:52           ` Bartlomiej Zolnierkiewicz
2008-10-24 21:40             ` Ralf Baechle

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).