linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/11] ide/ppc: remove PPC specific IDE hacks
@ 2008-02-14  0:36 Bartlomiej Zolnierkiewicz
  2008-02-14  0:36 ` [PATCH 01/11] ide-pmac: remove dead code Bartlomiej Zolnierkiewicz
                   ` (10 more replies)
  0 siblings, 11 replies; 13+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2008-02-14  0:36 UTC (permalink / raw)
  To: linux-ide
  Cc: linuxppc-dev, Bartlomiej Zolnierkiewicz, Benjamin Herrenschmidt,
	linux-kernel


Previous patchset adding warm-plug support allows the removal of PPC specific
IDE hacks (500 LOC gone)...

[ Ben, please take a look when you have some time, thanks! ]

diffstat:

 arch/powerpc/kernel/setup_32.c          |    8 --
 arch/powerpc/platforms/powermac/pci.c   |   22 -------
 arch/powerpc/platforms/powermac/pmac.h  |    5 -
 arch/powerpc/platforms/powermac/setup.c |    8 --
 arch/ppc/configs/sandpoint_defconfig    |    2 
 arch/ppc/kernel/ppc_ksyms.c             |    5 -
 arch/ppc/kernel/setup.c                 |    2 
 arch/ppc/platforms/4xx/bamboo.c         |    1 
 arch/ppc/platforms/4xx/ebony.c          |    1 
 arch/ppc/platforms/4xx/luan.c           |    1 
 arch/ppc/platforms/4xx/ocotea.c         |    1 
 arch/ppc/platforms/4xx/taishan.c        |    1 
 arch/ppc/platforms/4xx/yucca.c          |    1 
 arch/ppc/platforms/chestnut.c           |    1 
 arch/ppc/platforms/cpci690.c            |    1 
 arch/ppc/platforms/ev64260.c            |    1 
 arch/ppc/platforms/hdpu.c               |   36 -----------
 arch/ppc/platforms/lopec.c              |   85 ----------------------------
 arch/ppc/platforms/mvme5100.c           |    1 
 arch/ppc/platforms/powerpmc250.c        |    1 
 arch/ppc/platforms/pplus.c              |   58 -------------------
 arch/ppc/platforms/prep_setup.c         |   38 ------------
 arch/ppc/platforms/prpmc750.c           |    1 
 arch/ppc/platforms/prpmc800.c           |    1 
 arch/ppc/platforms/radstone_ppc7d.c     |    1 
 arch/ppc/platforms/residual.c           |    1 
 arch/ppc/platforms/sandpoint.c          |   94 -------------------------------
 arch/ppc/platforms/sandpoint.h          |    3 
 arch/ppc/platforms/spruce.c             |    1 
 arch/ppc/syslib/m8xx_setup.c            |    6 -
 arch/ppc/syslib/ppc4xx_setup.c          |   23 -------
 drivers/ide/ide.c                       |    6 -
 drivers/ide/pci/sl82c105.c              |    6 +
 drivers/ide/ppc/mpc8xx.c                |   86 +++++++---------------------
 drivers/ide/ppc/pmac.c                  |   97 +++-----------------------------
 include/asm-powerpc/ide.h               |   47 ++++++++++-----
 36 files changed, 72 insertions(+), 581 deletions(-)

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

* [PATCH 01/11] ide-pmac: remove dead code
  2008-02-14  0:36 [PATCH 00/11] ide/ppc: remove PPC specific IDE hacks Bartlomiej Zolnierkiewicz
@ 2008-02-14  0:36 ` Bartlomiej Zolnierkiewicz
  2008-02-14  0:36 ` [PATCH 02/11] ppc/hdpu: remove dead IDE code Bartlomiej Zolnierkiewicz
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 13+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2008-02-14  0:36 UTC (permalink / raw)
  To: linux-ide
  Cc: linuxppc-dev, Bartlomiej Zolnierkiewicz, Benjamin Herrenschmidt,
	linux-kernel

Remove unused pmac_ide_{check_base,get_irq}() and pmac_find_ide_boot(),
then remove no longer needed ide_majors[] and pmac_ide_count.

Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
 drivers/ide/ppc/pmac.c |   47 -----------------------------------------------
 1 file changed, 47 deletions(-)

Index: b/drivers/ide/ppc/pmac.c
===================================================================
--- a/drivers/ide/ppc/pmac.c
+++ b/drivers/ide/ppc/pmac.c
@@ -80,7 +80,6 @@ typedef struct pmac_ide_hwif {
 } pmac_ide_hwif_t;
 
 static pmac_ide_hwif_t pmac_ide[MAX_HWIFS];
-static int pmac_ide_count;
 
 enum {
 	controller_ohare,	/* OHare based */
@@ -893,52 +892,6 @@ pmac_ide_get_base(int index)
 	return pmac_ide[index].regbase;
 }
 
-int
-pmac_ide_check_base(unsigned long base)
-{
-	int ix;
-	
- 	for (ix = 0; ix < MAX_HWIFS; ++ix)
-		if (base == pmac_ide[ix].regbase)
-			return ix;
-	return -1;
-}
-
-int
-pmac_ide_get_irq(unsigned long base)
-{
-	int ix;
-
-	for (ix = 0; ix < MAX_HWIFS; ++ix)
-		if (base == pmac_ide[ix].regbase)
-			return pmac_ide[ix].irq;
-	return 0;
-}
-
-static int ide_majors[] = { 3, 22, 33, 34, 56, 57 };
-
-dev_t __init
-pmac_find_ide_boot(char *bootdevice, int n)
-{
-	int i;
-	
-	/*
-	 * Look through the list of IDE interfaces for this one.
-	 */
-	for (i = 0; i < pmac_ide_count; ++i) {
-		char *name;
-		if (!pmac_ide[i].node || !pmac_ide[i].node->full_name)
-			continue;
-		name = pmac_ide[i].node->full_name;
-		if (memcmp(name, bootdevice, n) == 0 && name[n] == 0) {
-			/* XXX should cope with the 2nd drive as well... */
-			return MKDEV(ide_majors[i], 0);
-		}
-	}
-
-	return 0;
-}
-
 /* Suspend call back, should be called after the child devices
  * have actually been suspended
  */

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

