Skip to contentSkip to conversation

m68k: pata_cswarp: Add Amiga cslab ata support

PATCH Superseded Paolo Pisati 3 participants 7 messages Mar 24, 2025

Subsystems (2)

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

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

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):
m68k: amiga_defconfig: enable PATA_CSWARP
ata: pata_cswarp: Add Amiga cslab ata support

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

PATCH v2 1/2 m68k: amiga_defconfig: enable PATA_CSWARP

---
 arch/m68k/configs/amiga_defconfig | 1 +
 1 file changed, 1 insertion(+)
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
Signature · 1 line
2.34.1
#4 lore raw

PATCH v2 2/2 ata: pata_cswarp: Add Amiga cslab ata support

In reply to 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)

---
 drivers/ata/Kconfig       |  11 +++
 drivers/ata/Makefile      |   1 +
 drivers/ata/pata_cswarp.c | 189 ++++++++++++++++++++++++++++++++++++++
 3 files changed, 201 insertions(+)
 create mode 100644 drivers/ata/pata_cswarp.c
drivers/ata/Kconfig +11 -0
index e00536b49552..a278386f0fa2 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
+	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 +189 -0

189 lines not on this page · raw message

Signature · 1 line
2.34.1
maintainer
#2 lore raw

Re: [PATCH v2 1/2] m68k: amiga_defconfig: enable PATA_CSWARP

In reply to Paolo Pisati
Quoted 10 lines · Paolo Pisati
---
 arch/m68k/configs/amiga_defconfig | 1 +
 1 file changed, 1 insertion(+)
arch/m68k/configs/amiga_defconfig +0 -0
index c705247e7b5b..feed92c95394 100644

arch/m68k/configs/amiga_defconfig CONFIG_ATA=y · line 337

Quoted 4 lines
arch/m68k/configs/amiga_defconfig +1 -0
@@ -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

This needs to be patch 2, otherwise there will be some bisectability issues. Unless Geert wants to take this patch and we queue patch 1 (the driver) through libata tree.

Geert,

How do yu want to proceed ? We can take everything through libata, or you can take both patches through your tree. I do not have a strong preference either way.

Quoted 3 lines
arch/m68k/configs/amiga_defconfig +0 -0
 CONFIG_PATA_BUDDHA=y
 CONFIG_MD=y
 CONFIG_BLK_DEV_DM=m
Signature · 2 lines
Damien Le Moal
Western Digital Research
maintainer
#5 lore raw

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

In reply to Paolo Pisati
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)

2 nits below.

[...]

Quoted 7 lines
drivers/ata/pata_cswarp.c new file +7 -0
+static int pata_cswarp_probe(struct zorro_dev *z,
+			     const struct zorro_device_id *ent)
+{
+	static const char board_name[] = "csWarp";
+	struct ata_host *host;
+	struct ata_port *ap;
+	void __iomem *cswarp_ctrl_board, *base;

drivers/ata/pata_cswarp.c line 117

Quoted 10 lines
drivers/ata/pata_cswarp.c new file +10 -0
+	unsigned long board = z->resource.start;
+
+	dev_info(&z->dev, "%s IDE controller (board: 0x%lx)\n", board_name,
+		 board);
+
+	if (!devm_request_mem_region(&z->dev, board + WARP_OFFSET_ATA, 0x1800,
+				     DRV_NAME))
+		return -ENXIO;
+
+	/* allocate host */

Not a very useful comment :)
You can drop this as the function name is obvious.

Quoted 24 lines
drivers/ata/pata_cswarp.c new file +24 -0
+	host = ata_host_alloc(&z->dev, 1);
+	if (!host)
+		return -ENXIO;
+
+	cswarp_ctrl_board = (void *)board;
+
+	ap = host->ports[0];
+	base = cswarp_ctrl_board + WARP_OFFSET_ATA;
+
+	ap->ops = &pata_cswarp_ops;
+
+	ap->pio_mask = ATA_PIO4;
+	ap->flags |= ATA_FLAG_SLAVE_POSS | ATA_FLAG_NO_IORDY |
+		ATA_FLAG_PIO_POLLING;
+
+	ap->ioaddr.data_addr		= base;
+	ap->ioaddr.error_addr		= base + 1 * 4;
+	ap->ioaddr.feature_addr		= base + 1 * 4;
+	ap->ioaddr.nsect_addr		= base + 2 * 4;
+	ap->ioaddr.lbal_addr		= base + 3 * 4;
+	ap->ioaddr.lbam_addr		= base + 4 * 4;
+	ap->ioaddr.lbah_addr		= base + 5 * 4;
+	ap->ioaddr.device_addr		= base + 6 * 4;
+	ap->ioaddr.status_addr		= base + 7 * 4;

drivers/ata/pata_cswarp.c line 151

Quoted 10 lines
drivers/ata/pata_cswarp.c new file +10 -0
+	ap->ioaddr.command_addr		= base + 7 * 4;
+
+	ap->ioaddr.altstatus_addr	= base + (0x1000 | (6UL << 2));
+	ap->ioaddr.ctl_addr		= base + (0x1000 | (6UL << 2));
+
+	ata_port_desc(ap, "  cmd 0x%lx ctl 0x%lx", (unsigned long)base,
+		      (unsigned long)ap->ioaddr.ctl_addr);
+
+	ata_host_activate(host, 0, NULL,
+			  IRQF_SHARED, &pata_cswarp_sht);
	return ata_host_activate(host, 0, NULL,
				 IRQF_SHARED, &pata_cswarp_sht);

so that errors are properly reported.

Quoted 4 lines
drivers/ata/pata_cswarp.c new file +4 -0
+
+	return 0;
+}
+
Signature · 2 lines
Damien Le Moal
Western Digital Research
#6 lore raw

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

Quoted 10 lines · Damien Le Moal

drivers/ata/pata_cswarp.c line 151

Quoted 5 lines
drivers/ata/pata_cswarp.c new file +5 -0
+	ata_port_desc(ap, "  cmd 0x%lx ctl 0x%lx", (unsigned long)base,
+		      (unsigned long)ap->ioaddr.ctl_addr);
+
+	ata_host_activate(host, 0, NULL,
+			  IRQF_SHARED, &pata_cswarp_sht);
	return ata_host_activate(host, 0, NULL,
				 IRQF_SHARED, &pata_cswarp_sht);

so that errors are properly reported.

Ack, will send a v3 and reorder the patches.

Signature · 2 lines
bye,
p.
#3 lore raw

Re: [PATCH v2 1/2] m68k: amiga_defconfig: enable PATA_CSWARP

In reply to Damien Le Moal

Hi Damien,

Quoted 20 lines · Damien Le Moal
Quoted 10 lines · Paolo Pisati
---
 arch/m68k/configs/amiga_defconfig | 1 +
 1 file changed, 1 insertion(+)
arch/m68k/configs/amiga_defconfig +0 -0
index c705247e7b5b..feed92c95394 100644

arch/m68k/configs/amiga_defconfig CONFIG_ATA=y · line 337

Quoted 4 lines
arch/m68k/configs/amiga_defconfig +1 -0
@@ -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

This needs to be patch 2, otherwise there will be some bisectability issues. Unless Geert wants to take this patch and we queue patch 1 (the driver) through libata tree.

Quoted 4 lines

Geert,

How do yu want to proceed ? We can take everything through libata, or you can take both patches through your tree. I do not have a strong preference either way.

Me neither. We don't get to see new hardware support a lot ;-)

Paolo:
Please enable the driver in arch/m68k/configs/multi_defconfig, too.

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
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