* [PATCH] TXx9: Add TX4938 ATA support
@ 2008-10-17 14:10 Atsushi Nemoto
2008-10-19 18:34 ` Sergei Shtylyov
0 siblings, 1 reply; 5+ messages in thread
From: Atsushi Nemoto @ 2008-10-17 14:10 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>
---
arch/mips/include/asm/txx9/tx4938.h | 13 +++++++++++
arch/mips/txx9/generic/setup_tx4938.c | 38 +++++++++++++++++++++++++++++++++
arch/mips/txx9/rbtx4938/setup.c | 1 +
3 files changed, 52 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..a5951ed 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,43 @@ 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 = irq,
+ .flags = IORESOURCE_IRQ,
+ },
+ };
+ struct tx4938ide_platform_info pdata = {
+ .ioport_shift = shift,
+ .gbus_clock = tune ? txx9_gbus_clock : 0,
+ };
+ 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 */
+ if ((__raw_readq(&tx4938_ebuscptr->cr[i]) & 0x00f00008)
+ == 0x00e00008)
+ break;
+ }
+ if (i == 8)
+ return;
+ pdata.ebus_ch = i;
+
+ 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] 5+ messages in thread
* Re: [PATCH] TXx9: Add TX4938 ATA support
2008-10-17 14:10 [PATCH] TXx9: Add TX4938 ATA support Atsushi Nemoto
@ 2008-10-19 18:34 ` Sergei Shtylyov
2008-10-20 14:14 ` Atsushi Nemoto
0 siblings, 1 reply; 5+ messages in thread
From: Sergei Shtylyov @ 2008-10-19 18:34 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>
> diff --git a/arch/mips/txx9/generic/setup_tx4938.c b/arch/mips/txx9/generic/setup_tx4938.c
> index af724e5..a5951ed 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,43 @@ 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 = irq,
> + .flags = IORESOURCE_IRQ,
> + },
> + };
Device without a resource for its registers? That's... interesting. :-)
> + struct tx4938ide_platform_info pdata = {
> + .ioport_shift = shift,
> + .gbus_clock = tune ? txx9_gbus_clock : 0,
Any reason not to supply the GBUS clock?
I'm afraid you can't just early return from the set_pio_mode() method...
> + };
> + 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 */
> + if ((__raw_readq(&tx4938_ebuscptr->cr[i]) & 0x00f00008)
> + == 0x00e00008)
> + break;
> + }
> + if (i == 8)
> + return;
> + pdata.ebus_ch = i;
Why not grab the base address from this register as well and put it into
the resource?
WBR, Sergei
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] TXx9: Add TX4938 ATA support
2008-10-19 18:34 ` Sergei Shtylyov
@ 2008-10-20 14:14 ` Atsushi Nemoto
2008-10-20 14:40 ` Sergei Shtylyov
0 siblings, 1 reply; 5+ messages in thread
From: Atsushi Nemoto @ 2008-10-20 14:14 UTC (permalink / raw)
To: sshtylyov; +Cc: linux-mips, linux-ide, bzolnier, ralf
On Sun, 19 Oct 2008 22:34:06 +0400, Sergei Shtylyov <sshtylyov@ru.mvista.com> wrote:
> > + struct tx4938ide_platform_info pdata = {
> > + .ioport_shift = shift,
> > + .gbus_clock = tune ? txx9_gbus_clock : 0,
>
> Any reason not to supply the GBUS clock?
The EBUS channel might be used for both ATA and ISA or other local bus
devices. In that case, the board setup code should initialize best
timings for all devices and the IDE driver should not overrite it.
> I'm afraid you can't just early return from the set_pio_mode() method...
Do you mean I should use IDE_HFLAG_NO_SET_MODE instead of just
returning from set_pio_mode?
> > + for (i = 0; i < 8; i++) {
> > + /* check EBCCRn.ISA, EBCCRn.BSZ, EBCCRn.ME */
> > + if ((__raw_readq(&tx4938_ebuscptr->cr[i]) & 0x00f00008)
> > + == 0x00e00008)
> > + break;
> > + }
> > + if (i == 8)
> > + return;
> > + pdata.ebus_ch = i;
>
> Why not grab the base address from this register as well and put it into
> the resource?
Well, ... no reason :-) I will do that way. Thank you.
---
Atsushi Nemoto
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] TXx9: Add TX4938 ATA support
2008-10-20 14:14 ` Atsushi Nemoto
@ 2008-10-20 14:40 ` Sergei Shtylyov
2008-10-20 15:08 ` Atsushi Nemoto
0 siblings, 1 reply; 5+ messages in thread
From: Sergei Shtylyov @ 2008-10-20 14:40 UTC (permalink / raw)
To: Atsushi Nemoto; +Cc: linux-mips, linux-ide, bzolnier, ralf
Hello.
Atsushi Nemoto wrote:
>>>+ struct tx4938ide_platform_info pdata = {
>>>+ .ioport_shift = shift,
>>>+ .gbus_clock = tune ? txx9_gbus_clock : 0,
>> Any reason not to supply the GBUS clock?
> The EBUS channel might be used for both ATA and ISA or other local bus
> devices. In that case, the board setup code should initialize best
> timings for all devices and the IDE driver should not overrite it.
Ah, I forgot about the ATA address space being appeandage to ISA address
space on TX4939...
>> I'm afraid you can't just early return from the set_pio_mode() method...
> Do you mean I should use IDE_HFLAG_NO_SET_MODE instead of just
> returning from set_pio_mode?
No, that's for the smart RAID controllers that program the transfer modes
themselves. In your case, hwif->port_ops->set_pio_mode() must be NULL -- if
you're not going to allow the mode programming, that is.
MBR, Sergei
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] TXx9: Add TX4938 ATA support
2008-10-20 14:40 ` Sergei Shtylyov
@ 2008-10-20 15:08 ` Atsushi Nemoto
0 siblings, 0 replies; 5+ messages in thread
From: Atsushi Nemoto @ 2008-10-20 15:08 UTC (permalink / raw)
To: sshtylyov; +Cc: linux-mips, linux-ide, bzolnier, ralf
On Mon, 20 Oct 2008 18:40:56 +0400, Sergei Shtylyov <sshtylyov@ru.mvista.com> wrote:
> > Do you mean I should use IDE_HFLAG_NO_SET_MODE instead of just
> > returning from set_pio_mode?
>
> No, that's for the smart RAID controllers that program the transfer modes
> themselves. In your case, hwif->port_ops->set_pio_mode() must be NULL -- if
> you're not going to allow the mode programming, that is.
I see. Thanks.
---
Atsushi Nemoto
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2008-10-20 15:08 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-10-17 14:10 [PATCH] TXx9: Add TX4938 ATA support Atsushi Nemoto
2008-10-19 18:34 ` Sergei Shtylyov
2008-10-20 14:14 ` Atsushi Nemoto
2008-10-20 14:40 ` Sergei Shtylyov
2008-10-20 15:08 ` Atsushi Nemoto
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).