* [PATCH 02/11] ppc/hdpu: remove dead IDE code
  2008-02-14  0:36 [PATCH 00/11] ide/ppc: remove PPC specific IDE hacks Bartlomiej Zolnierkiewicz
  2008-02-14  0:36 ` [PATCH 01/11] ide-pmac: remove dead code Bartlomiej Zolnierkiewicz
@ 2008-02-14  0:36 ` Bartlomiej Zolnierkiewicz
  2008-02-14  0:36 ` [PATCH 03/11] ppc/ppc4xx: remove ppc_ide_md hooks Bartlomiej Zolnierkiewicz
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 13+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2008-02-14  0:36 UTC (permalink / raw)
  To: linux-ide
  Cc: linuxppc-dev, Bartlomiej Zolnierkiewicz, Benjamin Herrenschmidt,
	linux-kernel

Also remove now not needed <linux/ide.h> include.

Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
 arch/ppc/platforms/hdpu.c |   36 ------------------------------------
 1 file changed, 36 deletions(-)

Index: b/arch/ppc/platforms/hdpu.c
===================================================================
--- a/arch/ppc/platforms/hdpu.c
+++ b/arch/ppc/platforms/hdpu.c
@@ -16,7 +16,6 @@
 #include <linux/pci.h>
 #include <linux/delay.h>
 #include <linux/irq.h>
-#include <linux/ide.h>
 #include <linux/seq_file.h>
 #include <linux/platform_device.h>
 
@@ -604,41 +603,6 @@ static void parse_bootinfo(unsigned long
 	}
 }
 
-#if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE)
-static void
-hdpu_ide_request_region(ide_ioreg_t from, unsigned int extent, const char *name)
-{
-	request_region(from, extent, name);
-	return;
-}
-
-static void hdpu_ide_release_region(ide_ioreg_t from, unsigned int extent)
-{
-	release_region(from, extent);
-	return;
-}
-
-static void __init
-hdpu_ide_pci_init_hwif_ports(hw_regs_t * hw, ide_ioreg_t data_port,
-			     ide_ioreg_t ctrl_port, int *irq)
-{
-	struct pci_dev *dev;
-
-	pci_for_each_dev(dev) {
-		if (((dev->class >> 8) == PCI_CLASS_STORAGE_IDE) ||
-		    ((dev->class >> 8) == PCI_CLASS_STORAGE_RAID)) {
-			hw->irq = dev->irq;
-
-			if (irq != NULL) {
-				*irq = dev->irq;
-			}
-		}
-	}
-
-	return;
-}
-#endif
-
 void hdpu_heartbeat(void)
 {
 	if (mv64x60_read(&bh, MV64x60_GPP_VALUE) & (1 << 5))

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

* [PATCH 03/11] ppc/ppc4xx: remove ppc_ide_md hooks
  2008-02-14  0:36 [PATCH 00/11] ide/ppc: remove PPC specific IDE hacks Bartlomiej Zolnierkiewicz
  2008-02-14  0:36 ` [PATCH 01/11] ide-pmac: remove dead code Bartlomiej Zolnierkiewicz
  2008-02-14  0:36 ` [PATCH 02/11] ppc/hdpu: remove dead IDE code Bartlomiej Zolnierkiewicz
@ 2008-02-14  0:36 ` Bartlomiej Zolnierkiewicz
  2008-02-14  0:36 ` [PATCH 04/11] ppc/pmac: " Bartlomiej Zolnierkiewicz
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 13+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2008-02-14  0:36 UTC (permalink / raw)
  To: linux-ide
  Cc: linuxppc-dev, Bartlomiej Zolnierkiewicz, Benjamin Herrenschmidt,
	linux-kernel

There are no "default" IDE ports on PPC4xx so ppc4xx_ide_init_hwif_ports() is
unnecessary, remove it.  Also remove no longer needed <linux/ide.h> include.

There should be no functional changes caused by this patch.

Cc: Josh Boyer <jwboyer@linux.vnet.ibm.com>
Cc: Matt Porter <mporter@kernel.crashing.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
 arch/ppc/syslib/ppc4xx_setup.c |   23 -----------------------
 1 file changed, 23 deletions(-)

Index: b/arch/ppc/syslib/ppc4xx_setup.c
===================================================================
--- a/arch/ppc/syslib/ppc4xx_setup.c
+++ b/arch/ppc/syslib/ppc4xx_setup.c
@@ -24,7 +24,6 @@
 #include <linux/pci.h>
 #include <linux/rtc.h>
 #include <linux/console.h>
-#include <linux/ide.h>
 #include <linux/serial_reg.h>
 #include <linux/seq_file.h>
 
@@ -189,24 +188,6 @@ ppc4xx_calibrate_decr(void)
 	mtspr(SPRN_PIT, tb_ticks_per_jiffy);
 }
 
-/*
- * IDE stuff.
- * should be generic for every IDE PCI chipset
- */
-#if defined(CONFIG_PCI) && defined(CONFIG_IDE)
-static void
-ppc4xx_ide_init_hwif_ports(hw_regs_t * hw, unsigned long data_port,
-			   unsigned long ctrl_port, int *irq)
-{
-	int i;
-
-	for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; ++i)
-		hw->io_ports[i] = data_port + i - IDE_DATA_OFFSET;
-
-	hw->io_ports[IDE_CONTROL_OFFSET] = ctrl_port;
-}
-#endif /* defined(CONFIG_PCI) && defined(CONFIG_IDE) */
-
 TODC_ALLOC();
 
 /*
@@ -271,10 +252,6 @@ ppc4xx_init(unsigned long r3, unsigned l
 #ifdef CONFIG_SERIAL_TEXT_DEBUG
 	ppc_md.progress = gen550_progress;
 #endif
-
-#if defined(CONFIG_PCI) && defined(CONFIG_IDE)
-	ppc_ide_md.ide_init_hwif = ppc4xx_ide_init_hwif_ports;
-#endif /* defined(CONFIG_PCI) && defined(CONFIG_IDE) */
 }
 
 /* Called from machine_check_exception */

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

* [PATCH 04/11] ppc/pmac: remove ppc_ide_md hooks
  2008-02-14  0:36 [PATCH 00/11] ide/ppc: remove PPC specific IDE hacks Bartlomiej Zolnierkiewicz
                   ` (2 preceding siblings ...)
  2008-02-14  0:36 ` [PATCH 03/11] ppc/ppc4xx: remove ppc_ide_md hooks Bartlomiej Zolnierkiewicz
@ 2008-02-14  0:36 ` Bartlomiej Zolnierkiewicz
  2008-02-14  0:36 ` [PATCH 05/11] ppc/mpc8xx: " Bartlomiej Zolnierkiewicz
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 13+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2008-02-14  0:36 UTC (permalink / raw)
  To: linux-ide
  Cc: linuxppc-dev, Bartlomiej Zolnierkiewicz, Benjamin Herrenschmidt,
	linux-kernel

* Add pmac_ide_init_ports() helper and use it instead of
  pmac_ide_init_hwif_ports().

* Remove ppc_ide_md hooks - no need for them
  (IDE pmac host driver takes care of all this setup).

* Then remove no longer needed <linux/ide.h> include
  from arch/powerpc/platforms/powermac/pmac.h.

Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
 arch/powerpc/platforms/powermac/pmac.h  |    5 ---
 arch/powerpc/platforms/powermac/setup.c |    8 -----
 drivers/ide/ppc/pmac.c                  |   50 +++++++-------------------------
 3 files changed, 11 insertions(+), 52 deletions(-)

Index: b/arch/powerpc/platforms/powermac/pmac.h
===================================================================
--- a/arch/powerpc/platforms/powermac/pmac.h
+++ b/arch/powerpc/platforms/powermac/pmac.h
@@ -2,7 +2,6 @@
 #define __PMAC_H__
 
 #include <linux/pci.h>
-#include <linux/ide.h>
 #include <linux/irq.h>
 
 /*
@@ -35,10 +34,6 @@ extern void pmac_check_ht_link(void);
 
 extern void pmac_setup_smp(void);
 
-extern unsigned long pmac_ide_get_base(int index);
-extern void pmac_ide_init_hwif_ports(hw_regs_t *hw,
-	unsigned long data_port, unsigned long ctrl_port, int *irq);
-
 extern int pmac_nvram_init(void);
 extern void pmac_pic_init(void);
 
Index: b/arch/powerpc/platforms/powermac/setup.c
===================================================================
--- a/arch/powerpc/platforms/powermac/setup.c
+++ b/arch/powerpc/platforms/powermac/setup.c
@@ -574,14 +574,6 @@ static int __init pmac_probe(void)
 	ISA_DMA_THRESHOLD = ~0L;
 	DMA_MODE_READ = 1;
 	DMA_MODE_WRITE = 2;
-
-#if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE)
-#ifdef CONFIG_BLK_DEV_IDE_PMAC
-        ppc_ide_md.ide_init_hwif	= pmac_ide_init_hwif_ports;
-        ppc_ide_md.default_io_base	= pmac_ide_get_base;
-#endif /* CONFIG_BLK_DEV_IDE_PMAC */
-#endif /* defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE) */
-
 #endif /* CONFIG_PPC32 */
 
 #ifdef CONFIG_PMAC_SMU
Index: b/drivers/ide/ppc/pmac.c
===================================================================
--- a/drivers/ide/ppc/pmac.c
+++ b/drivers/ide/ppc/pmac.c
@@ -418,37 +418,6 @@ static void pmac_ide_kauai_selectproc(id
 
 #endif /* CONFIG_BLK_DEV_IDEDMA_PMAC */
 
-/*
- * N.B. this can't be an initfunc, because the media-bay task can
- * call ide_[un]register at any time.
- */
-void
-pmac_ide_init_hwif_ports(hw_regs_t *hw,
-			      unsigned long data_port, unsigned long ctrl_port,
-			      int *irq)
-{
-	int i, ix;
-
-	if (data_port == 0)
-		return;
-
-	for (ix = 0; ix < MAX_HWIFS; ++ix)
-		if (data_port == pmac_ide[ix].regbase)
-			break;
-
-	if (ix >= MAX_HWIFS)
-		return;		/* not an IDE PMAC interface */
-
-	for (i = 0; i < 8; ++i)
-		hw->io_ports[i] = data_port + i * 0x10;
-	hw->io_ports[8] = data_port + 0x160;
-
-	if (irq != NULL)
-		*irq = pmac_ide[ix].irq;
-
-	hw->dev = &pmac_ide[ix].mdev->ofdev.dev;
-}
-
 #define PMAC_IDE_REG(x) \
 	((void __iomem *)((drive)->hwif->io_ports[IDE_DATA_OFFSET] + (x)))
 
@@ -886,12 +855,6 @@ sanitize_timings(pmac_ide_hwif_t *pmif)
 	pmif->timings[2] = pmif->timings[3] = value2;
 }
 
-unsigned long
-pmac_ide_get_base(int index)
-{
-	return pmac_ide[index].regbase;
-}
-
 /* Suspend call back, should be called after the child devices
  * have actually been suspended
  */
@@ -1108,6 +1071,15 @@ pmac_ide_setup_device(pmac_ide_hwif_t *p
 	return 0;
 }
 
+static void __devinit pmac_ide_init_ports(hw_regs_t *hw, unsigned long base)
+{
+	int i;
+
+	for (i = 0; i < 8; ++i)
+		hw->io_ports[i] = base + i * 0x10;
+	hw->io_ports[8] = base + 0x160;
+}
+
 /*
  * Attach to a macio probed interface
  */
@@ -1181,7 +1153,7 @@ pmac_ide_macio_attach(struct macio_dev *
 	dev_set_drvdata(&mdev->ofdev.dev, hwif);
 
 	memset(&hw, 0, sizeof(hw));
-	pmac_ide_init_hwif_ports(&hw, pmif->regbase, 0, NULL);
+	pmac_ide_init_ports(&hw, pmif->regbase);
 	hw.irq = irq;
 	hw.dev = &mdev->ofdev.dev;
 
@@ -1295,7 +1267,7 @@ pmac_ide_pci_attach(struct pci_dev *pdev
 	pci_set_drvdata(pdev, hwif);
 
 	memset(&hw, 0, sizeof(hw));
-	pmac_ide_init_hwif_ports(&hw, pmif->regbase, 0, NULL);
+	pmac_ide_init_ports(&hw, pmif->regbase);
 	hw.irq = pdev->irq;
 	hw.dev = &pdev->dev;
 

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

* [PATCH 05/11] ppc/mpc8xx: remove ppc_ide_md hooks
  2008-02-14  0:36 [PATCH 00/11] ide/ppc: remove PPC specific IDE hacks Bartlomiej Zolnierkiewicz
                   ` (3 preceding siblings ...)
  2008-02-14  0:36 ` [PATCH 04/11] ppc/pmac: " Bartlomiej Zolnierkiewicz
@ 2008-02-14  0:36 ` Bartlomiej Zolnierkiewicz
  2008-02-14 20:46   ` Vitaly Bordug
  2008-02-14  0:37 ` [PATCH 06/11] ppc/lopec: " Bartlomiej Zolnierkiewicz
                   ` (5 subsequent siblings)
  10 siblings, 1 reply; 13+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2008-02-14  0:36 UTC (permalink / raw)
  To: linux-ide
  Cc: linuxppc-dev, Bartlomiej Zolnierkiewicz, Benjamin Herrenschmidt,
	linux-kernel

* Initialize IDE ports in mpc8xx_ide_probe().

* Remove m8xx_ide_init() and ppc_ide_md hooks - no need for them
  (IDE mpc8xx host driver takes care of all this setup).

* Remove needless 'if (irq)' and 'if (data_port >= MAX_HWIFS)' checks
  from m8xx_ide_init_hwif_ports().

* Remove 'ctrl_port' and 'irq' arguments from m8xx_ide_init_hwif_ports().

* Rename m8xx_ide_init_hwif_ports() to m8xx_ide_init_ports().

* Add __init tag to m8xx_ide_init_ports().

This patch fixes hwif->irq always being overriden to 0 (== auto-probe, is
this even working on PPC?) because of ide_init_default_irq() call in ide.c.

There should be no other functional changes.

Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
 arch/ppc/syslib/m8xx_setup.c |    6 ---
 drivers/ide/ppc/mpc8xx.c     |   86 +++++++++++--------------------------------
 2 files changed, 22 insertions(+), 70 deletions(-)

Index: b/arch/ppc/syslib/m8xx_setup.c
===================================================================
--- a/arch/ppc/syslib/m8xx_setup.c
+++ b/arch/ppc/syslib/m8xx_setup.c
@@ -87,8 +87,6 @@ void m8xx_calibrate_decr(void);
 
 unsigned char __res[sizeof(bd_t)];
 
-extern void m8xx_ide_init(void);
-
 extern unsigned long find_available_memory(void);
 extern void m8xx_cpm_reset(void);
 extern void m8xx_wdt_handler_install(bd_t *bp);
@@ -474,8 +472,4 @@ platform_init(unsigned long r3, unsigned
 
 	ppc_md.find_end_of_memory	= m8xx_find_end_of_memory;
 	ppc_md.setup_io_mappings	= m8xx_map_io;
-
-#if defined(CONFIG_BLK_DEV_MPC8xx_IDE)
-	m8xx_ide_init();
-#endif
 }
Index: b/drivers/ide/ppc/mpc8xx.c
===================================================================
--- a/drivers/ide/ppc/mpc8xx.c
+++ b/drivers/ide/ppc/mpc8xx.c
@@ -99,32 +99,6 @@ static int _slot_ = -1;			/* will be rea
 /* Make clock cycles and always round up */
 #define PCMCIA_MK_CLKS( t, T ) (( (t) * ((T)/1000000) + 999U ) / 1000U )
 
-
-
-/*
- * IDE stuff.
- */
-static int
-m8xx_ide_default_irq(unsigned long base)
-{
-#ifdef CONFIG_BLK_DEV_MPC8xx_IDE
-	if (base >= MAX_HWIFS)
-		return 0;
-
-	printk("[%d] m8xx_ide_default_irq %d\n",__LINE__,ioport_dsc[base].irq);
-	
-	return (ioport_dsc[base].irq);
-#else
-        return 9;
-#endif
-}
-
-static unsigned long
-m8xx_ide_default_io_base(int index)
-{
-        return index;
-}
-
 #define M8XX_PCMCIA_CD2(slot)      (0x10000000 >> (slot << 4))
 #define M8XX_PCMCIA_CD1(slot)      (0x08000000 >> (slot << 4))
 
@@ -149,12 +123,11 @@ static int pcmcia_schlvl = PCMCIA_SCHLVL
  */
 
 /*
- * m8xx_ide_init_hwif_ports for a direct IDE interface _using_
+ * m8xx_ide_init_ports() for a direct IDE interface _using_
+ * MPC8xx's internal PCMCIA interface
  */
 #if defined(CONFIG_IDE_8xx_PCCARD) || defined(CONFIG_IDE_8xx_DIRECT)
-static void
-m8xx_ide_init_hwif_ports(hw_regs_t *hw, unsigned long data_port, 
-		unsigned long ctrl_port, int *irq)
+static void __init m8xx_ide_init_ports(hw_regs_t *hw, unsigned long data_port)
 {
 	unsigned long *p = hw->io_ports;
 	int i;
@@ -173,8 +146,6 @@ m8xx_ide_init_hwif_ports(hw_regs_t *hw, 
 	unsigned long base;
 
 	*p = 0;
-	if (irq)
-		*irq = 0;
 
 	pcmp = (pcmconf8xx_t *)(&(((immap_t *)IMAP_ADDR)->im_pcmcia));
 
@@ -248,9 +219,6 @@ m8xx_ide_init_hwif_ports(hw_regs_t *hw, 
 		}
 	}
 
-	if (data_port >= MAX_HWIFS)
-		return;
-
 	if (_slot_ == -1) {
 		printk ("PCMCIA slot has not been defined! Using A as default\n");
 		_slot_ = 0;
@@ -292,11 +260,13 @@ m8xx_ide_init_hwif_ports(hw_regs_t *hw, 
 	 	*p++ = base + ioport_dsc[data_port].reg_off[i];
 	}
 
-	if (irq) {
+	hw->irq = ioport_dsc[data_port].irq;
+	hw->ack_intr = (ide_ack_intr_t *)ide_interrupt_ack;
+
 #ifdef CONFIG_IDE_8xx_PCCARD
+	{
 		unsigned int reg;
 
-		*irq = ioport_dsc[data_port].irq;
 		if (_slot_)
 			pgcrx = &((immap_t *) IMAP_ADDR)->im_pcmcia.pcmc_pgcrb;
 		else
@@ -306,14 +276,11 @@ m8xx_ide_init_hwif_ports(hw_regs_t *hw, 
 		reg |= mk_int_int_mask (pcmcia_schlvl) << 24;
 		reg |= mk_int_int_mask (pcmcia_schlvl) << 16;
 		*pgcrx = reg;
-#else	/* direct connected IDE drive, i.e. external IRQ, not the PCMCIA irq */
-		*irq = ioport_dsc[data_port].irq;
-#endif	/* CONFIG_IDE_8xx_PCCARD */
 	}
+#endif	/* CONFIG_IDE_8xx_PCCARD */
 
 	ide_hwifs[data_port].pio_mask = ATA_PIO4;
 	ide_hwifs[data_port].set_pio_mode = m8xx_ide_set_pio_mode;
-	ide_hwifs[data_port].ack_intr = (ide_ack_intr_t *)ide_interrupt_ack;
 
 	/* Enable Harddisk Interrupt,
 	 * and make it edge sensitive
@@ -329,16 +296,15 @@ m8xx_ide_init_hwif_ports(hw_regs_t *hw, 
 	/* Enable falling edge irq */
 	pcmp->pcmc_per = 0x100000 >> (16 * _slot_);
 #endif	/* CONFIG_IDE_8xx_PCCARD */
-}	/* m8xx_ide_init_hwif_ports() using 8xx internal PCMCIA interface */
+}
 #endif /* CONFIG_IDE_8xx_PCCARD || CONFIG_IDE_8xx_DIRECT */
 
 /*
- * m8xx_ide_init_hwif_ports for a direct IDE interface _not_ using
+ * m8xx_ide_init_ports() for a direct IDE interface _not_ using
  * MPC8xx's internal PCMCIA interface
  */
 #if defined(CONFIG_IDE_EXT_DIRECT)
-void m8xx_ide_init_hwif_ports (hw_regs_t *hw,
-	unsigned long data_port, unsigned long ctrl_port, int *irq)
+static void __init m8xx_ide_init_ports(hw_regs_t *hw, unsigned long data_port)
 {
 	unsigned long *p = hw->io_ports;
 	int i;
@@ -349,8 +315,6 @@ void m8xx_ide_init_hwif_ports (hw_regs_t
 	unsigned long base;
 
 	*p = 0;
-	if (irq)
-		*irq = 0;
 
 	if (!ide_base) {
 
@@ -372,9 +336,6 @@ void m8xx_ide_init_hwif_ports (hw_regs_t
 #endif
 	}
 
-	if (data_port >= MAX_HWIFS)
-		return;
-
 	base = ide_base + ioport_dsc[data_port].base_off;
 #ifdef DEBUG
 	printk ("base: %08x + %08x = %08x\n",
@@ -392,14 +353,12 @@ void m8xx_ide_init_hwif_ports (hw_regs_t
 	 	*p++ = base + ioport_dsc[data_port].reg_off[i];
 	}
 
-	if (irq) {
-		/* direct connected IDE drive, i.e. external IRQ */
-		*irq = ioport_dsc[data_port].irq;
-	}
+	/* direct connected IDE drive, i.e. external IRQ */
+	hw->irq = ioport_dsc[data_port].irq;
+	hw->ack_intr = (ide_ack_intr_t *)ide_interrupt_ack;
 
 	ide_hwifs[data_port].pio_mask = ATA_PIO4;
 	ide_hwifs[data_port].set_pio_mode = m8xx_ide_set_pio_mode;
-	ide_hwifs[data_port].ack_intr = (ide_ack_intr_t *)ide_interrupt_ack;
 
 	/* Enable Harddisk Interrupt,
 	 * and make it edge sensitive
@@ -407,8 +366,7 @@ void m8xx_ide_init_hwif_ports (hw_regs_t
 	/* (11-18) Set edge detect for irq, no wakeup from low power mode */
 	((immap_t *) IMAP_ADDR)->im_siu_conf.sc_siel |=
 			(0x80000000 >> ioport_dsc[data_port].irq);
-}	/* m8xx_ide_init_hwif_ports() for CONFIG_IDE_8xx_DIRECT */ 
-
+}
 #endif	/* CONFIG_IDE_8xx_DIRECT */
 
 
@@ -829,20 +787,20 @@ static int identify  (volatile u8 *p)
 	return (0);	/* don't know */
 }
 
-void m8xx_ide_init(void)
-{
-	ppc_ide_md.default_irq          = m8xx_ide_default_irq;
-	ppc_ide_md.default_io_base      = m8xx_ide_default_io_base;
-	ppc_ide_md.ide_init_hwif        = m8xx_ide_init_hwif_ports;
-}
-
 static int __init mpc8xx_ide_probe(void)
 {
+	hw_regs_t hw;
 	u8 idx[4] = { 0xff, 0xff, 0xff, 0xff };
 
 #ifdef IDE0_BASE_OFFSET
+	memset(&hw, 0, sizeof(hw));
+	m8xx_ide_init_ports(&hw, 0);
+	ide_init_port_hw(&ide_hwifs[0], &hw);
 	idx[0] = 0;
 #ifdef IDE1_BASE_OFFSET
+	memset(&hw, 0, sizeof(hw));
+	m8xx_ide_init_ports(&hw, 1);
+	ide_init_port_hw(&ide_hwifs[1], &hw);
 	idx[1] = 1;
 #endif
 #endif

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

* [PATCH 06/11] ppc/lopec: remove ppc_ide_md hooks
  2008-02-14  0:36 [PATCH 00/11] ide/ppc: remove PPC specific IDE hacks Bartlomiej Zolnierkiewicz
                   ` (4 preceding siblings ...)
  2008-02-14  0:36 ` [PATCH 05/11] ppc/mpc8xx: " Bartlomiej Zolnierkiewicz
@ 2008-02-14  0:37 ` Bartlomiej Zolnierkiewicz
  2008-02-14  0:37 ` [PATCH 07/11] ppc/sandpoint: " Bartlomiej Zolnierkiewicz
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 13+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2008-02-14  0:37 UTC (permalink / raw)
  To: linux-ide
  Cc: linuxppc-dev, Bartlomiej Zolnierkiewicz, Benjamin Herrenschmidt,
	linux-kernel

* Add IDE_HFLAG_FORCE_LEGACY_IRQS host flag for Motorola-LoPEC platform
  to sl82c105 host driver.

* Remove ppc_ide_md hooks from arch/ppc/platforms/lopec.c - no need for
  them (sl82c105 host driver takes care of all this setup).

* Then remove no longer needed <linux/ide.h> include.

Looking at arch/ppc/configs/lopec_defconfig:

...
CONFIG_IDE_GENERIC=y
CONFIG_BLK_DEV_IDEPCI=y
# CONFIG_IDEPCI_SHARE_IRQ is not set
# CONFIG_BLK_DEV_OFFBOARD is not set
CONFIG_BLK_DEV_GENERIC=y
# CONFIG_BLK_DEV_OPTI621 is not set
CONFIG_BLK_DEV_SL82C105=y
...

there should be no functional changes unless somebody preferred to disable
sl82c105 host driver and use only ide_generic one (but why would anybody
want to do such thing :-).

PS It seems that lopec_defconfig hasn't been updated for ages but if somebody
is going to do it please look into disabling IDE_GENERIC and BLK_DEV_GENERIC
config options.  Thanks.

Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
 arch/ppc/platforms/lopec.c |   85 ---------------------------------------------
 drivers/ide/pci/sl82c105.c |    4 ++
 2 files changed, 4 insertions(+), 85 deletions(-)

Index: b/arch/ppc/platforms/lopec.c
===================================================================
--- a/arch/ppc/platforms/lopec.c
+++ b/arch/ppc/platforms/lopec.c
@@ -15,7 +15,6 @@
 #include <linux/pci_ids.h>
 #include <linux/ioport.h>
 #include <linux/init.h>
-#include <linux/ide.h>
 #include <linux/seq_file.h>
 #include <linux/initrd.h>
 #include <linux/console.h>
@@ -168,85 +167,6 @@ lopec_power_off(void)
 	lopec_halt();
 }
 
-#if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE)
-int lopec_ide_ports_known = 0;
-static unsigned long lopec_ide_regbase[MAX_HWIFS];
-static unsigned long lopec_ide_ctl_regbase[MAX_HWIFS];
-static unsigned long lopec_idedma_regbase;
-
-static void
-lopec_ide_probe(void)
-{
-	struct pci_dev *dev = pci_get_device(PCI_VENDOR_ID_WINBOND,
-					      PCI_DEVICE_ID_WINBOND_82C105,
-					      NULL);
-	lopec_ide_ports_known = 1;
-
-	if (dev) {
-		lopec_ide_regbase[0] = dev->resource[0].start;
-		lopec_ide_regbase[1] = dev->resource[2].start;
-		lopec_ide_ctl_regbase[0] = dev->resource[1].start;
-		lopec_ide_ctl_regbase[1] = dev->resource[3].start;
-		lopec_idedma_regbase = dev->resource[4].start;
-		pci_dev_put(dev);
-	}
-}
-
-static int
-lopec_ide_default_irq(unsigned long base)
-{
-	if (lopec_ide_ports_known == 0)
-		lopec_ide_probe();
-
-	if (base == lopec_ide_regbase[0])
-		return 14;
-	else if (base == lopec_ide_regbase[1])
-		return 15;
-	else
-		return 0;
-}
-
-static unsigned long
-lopec_ide_default_io_base(int index)
-{
-	if (lopec_ide_ports_known == 0)
-		lopec_ide_probe();
-	return lopec_ide_regbase[index];
-}
-
-static void __init
-lopec_ide_init_hwif_ports(hw_regs_t *hw, unsigned long data,
-			  unsigned long ctl, int *irq)
-{
-	unsigned long reg = data;
-	uint alt_status_base;
-	int i;
-
-	for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++)
-		hw->io_ports[i] = reg++;
-
-	if (data == lopec_ide_regbase[0]) {
-		alt_status_base = lopec_ide_ctl_regbase[0] + 2;
-		hw->irq = 14;
-	} else if (data == lopec_ide_regbase[1]) {
-		alt_status_base = lopec_ide_ctl_regbase[1] + 2;
-		hw->irq = 15;
-	} else {
-		alt_status_base = 0;
-		hw->irq = 0;
-	}
-
-	if (ctl)
-		hw->io_ports[IDE_CONTROL_OFFSET] = ctl;
-	else
-		hw->io_ports[IDE_CONTROL_OFFSET] = alt_status_base;
-
-	if (irq != NULL)
-		*irq = hw->irq;
-
-}
-#endif /* BLK_DEV_IDE */
-
 static void __init
 lopec_init_IRQ(void)
 {
@@ -384,11 +304,6 @@ platform_init(unsigned long r3, unsigned
 	ppc_md.nvram_read_val = todc_direct_read_val;
 	ppc_md.nvram_write_val = todc_direct_write_val;
 
-#if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE)
-	ppc_ide_md.default_irq = lopec_ide_default_irq;
-	ppc_ide_md.default_io_base = lopec_ide_default_io_base;
-	ppc_ide_md.ide_init_hwif = lopec_ide_init_hwif_ports;
-#endif
 #ifdef CONFIG_SERIAL_TEXT_DEBUG
 	ppc_md.progress = gen550_progress;
 #endif
Index: b/drivers/ide/pci/sl82c105.c
===================================================================
--- a/drivers/ide/pci/sl82c105.c
+++ b/drivers/ide/pci/sl82c105.c
@@ -328,6 +328,10 @@ static const struct ide_port_info sl82c1
 	.enablebits	= {{0x40,0x01,0x01}, {0x40,0x10,0x10}},
 	.host_flags	= IDE_HFLAG_IO_32BIT |
 			  IDE_HFLAG_UNMASK_IRQS |
+/* FIXME: check for Compatibility mode in generic IDE PCI code */
+#ifdef CONFIG_LOPEC
+			  IDE_HFLAG_FORCE_LEGACY_IRQS |
+#endif
 			  IDE_HFLAG_NO_AUTODMA |
 			  IDE_HFLAG_BOOTABLE,
 	.pio_mask	= ATA_PIO5,

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

* [PATCH 07/11] ppc/sandpoint: remove ppc_ide_md hooks
  2008-02-14  0:36 [PATCH 00/11] ide/ppc: remove PPC specific IDE hacks Bartlomiej Zolnierkiewicz
                   ` (5 preceding siblings ...)
  2008-02-14  0:37 ` [PATCH 06/11] ppc/lopec: " Bartlomiej Zolnierkiewicz
@ 2008-02-14  0:37 ` Bartlomiej Zolnierkiewicz
  2008-02-14  0:37 ` [PATCH 08/11] ppc/pplus: remove ppc_ide_md.ide_init_hwif hook Bartlomiej Zolnierkiewicz
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 13+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2008-02-14  0:37 UTC (permalink / raw)
  To: linux-ide
  Cc: linuxppc-dev, Bartlomiej Zolnierkiewicz, Benjamin Herrenschmidt,
	linux-kernel

* Add IDE_HFLAG_FORCE_LEGACY_IRQS host flag for Motorola-Sandpoint platform
  to sl82c105 host driver.

* Disable ide_generic host driver in arch/ppc/configs/sandpoint_defconfig
  and enable sl82c105 one.

* Remove ppc_ide_md hooks from arch/ppc/platforms/sandpoint.c - no need for
  them (sl82c105 host driver takes care of all this setup).

* Then remove no longer needed <linux/ide.h> include.

* Also update arch/ppc/platforms/sandpoint.h.

Unfortunately (unlike lopec's case) sl82c105 host driver was not enabled
in defconfing so there is a funcionality change.

[ Not a big deal since sl82c105 is superior over ide_generic. ]

Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
 arch/ppc/configs/sandpoint_defconfig |    2 
 arch/ppc/platforms/sandpoint.c       |   94 -----------------------------------
 arch/ppc/platforms/sandpoint.h       |    3 -
 drivers/ide/pci/sl82c105.c           |    2 
 4 files changed, 2 insertions(+), 99 deletions(-)

Index: b/arch/ppc/configs/sandpoint_defconfig
===================================================================
--- a/arch/ppc/configs/sandpoint_defconfig
+++ b/arch/ppc/configs/sandpoint_defconfig
@@ -189,7 +189,7 @@ CONFIG_IDE_TASKFILE_IO=y
 #
 # IDE chipset support/bugfixes
 #
-CONFIG_IDE_GENERIC=y
+CONFIG_BLK_DEV_SL82C105=y
 # CONFIG_BLK_DEV_IDEPCI is not set
 # CONFIG_BLK_DEV_IDEDMA is not set
 # CONFIG_IDEDMA_AUTO is not set
Index: b/arch/ppc/platforms/sandpoint.c
===================================================================
--- a/arch/ppc/platforms/sandpoint.c
+++ b/arch/ppc/platforms/sandpoint.c
@@ -71,7 +71,6 @@
 #include <linux/initrd.h>
 #include <linux/console.h>
 #include <linux/delay.h>
-#include <linux/ide.h>
 #include <linux/seq_file.h>
 #include <linux/root_dev.h>
 #include <linux/serial.h>
@@ -559,93 +558,6 @@ sandpoint_show_cpuinfo(struct seq_file *
 	return 0;
 }
 
-#if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE)
-/*
- * IDE support.
- */
-static int		sandpoint_ide_ports_known = 0;
-static unsigned long	sandpoint_ide_regbase[MAX_HWIFS];
-static unsigned long	sandpoint_ide_ctl_regbase[MAX_HWIFS];
-static unsigned long	sandpoint_idedma_regbase;
-
-static void
-sandpoint_ide_probe(void)
-{
-	struct pci_dev *pdev = pci_get_device(PCI_VENDOR_ID_WINBOND,
-			PCI_DEVICE_ID_WINBOND_82C105, NULL);
-
-	if (pdev) {
-		sandpoint_ide_regbase[0]=pdev->resource[0].start;
-		sandpoint_ide_regbase[1]=pdev->resource[2].start;
-		sandpoint_ide_ctl_regbase[0]=pdev->resource[1].start;
-		sandpoint_ide_ctl_regbase[1]=pdev->resource[3].start;
-		sandpoint_idedma_regbase=pdev->resource[4].start;
-		pci_dev_put(pdev);
-	}
-
-	sandpoint_ide_ports_known = 1;
-}
-
-static int
-sandpoint_ide_default_irq(unsigned long base)
-{
-	if (sandpoint_ide_ports_known == 0)
-		sandpoint_ide_probe();
-
-	if (base == sandpoint_ide_regbase[0])
-		return SANDPOINT_IDE_INT0;
-	else if (base == sandpoint_ide_regbase[1])
-		return SANDPOINT_IDE_INT1;
-	else
-		return 0;
-}
-
-static unsigned long
-sandpoint_ide_default_io_base(int index)
-{
-	if (sandpoint_ide_ports_known == 0)
-		sandpoint_ide_probe();
-
-	return sandpoint_ide_regbase[index];
-}
-
-static void __init
-sandpoint_ide_init_hwif_ports(hw_regs_t *hw, unsigned long data_port,
-		unsigned long ctrl_port, int *irq)
-{
-	unsigned long reg = data_port;
-	uint	alt_status_base;
-	int	i;
-
-	for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) {
-		hw->io_ports[i] = reg++;
-	}
-
-	if (data_port == sandpoint_ide_regbase[0]) {
-		alt_status_base = sandpoint_ide_ctl_regbase[0] + 2;
-		hw->irq = 14;
-	}
-	else if (data_port == sandpoint_ide_regbase[1]) {
-		alt_status_base = sandpoint_ide_ctl_regbase[1] + 2;
-		hw->irq = 15;
-	}
-	else {
-		alt_status_base = 0;
-		hw->irq = 0;
-	}
-
-	if (ctrl_port) {
-		hw->io_ports[IDE_CONTROL_OFFSET] = ctrl_port;
-	} else {
-		hw->io_ports[IDE_CONTROL_OFFSET] = alt_status_base;
-	}
-
-	if (irq != NULL) {
-		*irq = hw->irq;
-	}
-}
-#endif
-
 /*
  * Set BAT 3 to map 0xf8000000 to end of physical memory space 1-to-1.
  */
@@ -736,10 +648,4 @@ platform_init(unsigned long r3, unsigned
 #ifdef CONFIG_SERIAL_TEXT_DEBUG
 	ppc_md.progress = gen550_progress;
 #endif
-
-#if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE)
-	ppc_ide_md.default_irq = sandpoint_ide_default_irq;
-	ppc_ide_md.default_io_base = sandpoint_ide_default_io_base;
-	ppc_ide_md.ide_init_hwif = sandpoint_ide_init_hwif_ports;
-#endif
 }
Index: b/arch/ppc/platforms/sandpoint.h
===================================================================
--- a/arch/ppc/platforms/sandpoint.h
+++ b/arch/ppc/platforms/sandpoint.h
@@ -28,9 +28,6 @@
  */
 #define SANDPOINT_IDE_INT0		23	/* EPIC 7 */
 #define SANDPOINT_IDE_INT1		24	/* EPIC 8 */
-#else
-#define SANDPOINT_IDE_INT0		14	/* 8259 Test */
-#define SANDPOINT_IDE_INT1		15	/* 8259 Test */
 #endif
 
 /*
Index: b/drivers/ide/pci/sl82c105.c
===================================================================
--- a/drivers/ide/pci/sl82c105.c
+++ b/drivers/ide/pci/sl82c105.c
@@ -329,7 +329,7 @@ static const struct ide_port_info sl82c1
 	.host_flags	= IDE_HFLAG_IO_32BIT |
 			  IDE_HFLAG_UNMASK_IRQS |
 /* FIXME: check for Compatibility mode in generic IDE PCI code */
-#ifdef CONFIG_LOPEC
+#if defined(CONFIG_LOPEC) || defined(CONFIG_SANDPOINT)
 			  IDE_HFLAG_FORCE_LEGACY_IRQS |
 #endif
 			  IDE_HFLAG_NO_AUTODMA |

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

* [PATCH 08/11] ppc/pplus: remove ppc_ide_md.ide_init_hwif hook
  2008-02-14  0:36 [PATCH 00/11] ide/ppc: remove PPC specific IDE hacks Bartlomiej Zolnierkiewicz
                   ` (6 preceding siblings ...)
  2008-02-14  0:37 ` [PATCH 07/11] ppc/sandpoint: " Bartlomiej Zolnierkiewicz
@ 2008-02-14  0:37 ` Bartlomiej Zolnierkiewicz
  2008-02-14  0:37 ` [PATCH 09/11] ppc: remove ppc_ide_md Bartlomiej Zolnierkiewicz
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 13+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2008-02-14  0:37 UTC (permalink / raw)
  To: linux-ide
  Cc: linuxppc-dev, Bartlomiej Zolnierkiewicz, Benjamin Herrenschmidt,
	linux-kernel

* Call ide_init_default_irq() for pplus in init_ide_data().

* Remove no longer needed pplus_ide_init_hwif_ports().

There should be no functional changes caused by this patch.

Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
 arch/ppc/platforms/pplus.c |   23 -----------------------
 drivers/ide/ide.c          |    2 +-
 2 files changed, 1 insertion(+), 24 deletions(-)

Index: b/arch/ppc/platforms/pplus.c
===================================================================
--- a/arch/ppc/platforms/pplus.c
+++ b/arch/ppc/platforms/pplus.c
@@ -695,28 +695,6 @@ static unsigned long pplus_ide_default_i
 		return 0;
 	}
 }
-
-static void __init
-pplus_ide_init_hwif_ports(hw_regs_t * hw, unsigned long data_port,
-			  unsigned long ctrl_port, int *irq)
-{
-	unsigned long reg = data_port;
-	int i;
-
-	for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) {
-		hw->io_ports[i] = reg;
-		reg += 1;
-	}
-
-	if (ctrl_port)
-		hw->io_ports[IDE_CONTROL_OFFSET] = ctrl_port;
-	else
-		hw->io_ports[IDE_CONTROL_OFFSET] =
-		    hw->io_ports[IDE_DATA_OFFSET] + 0x206;
-
-	if (irq != NULL)
-		*irq = pplus_ide_default_irq(data_port);
-}
 #endif
 
 #ifdef CONFIG_SMP
@@ -887,7 +865,6 @@ platform_init(unsigned long r3, unsigned
 #if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE)
 	ppc_ide_md.default_irq = pplus_ide_default_irq;
 	ppc_ide_md.default_io_base = pplus_ide_default_io_base;
-	ppc_ide_md.ide_init_hwif = pplus_ide_init_hwif_ports;
 #endif
 
 #ifdef CONFIG_SERIAL_TEXT_DEBUG
Index: b/drivers/ide/ide.c
===================================================================
--- a/drivers/ide/ide.c
+++ b/drivers/ide/ide.c
@@ -214,7 +214,7 @@ static void __init init_ide_data (void)
 		memcpy(hwif->io_ports, hw.io_ports, sizeof(hw.io_ports));
 #endif
 		hwif->noprobe = !hwif->io_ports[IDE_DATA_OFFSET];
-#if !defined(CONFIG_PPC32) || !defined(CONFIG_PCI)
+#if !defined(CONFIG_PPC32) || defined(CONFIG_PPLUS) || !defined(CONFIG_PCI)
 		hwif->irq =
 			ide_init_default_irq(hwif->io_ports[IDE_DATA_OFFSET]);
 #endif

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

* [PATCH 09/11] ppc: remove ppc_ide_md
  2008-02-14  0:36 [PATCH 00/11] ide/ppc: remove PPC specific IDE hacks Bartlomiej Zolnierkiewicz
                   ` (7 preceding siblings ...)
  2008-02-14  0:37 ` [PATCH 08/11] ppc/pplus: remove ppc_ide_md.ide_init_hwif hook Bartlomiej Zolnierkiewicz
@ 2008-02-14  0:37 ` Bartlomiej Zolnierkiewicz
  2008-02-14  0:37 ` [PATCH 10/11] ppc: don't include <linux/ide.h> Bartlomiej Zolnierkiewicz
  2008-02-14  0:37 ` [PATCH 11/11] ppc/pmac: remove no longer needed IDE quirk Bartlomiej Zolnierkiewicz
  10 siblings, 0 replies; 13+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2008-02-14  0:37 UTC (permalink / raw)
  To: linux-ide
  Cc: linuxppc-dev, Bartlomiej Zolnierkiewicz, Benjamin Herrenschmidt,
	linux-kernel

