linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/2] Use libata platform drivers to replace deprecated m68k IDE drivers
@ 2021-06-08  5:46 Finn Thain
  2021-06-08  5:46 ` [PATCH v2 2/2] m68k/q40: Replace q40ide driver with pata_falcon and falconide Finn Thain
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Finn Thain @ 2021-06-08  5:46 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Jens Axboe, David S. Miller, Joshua Thompson, linux-ide,
	linux-kernel, linux-m68k, Richard Zidlicky, Michael Schmitz

This patch series allows m68k platforms to switch from deprecated IDE
drivers to libata drivers.

Changed since v1:
 - Added reviewed-by and tested-by tags.
 - Improved commit logs.


Finn Thain (2):
  m68k/mac: Replace macide driver with generic platform drivers
  m68k/q40: Replace q40ide driver with pata_falcon and falconide

 arch/m68k/atari/config.c          |  12 +--
 arch/m68k/configs/mac_defconfig   |   1 -
 arch/m68k/configs/multi_defconfig |   2 -
 arch/m68k/configs/q40_defconfig   |   2 +-
 arch/m68k/mac/config.c            |  24 +++--
 arch/m68k/q40/config.c            |  37 +++++--
 drivers/ata/Kconfig               |   6 +-
 drivers/ata/pata_falcon.c         |  62 ++++++++---
 drivers/ide/Kconfig               |  32 +-----
 drivers/ide/Makefile              |   2 -
 drivers/ide/falconide.c           |  75 ++++++++-----
 drivers/ide/macide.c              | 161 ----------------------------
 drivers/ide/q40ide.c              | 168 ------------------------------
 13 files changed, 151 insertions(+), 433 deletions(-)
 delete mode 100644 drivers/ide/macide.c
 delete mode 100644 drivers/ide/q40ide.c

-- 
2.26.3


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

* [PATCH v2 1/2] m68k/mac: Replace macide driver with generic platform drivers
  2021-06-08  5:46 [PATCH v2 0/2] Use libata platform drivers to replace deprecated m68k IDE drivers Finn Thain
  2021-06-08  5:46 ` [PATCH v2 2/2] m68k/q40: Replace q40ide driver with pata_falcon and falconide Finn Thain
