Re: 44x bug: funny TLB writes?

2007-09-20 Thread David Gibson
On Fri, Sep 21, 2007 at 01:38:34AM -0500, Hollis Blanchard wrote:
> On Fri, 2007-09-21 at 15:42 +1000, David Gibson wrote:
> > On Thu, Sep 20, 2007 at 10:34:12PM -0500, Hollis Blanchard wrote:
> > > I seem to have come across a strange bug while doing KVM development. It
> > > seems that the final tlbwe in finish_tlb (head_44x.S) is actually
> > > leaking RPN bits into the "attribute" word.
> > > 
> > > When I set a breakpoint there and press enter on the serial console, I
> > > see r12=ef600703, which is the physical address of the UART on this chip
> > > (440EP), plus the correct permission bits at the bottom.
> > > 
> > > Am I crazy? I'm not really looking to step through that assembly right
> > > now... Clearly (current) hardware is just ignoring these errant writes,
> > > but it should be fixed.
> > 
> > A quick glance at the code suggests this is indeed wrong.  Hurrah.
> > Another reason to rewrite the 44x tlb miss handling.
> 
> Just a quick fix would be fine too... ;)

I suppose.

> I'm just glad it's not a KVM bug, because when I dumped the TLB state
> and saw bizarre values I was getting really worried.
> 
> > PS.  "errant" and "error" are not cognate, even if the chip doc
> > writers think so...
> 
> According to Merriam Webster, errant 2c is "c : behaving wrongly  errant child>", so I'm OK with it.

Good heavens.  No such usage mentioned in the Shorter OED, only as in
"knight errant".  You Americans and your strange language :-p.

-- 
David Gibson| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au  | minimalist, thank you.  NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH v2 2/4] Implement generic time of day clocksource for powerpc machines.

2007-09-20 Thread David Gibson
On Fri, Sep 21, 2007 at 02:59:31PM +1000, Paul Mackerras wrote:
> Daniel Walker writes:
> 
> > I don't think the RTC frequency isn't the same as the timebase? Seems
> > like the RTC only case about seconds at the lowest level. If that's the
> > case then the jiffies clock might be better to use .. The other thing I
> > wonder is if the __USE_RTC boards might have lower level clocks that
> > could be used instead ..
> 
> It's OK, the RTC isn't what you think it is, it's a pair of
> CPU-internal registers which count seconds and nanoseconds.  On
> processors with the RTC, tb_ticks_per_sec is initialized to
> 10.  Trust me, this code is OK. :)

Indeed..  I'm wondering if we should do a s/rtc/ppc601rtc/ or
something.  Otherwise people will keep making this mistake and be
confused.

-- 
David Gibson| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au  | minimalist, thank you.  NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: 44x bug: funny TLB writes?

2007-09-20 Thread Hollis Blanchard
On Fri, 2007-09-21 at 15:42 +1000, David Gibson wrote:
> On Thu, Sep 20, 2007 at 10:34:12PM -0500, Hollis Blanchard wrote:
> > I seem to have come across a strange bug while doing KVM development. It
> > seems that the final tlbwe in finish_tlb (head_44x.S) is actually
> > leaking RPN bits into the "attribute" word.
> > 
> > When I set a breakpoint there and press enter on the serial console, I
> > see r12=ef600703, which is the physical address of the UART on this chip
> > (440EP), plus the correct permission bits at the bottom.
> > 
> > Am I crazy? I'm not really looking to step through that assembly right
> > now... Clearly (current) hardware is just ignoring these errant writes,
> > but it should be fixed.
> 
> A quick glance at the code suggests this is indeed wrong.  Hurrah.
> Another reason to rewrite the 44x tlb miss handling.

Just a quick fix would be fine too... ;)

I'm just glad it's not a KVM bug, because when I dumped the TLB state
and saw bizarre values I was getting really worried.

> PS.  "errant" and "error" are not cognate, even if the chip doc
> writers think so...

According to Merriam Webster, errant 2c is "c : behaving wrongly ", so I'm OK with it.

-- 
Hollis Blanchard
IBM Linux Technology Center

___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: 44x bug: funny TLB writes?

2007-09-20 Thread David Gibson
On Thu, Sep 20, 2007 at 10:34:12PM -0500, Hollis Blanchard wrote:
> I seem to have come across a strange bug while doing KVM development. It
> seems that the final tlbwe in finish_tlb (head_44x.S) is actually
> leaking RPN bits into the "attribute" word.
> 
> When I set a breakpoint there and press enter on the serial console, I
> see r12=ef600703, which is the physical address of the UART on this chip
> (440EP), plus the correct permission bits at the bottom.
> 
> Am I crazy? I'm not really looking to step through that assembly right
> now... Clearly (current) hardware is just ignoring these errant writes,
> but it should be fixed.

A quick glance at the code suggests this is indeed wrong.  Hurrah.
Another reason to rewrite the 44x tlb miss handling.

PS.  "errant" and "error" are not cognate, even if the chip doc
writers think so...

-- 
David Gibson| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au  | minimalist, thank you.  NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH v2 2/4] Implement generic time of day clocksource for powerpc machines.

2007-09-20 Thread Paul Mackerras
Daniel Walker writes:

> I don't think the RTC frequency isn't the same as the timebase? Seems
> like the RTC only case about seconds at the lowest level. If that's the
> case then the jiffies clock might be better to use .. The other thing I
> wonder is if the __USE_RTC boards might have lower level clocks that
> could be used instead ..

It's OK, the RTC isn't what you think it is, it's a pair of
CPU-internal registers which count seconds and nanoseconds.  On
processors with the RTC, tb_ticks_per_sec is initialized to
10.  Trust me, this code is OK. :)

Paul.
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH v2 2/4] Implement generic time of day clocksource for powerpc machines.

2007-09-20 Thread Stephen Rothwell
Small comments.

On Fri, 21 Sep 2007 13:26:02 +1000 Tony Breeds <[EMAIL PROTECTED]> wrote:
>
> +void update_vsyscall(struct timespec *wall_time, struct clocksource *clock)
> +{
> + u64 t2x, stamp_xsec;
> +
> + if (__USE_RTC() || clock != &clocksource_timebase)
^^^
I think this is redundant as if __USE_RTC() is true, you register
clocksource_rtc below.

> +#ifdef CONFIG_ISERIES
> + if (!firmware_has_feature(FW_FEATURE_ISERIES))
> +#endif

The #ifdef is redundant since if CONFIG_ISERIES is not set,
firmware_has_feature(FW_FEATURE_ISERIES) is constant 0.

-- 
Cheers,
Stephen Rothwell[EMAIL PROTECTED]
http://www.canb.auug.org.au/~sfr/


pgpOMZm3Ny9ey.pgp
Description: PGP signature
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev

[PATCH 11/11] [POWERPC] iSeries: move viodasd probing

2007-09-20 Thread Stephen Rothwell
This way we only have entries in the device tree for disks that actually
exist.  A slight complication is that disks may be attached to LPARs
at runtime.

Signed-off-by: Stephen Rothwell <[EMAIL PROTECTED]>
---
 arch/powerpc/platforms/iseries/dt.c  |6 -
 arch/powerpc/platforms/iseries/vio.c |  305 --
 drivers/block/viodasd.c  |   77 +++--
 include/asm-powerpc/iseries/vio.h|   47 +
 4 files changed, 286 insertions(+), 149 deletions(-)

-- 
Cheers,
Stephen Rothwell[EMAIL PROTECTED]

diff --git a/arch/powerpc/platforms/iseries/dt.c 
b/arch/powerpc/platforms/iseries/dt.c
index 2e4ad6b..4543c4b 100644
--- a/arch/powerpc/platforms/iseries/dt.c
+++ b/arch/powerpc/platforms/iseries/dt.c
@@ -72,7 +72,6 @@ static char __initdata device_type_cpu[] = "cpu";
 static char __initdata device_type_memory[] = "memory";
 static char __initdata device_type_serial[] = "serial";
 static char __initdata device_type_network[] = "network";
-static char __initdata device_type_block[] = "block";
 static char __initdata device_type_pci[] = "pci";
 static char __initdata device_type_vdevice[] = "vdevice";
 static char __initdata device_type_vscsi[] = "vscsi";
@@ -374,11 +373,6 @@ static void __init dt_vdevices(struct iseries_flat_dt *dt)
 
dt_end_node(dt);
}
-   reg += HVMAXARCHITECTEDVIRTUALLANS;
-
-   for (i = 0; i < HVMAXARCHITECTEDVIRTUALDISKS; i++)
-   dt_do_vdevice(dt, "viodasd", reg, i, device_type_block,
-   "IBM,iSeries-viodasd", 1);
 
dt_end_node(dt);
 }
diff --git a/arch/powerpc/platforms/iseries/vio.c 
b/arch/powerpc/platforms/iseries/vio.c
index c7d2a83..f52ecb7 100644
--- a/arch/powerpc/platforms/iseries/vio.c
+++ b/arch/powerpc/platforms/iseries/vio.c
@@ -25,8 +25,10 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -57,7 +59,7 @@ struct vio_resource {
charmodel[3];
 };
 
