[PATCH] Make #include sysdev/foo.h work for 64-bit powerpc

2008-04-01 Thread Michael Ellerman
We currently have inconsistent settings between 32  64-bit which means
32-bit code can #include sysdev/foo.h but 64-bit code can't.

So make the (C|A|CPP)FLAGS settings to allow this common. Doing so makes
the CPPFLAGS-y and AFLAGS-y variables unnecessary, so just fold them into
KBUILD_CPPFLAGS and KBUILD_AFLAGS respectively.

Signed-off-by: Michael Ellerman [EMAIL PROTECTED]
---
 arch/powerpc/Makefile |   10 --
 1 files changed, 4 insertions(+), 6 deletions(-)


This is 26 material.

diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
index 1c6ce35..aa9829a 100644
--- a/arch/powerpc/Makefile
+++ b/arch/powerpc/Makefile
@@ -71,13 +71,11 @@ endif
 
 LDFLAGS_vmlinux:= -Bstatic
 
-CPPFLAGS-$(CONFIG_PPC32) := -Iarch/$(ARCH)
-AFLAGS-$(CONFIG_PPC32) := -Iarch/$(ARCH)
 CFLAGS-$(CONFIG_PPC64) := -mminimal-toc -mtraceback=none  -mcall-aixdesc
-CFLAGS-$(CONFIG_PPC32) := -Iarch/$(ARCH) -ffixed-r2 -mmultiple
-KBUILD_CPPFLAGS+= $(CPPFLAGS-y)
-KBUILD_AFLAGS  += $(AFLAGS-y)
-KBUILD_CFLAGS  += -msoft-float -pipe $(CFLAGS-y)
+CFLAGS-$(CONFIG_PPC32) := -ffixed-r2 -mmultiple
+KBUILD_CPPFLAGS+= -Iarch/$(ARCH)
+KBUILD_AFLAGS  += -Iarch/$(ARCH)
+KBUILD_CFLAGS  += -msoft-float -pipe -Iarch/$(ARCH) $(CFLAGS-y)
 CPP= $(CC) -E $(KBUILD_CFLAGS)
 
 CHECKFLAGS += -m$(CONFIG_WORD_SIZE) -D__powerpc__ 
-D__powerpc$(CONFIG_WORD_SIZE)__
-- 
1.5.2.rc1.1884.g59b20

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


[RFC/PATCH 1/4] Move xics_setup_8259_cascade() into platforms/pseries/setup.c

2008-04-01 Thread Michael Ellerman
The code in xics.c to setup the i8259 cascaded irq handler is not really
xics specific, so move it into setup.c - we will clean this up further in
a subsequent patch.

Signed-off-by: Michael Ellerman [EMAIL PROTECTED]
---
 arch/powerpc/platforms/pseries/setup.c |   53 +++-
 arch/powerpc/platforms/pseries/xics.c  |   48 -
 arch/powerpc/platforms/pseries/xics.h  |3 --
 3 files changed, 52 insertions(+), 52 deletions(-)

diff --git a/arch/powerpc/platforms/pseries/setup.c 
b/arch/powerpc/platforms/pseries/setup.c
index fdb9b1c..43e4801 100644
--- a/arch/powerpc/platforms/pseries/setup.c
+++ b/arch/powerpc/platforms/pseries/setup.c
@@ -127,6 +127,51 @@ void pseries_8259_cascade(unsigned int irq, struct 
irq_desc *desc)
desc-chip-eoi(irq);
 }
 
+static void __init xics_setup_8259_cascade(void)
+{
+   struct device_node *np, *old, *found = NULL;
+   int cascade, naddr;
+   const u32 *addrp;
+   unsigned long intack = 0;
+
+   for_each_node_by_type(np, interrupt-controller)
+   if (of_device_is_compatible(np, chrp,iic)) {
+   found = np;
+   break;
+   }
+   if (found == NULL) {
+   printk(KERN_DEBUG xics: no ISA interrupt controller\n);
+   return;
+   }
+   cascade = irq_of_parse_and_map(found, 0);
+   if (cascade == NO_IRQ) {
+   printk(KERN_ERR xics: failed to map cascade interrupt);
+   return;
+   }
+   pr_debug(xics: cascade mapped to irq %d\n, cascade);
+
+   for (old = of_node_get(found); old != NULL ; old = np) {
+   np = of_get_parent(old);
+   of_node_put(old);
+   if (np == NULL)
+   break;
+   if (strcmp(np-name, pci) != 0)
+   continue;
+   addrp = of_get_property(np, 8259-interrupt-acknowledge, NULL);
+   if (addrp == NULL)
+   continue;
+   naddr = of_n_addr_cells(np);
+   intack = addrp[naddr-1];
+   if (naddr  1)
+   intack |= ((unsigned long)addrp[naddr-2])  32;
+   }
+   if (intack)
+   printk(KERN_DEBUG xics: PCI 8259 intack at 0x%016lx\n, 
intack);
+   i8259_init(found, intack);
+   of_node_put(found);
+   set_irq_chained_handler(cascade, pseries_8259_cascade);
+}
+
 static void __init pseries_mpic_init_IRQ(void)
 {
struct device_node *np, *old, *cascade = NULL;
@@ -206,6 +251,12 @@ static void __init pseries_mpic_init_IRQ(void)
set_irq_chained_handler(cascade_irq, pseries_8259_cascade);
 }
 
+static void __init pseries_xics_init_IRQ(void)
+{
+   xics_init_IRQ();
+   xics_setup_8259_cascade();
+}
+
 static void pseries_lpar_enable_pmcs(void)
 {
unsigned long set, reset;
@@ -235,7 +286,7 @@ static void __init pseries_discover_pic(void)
smp_init_pseries_mpic();
return;
} else if (strstr(typep, ppc-xicp)) {
-   ppc_md.init_IRQ   = xics_init_IRQ;
+   ppc_md.init_IRQ   = pseries_xics_init_IRQ;
setup_kexec_cpu_down_xics();
smp_init_pseries_xics();
return;
diff --git a/arch/powerpc/platforms/pseries/xics.c 
b/arch/powerpc/platforms/pseries/xics.c
index ca52b58..5a72f27 100644
--- a/arch/powerpc/platforms/pseries/xics.c
+++ b/arch/powerpc/platforms/pseries/xics.c
@@ -655,52 +655,6 @@ static void __init xics_init_one_node(struct device_node 
*np,
}
 }
 
