2006-05-11 02:10:01

by Thomas Kleffel

[permalink] [raw]
Subject: [PATCH] ide_cs: Make ide_cs work with the memory space of CF-Cards if IO space is not available

From: Thomas Kleffel <[email protected]>

this patch enables ide_cs to access CF-cards via their common memory
rather than via their IO space.

Signed-off-by: Thomas Kleffel <[email protected]>
---

This patch is against 2.6.17-rc3

The reason why this patch makes sense is that it is pretty easy to build
a CF-Interface out of a simple address/data-bus if you only use common
and attribute memory. Adding the capability to access IO space makes
things more complicated.

If you just want to use CF-Storage cards, access to common and attribute
memory is enough as the IDE registers are available there, as well.

I have submitted a patch to RMK which enables the AT91RM9200's CF
interface to work in that mode.



Attachments:
ide_cd.mem.patch (1.09 kB)

2006-05-11 15:40:45

by Alan

[permalink] [raw]
Subject: Re: [PATCH] ide_cs: Make ide_cs work with the memory space of CF-Cards if IO space is not available

On Iau, 2006-05-11 at 04:10 +0200, Thomas Kleffel (maintech GmbH) wrote:
> From: Thomas Kleffel <[email protected]>
>
> this patch enables ide_cs to access CF-cards via their common memory
> rather than via their IO space.

One obvious problem. Your patch simply sets io_base to an ioremap value.
The ide_cs code assumes port accesses (eg it does outb() on base + 2).
While outb() may happen to work on ARM on ioremap returns it doesn't on
most platforms.

Alan

2006-05-11 20:33:49

by Thomas Kleffel

[permalink] [raw]
Subject: Re: [PATCH] ide_cs: Make ide_cs work with the memory space of CF-Cards if IO space is not available (revised)

From: Thomas Kleffel <[email protected]>

this patch enables ide_cs to access CF-cards via their common memory
rather than via their IO space.

Signed-off-by: Thomas Kleffel <[email protected]>
---

This patch is against 2.6.17-rc3

The reason why this patch makes sense is that it is pretty easy to build
a CF-Interface out of a simple address/data-bus if you only use common
and attribute memory. Adding the capability to access IO space makes
things more complicated.

If you just want to use CF-Storage cards, access to common and attribute
memory is enough as the IDE registers are available there, as well.

I have submitted a patch to RMK which enables the AT91RM9200's CF
interface to work in that mode.

I made some changes based on the feedback from Alan Cox and Iain Barker.

Thomas



Attachments:
ide_cs.mem.patch (4.21 kB)

2006-05-11 22:40:35

by Russell King

[permalink] [raw]
Subject: Re: [PATCH] ide_cs: Make ide_cs work with the memory space of CF-Cards if IO space is not available

On Thu, May 11, 2006 at 04:52:58PM +0100, Alan Cox wrote:
> On Iau, 2006-05-11 at 04:10 +0200, Thomas Kleffel (maintech GmbH) wrote:
> > From: Thomas Kleffel <[email protected]>
> >
> > this patch enables ide_cs to access CF-cards via their common memory
> > rather than via their IO space.
>
> One obvious problem. Your patch simply sets io_base to an ioremap value.
> The ide_cs code assumes port accesses (eg it does outb() on base + 2).
> While outb() may happen to work on ARM on ioremap returns it doesn't on
> most platforms.

And it doesn't even work on all ARM platforms. I wish ARM folk would
recognise the difference between the different address spaces and stop
confusing them.

--
Russell King
Linux kernel 2.6 ARM Linux - http://www.arm.linux.org.uk/
maintainer of: 2.6 Serial core

2006-05-12 07:38:24

by Thomas Kleffel

[permalink] [raw]
Subject: Re: [PATCH] ide_cs: Make ide_cs work with the memory space of CF-Cards if IO space is not available (2nd revision)

From: Thomas Kleffel <[email protected]>

this patch enables ide_cs to access CF-cards via their common memory
rather than via their IO space.

Signed-off-by: Thomas Kleffel <[email protected]>
---

This patch is against 2.6.17-rc3

The reason why this patch makes sense is that it is pretty easy to build
a CF-Interface out of a simple address/data-bus if you only use common
and attribute memory. Adding the capability to access IO space makes
things more complicated.

If you just want to use CF-Storage cards, access to common and attribute
memory is enough as the IDE registers are available there, as well.