@ 2021-06-08  5:46 ` Finn Thain
  2021-06-09  6:26   ` Geert Uytterhoeven
  2021-06-08 14:37 ` [PATCH v2 0/2] Use libata platform drivers to replace deprecated m68k IDE drivers Christoph Hellwig
  2 siblings, 1 reply; 12+ messages in thread
From: Finn Thain @ 2021-06-08  5:46 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Jens Axboe, David S. Miller, Michael Schmitz, Joshua Thompson,
	linux-m68k, linux-kernel, linux-ide

This allows m68k mac systems to switch from the deprecated IDE subsystem
to libata.

This was tested on my Quadra 630. I haven't tested it on my PowerBook 150
because I don't have a RAM adapter board for it. It appears that the
hardware I tested doesn't need macide_clear_irq() or macide_test_irq().
If it did, the generic driver would not have worked. It's possible that
those routines are needed for the PowerBook 150 but we can cross that
bridge if and when we come to it.

BTW, macide_clear_irq() appears to suffer from a race condition. The write
to the interrupt flags register could have unintended side effects as it
may alter other flag bits. Fortunately, all of the other bits are unused
by Linux. When tested on my Quadra 630, the assignment *ide_ifr &= ~0x20
was observed to have no effect on bit 5, so it may be redundant anyway.

Cc: Michael Schmitz <schmitzmic@gmail.com>
Cc: Joshua Thompson <funaho@jurai.org>
Reviewed-by: Michael Schmitz <schmitzmic@gmail.com>
Signed-off-by: Finn Thain <fthain@linux-m68k.org>
---
 arch/m68k/configs/mac_defconfig   |   1 -
 arch/m68k/configs/multi_defconfig |   1 -
 arch/m68k/mac/config.c            |  24 +++--
 drivers/ide/Kconfig               |  14 ---
 drivers/ide/Makefile              |   1 -
 drivers/ide/macide.c              | 161 ------------------------------
 6 files changed, 14 insertions(+), 188 deletions(-)
 delete mode 100644 drivers/ide/macide.c

diff --git a/arch/m68k/configs/mac_defconfig b/arch/m68k/configs/mac_defconfig
index bf15e6c1c939..c72a85a084cc 100644
--- a/arch/m68k/configs/mac_defconfig
+++ b/arch/m68k/configs/mac_defconfig
@@ -319,7 +319,6 @@ CONFIG_IDE=y
 CONFIG_IDE_GD_ATAPI=y
 CONFIG_BLK_DEV_IDECD=y
 CONFIG_BLK_DEV_PLATFORM=y
-CONFIG_BLK_DEV_MAC_IDE=y
 CONFIG_RAID_ATTRS=m
 CONFIG_SCSI=y
 CONFIG_BLK_DEV_SD=y
diff --git a/arch/m68k/configs/multi_defconfig b/arch/m68k/configs/multi_defconfig
index 5466d48fcd9d..9ee6d2b4d1f4 100644
--- a/arch/m68k/configs/multi_defconfig
+++ b/arch/m68k/configs/multi_defconfig
@@ -351,7 +351,6 @@ CONFIG_BLK_DEV_PLATFORM=y
 CONFIG_BLK_DEV_GAYLE=y
 CONFIG_BLK_DEV_BUDDHA=y
 CONFIG_BLK_DEV_FALCON_IDE=y
-CONFIG_BLK_DEV_MAC_IDE=y
 CONFIG_BLK_DEV_Q40IDE=y
 CONFIG_RAID_ATTRS=m
 CONFIG_SCSI=y
diff --git a/arch/m68k/mac/config.c b/arch/m68k/mac/config.c
index 1cdac959bd91..5d16f9b47aa9 100644
--- a/arch/m68k/mac/config.c
+++ b/arch/m68k/mac/config.c
@@ -933,13 +933,15 @@ static const struct resource mac_scsi_ccl_rsrc[] __initconst = {
 	},
 };
 
-static const struct resource mac_ide_quadra_rsrc[] __initconst = {
-	DEFINE_RES_MEM(0x50F1A000, 0x104),
+static const struct resource mac_pata_quadra_rsrc[] __initconst = {
+	DEFINE_RES_MEM(0x50F1A000, 0x38),
+	DEFINE_RES_MEM(0x50F1A038, 0x04),
 	DEFINE_RES_IRQ(IRQ_NUBUS_F),
 };
 
-static const struct resource mac_ide_pb_rsrc[] __initconst = {
-	DEFINE_RES_MEM(0x50F1A000, 0x104),
+static const struct resource mac_pata_pb_rsrc[] __initconst = {
+	DEFINE_RES_MEM(0x50F1A000, 0x38),
+	DEFINE_RES_MEM(0x50F1A038, 0x04),
 	DEFINE_RES_IRQ(IRQ_NUBUS_C),
 };
 
@@ -949,7 +951,7 @@ static const struct resource mac_pata_baboon_rsrc[] __initconst = {
 	DEFINE_RES_IRQ(IRQ_BABOON_1),
 };
 
-static const struct pata_platform_info mac_pata_baboon_data __initconst = {
+static const struct pata_platform_info mac_pata_data __initconst = {
 	.ioport_shift = 2,
 };
 
@@ -1067,17 +1069,19 @@ int __init mac_platform_init(void)
 
 	switch (macintosh_config->ide_type) {
 	case MAC_IDE_QUADRA:
-		platform_device_register_simple("mac_ide", -1,
-			mac_ide_quadra_rsrc, ARRAY_SIZE(mac_ide_quadra_rsrc));
+		platform_device_register_resndata(NULL, "pata_platform", -1,
+			mac_pata_quadra_rsrc, ARRAY_SIZE(mac_pata_quadra_rsrc),
+			&mac_pata_data, sizeof(mac_pata_data));
 		break;
 	case MAC_IDE_PB:
-		platform_device_register_simple("mac_ide", -1,
-			mac_ide_pb_rsrc, ARRAY_SIZE(mac_ide_pb_rsrc));
+		platform_device_register_resndata(NULL, "pata_platform", -1,
+			mac_pata_pb_rsrc, ARRAY_SIZE(mac_pata_pb_rsrc),
+			&mac_pata_data, sizeof(mac_pata_data));
 		break;
 	case MAC_IDE_BABOON:
 		platform_device_register_resndata(NULL, "pata_platform", -1,
 			mac_pata_baboon_rsrc, ARRAY_SIZE(mac_pata_baboon_rsrc),
-			&mac_pata_baboon_data, sizeof(mac_pata_baboon_data));
+			&mac_pata_data, sizeof(mac_pata_data));
 		break;
 	}
 
diff --git a/drivers/ide/Kconfig b/drivers/ide/Kconfig
index 19abf11c84c8..8ce4a5878d0c 100644
--- a/drivers/ide/Kconfig
+++ b/drivers/ide/Kconfig
@@ -739,20 +739,6 @@ config BLK_DEV_FALCON_IDE
 	  disks, CD-ROM drives, etc.) that are connected to the on-board IDE
 	  interface.
 
-config BLK_DEV_MAC_IDE
-	tristate "Macintosh Quadra/Powerbook IDE interface support"
-	depends on MAC
-	help
-	  This is the IDE driver for the on-board IDE interface on some m68k
-	  Macintosh models, namely Quadra/Centris 630, Performa 588 and
-	  Powerbook 150. The IDE interface on the Powerbook 190 is not
-	  supported by this driver and requires BLK_DEV_PLATFORM or
-	  PATA_PLATFORM.
-
-	  Say Y if you have such an Macintosh model and want to use IDE
-	  devices (hard disks, CD-ROM drives, etc.) that are connected to the
-	  on-board IDE interface.
-
 config BLK_DEV_Q40IDE
 	tristate "Q40/Q60 IDE interface support"
 	depends on Q40
diff --git a/drivers/ide/Makefile b/drivers/ide/Makefile
index 2605b3cdaf47..45a1c0463bed 100644
--- a/drivers/ide/Makefile
+++ b/drivers/ide/Makefile
@@ -29,7 +29,6 @@ obj-$(CONFIG_BLK_DEV_4DRIVES)		+= ide-4drives.o
 
 obj-$(CONFIG_BLK_DEV_GAYLE)		+= gayle.o
 obj-$(CONFIG_BLK_DEV_FALCON_IDE)	+= falconide.o
-obj-$(CONFIG_BLK_DEV_MAC_IDE)		+= macide.o
 obj-$(CONFIG_BLK_DEV_Q40IDE)		+= q40ide.o
 obj-$(CONFIG_BLK_DEV_BUDDHA)		+= buddha.o
 
diff --git a/drivers/ide/macide.c b/drivers/ide/macide.c
deleted file mode 100644
index 8d2bf73bc548..000000000000
--- a/drivers/ide/macide.c
+++ /dev/null
@@ -1,161 +0,0 @@
-/*
- *  Macintosh IDE Driver
- *
- *     Copyright (C) 1998 by Michael Schmitz
- *
- *  This driver was written based on information obtained from the MacOS IDE
- *  driver binary by Mikael Forselius
- *
- *  This file is subject to the terms and conditions of the GNU General Public
- *  License.  See the file COPYING in the main directory of this archive for
- *  more details.
- */
-
-#include <linux/types.h>
-#include <linux/mm.h>
-#include <linux/interrupt.h>
-#include <linux/blkdev.h>
-#include <linux/delay.h>
-#include <linux/ide.h>
-#include <linux/module.h>
-#include <linux/platform_device.h>
-
-#include <asm/macintosh.h>
-
-#define DRV_NAME "mac_ide"
-
-#define IDE_BASE 0x50F1A000	/* Base address of IDE controller */
-
-/*
- * Generic IDE registers as offsets from the base
- * These match MkLinux so they should be correct.
- */
-
-#define IDE_CONTROL	0x38	/* control/altstatus */
-
-/*
- * Mac-specific registers
- */
-
-/*
- * this register is odd; it doesn't seem to do much and it's
- * not word-aligned like virtually every other hardware register
- * on the Mac...
- */
-
-#define IDE_IFR		0x101	/* (0x101) IDE interrupt flags on Quadra:
-				 *
-				 * Bit 0+1: some interrupt flags
-				 * Bit 2+3: some interrupt enable
-				 * Bit 4:   ??
-				 * Bit 5:   IDE interrupt flag (any hwif)
-				 * Bit 6:   maybe IDE interrupt enable (any hwif) ??
-				 * Bit 7:   Any interrupt condition
-				 */
-
-volatile unsigned char *ide_ifr = (unsigned char *) (IDE_BASE + IDE_IFR);
-
-int macide_test_irq(ide_hwif_t *hwif)
-{
-	if (*ide_ifr & 0x20)
-		return 1;
-	return 0;
-}
-
-static void macide_clear_irq(ide_drive_t *drive)
-{
-	*ide_ifr &= ~0x20;
-}
-
-static void __init macide_setup_ports(struct ide_hw *hw, unsigned long base,
-				      int irq)
-{
-	int i;
-
-	memset(hw, 0, sizeof(*hw));
-
-	for (i = 0; i < 8; i++)
-		hw->io_ports_array[i] = base + i * 4;
-
-	hw->io_ports.ctl_addr = base + IDE_CONTROL;
-
-	hw->irq = irq;
-}
-
-static const struct ide_port_ops macide_port_ops = {
-	.clear_irq		= macide_clear_irq,
-	.test_irq		= macide_test_irq,
-};
-
-static const struct ide_port_info macide_port_info = {
-	.port_ops		= &macide_port_ops,
-	.host_flags		= IDE_HFLAG_MMIO | IDE_HFLAG_NO_DMA,
-	.irq_flags		= IRQF_SHARED,
-	.chipset		= ide_generic,
-};
-
-static const char *mac_ide_name[] =
-	{ "Quadra", "Powerbook", "Powerbook Baboon" };
-
-/*
- * Probe for a Macintosh IDE interface
- */
-
-static int mac_ide_probe(struct platform_device *pdev)
-{
-	struct resource *mem, *irq;
-	struct ide_hw hw, *hws[] = { &hw };
-	struct ide_port_info d = macide_port_info;
-	struct ide_host *host;
-	int rc;
-
-	if (!MACH_IS_MAC)
-		return -ENODEV;
-
-	mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	if (!mem)
-		return -ENODEV;
-
-	irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
-	if (!irq)
-		return -ENODEV;
-
-	if (!devm_request_mem_region(&pdev->dev, mem->start,
-				     resource_size(mem), DRV_NAME)) {
-		dev_err(&pdev->dev, "resources busy\n");
-		return -EBUSY;
-	}
-
-	printk(KERN_INFO "ide: Macintosh %s IDE controller\n",
-			 mac_ide_name[macintosh_config->ide_type - 1]);
-
-	macide_setup_ports(&hw, mem->start, irq->start);
-
-	rc = ide_host_add(&d, hws, 1, &host);
-	if (rc)
-		return rc;
-
-	platform_set_drvdata(pdev, host);
-	return 0;
-}
-
-static int mac_ide_remove(struct platform_device *pdev)
-{
-	struct ide_host *host = platform_get_drvdata(pdev);
-
-	ide_host_remove(host);
-	return 0;
-}
-
-static struct platform_driver mac_ide_driver = {
-	.driver = {
-		.name = DRV_NAME,
-	},
-	.probe  = mac_ide_probe,
-	.remove = mac_ide_remove,
-};
-
-module_platform_driver(mac_ide_driver);
-
-MODULE_ALIAS("platform:" DRV_NAME);
-MODULE_LICENSE("GPL");
-- 
2.26.3


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

* [PATCH v2 2/2] m68k/q40: Replace q40ide driver with pata_falcon and falconide
  2021-06-08  5:46 [PATCH v2 0/2] Use libata platform drivers to replace deprecated m68k IDE drivers Finn Thain
@ 2021-06-08  5:46 ` Finn Thain
  2021-06-09  6:30   ` Geert Uytterhoeven
  2021-06-08  5:46 ` [PATCH v2 1/2] m68k/mac: Replace macide driver with generic platform drivers Finn Thain
  2021-06-08 14:37 ` [PATCH v2 0/2] Use libata platform drivers to replace deprecated m68k IDE drivers Christoph Hellwig
  2 siblings, 1 reply; 12+ messages in thread
From: Finn Thain @ 2021-06-08  5:46 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Jens Axboe, David S. Miller, Michael Schmitz, Richard Zidlicky,
	linux-m68k, linux-kernel, linux-ide

This allows m68k q40 systems to switch from the deprecated IDE subsystem
to libata.

Enhance the byte-swapping falconide and pata_falcon platform drivers to
accept an irq resource, for use on q40. Atari ST-DMA IRQ arrangements seem
to co-exist with q40 IRQ arrangements without too much mess.

The new IO resources were added solely for the purpose of making
request_region() reservations identical to those made by q40ide: these
regions aren't used for actual IO.

Cc: Michael Schmitz <schmitzmic@gmail.com>
Cc: Richard Zidlicky <rz@linux-m68k.org>
Reviewed-and-tested-by: Michael Schmitz <schmitzmic@gmail.com>
Signed-off-by: Finn Thain <fthain@linux-m68k.org>
---
Note that q40ide, falconide and pata_falcon all use the same accessors
(raw_insw_swapw, raw_insw, raw_outsw_swapw, raw_outsw) and hence all
three drivers are affected by the bug relating to CONFIG_ISA and
CONFIG_ATARI_ROM_ISA which Michael has been working on recently.
This patch doesn't make that issue any better or worse.
---
 arch/m68k/atari/config.c          |  12 +--
 arch/m68k/configs/multi_defconfig |   1 -
 arch/m68k/configs/q40_defconfig   |   2 +-
 arch/m68k/q40/config.c            |  37 +++++--
 drivers/ata/Kconfig               |   6 +-
 drivers/ata/pata_falcon.c         |  62 ++++++++---
 drivers/ide/Kconfig               |  18 +---
 drivers/ide/Makefile              |   1 -
 drivers/ide/falconide.c           |  75 ++++++++-----
 drivers/ide/q40ide.c              | 168 ------------------------------
 10 files changed, 137 insertions(+), 245 deletions(-)
 delete mode 100644 drivers/ide/q40ide.c

diff --git a/arch/m68k/atari/config.c b/arch/m68k/atari/config.c
index 44f9b5216ac9..261a0f57cc9a 100644
--- a/arch/m68k/atari/config.c
+++ b/arch/m68k/atari/config.c
@@ -875,16 +875,8 @@ static const struct resource atari_scsi_tt_rsrc[] __initconst = {
 #define FALCON_IDE_BASE	0xfff00000
 
 static const struct resource atari_falconide_rsrc[] __initconst = {
-	{
-		.flags = IORESOURCE_MEM,
-		.start = FALCON_IDE_BASE,
-		.end   = FALCON_IDE_BASE + 0x39,
-	},
-	{
-		.flags = IORESOURCE_IRQ,
-		.start = IRQ_MFP_FSCSI,
-		.end   = IRQ_MFP_FSCSI,
-	},
+	DEFINE_RES_MEM(FALCON_IDE_BASE, 0x38),
+	DEFINE_RES_MEM(FALCON_IDE_BASE + 0x38, 2),
 };
 
 int __init atari_platform_init(void)
diff --git a/arch/m68k/configs/multi_defconfig b/arch/m68k/configs/multi_defconfig
index 9ee6d2b4d1f4..f4cafed671cb 100644
--- a/arch/m68k/configs/multi_defconfig
+++ b/arch/m68k/configs/multi_defconfig
@@ -351,7 +351,6 @@ CONFIG_BLK_DEV_PLATFORM=y
 CONFIG_BLK_DEV_GAYLE=y
 CONFIG_BLK_DEV_BUDDHA=y
 CONFIG_BLK_DEV_FALCON_IDE=y
-CONFIG_BLK_DEV_Q40IDE=y
 CONFIG_RAID_ATTRS=m
 CONFIG_SCSI=y
 CONFIG_BLK_DEV_SD=y
diff --git a/arch/m68k/configs/q40_defconfig b/arch/m68k/configs/q40_defconfig
index 3ae421cb24a4..2c25b4096397 100644
--- a/arch/m68k/configs/q40_defconfig
+++ b/arch/m68k/configs/q40_defconfig
@@ -317,7 +317,7 @@ CONFIG_DUMMY_IRQ=m
 CONFIG_IDE=y
 CONFIG_IDE_GD_ATAPI=y
 CONFIG_BLK_DEV_IDECD=y
-CONFIG_BLK_DEV_Q40IDE=y
+CONFIG_BLK_DEV_FALCON_IDE=y
 CONFIG_RAID_ATTRS=m
 CONFIG_SCSI=y
 CONFIG_BLK_DEV_SD=y
diff --git a/arch/m68k/q40/config.c b/arch/m68k/q40/config.c
index d6a423875231..5caf1e5be1c2 100644
--- a/arch/m68k/q40/config.c
+++ b/arch/m68k/q40/config.c
@@ -286,14 +286,39 @@ static int q40_set_rtc_pll(struct rtc_pll_info *pll)
 		return -EINVAL;
 }
 
-static __init int q40_add_kbd_device(void)
-{
-	struct platform_device *pdev;
+#define PCIDE_BASE1	0x1f0
+#define PCIDE_BASE2	0x170
+#define PCIDE_CTL	0x206
+
+static const struct resource q40_pata_rsrc_0[] __initconst = {
+	DEFINE_RES_MEM(q40_isa_io_base + PCIDE_BASE1 * 4, 0x38),
+	DEFINE_RES_MEM(q40_isa_io_base + (PCIDE_BASE1 + PCIDE_CTL) * 4, 2),
+	DEFINE_RES_IO(PCIDE_BASE1, 8),
+	DEFINE_RES_IO(PCIDE_BASE1 + PCIDE_CTL, 1),
+	DEFINE_RES_IRQ(14),
+};
 
+static const struct resource q40_pata_rsrc_1[] __initconst = {
+	DEFINE_RES_MEM(q40_isa_io_base + PCIDE_BASE2 * 4, 0x38),
+	DEFINE_RES_MEM(q40_isa_io_base + (PCIDE_BASE2 + PCIDE_CTL) * 4, 2),
+	DEFINE_RES_IO(PCIDE_BASE2, 8),
+	DEFINE_RES_IO(PCIDE_BASE2 + PCIDE_CTL, 1),
+	DEFINE_RES_IRQ(15),
+};
+
+static __init int q40_platform_init(void)
+{
 	if (!MACH_IS_Q40)
 		return -ENODEV;
 
-	pdev = platform_device_register_simple("q40kbd", -1, NULL, 0);
-	return PTR_ERR_OR_ZERO(pdev);
+	platform_device_register_simple("q40kbd", -1, NULL, 0);
+
+	platform_device_register_simple("atari-falcon-ide", 0, q40_pata_rsrc_0,
+					ARRAY_SIZE(q40_pata_rsrc_0));
+
+	platform_device_register_simple("atari-falcon-ide", 1, q40_pata_rsrc_1,
+					ARRAY_SIZE(q40_pata_rsrc_1));
+
+	return 0;
 }
-arch_initcall(q40_add_kbd_device);
+arch_initcall(q40_platform_init);
diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig
index 030cb32da980..b7a5abee2147 100644
--- a/drivers/ata/Kconfig
+++ b/drivers/ata/Kconfig
@@ -1015,11 +1015,11 @@ config PATA_CMD640_PCI
 	  If unsure, say N.
 
 config PATA_FALCON
-	tristate "Atari Falcon PATA support"
-	depends on M68K && ATARI
+	tristate "Atari Falcon and Q40/Q60 PATA support"
+	depends on M68K && (ATARI || Q40)
 	help
 	  This option enables support for the on-board IDE
-	  interface on the Atari Falcon.
+	  interface on the Atari Falcon and Q40/Q60.
 
 	  If unsure, say N.
 
diff --git a/drivers/ata/pata_falcon.c b/drivers/ata/pata_falcon.c
index 27b0952fde6b..9d0dd8f4c21c 100644
--- a/drivers/ata/pata_falcon.c
+++ b/drivers/ata/pata_falcon.c
@@ -33,8 +33,6 @@
 #define DRV_NAME "pata_falcon"
 #define DRV_VERSION "0.1.0"
 
-#define ATA_HD_CONTROL	0x39
-
 static struct scsi_host_template pata_falcon_sht = {
 	ATA_PIO_SHT(DRV_NAME),
 };
@@ -121,23 +119,42 @@ static struct ata_port_operations pata_falcon_ops = {
 
 static int __init pata_falcon_init_one(struct platform_device *pdev)
 {
-	struct resource *res;
+	struct resource *base_mem_res, *ctl_mem_res;
+	struct resource *base_res, *ctl_res, *irq_res;
 	struct ata_host *host;
 	struct ata_port *ap;
 	void __iomem *base;
+	int irq = 0;
 
-	dev_info(&pdev->dev, "Atari Falcon PATA controller\n");
+	dev_info(&pdev->dev, "Atari Falcon and Q40/Q60 PATA controller\n");
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	if (!res)
-		return -ENODEV;
+	base_res = platform_get_resource(pdev, IORESOURCE_IO, 0);
+	if (base_res && !devm_request_region(&pdev->dev, base_res->start,
+					   resource_size(base_res), DRV_NAME)) {
+		dev_err(&pdev->dev, "resources busy\n");
+		return -EBUSY;
+	}
 
-	if (!devm_request_mem_region(&pdev->dev, res->start,
-				     resource_size(res), DRV_NAME)) {
+	ctl_res = platform_get_resource(pdev, IORESOURCE_IO, 1);
+	if (ctl_res && !devm_request_region(&pdev->dev, ctl_res->start,
+					    resource_size(ctl_res), DRV_NAME)) {
 		dev_err(&pdev->dev, "resources busy\n");
 		return -EBUSY;
 	}
 
+	base_mem_res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+	if (!base_mem_res)
+		return -ENODEV;
+	if (!devm_request_mem_region(&pdev->dev, base_mem_res->start,
+				     resource_size(base_mem_res), DRV_NAME)) {
+		dev_err(&pdev->dev, "resources busy\n");
+		return -EBUSY;
+	}
+
+	ctl_mem_res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
+	if (!ctl_mem_res)
+		return -ENODEV;
+
 	/* allocate host */
 	host = ata_host_alloc(&pdev->dev, 1);
 	if (!host)
@@ -147,10 +164,10 @@ static int __init pata_falcon_init_one(struct platform_device *pdev)
 	ap->ops = &pata_falcon_ops;
 	ap->pio_mask = ATA_PIO4;
 	ap->flags |= ATA_FLAG_SLAVE_POSS | ATA_FLAG_NO_IORDY;
-	ap->flags |= ATA_FLAG_PIO_POLLING;
 
-	base = (void __iomem *)res->start;
-	ap->ioaddr.data_addr		= base;
+	base = (void __iomem *)base_mem_res->start;
+	/* N.B. this assumes data_addr will be used for word-sized I/O only */
+	ap->ioaddr.data_addr		= base + 0 + 0 * 4;
 	ap->ioaddr.error_addr		= base + 1 + 1 * 4;
 	ap->ioaddr.feature_addr		= base + 1 + 1 * 4;
 	ap->ioaddr.nsect_addr		= base + 1 + 2 * 4;
@@ -161,14 +178,25 @@ static int __init pata_falcon_init_one(struct platform_device *pdev)
 	ap->ioaddr.status_addr		= base + 1 + 7 * 4;
 	ap->ioaddr.command_addr		= base + 1 + 7 * 4;
 
-	ap->ioaddr.altstatus_addr	= base + ATA_HD_CONTROL;
-	ap->ioaddr.ctl_addr		= base + ATA_HD_CONTROL;
+	base = (void __iomem *)ctl_mem_res->start;
+	ap->ioaddr.altstatus_addr	= base + 1;
+	ap->ioaddr.ctl_addr		= base + 1;
 
-	ata_port_desc(ap, "cmd 0x%lx ctl 0x%lx", (unsigned long)base,
-		      (unsigned long)base + ATA_HD_CONTROL);
+	ata_port_desc(ap, "cmd 0x%lx ctl 0x%lx",
+		      (unsigned long)base_mem_res->start,
+		      (unsigned long)ctl_mem_res->start);
+
+	irq_res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
+	if (irq_res && irq_res->start > 0) {
+		irq = irq_res->start;
+	} else {
+		ap->flags |= ATA_FLAG_PIO_POLLING;
+		ata_port_desc(ap, "no IRQ, using PIO polling");
+	}
 
 	/* activate */
-	return ata_host_activate(host, 0, NULL, 0, &pata_falcon_sht);
+	return ata_host_activate(host, irq, irq ? ata_sff_interrupt : NULL,
+				 IRQF_SHARED, &pata_falcon_sht);
 }
 
 static int __exit pata_falcon_remove_one(struct platform_device *pdev)
diff --git a/drivers/ide/Kconfig b/drivers/ide/Kconfig
index 8ce4a5878d0c..8af1ac69e5f8 100644
--- a/drivers/ide/Kconfig
+++ b/drivers/ide/Kconfig
@@ -731,21 +731,13 @@ config BLK_DEV_BUDDHA
 	  to one of its IDE interfaces.
 
 config BLK_DEV_FALCON_IDE
-	tristate "Falcon IDE interface support"
-	depends on ATARI
+	tristate "Falcon and Q40/Q60 IDE interface support"
+	depends on ATARI || Q40
 	help
 	  This is the IDE driver for the on-board IDE interface on the Atari
-	  Falcon. Say Y if you have a Falcon and want to use IDE devices (hard
-	  disks, CD-ROM drives, etc.) that are connected to the on-board IDE
-	  interface.
-
-config BLK_DEV_Q40IDE
-	tristate "Q40/Q60 IDE interface support"
-	depends on Q40
-	help
-	  Enable the on-board IDE controller in the Q40/Q60.  This should
-	  normally be on; disable it only if you are running a custom hard
-	  drive subsystem through an expansion card.
+	  Falcon and Q40/Q60. Say Y if you have such a machine and want to use
+	  IDE devices (hard disks, CD-ROM drives, etc.) that are connected to
+	  the on-board IDE interface.
 
 config BLK_DEV_PALMCHIP_BK3710
 	tristate "Palmchip bk3710 IDE controller support"
diff --git a/drivers/ide/Makefile b/drivers/ide/Makefile
index 45a1c0463bed..991eb72a786b 100644
--- a/drivers/ide/Makefile
+++ b/drivers/ide/Makefile
@@ -29,7 +29,6 @@ obj-$(CONFIG_BLK_DEV_4DRIVES)		+= ide-4drives.o
 
 obj-$(CONFIG_BLK_DEV_GAYLE)		+= gayle.o
 obj-$(CONFIG_BLK_DEV_FALCON_IDE)	+= falconide.o
-obj-$(CONFIG_BLK_DEV_Q40IDE)		+= q40ide.o
 obj-$(CONFIG_BLK_DEV_BUDDHA)		+= buddha.o
 
 obj-$(CONFIG_BLK_DEV_AEC62XX)		+= aec62xx.o
diff --git a/drivers/ide/falconide.c b/drivers/ide/falconide.c
index bb86d84558d9..fce68412b3c9 100644
--- a/drivers/ide/falconide.c
+++ b/drivers/ide/falconide.c
@@ -25,12 +25,6 @@
 
 #define DRV_NAME "falconide"
 
-    /*
-     *  Offsets from base address
-     */
-
-#define ATA_HD_CONTROL	0x39
-
     /*
      *  falconide_intr_lock is used to obtain access to the IDE interrupt,
      *  which is shared between several drivers.
@@ -107,7 +101,8 @@ static const struct ide_port_info falconide_port_info = {
 	.chipset		= ide_generic,
 };
 
-static void __init falconide_setup_ports(struct ide_hw *hw, unsigned long base)
+static void __init falconide_setup_ports(struct ide_hw *hw, unsigned long base,
+					 unsigned long ctl, int irq)
 {
 	int i;
 
@@ -118,9 +113,9 @@ static void __init falconide_setup_ports(struct ide_hw *hw, unsigned long base)
 	for (i = 1; i < 8; i++)
 		hw->io_ports_array[i] = base + 1 + i * 4;
 
-	hw->io_ports.ctl_addr = base + ATA_HD_CONTROL;
+	hw->io_ports.ctl_addr = ctl + 1;
 
-	hw->irq = IRQ_MFP_IDE;
+	hw->irq = irq;
 }
 
     /*
@@ -129,37 +124,69 @@ static void __init falconide_setup_ports(struct ide_hw *hw, unsigned long base)
 
 static int __init falconide_init(struct platform_device *pdev)
 {
-	struct resource *res;
+	struct resource *base_mem_res, *ctl_mem_res;
+	struct resource *base_res, *ctl_res, *irq_res;
 	struct ide_host *host;
 	struct ide_hw hw, *hws[] = { &hw };
-	unsigned long base;
 	int rc;
+	int irq;
+
+	dev_info(&pdev->dev, "Atari Falcon and Q40/Q60 IDE controller\n");
+
+	base_res = platform_get_resource(pdev, IORESOURCE_IO, 0);
+	if (base_res && !devm_request_region(&pdev->dev, base_res->start,
+					   resource_size(base_res), DRV_NAME)) {
+		dev_err(&pdev->dev, "resources busy\n");
+		return -EBUSY;
+	}
 
-	dev_info(&pdev->dev, "Atari Falcon IDE controller\n");
+	ctl_res = platform_get_resource(pdev, IORESOURCE_IO, 0);
+	if (ctl_res && !devm_request_region(&pdev->dev, ctl_res->start,
+					   resource_size(ctl_res), DRV_NAME)) {
+		dev_err(&pdev->dev, "resources busy\n");
+		return -EBUSY;
+	}
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	if (!res)
+	base_mem_res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+	if (!base_mem_res)
 		return -ENODEV;
 
-	if (!devm_request_mem_region(&pdev->dev, res->start,
-				     resource_size(res), DRV_NAME)) {
+	if (!devm_request_mem_region(&pdev->dev, base_mem_res->start,
+				     resource_size(base_mem_res), DRV_NAME)) {
 		dev_err(&pdev->dev, "resources busy\n");
 		return -EBUSY;
 	}
 
-	base = (unsigned long)res->start;
+	ctl_mem_res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
+	if (!ctl_mem_res)
+		return -ENODEV;
+
+	if (MACH_IS_ATARI) {
+		irq = IRQ_MFP_IDE;
+	} else {
+		irq_res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
+		if (irq_res && irq_res->start > 0)
+			irq = irq_res->start;
+		else
+			return -ENODEV;
+	}
 
-	falconide_setup_ports(&hw, base);
+	falconide_setup_ports(&hw, base_mem_res->start, ctl_mem_res->start, irq);
 
 	host = ide_host_alloc(&falconide_port_info, hws, 1);
-	if (host == NULL) {
-		rc = -ENOMEM;
-		goto err;
+	if (!host)
+		return -ENOMEM;
+
+	if (!MACH_IS_ATARI) {
+		host->get_lock = NULL;
+		host->release_lock = NULL;
 	}
 
-	falconide_get_lock(NULL, NULL);
+	if (host->get_lock)
+		host->get_lock(NULL, NULL);
 	rc = ide_host_register(host, &falconide_port_info, hws);
-	falconide_release_lock();
+	if (host->release_lock)
+		host->release_lock();
 
 	if (rc)
 		goto err_free;
@@ -168,8 +195,6 @@ static int __init falconide_init(struct platform_device *pdev)
 	return 0;
 err_free:
 	ide_host_free(host);
-err:
-	release_mem_region(res->start, resource_size(res));
 	return rc;
 }
 
diff --git a/drivers/ide/q40ide.c b/drivers/ide/q40ide.c
deleted file mode 100644
index ecd0a69245f6..000000000000
--- a/drivers/ide/q40ide.c
+++ /dev/null
@@ -1,168 +0,0 @@
-/*
- *  Q40 I/O port IDE Driver
- *
- *     (c) Richard Zidlicky
- *
- *  This file is subject to the terms and conditions of the GNU General Public
- *  License.  See the file COPYING in the main directory of this archive for
- *  more details.
- *
- *
- */
-
-#include <linux/types.h>
-#include <linux/mm.h>
-#include <linux/interrupt.h>
-#include <linux/blkdev.h>
-#include <linux/ide.h>
-#include <linux/module.h>
-
-#include <asm/ide.h>
-
-    /*
-     *  Bases of the IDE interfaces
-     */
-
-#define Q40IDE_NUM_HWIFS	2
-
-#define PCIDE_BASE1	0x1f0
-#define PCIDE_BASE2	0x170
-#define PCIDE_BASE3	0x1e8
-#define PCIDE_BASE4	0x168
-#define PCIDE_BASE5	0x1e0
-#define PCIDE_BASE6	0x160
-
-static const unsigned long pcide_bases[Q40IDE_NUM_HWIFS] = {
-    PCIDE_BASE1, PCIDE_BASE2, /* PCIDE_BASE3, PCIDE_BASE4  , PCIDE_BASE5,
-    PCIDE_BASE6 */
-};
-
-static int q40ide_default_irq(unsigned long base)
-{
-           switch (base) {
-	            case 0x1f0: return 14;
-		    case 0x170: return 15;
-		    case 0x1e8: return 11;
-		    default:
-			return 0;
-	   }
-}
-
-
-/*
- * Addresses are pretranslated for Q40 ISA access.
- */
-static void q40_ide_setup_ports(struct ide_hw *hw, unsigned long base, int irq)
-{
-	memset(hw, 0, sizeof(*hw));
-	/* BIG FAT WARNING: 
-	   assumption: only DATA port is ever used in 16 bit mode */
-	hw->io_ports.data_addr = Q40_ISA_IO_W(base);
-	hw->io_ports.error_addr = Q40_ISA_IO_B(base + 1);
-	hw->io_ports.nsect_addr = Q40_ISA_IO_B(base + 2);
-	hw->io_ports.lbal_addr = Q40_ISA_IO_B(base + 3);
-	hw->io_ports.lbam_addr = Q40_ISA_IO_B(base + 4);
-	hw->io_ports.lbah_addr = Q40_ISA_IO_B(base + 5);
-	hw->io_ports.device_addr = Q40_ISA_IO_B(base + 6);
-	hw->io_ports.status_addr = Q40_ISA_IO_B(base + 7);
-	hw->io_ports.ctl_addr = Q40_ISA_IO_B(base + 0x206);
-
-	hw->irq = irq;
-}
-
-static void q40ide_input_data(ide_drive_t *drive, struct ide_cmd *cmd,
-			      void *buf, unsigned int len)
-{
-	unsigned long data_addr = drive->hwif->io_ports.data_addr;
-
-	if (drive->media == ide_disk && cmd && (cmd->tf_flags & IDE_TFLAG_FS)) {
-		__ide_mm_insw(data_addr, buf, (len + 1) / 2);
-		return;
-	}
-
-	raw_insw_swapw((u16 *)data_addr, buf, (len + 1) / 2);
-}
-
-static void q40ide_output_data(ide_drive_t *drive, struct ide_cmd *cmd,
-			       void *buf, unsigned int len)
-{
-	unsigned long data_addr = drive->hwif->io_ports.data_addr;
-
-	if (drive->media == ide_disk && cmd && (cmd->tf_flags & IDE_TFLAG_FS)) {
-		__ide_mm_outsw(data_addr, buf, (len + 1) / 2);
-		return;
-	}
-
-	raw_outsw_swapw((u16 *)data_addr, buf, (len + 1) / 2);
-}
-
-/* Q40 has a byte-swapped IDE interface */
-static const struct ide_tp_ops q40ide_tp_ops = {
-	.exec_command		= ide_exec_command,
-	.read_status		= ide_read_status,
-	.read_altstatus		= ide_read_altstatus,
-	.write_devctl		= ide_write_devctl,
-
-	.dev_select		= ide_dev_select,
-	.tf_load		= ide_tf_load,
-	.tf_read		= ide_tf_read,
-
-	.input_data		= q40ide_input_data,
-	.output_data		= q40ide_output_data,
-};
-
-static const struct ide_port_info q40ide_port_info = {
-	.tp_ops			= &q40ide_tp_ops,
-	.host_flags		= IDE_HFLAG_MMIO | IDE_HFLAG_NO_DMA,
-	.irq_flags		= IRQF_SHARED,
-	.chipset		= ide_generic,
-};
-
-/* 
- * the static array is needed to have the name reported in /proc/ioports,
- * hwif->name unfortunately isn't available yet
- */
-static const char *q40_ide_names[Q40IDE_NUM_HWIFS]={
-	"ide0", "ide1"
-};
-
-/*
- *  Probe for Q40 IDE interfaces
- */
-
-static int __init q40ide_init(void)
-{
-    int i;
-    struct ide_hw hw[Q40IDE_NUM_HWIFS], *hws[] = { NULL, NULL };
-
-    if (!MACH_IS_Q40)
-      return -ENODEV;
-
-    printk(KERN_INFO "ide: Q40 IDE controller\n");
-
-    for (i = 0; i < Q40IDE_NUM_HWIFS; i++) {
-	const char *name = q40_ide_names[i];
-
-	if (!request_region(pcide_bases[i], 8, name)) {
-		printk("could not reserve ports %lx-%lx for %s\n",
-		       pcide_bases[i],pcide_bases[i]+8,name);
-		continue;
-	}
-	if (!request_region(pcide_bases[i]+0x206, 1, name)) {
-		printk("could not reserve port %lx for %s\n",
-		       pcide_bases[i]+0x206,name);
-		release_region(pcide_bases[i], 8);
-		continue;
-	}
-	q40_ide_setup_ports(&hw[i], pcide_bases[i],
-			q40ide_default_irq(pcide_bases[i]));
-
-	hws[i] = &hw[i];
-    }
-
-    return ide_host_add(&q40ide_port_info, hws, Q40IDE_NUM_HWIFS, NULL);
-}
-
-module_init(q40ide_init);
-
-MODULE_LICENSE("GPL");
-- 
2.26.3


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

* Re: [PATCH v2 0/2] Use libata platform drivers to replace deprecated m68k IDE drivers
  2021-06-08  5:46 [PATCH v2 0/2] Use libata platform drivers to replace deprecated m68k IDE drivers Finn Thain
  2021-06-08  5:46 ` [PATCH v2 2/2] m68k/q40: Replace q40ide driver with pata_falcon and falconide Finn Thain
  2021-06-08  5:46 ` [PATCH v2 1/2] m68k/mac: Replace macide driver with generic platform drivers Finn Thain
@ 2021-06-08 14:37 ` Christoph Hellwig
  2021-06-08 21:04   ` Jens Axboe
  2 siblings, 1 reply; 12+ messages in thread
From: Christoph Hellwig @ 2021-06-08 14:37 UTC (permalink / raw)
  To: Finn Thain
  Cc: Geert Uytterhoeven, Jens Axboe, David S. Miller, Joshua Thompson,
	linux-ide, linux-kernel, linux-m68k, Richard Zidlicky,
	Michael Schmitz

On Tue, Jun 08, 2021 at 03:46:34PM +1000, Finn Thain wrote:
> This patch series allows m68k platforms to switch from deprecated IDE
> drivers to libata drivers.

Thanks, this looks good to me:

Reviewed-by: Christoph Hellwig <hch@lst.de>

Jens, any chance you could pick this up quickly to prepare for the
legacy IDE removal series?

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

* Re: [PATCH v2 0/2] Use libata platform drivers to replace deprecated m68k IDE drivers
  2021-06-08 14:37 ` [PATCH v2 0/2] Use libata platform drivers to replace deprecated m68k IDE drivers Christoph Hellwig