-
-static void __init xics_setup_8259_cascade(void)
-{
-   struct device_node *np, *old, *found = NULL;
-   int cascade, naddr;
-   const u32 *addrp;
-   unsigned long intack = 0;
-
-   for_each_node_by_type(np, interrupt-controller)
-   if (of_device_is_compatible(np, chrp,iic)) {
-   found = np;
-   break;
-   }
-   if (found == NULL) {
-   printk(KERN_DEBUG xics: no ISA interrupt controller\n);
-   return;
-   }
-   cascade = irq_of_parse_and_map(found, 0);
-   if (cascade == NO_IRQ) {
-   printk(KERN_ERR xics: failed to map cascade interrupt);
-   return;
-   }
-   pr_debug(xics: cascade mapped to irq %d\n, cascade);
-
-   for (old = of_node_get(found); old != NULL ; old = np) {
-   np = of_get_parent(old);
-   of_node_put(old);
-   if (np == NULL)
-   break;
-   if (strcmp(np-name, pci) != 0)
-   continue;
-   addrp = of_get_property(np, 8259-interrupt-acknowledge, NULL);
-   if (addrp == NULL)
-   continue;
-   naddr = of_n_addr_cells(np);
-   intack = addrp[naddr-1];
-  

[RFC/PATCH 2/4] Turn xics_setup_8259_cascade() into a generic pseries_setup_i8259_cascade()

2008-04-01 Thread Michael Ellerman
Remove the xics references from xics_setup_8259_cascade(), and merge the
good bits from the almost identical logic in pseries_mpic_init_IRQ().

Signed-off-by: Michael Ellerman [EMAIL PROTECTED]
---
 arch/powerpc/platforms/pseries/setup.c |   20 
 1 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/arch/powerpc/platforms/pseries/setup.c 
b/arch/powerpc/platforms/pseries/setup.c
index 43e4801..1e1faa1 100644
--- a/arch/powerpc/platforms/pseries/setup.c
+++ b/arch/powerpc/platforms/pseries/setup.c
@@ -127,28 +127,32 @@ void pseries_8259_cascade(unsigned int irq, struct 
irq_desc *desc)
desc-chip-eoi(irq);
 }
 
-static void __init xics_setup_8259_cascade(void)
+static void __init pseries_setup_i8259_cascade(void)
 {
struct device_node *np, *old, *found = NULL;
-   int cascade, naddr;
+   unsigned int cascade;
const u32 *addrp;
unsigned long intack = 0;
+   int naddr;
 
-   for_each_node_by_type(np, interrupt-controller)
+   for_each_node_by_type(np, interrupt-controller) {
if (of_device_is_compatible(np, chrp,iic)) {
found = np;
break;
}
+   }
+
if (found == NULL) {
-   printk(KERN_DEBUG xics: no ISA interrupt controller\n);
+   printk(KERN_DEBUG pic: no ISA interrupt controller\n);
return;
}
+
cascade = irq_of_parse_and_map(found, 0);
if (cascade == NO_IRQ) {
-   printk(KERN_ERR xics: failed to map cascade interrupt);
+   printk(KERN_ERR pic: failed to map cascade interrupt);
return;
}
-   pr_debug(xics: cascade mapped to irq %d\n, cascade);
+   pr_debug(pic: cascade mapped to irq %d\n, cascade);
 
for (old = of_node_get(found); old != NULL ; old = np) {
np = of_get_parent(old);
@@ -166,7 +170,7 @@ static void __init xics_setup_8259_cascade(void)
intack |= ((unsigned long)addrp[naddr-2])  32;
}
if (intack)
-   printk(KERN_DEBUG xics: PCI 8259 intack at 0x%016lx\n, 
intack);
+   printk(KERN_DEBUG pic: PCI 8259 intack at 0x%016lx\n, intack);
i8259_init(found, intack);
of_node_put(found);
set_irq_chained_handler(cascade, pseries_8259_cascade);
@@ -254,7 +258,7 @@ static void __init pseries_mpic_init_IRQ(void)
 static void __init pseries_xics_init_IRQ(void)
 {
xics_init_IRQ();
-   xics_setup_8259_cascade();
+   pseries_setup_i8259_cascade();
 }
 
 static void pseries_lpar_enable_pmcs(void)
-- 
1.5.2.rc1.1884.g59b20

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


[RFC/PATCH 3/4] Use pseries_setup_i8259_cascade() in pseries_mpic_init_IRQ()

2008-04-01 Thread Michael Ellerman
pseries_mpic_init_IRQ() implements the same logic as the xics code did to
find the i8259 cascade irq. Now that we've pulled that logic out into
pseries_setup_i8259_cascade() we can use it in the mpic code.

Signed-off-by: Michael Ellerman [EMAIL PROTECTED]
---
 arch/powerpc/platforms/pseries/setup.c |   43 +--
 1 files changed, 2 insertions(+), 41 deletions(-)

diff --git a/arch/powerpc/platforms/pseries/setup.c 
b/arch/powerpc/platforms/pseries/setup.c
index 1e1faa1..22c047c 100644
--- a/arch/powerpc/platforms/pseries/setup.c
+++ b/arch/powerpc/platforms/pseries/setup.c
@@ -178,12 +178,9 @@ static void __init pseries_setup_i8259_cascade(void)
 
 static void __init pseries_mpic_init_IRQ(void)
 {
-   struct device_node *np, *old, *cascade = NULL;
-const unsigned int *addrp;
-   unsigned long intack = 0;
+   struct device_node *np;
const unsigned int *opprop;
unsigned long openpic_addr = 0;
-   unsigned int cascade_irq;
int naddr, n, i, opplen;
struct mpic *mpic;
 
@@ -216,43 +213,7 @@ static void __init pseries_mpic_init_IRQ(void)
mpic_init(mpic);
 
/* Look for cascade */
-   for_each_node_by_type(np, interrupt-controller)
-   if (of_device_is_compatible(np, chrp,iic)) {
-   cascade = np;
-   break;
-   }
-   if (cascade == NULL)
-   return;
-
-   cascade_irq = irq_of_parse_and_map(cascade, 0);
-   if (cascade_irq == NO_IRQ) {
-   printk(KERN_ERR mpic: failed to map cascade interrupt);
-   return;
-   }
-
-   /* Check ACK type */
-   for (old = of_node_get(cascade); old != NULL ; old = np) {
-   np = of_get_parent(old);
-   of_node_put(old);
-   if (np == NULL)
-   break;
-   if (strcmp(np-name, pci) != 0)
-   continue;
-   addrp = of_get_property(np, 8259-interrupt-acknowledge,
-   NULL);
-   if (addrp == NULL)
-   continue;
-   naddr = of_n_addr_cells(np);
-   intack = addrp[naddr-1];
-   if (naddr  1)
-   intack |= ((unsigned long)addrp[naddr-2])  32;
-   }
-   if (intack)
-   printk(KERN_DEBUG mpic: PCI 8259 intack at 0x%016lx\n,
-  intack);
-   i8259_init(cascade, intack);
-   of_node_put(cascade);
-   set_irq_chained_handler(cascade_irq, pseries_8259_cascade);
+   pseries_setup_i8259_cascade();
 }
 
 static void __init pseries_xics_init_IRQ(void)
-- 
1.5.2.rc1.1884.g59b20

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


[RFC/PATCH 4/4] Simplify xics direct/lpar irq_host setup

2008-04-01 Thread Michael Ellerman
The xics code currently has a direct and lpar variant of xics_host_map, the
only difference being which irq_chip they use. If we remember which irq_chip
we're using we can combine these two routines. That also allows us to have a
single irq_host_ops instead of two.

Signed-off-by: Michael Ellerman [EMAIL PROTECTED]
---
 arch/powerpc/platforms/pseries/xics.c |   39 ++--
 1 files changed, 12 insertions(+), 27 deletions(-)

diff --git a/arch/powerpc/platforms/pseries/xics.c 
b/arch/powerpc/platforms/pseries/xics.c
index 5a72f27..2fd8088 100644
--- a/arch/powerpc/platforms/pseries/xics.c
+++ b/arch/powerpc/platforms/pseries/xics.c
@@ -516,6 +516,8 @@ static struct irq_chip xics_pic_lpar = {
.set_affinity = xics_set_affinity
 };
 
+/* Points to the irq_chip we're actually using */
+static struct irq_chip *xics_irq_chip;
 
 static int xics_host_match(struct irq_host *h, struct device_node *node)
 {
@@ -526,23 +528,13 @@ static int xics_host_match(struct irq_host *h, struct 
device_node *node)
return !of_device_is_compatible(node, chrp,iic);
 }
 
-static int xics_host_map_direct(struct irq_host *h, unsigned int virq,
-   irq_hw_number_t hw)
+static int xics_host_map(struct irq_host *h, unsigned int virq,
+irq_hw_number_t hw)
 {
-   pr_debug(xics: map_direct virq %d, hwirq 0x%lx\n, virq, hw);
+   pr_debug(xics: map virq %d, hwirq 0x%lx\n, virq, hw);
 
get_irq_desc(virq)-status |= IRQ_LEVEL;
-   set_irq_chip_and_handler(virq, xics_pic_direct, handle_fasteoi_irq);
-   return 0;
-}
-
-static int xics_host_map_lpar(struct irq_host *h, unsigned int virq,
- irq_hw_number_t hw)
-{
-   pr_debug(xics: map_direct virq %d, hwirq 0x%lx\n, virq, hw);
-
-   get_irq_desc(virq)-status |= IRQ_LEVEL;
-   set_irq_chip_and_handler(virq, xics_pic_lpar, handle_fasteoi_irq);
+   set_irq_chip_and_handler(virq, xics_irq_chip, handle_fasteoi_irq);
return 0;
 }
 
@@ -561,27 +553,20 @@ static int xics_host_xlate(struct irq_host *h, struct 
device_node *ct,
return 0;
 }
 
-static struct irq_host_ops xics_host_direct_ops = {
+static struct irq_host_ops xics_host_ops = {
.match = xics_host_match,
-   .map = xics_host_map_direct,
-   .xlate = xics_host_xlate,
-};
-
-static struct irq_host_ops xics_host_lpar_ops = {
-   .match = xics_host_match,
-   .map = xics_host_map_lpar,
+   .map = xics_host_map,
.xlate = xics_host_xlate,
 };
 
 static void __init xics_init_host(void)
 {
-   struct irq_host_ops *ops;
-
if (firmware_has_feature(FW_FEATURE_LPAR))
-   ops = xics_host_lpar_ops;
+   xics_irq_chip = xics_pic_lpar;
else
-   ops = xics_host_direct_ops;
-   xics_host = irq_alloc_host(NULL, IRQ_HOST_MAP_TREE, 0, ops,
+   xics_irq_chip = xics_pic_direct;
+
+   xics_host = irq_alloc_host(NULL, IRQ_HOST_MAP_TREE, 0, xics_host_ops,
   XICS_IRQ_SPURIOUS);
BUG_ON(xics_host == NULL);
irq_set_default_host(xics_host);
-- 
1.5.2.rc1.1884.g59b20

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


Re: [PATCH] Make #include sysdev/foo.h work for 64-bit powerpc

2008-04-01 Thread Stephen Rothwell
Hi Michael,

On Tue,  1 Apr 2008 17:39:11 +1100 (EST) Michael Ellerman [EMAIL PROTECTED] 
wrote:

 We currently have inconsistent settings between 32  64-bit which means
 32-bit code can #include sysdev/foo.h but 64-bit code can't.

Kumar sent a very similar (if not identical) patch earlier today.

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


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

Re: [PATCHv2] powerpc: Describe memory-mapped RAMROM chips OF bindings

2008-04-01 Thread Laurent Pinchart
On Monday 31 March 2008 19:06, Sergei Shtylyov wrote:
 Hello.
 
 Laurent Pinchart wrote:
 
  Signed-off-by: Laurent Pinchart [EMAIL PROTECTED]
  ---
   Documentation/powerpc/booting-without-of.txt |   13 -
   1 files changed, 12 insertions(+), 1 deletions(-)
  
  diff --git a/Documentation/powerpc/booting-without-of.txt 
b/Documentation/powerpc/booting-without-of.txt
  index 7b4e8a7..3e1963b 100644
  --- a/Documentation/powerpc/booting-without-of.txt
  +++ b/Documentation/powerpc/booting-without-of.txt
  @@ -57,7 +57,8 @@ Table of Contents
 n) 4xx/Axon EMAC ethernet nodes
 o) Xilinx IP cores
 p) Freescale Synchronous Serial Interface
  - q) USB EHCI controllers
  +  q) USB EHCI controllers
  +  r) Memory-mapped RAM  ROM
 
 Memory-mapped RA/RO Memory again? Should better drop this. :-)

You're quite picky, aren't you ? :-)

I suppose Memory-mapped RA  RO won't be accepted, so what about Auxiliary 
RAM  ROM ?

-- 
Laurent Pinchart
CSE Semaphore Belgium

Chaussée de Bruxelles, 732A
B-1410 Waterloo
Belgium

T +32 (2) 387 42 59
F +32 (2) 387 42 75
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Commits added to powerpc.git master/powerpc-next branches

2008-04-01 Thread Paul Mackerras
I have updated the master and powerpc-next branches of the powerpc.git
repository with the following commits, including some pulled from Josh
Boyer and Kumar Gala.

Paul.

Alexandr Smirnov (4):
  [POWERPC] 85xx: Emerson KSI8560 base support
  [POWERPC] 85xx: Emerson KSI8560 bootwrapper
  [POWERPC] 85xx: Emerson KSI8560 default config
  [POWERPC] 85xx: Emerson KSI8560 device tree

Badari Pulavarty (1):
  [POWERPC] Add error return from htab_remove_mapping()

David Gibson (1):
  [POWERPC] Start removing linux,network-index in favour of aliases

Geert Uytterhoeven (4):
  [POWERPC] PS3: Save power in busy loops on halt
  [POWERPC] move_device_tree() should be __init
  [POWERPC] arch_add_memory() cannot be __devinit
  [POWERPC] PS3: Split device setup for static vs. dynamic devices

Geoff Levand (2):
  [POWERPC] PS3: Bootwrapper improvements
  [POWERPC] PS3: Sys-manager Wake-on-LAN support

Harvey Harrison (2):
  [POWERPC] Replace remaining __FUNCTION__ occurrences
  [POWERPC] ppc: Replace remaining __FUNCTION__ occurrences

Johannes Weiner (2):
  [POWERPC] Remove redundant display of free swap space in show_mem()
  [POWERPC] ppc: Remove redundant display of free swap space in show_mem()

Josh Boyer (3):
  [POWERPC] 4xx: Add AMCC 440EP Yosemite DTS
  [POWERPC] 4xx: Add platform support for the AMCC Yosemite board
  [POWERPC] 4xx: Add bootwrapper for AMCC Yosemite board

Julia Lawall (1):
  [POWERPC] Use FIELD_SIZEOF in drivers/block/viodasd.c

Masakazu Mokuno (1):
  [POWERPC] PS3: Gelic network driver Wake-on-LAN support

Robert Brose (1):
  [POWERPC] Add kernel parameter to set l3cr for MPC745x

Roel Kluin (1):
  [POWERPC] PS3: Fix unlikely typo in ps3_get_irq

Stefan Roese (10):
  [POWERPC] 4xx: Add AMCC 460EX/460GT support to cputable.c  
cpu_setup_44x.S
  [POWERPC] 4xx: Add AMCC Canyonlands 460EX eval board support to 
platforms/44x
  [POWERPC] 4xx: Add Canyonlands DTS
  [POWERPC] 4xx: Add 460EX PCIe support to 4xx pci driver
  [POWERPC] 4xx: Add Canyonlands defconfig file
  [POWERPC] 4xx: Add TAH support to taishan dts
  [POWERPC] 4xx: Add AMCC Glacier 460GT eval board dts
  [POWERPC] 4xx: Add amcc, haleakala to the toplevel compatible property
  [POWERPC] 4xx: Add PPC4xx L2-cache support (440GX)
  [POWERPC] 4xx: Add L2 cache node to AMCC Taishan dts file

Stephen Neuendorffer (3):
  [POWERPC] Xilinx: hwicap: Refactor status handling code.
  [POWERPC] Xilinx: hwicap: Verify sync before reading idcode.
  [POWERPC] Xilinx: hwicap: Use fixed device major.

Takashi Yamamoto (1):
  [POWERPC] PS3: Add ps3_get_speid routine

Valentine Barshak (2):
  [POWERPC] 4xx: Add dcri_clrset() for locked read/modify/write 
functionality
  [POWERPC] 4xx: Use dcri_clrset() for PCIe indirect dcr read/modify/write 
access

 Documentation/kernel-parameters.txt   |2 
 Documentation/powerpc/booting-without-of.txt  |   16 
 arch/powerpc/Kconfig  |3 
 arch/powerpc/boot/Makefile|4 
 arch/powerpc/boot/bamboo.c|3 
 arch/powerpc/boot/cuboot-rainier.c|3 
 arch/powerpc/boot/cuboot-sequoia.c|3 
 arch/powerpc/boot/cuboot-taishan.c|3 
 arch/powerpc/boot/cuboot-warp.c   |2 
 arch/powerpc/boot/cuboot-yosemite.c   |   44 +
 arch/powerpc/boot/dts/bamboo.dts  |2 
 arch/powerpc/boot/dts/canyonlands.dts |  391 +
 arch/powerpc/boot/dts/ebony.dts   |2 
 arch/powerpc/boot/dts/glacier.dts |  464 +++
 arch/powerpc/boot/dts/haleakala.dts   |2 
 arch/powerpc/boot/dts/ksi8560.dts |  267 ++
 arch/powerpc/boot/dts/rainier.dts |2 
 arch/powerpc/boot/dts/sequoia.dts |2 
 arch/powerpc/boot/dts/taishan.dts |   27 +
 arch/powerpc/boot/dts/walnut.dts  |1 
 arch/powerpc/boot/dts/warp.dts|1 
 arch/powerpc/boot/dts/yosemite.dts|  304 +++
 arch/powerpc/boot/ebony.c |3 
 arch/powerpc/boot/libfdt-wrapper.c|2 
 arch/powerpc/boot/ps3-head.S  |   25 -
 arch/powerpc/boot/ps3.c   |   23 -
 arch/powerpc/boot/treeboot-walnut.c   |2 
 arch/powerpc/boot/wrapper |   23 -
 arch/powerpc/configs/canyonlands_defconfig|  721 +
 arch/powerpc/configs/ksi8560_defconfig|  899 +
 arch/powerpc/kernel/cpu_setup_44x.S   |5 
 arch/powerpc/kernel/cputable.c|   28 +
 arch/powerpc/kernel/ibmebus.c |   12 
 arch/powerpc/kernel/iommu.c   |4 
 

