LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 10/18] ide: add warm-plug support for IDE devices
From: Bartlomiej Zolnierkiewicz @ 2008-02-08  0:45 UTC (permalink / raw)
  To: linux-ide; +Cc: linuxppc-dev, linux-kernel, Bartlomiej Zolnierkiewicz
In-Reply-To: <20080208004421.17746.32557.sendpatchset@localhost.localdomain>

* Add 'struct class ide_port_class' ('ide_port' class) and embedd 'struct
  class_device classdev' ('ide_port' class device) in ide_hwif_t.

* Register 'ide_port' class in ide_init() and unregister it in
  cleanup_module().

* Add class_to_ide_port() macro and ide_port_class_release().

* Register ->classdev in ide_register_port () and unregister it in
  ide_unregister().

* Add "delete_devices" class device attribute for unregistering IDE devices
  on a port and "scan" one for probing+registering IDE devices on a port.

* Add ide_sysfs_register_port() helper for registering "delete_devices"
  and "scan" attributes with ->classdev.  Call it in ide_device_add_all().

* Document IDE warm-plug support in Documentation/ide/warm-plug-howto.txt.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
+540 bytes (x86-32)

After seeing some 'class device' conversion patches from Greg I tried to
recast this patch to just use 'device' but I couldn't figure out how to
use class_device_create() with *static* objects...

 Documentation/ide/warm-plug-howto.txt |   13 ++++++
 drivers/ide/ide-probe.c               |   70 +++++++++++++++++++++++++++++++++-
 drivers/ide/ide.c                     |   22 ++++++++++
 include/linux/ide.h                   |    7 ++-
 4 files changed, 109 insertions(+), 3 deletions(-)

Index: b/Documentation/ide/warm-plug-howto.txt
===================================================================
--- /dev/null
+++ b/Documentation/ide/warm-plug-howto.txt
@@ -0,0 +1,13 @@
+
+IDE warm-plug HOWTO
+===================
+
+To warm-plug devices on a port 'idex':
+
+# echo -n "1" > /sys/class/ide_port/idex/delete_devices
+
+unplug old device(s) and plug new device(s)
+
+# echo -n "1" > /sys/class/ide_port/idex/scan
+
+done
Index: b/drivers/ide/ide-probe.c
===================================================================
--- a/drivers/ide/ide-probe.c
+++ b/drivers/ide/ide-probe.c
@@ -623,7 +623,7 @@ static void hwif_release_dev (struct dev
 	complete(&hwif->gendev_rel_comp);
 }
 
-static void ide_register_port(ide_hwif_t *hwif)
+static int ide_register_port(ide_hwif_t *hwif)
 {
 	int ret;
 
@@ -639,9 +639,23 @@ static void ide_register_port(ide_hwif_t
 	}
 	hwif->gendev.release = hwif_release_dev;
 	ret = device_register(&hwif->gendev);
-	if (ret < 0)
+	if (ret < 0) {
 		printk(KERN_WARNING "IDE: %s: device_register error: %d\n",
 			__FUNCTION__, ret);
+		goto out;
+	}
+
+	get_device(&hwif->gendev);
+
+	strlcpy(hwif->classdev.class_id, hwif->name, BUS_ID_SIZE);
+	hwif->classdev.dev = &hwif->gendev;
+	hwif->classdev.class = &ide_port_class;
+
+	ret = class_device_register(&hwif->classdev);
+	if (ret < 0)
+		device_unregister(&hwif->gendev);
+out:
+	return ret;
 }
 
 /**
@@ -1374,6 +1388,57 @@ static void ide_port_cable_detect(ide_hw
 	}
 }
 
+static ssize_t store_delete_devices(struct class_device *class_dev,
+				    const char *buf, size_t n)
+{
+	ide_hwif_t *hwif = class_to_ide_port(class_dev);
+
+	if (strncmp(buf, "1", n))
+		return -EINVAL;
+
+	ide_port_unregister_devices(hwif);
+
+	return n;
+};
+
+static CLASS_DEVICE_ATTR(delete_devices, S_IWUSR, NULL, store_delete_devices);
+
+static ssize_t store_scan(struct class_device *class_dev, const char *buf,
+			  size_t n)
+{
+	ide_hwif_t *hwif = class_to_ide_port(class_dev);
+
+	if (strncmp(buf, "1", n))
+		return -EINVAL;
+
+	ide_port_unregister_devices(hwif);
+	ide_port_scan(hwif);
+
+	return n;
+};
+
+static CLASS_DEVICE_ATTR(scan, S_IWUSR, NULL, store_scan);
+
+static struct class_device_attribute *ide_port_attrs[] = {
+	&class_device_attr_delete_devices,
+	&class_device_attr_scan,
+	NULL
+};
+
+static int ide_sysfs_register_port(ide_hwif_t *hwif)
+{
+	int i, rc;
+
+	for (i = 0; ide_port_attrs[i]; i++) {
+		rc = class_device_create_file(&hwif->classdev,
+					      ide_port_attrs[i]);
+		if (rc)
+			break;
+	}
+
+	return rc;
+}
+
 int ide_device_add_all(u8 *idx, const struct ide_port_info *d)
 {
 	ide_hwif_t *hwif, *mate = NULL;
@@ -1470,6 +1535,7 @@ int ide_device_add_all(u8 *idx, const st
 		hwif = &ide_hwifs[idx[i]];
 
 		if (hwif->present) {
+			ide_sysfs_register_port(hwif);
 			ide_proc_register_port(hwif);
 			ide_proc_port_register_devices(hwif);
 		}
Index: b/drivers/ide/ide.c
===================================================================
--- a/drivers/ide/ide.c
+++ b/drivers/ide/ide.c
@@ -596,6 +596,7 @@ void ide_unregister(unsigned int index, 
 
 	ide_remove_port_from_hwgroup(hwif);
 
+	class_device_unregister(&hwif->classdev);
 	device_unregister(&hwif->gendev);
 	wait_for_completion(&hwif->gendev_rel_comp);
 
@@ -1613,6 +1614,16 @@ struct bus_type ide_bus_type = {
 
 EXPORT_SYMBOL_GPL(ide_bus_type);
 
+static void ide_port_class_release(struct class_device *class_dev)
+{
+	put_device(&class_to_ide_port(class_dev)->gendev);
+}
+
+struct class ide_port_class = {
+	.name		= "ide_port",
+	.release	= ide_port_class_release,
+};
+
 /*
  * This is gets invoked once during initialization, to set *everything* up
  */
@@ -1633,11 +1644,20 @@ static int __init ide_init(void)
 		return ret;
 	}
 
+	ret = class_register(&ide_port_class);
+	if (ret)
+		goto out_port_class;
+
 	init_ide_data();
 
 	proc_ide_create();
 
 	return 0;
+
+out_port_class:
+	bus_unregister(&ide_bus_type);
+
+	return ret;
 }
 
 #ifdef MODULE
@@ -1674,6 +1694,8 @@ void __exit cleanup_module (void)
 
 	proc_ide_destroy();
 
+	class_unregister(&ide_port_class);
+
 	bus_unregister(&ide_bus_type);
 }
 