* Add special cases for pplus and prep to ide_default_{irq,io_base}()
  (+ FIXMEs about the need to use IDE platform host driver instead).

* Remove no longer needed ppc_ide_md and struct ide_machdep_calls.

* Then remove <linux/ide.h> include from:
  - arch/powerpc/kernel/setup_32.c
  - arch/ppc/kernel/ppc_ksyms.c
  - arch/ppc/kernel/setup.c
  - arch/ppc/platforms/pplus.c
  - arch/ppc/platforms/prep_setup.c

There should be no functional changes caused by this patch.

Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
 arch/powerpc/kernel/setup_32.c  |    8 ------
 arch/ppc/kernel/ppc_ksyms.c     |    5 ----
 arch/ppc/kernel/setup.c         |    2 -
 arch/ppc/platforms/pplus.c      |   35 -----------------------------
 arch/ppc/platforms/prep_setup.c |   38 --------------------------------
 drivers/ide/ide.c               |    4 ---
 include/asm-powerpc/ide.h       |   47 +++++++++++++++++++++++++++-------------
 7 files changed, 32 insertions(+), 107 deletions(-)

Index: b/arch/powerpc/kernel/setup_32.c
===================================================================
--- a/arch/powerpc/kernel/setup_32.c
+++ b/arch/powerpc/kernel/setup_32.c
@@ -10,9 +10,6 @@
 #include <linux/reboot.h>
 #include <linux/delay.h>
 #include <linux/initrd.h>