Re: [PATCH] Add idle power save for ppc 4xx

2008-04-01 Thread Josh Boyer
On Tue, 1 Apr 2008 15:00:38 +1100
Paul Mackerras [EMAIL PROTECTED] wrote:

 Josh Boyer writes:
 
  Actually, you probably don't want this as a property in the device
  tree.  It doesn't describe hardware.  A Kconfig option might be
  warranted though.
 
 In general it is valid to have properties in the device tree that
 describe the hypervisor or the kernel's interface to it, since they
 are aspects of the platform, i.e. the virtual hardware that the
 kernel is running on.

Yep, we reached that conclusion already.

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


Re: Using FEC on a MPC5200 with default PHY configuration

2008-04-01 Thread Wolfgang Grandegger
Grant Likely wrote:
 On Mon, Mar 31, 2008 at 3:44 AM, Wolfgang Grandegger [EMAIL PROTECTED] 
 wrote:
 Wolfgang Grandegger wrote:
   Hello,
  
   is it possible to use the FEC on a MPC5200 with the default hardware PHY
   configuration. I mean running the link with a default speed without
   handling or even touching the PHY like U-Boot does. I removed the PHY
   entries from the DTS file and disabled CONFIG_FEC_MPC52xx_MDIO but it
   did not work.

  To be more precise, I want to support a 3-Port managed switch with PHY
  from Micrel using the direct switch link.
 
 I'm actually working on this exact problem at the moment.  I'll get a
 patch out shortly to do so.

Great, if I can help with testing, please let me know.

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


Re: [PATCH 04/11 v2] [POWERPC] Remove and replace uses of PPC_MEMSTART with memstart_addr

2008-04-01 Thread Paul Mackerras
Kumar Gala writes:

 For the sub-arches that support relocatable interrupt vectors (book-e) its
 reasonable to have memory start at a non-zero physical address.  For those
 cases use the variable memstart_addr instead of the #define PPC_MEMSTART
 since the only uses of PPC_MEMSTART are for initialization and in the
 future we can set memstart_addr at runtime to have a relocatable kernel.

In those cases, is it still true that the kernel sits at the start of
the usable memory, or might there be usable memory before _stext?
In other words, is PAGE_OFFSET == KERNELBASE still true or not?

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


Re: [PATCHv3 2/4] cpm-serial: Relocate CPM buffer descriptors and SMC parameter ram.

2008-04-01 Thread Laurent Pinchart
On Monday 31 March 2008 21:10, Scott Wood wrote:
 Laurent Pinchart wrote:
  This patch relocates the buffer descriptors and the SMC parameter RAM at the
  end of the first CPM muram chunk, as described in the device tree. This 
  allows
  device trees to stop excluding SMC parameter ram allocated by the boot 
  loader
  from the CPM muram node.
 
 It's usually a good idea to state that something is untested if that's 
 the case. :-)

Sorry. I'll state it clearly next time.

 This patch cannot work as is.
 
  +static int cpm_get_virtual_address(void *devp, void **addr, int ncells)
  +{
  +   unsigned long xaddr;
  +   int n;
  +
  +   n = getprop(devp, virtual-reg, addr, ncells * sizeof *addr);
  +   if (n  ncells * sizeof *addr) {
 
 You must cast the sizeof to a signed int; otherwise, a negative return 
 from getprop will be bigger than the unsigned size, and you'll return 
 garbage as the address.
 
  +   for (n = 0; n  ncells; n++) {
  +   if (!dt_xlate_reg(devp, n, xaddr, NULL))
  +   return -1;
  +
  +   addr[n] = (void*)xaddr;
 
 (void *)
 
  +   }
  +   }
  +
  +   return ncells;
  +}
 
 This could be a generic bootwrapper function.  It should return the 
 number of resources (ncells is a misnomer) actually found, though, 
 rather than failing if there are fewer than asked for.  Let the caller 
 decide if it's fatal.

Ok. I'll move it to devtree.c.

  @@ -202,63 +243,62 @@ int cpm_console_init(void *devp, struct 
  serial_console_data *scdp)
  else
  do_cmd = cpm1_cmd;
   
  -   n = getprop(devp, fsl,cpm-command, cpm_cmd, 4);
  -   if (n  4)
  +   if (getprop(devp, fsl,cpm-command, cpm_cmd, 4)  sizeof cpm_cmd)
  return -1;
 
 Standard kernel style is sizeof(foo), not sizeof foo.

Ok.

 Plus, if you're going to replace 4 with sizeof(cpm_cmd), do it both 
 places.  I don't really see the need, though; a cell is always 4 bytes.