-static struct property * __init new_property(const char *name, int length,
+static struct property *new_property(const char *name, int length,
const void *value)
 {
struct property *np = kzalloc(sizeof(*np) + strlen(name) + 1 + length,
@@ -78,7 +80,7 @@ static void __init free_property(struct property *np)
kfree(np);
 }
 
-static struct device_node * __init new_node(const char *path,
+static struct device_node *new_node(const char *path,
struct device_node *parent)
 {
struct device_node *np = kzalloc(sizeof(*np), GFP_KERNEL);
@@ -97,7 +99,7 @@ static struct device_node * __init new_node(const char *path,
return np;
 }
 
-static void __init free_node(struct device_node *np)
+static void free_node(struct device_node *np)
 {
struct property *next;
struct property *prop;
@@ -113,7 +115,7 @@ static void __init free_node(struct device_node *np)
kfree(np);
 }
 
-static int __init add_string_property(struct device_node *np, const char *name,
+static int add_string_property(struct device_node *np, const char *name,
const char *value)
 {
struct property *nprop = new_property(name, strlen(value) + 1, value);
@@ -124,7 +126,7 @@ static int __init add_string_property(struct device_node 
*np, const char *name,
return 1;
 }
 
-static int __init add_raw_property(struct device_node *np, const char *name,
+static int add_raw_property(struct device_node *np, const char *name,
int length, const void *value)
 {
struct property *nprop = new_property(name, length, value);
@@ -135,6 +137,203 @@ static int __init add_raw_property(struct device_node 
*np, const char *name,
return 1;
 }
 
+static struct device_node *do_device_node(struct device_node *parent,
+   const char *name, u32 reg, u32 unit, const char *type,
+   const char *compat, struct vio_resource *res)
+{
+   struct device_node *np;
+   char path[32];
+
+   snprintf(path, sizeof(path), "/vdevice/[EMAIL PROTECTED]", name, reg);
+   np = new_node(path, parent);
+   if (!np)
+   return NULL;
+   if (!add_string_property(np, "name", name) ||
+   !add_string_property(np, "device_type", type) ||
+   !add_string_property(np, "compatible", compat) ||
+   !add_raw_property(np, "reg", sizeof(reg), ®) ||
+   !add_raw_property(np, "linux,unit_address",
+   sizeof(unit), &unit)) {
+   goto node_free;
+   }
+   if (res) {
+   if (!add_raw_property(np, "linux,vio_rsrcname",
+   sizeof(res->rsrcname), res->rsrcname) ||
+   !add_raw_property(np, "linux,vio_type",
+   sizeof(res->type), res->type) ||
+   !add_raw_property(np, "linux,vio_model",
+   sizeof(res->model), res->model))

[PATCH 10/11] [POWERPC] Clean up vio.h

2007-09-20 Thread Stephen Rothwell
Remove vio_dma_ops declaration (since it no longer exists) and some
unused fields from struct vio_driver.

Signed-off-by: Stephen Rothwell <[EMAIL PROTECTED]>
---
 arch/powerpc/kernel/vio.c |   11 ---
 include/asm-powerpc/vio.h |5 -
 2 files changed, 0 insertions(+), 16 deletions(-)

-- 
Cheers,
Stephen Rothwell[EMAIL PROTECTED]

diff --git a/arch/powerpc/kernel/vio.c b/arch/powerpc/kernel/vio.c
index aec5fff..cb22a35 100644
--- a/arch/powerpc/kernel/vio.c
+++ b/arch/powerpc/kernel/vio.c
@@ -135,16 +135,6 @@ static int vio_bus_remove(struct device *dev)
return 1;
 }
 
-/* convert from struct device to struct vio_dev and pass to driver. */
-static void vio_bus_shutdown(struct device *dev)
-{
-   struct vio_dev *viodev = to_vio_dev(dev);
-   struct vio_driver *viodrv = to_vio_driver(dev->driver);
-
-   if (dev->driver && viodrv->shutdown)
-   viodrv->shutdown(viodev);
-}
-
 /**
  * vio_register_driver: - Register a new vio driver
  * @drv:   The vio_driver structure to be registered.
@@ -361,7 +351,6 @@ static struct bus_type vio_bus_type = {
.match = vio_bus_match,
.probe = vio_bus_probe,
.remove = vio_bus_remove,
-   .shutdown = vio_bus_shutdown,
 };
 
 /**
diff --git a/include/asm-powerpc/vio.h b/include/asm-powerpc/vio.h
index 598d111..9204c15 100644
--- a/include/asm-powerpc/vio.h
+++ b/include/asm-powerpc/vio.h
@@ -53,17 +53,12 @@ struct vio_dev {
 };
 
 struct vio_driver {
-   struct list_head node;
const struct vio_device_id *id_table;
int (*probe)(struct vio_dev *dev, const struct vio_device_id *id);
int (*remove)(struct vio_dev *dev);
-   void (*shutdown)(struct vio_dev *dev);
-   unsigned long driver_data;
struct device_driver driver;
 };
 
-extern struct dma_mapping_ops vio_dma_ops;
-
 extern int vio_register_driver(struct vio_driver *drv);
 extern void vio_unregister_driver(struct vio_driver *drv);
 
-- 
1.5.3.2

___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH 09/11] [POWERPC] iSeries: move detection of virtual tapes

2007-09-20 Thread Stephen Rothwell
Now we will only have entries in the device tree for the actual existing
devices (including their OS/400 properties).  This way viotape.c gets
all the information about the devices from the device tree.

Signed-off-by: Stephen Rothwell <[EMAIL PROTECTED]>
---
 arch/powerpc/platforms/iseries/dt.c  |7 --
 arch/powerpc/platforms/iseries/vio.c |  153 ++
 drivers/char/viotape.c   |  124 ---
 include/asm-powerpc/iseries/vio.h|   41 +
 4 files changed, 196 insertions(+), 129 deletions(-)

-- 
Cheers,
Stephen Rothwell[EMAIL PROTECTED]

diff --git a/arch/powerpc/platforms/iseries/dt.c 
b/arch/powerpc/platforms/iseries/dt.c
index 84fcee1..2e4ad6b 100644
--- a/arch/powerpc/platforms/iseries/dt.c
+++ b/arch/powerpc/platforms/iseries/dt.c
@@ -73,7 +73,6 @@ static char __initdata device_type_memory[] = "memory";
 static char __initdata device_type_serial[] = "serial";
 static char __initdata device_type_network[] = "network";
 static char __initdata device_type_block[] = "block";
-static char __initdata device_type_byte[] = "byte";
 static char __initdata device_type_pci[] = "pci";
 static char __initdata device_type_vdevice[] = "vdevice";
 static char __initdata device_type_vscsi[] = "vscsi";
@@ -380,12 +379,6 @@ static void __init dt_vdevices(struct iseries_flat_dt *dt)
for (i = 0; i < HVMAXARCHITECTEDVIRTUALDISKS; i++)
dt_do_vdevice(dt, "viodasd", reg, i, device_type_block,
"IBM,iSeries-viodasd", 1);
-   reg += HVMAXARCHITECTEDVIRTUALDISKS;
-   reg += HVMAXARCHITECTEDVIRTUALCDROMS;
-
-   for (i = 0; i < HVMAXARCHITECTEDVIRTUALTAPES; i++)
-   dt_do_vdevice(dt, "viotape", reg, i, device_type_byte,
-   "IBM,iSeries-viotape", 1);
 
dt_end_node(dt);
 }
diff --git a/arch/powerpc/platforms/iseries/vio.c 
b/arch/powerpc/platforms/iseries/vio.c
index ad36d89..c7d2a83 100644
--- a/arch/powerpc/platforms/iseries/vio.c
+++ b/arch/powerpc/platforms/iseries/vio.c
@@ -45,6 +45,18 @@
 #define FIRST_VIOTAPE  (FIRST_VIOCD + NUM_VIOCDS)
 #define NUM_VIOTAPES   HVMAXARCHITECTEDVIRTUALTAPES
 
+struct vio_waitevent {
+   struct completion   com;
+   int rc;
+   u16 sub_result;
+};
+
+struct vio_resource {
+   charrsrcname[10];
+   chartype[4];
+   charmodel[3];
+};
+
 static struct property * __init new_property(const char *name, int length,
const void *value)
 {
@@ -124,22 +136,10 @@ static int __init add_raw_property(struct device_node 
*np, const char *name,
 }
 
 #if defined(CONFIG_VIOCD) || defined(CONFIG_VIOCD_MODULE)
-struct viocd_waitevent {
-   struct completion   com;
-   int rc;
-   u16 sub_result;
-};
-
-struct cdrom_info {
-   charrsrcname[10];
-   chartype[4];
-   charmodel[3];
-};
-
 static void __init handle_cd_event(struct HvLpEvent *event)
 {
struct viocdlpevent *bevent;
-   struct viocd_waitevent *pwe;
+   struct vio_waitevent *pwe;
 
if (!event)
/* Notification that a partition went away! */
@@ -159,7 +159,7 @@ static void __init handle_cd_event(struct HvLpEvent *event)
 
switch (event->xSubtype & VIOMINOR_SUBTYPE_MASK) {
case viocdgetinfo:
-   pwe = (struct viocd_waitevent *)event->xCorrelationToken;
+   pwe = (struct vio_waitevent *)event->xCorrelationToken;
pwe->rc = event->xRc;
pwe->sub_result = bevent->sub_result;
complete(&pwe->com);
@@ -180,8 +180,8 @@ static void __init get_viocd_info(struct device_node 
*vio_root)
 {
HvLpEvent_Rc hvrc;
u32 unit;
-   struct viocd_waitevent we;
-   struct cdrom_info *unitinfo;
+   struct vio_waitevent we;
+   struct vio_resource *unitinfo;
dma_addr_t unitinfo_dmaaddr;
int ret;
 
@@ -288,6 +288,124 @@ static void __init get_viocd_info(struct device_node 
*vio_root)
 }
 #endif /* defined(CONFIG_VIOCD) || defined(CONFIG_VIOCD_MODULE) */
 
+#if defined(CONFIG_VIOTAPE) || defined(CONFIG_VIOTAPE_MODULE)
+/* Handle interrupt events for tape */
+static void __init handle_tape_event(struct HvLpEvent *event)
+{
+   struct vio_waitevent *we;
+   struct viotapelpevent *tevent = (struct viotapelpevent *)event;
+
+   if (event == NULL)
+   /* Notification that a partition went away! */
+   return;
+
+   we = (struct vio_waitevent *)event->xCorrelationToken;
+   switch (event->xSubtype & VIOMINOR_SUBTYPE_MASK) {
+   case viotapegetinfo:
+   we->rc = tevent->sub_type_result;
+   complete(&we->com);
+   break;
+   default:
+   printk(KERN_WARNING "handle_tape_event: weird ack\n");
+   }
+}
+
+static void __init get_viotape_info(stru

[PATCH 08/11] [POWERPC] iSeries: move detection of virtual cdroms

2007-09-20 Thread Stephen Rothwell
Now we will only have entries in the device tree for the actual existing
devices (including their OS/400 properties).  This way viocd.c gets all
the information about the devices from the device tree.

Signed-off-by: Stephen Rothwell <[EMAIL PROTECTED]>
---
 arch/powerpc/kernel/vio.c   |3 -
 arch/powerpc/platforms/iseries/Makefile |2 +-
 arch/powerpc/platforms/iseries/dt.c |4 -
 arch/powerpc/platforms/iseries/vio.c|  321 +++
 drivers/cdrom/viocd.c   |  116 ++--
 include/asm-powerpc/iseries/vio.h   |   24 +++
 6 files changed, 365 insertions(+), 105 deletions(-)
 create mode 100644 arch/powerpc/platforms/iseries/vio.c

-- 
Cheers,
Stephen Rothwell[EMAIL PROTECTED]

diff --git a/arch/powerpc/kernel/vio.c b/arch/powerpc/kernel/vio.c
index 9e1ff21..aec5fff 100644
--- a/arch/powerpc/kernel/vio.c
+++ b/arch/powerpc/kernel/vio.c
@@ -257,9 +257,6 @@ static int __init vio_bus_init(void)
int err;
struct device_node *node_vroot;
 
-   if (firmware_has_feature(FW_FEATURE_ISERIES))
-   iommu_vio_init();
-
err = bus_register(&vio_bus_type);
if (err) {
printk(KERN_ERR "failed to register VIO bus\n");
diff --git a/arch/powerpc/platforms/iseries/Makefile 
b/arch/powerpc/platforms/iseries/Makefile
index 60db509..a65f1b4 100644
--- a/arch/powerpc/platforms/iseries/Makefile
+++ b/arch/powerpc/platforms/iseries/Makefile
@@ -7,7 +7,7 @@ obj-y += hvlog.o hvlpconfig.o lpardata.o setup.o dt_mod.o mf.o 
lpevents.o \
hvcall.o proc.o htab.o iommu.o misc.o irq.o
 obj-$(CONFIG_PCI) += pci.o vpdinfo.o
 obj-$(CONFIG_SMP) += smp.o
-obj-$(CONFIG_VIOPATH) += viopath.o
+obj-$(CONFIG_VIOPATH) += viopath.o vio.o
 obj-$(CONFIG_MODULES) += ksyms.o
 
 quiet_cmd_dt_strings = DT_STR  $@
diff --git a/arch/powerpc/platforms/iseries/dt.c 
b/arch/powerpc/platforms/iseries/dt.c
index 9e8a334..84fcee1 100644
--- a/arch/powerpc/platforms/iseries/dt.c
+++ b/arch/powerpc/platforms/iseries/dt.c
@@ -381,10 +381,6 @@ static void __init dt_vdevices(struct iseries_flat_dt *dt)
dt_do_vdevice(dt, "viodasd", reg, i, device_type_block,
"IBM,iSeries-viodasd", 1);
reg += HVMAXARCHITECTEDVIRTUALDISKS;
-
-   for (i = 0; i < HVMAXARCHITECTEDVIRTUALCDROMS; i++)
-   dt_do_vdevice(dt, "viocd", reg, i, device_type_block,
-   "IBM,iSeries-viocd", 1);
reg += HVMAXARCHITECTEDVIRTUALCDROMS;
 
for (i = 0; i < HVMAXARCHITECTEDVIRTUALTAPES; i++)
diff --git a/arch/powerpc/platforms/iseries/vio.c 
b/arch/powerpc/platforms/iseries/vio.c
new file mode 100644
index 000..ad36d89
--- /dev/null
+++ b/arch/powerpc/platforms/iseries/vio.c
@@ -0,0 +1,321 @@
+/*
+ * Legacy iSeries specific vio initialisation
+ * that needs to be built in (not a module).
+ *
+ * © Copyright 2007 IBM Corporation
+ * Author: Stephen Rothwell
+ * Some parts collected from various other files
+ *
+ * This program is free software;  you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define FIRST_VTY  0
+#define NUM_VTYS   1
+#define FIRST_VSCSI(FIRST_VTY + NUM_VTYS)
+#define NUM_VSCSIS 1
+#define FIRST_VLAN (FIRST_VSCSI + NUM_VSCSIS)
+#define NUM_VLANS  HVMAXARCHITECTEDVIRTUALLANS
+#define FIRST_VIODASD  (FIRST_VLAN + NUM_VLANS)
+#define NUM_VIODASDS   HVMAXARCHITECTEDVIRTUALDISKS
+#define FIRST_VIOCD(FIRST_VIODASD + NUM_VIODASDS)
+#define NUM_VIOCDS HVMAXARCHITECTEDVIRTUALCDROMS
+#define FIRST_VIOTAPE  (FIRST_VIOCD + NUM_VIOCDS)
+#define NUM_VIOTAPES   HVMAXARCHITECTEDVIRTUALTAPES
+
+static struct property * __init new_property(const char *name, int length,
+   const void *value)
+{
+   struct property *np = kzalloc(sizeof(*np) + strlen(name) + 1 + length,
+   GFP_KERNEL);
+
+   if (!np)
+   return NULL;
+   np->name = (char *)(np + 1);
+   np->value = np->name + strlen(name) + 1;
+   strcpy(np->name, name);
+   memcpy(np->value, value, length);
+   np->length = length;
+   return np;
+}
+
+static void __init free_property(struct property *np)
+{
+   kfree(np

[PATCH 07/11] [POWERPC] iSeries: missing newline in printk

2007-09-20 Thread Stephen Rothwell

Signed-off-by: Stephen Rothwell <[EMAIL PROTECTED]>
---
 arch/powerpc/platforms/iseries/viopath.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

-- 
Cheers,
Stephen Rothwell[EMAIL PROTECTED]

diff --git a/arch/powerpc/platforms/iseries/viopath.c 
b/arch/powerpc/platforms/iseries/viopath.c
index 7106a05..df23331 100644
--- a/arch/powerpc/platforms/iseries/viopath.c
+++ b/arch/powerpc/platforms/iseries/viopath.c
@@ -594,7 +594,7 @@ int viopath_close(HvLpIndex remoteLp, int subtype, int 
numReq)
numOpen += viopathStatus[remoteLp].users[i];
 
if ((viopathStatus[remoteLp].isOpen) && (numOpen == 0)) {
-   printk(VIOPATH_KERN_INFO "closing connection to partition %d",
+   printk(VIOPATH_KERN_INFO "closing connection to partition %d\n",
remoteLp);
 
HvCallEvent_closeLpEventPath(remoteLp,
-- 
1.5.3.2

___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH 06/11] [POWERPC] Remove more iSeries specific stuff from vio.c

2007-09-20 Thread Stephen Rothwell

Signed-off-by: Stephen Rothwell <[EMAIL PROTECTED]>
---
 arch/powerpc/kernel/vio.c  |   78 ++-
 arch/powerpc/platforms/iseries/iommu.c |   24 +-
 include/asm-powerpc/iseries/iommu.h|4 ++
 3 files changed, 52 insertions(+), 54 deletions(-)

-- 
Cheers,
Stephen Rothwell[EMAIL PROTECTED]

diff --git a/arch/powerpc/kernel/vio.c b/arch/powerpc/kernel/vio.c
index cf71c88..9e1ff21 100644
--- a/arch/powerpc/kernel/vio.c
+++ b/arch/powerpc/kernel/vio.c
@@ -48,61 +48,33 @@ static struct vio_dev vio_bus_device  = { /* fake "parent" 
device */
.dev.bus = &vio_bus_type,
 };
 
-#ifdef CONFIG_PPC_ISERIES
-static struct iommu_table veth_iommu_table;
-struct iommu_table vio_iommu_table;
-
-static void __init iommu_vio_init(void)
-{
-   iommu_table_getparms_iSeries(255, 0, 0xff, &veth_iommu_table);
-   veth_iommu_table.it_size /= 2;
-   vio_iommu_table = veth_iommu_table;
-   vio_iommu_table.it_offset += veth_iommu_table.it_size;
-
-   if (!iommu_init_table(&veth_iommu_table, -1))
-   printk("Virtual Bus VETH TCE table failed.\n");
-   if (!iommu_init_table(&vio_iommu_table, -1))
-   printk("Virtual Bus VIO TCE table failed.\n");
-}
-#else
-static void __init iommu_vio_init(void)
-{
-}
-#endif
-
 static struct iommu_table *vio_build_iommu_table(struct vio_dev *dev)
 {
-#ifdef CONFIG_PPC_ISERIES
-   if (firmware_has_feature(FW_FEATURE_ISERIES)) {
-   if (strcmp(dev->type, "network") == 0)
-   return &veth_iommu_table;
-   return &vio_iommu_table;
-   } else
-#endif
-   {
-   const unsigned char *dma_window;
-   struct iommu_table *tbl;
-   unsigned long offset, size;
-
-   dma_window = of_get_property(dev->dev.archdata.of_node,
- "ibm,my-dma-window", NULL);
-   if (!dma_window)
-   return NULL;
-
-   tbl = kmalloc(sizeof(*tbl), GFP_KERNEL);
-
-   of_parse_dma_window(dev->dev.archdata.of_node, dma_window,
-   &tbl->it_index, &offset, &size);
-
-   /* TCE table size - measured in tce entries */
-   tbl->it_size = size >> IOMMU_PAGE_SHIFT;
-   /* offset for VIO should always be 0 */
-   tbl->it_offset = offset >> IOMMU_PAGE_SHIFT;
-   tbl->it_busno = 0;
-   tbl->it_type = TCE_VB;
-
-   return iommu_init_table(tbl, -1);
-   }
+   const unsigned char *dma_window;
+   struct iommu_table *tbl;
+   unsigned long offset, size;
+
+   if (firmware_has_feature(FW_FEATURE_ISERIES))
+   return vio_build_iommu_table_iseries(dev);
+
+   dma_window = of_get_property(dev->dev.archdata.of_node,
+ "ibm,my-dma-window", NULL);
+   if (!dma_window)
+   return NULL;
+
+   tbl = kmalloc(sizeof(*tbl), GFP_KERNEL);
+
+   of_parse_dma_window(dev->dev.archdata.of_node, dma_window,
+   &tbl->it_index, &offset, &size);
+
+   /* TCE table size - measured in tce entries */
+   tbl->it_size = size >> IOMMU_PAGE_SHIFT;
+   /* offset for VIO should always be 0 */
+   tbl->it_offset = offset >> IOMMU_PAGE_SHIFT;
+   tbl->it_busno = 0;
+   tbl->it_type = TCE_VB;
+
+   return iommu_init_table(tbl, -1);
 }
 
 /**
diff --git a/arch/powerpc/platforms/iseries/iommu.c 
b/arch/powerpc/platforms/iseries/iommu.c
index 3281f10..49e9c66 100644
--- a/arch/powerpc/platforms/iseries/iommu.c
+++ b/arch/powerpc/platforms/iseries/iommu.c
@@ -31,6 +31,7 @@
 #include 
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -191,7 +192,8 @@ void iommu_devnode_init_iSeries(struct pci_dev *pdev, 
struct device_node *dn)
 }
 #endif
 
-extern struct iommu_table vio_iommu_table;
+static struct iommu_table veth_iommu_table;
+static struct iommu_table vio_iommu_table;
 
 void *iseries_hv_alloc(size_t size, dma_addr_t *dma_handle, gfp_t flag)
 {
@@ -219,6 +221,26 @@ void iseries_hv_unmap(dma_addr_t dma_handle, size_t size,
iommu_unmap_single(&vio_iommu_table, dma_handle, size, direction);
 }
 
+void __init iommu_vio_init(void)
+{
+   iommu_table_getparms_iSeries(255, 0, 0xff, &veth_iommu_table);
+   veth_iommu_table.it_size /= 2;
+   vio_iommu_table = veth_iommu_table;
+   vio_iommu_table.it_offset += veth_iommu_table.it_size;
+
+   if (!iommu_init_table(&veth_iommu_table, -1))
+   printk("Virtual Bus VETH TCE table failed.\n");
+   if (!iommu_init_table(&vio_iommu_table, -1))
+   printk("Virtual Bus VIO TCE table failed.\n");
+}
+
+struct iommu_table *vio_build_iommu_table_iseries(struct vio_dev *dev)
+{
+   if (strcmp(dev->type, "network") == 0)
+   return &veth_iommu_table;
+   return &vio_iommu_table;
+}
+
 void iommu_init_ea

[PATCH 05/11] [POWERPC] remove iSeries_vio_dev

2007-09-20 Thread Stephen Rothwell
It was only being used to carry around dma_iommu_ops and vio_iommu_table
which we can use directly instead.  This also means that vio_bus_device
doesn't need to refer to them either.

Signed-off-by: Stephen Rothwell <[EMAIL PROTECTED]>
---
 arch/powerpc/kernel/vio.c   |7 +-
 arch/powerpc/platforms/iseries/iommu.c  |   30 +++
 arch/powerpc/platforms/iseries/mf.c |   23 
 arch/powerpc/platforms/iseries/viopath.c|6 +---
 drivers/cdrom/viocd.c   |5 +--
 drivers/char/viotape.c  |7 ++---
 include/asm-powerpc/iseries/hv_call_event.h |   10 +
 include/asm-powerpc/iseries/vio.h   |4 ---
 8 files changed, 57 insertions(+), 35 deletions(-)

-- 
Cheers,
Stephen Rothwell[EMAIL PROTECTED]

diff --git a/arch/powerpc/kernel/vio.c b/arch/powerpc/kernel/vio.c
index 1d7b272..cf71c88 100644
--- a/arch/powerpc/kernel/vio.c
+++ b/arch/powerpc/kernel/vio.c
@@ -49,11 +49,8 @@ static struct vio_dev vio_bus_device  = { /* fake "parent" 
device */
 };
 
 #ifdef CONFIG_PPC_ISERIES
-struct device *iSeries_vio_dev = &vio_bus_device.dev;
-EXPORT_SYMBOL(iSeries_vio_dev);
-
 static struct iommu_table veth_iommu_table;
-static struct iommu_table vio_iommu_table;
+struct iommu_table vio_iommu_table;
 
 static void __init iommu_vio_init(void)
 {
@@ -66,8 +63,6 @@ static void __init iommu_vio_init(void)
printk("Virtual Bus VETH TCE table failed.\n");
if (!iommu_init_table(&vio_iommu_table, -1))
printk("Virtual Bus VIO TCE table failed.\n");
-   vio_bus_device.dev.archdata.dma_ops = &dma_iommu_ops;
-   vio_bus_device.dev.archdata.dma_data = &vio_iommu_table;
 }
 #else
 static void __init iommu_vio_init(void)
diff --git a/arch/powerpc/platforms/iseries/iommu.c 
b/arch/powerpc/platforms/iseries/iommu.c
index 3b6a966..3281f10 100644
--- a/arch/powerpc/platforms/iseries/iommu.c
+++ b/arch/powerpc/platforms/iseries/iommu.c
@@ -28,6 +28,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -36,6 +37,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 static void tce_build_iSeries(struct iommu_table *tbl, long index, long npages,
@@ -189,6 +191,34 @@ void iommu_devnode_init_iSeries(struct pci_dev *pdev, 
struct device_node *dn)
 }
 #endif
 
+extern struct iommu_table vio_iommu_table;
+
+void *iseries_hv_alloc(size_t size, dma_addr_t *dma_handle, gfp_t flag)
+{
+   return iommu_alloc_coherent(&vio_iommu_table, size, dma_handle,
+   DMA_32BIT_MASK, flag, -1);
+}
+EXPORT_SYMBOL_GPL(iseries_hv_alloc);
+
+void iseries_hv_free(size_t size, void *vaddr, dma_addr_t dma_handle)
+{
+   iommu_free_coherent(&vio_iommu_table, size, vaddr, dma_handle);
+}
+EXPORT_SYMBOL_GPL(iseries_hv_free);
+
+dma_addr_t iseries_hv_map(void *vaddr, size_t size,
+   enum dma_data_direction direction)
+{
+   return iommu_map_single(&vio_iommu_table, vaddr, size,
+   DMA_32BIT_MASK, direction);
+}
+
+void iseries_hv_unmap(dma_addr_t dma_handle, size_t size,
+   enum dma_data_direction direction)
+{
+   iommu_unmap_single(&vio_iommu_table, dma_handle, size, direction);
+}
+
 void iommu_init_early_iSeries(void)
 {
ppc_md.tce_build = tce_build_iSeries;
diff --git a/arch/powerpc/platforms/iseries/mf.c 
b/arch/powerpc/platforms/iseries/mf.c
index b1187d9..c0f2433 100644
--- a/arch/powerpc/platforms/iseries/mf.c
+++ b/arch/powerpc/platforms/iseries/mf.c
@@ -39,9 +39,9 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
+#include 
 #include 
 
 #include "setup.h"
@@ -870,8 +870,7 @@ static int proc_mf_dump_cmdline(char *page, char **start, 
off_t off,
if ((off + count) > 256)
count = 256 - off;
 
-   dma_addr = dma_map_single(iSeries_vio_dev, page, off + count,
-   DMA_FROM_DEVICE);
+   dma_addr = iseries_hv_map(page, off + count, DMA_FROM_DEVICE);
if (dma_mapping_error(dma_addr))
return -ENOMEM;
memset(page, 0, off + count);
@@ -883,8 +882,7 @@ static int proc_mf_dump_cmdline(char *page, char **start, 
off_t off,
vsp_cmd.sub_data.kern.length = off + count;
mb();
rc = signal_vsp_instruction(&vsp_cmd);
-   dma_unmap_single(iSeries_vio_dev, dma_addr, off + count,
-   DMA_FROM_DEVICE);
+   iseries_hv_unmap(dma_addr, off + count, DMA_FROM_DEVICE);
if (rc)
return rc;
if (vsp_cmd.result_code != 0)
@@ -919,8 +917,7 @@ static int mf_getVmlinuxChunk(char *buffer, int *size, int 
offset, u64 side)
int len = *size;
dma_addr_t dma_addr;
 
-   dma_addr = dma_map_single(iSeries_vio_dev, buffer, len,
-   DMA_FROM_DEVICE);
+   dma_addr = iseries_hv_map(buffer, len, DMA_FROM_DEVICE);
memset(buffer, 0, le

[PATCH 04/11] [POWERPC] iSeries: simplify viocd initialisation

2007-09-20 Thread Stephen Rothwell
We don't need to keep a lump of dma coherent memory around for the life
of the module.

Signed-off-by: Stephen Rothwell <[EMAIL PROTECTED]>
---
 drivers/cdrom/viocd.c |   37 +
 1 files changed, 13 insertions(+), 24 deletions(-)

-- 
Cheers,
Stephen Rothwell[EMAIL PROTECTED]

diff --git a/drivers/cdrom/viocd.c b/drivers/cdrom/viocd.c
index e51550d..b88fdeb 100644
--- a/drivers/cdrom/viocd.c
+++ b/drivers/cdrom/viocd.c
@@ -136,17 +136,12 @@ struct cdrom_info {
chartype[4];
charmodel[3];
 };
-/*
- * This needs to be allocated since it is passed to the
- * Hypervisor and we may be a module.
- */
-static struct cdrom_info *viocd_unitinfo;
-static dma_addr_t unitinfo_dmaaddr;
 
 struct disk_info {
struct gendisk  *viocd_disk;
struct cdrom_device_infoviocd_info;
struct device   *dev;
+   struct cdrom_info   unitinfo;
 };
 static struct disk_info viocd_diskinfo[VIOCD_MAX_CD];
 
@@ -164,9 +159,9 @@ static int proc_viocd_show(struct seq_file *m, void *v)
for (i = 0; i < viocd_numdev; i++) {
seq_printf(m, "viocd device %d is iSeries resource %10.10s"
"type %4.4s, model %3.3s\n",
-   i, viocd_unitinfo[i].rsrcname,
-   viocd_unitinfo[i].type,
-   viocd_unitinfo[i].model);
+   i, viocd_diskinfo[i].unitinfo.rsrcname,
+   viocd_diskinfo[i].unitinfo.type,
+   viocd_diskinfo[i].unitinfo.model);
}
return 0;
 }
@@ -222,6 +217,8 @@ static void __init get_viocd_info(void)
HvLpEvent_Rc hvrc;
int i;
struct viocd_waitevent we;
+   struct cdrom_info *viocd_unitinfo;
+   dma_addr_t unitinfo_dmaaddr;
 
viocd_unitinfo = dma_alloc_coherent(iSeries_vio_dev,
sizeof(*viocd_unitinfo) * VIOCD_MAX_CD,
@@ -259,16 +256,15 @@ static void __init get_viocd_info(void)
goto error_ret;
}
 
-   for (i = 0; (i < VIOCD_MAX_CD) && viocd_unitinfo[i].rsrcname[0]; i++)
+   for (i = 0; (i < VIOCD_MAX_CD) && viocd_unitinfo[i].rsrcname[0]; i++) {
+   viocd_diskinfo[viocd_numdev].unitinfo = viocd_unitinfo[i];
viocd_numdev++;
+   }
 
 error_ret:
-   if (viocd_numdev == 0) {
-   dma_free_coherent(iSeries_vio_dev,
-   sizeof(*viocd_unitinfo) * VIOCD_MAX_CD,
-   viocd_unitinfo, unitinfo_dmaaddr);
-   viocd_unitinfo = NULL;
-   }
+   dma_free_coherent(iSeries_vio_dev,
+   sizeof(*viocd_unitinfo) * VIOCD_MAX_CD,
+   viocd_unitinfo, unitinfo_dmaaddr);
 }
 
 static int viocd_open(struct cdrom_device_info *cdi, int purpose)
@@ -674,7 +670,7 @@ static int viocd_probe(struct vio_dev *vdev, const struct 
vio_device_id *id)
 
d = &viocd_diskinfo[deviceno];
c = &d->viocd_info;
-   ci = &viocd_unitinfo[deviceno];
+   ci = &d->unitinfo;
 
c->ops = &viocd_dops;
c->speed = 4;
@@ -816,9 +812,6 @@ static int __init viocd_init(void)
return 0;
 
 out_free_info:
-   dma_free_coherent(iSeries_vio_dev,
-   sizeof(*viocd_unitinfo) * VIOCD_MAX_CD,
-   viocd_unitinfo, unitinfo_dmaaddr);
vio_clearHandler(viomajorsubtype_cdio);
viopath_close(viopath_hostLp, viomajorsubtype_cdio, MAX_CD_REQ + 2);
 out_unregister:
@@ -830,10 +823,6 @@ static void __exit viocd_exit(void)
 {
remove_proc_entry("iSeries/viocd", NULL);
vio_unregister_driver(&viocd_driver);
-   if (viocd_unitinfo != NULL)
-   dma_free_coherent(iSeries_vio_dev,
-   sizeof(*viocd_unitinfo) * VIOCD_MAX_CD,
-   viocd_unitinfo, unitinfo_dmaaddr);
viopath_close(viopath_hostLp, viomajorsubtype_cdio, MAX_CD_REQ + 2);
vio_clearHandler(viomajorsubtype_cdio);
unregister_blkdev(VIOCD_MAJOR, VIOCD_DEVICE);
-- 
1.5.3.2

___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH 03/11] [POWERPC] Make vio_bus_type static

2007-09-20 Thread Stephen Rothwell

Signed-off-by: Stephen Rothwell <[EMAIL PROTECTED]>
---
 arch/powerpc/kernel/vio.c |4 +++-
 include/asm-powerpc/vio.h |1 -
 2 files changed, 3 insertions(+), 2 deletions(-)

-- 
Cheers,
Stephen Rothwell[EMAIL PROTECTED]

diff --git a/arch/powerpc/kernel/vio.c b/arch/powerpc/kernel/vio.c
index ee15c22..1d7b272 100644
--- a/arch/powerpc/kernel/vio.c
+++ b/arch/powerpc/kernel/vio.c
@@ -39,6 +39,8 @@
 
 extern struct kset devices_subsys; /* needed for vio_find_name() */
 
+static struct bus_type vio_bus_type;
+
 static struct vio_dev vio_bus_device  = { /* fake "parent" device */
.name = vio_bus_device.dev.bus_id,
.type = "",
@@ -388,7 +390,7 @@ static int vio_hotplug(struct device *dev, char **envp, int 
num_envp,
return 0;
 }
 
-struct bus_type vio_bus_type = {
+static struct bus_type vio_bus_type = {
.name = "vio",
.dev_attrs = vio_dev_attrs,
.uevent = vio_hotplug,
diff --git a/include/asm-powerpc/vio.h b/include/asm-powerpc/vio.h
index 3a0975e..598d111 100644
--- a/include/asm-powerpc/vio.h
+++ b/include/asm-powerpc/vio.h
@@ -63,7 +63,6 @@ struct vio_driver {
 };
 
 extern struct dma_mapping_ops vio_dma_ops;
-extern struct bus_type vio_bus_type;
 
 extern int vio_register_driver(struct vio_driver *drv);
 extern void vio_unregister_driver(struct vio_driver *drv);
-- 
1.5.3.2

___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH 02/11] [POWERPC] Simplify vio_bus_init a little for legacy iSeries

2007-09-20 Thread Stephen Rothwell
iSeries_vio_dev was already statically initialised and we can remove
one set of #ifdef CONFIG_PPC_ISERIES guards.

Signed-off-by: Stephen Rothwell <[EMAIL PROTECTED]>
---
 arch/powerpc/kernel/vio.c |   14 +++---
 1 files changed, 7 insertions(+), 7 deletions(-)

-- 
Cheers,
Stephen Rothwell[EMAIL PROTECTED]

diff --git a/arch/powerpc/kernel/vio.c b/arch/powerpc/kernel/vio.c
index 54645ba..ee15c22 100644
--- a/arch/powerpc/kernel/vio.c
+++ b/arch/powerpc/kernel/vio.c
@@ -64,6 +64,12 @@ static void __init iommu_vio_init(void)
printk("Virtual Bus VETH TCE table failed.\n");
if (!iommu_init_table(&vio_iommu_table, -1))
printk("Virtual Bus VIO TCE table failed.\n");
+   vio_bus_device.dev.archdata.dma_ops = &dma_iommu_ops;
+   vio_bus_device.dev.archdata.dma_data = &vio_iommu_table;
+}
+#else
+static void __init iommu_vio_init(void)
+{
 }
 #endif
 
@@ -282,14 +288,8 @@ static int __init vio_bus_init(void)
int err;
struct device_node *node_vroot;
 
-#ifdef CONFIG_PPC_ISERIES
-   if (firmware_has_feature(FW_FEATURE_ISERIES)) {
+   if (firmware_has_feature(FW_FEATURE_ISERIES))
iommu_vio_init();
-   vio_bus_device.dev.archdata.dma_ops = &dma_iommu_ops;
-   vio_bus_device.dev.archdata.dma_data = &vio_iommu_table;
-   iSeries_vio_dev = &vio_bus_device.dev;
-   }
-#endif /* CONFIG_PPC_ISERIES */
 
err = bus_register(&vio_bus_type);
if (err) {
-- 
1.5.3.2

___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH 01/11] [POWERPC] Remove debug printk from vio_bus_init

2007-09-20 Thread Stephen Rothwell
As it just adds noise to the boot messages.

Signed-off-by: Stephen Rothwell <[EMAIL PROTECTED]>
---
 arch/powerpc/kernel/vio.c |5 +
 1 files changed, 1 insertions(+), 4 deletions(-)

-- 
Cheers,
Stephen Rothwell[EMAIL PROTECTED]

diff --git a/arch/powerpc/kernel/vio.c b/arch/powerpc/kernel/vio.c
index 62c1bc1..54645ba 100644
--- a/arch/powerpc/kernel/vio.c
+++ b/arch/powerpc/kernel/vio.c
@@ -317,11 +317,8 @@ static int __init vio_bus_init(void)
 * the device tree. Drivers will associate with them later.
 */
for (of_node = node_vroot->child; of_node != NULL;
-   of_node = of_node->sibling) {
-   printk(KERN_DEBUG "%s: processing %p\n",
-   __FUNCTION__, of_node);
+   of_node = of_node->sibling)
vio_register_device_node(of_node);
-   }
of_node_put(node_vroot);
}
 
-- 
1.5.3.2

___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH 0/11][POWERPC] vio cleanups

2007-09-20 Thread Stephen Rothwell
Hi all,

This series of patches does some cleanups to PowerPC vio especially the
legacy iSeries parts of that.  The significant change is to do the
probing of the virtual cdroms, tapes and disks earlier and create device
tree entries for them dynamically so that we only have entries for those
that exist (rather than the theoretical maximum number).

-- 
Cheers,
Stephen Rothwell[EMAIL PROTECTED]
http://www.canb.auug.org.au/~sfr/
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH v2 2/4] Implement generic time of day clocksource for powerpc machines.

2007-09-20 Thread Daniel Walker
On Fri, 2007-09-21 at 13:26 +1000, Tony Breeds wrote:
> +
> +   if (__USE_RTC())
> +   clock = &clocksource_rtc;
> +   else
> +   clock = &clocksource_timebase;
> +
> +   clock->mult = clocksource_hz2mult(tb_ticks_per_sec,
> clock->shift);

I don't think the RTC frequency isn't the same as the timebase? Seems
like the RTC only case about seconds at the lowest level. If that's the
case then the jiffies clock might be better to use .. The other thing I
wonder is if the __USE_RTC boards might have lower level clocks that
could be used instead ..

Daniel

___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


44x bug: funny TLB writes?

2007-09-20 Thread Hollis Blanchard
I seem to have come across a strange bug while doing KVM development. It
seems that the final tlbwe in finish_tlb (head_44x.S) is actually
leaking RPN bits into the "attribute" word.

When I set a breakpoint there and press enter on the serial console, I
see r12=ef600703, which is the physical address of the UART on this chip
(440EP), plus the correct permission bits at the bottom.

Am I crazy? I'm not really looking to step through that assembly right
now... Clearly (current) hardware is just ignoring these errant writes,
but it should be fixed.

-- 
Hollis Blanchard
IBM Linux Technology Center

___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH v2 3/4] Implement clockevents driver for powerpc

2007-09-20 Thread Tony Breeds
Signed-off-by: Tony Breeds <[EMAIL PROTECTED]>

---
Updated to remove a trivial FIXME left behind

 arch/powerpc/Kconfig   |3 
 arch/powerpc/kernel/smp.c  |3 
 arch/powerpc/kernel/time.c |  134 +
 include/asm-powerpc/time.h |1 
 4 files changed, 98 insertions(+), 43 deletions(-)

Index: working/arch/powerpc/Kconfig
===
--- working.orig/arch/powerpc/Kconfig
+++ working/arch/powerpc/Kconfig
@@ -30,6 +30,9 @@ config GENERIC_TIME
 config GENERIC_TIME_VSYSCALL
def_bool y
 
+config GENERIC_CLOCKEVENTS
+   def_bool y
+
 config GENERIC_HARDIRQS
bool
default y
Index: working/arch/powerpc/kernel/smp.c
===
--- working.orig/arch/powerpc/kernel/smp.c
+++ working/arch/powerpc/kernel/smp.c
@@ -560,6 +560,8 @@ int __devinit start_secondary(void *unus
if (system_state > SYSTEM_BOOTING)
snapshot_timebase();
 
+   secondary_cpu_time_init();
+
spin_lock(&call_lock);
cpu_set(cpu, cpu_online_map);
spin_unlock(&call_lock);
Index: working/arch/powerpc/kernel/time.c
===
--- working.orig/arch/powerpc/kernel/time.c
+++ working/arch/powerpc/kernel/time.c
@@ -75,6 +75,7 @@
 
 /* powerpc clocksource/clockevent code */
 
+#include 
 #include 
 
 static cycle_t rtc_read(void);
@@ -99,6 +100,27 @@ static struct clocksource clocksource_ti
.read = timebase_read,
 };
 
+#define DECREMENTER_MAX0x7fff
+
+static int decrementer_set_next_event(unsigned long evt,
+ struct clock_event_device *dev);
+static void decrementer_set_mode(enum clock_event_mode mode,
+struct clock_event_device *dev);
+
+static struct clock_event_device decrementer_clockevent = {
+   .name   = "decrementer",
+   .rating = 200,
+   .shift  = 32,
+   .mult   = 0,/* To be filled in */
+   .irq= -1,
+   .set_next_event = decrementer_set_next_event,
+   .set_mode   = decrementer_set_mode,
+   .features   = CLOCK_EVT_FEAT_ONESHOT,
+};
+
+static DEFINE_PER_CPU(struct clock_event_device, decrementers);
+void init_decrementer_clockevent(void);
+
 #ifdef CONFIG_PPC_ISERIES
 static unsigned long __initdata iSeries_recal_titan;
 static signed long __initdata iSeries_recal_tb;
@@ -519,10 +541,12 @@ void __init iSeries_time_init_early(void
 void timer_interrupt(struct pt_regs * regs)
 {
struct pt_regs *old_regs;
-   int next_dec;
int cpu = smp_processor_id();
-   unsigned long ticks;
-   u64 tb_next_jiffy;
+   struct clock_event_device *evt = &per_cpu(decrementers, cpu);
+
+   /* Ensure a positive value is written to the decrementer, or else
+* some CPUs will continuue to take decrementer exceptions */
+   set_dec(DECREMENTER_MAX);
 
 #ifdef CONFIG_PPC32
if (atomic_read(&ppc_n_lost_interrupts) != 0)
@@ -532,7 +556,6 @@ void timer_interrupt(struct pt_regs * re
old_regs = set_irq_regs(regs);
irq_enter();
 
-   profile_tick(CPU_PROFILING);
calculate_steal_time();
 
 #ifdef CONFIG_PPC_ISERIES
@@ -540,44 +563,20 @@ void timer_interrupt(struct pt_regs * re
get_lppaca()->int_dword.fields.decr_int = 0;
 #endif
 
-   while ((ticks = tb_ticks_since(per_cpu(last_jiffy, cpu)))
-  >= tb_ticks_per_jiffy) {
-   /* Update last_jiffy */
-   per_cpu(last_jiffy, cpu) += tb_ticks_per_jiffy;
-   /* Handle RTCL overflow on 601 */
-   if (__USE_RTC() && per_cpu(last_jiffy, cpu) >= 10)
-   per_cpu(last_jiffy, cpu) -= 10;
-
-   /*
-* We cannot disable the decrementer, so in the period
-* between this cpu's being marked offline in cpu_online_map
-* and calling stop-self, it is taking timer interrupts.
-* Avoid calling into the scheduler rebalancing code if this
-* is the case.
-*/
-   if (!cpu_is_offline(cpu))
-   account_process_time(regs);
-
-   /*
-* No need to check whether cpu is offline here; boot_cpuid
-* should have been fixed up by now.
-*/
-   if (cpu != boot_cpuid)
-   continue;
+   /*
+* We cannot disable the decrementer, so in the period
+* between this cpu's being marked offline in cpu_online_map
+* and calling stop-self, it is taking timer interrupts.
+* Avoid calling into the scheduler rebalancing code if this
+* is the case.
+*/
+   if (!cpu_is_offline(cpu))
+   account_process_time(regs);
 
-  

[PATCH v2 4/4] Enable tickless idle and high res timers for powerpc

2007-09-20 Thread Tony Breeds
Signed-off-by: Tony Breeds <[EMAIL PROTECTED]>

---

Updated to remove the need for patching generic code to include hrtimer.h

 arch/powerpc/Kconfig   |1 +
 arch/powerpc/kernel/idle.c |3 +++
 arch/powerpc/platforms/iseries/setup.c |5 +
 3 files changed, 9 insertions(+)

Index: working/arch/powerpc/Kconfig
===
--- working.orig/arch/powerpc/Kconfig
+++ working/arch/powerpc/Kconfig
@@ -168,6 +168,7 @@ config HIGHMEM
bool "High memory support"
depends on PPC32
 
+source kernel/time/Kconfig
 source kernel/Kconfig.hz
 source kernel/Kconfig.preempt
 source "fs/Kconfig.binfmt"
Index: working/arch/powerpc/kernel/idle.c
===
--- working.orig/arch/powerpc/kernel/idle.c
+++ working/arch/powerpc/kernel/idle.c
@@ -24,6 +24,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -59,6 +60,7 @@ void cpu_idle(void)
 
set_thread_flag(TIF_POLLING_NRFLAG);
while (1) {
+   tick_nohz_stop_sched_tick();
while (!need_resched() && !cpu_should_die()) {
ppc64_runlatch_off();
 
@@ -90,6 +92,7 @@ void cpu_idle(void)
 
HMT_medium();
ppc64_runlatch_on();
+   tick_nohz_restart_sched_tick();
if (cpu_should_die())
cpu_die();
preempt_enable_no_resched();
Index: working/arch/powerpc/platforms/iseries/setup.c
===
--- working.orig/arch/powerpc/platforms/iseries/setup.c
+++ working/arch/powerpc/platforms/iseries/setup.c
@@ -26,6 +26,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 
 #include 
 #include 
@@ -561,6 +563,7 @@ static void yield_shared_processor(void)
 static void iseries_shared_idle(void)
 {
while (1) {
+   tick_nohz_stop_sched_tick();
while (!need_resched() && !hvlpevent_is_pending()) {
local_irq_disable();
ppc64_runlatch_off();
@@ -574,6 +577,7 @@ static void iseries_shared_idle(void)
}
 
ppc64_runlatch_on();
+   tick_nohz_restart_sched_tick();
 
if (hvlpevent_is_pending())
process_iSeries_events();
@@ -589,6 +593,7 @@ static void iseries_dedicated_idle(void)
set_thread_flag(TIF_POLLING_NRFLAG);
 
while (1) {
+   tick_nohz_stop_sched_tick();
if (!need_resched()) {
while (!need_resched()) {
ppc64_runlatch_off();
@@ -605,6 +610,7 @@ static void iseries_dedicated_idle(void)
}
 
ppc64_runlatch_on();
+   tick_nohz_restart_sched_tick();
preempt_enable_no_resched();
schedule();
preempt_disable();
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH v2 2/4] Implement generic time of day clocksource for powerpc machines.

2007-09-20 Thread Tony Breeds
Signed-off-by: Tony Breeds <[EMAIL PROTECTED]>

---

Updated to create a clocksource driver specific to the 601

 arch/powerpc/Kconfig   |6 
 arch/powerpc/kernel/time.c |  255 -
 2 files changed, 91 insertions(+), 170 deletions(-)

Index: working/arch/powerpc/Kconfig
===
--- working.orig/arch/powerpc/Kconfig
+++ working/arch/powerpc/Kconfig
@@ -24,6 +24,12 @@ config MMU
 config GENERIC_CMOS_UPDATE
def_bool y
 
+config GENERIC_TIME
+   def_bool y
+
+config GENERIC_TIME_VSYSCALL
+   def_bool y
+
 config GENERIC_HARDIRQS
bool
default y
Index: working/arch/powerpc/kernel/time.c
===
--- working.orig/arch/powerpc/kernel/time.c
+++ working/arch/powerpc/kernel/time.c
@@ -73,9 +73,38 @@
 #include 
 #endif
 
+/* powerpc clocksource/clockevent code */
+
+#include 
+
+static cycle_t rtc_read(void);
+static struct clocksource clocksource_rtc = {
+   .name = "rtc",
+   .rating   = 400,
+   .flags= CLOCK_SOURCE_IS_CONTINUOUS,
+   .mask = CLOCKSOURCE_MASK(64),
+   .shift= 22,
+   .mult = 0,  /* To be filled in */
+   .read = rtc_read,
+};
+
+static cycle_t timebase_read(void);
+static struct clocksource clocksource_timebase = {
+   .name = "timebase",
+   .rating   = 400,
+   .flags= CLOCK_SOURCE_IS_CONTINUOUS,
+   .mask = CLOCKSOURCE_MASK(64),
+   .shift= 22,
+   .mult = 0,  /* To be filled in */
+   .read = timebase_read,
+};
+
 #ifdef CONFIG_PPC_ISERIES
 static unsigned long __initdata iSeries_recal_titan;
 static signed long __initdata iSeries_recal_tb;
+
+/* Forward declaration is only needed for iSereis compiles */
+void __init clocksource_init(void);
 #endif
 
 #define XSEC_PER_SEC (1024*1024)
@@ -343,65 +372,6 @@ void udelay(unsigned long usecs)
 }
 EXPORT_SYMBOL(udelay);
 
-/*
- * This version of gettimeofday has microsecond resolution.
- */
-static inline void __do_gettimeofday(struct timeval *tv)
-{
-   unsigned long sec, usec;
-   u64 tb_ticks, xsec;
-   struct gettimeofday_vars *temp_varp;
-   u64 temp_tb_to_xs, temp_stamp_xsec;
-
-   /*
-* These calculations are faster (gets rid of divides)
-* if done in units of 1/2^20 rather than microseconds.
-* The conversion to microseconds at the end is done
-* without a divide (and in fact, without a multiply)
-*/
-   temp_varp = do_gtod.varp;
-
-   /* Sampling the time base must be done after loading
-* do_gtod.varp in order to avoid racing with update_gtod.
-*/
-   data_barrier(temp_varp);
-   tb_ticks = get_tb() - temp_varp->tb_orig_stamp;
-   temp_tb_to_xs = temp_varp->tb_to_xs;
-   temp_stamp_xsec = temp_varp->stamp_xsec;
-   xsec = temp_stamp_xsec + mulhdu(tb_ticks, temp_tb_to_xs);
-   sec = xsec / XSEC_PER_SEC;
-   usec = (unsigned long)xsec & (XSEC_PER_SEC - 1);
-   usec = SCALE_XSEC(usec, 100);
-
-   tv->tv_sec = sec;
-   tv->tv_usec = usec;
-}
-
-void do_gettimeofday(struct timeval *tv)
-{
-   if (__USE_RTC()) {
-   /* do this the old way */
-   unsigned long flags, seq;
-   unsigned int sec, nsec, usec;
-
-   do {
-   seq = read_seqbegin_irqsave(&xtime_lock, flags);
-   sec = xtime.tv_sec;
-   nsec = xtime.tv_nsec + tb_ticks_since(tb_last_jiffy);
-   } while (read_seqretry_irqrestore(&xtime_lock, seq, flags));
-   usec = nsec / 1000;
-   while (usec >= 100) {
-   usec -= 100;
-   ++sec;
-   }
-   tv->tv_sec = sec;
-   tv->tv_usec = usec;
-   return;
-   }
-   __do_gettimeofday(tv);
-}
-
-EXPORT_SYMBOL(do_gettimeofday);
 
 /*
  * There are two copies of tb_to_xs and stamp_xsec so that no
@@ -447,56 +417,6 @@ static inline void update_gtod(u64 new_t
++(vdso_data->tb_update_count);
 }
 
-/*
- * When the timebase - tb_orig_stamp gets too big, we do a manipulation
- * between tb_orig_stamp and stamp_xsec. The goal here is to keep the
- * difference tb - tb_orig_stamp small enough to always fit inside a
- * 32 bits number. This is a requirement of our fast 32 bits userland
- * implementation in the vdso. If we "miss" a call to this function
- * (interrupt latency, CPU locked in a spinlock, ...) and we end up
- * with a too big difference, then the vdso will fallback to calling
- * the syscall
- */
-static __inline__ void timer_recalc_offset(u64 cur_tb)
-{
-   unsigned long offset;
-   u64 new_stamp_xsec;
-   u64 tlen, t2x;
-   u64 tb, xsec_old, xsec_new;
-   struct gettimeofday_vars *varp;
-
- 

[PATCH v2 1/4] Implement {read,update}_persistent_clock.

2007-09-20 Thread Tony Breeds
With these functions implemented we cooperate better with the generic
timekeeping code.  This obsoletes the need for the timer sysdev as a bonus.

Signed-off-by: Tony Breeds <[EMAIL PROTECTED]>

---

Patch set updated to powerpc/for-2.6.24

* Compile tested for arch/powerpc/configs/*_defconfig
* Booted on pSeries, iSeries, Cell and PS3

 arch/powerpc/Kconfig |3 +
 arch/powerpc/kernel/time.c   |   85 ++-
 arch/powerpc/sysdev/Makefile |5 --
 arch/powerpc/sysdev/timer.c  |   81 -
 4 files changed, 29 insertions(+), 145 deletions(-)

Index: working/arch/powerpc/Kconfig
===
--- working.orig/arch/powerpc/Kconfig
+++ working/arch/powerpc/Kconfig
@@ -21,6 +21,9 @@ config MMU
bool
default y
 
+config GENERIC_CMOS_UPDATE
+   def_bool y
+
 config GENERIC_HARDIRQS
bool
default y
Index: working/arch/powerpc/kernel/time.c
===
--- working.orig/arch/powerpc/kernel/time.c
+++ working/arch/powerpc/kernel/time.c
@@ -73,16 +73,11 @@
 #include 
 #endif
 
-/* keep track of when we need to update the rtc */
-time_t last_rtc_update;
 #ifdef CONFIG_PPC_ISERIES
 static unsigned long __initdata iSeries_recal_titan;
 static signed long __initdata iSeries_recal_tb;
 #endif
 
-/* The decrementer counts down by 128 every 128ns on a 601. */
-#define DECREMENTER_COUNT_601  (10 / HZ)
-
 #define XSEC_PER_SEC (1024*1024)
 
 #ifdef CONFIG_PPC64
@@ -348,39 +343,6 @@ void udelay(unsigned long usecs)
 }
 EXPORT_SYMBOL(udelay);
 
-static __inline__ void timer_check_rtc(void)
-{
-/*
- * update the rtc when needed, this should be performed on the
- * right fraction of a second. Half or full second ?
- * Full second works on mk48t59 clocks, others need testing.
- * Note that this update is basically only used through 
- * the adjtimex system calls. Setting the HW clock in
- * any other way is a /dev/rtc and userland business.
- * This is still wrong by -0.5/+1.5 jiffies because of the
- * timer interrupt resolution and possible delay, but here we 
- * hit a quantization limit which can only be solved by higher
- * resolution timers and decoupling time management from timer
- * interrupts. This is also wrong on the clocks
- * which require being written at the half second boundary.
- * We should have an rtc call that only sets the minutes and
- * seconds like on Intel to avoid problems with non UTC clocks.
- */
-if (ppc_md.set_rtc_time && ntp_synced() &&
-   xtime.tv_sec - last_rtc_update >= 659 &&
-   abs((xtime.tv_nsec/1000) - (100-100/HZ)) < 50/HZ) {
-   struct rtc_time tm;
-   to_tm(xtime.tv_sec + 1 + timezone_offset, &tm);
-   tm.tm_year -= 1900;
-   tm.tm_mon -= 1;
-   if (ppc_md.set_rtc_time(&tm) == 0)
-   last_rtc_update = xtime.tv_sec + 1;
-   else
-   /* Try again one minute later */
-   last_rtc_update += 60;
-}
-}
-
 /*
  * This version of gettimeofday has microsecond resolution.
  */
@@ -689,7 +651,6 @@ void timer_interrupt(struct pt_regs * re
tb_last_jiffy = tb_next_jiffy;
do_timer(1);
timer_recalc_offset(tb_last_jiffy);
-   timer_check_rtc();
}
write_sequnlock(&xtime_lock);
}
@@ -801,11 +762,6 @@ int do_settimeofday(struct timespec *tv)
set_normalized_timespec(&xtime, new_sec, new_nsec);
set_normalized_timespec(&wall_to_monotonic, wtm_sec, wtm_nsec);
 
-   /* In case of a large backwards jump in time with NTP, we want the 
-* clock to be updated as soon as the PLL is again in lock.
-*/
-   last_rtc_update = new_sec - 658;
-
ntp_clear();
 
new_xsec = xtime.tv_nsec;
@@ -881,12 +837,35 @@ void __init generic_calibrate_decr(void)
 #endif
 }
 
-unsigned long get_boot_time(void)
+int update_persistent_clock(struct timespec now)
 {
struct rtc_time tm;
 
-   if (ppc_md.get_boot_time)
-   return ppc_md.get_boot_time();
+   if (!ppc_md.set_rtc_time)
+   return 0;
+
+   to_tm(now.tv_sec + 1 + timezone_offset, &tm);
+   tm.tm_year -= 1900;
+   tm.tm_mon -= 1;
+
+   return ppc_md.set_rtc_time(&tm);
+}
+
+unsigned long read_persistent_clock(void)
+{
+   struct rtc_time tm;
+   static int first = 1;
+
+   /* XXX this is a litle fragile but will work okay in the short term */
+   if (first) {
+   first = 0;
+   if (ppc_md.time_init)
+   timezone_offset = ppc_md.time_init();
+
+   /* get_boot_time

[PATCH V2] powerpc mm init_32 gdb regions

2007-09-20 Thread Ed Swarthout
Add memory regions to the kcore list for 32-bit machines.

The entries are only 32-bit, so restrict the virtual address to stay
below 0x_.  With KERNELBASE set to 0xc000_, this in effect
restricts access to the first 1GB of real memory.

Make setup_kcore conditional on CONFIG_PROC_KCORE for both 32/64.

Signed-off-by: Ed Swarthout <[EMAIL PROTECTED]>
---

 arch/powerpc/mm/init_32.c |   37 +
 arch/powerpc/mm/init_64.c |2 ++
 2 files changed, 39 insertions(+), 0 deletions(-)

diff --git a/arch/powerpc/mm/init_32.c b/arch/powerpc/mm/init_32.c
index d65995a..27c234f 100644
--- a/arch/powerpc/mm/init_32.c
+++ b/arch/powerpc/mm/init_32.c
@@ -255,3 +255,40 @@ void free_initrd_mem(unsigned long start, unsigned long 
end)
}
 }
 #endif
+
+#ifdef CONFIG_PROC_KCORE
+static struct kcore_list kcore_vmem;
+
+static int __init setup_kcore(void)
+{
+   int i;
+
+   for (i = 0; i < lmb.memory.cnt; i++) {
+   unsigned long base;
+   unsigned long size;
+   struct kcore_list *kcore_mem;
+
+   base = lmb.memory.region[i].base;
+   size = lmb.memory.region[i].size;
+
+   kcore_mem = kmalloc(sizeof(struct kcore_list), GFP_ATOMIC);
+   if (!kcore_mem)
+   panic("%s: kmalloc failed\n", __FUNCTION__);
+
+   /* must stay under 32 bits */
+   if ( 0xul - (unsigned long)__va(base) < size) {
+   size = 0xul - (unsigned long)(__va(base));
+   printk(KERN_DEBUG "setup_kcore: restrict size=%lx\n",
+   size);
+   }
+
+   kclist_add(kcore_mem, __va(base), size);
+   }
+
+   kclist_add(&kcore_vmem, (void *)VMALLOC_START,
+   VMALLOC_END-VMALLOC_START);
+
+   return 0;
+}
+module_init(setup_kcore);
+#endif
diff --git a/arch/powerpc/mm/init_64.c b/arch/powerpc/mm/init_64.c
index 9f27bb5..fa90f65 100644
--- a/arch/powerpc/mm/init_64.c
+++ b/arch/powerpc/mm/init_64.c
@@ -113,6 +113,7 @@ void free_initrd_mem(unsigned long start, unsigned long end)
 }
 #endif
 
+#ifdef CONFIG_PROC_KCORE
 static struct kcore_list kcore_vmem;
 
 static int __init setup_kcore(void)
@@ -139,6 +140,7 @@ static int __init setup_kcore(void)
return 0;
 }
 module_init(setup_kcore);
+#endif
 
 static void zero_ctor(void *addr, struct kmem_cache *cache, unsigned long 
flags)
 {
-- 
1.5.3.1.65.g47184

___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: Please pull from 'for-2.6.24' branch of 4xx tree

2007-09-20 Thread Paul Mackerras
Josh Boyer writes:

> Please pull from
> 
>  master.kernel.org:/pub/scm/linux/kernel/git/jwboyer/powerpc.git for-2.6.24

Pulled and pushed out.

Paul.
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH] Disable power management for arch/ppc

2007-09-20 Thread Paul Mackerras
Currently the prep_defconfig in arch/ppc won't build due to swsusp
being broken.  This patch avoids the problem by essentially disabling
all power management on those platforms left in arch/ppc.

Signed-off-by: Paul Mackerras <[EMAIL PROTECTED]>
---
Does anyone have an objection to this?

diff --git a/arch/ppc/Kconfig b/arch/ppc/Kconfig
index c1b34eb..1360f17 100644
--- a/arch/ppc/Kconfig
+++ b/arch/ppc/Kconfig
@@ -1012,7 +1012,7 @@ config CMDLINE
  some command-line options at build time by entering them here.  In
  most cases you will need to specify the root device here.
 
-if !44x || BROKEN
+if BROKEN
 source kernel/power/Kconfig
 endif
 
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH] PowerPC: add setup_cpu for 44x for processor-specific init

2007-09-20 Thread Paul Mackerras
Valentine Barshak writes:

> +_GLOBAL(__setup_cpu_440epx)
> + mflrr4
> + bl  __init_fpu_44x
> +_GLOBAL(__setup_cpu_440grx)
> + bl  __plb_disable_wrp
> + mtlrr4
> + blr

If we enter at __setup_cpu_440grx we'll return to some bogus
address...

Paul.
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: Cleanups for physmap_of.c (v2)

2007-09-20 Thread David Gibson
On Thu, Sep 20, 2007 at 07:11:59PM +0200, Segher Boessenkool wrote:
> > - (the big one) Despite the name, this driver really has
> > nothing to do with drivers/mtd/physmap.c.  The fact that the flash
> > chips must be physically direct mapped is a constrant, but doesn't
> > really say anything about the actual purpose of this driver, which is
> > to instantiate MTD devices based on information from the device tree.
> > Therefore the physmap name is replaced everywhere within the file with
> > "of_flash".
> 
> Do you think this code will handle NAND flash later, too?  If not,
> maybe "of_norflash" is better?

Uh.. maybe?  I guess we can either extend it or rename it in the
future sometime.

-- 
David Gibson| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au  | minimalist, thank you.  NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH 1/2] bootwrapper: Factor out dt_set_mac_address().

2007-09-20 Thread David Gibson
On Thu, Sep 20, 2007 at 05:06:15PM -0500, Scott Wood wrote:
> This allows callers to set addresses one at a time when that would be more
> convenient.
> 
> Signed-off-by: Scott Wood <[EMAIL PROTECTED]>

Um... I feel bad whinging about such a tiny nit, but...

> +void dt_set_mac_address(u32 index, const u8 *addr)

.. I'd prefer it was called dt_fixup_mac_address() to match the other
functions.

-- 
David Gibson| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au  | minimalist, thank you.  NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH 6/9] fs_enet: Be an of_platform device when CONFIG_PPC_CPM_NEW_BINDING is set.

2007-09-20 Thread Scott Wood
On Fri, Sep 21, 2007 at 10:08:41AM +1000, Stephen Rothwell wrote:
> On Thu, 20 Sep 2007 17:01:21 -0500 Scott Wood <[EMAIL PROTECTED]> wrote:
> >
> > +++ b/drivers/net/fs_enet/fs_enet-main.c
> > @@ -44,12 +44,18 @@
> >  #include 
> >  #include 
> >  
> > +#ifdef CONFIG_PPC_CPM_NEW_BINDING
> > +#include 
> 
> Hmm, didn't I already ask you to change this to linux/of_platform.h?

Grrr, I thought I'd gotten them all.
 
-Scott
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH] [POWERPC] Create and use CONFIG_WORD_SIZE

2007-09-20 Thread Stephen Rothwell
Linus made this suggestion for the x86 merge and this starts the process
for powerpc. We assume that CONFIG_PPC64 implies CONFIG_PPC_MERGE and
CONFIG_PPC_STD_MMU_32 implies CONFIG_PPC_STD_MMU.

Signed-off-by: Stephen Rothwell <[EMAIL PROTECTED]>
---
 arch/powerpc/Kconfig |5 +
 arch/powerpc/Makefile|   21 -
 arch/powerpc/kernel/Makefile |   30 +-
 arch/powerpc/lib/Makefile|7 ---
 arch/powerpc/mm/Makefile |   13 -
 arch/ppc/Kconfig |4 
 6 files changed, 46 insertions(+), 34 deletions(-)

I got some strange warnings from allmodconfig and this version makes them
go away.  It appears that sometimes we don't include the config when
using the top level arch Makefile.

-- 
Cheers,
Stephen Rothwell[EMAIL PROTECTED]

diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 66a3295..de886ec 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -14,6 +14,11 @@ config 64BIT
bool
default y if PPC64
 
+config WORD_SIZE
+   int
+   default 64 if PPC64
+   default 32 if !PPC64
+
 config PPC_MERGE
def_bool y
 
diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
index 6015a92..4fda65e 100644
--- a/arch/powerpc/Makefile
+++ b/arch/powerpc/Makefile
@@ -39,7 +39,6 @@ KBUILD_DEFCONFIG := $(shell uname -m)_defconfig
 
 ifeq ($(CONFIG_PPC64),y)
 OLDARCH:= ppc64
-SZ := 64
 
 new_nm := $(shell if $(NM) --help 2>&1 | grep -- '--synthetic' > /dev/null; 
then echo y; else echo n; fi)
 
@@ -49,16 +48,21 @@ endif
 
 else
 OLDARCH:= ppc
-SZ := 32
+endif
+
+# It seems there are times we use this Makefile without
+# including the config file, but this replicates the old behaviour
+ifeq ($(CONFIG_WORD_SIZE),)
+CONFIG_WORD_SIZE := 32
 endif
 
 UTS_MACHINE := $(OLDARCH)
 
 ifeq ($(HAS_BIARCH),y)
-override AS+= -a$(SZ)
-override LD+= -m elf$(SZ)ppc
-override CC+= -m$(SZ)
-override AR:= GNUTARGET=elf$(SZ)-powerpc $(AR)
+override AS+= -a$(CONFIG_WORD_SIZE)
+override LD+= -m elf$(CONFIG_WORD_SIZE)ppc
+override CC+= -m$(CONFIG_WORD_SIZE)
+override AR:= GNUTARGET=elf$(CONFIG_WORD_SIZE)-powerpc $(AR)
 endif
 
 LDFLAGS_vmlinux:= -Bstatic
@@ -72,7 +76,7 @@ AFLAGS+= $(AFLAGS-y)
 CFLAGS += -msoft-float -pipe $(CFLAGS-y)
 CPP= $(CC) -E $(CFLAGS)
 
-CHECKFLAGS += -m$(SZ) -D__powerpc__ -D__powerpc$(SZ)__
+CHECKFLAGS += -m$(CONFIG_WORD_SIZE) -D__powerpc__ 
-D__powerpc$(CONFIG_WORD_SIZE)__
 
 ifeq ($(CONFIG_PPC64),y)
 GCC_BROKEN_VEC := $(shell if [ $(call cc-version) -lt 0400 ] ; then echo "y"; 
fi)
@@ -116,8 +120,7 @@ cpu-as-$(CONFIG_E200)   += -Wa,-me200
 AFLAGS += $(cpu-as-y)
 CFLAGS += $(cpu-as-y)
 
-head-y := arch/powerpc/kernel/head_32.o
-head-$(CONFIG_PPC64)   := arch/powerpc/kernel/head_64.o
+head-y := 
arch/powerpc/kernel/head_$(CONFIG_WORD_SIZE).o
 head-$(CONFIG_8xx) := arch/powerpc/kernel/head_8xx.o
 head-$(CONFIG_40x) := arch/powerpc/kernel/head_40x.o
 head-$(CONFIG_44x) := arch/powerpc/kernel/head_44x.o
diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile
index 967afc5..ef3633f 100644
--- a/arch/powerpc/kernel/Makefile
+++ b/arch/powerpc/kernel/Makefile
@@ -37,10 +37,10 @@ obj-$(CONFIG_GENERIC_TBSYNC)+= smp-tbsync.o
 obj-$(CONFIG_CRASH_DUMP)   += crash_dump.o
 obj-$(CONFIG_6xx)  += idle_6xx.o l2cr_6xx.o cpu_setup_6xx.o
 obj-$(CONFIG_TAU)  += tau_6xx.o
-obj-$(CONFIG_HIBERNATION)  += swsusp.o suspend.o
-obj32-$(CONFIG_HIBERNATION) += swsusp_32.o
-obj64-$(CONFIG_HIBERNATION) += swsusp_64.o swsusp_asm64.o
-obj32-$(CONFIG_MODULES)+= module_32.o
+obj-$(CONFIG_HIBERNATION)  += swsusp.o suspend.o \
+  swsusp_$(CONFIG_WORD_SIZE).o
+obj64-$(CONFIG_HIBERNATION)+= swsusp_asm64.o
+obj-$(CONFIG_MODULES)  += module_$(CONFIG_WORD_SIZE).o
 
 ifeq ($(CONFIG_PPC_MERGE),y)
 
@@ -53,9 +53,10 @@ extra-$(CONFIG_8xx)  := head_8xx.o
 extra-y+= vmlinux.lds
 
 obj-y  += time.o prom.o traps.o setup-common.o \
-  udbg.o misc.o io.o
-obj-$(CONFIG_PPC32)+= entry_32.o setup_32.o misc_32.o
-obj-$(CONFIG_PPC64)+= misc_64.o dma_64.o iommu.o
+  udbg.o misc.o io.o \
+  misc_$(CONFIG_WORD_SIZE).o
+obj-$(CONFIG_PPC32)+= entry_32.o setup_32.o
+obj-$(CONFIG_PPC64)+= dma_64.o iommu.o
 obj-$(CONFIG_PPC_MULTIPLATFORM)+= prom_init.o
 obj-$(CONFIG_MODULES)  += ppc_ksyms.o
 obj-$(CONFIG_BOOTX_TEXT)   += btext.o
@@ -63,16 +64,12 @@ obj-$(CONFIG_SMP)   += smp.o
 obj-$(CONFIG_KPROBES)  += kprobes.o
 obj-$(CONFIG_PPC_UDBG_16550)   +

Re: [PATCH 6/9] fs_enet: Be an of_platform device when CONFIG_PPC_CPM_NEW_BINDING is set.

2007-09-20 Thread Stephen Rothwell
On Thu, 20 Sep 2007 17:01:21 -0500 Scott Wood <[EMAIL PROTECTED]> wrote:
>
> +++ b/drivers/net/fs_enet/fs_enet-main.c
> @@ -44,12 +44,18 @@
>  #include 
>  #include 
>  
> +#ifdef CONFIG_PPC_CPM_NEW_BINDING
> +#include 

Hmm, didn't I already ask you to change this to linux/of_platform.h?

> +++ b/drivers/net/fs_enet/mac-fcc.c
> @@ -42,6 +42,10 @@
>  #include 
>  #include 
>  
> +#ifdef CONFIG_PPC_CPM_NEW_BINDING
> +#include 

And this to linux/of_device.h

> +++ b/drivers/net/fs_enet/mac-fec.c
> @@ -43,6 +43,10 @@
>  #include 
>  #endif
>  
> +#ifdef CONFIG_PPC_CPM_NEW_BINDING
> +#include 

And this?

> +++ b/drivers/net/fs_enet/mac-scc.c
> @@ -43,6 +43,10 @@
>  #include 
>  #endif
>  
> +#ifdef CONFIG_PPC_CPM_NEW_BINDING
> +#include 

And this

> +++ b/drivers/net/fs_enet/mii-fec.c
> @@ -36,6 +36,10 @@
>  #include 
>  #include 
>  
> +#ifdef CONFIG_PPC_CPM_NEW_BINDING
> +#include 

And here

Sorry if I missed these last time around.
-- 
Cheers,
Stephen Rothwell[EMAIL PROTECTED]
http://www.canb.auug.org.au/~sfr/


pgp8lVw6y3WVU.pgp
Description: PGP signature
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev

Re: [PATCH 2/5] Implement generic time of day clocksource for powerpc machines.

2007-09-20 Thread Tony Breeds
On Thu, Sep 20, 2007 at 09:35:10AM -0700, john stultz wrote:
 
> I think what Daniel is pointing out is that the clocksource read
> function isn't the place for the __USE_RTC() conditional. 
> 
> It would likely be better instead of the timebase clocksource managing
> multiple type of hardware (timebase and RTC), to have a separate simple
> RTC clocksource, and then conditionally register one or the other at
> init time.

I'll create a seperate clocksource for the RTC case and use that as
appropriate.  I'll resend the patch series after I've booted it :)

Yours Tony

  linux.conf.auhttp://linux.conf.au/ || http://lca2008.linux.org.au/
  Jan 28 - Feb 02 2008 The Australian Linux Technical Conference!

___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: 4xx git tree moved

2007-09-20 Thread Josh Boyer
On Fri, 2007-09-21 at 01:39 +0400, Vitaly Bordug wrote:
> Hello Josh,
> 
> On Thu, 20 Sep 2007 07:42:36 -0500
> Josh Boyer wrote:
> 
> > For those interested in 4xx, I've moved my git tree to kernel.org.  You
> > can find it here:
> > 
> > git://git.kernel.org/pub/scm/linux/kernel/git/jwboyer/powerpc.git
> > 
> Can you call it something like 4xx-powerpc.git, or powerpc-4xx.git? Number of 
> powerpc.git stuff tend to grow :)

Sure.  powerpc-4xx.git would be fine.  After Paul does my latest pull
request I'll rename it.

josh

___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH 2/2] bootwrapper: Add PlanetCore firmware support.

2007-09-20 Thread Scott Wood
This is a library that board code can use to extract information from the
PlanetCore configuration keys.  PlanetCore is used on various boards from
Embedded Planet.

Signed-off-by: Scott Wood <[EMAIL PROTECTED]>
---
This replaces the previous "Add PlanetCore firmware support" patch.

Besides using dt_set_mac_address(), it fixes a bug with MAC address
generation -- it previously assumed that the mac address in the environment
was of the first ethernet port, when it's actually of the currently
configured ethernet port.

 arch/powerpc/boot/Makefile |2 +-
 arch/powerpc/boot/planetcore.c |  166 
 arch/powerpc/boot/planetcore.h |   49 
 3 files changed, 216 insertions(+), 1 deletions(-)
 create mode 100644 arch/powerpc/boot/planetcore.c
 create mode 100644 arch/powerpc/boot/planetcore.h

diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile
index cffef14..9ec785c 100644
--- a/arch/powerpc/boot/Makefile
+++ b/arch/powerpc/boot/Makefile
@@ -45,7 +45,7 @@ src-wlib := string.S crt0.S stdio.c main.c flatdevtree.c 
flatdevtree_misc.c \
ns16550.c serial.c simple_alloc.c div64.S util.S \
gunzip_util.c elf_util.c $(zlib) devtree.c oflib.c ofconsole.c \
4xx.c ebony.c mv64x60.c mpsc.c mv64x60_i2c.c cuboot.c bamboo.c \
-   cpm-serial.c stdlib.c
+   cpm-serial.c stdlib.c planetcore.c
 src-plat := of.c cuboot-83xx.c cuboot-85xx.c holly.c \
cuboot-ebony.c treeboot-ebony.c prpmc2800.c \
ps3-head.S ps3-hvcall.S ps3.c treeboot-bamboo.c cuboot-8xx.c \
diff --git a/arch/powerpc/boot/planetcore.c b/arch/powerpc/boot/planetcore.c
new file mode 100644
index 000..203f296
--- /dev/null
+++ b/arch/powerpc/boot/planetcore.c
@@ -0,0 +1,166 @@
+/*
+ * PlanetCore configuration data support functions
+ *
+ * Author: Scott Wood <[EMAIL PROTECTED]>
+ *
+ * Copyright (c) 2007 Freescale Semiconductor, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 as published
+ * by the Free Software Foundation.
+ */
+
+#include "stdio.h"
+#include "stdlib.h"
+#include "ops.h"
+#include "planetcore.h"
+#include "io.h"
+
+/* PlanetCore passes information to the OS in the form of
+ * a table of key=value strings, separated by newlines.
+ *
+ * The list is terminated by an empty string (i.e. two
+ * consecutive newlines).
+ *
+ * To make it easier to parse, we first convert all the
+ * newlines into null bytes.
+ */
+
+void planetcore_prepare_table(char *table)
+{
+   do {
+   if (*table == '\n')
+   *table = 0;
+
+   table++;
+   } while (*(table - 1) || *table != '\n');
+
+   *table = 0;
+}
+
+const char *planetcore_get_key(const char *table, const char *key)
+{
+   int keylen = strlen(key);
+
+   do {
+   if (!strncmp(table, key, keylen) && table[keylen] == '=')
+   return table + keylen + 1;
+
+   table += strlen(table) + 1;
+   } while (strlen(table) != 0);
+
+   return NULL;
+}
+
+int planetcore_get_decimal(const char *table, const char *key, u64 *val)
+{
+   const char *str = planetcore_get_key(table, key);
+   if (!str)
+   return 0;
+
+   *val = strtoull(str, NULL, 10);
+   return 1;
+}
+
+int planetcore_get_hex(const char *table, const char *key, u64 *val)
+{
+   const char *str = planetcore_get_key(table, key);
+   if (!str)
+   return 0;
+
+   *val = strtoull(str, NULL, 16);
+   return 1;
+}
+
+static u64 mac_table[4] = {
+   0x,
+   0x0080,
+   0x0040,
+   0x00c0,
+};
+
+void planetcore_set_mac_addrs(const char *table)
+{
+   u8 addr[4][6];
+   u64 int_addr;
+   u32 i;
+   int j;
+
+   if (!planetcore_get_hex(table, PLANETCORE_KEY_MAC_ADDR, &int_addr))
+   return;
+
+   for (i = 0; i < 4; i++) {
+   u64 this_dev_addr = (int_addr & ~0x00c0) |
+   mac_table[i];
+
+   for (j = 5; j >= 0; j--) {
+   addr[i][j] = this_dev_addr & 0xff;
+   this_dev_addr >>= 8;
+   }
+
+   dt_set_mac_address(i, addr[i]);
+   }
+}
+
+static char prop_buf[MAX_PROP_LEN];
+
+void planetcore_set_stdout_path(const char *table)
+{
+   char *path;
+   const char *label;
+   void *node, *chosen;
+
+   label = planetcore_get_key(table, PLANETCORE_KEY_SERIAL_PORT);
+   if (!label)
+   return;
+
+   node = find_node_by_prop_value_str(NULL, "linux,planetcore-label",
+  label);
+   if (!node)
+   return;
+
+   path = get_path(node, prop_buf, MAX_PROP_LEN);
+   if (!path)
+   return;
+
+   chosen = finddevice("/c

[PATCH 1/2] bootwrapper: Factor out dt_set_mac_address().

2007-09-20 Thread Scott Wood
This allows callers to set addresses one at a time when that would be more
convenient.

Signed-off-by: Scott Wood <[EMAIL PROTECTED]>
---
 arch/powerpc/boot/devtree.c |   31 +--
 arch/powerpc/boot/ops.h |1 +
 2 files changed, 18 insertions(+), 14 deletions(-)

diff --git a/arch/powerpc/boot/devtree.c b/arch/powerpc/boot/devtree.c
index 549463b..d78e8b4 100644
--- a/arch/powerpc/boot/devtree.c
+++ b/arch/powerpc/boot/devtree.c
@@ -88,29 +88,32 @@ void dt_fixup_clock(const char *path, u32 freq)
}
 }
 
+void dt_set_mac_address(u32 index, const u8 *addr)
+{
+   void *devp = find_node_by_prop_value(NULL, "linux,network-index",
+(void*)&index, sizeof(index));
+
+   if (devp) {
+   printf("ENET%d: local-mac-address <-"
+  " %02x:%02x:%02x:%02x:%02x:%02x\n\r", index,
+  addr[0], addr[1], addr[2],
+  addr[3], addr[4], addr[5]);
+
+   setprop(devp, "local-mac-address", addr, 6);
+   }
+}
+
 void __dt_fixup_mac_addresses(u32 startindex, ...)
 {
va_list ap;
u32 index = startindex;
-   void *devp;
const u8 *addr;
 
va_start(ap, startindex);
-   while ((addr = va_arg(ap, const u8 *))) {
-   devp = find_node_by_prop_value(NULL, "linux,network-index",
-  (void*)&index, sizeof(index));
 
-   if (devp) {
-   printf("ENET%d: local-mac-address <-"
-  " %02x:%02x:%02x:%02x:%02x:%02x\n\r", index,
-  addr[0], addr[1], addr[2],
-  addr[3], addr[4], addr[5]);
+   while ((addr = va_arg(ap, const u8 *)))
+   dt_set_mac_address(index++, addr);
 
-   setprop(devp, "local-mac-address", addr, 6);
-   }
-
-   index++;
-   }
va_end(ap);
 }
 
diff --git a/arch/powerpc/boot/ops.h b/arch/powerpc/boot/ops.h
index 703255b..d7a9a28 100644
--- a/arch/powerpc/boot/ops.h
+++ b/arch/powerpc/boot/ops.h
@@ -160,6 +160,7 @@ static inline void *find_node_by_devtype(const void *prev,
 void dt_fixup_memory(u64 start, u64 size);
 void dt_fixup_cpu_clocks(u32 cpufreq, u32 tbfreq, u32 busfreq);
 void dt_fixup_clock(const char *path, u32 freq);
+void dt_set_mac_address(u32 index, const u8 *addr);
 void __dt_fixup_mac_addresses(u32 startindex, ...);
 #define dt_fixup_mac_addresses(...) \
__dt_fixup_mac_addresses(0, __VA_ARGS__, NULL)
-- 
1.5.3.1

___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH 9/9] fs_enet: sparse fixes

2007-09-20 Thread Scott Wood
Mostly a bunch of __iomem annotations.

Signed-off-by: Scott Wood <[EMAIL PROTECTED]>
---
 drivers/net/fs_enet/fs_enet-main.c |   16 +-
 drivers/net/fs_enet/fs_enet.h  |   30 +-
 drivers/net/fs_enet/mac-fcc.c  |   60 ---
 drivers/net/fs_enet/mac-fec.c  |   34 ++--
 drivers/net/fs_enet/mac-scc.c  |   37 +++---
 drivers/net/fs_enet/mii-fec.c  |6 ++--
 6 files changed, 96 insertions(+), 87 deletions(-)

diff --git a/drivers/net/fs_enet/fs_enet-main.c 
b/drivers/net/fs_enet/fs_enet-main.c
index 281b7d7..876de8c 100644
--- a/drivers/net/fs_enet/fs_enet-main.c
+++ b/drivers/net/fs_enet/fs_enet-main.c
@@ -62,7 +62,7 @@ MODULE_DESCRIPTION("Freescale Ethernet Driver");
 MODULE_LICENSE("GPL");
 MODULE_VERSION(DRV_MODULE_VERSION);
 
-int fs_enet_debug = -1;/* -1 == use FS_ENET_DEF_MSG_ENABLE as 
value */
+static int fs_enet_debug = -1; /* -1 == use FS_ENET_DEF_MSG_ENABLE as value */
 module_param(fs_enet_debug, int, 0);
 MODULE_PARM_DESC(fs_enet_debug,
 "Freescale bitmapped debugging message enable value");
@@ -88,7 +88,7 @@ static int fs_enet_rx_napi(struct net_device *dev, int 
*budget)
 {
struct fs_enet_private *fep = netdev_priv(dev);
const struct fs_platform_info *fpi = fep->fpi;
-   cbd_t *bdp;
+   cbd_t __iomem *bdp;
struct sk_buff *skb, *skbn, *skbt;
int received = 0;
u16 pkt_len, sc;
@@ -240,7 +240,7 @@ static int fs_enet_rx_non_napi(struct net_device *dev)
 {
struct fs_enet_private *fep = netdev_priv(dev);
const struct fs_platform_info *fpi = fep->fpi;
-   cbd_t *bdp;
+   cbd_t __iomem *bdp;
struct sk_buff *skb, *skbn, *skbt;
int received = 0;
u16 pkt_len, sc;
@@ -365,7 +365,7 @@ static int fs_enet_rx_non_napi(struct net_device *dev)
 static void fs_enet_tx(struct net_device *dev)
 {
struct fs_enet_private *fep = netdev_priv(dev);
-   cbd_t *bdp;
+   cbd_t __iomem *bdp;
struct sk_buff *skb;
int dirtyidx, do_wake, do_restart;
u16 sc;
@@ -513,7 +513,7 @@ fs_enet_interrupt(int irq, void *dev_id)
 void fs_init_bds(struct net_device *dev)
 {
struct fs_enet_private *fep = netdev_priv(dev);
-   cbd_t *bdp;
+   cbd_t __iomem *bdp;
struct sk_buff *skb;
int i;
 
@@ -567,7 +567,7 @@ void fs_cleanup_bds(struct net_device *dev)
 {
struct fs_enet_private *fep = netdev_priv(dev);
struct sk_buff *skb;
-   cbd_t *bdp;
+   cbd_t __iomem *bdp;
int i;
 
/*
@@ -608,7 +608,7 @@ void fs_cleanup_bds(struct net_device *dev)
 static int fs_enet_start_xmit(struct sk_buff *skb, struct net_device *dev)
 {
struct fs_enet_private *fep = netdev_priv(dev);
-   cbd_t *bdp;
+   cbd_t __iomem *bdp;
int curidx;
u16 sc;
unsigned long flags;
@@ -1144,7 +1144,7 @@ static int fs_cleanup_instance(struct net_device *ndev)
 
/**/
 
 /* handy pointer to the immap */
-void *fs_enet_immap = NULL;
+void __iomem *fs_enet_immap = NULL;
 
 static int setup_immap(void)
 {
diff --git a/drivers/net/fs_enet/fs_enet.h b/drivers/net/fs_enet/fs_enet.h
index 14ebba8..4a8a101 100644
--- a/drivers/net/fs_enet/fs_enet.h
+++ b/drivers/net/fs_enet/fs_enet.h
@@ -15,7 +15,7 @@
 #include 
 
 struct fec_info {
-   fec_t *fecp;
+   fec_t __iomem *fecp;
u32 mii_speed;
 };
 #endif
@@ -80,14 +80,14 @@ struct fs_enet_private {
const struct fs_ops *ops;
int rx_ring, tx_ring;
dma_addr_t ring_mem_addr;
-   void *ring_base;
+   void __iomem *ring_base;
struct sk_buff **rx_skbuff;
struct sk_buff **tx_skbuff;
-   cbd_t *rx_bd_base;  /* Address of Rx and Tx buffers.*/
-   cbd_t *tx_bd_base;
-   cbd_t *dirty_tx;/* ring entries to be free()ed. */
-   cbd_t *cur_rx;
-   cbd_t *cur_tx;
+   cbd_t __iomem *rx_bd_base;  /* Address of Rx and Tx buffers.*/
+   cbd_t __iomem *tx_bd_base;
+   cbd_t __iomem *dirty_tx;/* ring entries to be free()ed. */
+   cbd_t __iomem *cur_rx;
+   cbd_t __iomem *cur_tx;
int tx_free;
struct net_device_stats stats;
struct timer_list phy_timer_list;
@@ -112,23 +112,23 @@ struct fs_enet_private {
union {
struct {
int idx;/* FEC1 = 0, FEC2 = 1  */
-   void *fecp; /* hw registers*/
+   void __iomem *fecp; /* hw registers*/
u32 hthi, htlo; /* state for multicast */
} fec;
 
struct {
int idx;/* FCC1-3 = 0-2*/
-   void *fccp; /* hw registers*/
- 

[PATCH 6/9] fs_enet: Be an of_platform device when CONFIG_PPC_CPM_NEW_BINDING is set.

2007-09-20 Thread Scott Wood
The existing OF glue code was crufty and broken.  Rather than fix it, it
will be removed, and the ethernet driver now talks to the device tree
directly.

The old, non-CONFIG_PPC_CPM_NEW_BINDING code can go away once CPM
platforms are dropped from arch/ppc (which will hopefully be soon), and
existing arch/powerpc boards that I wasn't able to test on for this
patchset get converted (which should be even sooner).

Signed-off-by: Scott Wood <[EMAIL PROTECTED]>
---
 drivers/net/fs_enet/Kconfig|1 +
 drivers/net/fs_enet/fs_enet-main.c |  259 ---
 drivers/net/fs_enet/fs_enet.h  |   55 +---
 drivers/net/fs_enet/mac-fcc.c  |   89 +
 drivers/net/fs_enet/mac-fec.c  |   19 +++-
 drivers/net/fs_enet/mac-scc.c  |   53 +--
 drivers/net/fs_enet/mii-bitbang.c  |  269 +++-
 drivers/net/fs_enet/mii-fec.c  |  143 +++-
 include/linux/fs_enet_pd.h |5 +
 9 files changed, 714 insertions(+), 179 deletions(-)

diff --git a/drivers/net/fs_enet/Kconfig b/drivers/net/fs_enet/Kconfig
index e27ee21..2765e49 100644
--- a/drivers/net/fs_enet/Kconfig
+++ b/drivers/net/fs_enet/Kconfig
@@ -11,6 +11,7 @@ config FS_ENET_HAS_SCC
 config FS_ENET_HAS_FCC
bool "Chip has an FCC usable for ethernet"
depends on FS_ENET && CPM2
+   select MDIO_BITBANG
default y
 
 config FS_ENET_HAS_FEC
diff --git a/drivers/net/fs_enet/fs_enet-main.c 
b/drivers/net/fs_enet/fs_enet-main.c
index a4b76cd..281b7d7 100644
--- a/drivers/net/fs_enet/fs_enet-main.c
+++ b/drivers/net/fs_enet/fs_enet-main.c
@@ -44,12 +44,18 @@
 #include 
 #include 
 
+#ifdef CONFIG_PPC_CPM_NEW_BINDING
+#include 
+#endif
+
 #include "fs_enet.h"
 
 /*/
 
+#ifndef CONFIG_PPC_CPM_NEW_BINDING
 static char version[] __devinitdata =
 DRV_MODULE_NAME ".c:v" DRV_MODULE_VERSION " (" DRV_MODULE_RELDATE ")" "\n";
+#endif
 
 MODULE_AUTHOR("Pantelis Antoniou <[EMAIL PROTECTED]>");
 MODULE_DESCRIPTION("Freescale Ethernet Driver");
@@ -953,6 +959,7 @@ static int fs_ioctl(struct net_device *dev, struct ifreq 
*rq, int cmd)
 extern int fs_mii_connect(struct net_device *dev);
 extern void fs_mii_disconnect(struct net_device *dev);
 
+#ifndef CONFIG_PPC_CPM_NEW_BINDING
 static struct net_device *fs_init_instance(struct device *dev,
struct fs_platform_info *fpi)
 {
@@ -1132,6 +1139,7 @@ static int fs_cleanup_instance(struct net_device *ndev)
 
return 0;
 }
+#endif
 
 
/**/
 
@@ -1140,35 +1148,250 @@ void *fs_enet_immap = NULL;
 
 static int setup_immap(void)
 {
-   phys_addr_t paddr = 0;
-   unsigned long size = 0;
-
 #ifdef CONFIG_CPM1
-   paddr = IMAP_ADDR;
-   size = 0x1; /* map 64K */
-#endif
-
-#ifdef CONFIG_CPM2
-   paddr = CPM_MAP_ADDR;
-   size = 0x4; /* map 256 K */
+   fs_enet_immap = ioremap(IMAP_ADDR, 0x4000);
+   WARN_ON(!fs_enet_immap);
+#elif defined(CONFIG_CPM2)
+   fs_enet_immap = cpm2_immr;
 #endif
-   fs_enet_immap = ioremap(paddr, size);
-   if (fs_enet_immap == NULL)
-   return -EBADF;  /* XXX ahem; maybe just BUG_ON? */
 
return 0;
 }
 
 static void cleanup_immap(void)
 {
-   if (fs_enet_immap != NULL) {
-   iounmap(fs_enet_immap);
-   fs_enet_immap = NULL;
-   }
+#if defined(CONFIG_CPM1)
+   iounmap(fs_enet_immap);
+#endif
 }
 
 
/**/
 
+#ifdef CONFIG_PPC_CPM_NEW_BINDING
+static int __devinit find_phy(struct device_node *np,
+  struct fs_platform_info *fpi)
+{
+   struct device_node *phynode, *mdionode;
+   struct resource res;
+   int ret = 0, len;
+
+   const u32 *data = of_get_property(np, "phy-handle", &len);
+   if (!data || len != 4)
+   return -EINVAL;
+
+   phynode = of_find_node_by_phandle(*data);
+   if (!phynode)
+   return -EINVAL;
+
+   mdionode = of_get_parent(phynode);
+   if (!phynode)
+   goto out_put_phy;
+
+   ret = of_address_to_resource(mdionode, 0, &res);
+   if (ret)
+   goto out_put_mdio;
+
+   data = of_get_property(phynode, "reg", &len);
+   if (!data || len != 4)
+   goto out_put_mdio;
+
+   snprintf(fpi->bus_id, 16, PHY_ID_FMT, res.start, *data);
+
+out_put_mdio:
+   of_node_put(mdionode);
+out_put_phy:
+   of_node_put(phynode);
+   return ret;
+}
+
+#ifdef CONFIG_FS_ENET_HAS_FEC
+#define IS_FEC(match) ((match)->data == &fs_fec_ops)
+#else
+#define IS_FEC(match) 0
+#endif
+
+static int __devinit fs_enet_probe(struct of_device *ofdev,
+   const struct of_device_id *match)
+{
+   struct net_device *ndev;
+   struct fs_enet_private *fep;
+   struct fs_platfor

[PATCH 8/9] fs_enet: Convert mii-bitbang to use the generic bitbang MDIO code.

2007-09-20 Thread Scott Wood
Signed-off-by: Scott Wood <[EMAIL PROTECTED]>
---
 drivers/net/fs_enet/mii-bitbang.c |  270 -
 1 files changed, 54 insertions(+), 216 deletions(-)

diff --git a/drivers/net/fs_enet/mii-bitbang.c 
b/drivers/net/fs_enet/mii-bitbang.c
index 2b9c44c..5732890 100644
--- a/drivers/net/fs_enet/mii-bitbang.c
+++ b/drivers/net/fs_enet/mii-bitbang.c
@@ -15,15 +15,13 @@
 #include 
 #include 
 #include 
-#include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
-#include 
-#include 
 #include 
+#include 
 
 #ifdef CONFIG_PPC_CPM_NEW_BINDING
 #include 
@@ -32,11 +30,11 @@
 #include "fs_enet.h"
 
 struct bb_info {
+   struct mdiobb_ctrl ctrl;
__be32 __iomem *dir;
__be32 __iomem *dat;
u32 mdio_msk;
u32 mdc_msk;
-   int delay;
 };
 
 /* FIXME: If any other users of GPIO crop up, then these will have to
@@ -59,212 +57,58 @@ static inline int bb_read(u32 __iomem *p, u32 m)
return (in_be32(p) & m) != 0;
 }
 
-static inline void mdio_active(struct bb_info *bitbang)
+static inline void mdio_dir(struct mdiobb_ctrl *ctrl, int dir)
 {
-   bb_set(bitbang->dir, bitbang->mdio_msk);
-}
+   struct bb_info *bitbang = container_of(ctrl, struct bb_info, ctrl);
 
-static inline void mdio_tristate(struct bb_info *bitbang)
-{
-   bb_clr(bitbang->dir, bitbang->mdio_msk);
+   if (dir)
+   bb_set(bitbang->dir, bitbang->mdio_msk);
+   else
+   bb_clr(bitbang->dir, bitbang->mdio_msk);
+
+   /* Read back to flush the write. */
+   in_be32(bitbang->dir);
 }
 
-static inline int mdio_read(struct bb_info *bitbang)
+static inline int mdio_read(struct mdiobb_ctrl *ctrl)
 {
+   struct bb_info *bitbang = container_of(ctrl, struct bb_info, ctrl);
return bb_read(bitbang->dat, bitbang->mdio_msk);
 }
 
-static inline void mdio(struct bb_info *bitbang, int what)
+static inline void mdio(struct mdiobb_ctrl *ctrl, int what)
 {
+   struct bb_info *bitbang = container_of(ctrl, struct bb_info, ctrl);
+
if (what)
bb_set(bitbang->dat, bitbang->mdio_msk);
else
bb_clr(bitbang->dat, bitbang->mdio_msk);
+
+   /* Read back to flush the write. */
+   in_be32(bitbang->dat);
 }
 
-static inline void mdc(struct bb_info *bitbang, int what)
+static inline void mdc(struct mdiobb_ctrl *ctrl, int what)
 {
+   struct bb_info *bitbang = container_of(ctrl, struct bb_info, ctrl);
+
if (what)
bb_set(bitbang->dat, bitbang->mdc_msk);
else
bb_clr(bitbang->dat, bitbang->mdc_msk);
-}
-
-static inline void mii_delay(struct bb_info *bitbang)
-{
-   udelay(bitbang->delay);
-}
-
-/* Utility to send the preamble, address, and register (common to read and 
write). */
-static void bitbang_pre(struct bb_info *bitbang , int read, u8 addr, u8 reg)
-{
-   int j;
-
-   /*
-* Send a 32 bit preamble ('1's) with an extra '1' bit for good measure.
-* The IEEE spec says this is a PHY optional requirement.  The AMD
-* 79C874 requires one after power up and one after a MII communications
-* error.  This means that we are doing more preambles than we need,
-* but it is safer and will be much more robust.
-*/
-
-   mdio_active(bitbang);
-   mdio(bitbang, 1);
-   for (j = 0; j < 32; j++) {
-   mdc(bitbang, 0);
-   mii_delay(bitbang);
-   mdc(bitbang, 1);
-   mii_delay(bitbang);
-   }
-
-   /* send the start bit (01) and the read opcode (10) or write (10) */
-   mdc(bitbang, 0);
-   mdio(bitbang, 0);
-   mii_delay(bitbang);
-   mdc(bitbang, 1);
-   mii_delay(bitbang);
-   mdc(bitbang, 0);
-   mdio(bitbang, 1);
-   mii_delay(bitbang);
-   mdc(bitbang, 1);
-   mii_delay(bitbang);
-   mdc(bitbang, 0);
-   mdio(bitbang, read);
-   mii_delay(bitbang);
-   mdc(bitbang, 1);
-   mii_delay(bitbang);
-   mdc(bitbang, 0);
-   mdio(bitbang, !read);
-   mii_delay(bitbang);
-   mdc(bitbang, 1);
-   mii_delay(bitbang);
-
-   /* send the PHY address */
-   for (j = 0; j < 5; j++) {
-   mdc(bitbang, 0);
-   mdio(bitbang, (addr & 0x10) != 0);
-   mii_delay(bitbang);
-   mdc(bitbang, 1);
-   mii_delay(bitbang);
-   addr <<= 1;
-   }
 
-   /* send the register address */
-   for (j = 0; j < 5; j++) {
-   mdc(bitbang, 0);
-   mdio(bitbang, (reg & 0x10) != 0);
-   mii_delay(bitbang);
-   mdc(bitbang, 1);
-   mii_delay(bitbang);
-   reg <<= 1;
-   }
+   /* Read back to flush the write. */
+   in_be32(bitbang->dat);
 }
 
-static int fs_enet_mii_bb_read(struct mii_bus *bus , int phy_id, int location)
-{
-   u16 rdreg;
-   int ret, j;
-   u8 addr = phy_id & 0xff;
-   u8 r

[PATCH 7/9] Generic bitbanged MDIO library

2007-09-20 Thread Scott Wood
Previously, bitbanged MDIO was only supported in individual
hardware-specific drivers.  This code factors out the higher level
protocol implementation, reducing the hardware-specific portion to
functions setting direction, data, and clock.

Signed-off-by: Scott Wood <[EMAIL PROTECTED]>
---
 drivers/net/phy/Kconfig|9 ++
 drivers/net/phy/Makefile   |1 +
 drivers/net/phy/mdio-bitbang.c |  187 
 include/linux/mdio-bitbang.h   |   42 +
 4 files changed, 239 insertions(+), 0 deletions(-)
 create mode 100644 drivers/net/phy/mdio-bitbang.c
 create mode 100644 include/linux/mdio-bitbang.h

diff --git a/drivers/net/phy/Kconfig b/drivers/net/phy/Kconfig
index dd09011..72a98dd 100644
--- a/drivers/net/phy/Kconfig
+++ b/drivers/net/phy/Kconfig
@@ -76,4 +76,13 @@ config FIXED_MII_100_FDX
bool "Emulation for 100M Fdx fixed PHY behavior"
depends on FIXED_PHY
 
+config MDIO_BITBANG
+   tristate "Support for bitbanged MDIO buses"
+   help
+ This module implements the MDIO bus protocol in software,
+ for use by low level drivers that export the ability to
+ drive the relevant pins.
+
+ If in doubt, say N.
+
 endif # PHYLIB
diff --git a/drivers/net/phy/Makefile b/drivers/net/phy/Makefile
index 8885650..3d6cc7b 100644
--- a/drivers/net/phy/Makefile
+++ b/drivers/net/phy/Makefile
@@ -13,3 +13,4 @@ obj-$(CONFIG_VITESSE_PHY) += vitesse.o
 obj-$(CONFIG_BROADCOM_PHY) += broadcom.o
 obj-$(CONFIG_ICPLUS_PHY)   += icplus.o
 obj-$(CONFIG_FIXED_PHY)+= fixed.o
+obj-$(CONFIG_MDIO_BITBANG) += mdio-bitbang.o
diff --git a/drivers/net/phy/mdio-bitbang.c b/drivers/net/phy/mdio-bitbang.c
new file mode 100644
index 000..8cd243d
--- /dev/null
+++ b/drivers/net/phy/mdio-bitbang.c
@@ -0,0 +1,187 @@
+/*
+ * Bitbanged MDIO support.
+ *
+ * Author: Scott Wood <[EMAIL PROTECTED]>
+ * Copyright (c) 2007 Freescale Semiconductor
+ *
+ * Based on CPM2 MDIO code which is:
+ *
+ * Copyright (c) 2003 Intracom S.A.
+ *  by Pantelis Antoniou <[EMAIL PROTECTED]>
+ *
+ * 2005 (c) MontaVista Software, Inc.
+ * Vitaly Bordug <[EMAIL PROTECTED]>
+ *
+ * This file is licensed under the terms of the GNU General Public License
+ * version 2. This program is licensed "as is" without any warranty of any
+ * kind, whether express or implied.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define MDIO_READ 1
+#define MDIO_WRITE 0
+
+#define MDIO_SETUP_TIME 10
+#define MDIO_HOLD_TIME 10
+
+/* Minimum MDC period is 400 ns, plus some margin for error.  MDIO_DELAY
+ * is done twice per period.
+ */
+#define MDIO_DELAY 250
+
+/* The PHY may take up to 300 ns to produce data, plus some margin
+ * for error.
+ */
+#define MDIO_READ_DELAY 350
+
+/* MDIO must already be configured as output. */
+static void mdiobb_send_bit(struct mdiobb_ctrl *ctrl, int val)
+{
+   const struct mdiobb_ops *ops = ctrl->ops;
+
+   ops->set_mdio_data(ctrl, val);
+   ndelay(MDIO_DELAY);
+   ops->set_mdc(ctrl, 1);
+   ndelay(MDIO_DELAY);
+   ops->set_mdc(ctrl, 0);
+}
+
+/* MDIO must already be configured as input. */
+static int mdiobb_get_bit(struct mdiobb_ctrl *ctrl)
+{
+   const struct mdiobb_ops *ops = ctrl->ops;
+
+   ndelay(MDIO_DELAY);
+   ops->set_mdc(ctrl, 1);
+   ndelay(MDIO_READ_DELAY);
+   ops->set_mdc(ctrl, 0);
+
+   return ops->get_mdio_data(ctrl);
+}
+
+/* MDIO must already be configured as output. */
+static void mdiobb_send_num(struct mdiobb_ctrl *ctrl, u16 val, int bits)
+{
+   int i;
+
+   for (i = bits - 1; i >= 0; i--)
+   mdiobb_send_bit(ctrl, (val >> i) & 1);
+}
+
+/* MDIO must already be configured as input. */
+static u16 mdiobb_get_num(struct mdiobb_ctrl *ctrl, int bits)
+{
+   int i;
+   u16 ret = 0;
+
+   for (i = bits - 1; i >= 0; i--) {
+   ret <<= 1;
+   ret |= mdiobb_get_bit(ctrl);
+   }
+
+   return ret;
+}
+
+/* Utility to send the preamble, address, and
+ * register (common to read and write).
+ */
+static void mdiobb_cmd(struct mdiobb_ctrl *ctrl, int read, u8 phy, u8 reg)
+{
+   const struct mdiobb_ops *ops = ctrl->ops;
+   int i;
+
+   ops->set_mdio_dir(ctrl, 1);
+
+   /*
+* Send a 32 bit preamble ('1's) with an extra '1' bit for good
+* measure.  The IEEE spec says this is a PHY optional
+* requirement.  The AMD 79C874 requires one after power up and
+* one after a MII communications error.  This means that we are
+* doing more preambles than we need, but it is safer and will be
+* much more robust.
+*/
+
+   for (i = 0; i < 32; i++)
+   mdiobb_send_bit(ctrl, 1);
+
+   /* send the start bit (01) and the read opcode (10) or write (10) */
+   mdiobb_send_bit(ctrl, 0);
+   mdiobb_send_bit(ctrl, 1);
+   mdiobb_send_bit(ctrl, read);
+   mdiobb_send_bit(ctrl, !read);
+
+   mdiob

[PATCH 5/9] fs_enet: Align receive buffers.

2007-09-20 Thread Scott Wood
At least some hardware driven by this driver needs receive buffers
to be aligned on a 16-byte boundary.  This usually happens by chance,
but it breaks if slab debugging is enabled.

Signed-off-by: Scott Wood <[EMAIL PROTECTED]>
---
 drivers/net/fs_enet/fs_enet-main.c |   21 +++--
 drivers/net/fs_enet/fs_enet.h  |3 ++-
 2 files changed, 21 insertions(+), 3 deletions(-)

diff --git a/drivers/net/fs_enet/fs_enet-main.c 
b/drivers/net/fs_enet/fs_enet-main.c
index da79a45..a4b76cd 100644
--- a/drivers/net/fs_enet/fs_enet-main.c
+++ b/drivers/net/fs_enet/fs_enet-main.c
@@ -69,6 +69,14 @@ static void fs_set_multicast_list(struct net_device *dev)
(*fep->ops->set_multicast_list)(dev);
 }
 
+static void skb_align(struct sk_buff *skb, int align)
+{
+   int off = ((unsigned long)skb->data) & (align - 1);
+
+   if (off)
+   skb_reserve(skb, align - off);
+}
+
 /* NAPI receive function */
 static int fs_enet_rx_napi(struct net_device *dev, int *budget)
 {
@@ -166,9 +174,13 @@ static int fs_enet_rx_napi(struct net_device *dev, int 
*budget)
skb = skbn;
skbn = skbt;
}
-   } else
+   } else {
skbn = dev_alloc_skb(ENET_RX_FRSIZE);
 
+   if (skbn)
+   skb_align(skbn, ENET_RX_ALIGN);
+   }
+
if (skbn != NULL) {
skb_put(skb, pkt_len);  /* Make room */
skb->protocol = eth_type_trans(skb, dev);
@@ -300,9 +312,13 @@ static int fs_enet_rx_non_napi(struct net_device *dev)
skb = skbn;
skbn = skbt;
}
-   } else
+   } else {
skbn = dev_alloc_skb(ENET_RX_FRSIZE);
 
+   if (skbn)
+   skb_align(skbn, ENET_RX_ALIGN);
+   }
+
if (skbn != NULL) {
skb_put(skb, pkt_len);  /* Make room */
skb->protocol = eth_type_trans(skb, dev);
@@ -512,6 +528,7 @@ void fs_init_bds(struct net_device *dev)
   dev->name);
break;
}
+   skb_align(skb, ENET_RX_ALIGN);
fep->rx_skbuff[i] = skb;
CBDW_BUFADDR(bdp,
dma_map_single(fep->dev, skb->data,
diff --git a/drivers/net/fs_enet/fs_enet.h b/drivers/net/fs_enet/fs_enet.h
index 72a61e9..f8c7ee8 100644
--- a/drivers/net/fs_enet/fs_enet.h
+++ b/drivers/net/fs_enet/fs_enet.h
@@ -82,7 +82,8 @@ struct phy_info {
 /* Must be a multiple of 32 (to cover both FEC & FCC) */
 #define PKT_MAXBLR_SIZE((PKT_MAXBUF_SIZE + 31) & ~31)
 /* This is needed so that invalidate_xxx wont invalidate too much */
-#define ENET_RX_FRSIZE L1_CACHE_ALIGN(PKT_MAXBUF_SIZE)
+#define ENET_RX_ALIGN  16
+#define ENET_RX_FRSIZE L1_CACHE_ALIGN(PKT_MAXBUF_SIZE + ENET_RX_ALIGN - 1)
 
 struct fs_enet_mii_bus {
struct list_head list;
-- 
1.5.3.1

___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH 4/9] fs_enet: mac-fcc: Eliminate __fcc-* macros.

2007-09-20 Thread Scott Wood
These macros accomplish nothing other than defeating type checking.

This patch also fixes one instance of the wrong register size being
used that was revealed by enabling type checking.

Signed-off-by: Scott Wood <[EMAIL PROTECTED]>
---
 drivers/net/fs_enet/mac-fcc.c |   25 -
 1 files changed, 8 insertions(+), 17 deletions(-)

diff --git a/drivers/net/fs_enet/mac-fcc.c b/drivers/net/fs_enet/mac-fcc.c
index ad3c5fa..8b30361 100644
--- a/drivers/net/fs_enet/mac-fcc.c
+++ b/drivers/net/fs_enet/mac-fcc.c
@@ -48,28 +48,19 @@
 
 /* FCC access macros */
 
-#define __fcc_out32(addr, x)   out_be32((unsigned *)addr, x)
-#define __fcc_out16(addr, x)   out_be16((unsigned short *)addr, x)
-#define __fcc_out8(addr, x)out_8((unsigned char *)addr, x)
-#define __fcc_in32(addr)   in_be32((unsigned *)addr)
-#define __fcc_in16(addr)   in_be16((unsigned short *)addr)
-#define __fcc_in8(addr)in_8((unsigned char *)addr)
-
-/* parameter space */
-
 /* write, read, set bits, clear bits */
-#define W32(_p, _m, _v)__fcc_out32(&(_p)->_m, (_v))
-#define R32(_p, _m)__fcc_in32(&(_p)->_m)
+#define W32(_p, _m, _v)out_be32(&(_p)->_m, (_v))
+#define R32(_p, _m)in_be32(&(_p)->_m)
 #define S32(_p, _m, _v)W32(_p, _m, R32(_p, _m) | (_v))
 #define C32(_p, _m, _v)W32(_p, _m, R32(_p, _m) & ~(_v))
 
-#define W16(_p, _m, _v)__fcc_out16(&(_p)->_m, (_v))
-#define R16(_p, _m)__fcc_in16(&(_p)->_m)
+#define W16(_p, _m, _v)out_be16(&(_p)->_m, (_v))
+#define R16(_p, _m)in_be16(&(_p)->_m)
 #define S16(_p, _m, _v)W16(_p, _m, R16(_p, _m) | (_v))
 #define C16(_p, _m, _v)W16(_p, _m, R16(_p, _m) & ~(_v))
 
-#define W8(_p, _m, _v) __fcc_out8(&(_p)->_m, (_v))
-#define R8(_p, _m) __fcc_in8(&(_p)->_m)
+#define W8(_p, _m, _v) out_8(&(_p)->_m, (_v))
+#define R8(_p, _m) in_8(&(_p)->_m)
 #define S8(_p, _m, _v) W8(_p, _m, R8(_p, _m) | (_v))
 #define C8(_p, _m, _v) W8(_p, _m, R8(_p, _m) & ~(_v))
 
@@ -290,7 +281,7 @@ static void restart(struct net_device *dev)
 
/* clear everything (slow & steady does it) */
for (i = 0; i < sizeof(*ep); i++)
-   __fcc_out8((char *)ep + i, 0);
+   out_8((char *)ep + i, 0);
 
/* get physical address */
rx_bd_base_phys = fep->ring_mem_addr;
@@ -495,7 +486,7 @@ static void tx_kickstart(struct net_device *dev)
struct fs_enet_private *fep = netdev_priv(dev);
fcc_t *fccp = fep->fcc.fccp;
 
-   S32(fccp, fcc_ftodr, 0x80);
+   S16(fccp, fcc_ftodr, 0x8000);
 }
 
 static u32 get_int_events(struct net_device *dev)
-- 
1.5.3.1

___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH 3/9] fs_enet: Don't share the interrupt.

2007-09-20 Thread Scott Wood
This driver can't handle an interrupt immediately after request_irq
(making it fail with CONFIG_DEBUG_SHIRQ), and has unshared interrupts
on all hardware I'm aware of.

Signed-off-by: Scott Wood <[EMAIL PROTECTED]>
---
 drivers/net/fs_enet/fs_enet-main.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/net/fs_enet/fs_enet-main.c 
b/drivers/net/fs_enet/fs_enet-main.c
index f261b90..da79a45 100644
--- a/drivers/net/fs_enet/fs_enet-main.c
+++ b/drivers/net/fs_enet/fs_enet-main.c
@@ -667,7 +667,7 @@ static int fs_request_irq(struct net_device *dev, int irq, 
const char *name,
struct fs_enet_private *fep = netdev_priv(dev);
 
(*fep->ops->pre_request_irq)(dev, irq);
-   return request_irq(irq, irqf, IRQF_SHARED, name, dev);
+   return request_irq(irq, irqf, 0, name, dev);
 }
 
 static void fs_free_irq(struct net_device *dev, int irq)
-- 
1.5.3.1

___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH 2/9] fs_enet: Include linux/string.h from linux/fs_enet_pd.h

2007-09-20 Thread Scott Wood
It is needed for strstr().

Signed-off-by: Scott Wood <[EMAIL PROTECTED]>
---
 include/linux/fs_enet_pd.h |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/include/linux/fs_enet_pd.h b/include/linux/fs_enet_pd.h
index 543cd3c..815c6f9 100644
--- a/include/linux/fs_enet_pd.h
+++ b/include/linux/fs_enet_pd.h
@@ -16,6 +16,7 @@
 #ifndef FS_ENET_PD_H
 #define FS_ENET_PD_H
 
+#include 
 #include 
 
 #define FS_ENET_NAME   "fs_enet"
-- 
1.5.3.1

___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH 1/9] fs_enet: Whitespace cleanup.

2007-09-20 Thread Scott Wood
Signed-off-by: Scott Wood <[EMAIL PROTECTED]>
---
 drivers/net/fs_enet/fs_enet-main.c |   85 ---
 drivers/net/fs_enet/fs_enet.h  |4 +-
 drivers/net/fs_enet/mac-fcc.c  |1 -
 drivers/net/fs_enet/mii-bitbang.c  |3 -
 drivers/net/fs_enet/mii-fec.c  |1 -
 5 files changed, 41 insertions(+), 53 deletions(-)

diff --git a/drivers/net/fs_enet/fs_enet-main.c 
b/drivers/net/fs_enet/fs_enet-main.c
index a4a2a0e..f261b90 100644
--- a/drivers/net/fs_enet/fs_enet-main.c
+++ b/drivers/net/fs_enet/fs_enet-main.c
@@ -353,7 +353,6 @@ static void fs_enet_tx(struct net_device *dev)
 
do_wake = do_restart = 0;
while (((sc = CBDR_SC(bdp)) & BD_ENET_TX_READY) == 0) {
-
dirtyidx = bdp - fep->tx_bd_base;
 
if (fep->tx_free == fep->tx_ring)
@@ -454,7 +453,6 @@ fs_enet_interrupt(int irq, void *dev_id)
 
nr = 0;
while ((int_events = (*fep->ops->get_int_events)(dev)) != 0) {
-
nr++;
 
int_clr_events = int_events;
@@ -710,45 +708,43 @@ static void fs_timeout(struct net_device *dev)
  
*-*/
 static void generic_adjust_link(struct  net_device *dev)
 {
-   struct fs_enet_private *fep = netdev_priv(dev);
-   struct phy_device *phydev = fep->phydev;
-   int new_state = 0;
-
-   if (phydev->link) {
-
-   /* adjust to duplex mode */
-   if (phydev->duplex != fep->oldduplex){
-   new_state = 1;
-   fep->oldduplex = phydev->duplex;
-   }
-
-   if (phydev->speed != fep->oldspeed) {
-   new_state = 1;
-   fep->oldspeed = phydev->speed;
-   }
-
-   if (!fep->oldlink) {
-   new_state = 1;
-   fep->oldlink = 1;
-   netif_schedule(dev);
-   netif_carrier_on(dev);
-   netif_start_queue(dev);
-   }
-
-   if (new_state)
-   fep->ops->restart(dev);
-
-   } else if (fep->oldlink) {
-   new_state = 1;
-   fep->oldlink = 0;
-   fep->oldspeed = 0;
-   fep->oldduplex = -1;
-   netif_carrier_off(dev);
-   netif_stop_queue(dev);
-   }
-
-   if (new_state && netif_msg_link(fep))
-   phy_print_status(phydev);
+   struct fs_enet_private *fep = netdev_priv(dev);
+   struct phy_device *phydev = fep->phydev;
+   int new_state = 0;
+
+   if (phydev->link) {
+   /* adjust to duplex mode */
+   if (phydev->duplex != fep->oldduplex) {
+   new_state = 1;
+   fep->oldduplex = phydev->duplex;
+   }
+
+   if (phydev->speed != fep->oldspeed) {
+   new_state = 1;
+   fep->oldspeed = phydev->speed;
+   }
+
+   if (!fep->oldlink) {
+   new_state = 1;
+   fep->oldlink = 1;
+   netif_schedule(dev);
+   netif_carrier_on(dev);
+   netif_start_queue(dev);
+   }
+
+   if (new_state)
+   fep->ops->restart(dev);
+   } else if (fep->oldlink) {
+   new_state = 1;
+   fep->oldlink = 0;
+   fep->oldspeed = 0;
+   fep->oldduplex = -1;
+   netif_carrier_off(dev);
+   netif_stop_queue(dev);
+   }
+
+   if (new_state && netif_msg_link(fep))
+   phy_print_status(phydev);
 }
 
 
@@ -792,7 +788,6 @@ static int fs_init_phy(struct net_device *dev)
return 0;
 }
 
-
 static int fs_enet_open(struct net_device *dev)
 {
struct fs_enet_private *fep = netdev_priv(dev);
@@ -978,7 +973,7 @@ static struct net_device *fs_init_instance(struct device 
*dev,
 #endif
 
 #ifdef CONFIG_FS_ENET_HAS_SCC
-   if (fs_get_scc_index(fpi->fs_no) >=0 )
+   if (fs_get_scc_index(fpi->fs_no) >=0)
fep->ops = &fs_scc_ops;
 #endif
 
@@ -1069,9 +1064,8 @@ static struct net_device *fs_init_instance(struct device 
*dev,
 
return ndev;
 
-  err:
+err:
if (ndev != NULL) {
-
if (registered)
unregister_netdev(ndev);
 
@@ -1262,7 +1256,6 @@ static int __init fs_init(void)
 err:
cleanup_immap();
return r;
-   
 }
 
 static void __exit fs_cleanup(void)
diff --git a/drivers/net/fs_enet/fs_enet.h b/drivers/net/fs_enet/fs_enet.h
index 569be22..72a61e9 100644
--- a/drivers/net/fs_enet/fs_enet.h
+++ b/drivers/net/fs_enet/fs_enet.h
@@ -15,8 +15,8 @@
 #include 
 
 struct fec_info {
-fec_t*  fecp;
-   u32 mii_speed;
+   fec_t *fecp;
+   u32 mii_speed;
 };
 #endif
 
diff --git a/dr

[PATCH 0/9] fs enet and mdio bitbang patches

2007-09-20 Thread Scott Wood
Changes since previous patchset:

- Changed mdio_bitbang_ to mdiobb_, as requested.
- Separated mii bitbang conversion to generic MDIO bitbang library from the
  of_platform conversion.
- Added register read-backs to flush the writes in mdio bitbang clients.
- Fixed a couple minor issues.

Jeff, please apply for 2.6.24.

-Scott
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: device tree question

2007-09-20 Thread Scott Wood
Alan Bennett wrote:
> Device Tree and BRG?
>   The SMC1 uses BRG7 and the SCC1 uses BRG1, should we have both BRGs
> configured in the .dts?  ( BRG1 is configured).

They should both be specified, and either in the firmware or in the 
platform code you need to set CMXSMR.

> Device Tree and Chosen?
>   Adding a chosen block and I end up off in the weeds.  removing the
> chosen block and I die within cpm_uart_console_write
> chosen {
> linux,stdout-path = "/soc/cpm/[EMAIL PROTECTED]";
> };

If you remove the chosen node, you won't get any output from the 
bootwrapper, but it shouldn't crash.

>   In arch/boot/ep8248e, there is a call to:
> planetcore_set_stdout_path(table) is this why there is no
> chosen/stdout-path element in the device tree?

The ep8248e bootwrapper platform is for planetcore (as that's what the 
board ships with).  If you're using u-boot, it's the cuboot-pq2 platform 
that you want to use.  Just make zImage and boot the cuImage.pq2 file.

-Scott
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: 4xx git tree moved

2007-09-20 Thread Vitaly Bordug
Hello Josh,

On Thu, 20 Sep 2007 07:42:36 -0500
Josh Boyer wrote:

> For those interested in 4xx, I've moved my git tree to kernel.org.  You
> can find it here:
> 
> git://git.kernel.org/pub/scm/linux/kernel/git/jwboyer/powerpc.git
> 
Can you call it something like 4xx-powerpc.git, or powerpc-4xx.git? Number of 
powerpc.git stuff tend to grow :)


-- 
Sincerely, Vitaly
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH v3] qe: miscellaneous code improvements and fixes to the QE library

2007-09-20 Thread Kumar Gala

On Sep 20, 2007, at 4:30 PM, Timur Tabi wrote:

> Timur Tabi wrote:
>> This patch makes numerous miscellaneous code improvements to the  
>> QE library.
>
> Paul and Kumar,
>
> Unless there are any other suggestions for improvements, this is  
> the version I'd like applied.  Thanks.

Ok, I'll take a look and see if I've got any comments.

- k
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: device tree question

2007-09-20 Thread Alan Bennett
Device Tree and BRG?
  The SMC1 uses BRG7 and the SCC1 uses BRG1, should we have both BRGs
configured in the .dts?  ( BRG1 is configured).

Device Tree and Chosen?
  Adding a chosen block and I end up off in the weeds.  removing the
chosen block and I die within cpm_uart_console_write
chosen {
linux,stdout-path = "/soc/cpm/[EMAIL PROTECTED]";
};
  In arch/boot/ep8248e, there is a call to:
planetcore_set_stdout_path(table) is this why there is no
chosen/stdout-path element in the device tree?

  Off to back out / replace the ep8248e + planetCore code to something
more u-boot friendly.

-Alan

__log_buf when hung with ~ cpm_uart_console_write

Using Embedded Planet EP8248E machine description.
Linux version 2.6.23-rc6-g943401ab-dirty ([EMAIL PROTECTED])
   (gcc version 3.4.5) #8 Thu Sep 20 15:03:37 MDT 2007.
Entering add_active_range(0, 0, 32768) 0 entries of 256 used.
Top of RAM: 0x800, Total RAM: 0x800.
Memory hole size: 0MB.
Zone PFN ranges:.
  DMA 0 ->32768.
  Normal  32768 ->32768.
Movable zone start PFN for each node.
early_node_map[1] active PFN ranges.
0:0 ->32768.
On node 0 totalpages: 32768.
  DMA zone: 256 pages used for memmap.
  DMA zone: 0 pages reserved.
  DMA zone: 32512 pages, LIFO batch:7.
  Normal zone: 0 pages used for memmap.
  Movable zone: 0 pages used for memmap.
Built 1 zonelists in Zone order.  Total pages: 32512.
Kernel command line: root=/dev/nfs ip=192.168.10.45:::255.255.255.0::
  eth1 nfsroot=192.168.10.5:/fh/rfs rw .
PID hash table entries: 512 (order: 9, 2048 bytes).
time_init: decrementer frequency = 16.50 MHz.
time_init: processor frequency   = 231.00 MHz.
console [ttyCPM0] enabled.




/*
 * Device Tree for the Embedded Planet EP8248E board.
 *
 * Copyright 2007 Freescale Semiconductor Inc.
 *
 * This program is free software; you can redistribute  it and/or modify it
 * under  the terms of  the GNU General  Public License as published by the
 * Free Software Foundation;  either version 2 of the  License, or (at your
 * option) any later version.
 */

/ {
model = "EP8248E";
compatible = "fsl,ep8248e";
#address-cells = <1>;
#size-cells = <1>;

cpus {
#address-cells = <1>;
#size-cells = <0>;

PowerPC,[EMAIL PROTECTED] {
device_type = "cpu";
reg = <0>;
d-cache-line-size = ;
i-cache-line-size = ;
d-cache-size = ;
i-cache-size = ;
timebase-frequency = <0>;
clock-frequency = <0>;
};
};

memory {
device_type = "memory";
reg = <0 0>;
};

[EMAIL PROTECTED] {
compatible = "fsl,mpc8248-localbus",
 "fsl,pq2-localbus";
#address-cells = <2>;
#size-cells = <1>;
reg = ;

ranges = <0 0 f800 0800
  2 0 e400 8000
  4 0 d000 0800>;

/* CS0 F800_ -> _ */
[EMAIL PROTECTED],0 {   
compatible = "cfi-flash";
reg = <0 0 0800>;
bank-width = <4>;
device-width = <2>;
};
/* CS2 E400_ -> E400_8000 */
[EMAIL PROTECTED],0 {
compatible = "fsl,ep8248e-bcsr";
reg = <2 0 10>;
#address-cells = <2>;
#size-cells = <1>;
ranges;

mdio {
device_type = "mdio";
compatible = "fsl,ep8248e-mdio-bitbang";
#address-cells = <1>;
#size-cells = <0>;
reg = <2 8 1>;

PHY0: [EMAIL PROTECTED] {
interrupt-parent = <&PIC>;
reg = <0>;
device_type = "ethernet-phy";
};

PHY1: [EMAIL PROTECTED] {
interrupt-parent = <&PIC>;
reg = <1>;
device_type = "ethernet-phy";
};
};
};
/* CS4 D000_ -> D7FF_ */
[EMAIL PROTECTED],0 {
compatible = "cfi-flash";
reg = <4 0 0800>;
bank-width = <4>;

Re: [PATCH v3] qe: miscellaneous code improvements and fixes to the QE library

2007-09-20 Thread Timur Tabi
Timur Tabi wrote:
> This patch makes numerous miscellaneous code improvements to the QE library.

Paul and Kumar,

Unless there are any other suggestions for improvements, this is the version 
I'd like applied.  Thanks.

-- 
Timur Tabi
Linux Kernel Developer @ Freescale
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH v3] qe: miscellaneous code improvements and fixes to the QE library

2007-09-20 Thread Timur Tabi
This patch makes numerous miscellaneous code improvements to the QE library.

1. Remove struct ucc_common and merge ucc_init_guemr() into ucc_set_type()
   (every caller of ucc_init_guemr() also calls ucc_set_type()).  Modify all
   callers of ucc_set_type() accordingly.

2. Remove the unused enum ucc_pram_initial_offset.

3. Refactor qe_setbrg(), also implement work-around for errata QE_General4.

4. Several printk() calls were missing the terminating \n.

5. Add __iomem where needed, and change u16 to __be16 and u32 to __be32 where
   appropriate.

6. In ucc_slow_init() the RBASE and TBASE registers in the PRAM were programmed
   with the wrong value.

7. Add the protocol type to struct us_info and updated ucc_slow_init() to
   use it, instead of always programming QE_CR_PROTOCOL_UNSPECIFIED.

8. Rename ucc_slow_restart_x() to ucc_slow_restart_tx()

9. Add several macros in qe.h (mostly for slow UCC support, but also to
   standardize some naming convention) and remove several unused macros.

10. Update ucc_geth.c to use the new macros.

11. Add ucc_slow_info.protocol to specify which QE_CR_PROTOCOL_xxx protcol
to use when initializing the UCC in ucc_slow_init().

12. Rename ucc_slow_pram.rfcr to rbmr and ucc_slow_pram.tfcr to tbmr, since
these are the real names of the registers.

13. Use the setbits, clrbits, and clrsetbits where appropriate.

14. Refactor ucc_set_qe_mux_rxtx().

15. Remove all instances of 'volatile'.

16. Simplify get_cmxucr_reg();

17. Replace qe_mux.cmxucrX with qe_mux.cmxucr[].

Signed-off-by: Timur Tabi <[EMAIL PROTECTED]>
---

Added changes 13 - 17.

 arch/powerpc/sysdev/qe_lib/qe.c   |   36 +++--
 arch/powerpc/sysdev/qe_lib/qe_ic.c|2 -
 arch/powerpc/sysdev/qe_lib/qe_io.c|   35 ++---
 arch/powerpc/sysdev/qe_lib/ucc.c  |  270 ++---
 arch/powerpc/sysdev/qe_lib/ucc_fast.c |  127 
 arch/powerpc/sysdev/qe_lib/ucc_slow.c |   48 +++---
 drivers/net/ucc_geth.c|2 +-
 include/asm-powerpc/immap_qe.h|   30 ++---
 include/asm-powerpc/qe.h  |  243 -
 include/asm-powerpc/ucc.h |   40 ++
 include/asm-powerpc/ucc_slow.h|9 +-
 11 files changed, 430 insertions(+), 412 deletions(-)

diff --git a/arch/powerpc/sysdev/qe_lib/qe.c b/arch/powerpc/sysdev/qe_lib/qe.c
index 90f8740..3d57d38 100644
--- a/arch/powerpc/sysdev/qe_lib/qe.c
+++ b/arch/powerpc/sysdev/qe_lib/qe.c
@@ -141,7 +141,7 @@ EXPORT_SYMBOL(qe_issue_cmd);
  * 16 BRGs, which can be connected to the QE channels or output
  * as clocks. The BRGs are in two different block of internal
  * memory mapped space.
- * The baud rate clock is the system clock divided by something.
+ * The BRG clock is the QE clock divided by 2.
  * It was set up long ago during the initial boot phase and is
  * is given to us.
  * Baud rate clocks are zero-based in the driver code (as that maps
@@ -165,28 +165,38 @@ unsigned int get_brg_clk(void)
return brg_clk;
 }
 
-/* This function is used by UARTS, or anything else that uses a 16x
- * oversampled clock.
+/* Program the BRG to the given sampling rate and multiplier
+ *
+ * @brg: the BRG, 1-16
+ * @rate: the desired sampling rate
+ * @multiplier: corresponds to the value programmed in GUMR_L[RDCR] or
+ * GUMR_L[TDCR].  E.g., if this BRG is the RX clock, and GUMR_L[RDCR]=01,
+ * then 'multiplier' should be 8.
+ *
+ * Also note that the value programmed into the BRGC register must be even.
  */
-void qe_setbrg(u32 brg, u32 rate)
+void qe_setbrg(unsigned int brg, unsigned int rate, unsigned int multiplier)
 {
-   volatile u32 *bp;
u32 divisor, tempval;
-   int div16 = 0;
+   u32 div16 = 0;
 
-   bp = &qe_immr->brg.brgc[brg];
+   divisor = get_brg_clk() / (rate * multiplier);
 
-   divisor = (get_brg_clk() / rate);
if (divisor > QE_BRGC_DIVISOR_MAX + 1) {
-   div16 = 1;
+   div16 = QE_BRGC_DIV16;
divisor /= 16;
}
 
-   tempval = ((divisor - 1) << QE_BRGC_DIVISOR_SHIFT) | QE_BRGC_ENABLE;
-   if (div16)
-   tempval |= QE_BRGC_DIV16;
+   /* Errata QE_General4, which affects some MPC832x and MPC836x SOCs, says
+  that the BRG divisor must be even if you're not using divide-by-16
+  mode. */
+   if (!div16 && (divisor & 1))
+   divisor++;
+
+   tempval = ((divisor - 1) << QE_BRGC_DIVISOR_SHIFT) |
+   QE_BRGC_ENABLE | div16;
 
-   out_be32(bp, tempval);
+   out_be32(&qe_immr->brg.brgc[brg - 1], tempval);
 }
 
 /* Initialize SNUMs (thread serial numbers) according to
diff --git a/arch/powerpc/sysdev/qe_lib/qe_ic.c 
b/arch/powerpc/sysdev/qe_lib/qe_ic.c
index 55e6f39..9a2d1ed 100644
--- a/arch/powerpc/sysdev/qe_lib/qe_ic.c
+++ b/arch/powerpc/sysdev/qe_lib/qe_ic.c
@@ -405,8 +405,6 @@ void __init qe_ic_init(struct device_node *node, unsigned 
int flags)
set_irq_data(qe_ic->virq_

[PATCH] powerpc: Separate out legacy MCE parsers

2007-09-20 Thread Olof Johansson
[POWERPC] Separate out legacy MCE parsers

Move out the old-style exception parsers to a separate function, and
don't call it on platforms that has a platform-specific handler.

It would make sense to move out the generic versions into their platforms
instead, but that can be done gradually down the road.

Signed-off-by: Olof Johansson <[EMAIL PROTECTED]>

---

On Tue, Sep 11, 2007 at 06:58:12AM +1000, Paul Mackerras wrote:
> Olof Johansson writes:
> 
> > If a platform provide it's own machine check handler, assume that code
> > will handle the reason parsing and reporting the error. The current
> > default fall-though only makes sense on a few 32-bit platforms that
> > lack individual handlers.
> 
> Might be nice to put that code into a function of its own, called
> print_6xx_machine_check or something similar.

See below. Any platform that doesn't set it's own MCE handler will call
the generic one, which is at the moment just a fallback to the previous
versions.


-Olof

diff --git a/arch/powerpc/kernel/traps.c b/arch/powerpc/kernel/traps.c
index ccfc99d..c9d3f6d 100644
--- a/arch/powerpc/kernel/traps.c
+++ b/arch/powerpc/kernel/traps.c
@@ -324,14 +324,137 @@ static inline int check_io_access(struct pt_regs *regs)
 #define clear_single_step(regs)((regs)->msr &= ~MSR_SE)
 #endif
 
+static int generic_machine_check_exception(struct pt_regs *regs)
+{
+   unsigned long reason = get_mc_reason(regs);
+
+#if defined(CONFIG_4xx) && !defined(CONFIG_440A)
+   if (reason & ESR_IMCP) {
+   printk("Instruction");
+   mtspr(SPRN_ESR, reason & ~ESR_IMCP);
+   } else
+   printk("Data");
+   printk(" machine check in kernel mode.\n");
+#elif defined(CONFIG_440A)
+   printk("Machine check in kernel mode.\n");
+   if (reason & ESR_IMCP){
+   printk("Instruction Synchronous Machine Check exception\n");
+   mtspr(SPRN_ESR, reason & ~ESR_IMCP);
+   }
+   else {
+   u32 mcsr = mfspr(SPRN_MCSR);
+   if (mcsr & MCSR_IB)
+   printk("Instruction Read PLB Error\n");
+   if (mcsr & MCSR_DRB)
+   printk("Data Read PLB Error\n");
+   if (mcsr & MCSR_DWB)
+   printk("Data Write PLB Error\n");
+   if (mcsr & MCSR_TLBP)
+   printk("TLB Parity Error\n");
+   if (mcsr & MCSR_ICP){
+   flush_instruction_cache();
+   printk("I-Cache Parity Error\n");
+   }
+   if (mcsr & MCSR_DCSP)
+   printk("D-Cache Search Parity Error\n");
+   if (mcsr & MCSR_DCFP)
+   printk("D-Cache Flush Parity Error\n");
+   if (mcsr & MCSR_IMPE)
+   printk("Machine Check exception is imprecise\n");
+
+   /* Clear MCSR */
+   mtspr(SPRN_MCSR, mcsr);
+   }
+#elif defined (CONFIG_E500)
+   printk("Machine check in kernel mode.\n");
+   printk("Caused by (from MCSR=%lx): ", reason);
+
+   if (reason & MCSR_MCP)
+   printk("Machine Check Signal\n");
+   if (reason & MCSR_ICPERR)
+   printk("Instruction Cache Parity Error\n");
+   if (reason & MCSR_DCP_PERR)
+   printk("Data Cache Push Parity Error\n");
+   if (reason & MCSR_DCPERR)
+   printk("Data Cache Parity Error\n");
+   if (reason & MCSR_BUS_IAERR)
+   printk("Bus - Instruction Address Error\n");
+   if (reason & MCSR_BUS_RAERR)
+   printk("Bus - Read Address Error\n");
+   if (reason & MCSR_BUS_WAERR)
+   printk("Bus - Write Address Error\n");
+   if (reason & MCSR_BUS_IBERR)
+   printk("Bus - Instruction Data Error\n");
+   if (reason & MCSR_BUS_RBERR)
+   printk("Bus - Read Data Bus Error\n");
+   if (reason & MCSR_BUS_WBERR)
+   printk("Bus - Read Data Bus Error\n");
+   if (reason & MCSR_BUS_IPERR)
+   printk("Bus - Instruction Parity Error\n");
+   if (reason & MCSR_BUS_RPERR)
+   printk("Bus - Read Parity Error\n");
+#elif defined (CONFIG_E200)
+   printk("Machine check in kernel mode.\n");
+   printk("Caused by (from MCSR=%lx): ", reason);
+
+   if (reason & MCSR_MCP)
+   printk("Machine Check Signal\n");
+   if (reason & MCSR_CP_PERR)
+   printk("Cache Push Parity Error\n");
+   if (reason & MCSR_CPERR)
+   printk("Cache Parity Error\n");
+   if (reason & MCSR_EXCP_ERR)
+   printk("ISI, ITLB, or Bus Error on first instruction fetch for 
an exception handler\n");
+   if (reason & MCSR_BUS_IRERR)
+   printk("Bus - Read Bus Error on instruction fetch\n");
+   if (reason & MCSR_BUS_DRERR)
+   printk("Bus - Read Bus Error on data load\n");
+   if (reason & MCSR_BUS_WRERR)
+   pr

Re: [PATCH] [POWERPC] Fix QEIC->MPIC cascading

2007-09-20 Thread Haiying Wang
On Thu, 2007-09-20 at 13:16 -0500, Timur Tabi wrote:
> Anton Vorontsov wrote:
> 
> > I don't know (didn't look) why this works for 83xx w/o ack()...
> > maybe IPIC don't need this. Or maybe there is a bug hiding.
> 
> Scott W told me that me that the IPIC doesn't have the concept of EOI ack.  
> It 
> just has IRQ masks.

That's true for IPIC, but MPIC has the concept of EOI ack - "An
interrupt is considered in-service from the time its vector is read
(through an IACK cycle) until the end of interrupt (EOI) register is
written. generating what the PIC considers an EOI signal."

On MPC8568, QEIC is a interrupt source of MPIC, so it must send a EOI
signal after the interrupt is served. otherwise, the QEIC interrupt is
always in-service.

Haiying

___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH 2/2] PowerPC: Fix Sequoia MAL0 and EMAC dts entries.

2007-09-20 Thread Valentine Barshak
Josh Boyer wrote:
> On Thu, 20 Sep 2007 22:46:18 +0400
> Valentine Barshak <[EMAIL PROTECTED]> wrote:
> 
>> Valentine Barshak wrote:
>>> David Gibson wrote:
 On Tue, Sep 18, 2007 at 09:29:13PM +0400, Valentine Barshak wrote:
> According to PowerPC 440EPx documentation,
> MAL0 is comprised of four channels (two transmit and two receive).
> Each channel is dedicated to one of two EMAC cores.
> This patch fixes Sequoia DTS MAL0 entry and EMAC entries,
> assigning correct channel numbers to EMACs.
 Hrm.. did they change the EMAC in 440EPx to only use one MAL
 tx-channel?  All the older ones could use two (for no readily apparent
 reason, IMO).

>>> Yes, they did.
>>> Just 1 tx and 1 rx-channel per EMAC. Just 2 bits to select channels, 
>>> while all other bits in MAL registers are reserved.
>>> I'm not sure why they did it (possible bus bandwidth problems), but it's 
>>> impossible to set more than 1 rx/tx channel for each EMAC in 440EPx.
>> Josh, David, is this patch OK?
> 
> Yeah.  I applied it to my tree and asked Paul to pull.  Same for the
> Bamboo one.
> 
> josh
OK thanks :)
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH] PowerPC: add setup_cpu for 44x for processor-specific init

2007-09-20 Thread Valentine Barshak
Kumar Gala wrote:
> 
>> diff -ruN linux-2.6.orig/arch/powerpc/kernel/cputable.c 
>> linux-2.6/arch/powerpc/kernel/cputable.c
>> --- linux-2.6.orig/arch/powerpc/kernel/cputable.c2007-09-20 
>> 19:30:47.0 +0400
>> +++ linux-2.6/arch/powerpc/kernel/cputable.c2007-09-20 
>> 21:27:35.0 +0400
> 
> [snip]
> 
>> @@ -1318,18 +1327,14 @@
>>
>>  for (i = 0; i < ARRAY_SIZE(cpu_specs); i++,s++)
>>  if ((pvr & s->pvr_mask) == s->pvr_value) {
>> +cpu_setup_t setup_func  = PTRRELOC(s->cpu_setup);
>> +
>>  *cur = cpu_specs + i;
>> -#ifdef CONFIG_PPC64
>> -/* ppc64 expects identify_cpu to also call setup_cpu
>> - * for that processor. I will consolidate that at a
>> - * later time, for now, just use our friend #ifdef.
>> - * we also don't need to PTRRELOC the function pointer
>> - * on ppc64 as we are running at 0 in real mode.
>> +/* ppc expects identify_cpu to also call setup_cpu
>> + * for that processor.
>>   */
>> -if (s->cpu_setup) {
>> -s->cpu_setup(offset, s);
>> -}
>> -#endif /* CONFIG_PPC64 */
>> +if (setup_func)
>> +setup_func(offset, s);
>>  return s;
>>  }
> 
> This should just be something like:
> 
> #if defined(CONFIG_PPC64) || defined(CONFIG_BOOKE)
> if (s->cpu_setup)
> ...
> #endif
> 
> we know reloc_offset is always 0 in book-e, plus fixup the comment.
> 
> - k

OK,
thanks,
Valentine.

> 
> 
> 

___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH 2/2] PowerPC: Fix Sequoia MAL0 and EMAC dts entries.

2007-09-20 Thread Josh Boyer
On Thu, 20 Sep 2007 22:46:18 +0400
Valentine Barshak <[EMAIL PROTECTED]> wrote:

> Valentine Barshak wrote:
> > David Gibson wrote:
> >> On Tue, Sep 18, 2007 at 09:29:13PM +0400, Valentine Barshak wrote:
> >>> According to PowerPC 440EPx documentation,
> >>> MAL0 is comprised of four channels (two transmit and two receive).
> >>> Each channel is dedicated to one of two EMAC cores.
> >>> This patch fixes Sequoia DTS MAL0 entry and EMAC entries,
> >>> assigning correct channel numbers to EMACs.
> >>
> >> Hrm.. did they change the EMAC in 440EPx to only use one MAL
> >> tx-channel?  All the older ones could use two (for no readily apparent
> >> reason, IMO).
> >>
> > Yes, they did.
> > Just 1 tx and 1 rx-channel per EMAC. Just 2 bits to select channels, 
> > while all other bits in MAL registers are reserved.
> > I'm not sure why they did it (possible bus bandwidth problems), but it's 
> > impossible to set more than 1 rx/tx channel for each EMAC in 440EPx.
> 
> Josh, David, is this patch OK?

Yeah.  I applied it to my tree and asked Paul to pull.  Same for the
Bamboo one.

josh
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH] PowerPC: add setup_cpu for 44x for processor-specific init

2007-09-20 Thread Kumar Gala

> diff -ruN linux-2.6.orig/arch/powerpc/kernel/cputable.c linux-2.6/ 
> arch/powerpc/kernel/cputable.c
> --- linux-2.6.orig/arch/powerpc/kernel/cputable.c 2007-09-20  
> 19:30:47.0 +0400
> +++ linux-2.6/arch/powerpc/kernel/cputable.c  2007-09-20  
> 21:27:35.0 +0400

[snip]

> @@ -1318,18 +1327,14 @@
>
>   for (i = 0; i < ARRAY_SIZE(cpu_specs); i++,s++)
>   if ((pvr & s->pvr_mask) == s->pvr_value) {
> + cpu_setup_t setup_func  = PTRRELOC(s->cpu_setup);
> +
>   *cur = cpu_specs + i;
> -#ifdef CONFIG_PPC64
> - /* ppc64 expects identify_cpu to also call setup_cpu
> -  * for that processor. I will consolidate that at a
> -  * later time, for now, just use our friend #ifdef.
> -  * we also don't need to PTRRELOC the function pointer
> -  * on ppc64 as we are running at 0 in real mode.
> + /* ppc expects identify_cpu to also call setup_cpu
> +  * for that processor.
>*/
> - if (s->cpu_setup) {
> - s->cpu_setup(offset, s);
> - }
> -#endif /* CONFIG_PPC64 */
> + if (setup_func)
> + setup_func(offset, s);
>   return s;
>   }

This should just be something like:

#if defined(CONFIG_PPC64) || defined(CONFIG_BOOKE)
if (s->cpu_setup)
...
#endif

we know reloc_offset is always 0 in book-e, plus fixup the comment.

- k



___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH 2/2] PowerPC: Fix Sequoia MAL0 and EMAC dts entries.

2007-09-20 Thread Valentine Barshak
Valentine Barshak wrote:
> David Gibson wrote:
>> On Tue, Sep 18, 2007 at 09:29:13PM +0400, Valentine Barshak wrote:
>>> According to PowerPC 440EPx documentation,
>>> MAL0 is comprised of four channels (two transmit and two receive).
>>> Each channel is dedicated to one of two EMAC cores.
>>> This patch fixes Sequoia DTS MAL0 entry and EMAC entries,
>>> assigning correct channel numbers to EMACs.
>>
>> Hrm.. did they change the EMAC in 440EPx to only use one MAL
>> tx-channel?  All the older ones could use two (for no readily apparent
>> reason, IMO).
>>
> Yes, they did.
> Just 1 tx and 1 rx-channel per EMAC. Just 2 bits to select channels, 
> while all other bits in MAL registers are reserved.
> I'm not sure why they did it (possible bus bandwidth problems), but it's 
> impossible to set more than 1 rx/tx channel for each EMAC in 440EPx.

Josh, David, is this patch OK?

___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH] [POWERPC] Fix QEIC->MPIC cascading

2007-09-20 Thread Scott Wood
Timur Tabi wrote:
> Anton Vorontsov wrote:
> 
>> I don't know (didn't look) why this works for 83xx w/o ack()...
>> maybe IPIC don't need this. Or maybe there is a bug hiding.
> 
> Scott W told me that me that the IPIC doesn't have the concept of EOI ack.  
> It 
> just has IRQ masks.

And the IRQ will be masked at the QEIC while being processed.  Doing it 
this way allows another QE interrupt to come through while the first is 
being serviced.

It might make sense on MPIC to ack after masking at the QEIC, for this 
reason.

-Scott
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: device tree question

2007-09-20 Thread Scott Wood
Alan Bennett wrote:
> Ok, making progress on the ep8248 / devtrees, etc...
> 
> But I'm not getting any output on the serial and my log_buf is pretty 
> clean.  Without console; what's the best way to figure out why I'm not 
> getting any output on my SMC1 serial port (using u-boot , not planetcore)?

U-boot locates the SMC1 registers in a different place than planetcore; 
SMC1's reg property should be <11a80 20 0 40>, and the cpm's reg 
property should be <119c0 30 80 1f80>.

> CS: chipselect {
> compatible = "fsl,ep8248e-chipselect",
>  "fsl,mpc8248-chipselect",
>  "fsl,pq2-chipselect";
> #address-cells = <2>;
> #size-cells = <1>;
> fsl,ctrl = <&CSCTRL>;

This has changed, and I haven't yet updated ep8248e.  The above should be:

[EMAIL PROTECTED] {
compatible = "fsl,mpc8248-localbus",
 "fsl,pq2-localbus";
#address-cells = <2>;
#size-cells = <1>;
reg = ;

You'll also need to update the bus probe matches in ep8248e.c.

> ranges = <0 0 f800 07f0
>   0 1 fff0 0008
>   0 2 fff8 0008

This is wrong; the first cell is the chipselect, and the second cell is 
the offset in bytes.  I rather doubt the second flash begins at byte 1 
and the third at byte 2. :-)

>   1 0 e400 8000
>   2 0 d000 0800>;

> /*  F800_ -> FFF0_  */
> [EMAIL PROTECTED],0 {
> compatible = "cfi-flash";
> reg = <0 0 7F0>;
> probe-type = "CFI";
> bank-width = <4>;
> };

This is a mix of the new and old flash bindings (again, I haven't yet 
updated ep8248e).  Look at the other dts files such as mpc8272ads and 
ep88xc for assistance.

> /*  F400_  */
> [EMAIL PROTECTED],0 {

It says e400 in ranges...

> #address-cells = <2>;
> #size-cells = <1>;
> reg = <1 0 10>;
> compatible = "fsl,ep8248e-bcsr";
> ranges;
> 
> mdio {
> device_type = "mdio";
> compatible = "fsl,ep8248e-mdio-bitbang";
> #address-cells = <1>;
> #size-cells = <0>;
> reg = <1 8 1>;
> 
> PHY0: [EMAIL PROTECTED] {
> interrupt-parent = <&PIC>;
> reg = <0>;
> device_type = "ethernet-phy";
> };
> 
> PHY1: [EMAIL PROTECTED] {
> interrupt-parent = <&PIC>;
> reg = <1>;
> device_type = "ethernet-phy";
> };
> };
> };
> /*  D000_ -> D7FF_  */
> [EMAIL PROTECTED],0 {
> compatible = "cfi-flash";
> reg = <0 0 0800>;

reg should be <2 0, not <0 0.

> [EMAIL PROTECTED] {
> #address-cells = <1>;
> #size-cells = <1>;
> device_type = "soc";
> compatible = "fsl,mpc8248", "fsl,pq2-soc";
> ranges = < f000 00053000>;

You need a reg property here until the kernel uses ranges; see the 
mpc8272ads dts in my tree.

> CSCTRL: chipselect {
> compatible = "fsl,mpc8248-chipselect-ctrl",
>  "fsl,pq2-chipselect-ctrl";
> reg = <10100 40>;
> fsl,bus = <&CS>;
> };

This can go away.

-Scott

___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH] PowerPC: add setup_cpu for 44x for processor-specific init

2007-09-20 Thread Valentine Barshak
Josh Boyer wrote:
> On Thu, 20 Sep 2007 21:55:58 +0400
> Valentine Barshak <[EMAIL PROTECTED]> wrote:
> 
>> This adds cpu_setup functionality to PowerPC 44x platform.
>> The cpu_setup callback is invoked by head_32 code and 
>> the identify_cpu() function at early init and is used to 
>> initialize FPU on 440EP(x) processors. The FPU initialization 
>> was previously done in head_44x.S. Also a workaround for 
>> the incorrect write to DDR SDRAM 440EPx/440GRx errata added.
>> Data can be written to wrong address in SDRAM when write 
>> pipelining is enabled on plb0. The setup_cpu function
>> for these processors disables write pipelining.
> 
> Wow, you're fast ;)
> 
> I'd like to see this split up a bit so there's not so much in one
> patch.  Essentially, introduce cpu_setup_44x.S, move the FPU init to
> use it, and then add the PLB workaround.

OK

> 
> I still need to look at the code too :)

sure :)

> 
> josh

Thanks,
Valentine.
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH] [POWERPC] Fix QEIC->MPIC cascading

2007-09-20 Thread Timur Tabi
Anton Vorontsov wrote:

> I don't know (didn't look) why this works for 83xx w/o ack()...
> maybe IPIC don't need this. Or maybe there is a bug hiding.

Scott W told me that me that the IPIC doesn't have the concept of EOI ack.  It 
just has IRQ masks.

-- 
Timur Tabi
Linux Kernel Developer @ Freescale
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: Sequoia kernel crash workaround.

2007-09-20 Thread Valentine Barshak
Josh Boyer wrote:
> On Thu, 20 Sep 2007 12:32:56 -0500 (CDT)
> Milton Miller <[EMAIL PROTECTED]> wrote:
> 
>> On Fri Sep 21 02:56:32 EST 2007, Valentine Barshak wrote:
>>> Josh Boyer wrote:
 On Wed, 19 Sep 2007 14:30:24 -0500
 Olof Johansson  wrote:

> On Wed, Sep 19, 2007 at 09:19:47PM +0200, Stefan Roese wrote:
>> Hi Valentine,
>>
>> On Wednesday 19 September 2007, Valentine Barshak wrote:
>>> Disabling write pipelining really helps.
>>> Josh, David, what is the right place to put this workaround to?
>>>
>>> Is it OK to do mtdcr(PLB4A0_ACR, mfdcr(PLB4A0_ACR) & ~PLB4_WRP); in
>>> arch/powerpc/boot/cuboot-sequoia.c:sequoia_fixups()?
>>> or
>>> should this be done in
>>> arch/powerpc/platforms/44x/sequoia.c:sequoia_setup_arch()
>>> with dcr_map, dcr_read/write stuff?
>> I vote for putting it into sequoia.c, since it's very likely to happen 
>> that 
>> Sequoia will at one point be booted without the bootwrapper. Or perhaps 
>> it 
>> should go into some common code checking the PVR and disabling it when 
>> this 
>> 440EPx/GRx is detected, since all those boards are affected.
> This is what we have setup_cpu functions in the cpu table for. Please
> put it there instead of in board code.
 Yes, agreed.
>>> I was thinking about it. Looks like it's the best place, but the code 
>>> that actually calls setup_cpu is under ifdef CONFIG_PPC64, while lots of 
>>> cpu_setup functions are defined for ppc32 processors.
>>> Is it OK to remove this ifdef, or should I do CONFIG_PPC64 || CONFIG_44x?
>> head_32.S calls call_setup_cpu in misc_32.S to call the cpu setup functon.
>>
>> Note that these functions are called before the kernel is copied down to
>> 0, so on ppc32 you will need the PTRRELOC type stuff.  Also the callsite
>> implies that the cpu number is available in r24, which may or may not be
>> true when called from C.
>>
>> Its probably easier to just call call_setup_cpu in the other 32 bit 
>> head_xxx files.
> 
> Hm.  I'll have to see how well that would work for 4xx.  Seems 8xx and
> FSL BookE are in a similar situation.

I started preparing the patch after Olof's "take out the ifdef" :)
I've tested it on 4xx. seems to work fine. FPU works OK and EPX/GRX 
workaround is fine also, but it has to be tested on 8xx and fsl.
Adding call_setup_cpu to head_44x is no problem.

> 
> josh

___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH] PowerPC: add setup_cpu for 44x for processor-specific init

2007-09-20 Thread Josh Boyer
On Thu, 20 Sep 2007 21:55:58 +0400
Valentine Barshak <[EMAIL PROTECTED]> wrote:

> This adds cpu_setup functionality to PowerPC 44x platform.
> The cpu_setup callback is invoked by head_32 code and 
> the identify_cpu() function at early init and is used to 
> initialize FPU on 440EP(x) processors. The FPU initialization 
> was previously done in head_44x.S. Also a workaround for 
> the incorrect write to DDR SDRAM 440EPx/440GRx errata added.
> Data can be written to wrong address in SDRAM when write 
> pipelining is enabled on plb0. The setup_cpu function
> for these processors disables write pipelining.

Wow, you're fast ;)

I'd like to see this split up a bit so there's not so much in one
patch.  Essentially, introduce cpu_setup_44x.S, move the FPU init to
use it, and then add the PLB workaround.

I still need to look at the code too :)

josh
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: Sequoia kernel crash workaround.

2007-09-20 Thread Josh Boyer
On Thu, 20 Sep 2007 12:32:56 -0500 (CDT)
Milton Miller <[EMAIL PROTECTED]> wrote:

> On Fri Sep 21 02:56:32 EST 2007, Valentine Barshak wrote:
> > Josh Boyer wrote:
> >> On Wed, 19 Sep 2007 14:30:24 -0500
> >> Olof Johansson  wrote:
> >> 
> >>> On Wed, Sep 19, 2007 at 09:19:47PM +0200, Stefan Roese wrote:
>  Hi Valentine,
> 
>  On Wednesday 19 September 2007, Valentine Barshak wrote:
> > Disabling write pipelining really helps.
> > Josh, David, what is the right place to put this workaround to?
> >
> > Is it OK to do mtdcr(PLB4A0_ACR, mfdcr(PLB4A0_ACR) & ~PLB4_WRP); in
> > arch/powerpc/boot/cuboot-sequoia.c:sequoia_fixups()?
> > or
> > should this be done in
> > arch/powerpc/platforms/44x/sequoia.c:sequoia_setup_arch()
> > with dcr_map, dcr_read/write stuff?
>  I vote for putting it into sequoia.c, since it's very likely to happen 
>  that 
>  Sequoia will at one point be booted without the bootwrapper. Or perhaps 
>  it 
>  should go into some common code checking the PVR and disabling it when 
>  this 
>  440EPx/GRx is detected, since all those boards are affected.
> >>> This is what we have setup_cpu functions in the cpu table for. Please
> >>> put it there instead of in board code.
> >> 
> >> Yes, agreed.
> > 
> > I was thinking about it. Looks like it's the best place, but the code 
> > that actually calls setup_cpu is under ifdef CONFIG_PPC64, while lots of 
> > cpu_setup functions are defined for ppc32 processors.
> > Is it OK to remove this ifdef, or should I do CONFIG_PPC64 || CONFIG_44x?
> 
> head_32.S calls call_setup_cpu in misc_32.S to call the cpu setup functon.
> 
> Note that these functions are called before the kernel is copied down to
> 0, so on ppc32 you will need the PTRRELOC type stuff.  Also the callsite
> implies that the cpu number is available in r24, which may or may not be
> true when called from C.
> 
> Its probably easier to just call call_setup_cpu in the other 32 bit 
> head_xxx files.

Hm.  I'll have to see how well that would work for 4xx.  Seems 8xx and
FSL BookE are in a similar situation.

josh
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH] PowerPC: add setup_cpu for 44x for processor-specific init