-#if defined(CONFIG_IDE) || defined(CONFIG_IDE_MODULE)
-#include <linux/ide.h>
-#endif
 #include <linux/tty.h>
 #include <linux/bootmem.h>
 #include <linux/seq_file.h>
@@ -51,11 +48,6 @@
 
 extern void bootx_init(unsigned long r4, unsigned long phys);
 
-#if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE)
-struct ide_machdep_calls ppc_ide_md;
-EXPORT_SYMBOL(ppc_ide_md);
-#endif
-
 int boot_cpuid;
 EXPORT_SYMBOL_GPL(boot_cpuid);
 int boot_cpuid_phys;
Index: b/arch/ppc/kernel/ppc_ksyms.c
===================================================================
--- a/arch/ppc/kernel/ppc_ksyms.c
+++ b/arch/ppc/kernel/ppc_ksyms.c
@@ -12,7 +12,6 @@
 #include <linux/irq.h>
 #include <linux/pci.h>
 #include <linux/delay.h>
-#include <linux/ide.h>
 #include <linux/pm.h>
 #include <linux/bitops.h>
 
@@ -124,10 +123,6 @@ EXPORT_SYMBOL(__ioremap);
 EXPORT_SYMBOL(iounmap);
 EXPORT_SYMBOL(ioremap_bot);	/* aka VMALLOC_END */
 