Ok, I'll keep 4.

  -   n = getprop(parent, virtual-reg, reg_virt, sizeof(reg_virt));
  -   if (n  (int)sizeof(reg_virt)) {
  -   if (!dt_xlate_reg(parent, 0, reg_phys, NULL))
  -   return -1;
  -
  -   reg_virt[0] = (void *)reg_phys;
  -   }
  -
  -   cpcr = reg_virt[0];
  +   if (cpm_get_virtual_address(devp, cpcr, 1)  0)
  +   return -1;
 
 s/devp/parent/
 
  muram = finddevice(/soc/cpm/muram/data);
  if (!muram)
  return -1;
   
  /* For bootwrapper-compatible device trees, we assume that the first
  -* entry has at least 18 bytes, and that #address-cells/#data-cells
  +* entry has at least 128 bytes, and that #address-cells/#data-cells
   * is one for both parent and child.
   */
   
  -   n = getprop(muram, virtual-reg, reg_virt, sizeof(reg_virt));
  -   if (n  (int)sizeof(reg_virt)) {
  -   if (!dt_xlate_reg(muram, 0, reg_phys, NULL))
  -   return -1;
  +   if (cpm_get_virtual_address(devp, muram_addr, 1)  0)
  +   return -1;
 
 s/devp/muram/
 
  +   
  +   if (getprop(muram, reg, reg, sizeof reg)  sizeof reg)
  +   return -1;
 
 Should read into array of u32, not void *.

Ok.

  +   if (is_cpm2  is_smc) {
  +   u16 *smc_base = (u16*)param;
 
 (u16 *)
 
  +   u16 pram_offset;
   
  -   muram_start = reg_virt[0];
  +   pram_offset = cbd_offset - 64;
  +   pram_offset = _ALIGN_DOWN(pram_offset, 64);
  +   *smc_base = pram_offset;
 
 Use out_be16().
 
 The SMC should be stopped before you do this.

Right.

New patch comming.

-- 
Laurent Pinchart
CSE Semaphore Belgium

Chaussée de Bruxelles, 732A
B-1410 Waterloo
Belgium

T +32 (2) 387 42 59
F +32 (2) 387 42 75


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

Re: [kvm-ppc-devel] [PATCH] Add idle power save for ppc 4xx

2008-04-01 Thread Josh Boyer
On Tue, 2008-04-01 at 08:01 -0400, Jimi Xenidis wrote:
 On Mar 31, 2008, at 11:15 PM, Josh Boyer wrote:
 
  On Tue, 2008-04-01 at 12:04 +1100, Michael Ellerman wrote:
  I'm assuming you pass a dtb to the virtual guest when you start  
  it up.
  Could you define a property in the CPU node there that can be  
  parsed to
  use the power_save function instead of always making it the  
  default?
 
  Actually, you probably don't want this as a property in the device
  tree.  It doesn't describe hardware.  A Kconfig option might be
  warranted though.
 
  I'll go with the Kconfig option.
 
  Go with a device-tree check. The pseries kernel supports both bare- 
  metal
  and hypervisor in the same kernel image, and it works out which it's
  running on by looking at the device-tree. This seems equivalent to  
  me?
 
  After some back and forth on IRC, we decided on that as well.  I love
  being right, then wrong, then right again.
 
 Awesome, can you summarize for the rest of us?

A node or property will be in the device tree that the guests can use to
determine if it's running under a hypervisor or not.

The details are yet to be worked out, so there isn't much more of a
summary yet.  There was also some conversation about having an idle=
kernel parameter similar to the PA-Semi port that would allow toggling
of it as well.

josh

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


Re: Commits added to powerpc.git master/powerpc-next branches

2008-04-01 Thread Josh Boyer
On Tue, 2008-04-01 at 21:59 +1100, Paul Mackerras wrote:
 I have updated the master and powerpc-next branches of the powerpc.git
 repository with the following commits, including some pulled from Josh
 Boyer and Kumar Gala.

Is there something still wrong with version 3 of this patch?

http://patchwork.ozlabs.org/linuxppc/patch?filter=incomingid=17516

It would be nice to get that in .26, and Nathan has a patch or two that
depends on it that do some cleanup.

josh

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


Re: [kvm-ppc-devel] [PATCH] Add idle power save for ppc 4xx

2008-04-01 Thread Arnd Bergmann
On Monday 31 March 2008, Jerone Young wrote:
  
   +{
   +   unsigned long msr_save;
   +
   +   /* set wait state MSR */
   +   local_irq_enable();
   +   msr_save = mfmsr();
   +   mtmsr(msr_save|MSR_WE);
  
  Why don't you |MSR_WE|MSR_EE at the same time?
 
 You technically can do this. But the question is do all 4xx cpus use
 MSR_EE to enable interrupts? I can assume they do (from what I know),
 but figured it would be safer to make the local_irq_enable() call.
 I can change it to just set the MSR_EE bit though, since all 4xx cpus
 (as far as I know) use it.

For correctness reasons, you actually have to set both EE and WE
simultaneously. Otherwise, an interrupt can come in between the two
mtmsr(), mark some thread as runnable and then go to sleep here
without ever checking need_resched() until the next interrupt,
which may take an indefinite time.

  
   +   local_irq_disable();
   +}
  
  None of the other power_save() implementations need this. In fact many
  of them don't even seem to return; they just loop around mtmsr.
 
 Sure it can be removed. Though with the comment in the mach_dep
 structure about power_save. It specifically says that interrupts are off
 when it is called. So I was following it here mainly. But I can remove
 the disabling of interrupts, since mtmsr is the only used under
 power_save.

With the current code, it shouldn't matter, because cpu_idle enables
the interrupts right after calling ppc_md-power_save(), but it would
be reasonable to disable the interrupts here anyway, if only to make
the function return with the same state that it was entered.

IMHO, the function should be

void ppc4xx_idle()
{
unsigned long msr_save;

msr_save = mfmsr();
/* enter idle mode */
mtmsr(msr_save|MSR_WE|MSR_EE);
/* disable interrupts again */
mtmsr(msr_save);
}

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


[PATCHv4 0/5] cpm2: Reset the CPM at startup and fix the cpm_uart driver accordingly.

2008-04-01 Thread Laurent Pinchart
Hi everybody,

these 5 patches reset the CPM in cpm2_reset() and fix the cpm_uart driver to 
initialise SMC ports correctly without relying on any initialisation 
performed by the boot loader/wrapper. They update the boot wrapper code and
the EP8248E device tree to match the new SMC registers description.

Patches 2/5, 3/5 and 4/5 (boot wrapper and EP8248E device tree updates) 
haven't been tested due to lack of hardware.

-- 
Laurent Pinchart
CSE Semaphore Belgium

Chaussée de Bruxelles, 732A
B-1410 Waterloo
Belgium

T +32 (2) 387 42 59
F +32 (2) 387 42 75


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

[PATCHv4 2/5] powerpc: Add bootwrapper function to get virtual reg from the device tree.

2008-04-01 Thread Laurent Pinchart
This patch adds a new generic device tree processing function that retrieves
virtual reg addresses from the device tree to the bootwrapper code. It also
updates the bootwrapper code to use the new function.

dt_get_virtual_reg() retrieves the virtual reg addresses from the
virtual-reg property. If the property can't be found, it uses the reg
property and walks the tree to translate it to absolute addresses.

Signed-off-by: Laurent Pinchart [EMAIL PROTECTED]
---
 arch/powerpc/boot/cpm-serial.c  |   34 ++
 arch/powerpc/boot/devtree.c |   20 
 arch/powerpc/boot/mpc52xx-psc.c |9 ++---
 arch/powerpc/boot/ns16550.c |   10 ++
 arch/powerpc/boot/ops.h |1 +
 5 files changed, 31 insertions(+), 43 deletions(-)

diff --git a/arch/powerpc/boot/cpm-serial.c b/arch/powerpc/boot/cpm-serial.c
index 28296fa..1f6225a 100644
--- a/arch/powerpc/boot/cpm-serial.c
+++ b/arch/powerpc/boot/cpm-serial.c
@@ -177,7 +177,6 @@ int cpm_console_init(void *devp, struct serial_console_data 
*scdp)
 {
void *reg_virt[2];
int is_smc = 0, is_cpm2 = 0, n;
-   unsigned long reg_phys;
void *parent, *muram;
 
if (dt_is_compatible(devp, fsl,cpm1-smc-uart)) {
@@ -206,15 +205,8 @@ int cpm_console_init(void *devp, struct 
serial_console_data *scdp)
if (n  4)
return -1;
 
-   n = getprop(devp, virtual-reg, reg_virt, sizeof(reg_virt));
-   if (n  (int)sizeof(reg_virt)) {
-   for (n = 0; n  2; n++) {
-   if (!dt_xlate_reg(devp, n, reg_phys, NULL))
-   return -1;
-
-   reg_virt[n] = (void *)reg_phys;
-   }
-   }
+   if (dt_get_virtual_reg(devp, reg_virt, 2)  2)
+   return -1;
 
if (is_smc)
smc = reg_virt[0];
@@ -227,15 +219,8 @@ int cpm_console_init(void *devp, struct 
serial_console_data *scdp)
if (!parent)
return -1;
 
-   n = getprop(parent, virtual-reg, reg_virt, sizeof(reg_virt));
-   if (n  (int)sizeof(reg_virt)) {
-   if (!dt_xlate_reg(parent, 0, reg_phys, NULL))
-   return -1;
-
-   reg_virt[0] = (void *)reg_phys;
-   }
-
-   cpcr = reg_virt[0];
+   if (dt_get_virtual_reg(parent, cpcr, 1)  1)
+   return -1;
 
muram = finddevice(/soc/cpm/muram/data);
if (!muram)
@@ -246,15 +231,8 @@ int cpm_console_init(void *devp, struct 
serial_console_data *scdp)
 * is one for both parent and child.
 */
 
-   n = getprop(muram, virtual-reg, reg_virt, sizeof(reg_virt));
-   if (n  (int)sizeof(reg_virt)) {
-   if (!dt_xlate_reg(muram, 0, reg_phys, NULL))
-   return -1;
-
-   reg_virt[0] = (void *)reg_phys;
-   }
-
-   muram_start = reg_virt[0];
+   if (dt_get_virtual_reg(muram, (void **)muram_start, 1)  1)
+   return -1;
 
n = getprop(muram, reg, muram_offset, 4);
if (n  4)
diff --git a/arch/powerpc/boot/devtree.c b/arch/powerpc/boot/devtree.c
index 60f561e..5d12336 100644
--- a/arch/powerpc/boot/devtree.c
+++ b/arch/powerpc/boot/devtree.c
@@ -350,3 +350,23 @@ int dt_is_compatible(void *node, const char *compat)
 
return 0;
 }
+
+int dt_get_virtual_reg(void *node, void **addr, int nres)
+{
+   unsigned long xaddr;
+   int n;
+
+   n = getprop(node, virtual-reg, addr, nres * 4);
+   if (n  0)
+   return n / 4;
+
+   for (n = 0; n  nres; n++) {
+   if (!dt_xlate_reg(node, n, xaddr, NULL))
+   break;
+
+   addr[n] = (void *)xaddr;
+   }
+
+   return n;
+}
+
diff --git a/arch/powerpc/boot/mpc52xx-psc.c b/arch/powerpc/boot/mpc52xx-psc.c
index 1074626..d4cb4e4 100644
--- a/arch/powerpc/boot/mpc52xx-psc.c
+++ b/arch/powerpc/boot/mpc52xx-psc.c
@@ -51,14 +51,9 @@ static unsigned char psc_getc(void)
 
 int mpc5200_psc_console_init(void *devp, struct serial_console_data *scdp)
 {
-   int n;
-
/* Get the base address of the psc registers */
-   n = getprop(devp, virtual-reg, psc, sizeof(psc));
-   if (n != sizeof(psc)) {
-   if (!dt_xlate_reg(devp, 0, (void *)psc, NULL))
-   return -1;
-   }
+   if (dt_get_virtual_reg(devp, psc, 1)  1)
+   return -1;
 
scdp-open = psc_open;
scdp-putc = psc_putc;
diff --git a/arch/powerpc/boot/ns16550.c b/arch/powerpc/boot/ns16550.c
index f8f1b2f..aef3bdc 100644
--- a/arch/powerpc/boot/ns16550.c
+++ b/arch/powerpc/boot/ns16550.c
@@ -55,15 +55,9 @@ static u8 ns16550_tstc(void)
 int ns16550_console_init(void *devp, struct serial_console_data *scdp)
 {
int n;
-   unsigned long reg_phys;
 
-   n = getprop(devp, virtual-reg, reg_base, sizeof(reg_base));
-   if (n != sizeof(reg_base)) {
-   if (!dt_xlate_reg(devp, 0, reg_phys, NULL))

[PATCHv4 4/5] ep8248e: Reference SMC parameter RAM base in the device tree.

2008-04-01 Thread Laurent Pinchart
This patch modifies the Embedded Planet EP8248E device tree to reference the
SMC paramater RAM base register instead of the parameter RAM allocated by the
boot loader.

The cpm_uart driver will allocate parameter RAM itself, making the serial port
initialisation independent of the boot loader.

The patch adds the parameter RAM allocated by the boot loader in the CPM muram
node, making it available to the kernel.

Signed-off-by: Laurent Pinchart [EMAIL PROTECTED]
---
 arch/powerpc/boot/dts/ep8248e.dts |5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/arch/powerpc/boot/dts/ep8248e.dts 
b/arch/powerpc/boot/dts/ep8248e.dts
index 5d2fb76..756758f 100644
--- a/arch/powerpc/boot/dts/ep8248e.dts
+++ b/arch/powerpc/boot/dts/ep8248e.dts
@@ -121,8 +121,7 @@
 
[EMAIL PROTECTED] {
compatible = fsl,cpm-muram-data;
-   reg = 0 0x1100 0x1140
-  0xec0 0x9800 0x800;
+   reg = 0 0x2000 0x9800 0x800;
};
};
 
@@ -138,7 +137,7 @@
device_type = serial;
compatible = fsl,mpc8248-smc-uart,
 fsl,cpm2-smc-uart;
-   reg = 0x11a80 0x20 0x1100 0x40;
+   reg = 0x11a80 0x20 0x87fc 2;
interrupts = 4 8;
interrupt-parent = PIC;
fsl,cpm-brg = 7;
-- 
1.5.0


-- 
Laurent Pinchart
CSE Semaphore Belgium

Chaussée de Bruxelles, 732A
B-1410 Waterloo
Belgium

T +32 (2) 387 42 59
F +32 (2) 387 42 75


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

Re: [PATCHv2] powerpc: Describe memory-mapped RAMROM chips OF bindings

2008-04-01 Thread Laurent Pinchart
On Tuesday 01 April 2008 11:18, Trent Piepho wrote:
 On Tue, 1 Apr 2008, Laurent Pinchart wrote:
  On Monday 31 March 2008 19:06, Sergei Shtylyov wrote:
 p) Freescale Synchronous Serial Interface
  -   q) USB EHCI controllers
  +  q) USB EHCI controllers
  +  r) Memory-mapped RAM  ROM
 
  Memory-mapped RA/RO Memory again? Should better drop this. :-)
 
  You're quite picky, aren't you ? :-)
 
  I suppose Memory-mapped RA  RO won't be accepted, so what about 
  Auxiliary
  RAM  ROM ?
 
 Direct-mapped?

Fine with me. Sergei ?

-- 
Laurent Pinchart
CSE Semaphore Belgium

Chaussée de Bruxelles, 732A
B-1410 Waterloo
Belgium

T +32 (2) 387 42 59
F +32 (2) 387 42 75
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCHv4 5/5] cpm2: Reset the CPM when early debugging is not enabled.

2008-04-01 Thread Laurent Pinchart
Similarly to what is done for PQ1-based platforms, this patch resets the
PQ2 Communication Processor Module in cpm2_reset() when early debugging is
not enabled. This helps avoiding conflicts when the boot loader configured
the CPM in an unexpected way.

Signed-off-by: Laurent Pinchart [EMAIL PROTECTED]
---
 arch/powerpc/sysdev/cpm2.c |6 ++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/arch/powerpc/sysdev/cpm2.c b/arch/powerpc/sysdev/cpm2.c
index 7be7112..57ed1a4 100644
--- a/arch/powerpc/sysdev/cpm2.c
+++ b/arch/powerpc/sysdev/cpm2.c
@@ -80,6 +80,12 @@ void __init cpm2_reset(void)
/* Tell everyone where the comm processor resides.
 */
cpmp = cpm2_immr-im_cpm;
+
+#ifndef CONFIG_PPC_EARLY_DEBUG_CPM
+   /* Reset the CPM.
+*/
+   cpm_command(CPM_CR_RST, 0);
+#endif
 }
 
 static DEFINE_SPINLOCK(cmd_lock);
-- 
1.5.0


-- 
Laurent Pinchart
CSE Semaphore Belgium

Chaussée de Bruxelles, 732A
B-1410 Waterloo
Belgium

T +32 (2) 387 42 59
F +32 (2) 387 42 75


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

Re: Please pull linux-2.6-mpc52xx.git

2008-04-01 Thread Bartlomiej Sieka

Hi Grant,

Grant Likely wrote:

On Tue, Mar 25, 2008 at 11:38 AM, Bartlomiej Sieka [EMAIL PROTECTED] wrote:

Grant Likely wrote:
  The one part that I have a really strong opinion on is that there
  should be a full featured mpc5200 defconfig for build testing.  Beyond
  that (and if ojn can also be appeased) I can probably be convinced.  :-)

 Hi Grant,

 How to deal with a situation where I need a particular PHY driver from
 libphy compiled in the kernel for one of the MPC5200 boards? Adding it
 to mpc5200_defconfig doesn't seem like a right thing to do.


Why not?  mpc5200_defconfig is all about compile and runtime testing
on many platforms to make sure drivers play well together.  I have no
problem adding more drivers to the mpc5200 defconfig.  (In fact, I
encourage it).


 How to
 convince you (and appease ojn) to accept a patch that adds a
 board-specific defconfig that only slightly differs from
 mpc5200_defconfig? :)


I'm thinking 'optimized' defconfigs should go into a subdirectory.


This requires a change to the top-level Makefile and shepherding this
change upstream. Could we perhaps try to avoid this by having optimized
defconfigs in the form of, for example:

arch/powerpc/configs/tqm5200_opt_defconfig
arch/powerpc/configs/motionpro_opt_defconfig

Or, to signify what is the base defconfig:

arch/powerpc/configs/mpc5200_tqm5200_defconfig
arch/powerpc/configs/mpc5200_motionpro_defconfig

or even:

arch/powerpc/configs/mpc5200_opt_tqm5200_defconfig
arch/powerpc/configs/mpc5200_opt_motionpro_defconfig

Would patch adding an optimized _defconfig along these lines be accepted?

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


[PATCHv4 3/5] cpm-serial: Relocate CPM buffer descriptors and SMC parameter ram.

2008-04-01 Thread Laurent Pinchart
This patch relocates the buffer descriptors and the SMC parameter RAM at the
end of the first CPM muram chunk, as described in the device tree. This allows
device trees to stop excluding SMC parameter ram allocated by the boot loader
from the CPM muram node.