@ 2021-06-08 21:04   ` Jens Axboe
  2021-06-08 21:50     ` Michael Schmitz
  0 siblings, 1 reply; 12+ messages in thread
From: Jens Axboe @ 2021-06-08 21:04 UTC (permalink / raw)
  To: Christoph Hellwig, Finn Thain
  Cc: Geert Uytterhoeven, David S. Miller, Joshua Thompson, linux-ide,
	linux-kernel, linux-m68k, Richard Zidlicky, Michael Schmitz

On 6/8/21 8:37 AM, Christoph Hellwig wrote:
> On Tue, Jun 08, 2021 at 03:46:34PM +1000, Finn Thain wrote:
>> This patch series allows m68k platforms to switch from deprecated IDE
>> drivers to libata drivers.
> 
> Thanks, this looks good to me:
> 
> Reviewed-by: Christoph Hellwig <hch@lst.de>
> 
> Jens, any chance you could pick this up quickly to prepare for the
> legacy IDE removal series?

I can, but had assumed it'd go through the IDE tree. But not that
important I guess. I've queued it up for now.

-- 
Jens Axboe


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

* Re: [PATCH v2 0/2] Use libata platform drivers to replace deprecated m68k IDE drivers
  2021-06-08 21:04   ` Jens Axboe
@ 2021-06-08 21:50     ` Michael Schmitz
  2021-06-09  3:53       ` Finn Thain
  2021-06-09 15:23       ` Jens Axboe
  0 siblings, 2 replies; 12+ messages in thread