2007-09-20 Thread Valentine Barshak
This adds cpu_setup functionality to PowerPC 44x platform.
The cpu_setup callback is invoked by head_32 code and 
the identify_cpu() function at early init and is used to 
initialize FPU on 440EP(x) processors. The FPU initialization 
was previously done in head_44x.S. Also a workaround for 
the incorrect write to DDR SDRAM 440EPx/440GRx errata added.
Data can be written to wrong address in SDRAM when write 
pipelining is enabled on plb0. The setup_cpu function
for these processors disables write pipelining.

Signed-off-by: Valentine Barshak <[EMAIL PROTECTED]>
---
 arch/powerpc/kernel/Makefile|1 
 arch/powerpc/kernel/cpu_setup_44x.S |   54 
 arch/powerpc/kernel/cputable.c  |   25 ++--
 arch/powerpc/kernel/head_44x.S  |   10 --
 4 files changed, 70 insertions(+), 20 deletions(-)

diff -ruN linux-2.6.orig/arch/powerpc/kernel/cpu_setup_44x.S 
linux-2.6/arch/powerpc/kernel/cpu_setup_44x.S
--- linux-2.6.orig/arch/powerpc/kernel/cpu_setup_44x.S  1970-01-01 
03:00:00.0 +0300
+++ linux-2.6/arch/powerpc/kernel/cpu_setup_44x.S   2007-09-20 
21:05:44.0 +0400
@@ -0,0 +1,54 @@
+/*
+ * This file contains low level CPU setup functions.
+ * Valentine Barshak <[EMAIL PROTECTED]>
+ * MontaVista Software, Inc (c) 2007
+ *
+ * Based on cpu_setup_6xx code by 
+ * Benjamin Herrenschmidt <[EMAIL PROTECTED]>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ *
+ */
+
+#include 
+#include 
+#include 
+
+_GLOBAL(__setup_cpu_440ep)
+   b   __init_fpu_44x
+_GLOBAL(__setup_cpu_440epx)
+   mflrr4
+   bl  __init_fpu_44x
+_GLOBAL(__setup_cpu_440grx)
+   bl  __plb_disable_wrp
+   mtlrr4
+   blr
+
+/* enable APU between CPU and FPU */
+_GLOBAL(__init_fpu_44x)
+   mfspr   r3,SPRN_CCR0
+   /* Clear DAPUIB flag in CCR0 */
+   rlwinm  r3,r3,0,12,10
+   mtspr   SPRN_CCR0,r3
+   isync
+   blr
+
+/*
+ * Workaround for the incorrect write to DDR SDRAM errata.
+ * The write address can be corrupted during writes to
+ * DDR SDRAM when write pipelining is enabled on PLB0.
+ * Disable write pipelining here.
+ */
+#define DCRN_PLB4A0_ACR0x81
+
+_GLOBAL(__plb_disable_wrp)
+   mfdcr   r3,DCRN_PLB4A0_ACR
+   /* clear WRP bit in PLB4A0_ACR */
+   rlwinm  r3,r3,0,8,6
+   mtdcr   DCRN_PLB4A0_ACR,r3
+   isync
+   blr
+
diff -ruN linux-2.6.orig/arch/powerpc/kernel/cputable.c 
linux-2.6/arch/powerpc/kernel/cputable.c
--- linux-2.6.orig/arch/powerpc/kernel/cputable.c   2007-09-20 
19:30:47.0 +0400
+++ linux-2.6/arch/powerpc/kernel/cputable.c2007-09-20 21:27:35.0 
+0400
@@ -31,6 +31,9 @@
  * and ppc64
  */
 #ifdef CONFIG_PPC32