Signed-off-by: Laurent Pinchart [EMAIL PROTECTED]
---
 arch/powerpc/Kconfig.debug |2 +-
 arch/powerpc/boot/cpm-serial.c |   89 ++-
 2 files changed, 69 insertions(+), 22 deletions(-)

diff --git a/arch/powerpc/Kconfig.debug b/arch/powerpc/Kconfig.debug
index db7cc34..a86d8d8 100644
--- a/arch/powerpc/Kconfig.debug
+++ b/arch/powerpc/Kconfig.debug
@@ -269,7 +269,7 @@ config PPC_EARLY_DEBUG_CPM_ADDR
hex CPM UART early debug transmit descriptor address
depends on PPC_EARLY_DEBUG_CPM
default 0xfa202008 if PPC_EP88XC
-   default 0xf008 if CPM2
+   default 0xf0001ff8 if CPM2
default 0xff002008 if CPM1
help
  This specifies the address of the transmit descriptor
diff --git a/arch/powerpc/boot/cpm-serial.c b/arch/powerpc/boot/cpm-serial.c
index 1f6225a..19dc15a 100644
--- a/arch/powerpc/boot/cpm-serial.c
+++ b/arch/powerpc/boot/cpm-serial.c
@@ -11,6 +11,7 @@
 #include types.h
 #include io.h
 #include ops.h
+#include page.h
 
 struct cpm_scc {
u32 gsmrl;
@@ -42,6 +43,22 @@ struct cpm_param {
u16 tbase;
u8 rfcr;
u8 tfcr;
+   u16 mrblr;
+   u32 rstate;
+   u8 res1[4];
+   u16 rbptr;
+   u8 res2[6];
+   u32 tstate;
+   u8 res3[4];
+   u16 tbptr;
+   u8 res4[6];
+   u16 maxidl;
+   u16 idlc;
+   u16 brkln;
+   u16 brkec;
+   u16 brkcr;
+   u16 rmask;
+   u8 res5[4];
 };
 
 struct cpm_bd {
@@ -54,10 +71,10 @@ static void *cpcr;
 static struct cpm_param *param;
 static struct cpm_smc *smc;
 static struct cpm_scc *scc;
-struct cpm_bd *tbdf, *rbdf;
+static struct cpm_bd *tbdf, *rbdf;
 static u32 cpm_cmd;
-static u8 *muram_start;
-static u32 muram_offset;
+static void *cbd_addr;
+static u32 cbd_offset;
 
 static void (*do_cmd)(int op);
 static void (*enable_port)(void);
@@ -119,20 +136,25 @@ static int cpm_serial_open(void)
 
out_8(param-rfcr, 0x10);
out_8(param-tfcr, 0x10);
-
-   rbdf = (struct cpm_bd *)muram_start;
-   rbdf-addr = (u8 *)(rbdf + 2);
+   out_be16(param-mrblr, 1);
+   out_be16(param-maxidl, 0);
+   out_be16(param-brkec, 0);
+   out_be16(param-brkln, 0);
+   out_be16(param-brkcr, 0);
+
+   rbdf = cbd_addr;
+   rbdf-addr = (u8 *)rbdf - 1;
rbdf-sc = 0xa000;
rbdf-len = 1;
 
tbdf = rbdf + 1;
-   tbdf-addr = (u8 *)(rbdf + 2) + 1;
+   tbdf-addr = (u8 *)rbdf - 2;
tbdf-sc = 0x2000;
tbdf-len = 1;
 
sync();
-   out_be16(param-rbase, muram_offset);
-   out_be16(param-tbase, muram_offset + sizeof(struct cpm_bd));
+   out_be16(param-rbase, cbd_offset);
+   out_be16(param-tbase, cbd_offset + sizeof(struct cpm_bd));
 
do_cmd(CPM_CMD_INIT_RX_TX);
 
@@ -175,9 +197,12 @@ static unsigned char cpm_serial_getc(void)
 
 int cpm_console_init(void *devp, struct serial_console_data *scdp)
 {
-   void *reg_virt[2];
-   int is_smc = 0, is_cpm2 = 0, n;
+   void *vreg[2];
+   u32 reg[2];
+   int is_smc = 0, is_cpm2 = 0;
void *parent, *muram;
+   void *muram_addr;
+   unsigned long muram_offset, muram_size;
 
if (dt_is_compatible(devp, fsl,cpm1-smc-uart)) {
is_smc = 1;
@@ -201,19 +226,18 @@ int cpm_console_init(void *devp, struct 
serial_console_data *scdp)
else
do_cmd = cpm1_cmd;
 
-   n = getprop(devp, fsl,cpm-command, cpm_cmd, 4);
-   if (n  4)
+   if (getprop(devp, fsl,cpm-command, cpm_cmd, 4)  4)
return -1;
 
-   if (dt_get_virtual_reg(devp, reg_virt, 2)  2)
+   if (dt_get_virtual_reg(devp, vreg, 2)  2)
return -1;
 
if (is_smc)
-   smc = reg_virt[0];
+   smc = vreg[0];
else
-   scc = reg_virt[0];
+   scc = vreg[0];
 
-   param = reg_virt[1];
+   param = vreg[1];
 
parent = get_parent(devp);
if (!parent)
@@ -227,17 +251,40 @@ int cpm_console_init(void *devp, struct 
serial_console_data *scdp)
return -1;
 
/* For bootwrapper-compatible device trees, we assume that the first
-* entry has at least 18 bytes, and that #address-cells/#data-cells
+* entry has at least 128 bytes, and that #address-cells/#data-cells
 * is one for both parent and child.
 */
 
-   if (dt_get_virtual_reg(muram, (void **)muram_start, 1)  1)
+   if (dt_get_virtual_reg(muram, muram_addr, 1)  1)
return -1;
 
-   n = getprop(muram, reg, muram_offset, 4);
-   if (n  4)
+   if (getprop(muram, reg, reg, 8)  8)
return -1;
 
+   muram_offset = reg[0];
+   

[PATCHv4 1/5] cpm_uart: Allocate DPRAM memory for SMC ports on CPM2-based platforms.

2008-04-01 Thread Laurent Pinchart
This patch allocates parameter RAM for SMC serial ports without relying on
previous initialisation by a boot loader or a wrapper layer.

SMC parameter RAM on CPM2-based platforms can be allocated anywhere in the
general-purpose areas of the dual-port RAM. The current code relies on the
boot loader to allocate a section of general-purpose CPM RAM and gets the
section address from the device tree.

This patch modifies the device tree address usage to reference the SMC
parameter RAM base pointer instead of a pre-allocated RAM section and
allocates memory from the CPM dual-port RAM when initialising the SMC port.
CPM1-based platforms are not affected.

Signed-off-by: Laurent Pinchart [EMAIL PROTECTED]
---
 drivers/serial/cpm_uart/cpm_uart.h  |3 ++
 drivers/serial/cpm_uart/cpm_uart_core.c |   19 +--
 drivers/serial/cpm_uart/cpm_uart_cpm1.c |   12 +++
 drivers/serial/cpm_uart/cpm_uart_cpm2.c |   52 +++
 4 files changed, 76 insertions(+), 10 deletions(-)

diff --git a/drivers/serial/cpm_uart/cpm_uart.h 
b/drivers/serial/cpm_uart/cpm_uart.h
index 80a7d60..5334653 100644
--- a/drivers/serial/cpm_uart/cpm_uart.h
+++ b/drivers/serial/cpm_uart/cpm_uart.h
@@ -93,6 +93,9 @@ extern struct uart_cpm_port cpm_uart_ports[UART_NR];
 
 /* these are located in their respective files */
 void cpm_line_cr_cmd(struct uart_cpm_port *port, int cmd);
+void __iomem *cpm_uart_map_pram(struct uart_cpm_port *port,
+   struct device_node *np);
+void cpm_uart_unmap_pram(struct uart_cpm_port *port, void __iomem *pram);
 int cpm_uart_init_portdesc(void);
 int cpm_uart_allocbuf(struct uart_cpm_port *pinfo, unsigned int is_con);
 void cpm_uart_freebuf(struct uart_cpm_port *pinfo);
diff --git a/drivers/serial/cpm_uart/cpm_uart_core.c 
b/drivers/serial/cpm_uart/cpm_uart_core.c
index 1ea123c..3a44a3f 100644
--- a/drivers/serial/cpm_uart/cpm_uart_core.c
+++ b/drivers/serial/cpm_uart/cpm_uart_core.c
@@ -997,24 +997,23 @@ static int cpm_uart_init_port(struct device_node *np,
if (!mem)
return -ENOMEM;
 
-   pram = of_iomap(np, 1);
-   if (!pram) {
-   ret = -ENOMEM;
-   goto out_mem;
-   }
-
if (of_device_is_compatible(np, fsl,cpm1-scc-uart) ||
of_device_is_compatible(np, fsl,cpm2-scc-uart)) {
pinfo-sccp = mem;
-   pinfo-sccup = pram;
+   pinfo-sccup = pram = cpm_uart_map_pram(pinfo, np);
} else if (of_device_is_compatible(np, fsl,cpm1-smc-uart) ||
   of_device_is_compatible(np, fsl,cpm2-smc-uart)) {
pinfo-flags |= FLAG_SMC;
pinfo-smcp = mem;
-   pinfo-smcup = pram;
+   pinfo-smcup = pram = cpm_uart_map_pram(pinfo, np);
} else {
ret = -ENODEV;
-   goto out_pram;
+   goto out_mem;
+   }
+
+   if (!pram) {
+   ret = -ENOMEM;
+   goto out_mem;
}
 
pinfo-tx_nrfifos = TX_NUM_FIFO;
@@ -1038,7 +1037,7 @@ static int cpm_uart_init_port(struct device_node *np,
return cpm_uart_request_port(pinfo-port);
 
 out_pram:
-   iounmap(pram);
+   cpm_uart_unmap_pram(pinfo, pram);
 out_mem:
iounmap(mem);
return ret;
diff --git a/drivers/serial/cpm_uart/cpm_uart_cpm1.c 
b/drivers/serial/cpm_uart/cpm_uart_cpm1.c
index 6ea0366..e692593 100644
--- a/drivers/serial/cpm_uart/cpm_uart_cpm1.c
+++ b/drivers/serial/cpm_uart/cpm_uart_cpm1.c
@@ -54,6 +54,18 @@ void cpm_line_cr_cmd(struct uart_cpm_port *port, int cmd)
 {
cpm_command(port-command, cmd);
 }
+
+void __iomem *cpm_uart_map_pram(struct uart_cpm_port *port,
+   struct device_node *np)
+{
+   return of_iomap(np, 1);
+}
+
+void cpm_uart_unmap_pram(struct uart_cpm_port *port, void __iomem *pram)
+{
+   iounmap(pram);
+}
+
 #else
 void cpm_line_cr_cmd(struct uart_cpm_port *port, int cmd)
 {
diff --git a/drivers/serial/cpm_uart/cpm_uart_cpm2.c 
b/drivers/serial/cpm_uart/cpm_uart_cpm2.c
index 6291094..a4cfb0b 100644
--- a/drivers/serial/cpm_uart/cpm_uart_cpm2.c
+++ b/drivers/serial/cpm_uart/cpm_uart_cpm2.c
@@ -41,6 +41,9 @@
 #include asm/io.h
 #include asm/irq.h
 #include asm/fs_pd.h
+#ifdef CONFIG_PPC_CPM_NEW_BINDING
+#include asm/prom.h
+#endif
 
 #include linux/serial_core.h
 #include linux/kernel.h
@@ -54,6 +57,55 @@ void cpm_line_cr_cmd(struct uart_cpm_port *port, int cmd)
 {
cpm_command(port-command, cmd);
 }
+
+void __iomem *cpm_uart_map_pram(struct uart_cpm_port *port,
+   struct device_node *np)
+{
+   void __iomem *pram;
+   unsigned long offset;
+   struct resource res;
+   unsigned long len;
+
+   /* Don't remap parameter RAM if it has already been initialized
+* during console setup.
+*/
+   if (IS_SMC(port)  port-smcup)
+   return port-smcup;
+   else if (!IS_SMC(port)  port-sccup)
+   

Re: [PATCHv2] powerpc: Describe memory-mapped RAMROM chips OF bindings

2008-04-01 Thread Grant Likely
On Mon, Mar 31, 2008 at 10:39 AM, Laurent Pinchart
[EMAIL PROTECTED] wrote:

  Signed-off-by: Laurent Pinchart [EMAIL PROTECTED]
  ---
   Documentation/powerpc/booting-without-of.txt |   13 -
   1 files changed, 12 insertions(+), 1 deletions(-)

  diff --git a/Documentation/powerpc/booting-without-of.txt 
 b/Documentation/powerpc/booting-without-of.txt
  index 7b4e8a7..3e1963b 100644
  --- a/Documentation/powerpc/booting-without-of.txt
  +++ b/Documentation/powerpc/booting-without-of.txt
  @@ -57,7 +57,8 @@ Table of Contents
n) 4xx/Axon EMAC ethernet nodes
o) Xilinx IP cores
p) Freescale Synchronous Serial Interface
  - q) USB EHCI controllers
  +  q) USB EHCI controllers
  +  r) Memory-mapped RAM  ROM

VII - Specifying interrupt information for devices
  1) interrupts property
  @@ -2816,6 +2817,16 @@ platforms are moved over to use the 
 flattened-device-tree model.
big-endian;
};

  +   r) Memory-mapped RAM  ROM
  +
  +Dedicated RAM and ROM chips are often used as storage for temporary or
  +permanent data in embedded devices. Possible usage include non-volatile
  +storage in battery-backed SRAM, semi-permanent storage in dedicated SRAM
  +to preserve data accross reboots and firmware storage in dedicated ROM.
  +
  + - name : should be either ram or rom
  + - reg : Address range of the RAM/ROM chip
  +