From: Michael Schmitz @ 2021-06-08 21:50 UTC (permalink / raw)
  To: Jens Axboe, Christoph Hellwig, Finn Thain
  Cc: Geert Uytterhoeven, David S. Miller, Joshua Thompson, linux-ide,
	linux-kernel, linux-m68k, Richard Zidlicky

Hi Jens,

please note that Finn's patch depends on one of mine currently under 
review. Without that one, Q40 support may break in certain cases.

Cheers,

     Michael Schmitz

On 9/06/21 9:04 am, Jens Axboe wrote:
> On 6/8/21 8:37 AM, Christoph Hellwig wrote:
>> On Tue, Jun 08, 2021 at 03:46:34PM +1000, Finn Thain wrote:
>>> This patch series allows m68k platforms to switch from deprecated IDE
>>> drivers to libata drivers.
>> Thanks, this looks good to me:
>>
>> Reviewed-by: Christoph Hellwig <hch@lst.de>
>>
>> Jens, any chance you could pick this up quickly to prepare for the
>> legacy IDE removal series?
> I can, but had assumed it'd go through the IDE tree. But not that
> important I guess. I've queued it up for now.
>

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

* Re: [PATCH v2 0/2] Use libata platform drivers to replace deprecated m68k IDE drivers
  2021-06-08 21:50     ` Michael Schmitz
@ 2021-06-09  3:53       ` Finn Thain
  2021-06-09  4:05         ` Michael Schmitz
  2021-06-09 15:23       ` Jens Axboe
  1 sibling, 1 reply; 12+ messages in thread
