Skip to contentSkip to conversation

m68k: pata_cswarp: Add Amiga cslab ata support

PATCH In review Paolo Pisati 3 participants 8 messages Mar 25, 2025 – May 26, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

v4 cover m68k: pata_cswarp: Add Amiga cslab ata support

Here is a driver (and the subsequent defconfig change) for the pata/CF socket in the CS-Lab Warp series of Amiga boards.

Changes in v4:
- refactor pata_cswarp_data_xfer()
- ioremap WARP_OFFSET_ATA region

Changes in v3:
- suppress a comment
- properly return ata_host_activate() error code

Change in v2:
- fix style, remove duplicate swap macro, driver version, etc
- rework the zorro attach mechanism
- remove the unnecessary zorro ids refactor

Paolo Pisati (2):
ata: pata_cswarp: Add Amiga cslab ata support
m68k: defconfig: enable PATA_CSWARP

 arch/m68k/configs/amiga_defconfig |   1 +
 arch/m68k/configs/multi_defconfig |   1 +
 drivers/ata/Kconfig               |  11 ++
 drivers/ata/Makefile              |   1 +
 drivers/ata/pata_cswarp.c         | 185 ++++++++++++++++++++++++++++++
 5 files changed, 199 insertions(+)
 create mode 100644 drivers/ata/pata_cswarp.c
Signature · 1 line
2.34.1
#1 lore raw

PATCH v4 1/2 ata: pata_cswarp: Add Amiga cslab ata support

Driver for the on-board IDE interface on CS-Lab Warp Expansion Card (NOTE that idemode=native has to be set in Warp Configuration)

---
 drivers/ata/Kconfig       |  11 +++
 drivers/ata/Makefile      |   1 +
 drivers/ata/pata_cswarp.c | 185 ++++++++++++++++++++++++++++++++++++++
 3 files changed, 197 insertions(+)
 create mode 100644 drivers/ata/pata_cswarp.c
drivers/ata/Kconfig +11 -0
index e00536b49552..2fa96dbf2e3e 100644
@@ -1025,6 +1025,17 @@ config PATA_GAYLE
 
 	  If unsure, say N.
 
+config PATA_CSWARP
+	tristate "Amiga CS Warp PATA support"
+	depends on M68K && AMIGA && ZORRO
+	help
+	  This option enables support for the on-board IDE interface on
+	  CS-Lab Warp Expansion Card (NOTE that idemode=native has to be
+	  set in Warp Configuration)
+
+	  If unsure, say N.
+
+
 config PATA_BUDDHA
 	tristate "Buddha/Catweasel/X-Surf PATA support"
 	depends on ZORRO
drivers/ata/Makefile +1 -0
index 20e6645ab737..7b9b87ebacea 100644
@@ -98,6 +98,7 @@ obj-$(CONFIG_PATA_WINBOND)	+= pata_sl82c105.o
 obj-$(CONFIG_PATA_CMD640_PCI)	+= pata_cmd640.o
 obj-$(CONFIG_PATA_FALCON)	+= pata_falcon.o
 obj-$(CONFIG_PATA_GAYLE)	+= pata_gayle.o
+obj-$(CONFIG_PATA_CSWARP)	+= pata_cswarp.o
 obj-$(CONFIG_PATA_BUDDHA)	+= pata_buddha.o
 obj-$(CONFIG_PATA_ISAPNP)	+= pata_isapnp.o
 obj-$(CONFIG_PATA_IXP4XX_CF)	+= pata_ixp4xx_cf.o
drivers/ata/pata_cswarp.c new file +185 -0

185 lines not on this page · raw message

Signature · 1 line
2.34.1
#2 lore raw

Re: [PATCH v4 1/2] ata: pata_cswarp: Add Amiga cslab ata support

Hi Paolo,

Quoted 4 lines · Paolo Pisati

Driver for the on-board IDE interface on CS-Lab Warp Expansion Card (NOTE that idemode=native has to be set in Warp Configuration)

Thanks for your patch!

Quoted 7 lines
drivers/ata/Kconfig +1 -0
@@ -1025,6 +1025,17 @@ config PATA_GAYLE
 
          If unsure, say N.
 
+config PATA_CSWARP

drivers/ata/Kconfig config PATA_GAYLE · line 1038

Quoted 10 lines
drivers/ata/Kconfig +10 -0
+       tristate "Amiga CS Warp PATA support"
+       depends on M68K && AMIGA && ZORRO
+       help
+         This option enables support for the on-board IDE interface on
+         CS-Lab Warp Expansion Card (NOTE that idemode=native has to be
+         set in Warp Configuration)
+
+         If unsure, say N.
+
+

Please drop one blank line.

Quoted 24 lines
drivers/ata/Kconfig +0 -0
 config PATA_BUDDHA
        tristate "Buddha/Catweasel/X-Surf PATA support"
        depends on ZORRO

index 000000000000..e0a0db6f7cfd

drivers/ata/pata_cswarp.c new file +16 -0
 
+static unsigned int pata_cswarp_data_xfer(struct ata_queued_cmd *qc,
+                                        unsigned char *buf,
+                                        unsigned int buflen, int rw)
+{
+       struct ata_device *dev = qc->dev;
+       struct ata_port *ap = dev->link->ap;
+       volatile void __iomem *data_addr = ap->ioaddr.data_addr;
+       unsigned int words = buflen >> 1;
+       u16 *buf16 = (u16 *)buf;
+
+       /* Transfer multiple of 2 bytes */
+       if (rw == READ)
+               raw_insw(data_addr, buf16, words);
+       else
+               raw_outsw(data_addr, buf16, words);
+

drivers/ata/pata_cswarp.c line 65

Quoted 10 lines
drivers/ata/pata_cswarp.c new file +10 -0
+       /* Transfer trailing byte, if any. */
+       if (unlikely(buflen & 0x01)) {
+               unsigned char pad[2] = { };
+
+               /* Point buf to the tail of buffer */
+               buf16 += words;
+
+               if (rw == READ) {
+                       *pad = raw_inw(data_addr);
+                       *buf16 = pad[0];

This looks wrong to me: as *pad is the same as pad[0], you could just eliminate the pad[] intermediate...
Moreover, this writes one byte too much into the buffer.

drivers/ata/pata_cswarp.c line 69

Quoted 4 lines
drivers/ata/pata_cswarp.c new file +4 -0
+               } else {
+                       pad[0] = *buf16;
+                       raw_outw(*pad, data_addr);
+               }

Comparing to what v3 did, I think you want:

    if (rw == READ)
            buf[buflen-1] = raw_inw(data_addr) >> 8;
    else
            raw_outw(buf[buflen-1] << 8, data_addr);

As all Amigas are big-endian, I think there is no need to implement this using some endian conversion function.

drivers/ata/pata_cswarp.c line 73

Quoted 4 lines
drivers/ata/pata_cswarp.c new file +4 -0
+       }
+
+       return buflen;
+}

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

#3 lore raw

PATCH v4 2/2 m68k: defconfig: enable PATA_CSWARP

In reply to Paolo Pisati
---
 arch/m68k/configs/amiga_defconfig | 1 +
 arch/m68k/configs/multi_defconfig | 1 +
 2 files changed, 2 insertions(+)
arch/m68k/configs/amiga_defconfig +1 -0
index c705247e7b5b..feed92c95394 100644
@@ -334,6 +334,7 @@ CONFIG_ATA=y
 # CONFIG_ATA_VERBOSE_ERROR is not set
 # CONFIG_ATA_BMDMA is not set
 CONFIG_PATA_GAYLE=y
+CONFIG_PATA_CSWARP=y
 CONFIG_PATA_BUDDHA=y
 CONFIG_MD=y
 CONFIG_BLK_DEV_DM=m
arch/m68k/configs/multi_defconfig +1 -0
index 20d877cb4e30..111900456d04 100644
@@ -360,6 +360,7 @@ CONFIG_ATA=y
 # CONFIG_ATA_BMDMA is not set
 CONFIG_PATA_FALCON=y
 CONFIG_PATA_GAYLE=y
+CONFIG_PATA_CSWARP=y
 CONFIG_PATA_BUDDHA=y
 CONFIG_PATA_PLATFORM=y
 CONFIG_MD=y
Signature · 1 line
2.34.1
maintainer Acked-by on v4 2/2
#4 lore raw

Re: [PATCH v4 2/2] m68k: defconfig: enable PATA_CSWARP

Quoted 1 line · Paolo Pisati

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

#5 lore raw
In reply to Paolo Pisati
Quoted 7 lines · Paolo Pisati

Here is a driver (and the subsequent defconfig change) for the pata/CF socket in the CS-Lab Warp series of Amiga boards.

Changes in v4:
- refactor pata_cswarp_data_xfer()
- ioremap WARP_OFFSET_ATA region

Quoted 8 lines

Changes in v3:
- suppress a comment
- properly return ata_host_activate() error code

Change in v2:
- fix style, remove duplicate swap macro, driver version, etc
- rework the zorro attach mechanism
- remove the unnecessary zorro ids refactor

Gentle ping about this one: can i get an ACK or a NACK?

Thanks.

Signature · 2 lines
bye,
p.
maintainer
#6 lore raw
Quoted 12 lines · Paolo Pisati
Quoted 11 lines · Paolo Pisati

Here is a driver (and the subsequent defconfig change) for the pata/CF socket in the CS-Lab Warp series of Amiga boards.

Changes in v4:
- refactor pata_cswarp_data_xfer()
- ioremap WARP_OFFSET_ATA region

Changes in v3:
- suppress a comment
- properly return ata_host_activate() error code

Quoted 6 lines
Quoted 4 lines

Change in v2:
- fix style, remove duplicate swap macro, driver version, etc
- rework the zorro attach mechanism
- remove the unnecessary zorro ids refactor

Gentle ping about this one: can i get an ACK or a NACK?

Sorry, this fell through the cracks.
This looks OK to me.

Geert,

Any comment / ack ? Or do you prefer to take these through the m68k tree ?

Signature · 2 lines
Damien Le Moal
Western Digital Research
#7 lore raw

Hi Geert,

any chance you could give us an update on this?

Quoted 31 lines · Damien Le Moal
Quoted 12 lines · Paolo Pisati
Quoted 11 lines · Paolo Pisati

Here is a driver (and the subsequent defconfig change) for the pata/CF socket in the CS-Lab Warp series of Amiga boards.

Changes in v4:
- refactor pata_cswarp_data_xfer()
- ioremap WARP_OFFSET_ATA region

Changes in v3:
- suppress a comment
- properly return ata_host_activate() error code

Quoted 6 lines
Quoted 4 lines

Change in v2:
- fix style, remove duplicate swap macro, driver version, etc
- rework the zorro attach mechanism
- remove the unnecessary zorro ids refactor

Gentle ping about this one: can i get an ACK or a NACK?

Sorry, this fell through the cracks.
This looks OK to me.

Geert,

Any comment / ack ? Or do you prefer to take these through the m68k tree ?

--
Damien Le Moal
Western Digital Research

Signature · 2 lines
bye,
p.