No compatible prop?  How does the OS know what the node is to be used for?

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


Re: [PATCH] Make #include sysdev/foo.h work for 64-bit powerpc

2008-04-01 Thread Kumar Gala


On Apr 1, 2008, at 1:54 AM, Stephen Rothwell wrote:

Hi Michael,

On Tue,  1 Apr 2008 17:39:11 +1100 (EST) Michael Ellerman [EMAIL PROTECTED] 
 wrote:


We currently have inconsistent settings between 32  64-bit which  
means

32-bit code can #include sysdev/foo.h but 64-bit code can't.


Kumar sent a very similar (if not identical) patch earlier today.


I actually sent it several days ago, but reposted as part of the  
series of work I was doing. ;)


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


[PATCH] [POWERPC] 4xx: Fix PESDRn_UTLSET1 register setup on 460EX/GT

2008-04-01 Thread Stefan Roese
The patch fixes a bug, where the PESDRn_UTLSET1 register was setup
wrongly resulting in a non working PCIe port 1. With this fix both
PCIe ports work fine again.

Signed-off-by: Stefan Roese [EMAIL PROTECTED]
---
Based upon linux-next repo from 2008-03-31

 arch/powerpc/sysdev/ppc4xx_pci.c |   10 --
 1 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/arch/powerpc/sysdev/ppc4xx_pci.c b/arch/powerpc/sysdev/ppc4xx_pci.c
index 6c925b7..efaf4c4 100644
--- a/arch/powerpc/sysdev/ppc4xx_pci.c
+++ b/arch/powerpc/sysdev/ppc4xx_pci.c
@@ -785,19 +785,17 @@ static int ppc460ex_pciex_init_port_hw(struct 
ppc4xx_pciex_port *port)
u32 val;
u32 utlset1;
 
-   if (port-endpoint) {
+   if (port-endpoint)
val = PTYPE_LEGACY_ENDPOINT  20;
-   utlset1 = 0x2022;
-   } else {
+   else
val = PTYPE_ROOT_PORT  20;
-   utlset1 = 0x2122;
-   }
 
if (port-index == 0) {
val |= LNKW_X1  12;
+   utlset1 = 0x2000;
} else {
val |= LNKW_X4  12;
-   utlset1 |= 0x00101101;
+   utlset1 = 0x20101101;
}
 
mtdcri(SDR0, port-sdr_base + PESDRn_DLPSET, val);
-- 
1.5.4.5

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


Re: Commits added to powerpc.git master/powerpc-next branches

2008-04-01 Thread Grant Likely
On Tue, Apr 1, 2008 at 6:05 AM, Josh Boyer [EMAIL PROTECTED] wrote:
 On Tue, 2008-04-01 at 21:59 +1100, Paul Mackerras wrote:
   I have updated the master and powerpc-next branches of the powerpc.git
   repository with the following commits, including some pulled from Josh
   Boyer and Kumar Gala.

Josh/Paul,

Any thoughts on picking these two up?

http://patchwork.ozlabs.org/linuxppc/patch?person=486id=17479
http://patchwork.ozlabs.org/linuxppc/patch?person=486id=17410

Thanks,
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


Re: Commits added to powerpc.git master/powerpc-next branches

2008-04-01 Thread Josh Boyer
On Tue, 1 Apr 2008 08:26:17 -0600
Grant Likely [EMAIL PROTECTED] wrote:

 On Tue, Apr 1, 2008 at 6:05 AM, Josh Boyer [EMAIL PROTECTED] wrote:
  On Tue, 2008-04-01 at 21:59 +1100, Paul Mackerras wrote:
I have updated the master and powerpc-next branches of the powerpc.git
repository with the following commits, including some pulled from Josh
Boyer and Kumar Gala.
 
 Josh/Paul,
 
 Any thoughts on picking these two up?
 
 http://patchwork.ozlabs.org/linuxppc/patch?person=486id=17479
 http://patchwork.ozlabs.org/linuxppc/patch?person=486id=17410

I plan to stick those in my tree today.  I didn't include them with the
first batch because those commits had been sitting around for a while
and wanted to get them into Paul' -next branch.

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


Re: Commits added to powerpc.git master/powerpc-next branches

2008-04-01 Thread Timur Tabi
Paul Mackerras wrote:
 I have updated the master and powerpc-next branches of the powerpc.git
 repository with the following commits, including some pulled from Josh
 Boyer and Kumar Gala.

How about this patch?

Enable CONFIG_FORCE_MAX_ZONEORDER for all PowerPC, and make selectable


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


Re: [PATCH] RTAS - adapt procfs interface

2008-04-01 Thread Nathan Lynch
Jens Osterkamp wrote:
 
 Handling of the proc_dir_entry-count has being changed in 2.6.24-rc5.

Do you know which commit caused the change?


 After this change the default value for pde-count is 1 and not 0 as it
 was in earlier kernels. Therefore, if we want to check wether our procfs
 file is already opened (already in use), we have to check if pde-count
 is not greater than 2 but not 1.
 
 Signed-off-by: Maxim Shchetynin [EMAIL PROTECTED]
 Signed-off-by: Jens Osterkamp [EMAIL PROTECTED]
 
 Index: linux-2.6/arch/powerpc/kernel/rtas_flash.c
 ===
 --- linux-2.6.orig/arch/powerpc/kernel/rtas_flash.c
 +++ linux-2.6/arch/powerpc/kernel/rtas_flash.c
 @@ -356,7 +356,7 @@ static int rtas_excl_open(struct inode *
  
   /* Enforce exclusive open with use count of PDE */
   spin_lock(flash_file_open_lock);
 - if (atomic_read(dp-count)  1) {
 + if (atomic_read(dp-count)  2) {
   spin_unlock(flash_file_open_lock);
   return -EBUSY;
   }

One could argue that the real problem is using the proc_dir_entry's
reference count to enforce exclusive open.
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH 2/8] powerpc: replace `__attribute' by `__attribute__'

2008-04-01 Thread Roel Kluin
replace `__attribute' by `__attribute__'

Signed-off-by: Roel Kluin [EMAIL PROTECTED]
---
diff --git a/arch/powerpc/platforms/iseries/main_store.h 
b/arch/powerpc/platforms/iseries/main_store.h
index 1a7a3f5..976b23e 100644
--- a/arch/powerpc/platforms/iseries/main_store.h
+++ b/arch/powerpc/platforms/iseries/main_store.h
@@ -61,7 +61,7 @@ struct IoHriMainStoreSegment4 {
 };
 
 /* Main Store VPD for Power4 */
-struct __attribute((packed)) IoHriMainStoreChipInfo1 {
+struct __attribute__((packed)) IoHriMainStoreChipInfo1 {
u32 chipMfgID;
charchipECLevel[4];
 };
@@ -73,14 +73,14 @@ struct IoHriMainStoreVpdIdData {
charserialNumber[12];
 };
 
-struct __attribute((packed)) IoHriMainStoreVpdFruData {
+struct __attribute__((packed)) IoHriMainStoreVpdFruData {
charfruLabel[8];
u8  numberOfSlots;
u8  pluggingType;
u16 slotMapIndex;
 };
 
-struct  __attribute((packed)) IoHriMainStoreAdrRangeBlock {
+struct  __attribute__((packed)) IoHriMainStoreAdrRangeBlock {
void*blockStart;
void*blockEnd;
u32 blockProcChipId;
@@ -88,7 +88,7 @@ struct  __attribute((packed)) IoHriMainStoreAdrRangeBlock {
 
 #define MaxAreaAdrRangeBlocks 4
 
-struct __attribute((packed)) IoHriMainStoreArea4 {
+struct __attribute__((packed)) IoHriMainStoreArea4 {
u32 msVpdFormat;
u8  containedVpdType;
u8  reserved1;

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


Re: [PATCH 2/8] powerpc: replace `__attribute' by `__attribute__'

2008-04-01 Thread Sam Ravnborg
On Tue, Apr 01, 2008 at 07:31:01PM +0200, Roel Kluin wrote:
 replace `__attribute' by `__attribute__'
 
 Signed-off-by: Roel Kluin [EMAIL PROTECTED]
 ---
 diff --git a/arch/powerpc/platforms/iseries/main_store.h 
 b/arch/powerpc/platforms/iseries/main_store.h
 index 1a7a3f5..976b23e 100644
 --- a/arch/powerpc/platforms/iseries/main_store.h
 +++ b/arch/powerpc/platforms/iseries/main_store.h
 @@ -61,7 +61,7 @@ struct IoHriMainStoreSegment4 {
  };
  
  /* Main Store VPD for Power4 */
 -struct __attribute((packed)) IoHriMainStoreChipInfo1 {
 +struct __attribute__((packed)) IoHriMainStoreChipInfo1 {
   u32 chipMfgID;
   charchipECLevel[4];
  };

Please introduce __packed if you touch this.
See include/linux/compiler-gcc.h

This comment is relevant for all your patches.
We have __used and other similar variants.

So take a good look at include/linux/compiler* and
use the proper shortcuts where available.

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


Re: [PATCHv4 0/5] cpm2: Reset the CPM at startup and fix the cpm_uart driver accordingly.

2008-04-01 Thread Scott Wood

Laurent Pinchart wrote:

Hi everybody,

these 5 patches reset the CPM in cpm2_reset() and fix the cpm_uart driver to 
initialise SMC ports correctly without relying on any initialisation 
performed by the boot loader/wrapper. They update the boot wrapper code and

the EP8248E device tree to match the new SMC registers description.

Patches 2/5, 3/5 and 4/5 (boot wrapper and EP8248E device tree updates) 
haven't been tested due to lack of hardware.


Tested OK on ep8248e.
ACK 1-5

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


Re: [PATCH] RTAS - adapt procfs interface

2008-04-01 Thread Nathan Lynch
Nathan Lynch wrote:
 
 One could argue that the real problem is using the proc_dir_entry's
 reference count to enforce exclusive open.


I think this is better... the way these files are used is lame, but
this should preserve the existing behavior.  I haven't yet tested
this, can you?


diff --git a/arch/powerpc/kernel/rtas_flash.c b/arch/powerpc/kernel/rtas_flash.c
index f227659..00bc308 100644
--- a/arch/powerpc/kernel/rtas_flash.c
+++ b/arch/powerpc/kernel/rtas_flash.c
@@ -139,7 +139,7 @@ struct rtas_validate_flash_t
unsigned int update_results;/* Update results token */
 };
 
-static DEFINE_SPINLOCK(flash_file_open_lock);
+static atomic_t open_count = ATOMIC_INIT(0);
 static struct proc_dir_entry *firmware_flash_pde;
 static struct proc_dir_entry *firmware_update_pde;
 static struct proc_dir_entry *validate_pde;
@@ -216,7 +216,7 @@ static int rtas_flash_release(struct inode *inode, struct 
file *file)
uf-flist = NULL;
}
 
-   atomic_dec(dp-count);
+   atomic_dec(open_count);
return 0;
 }
 
@@ -352,26 +352,17 @@ static ssize_t rtas_flash_write(struct file *file, const 
char __user *buffer,
 
 static int rtas_excl_open(struct inode *inode, struct file *file)
 {
-   struct proc_dir_entry *dp = PDE(inode);
-
-   /* Enforce exclusive open with use count of PDE */
-   spin_lock(flash_file_open_lock);
-   if (atomic_read(dp-count)  1) {
-   spin_unlock(flash_file_open_lock);
+   if (atomic_inc_return(open_count)  1) {
+   atomic_dec(open_count);
return -EBUSY;
}
 
-   atomic_inc(dp-count);
-   spin_unlock(flash_file_open_lock);
-   
return 0;
 }
 
 static int rtas_excl_release(struct inode *inode, struct file *file)
 {
-   struct proc_dir_entry *dp = PDE(inode);
-
-   atomic_dec(dp-count);
+   atomic_dec(open_count);
 
return 0;
 }
@@ -580,7 +571,7 @@ static int validate_flash_release(struct inode *inode, 
struct file *file)
}
 
/* The matching atomic_inc was in rtas_excl_open() */
-   atomic_dec(dp-count);
+   atomic_dec(open_count);
 
return 0;
 }
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH 2/2 v5] Add DIU platform code for MPC8610HPCD

2008-04-01 Thread Andrew Morton
On Mon, 31 Mar 2008 11:23:25 -0500
York Sun [EMAIL PROTECTED] wrote:

 Add platform code to support Freescale DIU. The platform code includes
 framebuffer memory allocation, pixel format, monitor port, etc.
 
 Signed-off-by: York Sun [EMAIL PROTECTED]
 Signed-off-by: Timur Tabi [EMAIL PROTECTED]
 ---
 This patch addes platform support for Freescale DIU driver, targeting 2.6.26 
 kernel.
 
  arch/powerpc/configs/mpc8610_hpcd_defconfig |  198 
 +++
  arch/powerpc/platforms/86xx/mpc8610_hpcd.c  |  190 --
  arch/powerpc/sysdev/fsl_soc.c   |   41 ++
  arch/powerpc/sysdev/fsl_soc.h   |   23 +++
  4 files changed, 413 insertions(+), 39 deletions(-)

The defconfig change gets almost 100% rejects and probably isn't
appropriate here and isn't very important.  I dropped that part of the
patch.

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


Re: [PATCH 2/8] powerpc: replace `__attribute' by `__attribute__'

2008-04-01 Thread Paul Mackerras
Roel Kluin writes:

 replace `__attribute' by `__attribute__'

Why?  Your commit message doesn't give any motivation.

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


Re: [PATCH 2/2 v5] Add DIU platform code for MPC8610HPCD

2008-04-01 Thread Timur Tabi
Andrew Morton wrote:

 The defconfig change gets almost 100% rejects and probably isn't
 appropriate here and isn't very important.

It's weird that you get rejects, but otherwise you're correct.  defconfigs are
just a convenience, anyway.

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


Re: [PATCHv2] powerpc: Describe memory-mapped RAMROM chips OF bindings

2008-04-01 Thread Trent Piepho

On Tue, 1 Apr 2008, Laurent Pinchart wrote:

On Monday 31 March 2008 19:06, Sergei Shtylyov wrote:

   p) Freescale Synchronous Serial Interface
- q) USB EHCI controllers
+  q) USB EHCI controllers
+  r) Memory-mapped RAM  ROM


Memory-mapped RA/RO Memory again? Should better drop this. :-)