From: Finn Thain @ 2021-06-09  3:53 UTC (permalink / raw)
  To: Michael Schmitz
  Cc: Jens Axboe, Christoph Hellwig, Geert Uytterhoeven,
	David S. Miller, Joshua Thompson, linux-ide, linux-kernel,
	linux-m68k, Richard Zidlicky

On Wed, 9 Jun 2021, Michael Schmitz wrote:

> please note that Finn's patch depends on one of mine currently under review.
> Without that one, Q40 support may break in certain cases.
> 

AFAIK, that's only true for a configuration that enables both CONFIG_Q40 
and CONFIG_ATARI. In my tests with stock v5.12, such a configuration 
presently doesn't work correctly on Atari.

This patch series doesn't make this issue any worse.

Besides, I think it is a non-issue because the problem is so rare that 
no-one noticed it before I did, and the workaround for CONFIG_Q40 users is 
trivial anyway (disable CONFIG_ATARI).

Is there really some benefit in holding up this patch series?

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

* Re: [PATCH v2 0/2] Use libata platform drivers to replace deprecated m68k IDE drivers
  2021-06-09  3:53       ` Finn Thain
@ 2021-06-09  4:05         ` Michael Schmitz
  0 siblings, 0 replies; 12+ messages in thread
From: Michael Schmitz @ 2021-06-09  4:05 UTC (permalink / raw)
  To: Finn Thain
  Cc: Jens Axboe, Christoph Hellwig, Geert Uytterhoeven,
	David S. Miller, Joshua Thompson, linux-ide, linux-kernel,
	linux-m68k, Richard Zidlicky