Index: b/include/linux/ide.h
===================================================================
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -581,7 +581,9 @@ typedef struct hwif_s {
 	unsigned	mmio       : 1; /* host uses MMIO */
 	unsigned	straight8  : 1;	/* Alan's straight 8 check */
 
-	struct device	gendev;
+	struct device		gendev;
+	struct class_device	classdev;
+
 	struct completion gendev_rel_comp; /* To deal with device release() */
 
 	void		*hwif_data;	/* extra hwif data */
@@ -593,6 +595,8 @@ typedef struct hwif_s {
 #endif
 } ____cacheline_internodealigned_in_smp ide_hwif_t;
 
+#define class_to_ide_port(dev)	container_of(dev, ide_hwif_t, classdev)
+
 /*
  *  internal ide interrupt handler type
  */
@@ -1275,6 +1279,7 @@ extern struct mutex ide_cfg_mtx;
 #define local_irq_set(flags)	do { local_save_flags((flags)); local_irq_enable_in_hardirq(); } while (0)
 
 extern struct bus_type ide_bus_type;
+extern struct class ide_port_class;
 
 /* check if CACHE FLUSH (EXT) command is supported (bits defined in ATA-6) */
 #define ide_id_has_flush_cache(id)	((id)->cfs_enable_2 & 0x3000)

^ permalink raw reply

* [PATCH 09/18] ide: rework PowerMac media-bay support
From: Bartlomiej Zolnierkiewicz @ 2008-02-08  0:45 UTC (permalink / raw)
  To: linux-ide; +Cc: linuxppc-dev, linux-kernel, Bartlomiej Zolnierkiewicz
In-Reply-To: <20080208004421.17746.32557.sendpatchset@localhost.localdomain>

Rework PowerMac media-bay support in such way that instead of
un/registering the IDE interface we un/register IDE devices:

* Add ide_port_scan() helper for probing+registerering devices on a port.

* Rename ide_port_unregister_devices() to __ide_port_unregister_devices().

* Add ide_port_unregister_devices() helper for unregistering devices on a port.

* Add 'ide_hwif_t *cd_port' to 'struct media_bay_info', pass 'hwif' instead
  of hwif->index to media_bay_set_ide_infos() and use it to setup 'cd_port'.

* Use ide_port_unregister_devices() instead of ide_unregister()
  and ide_port_scan() instead of ide_register_hw() in media_bay_step().

* Unexport ide_register_hw() and make it static.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
 drivers/ide/ide-probe.c        |   18 ++++++++++++++++++
 drivers/ide/ide.c              |   22 ++++++++++++++++------
 drivers/ide/ppc/pmac.c         |    3 ++-
 drivers/macintosh/mediabay.c   |   17 +++++++----------
 include/asm-powerpc/mediabay.h |    4 +++-
 include/linux/ide.h            |    6 ++----
 6 files changed, 48 insertions(+), 22 deletions(-)

Index: b/drivers/ide/ide-probe.c
===================================================================
--- a/drivers/ide/ide-probe.c
+++ b/drivers/ide/ide-probe.c
@@ -1490,3 +1490,21 @@ int ide_device_add(u8 idx[4], const stru
 	return ide_device_add_all(idx_all, d);
 }
 EXPORT_SYMBOL_GPL(ide_device_add);
+
+void ide_port_scan(ide_hwif_t *hwif)
+{
+	ide_port_cable_detect(hwif);
+	ide_port_init_devices(hwif);
+
+	if (ide_probe_port(hwif) < 0)
+		return;
+
+	hwif->present = 1;
+
+	ide_port_tune_devices(hwif);
+	ide_acpi_port_init_devices(hwif);
+	ide_port_setup_devices(hwif);
+	hwif_register_devices(hwif);
+	ide_proc_port_register_devices(hwif);
+}
+EXPORT_SYMBOL_GPL(ide_port_scan);
Index: b/drivers/ide/ide.c
===================================================================
--- a/drivers/ide/ide.c
+++ b/drivers/ide/ide.c
@@ -506,7 +506,7 @@ void ide_remove_port_from_hwgroup(ide_hw
 }
 
 /* Called with ide_lock held. */
-static void ide_port_unregister_devices(ide_hwif_t *hwif)
+static void __ide_port_unregister_devices(ide_hwif_t *hwif)
 {
 	int i;
 
@@ -522,6 +522,18 @@ static void ide_port_unregister_devices(
 	}
 }
 
+void ide_port_unregister_devices(ide_hwif_t *hwif)
+{
+	mutex_lock(&ide_cfg_mtx);
+	spin_lock_irq(&ide_lock);
+	__ide_port_unregister_devices(hwif);
+	hwif->present = 0;
+	ide_port_init_devices_data(hwif);
+	spin_unlock_irq(&ide_lock);
+	mutex_unlock(&ide_cfg_mtx);
+}
+EXPORT_SYMBOL_GPL(ide_port_unregister_devices);
+
 /**
  *	ide_unregister		-	free an IDE interface
  *	@index: index of interface (will change soon to a pointer)
@@ -562,7 +574,7 @@ void ide_unregister(unsigned int index, 
 	hwif = &ide_hwifs[index];
 	if (!hwif->present)
 		goto abort;
-	ide_port_unregister_devices(hwif);
+	__ide_port_unregister_devices(hwif);
 	hwif->present = 0;
 
 	spin_unlock_irq(&ide_lock);
@@ -657,8 +669,8 @@ EXPORT_SYMBOL_GPL(ide_init_port_hw);
  *	Returns -1 on error.
  */
 
-int ide_register_hw(hw_regs_t *hw, void (*quirkproc)(ide_drive_t *),
-		    ide_hwif_t **hwifp)
+static int ide_register_hw(hw_regs_t *hw, void (*quirkproc)(ide_drive_t *),
+			   ide_hwif_t **hwifp)
 {
 	int index, retry = 1;
 	ide_hwif_t *hwif;
@@ -692,8 +704,6 @@ found:
 	return hwif->present ? index : -1;
 }
 
-EXPORT_SYMBOL(ide_register_hw);
-
 /*
  *	Locks for IDE setting functionality
  */
Index: b/drivers/ide/ppc/pmac.c
===================================================================
--- a/drivers/ide/ppc/pmac.c
+++ b/drivers/ide/ppc/pmac.c
@@ -1088,7 +1088,8 @@ pmac_ide_setup_device(pmac_ide_hwif_t *p
 	if (np->parent && np->parent->name
 	    && strcasecmp(np->parent->name, "media-bay") == 0) {
 #ifdef CONFIG_PMAC_MEDIABAY
-		media_bay_set_ide_infos(np->parent, pmif->regbase, pmif->irq, hwif->index);
+		media_bay_set_ide_infos(np->parent, pmif->regbase, pmif->irq,
+					hwif);
 #endif /* CONFIG_PMAC_MEDIABAY */
 		pmif->mediabay = 1;
 		if (!bidp)
Index: b/drivers/macintosh/mediabay.c
===================================================================
--- a/drivers/macintosh/mediabay.c
+++ b/drivers/macintosh/mediabay.c
@@ -79,6 +79,7 @@ struct media_bay_info {
 	int				sleeping;
 	struct semaphore		lock;
 #ifdef CONFIG_BLK_DEV_IDE_PMAC
+	ide_hwif_t			*cd_port;
 	void __iomem			*cd_base;
 	int				cd_irq;
 	int				cd_retry;
@@ -450,7 +451,7 @@ int check_media_bay_by_base(unsigned lon
 }
 
 int media_bay_set_ide_infos(struct device_node* which_bay, unsigned long base,
-			    int irq, int index)
+			    int irq, ide_hwif_t *hwif)
 {
 	int	i;
 
@@ -458,10 +459,11 @@ int media_bay_set_ide_infos(struct devic
 		struct media_bay_info* bay = &media_bays[i];
 
 		if (bay->mdev && which_bay == bay->mdev->ofdev.node) {
-			int timeout = 5000;
+			int timeout = 5000, index = hwif->index;
 			
 			down(&bay->lock);
 
+			bay->cd_port	= hwif;
  			bay->cd_base	= (void __iomem *) base;
 			bay->cd_irq	= irq;
 
@@ -553,15 +555,10 @@ static void media_bay_step(int i)
 			bay->timer = 0;
 			bay->state = mb_up;
 			if (bay->cd_index < 0) {
-				hw_regs_t hw;
-
 				printk("mediabay %d, registering IDE...\n", i);
 				pmu_suspend();
-				ide_init_hwif_ports(&hw, (unsigned long) bay->cd_base, (unsigned long) 0, NULL);
-				hw.irq = bay->cd_irq;
-				hw.chipset = ide_pmac;
-				bay->cd_index =
-					ide_register_hw(&hw, NULL, NULL);
+				ide_port_scan(bay->cd_port);
+				bay->cd_index = bay->cd_port->index;
 				pmu_resume();
 			}
 			if (bay->cd_index == -1) {
@@ -591,7 +588,7 @@ static void media_bay_step(int i)
     	        if (bay->cd_index >= 0) {
 			printk(KERN_DEBUG "Unregistering mb %d ide, index:%d\n", i,
 			       bay->cd_index);
-			ide_unregister(bay->cd_index, 1, 1);
+			ide_port_unregister_devices(bay->cd_port);
 			bay->cd_index = -1;
 		}
 	    	if (bay->cd_retry) {
Index: b/include/asm-powerpc/mediabay.h
===================================================================
--- a/include/asm-powerpc/mediabay.h
+++ b/include/asm-powerpc/mediabay.h
@@ -22,10 +22,12 @@ int check_media_bay(struct device_node *
 /* Number of bays in the machine or 0 */
 extern int media_bay_count;
 
+#ifdef CONFIG_BLK_DEV_IDE_PMAC
 int check_media_bay_by_base(unsigned long base, int what);
 /* called by IDE PMAC host driver to register IDE controller for media bay */
 int media_bay_set_ide_infos(struct device_node *which_bay, unsigned long base,
-			    int irq, int index);
+			    int irq, ide_hwif_t *hwif);
+#endif
 
 #endif /* __KERNEL__ */
 #endif /* _PPC_MEDIABAY_H */
Index: b/include/linux/ide.h
===================================================================
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -189,10 +189,6 @@ struct hwif_s * ide_find_port(unsigned l
 void ide_init_port_data(struct hwif_s *, unsigned int);
 void ide_init_port_hw(struct hwif_s *, hw_regs_t *);
 
-struct ide_drive_s;
-int ide_register_hw(hw_regs_t *, void (*)(struct ide_drive_s *),
-		    struct hwif_s **);
-
 static inline void ide_std_init_ports(hw_regs_t *hw,
 				      unsigned long io_addr,
 				      unsigned long ctl_addr)
@@ -1202,6 +1198,8 @@ void ide_undecoded_slave(ide_drive_t *);
 
 int ide_device_add_all(u8 *idx, const struct ide_port_info *);
 int ide_device_add(u8 idx[4], const struct ide_port_info *);
+void ide_port_unregister_devices(ide_hwif_t *);
+void ide_port_scan(ide_hwif_t *);
 
 static inline void *ide_get_hwifdata (ide_hwif_t * hwif)
 {

^ permalink raw reply

* [PATCH 08/18] ide: move ide_port_setup_devices() call to ide_device_add_all()
From: Bartlomiej Zolnierkiewicz @ 2008-02-08  0:45 UTC (permalink / raw)
  To: linux-ide; +Cc: linuxppc-dev, linux-kernel, Bartlomiej Zolnierkiewicz
In-Reply-To: <20080208004421.17746.32557.sendpatchset@localhost.localdomain>

Add ide_cfg_mtx lock/unlock to ide_port_setup_devices() and then move
ide_port_setup_devices() call from init_irq() to ide_device_add_all().

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
 drivers/ide/ide-probe.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Index: b/drivers/ide/ide-probe.c
===================================================================
--- a/drivers/ide/ide-probe.c
+++ b/drivers/ide/ide-probe.c
@@ -947,6 +947,7 @@ static void ide_port_setup_devices(ide_h
 {
 	int i;
 
+	mutex_lock(&ide_cfg_mtx);
 	for (i = 0; i < MAX_DRIVES; i++) {
 		ide_drive_t *drive = &hwif->drives[i];
 
@@ -961,6 +962,7 @@ static void ide_port_setup_devices(ide_h
 
 		ide_add_drive_to_hwgroup(drive);
 	}
+	mutex_unlock(&ide_cfg_mtx);
 }
 
 /*
@@ -1086,8 +1088,6 @@ static int init_irq (ide_hwif_t *hwif)
 			hwif->sharing_irq ? "shar" : "serializ", match->name);
 	printk("\n");
 
-	ide_port_setup_devices(hwif);
-
 	mutex_unlock(&ide_cfg_mtx);
 	return 0;
 out_unlink:
@@ -1443,6 +1443,8 @@ int ide_device_add_all(u8 *idx, const st
 			continue;
 		}
 
+		ide_port_setup_devices(hwif);
+
 		ide_acpi_init(hwif);
 		ide_acpi_port_init_devices(hwif);
 	}

^ permalink raw reply

* [PATCH 07/18] ide: factor out devices init from ide_init_port_data()
From: Bartlomiej Zolnierkiewicz @ 2008-02-08  0:45 UTC (permalink / raw)
  To: linux-ide; +Cc: linuxppc-dev, linux-kernel, Bartlomiej Zolnierkiewicz
In-Reply-To: <20080208004421.17746.32557.sendpatchset@localhost.localdomain>

* Factor out devices init from ide_init_port_data() to
  ide_port_init_devices_data().

While at it:

* Add explicit clearing of IDE device structure.

There should be no functionality changes caused by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
 drivers/ide/ide.c |   23 +++++++++++++++++------
 1 file changed, 17 insertions(+), 6 deletions(-)

Index: b/drivers/ide/ide.c
===================================================================
--- a/drivers/ide/ide.c
+++ b/drivers/ide/ide.c
@@ -109,13 +109,13 @@ ide_hwif_t ide_hwifs[MAX_HWIFS];	/* mast
 
 EXPORT_SYMBOL(ide_hwifs);
 
+static void ide_port_init_devices_data(ide_hwif_t *);
+
 /*
  * Do not even *think* about calling this!
  */
 void ide_init_port_data(ide_hwif_t *hwif, unsigned int index)
 {
-	unsigned int unit;
-
 	/* bulk initialize hwif & drive info with zeros */
 	memset(hwif, 0, sizeof(ide_hwif_t));
 
@@ -134,8 +134,20 @@ void ide_init_port_data(ide_hwif_t *hwif
 
 	default_hwif_iops(hwif);
 	default_hwif_transport(hwif);
+
+	ide_port_init_devices_data(hwif);
+}
+EXPORT_SYMBOL_GPL(ide_init_port_data);
+
+static void ide_port_init_devices_data(ide_hwif_t *hwif)
+{
+	int unit;
+
 	for (unit = 0; unit < MAX_DRIVES; ++unit) {
 		ide_drive_t *drive = &hwif->drives[unit];
+		u8 j = (hwif->index * MAX_DRIVES) + unit;
+
+		memset(drive, 0, sizeof(*drive));
 
 		drive->media			= ide_disk;
 		drive->select.all		= (unit<<4)|0xa0;
@@ -147,15 +159,14 @@ void ide_init_port_data(ide_hwif_t *hwif
 		drive->special.b.set_geometry	= 1;
 		drive->name[0]			= 'h';
 		drive->name[1]			= 'd';
-		drive->name[2]			= 'a' + (index * MAX_DRIVES) + unit;
+		drive->name[2]			= 'a' + j;
 		drive->max_failures		= IDE_DEFAULT_MAX_FAILURES;
-		drive->using_dma		= 0;
-		drive->vdma			= 0;
+
 		INIT_LIST_HEAD(&drive->list);
 		init_completion(&drive->gendev_rel_comp);
 	}
 }
-EXPORT_SYMBOL_GPL(ide_init_port_data);
+
 
 static void init_hwif_default(ide_hwif_t *hwif, unsigned int index)
 {

^ permalink raw reply

* [PATCH 06/18] ide: factor out code unregistering devices from ide_unregister()
From: Bartlomiej Zolnierkiewicz @ 2008-02-08  0:45 UTC (permalink / raw)
  To: linux-ide; +Cc: linuxppc-dev, linux-kernel, Bartlomiej Zolnierkiewicz
In-Reply-To: <20080208004421.17746.32557.sendpatchset@localhost.localdomain>

Factor out code unregistering devices from ide_unregister() to
ide_port_unregister_devices().

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
 drivers/ide/ide.c |   30 +++++++++++++++++++-----------
 1 file changed, 19 insertions(+), 11 deletions(-)

Index: b/drivers/ide/ide.c
===================================================================
--- a/drivers/ide/ide.c
+++ b/drivers/ide/ide.c
@@ -494,6 +494,23 @@ void ide_remove_port_from_hwgroup(ide_hw
 	spin_unlock_irq(&ide_lock);
 }
 
+/* Called with ide_lock held. */
+static void ide_port_unregister_devices(ide_hwif_t *hwif)
+{
+	int i;
+
+	for (i = 0; i < MAX_DRIVES; i++) {
+		ide_drive_t *drive = &hwif->drives[i];
+
+		if (drive->present) {
+			spin_unlock_irq(&ide_lock);
+			device_unregister(&drive->gendev);
+			wait_for_completion(&drive->gendev_rel_comp);
+			spin_lock_irq(&ide_lock);
+		}
+	}
+}
+
 /**
  *	ide_unregister		-	free an IDE interface
  *	@index: index of interface (will change soon to a pointer)
@@ -520,11 +537,10 @@ void ide_remove_port_from_hwgroup(ide_hw
 
 void ide_unregister(unsigned int index, int init_default, int restore)
 {
-	ide_drive_t *drive;
 	ide_hwif_t *hwif, *g;
 	static ide_hwif_t tmp_hwif; /* protected by ide_cfg_mtx */
 	ide_hwgroup_t *hwgroup;
-	int irq_count = 0, unit;
+	int irq_count = 0;
 
 	BUG_ON(index >= MAX_HWIFS);
 
@@ -535,15 +551,7 @@ void ide_unregister(unsigned int index, 
 	hwif = &ide_hwifs[index];
 	if (!hwif->present)
 		goto abort;
-	for (unit = 0; unit < MAX_DRIVES; ++unit) {
-		drive = &hwif->drives[unit];
-		if (!drive->present)
-			continue;
-		spin_unlock_irq(&ide_lock);
-		device_unregister(&drive->gendev);
-		wait_for_completion(&drive->gendev_rel_comp);
-		spin_lock_irq(&ide_lock);
-	}
+	ide_port_unregister_devices(hwif);
 	hwif->present = 0;
 
 	spin_unlock_irq(&ide_lock);

^ permalink raw reply

* [PATCH 05/18] ide: factor out cable detection from ide_init_port()
From: Bartlomiej Zolnierkiewicz @ 2008-02-08  0:44 UTC (permalink / raw)
  To: linux-ide; +Cc: linuxppc-dev, linux-kernel, Bartlomiej Zolnierkiewicz
In-Reply-To: <20080208004421.17746.32557.sendpatchset@localhost.localdomain>

* Factor out cable detection from ide_init_port() to ide_port_cable_detect().

* Move ide_port_cable_detect() call to ide_device_add_all().

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
 drivers/ide/ide-probe.c |    4 ++++
 1 file changed, 4 insertions(+)

Index: b/drivers/ide/ide-probe.c
===================================================================
--- a/drivers/ide/ide-probe.c
+++ b/drivers/ide/ide-probe.c
@@ -1364,7 +1364,10 @@ static void ide_init_port(ide_hwif_t *hw
 	/* call chipset specific routine for each enabled port */
 	if (d->init_hwif)
 		d->init_hwif(hwif);
+}
 
+static void ide_port_cable_detect(ide_hwif_t *hwif)
+{
 	if (hwif->cable_detect && (hwif->ultra_mask & 0x78)) {
 		if (hwif->cbl != ATA_CBL_PATA40_SHORT)
 			hwif->cbl = hwif->cable_detect(hwif);
@@ -1392,6 +1395,7 @@ int ide_device_add_all(u8 *idx, const st
 		mate = (i & 1) ? NULL : hwif;
 
 		ide_init_port(hwif, i & 1, d);
+		ide_port_cable_detect(hwif);
 		ide_port_init_devices(hwif);
 	}
 

^ permalink raw reply

* [PATCH 04/18] ide-acpi: add missing drive->acpidata zeroing
From: Bartlomiej Zolnierkiewicz @ 2008-02-08  0:44 UTC (permalink / raw)
  To: linux-ide; +Cc: linuxppc-dev, linux-kernel, Bartlomiej Zolnierkiewicz
In-Reply-To: <20080208004421.17746.32557.sendpatchset@localhost.localdomain>

There should be no functionality changes caused by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
 drivers/ide/ide-acpi.c |    2 ++
 1 file changed, 2 insertions(+)

Index: b/drivers/ide/ide-acpi.c
===================================================================
--- a/drivers/ide/ide-acpi.c
+++ b/drivers/ide/ide-acpi.c
@@ -710,6 +710,8 @@ void ide_acpi_port_init_devices(ide_hwif
 	for (i = 0; i < MAX_DRIVES; i++) {
 		drive = &hwif->drives[i];
 
+		memset(drive->acpidata, 0, sizeof(*drive->acpidata));
+
 		if (!drive->present)
 			continue;
 

^ permalink raw reply

* [PATCH 03/18] ide: use ide_find_port() instead of ide_deprecated_find_port()
From: Bartlomiej Zolnierkiewicz @ 2008-02-08  0:44 UTC (permalink / raw)
  To: linux-ide; +Cc: linuxppc-dev, linux-kernel, Bartlomiej Zolnierkiewicz
In-Reply-To: <20080208004421.17746.32557.sendpatchset@localhost.localdomain>

* Use ide_find_port() instead of ide_deprecated_find_port() in bast-ide/
  palm_bk3710/ide-cs/delkin_cb host drivers and in ide_register_hw().

* Remove no longer needed ide_deprecated_find_port().

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
 drivers/ide/arm/bast-ide.c    |    2 +-
 drivers/ide/arm/palm_bk3710.c |    2 +-
 drivers/ide/ide.c             |   27 +--------------------------
 drivers/ide/legacy/ide-cs.c   |    2 +-
 drivers/ide/pci/delkin_cb.c   |    2 +-
 include/linux/ide.h           |    1 -
 6 files changed, 5 insertions(+), 31 deletions(-)

Index: b/drivers/ide/arm/bast-ide.c
===================================================================
--- a/drivers/ide/arm/bast-ide.c
+++ b/drivers/ide/arm/bast-ide.c
@@ -46,7 +46,7 @@ bastide_register(unsigned int base, unsi
 	hw.io_ports[IDE_CONTROL_OFFSET] = aux + (6 * 0x20);
 	hw.irq = irq;
 
-	hwif = ide_deprecated_find_port(hw.io_ports[IDE_DATA_OFFSET]);
+	hwif = ide_find_port(hw.io_ports[IDE_DATA_OFFSET]);
 	if (hwif == NULL)
 		goto out;
 
Index: b/drivers/ide/arm/palm_bk3710.c
===================================================================
--- a/drivers/ide/arm/palm_bk3710.c
+++ b/drivers/ide/arm/palm_bk3710.c
@@ -378,7 +378,7 @@ static int __devinit palm_bk3710_probe(s
 	hw.irq = irq->start;
 	hw.chipset = ide_palm3710;
 
-	hwif = ide_deprecated_find_port(hw.io_ports[IDE_DATA_OFFSET]);
+	hwif = ide_find_port(hw.io_ports[IDE_DATA_OFFSET]);
 	if (hwif == NULL)
 		goto out;
 
Index: b/drivers/ide/ide.c
===================================================================
--- a/drivers/ide/ide.c
+++ b/drivers/ide/ide.c
@@ -627,31 +627,6 @@ void ide_init_port_hw(ide_hwif_t *hwif, 
 }
 EXPORT_SYMBOL_GPL(ide_init_port_hw);
 
-ide_hwif_t *ide_deprecated_find_port(unsigned long base)
-{
-	ide_hwif_t *hwif;
-	int i;
-
-	for (i = 0; i < MAX_HWIFS; i++) {
-		hwif = &ide_hwifs[i];
-		if (hwif->io_ports[IDE_DATA_OFFSET] == base)
-			goto found;
-	}
-
-	for (i = 0; i < MAX_HWIFS; i++) {
-		hwif = &ide_hwifs[i];
-		if (hwif->hold)
-			continue;
-		if (!hwif->present && hwif->mate == NULL)
-			goto found;
-	}
-
-	hwif = NULL;
-found:
-	return hwif;
-}
-EXPORT_SYMBOL_GPL(ide_deprecated_find_port);
-
 /**
  *	ide_register_hw		-	register IDE interface
  *	@hw: hardware registers
@@ -671,7 +646,7 @@ int ide_register_hw(hw_regs_t *hw, void 
 	u8 idx[4] = { 0xff, 0xff, 0xff, 0xff };
 
 	do {
-		hwif = ide_deprecated_find_port(hw->io_ports[IDE_DATA_OFFSET]);
+		hwif = ide_find_port(hw->io_ports[IDE_DATA_OFFSET]);
 		index = hwif->index;
 		if (hwif)
 			goto found;
Index: b/drivers/ide/legacy/ide-cs.c
===================================================================
--- a/drivers/ide/legacy/ide-cs.c
+++ b/drivers/ide/legacy/ide-cs.c
@@ -156,7 +156,7 @@ static int idecs_register(unsigned long 
     hw.chipset = ide_pci;
     hw.dev = &handle->dev;
 
-    hwif = ide_deprecated_find_port(hw.io_ports[IDE_DATA_OFFSET]);
+    hwif = ide_find_port(hw.io_ports[IDE_DATA_OFFSET]);
     if (hwif == NULL)
 	return -1;
 
Index: b/drivers/ide/pci/delkin_cb.c
===================================================================
--- a/drivers/ide/pci/delkin_cb.c
+++ b/drivers/ide/pci/delkin_cb.c
@@ -78,7 +78,7 @@ delkin_cb_probe (struct pci_dev *dev, co
 	hw.irq = dev->irq;
 	hw.chipset = ide_pci;		/* this enables IRQ sharing */
 
-	hwif = ide_deprecated_find_port(hw.io_ports[IDE_DATA_OFFSET]);
+	hwif = ide_find_port(hw.io_ports[IDE_DATA_OFFSET]);
 	if (hwif == NULL)
 		goto out_disable;
 
Index: b/include/linux/ide.h
===================================================================
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -186,7 +186,6 @@ typedef struct hw_regs_s {
 } hw_regs_t;
 
 struct hwif_s * ide_find_port(unsigned long);
-struct hwif_s *ide_deprecated_find_port(unsigned long);
 void ide_init_port_data(struct hwif_s *, unsigned int);
 void ide_init_port_hw(struct hwif_s *, hw_regs_t *);
 

^ permalink raw reply

* [PATCH 02/18] ide: fix ide_find_port()
From: Bartlomiej Zolnierkiewicz @ 2008-02-08  0:44 UTC (permalink / raw)
  To: linux-ide; +Cc: linuxppc-dev, linux-kernel, Bartlomiej Zolnierkiewicz
In-Reply-To: <20080208004421.17746.32557.sendpatchset@localhost.localdomain>

* Instead of checking for '->io_ports[IDE_DATA_OFFSET] == 0' check for
  '->chipset == ide_unknown' when looking for an empty ide_hwifs[] slot.

* Do ide-pnp initialization after ide-generic when IDE is built-in
  (ide-pnp is the only user of ide_find_port() which needs such fixup).

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
 drivers/ide/Makefile |    2 +-
 drivers/ide/ide.c    |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

Index: b/drivers/ide/Makefile
===================================================================
--- a/drivers/ide/Makefile
+++ b/drivers/ide/Makefile
@@ -36,9 +36,9 @@ ifeq ($(CONFIG_BLK_DEV_CMD640), y)
 endif
 
 obj-$(CONFIG_BLK_DEV_IDE)		+= cris/ ppc/
-obj-$(CONFIG_BLK_DEV_IDEPNP)		+= ide-pnp.o
 obj-$(CONFIG_IDE_H8300)			+= h8300/
 obj-$(CONFIG_IDE_GENERIC)		+= ide-generic.o
+obj-$(CONFIG_BLK_DEV_IDEPNP)		+= ide-pnp.o
 
 ide-cd_mod-y += ide-cd.o ide-cd_ioctl.o ide-cd_verbose.o
 
Index: b/drivers/ide/ide.c
===================================================================
--- a/drivers/ide/ide.c
+++ b/drivers/ide/ide.c
@@ -259,7 +259,7 @@ ide_hwif_t * ide_find_port(unsigned long
 
 	for (i = 0; i < MAX_HWIFS; i++) {
 		hwif = &ide_hwifs[i];
-		if (hwif->io_ports[IDE_DATA_OFFSET] == 0)
+		if (hwif->chipset == ide_unknown)
 			goto found;
 	}
 

^ permalink raw reply

* [PATCH 01/18] ide-generic: set hwif->chipset
From: Bartlomiej Zolnierkiewicz @ 2008-02-08  0:44 UTC (permalink / raw)
  To: linux-ide; +Cc: linuxppc-dev, linux-kernel, Bartlomiej Zolnierkiewicz
In-Reply-To: <20080208004421.17746.32557.sendpatchset@localhost.localdomain>

This hwif->chipset fixup is already present in ide_device_add_all()
but for warm-plug support we also need to reserve not currently present
interfaces.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
 drivers/ide/ide-generic.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Index: b/drivers/ide/ide-generic.c
===================================================================
--- a/drivers/ide/ide-generic.c
+++ b/drivers/ide/ide-generic.c
@@ -23,7 +23,9 @@ static int __init ide_generic_init(void)
 	for (i = 0; i < MAX_HWIFS; i++) {
 		ide_hwif_t *hwif = &ide_hwifs[i];
 
-		if (hwif->io_ports[IDE_DATA_OFFSET] && !hwif->present)
+		if (hwif->io_ports[IDE_DATA_OFFSET] &&
+		    (hwif->chipset == ide_unknown ||
+		     hwif->chipset == ide_forced))
 			idx[i] = i;
 		else
 			idx[i] = 0xff;

^ permalink raw reply

* [PATCH 00/18] ide: warm-plug support for IDE devices and other goodies
From: Bartlomiej Zolnierkiewicz @ 2008-02-08  0:44 UTC (permalink / raw)
  To: linux-ide; +Cc: linuxppc-dev, linux-kernel, Bartlomiej Zolnierkiewicz


- couple of fixes and preparatory patches

- rework of PowerMac media-bay support ([un]register IDE devices instead of
  [un]registering IDE interface) [ it is the main reason for spamming PPC ML ]

- IDE warm-plug support (though it is still experimental it should work fine,
  unlike the older method), to warm-plug devices on a port 'idex':

  # echo -n "1" > /sys/class/ide_port/idex/delete_devices

  unplug old device(s) and plug new device(s)

  # echo -n "1" > /sys/class/ide_port/idex/scan

  done

- ability to add new interfaces for ide-generic host driver through
  /sys/class/ide_generic/add, i.e.

  echo -n "0x168:0x36e:10" > /sys/class/ide_generic/add

- because of the above changes some obsoleted/broken code can be removed
  (thus the total effect of the patch series is -100 LOC)


diffstat:
 Documentation/ide.txt                 |   31 --
 Documentation/ide/warm-plug-howto.txt |   13 +
 block/compat_ioctl.c                  |    1 
 drivers/ide/Kconfig                   |   25 --
 drivers/ide/Makefile                  |    2 
 drivers/ide/arm/bast-ide.c            |    4 
 drivers/ide/arm/palm_bk3710.c         |    2 
 drivers/ide/arm/rapide.c              |    2 
 drivers/ide/ide-acpi.c                |    2 
 drivers/ide/ide-generic.c             |   85 +++++++
 drivers/ide/ide-pnp.c                 |    2 
 drivers/ide/ide-probe.c               |  108 ++++++++-
 drivers/ide/ide-proc.c                |    3 
 drivers/ide/ide.c                     |  386 ++++++++--------------------------
 drivers/ide/legacy/ide-cs.c           |    6 
 drivers/ide/legacy/ide_platform.c     |    2 
 drivers/ide/mips/au1xxx-ide.c         |    5 
 drivers/ide/pci/cmd640.c              |    2 
 drivers/ide/pci/delkin_cb.c           |    6 
 drivers/ide/pci/scc_pata.c            |    2 
 drivers/ide/ppc/pmac.c                |    4 
 drivers/ide/setup-pci.c               |   11 
 drivers/macintosh/mediabay.c          |   17 -
 include/asm-powerpc/mediabay.h        |    4 
 include/linux/hdreg.h                 |    4 
 include/linux/ide.h                   |   51 ----
 26 files changed, 339 insertions(+), 441 deletions(-)

^ permalink raw reply

* Re: [libfdt] RFC: Node iterators (v2)
From: Scott Wood @ 2008-02-07 23:34 UTC (permalink / raw)
  To: Scott Wood, jdl, linuxppc-dev
In-Reply-To: <20080117051009.GA12239@localhost.localdomain>

David Gibson wrote:
> And here's a revised version.  This now also handles recursive
> iteration and iteration across nodes without respect to depth.  I've
> removed the for_each() macros for the time being, because they were
> making my brain hurt, but I'm still contemplating bringing them back.
> Several libfdt functions are now implemented using the new iterator,
> so this ends up as a code-size-reducing patch.
> 
> I'm pretty happy with the basic outline of this now, although the
> names and details might want a bit of polish still.

Can we get this merged?

> +int _fdt_next_node(const void *fdt, int offset, int *depth)
> +{

This is a public function; why the underscore?

-Scott

^ permalink raw reply

* Re: [PATCH] Fix compilation of powerpc asm-offsets.c with old gcc
From: Linus Torvalds @ 2008-02-07 22:53 UTC (permalink / raw)
  To: Paul Mackerras; +Cc: linuxppc-dev, akpm, tglx, linux-kernel
In-Reply-To: <18347.34100.60973.215093@cargo.ozlabs.ibm.com>



On Fri, 8 Feb 2008, Paul Mackerras wrote:
>
> From: Tony Breeds <tony@bakeyournoodle.com>
> 
> Commit ad7f71674ad7c3c4467e48f6ab9e85516dae2720 corrected the clock
> ..

Please, when mentioning hex numbers, also do the one-liner shortlog.

I realize that in gitk (or even just with two terminal windows open and a 
git repository) it's trivial to just follow the link and see what that 
commit was, but even you're just doing a "git log" or more commonly if you 
read the commit log somewhere else (like a mail gateway that posts them 
automatically when I apply things), it's really much more readable if you 
were to say something like:

  Commit ad7f71674ad7c3c4467e48f6ab9e85516dae2720 ("[POWERPC] Use a 
  sensible default for clock_getres() in the VDSO") corrected the clock
  ...

which reads much mroe naturally without having to go wonder what that 
commit was doing. No?

As it is, I'm pretty used to editing those things in (I do it all the 
time), and I will do so for this email too, but I want to keep bringing 
this up so that I hopfully wouldn't have to do it so often. So please 
write your commit messages with the specific git information available, 
but without _requiring_ people to be git users to get the gist of the 
matter, ok?

			Linus

^ permalink raw reply

* [PATCH] Fix compilation of powerpc asm-offsets.c with old gcc
From: Paul Mackerras @ 2008-02-07 22:24 UTC (permalink / raw)
  To: torvalds, akpm, tglx; +Cc: linuxppc-dev, linux-kernel

From: Tony Breeds <tony@bakeyournoodle.com>

Commit ad7f71674ad7c3c4467e48f6ab9e85516dae2720 corrected the clock
resolution reported by the VDSO clock_getres() but introduced another
problem in that older versions of gcc (gcc-4.0 and earlier) fail to
compile the new code in arch/powerpc/kernel/asm-offsets.c.

This fixes it by introducing a new MONOTONIC_RES_NSEC define in the
generic code which is equivalent to KTIME_MONOTONIC_RES but is just an
integer constant, not a ktime union.

Signed-off-by: Tony Breeds <tony@bakeyournoodle.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
---

Linus, I'm sending you this as a patch since it touches generic code.
Please apply, since mainline is broken for powerpc users who are using
gcc-4.0 or earlier.

diff --git a/arch/powerpc/kernel/asm-offsets.c b/arch/powerpc/kernel/asm-offsets.c
index e6e4928..4b749c4 100644
--- a/arch/powerpc/kernel/asm-offsets.c
+++ b/arch/powerpc/kernel/asm-offsets.c
@@ -313,7 +313,7 @@ int main(void)
 	DEFINE(CLOCK_REALTIME, CLOCK_REALTIME);
 	DEFINE(CLOCK_MONOTONIC, CLOCK_MONOTONIC);
 	DEFINE(NSEC_PER_SEC, NSEC_PER_SEC);
-	DEFINE(CLOCK_REALTIME_RES, (KTIME_MONOTONIC_RES).tv64);
+	DEFINE(CLOCK_REALTIME_RES, MONOTONIC_RES_NSEC);
 
 #ifdef CONFIG_BUG
 	DEFINE(BUG_ENTRY_SIZE, sizeof(struct bug_entry));
diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h
index 8371b66..203591e 100644
--- a/include/linux/hrtimer.h
+++ b/include/linux/hrtimer.h
@@ -225,11 +225,14 @@ static inline int hrtimer_is_hres_active(struct hrtimer *timer)
  * idea of the (in)accuracy of timers. Timer values are rounded up to
  * this resolution values.
  */
-# define KTIME_HIGH_RES		(ktime_t) { .tv64 = 1 }
+# define HIGH_RES_NSEC		1
+# define KTIME_HIGH_RES		(ktime_t) { .tv64 = HIGH_RES_NSEC }
+# define MONOTONIC_RES_NSEC	HIGH_RES_NSEC
 # define KTIME_MONOTONIC_RES	KTIME_HIGH_RES
 
 #else
 
+# define MONOTONIC_RES_NSEC	LOW_RES_NSEC
 # define KTIME_MONOTONIC_RES	KTIME_LOW_RES
 
 /*
diff --git a/include/linux/ktime.h b/include/linux/ktime.h
index a6ddec1..36c542b 100644
--- a/include/linux/ktime.h
+++ b/include/linux/ktime.h
@@ -316,7 +316,8 @@ static inline ktime_t ktime_sub_us(const ktime_t kt, const u64 usec)
  * idea of the (in)accuracy of timers. Timer values are rounded up to
  * this resolution values.
  */
-#define KTIME_LOW_RES		(ktime_t){ .tv64 = TICK_NSEC }
+#define LOW_RES_NSEC		TICK_NSEC
+#define KTIME_LOW_RES		(ktime_t){ .tv64 = LOW_RES_NSEC }
 
 /* Get the monotonic time in timespec format: */
 extern void ktime_get_ts(struct timespec *ts);

^ permalink raw reply related

* Tip for Kernel 2.6.14 & XUP
From: Joachim Meyer @ 2008-02-07 21:30 UTC (permalink / raw)
  To: linuxppc-embedded

Hi

I want to use the Kernelversion 2.6.14 now, for the XUP
I looked at the secretlab and the xilinx tree, but there were no hints that the 2.6.14er Version supports the XUP.
Am I right?
A Tip what I should do

PS: I want to use 2.6.14 because thats the latest Kernel which seems to be supported for PowerPC's from rtai

THX & Greez
Joachim
_____________________________________________________________________
Der WEB.DE SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen!
http://smartsurfer.web.de/?mc=100071&distributionid=000000000066

^ permalink raw reply

* Re: asm-offsets.c
From: Sean MacLennan @ 2008-02-07 20:24 UTC (permalink / raw)
  To: benh; +Cc: linuxppc-dev, Sean MacLennan
In-Reply-To: <1202373888.7079.124.camel@pasglop>

Benjamin Herrenschmidt wrote:
> On Wed, 2008-02-06 at 23:43 -0500, Sean MacLennan wrote:
>   
>> I just did a git pull of Josh's tree, and 
>> arch/powerpc/kernel/asm-offsets.c does not compile. I have only been 
>> glossing over the linuxppc-dev emails, so forgive me if this already 
>> came up.
>>
>> It looks like, at least for the Warp, CLOCK_REALTIME_RES is not defined 
>> so asm-offsets.c gets an error. The following patch fixes it.... but I 
>> am not sure it is right since I don't know if CLOCK_REALTIME_RES should 
>> be defined.
>>     
>
> Hrm... this macro should -define- CLOCK_REALTIME_RES, not rely on an
> existing definition...
>   
If I comment out CLOCK_REALTIME in include/linux/time.h then I fail:

  CC      arch/powerpc/kernel/asm-offsets.s
arch/powerpc/kernel/asm-offsets.c: In function 'main':
arch/powerpc/kernel/asm-offsets.c:313: error: 'CLOCK_REALTIME' undeclared (first use in this function)
arch/powerpc/kernel/asm-offsets.c:313: error: (Each undeclared identifier is reported only once
arch/powerpc/kernel/asm-offsets.c:313: error: for each function it appears in.)
make[1]: *** [arch/powerpc/kernel/asm-offsets.s] Error 1
make: *** [prepare0] Error 2
make: Leaving directory `/home/seanm/taco/for-2.6.25'


It looks like the first arg must be defined?

Cheers,
   Sean

^ permalink raw reply

* Re: asm-offsets.c
From: Christoph Hellwig @ 2008-02-07 19:01 UTC (permalink / raw)
  To: Sean MacLennan; +Cc: linuxppc-dev
In-Reply-To: <47AA8C7D.3030109@pikatech.com>

On Wed, Feb 06, 2008 at 11:43:41PM -0500, Sean MacLennan wrote:
> I just did a git pull of Josh's tree, and 
> arch/powerpc/kernel/asm-offsets.c does not compile. I have only been 
> glossing over the linuxppc-dev emails, so forgive me if this already 
> came up.
> 
> It looks like, at least for the Warp, CLOCK_REALTIME_RES is not defined 
> so asm-offsets.c gets an error. The following patch fixes it.... but I 
> am not sure it is right since I don't know if CLOCK_REALTIME_RES should 
> be defined.

The breakage is now in mainline aswell.

^ permalink raw reply

* [PATCH] cuboot-pq2: PCI fixes
From: Scott Wood @ 2008-02-07 18:01 UTC (permalink / raw)
  To: galak; +Cc: linuxppc-dev

1. Detect (and bail out on) more conditions that violate the
assumptions of the setup code -- we assume in such cases that the device
tree is correct and reflects what the firmware did.

2. The inbound memory mask calculation was wrong.

Signed-off-by: Scott Wood <scottwood@freescale.com>
---
 arch/powerpc/boot/cuboot-pq2.c |   27 +++++++++++++++++++--------
 1 files changed, 19 insertions(+), 8 deletions(-)

diff --git a/arch/powerpc/boot/cuboot-pq2.c b/arch/powerpc/boot/cuboot-pq2.c
index f56ac6c..9c7d134 100644
--- a/arch/powerpc/boot/cuboot-pq2.c
+++ b/arch/powerpc/boot/cuboot-pq2.c
@@ -128,7 +128,7 @@ static void fixup_pci(void)
 	u8 *soc_regs;
 	int i, len;
 	void *node, *parent_node;
-	u32 naddr, nsize, mem_log2;
+	u32 naddr, nsize, mem_pow2, mem_mask;
 
 	node = finddevice("/pci");
 	if (!node || !dt_is_compatible(node, "fsl,pq2-pci"))
@@ -141,7 +141,7 @@ static void fixup_pci(void)
 
 	soc_regs = (u8 *)fsl_get_immr();
 	if (!soc_regs)
-		goto err;
+		goto unhandled;
 
 	dt_get_reg_format(node, &naddr, &nsize);
 	if (naddr != 3 || nsize != 2)
@@ -153,7 +153,7 @@ static void fixup_pci(void)
 
 	dt_get_reg_format(parent_node, &naddr, &nsize);
 	if (naddr != 1 || nsize != 1)
-		goto err;
+		goto unhandled;
 
 	len = getprop(node, "ranges", pci_ranges_buf,
 	              sizeof(pci_ranges_buf));
@@ -170,14 +170,20 @@ static void fixup_pci(void)
 	}
 
 	if (!mem || !mmio || !io)
-		goto err;
+		goto unhandled;
+	if (mem->size[1] != mmio->size[1])
+		goto unhandled;
+	if (mem->size[1] & (mem->size[1] - 1))
+		goto unhandled;
+	if (io->size[1] & (io->size[1] - 1))
+		goto unhandled;
 
 	if (mem->phys_addr + mem->size[1] == mmio->phys_addr)
 		mem_base = mem;
 	else if (mmio->phys_addr + mmio->size[1] == mem->phys_addr)
 		mem_base = mmio;
 	else
-		goto err;
+		goto unhandled;
 
 	out_be32(&pci_regs[1][0], mem_base->phys_addr | 1);
 	out_be32(&pci_regs[2][0], ~(mem->size[1] + mmio->size[1] - 1));
@@ -201,8 +207,9 @@ static void fixup_pci(void)
 	out_le32(&pci_regs[0][58], 0);
 	out_le32(&pci_regs[0][60], 0);
 
-	mem_log2 = 1 << (__ilog2_u32(bd.bi_memsize - 1) + 1);
-	out_le32(&pci_regs[0][62], 0xa0000000 | ~((1 << (mem_log2 - 12)) - 1));
+	mem_pow2 = 1 << (__ilog2_u32(bd.bi_memsize - 1) + 1);
+	mem_mask = ~(mem_pow2 - 1) >> 12;
+	out_le32(&pci_regs[0][62], 0xa0000000 | mem_mask);
 
 	/* If PCI is disabled, drive RST high to enable. */
 	if (!(in_le32(&pci_regs[0][32]) & 1)) {
@@ -228,7 +235,11 @@ static void fixup_pci(void)
 	return;
 
 err:
-	printf("Bad PCI node\r\n");
+	printf("Bad PCI node -- using existing firmware setup.\r\n");
+	return;
+
+unhandled:
+	printf("Unsupported PCI node -- using existing firmware setup.\r\n");
 }
 
 static void pq2_platform_fixups(void)
-- 
1.5.3.8

^ permalink raw reply related

* Re: System Clock runaway on Xilinx platform
From: khollan @ 2008-02-07 16:07 UTC (permalink / raw)
  To: linuxppc-embedded
In-Reply-To: <fa686aa40802061452i78838bb0g87c99d76509c866e@mail.gmail.com>




jozsef imrek wrote:
> 
> 
> kevin, how do you get that 175 MHz PLB?
> 
> it should not matter, since the wall clock is derived from the
> cpu clock, but i suspect that your cpu clock is just twice the
> PLB clock, thus it is not 300 MHz, but 350 MHz. this would explain
> the time drift, as
> 
>         300 s * (350 MHz / 300 MHz) = 350 s   (obviously :)
> 
> so here is the extra 50 secs in every 5 minutes.
> 
> 
> 
> -- 
> mazsi
> 
> 

Thanks to an email by jozef imrek I realized that I'm an idiot.  To get the
CPU clock I multiply the PLB X 2 which is 175MHz X 2 = 350 MHz not 300MHz, I
guess I had a brain fart in calculation.  I changed the xparameters to 350
and it seems to be keeping time, I haven't tested it for very long but it's
doing a lot better than before.  Thanks to him I didn't have to wait 45 min
to rebuild the bit stream and probe the clocks.
Thanks Kevin
-- 
View this message in context: http://www.nabble.com/System-Clock-runaway-on-Xilinx-platform-tp15312437p15337076.html
Sent from the linuxppc-embedded mailing list archive at Nabble.com.

^ permalink raw reply

* Re: [PATCH] MTD support for the AMCC Taishan
From: Valentine Barshak @ 2008-02-07 14:55 UTC (permalink / raw)
  To: Imre Kaloz; +Cc: linuxppc-dev, Stefan Roese
In-Reply-To: <op.t55r5tt22s3iss@ecaz.afh.b-m.hu>

Imre Kaloz wrote:
> On Thu, 07 Feb 2008 15:05:23 +0100, Valentine Barshak 
> <vbarshak@ru.mvista.com> wrote:
> 
>>> Well, arch/ppc calculates the mtd2 dynamically and doesn't create
>>> a separate partition for kozio.
>>
>> That dynamic size calculation depends on the flash size.
>> The board I use has a 64MB NOR flash (I'm not aware of other Taishan 
>> boards having chips of different size). So AFAIU if such board exists, 
>> we'll need a cuboot flash-size fixup.
> 
> 
> All Taishan boards have 64MB flash (2x32MB). Denx was doing the size 
> calculation
> to dynamically allocate mtd2 based on the size of mtd0+mtd1 if I recall 
> right.
>

This is actually the code:
arch/ppc/platforms/4xx/taishan.c:static int taishan_setup_flash(void)
{
taishan_nor_parts[2].size = __res.bi_flashsize -
		RW_PART0_SZ - RW_PART1_SZ - RW_PART3_SZ - RW_PART4_SZ;

Thanks,
Valentine.
> 
> Cheers,
> Imre

^ permalink raw reply

* MPC5200B AC97 support for recent kernel
From: Juergen Beisert @ 2008-02-07 14:51 UTC (permalink / raw)
  To: linuxppc-dev

Hi,

I'm using a 2.6.23 kernel and trying to get the AC97 running on my MPC5200B=
=20
based CPU card. I'm using a patch stack posted here last year. FEC and ATA=
=20
seems running correctly. Also the AC97 seems to run, but I can hear some=20
noise only. But ALSA does detect the external Wolfson codec and its=20
capabilities correctly, so I think the AC97 link works as expected.

Some things I noticed:

 - I can control the volume of the noise with alsamixer
 - the external codes outputs the correct clock (~12 MHz)
 - the MPC5200B AC97 driver receives interrupts from the bestcomm unit (to
   report progress to the pcm framework)
 - everything seems ways too fast. A four minutes mp3 song is ready after
   40 seconds
 - I'm not sure: What type of data wants the AC97 PCS unit? AC97
   data slots are 20 bits wide. int32_t or 24 bits per sample? Big endian?
 - does it use interleave? Left, right, left, right, ... to be fed into AC97
   data slot 3 and 4?

Any ideas?

Juergen

=2D-=20
Dipl.-Ing. Juergen Beisert | http://www.pengutronix.de
=A0Pengutronix - Linux Solutions for Science and Industry
=A0   Handelsregister: Amtsgericht Hildesheim, HRA 2686
=A0 =A0 =A0    Vertretung Sued/Muenchen, Germany
   Phone: +49-8766-939 228 |  Fax: +49-5121-206917-9

^ permalink raw reply

* Re: [PATCH] MTD support for the AMCC Taishan
From: Imre Kaloz @ 2008-02-07 14:35 UTC (permalink / raw)
  To: Valentine Barshak; +Cc: linuxppc-dev, Stefan Roese
In-Reply-To: <47AB1023.9040707@ru.mvista.com>

On Thu, 07 Feb 2008 15:05:23 +0100, Valentine Barshak  
<vbarshak@ru.mvista.com> wrote:

>> Well, arch/ppc calculates the mtd2 dynamically and doesn't create
>> a separate partition for kozio.
>
> That dynamic size calculation depends on the flash size.
> The board I use has a 64MB NOR flash (I'm not aware of other Taishan  
> boards having chips of different size). So AFAIU if such board exists,  
> we'll need a cuboot flash-size fixup.


All Taishan boards have 64MB flash (2x32MB). Denx was doing the size  
calculation
to dynamically allocate mtd2 based on the size of mtd0+mtd1 if I recall  
right.


Cheers,
Imre

^ permalink raw reply

* Re: [PATCH] MTD support for the AMCC Taishan
From: Valentine Barshak @ 2008-02-07 14:05 UTC (permalink / raw)
  To: Imre Kaloz; +Cc: linuxppc-dev, Stefan Roese
In-Reply-To: <op.t55p8elk2s3iss@ecaz.afh.b-m.hu>

Imre Kaloz wrote:
> Well, arch/ppc calculates the mtd2 dynamically and doesn't create
> a separate partition for kozio.

That dynamic size calculation depends on the flash size.
The board I use has a 64MB NOR flash (I'm not aware of other Taishan 
boards having chips of different size). So AFAIU if such board exists, 
we'll need a cuboot flash-size fixup.

Thanks,
Valentine.
> 
> I've based this on how it's currently done for the Sequoia, too.
> 
> 
> Imre
> 
> On Thu, 07 Feb 2008 14:46:43 +0100, Valentine Barshak 
> <vbarshak@ru.mvista.com> wrote:
> 
>> Josh Boyer wrote:
>>> On Thu, 07 Feb 2008 11:29:55 +0100
>>> "Imre Kaloz" <kaloz@openwrt.org> wrote:
>>>
>>>> *bump*? :) If anything is wrong with it, please let me know.
>>
>> The arch/ppc had a bit different partition table.
>> Something like this:
>> mtd0: 00180000 00040000 "kernel"
>> mtd1: 00200000 00040000 "root"
>> mtd2: 03bc0000 00040000 "user"
>> mtd3: 00080000 00040000 "env"
>> mtd4: 00040000 00040000 "u-boot"
>>
>> Thanks,
>> Valentine.
>>
>>>  Nothing wrong that I could see.  I just need to test it first.
>>>  josh
>>> _______________________________________________
>>> Linuxppc-dev mailing list
>>> Linuxppc-dev@ozlabs.org
>>> https://ozlabs.org/mailman/listinfo/linuxppc-dev
>>
> 
> 

^ permalink raw reply

* Re: [PATCH] MTD support for the AMCC Taishan
From: Imre Kaloz @ 2008-02-07 13:54 UTC (permalink / raw)
  To: Valentine Barshak, Josh Boyer; +Cc: linuxppc-dev
In-Reply-To: <47AB0BC3.2000202@ru.mvista.com>

Well, arch/ppc calculates the mtd2 dynamically and doesn't create
a separate partition for kozio.

I've based this on how it's currently done for the Sequoia, too.


Imre

On Thu, 07 Feb 2008 14:46:43 +0100, Valentine Barshak  
<vbarshak@ru.mvista.com> wrote:

> Josh Boyer wrote:
>> On Thu, 07 Feb 2008 11:29:55 +0100
>> "Imre Kaloz" <kaloz@openwrt.org> wrote:
>>
>>> *bump*? :) If anything is wrong with it, please let me know.
>
> The arch/ppc had a bit different partition table.
> Something like this:
> mtd0: 00180000 00040000 "kernel"
> mtd1: 00200000 00040000 "root"
> mtd2: 03bc0000 00040000 "user"
> mtd3: 00080000 00040000 "env"
> mtd4: 00040000 00040000 "u-boot"
>
> Thanks,
> Valentine.
>
>>  Nothing wrong that I could see.  I just need to test it first.
>>  josh
>> _______________________________________________
>> Linuxppc-dev mailing list
>> Linuxppc-dev@ozlabs.org
>> https://ozlabs.org/mailman/listinfo/linuxppc-dev
>

^ permalink raw reply

* Re: [PATCH] MTD support for the AMCC Taishan
From: Valentine Barshak @ 2008-02-07 13:46 UTC (permalink / raw)
  To: Josh Boyer; +Cc: linuxppc-dev
In-Reply-To: <20080207060012.788e4258@zod.rchland.ibm.com>

Josh Boyer wrote:
> On Thu, 07 Feb 2008 11:29:55 +0100
> "Imre Kaloz" <kaloz@openwrt.org> wrote:
> 
>> *bump*? :) If anything is wrong with it, please let me know.

The arch/ppc had a bit different partition table.
Something like this:
mtd0: 00180000 00040000 "kernel"
mtd1: 00200000 00040000 "root"
mtd2: 03bc0000 00040000 "user"
mtd3: 00080000 00040000 "env"
mtd4: 00040000 00040000 "u-boot"

Thanks,
Valentine.

> 
> Nothing wrong that I could see.  I just need to test it first.
> 
> josh
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@ozlabs.org
> https://ozlabs.org/mailman/listinfo/linuxppc-dev

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox