[PATCH 1/3] add default device trees for MPC837x MDS board

2008-01-07 Thread Li Yang
Signed-off-by: Li Yang [EMAIL PROTECTED]
---
address comments and use new dts spec.

 arch/powerpc/boot/dts/mpc8377_mds.dts |  277 +++
 arch/powerpc/boot/dts/mpc8378_mds.dts |  263 +
 arch/powerpc/boot/dts/mpc8379_mds.dts |  291 +
 3 files changed, 831 insertions(+), 0 deletions(-)

diff --git a/arch/powerpc/boot/dts/mpc8377_mds.dts 
b/arch/powerpc/boot/dts/mpc8377_mds.dts
new file mode 100644
index 000..b50b5f9
--- /dev/null
+++ b/arch/powerpc/boot/dts/mpc8377_mds.dts
@@ -0,0 +1,277 @@
+/*
+ * MPC8377E MDS Device Tree Source
+ *
+ * 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 = fsl,mpc8377emds;
+   compatible = fsl,mpc8377emds,fsl,mpc837xmds;
+   #address-cells = 1;
+   #size-cells = 1;
+
+   aliases {
+   ethernet0 = enet0;
+   ethernet1 = enet1;
+   serial0 = serial0;
+   serial1 = serial1;
+   pci0 = pci0;
+   };
+
+   cpus {
+   #address-cells = 1;
+   #size-cells = 0;
+
+   PowerPC,[EMAIL PROTECTED] {
+   device_type = cpu;
+   reg = 0;
+   d-cache-line-size = 20;
+   i-cache-line-size = 20;
+   d-cache-size = 8000;  // L1, 32K
+   i-cache-size = 8000;  // L1, 32K
+   timebase-frequency = 0;
+   bus-frequency = 0;
+   clock-frequency = 0;
+   };
+   };
+
+   memory {
+   device_type = memory;
+   reg =  2000;  // 512MB at 0
+   };
+
+   [EMAIL PROTECTED] {
+   #address-cells = 1;
+   #size-cells = 1;
+   device_type = soc;
+   ranges = 0 e000 0010;
+   reg = e000 0200;
+   bus-frequency = 0;
+
+   [EMAIL PROTECTED] {
+   compatible = mpc83xx_wdt;
+   reg = 200 100;
+   };
+
+   [EMAIL PROTECTED] {
+   #address-cells = 1;
+   #size-cells = 0;
+   cell-index = 0;
+   compatible = fsl-i2c;
+   reg = 3000 100;
+   interrupts = e 8;
+   interrupt-parent =  ipic ;
+   dfsrr;
+   };
+
+   [EMAIL PROTECTED] {
+   #address-cells = 1;
+   #size-cells = 0;
+   cell-index = 1;
+   compatible = fsl-i2c;
+   reg = 3100 100;
+   interrupts = f 8;
+   interrupt-parent =  ipic ;
+   dfsrr;
+   };
+
+   [EMAIL PROTECTED] {
+   compatible = fsl_spi;
+   reg = 7000 1000;
+   interrupts = 10 8;
+   interrupt-parent =  ipic ;
+   mode = cpu;
+   };
+
+   /* phy type (ULPI, UTMI, UTMI_WIDE, SERIAL) */
+   [EMAIL PROTECTED] {
+   compatible = fsl-usb2-dr;
+   reg = 23000 1000;
+   #address-cells = 1;
+   #size-cells = 0;
+   interrupt-parent =  ipic ;
+   interrupts = 26 8;
+   phy_type = utmi_wide;
+   };
+
+   [EMAIL PROTECTED] {
+   #address-cells = 1;
+   #size-cells = 0;
+   compatible = fsl,gianfar-mdio;
+   reg = 24520 20;
+   phy2: [EMAIL PROTECTED] {
+   interrupt-parent =  ipic ;
+   interrupts = 11 8;
+   reg = 2;
+   device_type = ethernet-phy;
+   };
+   phy3: [EMAIL PROTECTED] {
+   interrupt-parent =  ipic ;
+   interrupts = 12 8;
+   reg = 3;
+   device_type = ethernet-phy;
+   };
+   };
+
+   enet0: [EMAIL PROTECTED] {
+   cell-index = 0;
+   device_type = network;
+   model = eTSEC;
+   compatible = gianfar;
+   reg = 24000 1000;
+

[PATCH 2/3] add MPC837x USB platform support

2008-01-07 Thread Li Yang
Add chip specific and board specific initialization for MPC837x USB.

Signed-off-by: Li Yang [EMAIL PROTECTED]
---
 arch/powerpc/platforms/83xx/mpc837x_mds.c |   48 +
 arch/powerpc/platforms/83xx/mpc83xx.h |3 ++
 arch/powerpc/platforms/83xx/usb.c |   39 +++
 3 files changed, 90 insertions(+), 0 deletions(-)

diff --git a/arch/powerpc/platforms/83xx/mpc837x_mds.c 
b/arch/powerpc/platforms/83xx/mpc837x_mds.c
index 166c111..de60872 100644
--- a/arch/powerpc/platforms/83xx/mpc837x_mds.c
+++ b/arch/powerpc/platforms/83xx/mpc837x_mds.c
@@ -27,6 +27,53 @@ unsigned long isa_io_base = 0;
 unsigned long isa_mem_base = 0;
 #endif
 
+#define BCSR12_USB_SER_MASK0x8a
+#define BCSR12_USB_SER_PIN 0x80
+#define BCSR12_USB_SER_DEVICE  0x02
+extern int mpc837x_usb_cfg(void);
+
+static int mpc837xmds_usb_cfg(void)
+{
+   struct device_node *np;
+   const void *phy_type, *mode;
+   void __iomem *bcsr_regs = NULL;
+   u8 bcsr12;
+   int ret;
+
+   ret = mpc837x_usb_cfg();
+   if (ret)
+   return ret;
+   /* Map BCSR area */
+   np = of_find_node_by_name(NULL, bcsr);
+   if (np) {
+   struct resource res;
+
+   of_address_to_resource(np, 0, res);
+   bcsr_regs = ioremap(res.start, res.end - res.start + 1);
+   of_node_put(np);
+   }
+   if (!bcsr_regs)
+   return -1;
+
+   np = of_find_node_by_name(NULL, usb);
+   phy_type = of_get_property(np, phy_type, NULL);
+   if (phy_type  !strcmp(phy_type, ulpi)) {
+   clrbits8(bcsr_regs + 12, BCSR12_USB_SER_PIN);
+   } else if (phy_type  !strcmp(phy_type, serial)) {
+   mode = of_get_property(np, dr_mode, NULL);
+   bcsr12 = in_8(bcsr_regs + 12)  ~BCSR12_USB_SER_MASK;
+   bcsr12 |= BCSR12_USB_SER_PIN;
+   if (mode  !strcmp(mode, peripheral))
+   bcsr12 |= BCSR12_USB_SER_DEVICE;
+   out_8(bcsr_regs + 12, bcsr12);
+   } else {
+   printk(KERN_ERR USB DR: unsupported PHY\n);
+   }
+
+   iounmap(bcsr_regs);
+   return 0;
+}
+
 /* 
  *
  * Setup the architecture
@@ -45,6 +92,7 @@ static void __init mpc837x_mds_setup_arch(void)
for_each_compatible_node(np, pci, fsl,mpc8349-pci)
mpc83xx_add_bridge(np);
 #endif
+   mpc837xmds_usb_cfg();
 }
 
 static struct of_device_id mpc837x_ids[] = {
diff --git a/arch/powerpc/platforms/83xx/mpc83xx.h 
b/arch/powerpc/platforms/83xx/mpc83xx.h
index b778cb4..88bb748 100644
--- a/arch/powerpc/platforms/83xx/mpc83xx.h
+++ b/arch/powerpc/platforms/83xx/mpc83xx.h
@@ -14,6 +14,7 @@
 #define MPC83XX_SCCR_USB_DRCM_11   0x0030
 #define MPC83XX_SCCR_USB_DRCM_01   0x0010
 #define MPC83XX_SCCR_USB_DRCM_10   0x0020
+#define MPC837X_SCCR_USB_DRCM_11   0x00c0
 
 /* system i/o configuration register low */
 #define MPC83XX_SICRL_OFFS 0x114
@@ -22,6 +23,8 @@
 #define MPC834X_SICRL_USB1 0x2000
 #define MPC831X_SICRL_USB_MASK 0x0c00
 #define MPC831X_SICRL_USB_ULPI 0x0800
+#define MPC837X_SICRL_USB_MASK 0xf000
+#define MPC837X_SICRL_USB_ULPI 0x5000
 
 /* system i/o configuration register high */
 #define MPC83XX_SICRH_OFFS 0x118
diff --git a/arch/powerpc/platforms/83xx/usb.c 
b/arch/powerpc/platforms/83xx/usb.c
index b45160f..2985c9c 100644
--- a/arch/powerpc/platforms/83xx/usb.c
+++ b/arch/powerpc/platforms/83xx/usb.c
@@ -179,3 +179,42 @@ int mpc831x_usb_cfg(void)
return ret;
 }
 #endif /* CONFIG_PPC_MPC831x */
+
+#ifdef CONFIG_PPC_MPC837x
+int mpc837x_usb_cfg(void)
+{
+   void __iomem *immap;
+   struct device_node *np = NULL;
+   const void *prop;
+   int ret = 0;
+
+   np = of_find_compatible_node(NULL, usb, fsl-usb2-dr);
+   if (!np)
+   return -ENODEV;
+   prop = of_get_property(np, phy_type, NULL);
+
+   if (strcmp(prop, ulpi)  strcmp(prop, serial)) {
+   printk(KERN_WARNING 837x USB PHY type not supported\n);
+   return -EINVAL;
+   }
+
+   /* Map IMMR space for pin and clock settings */
+   immap = ioremap(get_immrbase(), 0x1000);
+   if (!immap) {
+   of_node_put(np);
+   return -ENOMEM;
+   }
+
+   /* Configure clock */
+   clrsetbits_be32(immap + MPC83XX_SCCR_OFFS, MPC837X_SCCR_USB_DRCM_11,
+   MPC837X_SCCR_USB_DRCM_11);
+
+   /* Configure pin mux for ULPI/serial */
+   clrsetbits_be32(immap + MPC83XX_SICRL_OFFS, MPC837X_SICRL_USB_MASK,
+   MPC837X_SICRL_USB_ULPI);
+
+   iounmap(immap);
+   of_node_put(np);
+   return ret;
+}
+#endif /* CONFIG_PPC_MPC837x */
-- 
1.5.3.5.643.g40e25

___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org

Re: [PATCh v3] powerpc: add hugepagesz boot-time parameter

2008-01-07 Thread Mel Gorman
On (04/01/08 00:34), Arnd Bergmann didst pronounce:
 On Thursday 03 January 2008, Jon Tollefson wrote:
  Paul, please include this in 2.6.25 if there are no objections.
 
 No objections to this version from me, just questions.
 
  This patch adds the hugepagesz boot-time parameter for ppc64.  It lets
  one pick the size for huge pages. The choices available are 64K and 16M
  when the base page size is 4k. It defaults to 16M (previously the only
  only choice) if nothing or an invalid choice is specified.
 
 We started discussing this in v1, but the discussion got sidetracked:
 Is there a technical reason why you don't also allow 1M pages, which
 may be useful in certain scenarios?
 

I cannot see why not although the ideal would be that the necessary
information to support the pagesize would be provided by the firmware
instead of hard-coded values.

 On the Cell/B.E. platforms (IBM/Mercury blades, Toshiba Celleb, PS3), the
 second large page size is an option that can be set in a HID SPR
 to either 64KB or 1MB. Unfortunately, we can't do these two simultaneously,
 but the firmware can change the default and put it into the device tree,
 or you could have the kernel override the firmware settings.
 
 Going a lot further, do you have plans for a fully dynamic hugepage size,
 e.g. using a mount option for hugetlbfs?

A mount option for hugetlbfs to select a hugepage size is a long-term
goal. However, a lot of changes are required to support such a thing. Selecting
the hugepage size at boot-time is a reasonable starting point and one that
might be usable with some additional work by x86-64 on AMD processors
supporting 1GiB pages.

 I can see that as rather useful,
 but at the same time it's probably much more complicated than the boot time
 option.
 

Not probably at all. It is *certainly* much more complicated than the
boot-time option :)

-- 
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: [PATCh v3] powerpc: add hugepagesz boot-time parameter

2008-01-07 Thread Arnd Bergmann
On Monday 07 January 2008, Mel Gorman wrote:
 
  We started discussing this in v1, but the discussion got sidetracked:
  Is there a technical reason why you don't also allow 1M pages, which
  may be useful in certain scenarios?
  
 
 I cannot see why not although the ideal would be that the necessary
 information to support the pagesize would be provided by the firmware
 instead of hard-coded values.
 
  On the Cell/B.E. platforms (IBM/Mercury blades, Toshiba Celleb, PS3), the
  second large page size is an option that can be set in a HID SPR
  to either 64KB or 1MB. Unfortunately, we can't do these two simultaneously,
  but the firmware can change the default and put it into the device tree,
  or you could have the kernel override the firmware settings.

The problem with the firmware choosing the page size is that it has much
less of an idea about what the user wants to do than the kernel.
It's not exclusive however. We can first teach the kernel to deal
with firmware setting the 1MB or 1GB page size, and later implement
changing the HW setting from the kernel.

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


Re: [alsa-devel] [PATCH] ASoC drivers for the Freescale MPC8610 SoC

2008-01-07 Thread Mark Brown
On Fri, Jan 04, 2008 at 08:43:17PM -0600, Timur Tabi wrote:
 Mark Brown wrote:

 In other words, ...

 clock1 = 0, bb8000
 clock2 = 1, 653230
 clock23 = 0, ab2372

Yes, something like that would cover it.  I'm not sure what is idiomatic
for the device tree.

  and of course the ordering matters.  

 Ok, you got me there.  But then, isn't this just another example where the 
 device tree is incapable of describing a complex configuration, and so we 
 need 
 a platform driver?

Yes, you could certainly do that - as you say, any device tree based
configuration would be optional so it's not a blocker if some things
aren't supported.

It'd be nice to have some idea of how to handle it should someone want
to do it but I wouldn't think it's essential.  The most common case
where specific ordering is required is that a PLL will need to have all
its inputs configured before the PLL is activated so it'd probably cover
a large proportion of cases to do that last.

  Indeed.  Providing the device tree stuff doesn't get set in stone I'm
  not sure we need to nail this down perfectly for ASoC v1 when we're
  running into trouble working around it.

 I definitely agree with that.  I'll be the first to admit that this driver, 
 much like ASoC V1, is a prototype.

Yes, from an ASoC point of view the driver looks good as it is.  The
only discussion is about the PowerPC probing stuff.
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [alsa-devel] [PATCH] ASoC drivers for the Freescale MPC8610 SoC

2008-01-07 Thread Mark Brown
On Sun, Jan 06, 2008 at 11:46:37AM +1100, David Gibson wrote:

 Ok, but couldn't you strucutre your I2S or fabric driver so that it
 only becomes fully operational once the codec driver has registered
 with it?

That's what ASoC v2 is doing, more or less (the core brings things on
line rather than drivers doing it).  For v1 so long as it doesn't cause
any problems in practice I'm not sure I'd worry about it too much.
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH 0/7] Powerpc support for SBC8560 board

2008-01-07 Thread Paul Gortmaker

This is a respin of the sbc8560 patches, incorporating the feedback and
suggested changes from everyone.  Changes include:

-coding style and missing of_put (Stephen Rothwell)

-minor dtc cleanups for gianfar, mdio, mpic etc. (David Gibson / Kumar Gala)

-use for_each macros in legacy_serial to improve readability, and as
groundwork for next change (me)

-convert dtc duart + device-type=soc thing to be an epld entry
listed as compatible with localbus -- plus add localbus as an acceptable
parent in legacy_serial (David Gibson / Scott Wood)

-rtc is now a child of the epld/localbus and does not use device_type
in the dtc, nor in the platform detection code (David Gibson)

-add CPM2 data to dts for FCC ports (on optional daughterboard) based
on the MPC8560ADS dts (me)

-add dts aliases, conversion to dts-v1 (Kumar)

Patches are as follows:

1  powerpc-use-for_each-in-legacy_serial.txt
2  powerpc-allow-localbus-compatible-serial-ports-for-console-device.txt
3  sbc8560-add-support-for-Wind-River-SBC8560-in-arch-powerpc.txt
4  sbc8560-Add-device-tree-source-for-Wind-River-SBC8560-board.txt
5  sbc8560-Convert-WRS-SBC8560-device-tree-to-v1-format.txt
6  CPM2-Make-support-for-the-CPM2-optional-on-8560-based-boards.txt
7  sbc8560-Add-default-.config-file-for-Wind-River-SBC8560.txt

Thanks again to all those who provided feedback.

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


[PATCH 1/7] powerpc: use for_each in legacy_serial

2008-01-07 Thread Paul Gortmaker
Use for_each to iterate over device tree nodes in legacy_serial.

Signed-off-by: Paul Gortmaker [EMAIL PROTECTED]
---
 arch/powerpc/kernel/legacy_serial.c |   14 +++---
 1 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/arch/powerpc/kernel/legacy_serial.c 
b/arch/powerpc/kernel/legacy_serial.c
index b9cae6b..a17a5d0 100644
--- a/arch/powerpc/kernel/legacy_serial.c
+++ b/arch/powerpc/kernel/legacy_serial.c
@@ -307,7 +307,7 @@ void __init find_legacy_serial_ports(void)
}
 