Hi Finn,

Am 09.06.2021 um 15:53 schrieb Finn Thain:
> On Wed, 9 Jun 2021, Michael Schmitz wrote:
>
>> please note that Finn's patch depends on one of mine currently under review.
>> Without that one, Q40 support may break in certain cases.
>>
>
> AFAIK, that's only true for a configuration that enables both CONFIG_Q40
> and CONFIG_ATARI. In my tests with stock v5.12, such a configuration
> presently doesn't work correctly on Atari.
>
> This patch series doesn't make this issue any worse.

You're right, it's not a regression (that combination was broken before) 
, and there's no patch dependency or conflict either.

> Besides, I think it is a non-issue because the problem is so rare that
> no-one noticed it before I did, and the workaround for CONFIG_Q40 users is
> trivial anyway (disable CONFIG_ATARI).
>
> Is there really some benefit in holding up this patch series?

On second thought - no point in holding this up.

Cheers,

	Michael



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

* Re: [PATCH v2 1/2] m68k/mac: Replace macide driver with generic platform drivers
  2021-06-08  5:46 ` [PATCH v2 1/2] m68k/mac: Replace macide driver with generic platform drivers Finn Thain
@ 2021-06-09  6:26   ` Geert Uytterhoeven
  0 siblings, 0 replies; 12+ messages in thread