You're quite picky, aren't you ? :-)

I suppose Memory-mapped RA  RO won't be accepted, so what about Auxiliary
RAM  ROM ?


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


[PATCH / RFC 2/2] ISP1760: bus glue code

2008-04-01 Thread Sebastian Siewior
This patch contains the entry for the build system and glue code for the
platform bus. Currently OpenFirmware and PCI is supported.

Signed-off-by: Sebastian Siewior [EMAIL PROTECTED]
--- a/drivers/usb/host/Kconfig
+++ b/drivers/usb/host/Kconfig
@@ -95,6 +95,32 @@ config USB_ISP116X_HCD
  To compile this driver as a module, choose M here: the
  module will be called isp116x-hcd.
 
+config USB_ISP1760_HCD
+   tristate ISP 1760 HCD support
+   depends on USB  EXPERIMENTAL
+   ---help---
+ The ISP1760 chip is a USB 2.0 host controller.
+
+ This driver does not support isochronous transfers or OTG.
+
+ To compile this driver as a module, choose M here: the
+ module will be called isp1760-hcd.
+
+config USB_ISP1760_PCI
+   bool Support for the PCI bus
+   depends on USB_ISP1760_HCD  PCI
+   ---help---
+ Enables support for the device present on the PCI bus.
+ This should only be required if you happen to have the eval kit from
+ NXP and you are going to test it.
+
+config USB_ISP1760_OF
+   bool Support for the OF platform bus
+   depends on USB_ISP1760_HCD  OF
+   ---help---
+ Enables support for the device present on the PowerPC
+ OpenFirmware platform bus.
+
 config USB_OHCI_HCD
tristate OHCI HCD support
depends on USB  USB_ARCH_HAS_OHCI
--- a/drivers/usb/host/Makefile
+++ b/drivers/usb/host/Makefile
@@ -6,6 +6,8 @@ ifeq ($(CONFIG_USB_DEBUG),y)
EXTRA_CFLAGS+= -DDEBUG
 endif
 
+isp1760-objs := isp1760-hcd.o isp1760-if.o
+
 obj-$(CONFIG_PCI)  += pci-quirks.o
 
 obj-$(CONFIG_USB_EHCI_HCD) += ehci-hcd.o
@@ -16,4 +18,4 @@ obj-$(CONFIG_USB_SL811_HCD)   += sl811-hcd
 obj-$(CONFIG_USB_SL811_CS) += sl811_cs.o
 obj-$(CONFIG_USB_U132_HCD) += u132-hcd.o
 obj-$(CONFIG_USB_R8A66597_HCD) += r8a66597-hcd.o
-
+obj-$(CONFIG_USB_ISP1760_HCD)  += isp1760.o
--- /dev/null
+++ b/drivers/usb/host/isp1760-if.c
@@ -0,0 +1,294 @@
+/*
+ * Glue code for the ISP1760 driver and bus
+ * Currently there is support for
+ * - OpenFirmware
+ * - PCI
+ *
+ * (c) 2007 Sebastian Siewior [EMAIL PROTECTED]
+ *
+ */
+
+#include linux/usb.h
+#include linux/io.h
+
+#include ../core/hcd.h
+#include isp1760-hcd.h
+
+#ifdef CONFIG_USB_ISP1760_OF
+#include linux/of.h
+#include linux/of_platform.h
+#endif
+
+#ifdef CONFIG_USB_ISP1760_PCI
+#include linux/pci.h
+#endif
+
+#ifdef CONFIG_USB_ISP1760_OF
+static int of_isp1760_probe(struct of_device *dev,
+   const struct of_device_id *match)
+{
+   struct usb_hcd *hcd;
+   struct device_node *dp = dev-node;
+   struct resource *res;
+   struct resource memory;
+   struct of_irq oirq;
+   int virq;
+   u64 res_len;
+   int ret;
+
+   ret = of_address_to_resource(dp, 0, memory);
+   if (ret)
+   return -ENXIO;
+
+   res = request_mem_region(memory.start, memory.end - memory.start + 1,
+   dev-dev.bus_id);
+   if (!res)
+   return -EBUSY;
+
+   res_len = memory.end - memory.start + 1;
+
+   if (of_irq_map_one(dp, 0, oirq)) {
+   ret = -ENODEV;
+   goto release_reg;
+   }
+
+   virq = irq_create_of_mapping(oirq.controller, oirq.specifier,
+   oirq.size);
+
+   hcd = isp1760_register(memory.start, res_len, virq,
+   IRQF_SHARED | IRQF_DISABLED, dev-dev, dev-dev.bus_id);
+   if (IS_ERR(hcd)) {
+   ret = PTR_ERR(hcd);
+   goto release_reg;
+   }
+
+   dev_set_drvdata(dev-dev, hcd);
+   return ret;
+
+release_reg:
+   release_mem_region(memory.start, memory.end - memory.start + 1);
+   return ret;
+}
+
+static int of_isp1760_remove(struct of_device *dev)
+{
+   struct usb_hcd *hcd = dev_get_drvdata(dev-dev);
+
+   dev_set_drvdata(dev-dev, NULL);
+
+   usb_remove_hcd(hcd);
+   iounmap(hcd-regs);
+   release_mem_region(hcd-rsrc_start, hcd-rsrc_len);
+   usb_put_hcd(hcd);
+   return 0;
+}
+
+static struct of_device_id of_isp1760_match[] = {
+   {
+   .compatible = nxp,usb-isp1760,
+   },
+   { },
+};
+MODULE_DEVICE_TABLE(of, of_isp1760_match);
+
+static struct of_platform_driver isp1760_of_driver = {
+   .name   = nxp-isp1760,
+   .match_table= of_isp1760_match,
+   .probe  = of_isp1760_probe,
+   .remove = of_isp1760_remove,
+};
+#endif
+
+#ifdef CONFIG_USB_ISP1760_PCI
+static u32 nxp_pci_io_base;
+static u32 iolength;
+static u32 pci_mem_phy0;
+static u32 length;
+static u8 *chip_addr;
+static u8 *iobase;
+
+static int __devinit isp1761_pci_probe(struct pci_dev *dev,
+   const struct pci_device_id *id)
+{
+   u8 latency, limit;
+   __u32 reg_data;
+   int retry_count;
+   int length;
+   int status = 1;
+   struct usb_hcd *hcd;
+
+   if (usb_disabled())
+   return 

Re: [PATCH 04/11 v2] [POWERPC] Remove and replace uses of PPC_MEMSTART with memstart_addr

2008-04-01 Thread Kumar Gala


On Apr 1, 2008, at 5:50 AM, Paul Mackerras wrote:

Kumar Gala writes:

For the sub-arches that support relocatable interrupt vectors (book- 
e) its
reasonable to have memory start at a non-zero physical address.   
For those
cases use the variable memstart_addr instead of the #define  
PPC_MEMSTART

since the only uses of PPC_MEMSTART are for initialization and in the
future we can set memstart_addr at runtime to have a relocatable  
kernel.


In those cases, is it still true that the kernel sits at the start of
the usable memory, or might there be usable memory before _stext?
In other words, is PAGE_OFFSET == KERNELBASE still true or not?


Both cases are possible.

Here are the four cases I see:
* Normal kernel (kernel at physical 0)
* kexec kernel (kernel at physical 32M, but still has access to memory  
from physical 0 to 32M)


* cAMP kernel (kernel at non-zero offset) [eg. 256M offset]
* kexec cAMP kernel (kernel at 256M+32M, but has access to 256M + size)

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


Re: [PATCH 01/11] [POWERPC] bootwrapper: Allow specifying of image physical offset

2008-04-01 Thread Kumar Gala


On Apr 1, 2008, at 5:08 AM, Paul Mackerras wrote:

Kumar Gala writes:


Normally we assume kernel images will be loaded at offset 0. However
there are situations, like when the kernel itself is running at a  
non-zero

physical address, that we don't want to load it at 0.

Allow the wrapper to take an offset.  We use this when building u- 
boot images.


This makes it a bit harder to build a kernel and then wrap it later
on, since one would have to know what -m value to give.  Would it
possible for either the wrapper script or mkimage to peek in the ELF
header of the vmlinux to work out what physical address to use?


Hmm, need to think about that.  But my initial reaction is two fold.   
One I don't think this information would be around and two don't we  
already have this problem with a kdump kernel?


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


Re: [PATCH] [POWERPC] Move phys_addr_t definition into asm/types.h

2008-04-01 Thread Kumar Gala


On Mar 31, 2008, at 10:42 PM, Paul Mackerras wrote:

Kumar Gala writes:

Moved phys_addr_t out of mmu-*.h and into asm/types.h so we can use  
it in

places that before would have caused recursive includes.

For example to use phys_addr_t in asm/page.h we would have included
asm/mmu.h which would have possibly included asm/mmu-hash64.h  
which

includes asm/page.h.  Wh recursive include.


In general this looks fine.  I wonder if you should use u64 rather
than unsigned long long.  Since CONFIG_PHYS_64BIT=n on 64-bit machines
(which is itself somewhat counterintuitive) we will actually use
unsigned long on 64-bit machines, so it matters less than I originally
thought, but it would be worth explaining that in a comment and/or the
commit message.


We could change it to be:

/* Physical address used by some IO functions */
#if defined(CONFIG_PPC64) || defined(CONFIG_PHYS_64BIT)
typedef u64 phys_addr_t;
#else
typedef u32 phys_addr_t;
#endif

This seems a bit more self documenting which is always nice (and I can  
add a comment in the commit message about CONFIG_PHYS_64BIT only  
making sense on ppc32).


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


Re: Please pull powerpc.git merge branch

2008-04-01 Thread Paul Mackerras
Bartlomiej Sieka writes:

 What about http://patchwork.ozlabs.org/linuxppc/patch?id=17525 ? I don't
 see it in the merge branch of your repository, and it would be nice to
 get it upstream as it fixes boot problems on some MPC5200-based boards.

It needs a proper stand-alone commit message and an acked-by from
Grant.  The commit message should explain why you are making the
changes you are making rather than just saying the bulk of this patch
is taken from http://...;.

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


Re: [PATCH] Make #include sysdev/foo.h work for 64-bit powerpc

2008-04-01 Thread Michael Ellerman

On Tue, 2008-04-01 at 08:18 -0500, Kumar Gala wrote:
 On Apr 1, 2008, at 1:54 AM, Stephen Rothwell wrote:
  Hi Michael,
 
  On Tue,  1 Apr 2008 17:39:11 +1100 (EST) Michael Ellerman [EMAIL 
  PROTECTED] 
   wrote:
 
  We currently have inconsistent settings between 32  64-bit which  
  means
  32-bit code can #include sysdev/foo.h but 64-bit code can't.
 
  Kumar sent a very similar (if not identical) patch earlier today.
 
 I actually sent it several days ago, but reposted as part of the  
 series of work I was doing. ;)