/* First fill our array with SOC ports */
-   for (np = NULL; (np = of_find_compatible_node(np, serial, ns16550)) 
!= NULL;) {
+   for_each_compatible_node(np, serial, ns16550) {
struct device_node *soc = of_get_parent(np);
if (soc  !strcmp(soc-type, soc)) {
index = add_legacy_soc_port(np, np);
@@ -317,8 +317,8 @@ void __init find_legacy_serial_ports(void)
of_node_put(soc);
}
 
-   /* First fill our array with ISA ports */
-   for (np = NULL; (np = of_find_node_by_type(np, serial));) {
+   /* Next, fill our array with ISA ports */
+   for_each_node_by_type(np, serial) {
struct device_node *isa = of_get_parent(np);
if (isa  !strcmp(isa-name, isa)) {
index = add_legacy_isa_port(np, isa);
@@ -328,8 +328,8 @@ void __init find_legacy_serial_ports(void)
of_node_put(isa);
}
 
-   /* First fill our array with tsi-bridge ports */
-   for (np = NULL; (np = of_find_compatible_node(np, serial, ns16550)) 
!= NULL;) {
+   /* Next, fill our array with tsi-bridge ports */
+   for_each_compatible_node(np, serial, ns16550) {
struct device_node *tsi = of_get_parent(np);
if (tsi  !strcmp(tsi-type, tsi-bridge)) {
index = add_legacy_soc_port(np, np);
@@ -339,8 +339,8 @@ void __init find_legacy_serial_ports(void)
of_node_put(tsi);
}
 
-   /* First fill our array with opb bus ports */
-   for (np = NULL; (np = of_find_compatible_node(np, serial, ns16550)) 
!= NULL;) {
+   /* Next, fill our array with opb bus ports */
+   for_each_compatible_node(np, serial, ns16550) {
struct device_node *opb = of_get_parent(np);
if (opb  (!strcmp(opb-type, opb) ||
of_device_is_compatible(opb, ibm,opb))) {
-- 
1.5.0.rc1.gf4b6c

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


[PATCH 3/7] sbc8560: add support for Wind River SBC8560 in arch/powerpc

2008-01-07 Thread Paul Gortmaker
This adds support for the Wind River SBC8560 board, implemented as
powerpc.  It closely follows the implementation of the MPC8560ADS.

Signed-off-by: Paul Gortmaker [EMAIL PROTECTED]
---
 arch/powerpc/platforms/85xx/Kconfig   |   11 +-
 arch/powerpc/platforms/85xx/Makefile  |1 +
 arch/powerpc/platforms/85xx/sbc8560.c |  298 +
 3 files changed, 308 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/platforms/85xx/Kconfig 
b/arch/powerpc/platforms/85xx/Kconfig
index 7748a3a..0eb497b 100644
--- a/arch/powerpc/platforms/85xx/Kconfig
+++ b/arch/powerpc/platforms/85xx/Kconfig
@@ -38,6 +38,13 @@ config MPC85xx_DS
help
  This option enables support for the MPC85xx DS (MPC8544 DS) board
 
+config SBC8560
+   bool Wind River SBC8560
+   select DEFAULT_UIMAGE
+   select PPC_CPM_NEW_BINDING
+   help
+ This option enables support for the Wind River SBC8560 board
+
 endchoice
 
 config MPC8540
@@ -49,7 +56,7 @@ config MPC8540
 config MPC8560
bool
select CPM2
-   default y if MPC8560_ADS
+   default y if MPC8560_ADS || SBC8560
 
 config MPC85xx
bool
@@ -59,4 +66,4 @@ config MPC85xx
select FSL_PCI if PCI
select SERIAL_8250_SHARE_IRQ if SERIAL_8250
default y if MPC8540_ADS || MPC85xx_CDS || MPC8560_ADS \
-   || MPC85xx_MDS || MPC85xx_DS
+   || MPC85xx_MDS || MPC85xx_DS || SBC8560
diff --git a/arch/powerpc/platforms/85xx/Makefile 
b/arch/powerpc/platforms/85xx/Makefile
index 5eca920..c3f4d01 100644
--- a/arch/powerpc/platforms/85xx/Makefile
+++ b/arch/powerpc/platforms/85xx/Makefile
@@ -6,3 +6,4 @@ obj-$(CONFIG_MPC8560_ADS) += mpc85xx_ads.o
 obj-$(CONFIG_MPC85xx_CDS) += mpc85xx_cds.o
 obj-$(CONFIG_MPC85xx_DS)  += mpc85xx_ds.o
 obj-$(CONFIG_MPC85xx_MDS) += mpc85xx_mds.o
+obj-$(CONFIG_SBC8560) += sbc8560.o
diff --git a/arch/powerpc/platforms/85xx/sbc8560.c 
b/arch/powerpc/platforms/85xx/sbc8560.c
new file mode 100644
index 000..ca9d90f
--- /dev/null
+++ b/arch/powerpc/platforms/85xx/sbc8560.c
@@ -0,0 +1,298 @@
+/*
+ * Wind River SBC8560 setup and early boot code.
+ *
+ * Copyright 2007 Wind River Systems Inc.
+ *
+ * By Paul Gortmaker (see MAINTAINERS for contact information)
+ *
+ * Based largely on the MPC8560ADS support - Copyright 2005 Freescale 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.
+ */
+
+#include linux/stddef.h
+#include linux/kernel.h
+#include linux/pci.h
+#include linux/kdev_t.h
+#include linux/delay.h
+#include linux/seq_file.h
+#include linux/of_platform.h
+
+#include asm/system.h
+#include asm/time.h
+#include asm/machdep.h
+#include asm/pci-bridge.h
+#include asm/mpic.h
+#include mm/mmu_decl.h
+#include asm/udbg.h
+
+#include sysdev/fsl_soc.h
+#include sysdev/fsl_pci.h
+
+#ifdef CONFIG_CPM2
+#include asm/cpm2.h
+#include sysdev/cpm2_pic.h
+#endif
+
+#ifdef CONFIG_PCI
+static int sbc8560_exclude_device(struct pci_controller *hose,
+  u_char bus, u_char devfn)
+{
+   if (bus == 0  PCI_SLOT(devfn) == 0)
+   return PCIBIOS_DEVICE_NOT_FOUND;
+   else
+   return PCIBIOS_SUCCESSFUL;
+}
+#endif /* CONFIG_PCI */
+
+#ifdef CONFIG_CPM2
+
+static void cpm2_cascade(unsigned int irq, struct irq_desc *desc)
+{
+   int cascade_irq;
+
+   while ((cascade_irq = cpm2_get_irq()) = 0)
+   generic_handle_irq(cascade_irq);
+
+   desc-chip-eoi(irq);
+}
+
+#endif /* CONFIG_CPM2 */
+
+static void __init sbc8560_pic_init(void)
+{
+   struct mpic *mpic;
+   struct resource r;
+   struct device_node *np = NULL;
+#ifdef CONFIG_CPM2
+   int irq;
+#endif
+
+   np = of_find_node_by_type(np, open-pic);
+   if (!np) {
+   printk(KERN_ERR Could not find open-pic node\n);
+   return;
+   }
+
+   if (of_address_to_resource(np, 0, r)) {
+   printk(KERN_ERR Could not map mpic register space\n);
+   of_node_put(np);
+   return;
+   }
+
+   mpic = mpic_alloc(np, r.start,
+   MPIC_PRIMARY | MPIC_WANTS_RESET | MPIC_BIG_ENDIAN,
+   0, 256,  OpenPIC  );
+   BUG_ON(mpic == NULL);
+   of_node_put(np);
+
+   mpic_init(mpic);
+
+#ifdef CONFIG_CPM2
+   /* Setup CPM2 PIC */
+   np = of_find_compatible_node(NULL, NULL, fsl,cpm2-pic);
+   if (np == NULL) {
+   printk(KERN_ERR PIC init: can not find fsl,cpm2-pic node\n);
+   return;
+   }
+   irq = irq_of_parse_and_map(np, 0);
+
+   cpm2_pic_init(np);
+   of_node_put(np);
+   set_irq_chained_handler(irq, cpm2_cascade);
+#endif
+}
+
+/*
+ * Setup the architecture
+ */
+#ifdef CONFIG_CPM2
+struct cpm_pin {
+   int port, pin, flags;

[PATCH 2/7] powerpc: allow localbus compatible serial ports for console device

2008-01-07 Thread Paul Gortmaker
Add to legacy_serial the ability to use any ns16550 compatible
UART with a parent that is compatible with localbus as the
console device.

Signed-off-by: Paul Gortmaker [EMAIL PROTECTED]
---
 arch/powerpc/kernel/legacy_serial.c |   11 +++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/arch/powerpc/kernel/legacy_serial.c 
b/arch/powerpc/kernel/legacy_serial.c
index a17a5d0..d0b8e35 100644
--- a/arch/powerpc/kernel/legacy_serial.c
+++ b/arch/powerpc/kernel/legacy_serial.c
@@ -351,6 +351,17 @@ void __init find_legacy_serial_ports(void)
of_node_put(opb);
}
 
+   /* Next, fill our array with any localbus serial ports */
+   for_each_compatible_node(np, serial, ns16550) {
+   struct device_node *lbs = of_get_parent(np);
+   if (lbs  of_device_is_compatible(lbs, localbus)) {
+   index = add_legacy_soc_port(np, np);
+   if (index = 0  np == stdout)
+   legacy_serial_console = index;
+   }
+   of_node_put(lbs);
+   }
+
 #ifdef CONFIG_PCI
/* Next, try to locate PCI ports */
for (np = NULL; (np = of_find_all_nodes(np));) {
-- 
1.5.0.rc1.gf4b6c

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


[PATCH 4/7] sbc8560: Add device tree source for Wind River SBC8560 board

2008-01-07 Thread Paul Gortmaker
This adds the device tree source for the Wind River SBC8560 board.  The
biggest difference between this and the MPC8560ADS reference platform
dts is the use of an external 16550 compatible UART instead of the CPM2.

Signed-off-by: Paul Gortmaker [EMAIL PROTECTED]
---
 arch/powerpc/boot/dts/sbc8560.dts |  285 +
 1 files changed, 285 insertions(+), 0 deletions(-)

diff --git a/arch/powerpc/boot/dts/sbc8560.dts 
b/arch/powerpc/boot/dts/sbc8560.dts
new file mode 100644
index 000..858e8bf
--- /dev/null
+++ b/arch/powerpc/boot/dts/sbc8560.dts
@@ -0,0 +1,285 @@
+/*
+ * SBC8560 Device Tree Source
+ *
+ * Copyright 2007 Wind River Systems Inc.
+ *
+ * Paul Gortmaker (see MAINTAINERS for contact information)
+ *
+ * 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 = SBC8560;
+   compatible = SBC8560;
+   #address-cells = 1;
+   #size-cells = 1;
+
+   aliases {
+   ethernet0 = enet0;
+   ethernet1 = enet1;
+   ethernet2 = enet2;
+   ethernet3 = enet3;
+   serial0 = serial0;
+   serial1 = serial1;
+   pci0 = pci0;
+   };
+
+   cpus {
+   #address-cells = 1;
+   #size-cells = 0;
+
+   PowerPC,[EMAIL PROTECTED] {
+   device_type = cpu;
+   reg = 0;
+   d-cache-line-size = 20;   // 32 bytes
+   i-cache-line-size = 20;   // 32 bytes
+   d-cache-size = 8000;  // L1, 32K
+   i-cache-size = 8000;  // L1, 32K
+   timebase-frequency = 0;   // From uboot
+   bus-frequency = 0;
+   clock-frequency = 0;
+   };
+   };
+
+   memory {
+   device_type = memory;
+   reg =  2000;
+   };
+
+   [EMAIL PROTECTED] {
+   #address-cells = 1;
+   #size-cells = 1;
+   device_type = soc;
+   ranges = 0 ff70 0010;
+   reg = ff70 0010;
+   clock-frequency = 0;
+
+   [EMAIL PROTECTED] {
+   compatible = fsl,8560-memory-controller;
+   reg = 2000 1000;
+   interrupt-parent = mpic;
+   interrupts = 12 2;
+   };
+
+   [EMAIL PROTECTED] {
+   compatible = fsl,8560-l2-cache-controller;
+   reg = 2 1000;
+   cache-line-size = 20; // 32 bytes
+   cache-size = 4;   // L2, 256K
+   interrupt-parent = mpic;
+   interrupts = 10 2;
+   };
+
+   [EMAIL PROTECTED] {
+   #address-cells = 1;
+   #size-cells = 0;
+   cell-index = 0;
+   compatible = fsl-i2c;
+   reg = 3000 100;
+   interrupts = 2b 2;
+   interrupt-parent = mpic;
+   dfsrr;
+   };
+
+   [EMAIL PROTECTED] {
+   #address-cells = 1;
+   #size-cells = 0;
+   cell-index = 1;
+   compatible = fsl-i2c;
+   reg = 3100 100;
+   interrupts = 2b 2;
+   interrupt-parent = mpic;
+   dfsrr;
+   };
+
+   [EMAIL PROTECTED] {
+   #address-cells = 1;
+   #size-cells = 0;
+   compatible = fsl,gianfar-mdio;
+   reg = 24520 20;
+   phy0: [EMAIL PROTECTED] {
+   interrupt-parent = mpic;
+   interrupts = 6 1;
+   reg = 19;
+   device_type = ethernet-phy;
+   };
+   phy1: [EMAIL PROTECTED] {
+   interrupt-parent = mpic;
+   interrupts = 7 1;
+   reg = 1a;
+   device_type = ethernet-phy;
+   };
+   phy2: [EMAIL PROTECTED] {
+   interrupt-parent = mpic;
+   interrupts = 8 1;
+   reg = 1b;
+   device_type = ethernet-phy;
+   };
+   phy3: [EMAIL PROTECTED] {
+   

[PATCH 6/7] CPM2: Make support for the CPM2 optional on 8560 based boards

2008-01-07 Thread Paul Gortmaker
Currently there is no way to disable the CPM2 support.  Some boards,
like the SBC8560 have their own external UART and don't have any direct
dependencies on the CPM for a serial console or anything else.

Signed-off-by: Paul Gortmaker [EMAIL PROTECTED]
---
 arch/powerpc/platforms/85xx/Kconfig |4 ++--
 arch/powerpc/platforms/Kconfig  |4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/powerpc/platforms/85xx/Kconfig 
b/arch/powerpc/platforms/85xx/Kconfig
index 0eb497b..33d3bea 100644
--- a/arch/powerpc/platforms/85xx/Kconfig
+++ b/arch/powerpc/platforms/85xx/Kconfig
@@ -13,6 +13,7 @@ config MPC8560_ADS
bool Freescale MPC8560 ADS
select DEFAULT_UIMAGE
select PPC_CPM_NEW_BINDING
+   select CPM2
help
  This option enables support for the MPC 8560 ADS board
 
@@ -41,7 +42,7 @@ config MPC85xx_DS
 config SBC8560
bool Wind River SBC8560
select DEFAULT_UIMAGE
-   select PPC_CPM_NEW_BINDING
+   select PPC_CPM_NEW_BINDING if CPM2
help
  This option enables support for the Wind River SBC8560 board
 
@@ -55,7 +56,6 @@ config MPC8540
 
 config MPC8560
bool
-   select CPM2
default y if MPC8560_ADS || SBC8560
 
 config MPC85xx
diff --git a/arch/powerpc/platforms/Kconfig b/arch/powerpc/platforms/Kconfig
index ea22cad..d355dd6 100644
--- a/arch/powerpc/platforms/Kconfig
+++ b/arch/powerpc/platforms/Kconfig
@@ -272,8 +272,8 @@ config QUICC_ENGINE
  for a machine with a QE coprocessor.
 
 config CPM2
-   bool
-   default n
+   bool Enable support for the CPM2 (Communications Processor Module)
+   depends on MPC8560 || 8260
select CPM
select PPC_LIB_RHEAP
help
-- 
1.5.0.rc1.gf4b6c

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


Re: [PATCH 2/7] powerpc: allow localbus compatible serial ports for console device

2008-01-07 Thread Arnd Bergmann
On Monday 07 January 2008, Paul Gortmaker wrote:
 +   /* Next, fill our array with any localbus serial ports */
 +   for_each_compatible_node(np, serial, ns16550) {
 +   struct device_node *lbs = of_get_parent(np);
 +   if (lbs  of_device_is_compatible(lbs, localbus)) {
 +   index = add_legacy_soc_port(np, np);
 +   if (index = 0  np == stdout)
 +   legacy_serial_console = index;
 +   }
 +   of_node_put(lbs);
 +   }
 +

This is getting a little silly. Can't you finally unify the code
so it checks for any 8250/16450/16550 on any soc/isa/tsi-bridge/opb/localbus?

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


[PATCH 7/7] sbc8560: Add default .config file for Wind River SBC8560

2008-01-07 Thread Paul Gortmaker
This is a suitable .config file for building the WRS SBC8560 kernel
to be used for NFS root via one of the TSEC interfaces and with
serial console via the 16550 compatible UART on the board.

Signed-off-by: Paul Gortmaker [EMAIL PROTECTED]
---
 arch/powerpc/configs/sbc8560_defconfig |  765 
 1 files changed, 765 insertions(+), 0 deletions(-)

diff --git a/arch/powerpc/configs/sbc8560_defconfig 
b/arch/powerpc/configs/sbc8560_defconfig
new file mode 100644
index 000..9910ff9
--- /dev/null
+++ b/arch/powerpc/configs/sbc8560_defconfig
@@ -0,0 +1,765 @@
+#
+# Automatically generated make config: don't edit
+# Linux kernel version: 2.6.24-rc6
+# Thu Jan  3 16:47:32 2008
+#
+# CONFIG_PPC64 is not set
+
+#
+# Processor support
+#
+# CONFIG_6xx is not set
+CONFIG_PPC_85xx=y
+# CONFIG_PPC_8xx is not set
+# CONFIG_40x is not set
+# CONFIG_44x is not set
+# CONFIG_E200 is not set
+CONFIG_85xx=y
+CONFIG_E500=y
+CONFIG_BOOKE=y
+CONFIG_FSL_BOOKE=y
+# CONFIG_PHYS_64BIT is not set
+CONFIG_SPE=y
+# CONFIG_PPC_MM_SLICES is not set
+CONFIG_PPC32=y
+CONFIG_WORD_SIZE=32
+CONFIG_PPC_MERGE=y
+CONFIG_MMU=y
+CONFIG_GENERIC_CMOS_UPDATE=y
+CONFIG_GENERIC_TIME=y
+CONFIG_GENERIC_TIME_VSYSCALL=y
+CONFIG_GENERIC_CLOCKEVENTS=y
+CONFIG_GENERIC_HARDIRQS=y
+CONFIG_IRQ_PER_CPU=y
+CONFIG_RWSEM_XCHGADD_ALGORITHM=y
+CONFIG_ARCH_HAS_ILOG2_U32=y
+CONFIG_GENERIC_HWEIGHT=y
+CONFIG_GENERIC_CALIBRATE_DELAY=y
+CONFIG_GENERIC_FIND_NEXT_BIT=y
+# CONFIG_ARCH_NO_VIRT_TO_BUS is not set
+CONFIG_PPC=y
+CONFIG_EARLY_PRINTK=y
+CONFIG_GENERIC_NVRAM=y
+CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y
+CONFIG_ARCH_MAY_HAVE_PC_FDC=y
+CONFIG_PPC_OF=y
+CONFIG_OF=y
+CONFIG_PPC_UDBG_16550=y
+# CONFIG_GENERIC_TBSYNC is not set
+CONFIG_AUDIT_ARCH=y
+CONFIG_GENERIC_BUG=y
+CONFIG_DEFAULT_UIMAGE=y
+# CONFIG_PPC_DCR_NATIVE is not set
+# CONFIG_PPC_DCR_MMIO is not set
+CONFIG_DEFCONFIG_LIST=/lib/modules/$UNAME_RELEASE/.config
+
+#
+# General setup
+#
+CONFIG_EXPERIMENTAL=y
+CONFIG_BROKEN_ON_SMP=y
+CONFIG_INIT_ENV_ARG_LIMIT=32
+CONFIG_LOCALVERSION=
+CONFIG_LOCALVERSION_AUTO=y
+CONFIG_SWAP=y
+CONFIG_SYSVIPC=y
+CONFIG_SYSVIPC_SYSCTL=y
+# CONFIG_POSIX_MQUEUE is not set
+# CONFIG_BSD_PROCESS_ACCT is not set
+# CONFIG_TASKSTATS is not set
+# CONFIG_USER_NS is not set
+# CONFIG_PID_NS is not set
+# CONFIG_AUDIT is not set
+# CONFIG_IKCONFIG is not set
+CONFIG_LOG_BUF_SHIFT=14
+# CONFIG_CGROUPS is not set
+CONFIG_FAIR_GROUP_SCHED=y
+CONFIG_FAIR_USER_SCHED=y
+# CONFIG_FAIR_CGROUP_SCHED is not set
+CONFIG_SYSFS_DEPRECATED=y
+# CONFIG_RELAY is not set
+CONFIG_BLK_DEV_INITRD=y
+CONFIG_INITRAMFS_SOURCE=
+# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
+CONFIG_SYSCTL=y
+CONFIG_EMBEDDED=y
+CONFIG_SYSCTL_SYSCALL=y
+CONFIG_KALLSYMS=y
+# CONFIG_KALLSYMS_ALL is not set
+# CONFIG_KALLSYMS_EXTRA_PASS is not set
+CONFIG_HOTPLUG=y
+CONFIG_PRINTK=y
+CONFIG_BUG=y
+CONFIG_ELF_CORE=y
+CONFIG_BASE_FULL=y
+CONFIG_FUTEX=y
+CONFIG_ANON_INODES=y
+CONFIG_EPOLL=y
+CONFIG_SIGNALFD=y
+CONFIG_EVENTFD=y
+CONFIG_SHMEM=y
+CONFIG_VM_EVENT_COUNTERS=y
+CONFIG_SLAB=y
+# CONFIG_SLUB is not set
+# CONFIG_SLOB is not set
+CONFIG_RT_MUTEXES=y
+# CONFIG_TINY_SHMEM is not set
+CONFIG_BASE_SMALL=0
+# CONFIG_MODULES is not set
+CONFIG_BLOCK=y
+# CONFIG_LBD is not set
+# CONFIG_BLK_DEV_IO_TRACE is not set
+# CONFIG_LSF is not set
+# CONFIG_BLK_DEV_BSG is not set
+
+#
+# IO Schedulers
+#
+CONFIG_IOSCHED_NOOP=y
+CONFIG_IOSCHED_AS=y
+CONFIG_IOSCHED_DEADLINE=y
+CONFIG_IOSCHED_CFQ=y
+CONFIG_DEFAULT_AS=y
+# CONFIG_DEFAULT_DEADLINE is not set
+# CONFIG_DEFAULT_CFQ is not set
+# CONFIG_DEFAULT_NOOP is not set
+CONFIG_DEFAULT_IOSCHED=anticipatory
+
+#
+# Platform support
+#
+# CONFIG_PPC_MPC52xx is not set
+# CONFIG_PPC_MPC5200 is not set
+# CONFIG_PPC_CELL is not set
+# CONFIG_PPC_CELL_NATIVE is not set
+# CONFIG_PQ2ADS is not set
+# CONFIG_MPC8540_ADS is not set
+# CONFIG_MPC8560_ADS is not set
+# CONFIG_MPC85xx_CDS is not set
+# CONFIG_MPC85xx_MDS is not set
+# CONFIG_MPC85xx_DS is not set
+CONFIG_SBC8560=y
+CONFIG_MPC8560=y
+CONFIG_MPC85xx=y
+CONFIG_MPIC=y
+# CONFIG_MPIC_WEIRD is not set
+# CONFIG_PPC_I8259 is not set
+# CONFIG_PPC_RTAS is not set
+# CONFIG_MMIO_NVRAM is not set
+# CONFIG_PPC_MPC106 is not set
+# CONFIG_PPC_970_NAP is not set
+# CONFIG_PPC_INDIRECT_IO is not set
+# CONFIG_GENERIC_IOMAP is not set
+# CONFIG_CPU_FREQ is not set
+# CONFIG_CPM2 is not set
+# CONFIG_FSL_ULI1575 is not set
+
+#
+# Kernel options
+#
+# CONFIG_HIGHMEM is not set
+# CONFIG_TICK_ONESHOT is not set
+# CONFIG_NO_HZ is not set
+# CONFIG_HIGH_RES_TIMERS is not set
+CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
+# CONFIG_HZ_100 is not set
+CONFIG_HZ_250=y
+# CONFIG_HZ_300 is not set
+# CONFIG_HZ_1000 is not set
+CONFIG_HZ=250
+CONFIG_PREEMPT_NONE=y
+# CONFIG_PREEMPT_VOLUNTARY is not set
+# CONFIG_PREEMPT is not set
+CONFIG_BINFMT_ELF=y
+CONFIG_BINFMT_MISC=y
+# CONFIG_MATH_EMULATION is not set
+CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
+CONFIG_ARCH_FLATMEM_ENABLE=y
+CONFIG_ARCH_POPULATES_NODE_MAP=y
+CONFIG_SELECT_MEMORY_MODEL=y

Re: [PATCH 2/3] Handle absolute pathnames correctly in dtc_open_file.

2008-01-07 Thread Jon Loeliger
So, like, the other day Scott Wood mumbled:
 Also, free file-dir when freeing file.
 
 Signed-off-by: Scott Wood [EMAIL PROTECTED]

Applied.

Thanks.

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


Re: [PATCH 3/3] Remove \n from yyerror() call.

2008-01-07 Thread Jon Loeliger
So, like, the other day Scott Wood mumbled:
 The \n is provided by yyerror().
 
 Signed-off-by: Scott Wood [EMAIL PROTECTED]

Applied.

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


Re: [PATCH 1/3] Add support for binary includes.

2008-01-07 Thread Jon Loeliger
So, like, the other day David Gibson mumbled:
 
 
 Hrm.  Can we leave this one until after 1.1?   Since it adds new
 syntax, I think it would be worth cogitating a bit longer.

Double hrm.

Scott, can you remind us why this feature was requested
off the U-Boot list, please?  I'm trying to decide if we
really do want to get it into the 1.1 release.

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


Re: [PATCH 2/3] Handle absolute pathnames correctly in dtc_open_file.

2008-01-07 Thread Jon Loeliger
So, like, the other day Scott Wood mumbled:
 On Sun, Jan 06, 2008 at 02:37:16PM +1100, David Gibson wrote:
out:
   + free((void *)file-dir);
  
  That cast shouldn't be there.
 
 It generates a constness warning otherwise.  I was on the fence over
 whether to just remove the constness (even though the data is never
 modified during its lifetime); would that be preferable?

The earlier patch was applied for functionality reasons.
If needed, a follow-up patch to sort this out is still welcome.

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


Re: [PATCH 2/7] powerpc: allow localbus compatible serial ports for console device

2008-01-07 Thread Paul Gortmaker
Arnd Bergmann wrote:
 On Monday 07 January 2008, Paul Gortmaker wrote:
   
 +   /* Next, fill our array with any localbus serial ports */
 +   for_each_compatible_node(np, serial, ns16550) {
 +   struct device_node *lbs = of_get_parent(np);
 +   if (lbs  of_device_is_compatible(lbs, localbus)) {
 +   index = add_legacy_soc_port(np, np);
 +   if (index = 0  np == stdout)
 +   legacy_serial_console = index;
 +   }
 +   of_node_put(lbs);
 +   }
 +
 

 This is getting a little silly. Can't you finally unify the code
 so it checks for any 8250/16450/16550 on any soc/isa/tsi-bridge/opb/localbus?
   

I'd thought about doing that, but there are slight differences
in each test.  To remain 100% faithful to the original implementation
you'd have to have a table or similar that had these various fields
and loop over that -- something like:

compat  parent   pnt-compat  pnt-type   add-fcn
---
ns16550 NULL NULLsocadd_legacy_soc_port
NULLisa  NULLNULL   add_legacy_isa_port
ns16550 NULL NULLtsi-bridge add_legacy_soc_port
ns16550 NULL ibm,opb opbadd_legacy_soc_port
ns16550 NULL localbusNULL   add_legacy_soc_port

But, if we were willing to move away from checks based on
the parent-type and stick with parent-compat, then the
unification would be a lot cleaner and easier to implement.
(we could also leave the ISA one out as an oddball, and then
not have to carry an add-fcn either).

Paul.




   Arnd 
   

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


Re: [alsa-devel] [PATCH] ASoC drivers for the Freescale MPC8610 SoC

2008-01-07 Thread Timur Tabi
David Gibson wrote:

 Ok, but couldn't you strucutre your I2S or fabric driver so that it
 only becomes fully operational once the codec driver has registered
 with it?

Not in ASoC V1.  You have to understand, ASoC V1 was designed without any 
consideration for runtime-bindings and other OF goodies.  All connections 
between the drivers are static, literally.  In fact, I wouldn't be surprised if 
some ASoC drivers cannot be compiled as modules.

So all I'm trying to do now is get my driver, with warts and all, into the tree 
so that I can focus with Liam et al to get a real ASoC V2 up and running.

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


Re: [PATCH 2/7] powerpc: allow localbus compatible serial ports for console device

2008-01-07 Thread Arnd Bergmann
On Monday 07 January 2008, Paul Gortmaker wrote:
 
 I'd thought about doing that, but there are slight differences
 in each test.  To remain 100% faithful to the original implementation
 you'd have to have a table or similar that had these various fields
 and loop over that -- something like:
 
 compat      parent   pnt-compat  pnt-type   add-fcn
 ---
 ns16550     NULL     NULL        soc        add_legacy_soc_port
 NULL        isa      NULL        NULL       add_legacy_isa_port
 ns16550     NULL     NULL        tsi-bridge add_legacy_soc_port
 ns16550     NULL     ibm,opb     opb        add_legacy_soc_port
 ns16550     NULL     localbus    NULL       add_legacy_soc_port
 
 But, if we were willing to move away from checks based on
 the parent-type and stick with parent-compat, then the
 unification would be a lot cleaner and easier to implement.

Unfortunately, some of our cell blades don't have the right
'compatible' property, so you still need to check the type for
the opb case.

 (we could also leave the ISA one out as an oddball, and then
 not have to carry an add-fcn either).

yes, that seems reasonable.

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


Re: [PATCH 1/3] Add support for binary includes.

2008-01-07 Thread Scott Wood
On Mon, Jan 07, 2008 at 09:24:32AM -0600, Jon Loeliger wrote:
 So, like, the other day David Gibson mumbled:
  
  
  Hrm.  Can we leave this one until after 1.1?   Since it adds new
  syntax, I think it would be worth cogitating a bit longer.
 
 Double hrm.
 
 Scott, can you remind us why this feature was requested
 off the U-Boot list, please?  I'm trying to decide if we
 really do want to get it into the 1.1 release.

U-boot wants it because they're planning on using device trees as their
new multi-image format.

I implemented it for a similar, but different reason -- passing guest
device trees to a hypervisor within a hypervisor config tree.

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


[RFC PATCH 0/3]: Add StorCenter port to arch/powerpc

2008-01-07 Thread Jon Loeliger
Guys,

I have the bulk of a port for the iomega StorCenter that
Andy and I have been working on.  We'd like your feedback!

Specifically, it's not quite working yet, and for lack of
actually getting serial output, we're having some difficulty
still.  I post it here in a desperate attempt to let some
eagle-eyed person point out my obvious D'oh problem.

Thanks,
jdl


 arch/powerpc/boot/Makefile  |3 +-
 arch/powerpc/boot/cuboot-824x.c |   52 +
 arch/powerpc/boot/dts/storcenter.dts|  159 +++
 arch/powerpc/configs/storcenter_defconfig   | 1538 +++
 arch/powerpc/platforms/embedded6xx/Kconfig  |   15 +-
 arch/powerpc/platforms/embedded6xx/Makefile |2 +
 arch/powerpc/platforms/embedded6xx/storcenter.c |  158 +++
 7 files changed, 1924 insertions(+), 3 deletions(-)
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[RFC PATCH 1/3] Add StorCenter DTS first draft.

2008-01-07 Thread Jon Loeliger
Based on the Kurobox DTS files.

Signed-off-by: Andy Wilcox [EMAIL PROTECTED]
Signed-off-by: Jon Loeliger [EMAIL PROTECTED]
---

Ignore the flash bits.  They are from the previous
World View and need to be updated still.

 arch/powerpc/boot/dts/storcenter.dts |  159 ++
 1 files changed, 159 insertions(+), 0 deletions(-)
 create mode 100644 arch/powerpc/boot/dts/storcenter.dts

diff --git a/arch/powerpc/boot/dts/storcenter.dts 
b/arch/powerpc/boot/dts/storcenter.dts
new file mode 100644
index 000..68887ac
--- /dev/null
+++ b/arch/powerpc/boot/dts/storcenter.dts
@@ -0,0 +1,159 @@
+/*
+ * Device Tree Source for IOMEGA StorCenter
+ *
+ * Copyright 2007 Oyvind Repvik
+ * Copyright 2007 Jon Loeliger
+ *
+ * Based on the Kurobox DTS by G. Liakhovetski [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.
+ */
+
+/ {
+   model = StorCenter;
+   compatible = storcenter;
+   #address-cells = 1;
+   #size-cells = 1;
+
+aliases {
+serial0 = serial0;
+serial1 = serial1;
+pci0 = pci0;
+};
+
+   cpus {
+   #address-cells = 1;
+   #size-cells = 0;
+
+   PowerPC,[EMAIL PROTECTED] {
+   device_type = cpu;
+   reg = 0;
+   clock-frequency = d# 2;   /* Hz */
+   timebase-frequency = d# 2500; /* Hz */
+   bus-frequency = 0;/* from bootwrapper */
+   i-cache-line-size = d# 32;/* bytes */
+   d-cache-line-size = d# 32;/* bytes */
+   i-cache-size = 4000;
+   d-cache-size = 4000;
+   };
+   };
+
+   memory {
+   device_type = memory;
+   reg =  0400;  /* 64MB @ 0x0 */
+   };
+
+   [EMAIL PROTECTED] {
+   device_type = rom;
+   compatible = direct-mapped;
+   probe-type = CFI;
+   reg = ff80 0080;
+   bank-width = 1;
+   partitions = 
+    E000
+   E000 2000
+   0001 0004
+   0005 0020
+   0025 004B
+   0070 0002
+   0072 0001
+   0073 0001
+   0074 000B
+   ;
+   partition-names = uboot2env, dtb, uboot2,
+ emkernel, emfs, uboot1,
+ empty, uboot1-env, SysConf;
+   };
+
+
+   [EMAIL PROTECTED] {
+   #address-cells = 1;
+   #size-cells = 1;
+   device_type = soc;
+   compatible = fsl,mpc8241, mpc10x;
+   store-gathering = 0; /* 0 == off, !0 == on */
+
+   reg = 8000 0010;  /* Temporary, right? */
+
+   ranges = 8000 8000 7000/* pci mem space */
+ fdf0 fdf0 0010/* EUMB */
+ fe00 fe00 00c0/* pci i/o space */
+ fec0 fec0 0030/* pci cfg regs */
+ fef0 fef0 0010;  /* pci iack */
+
+   [EMAIL PROTECTED] {
+   #address-cells = 1;
+   #size-cells = 0;
+   compatible = fsl-i2c;
+   reg = fdf03000 1000;
+   interrupts = 5 2;
+   interrupt-parent = mpic;
+
+   [EMAIL PROTECTED] {
+   compatible = dallas,ds1337;
+   reg = 68;
+   };
+   };
+
+   serial0: [EMAIL PROTECTED] {
+   cell-index = 0;
+   device_type = serial;
+   compatible = ns16550;
+   reg = fdf04500 8;
+   clock-frequency = d# 97553800; /* Hz */
+   current-speed = d# 115200;
+   interrupts = 9 2;
+   interrupt-parent = mpic;
+   };
+
+   serial1: [EMAIL PROTECTED] {
+   cell-index = 1;
+   device_type = serial;
+   compatible = ns16550;
+   reg = fdf04600 8;
+   clock-frequency = d# 97553800; /* Hz */
+   current-speed = d# 9600;
+   interrupts = a 2;
+

[RFC PATCH 2/3] Add initial iomega StorCenter board port.

2008-01-07 Thread Jon Loeliger

Use cuImage bootwrapper until U-Boot port is completed.
Derived heavily from Linkstation port.

Signed-off-by: Andy Wilcox [EMAIL PROTECTED]
Signed-off-by: Jon Loeliger [EMAIL PROTECTED]
---

Nope, I have NOT verified that the bd_t file that
is used here byte-identical to U-Boot's layout yet.
[ There is _always_ something more to do... ]

 arch/powerpc/boot/Makefile  |3 +-
 arch/powerpc/boot/cuboot-824x.c |   52 
 arch/powerpc/platforms/embedded6xx/Kconfig  |   15 ++-
 arch/powerpc/platforms/embedded6xx/Makefile |2 +
 arch/powerpc/platforms/embedded6xx/storcenter.c |  158 +++
 5 files changed, 227 insertions(+), 3 deletions(-)
 create mode 100644 arch/powerpc/boot/cuboot-824x.c
 create mode 100644 arch/powerpc/platforms/embedded6xx/storcenter.c

diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile
index d1e625c..a59b176 100644
--- a/arch/powerpc/boot/Makefile
+++ b/arch/powerpc/boot/Makefile
@@ -57,7 +57,7 @@ src-wlib := string.S crt0.S stdio.c main.c \
4xx.c ebony.c mv64x60.c mpsc.c mv64x60_i2c.c cuboot.c bamboo.c \
cpm-serial.c stdlib.c mpc52xx-psc.c planetcore.c uartlite.c \
fsl-soc.c mpc8xx.c pq2.c
-src-plat := of.c cuboot-52xx.c cuboot-83xx.c cuboot-85xx.c holly.c \
+src-plat := of.c cuboot-52xx.c cuboot-824x.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 \
cuboot-pq2.c cuboot-sequoia.c treeboot-walnut.c cuboot-bamboo.c 
\
@@ -196,6 +196,7 @@ image-$(CONFIG_PPC_EP88XC)  += zImage.ep88xc
 image-$(CONFIG_EP405)  += zImage.ep405
 image-$(CONFIG_8260)   += cuImage.pq2
 image-$(CONFIG_PPC_MPC52xx)+= cuImage.52xx
+image-$(CONFIG_STORCENTER) += cuImage.824x
 image-$(CONFIG_PPC_83xx)   += cuImage.83xx
 image-$(CONFIG_PPC_85xx)   += cuImage.85xx
 image-$(CONFIG_MPC7448HPC2)+= cuImage.hpc2
diff --git a/arch/powerpc/boot/cuboot-824x.c b/arch/powerpc/boot/cuboot-824x.c
new file mode 100644
index 000..4aa3eee
--- /dev/null
+++ b/arch/powerpc/boot/cuboot-824x.c
@@ -0,0 +1,52 @@
+/*
+ * Old U-boot compatibility for 824x
+ *
+ * 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 ops.h
+#include stdio.h
+#include cuboot.h
+
+#define TARGET_824x
+#include ppcboot.h
+
+static bd_t bd;
+
+static void platform_fixups(void)
+{
+   void *soc;
+
+   dt_fixup_memory(bd.bi_memstart, bd.bi_memsize);
+   dt_fixup_mac_addresses(bd.bi_enetaddr);
+   dt_fixup_cpu_clocks(bd.bi_intfreq, bd.bi_busfreq / 4, bd.bi_busfreq);
+
+   soc = find_node_by_devtype(NULL, soc);
+   if (soc) {
+   void *serial = NULL;
+
+   setprop(soc, bus-frequency, bd.bi_busfreq,
+   sizeof(bd.bi_busfreq));
+
+   while ((serial = find_node_by_devtype(serial, serial))) {
+   if (get_parent(serial) != soc)
+   continue;
+
+   setprop(serial, clock-frequency, bd.bi_busfreq,
+   sizeof(bd.bi_busfreq));
+   }
+   }
+}
+
+void platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
+   unsigned long r6, unsigned long r7)
+{
+   CUBOOT_INIT();
+   fdt_init(_dtb_start);
+   serial_console_init();
+   platform_ops.fixups = platform_fixups;
+}
diff --git a/arch/powerpc/platforms/embedded6xx/Kconfig 
b/arch/powerpc/platforms/embedded6xx/Kconfig
index 8924095..be5cdd2 100644
--- a/arch/powerpc/platforms/embedded6xx/Kconfig
+++ b/arch/powerpc/platforms/embedded6xx/Kconfig
@@ -16,6 +16,17 @@ config LINKSTATION
  Linkstation-I HD-HLAN and HD-HGLAN versions, and PPC-based
  Terastation systems should be supported too.
 
+config STORCENTER
+   bool IOMEGA StorCenter
+   depends on EMBEDDED6xx
+   select MPIC
+   select FSL_SOC
+   select PPC_UDBG_16550 if SERIAL_8250
+   select WANT_DEVICE_TREE
+   help
+ Select STORCENTER if configuring for the iomega StorCenter
+ with an 8241 CPU in it.
+
 config MPC7448HPC2
bool Freescale MPC7448HPC2(Taiga)
depends on EMBEDDED6xx
@@ -56,7 +67,7 @@ config TSI108_BRIDGE
 
 config MPC10X_BRIDGE
bool
-   depends on LINKSTATION
+   depends on LINKSTATION || STORCENTER
select PPC_INDIRECT_PCI
default y
 
@@ -67,7 +78,7 @@ config MV64X60
 
 config MPC10X_OPENPIC
bool
-   depends on LINKSTATION
+   depends on LINKSTATION || STORCENTER
default y
 
 config MPC10X_STORE_GATHERING
diff --git 

[RFC PATCH 3/3] Add initial storcenter config file.

2008-01-07 Thread Jon Loeliger
Signed-off-by: Andy Wilcox [EMAIL PROTECTED]
Signed-off-by: Jon Loeliger [EMAIL PROTECTED]
---

This is known to have just a ton of crap in the
config still.  Not to worry.  It'll be trimmed
down some later...


 arch/powerpc/configs/storcenter_defconfig | 1538 +
 1 files changed, 1538 insertions(+), 0 deletions(-)
 create mode 100644 arch/powerpc/configs/storcenter_defconfig

diff --git a/arch/powerpc/configs/storcenter_defconfig 
b/arch/powerpc/configs/storcenter_defconfig
new file mode 100644
index 000..7f3224a
--- /dev/null
+++ b/arch/powerpc/configs/storcenter_defconfig
@@ -0,0 +1,1538 @@
+#
+# Automatically generated make config: don't edit
+# Linux kernel version: 2.6.24-rc6
+# Sun Jan  6 12:38:41 2008
+#
+# CONFIG_PPC64 is not set
+
+#
+# Processor support
+#
+CONFIG_6xx=y
+# CONFIG_PPC_85xx is not set
+# CONFIG_PPC_8xx is not set
+# CONFIG_40x is not set
+# CONFIG_44x is not set
+# CONFIG_E200 is not set
+CONFIG_PPC_FPU=y
+# CONFIG_ALTIVEC is not set
+CONFIG_PPC_STD_MMU=y
+CONFIG_PPC_STD_MMU_32=y
+# CONFIG_PPC_MM_SLICES is not set
+# CONFIG_SMP is not set
+CONFIG_PPC32=y
+CONFIG_WORD_SIZE=32
+CONFIG_PPC_MERGE=y
+CONFIG_MMU=y
+CONFIG_GENERIC_CMOS_UPDATE=y
+CONFIG_GENERIC_TIME=y
+CONFIG_GENERIC_TIME_VSYSCALL=y
+CONFIG_GENERIC_CLOCKEVENTS=y
+CONFIG_GENERIC_HARDIRQS=y
+CONFIG_IRQ_PER_CPU=y
+CONFIG_RWSEM_XCHGADD_ALGORITHM=y
+CONFIG_ARCH_HAS_ILOG2_U32=y
+CONFIG_GENERIC_HWEIGHT=y
+CONFIG_GENERIC_CALIBRATE_DELAY=y
+CONFIG_GENERIC_FIND_NEXT_BIT=y
+# CONFIG_ARCH_NO_VIRT_TO_BUS is not set
+CONFIG_PPC=y
+CONFIG_EARLY_PRINTK=y
+CONFIG_GENERIC_NVRAM=y
+CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y
+CONFIG_ARCH_MAY_HAVE_PC_FDC=y
+CONFIG_PPC_OF=y
+CONFIG_OF=y
+CONFIG_PPC_UDBG_16550=y
+# CONFIG_GENERIC_TBSYNC is not set
+CONFIG_AUDIT_ARCH=y
+CONFIG_GENERIC_BUG=y
+# CONFIG_DEFAULT_UIMAGE is not set
+# CONFIG_PPC_DCR_NATIVE is not set
+# CONFIG_PPC_DCR_MMIO is not set
+CONFIG_DEFCONFIG_LIST=/lib/modules/$UNAME_RELEASE/.config
+
+#
+# General setup
+#
+CONFIG_EXPERIMENTAL=y
+CONFIG_BROKEN_ON_SMP=y
+CONFIG_INIT_ENV_ARG_LIMIT=32
+CONFIG_LOCALVERSION=
+CONFIG_LOCALVERSION_AUTO=y
+CONFIG_SWAP=y
+CONFIG_SYSVIPC=y
+CONFIG_SYSVIPC_SYSCTL=y
+CONFIG_POSIX_MQUEUE=y
+# CONFIG_BSD_PROCESS_ACCT is not set
+# CONFIG_TASKSTATS is not set
+# CONFIG_USER_NS is not set
+# CONFIG_PID_NS is not set
+# CONFIG_AUDIT is not set
+CONFIG_IKCONFIG=y
+CONFIG_IKCONFIG_PROC=y
+CONFIG_LOG_BUF_SHIFT=14
+# CONFIG_CGROUPS is not set
+# CONFIG_FAIR_GROUP_SCHED is not set
+CONFIG_SYSFS_DEPRECATED=y
+# CONFIG_RELAY is not set
+CONFIG_BLK_DEV_INITRD=y
+CONFIG_INITRAMFS_SOURCE=
+# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
+CONFIG_SYSCTL=y
+# CONFIG_EMBEDDED is not set
+CONFIG_SYSCTL_SYSCALL=y
+CONFIG_KALLSYMS=y
+# CONFIG_KALLSYMS_ALL is not set
+# CONFIG_KALLSYMS_EXTRA_PASS is not set
+CONFIG_HOTPLUG=y
+CONFIG_PRINTK=y
+CONFIG_BUG=y
+CONFIG_ELF_CORE=y
+CONFIG_BASE_FULL=y
+CONFIG_FUTEX=y
+CONFIG_ANON_INODES=y
+CONFIG_EPOLL=y
+CONFIG_SIGNALFD=y
+CONFIG_EVENTFD=y
+CONFIG_SHMEM=y
+CONFIG_VM_EVENT_COUNTERS=y
+CONFIG_SLUB_DEBUG=y
+# CONFIG_SLAB is not set
+CONFIG_SLUB=y
+# CONFIG_SLOB is not set
+CONFIG_RT_MUTEXES=y
+# CONFIG_TINY_SHMEM is not set
+CONFIG_BASE_SMALL=0
+CONFIG_MODULES=y
+CONFIG_MODULE_UNLOAD=y
+# CONFIG_MODULE_FORCE_UNLOAD is not set
+# CONFIG_MODVERSIONS is not set
+# CONFIG_MODULE_SRCVERSION_ALL is not set
+CONFIG_KMOD=y
+CONFIG_BLOCK=y
+# CONFIG_LBD is not set
+# CONFIG_BLK_DEV_IO_TRACE is not set
+# CONFIG_LSF is not set
+# CONFIG_BLK_DEV_BSG is not set
+
+#
+# IO Schedulers
+#
+CONFIG_IOSCHED_NOOP=y
+CONFIG_IOSCHED_AS=y
+CONFIG_IOSCHED_DEADLINE=y
+CONFIG_IOSCHED_CFQ=y
+CONFIG_DEFAULT_AS=y
+# CONFIG_DEFAULT_DEADLINE is not set
+# CONFIG_DEFAULT_CFQ is not set
+# CONFIG_DEFAULT_NOOP is not set
+CONFIG_DEFAULT_IOSCHED=anticipatory
+
+#
+# Platform support
+#
+CONFIG_PPC_MULTIPLATFORM=y
+# CONFIG_PPC_82xx is not set
+# CONFIG_PPC_83xx is not set
+# CONFIG_PPC_86xx is not set
+CONFIG_CLASSIC32=y
+# CONFIG_PPC_CHRP is not set
+# CONFIG_PPC_MPC52xx is not set
+# CONFIG_PPC_MPC5200 is not set
+# CONFIG_PPC_EFIKA is not set
+# CONFIG_PPC_LITE5200 is not set
+# CONFIG_PPC_PMAC is not set
+# CONFIG_PPC_CELL is not set
+# CONFIG_PPC_CELL_NATIVE is not set
+# CONFIG_PQ2ADS is not set
+CONFIG_EMBEDDED6xx=y
+# CONFIG_LINKSTATION is not set
+CONFIG_STORCENTER=y
+# CONFIG_MPC7448HPC2 is not set
+# CONFIG_PPC_HOLLY is not set
+# CONFIG_PPC_PRPMC2800 is not set
+CONFIG_MPC10X_BRIDGE=y
+CONFIG_MPC10X_OPENPIC=y
+# CONFIG_MPC10X_STORE_GATHERING is not set
+CONFIG_MPIC=y
+# CONFIG_MPIC_WEIRD is not set
+# CONFIG_PPC_I8259 is not set
+# CONFIG_PPC_RTAS is not set
+# CONFIG_MMIO_NVRAM is not set
+# CONFIG_PPC_MPC106 is not set
+# CONFIG_PPC_970_NAP is not set
+# CONFIG_PPC_INDIRECT_IO is not set
+# CONFIG_GENERIC_IOMAP is not set
+# CONFIG_CPU_FREQ is not set
+# CONFIG_TAU is not set
+# CONFIG_CPM2 is not set
+# CONFIG_FSL_ULI1575 is not set
+
+#
+# Kernel options
+#
+# CONFIG_HIGHMEM is not set
+CONFIG_TICK_ONESHOT=y
+CONFIG_NO_HZ=y

[PATCH] Use linux/of_{platform, device}.h and not asm/... variants.

2008-01-07 Thread Jon Loeliger
From: Jon Loeliger [EMAIL PROTECTED]

Signed-off-by: Jon Loeliger [EMAIL PROTECTED]
---

Paul,

Continue to fight the Good Fight by removing
old include file references that managed to
creep in recently.

These are the last few in arch/powerpc directly.
If you could pick this up for .25, that be good!

jdl



 arch/powerpc/kernel/of_device.c  |2 +-
 arch/powerpc/platforms/44x/rainier.c |3 ++-
 arch/powerpc/platforms/maple/setup.c |2 +-
 3 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/arch/powerpc/kernel/of_device.c b/arch/powerpc/kernel/of_device.c
index 3388ad6..5748ddb 100644
--- a/arch/powerpc/kernel/of_device.c
+++ b/arch/powerpc/kernel/of_device.c
@@ -5,10 +5,10 @@
 #include linux/module.h
 #include linux/mod_devicetable.h
 #include linux/slab.h
+#include linux/of_device.h
 
 #include asm/errno.h
 #include asm/dcr.h
-#include asm/of_device.h
 
 static void of_device_make_bus_id(struct of_device *dev)
 {
diff --git a/arch/powerpc/platforms/44x/rainier.c 
b/arch/powerpc/platforms/44x/rainier.c
index a4ce5ba..a7fae1c 100644
--- a/arch/powerpc/platforms/44x/rainier.c
+++ b/arch/powerpc/platforms/44x/rainier.c
@@ -14,12 +14,13 @@
  * option) any later version.
  */
 #include linux/init.h
+#include linux/of_platform.h
+
 #include asm/machdep.h
 #include asm/prom.h
 #include asm/udbg.h
 #include asm/time.h
 #include asm/uic.h
-#include asm/of_platform.h
 #include asm/pci-bridge.h
 #include 44x.h
 
diff --git a/arch/powerpc/platforms/maple/setup.c 
b/arch/powerpc/platforms/maple/setup.c
index 144177d..3ce2d73 100644
--- a/arch/powerpc/platforms/maple/setup.c
+++ b/arch/powerpc/platforms/maple/setup.c
@@ -42,6 +42,7 @@
 #include linux/serial.h
 #include linux/smp.h
 #include linux/bitops.h
+#include linux/of_device.h
 
 #include asm/processor.h
 #include asm/sections.h
@@ -56,7 +57,6 @@
 #include asm/dma.h
 #include asm/cputable.h
 #include asm/time.h
-#include asm/of_device.h
 #include asm/lmb.h
 #include asm/mpic.h
 #include asm/rtas.h
-- 
1.5.4.rc0

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


Re: [alsa-devel] [PATCH] ASoC drivers for the Freescale MPC8610 SoC

2008-01-07 Thread Mark Brown
On Mon, Jan 07, 2008 at 09:52:03AM -0600, Timur Tabi wrote:
 David Gibson wrote:

  Ok, but couldn't you strucutre your I2S or fabric driver so that it
  only becomes fully operational once the codec driver has registered
  with it?

 Not in ASoC V1.  You have to understand, ASoC V1 was designed without any 
 consideration for runtime-bindings and other OF goodies.  All connections 
 between the drivers are static, literally.  In fact, I wouldn't be surprised 
 if 
 some ASoC drivers cannot be compiled as modules.

I'd just like to emphasise this point - ASoC v1 really doesn't
understand the idea that the components of the sound subsystem might be
probed separately.  It's set up to handle bare hardware with everything
being probed from code in the machine/fabric driver.  This makes life
very messy for platforms with something like the device tree.

As has been said, handling this properly is one of the major motivations
behind ASoC v2.

 So all I'm trying to do now is get my driver, with warts and all, into the 
 tree 
 so that I can focus with Liam et al to get a real ASoC V2 up and running.

This is certainly the approach we want to take from an ASoC point of
view.
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH] [POWERPC] mpc5200: eliminate mpc52xx_*_map_*() functions.

2008-01-07 Thread Grant Likely
From: Grant Likely [EMAIL PROTECTED]

mpc5200 platform code defines a bunch of map functions which duplicate the
functionality of of_iomap().  Remove them and use of_iomap() instead.

Signed-off-by: Grant Likely [EMAIL PROTECTED]
---

If there are no objections to this one, I'll be putting it in my 5200 tree
and asking Paulus to pull it in the next day or so

Cheers,
g.

 arch/powerpc/platforms/52xx/lite5200.c   |   10 -
 arch/powerpc/platforms/52xx/lite5200_pm.c|6 +++
 arch/powerpc/platforms/52xx/mpc52xx_common.c |   51 +-
 arch/powerpc/platforms/52xx/mpc52xx_pic.c|8 +++-
 arch/powerpc/platforms/52xx/mpc52xx_pm.c |8 +++-
 drivers/spi/mpc52xx_psc_spi.c|9 -
 include/asm-powerpc/mpc52xx.h|2 -
 7 files changed, 40 insertions(+), 54 deletions(-)

diff --git a/arch/powerpc/platforms/52xx/lite5200.c 
b/arch/powerpc/platforms/52xx/lite5200.c
index ce903be..5a8d190 100644
--- a/arch/powerpc/platforms/52xx/lite5200.c
+++ b/arch/powerpc/platforms/52xx/lite5200.c
@@ -42,10 +42,13 @@
 static void __init
 lite5200_fix_clock_config(void)
 {
+   struct device_node *np;
struct mpc52xx_cdm  __iomem *cdm;
 
/* Map zones */
-   cdm = mpc52xx_find_and_map(mpc5200-cdm);
+   np = of_find_compatible_node(NULL, NULL, mpc5200-cdm);
+   cdm = of_iomap(np, 0);
+   of_node_put(np);
if (!cdm) {
printk(KERN_ERR %s() failed; expect abnormal behaviour\n,
   __FUNCTION__);
@@ -74,10 +77,13 @@ lite5200_fix_clock_config(void)
 static void __init
 lite5200_fix_port_config(void)
 {
+   struct device_node *np;
struct mpc52xx_gpio __iomem *gpio;
u32 port_config;
 
-   gpio = mpc52xx_find_and_map(mpc5200-gpio);
+   np = of_find_compatible_node(NULL, NULL, mpc5200-gpio);
+   gpio = of_iomap(np, 0);
+   of_node_put(np);
if (!gpio) {
printk(KERN_ERR %s() failed. expect abnormal behavior\n,
   __FUNCTION__);
diff --git a/arch/powerpc/platforms/52xx/lite5200_pm.c 
b/arch/powerpc/platforms/52xx/lite5200_pm.c
index ffa14af..c3ada1e 100644
--- a/arch/powerpc/platforms/52xx/lite5200_pm.c
+++ b/arch/powerpc/platforms/52xx/lite5200_pm.c
@@ -42,6 +42,8 @@ static int lite5200_pm_set_target(suspend_state_t state)
 
 static int lite5200_pm_prepare(void)
 {
+   struct device_node *np;
+
/* deep sleep? let mpc52xx code handle that */
if (lite5200_pm_target_state == PM_SUSPEND_STANDBY)
return mpc52xx_pm_prepare();
@@ -50,7 +52,9 @@ static int lite5200_pm_prepare(void)
return -EINVAL;
 
/* map registers */
-   mbar = mpc52xx_find_and_map(mpc5200);
+   np = of_find_compatible_node(NULL, NULL, mpc5200);
+   mbar = of_iomap(np, 0);
+   of_node_put(np);
if (!mbar) {
printk(KERN_ERR %s:%i Error mapping registers\n, __func__, 
__LINE__);
return -ENOSYS;
diff --git a/arch/powerpc/platforms/52xx/mpc52xx_common.c 
b/arch/powerpc/platforms/52xx/mpc52xx_common.c
index 9bdbee4..90a4cec 100644
--- a/arch/powerpc/platforms/52xx/mpc52xx_common.c
+++ b/arch/powerpc/platforms/52xx/mpc52xx_common.c
@@ -26,45 +26,6 @@
  */
 static volatile struct mpc52xx_gpt *mpc52xx_wdt = NULL;
 
-static void __iomem *
-mpc52xx_map_node(struct device_node *ofn)
-{
-   const u32 *regaddr_p;
-   u64 regaddr64, size64;
-
-   if (!ofn)
-   return NULL;
-
-   regaddr_p = of_get_address(ofn, 0, size64, NULL);
-   if (!regaddr_p) {
-   of_node_put(ofn);
-   return NULL;
-   }
-
-   regaddr64 = of_translate_address(ofn, regaddr_p);
-
-   of_node_put(ofn);
-
-   return ioremap((u32)regaddr64, (u32)size64);
-}
-
-void __iomem *
-mpc52xx_find_and_map(const char *compatible)
-{
-   return mpc52xx_map_node(
-   of_find_compatible_node(NULL, NULL, compatible));
-}
-
-EXPORT_SYMBOL(mpc52xx_find_and_map);
-
-void __iomem *
-mpc52xx_find_and_map_path(const char *path)
-{
-   return mpc52xx_map_node(of_find_node_by_path(path));
-}
-
-EXPORT_SYMBOL(mpc52xx_find_and_map_path);
-
 /**
  * mpc52xx_find_ipb_freq - Find the IPB bus frequency for a device
  * @node:  device node
@@ -101,9 +62,12 @@ EXPORT_SYMBOL(mpc52xx_find_ipb_freq);
 void __init
 mpc5200_setup_xlb_arbiter(void)
 {
+   struct device_node *np;
struct mpc52xx_xlb  __iomem *xlb;
 
-   xlb = mpc52xx_find_and_map(mpc5200-xlb);
+   np = of_find_compatible_node(NULL, NULL, mpc5200-xlb);
+   xlb = of_iomap(np, 0);
+   of_node_put(np);
if (!xlb) {
printk(KERN_ERR __FILE__ : 
Error mapping XLB in mpc52xx_setup_cpu().  
@@ -156,16 +120,19 @@ mpc52xx_map_wdt(void)
for_each_compatible_node(np, NULL, fsl,mpc5200-gpt) {
has_wdt = of_get_property(np, fsl,has-wdt, NULL);
if (has_wdt) {
-   

[RFC] Add of_find_matching_node() helper function

2008-01-07 Thread Grant Likely
From: Grant Likely [EMAIL PROTECTED]

Similar to of_find_compatible_node(), of_find_matching_node() and
for_each_matching_node() allow you to iterate over the device tree
looking for specific nodes except that it accepts a of_device_id
table instead of strings.

This patch also moves of_match_node() from driver/of/device.c to
driver/of/base.c to colocate it with the of_find_matching_node which
depends on it.

Signed-off-by: Grant Likely [EMAIL PROTECTED]
---

I've found this change useful for the 5200 board ports to clean up the
platform matching code.  It works well in my environment, but it could
have farther reaching consequences.  Please review and comment.

Cheers,
g.

 drivers/of/base.c |   58 +
 drivers/of/device.c   |   29 ---
 include/linux/of.h|8 ++
 include/linux/of_device.h |2 --
 4 files changed, 66 insertions(+), 31 deletions(-)

diff --git a/drivers/of/base.c b/drivers/of/base.c
index 9377f3b..b306fef 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -273,3 +273,61 @@ struct device_node *of_find_compatible_node(struct 
device_node *from,
return np;
 }
 EXPORT_SYMBOL(of_find_compatible_node);
+
+/**
+ * of_match_node - Tell if an device_node has a matching of_match structure
+ * @matches:   array of of device match structures to search in
+ * @node:  the of device structure to match against
+ *
+ * Low level utility function used by device matching.
+ */
+const struct of_device_id *of_match_node(const struct of_device_id *matches,
+const struct device_node *node)
+{
+   while (matches-name[0] || matches-type[0] || matches-compatible[0]) {
+   int match = 1;
+   if (matches-name[0])
+   match = node-name
+!strcmp(matches-name, node-name);
+   if (matches-type[0])
+   match = node-type
+!strcmp(matches-type, node-type);
+   if (matches-compatible[0])
+   match = of_device_is_compatible(node,
+   matches-compatible);
+   if (match)
+   return matches;
+   matches++;
+   }
+   return NULL;
+}
+EXPORT_SYMBOL(of_match_node);
+
+/**
+ * of_find_matching_node - Find a node based on an of_device_id match
+ * table.
+ * @from:  The node to start searching from or NULL, the node
+ * you pass will not be searched, only the next one
+ * will; typically, you pass what the previous call
+ * returned. of_node_put() will be called on it
+ * @matches:   array of of device match structures to search in
+ *
+ * Returns a node pointer with refcount incremented, use
+ * of_node_put() on it when done.
+ */
+struct device_node *of_find_matching_node(struct device_node *from,
+ const struct of_device_id *matches)
+{
+   struct device_node *np;
+
+   read_lock(devtree_lock);
+   np = from ? from-allnext : allnodes;
+   for (; np; np = np-allnext) {
+   if (of_match_node(matches, np)  of_node_get(np))
+   break;
+   }
+   of_node_put(from);
+   read_unlock(devtree_lock);
+   return np;
+}
+EXPORT_SYMBOL(of_find_matching_node);
diff --git a/drivers/of/device.c b/drivers/of/device.c
index 6245f06..29681c4 100644
--- a/drivers/of/device.c
+++ b/drivers/of/device.c
@@ -10,35 +10,6 @@
 #include asm/errno.h
 
 /**
- * of_match_node - Tell if an device_node has a matching of_match structure
- * @ids: array of of device match structures to search in
- * @node: the of device structure to match against
- *
- * Low level utility function used by device matching.
- */
-const struct of_device_id *of_match_node(const struct of_device_id *matches,
-const struct device_node *node)
-{
-   while (matches-name[0] || matches-type[0] || matches-compatible[0]) {
-   int match = 1;
-   if (matches-name[0])
-   match = node-name
-!strcmp(matches-name, node-name);
-   if (matches-type[0])
-   match = node-type
-!strcmp(matches-type, node-type);
-   if (matches-compatible[0])
-   match = of_device_is_compatible(node,
-   matches-compatible);
-   if (match)
-   return matches;
-   matches++;
-   }
-   return NULL;
-}
-EXPORT_SYMBOL(of_match_node);
-
-/**
  * of_match_device - Tell if an of_device structure has a matching
  * of_match structure
  * @ids: array of of device match 

Re: [alsa-devel] [PATCH] ASoC drivers for the Freescale MPC8610 SoC

2008-01-07 Thread Timur Tabi
Liam Girdwood wrote:
 On Mon, 2008-01-07 at 09:52 -0600, Timur Tabi wrote:
 So all I'm trying to do now is get my driver, with warts and all, into the 
 tree 
 so that I can focus with Liam et al to get a real ASoC V2 up and running.

 
 I'll commit the MPC8610 into the ASoC (v1) dev tree soon (hopefully
 tonight). This will allow folks to use it in the meantime whilst we sort
 out any changes.

I'm working on some minor updates, so hold off for now.  I'll post a new patch 
later this afternoon.

 I'll then port (what I can) to V2, although I may need some assistance
 with some of the PPC sections.

I'll be 100% available for that.

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


[PATCH v2] [POWERPC] Update MPC8610 HPCD to support audio drivers

2008-01-07 Thread Timur Tabi
Update the MPC8610 HPCD files to support the audio driver.  Update
booting-without-of.txt with information on the SSI device.

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

Updated based on comments from mailing lists.  Split the patch into two parts.

This patch applies on top of
git://git.kernel.org/pub/scm/linux/kernel/git/perex/alsa.git.

 Documentation/powerpc/booting-without-of.txt |   40 ++
 arch/powerpc/boot/dts/mpc8610_hpcd.dts   |  110 -
 arch/powerpc/configs/mpc8610_hpcd_defconfig  |  171 +-
 arch/powerpc/platforms/86xx/mpc8610_hpcd.c   |   18 +++
 4 files changed, 335 insertions(+), 4 deletions(-)

diff --git a/Documentation/powerpc/booting-without-of.txt 
b/Documentation/powerpc/booting-without-of.txt
index e9a3cb1..826af91 100644
--- a/Documentation/powerpc/booting-without-of.txt
+++ b/Documentation/powerpc/booting-without-of.txt
@@ -53,6 +53,7 @@ Table of Contents
   j) CFI or JEDEC memory-mapped NOR flash
   k) Global Utilities Block
   l) Xilinx IP cores
+  p) Freescale Synchronous Serial Interface
 
   VII - Specifying interrupt information for devices
 1) interrupts property
@@ -2514,6 +2515,45 @@ platforms are moved over to use the 
flattened-device-tree model.
   Requred properties:
- current-speed : Baud rate of uartlite
 
+p) Freescale Synchronous Serial Interface
+
+   The SSI is a serial device that communicates with audio codecs.  It can
+   be programmed in AC97, I2S, left-justified, or right-justified modes.
+
+   Required properties:
+   - compatible  : compatible list, containing fsl,ssi
+   - cell-index  : the SSI, 0 = SSI1, 1 = SSI2, and so on
+   - reg : offset and length of the register set for the device
+   - interrupts  : a b where a is the interrupt number and b is a
+field that represents an encoding of the sense and
+   level information for the interrupt.  This should be
+   encoded based on the information in section 2)
+   depending on the type of interrupt controller you
+   have.
+   - interrupt-parent : the phandle for the interrupt controller that
+services interrupts for this device.
+   - fsl,mode: the operating mode for the SSI interface
+   i2s-slave - I2S mode, SSI is clock slave
+   i2s-master - I2S mode, SSI is clock master
+   lj-slave - left-justified mode, SSI is clock slave
+   lj-master - l.j. mode, SSI is clock master
+   rj-slave - right-justified mode, SSI is clock 
slave
+   rj-master - r.j., SSI is clock master
+   ac97-slave - AC97 mode, SSI is clock slave
+   ac97-master - AC97 mode, SSI is clock master
+
+   Optional properties:
+   - codec   : child node that defines an audio codec connected
+   to this SSI
+
+   Child 'codec' node required properties:
+   - compatible  : compatible list, contains the name of the codec
+
+   Child 'codec' node optional properties:
+   - bus-frequency   : The frequency of the input clock, which typically
+comes from an on-board dedicated oscillator.
+
+
More devices will be defined as this spec matures.
 
 VII - Specifying interrupt information for devices
diff --git a/arch/powerpc/boot/dts/mpc8610_hpcd.dts 
b/arch/powerpc/boot/dts/mpc8610_hpcd.dts
index 966edf1..fda0ace 100644
--- a/arch/powerpc/boot/dts/mpc8610_hpcd.dts
+++ b/arch/powerpc/boot/dts/mpc8610_hpcd.dts
@@ -1,7 +1,7 @@
 /*
  * MPC8610 HPCD Device Tree Source
  *
- * Copyright 2007 Freescale Semiconductor Inc.
+ * Copyright 2007-2008 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
@@ -42,6 +42,7 @@
#size-cells = 1;
#interrupt-cells = 2;
device_type = soc;
+   compatible = fsl,mpc8610;
ranges = 0 e000 0010;
reg = e000 1000;
bus-frequency = 0;
@@ -103,6 +104,113 @@
reg = e 1000;
fsl,has-rstcr;
};
+
+   [EMAIL PROTECTED] {
+   compatible = fsl,mpc8610-ssi;
+   cell-index = 0;
+   reg = 16000 100;
+   interrupt-parent = mpic;
+   interrupts = 3e 2;
+   fsl,mode = i2s-slave;
+   codec {
+   compatible = cirrus,cs4270;
+   /* MCLK source is a 

[RFC 0/2] mpc5200: eliminate direct manipulation of shared registers from SPI driver

2008-01-07 Thread Grant Likely
The mpc5200 PSC SPI driver driver directly manipulates the port_config
and the CDM registers on the mpc5200 which it should not do.  port_config
should only be manipulated from within the board specific platform code
and the CDM registers are shared between multiple devices.

This patch eliminates the port_config manipulations and adds a common
routine for adjusting CDM settings.  Boards using the SPI driver will
need to add the required port_config changes to either the boot firmware
or the platform code.

If there are no objections, I plan to ask Paulus to merge these in the
next couple of days.

Cheers,
g.

--
Grant Likely, B.Sc. P.Eng.
Secret Lab Technologies Ltd.
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[RFC 1/2] mpc5200: Add common clock setting routine mpc52xx_set_psc_clkdiv()

2008-01-07 Thread Grant Likely
From: Grant Likely [EMAIL PROTECTED]

PSC drivers should not access the CDM registers directly.  Instead provide
a common routine for setting the PSC clock parameters with the required
locking.

Signed-off-by: Grant Likely [EMAIL PROTECTED]
---

 arch/powerpc/platforms/52xx/efika.c  |3 +
 arch/powerpc/platforms/52xx/lite5200.c   |   10 +--
 arch/powerpc/platforms/52xx/mpc5200_simple.c |6 +-
 arch/powerpc/platforms/52xx/mpc52xx_common.c |   91 +-
 arch/ppc/syslib/mpc52xx_setup.c  |   36 ++
 include/asm-powerpc/mpc52xx.h|   13 ++--
 6 files changed, 130 insertions(+), 29 deletions(-)

diff --git a/arch/powerpc/platforms/52xx/efika.c 
b/arch/powerpc/platforms/52xx/efika.c
index a0da70c..a2068fa 100644
--- a/arch/powerpc/platforms/52xx/efika.c
+++ b/arch/powerpc/platforms/52xx/efika.c
@@ -180,6 +180,9 @@ static void __init efika_setup_arch(void)
 {
rtas_initialize();
 
+   /* Map important registers from the internal memory map */
+   mpc52xx_map_common_devices();
+
efika_pcisetup();
 
 #ifdef CONFIG_PM
diff --git a/arch/powerpc/platforms/52xx/lite5200.c 
b/arch/powerpc/platforms/52xx/lite5200.c
index f8ba5f2..42e87b6 100644
--- a/arch/powerpc/platforms/52xx/lite5200.c
+++ b/arch/powerpc/platforms/52xx/lite5200.c
@@ -150,15 +150,15 @@ static void __init lite5200_setup_arch(void)
if (ppc_md.progress)
ppc_md.progress(lite5200_setup_arch(), 0);
 
-   /* Fix things that firmware should have done. */
-   lite5200_fix_clock_config();
-   lite5200_fix_port_config();
+   /* Map important registers from the internal memory map */
+   mpc52xx_map_common_devices();
 
/* Some mpc5200  mpc5200b related configuration */
mpc5200_setup_xlb_arbiter();
 
-   /* Map wdt for mpc52xx_restart() */
-   mpc52xx_map_wdt();
+   /* Fix things that firmware should have done. */
+   lite5200_fix_clock_config();
+   lite5200_fix_port_config();
 
 #ifdef CONFIG_PM
mpc52xx_suspend.board_suspend_prepare = lite5200_suspend_prepare;
diff --git a/arch/powerpc/platforms/52xx/mpc5200_simple.c 
b/arch/powerpc/platforms/52xx/mpc5200_simple.c
index 754aa93..c48b82b 100644
--- a/arch/powerpc/platforms/52xx/mpc5200_simple.c
+++ b/arch/powerpc/platforms/52xx/mpc5200_simple.c
@@ -39,12 +39,12 @@ static void __init mpc5200_simple_setup_arch(void)
if (ppc_md.progress)
ppc_md.progress(mpc5200_simple_setup_arch(), 0);
 
+   /* Map important registers from the internal memory map */
+   mpc52xx_map_common_devices();
+
/* Some mpc5200  mpc5200b related configuration */
mpc5200_setup_xlb_arbiter();
 
-   /* Map wdt for mpc52xx_restart() */
-   mpc52xx_map_wdt();
-
mpc52xx_setup_pci();
 }
 
diff --git a/arch/powerpc/platforms/52xx/mpc52xx_common.c 
b/arch/powerpc/platforms/52xx/mpc52xx_common.c
index 59346e3..67eba48 100644
--- a/arch/powerpc/platforms/52xx/mpc52xx_common.c
+++ b/arch/powerpc/platforms/52xx/mpc52xx_common.c
@@ -13,6 +13,7 @@
 #undef DEBUG
 
 #include linux/kernel.h
+#include linux/spinlock.h
 #include linux/of_platform.h
 #include asm/io.h
 #include asm/prom.h
@@ -24,7 +25,9 @@
  * from interrupt context while node mapping (which calls ioremap())
  * cannot be used at such point.
  */
-static volatile struct mpc52xx_gpt *mpc52xx_wdt = NULL;
+static spinlock_t mpc52xx_lock = SPIN_LOCK_UNLOCKED;
+static struct mpc52xx_gpt __iomem *mpc52xx_wdt;
+static struct mpc52xx_cdm __iomem *mpc52xx_cdm;
 
 /**
  * mpc52xx_find_ipb_freq - Find the IPB bus frequency for a device
@@ -93,32 +96,43 @@ mpc5200_setup_xlb_arbiter(void)
iounmap(xlb);
 }
 
-static struct of_device_id __init mpc52xx_ids[] = {
-   { .compatible = fsl,mpc5200-immr, },
-   { .compatible = fsl,lpb, },
-
-   /* depreciated matches; shouldn't be used in new device trees */
-   { .type = builtin, .compatible = mpc5200, }, /* efika */
-   { .type = soc, .compatible = mpc5200, }, /* lite5200 */
-   {}
-};
-
+/**
+ * mpc52xx_declare_of_platform_devices: register internal devices and children
+ * of the localplus bus to the of_platform
+ * bus.
+ */
 void __init
 mpc52xx_declare_of_platform_devices(void)
 {
+   const static struct of_device_id mpc52xx_bus_ids[] = {
+   { .compatible = fsl,mpc5200-immr, },
+   { .compatible = fsl,lpb, },
+   { .type = builtin, .compatible = mpc5200, }, /* efika */
+   { .type = soc, .compatible = mpc5200, }, /* old */
+   {}
+   };
+
/* Find every child of the SOC node and add it to of_platform */
-   if (of_platform_bus_probe(NULL, mpc52xx_ids, NULL))
+   if (of_platform_bus_probe(NULL, mpc52xx_bus_ids, NULL))
printk(KERN_ERR __FILE__ : 
Error while probing of_platform bus\n);
 }
 

[RFC 2/2] mpc52xx_psc_spi device driver must not touch port_config and cdm

2008-01-07 Thread Grant Likely
From: Grant Likely [EMAIL PROTECTED]

It is dangerous for an mpc52xx device driver to modify the port_config
register.  If the driver is probed incorrectly, it will change the pin
IO configuration in ways which may not be compatible with the board.
port_config should be set up by the bootloader, or failing that, in
the platform setup code in arch/powerpc/platforms/52xx.

Also, modifying CDM registers directly can cause a race condition with
other drivers.  Instead call a common routine to modify CDM settings.

Signed-off-by: Grant Likely [EMAIL PROTECTED]
---

 drivers/spi/mpc52xx_psc_spi.c |   77 +
 1 files changed, 2 insertions(+), 75 deletions(-)

diff --git a/drivers/spi/mpc52xx_psc_spi.c b/drivers/spi/mpc52xx_psc_spi.c
index a3ebc63..253ed56 100644
--- a/drivers/spi/mpc52xx_psc_spi.c
+++ b/drivers/spi/mpc52xx_psc_spi.c
@@ -330,80 +330,13 @@ static void mpc52xx_psc_spi_cleanup(struct spi_device 
*spi)
 
 static int mpc52xx_psc_spi_port_config(int psc_id, struct mpc52xx_psc_spi *mps)
 {
-   struct device_node *np;
-   struct mpc52xx_cdm __iomem *cdm;
-   struct mpc52xx_gpio __iomem *gpio;
struct mpc52xx_psc __iomem *psc = mps-psc;
-   u32 ul;
u32 mclken_div;
int ret = 0;
 
-#if defined(CONFIG_PPC_MERGE)
-   np = of_find_compatible_node(NULL, NULL, mpc5200-cdm);
-   cdm = of_iomap(np, 0);
-   of_node_put(np);
-   np = of_find_compatible_node(NULL, NULL, mpc5200-gpio);
-   gpio = of_iomap(np, 0);
-   of_node_put(np);
-#else
-   cdm = ioremap(MPC52xx_PA(MPC52xx_CDM_OFFSET), MPC52xx_CDM_SIZE);
-   gpio = ioremap(MPC52xx_PA(MPC52xx_GPIO_OFFSET), MPC52xx_GPIO_SIZE);
-#endif
-   if (!cdm || !gpio) {
-   printk(KERN_ERR Error mapping CDM/GPIO\n);
-   ret = -EFAULT;
-   goto unmap_regs;
-   }
-
/* default sysclk is 512MHz */
-   mclken_div = 0x8000 |
-   (((mps-sysclk ? mps-sysclk : 51200) / MCLK)  0x1FF);
-
-   switch (psc_id) {
-   case 1:
-   ul = in_be32(gpio-port_config);
-   ul = 0xFFF8;
-   ul |= 0x0006;
-   out_be32(gpio-port_config, ul);
-   out_be16(cdm-mclken_div_psc1, mclken_div);
-   ul = in_be32(cdm-clk_enables);
-   ul |= 0x0020;
-   out_be32(cdm-clk_enables, ul);
-   break;
-   case 2:
-   ul = in_be32(gpio-port_config);
-   ul = 0xFF8F;
-   ul |= 0x0060;
-   out_be32(gpio-port_config, ul);
-   out_be16(cdm-mclken_div_psc2, mclken_div);
-   ul = in_be32(cdm-clk_enables);
-   ul |= 0x0040;
-   out_be32(cdm-clk_enables, ul);
-   break;
-   case 3:
-   ul = in_be32(gpio-port_config);
-   ul = 0xF0FF;
-   ul |= 0x0600;
-   out_be32(gpio-port_config, ul);
-   out_be16(cdm-mclken_div_psc3, mclken_div);
-   ul = in_be32(cdm-clk_enables);
-   ul |= 0x0080;
-   out_be32(cdm-clk_enables, ul);
-   break;
-   case 6:
-   ul = in_be32(gpio-port_config);
-   ul = 0xFF8F;
-   ul |= 0x0070;
-   out_be32(gpio-port_config, ul);
-   out_be16(cdm-mclken_div_psc6, mclken_div);
-   ul = in_be32(cdm-clk_enables);
-   ul |= 0x0010;
-   out_be32(cdm-clk_enables, ul);
-   break;
-   default:
-   ret = -EINVAL;
-   goto unmap_regs;
-   }
+   mclken_div = (mps-sysclk ? mps-sysclk : 51200) / MCLK;
+   mpc52xx_set_psc_clkdiv(psc_id, mclken_div);
 
/* Reset the PSC into a known state */
out_8(psc-command, MPC52xx_PSC_RST_RX);
@@ -427,12 +360,6 @@ static int mpc52xx_psc_spi_port_config(int psc_id, struct 
mpc52xx_psc_spi *mps)
 
mps-bits_per_word = 8;
 
-unmap_regs:
-   if (cdm)
-   iounmap(cdm);
-   if (gpio)
-   iounmap(gpio);
-
return ret;
 }
 

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


Re: [alsa-devel] [PATCH] ASoC drivers for the Freescale MPC8610 SoC

2008-01-07 Thread Liam Girdwood
On Mon, 2008-01-07 at 09:52 -0600, Timur Tabi wrote:
 
 So all I'm trying to do now is get my driver, with warts and all, into the 
 tree 
 so that I can focus with Liam et al to get a real ASoC V2 up and running.
 

I'll commit the MPC8610 into the ASoC (v1) dev tree soon (hopefully
tonight). This will allow folks to use it in the meantime whilst we sort
out any changes.

I'll then port (what I can) to V2, although I may need some assistance
with some of the PPC sections.

Fwiw we are looking at submitting V2 in March/April time. 


Liam

PS. Sorry for the silence lately. We've just moved to a new opensource
server over the holidays and have been without some services i.e. mail.



Privacy  Confidentiality Notice
-
This message and any attachments contain privileged and confidential 
information that is intended solely for the person(s) to whom it is addressed. 
If you are not an intended recipient you must not: read; copy; distribute; 
discuss; take any action in or make any reliance upon the contents of this 
message; nor open or read any attachment. If you have received this message in 
error, please notify us as soon as possible on the following telephone number 
and destroy this message including any attachments. Thank you.
-
Wolfson Microelectronics plc
Tel: +44 (0)131 272 7000
Fax: +44 (0)131 272 7001
Web: www.wolfsonmicro.com

Registered in Scotland

Company number SC089839

Registered office: 

Westfield House, 26 Westfield Road, Edinburgh, EH11 2QB, UK

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


RE: [RFC] Add of_find_matching_node() helper function

2008-01-07 Thread Stephen Neuendorffer
I wanted such function too, but stopped short of writing it because
of_match_node was in the wrong place.

Steve

 -Original Message-
 From: [EMAIL PROTECTED]
[mailto:linuxppc-dev-
 [EMAIL PROTECTED] On Behalf Of Grant
Likely
 Sent: Monday, January 07, 2008 10:16 AM
 To: [EMAIL PROTECTED]; [EMAIL PROTECTED]; linuxppc-dev@ozlabs.org
 Subject: [RFC] Add of_find_matching_node() helper function
 
 From: Grant Likely [EMAIL PROTECTED]
 
 Similar to of_find_compatible_node(), of_find_matching_node() and
 for_each_matching_node() allow you to iterate over the device tree
 looking for specific nodes except that it accepts a of_device_id
 table instead of strings.
 
 This patch also moves of_match_node() from driver/of/device.c to
 driver/of/base.c to colocate it with the of_find_matching_node which
 depends on it.
 
 Signed-off-by: Grant Likely [EMAIL PROTECTED]
 ---
 
 I've found this change useful for the 5200 board ports to clean up the
 platform matching code.  It works well in my environment, but it could
 have farther reaching consequences.  Please review and comment.
 
 Cheers,
 g.
 
  drivers/of/base.c |   58
+
  drivers/of/device.c   |   29 ---
  include/linux/of.h|8 ++
  include/linux/of_device.h |2 --
  4 files changed, 66 insertions(+), 31 deletions(-)
 
 diff --git a/drivers/of/base.c b/drivers/of/base.c
 index 9377f3b..b306fef 100644
 --- a/drivers/of/base.c
 +++ b/drivers/of/base.c
 @@ -273,3 +273,61 @@ struct device_node
*of_find_compatible_node(struct device_node *from,
   return np;
  }
  EXPORT_SYMBOL(of_find_compatible_node);
 +
 +/**
 + * of_match_node - Tell if an device_node has a matching of_match
structure
 + *   @matches:   array of of device match structures to search in
 + *   @node:  the of device structure to match against
 + *
 + *   Low level utility function used by device matching.
 + */
 +const struct of_device_id *of_match_node(const struct of_device_id
*matches,
 +  const struct device_node *node)
 +{
 + while (matches-name[0] || matches-type[0] ||
matches-compatible[0]) {
 + int match = 1;
 + if (matches-name[0])
 + match = node-name
 +  !strcmp(matches-name, node-name);
 + if (matches-type[0])
 + match = node-type
 +  !strcmp(matches-type, node-type);
 + if (matches-compatible[0])
 + match = of_device_is_compatible(node,
 + matches-compatible);
 + if (match)
 + return matches;
 + matches++;
 + }
 + return NULL;
 +}
 +EXPORT_SYMBOL(of_match_node);
 +
 +/**
 + *   of_find_matching_node - Find a node based on an of_device_id
match
 + *   table.
 + *   @from:  The node to start searching from or NULL, the
node
 + *   you pass will not be searched, only the next one
 + *   will; typically, you pass what the previous call
 + *   returned. of_node_put() will be called on it
 + *   @matches:   array of of device match structures to search in
 + *
 + *   Returns a node pointer with refcount incremented, use
 + *   of_node_put() on it when done.
 + */
 +struct device_node *of_find_matching_node(struct device_node *from,
 +   const struct of_device_id
*matches)
 +{
 + struct device_node *np;
 +
 + read_lock(devtree_lock);
 + np = from ? from-allnext : allnodes;
 + for (; np; np = np-allnext) {
 + if (of_match_node(matches, np)  of_node_get(np))
 + break;
 + }
 + of_node_put(from);
 + read_unlock(devtree_lock);
 + return np;
 +}
 +EXPORT_SYMBOL(of_find_matching_node);
 diff --git a/drivers/of/device.c b/drivers/of/device.c
 index 6245f06..29681c4 100644
 --- a/drivers/of/device.c
 +++ b/drivers/of/device.c
 @@ -10,35 +10,6 @@
  #include asm/errno.h
 
  /**
 - * of_match_node - Tell if an device_node has a matching of_match
structure
 - * @ids: array of of device match structures to search in
 - * @node: the of device structure to match against
 - *
 - * Low level utility function used by device matching.
 - */
 -const struct of_device_id *of_match_node(const struct of_device_id
*matches,
 -  const struct device_node *node)
 -{
 - while (matches-name[0] || matches-type[0] ||
matches-compatible[0]) {
 - int match = 1;
 - if (matches-name[0])
 - match = node-name
 -  !strcmp(matches-name, node-name);
 - if (matches-type[0])
 - match = node-type
 -  !strcmp(matches-type, node-type);
 - if (matches-compatible[0])
 -

Re: [RFC PATCH 1/3] Add StorCenter DTS first draft.

2008-01-07 Thread Grant Likely
On 1/7/08, Jon Loeliger [EMAIL PROTECTED] wrote:
 Based on the Kurobox DTS files.

 Signed-off-by: Andy Wilcox [EMAIL PROTECTED]
 Signed-off-by: Jon Loeliger [EMAIL PROTECTED]
 ---

 Ignore the flash bits.  They are from the previous
 World View and need to be updated still.

  arch/powerpc/boot/dts/storcenter.dts |  159 
 ++
  1 files changed, 159 insertions(+), 0 deletions(-)
  create mode 100644 arch/powerpc/boot/dts/storcenter.dts

 diff --git a/arch/powerpc/boot/dts/storcenter.dts 
 b/arch/powerpc/boot/dts/storcenter.dts
 new file mode 100644
 index 000..68887ac
 --- /dev/null
 +++ b/arch/powerpc/boot/dts/storcenter.dts
 @@ -0,0 +1,159 @@
 +   [EMAIL PROTECTED] {
 +   #address-cells = 1;
 +   #size-cells = 1;
 +   device_type = soc;
 +   compatible = fsl,mpc8241, mpc10x;
 +   store-gathering = 0; /* 0 == off, !0 == on */
 +
 +   reg = 8000 0010;  /* Temporary, right? 
 */
 +
 +   ranges = 8000 8000 7000/* pci mem space */
 + fdf0 fdf0 0010/* EUMB */
 + fe00 fe00 00c0/* pci i/o space */
 + fec0 fec0 0030/* pci cfg regs */
 + fef0 fef0 0010;  /* pci iack */

This doesn't look nice.  On the other ppc boards, Kumar moved the pci
bus node out of the soc node so the the internal register range is
separate from the soc.

I think it should look like this:

{
[EMAIL PROTECTED] {
compatible = fsl,mpc8241-immr;
ranges = 0 fe00 0010;
[EMAIL PROTECTED] {
blah
};
blah
};
[EMAIL PROTECTED] {
ranges = blah
};
};

 +
 +   [EMAIL PROTECTED] {
 +   serial0: [EMAIL PROTECTED] {
 +   cell-index = 0;
 +   device_type = serial;
 +   compatible = ns16550;
 +   reg = fdf04500 8;
 +   clock-frequency = d# 97553800; /* Hz */

That's kind of an odd number for clock frequency.  Usually clock
frequencies are *big* and *round*.  :-)

 +   current-speed = d# 115200;
 +   interrupts = 9 2;
 +   interrupt-parent = mpic;
 +   };
 +

Cheers,
g.

-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
[EMAIL PROTECTED]
(403) 399-0195
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [RFC PATCH 2/3] Add initial iomega StorCenter board port.

2008-01-07 Thread Grant Likely
On 1/7/08, Jon Loeliger [EMAIL PROTECTED] wrote:

 Use cuImage bootwrapper until U-Boot port is completed.
 Derived heavily from Linkstation port.

 Signed-off-by: Andy Wilcox [EMAIL PROTECTED]
 Signed-off-by: Jon Loeliger [EMAIL PROTECTED]
 ---

 diff --git a/arch/powerpc/platforms/embedded6xx/Kconfig 
 b/arch/powerpc/platforms/embedded6xx/Kconfig
 index 8924095..be5cdd2 100644
 --- a/arch/powerpc/platforms/embedded6xx/Kconfig
 +++ b/arch/powerpc/platforms/embedded6xx/Kconfig

Curious; why in platforms/embedded6xx vs platforms/82xx?

 diff --git a/arch/powerpc/platforms/embedded6xx/Makefile 
 b/arch/powerpc/platforms/embedded6xx/Makefile
 index 844947c..f4fb280 100644
 --- a/arch/powerpc/platforms/embedded6xx/Makefile
 +++ b/arch/powerpc/platforms/embedded6xx/Makefile
 @@ -3,5 +3,7 @@
  #
  obj-$(CONFIG_MPC7448HPC2)  += mpc7448_hpc2.o
  obj-$(CONFIG_LINKSTATION)  += linkstation.o ls_uart.o
 +obj-$(CONFIG_STORCENTER)   += storcenter.o
  obj-$(CONFIG_PPC_HOLLY)+= holly.o
  obj-$(CONFIG_PPC_PRPMC2800)+= prpmc2800.o
 +obj-$(CONFIG_STORCENTER)   += storcenter.o

Linked twice?

Cheers,
g.

-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
[EMAIL PROTECTED]
(403) 399-0195
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [RFC PATCH 0/3]: Add StorCenter port to arch/powerpc

2008-01-07 Thread Grant Likely
On 1/7/08, Jon Loeliger [EMAIL PROTECTED] wrote:
 Specifically, it's not quite working yet, and for lack of
 actually getting serial output, we're having some difficulty
 still.  I post it here in a desperate attempt to let some
 eagle-eyed person point out my obvious D'oh problem.

Can you access __log_buf in any way at all?

g.

-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
[EMAIL PROTECTED]
(403) 399-0195
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [RFC PATCH 1/3] Add StorCenter DTS first draft.

2008-01-07 Thread Jon Loeliger
So, like, the other day Grant Likely mumbled:
  +
  +   ranges = 8000 8000 7000/* pci mem space */
  + fdf0 fdf0 0010/* EUMB */
  + fe00 fe00 00c0/* pci i/o space */
  + fec0 fec0 0030/* pci cfg regs */
  + fef0 fef0 0010;  /* pci iack */
 
 This doesn't look nice.  On the other ppc boards, Kumar moved the pci
 bus node out of the soc node so the the internal register range is
 separate from the soc.

Oh crap.  I forgot about that.  Yes, you are right.

 I think it should look like this:
 
 {
 [EMAIL PROTECTED] {
 compatible = fsl,mpc8241-immr;
 ranges = 0 fe00 0010;
 [EMAIL PROTECTED] {
 blah
 };
 blah
 };
 [EMAIL PROTECTED] {
 ranges = blah
 };
 };

So, I'll definitely rework that part as in indicated

  +   clock-frequency = d# 97553800; /* Hz */
 
 That's kind of an odd number for clock frequency.  Usually clock
 frequencies are *big* and *round*.  :-)

And this one, according to Andy, is nice-n-measured right
off the crystal!  I had 10M in there originally even.
But I'll double check that with him to be sure.

Thanks,
jdl

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


Re: [RFC PATCH 2/3] Add initial iomega StorCenter board port.

2008-01-07 Thread Jon Loeliger
So, like, the other day Grant Likely mumbled:
 
 Curious; why in platforms/embedded6xx vs platforms/82xx?

82xx is nominally the _other_ 82xx family. :-)
This is just more historical precedent, and the fact
that it is similar to the linkstation there.

   obj-$(CONFIG_MPC7448HPC2)  += mpc7448_hpc2.o
   obj-$(CONFIG_LINKSTATION)  += linkstation.o ls_uart.o
  +obj-$(CONFIG_STORCENTER)   += storcenter.o
   obj-$(CONFIG_PPC_HOLLY)+= holly.o
   obj-$(CONFIG_PPC_PRPMC2800)+= prpmc2800.o
  +obj-$(CONFIG_STORCENTER)   += storcenter.o
 
 Linked twice?

I wanted to make double-sure to screw it up.  You know. :-)

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


Re: [RFC PATCH 0/3]: Add StorCenter port to arch/powerpc

2008-01-07 Thread Jon Loeliger
So, like, the other day Grant Likely mumbled:
 On 1/7/08, Jon Loeliger [EMAIL PROTECTED] wrote:
  Specifically, it's not quite working yet, and for lack of
  actually getting serial output, we're having some difficulty
  still.  I post it here in a desperate attempt to let some
  eagle-eyed person point out my obvious D'oh problem.
 
 Can you access __log_buf in any way at all?

Not that we've established yet...

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


[DTC PATCH 1/2] Convert malloc() uses to xmalloc().

2008-01-07 Thread Scott Wood
Signed-off-by: Scott Wood [EMAIL PROTECTED]
---
 dtc-lexer.l |6 +-
 srcpos.c|   12 +++-
 2 files changed, 4 insertions(+), 14 deletions(-)

diff --git a/dtc-lexer.l b/dtc-lexer.l
index bfb996e..f2836a8 100644
--- a/dtc-lexer.l
+++ b/dtc-lexer.l
@@ -273,11 +273,7 @@ int push_input_file(const char *filename)
exit(1);
}
 
-   incl_file = malloc(sizeof(struct incl_file));
-   if (!incl_file) {
-   yyerror(Can not allocate include file space.);
-   return 0;
-   }
+   incl_file = xmalloc(sizeof(struct incl_file));
 
/*
 * Save current context.
diff --git a/srcpos.c b/srcpos.c
index 7a0c47e..7d0f0a7 100644
--- a/srcpos.c
+++ b/srcpos.c
@@ -33,9 +33,7 @@ static int dtc_open_one(struct dtc_file *file,
char *fullname;
 
if (search) {
-   fullname = malloc(strlen(search) + strlen(fname) + 2);
-   if (!fullname)
-   die(Out of memory\n);
+   fullname = xmalloc(strlen(search) + strlen(fname) + 2);
 
strcpy(fullname, search);
strcat(fullname, /);
@@ -63,15 +61,11 @@ struct dtc_file *dtc_open_file(const char *fname,
struct dtc_file *file;
const char *slash;
 
-   file = malloc(sizeof(struct dtc_file));
-   if (!file)
-   die(Out of memory\n);
+   file = xmalloc(sizeof(struct dtc_file));
 
slash = strrchr(fname, '/');
if (slash) {
-   char *dir = malloc(slash - fname + 1);
-   if (!dir)
-   die(Out of memory\n);
+   char *dir = xmalloc(slash - fname + 1);
 
memcpy(dir, fname, slash - fname);
dir[slash - fname] = 0;
-- 
1.5.3

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


[DTC PATCH 2/2] Preserve scanner state when /include/ing.

2008-01-07 Thread Scott Wood
This allows /include/s to work when in non-default states,
such as PROPNODECHAR.

We may want to use state stacks to get rid of BEGIN_DEFAULT() altogether...

Signed-off-by: Scott Wood [EMAIL PROTECTED]
---
 dtc-lexer.l |6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/dtc-lexer.l b/dtc-lexer.l
index f2836a8..920b87f 100644
--- a/dtc-lexer.l
+++ b/dtc-lexer.l
@@ -18,7 +18,7 @@
  *   USA
  */
 
-%option noyywrap nounput yylineno
+%option noyywrap nounput yylineno stack
 
 %x INCLUDE
 %x BYTESTRING
@@ -55,7 +55,7 @@ static int dts_version; /* = 0 */
 %}
 
 %%
-*/include/ BEGIN(INCLUDE);
+*/include/ yy_push_state(INCLUDE);
 
 INCLUDE\[^\n]*\   {
yytext[strlen(yytext) - 1] = 0;
@@ -63,7 +63,7 @@ static int dts_version; /* = 0 */
/* Some unrecoverable error.*/
exit(1);
}
-   BEGIN_DEFAULT();
+   yy_pop_state();
}
 
 
-- 
1.5.3
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [RFC PATCH 2/3] Add initial iomega StorCenter board port.

2008-01-07 Thread Scott Wood
Jon Loeliger wrote:
 Use cuImage bootwrapper until U-Boot port is completed.
 Derived heavily from Linkstation port.
 
 Signed-off-by: Andy Wilcox [EMAIL PROTECTED]
 Signed-off-by: Jon Loeliger [EMAIL PROTECTED]
 ---
 
 Nope, I have NOT verified that the bd_t file that
 is used here byte-identical to U-Boot's layout yet.
 [ There is _always_ something more to do... ]
 
  arch/powerpc/boot/Makefile  |3 +-
  arch/powerpc/boot/cuboot-824x.c |   52 
  arch/powerpc/platforms/embedded6xx/Kconfig  |   15 ++-
  arch/powerpc/platforms/embedded6xx/Makefile |2 +
  arch/powerpc/platforms/embedded6xx/storcenter.c |  158 
 +++
  5 files changed, 227 insertions(+), 3 deletions(-)
  create mode 100644 arch/powerpc/boot/cuboot-824x.c
  create mode 100644 arch/powerpc/platforms/embedded6xx/storcenter.c
 
 diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile
 index d1e625c..a59b176 100644
 --- a/arch/powerpc/boot/Makefile
 +++ b/arch/powerpc/boot/Makefile
 @@ -57,7 +57,7 @@ src-wlib := string.S crt0.S stdio.c main.c \
   4xx.c ebony.c mv64x60.c mpsc.c mv64x60_i2c.c cuboot.c bamboo.c \
   cpm-serial.c stdlib.c mpc52xx-psc.c planetcore.c uartlite.c \
   fsl-soc.c mpc8xx.c pq2.c
 -src-plat := of.c cuboot-52xx.c cuboot-83xx.c cuboot-85xx.c holly.c \
 +src-plat := of.c cuboot-52xx.c cuboot-824x.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 \
   cuboot-pq2.c cuboot-sequoia.c treeboot-walnut.c cuboot-bamboo.c 
 \
 @@ -196,6 +196,7 @@ image-$(CONFIG_PPC_EP88XC)+= zImage.ep88xc
  image-$(CONFIG_EP405)+= zImage.ep405
  image-$(CONFIG_8260) += cuImage.pq2
  image-$(CONFIG_PPC_MPC52xx)  += cuImage.52xx
 +image-$(CONFIG_STORCENTER)   += cuImage.824x
  image-$(CONFIG_PPC_83xx) += cuImage.83xx
  image-$(CONFIG_PPC_85xx) += cuImage.85xx
  image-$(CONFIG_MPC7448HPC2)  += cuImage.hpc2
 diff --git a/arch/powerpc/boot/cuboot-824x.c b/arch/powerpc/boot/cuboot-824x.c
 new file mode 100644
 index 000..4aa3eee
 --- /dev/null
 +++ b/arch/powerpc/boot/cuboot-824x.c
 @@ -0,0 +1,52 @@
 +/*
 + * Old U-boot compatibility for 824x
 + *
 + * 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 ops.h
 +#include stdio.h
 +#include cuboot.h
 +
 +#define TARGET_824x
 +#include ppcboot.h
 +
 +static bd_t bd;
 +
 +static void platform_fixups(void)
 +{
 + void *soc;
 +
 + dt_fixup_memory(bd.bi_memstart, bd.bi_memsize);
 + dt_fixup_mac_addresses(bd.bi_enetaddr);
 + dt_fixup_cpu_clocks(bd.bi_intfreq, bd.bi_busfreq / 4, bd.bi_busfreq);
 +
 + soc = find_node_by_devtype(NULL, soc);
 + if (soc) {
 + void *serial = NULL;
 +
 + setprop(soc, bus-frequency, bd.bi_busfreq,
 + sizeof(bd.bi_busfreq));
 +
 + while ((serial = find_node_by_devtype(serial, serial))) {
 + if (get_parent(serial) != soc)
 + continue;
 +
 + setprop(serial, clock-frequency, bd.bi_busfreq,
 + sizeof(bd.bi_busfreq));
 + }
 + }
 +}
 +
 +void platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
 +   unsigned long r6, unsigned long r7)
 +{
 + CUBOOT_INIT();
 + fdt_init(_dtb_start);
 + serial_console_init();
 + platform_ops.fixups = platform_fixups;
 +}
 diff --git a/arch/powerpc/platforms/embedded6xx/Kconfig 
 b/arch/powerpc/platforms/embedded6xx/Kconfig
 index 8924095..be5cdd2 100644
 --- a/arch/powerpc/platforms/embedded6xx/Kconfig
 +++ b/arch/powerpc/platforms/embedded6xx/Kconfig
 @@ -16,6 +16,17 @@ config LINKSTATION
 Linkstation-I HD-HLAN and HD-HGLAN versions, and PPC-based
 Terastation systems should be supported too.
  
 +config STORCENTER
 + bool IOMEGA StorCenter
 + depends on EMBEDDED6xx
 + select MPIC
 + select FSL_SOC
 + select PPC_UDBG_16550 if SERIAL_8250
 + select WANT_DEVICE_TREE
 + help
 +   Select STORCENTER if configuring for the iomega StorCenter
 +   with an 8241 CPU in it.
 +
  config MPC7448HPC2
   bool Freescale MPC7448HPC2(Taiga)
   depends on EMBEDDED6xx
 @@ -56,7 +67,7 @@ config TSI108_BRIDGE
  
  config MPC10X_BRIDGE
   bool
 - depends on LINKSTATION
 + depends on LINKSTATION || STORCENTER
   select PPC_INDIRECT_PCI
   default y
  
 @@ -67,7 +78,7 @@ config MV64X60
  
  config MPC10X_OPENPIC
   bool
 - depends on LINKSTATION
 + depends on LINKSTATION || STORCENTER
 

Re: [RFC PATCH 2/3] Add initial iomega StorCenter board port.

2008-01-07 Thread Scott Wood
Jon Loeliger wrote:
 Can we take out the dependencies and the default y, and just select them 
 in the individual board configs?
 
 Yeah.  That and, shouldn't those choices be mutually
 exclusive in a choice arrangement instead too?

No, choice sucks for multiplatform.

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


[PATCH][POWERPC] Workaround for iommu page alignment

2008-01-07 Thread Benjamin Herrenschmidt
Our iommu page size is currently always 4K. That means with our current
code, drivers may do a dma_map_sg() of a 64K page and obtain a dma_addr_t
that is only 4K aligned.

This works fine in most cases except some infiniband HW it seems, where
they tell the HW about the page size and it ignores the low bits of the
DMA address.

This works around it by making our IOMMU code enforce a PAGE_SIZE alignment
for mappings of objects that are page aligned in the first place and whose
size is larger or equal to a page.

Signed-off-by: Benjamin Herrenschmidt [EMAIL PROTECTED]
---

Looks like it fell through the holiday cracks ... 

It could still go in 2.6.24 I suppose... If not, put it in 2.6.25 and
we'll backport to stable later.

Index: linux-work/arch/powerpc/kernel/iommu.c
===
--- linux-work.orig/arch/powerpc/kernel/iommu.c 2007-12-21 10:39:39.0 
+1100
+++ linux-work/arch/powerpc/kernel/iommu.c  2007-12-21 10:46:18.0 
+1100
@@ -278,6 +278,7 @@ int iommu_map_sg(struct iommu_table *tbl
unsigned long flags;
struct scatterlist *s, *outs, *segstart;
int outcount, incount, i;
+   unsigned int align;
unsigned long handle;
 
BUG_ON(direction == DMA_NONE);
@@ -309,7 +310,11 @@ int iommu_map_sg(struct iommu_table *tbl
/* Allocate iommu entries for that segment */
vaddr = (unsigned long) sg_virt(s);
npages = iommu_num_pages(vaddr, slen);
-   entry = iommu_range_alloc(tbl, npages, handle, mask  
IOMMU_PAGE_SHIFT, 0);
+   align = 0;
+   if (IOMMU_PAGE_SHIFT  PAGE_SHIFT  (vaddr  ~PAGE_MASK) == 0)
+   align = PAGE_SHIFT - IOMMU_PAGE_SHIFT;
+   entry = iommu_range_alloc(tbl, npages, handle,
+ mask  IOMMU_PAGE_SHIFT, align);
 
DBG(  - vaddr: %lx, size: %lx\n, vaddr, slen);
 
@@ -572,7 +577,7 @@ dma_addr_t iommu_map_single(struct iommu
 {
dma_addr_t dma_handle = DMA_ERROR_CODE;
unsigned long uaddr;
-   unsigned int npages;
+   unsigned int npages, align;
 
BUG_ON(direction == DMA_NONE);
 
@@ -580,8 +585,13 @@ dma_addr_t iommu_map_single(struct iommu
npages = iommu_num_pages(uaddr, size);
 
if (tbl) {
+   align = 0;
+   if (IOMMU_PAGE_SHIFT  PAGE_SHIFT 
+   ((unsigned long)vaddr  ~PAGE_MASK) == 0)
+   align = PAGE_SHIFT - IOMMU_PAGE_SHIFT;
+
dma_handle = iommu_alloc(tbl, vaddr, npages, direction,
-mask  IOMMU_PAGE_SHIFT, 0);
+mask  IOMMU_PAGE_SHIFT, align);
if (dma_handle == DMA_ERROR_CODE) {
if (printk_ratelimit())  {
printk(KERN_INFO iommu_alloc failed, 


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


Re: [PATCH][POWERPC] Workaround for iommu page alignment

2008-01-07 Thread Olof Johansson
On Tue, Jan 08, 2008 at 08:45:59AM +1100, Benjamin Herrenschmidt wrote:
 Our iommu page size is currently always 4K. That means with our current
 code, drivers may do a dma_map_sg() of a 64K page and obtain a dma_addr_t
 that is only 4K aligned.
 
 This works fine in most cases except some infiniband HW it seems, where
 they tell the HW about the page size and it ignores the low bits of the
 DMA address.
 
 This works around it by making our IOMMU code enforce a PAGE_SIZE alignment
 for mappings of objects that are page aligned in the first place and whose
 size is larger or equal to a page.
 
 Signed-off-by: Benjamin Herrenschmidt [EMAIL PROTECTED]

Acked-by: Olof Johansson [EMAIL PROTECTED]


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


[PATCH v6] qe: add ability to upload QE firmware

2008-01-07 Thread Timur Tabi
Define the layout of a binary blob that contains a QE firmware and instructions
on how to upload it.  Add function qe_upload_firmware() to parse the blob
and perform the actual upload.  Fully define 'struct rsp' in immap_qe.h to
include the actual RISC Special Registers.  Added description of a new
QE firmware node to booting-without-of.txt.

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

Updated w.r.t. comments from Anton V.

This patch is for Kumar's for-2.6.25 branch.  This code is necessary for
my QE UART driver.

 Documentation/powerpc/00-INDEX   |3 +
 Documentation/powerpc/booting-without-of.txt |   33 +++-
 Documentation/powerpc/qe_firmware.txt|  295 ++
 arch/powerpc/platforms/Kconfig   |1 +
 arch/powerpc/sysdev/qe_lib/qe.c  |  248 ++
 include/asm-powerpc/immap_qe.h   |   34 +++-
 include/asm-powerpc/qe.h |   61 ++
 7 files changed, 671 insertions(+), 4 deletions(-)
 create mode 100644 Documentation/powerpc/qe_firmware.txt

diff --git a/Documentation/powerpc/00-INDEX b/Documentation/powerpc/00-INDEX
index 94a3c57..3be84aa 100644
--- a/Documentation/powerpc/00-INDEX
+++ b/Documentation/powerpc/00-INDEX
@@ -28,3 +28,6 @@ sound.txt
- info on sound support under Linux/PPC
 zImage_layout.txt
- info on the kernel images for Linux/PPC
+qe_firmware.txt
+   - describes the layout of firmware binaries for the Freescale QUICC
+ Engine and the code that parses and uploads the microcode therein.
diff --git a/Documentation/powerpc/booting-without-of.txt 
b/Documentation/powerpc/booting-without-of.txt
index e9a3cb1..26d485f 100644
--- a/Documentation/powerpc/booting-without-of.txt
+++ b/Documentation/powerpc/booting-without-of.txt
@@ -52,7 +52,10 @@ Table of Contents
   i) Freescale QUICC Engine module (QE)
   j) CFI or JEDEC memory-mapped NOR flash
   k) Global Utilities Block
-  l) Xilinx IP cores
+  l) Freescale Communications Processor Module
+  m) Chipselect/Local Bus
+  n) 4xx/Axon EMAC ethernet nodes
+  o) Xilinx IP cores
 
   VII - Specifying interrupt information for devices
 1) interrupts property
@@ -1772,6 +1775,32 @@ platforms are moved over to use the 
flattened-device-tree model.
};
};
 
+   viii) Uploaded QE firmware
+
+If a new firwmare has been uploaded to the QE (usually by the
+boot loader), then a 'firmware' child node should be added to the QE
+node.  This node provides information on the uploaded firmware that
+device drivers may need.
+
+Required properties:
+- id: The string name of the firmware.  This is taken from the 'id'
+  member of the qe_firmware structure of the uploaded firmware.
+  Device drivers can search this string to determine if the
+  firmware they want is already present.
+- extended-modes: The Extended Modes bitfield, taken from the
+  firmware binary.  It is a 64-bit number represented
+  as an array of two 32-bit numbers.
+- virtual-traps: The virtual traps, taken from the firmware binary.
+ It is an array of 8 32-bit numbers.
+
+Example:
+
+   firmware {
+   id = Soft-UART;
+   extended-modes = 0 0;
+   virtual-traps = 0 0 0 0 0 0 0 0;
+   }
+
j) CFI or JEDEC memory-mapped NOR flash
 
 Flash chips (Memory Technology Devices) are often used for solid state
@@ -2254,7 +2283,7 @@ platforms are moved over to use the flattened-device-tree 
model.
   available.
   For Axon: 0x012a
 
-   l) Xilinx IP cores
+   o) Xilinx IP cores
 
The Xilinx EDK toolchain ships with a set of IP cores (devices) for use
in Xilinx Spartan and Virtex FPGAs.  The devices cover the whole range
diff --git a/Documentation/powerpc/qe_firmware.txt 
b/Documentation/powerpc/qe_firmware.txt
new file mode 100644
index 000..8962664
--- /dev/null
+++ b/Documentation/powerpc/qe_firmware.txt
@@ -0,0 +1,295 @@
+  Freescale QUICC Engine Firmware Uploading
+  -
+
+(c) 2007 Timur Tabi timur at freescale.com,
+Freescale Semiconductor
+
+Table of Contents
+=
+
+  I - Software License for Firmware
+
+  II - Microcode Availability
+
+  III - Description and Terminology
+
+  IV - Microcode Programming Details
+
+  V - Firmware Structure Layout
+
+  VI - Sample Code for Creating Firmware Files
+
+Revision Information
+
+
+November 30, 2007: Rev 1.0 - Initial version
+
+I - Software License for Firmware
+=
+
+Each firmware file comes with its own software license.  For information on
+the particular license, please see the license text that is 

Re: [PATCH 1/3] sbc8548: Add basic support for Wind River SBC8548 as powerpc

2008-01-07 Thread Paul Gortmaker
Kumar Gala wrote:

 On Dec 21, 2007, at 12:43 AM, Paul Gortmaker wrote:

 This adds the basic support for the Wind River SBC8548 board, 
 implemented
 as powerpc.  It closely follows the implementation of the MPC8548CDS.



[...]

 +#ifdef CONFIG_PCI
 +static int sbc8548_exclude_device(struct pci_controller *hose,
 +  u_char bus, u_char devfn)
 +{
 +if (bus == 0  PCI_SLOT(devfn) == 0)
 +return PCIBIOS_DEVICE_NOT_FOUND;
 +else
 +return PCIBIOS_SUCCESSFUL;
 +}
 +#endif

 see comment on the 8560 support, but I don't think you need to exclude 
 the PHBs anymore.  I've fixed this so we have a general quick for FSL 
 PHBs.


Right.  I wanted to also test on the 8548, since I can't really plug 
anything
into my 8560, and on the 8548, the PCI behaviour is unaltered by
clobbering these.  I'll send a patch removing it from both of the
sbc85xx boards in a bit.

Aside from this, and the 8548 dts-v1 conversion (already sent), I don't
think there were any other to-fix items for the sbc8548, so I won't
spam everyone with those 8548 patches again unless you need me to
rebase them or similar.

Thanks,
Paul.


 - k

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


[PATCH] sbc85xx: remove PCI exclude device for sbc8548/sbc8560

2008-01-07 Thread Paul Gortmaker
The PCI exclude device for the sbc85xx boards was only filtering out
the PHB and nothing else.  This functionality is no longer required
at a board specific level -- it is handled as a more global quirk now.

Signed-off-by: Paul Gortmaker [EMAIL PROTECTED]
---
 arch/powerpc/platforms/85xx/sbc8548.c |   13 -
 arch/powerpc/platforms/85xx/sbc8560.c |   13 -
 2 files changed, 0 insertions(+), 26 deletions(-)

diff --git a/arch/powerpc/platforms/85xx/sbc8548.c 
b/arch/powerpc/platforms/85xx/sbc8548.c
index f3ab271..de27b57 100644
--- a/arch/powerpc/platforms/85xx/sbc8548.c
+++ b/arch/powerpc/platforms/85xx/sbc8548.c
@@ -49,17 +49,6 @@
 #include sysdev/fsl_soc.h
 #include sysdev/fsl_pci.h
 
-#ifdef CONFIG_PCI
-static int sbc8548_exclude_device(struct pci_controller *hose,
- u_char bus, u_char devfn)
-{
-   if (bus == 0  PCI_SLOT(devfn) == 0)
-   return PCIBIOS_DEVICE_NOT_FOUND;
-   else
-   return PCIBIOS_SUCCESSFUL;
-}
-#endif
-
 static void __init sbc8548_pic_init(void)
 {
struct mpic *mpic;
@@ -114,8 +103,6 @@ static void __init sbc8548_setup_arch(void)
fsl_add_bridge(np, 0);
}
}
-
-   ppc_md.pci_exclude_device = sbc8548_exclude_device;
 #endif
 }
 
diff --git a/arch/powerpc/platforms/85xx/sbc8560.c 
b/arch/powerpc/platforms/85xx/sbc8560.c
index 6aef38b..2030e87 100644
--- a/arch/powerpc/platforms/85xx/sbc8560.c
+++ b/arch/powerpc/platforms/85xx/sbc8560.c
@@ -37,17 +37,6 @@
 #include sysdev/cpm2_pic.h
 #endif
 
-#ifdef CONFIG_PCI
-static int sbc8560_exclude_device(struct pci_controller *hose,
-  u_char bus, u_char devfn)
-{
-   if (bus == 0  PCI_SLOT(devfn) == 0)
-   return PCIBIOS_DEVICE_NOT_FOUND;
-   else
-   return PCIBIOS_SUCCESSFUL;
-}
-#endif /* CONFIG_PCI */
-
 #ifdef CONFIG_CPM2
 
 static void cpm2_cascade(unsigned int irq, struct irq_desc *desc)
@@ -199,8 +188,6 @@ static void __init sbc8560_setup_arch(void)
 #ifdef CONFIG_PCI
for_each_compatible_node(np, pci, fsl,mpc8540-pci)
fsl_add_bridge(np, 1);
-
-   ppc_md.pci_exclude_device = sbc8560_exclude_device;
 #endif
 }
 
-- 
1.5.0.rc1.gf4b6c

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


Re: [PATCH][POWERPC] Workaround for iommu page alignment

2008-01-07 Thread Michael Ellerman
On Tue, 2008-01-08 at 08:45 +1100, Benjamin Herrenschmidt wrote:
 Our iommu page size is currently always 4K. That means with our current
 code, drivers may do a dma_map_sg() of a 64K page and obtain a dma_addr_t
 that is only 4K aligned.
 
 This works fine in most cases except some infiniband HW it seems, where
 they tell the HW about the page size and it ignores the low bits of the
 DMA address.
 
 This works around it by making our IOMMU code enforce a PAGE_SIZE alignment
 for mappings of objects that are page aligned in the first place and whose
 size is larger or equal to a page.
  ^

I don't see in the code where you implement the size  PAGE_SIZE
condition. But I only just got back from holidays .. :)