From: Geert Uytterhoeven @ 2021-06-09  6:26 UTC (permalink / raw)
  To: Finn Thain
  Cc: Jens Axboe, David S. Miller, Michael Schmitz, Joshua Thompson,
	linux-m68k, Linux Kernel Mailing List, linux-ide

On Tue, Jun 8, 2021 at 8:04 AM Finn Thain <fthain@linux-m68k.org> wrote:
> This allows m68k mac systems to switch from the deprecated IDE subsystem
> to libata.
>
> This was tested on my Quadra 630. I haven't tested it on my PowerBook 150
> because I don't have a RAM adapter board for it. It appears that the
> hardware I tested doesn't need macide_clear_irq() or macide_test_irq().
> If it did, the generic driver would not have worked. It's possible that
> those routines are needed for the PowerBook 150 but we can cross that
> bridge if and when we come to it.
>
> BTW, macide_clear_irq() appears to suffer from a race condition. The write
> to the interrupt flags register could have unintended side effects as it
> may alter other flag bits. Fortunately, all of the other bits are unused
> by Linux. When tested on my Quadra 630, the assignment *ide_ifr &= ~0x20
> was observed to have no effect on bit 5, so it may be redundant anyway.
>
> Cc: Michael Schmitz <schmitzmic@gmail.com>
> Cc: Joshua Thompson <funaho@jurai.org>
> Reviewed-by: Michael Schmitz <schmitzmic@gmail.com>
> Signed-off-by: Finn Thain <fthain@linux-m68k.org>