OK, I missed it. I'm not fussed who's goes in, I just needed it for some
other work.

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: Please pull from 'for-2.6.25' branch

2008-04-01 Thread Kumar Gala


On Mar 31, 2008, at 11:57 AM, Kumar Gala wrote:

Please pull from 'for-2.6.25' branch of

	master.kernel.org:/pub/scm/linux/kernel/git/galak/powerpc.git  
for-2.6.25


I'd like to get these minor fixes into 2.6.25.  They aren't critical  
but

extremely convenient at this point.


Paul, any comments on sending this onto linus.  I was hoping to avoid  
2.6.25 coming up not support the proper device bindings for DMA and  
SATA.


- k




to receive the following updates:

arch/powerpc/boot/dts/mpc8377_mds.dts   |4 ++--
arch/powerpc/boot/dts/mpc8377_rdb.dts   |3 +--
arch/powerpc/boot/dts/mpc8378_rdb.dts   |3 +--
arch/powerpc/boot/dts/mpc8379_mds.dts   |8 
arch/powerpc/boot/dts/mpc8379_rdb.dts   |3 +--
arch/powerpc/configs/mpc832x_mds_defconfig  |   11 +++
arch/powerpc/configs/mpc834x_mds_defconfig  |   11 +++
arch/powerpc/configs/mpc836x_mds_defconfig  |   11 +++
arch/powerpc/configs/mpc837x_rdb_defconfig  |   24 ++ 
+-
arch/powerpc/configs/mpc83xx_defconfig  |   24 ++ 
+-

arch/powerpc/configs/mpc8544_ds_defconfig   |   11 +++
arch/powerpc/configs/mpc8568mds_defconfig   |   11 +++
arch/powerpc/configs/mpc8572_ds_defconfig   |   11 +++
arch/powerpc/configs/mpc85xx_defconfig  |   11 +++
arch/powerpc/configs/mpc8641_hpcn_defconfig |   11 +++
arch/powerpc/configs/prpmc2800_defconfig|   11 +++
arch/powerpc/configs/storcenter_defconfig   |   11 +++
drivers/ata/sata_fsl.c  |5 +
drivers/dma/fsldma.c|8 
19 files changed, 90 insertions(+), 102 deletions(-)

Anton Vorontsov (1):
 [POWERPC] 83xx: Fix wrong USB phy type in mpc837xrdb dts

Kim Phillips (2):
 [POWERPC] 83xx: enable usb in 837x rdb and 83xx defconfigs
 [POWERPC] sata_fsl: reduce compatibility to fsl,pq-sata

Kumar Gala (2):
 [POWERPC] fsldma: Use compatiable binding as spec
 [POWERPC] Fix defconfigs so we dont set both GENRTC and RTCLIB

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


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


Re: [PATCH 01/11] [POWERPC] bootwrapper: Allow specifying of image physical offset

2008-04-01 Thread Paul Mackerras
Kumar Gala writes:

 Hmm, need to think about that.  But my initial reaction is two fold.   
 One I don't think this information would be around and two don't we  
 already have this problem with a kdump kernel?

I'm just concerned that we have two things that have to match up - the
compiled-in physical address that the kernel assumes it is running at,
and the physical address where it is actually loaded.  While those two
things were both always 0 for embedded processors, there wasn't a
problem, but now we can have a situation where a kernel binary has to
be loaded at some nonzero address to work correctly, but there is no
way to work out what that address is for an existing vmlinux binary.
Or have I missed something?

For a kdump kernel, at least for 64-bit, the physical address has to
be 32MB.  There is no other choice, so there is no possibility of
confusion.

For 85xx, would it be possible to have the kernel figure out what
physical address it has been loaded at, and use that as the base
address, rather than having the base address set at compile time?
That would solve my objection since it would mean that there would no
longer be two things that had to be kept in sync.  You could pass any
value to wrapper/mkimage (subject to constraints such as it has to be
a multiple of 256M) and it would work.  That value could even come
from a config option in the case where wrapper is invoked as part of
the kernel build, but that config option shouldn't affect anything at
all in the vmlinux.

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


Re: Please pull powerpc.git merge branch

2008-04-01 Thread Grant Likely
On Tue, Apr 1, 2008 at 5:12 PM, Paul Mackerras [EMAIL PROTECTED] wrote:
 Bartlomiej Sieka writes:

   What about http://patchwork.ozlabs.org/linuxppc/patch?id=17525 ? I don't
   see it in the merge branch of your repository, and it would be nice to
   get it upstream as it fixes boot problems on some MPC5200-based boards.

  It needs a proper stand-alone commit message and an acked-by from
  Grant.  The commit message should explain why you are making the
  changes you are making rather than just saying the bulk of this patch
  is taken from http://...;.

Total Ack.  I just missed it when it was sent.  But Paul is right, it
needs a real commit message.  Feel free to add my Acked-by: line when
you resend.

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


Re: [Cbe-oss-dev] [PATCH] Cell OProfile: SPU mutex lock fix

2008-04-01 Thread Arnd Bergmann
On Tuesday 25 March 2008, Carl Love wrote:
 This patch fixes a bug in the code that records the SPU data and
 context switches.  The buffer_mutex lock must be held when the
 kernel is adding data to the buffer between the kernel and the
 OProfile daemon.  The lock is not being held in the current code
 base.  This patch fixes the bug using work queues.  The data to 
 be passed to the daemon is caputured by the interrupt handler.  
 The workqueue function is invoked to grab the buffer_mutex lock
 and add the data to the buffer.  

So what was the exact bug you're fixing with this? There was no
buffer_mutex before, so why do you need it now? Can't this be a
spinlock so you can get it from interrupt context instead of
using a workqueue?

 Index: linux-2.6.25-rc4/arch/powerpc/oprofile/cell/spu_profiler.c
 ===
 --- linux-2.6.25-rc4.orig/arch/powerpc/oprofile/cell/spu_profiler.c
 +++ linux-2.6.25-rc4/arch/powerpc/oprofile/cell/spu_profiler.c
 @@ -16,6 +16,7 @@
  #include linux/smp.h
  #include linux/slab.h
  #include asm/cell-pmu.h
 +#include linux/workqueue.h
  #include pr_util.h
  

Please keep #include statements in alphabetical order, with all linux/ files
before the asm/ files.

  #define TRACE_ARRAY_SIZE 1024
 @@ -32,9 +33,19 @@ static unsigned int profiling_interval;
  
  #define SPU_PC_MASK   0x
  
 +/* The generic OProfile code uses the buffer_mutex to protect the buffer
 + * between the kernel and the daemon.  The SPU code needs to use the buffer
 + * to ensure that the kernel SPU writes complete as a single block before
 + * being consumed by the daemon.
 + */
 +extern struct mutex buffer_mutex;
 +
  static DEFINE_SPINLOCK(sample_array_lock);
  unsigned long sample_array_lock_flags;
  
 +struct work_struct spu_record_wq;
 +extern struct workqueue_struct *oprofile_spu_wq;
 +
  void set_spu_profiling_frequency(unsigned int freq_khz, unsigned int 
 cycles_reset)
  {
   unsigned long ns_per_cyc;

Never put extern statements in the implementation, they describe the
interface between two parts of the code and should be inside of a
common header.

Why do you want to have your own workqueue instead of using the
global one?

 @@ -123,14 +134,14 @@ static int cell_spu_pc_collection(int cp
   return entry;
  }
  
 -
 -static enum hrtimer_restart profile_spus(struct hrtimer *timer)
 -{
 - ktime_t kt;
 +static void profile_spus_record_samples (struct work_struct *ws) {
 + /* This routine is called via schedule_work() to record the
 +  * spu data.  It must be run in a normal kernel mode to
 +  * grab the OProfile mutex lock.
 +  */
   int cpu, node, k, num_samples, spu_num;
  
 - if (!spu_prof_running)
 - goto stop;
 + mutex_lock(buffer_mutex);
  
   for_each_online_cpu(cpu) {
   if (cbe_get_hw_thread_id(cpu))
 @@ -170,6 +181,20 @@ static enum hrtimer_restart profile_spus
   smp_wmb();  /* insure spu event buffer updates are written */
   /* don't want events intermingled... */
  
 + mutex_unlock(buffer_mutex);
 +}
 +
 +static enum hrtimer_restart profile_spus(struct hrtimer *timer)
 +{
 + ktime_t kt;
 +
 +
 + if (!spu_prof_running)
 + goto stop;
 +
 + /* schedule the funtion to record the data */
 + schedule_work(spu_record_wq);
 +
   kt = ktime_set(0, profiling_interval);
   if (!spu_prof_running)
   goto stop;

This looks like you want to use a delayed_work rather than building your
own out of hrtimer and work. Is there any point why you want to use
an hrtimer?

 -static DEFINE_SPINLOCK(buffer_lock);
 +extern struct mutex buffer_mutex;
 +extern struct workqueue_struct *oprofile_spu_wq;
 +extern int calls_to_record_switch;
 +

Again, public interfaces need to go to a header file, and should
have a name that identifies the interface. buffer_mutex is
certainly not a suitable name for a kernel-wide global variable!

  static DEFINE_SPINLOCK(cache_lock);
  static int num_spu_nodes;
 +
  int spu_prof_num_nodes;
  int last_guard_val[MAX_NUMNODES * 8];
 +int cnt_swtch_processed_flag[MAX_NUMNODES * 8];
 +
 +struct spus_profiling_code_data_s {
 + int num_spu_nodes;
 + struct work_struct spu_prof_code_wq;
 +} spus_profiling_code_data;
 +
 +struct spu_context_switch_data_s {
 + struct spu *spu;
 + unsigned long spu_cookie;
 + unsigned long app_dcookie;
 + unsigned int offset;
 + unsigned long objectId;
 + int valid_entry;
 +} spu_context_switch_data;

I don't understand what these variables are really doing, but
having e.g. just one spu_context_switch_data for all the SPUs
doesn't seem to make much sense. What happens when two SPUs do
a context switch at the same time?

 +int calls_to_record_switch = 0;
 +int record_spu_start_flag = 0;
 +
 +struct spus_cntxt_sw_data_s {
 + int num_spu_nodes;
 + struct spu_context_switch_data_s spu_data[MAX_NUMNODES * 8];
 + struct