+extern void __setup_cpu_440ep(unsigned long offset, struct cpu_spec* spec);
+extern void __setup_cpu_440epx(unsigned long offset, struct cpu_spec* spec);
+extern void __setup_cpu_440grx(unsigned long offset, struct cpu_spec* spec);
 extern void __setup_cpu_603(unsigned long offset, struct cpu_spec* spec);
 extern void __setup_cpu_604(unsigned long offset, struct cpu_spec* spec);
 extern void __setup_cpu_750(unsigned long offset, struct cpu_spec* spec);
@@ -,6 +1114,7 @@
.cpu_user_features  = COMMON_USER_BOOKE | 
PPC_FEATURE_HAS_FPU,
.icache_bsize   = 32,
.dcache_bsize   = 32,
+   .cpu_setup  = __setup_cpu_440ep,
.platform   = "ppc440",
},
{
@@ -1121,6 +1125,7 @@
.cpu_user_features  = COMMON_USER_BOOKE | 
PPC_FEATURE_HAS_FPU,
.icache_bsize   = 32,
.dcache_bsize   = 32,
+   .cpu_setup  = __setup_cpu_440ep,
.platform   = "ppc440",
},
{ /* 440EPX */
@@ -1131,6 +1136,8 @@
.cpu_user_features  = COMMON_USER_BOOKE | 
PPC_FEATURE_HAS_FPU,
.icache_bsize   = 32,
.dcache_bsize   = 32,
+   .cpu_setup  = __setup_cpu_440epx,
+   .platform   = "ppc440",
},
{ /* 440GRX */
.pvr_mask   = 0xfffb,
@@ -1140,6 +1147,8 @@
.cpu_user_features  = COMMON_USER_BOOKE,
.icache_bsize   = 32,
.dcache_bsize   = 32,
+   .cpu_setup  = __setup_cpu_440grx,
+   .platform   = "ppc440",
},
{   /* 440GP Rev. B */
.pvr_mask   = 0xffff,
@@ -1318,18 +1327,14 @@
 
for (i = 0; i < ARRAY_SIZE(cpu_specs); i++,s++)
if ((pvr & s->pvr_mask) == s->pvr_

Re: Sequoia kernel crash workaround.

2007-09-20 Thread Olof Johansson
On Thu, Sep 20, 2007 at 12:25:06PM -0500, Olof Johansson wrote:
> On Thu, Sep 20, 2007 at 08:56:32PM +0400, Valentine Barshak wrote:
> >
> > I was thinking about it. Looks like it's the best place, but the code that 
> > actually calls setup_cpu is under ifdef CONFIG_PPC64, while lots of 
> > cpu_setup functions are defined for ppc32 processors.
> > Is it OK to remove this ifdef, or should I do CONFIG_PPC64 || CONFIG_44x?
> 
> Sounds like something that went wrong at the merge of ppc and ppc64.
> 
> Take out the ifdef, even if there's fallout we should deal with it
> instead of adding more complex ifdefs.

See comment from Milton, my bad. It's just called from head_32.S right now.
It'll need to be added to the 4xx head as well, or an ifdef added. One or
the other, I'll leave it to Josh to pick.


-Olof
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: device tree question

2007-09-20 Thread Alan Bennett
Ok, making progress on the ep8248 / devtrees, etc...

But I'm not getting any output on the serial and my log_buf is pretty
clean.  Without console; what's the best way to figure out why I'm not
getting any output on my SMC1 serial port (using u-boot , not planetcore)?

-Alan

__log_buf:
  Using Embedded Planet EP8248E machine description.
Linux version 2.6.23-rc6-g943401ab-dirty ([EMAIL PROTECTED]) (gcc version 3.4.5)
 #3 Wed Sep 19 12:51:18 MDT 2007.
Entering add_active_range(0, 0, 32768) 0 entries of 256 used.
Top of RAM: 0x800, Total RAM: 0x800.
Memory hole size: 0MB.
Zone PFN ranges:.
  DMA 0 ->32768.
  Normal  32768 ->32768.
Movable zone start PFN for each node.
early_node_map[1] active PFN ranges.
0:0 ->32768.
On node 0 totalpages: 32768.
  DMA zone: 256 pages used for memmap.
  DMA zone: 0 pages reserved.
  DMA zone: 32512 pages, LIFO batch:7.
  Normal zone: 0 pages used for memmap.
  Movable zone: 0 pages used for memmap.
Built 1 zonelists in Zone order.  Total pages: 32512.
Kernel command line: root=/dev/nfs ip=192.168.10.45:::255.255.255.0::eth1
 nfsroot=192.168.10.5:/fh/rfs rw .
PID hash table entries: 512 (order: 9, 2048 bytes).
time_init: decrementer frequency = 16.50 MHz.
time_init: processor frequency   = 231.00 MHz..


dts file:

/*
 * Device Tree for the Embedded Planet EP8248E board.
 *
 * Copyright 2007 Freescale Semiconductor Inc.
 *
 * This program is free software; you can redistribute  it and/or modify it
 * under  the terms of  the GNU General  Public License as published by the
 * Free Software Foundation;  either version 2 of the  License, or (at your
 * option) any later version.
 */

/ {
model = "EP8248E";
compatible = "fsl,ep8248e";
#address-cells = <1>;
#size-cells = <1>;

cpus {
#address-cells = <1>;
#size-cells = <0>;

PowerPC,[EMAIL PROTECTED] {
device_type = "cpu";
reg = <0>;
d-cache-line-size = ;
i-cache-line-size = ;
d-cache-size = ;
i-cache-size = ;
timebase-frequency = <0>;
clock-frequency = <0>;
};
};

CS: chipselect {
compatible = "fsl,ep8248e-chipselect",
 "fsl,mpc8248-chipselect",
 "fsl,pq2-chipselect";
#address-cells = <2>;
#size-cells = <1>;
fsl,ctrl = <&CSCTRL>;

ranges = <0 0 f800 07f0
  0 1 fff0 0008
  0 2 fff8 0008
  1 0 e400 8000
  2 0 d000 0800>;
/*  F800_ -> FFF0_  */
[EMAIL PROTECTED],0 {
compatible = "cfi-flash";
reg = <0 0 7F0>;
probe-type = "CFI";
bank-width = <4>;
};
/*  FFF0_ -> FFF7_  */
[EMAIL PROTECTED],1 {
device_type = "rom";
compatible = "direct-mapped";
reg = <0 0 8>;
probe-type = "CFI";
bank-width = <4>;
};
/*  FFF8_ -> _  */
[EMAIL PROTECTED],2 {
compatible = "cfi-flash";
reg = <0 0 8>;
probe-type = "CFI";
bank-width = <4>;
};
/*  F400_  */
[EMAIL PROTECTED],0 {
#address-cells = <2>;
#size-cells = <1>;
reg = <1 0 10>;
compatible = "fsl,ep8248e-bcsr";
ranges;

mdio {
device_type = "mdio";
compatible = "fsl,ep8248e-mdio-bitbang";
#address-cells = <1>;
#size-cells = <0>;
reg = <1 8 1>;

PHY0: [EMAIL PROTECTED] {
interrupt-parent = <&PIC>;
reg = <0>;
device_type = "ethernet-phy";
};

PHY1: [EMAIL PROTECTED] {
interrupt-parent = <&PIC>;
reg = <1>;
device_type = "ethernet-phy";
};
};
};
/*  D000_ -> D7FF_  */
[EMAIL PR

Re: [PATCH 2/5] Implement generic time of day clocksource for powerpc machines.

2007-09-20 Thread john stultz
On Thu, 2007-09-20 at 10:52 +1000, Paul Mackerras wrote:
> Daniel Walker writes:
> 
> > If you switch to the rtc do the shift and mult need to change?
> 
> You can't switch; any given CPU chip will have either the RTC or the
> timebase but not both.

I think what Daniel is pointing out is that the clocksource read
function isn't the place for the __USE_RTC() conditional. 

It would likely be better instead of the timebase clocksource managing
multiple type of hardware (timebase and RTC), to have a separate simple
RTC clocksource, and then conditionally register one or the other at
init time.

thanks
-john

___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH] [POWERPC] Fix QEIC->MPIC cascading

2007-09-20 Thread Anton Vorontsov
On Thu, Sep 20, 2007 at 12:03:08PM -0500, Timur Tabi wrote:
> Anton Vorontsov wrote:
>> set_irq_chained_handler overwrites MPIC's handle_irq function
>> (handle_fasteoi_irq) thus MPIC never gets eoi event from the
>> cascaded IRQ. This situation hangs MPIC on MPC8568E.
>
> I'm not familiar with the differences between IPIC and MPIC.  What is this 
> patch not needed for 83xx?

Yup, this patch not needed for 83xx. IPIC doesn't have end()/eoi().
(..and MPIC doesn't have ack()).

Though...

Idially QEIC should do both ack() and end(), at the beginning and at
the end of irq handling respectively.

I don't know (didn't look) why this works for 83xx w/o ack()...
maybe IPIC don't need this. Or maybe there is a bug hiding.

-- 
Anton Vorontsov
email: [EMAIL PROTECTED]
backup email: [EMAIL PROTECTED]
irc://irc.freenode.net/bd2
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: Sequoia kernel crash workaround.

2007-09-20 Thread Milton Miller
On Fri Sep 21 02:56:32 EST 2007, Valentine Barshak wrote:
> Josh Boyer wrote:
>> On Wed, 19 Sep 2007 14:30:24 -0500
>> Olof Johansson  wrote:
>> 
>>> On Wed, Sep 19, 2007 at 09:19:47PM +0200, Stefan Roese wrote:
 Hi Valentine,

 On Wednesday 19 September 2007, Valentine Barshak wrote:
> Disabling write pipelining really helps.
> Josh, David, what is the right place to put this workaround to?
>
> Is it OK to do mtdcr(PLB4A0_ACR, mfdcr(PLB4A0_ACR) & ~PLB4_WRP); in
> arch/powerpc/boot/cuboot-sequoia.c:sequoia_fixups()?
> or
> should this be done in
> arch/powerpc/platforms/44x/sequoia.c:sequoia_setup_arch()
> with dcr_map, dcr_read/write stuff?
 I vote for putting it into sequoia.c, since it's very likely to happen 
 that 
 Sequoia will at one point be booted without the bootwrapper. Or perhaps it 
 should go into some common code checking the PVR and disabling it when 
 this 
 440EPx/GRx is detected, since all those boards are affected.
>>> This is what we have setup_cpu functions in the cpu table for. Please
>>> put it there instead of in board code.
>> 
>> Yes, agreed.
> 
> I was thinking about it. Looks like it's the best place, but the code 
> that actually calls setup_cpu is under ifdef CONFIG_PPC64, while lots of 
> cpu_setup functions are defined for ppc32 processors.
> Is it OK to remove this ifdef, or should I do CONFIG_PPC64 || CONFIG_44x?

head_32.S calls call_setup_cpu in misc_32.S to call the cpu setup functon.

Note that these functions are called before the kernel is copied down to
0, so on ppc32 you will need the PTRRELOC type stuff.  Also the callsite
implies that the cpu number is available in r24, which may or may not be
true when called from C.

Its probably easier to just call call_setup_cpu in the other 32 bit 
head_xxx files.

milton
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: Sequoia kernel crash workaround.

2007-09-20 Thread Josh Boyer
On Thu, 20 Sep 2007 12:25:06 -0500
Olof Johansson <[EMAIL PROTECTED]> wrote:

> On Thu, Sep 20, 2007 at 08:56:32PM +0400, Valentine Barshak wrote:
> >
> > I was thinking about it. Looks like it's the best place, but the code that 
> > actually calls setup_cpu is under ifdef CONFIG_PPC64, while lots of 
> > cpu_setup functions are defined for ppc32 processors.
> > Is it OK to remove this ifdef, or should I do CONFIG_PPC64 || CONFIG_44x?
> 
> Sounds like something that went wrong at the merge of ppc and ppc64.
> 
> Take out the ifdef, even if there's fallout we should deal with it
> instead of adding more complex ifdefs.

Yeah.  Looks like BenH did this in commit:

42c4aaadb737e0e672b3fb86b2c41ff59f0fb8bc

Ben, any reason you ifdef'd it for ppc64?

josh
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: Sequoia kernel crash workaround.

2007-09-20 Thread Olof Johansson
On Thu, Sep 20, 2007 at 08:56:32PM +0400, Valentine Barshak wrote:
>
> I was thinking about it. Looks like it's the best place, but the code that 
> actually calls setup_cpu is under ifdef CONFIG_PPC64, while lots of 
> cpu_setup functions are defined for ppc32 processors.
> Is it OK to remove this ifdef, or should I do CONFIG_PPC64 || CONFIG_44x?

Sounds like something that went wrong at the merge of ppc and ppc64.

Take out the ifdef, even if there's fallout we should deal with it
instead of adding more complex ifdefs.


-Olof
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[patch 5/7] Use extended crashkernel command line on ppc64

2007-09-20 Thread Bernhard Walle
This patch adapts the ppc64 code to use the generic parse_crashkernel()
function introduced in the generic patch of that series.


Signed-off-by: Bernhard Walle <[EMAIL PROTECTED]>

---
 arch/powerpc/kernel/machine_kexec.c |   52 ++--
 1 file changed, 26 insertions(+), 26 deletions(-)

--- a/arch/powerpc/kernel/machine_kexec.c
+++ b/arch/powerpc/kernel/machine_kexec.c
@@ -61,45 +61,39 @@ NORET_TYPE void machine_kexec(struct kim
for(;;);
 }
 
-static int __init early_parse_crashk(char *p)
+void __init reserve_crashkernel(void)
 {
-   unsigned long size;
-
-   if (!p)
-   return 1;
-
-   size = memparse(p, &p);
+   unsigned long long crash_size = 0, crash_base;
+   int ret;
 
-   if (*p == '@')
-   crashk_res.start = memparse(p + 1, &p);
-   else
-   crashk_res.start = KDUMP_KERNELBASE;
-
-   crashk_res.end = crashk_res.start + size - 1;
-
-   return 0;
-}
-early_param("crashkernel", early_parse_crashk);
+   /* this is necessary because of lmb_phys_mem_size() */
+   lmb_analyze();
 
-void __init reserve_crashkernel(void)
-{
-   unsigned long size;
+   /* use common parsing */
+   ret = parse_crashkernel(boot_command_line, lmb_phys_mem_size(),
+   &crash_size, &crash_base);
+   if (ret == 0 && crash_size > 0) {
+   if (crash_base == 0)
+   crash_base = KDUMP_KERNELBASE;
+   crashk_res.start = crash_base;
+   } else {
+   /* handle the device tree */
+   crash_size = crashk_res.end - crashk_res.start + 1;
+   }
 
-   if (crashk_res.start == 0)
+   if (crash_size == 0)
return;
 
/* We might have got these values via the command line or the
 * device tree, either way sanitise them now. */
 
-   size = crashk_res.end - crashk_res.start + 1;
-
if (crashk_res.start != KDUMP_KERNELBASE)
printk("Crash kernel location must be 0x%x\n",
KDUMP_KERNELBASE);
 
crashk_res.start = KDUMP_KERNELBASE;
-   size = PAGE_ALIGN(size);
-   crashk_res.end = crashk_res.start + size - 1;
+   crash_size = PAGE_ALIGN(crash_size);
+   crashk_res.end = crashk_res.start + crash_size - 1;
 
/* Crash kernel trumps memory limit */
if (memory_limit && memory_limit <= crashk_res.end) {
@@ -108,7 +102,13 @@ void __init reserve_crashkernel(void)
memory_limit);
}
 
-   lmb_reserve(crashk_res.start, size);
+   printk(KERN_INFO "Reserving %ldMB of memory at %ldMB "
+   "for crashkernel (System RAM: %ldMB)\n",
+   (unsigned long)(crash_size >> 20),
+   (unsigned long)(crashk_res.start >> 20),
+   (unsigned long)(lmb_phys_mem_size() >> 20));
+
+   lmb_reserve(crashk_res.start, crash_size);
 }
 
 int overlaps_crashkernel(unsigned long start, unsigned long size)

-- 
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: Cleanups for physmap_of.c (v2)

2007-09-20 Thread Segher Boessenkool
>   - (the big one) Despite the name, this driver really has
> nothing to do with drivers/mtd/physmap.c.  The fact that the flash
> chips must be physically direct mapped is a constrant, but doesn't
> really say anything about the actual purpose of this driver, which is
> to instantiate MTD devices based on information from the device tree.
> Therefore the physmap name is replaced everywhere within the file with
> "of_flash".

Do you think this code will handle NAND flash later, too?  If not,
maybe "of_norflash" is better?


Segher

___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH] [POWERPC] Fix QEIC->MPIC cascading

2007-09-20 Thread Timur Tabi
Anton Vorontsov wrote:
> set_irq_chained_handler overwrites MPIC's handle_irq function
> (handle_fasteoi_irq) thus MPIC never gets eoi event from the
> cascaded IRQ. This situation hangs MPIC on MPC8568E.

I'm not familiar with the differences between IPIC and MPIC.  What is this 
patch not needed for 83xx?

-- 
Timur Tabi
Linux Kernel Developer @ Freescale
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: Sequoia kernel crash workaround.

2007-09-20 Thread Valentine Barshak
Josh Boyer wrote:
> On Wed, 19 Sep 2007 14:30:24 -0500
> Olof Johansson <[EMAIL PROTECTED]> wrote:
> 
>> On Wed, Sep 19, 2007 at 09:19:47PM +0200, Stefan Roese wrote:
>>> Hi Valentine,
>>>
>>> On Wednesday 19 September 2007, Valentine Barshak wrote:
 Disabling write pipelining really helps.
 Josh, David, what is the right place to put this workaround to?

 Is it OK to do mtdcr(PLB4A0_ACR, mfdcr(PLB4A0_ACR) & ~PLB4_WRP); in
 arch/powerpc/boot/cuboot-sequoia.c:sequoia_fixups()?
 or
 should this be done in
 arch/powerpc/platforms/44x/sequoia.c:sequoia_setup_arch()
 with dcr_map, dcr_read/write stuff?
>>> I vote for putting it into sequoia.c, since it's very likely to happen that 
>>> Sequoia will at one point be booted without the bootwrapper. Or perhaps it 
>>> should go into some common code checking the PVR and disabling it when this 
>>> 440EPx/GRx is detected, since all those boards are affected.
>> This is what we have setup_cpu functions in the cpu table for. Please
>> put it there instead of in board code.
> 
> Yes, agreed.

I was thinking about it. Looks like it's the best place, but the code 
that actually calls setup_cpu is under ifdef CONFIG_PPC64, while lots of 
cpu_setup functions are defined for ppc32 processors.
Is it OK to remove this ifdef, or should I do CONFIG_PPC64 || CONFIG_44x?

Thanks,
Valentine.

> 
> josh
> ___
> Linuxppc-dev mailing list
> Linuxppc-dev@ozlabs.org
> https://ozlabs.org/mailman/listinfo/linuxppc-dev

___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH 3/3] IB/ehca: Make sure user pages are from hugetlb before using MR large pages

2007-09-20 Thread Roland Dreier
thanks, applied this and the umem patch...
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: 2.6.23-rc6-mm1: Build failure on ppc64 drivers/ata/pata_scc.c

2007-09-20 Thread Kamalesh Babulal
On 9/20/07, Kamalesh Babulal <[EMAIL PROTECTED]> wrote:
>
> Alan Cox wrote:
> > On Thu, 20 Sep 2007 14:13:15 +0100
> > [EMAIL PROTECTED] (Mel Gorman) wrote:
> >
> >
> >> PPC64 building allmodconfig fails to compile drivers/ata/pata_scc.c .
> It
> >> doesn't show up on other arches because this driver is specific to the
> >> architecture.
> >>
> >> drivers/ata/pata_scc.c: In function `scc_bmdma_status'
> >>
> >
> > Its not been updated to match the libata core changes. Try something
> like
> > this. Whoever is maintaining it should also remove the prereset cable
> handling
> > code and use the proper cable detect method.
> >
> >
> > Signed-off-by: Alan Cox <[EMAIL PROTECTED]>
> >
> > diff -u --exclude-from /usr/src/exclude --new-file --recursive
> linux.vanilla-2.6.23rc6-mm1/drivers/ata/pata_scc.c linux-2.6.23rc6-mm1
> /drivers/ata/pata_scc.c
> > --- linux.vanilla-2.6.23rc6-mm1/drivers/ata/pata_scc.c2007-09-18
> 15:32:51.0 +0100
> > +++ linux-2.6.23rc6-mm1/drivers/ata/pata_scc.c2007-09-20 14:23:
> 32.879807760 +0100
> > @@ -731,7 +731,7 @@
> >   void __iomem *mmio = ap->ioaddr.bmdma_addr;
> >   u8 host_stat = in_be32(mmio + SCC_DMA_STATUS);
> >   u32 int_status = in_be32(mmio + SCC_DMA_INTST);
> > - struct ata_queued_cmd *qc = ata_qc_from_tag(ap, ap->active_tag);
> > + struct ata_queued_cmd *qc = ata_qc_from_tag(ap, ap->
> link.active_tag);
> >   static int retry = 0;
> >
> >   /* return if IOS_SS is cleared */
> > @@ -860,10 +860,10 @@
> >   *   @deadline: deadline jiffies for the operation
> >   */
> >
> > -static int scc_pata_prereset(struct ata_port *ap, unsigned long
> deadline)
> > +static int scc_pata_prereset(struct ata_link *link, unsigned long
> deadline)
> >  {
> > - ap->cbl = ATA_CBL_PATA80;
> > - return ata_std_prereset(ap, deadline);
> > + link->ap->cbl = ATA_CBL_PATA80;
> > + return ata_std_prereset(link, deadline);
> >  }
> >
> >  /**
> > @@ -874,8 +874,9 @@
> >   *   Note: Original code is ata_std_postreset().
> >   */
> >
> > -static void scc_std_postreset (struct ata_port *ap, unsigned int
> *classes)
> > +static void scc_std_postreset (struct ata_link *link, unsigned int
> *classes)
> >  {
> >
> > - ap->cbl = ATA_CBL_PATA80;
> > - return ata_std_prereset(ap, deadline);
> > + link->ap->cbl = ATA_CBL_PATA80;
> > + return ata_std_prereset(link, deadline);
> >  }
> >
> >  /**
> > @@ -874,8 +874,9 @@
> >   *   Note: Original code is ata_std_postreset().
> >   */
> >
> > + struct ata_port *ap = link->ap;
> >   DPRINTK("ENTER\n");
> >
> >   /* is double-select really necessary? */
> >
> >
> Hi,
>
> This patch solves the build failure, but with following warnings
> 


sorry, have to fix the mail client, resending the build failure.

Hi,

This patch solves the build failure, but with following warnings
CC drivers/ata/pata_scc.o
drivers/ata/pata_scc.c: In function 'scc_error_handler':
drivers/ata/pata_scc.c:909: warning: passing argument 3 of
'ata_bmdma_drive_eh' from incompatible pointer type

and after that the build fails with

CC [M] drivers/net/spider_net.o
drivers/net/spider_net.c: In function 'spider_net_release_tx_chain':
drivers/net/spider_net.c:818: error: 'dev' undeclared (first use in this
function)
drivers/net/spider_net.c:818: error: (Each undeclared identifier is reported
only once
drivers/net/spider_net.c:818: error: for each function it appears in.)
drivers/net/spider_net.c: In function 'spider_net_xmit':
drivers/net/spider_net.c:922: error: 'dev' undeclared (first use in this
function)
drivers/net/spider_net.c: In function 'spider_net_pass_skb_up':
drivers/net/spider_net.c:1018: error: 'dev' undeclared (first use in this
function)
drivers/net/spider_net.c: In function 'spider_net_decode_one_descr':
drivers/net/spider_net.c:1215: error: 'dev' undeclared (first use in this
function)
make[2]: *** [drivers/net/spider_net.o] Error 1
make[1]: *** [drivers/net] Error 2
make: *** [drivers] Error 2


-- 
Thanks & Regards,
Kamalesh Babulal,
Linux Technology Center,
IBM, ISTL.
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev

Re: 2.6.23-rc6-mm1: Build failure on ppc64 drivers/ata/pata_scc.c

2007-09-20 Thread Kamalesh Babulal
Alan Cox wrote:
> On Thu, 20 Sep 2007 14:13:15 +0100
> [EMAIL PROTECTED] (Mel Gorman) wrote:
>
>   
>> PPC64 building allmodconfig fails to compile drivers/ata/pata_scc.c . It
>> doesn't show up on other arches because this driver is specific to the
>> architecture.
>>
>> drivers/ata/pata_scc.c: In function `scc_bmdma_status'
>> 
>
> Its not been updated to match the libata core changes. Try something like
> this. Whoever is maintaining it should also remove the prereset cable handling
> code and use the proper cable detect method.
>
>
> Signed-off-by: Alan Cox <[EMAIL PROTECTED]>
>
> diff -u --exclude-from /usr/src/exclude --new-file --recursive 
> linux.vanilla-2.6.23rc6-mm1/drivers/ata/pata_scc.c 
> linux-2.6.23rc6-mm1/drivers/ata/pata_scc.c
> --- linux.vanilla-2.6.23rc6-mm1/drivers/ata/pata_scc.c2007-09-18 
> 15:32:51.0 +0100
> +++ linux-2.6.23rc6-mm1/drivers/ata/pata_scc.c2007-09-20 
> 14:23:32.879807760 +0100
> @@ -731,7 +731,7 @@
>   void __iomem *mmio = ap->ioaddr.bmdma_addr;
>   u8 host_stat = in_be32(mmio + SCC_DMA_STATUS);
>   u32 int_status = in_be32(mmio + SCC_DMA_INTST);
> - struct ata_queued_cmd *qc = ata_qc_from_tag(ap, ap->active_tag);
> + struct ata_queued_cmd *qc = ata_qc_from_tag(ap, ap->link.active_tag);
>   static int retry = 0;
>
>   /* return if IOS_SS is cleared */
> @@ -860,10 +860,10 @@
>   *   @deadline: deadline jiffies for the operation
>   */
>
> -static int scc_pata_prereset(struct ata_port *ap, unsigned long deadline)
> +static int scc_pata_prereset(struct ata_link *link, unsigned long deadline)
>  {
> - ap->cbl = ATA_CBL_PATA80;
> - return ata_std_prereset(ap, deadline);
> + link->ap->cbl = ATA_CBL_PATA80;
> + return ata_std_prereset(link, deadline);
>  }
>
>  /**
> @@ -874,8 +874,9 @@
>   *   Note: Original code is ata_std_postreset().
>   */
>
> -static void scc_std_postreset (struct ata_port *ap, unsigned int *classes)
> +static void scc_std_postreset (struct ata_link *link, unsigned int *classes)
>  {
>
> - ap->cbl = ATA_CBL_PATA80;
> - return ata_std_prereset(ap, deadline);
> + link->ap->cbl = ATA_CBL_PATA80;
> + return ata_std_prereset(link, deadline);
>  }
>
>  /**
> @@ -874,8 +874,9 @@
>   *   Note: Original code is ata_std_postreset().
>   */
>
> + struct ata_port *ap = link->ap;
>   DPRINTK("ENTER\n");
>
>   /* is double-select really necessary? */
>
>   
Hi,

This patch solves the build failure, but with following warnings
CC drivers/ata/pata_scc.o
drivers/ata/pata_scc.c: In function ‘scc_error_handler’:
drivers/ata/pata_scc.c:909: warning: passing argument 3 of 
‘ata_bmdma_drive_eh’ from incompatible pointer type

and after that the build fails with

CC [M] drivers/net/spider_net.o
drivers/net/spider_net.c: In function ‘spider_net_release_tx_chain’:
drivers/net/spider_net.c:818: error: ‘dev’ undeclared (first use in this 
function)
drivers/net/spider_net.c:818: error: (Each undeclared identifier is 
reported only once
drivers/net/spider_net.c:818: error: for each function it appears in.)
drivers/net/spider_net.c: In function ‘spider_net_xmit’:
drivers/net/spider_net.c:922: error: ‘dev’ undeclared (first use in this 
function)
drivers/net/spider_net.c: In function ‘spider_net_pass_skb_up’:
drivers/net/spider_net.c:1018: error: ‘dev’ undeclared (first use in 
this function)
drivers/net/spider_net.c: In function ‘spider_net_decode_one_descr’:
drivers/net/spider_net.c:1215: error: ‘dev’ undeclared (first use in 
this function)
make[2]: *** [drivers/net/spider_net.o] Error 1
make[1]: *** [drivers/net] Error 2
make: *** [drivers] Error 2


-- 
Thanks & Regards,
Kamalesh Babulal,
Linux Technology Center,
IBM, ISTL.

___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev

Re: 2.6.23-rc6-mm1: Build failure on ppc64 drivers/ata/pata_scc.c

2007-09-20 Thread Mel Gorman
On (20/09/07 15:09), Alan Cox didst pronounce:
> On Thu, 20 Sep 2007 14:13:15 +0100
> [EMAIL PROTECTED] (Mel Gorman) wrote:
> 
> > PPC64 building allmodconfig fails to compile drivers/ata/pata_scc.c . It
> > doesn't show up on other arches because this driver is specific to the
> > architecture.
> > 
> > drivers/ata/pata_scc.c: In function `scc_bmdma_status'
> 
> Its not been updated to match the libata core changes. Try something like
> this. Whoever is maintaining it should also remove the prereset cable handling
> code and use the proper cable detect method.
> 

I can confirm it builds with the following messages

  CC [M]  drivers/ata/pata_scc.o
drivers/ata/pata_scc.c: In function `scc_error_handler':
drivers/ata/pata_scc.c:909: warning: passing arg 3 of `ata_bmdma_drive_eh' from 
incompatible pointer type

As for the rest, I cannot comment.

Thanks Alan

> 
> Signed-off-by: Alan Cox <[EMAIL PROTECTED]>
> 
> diff -u --exclude-from /usr/src/exclude --new-file --recursive 
> linux.vanilla-2.6.23rc6-mm1/drivers/ata/pata_scc.c 
> linux-2.6.23rc6-mm1/drivers/ata/pata_scc.c
> --- linux.vanilla-2.6.23rc6-mm1/drivers/ata/pata_scc.c2007-09-18 
> 15:32:51.0 +0100
> +++ linux-2.6.23rc6-mm1/drivers/ata/pata_scc.c2007-09-20 
> 14:23:32.879807760 +0100
> @@ -731,7 +731,7 @@
>   void __iomem *mmio = ap->ioaddr.bmdma_addr;
>   u8 host_stat = in_be32(mmio + SCC_DMA_STATUS);
>   u32 int_status = in_be32(mmio + SCC_DMA_INTST);
> - struct ata_queued_cmd *qc = ata_qc_from_tag(ap, ap->active_tag);
> + struct ata_queued_cmd *qc = ata_qc_from_tag(ap, ap->link.active_tag);
>   static int retry = 0;
>  
>   /* return if IOS_SS is cleared */
> @@ -860,10 +860,10 @@
>   *   @deadline: deadline jiffies for the operation
>   */
>  
> -static int scc_pata_prereset(struct ata_port *ap, unsigned long deadline)
> +static int scc_pata_prereset(struct ata_link *link, unsigned long deadline)
>  {
> - ap->cbl = ATA_CBL_PATA80;
> - return ata_std_prereset(ap, deadline);
> + link->ap->cbl = ATA_CBL_PATA80;
> + return ata_std_prereset(link, deadline);
>  }
>  
>  /**
> @@ -874,8 +874,9 @@
>   *   Note: Original code is ata_std_postreset().
>   */
>  
> -static void scc_std_postreset (struct ata_port *ap, unsigned int *classes)
> +static void scc_std_postreset (struct ata_link *link, unsigned int *classes)
>  {
> + struct ata_port *ap = link->ap;
>   DPRINTK("ENTER\n");
>  
>   /* is double-select really necessary? */
> 

-- 
-- 
Mel Gorman
Part-time Phd Student  Linux Technology Center
University of Limerick IBM Dublin Software Lab
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: Patches added to powerpc.git for-2.6.24 branch

2007-09-20 Thread Kumar Gala

On Sep 19, 2007, at 9:52 PM, Jeremy Kerr wrote:

>
> A couple more, if these are acceptable:
>
> [PATCH 1/2] cell: don't cast the result of of_get_property()
> [PATCH 2/2] fsl/embedded6xx: don't cast the result of of_get_property

I've picked up the fsl/embedded6xx.

I'll leave cell to arnd or paul.

- k
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: 2.6.23-rc6-mm1: Build failure on ppc64 drivers/ata/pata_scc.c

2007-09-20 Thread Alan Cox
On Thu, 20 Sep 2007 14:13:15 +0100
[EMAIL PROTECTED] (Mel Gorman) wrote:

> PPC64 building allmodconfig fails to compile drivers/ata/pata_scc.c . It
> doesn't show up on other arches because this driver is specific to the
> architecture.
> 
> drivers/ata/pata_scc.c: In function `scc_bmdma_status'

Its not been updated to match the libata core changes. Try something like
this. Whoever is maintaining it should also remove the prereset cable handling
code and use the proper cable detect method.


Signed-off-by: Alan Cox <[EMAIL PROTECTED]>

diff -u --exclude-from /usr/src/exclude --new-file --recursive 
linux.vanilla-2.6.23rc6-mm1/drivers/ata/pata_scc.c 
linux-2.6.23rc6-mm1/drivers/ata/pata_scc.c
--- linux.vanilla-2.6.23rc6-mm1/drivers/ata/pata_scc.c  2007-09-18 
15:32:51.0 +0100
+++ linux-2.6.23rc6-mm1/drivers/ata/pata_scc.c  2007-09-20 14:23:32.879807760 
+0100
@@ -731,7 +731,7 @@
void __iomem *mmio = ap->ioaddr.bmdma_addr;
u8 host_stat = in_be32(mmio + SCC_DMA_STATUS);
u32 int_status = in_be32(mmio + SCC_DMA_INTST);
-   struct ata_queued_cmd *qc = ata_qc_from_tag(ap, ap->active_tag);
+   struct ata_queued_cmd *qc = ata_qc_from_tag(ap, ap->link.active_tag);
static int retry = 0;
 
/* return if IOS_SS is cleared */
@@ -860,10 +860,10 @@
  * @deadline: deadline jiffies for the operation
  */
 
-static int scc_pata_prereset(struct ata_port *ap, unsigned long deadline)
+static int scc_pata_prereset(struct ata_link *link, unsigned long deadline)
 {
-   ap->cbl = ATA_CBL_PATA80;
-   return ata_std_prereset(ap, deadline);
+   link->ap->cbl = ATA_CBL_PATA80;
+   return ata_std_prereset(link, deadline);
 }
 
 /**
@@ -874,8 +874,9 @@
  * Note: Original code is ata_std_postreset().
  */
 
-static void scc_std_postreset (struct ata_port *ap, unsigned int *classes)
+static void scc_std_postreset (struct ata_link *link, unsigned int *classes)
 {
+   struct ata_port *ap = link->ap;
DPRINTK("ENTER\n");
 
/* is double-select really necessary? */
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH 1/3 v2] powerpc clk.h interface for platforms

2007-09-20 Thread Domen Puncer
clk interface for arch/powerpc, platforms should fill
clk_functions.

Signed-off-by: Domen Puncer <[EMAIL PROTECTED]>

---
On 20/09/07 15:07 +1000, Paul Mackerras wrote:
> Domen Puncer writes:
> 
> > 52xx
> > Reason for adding it to all was that EXPORT_SYMBOL's would clash if
> > one were to add clk support for another platform.
> 
> What I meant was, why aren't you using a config symbol so that we
> don't build it on platforms that don't need any "clk" support at all?

Right, doh!

> 
> Paul.


 arch/powerpc/Kconfig|4 +
 arch/powerpc/kernel/Makefile|1 
 arch/powerpc/kernel/clock.c |   82 
 arch/powerpc/platforms/52xx/Kconfig |1 
 include/asm-powerpc/clk_interface.h |   20 
 5 files changed, 108 insertions(+)

Index: linux.git/arch/powerpc/kernel/clock.c
===
--- /dev/null
+++ linux.git/arch/powerpc/kernel/clock.c
@@ -0,0 +1,82 @@
+/*
+ * Dummy clk implementations for powerpc.
+ * These need to be overridden in platform code.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+struct clk_interface clk_functions;
+
+struct clk *clk_get(struct device *dev, const char *id)
+{
+   if (clk_functions.clk_get)
+   return clk_functions.clk_get(dev, id);
+   return ERR_PTR(-ENOSYS);
+}
+EXPORT_SYMBOL(clk_get);
+
+void clk_put(struct clk *clk)
+{
+   if (clk_functions.clk_put)
+   clk_functions.clk_put(clk);
+}
+EXPORT_SYMBOL(clk_put);
+
+int clk_enable(struct clk *clk)
+{
+   if (clk_functions.clk_enable)
+   return clk_functions.clk_enable(clk);
+   return -ENOSYS;
+}
+EXPORT_SYMBOL(clk_enable);
+
+void clk_disable(struct clk *clk)
+{
+   if (clk_functions.clk_disable)
+   clk_functions.clk_disable(clk);
+}
+EXPORT_SYMBOL(clk_disable);
+
+unsigned long clk_get_rate(struct clk *clk)
+{
+   if (clk_functions.clk_get_rate)
+   return clk_functions.clk_get_rate(clk);
+   return 0;
+}
+EXPORT_SYMBOL(clk_get_rate);
+
+long clk_round_rate(struct clk *clk, unsigned long rate)
+{
+   if (clk_functions.clk_round_rate)
+   return clk_functions.clk_round_rate(clk, rate);
+   return -ENOSYS;
+}
+EXPORT_SYMBOL(clk_round_rate);
+
+int clk_set_rate(struct clk *clk, unsigned long rate)
+{
+   if (clk_functions.clk_set_rate)
+   return clk_functions.clk_set_rate(clk, rate);
+   return -ENOSYS;
+}
+EXPORT_SYMBOL(clk_set_rate);
+
+struct clk *clk_get_parent(struct clk *clk)
+{
+   if (clk_functions.clk_get_parent)
+   return clk_functions.clk_get_parent(clk);
+   return ERR_PTR(-ENOSYS);
+}
+EXPORT_SYMBOL(clk_get_parent);
+
+int clk_set_parent(struct clk *clk, struct clk *parent)
+{
+   if (clk_functions.clk_set_parent)
+   return clk_functions.clk_set_parent(clk, parent);
+   return -ENOSYS;
+}
+EXPORT_SYMBOL(clk_set_parent);
Index: linux.git/include/asm-powerpc/clk_interface.h
===
--- /dev/null
+++ linux.git/include/asm-powerpc/clk_interface.h
@@ -0,0 +1,20 @@
+#ifndef __ASM_POWERPC_CLK_INTERFACE_H
+#define __ASM_POWERPC_CLK_INTERFACE_H
+
+#include 
+
+struct clk_interface {
+   struct clk* (*clk_get)  (struct device *dev, const char *id);
+   int (*clk_enable)   (struct clk *clk);
+   void(*clk_disable)  (struct clk *clk);
+   unsigned long   (*clk_get_rate) (struct clk *clk);
+   void(*clk_put)  (struct clk *clk);
+   long(*clk_round_rate) (struct clk *clk, unsigned long rate);
+   int (*clk_set_rate) (struct clk *clk, unsigned long rate);
+   int (*clk_set_parent) (struct clk *clk, struct clk *parent);
+   struct clk* (*clk_get_parent) (struct clk *clk);
+};
+
+extern struct clk_interface clk_functions;
+
+#endif /* __ASM_POWERPC_CLK_INTERFACE_H */
Index: linux.git/arch/powerpc/kernel/Makefile
===
--- linux.git.orig/arch/powerpc/kernel/Makefile
+++ linux.git/arch/powerpc/kernel/Makefile
@@ -24,6 +24,7 @@ obj-$(CONFIG_PPC64)   += vdso64/
 obj-$(CONFIG_ALTIVEC)  += vecemu.o vector.o
 obj-$(CONFIG_PPC_970_NAP)  += idle_power4.o
 obj-$(CONFIG_PPC_OF)   += of_device.o of_platform.o prom_parse.o
+obj-$(CONFIG_PPC_CLOCK)+= clock.o
 procfs-$(CONFIG_PPC64) := proc_ppc64.o
 obj-$(CONFIG_PROC_FS)  += $(procfs-y)
 rtaspci-$(CONFIG_PPC64)-$(CONFIG_PCI)  := rtas_pci.o
Index: linux.git/arch/powerpc/Kconfig
===
--- linux.git.orig/arch/powerpc/Kconfig
+++ linux.git/arch/powerpc/Kconfig
@@ -664,3 +664,7 @@ config KEYS_COMPAT
default y
 
 source "crypto/Kconfig"
+
+config PPC_CLOCK
+   bool
+   default n
Index: linux.git/arch/powerpc

Re: [patch 3/3] mpc8349emitx.dts: Add ds1339 RTC

2007-09-20 Thread Scott Wood
On Thu, Sep 20, 2007 at 12:42:14PM +0200, Peter Korsgaard wrote:
> Index: linux/arch/powerpc/boot/dts/mpc8349emitx.dts
> ===
> --- linux.orig/arch/powerpc/boot/dts/mpc8349emitx.dts
> +++ linux/arch/powerpc/boot/dts/mpc8349emitx.dts
> @@ -68,6 +68,13 @@
>   interrupts = ;
>   interrupt-parent = < &ipic >;
>   dfsrr;
> +
> + [EMAIL PROTECTED] {
> + device_type = "rtc";
> + compatible = "dallas,ds1339";
> + reg = <68 4>;
> + };

#size-cells is zero on i2c, so it should just be reg = <68>.

You'll probably need to add #address-cells and #size-cells to the
controller node, as well.

-Scott
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


2.6.23-rc6-mm1: Build failures on ppc64_defconfig

2007-09-20 Thread Satyam Sharma


On Thu, 20 Sep 2007, Mel Gorman wrote:
> 
> allmodconfig on ppc64 fails to build with the following error

BTW ppc64_defconfig didn't quite like 2.6.23-rc6-mm1 either ...
IIRC I got build failures in:

drivers/ata/pata_scc.c
drivers/md/raid6int8.c
drivers/net/spider_net.c
drivers/net/pasemi_mac.c
drivers/pci/hotplug/rpadlpar_sysfs.c

I was in a hurry so didn't record the errors, just noted down the files
and disabled them from .config and continued building ... I'll get back
to fixing these up tonight (if you don't do that by then already).


Satyam
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: Build failure on ppc64 drivers/block/ps3disk.c

2007-09-20 Thread Jens Axboe
On Thu, Sep 20 2007, Mel Gorman wrote:
> allmodconfig on ppc64 fails to build with the following error
> 
> drivers/block/ps3disk.c: In function `ps3disk_probe':
> drivers/block/ps3disk.c:509: error: implicit declaration of function 
> `blk_queue_issue_flush_fn'
> make[2]: *** [drivers/block/ps3disk.o] Error 1
> make[1]: *** [drivers/block] Error 2
> make: *** [drivers] Error 2
> 
> The problem seems to be coming from git-block.patch. Jens, glancing through
> the patch, the function blk_queue_issue_flush_fn() seems to be have been
> made redundant. Based on that, this looks like the correct fix but it needs
> a review. Thanks
> 
> Signed-off-by: Mel Gorman <[EMAIL PROTECTED]>
> --- 
>  drivers/block/ps3disk.c |   21 -
>  1 file changed, 21 deletions(-)
> 
> diff -rup -X /usr/src/patchset-0.6/bin//dontdiff 
> linux-2.6.23-rc6-mm1-030_fix_ppc64_sata/drivers/block/ps3disk.c 
> linux-2.6.23-rc6-mm1-035_fix_ppc64_ps3disk/drivers/block/ps3disk.c
> --- linux-2.6.23-rc6-mm1-030_fix_ppc64_sata/drivers/block/ps3disk.c   
> 2007-09-11 03:50:29.0 +0100
> +++ linux-2.6.23-rc6-mm1-035_fix_ppc64_ps3disk/drivers/block/ps3disk.c
> 2007-09-20 14:17:43.0 +0100
> @@ -414,26 +414,6 @@ static void ps3disk_prepare_flush(struct
>   req->cmd_type = REQ_TYPE_FLUSH;
>  }
>  
> -static int ps3disk_issue_flush(struct request_queue *q, struct gendisk 
> *gendisk,
> -sector_t *sector)
> -{
> - struct ps3_storage_device *dev = q->queuedata;
> - struct request *req;
> - int res;
> -
> - dev_dbg(&dev->sbd.core, "%s:%u\n", __func__, __LINE__);
> -
> - req = blk_get_request(q, WRITE, __GFP_WAIT);
> - ps3disk_prepare_flush(q, req);
> - res = blk_execute_rq(q, gendisk, req, 0);
> - if (res)
> - dev_err(&dev->sbd.core, "%s:%u: flush request failed %d\n",
> - __func__, __LINE__, res);
> - blk_put_request(req);
> - return res;
> -}
> -
> -
>  static unsigned long ps3disk_mask;
>  
>  static DEFINE_MUTEX(ps3disk_mask_mutex);
> @@ -506,7 +486,6 @@ static int __devinit ps3disk_probe(struc
>   blk_queue_dma_alignment(queue, dev->blk_size-1);
>   blk_queue_hardsect_size(queue, dev->blk_size);
>  
> - blk_queue_issue_flush_fn(queue, ps3disk_issue_flush);
>   blk_queue_ordered(queue, QUEUE_ORDERED_DRAIN_FLUSH,
> ps3disk_prepare_flush);

Thanks! The patch is correct, the prepare_flush() hook is now all that
is needed. I will apply this to my barrier branch, where this originates
from.

-- 
Jens Axboe

___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Build failure on ppc64 drivers/block/ps3disk.c

2007-09-20 Thread Mel Gorman
allmodconfig on ppc64 fails to build with the following error

drivers/block/ps3disk.c: In function `ps3disk_probe':
drivers/block/ps3disk.c:509: error: implicit declaration of function 
`blk_queue_issue_flush_fn'
make[2]: *** [drivers/block/ps3disk.o] Error 1
make[1]: *** [drivers/block] Error 2
make: *** [drivers] Error 2

The problem seems to be coming from git-block.patch. Jens, glancing through
the patch, the function blk_queue_issue_flush_fn() seems to be have been
made redundant. Based on that, this looks like the correct fix but it needs
a review. Thanks

Signed-off-by: Mel Gorman <[EMAIL PROTECTED]>
--- 
 drivers/block/ps3disk.c |   21 -
 1 file changed, 21 deletions(-)

diff -rup -X /usr/src/patchset-0.6/bin//dontdiff 
linux-2.6.23-rc6-mm1-030_fix_ppc64_sata/drivers/block/ps3disk.c 
linux-2.6.23-rc6-mm1-035_fix_ppc64_ps3disk/drivers/block/ps3disk.c
--- linux-2.6.23-rc6-mm1-030_fix_ppc64_sata/drivers/block/ps3disk.c 
2007-09-11 03:50:29.0 +0100
+++ linux-2.6.23-rc6-mm1-035_fix_ppc64_ps3disk/drivers/block/ps3disk.c  
2007-09-20 14:17:43.0 +0100
@@ -414,26 +414,6 @@ static void ps3disk_prepare_flush(struct
req->cmd_type = REQ_TYPE_FLUSH;
 }
 
-static int ps3disk_issue_flush(struct request_queue *q, struct gendisk 
*gendisk,
-  sector_t *sector)
-{
-   struct ps3_storage_device *dev = q->queuedata;
-   struct request *req;
-   int res;
-
-   dev_dbg(&dev->sbd.core, "%s:%u\n", __func__, __LINE__);
-
-   req = blk_get_request(q, WRITE, __GFP_WAIT);
-   ps3disk_prepare_flush(q, req);
-   res = blk_execute_rq(q, gendisk, req, 0);
-   if (res)
-   dev_err(&dev->sbd.core, "%s:%u: flush request failed %d\n",
-   __func__, __LINE__, res);
-   blk_put_request(req);
-   return res;
-}
-
-
 static unsigned long ps3disk_mask;
 
 static DEFINE_MUTEX(ps3disk_mask_mutex);
@@ -506,7 +486,6 @@ static int __devinit ps3disk_probe(struc
blk_queue_dma_alignment(queue, dev->blk_size-1);
blk_queue_hardsect_size(queue, dev->blk_size);
 
-   blk_queue_issue_flush_fn(queue, ps3disk_issue_flush);
blk_queue_ordered(queue, QUEUE_ORDERED_DRAIN_FLUSH,
  ps3disk_prepare_flush);
 

-- 
Mel Gorman
Part-time Phd Student  Linux Technology Center
University of Limerick IBM Dublin Software Lab
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


2.6.23-rc6-mm1: Build failure on ppc64 drivers/ata/pata_scc.c

2007-09-20 Thread Mel Gorman
PPC64 building allmodconfig fails to compile drivers/ata/pata_scc.c . It
doesn't show up on other arches because this driver is specific to the
architecture.

drivers/ata/pata_scc.c: In function `scc_bmdma_status':
drivers/ata/pata_scc.c:734: error: structure has no member named `active_tag'
drivers/ata/pata_scc.c: In function `scc_pata_prereset':
drivers/ata/pata_scc.c:866: warning: passing arg 1 of `ata_std_prereset' from 
incompatible pointer type
drivers/ata/pata_scc.c: In function `scc_error_handler':
drivers/ata/pata_scc.c:908: warning: passing arg 2 of `ata_bmdma_drive_eh' from 
incompatible pointer type
drivers/ata/pata_scc.c:908: warning: passing arg 3 of `ata_bmdma_drive_eh' from 
incompatible pointer type
drivers/ata/pata_scc.c:908: warning: passing arg 5 of `ata_bmdma_drive_eh' from 
incompatible pointer type
make[2]: *** [drivers/ata/pata_scc.o] Error 1
make[1]: *** [drivers/ata] Error 2
make: *** [drivers] Error 2

The problem seems to be in git-libata-all.patch but based on similar
changes in this patch, the following patch should be the fix. 

Signed-off-by: Mel Gorman <[EMAIL PROTECTED]>
--- 
 drivers/ata/pata_scc.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff -rup -X /usr/src/patchset-0.6/bin//dontdiff 
linux-2.6.23-rc6-mm1-025_fix_ppc64_kgdb/drivers/ata/pata_scc.c 
linux-2.6.23-rc6-mm1-030_fix_ppc64_sata/drivers/ata/pata_scc.c
--- linux-2.6.23-rc6-mm1-025_fix_ppc64_kgdb/drivers/ata/pata_scc.c  
2007-09-18 11:29:26.0 +0100
+++ linux-2.6.23-rc6-mm1-030_fix_ppc64_sata/drivers/ata/pata_scc.c  
2007-09-20 11:51:01.0 +0100
@@ -731,7 +731,7 @@ static u8 scc_bmdma_status (struct ata_p
void __iomem *mmio = ap->ioaddr.bmdma_addr;
u8 host_stat = in_be32(mmio + SCC_DMA_STATUS);
u32 int_status = in_be32(mmio + SCC_DMA_INTST);
-   struct ata_queued_cmd *qc = ata_qc_from_tag(ap, ap->active_tag);
+   struct ata_queued_cmd *qc = ata_qc_from_tag(ap, ap->link.active_tag);
static int retry = 0;
 
/* return if IOS_SS is cleared */
-- 
Mel Gorman
Part-time Phd Student  Linux Technology Center
University of Limerick IBM Dublin Software Lab
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH] [POWERPC] Fix QEIC->MPIC cascading

2007-09-20 Thread Anton Vorontsov
set_irq_chained_handler overwrites MPIC's handle_irq function
(handle_fasteoi_irq) thus MPIC never gets eoi event from the
cascaded IRQ. This situation hangs MPIC on MPC8568E.

Patch adds flow level "end" handler to the MPIC, and QEIC calls
it when QEIC's interrupt processing finished.

Signed-off-by: Anton Vorontsov <[EMAIL PROTECTED]>
---
 arch/powerpc/sysdev/mpic.c |3 +++
 arch/powerpc/sysdev/qe_lib/qe_ic.c |6 ++
 2 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/arch/powerpc/sysdev/mpic.c b/arch/powerpc/sysdev/mpic.c
index 8de29f2..bee2d5b 100644
--- a/arch/powerpc/sysdev/mpic.c
+++ b/arch/powerpc/sysdev/mpic.c
@@ -846,6 +846,7 @@ static struct irq_chip mpic_irq_chip = {
.mask   = mpic_mask_irq,
.unmask = mpic_unmask_irq,
.eoi= mpic_end_irq,
+   .end= mpic_end_irq,
.set_type   = mpic_set_irq_type,
 };
 
@@ -854,6 +855,7 @@ static struct irq_chip mpic_ipi_chip = {
.mask   = mpic_mask_ipi,
.unmask = mpic_unmask_ipi,
.eoi= mpic_end_ipi,
+   .end= mpic_end_ipi,
 };
 #endif /* CONFIG_SMP */
 
@@ -864,6 +866,7 @@ static struct irq_chip mpic_irq_ht_chip = {
.mask   = mpic_mask_irq,
.unmask = mpic_unmask_ht_irq,
.eoi= mpic_end_ht_irq,
+   .end= mpic_end_ht_irq,
.set_type   = mpic_set_irq_type,
 };
 #endif /* CONFIG_MPIC_U3_HT_IRQS */
diff --git a/arch/powerpc/sysdev/qe_lib/qe_ic.c 
b/arch/powerpc/sysdev/qe_lib/qe_ic.c
index 55e6f39..8e743e0 100644
--- a/arch/powerpc/sysdev/qe_lib/qe_ic.c
+++ b/arch/powerpc/sysdev/qe_lib/qe_ic.c
@@ -328,6 +328,9 @@ void qe_ic_cascade_low(unsigned int irq, struct irq_desc 
*desc)
 
if (cascade_irq != NO_IRQ)
generic_handle_irq(cascade_irq);
+
+   if (desc->chip->end)
+   desc->chip->end(irq);
 }
 
 void qe_ic_cascade_high(unsigned int irq, struct irq_desc *desc)
@@ -337,6 +340,9 @@ void qe_ic_cascade_high(unsigned int irq, struct irq_desc 
*desc)
 
if (cascade_irq != NO_IRQ)
generic_handle_irq(cascade_irq);
+
+   if (desc->chip->end)
+   desc->chip->end(irq);
 }
 
 void __init qe_ic_init(struct device_node *node, unsigned int flags)
-- 
1.5.0.6
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


4xx git tree moved

2007-09-20 Thread Josh Boyer
For those interested in 4xx, I've moved my git tree to kernel.org.  You
can find it here:

git://git.kernel.org/pub/scm/linux/kernel/git/jwboyer/powerpc.git

josh
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Please pull from 'for-2.6.24' branch of 4xx tree

2007-09-20 Thread Josh Boyer
Hi Paul,

Please pull from

 master.kernel.org:/pub/scm/linux/kernel/git/jwboyer/powerpc.git for-2.6.24

to receive the following updates:

David Gibson (1):
  [POWERPC] Cleanups for physmap_of.c (v2)

Hollis Blanchard (1):
  [POWERPC] 4xx: Implement udbg_getc() for 440

Josh Boyer (5):
  [POWERPC] cuimage for Bamboo board
  [POWERPC] Make partitions optional in physmap_of
  [POWERPC] 4xx: Convert Walnut flash mappings to new binding
  [POWERPC] 4xx: Convert Seqouia flash mappings to new binding
  [POWERPC] Update PowerPC 4xx entry in MAINTAINERS

Valentine Barshak (3):
  [POWERPC] Add 64-bit resources support to pci_iomap
  [POWERPC] 4xx: Fix Bamboo MAL0 dts entry.
  [POWERPC] 4xx: Fix Sequoia MAL0 and EMAC dts entries.

 MAINTAINERS|3 +
 arch/powerpc/boot/44x.h|2 +-
 arch/powerpc/boot/Makefile |4 +-
 arch/powerpc/boot/bamboo.c |8 +-
 arch/powerpc/boot/cuboot-bamboo.c  |   30 +
 arch/powerpc/boot/dts/bamboo.dts   |2 +-
 arch/powerpc/boot/dts/sequoia.dts  |   46 +--
 arch/powerpc/boot/dts/walnut.dts   |   17 ++-
 arch/powerpc/boot/treeboot-bamboo.c|   22 +++-
 arch/powerpc/configs/sequoia_defconfig |   91 +-
 arch/powerpc/kernel/iomap.c|4 +-
 arch/powerpc/kernel/udbg_16550.c   |   11 ++
 drivers/mtd/maps/physmap_of.c  |  222 ++--
 13 files changed, 304 insertions(+), 158 deletions(-)
 create mode 100644 arch/powerpc/boot/cuboot-bamboo.c

___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: Cleanups for physmap_of.c (v2)

2007-09-20 Thread Josh Boyer
On Thu, 20 Sep 2007 11:22:25 +1000
David Gibson <[EMAIL PROTECTED]> wrote:

> This patch includes a whole batch of smallish cleanups for
> drivers/mtd/physmap_of.c.
> 
>   - A bunch of uneeded #includes are removed
>   - We switch to the modern linux/of.h etc. in place of
> asm/prom.h
>   - Use some helper macros to avoid some ugly inline #ifdefs
>   - A few lines of unreachable code are removed
>   - A number of indentation / line-wrapping fixes
>   - More consistent use of kernel idioms such as if (!p) instead
> of if (p == NULL)
>   - Clarify some printk()s and other informative strings.
>   - parse_obsolete_partitions() now returns 0 if no partition
> information is found, instead of returning -ENOENT which the caller
> had to handle specially.
>   - (the big one) Despite the name, this driver really has
> nothing to do with drivers/mtd/physmap.c.  The fact that the flash
> chips must be physically direct mapped is a constrant, but doesn't
> really say anything about the actual purpose of this driver, which is
> to instantiate MTD devices based on information from the device tree.
> Therefore the physmap name is replaced everywhere within the file with
> "of_flash".  The file itself and the Kconfig option is not renamed for
> now (so that the diff is actually a diff).  That can come later.
> 
> Signed-off-by: David Gibson <[EMAIL PROTECTED]>

Looks great this time.  Tested on Ebony and Walnut.  I've applied it to
my tree.

josh
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[patch 1/3] fsl_soc: Fix trivial printk typo.

2007-09-20 Thread Peter Korsgaard
Fix a trivial printk typo in fsl_soc.

Cc: G. Liakhovetski <[EMAIL PROTECTED]>
Signed-off-by: Peter Korsgaard <[EMAIL PROTECTED]>
---
 arch/powerpc/sysdev/fsl_soc.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: linux/arch/powerpc/sysdev/fsl_soc.c
===
--- linux.orig/arch/powerpc/sysdev/fsl_soc.c
+++ linux/arch/powerpc/sysdev/fsl_soc.c
@@ -346,7 +346,7 @@
 
addr = of_get_property(node, "reg", &len);
if (!addr || len < sizeof(int) || *addr > (1 << 10) - 1) {
-   printk(KERN_WARNING "fsl_ioc.c: invalid i2c device 
entry\n");
+   printk(KERN_WARNING "fsl_soc.c: invalid i2c device 
entry\n");
continue;
}
 

-- 
Bye, Peter Korsgaard
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[patch 3/3] mpc8349emitx.dts: Add ds1339 RTC

2007-09-20 Thread Peter Korsgaard
Add ds1339 I2C RTC chip as child of 2nd I2C controller.

Cc: Timur Tabi <[EMAIL PROTECTED]>
Signed-off-by: Peter Korsgaard <[EMAIL PROTECTED]>
---
 arch/powerpc/boot/dts/mpc8349emitx.dts |7 +++
 1 file changed, 7 insertions(+)

Index: linux/arch/powerpc/boot/dts/mpc8349emitx.dts
===
--- linux.orig/arch/powerpc/boot/dts/mpc8349emitx.dts
+++ linux/arch/powerpc/boot/dts/mpc8349emitx.dts
@@ -68,6 +68,13 @@
interrupts = ;
interrupt-parent = < &ipic >;
dfsrr;
+
+   [EMAIL PROTECTED] {
+   device_type = "rtc";
+   compatible = "dallas,ds1339";
+   reg = <68 4>;
+   };
+
};
 
[EMAIL PROTECTED] {

-- 
Bye, Peter Korsgaard
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[patch 0/3] fsl_soc / mpc8349emitx patches

2007-09-20 Thread Peter Korsgaard
Various small fsl_soc / mpc8349emitx patches.

-- 
Bye, Peter Korsgaard
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[patch 2/3] fsl_soc: rtc-ds1307 support

2007-09-20 Thread Peter Korsgaard
Add support for the I2C devices handled by the rtc-ds1307 driver to
of_register_i2c_devices.

Cc: G. Liakhovetski <[EMAIL PROTECTED]>
Signed-off-by: Peter Korsgaard <[EMAIL PROTECTED]>
---
 arch/powerpc/sysdev/fsl_soc.c |6 ++
 1 file changed, 6 insertions(+)

Index: linux/arch/powerpc/sysdev/fsl_soc.c
===
--- linux.orig/arch/powerpc/sysdev/fsl_soc.c
+++ linux/arch/powerpc/sysdev/fsl_soc.c
@@ -319,6 +319,12 @@
{"ricoh,rs5c372b", "rtc-rs5c372", "rs5c372b",},
{"ricoh,rv5c386",  "rtc-rs5c372", "rv5c386",},
{"ricoh,rv5c387a", "rtc-rs5c372", "rv5c387a",},
+   {"dallas,ds1307",  "rtc-ds1307",  "ds1307",},
+   {"dallas,ds1337",  "rtc-ds1307",  "ds1337",},
+   {"dallas,ds1338",  "rtc-ds1307",  "ds1338",},
+   {"dallas,ds1339",  "rtc-ds1307",  "ds1339",},
+   {"dallas,ds1340",  "rtc-ds1307",  "ds1340",},
+   {"stm,m41t00", "rtc-ds1307",  "m41t00"},
 };
 
 static int __init of_find_i2c_driver(struct device_node *node, struct 
i2c_board_info *info)

-- 
Bye, Peter Korsgaard
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: Configuration-Problem ext-interrupt on mpc52xx

2007-09-20 Thread S. Fricke
Hello,

> > I have read it! But another driver on Boot-time pulled my interrupt
> 
> Erm.. if the interrupt is shared with something else which expects a
> different trigger/polarity, you're kind of stuffed

YEEeess! An incomplete documentation is suboptimal! In german, we would
say: "[...] Das es die Sau krausst [...]"

I have now used an another Interrupt and it works.

Mit freundlichen Gruessen
Silvio Fricke

-- 
-- S. Fricke - MAILTO:[EMAIL PROTECTED] --
   Diplom-Informatiker (FH)   TEL:   (+49)8330-911278
   Linux-Entwicklung   JABBER:  [EMAIL PROTECTED]
-- Steinbacher Strasse 18, D-87764 Legau ---



pgp8VQjayKpfq.pgp
Description: PGP signature
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev

  1   2   >