Thanks for your patch!

>  arch/m68k/configs/mac_defconfig   |   1 -
>  arch/m68k/configs/multi_defconfig |   1 -
>  arch/m68k/mac/config.c            |  24 +++--
>  drivers/ide/Kconfig               |  14 ---
>  drivers/ide/Makefile              |   1 -
>  drivers/ide/macide.c              | 161 ------------------------------
>  6 files changed, 14 insertions(+), 188 deletions(-)
>  delete mode 100644 drivers/ide/macide.c

Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

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

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

* Re: [PATCH v2 2/2] m68k/q40: Replace q40ide driver with pata_falcon and falconide
  2021-06-08  5:46 ` [PATCH v2 2/2] m68k/q40: Replace q40ide driver with pata_falcon and falconide Finn Thain
@ 2021-06-09  6:30   ` Geert Uytterhoeven
  0 siblings, 0 replies; 12+ messages in thread
From: Geert Uytterhoeven @ 2021-06-09  6:30 UTC (permalink / raw)
  To: Finn Thain
  Cc: Jens Axboe, David S. Miller, Michael Schmitz, Richard Zidlicky,
	linux-m68k, Linux Kernel Mailing List, linux-ide

On Tue, Jun 8, 2021 at 8:04 AM Finn Thain <fthain@linux-m68k.org> wrote:
> This allows m68k q40 systems to switch from the deprecated IDE subsystem
> to libata.
>
> Enhance the byte-swapping falconide and pata_falcon platform drivers to
> accept an irq resource, for use on q40. Atari ST-DMA IRQ arrangements seem
> to co-exist with q40 IRQ arrangements without too much mess.
>
> The new IO resources were added solely for the purpose of making
> request_region() reservations identical to those made by q40ide: these
> regions aren't used for actual IO.
>
> Cc: Michael Schmitz <schmitzmic@gmail.com>
> Cc: Richard Zidlicky <rz@linux-m68k.org>
> Reviewed-and-tested-by: Michael Schmitz <schmitzmic@gmail.com>
> Signed-off-by: Finn Thain <fthain@linux-m68k.org>

Thanks for your patch!

>  arch/m68k/atari/config.c          |  12 +--
>  arch/m68k/configs/multi_defconfig |   1 -
>  arch/m68k/configs/q40_defconfig   |   2 +-
>  arch/m68k/q40/config.c            |  37 +++++--
>  drivers/ata/Kconfig               |   6 +-
>  drivers/ata/pata_falcon.c         |  62 ++++++++---
>  drivers/ide/Kconfig               |  18 +---
>  drivers/ide/Makefile              |   1 -
>  drivers/ide/falconide.c           |  75 ++++++++-----
>  drivers/ide/q40ide.c              | 168 ------------------------------
>  10 files changed, 137 insertions(+), 245 deletions(-)
>  delete mode 100644 drivers/ide/q40ide.c

Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

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

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

* Re: [PATCH v2 0/2] Use libata platform drivers to replace deprecated m68k IDE drivers
  2021-06-08 21:50     ` Michael Schmitz
  2021-06-09  3:53       ` Finn Thain
@ 2021-06-09 15:23       ` Jens Axboe
  2021-06-09 19:26         ` Michael Schmitz
  1 sibling, 1 reply; 12+ messages in thread
From: Jens Axboe @ 2021-06-09 15:23 UTC (permalink / raw)
  To: Michael Schmitz, Christoph Hellwig, Finn Thain
  Cc: Geert Uytterhoeven, David S. Miller, Joshua Thompson, linux-ide,
	linux-kernel, linux-m68k, Richard Zidlicky

On 6/8/21 3:50 PM, Michael Schmitz wrote:
> Hi Jens,
> 
> please note that Finn's patch depends on one of mine currently under 
> review. Without that one, Q40 support may break in certain cases.

Can you point me at it?

-- 
Jens Axboe


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

* Re: [PATCH v2 0/2] Use libata platform drivers to replace deprecated m68k IDE drivers
  2021-06-09 15:23       ` Jens Axboe
@ 2021-06-09 19:26         ` Michael Schmitz
  0 siblings, 0 replies; 12+ messages in thread
From: Michael Schmitz @ 2021-06-09 19:26 UTC (permalink / raw)
  To: Jens Axboe, Christoph Hellwig, Finn Thain
  Cc: Geert Uytterhoeven, David S. Miller, Joshua Thompson, linux-ide,
	linux-kernel, linux-m68k, Richard Zidlicky

Hi Jens,

it's this one:

https://lore.kernel.org/linux-m68k/1623223322-4242-1-git-send-email-schmitzmic@gmail.com/

But see my reply to Finn's mail - my patch is entirely orthogonal to 
his, and simply fixes a long standing issue that has recently surfaced 
with Finn's efforts to unify Atari and Q40 IDE drivers.

Cheers,

     Michael

On 10/06/21 3:23 am, Jens Axboe wrote:
> On 6/8/21 3:50 PM, Michael Schmitz wrote:
>> Hi Jens,
>>
>> please note that Finn's patch depends on one of mine currently under
>> review. Without that one, Q40 support may break in certain cases.
> Can you point me at it?
>

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

end of thread, other threads:[~2021-06-09 19:27 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-08  5:46 [PATCH v2 0/2] Use libata platform drivers to replace deprecated m68k IDE drivers Finn Thain
2021-06-08  5:46 ` [PATCH v2 2/2] m68k/q40: Replace q40ide driver with pata_falcon and falconide Finn Thain
2021-06-09  6:30   ` Geert Uytterhoeven
2021-06-08  5:46 ` [PATCH v2 1/2] m68k/mac: Replace macide driver with generic platform drivers Finn Thain
2021-06-09  6:26   ` Geert Uytterhoeven
2021-06-08 14:37 ` [PATCH v2 0/2] Use libata platform drivers to replace deprecated m68k IDE drivers Christoph Hellwig
2021-06-08 21:04   ` Jens Axboe
2021-06-08 21:50     ` Michael Schmitz
2021-06-09  3:53       ` Finn Thain
2021-06-09  4:05         ` Michael Schmitz
2021-06-09 15:23       ` Jens Axboe
2021-06-09 19:26         ` Michael Schmitz

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