-#if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE)
-EXPORT_SYMBOL(ppc_ide_md);
-#endif
-
 #ifdef CONFIG_PCI
 EXPORT_SYMBOL(isa_io_base);
 EXPORT_SYMBOL(isa_mem_base);
Index: b/arch/ppc/kernel/setup.c
===================================================================
--- a/arch/ppc/kernel/setup.c
+++ b/arch/ppc/kernel/setup.c
@@ -10,7 +10,6 @@
 #include <linux/reboot.h>
 #include <linux/delay.h>
 #include <linux/initrd.h>
-#include <linux/ide.h>
 #include <linux/screen_info.h>
 #include <linux/bootmem.h>
 #include <linux/seq_file.h>
@@ -57,7 +56,6 @@ extern void ppc6xx_idle(void);
 extern void power4_idle(void);
 
 extern boot_infos_t *boot_infos;
-struct ide_machdep_calls ppc_ide_md;
 
 /* Used with the BI_MEMSIZE bootinfo parameter to store the memory
    size value reported by the boot loader. */
Index: b/arch/ppc/platforms/pplus.c
===================================================================
--- a/arch/ppc/platforms/pplus.c
+++ b/arch/ppc/platforms/pplus.c
@@ -19,7 +19,6 @@
 #include <linux/ioport.h>
 #include <linux/console.h>
 #include <linux/pci.h>
-#include <linux/ide.h>
 #include <linux/seq_file.h>
 #include <linux/root_dev.h>
 
@@ -668,35 +667,6 @@ static void __init pplus_init_IRQ(void)
 		ppc_md.progress("init_irq: exit", 0);
 }
 
-#if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE)
-/*
- * IDE stuff.
- */
-static int pplus_ide_default_irq(unsigned long base)
-{
-	switch (base) {
-	case 0x1f0:
-		return 14;
-	case 0x170:
-		return 15;
-	default:
-		return 0;
-	}
-}
-
-static unsigned long pplus_ide_default_io_base(int index)
-{
-	switch (index) {
-	case 0:
-		return 0x1f0;
-	case 1:
-		return 0x170;
-	default:
-		return 0;
-	}
-}
-#endif
-
 #ifdef CONFIG_SMP
 /* PowerPlus (MTX) support */
 static int __init smp_pplus_probe(void)
@@ -862,11 +832,6 @@ platform_init(unsigned long r3, unsigned
 	ppc_md.find_end_of_memory = pplus_find_end_of_memory;
 	ppc_md.setup_io_mappings = pplus_map_io;
 
-#if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE)
-	ppc_ide_md.default_irq = pplus_ide_default_irq;
-	ppc_ide_md.default_io_base = pplus_ide_default_io_base;
-#endif
-
 #ifdef CONFIG_SERIAL_TEXT_DEBUG
 	ppc_md.progress = gen550_progress;
 #endif				/* CONFIG_SERIAL_TEXT_DEBUG */
Index: b/arch/ppc/platforms/prep_setup.c
===================================================================
--- a/arch/ppc/platforms/prep_setup.c
+++ b/arch/ppc/platforms/prep_setup.c
@@ -33,7 +33,6 @@
 #include <linux/console.h>
 #include <linux/timex.h>
 #include <linux/pci.h>
-#include <linux/ide.h>
 #include <linux/seq_file.h>
 #include <linux/root_dev.h>
 
@@ -894,38 +893,6 @@ prep_init_IRQ(void)
 		i8259_init(MPC10X_MAPA_PCI_INTACK_ADDR, 0);
 }
 
-#if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE)
-/*
- * IDE stuff.
- */
-static int
-prep_ide_default_irq(unsigned long base)
-{
-	switch (base) {
-		case 0x1f0: return 13;
-		case 0x170: return 13;
-		case 0x1e8: return 11;
-		case 0x168: return 10;
-		case 0xfff0: return 14;		/* MCP(N)750 ide0 */
-		case 0xffe0: return 15;		/* MCP(N)750 ide1 */
-		default: return 0;
-	}
-}
-
-static unsigned long
-prep_ide_default_io_base(int index)
-{
-	switch (index) {
-		case 0: return 0x1f0;
-		case 1: return 0x170;
-		case 2: return 0x1e8;
-		case 3: return 0x168;
-		default:
-			return 0;
-	}
-}
-#endif
-
 #ifdef CONFIG_SMP
 /* PReP (MTX) support */
 static int __init
@@ -1070,11 +1037,6 @@ prep_init(unsigned long r3, unsigned lon
 
 	ppc_md.setup_io_mappings = prep_map_io;
 
-#if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE)
-	ppc_ide_md.default_irq = prep_ide_default_irq;
-	ppc_ide_md.default_io_base = prep_ide_default_io_base;
-#endif
-
 #ifdef CONFIG_SMP
 	smp_ops			 = &prep_smp_ops;
 #endif /* CONFIG_SMP */
Index: b/drivers/ide/ide.c
===================================================================
--- a/drivers/ide/ide.c
+++ b/drivers/ide/ide.c
@@ -207,10 +207,6 @@ static void __init init_ide_data (void)
 #ifdef CONFIG_IDE_ARCH_OBSOLETE_INIT
 		memset(&hw, 0, sizeof(hw));
 		ide_std_init_ports(&hw, io_addr, ctl_addr);
-# ifdef CONFIG_PPC32
-		if (ppc_ide_md.ide_init_hwif)
-			ppc_ide_md.ide_init_hwif(&hw, io_addr, 0, &hwif->irq);
-# endif
 		memcpy(hwif->io_ports, hw.io_ports, sizeof(hw.io_ports));
 #endif
 		hwif->noprobe = !hwif->io_ports[IDE_DATA_OFFSET];
Index: b/include/asm-powerpc/ide.h
===================================================================
--- a/include/asm-powerpc/ide.h
+++ b/include/asm-powerpc/ide.h
@@ -31,30 +31,47 @@
 #include <linux/hdreg.h>
 #include <linux/ioport.h>
 
-struct ide_machdep_calls {
-        int         (*default_irq)(unsigned long base);
-        unsigned long (*default_io_base)(int index);
-        void        (*ide_init_hwif)(hw_regs_t *hw,
-                                     unsigned long data_port,
-                                     unsigned long ctrl_port,
-                                     int *irq);
-};
-
-extern struct ide_machdep_calls ppc_ide_md;
-
 #define IDE_ARCH_OBSOLETE_DEFAULTS
 
+/* FIXME: use ide_platform host driver */
 static __inline__ int ide_default_irq(unsigned long base)
 {
-	if (ppc_ide_md.default_irq)
-		return ppc_ide_md.default_irq(base);
+#ifdef CONFIG_PPLUS
+	switch (base) {
+	case 0x1f0:	return 14;
+	case 0x170:	return 15;
+	}
+#endif
+#ifdef CONFIG_PPC_PREP
+	switch (base) {
+	case 0x1f0:	return 13;
+	case 0x170:	return 13;
+	case 0x1e8:	return 11;
+	case 0x168:	return 10;
+	case 0xfff0:	return 14;	/* MCP(N)750 ide0 */
+	case 0xffe0:	return 15;	/* MCP(N)750 ide1 */
+	}
+#endif
 	return 0;
 }
 
+/* FIXME: use ide_platform host driver */
 static __inline__ unsigned long ide_default_io_base(int index)
 {
-	if (ppc_ide_md.default_io_base)
-		return ppc_ide_md.default_io_base(index);
+#ifdef CONFIG_PPLUS
+	switch (index) {
+	case 0:		return 0x1f0;
+	case 1:		return 0x170;
+	}
+#endif
+#ifdef CONFIG_PPC_PREP
+	switch (index) {
+	case 0:		return 0x1f0;
+	case 1:		return 0x170;
+	case 2:		return 0x1e8;
+	case 3:		return 0x168;
+	}
+#endif
 	return 0;
 }
 

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

* [PATCH 10/11] ppc: don't include <linux/ide.h>
  2008-02-14  0:36 [PATCH 00/11] ide/ppc: remove PPC specific IDE hacks Bartlomiej Zolnierkiewicz
                   ` (8 preceding siblings ...)
  2008-02-14  0:37 ` [PATCH 09/11] ppc: remove ppc_ide_md Bartlomiej Zolnierkiewicz
@ 2008-02-14  0:37 ` Bartlomiej Zolnierkiewicz
  2008-02-14  0:37 ` [PATCH 11/11] ppc/pmac: remove no longer needed IDE quirk Bartlomiej Zolnierkiewicz
  10 siblings, 0 replies; 13+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2008-02-14  0:37 UTC (permalink / raw)
  To: linux-ide
  Cc: linuxppc-dev, Bartlomiej Zolnierkiewicz, Benjamin Herrenschmidt,
	linux-kernel

Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
 arch/ppc/platforms/4xx/bamboo.c     |    1 -
 arch/ppc/platforms/4xx/ebony.c      |    1 -
 arch/ppc/platforms/4xx/luan.c       |    1 -
 arch/ppc/platforms/4xx/ocotea.c     |    1 -
 arch/ppc/platforms/4xx/taishan.c    |    1 -
 arch/ppc/platforms/4xx/yucca.c      |    1 -
 arch/ppc/platforms/chestnut.c       |    1 -
 arch/ppc/platforms/cpci690.c        |    1 -
 arch/ppc/platforms/ev64260.c        |    1 -
 arch/ppc/platforms/mvme5100.c       |    1 -
 arch/ppc/platforms/powerpmc250.c    |    1 -
 arch/ppc/platforms/prpmc750.c       |    1 -
 arch/ppc/platforms/prpmc800.c       |    1 -
 arch/ppc/platforms/radstone_ppc7d.c |    1 -
 arch/ppc/platforms/residual.c       |    1 -
 arch/ppc/platforms/spruce.c         |    1 -
 16 files changed, 16 deletions(-)

Index: b/arch/ppc/platforms/4xx/bamboo.c
===================================================================
--- a/arch/ppc/platforms/4xx/bamboo.c
+++ b/arch/ppc/platforms/4xx/bamboo.c
@@ -22,7 +22,6 @@
 #include <linux/blkdev.h>
 #include <linux/console.h>
 #include <linux/delay.h>
-#include <linux/ide.h>
 #include <linux/initrd.h>
 #include <linux/seq_file.h>
 #include <linux/root_dev.h>
Index: b/arch/ppc/platforms/4xx/ebony.c
===================================================================
--- a/arch/ppc/platforms/4xx/ebony.c
+++ b/arch/ppc/platforms/4xx/ebony.c
@@ -25,7 +25,6 @@
 #include <linux/blkdev.h>
 #include <linux/console.h>
 #include <linux/delay.h>
-#include <linux/ide.h>
 #include <linux/initrd.h>
 #include <linux/seq_file.h>
 #include <linux/root_dev.h>
Index: b/arch/ppc/platforms/4xx/luan.c
===================================================================
--- a/arch/ppc/platforms/4xx/luan.c
+++ b/arch/ppc/platforms/4xx/luan.c
@@ -23,7 +23,6 @@
 #include <linux/blkdev.h>
 #include <linux/console.h>
 #include <linux/delay.h>
-#include <linux/ide.h>
 #include <linux/initrd.h>
 #include <linux/seq_file.h>
 #include <linux/root_dev.h>
Index: b/arch/ppc/platforms/4xx/ocotea.c
===================================================================
--- a/arch/ppc/platforms/4xx/ocotea.c
+++ b/arch/ppc/platforms/4xx/ocotea.c
@@ -23,7 +23,6 @@
 #include <linux/blkdev.h>
 #include <linux/console.h>
 #include <linux/delay.h>
-#include <linux/ide.h>
 #include <linux/initrd.h>
 #include <linux/seq_file.h>
 #include <linux/root_dev.h>
Index: b/arch/ppc/platforms/4xx/taishan.c
===================================================================
--- a/arch/ppc/platforms/4xx/taishan.c
+++ b/arch/ppc/platforms/4xx/taishan.c
@@ -23,7 +23,6 @@
 #include <linux/blkdev.h>
 #include <linux/console.h>
 #include <linux/delay.h>
-#include <linux/ide.h>
 #include <linux/initrd.h>
 #include <linux/seq_file.h>
 #include <linux/root_dev.h>
Index: b/arch/ppc/platforms/4xx/yucca.c
===================================================================
--- a/arch/ppc/platforms/4xx/yucca.c
+++ b/arch/ppc/platforms/4xx/yucca.c
@@ -24,7 +24,6 @@
 #include <linux/blkdev.h>
 #include <linux/console.h>
 #include <linux/delay.h>
-#include <linux/ide.h>
 #include <linux/initrd.h>
 #include <linux/seq_file.h>
 #include <linux/root_dev.h>
Index: b/arch/ppc/platforms/chestnut.c
===================================================================
--- a/arch/ppc/platforms/chestnut.c
+++ b/arch/ppc/platforms/chestnut.c
@@ -22,7 +22,6 @@
 #include <linux/initrd.h>
 #include <linux/delay.h>
 #include <linux/seq_file.h>
-#include <linux/ide.h>
 #include <linux/serial.h>
 #include <linux/serial_core.h>
 #include <linux/serial_8250.h>
Index: b/arch/ppc/platforms/cpci690.c
===================================================================
--- a/arch/ppc/platforms/cpci690.c
+++ b/arch/ppc/platforms/cpci690.c
@@ -10,7 +10,6 @@
  */
 #include <linux/delay.h>
 #include <linux/pci.h>
-#include <linux/ide.h>
 #include <linux/irq.h>
 #include <linux/fs.h>
 #include <linux/seq_file.h>
Index: b/arch/ppc/platforms/ev64260.c
===================================================================
--- a/arch/ppc/platforms/ev64260.c
+++ b/arch/ppc/platforms/ev64260.c
@@ -23,7 +23,6 @@
 
 #include <linux/delay.h>
 #include <linux/pci.h>
-#include <linux/ide.h>
 #include <linux/irq.h>
 #include <linux/fs.h>
 #include <linux/seq_file.h>
Index: b/arch/ppc/platforms/mvme5100.c
===================================================================
--- a/arch/ppc/platforms/mvme5100.c
+++ b/arch/ppc/platforms/mvme5100.c
@@ -17,7 +17,6 @@
 #include <linux/initrd.h>
 #include <linux/console.h>
 #include <linux/delay.h>
-#include <linux/ide.h>
 #include <linux/seq_file.h>
 #include <linux/kdev_t.h>
 #include <linux/root_dev.h>
Index: b/arch/ppc/platforms/powerpmc250.c
===================================================================
--- a/arch/ppc/platforms/powerpmc250.c
+++ b/arch/ppc/platforms/powerpmc250.c
@@ -25,7 +25,6 @@
 #include <linux/delay.h>
 #include <linux/slab.h>
 #include <linux/seq_file.h>
-#include <linux/ide.h>
 #include <linux/root_dev.h>
 
 #include <asm/byteorder.h>
Index: b/arch/ppc/platforms/prpmc750.c
===================================================================
--- a/arch/ppc/platforms/prpmc750.c
+++ b/arch/ppc/platforms/prpmc750.c
@@ -22,7 +22,6 @@
 #include <linux/console.h>
 #include <linux/delay.h>
 #include <linux/seq_file.h>
-#include <linux/ide.h>
 #include <linux/root_dev.h>
 #include <linux/slab.h>
 #include <linux/serial_reg.h>
Index: b/arch/ppc/platforms/prpmc800.c
===================================================================
--- a/arch/ppc/platforms/prpmc800.c
+++ b/arch/ppc/platforms/prpmc800.c
@@ -20,7 +20,6 @@
 #include <linux/console.h>
 #include <linux/delay.h>
 #include <linux/seq_file.h>
-#include <linux/ide.h>
 #include <linux/root_dev.h>
 #include <linux/harrier_defs.h>
 
Index: b/arch/ppc/platforms/radstone_ppc7d.c
===================================================================
--- a/arch/ppc/platforms/radstone_ppc7d.c
+++ b/arch/ppc/platforms/radstone_ppc7d.c
@@ -29,7 +29,6 @@
 #include <linux/initrd.h>
 #include <linux/console.h>
 #include <linux/delay.h>
-#include <linux/ide.h>
 #include <linux/seq_file.h>
 #include <linux/root_dev.h>
 #include <linux/serial.h>
Index: b/arch/ppc/platforms/residual.c
===================================================================
--- a/arch/ppc/platforms/residual.c
+++ b/arch/ppc/platforms/residual.c
@@ -38,7 +38,6 @@
 #include <linux/init.h>
 #include <linux/ioport.h>
 #include <linux/pci.h>
-#include <linux/ide.h>
 
 #include <asm/sections.h>
 #include <asm/mmu.h>
Index: b/arch/ppc/platforms/spruce.c
===================================================================
--- a/arch/ppc/platforms/spruce.c
+++ b/arch/ppc/platforms/spruce.c
@@ -22,7 +22,6 @@
 #include <linux/console.h>
 #include <linux/delay.h>
 #include <linux/seq_file.h>
-#include <linux/ide.h>
 #include <linux/root_dev.h>
 #include <linux/serial.h>
 #include <linux/tty.h>

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

* [PATCH 11/11] ppc/pmac: remove no longer needed IDE quirk
  2008-02-14  0:36 [PATCH 00/11] ide/ppc: remove PPC specific IDE hacks Bartlomiej Zolnierkiewicz
                   ` (9 preceding siblings ...)
  2008-02-14  0:37 ` [PATCH 10/11] ppc: don't include <linux/ide.h> Bartlomiej Zolnierkiewicz
@ 2008-02-14  0:37 ` Bartlomiej Zolnierkiewicz
  10 siblings, 0 replies; 13+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2008-02-14  0:37 UTC (permalink / raw)
  To: linux-ide
  Cc: linuxppc-dev, Bartlomiej Zolnierkiewicz, Benjamin Herrenschmidt,
	linux-kernel

IDE PMAC host driver and all IDE PCI host drivers use pci_enable_device()
nowadays so the following quirk in pmac_pcibios_after_init() can be removed.

Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
 arch/powerpc/platforms/powermac/pci.c |   22 ----------------------
 1 file changed, 22 deletions(-)

Index: b/arch/powerpc/platforms/powermac/pci.c
===================================================================
--- a/arch/powerpc/platforms/powermac/pci.c
+++ b/arch/powerpc/platforms/powermac/pci.c
@@ -1144,28 +1144,6 @@ void __init pmac_pcibios_after_init(void
 {
 	struct device_node* nd;
 
-#ifdef CONFIG_BLK_DEV_IDE
-	struct pci_dev *dev = NULL;
-
-	/* OF fails to initialize IDE controllers on macs
-	 * (and maybe other machines)
-	 *
-	 * Ideally, this should be moved to the IDE layer, but we need
-	 * to check specifically with Andre Hedrick how to do it cleanly
-	 * since the common IDE code seem to care about the fact that the
-	 * BIOS may have disabled a controller.
-	 *
-	 * -- BenH
-	 */
-	for_each_pci_dev(dev) {
-		if ((dev->class >> 16) != PCI_BASE_CLASS_STORAGE)
-			continue;
-		if (pci_enable_device(dev))
-			printk(KERN_WARNING
-			       "pci: Failed to enable %s\n", pci_name(dev));
-	}
-#endif /* CONFIG_BLK_DEV_IDE */
-
 	for_each_node_by_name(nd, "firewire") {
 		if (nd->parent && (of_device_is_compatible(nd, "pci106b,18") ||
 				   of_device_is_compatible(nd, "pci106b,30") ||

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

* Re: [PATCH 05/11] ppc/mpc8xx: remove ppc_ide_md hooks
  2008-02-14  0:36 ` [PATCH 05/11] ppc/mpc8xx: " Bartlomiej Zolnierkiewicz
@ 2008-02-14 20:46   ` Vitaly Bordug
  0 siblings, 0 replies; 13+ messages in thread
From: Vitaly Bordug @ 2008-02-14 20:46 UTC (permalink / raw)
  To: Bartlomiej Zolnierkiewicz
  Cc: linux-ide, linuxppc-dev, linux-kernel, Bartlomiej Zolnierkiewicz

On Thu, 14 Feb 2008 01:36:56 +0100
Bartlomiej Zolnierkiewicz wrote:

> * Initialize IDE ports in mpc8xx_ide_probe().
> 
> * Remove m8xx_ide_init() and ppc_ide_md hooks - no need for them
>   (IDE mpc8xx host driver takes care of all this setup).
> 
> * Remove needless 'if (irq)' and 'if (data_port >= MAX_HWIFS)' checks
>   from m8xx_ide_init_hwif_ports().
> 
> * Remove 'ctrl_port' and 'irq' arguments from
> m8xx_ide_init_hwif_ports().
> 
> * Rename m8xx_ide_init_hwif_ports() to m8xx_ide_init_ports().
> 
> * Add __init tag to m8xx_ide_init_ports().
> 
> This patch fixes hwif->irq always being overriden to 0 (==
> auto-probe, is this even working on PPC?) because of
> ide_init_default_irq() call in ide.c.
> 
> There should be no other functional changes.
> 
> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Acked-by: Vitaly Bordug <vitb@kernel.crashing.org>


> ---
>  arch/ppc/syslib/m8xx_setup.c |    6 ---
>  drivers/ide/ppc/mpc8xx.c     |   86
> +++++++++++-------------------------------- 2 files changed, 22
> insertions(+), 70 deletions(-)
> 
> Index: b/arch/ppc/syslib/m8xx_setup.c
> ===================================================================
> --- a/arch/ppc/syslib/m8xx_setup.c
> +++ b/arch/ppc/syslib/m8xx_setup.c
> @@ -87,8 +87,6 @@ void m8xx_calibrate_decr(void);
>  
>  unsigned char __res[sizeof(bd_t)];
>  
> -extern void m8xx_ide_init(void);
> -
>  extern unsigned long find_available_memory(void);
>  extern void m8xx_cpm_reset(void);
>  extern void m8xx_wdt_handler_install(bd_t *bp);
> @@ -474,8 +472,4 @@ platform_init(unsigned long r3, unsigned
>  
>  	ppc_md.find_end_of_memory	= m8xx_find_end_of_memory;
>  	ppc_md.setup_io_mappings	= m8xx_map_io;
> -
> -#if defined(CONFIG_BLK_DEV_MPC8xx_IDE)
> -	m8xx_ide_init();
> -#endif
>  }
> Index: b/drivers/ide/ppc/mpc8xx.c
> ===================================================================
> --- a/drivers/ide/ppc/mpc8xx.c
> +++ b/drivers/ide/ppc/mpc8xx.c
> @@ -99,32 +99,6 @@ static int _slot_ = -1;			/*
> will be rea /* Make clock cycles and always round up */
>  #define PCMCIA_MK_CLKS( t, T ) (( (t) * ((T)/1000000) + 999U ) /
> 1000U ) 
> -
> -
> -/*
> - * IDE stuff.
> - */
> -static int
> -m8xx_ide_default_irq(unsigned long base)
> -{
> -#ifdef CONFIG_BLK_DEV_MPC8xx_IDE
> -	if (base >= MAX_HWIFS)
> -		return 0;
> -
> -	printk("[%d] m8xx_ide_default_irq
> %d\n",__LINE__,ioport_dsc[base].irq);
> -	
> -	return (ioport_dsc[base].irq);
> -#else
> -        return 9;
> -#endif
> -}
> -
> -static unsigned long
> -m8xx_ide_default_io_base(int index)
> -{
> -        return index;
> -}
> -
>  #define M8XX_PCMCIA_CD2(slot)      (0x10000000 >> (slot << 4))
>  #define M8XX_PCMCIA_CD1(slot)      (0x08000000 >> (slot << 4))
>  
> @@ -149,12 +123,11 @@ static int pcmcia_schlvl = PCMCIA_SCHLVL
>   */
>  
>  /*
> - * m8xx_ide_init_hwif_ports for a direct IDE interface _using_
> + * m8xx_ide_init_ports() for a direct IDE interface _using_
> + * MPC8xx's internal PCMCIA interface
>   */
>  #if defined(CONFIG_IDE_8xx_PCCARD) || defined(CONFIG_IDE_8xx_DIRECT)
> -static void
> -m8xx_ide_init_hwif_ports(hw_regs_t *hw, unsigned long data_port, 
> -		unsigned long ctrl_port, int *irq)
> +static void __init m8xx_ide_init_ports(hw_regs_t *hw, unsigned long
> data_port) {
>  	unsigned long *p = hw->io_ports;
>  	int i;
> @@ -173,8 +146,6 @@ m8xx_ide_init_hwif_ports(hw_regs_t *hw, 
>  	unsigned long base;
>  
>  	*p = 0;
> -	if (irq)
> -		*irq = 0;
>  
>  	pcmp = (pcmconf8xx_t *)(&(((immap_t
> *)IMAP_ADDR)->im_pcmcia)); 
> @@ -248,9 +219,6 @@ m8xx_ide_init_hwif_ports(hw_regs_t *hw, 
>  		}
>  	}
>  
> -	if (data_port >= MAX_HWIFS)
> -		return;
> -
>  	if (_slot_ == -1) {
>  		printk ("PCMCIA slot has not been defined! Using A
> as default\n"); _slot_ = 0;
> @@ -292,11 +260,13 @@ m8xx_ide_init_hwif_ports(hw_regs_t *hw, 
>  	 	*p++ = base + ioport_dsc[data_port].reg_off[i];
>  	}
>  
> -	if (irq) {
> +	hw->irq = ioport_dsc[data_port].irq;
> +	hw->ack_intr = (ide_ack_intr_t *)ide_interrupt_ack;
> +
>  #ifdef CONFIG_IDE_8xx_PCCARD
> +	{
>  		unsigned int reg;
>  
> -		*irq = ioport_dsc[data_port].irq;
>  		if (_slot_)
>  			pgcrx = &((immap_t *)
> IMAP_ADDR)->im_pcmcia.pcmc_pgcrb; else
> @@ -306,14 +276,11 @@ m8xx_ide_init_hwif_ports(hw_regs_t *hw, 
>  		reg |= mk_int_int_mask (pcmcia_schlvl) << 24;
>  		reg |= mk_int_int_mask (pcmcia_schlvl) << 16;
>  		*pgcrx = reg;
> -#else	/* direct connected IDE drive, i.e. external IRQ, not
> the PCMCIA irq */
> -		*irq = ioport_dsc[data_port].irq;
> -#endif	/* CONFIG_IDE_8xx_PCCARD */
>  	}
> +#endif	/* CONFIG_IDE_8xx_PCCARD */
>  
>  	ide_hwifs[data_port].pio_mask = ATA_PIO4;
>  	ide_hwifs[data_port].set_pio_mode = m8xx_ide_set_pio_mode;
> -	ide_hwifs[data_port].ack_intr = (ide_ack_intr_t
> *)ide_interrupt_ack; 
>  	/* Enable Harddisk Interrupt,
>  	 * and make it edge sensitive
> @@ -329,16 +296,15 @@ m8xx_ide_init_hwif_ports(hw_regs_t *hw, 
>  	/* Enable falling edge irq */
>  	pcmp->pcmc_per = 0x100000 >> (16 * _slot_);
>  #endif	/* CONFIG_IDE_8xx_PCCARD */
> -}	/* m8xx_ide_init_hwif_ports() using 8xx internal PCMCIA
> interface */ +}
>  #endif /* CONFIG_IDE_8xx_PCCARD || CONFIG_IDE_8xx_DIRECT */
>  
>  /*
> - * m8xx_ide_init_hwif_ports for a direct IDE interface _not_ using
> + * m8xx_ide_init_ports() for a direct IDE interface _not_ using
>   * MPC8xx's internal PCMCIA interface
>   */
>  #if defined(CONFIG_IDE_EXT_DIRECT)
> -void m8xx_ide_init_hwif_ports (hw_regs_t *hw,
> -	unsigned long data_port, unsigned long ctrl_port, int *irq)
> +static void __init m8xx_ide_init_ports(hw_regs_t *hw, unsigned long
> data_port) {
>  	unsigned long *p = hw->io_ports;
>  	int i;
> @@ -349,8 +315,6 @@ void m8xx_ide_init_hwif_ports (hw_regs_t
>  	unsigned long base;
>  
>  	*p = 0;
> -	if (irq)
> -		*irq = 0;
>  
>  	if (!ide_base) {
>  
> @@ -372,9 +336,6 @@ void m8xx_ide_init_hwif_ports (hw_regs_t
>  #endif
>  	}
>  
> -	if (data_port >= MAX_HWIFS)
> -		return;
> -
>  	base = ide_base + ioport_dsc[data_port].base_off;
>  #ifdef DEBUG
>  	printk ("base: %08x + %08x = %08x\n",
> @@ -392,14 +353,12 @@ void m8xx_ide_init_hwif_ports (hw_regs_t
>  	 	*p++ = base + ioport_dsc[data_port].reg_off[i];
>  	}
>  
> -	if (irq) {
> -		/* direct connected IDE drive, i.e. external IRQ */
> -		*irq = ioport_dsc[data_port].irq;
> -	}
> +	/* direct connected IDE drive, i.e. external IRQ */
> +	hw->irq = ioport_dsc[data_port].irq;
> +	hw->ack_intr = (ide_ack_intr_t *)ide_interrupt_ack;
>  
>  	ide_hwifs[data_port].pio_mask = ATA_PIO4;
>  	ide_hwifs[data_port].set_pio_mode = m8xx_ide_set_pio_mode;
> -	ide_hwifs[data_port].ack_intr = (ide_ack_intr_t
> *)ide_interrupt_ack; 
>  	/* Enable Harddisk Interrupt,
>  	 * and make it edge sensitive
> @@ -407,8 +366,7 @@ void m8xx_ide_init_hwif_ports (hw_regs_t
>  	/* (11-18) Set edge detect for irq, no wakeup from low power
> mode */ ((immap_t *) IMAP_ADDR)->im_siu_conf.sc_siel |=
>  			(0x80000000 >> ioport_dsc[data_port].irq);
> -}	/* m8xx_ide_init_hwif_ports() for CONFIG_IDE_8xx_DIRECT */ 
> -
> +}
>  #endif	/* CONFIG_IDE_8xx_DIRECT */
>  
>  
> @@ -829,20 +787,20 @@ static int identify  (volatile u8 *p)
>  	return (0);	/* don't know */
>  }
>  
> -void m8xx_ide_init(void)
> -{
> -	ppc_ide_md.default_irq          = m8xx_ide_default_irq;
> -	ppc_ide_md.default_io_base      = m8xx_ide_default_io_base;
> -	ppc_ide_md.ide_init_hwif        = m8xx_ide_init_hwif_ports;
> -}
> -
>  static int __init mpc8xx_ide_probe(void)
>  {
> +	hw_regs_t hw;
>  	u8 idx[4] = { 0xff, 0xff, 0xff, 0xff };
>  
>  #ifdef IDE0_BASE_OFFSET
> +	memset(&hw, 0, sizeof(hw));
> +	m8xx_ide_init_ports(&hw, 0);
> +	ide_init_port_hw(&ide_hwifs[0], &hw);
>  	idx[0] = 0;
>  #ifdef IDE1_BASE_OFFSET
> +	memset(&hw, 0, sizeof(hw));
> +	m8xx_ide_init_ports(&hw, 1);
> +	ide_init_port_hw(&ide_hwifs[1], &hw);
>  	idx[1] = 1;
>  #endif
>  #endif
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@ozlabs.org
> https://ozlabs.org/mailman/listinfo/linuxppc-dev


-- 
Sincerely, Vitaly

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

end of thread, other threads:[~2008-02-14 20:46 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-02-14  0:36 [PATCH 00/11] ide/ppc: remove PPC specific IDE hacks Bartlomiej Zolnierkiewicz
2008-02-14  0:36 ` [PATCH 01/11] ide-pmac: remove dead code Bartlomiej Zolnierkiewicz
2008-02-14  0:36 ` [PATCH 02/11] ppc/hdpu: remove dead IDE code Bartlomiej Zolnierkiewicz
2008-02-14  0:36 ` [PATCH 03/11] ppc/ppc4xx: remove ppc_ide_md hooks Bartlomiej Zolnierkiewicz
2008-02-14  0:36 ` [PATCH 04/11] ppc/pmac: " Bartlomiej Zolnierkiewicz
2008-02-14  0:36 ` [PATCH 05/11] ppc/mpc8xx: " Bartlomiej Zolnierkiewicz
2008-02-14 20:46   ` Vitaly Bordug
2008-02-14  0:37 ` [PATCH 06/11] ppc/lopec: " Bartlomiej Zolnierkiewicz
2008-02-14  0:37 ` [PATCH 07/11] ppc/sandpoint: " Bartlomiej Zolnierkiewicz
2008-02-14  0:37 ` [PATCH 08/11] ppc/pplus: remove ppc_ide_md.ide_init_hwif hook Bartlomiej Zolnierkiewicz
2008-02-14  0:37 ` [PATCH 09/11] ppc: remove ppc_ide_md Bartlomiej Zolnierkiewicz
2008-02-14  0:37 ` [PATCH 10/11] ppc: don't include <linux/ide.h> Bartlomiej Zolnierkiewicz
2008-02-14  0:37 ` [PATCH 11/11] ppc/pmac: remove no longer needed IDE quirk Bartlomiej Zolnierkiewicz

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