cheers

-- 
Michael Ellerman
OzLabs, IBM Australia Development Lab

wwweb: http://michael.ellerman.id.au
phone: +61 2 6212 1183 (tie line 70 21183)

We do not inherit the earth from our ancestors,
we borrow it from our children. - S.M.A.R.T Person


signature.asc
Description: This is a digitally signed message part
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev

Re: [PATCH 2/3] add MPC837x USB platform support

2008-01-07 Thread Stephen Rothwell
Hi,

Just a couple of comments.

On Mon,  7 Jan 2008 20:03:19 +0800 Li Yang [EMAIL PROTECTED] wrote:

 +static int mpc837xmds_usb_cfg(void)
 +{

 + np = of_find_node_by_name(NULL, usb);
 + phy_type = of_get_property(np, phy_type, NULL);

No check for np being NULL

 + if (phy_type  !strcmp(phy_type, ulpi)) {
 + clrbits8(bcsr_regs + 12, BCSR12_USB_SER_PIN);
 + } else if (phy_type  !strcmp(phy_type, serial)) {
 + mode = of_get_property(np, dr_mode, NULL);
 + bcsr12 = in_8(bcsr_regs + 12)  ~BCSR12_USB_SER_MASK;
 + bcsr12 |= BCSR12_USB_SER_PIN;
 + if (mode  !strcmp(mode, peripheral))
 + bcsr12 |= BCSR12_USB_SER_DEVICE;
 + out_8(bcsr_regs + 12, bcsr12);
 + } else {
 + printk(KERN_ERR USB DR: unsupported PHY\n);
 + }
 +
 + iounmap(bcsr_regs);
 + return 0;

No of_node_put(np)

 +#ifdef CONFIG_PPC_MPC837x
 +int mpc837x_usb_cfg(void)
 +{

 + np = of_find_compatible_node(NULL, usb, fsl-usb2-dr);
 + if (!np)
 + return -ENODEV;
 + prop = of_get_property(np, phy_type, NULL);
 +
 + if (strcmp(prop, ulpi)  strcmp(prop, serial)) {

No check for prop being NULL.

 + printk(KERN_WARNING 837x USB PHY type not supported\n);
 + return -EINVAL;

No of_node_put(np)

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


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

Re: [PATCH 3/3] USB device tree cleanups

2008-01-07 Thread Stephen Rothwell
On Mon,  7 Jan 2008 20:03:20 +0800 Li Yang [EMAIL PROTECTED] wrote:

 +++ b/arch/powerpc/sysdev/fsl_soc.c
 @@ -533,9 +533,7 @@ static int __init fsl_usb_of_init(void)
   *usb_dev_dr_client = NULL;
   int ret;
  
 - for (np = NULL, i = 0;
 -  (np = of_find_compatible_node(np, usb, fsl-usb2-mph)) != NULL;
 -  i++) {
 + for_each_compatible_node(np, NULL, fsl-usb2-mph) {

'i' is no longer being updated (or indeed set to anything) but is still
used in the loop - at least in Paulus' current tree).

   struct resource r[2];
   struct fsl_usb2_platform_data usb_data;
   const unsigned char *prop = NULL;
 @@ -580,9 +578,7 @@ static int __init fsl_usb_of_init(void)
   goto unreg_mph;
   }
  
 - for (np = NULL;
 -  (np = of_find_compatible_node(np, usb, fsl-usb2-dr)) != NULL;
 -  i++) {
 + for_each_compatible_node(np, NULL, fsl-usb2-dr) {

Same here.

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


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

Re: [PATCH][POWERPC] Workaround for iommu page alignment

2008-01-07 Thread Benjamin Herrenschmidt

 I don't see in the code where you implement the size  PAGE_SIZE
 condition. But I only just got back from holidays .. :)

Indeed ... a quilt ref was missing :-(

New patch coming ...

Ben.


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


[PATCH][POWERPC] Workaround for iommu page alignment (#2)

2008-01-07 Thread Benjamin Herrenschmidt
powerpc: Workaround for iommu page alignment

Our iommu page size is currently always 4K. That means with our current
code, drivers may do a dma_map_sg() of a 64K page and obtain a dma_addr_t
that is only 4K aligned.

This works fine in most cases except some infiniband HW it seems, where
they tell the HW about the page size and it ignores the low bits of the
DMA address.

This works around it by making our IOMMU code enforce a PAGE_SIZE alignment
for mappings of objects that are page aligned in the first place and whose
size is larger or equal to a page.

Signed-off-by: Benjamin Herrenschmidt [EMAIL PROTECTED]
---

And this version actually does what the comment says (I had forgotten
to quilt ref... a common mistake).

Index: linux-work/arch/powerpc/kernel/iommu.c
===
--- linux-work.orig/arch/powerpc/kernel/iommu.c 2007-12-21 10:39:39.0 
+1100
+++ linux-work/arch/powerpc/kernel/iommu.c  2007-12-21 10:48:12.0 
+1100
@@ -278,6 +278,7 @@ int iommu_map_sg(struct iommu_table *tbl
unsigned long flags;
struct scatterlist *s, *outs, *segstart;
int outcount, incount, i;
+   unsigned int align;
unsigned long handle;
 
BUG_ON(direction == DMA_NONE);
@@ -309,7 +310,12 @@ int iommu_map_sg(struct iommu_table *tbl
/* Allocate iommu entries for that segment */
vaddr = (unsigned long) sg_virt(s);
npages = iommu_num_pages(vaddr, slen);
-   entry = iommu_range_alloc(tbl, npages, handle, mask  
IOMMU_PAGE_SHIFT, 0);
+   align = 0;
+   if (IOMMU_PAGE_SHIFT  PAGE_SHIFT  slen = PAGE_SIZE 
+   (vaddr  ~PAGE_MASK) == 0)
+   align = PAGE_SHIFT - IOMMU_PAGE_SHIFT;
+   entry = iommu_range_alloc(tbl, npages, handle,
+ mask  IOMMU_PAGE_SHIFT, align);
 
DBG(  - vaddr: %lx, size: %lx\n, vaddr, slen);
 
@@ -572,7 +578,7 @@ dma_addr_t iommu_map_single(struct iommu
 {
dma_addr_t dma_handle = DMA_ERROR_CODE;
unsigned long uaddr;
-   unsigned int npages;
+   unsigned int npages, align;
 
BUG_ON(direction == DMA_NONE);
 
@@ -580,8 +586,13 @@ dma_addr_t iommu_map_single(struct iommu
npages = iommu_num_pages(uaddr, size);
 
if (tbl) {
+   align = 0;
+   if (IOMMU_PAGE_SHIFT  PAGE_SHIFT  size = PAGE_SIZE 
+   ((unsigned long)vaddr  ~PAGE_MASK) == 0)
+   align = PAGE_SHIFT - IOMMU_PAGE_SHIFT;
+
dma_handle = iommu_alloc(tbl, vaddr, npages, direction,
-mask  IOMMU_PAGE_SHIFT, 0);
+mask  IOMMU_PAGE_SHIFT, align);
if (dma_handle == DMA_ERROR_CODE) {
if (printk_ratelimit())  {
printk(KERN_INFO iommu_alloc failed, 


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


[PATCH v3] ucc_uart: add support for Freescale QUICCEngine UART

2008-01-07 Thread Timur Tabi
Add support for UART serial ports using a Freescale QUICC Engine
(found on some MPC83xx and MPC85xx SOCs).

Updated booting-without-of.txt to define new properties for a QE UART node,
and a new node definition that describes uploaded QE firmware.

Because of a silicon bug in some QE-enabled SOCs (e.g. 8323 and 8360), a new
microcode is required. This microcode implements UART via a work-around,
hence it's called Soft-UART.  This driver can use the QE firmware upload
feature to upload the correct microcode to the QE.

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

Updated w.r.t. comments from Anton V.

This patch is for Kumar's for-2.6.25 branch, and it applies on top of my
previous patches, qe: add ability to upload QE firmware and
qe: add function qe_clock_source().

 Documentation/powerpc/booting-without-of.txt |9 +-
 arch/powerpc/boot/dts/mpc832x_mds.dts|   50 +
 arch/powerpc/sysdev/qe_lib/Kconfig   |2 +-
 arch/powerpc/sysdev/qe_lib/ucc_slow.c|   10 +-
 drivers/serial/Kconfig   |   10 +
 drivers/serial/Makefile  |1 +
 drivers/serial/ucc_uart.c| 1507 ++
 7 files changed, 1586 insertions(+), 3 deletions(-)
 create mode 100644 drivers/serial/ucc_uart.c

diff --git a/Documentation/powerpc/booting-without-of.txt 
b/Documentation/powerpc/booting-without-of.txt
index 00fd333..9de0a97 100644
--- a/Documentation/powerpc/booting-without-of.txt
+++ b/Documentation/powerpc/booting-without-of.txt
@@ -1616,7 +1616,7 @@ platforms are moved over to use the flattened-device-tree 
model.
 
Required properties:
- device_type : should be network, hldc, uart, transparent
-bisync or atm.
+ bisync, atm, or serial.
- compatible : could be ucc_geth or fsl_atm and so on.
- model : should be UCC.
- device-id : the ucc number(1-8), corresponding to UCCx in UM.
@@ -1629,6 +1629,13 @@ platforms are moved over to use the 
flattened-device-tree model.
- interrupt-parent : the phandle for the interrupt controller that
  services interrupts for this device.
- pio-handle : The phandle for the Parallel I/O port configuration.
+   - port-number : for UART drivers, the port number to use, between 0 and 3.
+ This usually corresponds to the /dev/ttyQE device, e.g. 0 = /dev/ttyQE0.
+ The port number is added to the minor number of the device.  Unlike the
+ CPM UART driver, the port-number is required for the QE UART driver.
+   - soft-uart : for UART drivers, if specified this means the QE UART device
+ driver should use Soft-UART mode, which is needed on some SOCs that have
+ broken UART hardware.  Soft-UART is provided via a microcode upload.
- rx-clock-name: the UCC receive clock source
  none: clock source is disabled
  brg1 through brg16: clock source is BRG1-BRG16, respectively
diff --git a/arch/powerpc/boot/dts/mpc832x_mds.dts 
b/arch/powerpc/boot/dts/mpc832x_mds.dts
index fe54489..2d2439b 100644
--- a/arch/powerpc/boot/dts/mpc832x_mds.dts
+++ b/arch/powerpc/boot/dts/mpc832x_mds.dts
@@ -7,6 +7,18 @@
  * 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.
+
+ * To enable external serial I/O on a Freescale MPC 8323 SYS/MDS board, do
+ * this:
+ *
+ * 1) On chip U61, lift (disconnect) pins 21 (TXD) and 22 (RXD) from the board.
+ * 2) Solder a wire from U61-21 to P19A-23.  P19 is a grid of pins on the board
+ *next to the serial ports.
+ * 3) Solder a wire from U61-22 to P19K-22.
+ *
+ * Note that there's a typo in the schematic.  The board labels the last column
+ * of pins P19K, but in the schematic, that column is called P19J.  So if
+ * you're going by the schematic, the pin is called P19J-K22.
  */
 
 / {
@@ -159,6 +171,23 @@
1 1e  1  0  1  0/* TX_EN */
1 1f  2  0  1  0;/* CRS */
};
+   pio5: [EMAIL PROTECTED] {
+   pio-map = 
+   /*
+*open   has
+*   port  pin  dir  drain  sel  irq
+*/
+   201  020  /* TxD5 */
+   282  020  /* RxD5 */
+
+   2   1d2  000  /* CTS5 */
+   2   1f1  020  /* RTS5 */
+
+   2   182  000  /* CD */
+
+   ;
+   };
+
};
};
 
@@ -166,6 +195,7 @@
#address-cells = 1;
#size-cells = 1;
device_type = qe;
+  

[PATCH 0/8] pseries: phyp dump: hypervisor-assisted dump

2008-01-07 Thread Manish Ahuja
The following series of patches implement a basic framework
for hypervisor-assisted dump. The very first patch provides 
documentation explaining what this is  :-) . Yes, its supposed
to be an improvement over kdump.

The patches mostly work; a list of open issues / todo list
is included in the documentation.  It also appears that 
the not-yet-released firmware versions this was tested 
on are still, ahem, incomplete; this work is also pending.

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


[PATCH 1/8] pseries: phyp dump: Docmentation

2008-01-07 Thread Manish Ahuja

Basic documentation for hypervisor-assisted dump.

Signed-off-by: Linas Vepstas [EMAIL PROTECTED]
Signed-off-by: Manish Ahuja [EMAIL PROTECTED]


 Documentation/powerpc/phyp-assisted-dump.txt |  129 +++
 1 file changed, 129 insertions(+)

Index: 2.6.24-rc5/Documentation/powerpc/phyp-assisted-dump.txt
===
--- /dev/null   1970-01-01 00:00:00.0 +
+++ 2.6.24-rc5/Documentation/powerpc/phyp-assisted-dump.txt 2008-01-07 
18:05:46.0 -0600
@@ -0,0 +1,129 @@
+
+   Hypervisor-Assisted Dump
+   
+   November 2007
+
+The goal of hypervisor-assisted dump is to enable the dump of
+a crashed system, and to do so from a fully-reset system, and
+to minimize the total elapsed time until the system is back
+in production use.
+
+As compared to kdump or other strategies, hypervisor-assisted
+dump offers several strong, practical advantages:
+
+-- Unlike kdump, the system has been reset, and loaded
+   with a fresh copy of the kernel.  In particular,
+   PCI and I/O devices have been reinitialized and are
+   in a clean, consistent state.
+-- As the dump is performed, the dumped memory becomes
+   immediately available to the system for normal use.
+-- After the dump is completed, no further reboots are
+   required; the system will be fully usable, and running
+   in it's normal, production mode on it normal kernel.
+
+The above can only be accomplished by coordination with,
+and assistance from the hypervisor. The procedure is
+as follows:
+
+-- When a system crashes, the hypervisor will save
+   the low 256MB of RAM to a previously registered
+   save region. It will also save system state, system
+   registers, and hardware PTE's.
+
+-- After the low 256MB area has been saved, the
+   hypervisor will reset PCI and other hardware state.
+   It will *not* clear RAM. It will then launch the
+   bootloader, as normal.
+
+-- The freshly booted kernel will notice that there
+   is a new node (ibm,dump-kernel) in the device tree,
+   indicating that there is crash data available from
+   a previous boot. It will boot into only 256MB of RAM,
+   reserving the rest of system memory.
+
+-- Userspace tools will parse /sys/kernel/release_region
+   and read /proc/vmcore to obtain the contents of memory,
+   which holds the previous crashed kernel. The userspace
+   tools may copy this info to disk, or network, nas, san,
+   iscsi, etc. as desired.
+
+   For Example: the values in /sys/kernel/release-region
+   would look something like this (address-range pairs).
+   CPU:0x177fee000-0x1: HPTE:0x177ffe020-0x1000: /
+   DUMP:0x177fff020-0x1000, 0x1000-0x16F1D370A
+
+-- As the userspace tools complete saving a portion of
+   dump, they echo an offset and size to
+   /sys/kernel/release_region to release the reserved
+   memory back to general use.
+
+   An example of this is:
+ echo 0x4000 0x1000  /sys/kernel/release_region
+   which will release 256MB at the 1GB boundary.
+
+Please note that the hypervisor-assisted dump feature
+is only available on Power6-based systems with recent
+firmware versions.
+
+Implementation details:
+--
+In order for this scheme to work, memory needs to be reserved
+quite early in the boot cycle. However, access to the device
+tree this early in the boot cycle is difficult, and device-tree
+access is needed to determine if there is a crash data waiting.
+To work around this problem, all but 256MB of RAM is reserved
+during early boot. A short while later in boot, a check is made
+to determine if there is dump data waiting. If there isn't,
+then the reserved memory is released to general kernel use.
+If there is dump data, then the /sys/kernel/release_region
+file is created, and the reserved memory is held.
+
+If there is no waiting dump data, then all but 256MB of the
+reserved ram will be released for general kernel use. The
+highest 256 MB of RAM will *not* be released: this region
+will be kept permanently reserved, so that it can act as
+a receptacle for a copy of the low 256MB in the case a crash
+does occur. See, however, open issues below, as to whether
+such a reserved region is really needed.
+
+Currently the dump will be copied from /proc/vmcore to a
+a new file upon user intervention. The starting address
+to be read and the range for each data point in provided
+in /sys/kernel/release_region.
+
+The tools to examine the dump will be same as the ones
+used for kdump.
+
+
+General notes:
+--
+Security: please note that there are potential security issues
+with any sort of dump mechanism. In particular, plaintext
+(unencrypted) data, and possibly passwords, may be present in
+the dump data. Userspace tools must take adequate precautions to
+preserve security.
+
+Open issues/ToDo:
+
+ o The various code paths that tell the hypervisor that a 

[PATCH 2/8] pseries: phyp dump: config file

2008-01-07 Thread Manish Ahuja

Add hypervisor-assisted dump to kernel config

Signed-off-by: Linas Vepstas [EMAIL PROTECTED]

-
 arch/powerpc/Kconfig |   11 +++
 1 file changed, 11 insertions(+)

Index: linux-2.6.24-rc2-git4/arch/powerpc/Kconfig
===
--- linux-2.6.24-rc2-git4.orig/arch/powerpc/Kconfig 2007-11-14 
16:39:20.0 -0600
+++ linux-2.6.24-rc2-git4/arch/powerpc/Kconfig  2007-11-15 14:27:33.0 
-0600
@@ -261,6 +261,17 @@ config CRASH_DUMP
 
  Don't change this unless you know what you are doing.
 
+config PHYP_DUMP
+   bool Hypervisor-assisted dump (EXPERIMENTAL)
+   depends on PPC_PSERIES  EXPERIMENTAL
+   default y
+   help
+ Hypervisor-assisted dump is meant to be a kdump replacement
+ offering robustness and speed not possible without system
+ hypervisor assistence.
+
+ If unsure, say Y
+
 config PPCBUG_NVRAM
bool Enable reading PPCBUG NVRAM during boot if PPLUS || LOPEC
default y if PPC_PREP
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH 3/8] pseries: phyp dump: reserve-release proof-of-concept

2008-01-07 Thread Manish Ahuja

Initial patch for reserving memory in early boot, and freeing it later.
If the previous boot had ended with a crash, the reserved memory would contain
a copy of the crashed kernel data.

Signed-off-by: Manish Ahuja [EMAIL PROTECTED]
Signed-off-by: Linas Vepstas [EMAIL PROTECTED]


 arch/powerpc/kernel/prom.c |   33 +
 arch/powerpc/platforms/pseries/Makefile|1 
 arch/powerpc/platforms/pseries/phyp_dump.c |   71 +
 include/asm-powerpc/phyp_dump.h|   32 +
 4 files changed, 137 insertions(+)

Index: linux-2.6.24-rc2-git4/include/asm-powerpc/phyp_dump.h
===
--- /dev/null   1970-01-01 00:00:00.0 +
+++ linux-2.6.24-rc2-git4/include/asm-powerpc/phyp_dump.h   2007-11-19 
17:44:21.0 -0600
@@ -0,0 +1,32 @@
+/*
+ * Hypervisor-assisted dump
+ *
+ * Linas Vepstas, Manish Ahuja 2007
+ * Copyright (c) 2007 IBM Corp.
+ *
+ *  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.
+ */
+
+#ifndef _PPC64_PHYP_DUMP_H
+#define _PPC64_PHYP_DUMP_H
+
+#ifdef CONFIG_PHYP_DUMP
+
+/* The RMR region will be saved for later dumping
+ * whenever the kernel crashes. Set this to 256MB. */
+#define PHYP_DUMP_RMR_START 0x0
+#define PHYP_DUMP_RMR_END   (1UL28)
+
+struct phyp_dump {
+   /* Memory that is reserved during very early boot. */
+   unsigned long init_reserve_start;
+   unsigned long init_reserve_size;
+};
+
+extern struct phyp_dump *phyp_dump_info;
+
+#endif /* CONFIG_PHYP_DUMP */
+#endif /* _PPC64_PHYP_DUMP_H */
Index: linux-2.6.24-rc2-git4/arch/powerpc/platforms/pseries/phyp_dump.c
===
--- /dev/null   1970-01-01 00:00:00.0 +
+++ linux-2.6.24-rc2-git4/arch/powerpc/platforms/pseries/phyp_dump.c
2007-11-19 19:07:49.0 -0600
@@ -0,0 +1,71 @@
+/*
+ * Hypervisor-assisted dump
+ *
+ * Linas Vepstas, Manish Ahuja 2007
+ * Copyrhgit (c) 2007 IBM Corp.
+ *
+ *  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 linux/init.h
+#include linux/mm.h
+#include linux/pfn.h
+#include linux/swap.h
+
+#include asm/page.h
+#include asm/phyp_dump.h
+
+/* Global, used to communicate data between early boot and late boot */
+static struct phyp_dump phyp_dump_global;
+struct phyp_dump *phyp_dump_info = phyp_dump_global;
+
+/**
+ * release_memory_range -- release memory previously lmb_reserved
+ * @start_pfn: starting physical frame number
+ * @nr_pages: number of pages to free.
+ *
+ * This routine will release memory that had been previously
+ * lmb_reserved in early boot. The released memory becomes
+ * available for genreal use.
+ */
+static void
+release_memory_range(unsigned long start_pfn, unsigned long nr_pages)
+{
+   struct page *rpage;
+   unsigned long end_pfn;
+   long i;
+
+   end_pfn = start_pfn + nr_pages;
+
+   for (i=start_pfn; i = end_pfn; i++) {
+   rpage = pfn_to_page(i);
+   if (PageReserved(rpage)) {
+   ClearPageReserved(rpage);
+   init_page_count(rpage);
+   __free_page(rpage);
+   totalram_pages++;
+   }
+   }
+}
+
+static int __init phyp_dump_setup(void)
+{
+   unsigned long start_pfn, nr_pages;
+
+   /* If no memory was reserved in early boot, there is nothing to do */
+   if (phyp_dump_info-init_reserve_size == 0)
+   return 0;
+
+   /* Release memory that was reserved in early boot */
+   start_pfn = PFN_DOWN(phyp_dump_info-init_reserve_start);
+   nr_pages = PFN_DOWN(phyp_dump_info-init_reserve_size);
+   release_memory_range(start_pfn, nr_pages);
+
+   return 0;
+}
+
+subsys_initcall(phyp_dump_setup);
Index: linux-2.6.24-rc2-git4/arch/powerpc/platforms/pseries/Makefile
===
--- linux-2.6.24-rc2-git4.orig/arch/powerpc/platforms/pseries/Makefile  
2007-11-19 17:43:52.0 -0600
+++ linux-2.6.24-rc2-git4/arch/powerpc/platforms/pseries/Makefile   
2007-11-19 17:44:21.0 -0600
@@ -18,3 +18,4 @@ obj-$(CONFIG_HOTPLUG_CPU) += hotplug-cpu
 obj-$(CONFIG_HVC_CONSOLE)  += hvconsole.o
 obj-$(CONFIG_HVCS) += hvcserver.o
 obj-$(CONFIG_HCALL_STATS)  += hvCall_inst.o
+obj-$(CONFIG_PHYP_DUMP)+= phyp_dump.o
Index: linux-2.6.24-rc2-git4/arch/powerpc/kernel/prom.c

[PATCH 4/8] pseries: phyp dump: use sysfs to release reserved mem

2008-01-07 Thread Manish Ahuja

Check to see if there actually is data from a previously
crashed kernel waiting. If so, Allow user-sapce tools to
grab the data (by reading /proc/kcore). When user-space 
finishes dumping a section, it must release that memory
by writing to sysfs. For example,

  echo 0x4000 0x1000  /sys/kernel/release_region

will release 256MB starting at the 1GB.  The released memory
becomes free for general use.

Signed-off-by: Linas Vepstas [EMAIL PROTECTED]

--
 arch/powerpc/platforms/pseries/phyp_dump.c |  101 +++--
 1 file changed, 96 insertions(+), 5 deletions(-)

Index: linux-2.6.24-rc3-git1/arch/powerpc/platforms/pseries/phyp_dump.c
===
--- linux-2.6.24-rc3-git1.orig/arch/powerpc/platforms/pseries/phyp_dump.c   
2007-11-21 13:15:05.0 -0600
+++ linux-2.6.24-rc3-git1/arch/powerpc/platforms/pseries/phyp_dump.c
2007-11-21 13:24:30.0 -0600
@@ -12,17 +12,24 @@
  */
 
 #include linux/init.h
+#include linux/kobject.h
 #include linux/mm.h
+#include linux/of.h
 #include linux/pfn.h
 #include linux/swap.h
+#include linux/sysfs.h
 
 #include asm/page.h
 #include asm/phyp_dump.h
+#include asm/rtas.h
 
 /* Global, used to communicate data between early boot and late boot */
 static struct phyp_dump phyp_dump_global;
 struct phyp_dump *phyp_dump_info = phyp_dump_global;
 
+static int ibm_configure_kernel_dump;
+
+/* - */
 /**
  * release_memory_range -- release memory previously lmb_reserved
  * @start_pfn: starting physical frame number
@@ -52,18 +59,102 @@ release_memory_range(unsigned long start
}
 }
 
-static int __init phyp_dump_setup(void)
+/* - */
+/**
+ * sysfs_release_region -- sysfs interface to release memory range.
+ *
+ * Usage:
+ *   echo start addr length  /sys/kernel/release_region
+ *
+ * Example:
+ *   echo 0x4000 0x1000  /sys/kernel/release_region
+ *
+ * will release 256MB starting at 1GB.
+ */
+static ssize_t
+store_release_region(struct kset *kset, const char *buf, size_t count)
 {
+   unsigned long start_addr, length, end_addr;
unsigned long start_pfn, nr_pages;
+   ssize_t ret;
 
-   /* If no memory was reserved in early boot, there is nothing to do */
-   if (phyp_dump_info-init_reserve_size == 0)
-   return 0;
+   ret = sscanf(buf, %lx %lx, start_addr, length);
+   if (ret != 2)
+   return -EINVAL;
+
+   /* Range-check - don't free any reserved memory that
+* wasn't reserved for phyp-dump */
+   if (start_addr  phyp_dump_info-init_reserve_start)
+   start_addr = phyp_dump_info-init_reserve_start;
+
+   end_addr = phyp_dump_info-init_reserve_start +
+   phyp_dump_info-init_reserve_size;
+   if (start_addr+length  end_addr)
+   length = end_addr - start_addr;
+
+   /* Release the region of memory assed in by user */
+   start_pfn = PFN_DOWN(start_addr);
+   nr_pages = PFN_DOWN(length);
+   release_memory_range (start_pfn, nr_pages);
+
+   return count;
+}
+
+static ssize_t
+show_release_region(struct kset * kset, char *buf)
+{
+   return sprintf(buf, ola\n);
+}
+
+static struct subsys_attribute rr = __ATTR(release_region, 0600,
+show_release_region,
+store_release_region);
+
+/* - */
+
+static void release_all (void)
+{
+   unsigned long start_pfn, nr_pages;
 
-   /* Release memory that was reserved in early boot */
+   /* Release all memory that was reserved in early boot */
start_pfn = PFN_DOWN(phyp_dump_info-init_reserve_start);
nr_pages = PFN_DOWN(phyp_dump_info-init_reserve_size);
release_memory_range(start_pfn, nr_pages);
+}
+
+static int __init phyp_dump_setup(void)
+{
+   struct device_node *rtas;
+   const int *dump_header;
+   int header_len = 0;
+   int rc;
+
+   /* If no memory was reserved in early boot, there is nothing to do */
+   if (phyp_dump_info-init_reserve_size == 0)
+   return 0;
+
+   /* Return if phyp dump not supported */
+   ibm_configure_kernel_dump = rtas_token(ibm,configure-kernel-dump);
+   if (ibm_configure_kernel_dump == RTAS_UNKNOWN_SERVICE) {
+   release_all();
+   return -ENOSYS;
+   }
+
+   /* Is there dump data waiting for us? */
+   rtas = of_find_node_by_path(/rtas);
+   dump_header = of_get_property(rtas, ibm,kernel-dump, header_len);
+   if (dump_header == NULL) {
+   release_all();
+   return 0;
+   }
+
+   /* Should we create a dump_subsys, analogous to s390/ipl.c ? */
+   rc = subsys_create_file(kernel_subsys, rr);
+   if (rc) {
+   printk (KERN_ERR phyp-dump: unable to create 

[PATCH 3/8] pseries: phyp dump: reserve-release proof-of-concept

2008-01-07 Thread Manish Ahuja

Initial patch for reserving memory in early boot, and freeing it later.
If the previous boot had ended with a crash, the reserved memory would contain
a copy of the crashed kernel data.

Signed-off-by: Manish Ahuja [EMAIL PROTECTED]
Signed-off-by: Linas Vepstas [EMAIL PROTECTED]


 arch/powerpc/kernel/prom.c |   33 +
 arch/powerpc/platforms/pseries/Makefile|1 
 arch/powerpc/platforms/pseries/phyp_dump.c |   71 +
 include/asm-powerpc/phyp_dump.h|   32 +
 4 files changed, 137 insertions(+)

Index: linux-2.6.24-rc2-git4/include/asm-powerpc/phyp_dump.h
===
--- /dev/null   1970-01-01 00:00:00.0 +
+++ linux-2.6.24-rc2-git4/include/asm-powerpc/phyp_dump.h   2007-11-19 
17:44:21.0 -0600
@@ -0,0 +1,32 @@
+/*
+ * Hypervisor-assisted dump
+ *
+ * Linas Vepstas, Manish Ahuja 2007
+ * Copyright (c) 2007 IBM Corp.
+ *
+ *  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.
+ */
+
+#ifndef _PPC64_PHYP_DUMP_H
+#define _PPC64_PHYP_DUMP_H
+
+#ifdef CONFIG_PHYP_DUMP
+
+/* The RMR region will be saved for later dumping
+ * whenever the kernel crashes. Set this to 256MB. */
+#define PHYP_DUMP_RMR_START 0x0
+#define PHYP_DUMP_RMR_END   (1UL28)
+
+struct phyp_dump {
+   /* Memory that is reserved during very early boot. */
+   unsigned long init_reserve_start;
+   unsigned long init_reserve_size;
+};
+
+extern struct phyp_dump *phyp_dump_info;
+
+#endif /* CONFIG_PHYP_DUMP */
+#endif /* _PPC64_PHYP_DUMP_H */
Index: linux-2.6.24-rc2-git4/arch/powerpc/platforms/pseries/phyp_dump.c
===
--- /dev/null   1970-01-01 00:00:00.0 +
+++ linux-2.6.24-rc2-git4/arch/powerpc/platforms/pseries/phyp_dump.c
2007-11-19 19:07:49.0 -0600
@@ -0,0 +1,71 @@
+/*
+ * Hypervisor-assisted dump
+ *
+ * Linas Vepstas, Manish Ahuja 2007
+ * Copyrhgit (c) 2007 IBM Corp.
+ *
+ *  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 linux/init.h
+#include linux/mm.h
+#include linux/pfn.h
+#include linux/swap.h
+
+#include asm/page.h
+#include asm/phyp_dump.h
+
+/* Global, used to communicate data between early boot and late boot */
+static struct phyp_dump phyp_dump_global;
+struct phyp_dump *phyp_dump_info = phyp_dump_global;
+
+/**
+ * release_memory_range -- release memory previously lmb_reserved
+ * @start_pfn: starting physical frame number
+ * @nr_pages: number of pages to free.
+ *
+ * This routine will release memory that had been previously
+ * lmb_reserved in early boot. The released memory becomes
+ * available for genreal use.
+ */
+static void
+release_memory_range(unsigned long start_pfn, unsigned long nr_pages)
+{
+   struct page *rpage;
+   unsigned long end_pfn;
+   long i;
+
+   end_pfn = start_pfn + nr_pages;
+
+   for (i=start_pfn; i = end_pfn; i++) {
+   rpage = pfn_to_page(i);
+   if (PageReserved(rpage)) {
+   ClearPageReserved(rpage);
+   init_page_count(rpage);
+   __free_page(rpage);
+   totalram_pages++;
+   }
+   }
+}
+
+static int __init phyp_dump_setup(void)
+{
+   unsigned long start_pfn, nr_pages;
+
+   /* If no memory was reserved in early boot, there is nothing to do */
+   if (phyp_dump_info-init_reserve_size == 0)
+   return 0;
+
+   /* Release memory that was reserved in early boot */
+   start_pfn = PFN_DOWN(phyp_dump_info-init_reserve_start);
+   nr_pages = PFN_DOWN(phyp_dump_info-init_reserve_size);
+   release_memory_range(start_pfn, nr_pages);
+
+   return 0;
+}
+
+subsys_initcall(phyp_dump_setup);
Index: linux-2.6.24-rc2-git4/arch/powerpc/platforms/pseries/Makefile
===
--- linux-2.6.24-rc2-git4.orig/arch/powerpc/platforms/pseries/Makefile  
2007-11-19 17:43:52.0 -0600
+++ linux-2.6.24-rc2-git4/arch/powerpc/platforms/pseries/Makefile   
2007-11-19 17:44:21.0 -0600
@@ -18,3 +18,4 @@ obj-$(CONFIG_HOTPLUG_CPU) += hotplug-cpu
 obj-$(CONFIG_HVC_CONSOLE)  += hvconsole.o
 obj-$(CONFIG_HVCS) += hvcserver.o
 obj-$(CONFIG_HCALL_STATS)  += hvCall_inst.o
+obj-$(CONFIG_PHYP_DUMP)+= phyp_dump.o
Index: linux-2.6.24-rc2-git4/arch/powerpc/kernel/prom.c

Re: [PATCH 3/8] pseries: phyp dump: reserve-release proof-of-concept

2008-01-07 Thread Arnd Bergmann
On Tuesday 08 January 2008, Manish Ahuja wrote:

 Initial patch for reserving memory in early boot, and freeing it later.
 If the previous boot had ended with a crash, the reserved memory would contain
 a copy of the crashed kernel data.
 
 Signed-off-by: Manish Ahuja [EMAIL PROTECTED]
 Signed-off-by: Linas Vepstas [EMAIL PROTECTED]

I think the signed-off-by chain needs to be modified. The way it appears,
you handled the patch first, then sent it to Linas, who forwarded it
to whoever will take the patches from the list.

This obviously isn't true, since you are actually the one who is sending
out the patches. Moreover, I believe that the [EMAIL PROTECTED]
address is now dead, and shouldn't be used for this any more.

So, depending on which of you two wrote the majority of a patch, I think
it should be either

| Signed-off-by: Manish Ahuja [EMAIL PROTECTED]
| Acked-by: Linas Vepstas [EMAIL PROTECTED]

or 

| From: Linas Vepstas [EMAIL PROTECTED]
| Signed-off-by: Manish Ahuja [EMAIL PROTECTED]

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


[PATCH 5/8] pseries: phyp dump: register dump area.

2008-01-07 Thread Manish Ahuja


Set up the actual dump header, register it with the hypervisor.

Signed-off-by: Manish Ahuja [EMAIL PROTECTED]
Signed-off-by: Linas Vepstas [EMAIL PROTECTED]

--
 arch/powerpc/platforms/pseries/phyp_dump.c |  169 +++--
 1 file changed, 163 insertions(+), 6 deletions(-)

Index: linux-2.6.24-rc3-git1/arch/powerpc/platforms/pseries/phyp_dump.c
===
--- linux-2.6.24-rc3-git1.orig/arch/powerpc/platforms/pseries/phyp_dump.c   
2007-11-21 15:55:37.0 -0600
+++ linux-2.6.24-rc3-git1/arch/powerpc/platforms/pseries/phyp_dump.c
2007-11-21 16:06:52.0 -0600
@@ -30,6 +30,134 @@ struct phyp_dump *phyp_dump_info = phyp
 static int ibm_configure_kernel_dump;
 
 /* - */
+/* RTAS interfaces to declare the dump regions */
+
+struct dump_section {
+   u32 dump_flags;
+   u16 source_type;
+   u16 error_flags;
+   u64 source_address;
+   u64 source_length;
+   u64 length_copied;
+   u64 destination_address;
+};
+
+struct phyp_dump_header {
+   u32 version;
+   u16 num_of_sections;
+   u16 status;
+
+   u32 first_offset_section;
+   u32 dump_disk_section;
+   u64 block_num_dd;
+   u64 num_of_blocks_dd;
+   u32 offset_dd;
+   u32 maxtime_to_auto;
+   /* No dump disk path string used */
+
+   struct dump_section cpu_data;
+   struct dump_section hpte_data;
+   struct dump_section kernel_data;
+};
+
+/* The dump header *must be* in low memory, so .bss it */
+static struct phyp_dump_header phdr;
+
+#define NUM_DUMP_SECTIONS 3
+#define DUMP_HEADER_VERSION 0x1
+#define DUMP_REQUEST_FLAG 0x1
+#define DUMP_SOURCE_CPU 0x0001
+#define DUMP_SOURCE_HPTE 0x0002
+#define DUMP_SOURCE_RMO  0x0011
+
+/**
+ * init_dump_header() - initialize the header declaring a dump
+ * Returns: length of dump save area.
+ *
+ * When the hypervisor saves crashed state, it needs to put
+ * it somewhere. The dump header tells the hypervisor where
+ * the data can be saved.
+ */
+static unsigned long init_dump_header(struct phyp_dump_header *ph)
+{
+   struct device_node *rtas;
+   const unsigned int *sizes;
+   int len;
+   unsigned long cpu_state_size = 0;
+   unsigned long hpte_region_size = 0;
+   unsigned long addr_offset = 0;
+
+   /* Get the required dump region sizes */
+   rtas = of_find_node_by_path(/rtas);
+   sizes = of_get_property(rtas, ibm,configure-kernel-dump-sizes, len);
+   if (!sizes || len  20)
+   return 0;
+
+   if (sizes[0] == 1)
+   cpu_state_size = *((unsigned long *) sizes[1]);
+
+   if (sizes[3] == 2)
+   hpte_region_size = *((unsigned long *) sizes[4]);
+
+   /* Set up the dump header */
+   ph-version = DUMP_HEADER_VERSION;
+   ph-num_of_sections = NUM_DUMP_SECTIONS;
+   ph-status = 0;
+
+   ph-first_offset_section =
+   (u32) (((struct phyp_dump_header *) 0)-cpu_data);
+   ph-dump_disk_section = 0;
+   ph-block_num_dd = 0;
+   ph-num_of_blocks_dd = 0;
+   ph-offset_dd = 0;
+
+   ph-maxtime_to_auto = 0; /* disabled */
+
+   /* The first two sections are mandatory */
+   ph-cpu_data.dump_flags = DUMP_REQUEST_FLAG;
+   ph-cpu_data.source_type = DUMP_SOURCE_CPU;
+   ph-cpu_data.source_address = 0;
+   ph-cpu_data.source_length = cpu_state_size;
+   ph-cpu_data.destination_address = addr_offset;
+   addr_offset += cpu_state_size;
+
+   ph-hpte_data.dump_flags = DUMP_REQUEST_FLAG;
+   ph-hpte_data.source_type = DUMP_SOURCE_HPTE;
+   ph-hpte_data.source_address = 0;
+   ph-hpte_data.source_length = hpte_region_size;
+   ph-hpte_data.destination_address = addr_offset;
+   addr_offset += hpte_region_size;
+
+   /* This section describes the low kernel region */
+   ph-kernel_data.dump_flags = DUMP_REQUEST_FLAG;
+   ph-kernel_data.source_type = DUMP_SOURCE_RMO;
+   ph-kernel_data.source_address = PHYP_DUMP_RMR_START;
+   ph-kernel_data.source_length = PHYP_DUMP_RMR_END;
+   ph-kernel_data.destination_address = addr_offset;
+   addr_offset += ph-kernel_data.source_length;
+
+   return addr_offset;
+}
+
+static void register_dump_area(struct phyp_dump_header *ph, unsigned long addr)
+{
+   int rc;
+   ph-cpu_data.destination_address += addr;
+   ph-hpte_data.destination_address += addr;
+   ph-kernel_data.destination_address += addr;
+
+   do {
+   rc = rtas_call(ibm_configure_kernel_dump, 3, 1, NULL,
+  1, ph, sizeof(struct phyp_dump_header));
+   } while (rtas_busy_delay(rc));
+
+   if (rc)
+   {
+   printk (KERN_ERR phyp-dump: unexpected error (%d) on 
register\n, rc);
+   }
+}
+
+/* - */
 /**
  * release_memory_range -- release memory previously 

Re: [PATCH 3/7] sbc8560: add support for Wind River SBC8560 in arch/powerpc

2008-01-07 Thread Stephen Rothwell
Hi Paul,

On Mon,  7 Jan 2008 09:25:28 -0500 Paul Gortmaker [EMAIL PROTECTED] wrote:

 +++ b/arch/powerpc/platforms/85xx/sbc8560.c

 +static void __init sbc8560_pic_init(void)
 +{

 +#ifdef CONFIG_CPM2
 + /* Setup CPM2 PIC */
 + np = of_find_compatible_node(NULL, NULL, fsl,cpm2-pic);
 + if (np == NULL) {
 + printk(KERN_ERR PIC init: can not find fsl,cpm2-pic node\n);
 + return;
 + }
 + irq = irq_of_parse_and_map(np, 0);

What happens if that fails?

 +
 + cpm2_pic_init(np);
 + of_node_put(np);
 + set_irq_chained_handler(irq, cpm2_cascade);

Does passing NO_IRQ matter here (in the case that irq_of_parse_and_map fails)?

 +static const struct cpm_pin sbc8560_pins[] = {

Of course, these could be __initdata (but not const as well).  Sorry
about not mentioning this last time and it is a trivial change that
should not stop this stuff going in.

 +static int __init sbc8560_probe(void)
 +{
 +unsigned long root = of_get_flat_dt_root();
 +
 +return of_flat_dt_is_compatible(root, SBC8560);

To use the flattened device tree accessors, you should include asm/prom.h

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


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

[PATCH 6/8] pseries: phyp dump: debugging print routines.

2008-01-07 Thread Manish Ahuja


Provide some basic debugging support.

Signed-off-by: Manish Ahuja [EMAIL PROTECTED]
Signed-off-by: Linas Vepsts [EMAIL PROTECTED]
-

 arch/powerpc/platforms/pseries/phyp_dump.c |   53 -
 1 file changed, 52 insertions(+), 1 deletion(-)

Index: 2.6.24-rc5/arch/powerpc/platforms/pseries/phyp_dump.c
===
--- 2.6.24-rc5.orig/arch/powerpc/platforms/pseries/phyp_dump.c  2008-01-01 
23:24:10.0 -0600
+++ 2.6.24-rc5/arch/powerpc/platforms/pseries/phyp_dump.c   2008-01-01 
23:24:27.0 -0600
@@ -2,7 +2,7 @@
  * Hypervisor-assisted dump
  *
  * Linas Vepstas, Manish Ahuja 2007
- * Copyrhgit (c) 2007 IBM Corp.
+ * Copyright (c) 2007 IBM Corp.
  *
  *  This program is free software; you can redistribute it and/or
  *  modify it under the terms of the GNU General Public License
@@ -139,6 +139,51 @@ static unsigned long init_dump_header(st
return addr_offset;
 }
 
+#ifdef DEBUG
+static void print_dump_header(const struct phyp_dump_header *ph)
+{
+   printk(KERN_INFO dump header:\n);
+   /* setup some ph-sections required */
+   printk(KERN_INFO version = %d\n, ph-version);
+   printk(KERN_INFO Sections = %d\n, ph-num_of_sections);
+   printk(KERN_INFO Status = 0x%x\n, ph-status);
+
+   /* No ph-disk, so all should be set to 0 */
+   printk(KERN_INFO Offset to first section 0x%x\n, 
ph-first_offset_section);
+   printk(KERN_INFO dump disk sections should be zero\n);
+   printk(KERN_INFO dump disk section = %d\n,ph-dump_disk_section);
+   printk(KERN_INFO block num = %ld\n,ph-block_num_dd);
+   printk(KERN_INFO number of blocks = %ld\n,ph-num_of_blocks_dd);
+   printk(KERN_INFO dump disk offset = %d\n,ph-offset_dd);
+   printk(KERN_INFO Max auto time= %d\n,ph-maxtime_to_auto);
+
+   /*set cpu state and hpte states as well scratch pad area */
+   printk(KERN_INFO  CPU AREA \n);
+   printk(KERN_INFO cpu dump_flags =%d\n,ph-cpu_data.dump_flags);
+   printk(KERN_INFO cpu source_type =%d\n,ph-cpu_data.source_type);
+   printk(KERN_INFO cpu error_flags =%d\n,ph-cpu_data.error_flags);
+   printk(KERN_INFO cpu source_address 
=%lx\n,ph-cpu_data.source_address);
+   printk(KERN_INFO cpu source_length =%lx\n,ph-cpu_data.source_length);
+   printk(KERN_INFO cpu length_copied =%lx\n,ph-cpu_data.length_copied);
+
+   printk(KERN_INFO  HPTE AREA \n);
+   printk(KERN_INFO HPTE dump_flags =%d\n,ph-hpte_data.dump_flags);
+   printk(KERN_INFO HPTE source_type =%d\n,ph-hpte_data.source_type);
+   printk(KERN_INFO HPTE error_flags =%d\n,ph-hpte_data.error_flags);
+   printk(KERN_INFO HPTE source_address 
=%lx\n,ph-hpte_data.source_address);
+   printk(KERN_INFO HPTE source_length 
=%lx\n,ph-hpte_data.source_length);
+   printk(KERN_INFO HPTE length_copied 
=%lx\n,ph-hpte_data.length_copied);
+
+   printk(KERN_INFO  SRSD AREA \n);
+   printk(KERN_INFO SRSD dump_flags =%d\n,ph-kernel_data.dump_flags);
+   printk(KERN_INFO SRSD source_type =%d\n,ph-kernel_data.source_type);
+   printk(KERN_INFO SRSD error_flags =%d\n,ph-kernel_data.error_flags);
+   printk(KERN_INFO SRSD source_address 
=%lx\n,ph-kernel_data.source_address);
+   printk(KERN_INFO SRSD source_length 
=%lx\n,ph-kernel_data.source_length);
+   printk(KERN_INFO SRSD length_copied 
=%lx\n,ph-kernel_data.length_copied);
+}
+#endif
+
 static void register_dump_area(struct phyp_dump_header *ph, unsigned long addr)
 {
int rc;
@@ -154,6 +199,9 @@ static void register_dump_area(struct ph
if (rc)
{
printk (KERN_ERR phyp-dump: unexpected error (%d) on 
register\n, rc);
+#ifdef DEBUG
+   print_dump_header (ph);
+#endif
}
 }
 
@@ -271,6 +319,9 @@ static int __init phyp_dump_setup(void)
release_all();
return -ENOSYS;
}
+#ifdef DEBUG
+   print_dump_header (dump_header);
+#endif
 
/* Is there dump data waiting for us? If there isn't,
 * then register a new dump area, and release all of
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH] Use linux/of_{platform, device}.h and not asm/... variants.

2008-01-07 Thread Stephen Rothwell
Hi Jon,

On Mon, 07 Jan 2008 12:07:15 -0600 Jon Loeliger [EMAIL PROTECTED] wrote:

 From: Jon Loeliger [EMAIL PROTECTED]
 
 Signed-off-by: Jon Loeliger [EMAIL PROTECTED]
 ---
 
 Paul,
 
 Continue to fight the Good Fight by removing
 old include file references that managed to
 creep in recently.
 
 These are the last few in arch/powerpc directly.
 If you could pick this up for .25, that be good!

Thanks for doing this.

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


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

[PATCH 8/8] pseries: phyp dump: Tracking memory range freed.

2008-01-07 Thread Manish Ahuja


This patch tracks the size freed. For now it does a simple
rudimentary calculation of the ranges freed. The idea is
to keep it simple at the external shell script level and 
send in large chunks for now.

Signed-off-by: Manish Ahuja [EMAIL PROTECTED]
-

---
 arch/powerpc/platforms/pseries/phyp_dump.c |   36 +
 include/asm-powerpc/phyp_dump.h|3 ++
 2 files changed, 39 insertions(+)

Index: 2.6.24-rc5/include/asm-powerpc/phyp_dump.h
===
--- 2.6.24-rc5.orig/include/asm-powerpc/phyp_dump.h 2008-01-07 
22:55:28.0 -0600
+++ 2.6.24-rc5/include/asm-powerpc/phyp_dump.h  2008-01-07 22:58:02.0 
-0600
@@ -24,6 +24,9 @@ struct phyp_dump {
/* Memory that is reserved during very early boot. */
unsigned long init_reserve_start;
unsigned long init_reserve_size;
+   /* Scratch area memory details */
+   unsigned long scratch_reserve_start;
+   unsigned long scratch_reserve_size;
 };
 
 extern struct phyp_dump *phyp_dump_info;
Index: 2.6.24-rc5/arch/powerpc/platforms/pseries/phyp_dump.c
===
--- 2.6.24-rc5.orig/arch/powerpc/platforms/pseries/phyp_dump.c  2008-01-07 
22:57:27.0 -0600
+++ 2.6.24-rc5/arch/powerpc/platforms/pseries/phyp_dump.c   2008-01-07 
22:58:02.0 -0600
@@ -287,6 +287,39 @@ release_memory_range(unsigned long start
}
 }
 
+/**
+ * track_freed_range -- Counts the range being freed.
+ * Once the counter goes to zero, it re-registers dump for
+ * future use.
+ */
+static void
+track_freed_range(unsigned long addr, unsigned long length)
+{
+   static unsigned long scratch_area_size, reserved_area_size;
+
+   if (addr  phyp_dump_info-init_reserve_start)
+   return;
+
+   if ((addr = phyp_dump_info-init_reserve_start) 
+   (addr = phyp_dump_info-init_reserve_start +
+phyp_dump_info-init_reserve_size))
+   reserved_area_size += length;
+
+   if ((addr = phyp_dump_info-scratch_reserve_start) 
+   (addr = phyp_dump_info-scratch_reserve_start +
+phyp_dump_info-scratch_reserve_size))
+   scratch_area_size += length;
+
+   if ((reserved_area_size == phyp_dump_info-init_reserve_start) 
+   (scratch_area_size == phyp_dump_info-scratch_reserve_size)) {
+
+   invalidate_last_dump(phdr,
+   phyp_dump_info-scratch_reserve_start);
+   register_dump_area (phdr,
+   phyp_dump_info-scratch_reserve_start);
+   }
+}
+
 /* - */
 /**
  * sysfs_release_region -- sysfs interface to release memory range.
@@ -310,6 +343,8 @@ store_release_region(struct kset *kset, 
if (ret != 2)
return -EINVAL;
 
+   track_freed_range(start_addr, length);
+
/* Range-check - don't free any reserved memory that
 * wasn't reserved for phyp-dump */
if (start_addr  phyp_dump_info-init_reserve_start)
@@ -414,6 +449,7 @@ static int __init phyp_dump_setup(void)
}
 
/* Don't allow user to release the 256MB scratch area */
+   /* this might be wrong */
phyp_dump_info-init_reserve_size = free_area_length;
 
/* Should we create a dump_subsys, analogous to s390/ipl.c ? */
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [RFC] Add of_find_matching_node() helper function

2008-01-07 Thread Stephen Rothwell
Hi Grant,

On Mon, 07 Jan 2008 11:15:56 -0700 Grant Likely [EMAIL PROTECTED] wrote:

 +++ b/include/linux/of.h
 @@ -60,5 +66,7 @@ extern const void *of_get_property(const struct device_node 
 *node,
   int *lenp);
  extern int of_n_addr_cells(struct device_node *np);
  extern int of_n_size_cells(struct device_node *np);
 +extern const struct of_device_id *of_match_node(
 + const struct of_device_id *matches, const struct device_node *node);
  
  #endif /* _LINUX_OF_H */
 diff --git a/include/linux/of_device.h b/include/linux/of_device.h
 index 212bffb..6dc1195 100644
 --- a/include/linux/of_device.h
 +++ b/include/linux/of_device.h
 @@ -10,8 +10,6 @@
  
  #define  to_of_device(d) container_of(d, struct of_device, dev)
  
 -extern const struct of_device_id *of_match_node(
 - const struct of_device_id *matches, const struct device_node *node);
  extern const struct of_device_id *of_match_device(
   const struct of_device_id *matches, const struct of_device *dev);

So you should really change all the callers of of_match_node to include 
linux/of.h.
-- 
Cheers,
Stephen Rothwell[EMAIL PROTECTED]
http://www.canb.auug.org.au/~sfr/


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

Re: [PATCH 3/8] pseries: phyp dump: reserve-release proof-of-concept

2008-01-07 Thread Manish Ahuja
Arnd,

Sorry this patch ended up out of sequence. I reposted it properly again in the 
other thread.

We did talk about using gmail address, but Linas was more comfortable using 
this as this is
where he was, when we did this. Hence the use of Austin address with gmail 
being on the cc list.

I am sure he will chime in with more details about it when he gets the 
opportunity.

Thanks,
Manish



Arnd Bergmann wrote:
 On Tuesday 08 January 2008, Manish Ahuja wrote:
 
 Initial patch for reserving memory in early boot, and freeing it later.
 If the previous boot had ended with a crash, the reserved memory would 
 contain
 a copy of the crashed kernel data.

 Signed-off-by: Manish Ahuja [EMAIL PROTECTED]
 Signed-off-by: Linas Vepstas [EMAIL PROTECTED]
 
 I think the signed-off-by chain needs to be modified. The way it appears,
 you handled the patch first, then sent it to Linas, who forwarded it
 to whoever will take the patches from the list.
 
 This obviously isn't true, since you are actually the one who is sending
 out the patches. Moreover, I believe that the [EMAIL PROTECTED]
 address is now dead, and shouldn't be used for this any more.
 
 So, depending on which of you two wrote the majority of a patch, I think
 it should be either
 
 | Signed-off-by: Manish Ahuja [EMAIL PROTECTED]
 | Acked-by: Linas Vepstas [EMAIL PROTECTED]
 
 or 
 
 | From: Linas Vepstas [EMAIL PROTECTED]
 | Signed-off-by: Manish Ahuja [EMAIL PROTECTED]
 
   Arnd 

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


Re: [PATCH 6/8] pseries: phyp dump: debugging print routines.

2008-01-07 Thread Arnd Bergmann
On Tuesday 08 January 2008, Manish Ahuja wrote:
 +#ifdef DEBUG
 +static void print_dump_header(const struct phyp_dump_header *ph)
 +{
 +   printk(KERN_INFO dump header:\n);
 ...
 +   printk(KERN_INFO SRSD length_copied 
 =%lx\n,ph-kernel_data.length_copied);
 +}
 +#endif
 +

If you move the #if to inside of the function,

 printk (KERN_ERR phyp-dump: unexpected error (%d) on 
 register\n, rc);
 +#ifdef DEBUG
 +   print_dump_header (ph);
 +#endif
 }

 }
 +#ifdef DEBUG
 +   print_dump_header (dump_header);
 +#endif


you don't need the #ifdefs here.

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


Re: [PATCH 3/8] pseries: phyp dump: reserve-release proof-of-concept

2008-01-07 Thread Linas Vepstas
On 07/01/2008, Arnd Bergmann [EMAIL PROTECTED] wrote:
 On Tuesday 08 January 2008, Manish Ahuja wrote:

  Initial patch for reserving memory in early boot, and freeing it later.
  If the previous boot had ended with a crash, the reserved memory would 
  contain
  a copy of the crashed kernel data.
 
  Signed-off-by: Manish Ahuja [EMAIL PROTECTED]
  Signed-off-by: Linas Vepstas [EMAIL PROTECTED]

 I think the signed-off-by chain needs to be modified. The way it appears,
 you handled the patch first, then sent it to Linas, who forwarded it
 to whoever will take the patches from the list.

Well,
-- there was dual authorship. I remangled the patches while Manish wrote
code  tested. And I'd mailed them out the first time around, so you could
say I forwarded after heavy editing.


 This obviously isn't true, since you are actually the one who is sending
 out the patches. Moreover, I believe that the [EMAIL PROTECTED]
 address is now dead, and shouldn't be used for this any more.

Hmm. I wanted to indicate that the work was done while I was at IBM;
clearly, no one is going through git and changing old, expired email
addrs, and so submission based on the old addr seemed appropriate.

I'm taking the Signed-off-by line as a quasi-legal thing: a fancy ID string,
identifying the author(s),  rather than a new way to manage email
address books.

 So, depending on which of you two wrote the majority of a patch, I think
 it should be either

I'm not sure there was a clear majority. I think Manish did more work
in general, but we hacked this together side by side. I got him to create
working tested code; I busted it up into individual, clean, documented,
mailing-list ready chunks.

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


Re: [PATCH v2] [POWERPC] Update MPC8610 HPCD to support audio drivers

2008-01-07 Thread Stephen Rothwell
Hi Timur,

On Mon,  7 Jan 2008 12:56:43 -0600 Timur Tabi [EMAIL PROTECTED] wrote:

 +++ b/arch/powerpc/platforms/86xx/mpc8610_hpcd.c
 @@ -34,9 +34,27 @@
  
  #include asm/mpic.h
  
 +#include linux/of_platform.h
  #include sysdev/fsl_pci.h
  #include sysdev/fsl_soc.h
  
 +static struct of_device_id mpc8610_ids[] = {

__initdata

 + { .compatible = fsl,mpc8610, },
 + {}
 +};
 +
 +static int __init mpc8610_declare_of_platform_devices(void)
 +{
 + if (!machine_is(mpc86xx_hpcd))
 + return 0;
 +
 + /* Without this call, the SSI device driver won't get probed. */
 + of_platform_bus_probe(NULL, mpc8610_ids, NULL);
 +
 + return 0;
 +}
 +device_initcall(mpc8610_declare_of_platform_devices);

We have machine_device_initcall for this now.

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


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

Re: [RFC 1/2] mpc5200: Add common clock setting routine mpc52xx_set_psc_clkdiv()

2008-01-07 Thread Stephen Rothwell
On Mon, 07 Jan 2008 12:03:59 -0700 Grant Likely [EMAIL PROTECTED] wrote:

 +++ b/arch/powerpc/platforms/52xx/mpc52xx_common.c
  
 -static struct of_device_id __init mpc52xx_ids[] = {

Why not just leave this here and mark in __initdata?

 +/**
 + * mpc52xx_declare_of_platform_devices: register internal devices and 
 children
 + *   of the localplus bus to the of_platform
 + *   bus.
 + */
  void __init
  mpc52xx_declare_of_platform_devices(void)
  {
 + const static struct of_device_id mpc52xx_bus_ids[] = {

Or just mark it __initdata instead of const?

 + { .compatible = fsl,mpc5200-immr, },
 + { .compatible = fsl,lpb, },
 + { .type = builtin, .compatible = mpc5200, }, /* efika */
 + { .type = soc, .compatible = mpc5200, }, /* old */

And you lost the comment about the last two being deprecated mates.

 +mpc52xx_map_common_devices(void)
  {
   struct device_node *np;
 - struct of_device_id gpt_ids[] = {
 + const static struct of_device_id gpt_ids[] = {

Again __initdata?

 + const static struct of_device_id cdm_ids[] = {

And again?

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


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

Re: [PATCH 3/8] pseries: phyp dump: reserve-release proof-of-concept

2008-01-07 Thread Michael Ellerman
On Mon, 2008-01-07 at 18:49 -0600, Linas Vepstas wrote:
 On 07/01/2008, Arnd Bergmann [EMAIL PROTECTED] wrote:
  On Tuesday 08 January 2008, Manish Ahuja wrote:
 
   Initial patch for reserving memory in early boot, and freeing it later.
   If the previous boot had ended with a crash, the reserved memory would 
   contain
   a copy of the crashed kernel data.
  
   Signed-off-by: Manish Ahuja [EMAIL PROTECTED]
   Signed-off-by: Linas Vepstas [EMAIL PROTECTED]
 
  I think the signed-off-by chain needs to be modified. The way it appears,
  you handled the patch first, then sent it to Linas, who forwarded it
  to whoever will take the patches from the list.

  This obviously isn't true, since you are actually the one who is sending
  out the patches. Moreover, I believe that the [EMAIL PROTECTED]
  address is now dead, and shouldn't be used for this any more.
 
 Hmm. I wanted to indicate that the work was done while I was at IBM;
 clearly, no one is going through git and changing old, expired email
 addrs, and so submission based on the old addr seemed appropriate.
 
 I'm taking the Signed-off-by line as a quasi-legal thing: a fancy ID string,
 identifying the author(s),  rather than a new way to manage email
 address books.

No one's changing the git history (you can't), but it seems silly to
submit a patch with an address that is already dead. There is a general
expectation that if/when someone finds a bug in the code they can email
the signed-off-by addresses and get a real person.

As far as indicating it was written at IBM, that should be covered by
the copyright notices.

cheers

-- 
Michael Ellerman
OzLabs, IBM Australia Development Lab

wwweb: http://michael.ellerman.id.au
phone: +61 2 6212 1183 (tie line 70 21183)

We do not inherit the earth from our ancestors,
we borrow it from our children. - S.M.A.R.T Person


signature.asc
Description: This is a digitally signed message part
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev

Re: [PATCH] i2c-ibm_iic driver

2008-01-07 Thread Sean MacLennan
Arnd Bergmann wrote:
 If there is a good reason to specify fast or slow mode per board, you may want
 to make that a property in the device node.
   
I tried to add fast_mode to the .dts file and failed.

IIC1: [EMAIL PROTECTED] {
device_type = i2c;
compatible = ibm,iic-440ep, ibm,iic-440gp, ibm,iic;
reg = ef600800 14;
interrupt-parent = UIC0;
interrupts = 7 4;
fast-mode = 0;
};

As soon as a I add the fast-mode line I get the following error on boot:

fdt_wrapper_setprop():105  FDT_ERR_NOSPACE

Remove the line and I boot. Any ideas?

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


[PATCH] i2c-ibm_iic driver - new patch

2008-01-07 Thread Sean MacLennan
Second attempt. I think I have covered all the comments. It now should 
work with both ppc and powerpc architectures.


You can now specify fast-mode in the .dts file.

You can now specify an index for each entry.  If you don't I try to 
chose reasonable defaults. i.e. I keep a static int that is incremented. 
If you mix index entries with non-index entries, you are on your own.


Below is the example for the taco, I have shown fast-mode set in IIC1 as 
an example:


   IIC0: [EMAIL PROTECTED] {
   device_type = i2c;
   compatible = ibm,iic-440ep, ibm,iic-440gp, ibm,iic;
   reg = ef600700 14;
   interrupt-parent = UIC0;
   interrupts = 2 4;
   index = 0;
   };

   IIC1: [EMAIL PROTECTED] {
   device_type = i2c;
   compatible = ibm,iic-440ep, ibm,iic-440gp, ibm,iic;
   reg = ef600800 14;
   interrupt-parent = UIC0;
   interrupts = 7 4;
   index = 1;
   fast-mode;
   };

Cheers,
  Sean

diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig
index c466c6c..e9e1493 100644
--- a/drivers/i2c/busses/Kconfig
+++ b/drivers/i2c/busses/Kconfig
@@ -241,7 +241,6 @@ config I2C_PIIX4
 
 config I2C_IBM_IIC
tristate IBM PPC 4xx on-chip I2C interface
-   depends on IBM_OCP
help
  Say Y here if you want to use IIC peripheral found on 
  embedded IBM PPC 4xx based systems. 
diff --git a/drivers/i2c/busses/i2c-ibm_iic.c b/drivers/i2c/busses/i2c-ibm_iic.c
index 9b43ff7..0b10bb1 100644
--- a/drivers/i2c/busses/i2c-ibm_iic.c
+++ b/drivers/i2c/busses/i2c-ibm_iic.c
@@ -6,7 +6,10 @@
  * Copyright (c) 2003, 2004 Zultys Technologies.
  * Eugene Surovegin [EMAIL PROTECTED] or [EMAIL PROTECTED]
  *
- * Based on original work by 
+ * Copyright (c) 2008 PIKA Technologies
+ * Sean MacLennan [EMAIL PROTECTED]
+ *
+ * Based on original work by
  * Ian DaSilva  [EMAIL PROTECTED]
  *  Armin Kuster [EMAIL PROTECTED]
  * Matt Porter  [EMAIL PROTECTED]
@@ -39,12 +42,17 @@
 #include asm/io.h
 #include linux/i2c.h
 #include linux/i2c-id.h
+
+#ifdef CONFIG_IBM_OCP
 #include asm/ocp.h
 #include asm/ibm4xx.h
+#else
+#include linux/of_platform.h
+#endif
 
 #include i2c-ibm_iic.h
 
-#define DRIVER_VERSION 2.1
+#define DRIVER_VERSION 2.2
 
 MODULE_DESCRIPTION(IBM IIC driver v DRIVER_VERSION);
 MODULE_LICENSE(GPL);
@@ -657,6 +665,7 @@ static inline u8 iic_clckdiv(unsigned int opb)
return (u8)((opb + 9) / 10 - 1);
 }
 
+#ifdef CONFIG_IBM_OCP
 /*
  * Register single IIC interface
  */
@@ -831,3 +840,192 @@ static void __exit iic_exit(void)
 
 module_init(iic_init);
 module_exit(iic_exit);
+#else
+/*
+ * Register single IIC interface
+ */
+static int __devinit iic_probe(struct of_device *ofdev,
+  const struct 
of_device_id *match)
+{
+   static int index = 0;
+   struct device_node *np = ofdev-node;
+   struct ibm_iic_private* dev;
+   struct i2c_adapter* adap;
+   const u32 *addrp, *freq;
+   u64 addr;
+   int ret;
+
+   if (!(dev = kzalloc(sizeof(*dev), GFP_KERNEL))) {
+   printk(KERN_CRIT ibm-iic: failed to allocate device data\n);
+   return -ENOMEM;
+   }
+
+   /* This assumes we don't mix index and non-index entries. */
+   if((addrp = of_get_property(np, index, NULL)))
+   dev-idx = *addrp;
+   else
+   dev-idx = index++;
+
+   dev_set_drvdata(ofdev-dev, dev);
+
+   if((addrp = of_get_address(np, 0, NULL, NULL)) == NULL ||
+  (addr = of_translate_address(np, addrp)) == OF_BAD_ADDR) {
+   printk(KERN_CRIT ibm-iic%d: Unable to get iic address\n,
+  dev-idx);
+   ret = -EBUSY;
+   goto fail1;
+   }
+
+   if (!(dev-vaddr = ioremap(addr, sizeof(struct iic_regs{
+   printk(KERN_CRIT ibm-iic%d: failed to ioremap device 
registers\n,
+   dev-idx);
+   ret = -ENXIO;
+   goto fail1;
+   }
+
+   init_waitqueue_head(dev-wq);
+
+   if(iic_force_poll)
+   dev-irq = NO_IRQ;
+   else if((dev-irq = irq_of_parse_and_map(np, 0)) == NO_IRQ)
+   printk(KERN_ERR __FILE__ : irq_of_parse_and_map failed\n);
+
+   if (dev-irq != NO_IRQ) {
+   /* Disable interrupts until we finish initialization,
+  assumes level-sensitive IRQ setup...
+*/
+   iic_interrupt_mode(dev, 0);
+   if(request_irq(dev-irq, iic_handler, 0, IBM IIC, dev)){
+   printk(KERN_ERR ibm-iic%d: request_irq %d failed\n,
+  dev-idx, dev-irq);
+   /* Fallback to the polling mode */
+   dev-irq = NO_IRQ;
+   }
+   }
+
+   if (dev-irq == NO_IRQ)
+  

How complete should the DTS be?

2008-01-07 Thread Sean MacLennan
Just a general question about DTS completeness. Like all 440EP 
processors, the taco has two i2c buses. However, only one bus has 
anything connected to it.

Should I show both bus entries in the DTS, or only the one that is used? 
I have generally only been showing the devices that are present. i.e. 
Only one emac, only one serial port.

Is there a convention for this?

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


Re: [PATCH] i2c-ibm_iic driver - new patch

2008-01-07 Thread Stephen Rothwell
Hi Sean,

On Mon, 07 Jan 2008 21:03:12 -0500 Sean MacLennan [EMAIL PROTECTED] wrote:


Please don't post patches as attachments.

 +static int __devinit iic_probe(struct of_device *ofdev,
 +const struct 
 of_device_id *match)

Indenting could be better.

 +{

 + if (!(dev = kzalloc(sizeof(*dev), GFP_KERNEL))) {

Please split the assignments from the tests.  Here and elsewhere.

 + printk(KERN_CRIT ibm-iic: failed to allocate device data\n);

I am not sure that these messages are necessary and, even if so, not KERN_CRIT.

 + if(iic_force_poll)

Space after if

 + if (dev-irq != NO_IRQ) {
.
.
 + }
 +
 + if (dev-irq == NO_IRQ)

else instead?

 + printk(KERN_WARNING ibm-iic%d: using polling mode\n,
 +dev-idx);
 +static int __devexit iic_remove(struct of_device *ofdev)
 +{
 + struct ibm_iic_private* dev = (struct 
 ibm_iic_private*)dev_get_drvdata(ofdev-dev);

Unnecessary cast.

 + if (i2c_del_adapter(dev-adap)){
 + printk(KERN_CRIT ibm-iic%d: failed to delete i2c adapter :(\n,
 + dev-idx);

This is not a KERN_CRIT situation ...

 + /* That's *very* bad, just shutdown IRQ ... */
 + if (dev-irq = 0){

What is that testing? For NO_IRQ as below?

 + iic_interrupt_mode(dev, 0);
 + free_irq(dev-irq, dev);
 + dev-irq = -1;

NO_IRQ?

 + }
 + } else {
 + if (dev-irq != NO_IRQ){
 + iic_interrupt_mode(dev, 0);
 + free_irq(dev-irq, dev);
 + }
 + iounmap(dev-vaddr);
 + kfree(dev);

Should these last two be after the below brace?

 + }
 +
 + return 0;
 +}
 +
 +
 +static struct of_device_id ibm_iic_match[] =

This should be const.

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


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

[PATCH/RFC] mpc83xx/85xx SysRQ/brk over 8250 console

2008-01-07 Thread Paul Gortmaker
It seems that if a break is rec'd on the serial console (as per SysRQ
or similar) on some 83xx and 85xx processors, then a pulse of IRQs is
generated which makes the use of SysRQ itself about 99% impossible.  I
experimented with trying several ACK strategies, but in the end the
thing which worked best was just to wait for the surge of events to pass
(a fraction of a second).  The number of events can be on the order of
1000 (as reported by /proc/interrupts)

I really dislike seeing board specific ifdefs within what should be
board independent code, so I'm hoping that once the problem is known,
that a more elegant solution will pop into someone's head.  Or at least
this will hopefully save someone the grief of re-investigating the source
and start a discussion.

I've seen this on two different 834x boards and also an 8548 based
board.  At this point, it is not clear to me if the problem extends
beyond these CPU/soc to all with UARTs at 4500/4600.

While less than ideal, the work-around below which simply ignores the
events does allow a person to use SysRQ on such platforms.

The definition of the RFE bit (Rx FIFO error) can be found in pretty
much any of the MPC CPU PDFs (for those with 4500/4600 16550s).

Paul.

diff --git a/drivers/serial/8250.c b/drivers/serial/8250.c
index f94109c..2761c64 100644
--- a/drivers/serial/8250.c
+++ b/drivers/serial/8250.c
@@ -1426,6 +1426,24 @@ serial8250_handle_port(struct uart_8250_port *up)
 
status = serial_inp(up, UART_LSR);
 
+#if defined(CONFIG_MPC834x) || defined(CONFIG_MPC8540)
+   /*
+* There appears to be a quirk in the implementation on some 8xxx
+* where after a break is rec'd (UART_LSR_BI), the UART generates
+* a short duration burst of bogus IRQ events with the signature
+* of RFE set (along with normal bits set) in the LSR.
+*/
+
+#define RFE_8xxx_ERR_BITS (UART_LSR_RFE| UART_LSR_TEMT | \
+   UART_LSR_THRE   | UART_LSR_BI   | \
+   UART_LSR_DR )
+
+   if (status == RFE_8xxx_ERR_BITS) {
+   spin_unlock_irqrestore(up-port.lock, flags);
+   return;
+   }
+#endif
+
DEBUG_INTR(status = %x..., status);
 
if (status  UART_LSR_DR)
diff --git a/include/linux/serial_reg.h b/include/linux/serial_reg.h
index 96c0d93..1ea6436 100644
--- a/include/linux/serial_reg.h
+++ b/include/linux/serial_reg.h
@@ -111,6 +111,7 @@
 #define UART_MCR_DTR   0x01 /* DTR complement */
 
 #define UART_LSR   5   /* In:  Line Status Register */
+#define UART_LSR_RFE   0x80 /* Rx FIFO Error (BE, FE, or PE) */
 #define UART_LSR_TEMT  0x40 /* Transmitter empty */
 #define UART_LSR_THRE  0x20 /* Transmit-hold-register empty */
 #define UART_LSR_BI0x10 /* Break interrupt indicator */
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH] add MPC837x MDS board default device tree

2008-01-07 Thread Kumar Gala

On Dec 14, 2007, at 2:12 AM, Kumar Gala wrote:


 On Dec 6, 2007, at 8:01 PM, David Gibson wrote:

 On Wed, Dec 05, 2007 at 06:37:53PM +0800, Li Yang wrote:
 Signed-off-by: Li Yang [EMAIL PROTECTED]
 ---
 Update SATA nodes; remove serdes nodes; add aliases and labels.

 arch/powerpc/boot/dts/mpc8377_mds.dts |  270 +++
 
 arch/powerpc/boot/dts/mpc8378_mds.dts |  256 +++
 ++
 arch/powerpc/boot/dts/mpc8379_mds.dts |  284 +++
 ++
 3 files changed, 810 insertions(+), 0 deletions(-)
 create mode 100644 arch/powerpc/boot/dts/mpc8377_mds.dts
 create mode 100644 arch/powerpc/boot/dts/mpc8378_mds.dts
 create mode 100644 arch/powerpc/boot/dts/mpc8379_mds.dts

 diff --git a/arch/powerpc/boot/dts/mpc8377_mds.dts b/arch/powerpc/
 boot/dts/mpc8377_mds.dts
 new file mode 100644
 index 000..919ffd0
 --- /dev/null
 +++ b/arch/powerpc/boot/dts/mpc8377_mds.dts
 [snip]
 +   aliases {
 +   ethernet0 = /[EMAIL PROTECTED]/[EMAIL PROTECTED];
 +   ethernet1 = /[EMAIL PROTECTED]/[EMAIL PROTECTED];
 +   serial0 = /[EMAIL PROTECTED]/[EMAIL PROTECTED];
 +   serial1 = /[EMAIL PROTECTED]/[EMAIL PROTECTED];
 +   pci0 = /[EMAIL PROTECTED];

 You can use path references for these now.

 +   };
 +
 +   cpus {
 +   #address-cells = 1;
 +   #size-cells = 0;
 +
 +   PowerPC,[EMAIL PROTECTED] {

 This should absolutely not have a x in it.  Either have an exact
 model, or just use [EMAIL PROTECTED] (in which case you can put the model 
 in
 compatible).

 [snip]
 +   [EMAIL PROTECTED] {
 +   device_type = i2c;

 Drop the device_type.  No i2c device_type class is defined.

 [snip]
 +   /* phy type (ULPI, UTMI, UTMI_WIDE, SERIAL) */
 +   [EMAIL PROTECTED] {
 +   device_type = usb;

 Drop device_type here too.

 +   compatible = fsl-usb2-dr;
 +   reg = 23000 1000;
 +   #address-cells = 1;
 +   #size-cells = 0;
 +   interrupt-parent =  ipic ;
 +   interrupts = 26 8;
 +   phy_type = utmi_wide;
 +   };
 +
 +   [EMAIL PROTECTED] {
 +   device_type = mdio;
 +   compatible = gianfar;

 Grr... not your fault, but this crap in the gianfar driver where it
 uses the same compatible property for the mdio and MAC has to be
 fixed.

 I've fixed this now.  Look at my tree/patch.

 [snip]

 +   serial1:[EMAIL PROTECTED] {

 Standard style puts a space after the colon.

 +   device_type = serial;
 +   compatible = ns16550;
 +   reg = 4600 100;
 +   clock-frequency = 0;
 +   interrupts = a 8;
 +   interrupt-parent =  ipic ;
 +   };
 +
 +   [EMAIL PROTECTED] {
 +   model = SEC3;
 +   compatible = talitos;

 This driver, also, needs fixing to recognize a better formatted
 compatible property.

 Can you respin with David's changes as well as mirror my cleanup of
 the other 83xx/85xx .dts


Any updates on new versions of the .dts for mpc837x?

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


RE: [PATCH] add MPC837x MDS board default device tree

2008-01-07 Thread Li Yang
 -Original Message-
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] 
 On Behalf Of Kumar Gala
 Sent: Tuesday, January 08, 2008 1:46 PM
 To: Li Yang
 Cc: linuxppc-dev list; David Gibson
 Subject: Re: [PATCH] add MPC837x MDS board default device tree

{snip}

 
 Any updates on new versions of the .dts for mpc837x?

I have just posted them yesterday.

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


Re: [PATCH] i2c-ibm_iic driver - new patch

2008-01-07 Thread Sean MacLennan
Stephen Rothwell wrote:
 Hi Sean,

 On Mon, 07 Jan 2008 21:03:12 -0500 Sean MacLennan [EMAIL PROTECTED] wrote:
   

 Please don't post patches as attachments.
   
Ok.
   
 +static int __devinit iic_probe(struct of_device *ofdev,
 +   const struct 
 of_device_id *match)
 

 Indenting could be better.
   
Sorry. Since this kernel is in a work directory and not in 
/usr/src/linux* my rules for deciding on the tab size didn't work :( I 
tried to correct the tabbing.
 Please split the assignments from the tests.  Here and elsewhere.

   
I made the changes in my code. I am trying to leave the original code as 
much as possible.
 +printk(KERN_CRIT ibm-iic: failed to allocate device data\n);
 

 I am not sure that these messages are necessary and, even if so, not 
 KERN_CRIT.

   
What would you recommend then? KERN_ERR? These are cut and paste from 
the original driver, so I left them alone. I will try KERN_ERR.
 +}
 +} else {
 +if (dev-irq != NO_IRQ){
 +iic_interrupt_mode(dev, 0);
 +free_irq(dev-irq, dev);
 +}
 +iounmap(dev-vaddr);
 +kfree(dev);
 

 Should these last two be after the below brace?

   
I'm not really qualified to answer, but I will anyway ;) I assume the 
original author is basically saying if he cannot delete the adapter, it 
is unsafe to free the memory since the i2c code may still use it. If I 
have read that right, then I agree.

Cheers,
Sean

diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig
index c466c6c..e9e1493 100644
--- a/drivers/i2c/busses/Kconfig
+++ b/drivers/i2c/busses/Kconfig
@@ -241,7 +241,6 @@ config I2C_PIIX4
 
 config I2C_IBM_IIC
 tristate IBM PPC 4xx on-chip I2C interface
-depends on IBM_OCP
 help
   Say Y here if you want to use IIC peripheral found on
   embedded IBM PPC 4xx based systems.
diff --git a/drivers/i2c/busses/i2c-ibm_iic.c 
b/drivers/i2c/busses/i2c-ibm_iic.c
index 9b43ff7..d218a3b 100644
--- a/drivers/i2c/busses/i2c-ibm_iic.c
+++ b/drivers/i2c/busses/i2c-ibm_iic.c
@@ -6,6 +6,9 @@
  * Copyright (c) 2003, 2004 Zultys Technologies.
  * Eugene Surovegin [EMAIL PROTECTED] or [EMAIL PROTECTED]
  *
+ * Copyright (c) 2008 PIKA Technologies
+ * Sean MacLennan [EMAIL PROTECTED]
+ *
  * Based on original work by
  * Ian DaSilva  [EMAIL PROTECTED]
  *  Armin Kuster [EMAIL PROTECTED]
@@ -39,12 +42,17 @@
 #include asm/io.h
 #include linux/i2c.h
 #include linux/i2c-id.h
+
+#ifdef CONFIG_IBM_OCP
 #include asm/ocp.h
 #include asm/ibm4xx.h
+#else
+#include linux/of_platform.h
+#endif
 
 #include i2c-ibm_iic.h
 
-#define DRIVER_VERSION 2.1
+#define DRIVER_VERSION 2.2
 
 MODULE_DESCRIPTION(IBM IIC driver v DRIVER_VERSION);
 MODULE_LICENSE(GPL);
@@ -650,13 +658,14 @@ static inline u8 iic_clckdiv(unsigned int opb)
 opb /= 100;

 if (opb  20 || opb  150){
-printk(KERN_CRIT ibm-iic: invalid OPB clock frequency %u MHz\n,
+printk(KERN_WARNING ibm-iic: invalid OPB clock frequency %u 
MHz\n,
 opb);
 opb = opb  20 ? 20 : 150;
 }
 return (u8)((opb + 9) / 10 - 1);
 }
 
+#ifdef CONFIG_IBM_OCP
 /*
  * Register single IIC interface
  */
@@ -672,7 +681,7 @@ static int __devinit iic_probe(struct ocp_device *ocp){
 ocp-def-index);
 
 if (!(dev = kzalloc(sizeof(*dev), GFP_KERNEL))) {
-printk(KERN_CRIT ibm-iic%d: failed to allocate device data\n,
+printk(KERN_ERR ibm-iic%d: failed to allocate device data\n,
 ocp-def-index);
 return -ENOMEM;
 }
@@ -687,7 +696,7 @@ static int __devinit iic_probe(struct ocp_device *ocp){
 }
 
 if (!(dev-vaddr = ioremap(ocp-def-paddr, sizeof(struct iic_regs{
-printk(KERN_CRIT ibm-iic%d: failed to ioremap device registers\n,
+printk(KERN_ERR ibm-iic%d: failed to ioremap device registers\n,
 dev-idx);
 ret = -ENXIO;
 goto fail2;
@@ -746,7 +755,7 @@ static int __devinit iic_probe(struct ocp_device *ocp){
 adap-nr = dev-idx = 0 ? dev-idx : 0;
 
 if ((ret = i2c_add_numbered_adapter(adap))  0) {
-printk(KERN_CRIT ibm-iic%d: failed to register i2c adapter\n,
+printk(KERN_ERR ibm-iic%d: failed to register i2c adapter\n,
 dev-idx);
 goto fail;
 }
@@ -779,7 +788,7 @@ static void __devexit iic_remove(struct ocp_device *ocp)
 struct ibm_iic_private* dev = (struct 
ibm_iic_private*)ocp_get_drvdata(ocp);
 BUG_ON(dev == NULL);
 if (i2c_del_adapter(dev-adap)){
-printk(KERN_CRIT ibm-iic%d: failed to delete i2c adapter :(\n,
+printk(KERN_ERR ibm-iic%d: failed to delete i2c adapter :(\n,
 dev-idx);
 /* That's *very* bad, just shutdown IRQ ... */
 if (dev-irq = 0){
@@ -831,3 +840,186 @@ static void __exit iic_exit(void)
 
 module_init(iic_init);
 module_exit(iic_exit);
+#else
+/*
+ * Register single 

Re: How complete should the DTS be?

2008-01-07 Thread Kumar Gala

On Jan 7, 2008, at 8:07 PM, Sean MacLennan wrote:

 Just a general question about DTS completeness. Like all 440EP
 processors, the taco has two i2c buses. However, only one bus has
 anything connected to it.

 Should I show both bus entries in the DTS, or only the one that is  
 used?
 I have generally only been showing the devices that are present. i.e.
 Only one emac, only one serial port.

 Is there a convention for this?


The .dts should reflect the HW as its used.  On some reference boards  
we might put out more info because of the various configs these types  
of boards can be setup in.  However if something has a static config  
just describe that.  So in your example of two i2c buses with only one  
connected, just describe the one that is used.

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


Re: [PATCH/RFC] mpc83xx/85xx SysRQ/brk over 8250 console

2008-01-07 Thread Kumar Gala

On Jan 7, 2008, at 11:27 PM, Paul Gortmaker wrote:

 It seems that if a break is rec'd on the serial console (as per SysRQ
 or similar) on some 83xx and 85xx processors, then a pulse of IRQs is
 generated which makes the use of SysRQ itself about 99% impossible.  I
 experimented with trying several ACK strategies, but in the end the
 thing which worked best was just to wait for the surge of events to  
 pass
 (a fraction of a second).  The number of events can be on the order of
 1000 (as reported by /proc/interrupts)

 I really dislike seeing board specific ifdefs within what should be
 board independent code, so I'm hoping that once the problem is known,
 that a more elegant solution will pop into someone's head.  Or at  
 least
 this will hopefully save someone the grief of re-investigating the  
 source
 and start a discussion.

 I've seen this on two different 834x boards and also an 8548 based
 board.  At this point, it is not clear to me if the problem extends
 beyond these CPU/soc to all with UARTs at 4500/4600.

 While less than ideal, the work-around below which simply ignores the
 events does allow a person to use SysRQ on such platforms.

 The definition of the RFE bit (Rx FIFO error) can be found in pretty
 much any of the MPC CPU PDFs (for those with 4500/4600 16550s).

 Paul.

This should really get posted to [EMAIL PROTECTED] and  
probably [EMAIL PROTECTED] lists.

- k

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


Re: [PATCH] sbc85xx: remove PCI exclude device for sbc8548/sbc8560

2008-01-07 Thread Kumar Gala

On Jan 7, 2008, at 4:40 PM, Paul Gortmaker wrote:

 The PCI exclude device for the sbc85xx boards was only filtering out
 the PHB and nothing else.  This functionality is no longer required
 at a board specific level -- it is handled as a more global quirk now.

 Signed-off-by: Paul Gortmaker [EMAIL PROTECTED]

Can you respin the full patch set with the update .dts to v1.

- k

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


Re: [PATCH] Fix remainder calculating bug in single floating point division

2008-01-07 Thread Kumar Gala

On Jan 6, 2008, at 2:44 PM, Dan Malek wrote:


 On Jan 6, 2008, at 12:07 PM, Benjamin Herrenschmidt wrote:

 It's nice to see somebody digging in that scary math emu stuff. If  
 you
 could also get rid of the warnings, it would be perfect :-)

 Yes, it is :-)  I didn't think it would have a life beyond MPC8xx.

  that this code was lifted from
 somewhere else (glibc ? gcc soft-float ?),

 It seems like a lifetime ago  I copied the framework
 from Sparc, and the internals from gcc soft-float.  I didn't
 change any of the internal emulation functions (hence,
 some of the warnings), just the calling interface.

 While it's convenient, I still don't think kernel float
 emulation should be a solution.  The tools should
 generate soft-float for the applications and libraries.

If we think this is really true, we could move to using include/math- 
emu/* instead of the files in powerpc/math-emu.

The problem I had was when I tried to recreate the history of the code  
in powerpc/math-emu and how it doesn't really match the glibc code  
base.  There are some differences and I wasn't sure if they were do to  
trying to match PPC HW at a bit level or not.

I was hoping that the work Liu Yu would get as a bit of a testsuite to  
see if there was any harm in moving over to include/math-emu.

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


Re: [PATCH] Fix remainder calculating bug in single floating point division

2008-01-07 Thread Kumar Gala

On Jan 6, 2008, at 8:26 AM, Liu Yu wrote:

 This bug exists in the emulation of floating point division for  
 powerpc.

 The original code cannot count the remainder correctly.
 I can provide a test case to trigger this bug.
 When use fdiv to count 1.1754941e-38f / 0.999f,
 the result is expected to be 1.175494e-38f,
 but we will get 1.174921e-38f in the original case.

 Comments are always welcomed!

can you provide the test case that shows the error.

- k

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


Re: [PATCH] Fix carry bug in 128-bit unsigned integer adding

2008-01-07 Thread Kumar Gala

On Jan 6, 2008, at 8:26 AM, Liu Yu wrote:

 This bug exists in math emulation for powerpc.
 The macro define are mainly used by multiplication.

 When adding two unsigned operands ( r = x + y ),
 the carry bit can be counted by whether r is less than x.
 However, when adding three unsigned operands, this method does not  
 work.

 The original code below uses this method to count carry,
 it apparently overlook the case of three operands.
 Assume all the operands is 32-bit wide,
 ( r = x + y + last_carry , x = 0, y = 0x, last_carry = 1),
 then r is no less than x but it actually gets a carry.

 I tried to fix this bug, but this patch seems not that pretty.
 Are there any better ideas?
 Comments are always welcomed!

take a look at how include/math-emu/op-4.h implements __FP_FRAC_ADD_4  
 __FP_FRAC_SUB_4.  Will that fix the bug, if so we should make the  
code match how its done there.

- k

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


Re: [PATCH] Hwmon for Taco

2008-01-07 Thread Sean MacLennan
Benjamin Herrenschmidt wrote:
 That should be in the device-tree...

 Cheers,
 Ben.

   

Now in the device tree. The name of the file has changed.

Cheers,
Sean

diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig
index a0445be..1f89186 100644
--- a/drivers/hwmon/Kconfig
+++ b/drivers/hwmon/Kconfig
@@ -57,6 +57,16 @@ config SENSORS_ABITUGURU3
   This driver can also be built as a module.  If so, the module
   will be called abituguru3.
 
+config SENSORS_AD7414
+tristate Analog Devices AD7414
+depends on I2C  EXPERIMENTAL
+help
+  If you say yes here you get support for the Analog Devices
+  AD7414 temperature monitoring chip.
+
+  This driver can also be built as a module. If so, the module
+  will be called ad7414.
+
 config SENSORS_AD7418
 tristate Analog Devices AD7416, AD7417 and AD7418
 depends on I2C  EXPERIMENTAL
@@ -763,4 +773,13 @@ config HWMON_DEBUG_CHIP
   a problem with I2C support and want to see more of what is going
   on.
 
+config PIKA_DTM
+tristate PIKA DTM (Dynamic Thermal Management)
+depends on HWMON  WARP
+select SENSORS_AD7414
+default y
+help
+  Say Y here if you have a PIKA Warp(tm) Appliance. This driver is
+  required for the DTM to work properly.
+
 endif # HWMON
diff --git a/drivers/hwmon/Makefile b/drivers/hwmon/Makefile
index 55595f6..0c6ee71 100644
--- a/drivers/hwmon/Makefile
+++ b/drivers/hwmon/Makefile
@@ -15,6 +15,7 @@ obj-$(CONFIG_SENSORS_W83791D)+= w83791d.o
 
 obj-$(CONFIG_SENSORS_ABITUGURU)+= abituguru.o
 obj-$(CONFIG_SENSORS_ABITUGURU3)+= abituguru3.o
+obj-$(CONFIG_SENSORS_AD7414)+= ad7414.o
 obj-$(CONFIG_SENSORS_AD7418)+= ad7418.o
 obj-$(CONFIG_SENSORS_ADM1021)+= adm1021.o
 obj-$(CONFIG_SENSORS_ADM1025)+= adm1025.o
@@ -69,7 +70,8 @@ obj-$(CONFIG_SENSORS_VT8231)+= vt8231.o
 obj-$(CONFIG_SENSORS_W83627EHF)+= w83627ehf.o
 obj-$(CONFIG_SENSORS_W83L785TS)+= w83l785ts.o
 
+obj-$(CONFIG_PIKA_DTM)+= pika-dtm.o
+
 ifeq ($(CONFIG_HWMON_DEBUG_CHIP),y)
 EXTRA_CFLAGS += -DDEBUG
 endif
-
--- /dev/null2005-11-20 22:22:37.0 -0500
+++ drivers/hwmon/pika-dtm.c2008-01-08 01:23:32.0 -0500
@@ -0,0 +1,87 @@
+/*
+ *  drivers/hwmon/pika-dtm.c
+ *
+ *  Overview: On the Warp, the fpga controls the fan. This provides
+ *  the temperature to the fpga.
+ *
+ *  Copyright (c) 2008 PIKA Technologies
+ *Sean MacLennan [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 theLicense, or 
(at your
+ *  option) any later version.
+ *
+ */
+
+#include linux/module.h
+#include linux/kthread.h
+#include linux/io.h
+#include linux/of_platform.h
+
+
+extern int ad7414_get_temp(void);
+
+static unsigned __iomem *dtm_fpga;
+static struct task_struct *dtm_thread;
+
+
+static int pika_dtm_thread(void *arg)
+{
+while(!kthread_should_stop()) {
+int temp = ad7414_get_temp();
+
+// Write to FPGA
+out_be32(dtm_fpga, temp);
+
+set_current_state(TASK_INTERRUPTIBLE);
+schedule_timeout(HZ);
+}
+
+return 0;
+}
+
+
+int __init pika_dtm_init(void)
+{
+struct device_node *np;
+struct resource res;
+
+if((np = of_find_compatible_node(NULL, NULL, pika,fpga)) == NULL) {
+printk(KERN_ERR __FILE__ : Unable to find FPGA\n);
+return -ENOENT;
+}
+
+/* We do not call of_iomap here since it would map in the entire
+ * fpga space, which is overkill for 4 bytes.
+ */
+if(of_address_to_resource(np, 0, res) ||
+   (dtm_fpga = ioremap(res.start + 0x20, 4)) == NULL) {
+printk(KERN_ERR __FILE__ : Unable to map FPGA\n);
+return -ENOENT;
+}
+
+dtm_thread = kthread_run(pika_dtm_thread, NULL, pika-dtm);
+
+if(IS_ERR(dtm_thread)) {
+iounmap(dtm_fpga);
+printk(KERN_ERR __FILE__ : Unable to start PIKA DTM thread\n);
+return PTR_ERR(dtm_thread);
+}
+
+return 0;
+}
+module_init(pika_dtm_init);
+
+
+void __exit pika_dtm_exit(void)
+{
+kthread_stop(dtm_thread);
+iounmap(dtm_fpga);
+}
+module_exit(pika_dtm_exit);
+
+
+MODULE_DESCRIPTION(PIKA DTM driver);
+MODULE_AUTHOR(Sean MacLennan);
+MODULE_LICENSE(GPL);
--- /dev/null2005-11-20 22:22:37.0 -0500
+++ drivers/hwmon/ad7414.c2008-01-05 20:36:06.0 -0500
@@ -0,0 +1,296 @@
+/*
+ * An hwmon driver for the Analog Devices AD7414
+ *
+ * Copyright 2006 Stefan Roese [EMAIL PROTECTED], DENX Software Engineering
+ *
+ * Based on ad7418.c
+ * Copyright 2006 Tower Technologies, Alessandro Zummo 
[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.
+ */
+

Re: [PATCH] i2c-ibm_iic driver - new patch

2008-01-07 Thread Stephen Rothwell
On Tue, 08 Jan 2008 00:56:27 -0500 Sean MacLennan [EMAIL PROTECTED] wrote:

 Stephen Rothwell wrote:
 
  On Mon, 07 Jan 2008 21:03:12 -0500 Sean MacLennan [EMAIL PROTECTED] wrote:

  Please don't post patches as attachments.
  
 Ok.

Unfortunately, you are using thunderbird and so the patch is now wrapped.
There is a workaround, see Documentation/email-clients.txt.

  Please split the assignments from the tests.  Here and elsewhere.

 I made the changes in my code. I am trying to leave the original code as 
 much as possible.

Thats all we ask.

  +  } else {
  +  if (dev-irq != NO_IRQ){
  +  iic_interrupt_mode(dev, 0);
  +  free_irq(dev-irq, dev);
  +  }
  +  iounmap(dev-vaddr);
  +  kfree(dev);
  
 
  Should these last two be after the below brace?
 

 I'm not really qualified to answer, but I will anyway ;) I assume the 
 original author is basically saying if he cannot delete the adapter, it 
 is unsafe to free the memory since the i2c code may still use it. If I 
 have read that right, then I agree.

OK, I can see that this is a that should not happen condition.

 +if (iic_force_poll)
 +dev-irq = NO_IRQ;
 +else if ((dev-irq = irq_of_parse_and_map(np, 0)) == NO_IRQ)

You missed this one.

Overall looks better, except all your indentation is now 4 spaces. We use
a TAB character for each level of indentation and you should be able to
set your editor to *display* the TABs as 4 places if that is what you like.

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


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

Re: [PATCH] Hwmon for Taco

2008-01-07 Thread Grant Likely
On 1/7/08, Sean MacLennan [EMAIL PROTECTED] wrote:
 diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig
 index a0445be..1f89186 100644
 --- a/drivers/hwmon/Kconfig
 +++ b/drivers/hwmon/Kconfig
 @@ -57,6 +57,16 @@ config SENSORS_ABITUGURU3
This driver can also be built as a module.  If so, the module
will be called abituguru3.

 +config SENSORS_AD7414
 +tristate Analog Devices AD7414
 +depends on I2C  EXPERIMENTAL
 +help
 +  If you say yes here you get support for the Analog Devices
 +  AD7414 temperature monitoring chip.
 +
 +  This driver can also be built as a module. If so, the module
 +  will be called ad7414.
 +
  config SENSORS_AD7418
  tristate Analog Devices AD7416, AD7417 and AD7418
  depends on I2C  EXPERIMENTAL
 @@ -763,4 +773,13 @@ config HWMON_DEBUG_CHIP
a problem with I2C support and want to see more of what is going
on.

 +config PIKA_DTM
 +tristate PIKA DTM (Dynamic Thermal Management)
 +depends on HWMON  WARP
 +select SENSORS_AD7414

select is dangerous because it bypasses dependency checking.  Make it
'depends on' instead.

 +default y
 +help
 +  Say Y here if you have a PIKA Warp(tm) Appliance. This driver is
 +  required for the DTM to work properly.
 +

This patch should be split in 2; one for the AD7414 driver and one for
the thermal management driver.

  endif # HWMON
 diff --git a/drivers/hwmon/Makefile b/drivers/hwmon/Makefile
 index 55595f6..0c6ee71 100644
 --- a/drivers/hwmon/Makefile
 +++ b/drivers/hwmon/Makefile
 @@ -15,6 +15,7 @@ obj-$(CONFIG_SENSORS_W83791D)+= w83791d.o

  obj-$(CONFIG_SENSORS_ABITUGURU)+= abituguru.o
  obj-$(CONFIG_SENSORS_ABITUGURU3)+= abituguru3.o
 +obj-$(CONFIG_SENSORS_AD7414)+= ad7414.o
  obj-$(CONFIG_SENSORS_AD7418)+= ad7418.o
  obj-$(CONFIG_SENSORS_ADM1021)+= adm1021.o
  obj-$(CONFIG_SENSORS_ADM1025)+= adm1025.o
 @@ -69,7 +70,8 @@ obj-$(CONFIG_SENSORS_VT8231)+= vt8231.o
  obj-$(CONFIG_SENSORS_W83627EHF)+= w83627ehf.o
  obj-$(CONFIG_SENSORS_W83L785TS)+= w83l785ts.o

 +obj-$(CONFIG_PIKA_DTM)+= pika-dtm.o
 +
  ifeq ($(CONFIG_HWMON_DEBUG_CHIP),y)
  EXTRA_CFLAGS += -DDEBUG
  endif
 -
 --- /dev/null2005-11-20 22:22:37.0 -0500
 +++ drivers/hwmon/pika-dtm.c2008-01-08 01:23:32.0 -0500

This is *very* board specific and not very complex a driver.  It
should probably live with the platform code somewhere in
arch/powerpc/platforms.  You can use the machine_device_initcall()
hook to kick off the thread.

 @@ -0,0 +1,87 @@
 +/*
 + *  drivers/hwmon/pika-dtm.c
 + *
 + *  Overview: On the Warp, the fpga controls the fan. This provides
 + *  the temperature to the fpga.
 + *
 + *  Copyright (c) 2008 PIKA Technologies
 + *Sean MacLennan [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 theLicense, or
 (at your
 + *  option) any later version.

Your mailer chewed up the patch here (line wrap).

 + *
 + */
 +
 +#include linux/module.h
 +#include linux/kthread.h
 +#include linux/io.h
 +#include linux/of_platform.h
 +
 +
 +extern int ad7414_get_temp(void);

Bad!  Function decls must be in common header files.

 +
 +static unsigned __iomem *dtm_fpga;
 +static struct task_struct *dtm_thread;
 +
 +
 +static int pika_dtm_thread(void *arg)
 +{
 +while(!kthread_should_stop()) {
 +int temp = ad7414_get_temp();
 +
 +// Write to FPGA

Style; use /* */, not //

 +out_be32(dtm_fpga, temp);
 +
 +set_current_state(TASK_INTERRUPTIBLE);
 +schedule_timeout(HZ);
 +}
 +
 +return 0;
 +}
 +
 +
 +int __init pika_dtm_init(void)
 +{
 +struct device_node *np;
 +struct resource res;
 +
 +if((np = of_find_compatible_node(NULL, NULL, pika,fpga)) == NULL) {
 +printk(KERN_ERR __FILE__ : Unable to find FPGA\n);
 +return -ENOENT;
 +}
 +
 +/* We do not call of_iomap here since it would map in the entire
 + * fpga space, which is overkill for 4 bytes.
 + */

iomapping is not expensive; just map the whole space (it's going to
map a minimum 4k page anyway).  The code will be easier to read if you
just use of_iomap().

 +if(of_address_to_resource(np, 0, res) ||
 +   (dtm_fpga = ioremap(res.start + 0x20, 4)) == NULL) {
 +printk(KERN_ERR __FILE__ : Unable to map FPGA\n);
 +return -ENOENT;
 +}
 +
 +dtm_thread = kthread_run(pika_dtm_thread, NULL, pika-dtm);
 +
 +if(IS_ERR(dtm_thread)) {
 +iounmap(dtm_fpga);
 +printk(KERN_ERR __FILE__ : Unable to start PIKA DTM thread\n);
 +return PTR_ERR(dtm_thread);
 +}
 +
 +return 0;
 +}
 +module_init(pika_dtm_init);
 +
 +
 +void __exit pika_dtm_exit(void)
 +{
 +kthread_stop(dtm_thread);
 +iounmap(dtm_fpga);
 +}
 +module_exit(pika_dtm_exit);
 +
 

[PATCH 2/3 v2] add MPC837x USB platform support

2008-01-07 Thread Li Yang
Add chip specific and board specific initialization for MPC837x USB.

Signed-off-by: Li Yang [EMAIL PROTECTED]
---
 arch/powerpc/platforms/83xx/mpc837x_mds.c |   51 +
 arch/powerpc/platforms/83xx/mpc83xx.h |3 ++
 arch/powerpc/platforms/83xx/usb.c |   40 ++
 3 files changed, 94 insertions(+), 0 deletions(-)

diff --git a/arch/powerpc/platforms/83xx/mpc837x_mds.c 
b/arch/powerpc/platforms/83xx/mpc837x_mds.c
index 166c111..c7579f6 100644
--- a/arch/powerpc/platforms/83xx/mpc837x_mds.c
+++ b/arch/powerpc/platforms/83xx/mpc837x_mds.c
@@ -27,6 +27,56 @@ unsigned long isa_io_base = 0;
 unsigned long isa_mem_base = 0;
 #endif
 
+#define BCSR12_USB_SER_MASK0x8a
+#define BCSR12_USB_SER_PIN 0x80
+#define BCSR12_USB_SER_DEVICE  0x02
+extern int mpc837x_usb_cfg(void);
+
+static int mpc837xmds_usb_cfg(void)
+{
+   struct device_node *np;
+   const void *phy_type, *mode;
+   void __iomem *bcsr_regs = NULL;
+   u8 bcsr12;
+   int ret;
+
+   ret = mpc837x_usb_cfg();
+   if (ret)
+   return ret;
+   /* Map BCSR area */
+   np = of_find_node_by_name(NULL, bcsr);
+   if (np) {
+   struct resource res;
+
+   of_address_to_resource(np, 0, res);
+   bcsr_regs = ioremap(res.start, res.end - res.start + 1);
+   of_node_put(np);
+   }
+   if (!bcsr_regs)
+   return -1;
+
+   np = of_find_node_by_name(NULL, usb);
+   if (!np)
+   return -ENODEV;
+   phy_type = of_get_property(np, phy_type, NULL);
+   if (phy_type  !strcmp(phy_type, ulpi)) {
+   clrbits8(bcsr_regs + 12, BCSR12_USB_SER_PIN);
+   } else if (phy_type  !strcmp(phy_type, serial)) {
+   mode = of_get_property(np, dr_mode, NULL);
+   bcsr12 = in_8(bcsr_regs + 12)  ~BCSR12_USB_SER_MASK;
+   bcsr12 |= BCSR12_USB_SER_PIN;
+   if (mode  !strcmp(mode, peripheral))
+   bcsr12 |= BCSR12_USB_SER_DEVICE;
+   out_8(bcsr_regs + 12, bcsr12);
+   } else {
+   printk(KERN_ERR USB DR: unsupported PHY\n);
+   }
+
+   of_node_put(np);
+   iounmap(bcsr_regs);
+   return 0;
+}
+
 /* 
  *
  * Setup the architecture
@@ -45,6 +95,7 @@ static void __init mpc837x_mds_setup_arch(void)
for_each_compatible_node(np, pci, fsl,mpc8349-pci)
mpc83xx_add_bridge(np);
 #endif
+   mpc837xmds_usb_cfg();
 }
 
 static struct of_device_id mpc837x_ids[] = {
diff --git a/arch/powerpc/platforms/83xx/mpc83xx.h 
b/arch/powerpc/platforms/83xx/mpc83xx.h
index b778cb4..88bb748 100644
--- a/arch/powerpc/platforms/83xx/mpc83xx.h
+++ b/arch/powerpc/platforms/83xx/mpc83xx.h
@@ -14,6 +14,7 @@
 #define MPC83XX_SCCR_USB_DRCM_11   0x0030
 #define MPC83XX_SCCR_USB_DRCM_01   0x0010
 #define MPC83XX_SCCR_USB_DRCM_10   0x0020
+#define MPC837X_SCCR_USB_DRCM_11   0x00c0
 
 /* system i/o configuration register low */
 #define MPC83XX_SICRL_OFFS 0x114
@@ -22,6 +23,8 @@
 #define MPC834X_SICRL_USB1 0x2000
 #define MPC831X_SICRL_USB_MASK 0x0c00
 #define MPC831X_SICRL_USB_ULPI 0x0800
+#define MPC837X_SICRL_USB_MASK 0xf000
+#define MPC837X_SICRL_USB_ULPI 0x5000
 
 /* system i/o configuration register high */
 #define MPC83XX_SICRH_OFFS 0x118
diff --git a/arch/powerpc/platforms/83xx/usb.c 
b/arch/powerpc/platforms/83xx/usb.c
index b45160f..b1de453 100644
--- a/arch/powerpc/platforms/83xx/usb.c
+++ b/arch/powerpc/platforms/83xx/usb.c
@@ -179,3 +179,43 @@ int mpc831x_usb_cfg(void)
return ret;
 }
 #endif /* CONFIG_PPC_MPC831x */
+
+#ifdef CONFIG_PPC_MPC837x
+int mpc837x_usb_cfg(void)
+{
+   void __iomem *immap;
+   struct device_node *np = NULL;
+   const void *prop;
+   int ret = 0;
+
+   np = of_find_compatible_node(NULL, usb, fsl-usb2-dr);
+   if (!np)
+   return -ENODEV;
+   prop = of_get_property(np, phy_type, NULL);
+
+   if (!prop || (strcmp(prop, ulpi)  strcmp(prop, serial))) {
+   printk(KERN_WARNING 837x USB PHY type not supported\n);
+   of_node_put(np);
+   return -EINVAL;
+   }
+
+   /* Map IMMR space for pin and clock settings */
+   immap = ioremap(get_immrbase(), 0x1000);
+   if (!immap) {
+   of_node_put(np);
+   return -ENOMEM;
+   }
+
+   /* Configure clock */
+   clrsetbits_be32(immap + MPC83XX_SCCR_OFFS, MPC837X_SCCR_USB_DRCM_11,
+   MPC837X_SCCR_USB_DRCM_11);
+
+   /* Configure pin mux for ULPI/serial */
+   clrsetbits_be32(immap + MPC83XX_SICRL_OFFS, MPC837X_SICRL_USB_MASK,
+   MPC837X_SICRL_USB_ULPI);
+
+   iounmap(immap);
+   of_node_put(np);
+   return ret;
+}
+#endif /* CONFIG_PPC_MPC837x */
-- 

help

2008-01-07 Thread 张自强
Help

-邮件原件-
发件人: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] 代表
[EMAIL PROTECTED]
发送时间: 2008年1月8日 14:59
收件人: linuxppc-dev@ozlabs.org
主题: Linuxppc-dev Digest, Vol 41, Issue 56

Send Linuxppc-dev mailing list submissions to
linuxppc-dev@ozlabs.org

To subscribe or unsubscribe via the World Wide Web, visit
https://ozlabs.org/mailman/listinfo/linuxppc-dev
or, via email, send a message with subject or body 'help' to
[EMAIL PROTECTED]

You can reach the person managing the list at
[EMAIL PROTECTED]

When replying, please edit your Subject line so it is more specific
than Re: Contents of Linuxppc-dev digest...


Today's Topics:

   1. Re: [PATCH] Fix remainder calculating bug in single floating
  point division (Kumar Gala)
   2. Re: [PATCH] Fix carry bug in 128-bit unsigned integer adding
  (Kumar Gala)
   3. Re: [PATCH] Hwmon for Taco (Sean MacLennan)
   4. Re: [PATCH] i2c-ibm_iic driver - new patch (Stephen Rothwell)
   5. Re: [PATCH] Hwmon for Taco (Grant Likely)


--

Message: 1
Date: Tue, 8 Jan 2008 00:22:25 -0600
From: Kumar Gala [EMAIL PROTECTED]
Subject: Re: [PATCH] Fix remainder calculating bug in single floating
point   division
To: Liu Yu [EMAIL PROTECTED]
Cc: linuxppc-dev@ozlabs.org
Message-ID: [EMAIL PROTECTED]
Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes


On Jan 6, 2008, at 8:26 AM, Liu Yu wrote:

 This bug exists in the emulation of floating point division for  
 powerpc.

 The original code cannot count the remainder correctly.
 I can provide a test case to trigger this bug.
 When use fdiv to count 1.1754941e-38f / 0.999f,
 the result is expected to be 1.175494e-38f,
 but we will get 1.174921e-38f in the original case.

 Comments are always welcomed!

can you provide the test case that shows the error.

- k



--

Message: 2
Date: Tue, 8 Jan 2008 00:27:59 -0600
From: Kumar Gala [EMAIL PROTECTED]
Subject: Re: [PATCH] Fix carry bug in 128-bit unsigned integer adding
To: Liu Yu [EMAIL PROTECTED]
Cc: linuxppc-dev@ozlabs.org
Message-ID: [EMAIL PROTECTED]
Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes


On Jan 6, 2008, at 8:26 AM, Liu Yu wrote:

 This bug exists in math emulation for powerpc.
 The macro define are mainly used by multiplication.

 When adding two unsigned operands ( r = x + y ),
 the carry bit can be counted by whether r is less than x.
 However, when adding three unsigned operands, this method does not  
 work.

 The original code below uses this method to count carry,
 it apparently overlook the case of three operands.
 Assume all the operands is 32-bit wide,
 ( r = x + y + last_carry , x = 0, y = 0x, last_carry = 1),
 then r is no less than x but it actually gets a carry.

 I tried to fix this bug, but this patch seems not that pretty.
 Are there any better ideas?
 Comments are always welcomed!

take a look at how include/math-emu/op-4.h implements __FP_FRAC_ADD_4  
 __FP_FRAC_SUB_4.  Will that fix the bug, if so we should make the  
code match how its done there.

- k



--

Message: 3
Date: Tue, 08 Jan 2008 01:30:00 -0500
From: Sean MacLennan [EMAIL PROTECTED]
Subject: Re: [PATCH] Hwmon for Taco
To: [EMAIL PROTECTED]
Cc: linuxppc-dev@ozlabs.org
Message-ID: [EMAIL PROTECTED]
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

Benjamin Herrenschmidt wrote:
 That should be in the device-tree...

 Cheers,
 Ben.

   

Now in the device tree. The name of the file has changed.

Cheers,
Sean

diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig
index a0445be..1f89186 100644
--- a/drivers/hwmon/Kconfig
+++ b/drivers/hwmon/Kconfig
@@ -57,6 +57,16 @@ config SENSORS_ABITUGURU3
   This driver can also be built as a module.  If so, the module
   will be called abituguru3.
 
+config SENSORS_AD7414
+tristate Analog Devices AD7414
+depends on I2C  EXPERIMENTAL
+help
+  If you say yes here you get support for the Analog Devices
+  AD7414 temperature monitoring chip.
+
+  This driver can also be built as a module. If so, the module
+  will be called ad7414.
+
 config SENSORS_AD7418
 tristate Analog Devices AD7416, AD7417 and AD7418
 depends on I2C  EXPERIMENTAL
@@ -763,4 +773,13 @@ config HWMON_DEBUG_CHIP
   a problem with I2C support and want to see more of what is going
   on.
 
+config PIKA_DTM
+tristate PIKA DTM (Dynamic Thermal Management)
+depends on HWMON  WARP
+select SENSORS_AD7414
+default y
+help
+  Say Y here if you have a PIKA Warp(tm) Appliance. This driver is
+  required for the DTM to work properly.
+
 endif # HWMON
diff --git a/drivers/hwmon/Makefile b/drivers/hwmon/Makefile
index 55595f6..0c6ee71 100644
--- a/drivers/hwmon/Makefile
+++ b/drivers/hwmon/Makefile
@@ -15,6 +15,7 @@ obj-$(CONFIG_SENSORS_W83791D)+= w83791d.o
 
 

Re: [PATCH 3/4] mtd: Factor out OF partition support from the NOR driver.

2008-01-07 Thread Stefan Roese
On Thursday 13 December 2007, Scott Wood wrote:
 Signed-off-by: Scott Wood [EMAIL PROTECTED]

Acked-by: Stefan Roese [EMAIL PROTECTED]

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


RE: [PATCH 1/3] add default device trees for MPC837x MDS board

2008-01-07 Thread Li Yang
 -Original Message-
 From: Kumar Gala [mailto:[EMAIL PROTECTED] 
 Sent: Tuesday, January 08, 2008 3:37 PM
 To: Li Yang
 Cc: linuxppc-dev@ozlabs.org; [EMAIL PROTECTED]
 Subject: Re: [PATCH 1/3] add default device trees for MPC837x 
 MDS board
 
 
 On Jan 7, 2008, at 6:03 AM, Li Yang wrote:
 
  Signed-off-by: Li Yang [EMAIL PROTECTED]
  ---
  address comments and use new dts spec.
 
  arch/powerpc/boot/dts/mpc8377_mds.dts |  277 
 
  +++
  arch/powerpc/boot/dts/mpc8378_mds.dts |  263 
 
  +
  arch/powerpc/boot/dts/mpc8379_mds.dts |  291 
 
  +
  3 files changed, 831 insertions(+), 0 deletions(-)
 
 Could I convince you to convert these to dts-v1 format?

Ok, I can do it.  The DTS spec changes too much lately.  :(

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


Re: [PATCH 2/4] nand base: Give drivers a chance to do late initialization.

2008-01-07 Thread David Woodhouse

On Thu, 2007-12-13 at 11:15 -0600, Scott Wood wrote:
 Some nand controllers, such as the Freescale enhanced local bus controller,
 need to do late initialization based on details of the chip that has been
 probed, such as chip size, large/small pages, etc.  A late_init() callback
 method is added to allow this.

Do you really need this so late? Can't it be done between
nand_scan_ident() and nand_scan_tail()? That's why we split nand_scan()
into two in the first place...

-- 
dwmw2

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


Re: [PATCH 1/3] add default device trees for MPC837x MDS board

2008-01-07 Thread Kumar Gala

On Jan 7, 2008, at 6:03 AM, Li Yang wrote:

 Signed-off-by: Li Yang [EMAIL PROTECTED]
 ---
 address comments and use new dts spec.

 arch/powerpc/boot/dts/mpc8377_mds.dts |  277  
 +++
 arch/powerpc/boot/dts/mpc8378_mds.dts |  263  
 +
 arch/powerpc/boot/dts/mpc8379_mds.dts |  291  
 +
 3 files changed, 831 insertions(+), 0 deletions(-)

Could I convince you to convert these to dts-v1 format?

- k

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


  1   2   >