I have submitted a patch to RMK which enables the AT91RM9200's CF
interface to work in that mode.

I made some changes based on the feedback from Alan Cox and Iain Barker.

The window size was changed from 16 to 0 (autodetect) on suggestion from
Iain Barker. 16 didn't work with one of his cards.

Thomas



Attachments:
ide_cs.mem.patch (4.21 kB)

2006-05-12 09:18:51

by David Vrabel

[permalink] [raw]
Subject: Re: [PATCH] ide_cs: Make ide_cs work with the memory space of CF-Cards if IO space is not available (2nd revision)

Thomas Kleffel (maintech GmbH) wrote:
>
> +void outb_io(unsigned char value, unsigned long port) {
> + outb(value, port);
> +}
> +
> +void outb_mem(unsigned char value, unsigned long port) {
> + writeb(value, (void __iomem *) port);
> }

[...]

> + if(is_mmio)
> + my_outb = outb_mem;
> + else
> + my_outb = outb_io;


Shouldn't you convert ide_cs to use iowrite8 (and friends) instead of
doing this?

David Vrabel

2006-05-12 09:26:50

by Thomas Kleffel

[permalink] [raw]
Subject: Re: [PATCH] ide_cs: Make ide_cs work with the memory space of CF-Cards if IO space is not available (2nd revision)

David Vrabel wrote:

>Thomas Kleffel (maintech GmbH) wrote:
>
>
>>+void outb_io(unsigned char value, unsigned long port) {
>>+ outb(value, port);
>>+}
>>+
>>+void outb_mem(unsigned char value, unsigned long port) {
>>+ writeb(value, (void __iomem *) port);
>> }
>>
>>
>
>[...]
>
>
>
>>+ if(is_mmio)
>>+ my_outb = outb_mem;
>>+ else
>>+ my_outb = outb_io;
>>
>>
>
>
>Shouldn't you convert ide_cs to use iowrite8 (and friends) instead of
>doing this?
>
>
You're right. I didn't know about iowrite8.

I'll post a new revision soon.

Thomas

2006-05-12 09:46:36

by Thomas Kleffel

[permalink] [raw]
Subject: Re: [PATCH] ide_cs: Make ide_cs work with the memory space of CF-Cards if IO space is not available (3nd revision)

From: Thomas Kleffel <[email protected]>

this patch enables ide_cs to access CF-cards via their common memory
rather than via their IO space.

Signed-off-by: Thomas Kleffel <[email protected]>
---

This patch is against 2.6.17-rc3

The reason why this patch makes sense is that it is pretty easy to build
a CF-Interface out of a simple address/data-bus if you only use common
and attribute memory. Adding the capability to access IO space makes
things more complicated.

If you just want to use CF-Storage cards, access to common and attribute
memory is enough as the IDE registers are available there, as well.

I have submitted a patch to RMK which enables the AT91RM9200's CF
interface to work in that mode.

I made some changes based on the feedback from Alan Cox and Iain Barker.

The window size was changed from 16 to 0 (autodetect) on suggestion from
Iain Barker. 16 didn't work with one of his cards.

ide_cs was converted from outb to iowrite8 on suggestion from David Vrabel.

Thomas




Attachments:
ide_cs.mem.patch (3.92 kB)

2006-05-14 13:16:03

by Thomas Kleffel

[permalink] [raw]
Subject: Re: [PATCH] ide_cs: Make ide_cs work with the memory space of CF-Cards if IO space is not available (4rd revision)

From: Thomas Kleffel <[email protected]>

this patch enables ide_cs to access CF-cards via their common memory
rather than via their IO space.

Signed-off-by: Thomas Kleffel <[email protected]>
---

This patch is against 2.6.17-rc3

The reason why this patch makes sense is that it is pretty easy to build
a CF-Interface out of a simple address/data-bus if you only use common
and attribute memory. Adding the capability to access IO space makes
things more complicated.

If you just want to use CF-Storage cards, access to common and attribute
memory is enough as the IDE registers are available there, as well.

I have submitted a patch to RMK which enables the AT91RM9200's CF
interface to work in that mode.

I made some changes based on the feedback from Alan Cox and Iain Barker.

The window size was changed from 16 to 0 (autodetect) on suggestion from
Iain Barker. 16 didn't work with one of his cards.

Detection of slave drives works with mmio, now.

Thomas





Attachments:
ide_cs.mem.patch (4.54 kB)