[PATCH 15/20] [POWERPC] Adds 44x CPR0 accessors to boot wrapper

2007-12-13 Thread Benjamin Herrenschmidt
This adds macros to the boot wrapper to access the CPR
registers from the boot wrappers.

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

 arch/powerpc/boot/dcr.h |   27 +++
 1 file changed, 27 insertions(+)

--- linux-merge.orig/arch/powerpc/boot/dcr.h2007-12-13 18:33:32.0 
+1100
+++ linux-merge/arch/powerpc/boot/dcr.h 2007-12-13 18:33:33.0 +1100
@@ -147,4 +147,31 @@ static const unsigned long sdram_bxcr[] 
 #define DCRN_405_CPC0_CR0 0xb1
 #define DCRN_405_CPC0_CR1 0xb2
 
+
+/* 440GX Clock control etc */
+
+
+#define DCRN_CPR0_CLKUPD   0x020
+#define DCRN_CPR0_PLLC 0x040
+#define DCRN_CPR0_PLLD 0x060
+#define DCRN_CPR0_PRIMAD   0x080
+#define DCRN_CPR0_PRIMBD   0x0a0
+#define DCRN_CPR0_OPBD 0x0c0
+#define DCRN_CPR0_PERD 0x0e0
+#define DCRN_CPR0_MALD 0x100
+
+/* CPRs read/write helper macros - based off include/asm-ppc/ibm44x.h */
+
+#define DCRN_CPR0_CFGADDR  0xc
+#define DCRN_CPR0_CFGDATA  0xd
+
+#define CPR0_READ(offset) ({\
+   mtdcr(DCRN_CPR0_CFGADDR, offset); \
+   mfdcr(DCRN_CPR0_CFGDATA); })
+#define CPR0_WRITE(offset, data) ({\
+   mtdcr(DCRN_CPR0_CFGADDR, offset); \
+   mtdcr(DCRN_CPR0_CFGDATA, data); })
+
+
+
 #endif /* _PPC_BOOT_DCR_H_ */
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH 16/20] [POWERPC] Rework 4xx clock probing in boot wrapper

2007-12-13 Thread Benjamin Herrenschmidt
This reworks the boot wrapper library function that probes
the chip clocks. Better separate the base function that is
used on 440GX,SPe,EP,... from the uart fixups as those need
different device-tree path on different processors.

Also, rework the function itself based on the arch/ppc code
from Eugene Surovegin which I find more readable, and which
handles one more bypass case. Also handle the subtle difference
between 440EP/EPx and 440SPe/GX, on the former, PerClk is derived
from the PLB clock while on the later, it's derived from the OPB. 

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

 arch/powerpc/boot/4xx.c|  272 +++--
 arch/powerpc/boot/4xx.h|   11 +
 arch/powerpc/boot/bamboo.c |2 
 arch/powerpc/boot/cuboot-sequoia.c |2 
 arch/powerpc/boot/cuboot-taishan.c |4 
 arch/powerpc/boot/dcr.h|   17 ++
 arch/powerpc/boot/ebony.c  |   60 
 7 files changed, 233 insertions(+), 135 deletions(-)

--- linux-work.orig/arch/powerpc/boot/4xx.c 2007-12-03 14:25:34.0 
+1100
+++ linux-work/arch/powerpc/boot/4xx.c  2007-12-03 14:26:09.0 +1100
@@ -275,89 +275,225 @@ void ibm4xx_fixup_ebc_ranges(const char 
setprop(devp, ranges, ranges, (p - ranges) * sizeof(u32));
 }
 
-#define SPRN_CCR1 0x378
-void ibm440ep_fixup_clocks(unsigned int sysclk, unsigned int ser_clk)
+/* Calculate 440GP clocks */
+void ibm440gp_fixup_clocks(unsigned int sys_clk, unsigned int ser_clk)
 {
-   u32 cpu, plb, opb, ebc, tb, uart0, m, vco;
-   u32 reg;
-   u32 fwdva, fwdvb, fbdv, lfbdv, opbdv0, perdv0, spcid0, prbdv0, tmp;
-
-   mtdcr(DCRN_CPR0_ADDR, CPR0_PLLD0);
-   reg = mfdcr(DCRN_CPR0_DATA);
-   tmp = (reg  0x000F)  16;
-   fwdva = tmp ? tmp : 16;
-   tmp = (reg  0x0700)  8;
-   fwdvb = tmp ? tmp : 8;
-   tmp = (reg  0x1F00)  24;
-   fbdv = tmp ? tmp : 32;
-   lfbdv = (reg  0x007F);
-
-   mtdcr(DCRN_CPR0_ADDR, CPR0_OPBD0);
-   reg = mfdcr(DCRN_CPR0_DATA);
-   tmp = (reg  0x0300)  24;
-   opbdv0 = tmp ? tmp : 4;
-
-   mtdcr(DCRN_CPR0_ADDR, CPR0_PERD0);
-   reg = mfdcr(DCRN_CPR0_DATA);
-   tmp = (reg  0x0700)  24;
-   perdv0 = tmp ? tmp : 8;
-
-   mtdcr(DCRN_CPR0_ADDR, CPR0_PRIMBD0);
-   reg = mfdcr(DCRN_CPR0_DATA);
-   tmp = (reg  0x0700)  24;
-   prbdv0 = tmp ? tmp : 8;
-
-   mtdcr(DCRN_CPR0_ADDR, CPR0_SCPID);
-   reg = mfdcr(DCRN_CPR0_DATA);
-   tmp = (reg  0x0300)  24;
-   spcid0 = tmp ? tmp : 4;
-
-   /* Calculate M */
-   mtdcr(DCRN_CPR0_ADDR, CPR0_PLLC0);
-   reg = mfdcr(DCRN_CPR0_DATA);
-   tmp = (reg  0x0300)  24;
-   if (tmp == 0) { /* PLL output */
-   tmp = (reg  0x2000)  29;
-   if (!tmp) /* PLLOUTA */
-   m = fbdv * lfbdv * fwdva;
+   u32 sys0 = mfdcr(DCRN_CPC0_SYS0);
+   u32 cr0 = mfdcr(DCRN_CPC0_CR0);
+   u32 cpu, plb, opb, ebc, tb, uart0, uart1, m;
+   u32 opdv = CPC0_SYS0_OPDV(sys0);
+   u32 epdv = CPC0_SYS0_EPDV(sys0);
+
+   if (sys0  CPC0_SYS0_BYPASS) {
+   /* Bypass system PLL */
+   cpu = plb = sys_clk;
+   } else {
+   if (sys0  CPC0_SYS0_EXTSL)
+   /* PerClk */
+   m = CPC0_SYS0_FWDVB(sys0) * opdv * epdv;
else
-   m = fbdv * lfbdv * fwdvb;
+   /* CPU clock */
+   m = CPC0_SYS0_FBDV(sys0) * CPC0_SYS0_FWDVA(sys0);
+   cpu = sys_clk * m / CPC0_SYS0_FWDVA(sys0);
+   plb = sys_clk * m / CPC0_SYS0_FWDVB(sys0);
}
-   else if (tmp == 1) /* CPU output */
-   m = fbdv * fwdva;
+
+   opb = plb / opdv;
+   ebc = opb / epdv;
+
+   /* FIXME: Check if this is for all 440GP, or just Ebony */
+   if ((mfpvr()  0xffff) == 0x4440)
+   /* Rev. B 440GP, use external system clock */
+   tb = sys_clk;
else
-   m = perdv0 * opbdv0 * fwdvb;
+   /* Rev. C 440GP, errata force us to use internal clock */
+   tb = cpu;
 
-   vco = (m * sysclk) + (m  1);
-   cpu = vco / fwdva;
-   plb = vco / fwdvb / prbdv0;
-   opb = plb / opbdv0;
-   ebc = plb / perdv0;
+   if (cr0  CPC0_CR0_U0EC)
+   /* External UART clock */
+   uart0 = ser_clk;
+   else
+   /* Internal UART clock */
+   uart0 = plb / CPC0_CR0_UDIV(cr0);
 
-   /* FIXME */
-   uart0 = ser_clk;
+   if (cr0  CPC0_CR0_U1EC)
+   /* External UART clock */
+   uart1 = ser_clk;
+   else
+   /* Internal UART clock */
+   uart1 = plb / CPC0_CR0_UDIV(cr0);
+
+   printf(PPC440GP: SysClk = %dMHz (%x)\n\r,
+  (sys_clk + 50) / 100, sys_clk);
+
+   dt_fixup_cpu_clocks(cpu, tb, 0);

[PATCH 18/20] [POWERPC] 4xx PCI-E Link setup improvements

2007-12-13 Thread Benjamin Herrenschmidt
This improves the way the 4xx PCI-E code handles checking for a link
and adds explicit testing of CRS result codes on config space accesses.

This should make it more reliable.

Also, bridges with no link are now still created, though config space
accesses beyond the root complex are filtered. This is one step toward
eventually supporting hotplug.

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

 arch/powerpc/sysdev/ppc4xx_pci.c |  222 +++
 arch/powerpc/sysdev/ppc4xx_pci.h |2 
 2 files changed, 134 insertions(+), 90 deletions(-)

--- linux-merge.orig/arch/powerpc/sysdev/ppc4xx_pci.c   2007-12-11 
16:51:20.0 +1100
+++ linux-merge/arch/powerpc/sysdev/ppc4xx_pci.c2007-12-11 
16:51:24.0 +1100
@@ -16,6 +16,8 @@
  *
  */
 
+#undef DEBUG
+
 #include linux/kernel.h
 #include linux/pci.h
 #include linux/init.h
@@ -531,10 +533,13 @@ struct ppc4xx_pciex_port
struct device_node  *node;
unsigned intindex;
int endpoint;
+   int link;
+   int has_ibpre;
unsigned intsdr_base;
dcr_host_t  dcrs;
struct resource cfg_space;
struct resource utl_regs;
+   void __iomem*utl_base;
 };
 
 static struct ppc4xx_pciex_port *ppc4xx_pciex_ports;
@@ -706,29 +711,44 @@ static int ppc440spe_pciex_init_port_hw(
return 0;
 }
 
-static int ppc440speA_pciex_init_utl(struct ppc4xx_pciex_port *port)
+static int ppc440speA_pciex_init_port_hw(struct ppc4xx_pciex_port *port)
+{
+   return ppc440spe_pciex_init_port_hw(port);
+}
+
+static int ppc440speB_pciex_init_port_hw(struct ppc4xx_pciex_port *port)
 {
-   void __iomem *utl_base;
+   int rc = ppc440spe_pciex_init_port_hw(port);
+
+   port-has_ibpre = 1;
+
+   return rc;
+}
 
+static int ppc440speA_pciex_init_utl(struct ppc4xx_pciex_port *port)
+{
/* XXX Check what that value means... I hate magic */
dcr_write(port-dcrs, DCRO_PEGPL_SPECIAL, 0x68782800);
 
-   utl_base = ioremap(port-utl_regs.start, 0x100);
-   BUG_ON(utl_base == NULL);
-
/*
 * Set buffer allocations and then assert VRB and TXE.
 */
-   out_be32(utl_base + PEUTL_OUTTR,   0x0800);
-   out_be32(utl_base + PEUTL_INTR,0x0200);
-   out_be32(utl_base + PEUTL_OPDBSZ,  0x1000);
-   out_be32(utl_base + PEUTL_PBBSZ,   0x5300);
-   out_be32(utl_base + PEUTL_IPHBSZ,  0x0800);
-   out_be32(utl_base + PEUTL_IPDBSZ,  0x1000);
-   out_be32(utl_base + PEUTL_RCIRQEN, 0x00f0);
-   out_be32(utl_base + PEUTL_PCTL,0x80800066);
+   out_be32(port-utl_base + PEUTL_OUTTR,   0x0800);
+   out_be32(port-utl_base + PEUTL_INTR,0x0200);
+   out_be32(port-utl_base + PEUTL_OPDBSZ,  0x1000);
+   out_be32(port-utl_base + PEUTL_PBBSZ,   0x5300);
+   out_be32(port-utl_base + PEUTL_IPHBSZ,  0x0800);
+   out_be32(port-utl_base + PEUTL_IPDBSZ,  0x1000);
+   out_be32(port-utl_base + PEUTL_RCIRQEN, 0x00f0);
+   out_be32(port-utl_base + PEUTL_PCTL,0x80800066);
 
-   iounmap(utl_base);
+   return 0;
+}
+
+static int ppc440speB_pciex_init_utl(struct ppc4xx_pciex_port *port)
+{
+   /* Report CRS to the operating system */
+   out_be32(port-utl_base + PEUTL_PBCTL,0x0800);
 
return 0;
 }
@@ -736,14 +756,15 @@ static int ppc440speA_pciex_init_utl(str
 static struct ppc4xx_pciex_hwops ppc440speA_pcie_hwops __initdata =
 {
.core_init  = ppc440spe_pciex_core_init,
-   .port_init_hw   = ppc440spe_pciex_init_port_hw,
+   .port_init_hw   = ppc440speA_pciex_init_port_hw,
.setup_utl  = ppc440speA_pciex_init_utl,
 };
 
 static struct ppc4xx_pciex_hwops ppc440speB_pcie_hwops __initdata =
 {
.core_init  = ppc440spe_pciex_core_init,
-   .port_init_hw   = ppc440spe_pciex_init_port_hw,
+   .port_init_hw   = ppc440speB_pciex_init_port_hw,
+   .setup_utl  = ppc440speB_pciex_init_utl,
 };
 
 
@@ -821,30 +842,21 @@ static int ppc405ex_pciex_init_port_hw(s
 
 static int ppc405ex_pciex_init_utl(struct ppc4xx_pciex_port *port)
 {
-   void __iomem *utl_base;
-
dcr_write(port-dcrs, DCRO_PEGPL_SPECIAL, 0x0);
 
-   utl_base = ioremap(port-utl_regs.start, 0x100);
-   BUG_ON(utl_base == NULL);
-
/*
 * Set buffer allocations and then assert VRB and TXE.
 */
-   out_be32(utl_base + PEUTL_OUTTR,   0x0200);
-   out_be32(utl_base + PEUTL_INTR,0x0200);
-   out_be32(utl_base + PEUTL_OPDBSZ,  0x0400);
-   out_be32(utl_base + PEUTL_PBBSZ,   0x2100);
-   out_be32(utl_base + PEUTL_IPHBSZ,  0x0200);
-   out_be32(utl_base + PEUTL_IPDBSZ,  0x0400);
-   out_be32(utl_base + PEUTL_RCIRQEN, 0x00f0);
-   out_be32(utl_base + PEUTL_PCTL,0x80800066);
-

[PATCH 19/20] [POWERPC] pci32: 4xx embedded platforms want to reassign all PCI resources

2007-12-13 Thread Benjamin Herrenschmidt
This makes 4xx embedded platforms re-assign all PCI resources as we
pretty much never care about what the various firmwares have done on
these, it's generally not compatible with the way the kernel will map
the bridges.

We still need to also enable bus renumbering on some of them, but I
will do that from a separate patch after I've fixed 4xx PCIe to handle
all bus numbers.

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

 arch/powerpc/platforms/40x/ep405.c   |2 ++
 arch/powerpc/platforms/40x/kilauea.c |3 +++
 arch/powerpc/platforms/40x/walnut.c  |3 +++
 arch/powerpc/platforms/44x/bamboo.c  |4 
 arch/powerpc/platforms/44x/ebony.c   |3 +++
 arch/powerpc/platforms/44x/katmai.c  |3 +++
 arch/powerpc/platforms/44x/sequoia.c |5 -
 arch/powerpc/platforms/44x/taishan.c |2 ++
 8 files changed, 24 insertions(+), 1 deletion(-)

--- linux-work.orig/arch/powerpc/platforms/44x/bamboo.c 2007-12-10 
16:51:42.0 +1100
+++ linux-work/arch/powerpc/platforms/44x/bamboo.c  2007-12-10 
16:55:06.0 +1100
@@ -21,6 +21,8 @@
 #include asm/udbg.h
 #include asm/time.h
 #include asm/uic.h
+#include asm/pci-bridge.h
+
 #include 44x.h
 
 static struct of_device_id bamboo_of_bus[] = {
@@ -48,6 +50,8 @@ static int __init bamboo_probe(void)
if (!of_flat_dt_is_compatible(root, amcc,bamboo))
return 0;
 
+   ppc_pci_flags = PPC_PCI_REASSIGN_ALL_RSRC;
+
return 1;
 }
 
Index: linux-work/arch/powerpc/platforms/40x/ep405.c
===
--- linux-work.orig/arch/powerpc/platforms/40x/ep405.c  2007-12-10 
16:51:42.0 +1100
+++ linux-work/arch/powerpc/platforms/40x/ep405.c   2007-12-10 
16:55:06.0 +1100
@@ -101,6 +101,8 @@ static void __init ep405_setup_arch(void
 {
/* Find  init the BCSR CPLD */
ep405_init_bcsr();
+
+   ppc_pci_flags = PPC_PCI_REASSIGN_ALL_RSRC;
 }
 
 static int __init ep405_probe(void)
Index: linux-work/arch/powerpc/platforms/40x/kilauea.c
===
--- linux-work.orig/arch/powerpc/platforms/40x/kilauea.c2007-12-10 
16:51:42.0 +1100
+++ linux-work/arch/powerpc/platforms/40x/kilauea.c 2007-12-10 
16:55:06.0 +1100
@@ -19,6 +19,7 @@
 #include asm/udbg.h
 #include asm/time.h
 #include asm/uic.h
+#include asm/pci-bridge.h
 
 static struct of_device_id kilauea_of_bus[] = {
{ .compatible = ibm,plb4, },
@@ -45,6 +46,8 @@ static int __init kilauea_probe(void)
if (!of_flat_dt_is_compatible(root, amcc,kilauea))
return 0;
 
+   ppc_pci_flags = PPC_PCI_REASSIGN_ALL_RSRC;
+
return 1;
 }
 
Index: linux-work/arch/powerpc/platforms/40x/walnut.c
===
--- linux-work.orig/arch/powerpc/platforms/40x/walnut.c 2007-12-10 
16:51:42.0 +1100
+++ linux-work/arch/powerpc/platforms/40x/walnut.c  2007-12-10 
16:55:06.0 +1100
@@ -24,6 +24,7 @@
 #include asm/udbg.h
 #include asm/time.h
 #include asm/uic.h
+#include asm/pci-bridge.h
 
 static struct of_device_id walnut_of_bus[] = {
{ .compatible = ibm,plb3, },
@@ -51,6 +52,8 @@ static int __init walnut_probe(void)
if (!of_flat_dt_is_compatible(root, ibm,walnut))
return 0;
 
+   ppc_pci_flags = PPC_PCI_REASSIGN_ALL_RSRC;
+
return 1;
 }
 
Index: linux-work/arch/powerpc/platforms/44x/ebony.c
===
--- linux-work.orig/arch/powerpc/platforms/44x/ebony.c  2007-12-10 
16:51:42.0 +1100
+++ linux-work/arch/powerpc/platforms/44x/ebony.c   2007-12-10 
16:55:06.0 +1100
@@ -24,6 +24,7 @@
 #include asm/udbg.h
 #include asm/time.h
 #include asm/uic.h
+#include asm/pci-bridge.h
 
 #include 44x.h
 
@@ -55,6 +56,8 @@ static int __init ebony_probe(void)
if (!of_flat_dt_is_compatible(root, ibm,ebony))
return 0;
 
+   ppc_pci_flags = PPC_PCI_REASSIGN_ALL_RSRC;
+
return 1;
 }
 
Index: linux-work/arch/powerpc/platforms/44x/katmai.c
===
--- linux-work.orig/arch/powerpc/platforms/44x/katmai.c 2007-12-10 
16:51:42.0 +1100
+++ linux-work/arch/powerpc/platforms/44x/katmai.c  2007-12-10 
16:55:06.0 +1100
@@ -21,6 +21,7 @@
 #include asm/udbg.h
 #include asm/time.h
 #include asm/uic.h
+#include asm/pci-bridge.h
 
 #include 44x.h
 
@@ -49,6 +50,8 @@ static int __init katmai_probe(void)
if (!of_flat_dt_is_compatible(root, amcc,katmai))
return 0;
 
+   ppc_pci_flags = PPC_PCI_REASSIGN_ALL_RSRC;
+
return 1;
 }
 
Index: linux-work/arch/powerpc/platforms/44x/sequoia.c
===
--- linux-work.orig/arch/powerpc/platforms/44x/sequoia.c2007-12-10 
16:51:42.0 +1100
+++ 

[0/3] Add RapidIO support to powerpc architecture with memory mapping

2007-12-13 Thread Zhang Wei
Hi,

Those patches add RapidIO support to powerpc archiecture with
memory mapping as below:

[1/3] Copy the arch/ppc RapidIO support to arch/powerpc
[2/3] Make the arch/powerpc RapidIO support workable with of-device
  and add memory mapping support.
[3/3] Add the memory mapping support to rionet driver.

Best Regards,
Zhang Wei


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


[PATCH 3/3] Add memory mapping support to rionet driver.

2007-12-13 Thread Zhang Wei
Signed-off-by: Zhang Wei [EMAIL PROTECTED]
---
 drivers/net/Kconfig  |   10 ++
 drivers/net/rionet.c |  337 +-
 2 files changed, 345 insertions(+), 2 deletions(-)

diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index e8d69b0..b1129cc 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -2637,6 +2637,16 @@ config RIONET_RX_SIZE
depends on RIONET
default 128
 
+config RIONET_MEMMAP
+   bool Use memory map instead of message
+   depends on RIONET
+   default n
+
+config RIONET_DMA
+   bool Use DMA for memory mapping data transfer
+   depends on RIONET_MEMMAP  FSL_DMA
+   default y
+
 config FDDI
bool FDDI driver support
depends on (PCI || EISA || TC)
diff --git a/drivers/net/rionet.c b/drivers/net/rionet.c
index e7fd08a..53b53a8 100644
--- a/drivers/net/rionet.c
+++ b/drivers/net/rionet.c
@@ -1,6 +1,13 @@
 /*
  * rionet - Ethernet driver over RapidIO messaging services
  *
+ * Copyright (C) 2007 Freescale Semiconductor, Inc. All rights reserved.
+ * Author: Zhang Wei, [EMAIL PROTECTED], Jun 2007
+ *
+ * Changelog:
+ * Jun 2007 Zhang Wei [EMAIL PROTECTED]
+ * - Added the support to RapidIO memory driver. 2007.
+ *
  * Copyright 2005 MontaVista Software, Inc.
  * Matt Porter [EMAIL PROTECTED]
  *
@@ -8,6 +15,7 @@
  * 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/module.h
@@ -23,6 +31,7 @@
 #include linux/skbuff.h
 #include linux/crc32.h
 #include linux/ethtool.h
+#include linux/dmaengine.h
 
 #define DRV_NAMErionet
 #define DRV_VERSION 0.2
@@ -40,13 +49,47 @@ MODULE_LICENSE(GPL);
 NETIF_MSG_TX_ERR)
 
 #define RIONET_DOORBELL_JOIN   0x1000
+#ifdef CONFIG_RIONET_MEMMAP
+#define RIONET_DOORBELL_SEND   0x1001
+#define RIONET_DOORBELL_LEAVE  0x1002
+#else
 #define RIONET_DOORBELL_LEAVE  0x1001
+#endif
 
 #define RIONET_MAILBOX 0
 
 #define RIONET_TX_RING_SIZECONFIG_RIONET_TX_SIZE
 #define RIONET_RX_RING_SIZECONFIG_RIONET_RX_SIZE
 
+#define ERR(fmt, arg...) \
+   printk(KERN_ERR ERROR %s - %s:  fmt,  __FILE__, __FUNCTION__, ## arg)
+
+#ifdef CONFIG_RIONET_MEMMAP
+/* Definitions for rionet memory map driver */
+#define RIONET_DRVID   0x101
+#define RIONET_MAX_SK_DATA_SIZE0x1000
+#define RIONET_TX_RX_BUFF_SIZE (0x1000 * (128 + 128))
+#define RIONET_QUEUE_NEXT(x)   (((x)  127) ? ((x) + 1) : 0)
+#define RIONET_QUEUE_INC(x)(x = RIONET_QUEUE_NEXT(x))
+
+struct sk_data {
+   u8  data[0x1000];
+};
+
+#define RIONET_SKDATA_EN   0x8000
+struct rionet_tx_rx_buff {
+   volatile intenqueue;/* enqueue point */
+   volatile intdequeue;/* dequeue point */
+   u32 size[128];  /* size[i] is skdata[i] size
+* the most high bit [31] is
+* enable bit. The
+* max size is 4096.
+*/
+   u8  rev1[3576];
+   struct sk_data  skdata[128];/* all size are 0x1000 * 128 */
+};
+#endif /* CONFIG_RIONET_MEMMAP */
+
 static LIST_HEAD(rionet_peers);
 
 struct rionet_private {
@@ -60,6 +103,18 @@ struct rionet_private {
spinlock_t lock;
spinlock_t tx_lock;
u32 msg_enable;
+#ifdef CONFIG_RIONET_MEMMAP
+   struct rionet_tx_rx_buff *rxbuff;
+   struct rionet_tx_rx_buff __iomem *txbuff;
+   struct rio_mem *rxmem;
+   struct rio_mem *txmem;
+#ifdef CONFIG_RIONET_DMA
+   struct dma_chan *txdmachan;
+   struct dma_chan *rxdmachan;
+   struct dma_client rio_dma_client;
+   spinlock_t rio_dma_event_lock;
+#endif
+#endif
 };
 
 struct rionet_peer {
@@ -77,7 +132,7 @@ static int rionet_capable = 1;
  * could be made into a hash table to save memory depending
  * on system trade-offs.
  */
-static struct rio_dev *rionet_active[RIO_MAX_ROUTE_ENTRIES];
+static struct rio_dev **rionet_active;
 
 #define is_rionet_capable(pef, src_ops, dst_ops)   \
((pef  RIO_PEF_INB_MBOX) \
@@ -108,9 +163,11 @@ static int rionet_rx_clean(struct net_device *ndev)
 
rnet-rx_skb[i]-data = data;
skb_put(rnet-rx_skb[i], RIO_MAX_MSG_SIZE);
+   rnet-rx_skb[i]-dev = ndev;
rnet-rx_skb[i]-protocol =
eth_type_trans(rnet-rx_skb[i], ndev);
error = netif_rx(rnet-rx_skb[i]);
+   rnet-rx_skb[i] = NULL;
 
if (error == NET_RX_DROP) {
ndev-stats.rx_dropped++;
@@ -141,19 +198,96 @@ static void rionet_rx_fill(struct net_device *ndev, int 
end)
if (!rnet-rx_skb[i])

[PATCH 17/20] [POWERPC] Base support for 440SPe Katmai eval board

2007-12-13 Thread Benjamin Herrenschmidt
This adds base support for the Katmai board, including PCI-X and
PCI-Express (but no RTC, nvram, etc... yet).

Signed-off-by: Benjamin Herrenschmidt [EMAIL PROTECTED]
Acked-by: Stefan Roese [EMAIL PROTECTED]
---

As for Taishan, the bootwrapper code can be simplified. In fact,
we probably don't need to probe clocks  memsize off the chip and
just trust what uboot tells us.

 arch/powerpc/boot/Makefile|5 
 arch/powerpc/boot/cuboot-katmai.c |   56 ++
 arch/powerpc/boot/dts/katmai.dts  |  393 
 arch/powerpc/configs/katmai_defconfig |  789 ++
 arch/powerpc/platforms/44x/Kconfig|   13 
 arch/powerpc/platforms/44x/Makefile   |3 
 arch/powerpc/platforms/44x/katmai.c   |   63 ++
 7 files changed, 1320 insertions(+), 2 deletions(-)

--- linux-merge.orig/arch/powerpc/platforms/44x/Kconfig 2007-12-11 
17:06:53.0 +1100
+++ linux-merge/arch/powerpc/platforms/44x/Kconfig  2007-12-11 
17:06:55.0 +1100
@@ -31,6 +31,15 @@ config TAISHAN
  This option enables support for the AMCC PPC440GX Taishan
  evaluation board.
 
+config KATMAI
+   bool Katmai
+   depends on 44x
+   default n
+   select 440SPe
+   select PPC4xx_PCI_EXPRESS
+   help
+ This option enables support for the AMCC PPC440SPe evaluation board.
+
 #config LUAN
 #  bool Luan
 #  depends on 44x
@@ -75,6 +84,10 @@ config 440GX
 config 440SP
bool
 
+config 440SPe
+select IBM_NEW_EMAC_EMAC4
+   bool
+
 # 44x errata/workaround config symbols, selected by the CPU models above
 config IBM440EP_ERR42
bool
Index: linux-merge/arch/powerpc/platforms/44x/Makefile
===
--- linux-merge.orig/arch/powerpc/platforms/44x/Makefile2007-12-11 
17:06:53.0 +1100
+++ linux-merge/arch/powerpc/platforms/44x/Makefile 2007-12-11 
17:06:55.0 +1100
@@ -1,5 +1,6 @@
 obj-$(CONFIG_44x)  := misc_44x.o
 obj-$(CONFIG_EBONY)+= ebony.o
 obj-$(CONFIG_TAISHAN)  += taishan.o
-obj-$(CONFIG_BAMBOO) += bamboo.o
+obj-$(CONFIG_BAMBOO)   += bamboo.o
 obj-$(CONFIG_SEQUOIA)  += sequoia.o
+obj-$(CONFIG_KATMAI)   += katmai.o
Index: linux-merge/arch/powerpc/boot/dts/katmai.dts
===
--- /dev/null   1970-01-01 00:00:00.0 +
+++ linux-merge/arch/powerpc/boot/dts/katmai.dts2007-12-11 
17:06:55.0 +1100
@@ -0,0 +1,393 @@
+/*
+ * Device Tree Source for AMCC Katmai eval board
+ *
+ * Copyright (c) 2006, 2007 IBM Corp.
+ * Benjamin Herrenschmidt [EMAIL PROTECTED]
+ *
+ * Copyright (c) 2006, 2007 IBM Corp.
+ * Josh Boyer [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.
+ */
+
+/ {
+   #address-cells = 2;
+   #size-cells = 1;
+   model = amcc,katmai;
+   compatible = amcc,katmai;
+   dcr-parent = /cpus/PowerPC,[EMAIL PROTECTED];
+
+   cpus {
+   #address-cells = 1;
+   #size-cells = 0;
+
+   PowerPC,[EMAIL PROTECTED] {
+   device_type = cpu;
+   reg = 0;
+   clock-frequency = 0; /* Filled in by zImage */
+   timebase-frequency = 0; /* Filled in by zImage */
+   i-cache-line-size = 20;
+   d-cache-line-size = 20;
+   i-cache-size = 2;
+   d-cache-size = 2;
+   dcr-controller;
+   dcr-access-method = native;
+   };
+   };
+
+   memory {
+   device_type = memory;
+   reg = 0 0 0; /* Filled in by zImage */
+   };
+
+   UIC0: interrupt-controller0 {
+   compatible = ibm,uic-440spe,ibm,uic;
+   interrupt-controller;
+   cell-index = 0;
+   dcr-reg = 0c0 009;
+   #address-cells = 0;
+   #size-cells = 0;
+   #interrupt-cells = 2;
+   };
+
+   UIC1: interrupt-controller1 {
+   compatible = ibm,uic-440spe,ibm,uic;
+   interrupt-controller;
+   cell-index = 1;
+   dcr-reg = 0d0 009;
+   #address-cells = 0;
+   #size-cells = 0;
+   #interrupt-cells = 2;
+   interrupts = 1e 4 1f 4; /* cascade */
+   interrupt-parent = UIC0;
+   };
+
+   UIC2: interrupt-controller2 {
+   compatible = ibm,uic-440spe,ibm,uic;
+   interrupt-controller;
+   cell-index = 2;
+   dcr-reg = 0e0 009;
+   #address-cells = 0;
+   #size-cells = 0;
+   #interrupt-cells = 2;
+   interrupts = a 4 b 4; /* cascade */
+   

[PATCH 20/20] [POWERPC] 4xx: Add 440SPe revA runtime detection to PCIe

2007-12-13 Thread Benjamin Herrenschmidt
From: Stefan Roese [EMAIL PROTECTED]

This patch adds runtime detection of the 440SPe revision A chips. These
chips are equipped with a slighly different PCIe core and need special/
different initialization. The compatible node is changed to
plb-pciex-440spe (A and B dropped). This is needed for boards that
can be equipped with both PPC revisions like the AMCC Yucca.

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

 arch/powerpc/boot/dts/katmai.dts |6 +++---
 arch/powerpc/sysdev/ppc4xx_pci.c |   25 +
 2 files changed, 20 insertions(+), 11 deletions(-)

--- linux-merge.orig/arch/powerpc/boot/dts/katmai.dts   2007-12-11 
17:11:37.0 +1100
+++ linux-merge/arch/powerpc/boot/dts/katmai.dts2007-12-11 
17:11:37.0 +1100
@@ -268,7 +268,7 @@
#interrupt-cells = 1;
#size-cells = 2;
#address-cells = 3;
-   compatible = ibm,plb-pciex-440speB, ibm,plb-pciex;
+   compatible = ibm,plb-pciex-440spe, ibm,plb-pciex;
primary;
port = 0; /* port number */
reg = d  2000  /* Config space access 
*/
@@ -309,7 +309,7 @@
#interrupt-cells = 1;
#size-cells = 2;
#address-cells = 3;
-   compatible = ibm,plb-pciex-440speB, ibm,plb-pciex;
+   compatible = ibm,plb-pciex-440spe, ibm,plb-pciex;
primary;
port = 1; /* port number */
reg = d 2000 2000  /* Config space access 
*/
@@ -350,7 +350,7 @@
#interrupt-cells = 1;
#size-cells = 2;
#address-cells = 3;
-   compatible = ibm,plb-pciex-440speB, ibm,plb-pciex;
+   compatible = ibm,plb-pciex-440spe, ibm,plb-pciex;
primary;
port = 2; /* port number */
reg = d 4000 2000  /* Config space access 
*/
Index: linux-merge/arch/powerpc/sysdev/ppc4xx_pci.c
===
--- linux-merge.orig/arch/powerpc/sysdev/ppc4xx_pci.c   2007-12-11 
17:11:37.0 +1100
+++ linux-merge/arch/powerpc/sysdev/ppc4xx_pci.c2007-12-11 
17:11:37.0 +1100
@@ -49,6 +49,15 @@ extern unsigned long total_memory;
 #define RES_TO_U32_HIGH(val)   (0)
 #endif
 
+static inline int ppc440spe_revA(void)
+{
+   /* Catch both 440SPe variants, with and without RAID6 support */
+if ((mfspr(SPRN_PVR)  0xffef) == 0x53421890)
+return 1;
+else
+return 0;
+}
+
 static void fixup_ppc4xx_pci_bridge(struct pci_dev *dev)
 {
struct pci_controller *hose;
@@ -516,8 +525,7 @@ static void __init ppc4xx_probe_pcix_bri
  *
  * We support 3 parts currently based on the compatible property:
  *
- * ibm,plb-pciex-440speA
- * ibm,plb-pciex-440speB
+ * ibm,plb-pciex-440spe
  * ibm,plb-pciex-405ex
  *
  * Anything else will be rejected for now as they are all subtly
@@ -688,7 +696,7 @@ static int ppc440spe_pciex_init_port_hw(
 
mtdcri(SDR0, port-sdr_base + PESDRn_DLPSET, val);
mtdcri(SDR0, port-sdr_base + PESDRn_UTLSET1, 0x2022);
-   if (of_device_is_compatible(port-node, ibm,plb-pciex-440speA))
+   if (ppc440spe_revA())
mtdcri(SDR0, port-sdr_base + PESDRn_UTLSET2, 0x1100);
mtdcri(SDR0, port-sdr_base + PESDRn_440SPE_HSSL0SET1, 0x3500);
mtdcri(SDR0, port-sdr_base + PESDRn_440SPE_HSSL1SET1, 0x3500);
@@ -767,7 +775,6 @@ static struct ppc4xx_pciex_hwops ppc440s
.setup_utl  = ppc440speB_pciex_init_utl,
 };
 
-
 #endif /* CONFIG_44x */
 
 #ifdef CONFIG_40x
@@ -881,10 +888,12 @@ static int __init ppc4xx_pciex_check_cor
return 0;
 
 #ifdef CONFIG_44x
-   if (of_device_is_compatible(np, ibm,plb-pciex-440speA))
-   ppc4xx_pciex_hwops = ppc440speA_pcie_hwops;
-   else if (of_device_is_compatible(np, ibm,plb-pciex-440speB))
-   ppc4xx_pciex_hwops = ppc440speB_pcie_hwops;
+   if (of_device_is_compatible(np, ibm,plb-pciex-440spe)) {
+   if (ppc440spe_revA())
+   ppc4xx_pciex_hwops = ppc440speA_pcie_hwops;
+   else
+   ppc4xx_pciex_hwops = ppc440speB_pcie_hwops;
+   }
 #endif /* CONFIG_44x*/
 #ifdef CONFIG_40x
if (of_device_is_compatible(np, ibm,plb-pciex-405ex))
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH 1/3] Move arch/ppc/syslib/ppc85xx_rio.c to arch/powerpc/sysdev/fsl_rio.c

2007-12-13 Thread Zhang Wei
Signed-off-by: Zhang Wei [EMAIL PROTECTED]
---
 arch/powerpc/sysdev/fsl_rio.c |  932 +
 1 files changed, 932 insertions(+), 0 deletions(-)
 create mode 100644 arch/powerpc/sysdev/fsl_rio.c

diff --git a/arch/powerpc/sysdev/fsl_rio.c b/arch/powerpc/sysdev/fsl_rio.c
new file mode 100644
index 000..af2425e
--- /dev/null
+++ b/arch/powerpc/sysdev/fsl_rio.c
@@ -0,0 +1,932 @@
+/*
+ * MPC85xx RapidIO support
+ *
+ * Copyright 2005 MontaVista Software, Inc.
+ * Matt Porter [EMAIL PROTECTED]
+ *
+ * This program is free software; you can redistribute  it and/or modify it
+ * under  the terms of  the GNU General  Public License as published by the
+ * Free Software Foundation;  either version 2 of the  License, or (at your
+ * option) any later version.
+ */
+
+#include linux/init.h
+#include linux/module.h
+#include linux/types.h
+#include linux/dma-mapping.h
+#include linux/interrupt.h
+#include linux/rio.h
+#include linux/rio_drv.h
+
+#include asm/io.h
+
+#define RIO_REGS_BASE  (CCSRBAR + 0xc)
+#define RIO_ATMU_REGS_OFFSET   0x10c00
+#define RIO_MSG_REGS_OFFSET0x11000
+#define RIO_MAINT_WIN_SIZE 0x40
+#define RIO_DBELL_WIN_SIZE 0x1000
+
+#define RIO_MSG_OMR_MUI0x0002
+#define RIO_MSG_OSR_TE 0x0080
+#define RIO_MSG_OSR_QOI0x0020
+#define RIO_MSG_OSR_QFI0x0010
+#define RIO_MSG_OSR_MUB0x0004
+#define RIO_MSG_OSR_EOMI   0x0002
+#define RIO_MSG_OSR_QEI0x0001
+
+#define RIO_MSG_IMR_MI 0x0002
+#define RIO_MSG_ISR_TE 0x0080
+#define RIO_MSG_ISR_QFI0x0010
+#define RIO_MSG_ISR_DIQI   0x0001
+
+#define RIO_MSG_DESC_SIZE  32
+#define RIO_MSG_BUFFER_SIZE4096
+#define RIO_MIN_TX_RING_SIZE   2
+#define RIO_MAX_TX_RING_SIZE   2048
+#define RIO_MIN_RX_RING_SIZE   2
+#define RIO_MAX_RX_RING_SIZE   2048
+
+#define DOORBELL_DMR_DI0x0002
+#define DOORBELL_DSR_TE0x0080
+#define DOORBELL_DSR_QFI   0x0010
+#define DOORBELL_DSR_DIQI  0x0001
+#define DOORBELL_TID_OFFSET0x03
+#define DOORBELL_SID_OFFSET0x05
+#define DOORBELL_INFO_OFFSET   0x06
+
+#define DOORBELL_MESSAGE_SIZE  0x08
+#define DBELL_SID(x)   (*(u8 *)(x + DOORBELL_SID_OFFSET))
+#define DBELL_TID(x)   (*(u8 *)(x + DOORBELL_TID_OFFSET))
+#define DBELL_INF(x)   (*(u16 *)(x + DOORBELL_INFO_OFFSET))
+
+struct rio_atmu_regs {
+   u32 rowtar;
+   u32 pad1;
+   u32 rowbar;
+   u32 pad2;
+   u32 rowar;
+   u32 pad3[3];
+};
+
+struct rio_msg_regs {
+   u32 omr;
+   u32 osr;
+   u32 pad1;
+   u32 odqdpar;
+   u32 pad2;
+   u32 osar;
+   u32 odpr;
+   u32 odatr;
+   u32 odcr;
+   u32 pad3;
+   u32 odqepar;
+   u32 pad4[13];
+   u32 imr;
+   u32 isr;
+   u32 pad5;
+   u32 ifqdpar;
+   u32 pad6;
+   u32 ifqepar;
+   u32 pad7[250];
+   u32 dmr;
+   u32 dsr;
+   u32 pad8;
+   u32 dqdpar;
+   u32 pad9;
+   u32 dqepar;
+   u32 pad10[26];
+   u32 pwmr;
+   u32 pwsr;
+   u32 pad11;
+   u32 pwqbar;
+};
+
+struct rio_tx_desc {
+   u32 res1;
+   u32 saddr;
+   u32 dport;
+   u32 dattr;
+   u32 res2;
+   u32 res3;
+   u32 dwcnt;
+   u32 res4;
+};
+
+static u32 regs_win;
+static struct rio_atmu_regs *atmu_regs;
+static struct rio_atmu_regs *maint_atmu_regs;
+static struct rio_atmu_regs *dbell_atmu_regs;
+static u32 dbell_win;
+static u32 maint_win;
+static struct rio_msg_regs *msg_regs;
+
+static struct rio_dbell_ring {
+   void *virt;
+   dma_addr_t phys;
+} dbell_ring;
+
+static struct rio_msg_tx_ring {
+   void *virt;
+   dma_addr_t phys;
+   void *virt_buffer[RIO_MAX_TX_RING_SIZE];
+   dma_addr_t phys_buffer[RIO_MAX_TX_RING_SIZE];
+   int tx_slot;
+   int size;
+   void *dev_id;
+} msg_tx_ring;
+
+static struct rio_msg_rx_ring {
+   void *virt;
+   dma_addr_t phys;
+   void *virt_buffer[RIO_MAX_RX_RING_SIZE];
+   int rx_slot;
+   int size;
+   void *dev_id;
+} msg_rx_ring;
+
+/**
+ * mpc85xx_rio_doorbell_send - Send a MPC85xx doorbell message
+ * @index: ID of RapidIO interface
+ * @destid: Destination ID of target device
+ * @data: 16-bit info field of RapidIO doorbell message
+ *
+ * Sends a MPC85xx doorbell message. Returns %0 on success or
+ * %-EINVAL on failure.
+ */
+static int mpc85xx_rio_doorbell_send(int index, u16 destid, u16 data)
+{
+   pr_debug(mpc85xx_doorbell_send: index %d destid %4.4x data %4.4x\n,
+index, destid, data);
+   out_be32((void *)dbell_atmu_regs-rowtar, destid  22);
+   out_be16((void *)(dbell_win), data);
+
+   return 0;
+}
+
+/**
+ * mpc85xx_local_config_read - Generate a MPC85xx local config space read
+ * @index: ID of RapdiIO interface
+ * @offset: Offset into 

Re: [PATCH 19/20] [POWERPC] pci32: 4xx embedded platforms want to reassign all PCI resources

2007-12-13 Thread Stefan Roese
On Thursday 13 December 2007, Benjamin Herrenschmidt wrote:
 This makes 4xx embedded platforms re-assign all PCI resources as we
 pretty much never care about what the various firmwares have done on
 these, it's generally not compatible with the way the kernel will map
 the bridges.

 We still need to also enable bus renumbering on some of them, but I
 will do that from a separate patch after I've fixed 4xx PCIe to handle
 all bus numbers.

I just applied this series on top of Paulus's for-2.6.25 branch and I
get the following error:

/home/stefan/git/linux-2.6/paulus-powerpc/arch/powerpc/platforms/40x/kilauea.c: 
In function 'kilauea_probe':
/home/stefan/git/linux-2.6/paulus-powerpc/arch/powerpc/platforms/40x/kilauea.c:49:
 error: 'ppc_pci_flags' undeclared (first use in this function)
/home/stefan/git/linux-2.6/paulus-powerpc/arch/powerpc/platforms/40x/kilauea.c:49:
 error: (Each undeclared identifier is reported only once
/home/stefan/git/linux-2.6/paulus-powerpc/arch/powerpc/platforms/40x/kilauea.c:49:
 error: for each function it appears in.)
/home/stefan/git/linux-2.6/paulus-powerpc/arch/powerpc/platforms/40x/kilauea.c:49:
 error: 'PPC_PCI_REASSIGN_ALL_RSRC' undeclared (first use in this function)
make[3]: *** [arch/powerpc/platforms/40x/kilauea.o] Error 1

Seems like the patch:

powerpc: pci32: Add flags modifying the PCI code behaviour

This adds to the 32 bits PCI code some flags, replacing the old
pci_assign_all_busses global, that allow to control various
aspects of the PCI probing, such as whether to re-assign all
resources or not, or to not try to assign anything at all.

This also adds the flag x86 already has to avoid ISA alignment
on bridges that don't have ISA forwarding enabled (no legacy
devices on the top level bus) and sets it for PowerMacs.

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


is missing.

Thanks.

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


[PATCH 2/2] celleb: split machine definition

2007-12-13 Thread Ishizaki Kou
This patch splits machine definition for celleb into two definitoins,
one is for celleb_beat, and another is for celleb_native. Though this
patch looks complex because of sorting some functions, there are no
more semantic changes than that for the splitting.

Signed-off-by: Kou Ishizaki [EMAIL PROTECTED]
---

Here is the previous discussion:
 http://ozlabs.org/pipermail/linuxppc-dev/2007-December/047436.html


Index: linux-powerpc-git/arch/powerpc/platforms/cell/iommu.c
===
--- linux-powerpc-git.orig/arch/powerpc/platforms/cell/iommu.c
+++ linux-powerpc-git/arch/powerpc/platforms/cell/iommu.c
@@ -700,8 +700,8 @@ static int __init cell_iommu_init(void)
 {
struct device_node *np;
 
-   if ((!machine_is(cell)  !machine_is(celleb)) ||
-   firmware_has_feature(FW_FEATURE_LPAR))
+   if (!machine_is(cell) 
+   !machine_is(celleb_native))
return -ENODEV;
 
/* If IOMMU is disabled or we have little enough RAM to not need
Index: linux-powerpc-git/arch/powerpc/platforms/celleb/scc_uhc.c
===
--- linux-powerpc-git.orig/arch/powerpc/platforms/celleb/scc_uhc.c
+++ linux-powerpc-git/arch/powerpc/platforms/celleb/scc_uhc.c
@@ -47,7 +47,8 @@ static void enable_scc_uhc(struct pci_de
u32 val = 0;
int i;
 
-   if (!machine_is(celleb))
+   if (!machine_is(celleb_beat) 
+   !machine_is(celleb_native))
return;
 
uhc_base = ioremap(pci_resource_start(dev, 0),
Index: linux-powerpc-git/arch/powerpc/platforms/celleb/setup.c
===
--- linux-powerpc-git.orig/arch/powerpc/platforms/celleb/setup.c
+++ linux-powerpc-git/arch/powerpc/platforms/celleb/setup.c
@@ -93,30 +93,43 @@ static void celleb_progress(char *s, uns
printk(*** %04x : %s\n, hex, s ? s : );
 }
 
-static void __init celleb_init_IRQ_native(void)
+static void __init celleb_setup_arch_common(void)
 {
-   iic_init_IRQ();
-   spider_init_IRQ();
+   /* init to some ~sane value until calibrate_delay() runs */
+   loops_per_jiffy = 5000;
+
+#ifdef CONFIG_DUMMY_CONSOLE
+   conswitchp = dummy_con;
+#endif
 }
 
-static void __init celleb_setup_arch_beat(void)
+static struct of_device_id celleb_bus_ids[] __initdata = {
+   { .type = scc, },
+   { .type = ioif, },/* old style */
+   {},
+};
+
+static int __init celleb_publish_devices(void)
 {
-   ppc_md.restart  = beat_restart;
-   ppc_md.power_off= beat_power_off;
-   ppc_md.halt = beat_halt;
-   ppc_md.get_rtc_time = beat_get_rtc_time;
-   ppc_md.set_rtc_time = beat_set_rtc_time;
-   ppc_md.power_save   = beat_power_save;
-   ppc_md.nvram_size   = beat_nvram_get_size;
-   ppc_md.nvram_read   = beat_nvram_read;
-   ppc_md.nvram_write  = beat_nvram_write;
-   ppc_md.set_dabr = beat_set_xdabr;
-   ppc_md.init_IRQ = beatic_init_IRQ;
-   ppc_md.get_irq  = beatic_get_irq;
-#ifdef CONFIG_KEXEC
-   ppc_md.kexec_cpu_down   = beat_kexec_cpu_down;
-#endif
+   if (!machine_is(celleb_beat) 
+   !machine_is(celleb_native))
+   return -ENODEV;
+
+   /* Publish OF platform devices for southbridge IOs */
+   of_platform_bus_probe(NULL, celleb_bus_ids, NULL);
 
+   celleb_pci_workaround_init();
+
+   return 0;
+}
+device_initcall(celleb_publish_devices);
+
+
+/*
+ * functions for Celleb-Beat
+ */
+static void __init celleb_setup_arch_beat(void)
+{
 #ifdef CONFIG_SPU_BASE
spu_priv1_ops   = spu_priv1_beat_ops;
spu_management_ops  = spu_management_of_ops;
@@ -125,18 +138,36 @@ static void __init celleb_setup_arch_bea
 #ifdef CONFIG_SMP
smp_init_celleb();
 #endif
+
+   celleb_setup_arch_common();
 }
 
-static void __init celleb_setup_arch_native(void)
+static int __init celleb_probe_beat(void)
 {
-   ppc_md.restart  = rtas_restart;
-   ppc_md.power_off= rtas_power_off;
-   ppc_md.halt = rtas_halt;
-   ppc_md.get_boot_time= rtas_get_boot_time;
-   ppc_md.get_rtc_time = rtas_get_rtc_time;
-   ppc_md.set_rtc_time = rtas_set_rtc_time;
-   ppc_md.init_IRQ = celleb_init_IRQ_native;
+   unsigned long root = of_get_flat_dt_root();
+
+   if (!of_flat_dt_is_compatible(root, Beat))
+   return 0;
+
+   powerpc_firmware_features |= FW_FEATURE_CELLEB_ALWAYS
+   | FW_FEATURE_BEAT | FW_FEATURE_LPAR;
+   hpte_init_beat_v3();
+
+   return 1;
+}
 
+
+/*
+ * functions for Celleb-native
+ */
+static void __init celleb_init_IRQ_native(void)
+{
+   iic_init_IRQ();
+   spider_init_IRQ();
+}
+
+static void __init celleb_setup_arch_native(void)
+{
 #ifdef CONFIG_SPU_BASE
spu_priv1_ops   = 

[PATCH 1/2] cleanup calling mmio_nvram_init

2007-12-13 Thread Ishizaki Kou
This patch adds conditional initialization for mmio_nvram_init().

Signed-off-by: Kou Ishizaki [EMAIL PROTECTED]
---

Here is the previous discussion:
 http://ozlabs.org/pipermail/linuxppc-dev/2007-December/047435.html


Index: linux-powerpc-git/arch/powerpc/platforms/cell/setup.c
===
--- linux-powerpc-git.orig/arch/powerpc/platforms/cell/setup.c
+++ linux-powerpc-git/arch/powerpc/platforms/cell/setup.c
@@ -179,9 +179,7 @@ static void __init cell_setup_arch(void)
conswitchp = dummy_con;
 #endif
 
-#ifdef CONFIG_MMIO_NVRAM
mmio_nvram_init();
-#endif
 }
 
 static int __init cell_probe(void)
Index: linux-powerpc-git/include/asm-powerpc/nvram.h
===
--- linux-powerpc-git.orig/include/asm-powerpc/nvram.h
+++ linux-powerpc-git/include/asm-powerpc/nvram.h
@@ -10,6 +10,8 @@
 #ifndef _ASM_POWERPC_NVRAM_H
 #define _ASM_POWERPC_NVRAM_H
 
+#include linux/errno.h
+
 #define NVRW_CNT 0x20
 #define NVRAM_HEADER_LEN 16 /* sizeof(struct nvram_header) */
 #define NVRAM_BLOCK_LEN 16
@@ -71,7 +73,16 @@ extern int nvram_clear_error_log(void);
 extern struct nvram_partition *nvram_find_partition(int sig, const char *name);
 
 extern int pSeries_nvram_init(void);
+
+#ifdef CONFIG_MMIO_NVRAM
 extern int mmio_nvram_init(void);
+#else
+static inline int mmio_nvram_init(void)
+{
+   return -ENODEV;
+}
+#endif
+
 #endif /* __KERNEL__ */
 
 /* PowerMac specific nvram stuffs */
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH 2/2] kdump shutdown hook support

2007-12-13 Thread Michael Neuling
This adds hooks into the default_machine_crash_shutdown so drivers can
register a function to be run in the first kernel before we hand off
to the second kernel.  This should only be used in exceptional
circumstances, like where the device can't be reset in the second
kernel alone (as is the case with eHEA).  To emphasize this, the
number of handles allowed to be registered is currently #def to 1.

This uses the setjmp/longjmp code to call out to the registered hooks,
so any bogus exceptions we encounter will hopefully be recoverable.  

Tested with bogus data and instruction exceptions.

Signed-off-by: Michael Neuling [EMAIL PROTECTED]
---

 arch/powerpc/kernel/crash.c |  102 +---
 include/asm-powerpc/kexec.h |3 +
 2 files changed, 100 insertions(+), 5 deletions(-)

Index: clone3/arch/powerpc/kernel/crash.c
===
--- clone3.orig/arch/powerpc/kernel/crash.c
+++ clone3/arch/powerpc/kernel/crash.c
@@ -32,6 +32,8 @@
 #include asm/lmb.h
 #include asm/firmware.h
 #include asm/smp.h
+#include asm/system.h
+#include asm/setjmp.h
 
 #ifdef DEBUG
 #include asm/udbg.h
@@ -45,6 +47,11 @@ int crashing_cpu = -1;
 static cpumask_t cpus_in_crash = CPU_MASK_NONE;
 cpumask_t cpus_in_sr = CPU_MASK_NONE;
 
+#define CRASH_HANDLER_MAX 1
+/* NULL terminated list of shutdown handles */
+static crash_shutdown_t crash_shutdown_handles[CRASH_HANDLER_MAX+1];
+static DEFINE_SPINLOCK(crash_handlers_lock);
+
 #ifdef CONFIG_SMP
 static atomic_t enter_on_soft_reset = ATOMIC_INIT(0);
 
@@ -285,9 +292,72 @@ static inline void crash_kexec_stop_spus
 }
 #endif /* CONFIG_SPU_BASE */
 
+/*
+ * Register a function to be called on shutdown.  Only use this if you
+ * can't reset your device in the second kernel.
+ */
+int crash_shutdown_register(crash_shutdown_t handler)
+{
+   unsigned int i, rc;
+
+   spin_lock(crash_handlers_lock);
+   for (i = 0 ; i  CRASH_HANDLER_MAX; i++)
+   if (!crash_shutdown_handles[i]) {
+   /* Insert handle at first empty entry */
+   crash_shutdown_handles[i] = handler;
+   rc = 0;
+   break;
+   }
+
+   if (i == CRASH_HANDLER_MAX) {
+   printk(KERN_ERR Crash shutdown handles full, 
+  not registered.\n);
+   rc = 1;
+   }
+
+   spin_unlock(crash_handlers_lock);
+   return rc;
+}
+EXPORT_SYMBOL(crash_shutdown_register);
+
+int crash_shutdown_unregister(crash_shutdown_t handler)
+{
+   unsigned int i, rc;
+
+   spin_lock(crash_handlers_lock);
+   for (i = 0 ; i  CRASH_HANDLER_MAX; i++)
+   if (crash_shutdown_handles[i] == handler)
+   break;
+
+   if (i == CRASH_HANDLER_MAX) {
+   printk(KERN_ERR Crash shutdown handle not found\n);
+   rc = 1;
+   } else {
+   /* Shift handles down */
+   for (; crash_shutdown_handles[i]; i++)
+   crash_shutdown_handles[i] =
+   crash_shutdown_handles[i+1];
+   rc = 0;
+   }
+
+   spin_unlock(crash_handlers_lock);
+   return rc;
+}
+EXPORT_SYMBOL(crash_shutdown_unregister);
+
+static unsigned long crash_shutdown_buf[SETJMP_BUF_LEN];
+
+static int handle_fault(struct pt_regs *regs)
+{
+   longjmp(crash_shutdown_buf, 1);
+   return 0;
+}
+
 void default_machine_crash_shutdown(struct pt_regs *regs)
 {
-   unsigned int irq;
+   unsigned int i;
+   int (*old_handler)(struct pt_regs *regs);
+
 
/*
 * This function is only called after the system
@@ -301,15 +371,37 @@ void default_machine_crash_shutdown(stru
 */
hard_irq_disable();
 
-   for_each_irq(irq) {
-   struct irq_desc *desc = irq_desc + irq;
+   for_each_irq(i) {
+   struct irq_desc *desc = irq_desc + i;
 
if (desc-status  IRQ_INPROGRESS)
-   desc-chip-eoi(irq);
+   desc-chip-eoi(i);
 
if (!(desc-status  IRQ_DISABLED))
-   desc-chip-disable(irq);
+   desc-chip-disable(i);
+   }
+
+   /*
+* Call registered shutdown routines savely.  Swap out
+* __debugger_fault_handler, and replace on exit.
+*/
+   old_handler = __debugger_fault_handler;
+   __debugger_fault_handler = handle_fault;
+   for (i = 0; crash_shutdown_handles[i]; i++) {
+   if (setjmp(crash_shutdown_buf) == 0) {
+   /*
+* Insert syncs and delay to ensure
+* instructions in the dangerous region don't
+* leak away from this protected region.
+*/
+   asm volatile(sync; isync);
+   /* dangerous region */
+   

[PATCH 0/6] PS3: gelic: gelic updates for 2.6.25

2007-12-13 Thread Masakazu Mokuno
Hi,

Here is a set of updates for PS3 gelic network driver.
This patch set requires other patches which were already submitted by
Geert (http://marc.info/?l=linux-kernelm=119626095605487).

[1] PS3: gelic: Fix the wrong dev_id passed
[2] PS3: gelic: Add endianness macros
[3] PS3: gelic: Code cleanup
[4] PS3: gelic: Remove duplicated ethtool handers
[5] PS3: gelic: Add support for port link status
[6] PS3: gelic: Add support for dual network interface

This is also a set of prerequisite for new wireless driver for PS3, which
I'll submit later. 

Thanks for reviewing!

-- 
Masakazu MOKUNO

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


Re: [PATCH 19/20] [POWERPC] pci32: 4xx embedded platforms want to reassign all PCI resources

2007-12-13 Thread Benjamin Herrenschmidt

On Thu, 2007-12-13 at 10:42 +0100, Stefan Roese wrote:
 On Thursday 13 December 2007, Benjamin Herrenschmidt wrote:
  This makes 4xx embedded platforms re-assign all PCI resources as we
  pretty much never care about what the various firmwares have done on
  these, it's generally not compatible with the way the kernel will map
  the bridges.
 
  We still need to also enable bus renumbering on some of them, but I
  will do that from a separate patch after I've fixed 4xx PCIe to handle
  all bus numbers.
 
 I just applied this series on top of Paulus's for-2.6.25 branch and I
 get the following error:
 
 /home/stefan/git/linux-2.6/paulus-powerpc/arch/powerpc/platforms/40x/kilauea.c:
  In function 'kilauea_probe':
 /home/stefan/git/linux-2.6/paulus-powerpc/arch/powerpc/platforms/40x/kilauea.c:49:
  error: 'ppc_pci_flags' undeclared (first use in this function)
 /home/stefan/git/linux-2.6/paulus-powerpc/arch/powerpc/platforms/40x/kilauea.c:49:
  error: (Each undeclared identifier is reported only once
 /home/stefan/git/linux-2.6/paulus-powerpc/arch/powerpc/platforms/40x/kilauea.c:49:
  error: for each function it appears in.)
 /home/stefan/git/linux-2.6/paulus-powerpc/arch/powerpc/platforms/40x/kilauea.c:49:
  error: 'PPC_PCI_REASSIGN_ALL_RSRC' undeclared (first use in this function)
 make[3]: *** [arch/powerpc/platforms/40x/kilauea.o] Error 1

As discussed on IRC, that's just because you are missing the PCI
series of patches :-)

Cheers,
Ben.


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


Re: [RFC] ehea: kdump support using new shutdown hook

2007-12-13 Thread Subrata Modak
Do you think we can improve upon our own LTP-KDUMP test cases housed
here:
http://ltp.cvs.sourceforge.net/ltp/ltp/testcases/kdump/,

because of your changes below:

--Subrata

On Wed, 2007-12-12 at 17:53 +0100, Thomas Klein wrote:
 This patch adds kdump support using the new PPC crash shutdown hook to the
 ehea driver. The driver now keeps a list of firmware handles which have to
 be freed in case of a crash. The crash handler does the minimum required: it
 frees the firmware resource handles plus broadcast/multicast registrations.
 
 Please comment.
 
 Shutdown hook patches:
   http://ozlabs.org/pipermail/linuxppc-dev/2007-December/048058.html
   http://ozlabs.org/pipermail/linuxppc-dev/2007-December/048059.html
 
 
 Signed-off-by: Thomas Klein [EMAIL PROTECTED]
 
 ---
 diff -Nurp -X dontdiff linux-2.6.24-rc5/drivers/net/ehea/ehea.h 
 patched_kernel/drivers/net/ehea/ehea.h
 --- linux-2.6.24-rc5/drivers/net/ehea/ehea.h  2007-12-11 04:48:43.0 
 +0100
 +++ patched_kernel/drivers/net/ehea/ehea.h2007-12-12 17:30:53.0 
 +0100
 @@ -40,7 +40,7 @@
  #include asm/io.h
 
  #define DRV_NAME ehea
 -#define DRV_VERSION  EHEA_0083
 +#define DRV_VERSION  EHEA_0084
 
  /* eHEA capability flags */
  #define DLPAR_PORT_ADD_REM 1
 @@ -386,6 +386,7 @@ struct ehea_port_res {
 
 
  #define EHEA_MAX_PORTS 16
 +#define EHEA_MAX_RES_HANDLES (100 * EHEA_MAX_PORTS + 10)
  struct ehea_adapter {
   u64 handle;
   struct of_device *ofdev;
 @@ -397,6 +398,7 @@ struct ehea_adapter {
   u64 max_mc_mac;/* max number of multicast mac addresses */
   int active_ports;
   struct list_head list;
 + u64 res_handles[EHEA_MAX_RES_HANDLES];
  };
 
 
 diff -Nurp -X dontdiff linux-2.6.24-rc5/drivers/net/ehea/ehea_main.c 
 patched_kernel/drivers/net/ehea/ehea_main.c
 --- linux-2.6.24-rc5/drivers/net/ehea/ehea_main.c 2007-12-11 
 04:48:43.0 +0100
 +++ patched_kernel/drivers/net/ehea/ehea_main.c   2007-12-12 
 17:30:53.0 +0100
 @@ -35,6 +35,7 @@
  #include linux/if_ether.h
  #include linux/notifier.h
  #include linux/reboot.h
 +#include asm-powerpc/kexec.h
 
  #include net/ip.h
 
 @@ -2256,6 +2257,33 @@ static int ehea_clean_all_portres(struct
   return ret;
  }
 
 +static void ehea_update_adapter_handles(struct ehea_adapter *adapter)
 +{
 + int i, k;
 + int j = 0;
 +
 + memset(adapter-res_handles, sizeof(adapter-res_handles), 0);
 +
 + for (k = 0; k  EHEA_MAX_PORTS; k++) {
 + struct ehea_port *port = adapter-port[k];
 +
 + if (!port || (port-state != EHEA_PORT_UP))
 + continue;
 +
 + for(i = 0; i  port-num_def_qps + port-num_add_tx_qps; i++) {
 + struct ehea_port_res *pr = port-port_res[i];
 +
 + adapter-res_handles[j++] = pr-qp-fw_handle;
 + adapter-res_handles[j++] = pr-send_cq-fw_handle;
 + adapter-res_handles[j++] = pr-recv_cq-fw_handle;
 + adapter-res_handles[j++] = pr-eq-fw_handle;
 + adapter-res_handles[j++] = pr-send_mr.handle;
 + adapter-res_handles[j++] = pr-recv_mr.handle;
 + }
 + adapter-res_handles[j++] = port-qp_eq-fw_handle;
 + }
 +}
 +
  static void ehea_remove_adapter_mr(struct ehea_adapter *adapter)
  {
   if (adapter-active_ports)
 @@ -2318,6 +2346,7 @@ static int ehea_up(struct net_device *de
 
   ret = 0;
   port-state = EHEA_PORT_UP;
 + ehea_update_adapter_handles(port-adapter);
   goto out;
 
  out_free_irqs:
 @@ -2387,6 +2416,8 @@ static int ehea_down(struct net_device *
   ehea_info(Failed freeing resources for %s. ret=%i,
 dev-name, ret);
 
 + ehea_update_adapter_handles(port-adapter);
 +
   return ret;
  }
 
 @@ -3302,6 +,71 @@ static int __devexit ehea_remove(struct 
   return 0;
  }
 
 +void ehea_crash_deregister(void)
 +{
 + struct ehea_adapter *adapter;
 + int i;
 + u64 hret;
 + u8 reg_type;
 +
 + list_for_each_entry(adapter, adapter_list, list) {
 + for (i = 0; i  EHEA_MAX_PORTS; i++) {
 + struct ehea_port *port = adapter-port[i];
 + if (port-state == EHEA_PORT_UP) {
 + struct ehea_mc_list *mc_entry = port-mc_list;
 + struct list_head *pos;
 + struct list_head *temp;
 +
 + /* Undo multicast registrations */
 + list_for_each_safe(pos, temp,
 +(port-mc_list-list)) {
 + mc_entry = list_entry(pos,
 + struct ehea_mc_list,
 + list);
 + ehea_multicast_reg_helper(port,
 + 

Re: apm_emulation regression

2007-12-13 Thread Johannes Berg

  That basically means X will break. That's why X broke on the latest
  ubuntu until I whacked some new scripts in them to force console
  switching, among other things. Possibly other apps that relied
  on /dev/apm_bios to be notified of system suspend/resume broke as well.
 
 Ah. I guess I never noticed because I had the scripts to do console
 switching all along.

Actually, it just occurred to me that the *kernel* does a console switch
when we use /sys/power/state, so maybe that is why I never had a problem
rather than userspace doing a console switch (which it only started
doing very recently)

johannes


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: cpu frequency governor regression (?)

2007-12-13 Thread Johannes Berg
Ok, umm, sorry for bothering. This is actually a userspace problem.
Because I had it written up already below is the mail I was composing; I
was just checking whether the same would happen without the performance
module loaded, and voila, the same *did* happen which lead me to
investigate userspace. Turns out pm-utils is the cause of this problem.
Nothing but trouble with pm-utils on non-standard non-ACPI systems :/

The problem is this: pm-utils's hibernate_cpufreq() does:

savestate ${x}_governor $(cat $x/cpufreq/scaling_governor)
  ^

but thaw_cpufreq() does:

gov=$(restorestate $(echo cpu${x}_governor))
  

doh! Again, sorry, I really should have looked there first.

johannes

--- % % % ---

 bizarre. It should default back to whatever CONFIG_CPU_FREQ_DEFAULT_* option
 was set.  (Arguably a bug in itself, as we don't track  restore them
 on resume, so if you changed from the default after booting: splat)

Ok I verified this again:

$ zgrep CPU_FREQ /proc/config.gz 
CONFIG_CPU_FREQ=y
CONFIG_CPU_FREQ_TABLE=y
CONFIG_CPU_FREQ_DEBUG=y
CONFIG_CPU_FREQ_STAT=y
# CONFIG_CPU_FREQ_STAT_DETAILS is not set
# CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE is not set
CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE=y
# CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND is not set
# CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE is not set
CONFIG_CPU_FREQ_GOV_PERFORMANCE=m
CONFIG_CPU_FREQ_GOV_POWERSAVE=m
CONFIG_CPU_FREQ_GOV_USERSPACE=y
CONFIG_CPU_FREQ_GOV_ONDEMAND=m
CONFIG_CPU_FREQ_GOV_CONSERVATIVE=m
CONFIG_CPU_FREQ_PMAC64=y

 Also, does /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor 
 have performance in *all* the cpus?

Yes, it does.

 Why you're getting the performance governor is puzzling though.
 Can you enable CONFIG_CPU_FREQ_DEBUG=y, and boot with cpufreq.debug=7
 and send the log from a transition across hibernate?

Ok, fresh boot with cpufreq.debug=7, so far I have userspace in all
scaling_governor files for the four CPUs.

Up to this point, I have the following in the log (dmesg | grep freq):

[0.00] time_init: decrementer frequency = 33.33 MHz
[0.00] time_init: processor frequency   = 2500.00 MHz
[0.168566] Registering G5 CPU frequency driver
[0.168583] cpufreq-core: trying to register driver powermac
[0.168588] cpufreq-core: adding CPU 0
[0.168597] freq-table: setting show_table for cpu 0 to c054caf0
[0.168601] freq-table: table entry 0: 250 kHz, 0 index
[0.168605] freq-table: table entry 1: 125 kHz, 1 index
[0.168751] cpufreq-core: CPU 1 already managed, adding link
[0.168758] cpufreq-core: CPU 2 already managed, adding link
[0.168766] cpufreq-core: CPU 3 already managed, adding link
[0.168774] cpufreq-core: setting new policy for CPU 0: 125 - 250 kHz
[0.168779] freq-table: request for verification of policy (125 - 
250 kHz) for cpu 0
[0.168784] freq-table: verification lead to (125 - 250 kHz) for cpu 0
[0.168789] freq-table: request for verification of policy (125 - 
250 kHz) for cpu 0
[0.168794] freq-table: verification lead to (125 - 250 kHz) for cpu 0
[0.168799] cpufreq-core: new min and max freqs are 125 - 250 kHz
[0.168802] cpufreq-core: governor switch
[0.168810] cpufreq-core: __cpufreq_governor for CPU 0, event 1
[0.168823] cpufreq-core: governor: change or update limits
[0.168827] cpufreq-core: __cpufreq_governor for CPU 0, event 3
[0.168837] cpufreq-core: target for CPU 0: 250 kHz, relation 0
[0.168842] freq-table: request for target 250 kHz (relation: 0) for cpu 0
[0.168846] freq-table: target is 0 (250 kHz, 0)
[0.168849] cpufreq-core: initialization complete
[0.168853] cpufreq-core: adding CPU 1
[0.168856] cpufreq-core: adding CPU 2
[0.168859] cpufreq-core: adding CPU 3
[0.168865] cpufreq-core: driver powermac up and running
[4.997986] cpufreq-core: updating policy for CPU 0
[4.997992] cpufreq-core: setting new policy for CPU 0: 125 - 250 kHz
[4.997998] freq-table: request for verification of policy (125 - 
250 kHz) for cpu 0
[4.998003] freq-table: verification lead to (125 - 250 kHz) for cpu 0
[4.998009] freq-table: request for verification of policy (125 - 
250 kHz) for cpu 0
[4.998013] freq-table: verification lead to (125 - 250 kHz) for cpu 0
[4.998029] cpufreq-core: new min and max freqs are 125 - 250 kHz
[4.998032] cpufreq-core: governor: change or update limits
[4.998036] cpufreq-core: __cpufreq_governor for CPU 0, event 3
[4.998048] cpufreq-core: target for CPU 0: 250 kHz, relation 0
[4.998052] freq-table: request for target 250 kHz (relation: 0) for cpu 0
[4.998056] freq-table: target is 0 (250 kHz, 0)
[4.998061] cpufreq-core: updating policy for CPU 1
[4.998065] cpufreq-core: setting new policy for CPU 0: 125 - 250 kHz
[4.998070] 

[PATCH 1/6] PS3: gelic: Fix the wrong dev_id passed

2007-12-13 Thread Masakazu Mokuno
PS3: gelic: Fix the wrong dev_id passed

The device id for lv1_net_set_interrupt_status_indicator() would be wrong.
This path would be invoked only in the case of the initialization failure.

Signed-off-by: Masakazu Mokuno [EMAIL PROTECTED]
---
 drivers/net/ps3_gelic_net.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/net/ps3_gelic_net.c
+++ b/drivers/net/ps3_gelic_net.c
@@ -1512,7 +1512,7 @@ static int ps3_gelic_driver_probe (struc
 
 fail_setup_netdev:
lv1_net_set_interrupt_status_indicator(bus_id(card),
-  bus_id(card),
+  dev_id(card),
   0 , 0);
 fail_status_indicator:
ps3_dma_region_free(dev-d_region);

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


Re: [PATCH 1/2] cleanup calling mmio_nvram_init

2007-12-13 Thread Arnd Bergmann
On Thursday 13 December 2007, Ishizaki Kou wrote:
 This patch adds conditional initialization for mmio_nvram_init().

Thanks!

 Signed-off-by: Kou Ishizaki [EMAIL PROTECTED]

Acked-by: Arnd Bergmann [EMAIL PROTECTED]
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH 4/6] PS3: gelic: remove duplicated ethtool handers

2007-12-13 Thread Masakazu Mokuno
PS3: gelic: remove duplicated ethtool handers

Remove some ethtool handers, which the common ethtool handlers already has
in functionality

Signed-off-by: Masakazu Mokuno [EMAIL PROTECTED]
---
 drivers/net/ps3_gelic_net.c |   43 +++
 1 file changed, 3 insertions(+), 40 deletions(-)

--- a/drivers/net/ps3_gelic_net.c
+++ b/drivers/net/ps3_gelic_net.c
@@ -1196,28 +1196,6 @@ static int gelic_ether_get_settings(stru
return 0;
 }
 
-static u32 gelic_ether_get_link(struct net_device *netdev)
-{
-   struct gelic_card *card = netdev_priv(netdev);
-   int status;
-   u64 v1, v2;
-   int link;
-
-   status = lv1_net_control(bus_id(card), dev_id(card),
-GELIC_LV1_GET_ETH_PORT_STATUS,
-GELIC_LV1_VLAN_TX_ETHERNET, 0, 0,
-v1, v2);
-   if (status)
-   return 0; /* link down */
-
-   if (v1  GELIC_LV1_ETHER_LINK_UP)
-   link = 1;
-   else
-   link = 0;
-
-   return link;
-}
-
 static int gelic_net_nway_reset(struct net_device *netdev)
 {
if (netif_running(netdev)) {
@@ -1227,21 +1205,6 @@ static int gelic_net_nway_reset(struct n
return 0;
 }
 
-static u32 gelic_net_get_tx_csum(struct net_device *netdev)
-{
-   return (netdev-features  NETIF_F_IP_CSUM) != 0;
-}
-
-static int gelic_net_set_tx_csum(struct net_device *netdev, u32 data)
-{
-   if (data)
-   netdev-features |= NETIF_F_IP_CSUM;
-   else
-   netdev-features = ~NETIF_F_IP_CSUM;
-
-   return 0;
-}
-
 static u32 gelic_net_get_rx_csum(struct net_device *netdev)
 {
struct gelic_card *card = netdev_priv(netdev);
@@ -1260,10 +1223,10 @@ static int gelic_net_set_rx_csum(struct 
 static struct ethtool_ops gelic_net_ethtool_ops = {
.get_drvinfo= gelic_net_get_drvinfo,
.get_settings   = gelic_ether_get_settings,
-   .get_link   = gelic_ether_get_link,
+   .get_link   = ethtool_op_get_link,
.nway_reset = gelic_net_nway_reset,
-   .get_tx_csum= gelic_net_get_tx_csum,
-   .set_tx_csum= gelic_net_set_tx_csum,
+   .get_tx_csum= ethtool_op_get_tx_csum,
+   .set_tx_csum= ethtool_op_set_tx_csum,
.get_rx_csum= gelic_net_get_rx_csum,
.set_rx_csum= gelic_net_set_rx_csum,
 };

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


[PATCH 5/6] PS3: gelic: add support for port link status

2007-12-13 Thread Masakazu Mokuno
PS3: gelic: add support for port link status

Add support for interrupt driven port link status detection.

Signed-off-by: Masakazu Mokuno [EMAIL PROTECTED]
---
 drivers/net/ps3_gelic_net.c |   77 
 drivers/net/ps3_gelic_net.h |2 +
 2 files changed, 52 insertions(+), 27 deletions(-)

--- a/drivers/net/ps3_gelic_net.c
+++ b/drivers/net/ps3_gelic_net.c
@@ -87,6 +87,28 @@ static inline void gelic_card_rx_irq_off
 {
gelic_card_set_irq_mask(card, card-ghiintmask  ~GELIC_CARD_RXINT);
 }
+
+static void
+gelic_card_get_ether_port_status(struct gelic_card *card, int inform)
+{
+   u64 v2;
+   struct net_device *ether_netdev;
+
+   lv1_net_control(bus_id(card), dev_id(card),
+   GELIC_LV1_GET_ETH_PORT_STATUS,
+   GELIC_LV1_VLAN_TX_ETHERNET, 0, 0,
+   card-ether_port_status, v2);
+
+   if (inform) {
+   ether_netdev = card-netdev;
+   if (card-ether_port_status  GELIC_LV1_ETHER_LINK_UP)
+   netif_carrier_on(ether_netdev);
+   else
+   netif_carrier_off(ether_netdev);
+   }
+}
+
+
 /**
  * gelic_descr_get_status -- returns the status of a descriptor
  * @descr: descriptor to look at
@@ -1032,6 +1054,10 @@ static irqreturn_t gelic_card_interrupt(
gelic_card_kick_txdma(card, card-tx_chain.tail);
spin_unlock_irqrestore(card-tx_dma_lock, flags);
}
+
+   /* ether port status changed */
+   if (status  GELIC_CARD_PORT_STATUS_CHANGED)
+   gelic_card_get_ether_port_status(card, 1);
return IRQ_HANDLED;
 }
 
@@ -1128,13 +1154,14 @@ static int gelic_net_open(struct net_dev
napi_enable(card-napi);
 
card-tx_dma_progress = 0;
-   card-ghiintmask = GELIC_CARD_RXINT | GELIC_CARD_TXINT;
+   card-ghiintmask = GELIC_CARD_RXINT | GELIC_CARD_TXINT |
+   GELIC_CARD_PORT_STATUS_CHANGED;
 
gelic_card_set_irq_mask(card, card-ghiintmask);
gelic_card_enable_rxdmac(card);
 
netif_start_queue(netdev);
-   netif_carrier_on(netdev);
+   gelic_card_get_ether_port_status(card, 1);
 
return 0;
 
@@ -1157,39 +1184,35 @@ static int gelic_ether_get_settings(stru
struct ethtool_cmd *cmd)
 {
struct gelic_card *card = netdev_priv(netdev);
-   int status;
-   u64 v1, v2;
-   int speed, duplex;
 
-   speed = duplex = -1;
-   status = lv1_net_control(bus_id(card), dev_id(card),
-GELIC_LV1_GET_ETH_PORT_STATUS,
-GELIC_LV1_VLAN_TX_ETHERNET, 0, 0,
-v1, v2);
-   if (status) {
-   /* link down */
-   } else {
-   if (v1  GELIC_LV1_ETHER_FULL_DUPLEX) {
-   duplex = DUPLEX_FULL;
-   } else {
-   duplex = DUPLEX_HALF;
-   }
+   gelic_card_get_ether_port_status(card, 0);
 
-   if (v1  GELIC_LV1_ETHER_SPEED_10) {
-   speed = SPEED_10;
-   } else if (v1  GELIC_LV1_ETHER_SPEED_100) {
-   speed = SPEED_100;
-   } else if (v1  GELIC_LV1_ETHER_SPEED_1000) {
-   speed = SPEED_1000;
-   }
+   if (card-ether_port_status  GELIC_LV1_ETHER_FULL_DUPLEX)
+   cmd-duplex = DUPLEX_FULL;
+   else
+   cmd-duplex = DUPLEX_HALF;
+
+   switch (card-ether_port_status  GELIC_LV1_ETHER_SPEED_MASK) {
+   case GELIC_LV1_ETHER_SPEED_10:
+   cmd-speed = SPEED_10;
+   break;
+   case GELIC_LV1_ETHER_SPEED_100:
+   cmd-speed = SPEED_100;
+   break;
+   case GELIC_LV1_ETHER_SPEED_1000:
+   cmd-speed = SPEED_1000;
+   break;
+   default:
+   pr_info(%s: speed unknown\n, __func__);
+   cmd-speed = SPEED_10;
+   break;
}
+
cmd-supported = SUPPORTED_TP | SUPPORTED_Autoneg |
SUPPORTED_10baseT_Half | SUPPORTED_10baseT_Full |
SUPPORTED_100baseT_Half | SUPPORTED_100baseT_Full |
SUPPORTED_1000baseT_Half | SUPPORTED_1000baseT_Full;
cmd-advertising = cmd-supported;
-   cmd-speed = speed;
-   cmd-duplex = duplex;
cmd-autoneg = AUTONEG_ENABLE; /* always enabled */
cmd-port = PORT_TP;
 
--- a/drivers/net/ps3_gelic_net.h
+++ b/drivers/net/ps3_gelic_net.h
@@ -261,6 +261,8 @@ struct gelic_card {
atomic_t tx_timeout_task_counter;
wait_queue_head_t waitq;
 
+   u64 ether_port_status;
+
struct gelic_descr *tx_top, *rx_top;
struct gelic_descr descr[0];
 };

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

[PATCH 6/6] PS3: gelic: Add support for dual network interface

2007-12-13 Thread Masakazu Mokuno
PS3: gelic: Add support for dual network interface

Add support for dual network (net_device) interface so that ethernet
and wireless can own separate ethX interface.
  - Export functions which are convenience for both interfaces
  - Move irq allocation/release code to driver probe/remove handlers
because interfaces share interrupts.
  - Allocate skbs by using dev_alloc_skb() instead netdev_alloc_skb()
as the interfaces share the hardware rx queue.
  - Add gelic_port struct in order to abstract dual interface handling
  - Change handers for hardware queues so that they can handle dual
{source,destination} interfaces.
  - Use new NAPI functions
This is a prerequisite for the new PS3 wireless support.

Signed-off-by: Masakazu Mokuno [EMAIL PROTECTED]
---
 drivers/net/ps3_gelic_net.c |  721 ++--
 drivers/net/ps3_gelic_net.h |  107 +-
 2 files changed, 525 insertions(+), 303 deletions(-)

--- a/drivers/net/ps3_gelic_net.c
+++ b/drivers/net/ps3_gelic_net.c
@@ -48,27 +48,19 @@
 #include ps3_gelic_net.h
 
 #define DRV_NAME Gelic Network Driver
-#define DRV_VERSION 1.0
+#define DRV_VERSION 1.1
 
 MODULE_AUTHOR(SCE Inc.);
 MODULE_DESCRIPTION(Gelic Network driver);
 MODULE_LICENSE(GPL);
 
-static inline struct device *ctodev(struct gelic_card *card)
-{
-   return card-dev-core;
-}
-static inline u64 bus_id(struct gelic_card *card)
-{
-   return card-dev-bus_id;
-}
-static inline u64 dev_id(struct gelic_card *card)
-{
-   return card-dev-dev_id;
-}
+
+static inline void gelic_card_enable_rxdmac(struct gelic_card *card);
+static inline void gelic_card_disable_rxdmac(struct gelic_card *card);
+static inline void gelic_card_disable_txdmac(struct gelic_card *card);
 
 /* set irq_mask */
-static int gelic_card_set_irq_mask(struct gelic_card *card, u64 mask)
+int gelic_card_set_irq_mask(struct gelic_card *card, u64 mask)
 {
int status;
 
@@ -76,20 +68,23 @@ static int gelic_card_set_irq_mask(struc
mask, 0);
if (status)
dev_info(ctodev(card),
-lv1_net_set_interrupt_mask failed %d\n, status);
+%s failed %d\n, __func__, status);
return status;
 }
+
 static inline void gelic_card_rx_irq_on(struct gelic_card *card)
 {
-   gelic_card_set_irq_mask(card, card-ghiintmask | GELIC_CARD_RXINT);
+   card-irq_mask |= GELIC_CARD_RXINT;
+   gelic_card_set_irq_mask(card, card-irq_mask);
 }
 static inline void gelic_card_rx_irq_off(struct gelic_card *card)
 {
-   gelic_card_set_irq_mask(card, card-ghiintmask  ~GELIC_CARD_RXINT);
+   card-irq_mask = ~GELIC_CARD_RXINT;
+   gelic_card_set_irq_mask(card, card-irq_mask);
 }
 
-static void
-gelic_card_get_ether_port_status(struct gelic_card *card, int inform)
+static void gelic_card_get_ether_port_status(struct gelic_card *card,
+int inform)
 {
u64 v2;
struct net_device *ether_netdev;
@@ -100,7 +95,7 @@ gelic_card_get_ether_port_status(struct 
card-ether_port_status, v2);
 
if (inform) {
-   ether_netdev = card-netdev;
+   ether_netdev = card-netdev[GELIC_PORT_ETHERNET];
if (card-ether_port_status  GELIC_LV1_ETHER_LINK_UP)
netif_carrier_on(ether_netdev);
else
@@ -108,6 +103,46 @@ gelic_card_get_ether_port_status(struct 
}
 }
 
+void gelic_card_up(struct gelic_card *card)
+{
+   pr_debug(%s: called\n, __func__);
+   down(card-updown_lock);
+   if (atomic_inc_return(card-users) == 1) {
+   pr_debug(%s: real do\n, __func__);
+   /* enable irq */
+   gelic_card_set_irq_mask(card, card-irq_mask);
+   /* start rx */
+   gelic_card_enable_rxdmac(card);
+
+   napi_enable(card-napi);
+   }
+   up(card-updown_lock);
+   pr_debug(%s: done\n, __func__);
+}
+
+void gelic_card_down(struct gelic_card *card)
+{
+   u64 mask;
+   pr_debug(%s: called\n, __func__);
+   down(card-updown_lock);
+   if (atomic_dec_if_positive(card-users) == 0) {
+   pr_debug(%s: real do\n, __func__);
+   napi_disable(card-napi);
+   /*
+* Disable irq. Wireless interrupts will
+* be disabled later if any
+*/
+   mask = card-irq_mask  (GELIC_CARD_WLAN_EVENT_RECEIVED |
+GELIC_CARD_WLAN_COMMAND_COMPLETED);
+   gelic_card_set_irq_mask(card, mask);
+   /* stop rx */
+   gelic_card_disable_rxdmac(card);
+   /* stop tx */
+   gelic_card_disable_txdmac(card);
+   }
+   up(card-updown_lock);
+   pr_debug(%s: done\n, __func__);
+}
 
 /**
  * gelic_descr_get_status -- returns the status of a descriptor
@@ -133,8 +168,8 @@ static void 

[PATCH 2/6] PS3: gelic: Add endianness macros

2007-12-13 Thread Masakazu Mokuno
PS3: gelic: Add endianness macros

Mark the members of the structure for DMA descriptor proper endian
and use appropriate accessor macros.
As gelic driver works only on PS3, all these macros will be
expanded null.

Signed-off-by: Masakazu Mokuno [EMAIL PROTECTED]
---
 drivers/net/ps3_gelic_net.c |   70 
 drivers/net/ps3_gelic_net.h |   16 +-
 2 files changed, 47 insertions(+), 39 deletions(-)

--- a/drivers/net/ps3_gelic_net.c
+++ b/drivers/net/ps3_gelic_net.c
@@ -98,7 +98,7 @@ gelic_net_get_descr_status(struct gelic_
 {
u32 cmd_status;
 
-   cmd_status = descr-dmac_cmd_status;
+   cmd_status = be32_to_cpu(descr-dmac_cmd_status);
cmd_status = GELIC_NET_DESCR_IND_PROC_SHIFT;
return cmd_status;
 }
@@ -117,13 +117,13 @@ static void gelic_net_set_descr_status(s
u32 cmd_status;
 
/* read the status */
-   cmd_status = descr-dmac_cmd_status;
+   cmd_status = be32_to_cpu(descr-dmac_cmd_status);
/* clean the upper 4 bits */
cmd_status = GELIC_NET_DESCR_IND_PROC_MASKO;
/* add the status to it */
cmd_status |= ((u32)status)  GELIC_NET_DESCR_IND_PROC_SHIFT;
/* and write it back */
-   descr-dmac_cmd_status = cmd_status;
+   descr-dmac_cmd_status = cpu_to_be32(cmd_status);
/*
 * dma_cmd_status field is used to indicate whether the descriptor
 * is valid or not.
@@ -193,7 +193,7 @@ static int gelic_net_init_chain(struct g
/* chain bus addr of hw descriptor */
descr = start_descr;
for (i = 0; i  no; i++, descr++) {
-   descr-next_descr_addr = descr-next-bus_addr;
+   descr-next_descr_addr = cpu_to_be32(descr-next-bus_addr);
}
 
chain-head = start_descr;
@@ -245,7 +245,7 @@ static int gelic_net_prepare_rx_descr(st
 %s:allocate skb failed !!\n, __func__);
return -ENOMEM;
}
-   descr-buf_size = bufsize;
+   descr-buf_size = cpu_to_be32(bufsize);
descr-dmac_cmd_status = 0;
descr-result_size = 0;
descr-valid_size = 0;
@@ -256,9 +256,10 @@ static int gelic_net_prepare_rx_descr(st
if (offset)
skb_reserve(descr-skb, GELIC_NET_RXBUF_ALIGN - offset);
/* io-mmu-map the skb */
-   descr-buf_addr = dma_map_single(ctodev(card), descr-skb-data,
-GELIC_NET_MAX_MTU,
-DMA_FROM_DEVICE);
+   descr-buf_addr = cpu_to_be32(dma_map_single(ctodev(card),
+descr-skb-data,
+GELIC_NET_MAX_MTU,
+DMA_FROM_DEVICE));
if (!descr-buf_addr) {
dev_kfree_skb_any(descr-skb);
descr-skb = NULL;
@@ -284,7 +285,7 @@ static void gelic_net_release_rx_chain(s
do {
if (descr-skb) {
dma_unmap_single(ctodev(card),
-descr-buf_addr,
+be32_to_cpu(descr-buf_addr),
 descr-skb-len,
 DMA_FROM_DEVICE);
descr-buf_addr = 0;
@@ -353,10 +354,11 @@ static void gelic_net_release_tx_descr(s
 {
struct sk_buff *skb = descr-skb;
 
-   BUG_ON(!(descr-data_status  (1  GELIC_NET_TXDESC_TAIL)));
+   BUG_ON(!(be32_to_cpu(descr-data_status) 
+(1  GELIC_NET_TXDESC_TAIL)));
 
-   dma_unmap_single(ctodev(card), descr-buf_addr, skb-len,
-DMA_TO_DEVICE);
+   dma_unmap_single(ctodev(card),
+be32_to_cpu(descr-buf_addr), skb-len, DMA_TO_DEVICE);
dev_kfree_skb_any(skb);
 
descr-buf_addr = 0;
@@ -610,28 +612,29 @@ static void gelic_net_set_txdescr_cmdsta
  struct sk_buff *skb)
 {
if (skb-ip_summed != CHECKSUM_PARTIAL)
-   descr-dmac_cmd_status = GELIC_NET_DMAC_CMDSTAT_NOCS |
-   GELIC_NET_DMAC_CMDSTAT_END_FRAME;
+   descr-dmac_cmd_status =
+   cpu_to_be32(GELIC_NET_DMAC_CMDSTAT_NOCS |
+   GELIC_NET_DMAC_CMDSTAT_END_FRAME);
else {
/* is packet ip?
 * if yes: tcp? udp? */
if (skb-protocol == htons(ETH_P_IP)) {
if (ip_hdr(skb)-protocol == IPPROTO_TCP)
descr-dmac_cmd_status =
-   GELIC_NET_DMAC_CMDSTAT_TCPCS |
-   GELIC_NET_DMAC_CMDSTAT_END_FRAME;
+   cpu_to_be32(GELIC_NET_DMAC_CMDSTAT_TCPCS |
+   GELIC_NET_DMAC_CMDSTAT_END_FRAME);
 

Re: [PATCH 2/2] celleb: split machine definition

2007-12-13 Thread Arnd Bergmann
On Thursday 13 December 2007, Ishizaki Kou wrote:
 This patch splits machine definition for celleb into two definitoins,
 one is for celleb_beat, and another is for celleb_native. Though this
 patch looks complex because of sorting some functions, there are no
 more semantic changes than that for the splitting.

Looks good, thanks!

 Signed-off-by: Kou Ishizaki [EMAIL PROTECTED]

Acked-by: Arnd Bergmann [EMAIL PROTECTED]
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH] IB/ehca: Fix lock flag location, bump version number

2007-12-13 Thread Joachim Fenkes
Signed-off-by: Joachim Fenkes [EMAIL PROTECTED]
---

This addresses a comment of Roland and bumps the version number. If it's not
too late, please apply for 2.6.24. Thanks!

 drivers/infiniband/hw/ehca/ehca_classes.h |1 +
 drivers/infiniband/hw/ehca/ehca_main.c|2 +-
 drivers/infiniband/hw/ehca/hcp_if.c   |1 -
 3 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/infiniband/hw/ehca/ehca_classes.h 
b/drivers/infiniband/hw/ehca/ehca_classes.h
index 87f12d4..74d2b72 100644
--- a/drivers/infiniband/hw/ehca/ehca_classes.h
+++ b/drivers/infiniband/hw/ehca/ehca_classes.h
@@ -322,6 +322,7 @@ extern int ehca_static_rate;
 extern int ehca_port_act_time;
 extern int ehca_use_hp_mr;
 extern int ehca_scaling_code;
+extern int ehca_lock_hcalls;
 
 struct ipzu_queue_resp {
u32 qe_size;  /* queue entry size */
diff --git a/drivers/infiniband/hw/ehca/ehca_main.c 
b/drivers/infiniband/hw/ehca/ehca_main.c
index c7bff3e..6a56d86 100644
--- a/drivers/infiniband/hw/ehca/ehca_main.c
+++ b/drivers/infiniband/hw/ehca/ehca_main.c
@@ -50,7 +50,7 @@
 #include ehca_tools.h
 #include hcp_if.h
 
-#define HCAD_VERSION 0024
+#define HCAD_VERSION 0025
 
 MODULE_LICENSE(Dual BSD/GPL);
 MODULE_AUTHOR(Christoph Raisch [EMAIL PROTECTED]);
diff --git a/drivers/infiniband/hw/ehca/hcp_if.c 
b/drivers/infiniband/hw/ehca/hcp_if.c
index 331b5e8..7029aa6 100644
--- a/drivers/infiniband/hw/ehca/hcp_if.c
+++ b/drivers/infiniband/hw/ehca/hcp_if.c
@@ -89,7 +89,6 @@
 #define HCALL9_REGS_FORMAT HCALL7_REGS_FORMAT  r11=%lx r12=%lx
 
 static DEFINE_SPINLOCK(hcall_lock);
-extern int ehca_lock_hcalls;
 
 static u32 get_longbusy_msecs(int longbusy_rc)
 {
-- 
1.5.2



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


Re: [PATCH RFC 0/7] NAND on UPM and related patches

2007-12-13 Thread Anton Vorontsov
On Wed, Dec 12, 2007 at 03:06:54PM -0600, Scott Wood wrote:
[...]
 Given that, personally I'd want to lockless variant to stay.
 
 So, you still want to get rid of it?
 
 Yes, in the absence of benchmarking that shows it makes a real 
 difference.

Benchmarking shows no difference in throughput between lock and
lockless variants. This is expected of course, flashes are slow,
so I can't really benchmark anything with it.

 Premature optimization being the root of all evil, and what 
 not.

;-) Will remove it, thanks!

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


Re: [PATCH/RFC] CPM1: implement GPIO API

2007-12-13 Thread Scott Wood
On Wed, Dec 12, 2007 at 05:42:06PM +0100, Jochen Friedrich wrote:
 +int cpm_init_par_io(void)
 +{
 + int ret;
 + struct device_node *np;
 + const u32 *num_ports;
 + int i;
 +
 + np = of_find_node_by_name(NULL, par_io);
 + if (!np) {
 + ret = -ENOENT;
 + goto err0;
 + }

Shouldn't this lookup be by compatible (something like fsl,cpm1-gpio would
be good)?

 +int gpio_request(unsigned int gpio, const char *label)
 +{
 + if (!cpm1_port_locks)
 + return -ENODEV;
 +
 + if (gpio / 32  cpm1_num_ports)
 + return -EINVAL;

Shouldn't this be =?

 + return 0;

No already-requested check?

 +}
 +EXPORT_SYMBOL_GPL(gpio_request);

This is an API, not internals; can we stick with plain EXPORT_SYMBOL()?

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


[PATCH 1/4] nand base: Don't panic if a controller driver does ecc its own way.

2007-12-13 Thread Scott Wood
Some hardware, such as the enhanced local bus controller used on some
mpc83xx chips, does ecc transparently when reading and writing data, rather
than providing a generic calculate/correct mechanism that can be exported to
the nand subsystem.

The subsystem should not BUG() when calculate, correct, or hwctl are
missing, if the methods that call them have been overridden.

Signed-off-by: Scott Wood [EMAIL PROTECTED]
---
 drivers/mtd/nand/nand_base.c |8 ++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index e29c1da..85a7283 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -2469,8 +2469,12 @@ int nand_scan_tail(struct mtd_info *mtd)
chip-ecc.write_oob = nand_write_oob_std;
 
case NAND_ECC_HW_SYNDROME:
-   if (!chip-ecc.calculate || !chip-ecc.correct ||
-   !chip-ecc.hwctl) {
+   if ((!chip-ecc.calculate || !chip-ecc.correct ||
+!chip-ecc.hwctl) 
+   (!chip-ecc.read_page ||
+chip-ecc.read_page == nand_read_page_hwecc) ||
+!chip-ecc.write_page ||
+chip-ecc.write_page == nand_write_page_hwecc) {
printk(KERN_WARNING No ECC functions supplied, 
   Hardware ECC not possible\n);
BUG();
-- 
1.5.3.7

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


[PATCH 3/4] mpc8313erdb: Add NOR flash to the device tree.

2007-12-13 Thread Scott Wood
Signed-off-by: Scott Wood [EMAIL PROTECTED]
---
 arch/powerpc/boot/dts/mpc8313erdb.dts |9 +
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/arch/powerpc/boot/dts/mpc8313erdb.dts 
b/arch/powerpc/boot/dts/mpc8313erdb.dts
index 86e851a..8c7b645 100644
--- a/arch/powerpc/boot/dts/mpc8313erdb.dts
+++ b/arch/powerpc/boot/dts/mpc8313erdb.dts
@@ -53,6 +53,15 @@
  2 0 f000 0002
  3 0 fa00 8000;
 
+   [EMAIL PROTECTED],0 {
+   #address-cells = 1;
+   #size-cells = 1;
+   compatible = cfi-flash;
+   reg = 0 0 80;
+   bank-width = 2;
+   device-width = 1;
+   };
+
[EMAIL PROTECTED],0 {
#address-cells = 1;
#size-cells = 1;
-- 
1.5.3.7

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


[PATCH 2/4] mpc8313erdb: Add NAND to device tree, and call of_platform_bus_probe().

2007-12-13 Thread Scott Wood
Signed-off-by: Scott Wood [EMAIL PROTECTED]
---
 arch/powerpc/boot/dts/mpc8313erdb.dts |   37 +
 arch/powerpc/platforms/83xx/mpc8313_rdb.c |   17 +
 2 files changed, 54 insertions(+), 0 deletions(-)

diff --git a/arch/powerpc/boot/dts/mpc8313erdb.dts 
b/arch/powerpc/boot/dts/mpc8313erdb.dts
index 9e7eba9..86e851a 100644
--- a/arch/powerpc/boot/dts/mpc8313erdb.dts
+++ b/arch/powerpc/boot/dts/mpc8313erdb.dts
@@ -37,6 +37,43 @@
reg =  0800;  // 128MB at 0
};
 
+   localbus {
+   #address-cells = 2;
+   #size-cells = 1;
+   compatible = fsl,mpc8313-elbc, fsl,elbc;
+   reg = e0005000 1000;
+   interrupts = d#77 8;
+   interrupt-parent = ipic;
+
+   // CS0 and CS1 are swapped when
+   // booting from nand, but the
+   // addresses are the same.
+   ranges = 0 0 fe00 0080
+ 1 0 e280 8000
+ 2 0 f000 0002
+ 3 0 fa00 8000;
+
+   [EMAIL PROTECTED],0 {
+   #address-cells = 1;
+   #size-cells = 1;
+   compatible = fsl,mpc8313-fcm-nand, 
fsl,elbc-fcm-nand;
+   reg = 1 0 2000;
+
+   [EMAIL PROTECTED] {
+   reg = 0 10;
+   read-only;
+   };
+
+   [EMAIL PROTECTED] {
+   reg = 10 30;
+   };
+
+   [EMAIL PROTECTED] {
+   reg = 40 1c0;
+   };
+   };
+   };
+
[EMAIL PROTECTED] {
#address-cells = 1;
#size-cells = 1;
diff --git a/arch/powerpc/platforms/83xx/mpc8313_rdb.c 
b/arch/powerpc/platforms/83xx/mpc8313_rdb.c
index 6fb8299..3ad482a 100644
--- a/arch/powerpc/platforms/83xx/mpc8313_rdb.c
+++ b/arch/powerpc/platforms/83xx/mpc8313_rdb.c
@@ -14,6 +14,7 @@
  */
 
 #include linux/pci.h
+#include linux/of_platform.h
 
 #include asm/time.h
 #include asm/ipic.h
@@ -75,6 +76,22 @@ static int __init mpc8313_rdb_probe(void)
return of_flat_dt_is_compatible(root, MPC8313ERDB);
 }
 
+static struct of_device_id __initdata of_bus_ids[] = {
+   { .name = soc8313, },
+   { .name = localbus, },
+   {},
+};
+
+static int __init declare_of_platform_devices(void)
+{
+   if (!machine_is(mpc8313_rdb))
+   return 0;
+
+   of_platform_bus_probe(NULL, of_bus_ids, NULL);
+   return 0;
+}
+device_initcall(declare_of_platform_devices);
+
 define_machine(mpc8313_rdb) {
.name   = MPC8313 RDB,
.probe  = mpc8313_rdb_probe,
-- 
1.5.3.7

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


[PATCH] mpc834x_mds: Fix whitespace and call of_platform_bus_probe().

2007-12-13 Thread Scott Wood
Signed-off-by: Scott Wood [EMAIL PROTECTED]
---
 arch/powerpc/platforms/83xx/mpc834x_mds.c |   21 +++--
 1 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/platforms/83xx/mpc834x_mds.c 
b/arch/powerpc/platforms/83xx/mpc834x_mds.c
index a81bb3c..459fb72 100644
--- a/arch/powerpc/platforms/83xx/mpc834x_mds.c
+++ b/arch/powerpc/platforms/83xx/mpc834x_mds.c
@@ -23,6 +23,7 @@
 #include linux/delay.h
 #include linux/seq_file.h
 #include linux/root_dev.h
+#include linux/of_platform.h
 
 #include asm/system.h
 #include asm/atomic.h
@@ -106,14 +107,30 @@ static void __init mpc834x_mds_init_IRQ(void)
ipic_set_default_priority();
 }
 
+static struct of_device_id mpc834x_ids[] = {
+   { .type = soc, },
+   { .compatible = soc, },
+   {},
+};
+
+static int __init mpc834x_declare_of_platform_devices(void)
+{
+   if (!machine_is(mpc834x_mds))
+   return 0;
+
+   of_platform_bus_probe(NULL, mpc834x_ids, NULL);
+   return 0;
+}
+device_initcall(mpc834x_declare_of_platform_devices);
+
 /*
  * Called very early, MMU is off, device-tree isn't unflattened
  */
 static int __init mpc834x_mds_probe(void)
 {
-unsigned long root = of_get_flat_dt_root();
+   unsigned long root = of_get_flat_dt_root();
 
-return of_flat_dt_is_compatible(root, MPC834xMDS);
+   return of_flat_dt_is_compatible(root, MPC834xMDS);
 }
 
 define_machine(mpc834x_mds) {
-- 
1.5.3.7
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


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

2007-12-13 Thread Scott Wood
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.

Signed-off-by: Scott Wood [EMAIL PROTECTED]
---
 drivers/mtd/nand/nand_base.c |   12 
 include/linux/mtd/nand.h |2 ++
 2 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index 85a7283..119a6f7 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -2593,6 +2593,18 @@ int nand_scan_tail(struct mtd_info *mtd)
/* propagate ecc.layout to mtd_info */
mtd-ecclayout = chip-ecc.layout;
 
+   /* Give the driver a chance to do any remaining setup
+* based on the chip details.
+*/
+   if (chip-late_init) {
+   int ret = chip-late_init(mtd);
+
+   if (ret) {
+   kfree(chip-buffers);
+   return ret;
+   }
+   }
+
/* Check, if we should skip the bad block table scan */
if (chip-options  NAND_SKIP_BBTSCAN)
return 0;
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
index c42bc7f..27bc879 100644
--- a/include/linux/mtd/nand.h
+++ b/include/linux/mtd/nand.h
@@ -360,6 +360,7 @@ struct nand_buffers {
  * @errstat:   [OPTIONAL] hardware specific function to perform 
additional error status checks
  * (determine if errors are correctable)
  * @write_page:[REPLACEABLE] High-level page write function
+ * @late_init: [OPTIONAL] initialization callback after identification
  */
 
 struct nand_chip {
@@ -384,6 +385,7 @@ struct nand_chip {
int (*errstat)(struct mtd_info *mtd, struct nand_chip 
*this, int state, int status, int page);
int (*write_page)(struct mtd_info *mtd, struct nand_chip 
*chip,
  const uint8_t *buf, int page, int cached, 
int raw);
+   int (*late_init)(struct mtd_info *mtd);
 
int chip_delay;
unsigned intoptions;
-- 
1.5.3.7

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


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

2007-12-13 Thread Scott Wood
Signed-off-by: Scott Wood [EMAIL PROTECTED]
---
 drivers/mtd/Kconfig|8 
 drivers/mtd/Makefile   |1 +
 drivers/mtd/maps/physmap_of.c  |   88 ---
 drivers/mtd/ofpart.c   |   68 +++
 include/linux/mtd/partitions.h |9 -
 5 files changed, 112 insertions(+), 62 deletions(-)
 create mode 100644 drivers/mtd/ofpart.c

diff --git a/drivers/mtd/Kconfig b/drivers/mtd/Kconfig
index 8848e8a..b729410 100644
--- a/drivers/mtd/Kconfig
+++ b/drivers/mtd/Kconfig
@@ -150,6 +150,14 @@ config MTD_AFS_PARTS
  for your particular device. It won't happen automatically. The
  'armflash' map driver (CONFIG_MTD_ARMFLASH) does this, for example.
 
+config MTD_OF_PARTS
+   tristate Flash partition map based on OF description
+   depends on PPC_OF  MTD_PARTITIONS
+   help
+ This provides a partition parsing function which derives
+ the partition map from the children of the flash node,
+ as described in Documentation/powerpc/booting-without-of.txt.
+
 comment User Modules And Translation Layers
 
 config MTD_CHAR
diff --git a/drivers/mtd/Makefile b/drivers/mtd/Makefile
index 7f0b04b..538e33d 100644
--- a/drivers/mtd/Makefile
+++ b/drivers/mtd/Makefile
@@ -11,6 +11,7 @@ obj-$(CONFIG_MTD_CONCAT)  += mtdconcat.o
 obj-$(CONFIG_MTD_REDBOOT_PARTS) += redboot.o
 obj-$(CONFIG_MTD_CMDLINE_PARTS) += cmdlinepart.o
 obj-$(CONFIG_MTD_AFS_PARTS)+= afs.o
+obj-$(CONFIG_MTD_OF_PARTS)  += ofpart.o
 
 # 'Users' - code which presents functionality to userspace.
 obj-$(CONFIG_MTD_CHAR) += mtdchar.o
diff --git a/drivers/mtd/maps/physmap_of.c b/drivers/mtd/maps/physmap_of.c
index aeed9ea..49acd41 100644
--- a/drivers/mtd/maps/physmap_of.c
+++ b/drivers/mtd/maps/physmap_of.c
@@ -80,64 +80,6 @@ static int parse_obsolete_partitions(struct of_device *dev,
 
return nr_parts;
 }
-
-static int __devinit parse_partitions(struct of_flash *info,
- struct of_device *dev)
-{
-   const char *partname;
-   static const char *part_probe_types[]
-   = { cmdlinepart, RedBoot, NULL };
-   struct device_node *dp = dev-node, *pp;
-   int nr_parts, i;
-
-   /* First look for RedBoot table or partitions on the command
-* line, these take precedence over device tree information */
-   nr_parts = parse_mtd_partitions(info-mtd, part_probe_types,
-   info-parts, 0);
-   if (nr_parts  0) {
-   add_mtd_partitions(info-mtd, info-parts, nr_parts);
-   return 0;
-   }
-
-   /* First count the subnodes */
-   nr_parts = 0;
-   for (pp = dp-child; pp; pp = pp-sibling)
-   nr_parts++;
-
-   if (nr_parts == 0)
-   return parse_obsolete_partitions(dev, info, dp);
-
-   info-parts = kzalloc(nr_parts * sizeof(*info-parts),
- GFP_KERNEL);
-   if (!info-parts)
-   return -ENOMEM;
-
-   for (pp = dp-child, i = 0; pp; pp = pp-sibling, i++) {
-   const u32 *reg;
-   int len;
-
-   reg = of_get_property(pp, reg, len);
-   if (!reg || (len != 2*sizeof(u32))) {
-   dev_err(dev-dev, Invalid 'reg' on %s\n,
-   dp-full_name);
-   kfree(info-parts);
-   info-parts = NULL;
-   return -EINVAL;
-   }
-   info-parts[i].offset = reg[0];
-   info-parts[i].size = reg[1];
-
-   partname = of_get_property(pp, label, len);
-   if (!partname)
-   partname = of_get_property(pp, name, len);
-   info-parts[i].name = (char *)partname;
-
-   if (of_get_property(pp, read-only, len))
-   info-parts[i].mask_flags = MTD_WRITEABLE;
-   }
-
-   return nr_parts;
-}
 #else /* MTD_PARTITIONS */
 #defineOF_FLASH_PARTS(info)(0)
 #define parse_partitions(info, dev)(0)
@@ -212,6 +154,10 @@ static struct mtd_info * __devinit obsolete_probe(struct 
of_device *dev,
 static int __devinit of_flash_probe(struct of_device *dev,
const struct of_device_id *match)
 {
+#ifdef CONFIG_MTD_PARTITIONS
+   static const char *part_probe_types[]
+   = { cmdlinepart, RedBoot, NULL };
+#endif
struct device_node *dp = dev-node;
struct resource res;
struct of_flash *info;
@@ -274,13 +220,33 @@ static int __devinit of_flash_probe(struct of_device *dev,
}
info-mtd-owner = THIS_MODULE;
 
-   err = parse_partitions(info, dev);
+#ifdef CONFIG_MTD_PARTITIONS
+   /* First look for RedBoot table or partitions on the command
+* line, these take precedence over device tree information */
+   err = parse_mtd_partitions(info-mtd, 

[PATCH 4/4] MPC8313 enhanced Local Bus Controller NAND support.

2007-12-13 Thread Scott Wood
Signed-off-by: Nick Spence [EMAIL PROTECTED]
Signed-off-by: Scott Wood [EMAIL PROTECTED]
---
 drivers/mtd/nand/Kconfig |9 +
 drivers/mtd/nand/Makefile|1 +
 drivers/mtd/nand/fsl_elbc_nand.c | 1281 ++
 3 files changed, 1291 insertions(+), 0 deletions(-)
 create mode 100644 drivers/mtd/nand/fsl_elbc_nand.c

diff --git a/drivers/mtd/nand/Kconfig b/drivers/mtd/nand/Kconfig
index 246d451..05d976c 100644
--- a/drivers/mtd/nand/Kconfig
+++ b/drivers/mtd/nand/Kconfig
@@ -306,4 +306,13 @@ config MTD_ALAUDA
  These two (and possibly other) Alauda-based cardreaders for
  SmartMedia and xD allow raw flash access.
 
+config MTD_NAND_FSL_ELBC
+   tristate NAND support for Freescale eLBC controllers
+   depends on MTD_NAND  PPC_OF
+   help
+ Various Freescale chips, including the 8313, include a NAND Flash
+ Controller Module with built-in hardware ECC capabilities.
+ Enabling this option will enable you to use this to control
+ external NAND devices.
+
 endif # MTD_NAND
diff --git a/drivers/mtd/nand/Makefile b/drivers/mtd/nand/Makefile
index 3ad6c01..d0d4de2 100644
--- a/drivers/mtd/nand/Makefile
+++ b/drivers/mtd/nand/Makefile
@@ -29,5 +29,6 @@ obj-$(CONFIG_MTD_NAND_CM_X270)+= cmx270_nand.o
 obj-$(CONFIG_MTD_NAND_BASLER_EXCITE)   += excite_nandflash.o
 obj-$(CONFIG_MTD_NAND_PLATFORM)+= plat_nand.o
 obj-$(CONFIG_MTD_ALAUDA)   += alauda.o
+obj-$(CONFIG_MTD_NAND_FSL_ELBC)+= fsl_elbc_nand.o
 
 nand-objs := nand_base.o nand_bbt.o
diff --git a/drivers/mtd/nand/fsl_elbc_nand.c b/drivers/mtd/nand/fsl_elbc_nand.c
new file mode 100644
index 000..ce8b0bf
--- /dev/null
+++ b/drivers/mtd/nand/fsl_elbc_nand.c
@@ -0,0 +1,1281 @@
+/* Freescale Enhanced Local Bus Controller NAND driver
+ *
+ * Copyright (c) 2006-2007 Freescale Semiconductor
+ *
+ * Authors: Nick Spence [EMAIL PROTECTED],
+ *  Scott Wood [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.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#include linux/module.h
+#include linux/types.h
+#include linux/init.h
+#include linux/kernel.h
+#include linux/string.h
+#include linux/ioport.h
+#include linux/of_platform.h
+#include linux/slab.h
+#include linux/interrupt.h
+
+#include linux/mtd/mtd.h
+#include linux/mtd/nand.h
+#include linux/mtd/nand_ecc.h
+#include linux/mtd/partitions.h
+
+#include asm/io.h
+
+
+//#define ELBC_NAND_DEBUG_LVL 6
+
+#ifdef ELBC_NAND_DEBUG_LVL
+static int fcm_debug_level = ELBC_NAND_DEBUG_LVL;
+#define FCM_DEBUG(n, args...)  \
+   do {\
+   if (n = fcm_debug_level)   \
+   pr_dbg(args);   \
+   } while(0)
+#else
+#define FCM_DEBUG(n, dev, args...) do { } while(0)
+#endif
+
+#define MAX_BANKS 8
+#define ERR_BYTE 0xFF /* Value returned for read bytes when read failed */
+#define FCM_TIMEOUT_MSECS 500 /* Maximum number of mSecs to wait for FCM */
+
+struct elbc_bank {
+   u32 br; /** Base Register  */
+#define BR_BA   0x8000
+#define BR_BA_SHIFT 15
+#define BR_PS   0x1800
+#define BR_PS_SHIFT 11
+#define BR_PS_8 0x0800  /* Port Size 8 bit */
+#define BR_PS_160x1000  /* Port Size 16 bit */
+#define BR_PS_320x1800  /* Port Size 32 bit */
+#define BR_DECC 0x0600
+#define BR_DECC_SHIFT9
+#define BR_DECC_OFF 0x  /* HW ECC checking and generation off */
+#define BR_DECC_CHK 0x0200  /* HW ECC checking on, generation off */
+#define BR_DECC_CHK_GEN 0x0400  /* HW ECC checking and generation on */
+#define BR_WP   0x0100
+#define BR_WP_SHIFT  8
+#define BR_MSEL 0x00E0
+#define BR_MSEL_SHIFT5
+#define BR_MS_GPCM  0x  /* GPCM */
+#define BR_MS_FCM   0x0020  /* FCM */
+#define BR_MS_SDRAM 0x0060  /* SDRAM */
+#define BR_MS_UPMA  0x0080  /* UPMA */
+#define BR_MS_UPMB  0x00A0  /* UPMB */
+#define BR_MS_UPMC  0x00C0  /* UPMC */
+#define BR_V0x0001
+#define BR_V_SHIFT   0
+#define BR_RES  ~(BR_BA|BR_PS|BR_DECC|BR_WP|BR_MSEL|BR_V)
+
+   u32 or; /** Base 

Re: [PATCH] IB/ehca: Fix lock flag location, bump version number

2007-12-13 Thread Roland Dreier
applied, thanks
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH 1/4] mpc8313erdb: Fix whitespace.

2007-12-13 Thread Scott Wood
Signed-off-by: Scott Wood [EMAIL PROTECTED]
---
 arch/powerpc/platforms/83xx/mpc8313_rdb.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/platforms/83xx/mpc8313_rdb.c 
b/arch/powerpc/platforms/83xx/mpc8313_rdb.c
index 33766b8..6fb8299 100644
--- a/arch/powerpc/platforms/83xx/mpc8313_rdb.c
+++ b/arch/powerpc/platforms/83xx/mpc8313_rdb.c
@@ -70,9 +70,9 @@ void __init mpc8313_rdb_init_IRQ(void)
  */
 static int __init mpc8313_rdb_probe(void)
 {
-unsigned long root = of_get_flat_dt_root();
+   unsigned long root = of_get_flat_dt_root();
 
-return of_flat_dt_is_compatible(root, MPC8313ERDB);
+   return of_flat_dt_is_compatible(root, MPC8313ERDB);
 }
 
 define_machine(mpc8313_rdb) {
-- 
1.5.3.7

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


[PATCH 4/4] mpc8313erdb: Update defconfig with NOR flash, NAND flash, and JFFS enabled.

2007-12-13 Thread Scott Wood
Signed-off-by: Scott Wood [EMAIL PROTECTED]
---
 arch/powerpc/configs/mpc8313_rdb_defconfig |   45 ---
 1 files changed, 33 insertions(+), 12 deletions(-)

diff --git a/arch/powerpc/configs/mpc8313_rdb_defconfig 
b/arch/powerpc/configs/mpc8313_rdb_defconfig
index c9af905..6942568 100644
--- a/arch/powerpc/configs/mpc8313_rdb_defconfig
+++ b/arch/powerpc/configs/mpc8313_rdb_defconfig
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
 # Linux kernel version: 2.6.24-rc4
-# Thu Dec  6 16:48:31 2007
+# Wed Dec 12 17:01:53 2007
 #
 # CONFIG_PPC64 is not set
 
@@ -336,15 +336,17 @@ CONFIG_PREVENT_FIRMWARE_BUILD=y
 CONFIG_MTD=y
 # CONFIG_MTD_DEBUG is not set
 # CONFIG_MTD_CONCAT is not set
-# CONFIG_MTD_PARTITIONS is not set
+CONFIG_MTD_PARTITIONS=y
+# CONFIG_MTD_REDBOOT_PARTS is not set
+# CONFIG_MTD_CMDLINE_PARTS is not set
+CONFIG_MTD_OF_PARTS=y
 
 #
 # User Modules And Translation Layers
 #
 CONFIG_MTD_CHAR=y
-# CONFIG_MTD_BLKDEVS is not set
-# CONFIG_MTD_BLOCK is not set
-# CONFIG_MTD_BLOCK_RO is not set
+CONFIG_MTD_BLKDEVS=y
+CONFIG_MTD_BLOCK=y
 # CONFIG_FTL is not set
 # CONFIG_NFTL is not set
 # CONFIG_INFTL is not set
@@ -381,11 +383,8 @@ CONFIG_MTD_CFI_UTIL=y
 # Mapping drivers for chip access
 #
 # CONFIG_MTD_COMPLEX_MAPPINGS is not set
-CONFIG_MTD_PHYSMAP=y
-CONFIG_MTD_PHYSMAP_START=0xfe00
-CONFIG_MTD_PHYSMAP_LEN=0x100
-CONFIG_MTD_PHYSMAP_BANKWIDTH=2
-# CONFIG_MTD_PHYSMAP_OF is not set
+# CONFIG_MTD_PHYSMAP is not set
+CONFIG_MTD_PHYSMAP_OF=y
 # CONFIG_MTD_INTEL_VR_NOR is not set
 # CONFIG_MTD_PLATRAM is not set
 
@@ -406,7 +405,17 @@ CONFIG_MTD_PHYSMAP_BANKWIDTH=2
 # CONFIG_MTD_DOC2000 is not set
 # CONFIG_MTD_DOC2001 is not set
 # CONFIG_MTD_DOC2001PLUS is not set
-# CONFIG_MTD_NAND is not set
+CONFIG_MTD_NAND=y
+# CONFIG_MTD_NAND_VERIFY_WRITE is not set
+# CONFIG_MTD_NAND_ECC_SMC is not set
+# CONFIG_MTD_NAND_MUSEUM_IDS is not set
+CONFIG_MTD_NAND_IDS=y
+# CONFIG_MTD_NAND_DISKONCHIP is not set
+# CONFIG_MTD_NAND_CAFE is not set
+# CONFIG_MTD_NAND_NANDSIM is not set
+# CONFIG_MTD_NAND_PLATFORM is not set
+# CONFIG_MTD_ALAUDA is not set
+CONFIG_MTD_NAND_FSL_ELBC=y
 # CONFIG_MTD_ONENAND is not set
 
 #
@@ -1178,7 +1187,17 @@ CONFIG_TMPFS=y
 # CONFIG_BEFS_FS is not set
 # CONFIG_BFS_FS is not set
 # CONFIG_EFS_FS is not set
-# CONFIG_JFFS2_FS is not set
+CONFIG_JFFS2_FS=y
+CONFIG_JFFS2_FS_DEBUG=0
+CONFIG_JFFS2_FS_WRITEBUFFER=y
+# CONFIG_JFFS2_FS_WBUF_VERIFY is not set
+# CONFIG_JFFS2_SUMMARY is not set
+# CONFIG_JFFS2_FS_XATTR is not set
+# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set
+CONFIG_JFFS2_ZLIB=y
+# CONFIG_JFFS2_LZO is not set
+CONFIG_JFFS2_RTIME=y
+# CONFIG_JFFS2_RUBIN is not set
 # CONFIG_CRAMFS is not set
 # CONFIG_VXFS_FS is not set
 # CONFIG_HPFS_FS is not set
@@ -1242,6 +1261,8 @@ CONFIG_BITREVERSE=y
 CONFIG_CRC32=y
 # CONFIG_CRC7 is not set
 # CONFIG_LIBCRC32C is not set
+CONFIG_ZLIB_INFLATE=y
+CONFIG_ZLIB_DEFLATE=y
 CONFIG_PLIST=y
 CONFIG_HAS_IOMEM=y
 CONFIG_HAS_IOPORT=y
-- 
1.5.3.7
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH/RFC] CPM1: implement GPIO API

2007-12-13 Thread Scott Wood
On Thu, Dec 13, 2007 at 03:53:45AM +0300, Anton Vorontsov wrote:
 No. This is how gpio api is working currently. With gpiolib[1], most of
 these functions will be controller-specific. IIRC, gpiolib is still in
 early development stage, so, for now, we have to limit us to one gpio
 chip controller.
 
 This works great for us: CPM, CPM2 and QE shouldn't appear on the single
 crystal.

But at least the latter two should be able to co-exist in a single kernel
image...  Oh well, all we can do is hope the saner API makes it in soon. :-)

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


Re: [PATCH 19/20] [POWERPC] pci32: 4xx embedded platforms want to reassign all PCI resources

2007-12-13 Thread Josh Boyer
On Thu, 13 Dec 2007 18:38:46 +1100
Benjamin Herrenschmidt [EMAIL PROTECTED] wrote:

 This makes 4xx embedded platforms re-assign all PCI resources as we
 pretty much never care about what the various firmwares have done on
 these, it's generally not compatible with the way the kernel will map
 the bridges.
 
 We still need to also enable bus renumbering on some of them, but I
 will do that from a separate patch after I've fixed 4xx PCIe to handle
 all bus numbers.

This one is slightly broken in my opinion.  You've added
the ppc_pci_flags to all of these platforms, which is fine for your
intended goal.  But now all of these platforms _have_ to compile with
PCI enabled or they'll break with:

arch/powerpc/platforms/built-in.o: In function `walnut_probe':
walnut.c:(.init.text+0x9a): undefined reference to `ppc_pci_flags'
walnut.c:(.init.text+0xa6): undefined reference to `ppc_pci_flags'
make[1]: *** [.tmp_vmlinux1] Error 1

So to do it correctly we need to either select CONFIG_PCI for all of
them, wrap the ppc_pci_flags assignment in #ifdef CONFIG_PCI, or move
the ppc_pci_flags variable declaration into something that always gets
compiled.

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


Re: [PATCH 19/20] [POWERPC] pci32: 4xx embedded platforms want to reassign all PCI resources

2007-12-13 Thread Josh Boyer
On Thu, 13 Dec 2007 18:38:46 +1100
Benjamin Herrenschmidt [EMAIL PROTECTED] wrote:

 This makes 4xx embedded platforms re-assign all PCI resources as we
 pretty much never care about what the various firmwares have done on
 these, it's generally not compatible with the way the kernel will map
 the bridges.
 
 We still need to also enable bus renumbering on some of them, but I
 will do that from a separate patch after I've fixed 4xx PCIe to handle
 all bus numbers.
 
 Signed-off-by: Benjamin Herrenschmidt [EMAIL PROTECTED]

[snip]

 Index: linux-work/arch/powerpc/platforms/44x/sequoia.c
 ===
 --- linux-work.orig/arch/powerpc/platforms/44x/sequoia.c  2007-12-10 
 16:51:42.0 +1100
 +++ linux-work/arch/powerpc/platforms/44x/sequoia.c   2007-12-10 
 16:55:06.0 +1100
 @@ -21,7 +21,8 @@
  #include asm/udbg.h
  #include asm/time.h
  #include asm/uic.h
 -#include 44x.h
 +#include asm/pci-bridge.h
 +

Oh, and you also broke the Sequoia build with this change because you
removed the 44x.h include :).

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


Re: [PATCH 1/20] [POWERPC] Reworking machine check handling and Fix 440/440A

2007-12-13 Thread Josh Boyer
On Thu, 13 Dec 2007 18:38:31 +1100
Benjamin Herrenschmidt [EMAIL PROTECTED] wrote:

 This adds a cputable function pointer for the CPU-side machine
 check handling. The semantic is still the same as the old one,
 the one in ppc_md. overrides the one in cputable, though
 ultimately we'll want to change that so the CPU gets first.
 
 This removes CONFIG_440A which was a problem for multiplatform
 kernels and instead fixes up the IVOR at runtime from a setup_cpu
 function. The A version of the machine check also tweaks the
 regs-trap value to differenciate the 2 versions at the C level.

[snip]

 Index: linux-merge/include/asm-ppc/reg_booke.h
 ===
 --- linux-merge.orig/include/asm-ppc/reg_booke.h  2007-12-11 
 16:21:38.0 +1100
 +++ linux-merge/include/asm-ppc/reg_booke.h   2007-12-11 16:23:21.0 
 +1100
 @@ -207,7 +207,7 @@
  #define  CCR1_TCS0x0080 /* Timer Clock Select */
 
  /* Bit definitions for the MCSR. */
 -#ifdef CONFIG_440A
 +#ifdef CONFIG_44x
  #define MCSR_MCS 0x8000 /* Machine Check Summary */
  #define MCSR_IB  0x4000 /* Instruction PLB Error */
  #define MCSR_DRB 0x2000 /* Data Read PLB Error */

This breaks non-44x based arch/ppc platforms.  For example ep405 in
arch/ppc fails with:

/home/jwboyer/src/linux-2.6/arch/ppc/kernel/traps.c: In function 
‘machine_check_440A’:
/home/jwboyer/src/linux-2.6/arch/ppc/kernel/traps.c:260: error: ‘MCSR_IB’ 
undeclared (first use in this function)
/home/jwboyer/src/linux-2.6/arch/ppc/kernel/traps.c:260: error: (Each 
undeclared identifier is reported only once
/home/jwboyer/src/linux-2.6/arch/ppc/kernel/traps.c:260: error: for each 
function it appears in.)
/home/jwboyer/src/linux-2.6/arch/ppc/kernel/traps.c:262: error: ‘MCSR_DRB’ 
undeclared (first use in this function)
/home/jwboyer/src/linux-2.6/arch/ppc/kernel/traps.c:264: error: ‘MCSR_DWB’ 
undeclared (first use in this function)
/home/jwboyer/src/linux-2.6/arch/ppc/kernel/traps.c:266: error: ‘MCSR_TLBP’ 
undeclared (first use in this function)
/home/jwboyer/src/linux-2.6/arch/ppc/kernel/traps.c:268: error: ‘MCSR_ICP’ 
undeclared (first use in this function)
/home/jwboyer/src/linux-2.6/arch/ppc/kernel/traps.c:272: error: ‘MCSR_DCSP’ 
undeclared (first use in this function)
/home/jwboyer/src/linux-2.6/arch/ppc/kernel/traps.c:274: error: ‘MCSR_DCFP’ 
undeclared (first use in this function)
/home/jwboyer/src/linux-2.6/arch/ppc/kernel/traps.c:276: error: ‘MCSR_IMPE’ 
undeclared (first use in this function)
make[2]: *** [arch/ppc/kernel/traps.o] Error 1

The same is true for other platforms as well.  Getting closer...

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

Re: [ofa-general] Re: [ewg] Re: [PATCH] IB/ehca: Serialize HCA-related hCalls on POWER5

2007-12-13 Thread Caitlin Bestler
On Dec 13, 2007 12:30 AM, Or Gerlitz [EMAIL PROTECTED] wrote:
 Roland Dreier wrote:
  I think the right fix for iSER would be to make iSER work even for
  devices that don't support FMRs.  For example cxgb3 doesn't implement
  FMRs so if anyone ever updates iSER to work on iWARP and not just IB,
  then this is something that has to be tackled anyway.  Then ehca could
  just get rid of the FMR support it has.

 OK, The iSER design took into account the case of many initiators
 running on strong/modern machines talking to possibly lightweight
 embedded target for which the processing cost per I/O at the target side
 should be minimized, that is at most --one-- RDMA operation should be
 issued by the target to serve an I/O request.

 For that end, iSER works with one descriptor (called stag in iWARP and
 rkey in IB) per I/O direction sent from the initiator to the target and
 hence can't work without some sort of FMR implementation.

 The current implementation of the open iscsi initiator makes sure to
 issue commands in thread (sleepable) context, see iscsi_xmitworker and
 references to it in drivers/scsi/libiscsi.c , so this keeps ehca users
 safe for the time being.

 Or.


I agree, *some* form of FMR support is important for iSER (and probably
for NFS over RDMA as well). Rather than adding a crippled NO FMR
mode it would make more sense to add support for FMR Work Requests.
I'm not certain what, if any, impact that would have on the Power5 problem,
but that's certainly a cleaner path for iWARP.
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH/RFC] CPM1: implement GPIO API

2007-12-13 Thread Arnd Bergmann
On Thursday 13 December 2007, Scott Wood wrote:
  +}
  +EXPORT_SYMBOL_GPL(gpio_request);
 
 This is an API, not internals; can we stick with plain EXPORT_SYMBOL()?

The architecture independent API posted by David Brownell uses _GPL,
see http://lkml.org/lkml/2007/11/9/141.

I'd vote for _GPL on all new interfaces anyway, but I guess this one
is really David's decision since he came up with the API.

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


Re: apm_emulation regression

2007-12-13 Thread Benjamin Herrenschmidt

On Thu, 2007-12-13 at 12:40 +0100, Johannes Berg wrote:
   That basically means X will break. That's why X broke on the latest
   ubuntu until I whacked some new scripts in them to force console
   switching, among other things. Possibly other apps that relied
   on /dev/apm_bios to be notified of system suspend/resume broke as well.
  
  Ah. I guess I never noticed because I had the scripts to do console
  switching all along.
 
 Actually, it just occurred to me that the *kernel* does a console switch
 when we use /sys/power/state, so maybe that is why I never had a problem
 rather than userspace doing a console switch (which it only started
 doing very recently)

The kernel console switching can be disabled and -is- by some distros.
For example, the problem I was having was when testing Gutsy before it
was final, the script to console switch wasn't in the right place for
powermac and didn't work. X wouldn't be suspended properly and the
machine would lockup.

In general, we should try to fix that, as other things might rely
on /dev/apm_bios doing the right thing.

Ben.


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


Re: [PATCH 19/20] [POWERPC] pci32: 4xx embedded platforms want to reassign all PCI resources

2007-12-13 Thread Benjamin Herrenschmidt

 This one is slightly broken in my opinion.  You've added
 the ppc_pci_flags to all of these platforms, which is fine for your
 intended goal.  But now all of these platforms _have_ to compile with
 PCI enabled or they'll break with:
 
 arch/powerpc/platforms/built-in.o: In function `walnut_probe':
 walnut.c:(.init.text+0x9a): undefined reference to `ppc_pci_flags'
 walnut.c:(.init.text+0xa6): undefined reference to `ppc_pci_flags'
 make[1]: *** [.tmp_vmlinux1] Error 1
 
 So to do it correctly we need to either select CONFIG_PCI for all of
 them, wrap the ppc_pci_flags assignment in #ifdef CONFIG_PCI, or move
 the ppc_pci_flags variable declaration into something that always gets
 compiled.

Hrm... PCI is user selectable ? Forgot about that ...

All those platforms have PCI slots, so we may as well select it in
Kconfig... I'd rather avoid #ifdef's

Ben.

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


Re: [PATCH 19/20] [POWERPC] pci32: 4xx embedded platforms want to reassign all PCI resources

2007-12-13 Thread Josh Boyer
On Fri, 14 Dec 2007 07:37:23 +1100
Benjamin Herrenschmidt [EMAIL PROTECTED] wrote:

 
  This one is slightly broken in my opinion.  You've added
  the ppc_pci_flags to all of these platforms, which is fine for your
  intended goal.  But now all of these platforms _have_ to compile with
  PCI enabled or they'll break with:
  
  arch/powerpc/platforms/built-in.o: In function `walnut_probe':
  walnut.c:(.init.text+0x9a): undefined reference to `ppc_pci_flags'
  walnut.c:(.init.text+0xa6): undefined reference to `ppc_pci_flags'
  make[1]: *** [.tmp_vmlinux1] Error 1
  
  So to do it correctly we need to either select CONFIG_PCI for all of
  them, wrap the ppc_pci_flags assignment in #ifdef CONFIG_PCI, or move
  the ppc_pci_flags variable declaration into something that always gets
  compiled.
 
 Hrm... PCI is user selectable ? Forgot about that ...
 
 All those platforms have PCI slots, so we may as well select it in
 Kconfig... I'd rather avoid #ifdef's

What about people that don't have PCI on their boards, or don't really
care about it?

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


Re: [PATCH 1/20] [POWERPC] Reworking machine check handling and Fix 440/440A

2007-12-13 Thread Benjamin Herrenschmidt

 This breaks non-44x based arch/ppc platforms.  For example ep405 in
 arch/ppc fails with:
 
 /home/jwboyer/src/linux-2.6/arch/ppc/kernel/traps.c: In function 
 ‘machine_check_440A’:
 /home/jwboyer/src/linux-2.6/arch/ppc/kernel/traps.c:260: error: ‘MCSR_IB’ 
 undeclared (first use in this function)
 /home/jwboyer/src/linux-2.6/arch/ppc/kernel/traps.c:260: error: (Each 
 undeclared identifier is reported only once
 /home/jwboyer/src/linux-2.6/arch/ppc/kernel/traps.c:260: error: for each 
 function it appears in.)
 /home/jwboyer/src/linux-2.6/arch/ppc/kernel/traps.c:262: error: ‘MCSR_DRB’ 
 undeclared (first use in this function)
 /home/jwboyer/src/linux-2.6/arch/ppc/kernel/traps.c:264: error: ‘MCSR_DWB’ 
 undeclared (first use in this function)
 /home/jwboyer/src/linux-2.6/arch/ppc/kernel/traps.c:266: error: ‘MCSR_TLBP’ 
 undeclared (first use in this function)
 /home/jwboyer/src/linux-2.6/arch/ppc/kernel/traps.c:268: error: ‘MCSR_ICP’ 
 undeclared (first use in this function)
 /home/jwboyer/src/linux-2.6/arch/ppc/kernel/traps.c:272: error: ‘MCSR_DCSP’ 
 undeclared (first use in this function)
 /home/jwboyer/src/linux-2.6/arch/ppc/kernel/traps.c:274: error: ‘MCSR_DCFP’ 
 undeclared (first use in this function)
 /home/jwboyer/src/linux-2.6/arch/ppc/kernel/traps.c:276: error: ‘MCSR_IMPE’ 
 undeclared (first use in this function)
 make[2]: *** [arch/ppc/kernel/traps.o] Error 1
 
 The same is true for other platforms as well.  Getting closer...

True, I intended to use 4xx not 44x for the ifdef... very easy typo to
make.

Ben.


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

Re: [PATCH 19/20] [POWERPC] pci32: 4xx embedded platforms want to reassign all PCI resources

2007-12-13 Thread Benjamin Herrenschmidt

On Thu, 2007-12-13 at 14:40 -0600, Josh Boyer wrote:
 
   This one is slightly broken in my opinion.  You've added
   the ppc_pci_flags to all of these platforms, which is fine for
 your
   intended goal.  But now all of these platforms _have_ to compile
 with
   PCI enabled or they'll break with:
   
   arch/powerpc/platforms/built-in.o: In function `walnut_probe':
   walnut.c:(.init.text+0x9a): undefined reference to `ppc_pci_flags'
   walnut.c:(.init.text+0xa6): undefined reference to `ppc_pci_flags'
   make[1]: *** [.tmp_vmlinux1] Error 1
   
   So to do it correctly we need to either select CONFIG_PCI for all
 of
   them, wrap the ppc_pci_flags assignment in #ifdef CONFIG_PCI, or
 move
   the ppc_pci_flags variable declaration into something that always
 gets
   compiled.
  
  Hrm... PCI is user selectable ? Forgot about that ...
  
  All those platforms have PCI slots, so we may as well select it in
  Kconfig... I'd rather avoid #ifdef's
 
 What about people that don't have PCI on their boards, or don't really
 care about it?

Then those boards wouldn't be a walnut, ep405, ... right ?

That's why I put the flags in the BSP. If your board has no PCI, don't
muck around with the PCI flags. 

Ben.


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


Re: [ofa-general] Re: [ewg] Re: [PATCH] IB/ehca: Serialize HCA-related hCalls on POWER5

2007-12-13 Thread Joachim Fenkes
[EMAIL PROTECTED] wrote on 13.12.2007 20:22:49:

 On Dec 13, 2007 12:30 AM, Or Gerlitz [EMAIL PROTECTED] wrote:
  The current implementation of the open iscsi initiator makes sure to
  issue commands in thread (sleepable) context, see iscsi_xmitworker and
  references to it in drivers/scsi/libiscsi.c , so this keeps ehca users
  safe for the time being.

 I agree, *some* form of FMR support is important for iSER (and probably
 for NFS over RDMA as well). Rather than adding a crippled NO FMR
 mode it would make more sense to add support for FMR Work Requests.
 I'm not certain what, if any, impact that would have on the Power5 
problem,
 but that's certainly a cleaner path for iWARP.

Well, FMR WRs wouldn't change the eHCA issue -- the driver would have to 
make an hCall in any case, and the architecture says that the hCalls used 
in this scenario might return H_LONG_BUSY, causing the driver to sleep. No 
way around that. Because of this, eHCA's FMRs are actually standard MRs 
with a different API.

If, as Or said, the iSCSI initiator issues commands in sleepable context 
anyway, nothing would be lost by using standard MRs as a fallback solution 
if FMRs aren't available, would it?

J.

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


Re: [PATCH 19/20] [POWERPC] pci32: 4xx embedded platforms want to reassign all PCI resources

2007-12-13 Thread Josh Boyer
On Fri, 14 Dec 2007 07:52:57 +1100
Benjamin Herrenschmidt [EMAIL PROTECTED] wrote:

 
 On Thu, 2007-12-13 at 14:40 -0600, Josh Boyer wrote:
  
This one is slightly broken in my opinion.  You've added
the ppc_pci_flags to all of these platforms, which is fine for
  your
intended goal.  But now all of these platforms _have_ to compile
  with
PCI enabled or they'll break with:

arch/powerpc/platforms/built-in.o: In function `walnut_probe':
walnut.c:(.init.text+0x9a): undefined reference to `ppc_pci_flags'
walnut.c:(.init.text+0xa6): undefined reference to `ppc_pci_flags'
make[1]: *** [.tmp_vmlinux1] Error 1

So to do it correctly we need to either select CONFIG_PCI for all
  of
them, wrap the ppc_pci_flags assignment in #ifdef CONFIG_PCI, or
  move
the ppc_pci_flags variable declaration into something that always
  gets
compiled.
   
   Hrm... PCI is user selectable ? Forgot about that ...
   
   All those platforms have PCI slots, so we may as well select it in
   Kconfig... I'd rather avoid #ifdef's
  
  What about people that don't have PCI on their boards, or don't really
  care about it?
 
 Then those boards wouldn't be a walnut, ep405, ... right ?
 
 That's why I put the flags in the BSP. If your board has no PCI, don't
 muck around with the PCI flags. 

Well, there is physical PCI hardware on the boards, yes.  But what if
people have no intention of using it?  E.g. they have no devices, etc.
Now we're requiring PCI support to be built into the kernel.

I'm just being pedantic about keeping embedded tiny.

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


Re: [PATCH 2/4] mpc8313erdb: Add NAND to device tree, and call of_platform_bus_probe().

2007-12-13 Thread Olof Johansson
On Thu, Dec 13, 2007 at 11:17:14AM -0600, Scott Wood wrote:
 Signed-off-by: Scott Wood [EMAIL PROTECTED]
 diff --git a/arch/powerpc/platforms/83xx/mpc8313_rdb.c 
 b/arch/powerpc/platforms/83xx/mpc8313_rdb.c
 index 6fb8299..3ad482a 100644
 --- a/arch/powerpc/platforms/83xx/mpc8313_rdb.c
 +++ b/arch/powerpc/platforms/83xx/mpc8313_rdb.c
 @@ -14,6 +14,7 @@
   */
  
  #include linux/pci.h
 +#include linux/of_platform.h
  
  #include asm/time.h
  #include asm/ipic.h
 @@ -75,6 +76,22 @@ static int __init mpc8313_rdb_probe(void)
   return of_flat_dt_is_compatible(root, MPC8313ERDB);
  }
  
 +static struct of_device_id __initdata of_bus_ids[] = {
 + { .name = soc8313, },
 + { .name = localbus, },

Please probe based on compatible instead of name properties.


Thanks,

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


RE: [ofa-general] Re: [ewg] Re: [PATCH] IB/ehca: Serialize HCA-related hCalls on POWER5

2007-12-13 Thread Joachim Fenkes
Caitlin Bestler [EMAIL PROTECTED] wrote on 13.12.2007 
22:08:34:

 To clarify, an FMR Work Request is simply posted to the SendQ like
 any other Work Request (of course the QP has to be privileged, or
 it will complete in error). An SQ Post should never block.

This would require hardware support, wouldn't it? eHCA2 doesn't have this 
kind of support, so FMR WRs are not an option here.

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


Re: [PATCH 19/20] [POWERPC] pci32: 4xx embedded platforms want to reassign all PCI resources

2007-12-13 Thread Benjamin Herrenschmidt

On Thu, 2007-12-13 at 15:11 -0600, Josh Boyer wrote:
 Well, there is physical PCI hardware on the boards, yes.  But what if
 people have no intention of using it?  E.g. they have no devices, etc.
 Now we're requiring PCI support to be built into the kernel.
 
 I'm just being pedantic about keeping embedded tiny.

Keeping your embedded design tiny (and thus your own BSP) is one thing,
but adding ifdef's all over the place so that somebody can tinify an
eval board, I'm less sure about this... but if you want, you can fixup
my patches.

Ben.


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


Re: [PATCH 19/20] [POWERPC] pci32: 4xx embedded platforms want to reassign all PCI resources

2007-12-13 Thread Josh Boyer
On Fri, 14 Dec 2007 08:37:26 +1100
Benjamin Herrenschmidt [EMAIL PROTECTED] wrote:

 
 On Thu, 2007-12-13 at 15:11 -0600, Josh Boyer wrote:
  Well, there is physical PCI hardware on the boards, yes.  But what if
  people have no intention of using it?  E.g. they have no devices, etc.
  Now we're requiring PCI support to be built into the kernel.
  
  I'm just being pedantic about keeping embedded tiny.
 
 Keeping your embedded design tiny (and thus your own BSP) is one thing,
 but adding ifdef's all over the place so that somebody can tinify an
 eval board, I'm less sure about this... but if you want, you can fixup
 my patches.

I'm not really advocating for ifdefs.  If it annoys me enough (which I
doubt it will), then I'd try to come up with some way to avoid those
too.  For now, I think selecting PCI in Kconfig for those boards is OK.

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


[PATCH 1/7] bootwrapper: Add a firmware-independent raw target.

2007-12-13 Thread Stephen Neuendorffer
From: Grant Likely [EMAIL PROTECTED]

This target produces a flat binary rather than an ELF file,
fixes the entry point at the beginning of the image, and takes
a complete device tree with no fixups needed.

The device tree must have labels on /#address-cells, the timebase
frequency, and the memory size.

Signed-off-by: Grant Likely [EMAIL PROTECTED]
---
 arch/powerpc/Kconfig |   12 +++
 arch/powerpc/boot/Makefile   |6 -
 arch/powerpc/boot/io.h   |7 ++
 arch/powerpc/boot/raw-platform.c |   41 ++
 arch/powerpc/boot/wrapper|   15 +
 5 files changed, 75 insertions(+), 6 deletions(-)
 create mode 100644 arch/powerpc/boot/raw-platform.c

diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 232c298..4a60ec4 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -394,6 +394,18 @@ config WANT_DEVICE_TREE
bool
default n
 
+config BUILD_RAW_IMAGE
+   bool Build firmware-independent image
+   select WANT_DEVICE_TREE
+   help
+ If this is enabled, a firmware independent raw image will be
+ built, as zImage.raw.  This requires a completely filled-in
+ device tree, with the following labels:
+
+ mem_size_cells: on /#address-cells
+ memsize: on the size portion of /memory/reg
+ timebase: on the boot CPU's timebase property
+
 config DEVICE_TREE
string Static device tree source file
depends on WANT_DEVICE_TREE
diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile
index 18e3271..975e1f5 100644
--- a/arch/powerpc/boot/Makefile
+++ b/arch/powerpc/boot/Makefile
@@ -56,7 +56,7 @@ src-plat := of.c cuboot-52xx.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 
\
-   fixed-head.S ep88xc.c cuboot-hpc2.c
+   fixed-head.S ep88xc.c cuboot-hpc2.c raw-platform.c
 src-boot := $(src-wlib) $(src-plat) empty.c
 
 src-boot := $(addprefix $(obj)/, $(src-boot))
@@ -159,6 +159,7 @@ image-$(CONFIG_EBONY)   += 
treeImage.ebony cuImage.ebony
 image-$(CONFIG_BAMBOO) += treeImage.bamboo cuImage.bamboo
 image-$(CONFIG_SEQUOIA)+= cuImage.sequoia
 image-$(CONFIG_WALNUT) += treeImage.walnut
+image-$(CONFIG_BUILD_RAW_IMAGE)+= zImage.raw
 endif
 
 # For 32-bit powermacs, build the COFF and miboot images
@@ -221,6 +222,9 @@ $(obj)/treeImage.initrd.%: vmlinux $(dts) $(wrapperbits)
 $(obj)/treeImage.%: vmlinux $(dts) $(wrapperbits)
$(call if_changed,wrap,treeboot-$*,$(dts))
 
+$(obj)/zImage.raw: vmlinux $(dts) $(wrapperbits)
+   $(call if_changed,wrap,raw,$(dts))
+
 # If there isn't a platform selected then just strip the vmlinux.
 ifeq (,$(image-y))
 image-y := vmlinux.strip
diff --git a/arch/powerpc/boot/io.h b/arch/powerpc/boot/io.h
index ccaedae..ec57ec9 100644
--- a/arch/powerpc/boot/io.h
+++ b/arch/powerpc/boot/io.h
@@ -99,4 +99,11 @@ static inline void barrier(void)
asm volatile( : : : memory);
 }
 
+static inline void disable_irq(void)
+{
+   int dummy;
+   asm volatile(mfmsr %0; rlwinm %0, %0, 0, ~(115); mtmsr %0 :
+=r (dummy) : : memory);
+}
+
 #endif /* _IO_H */
diff --git a/arch/powerpc/boot/raw-platform.c b/arch/powerpc/boot/raw-platform.c
new file mode 100644
index 000..b9caeee
--- /dev/null
+++ b/arch/powerpc/boot/raw-platform.c
@@ -0,0 +1,41 @@
+/*
+ * The raw platform -- for booting from a complete dtb without
+ * any fixups.
+ *
+ * Author: Scott Wood [EMAIL PROTECTED]
+ *
+ * Copyright (c) 2007 Freescale Semiconductor, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 as published
+ * by the Free Software Foundation.
+ */
+
+#include ops.h
+#include types.h
+#include io.h
+
+BSS_STACK(4096);
+
+/* These are labels in the device tree. */
+extern u32 memsize[2], timebase, mem_size_cells;
+
+void platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
+   unsigned long r6, unsigned long r7)
+{
+   u64 memsize64 = memsize[0];
+
+   if (mem_size_cells == 2) {
+   memsize64 = 32;
+   memsize64 |= memsize[1];
+   }
+
+   if (sizeof(void *) == 4  memsize64 = 0x1ULL)
+   memsize64 = 0x;
+
+   disable_irq();
+   timebase_period_ns = 10 / timebase;
+   simple_alloc_init(_end, memsize64 - (unsigned long)_end, 32, 64);
+   ft_init(_dtb_start, _dtb_end - _dtb_start, 32);
+   serial_console_init();
+}
diff --git a/arch/powerpc/boot/wrapper b/arch/powerpc/boot/wrapper
index 31147a0..716cd44 100755
--- a/arch/powerpc/boot/wrapper
+++ 

[PATCH 2/7] [POWERPC] Xilinx: clear data caches.

2007-12-13 Thread Stephen Neuendorffer
This code is needed to boot without a boot loader.

Grant:  I'm not sure where the right place to put this is.  I'm assuming we'll 
actually need some boot code that is not generic?  Also, note that there is a 
V4FX errata workaround in arch/ppc/boot/head.S, which probably also needs to 
get pulled to powerpc.

Signed-off-by: Stephen Neuendorffer [EMAIL PROTECTED]
---
 arch/powerpc/boot/raw-platform.c |   22 ++
 1 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/arch/powerpc/boot/raw-platform.c b/arch/powerpc/boot/raw-platform.c
index b9caeee..2a5e493 100644
--- a/arch/powerpc/boot/raw-platform.c
+++ b/arch/powerpc/boot/raw-platform.c
@@ -24,6 +24,28 @@ void platform_init(unsigned long r3, unsigned long r4, 
unsigned long r5,
unsigned long r6, unsigned long r7)
 {
u64 memsize64 = memsize[0];
+   static const unsigned long line_size = 32;
+   static const unsigned long congruence_classes = 256;
+   unsigned long addr;
+   unsigned long dccr;
+
+   /*
+* Invalidate the data cache if the data cache is turned off.
+* - The 405 core does not invalidate the data cache on power-up
+*   or reset but does turn off the data cache. We cannot assume
+*   that the cache contents are valid.
+* - If the data cache is turned on this must have been done by
+*   a bootloader and we assume that the cache contents are
+*   valid.
+*/
+   __asm__(mfdccr %0: =r (dccr));
+   if (dccr == 0) {
+   for (addr = 0;
+addr  (congruence_classes * line_size);
+addr += line_size) {
+   __asm__(dccci 0,%0: :b(addr));
+   }
+   }
 
if (mem_size_cells == 2) {
memsize64 = 32;
-- 
1.5.3.4



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


[PATCH 6/7] [POWERPC] Xilinx: Add correct compatible list for device tree bus bindings.

2007-12-13 Thread Stephen Neuendorffer
Includes both flavors of plb, opb, dcr, and a pseudo 'compound' bus
for representing compound peripherals containing more than one logical
device.

Signed-off-by: Stephen Neuendorffer [EMAIL PROTECTED]
---
 arch/powerpc/platforms/40x/virtex.c |   12 +++-
 1 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/arch/powerpc/platforms/40x/virtex.c 
b/arch/powerpc/platforms/40x/virtex.c
index 859ba1d..7590fa5 100644
--- a/arch/powerpc/platforms/40x/virtex.c
+++ b/arch/powerpc/platforms/40x/virtex.c
@@ -15,12 +15,22 @@
 #include asm/time.h
 #include asm/xilinx_intc.h
 
+static struct of_device_id xilinx_of_bus_ids[] = {
+   { .compatible = xlnx,plb-v46-1.00.a, },
+   { .compatible = xlnx,plb-v34-1.01.a, },
+   { .compatible = xlnx,plb-v34-1.02.a, },
+   { .compatible = xlnx,opb-v20-1.10.c, },
+   { .compatible = xlnx,dcr-v29-1.00.a, },
+   { .compatible = xlnx,compound, },
+   {},
+};
+
 static int __init virtex_device_probe(void)
 {
if (!machine_is(virtex))
return 0;
 
-   of_platform_bus_probe(NULL, NULL, NULL);
+   of_platform_bus_probe(NULL, xilinx_of_bus_ids, NULL);
 
return 0;
 }
-- 
1.5.3.4



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


[PATCH 3/7] [POWERPC] Xilinx: Uartlite: Make console output actually work.

2007-12-13 Thread Stephen Neuendorffer
From: Grant Likely [EMAIL PROTECTED]

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

Fixed to apply against 2.6.24-rc5, and remove DEBUG information.

Signed-off-by: Stephen Neuendorffer [EMAIL PROTECTED]
---
 drivers/serial/uartlite.c |  121 +
 1 files changed, 79 insertions(+), 42 deletions(-)

diff --git a/drivers/serial/uartlite.c b/drivers/serial/uartlite.c
index 3f59324..5ec42f3 100644
--- a/drivers/serial/uartlite.c
+++ b/drivers/serial/uartlite.c
@@ -9,6 +9,8 @@
  * kind, whether express or implied.
  */
 
+#undef DEBUG
+
 #include linux/platform_device.h
 #include linux/module.h
 #include linux/console.h
@@ -321,6 +323,49 @@ static struct uart_ops ulite_ops = {
.verify_port= ulite_verify_port
 };
 
+/**
+ * ulite_get_port: Get the uart_port for a given port number and base addr
+ */
+static struct uart_port * ulite_get_port(int id)
+{
+   struct uart_port *port;
+
+   /* if id = -1; then scan for a free id and use that */
+   if (id  0) {
+   for (id = 0; id  ULITE_NR_UARTS; id++)
+   if (ulite_ports[id].mapbase == 0)
+   break;
+   }
+
+   if ((id  0) || (id = ULITE_NR_UARTS)) {
+   printk(KERN_WARNING uartlite: invalid id: %i\n, id);
+   return NULL;
+   }
+
+   /* The ID is valid, so get the address of the uart_port structure */
+   port = ulite_ports[id];
+
+   /* Is the structure is already initialized? */
+   if (port-mapbase)
+   return port;
+
+   /* At this point, we've got an empty uart_port struct, initialize it */
+   spin_lock_init(port-lock);
+   port-membase = NULL;
+   port-fifosize = 16;
+   port-regshift = 2;
+   port-iotype = UPIO_MEM;
+   port-iobase = 1; /* mark port in use */
+   port-ops = ulite_ops;
+   port-irq = NO_IRQ;
+   port-flags = UPF_BOOT_AUTOCONF;
+   port-dev = NULL;
+   port-type = PORT_UNKNOWN;
+   port-line = id;
+
+   return port;
+}
+
 /* -
  * Console driver operations
  */
@@ -376,7 +421,7 @@ static void ulite_console_write(struct console *co, const 
char *s,
 }
 
 #if defined(CONFIG_OF)
-static inline void __init ulite_console_of_find_device(int id)
+static inline u32 __init ulite_console_of_find_device(int id)
 {
struct device_node *np;
struct resource res;
@@ -392,13 +437,14 @@ static inline void __init 
ulite_console_of_find_device(int id)
if (rc)
continue;
 
-   ulite_ports[id].mapbase = res.start;
of_node_put(np);
-   return;
+   return res.start+3;
}
+
+   return 0;
 }
 #else /* CONFIG_OF */
-static inline void __init ulite_console_of_find_device(int id) { /* do nothing 
*/ }
+static inline u32 __init ulite_console_of_find_device(int id) { return 0; }
 #endif /* CONFIG_OF */
 
 static int __init ulite_console_setup(struct console *co, char *options)
@@ -408,25 +454,33 @@ static int __init ulite_console_setup(struct console *co, 
char *options)
int bits = 8;
int parity = 'n';
int flow = 'n';
+   u32 base;
 
-   if (co-index  0 || co-index = ULITE_NR_UARTS)
-   return -EINVAL;
+   /* Find a matching uart port in the device tree */
+   base = ulite_console_of_find_device(co-index);
 
-   port = ulite_ports[co-index];
+   /* Get the port structure */
+   port = ulite_get_port(co-index);
+   if (!port)
+   return -ENODEV;
 
-   /* Check if it is an OF device */
-   if (!port-mapbase)
-   ulite_console_of_find_device(co-index);
+   /* was it initialized for this device? */
+   if (base) {
+   if ((port-mapbase)  (port-mapbase != base)) {
+   pr_debug(KERN_DEBUG ulite: addr mismatch; %x != %x\n,
+port-mapbase, base);
+   return -ENODEV; /* port used by another device; bail */
+   }
+   port-mapbase = base;
+   }
 
-   /* Do we have a device now? */
-   if (!port-mapbase) {
-   pr_debug(console on ttyUL%i not present\n, co-index);
+   if (!port-mapbase)
return -ENODEV;
-   }
 
-   /* not initialized yet? */
+   /* registers mapped yet? */
if (!port-membase) {
-   if (ulite_request_port(port))
+   port-membase = ioremap(port-mapbase, ULITE_REGION);
+   if (!port-membase)
return -ENODEV;
}
 
@@ -488,39 +542,22 @@ static int __devinit ulite_assign(struct device *dev, int 
id, u32 base, int irq)
struct uart_port *port;
int rc;
 
-   /* if id = -1; then scan for a free id and use that */
-   if (id  0) {
-   for (id = 0; id  ULITE_NR_UARTS; id++)
-  

[PATCH 4/7] [POWERPC] Xilinx: update compatible list for interrupt controller

2007-12-13 Thread Stephen Neuendorffer
These values now match what is generated by the uboot BSP generator.

Signed-off-by: Stephen Neuendorffer [EMAIL PROTECTED]
---
 arch/powerpc/sysdev/xilinx_intc.c |8 +++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/arch/powerpc/sysdev/xilinx_intc.c 
b/arch/powerpc/sysdev/xilinx_intc.c
index c2f17cc..10345dd 100644
--- a/arch/powerpc/sysdev/xilinx_intc.c
+++ b/arch/powerpc/sysdev/xilinx_intc.c
@@ -135,10 +135,16 @@ void __init xilinx_intc_init_tree(void)
struct device_node *np;
 
/* find top level interrupt controller */
-   for_each_compatible_node(np, NULL, xilinx,intc) {
+   for_each_compatible_node(np, NULL, xlnx,opb-intc-1.00.c) {
if (!of_get_property(np, interrupts, NULL))
break;
}
+if(!np) {
+   for_each_compatible_node(np, NULL, xlnx,xps-intc-1.00.a) {
+   if (!of_get_property(np, interrupts, NULL))
+   break;
+   }
+}
 
/* xilinx interrupt controller needs to be top level */
BUG_ON(!np);
-- 
1.5.3.4



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


[PATCH 5/7] [POWERPC] Xilinx: Update compatible to use values generated by BSP generator.

2007-12-13 Thread Stephen Neuendorffer
Mainly, this involves two changes:
1) xilinx-xlnx (recognized standard is to use the stock ticker)
2) In order to have the device tree focus on describing what the hardware is as 
exactly as possible, the compatible strings contain the full IP name and IP 
version.

Signed-off-by: Stephen Neuendorffer [EMAIL PROTECTED]
---
 arch/powerpc/platforms/40x/virtex.c |2 +-
 drivers/block/xsysace.c |4 ++-
 drivers/serial/uartlite.c   |   42 +-
 drivers/video/xilinxfb.c|2 +-
 4 files changed, 31 insertions(+), 19 deletions(-)

diff --git a/arch/powerpc/platforms/40x/virtex.c 
b/arch/powerpc/platforms/40x/virtex.c
index 14bbc32..859ba1d 100644
--- a/arch/powerpc/platforms/40x/virtex.c
+++ b/arch/powerpc/platforms/40x/virtex.c
@@ -30,7 +30,7 @@ static int __init virtex_probe(void)
 {
unsigned long root = of_get_flat_dt_root();
 
-   if (!of_flat_dt_is_compatible(root, xilinx,virtex))
+   if (!of_flat_dt_is_compatible(root, xlnx,virtex))
return 0;
 
return 1;
diff --git a/drivers/block/xsysace.c b/drivers/block/xsysace.c
index 82effce..45bc51b 100644
--- a/drivers/block/xsysace.c
+++ b/drivers/block/xsysace.c
@@ -1208,7 +1208,9 @@ static int __devexit ace_of_remove(struct of_device *op)
 
 /* Match table for of_platform binding */
 static struct of_device_id __devinit ace_of_match[] = {
-   { .compatible = xilinx,xsysace, },
+   { .compatible = xlnx,opb-sysace-1.00.b, },
+   { .compatible = xlnx,opb-sysace-1.00.c, },
+   { .compatible = xlnx,xps-sysace-1.00.a, },
{},
 };
 MODULE_DEVICE_TABLE(of, ace_of_match);
diff --git a/drivers/serial/uartlite.c b/drivers/serial/uartlite.c
index 5ec42f3..6536cc7 100644
--- a/drivers/serial/uartlite.c
+++ b/drivers/serial/uartlite.c
@@ -21,8 +21,18 @@
 #include linux/interrupt.h
 #include asm/io.h
 #if defined(CONFIG_OF)
+#include linux/of.h
 #include linux/of_device.h
 #include linux/of_platform.h
+
+/* Match table for of_platform binding */
+static struct of_device_id __devinit ulite_of_match[] = {
+   { .type = serial, .compatible = xlnx,opb-uartlite-1.00.b, },
+   { .type = serial, .compatible = xlnx,xps-uartlite-1.00.a, },
+   {},
+};
+MODULE_DEVICE_TABLE(of, ulite_of_match);
+
 #endif
 
 #define ULITE_NAME ttyUL
@@ -427,18 +437,25 @@ static inline u32 __init ulite_console_of_find_device(int 
id)
struct resource res;
const unsigned int *of_id;
int rc;
+const struct of_device_id *matches = ulite_of_match;
+
+   while (matches-compatible[0]) {
+   for_each_compatible_node(np, NULL, matches-compatible) {
+   if (!of_match_node(matches, np))
+   continue;
 
-   for_each_compatible_node(np, NULL, xilinx,uartlite) {
-   of_id = of_get_property(np, port-number, NULL);
-   if ((!of_id) || (*of_id != id))
-   continue;
+   of_id = of_get_property(np, port-number, NULL);
+   if ((!of_id) || (*of_id != id))
+   continue;
 
-   rc = of_address_to_resource(np, 0, res);
-   if (rc)
-   continue;
+   rc = of_address_to_resource(np, 0, res);
+   if (rc)
+   continue;
 
-   of_node_put(np);
-   return res.start+3;
+of_node_put(np);
+return res.start+3;
+   }
+   matches++;
}
 
return 0;
@@ -654,13 +671,6 @@ static int __devexit ulite_of_remove(struct of_device *op)
return ulite_release(op-dev);
 }
 
-/* Match table for of_platform binding */
-static struct of_device_id __devinit ulite_of_match[] = {
-   { .type = serial, .compatible = xilinx,uartlite, },
-   {},
-};
-MODULE_DEVICE_TABLE(of, ulite_of_match);
-
 static struct of_platform_driver ulite_of_driver = {
.owner = THIS_MODULE,
.name = uartlite,
diff --git a/drivers/video/xilinxfb.c b/drivers/video/xilinxfb.c
index e38d3b7..9b426d3 100644
--- a/drivers/video/xilinxfb.c
+++ b/drivers/video/xilinxfb.c
@@ -460,7 +460,7 @@ static int __devexit xilinxfb_of_remove(struct of_device 
*op)
 
 /* Match table for of_platform binding */
 static struct of_device_id __devinit xilinxfb_of_match[] = {
-   { .compatible = xilinx,ml300-fb, },
+   { .compatible = xlnx,plb-tft-cntlr-ref-1.00.a, },
{},
 };
 MODULE_DEVICE_TABLE(of, xilinxfb_of_match);
-- 
1.5.3.4



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


[PATCH 7/7] [POWERPC] Xilinx: Update booting-without-of.

2007-12-13 Thread Stephen Neuendorffer
This now better describes what the UBoot device tree generator actually does.  
In particular:

1) Nodes have a label derived from the device name, and a node name
derived from the device type.
2) Usage of compound nodes (representing more than one device in the same IP) 
which actually works.  This requires having a valid compatible node, and all 
the other things that a bus normally has.  I've chosen 'xlnx,compound' as the 
bus name to describe these compound nodes.
3) Uartlite requires a port-number property for the console to work.

In addition, I've clarified some of the language relating to how mhs
nodes should be represent in the device tree.
---
 Documentation/powerpc/booting-without-of.txt |   61 +++---
 1 files changed, 36 insertions(+), 25 deletions(-)

diff --git a/Documentation/powerpc/booting-without-of.txt 
b/Documentation/powerpc/booting-without-of.txt
index e9a3cb1..5e2b85a 100644
--- a/Documentation/powerpc/booting-without-of.txt
+++ b/Documentation/powerpc/booting-without-of.txt
@@ -2276,7 +2276,7 @@ platforms are moved over to use the flattened-device-tree 
model.
properties of the device node.  In general, device nodes for IP-cores
will take the following form:
 
-   (name)@(base-address) {
+   (name): (ip-core-name)@(base-address) {
compatible = xlnx,(ip-core-name)-(HW_VER)
 [, (list of compatible devices), ...];
reg = (baseaddr) (size);
@@ -2294,9 +2294,9 @@ platforms are moved over to use the flattened-device-tree 
model.
dropped from the parameter name, the name is converted
to lowercase and all underscore '_' characters are
converted to dashes '-'.
-   (baseaddr): the C_BASEADDR parameter.
+   (baseaddr): the baseaddr parameter value (often named C_BASEADDR).
(HW_VER):   from the HW_VER parameter.
-   (size): equals C_HIGHADDR - C_BASEADDR + 1
+   (size): the address range size (often C_HIGHADDR - C_BASEADDR + 
1).
 
Typically, the compatible list will include the exact IP core version
followed by an older IP core version which implements the same
@@ -2326,12 +2326,13 @@ platforms are moved over to use the 
flattened-device-tree model.
 
becomes the following device tree node:
 
-   [EMAIL PROTECTED] {
+   opb_uartlite_0: [EMAIL PROTECTED] {
device_type = serial;
compatible = xlnx,opb-uartlite-1.00.b;
reg = ec10 1;
-   interrupt-parent = opb-intc;
+   interrupt-parent = opb_intc_0;
interrupts = 1 0; // got this from the opb_intc parameters
+   port-number = 0;
current-speed = d#115200; // standard serial device prop
clock-frequency = d#5000; // standard serial device prop
xlnx,data-bits = 8;
@@ -2339,16 +2340,19 @@ platforms are moved over to use the 
flattened-device-tree model.
xlnx,use-parity = 0;
};
 
-   Some IP cores actually implement 2 or more logical devices.  In this case,
-   the device should still describe the whole IP core with a single node
-   and add a child node for each logical device.  The ranges property can
-   be used to translate from parent IP-core to the registers of each device.
-   (Note: this makes the assumption that both logical devices have the same
-   bus binding.  If this is not true, then separate nodes should be used for
-   each logical device).  The 'cell-index' property can be used to enumerate
-   logical devices within an IP core.  For example, the following is the
-   system.mhs entry for the dual ps2 controller found on the ml403 reference
-   design.
+   Some IP cores actually implement 2 or more logical devices.  In
+   this case, the device should still describe the whole IP core with
+   a single node and add a child node for each logical device.  The
+   ranges property can be used to translate from parent IP-core to the
+   registers of each device.  In addition, the parent node should be
+   compatible with the bus type 'xlnx,compound', and should contain
+   #address-cells and #size-cells, as with any other bus.  (Note: this
+   makes the assumption that both logical devices have the same bus
+   binding.  If this is not true, then separate nodes should be used
+   for each logical device).  The 'cell-index' property can be used to
+   enumerate logical devices within an IP core.  For example, the
+   following is the system.mhs entry for the dual ps2 controller found
+   on the ml403 reference design.
 
BEGIN opb_ps2_dual_ref
PARAMETER INSTANCE = opb_ps2_dual_ref_0
@@ -2370,21 +2374,24 @@ platforms are moved over to use the 
flattened-device-tree model.
 
It would result in the following device tree nodes:
 
-   [EMAIL PROTECTED] {
+   opb_ps2_dual_ref_0: [EMAIL PROTECTED] 

RE: [ofa-general] Re: [ewg] Re: [PATCH] IB/ehca: SerializeHCA-related hCalls on POWER5

2007-12-13 Thread Sean Hefty
To clarify, an FMR Work Request is simply posted to the SendQ like
any other Work Request (of course the QP has to be privileged, or
it will complete in error). An SQ Post should never block.

FMR's as defined by the IB spec and that created by Mellanox are not the same.
They, unfortunately, use the same name and acronym only.  Mellanox FMRs use an
API that is more like that of standard MRs. 

- Sean

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


Re: apm_emulation regression

2007-12-13 Thread Benjamin Herrenschmidt

On Fri, 2007-12-14 at 11:04 +1100, Benjamin Herrenschmidt wrote:
 On Fri, 2007-12-14 at 01:10 +0100, Rafael J. Wysocki wrote:
  
  Hmm.
  
  I'm not that familiar with the APM emulation code, but the description
  of the
  problem above suggests that the APM emulation can install a suspend
  notifier for this purpose.
 
 It can use the new notifier that happens before freezing yes. Johannes,
 I think that's pretty much what my old powermac implementation did
 (using my private notifier scheme I had there), might be worth reviving
 that bit and sticking it into the generic apm_emu ...

Note that you may want to improve on it with a timeout in case userspace
doesn't ack...

Ben.


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


Re: apm_emulation regression

2007-12-13 Thread Benjamin Herrenschmidt

On Fri, 2007-12-14 at 01:10 +0100, Rafael J. Wysocki wrote:
 
 Hmm.
 
 I'm not that familiar with the APM emulation code, but the description
 of the
 problem above suggests that the APM emulation can install a suspend
 notifier for this purpose.

It can use the new notifier that happens before freezing yes. Johannes,
I think that's pretty much what my old powermac implementation did
(using my private notifier scheme I had there), might be worth reviving
that bit and sticking it into the generic apm_emu ...

Ben.


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


Re: apm_emulation regression

2007-12-13 Thread Rafael J. Wysocki
On Wednesday, 12 of December 2007, Johannes Berg wrote:
 
 On Wed, 2007-12-12 at 13:45 +1100, Benjamin Herrenschmidt wrote:
  I only just noticed a huge regression that was introduced when we moved
  PowerPC to the generic APM emulation code instead of our own. I'm in
  large part to blame since I acked the patch...
  
  Basically, what we lost is the mechanism for notifying user applications
  and waiting for their ACK before proceeding to system suspend. The new
  generic code will still do that ... only when the actual suspend request
  initiates from an APM suspend ioctl.
 
 Indeed.
 
  For any other suspend (via our private PMU ioctl or via the sysfs
  interface), userspace will -not- be notified.
 
 Right.
 
  That basically means X will break. That's why X broke on the latest
  ubuntu until I whacked some new scripts in them to force console
  switching, among other things. Possibly other apps that relied
  on /dev/apm_bios to be notified of system suspend/resume broke as well.
 
 Ah. I guess I never noticed because I had the scripts to do console
 switching all along.
 
  Now the question is that is it still work trying to fix it ? That would
  probably require APM emulation hooking at a fairly high level into the
  generic PM code to trigger the signaling  waiting of processes before
  freeze  device suspend among others...
 
 Yeah, bit icky... but doable. Rafael, any ideas?

Hmm.

I'm not that familiar with the APM emulation code, but the description of the
problem above suggests that the APM emulation can install a suspend
notifier for this purpose.

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


Re: [PATCH 2/7] [POWERPC] Xilinx: clear data caches.

2007-12-13 Thread Benjamin Herrenschmidt

On Fri, 2007-12-14 at 11:07 +1100, Benjamin Herrenschmidt wrote:
 On Thu, 2007-12-13 at 15:43 -0800, Stephen Neuendorffer wrote:
  This code is needed to boot without a boot loader.
  
  Grant:  I'm not sure where the right place to put this is.  I'm assuming 
  we'll actually need some boot code that is not generic?  Also, note that 
  there is a V4FX errata workaround in arch/ppc/boot/head.S, which probably 
  also needs to get pulled to powerpc.
  
  Signed-off-by: Stephen Neuendorffer [EMAIL PROTECTED]
  ---
   arch/powerpc/boot/raw-platform.c |   22 ++
   1 files changed, 22 insertions(+), 0 deletions(-)
 
 This raw-platform.c file doesn't seem like a good place for code that is
 totally platform specific ...

Maybe best is to do that in asm ? The problem when you are in C code is
that you may already have hit stale cache entries. raw platforms
probably need to perform various CPU-specific initializations anyway,
prior to entering C code, in a custom crt0.S, so that's probably the
best place to do the cache clearing.

Ben.

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


RE: [PATCH 2/7] [POWERPC] Xilinx: clear data caches.

2007-12-13 Thread Stephen Neuendorffer

Unfortunately, I think your right... The asm code seems so clean at the
moment, I don't really want be the one to start tarnishing it with a
bunch of little fixups.. :)

Steve

 -Original Message-
 From: Benjamin Herrenschmidt [mailto:[EMAIL PROTECTED] 
 Sent: Thursday, December 13, 2007 4:10 PM
 To: Stephen Neuendorffer
 Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]; 
 [EMAIL PROTECTED]; linuxppc-dev@ozlabs.org
 Subject: Re: [PATCH 2/7] [POWERPC] Xilinx: clear data caches.
 
 
 On Fri, 2007-12-14 at 11:07 +1100, Benjamin Herrenschmidt wrote:
  On Thu, 2007-12-13 at 15:43 -0800, Stephen Neuendorffer wrote:
   This code is needed to boot without a boot loader.
   
   Grant:  I'm not sure where the right place to put this 
 is.  I'm assuming we'll actually need some boot code that is 
 not generic?  Also, note that there is a V4FX errata 
 workaround in arch/ppc/boot/head.S, which probably also needs 
 to get pulled to powerpc.
   
   Signed-off-by: Stephen Neuendorffer 
 [EMAIL PROTECTED]
   ---
arch/powerpc/boot/raw-platform.c |   22 ++
1 files changed, 22 insertions(+), 0 deletions(-)
  
  This raw-platform.c file doesn't seem like a good place for 
 code that is
  totally platform specific ...
 
 Maybe best is to do that in asm ? The problem when you are in 
 C code is
 that you may already have hit stale cache entries. raw platforms
 probably need to perform various CPU-specific initializations anyway,
 prior to entering C code, in a custom crt0.S, so that's probably the
 best place to do the cache clearing.
 
 Ben.
 
 
 

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


Re: [PATCH] ipic: ack only for edge interrupts

2007-12-13 Thread Kumar Gala

On Dec 4, 2007, at 5:01 AM, Li Yang wrote:

 Only external interrupts in edge detect mode support ack operation.
 Therefore, in most cases ack is not needed.  The patch makes ipic
 ack only when it's needed.  This could boost over all system  
 performance.

 Signed-off-by: Li Yang [EMAIL PROTECTED]
 Cc: Benjamin Herrenschmidt [EMAIL PROTECTED]
 ---
 Update to use different irq_chip for level and edge interrupts as Ben
 suggested.
 Supercedes [PATCH] ipic: change ack operation that register is  
 accessed
 only when needed

 arch/powerpc/sysdev/ipic.c |  113  
 +---
 arch/powerpc/sysdev/ipic.h |6 +--
 2 files changed, 45 insertions(+), 74 deletions(-)

applied.

- k

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


[PATCH 0/6] xics.c and time.c optimizations

2007-12-13 Thread Milton Miller
The following patches against for-2.2.25 do some optimizations related
to the usage smp_processor_id().  

The xics one has been tested on SMP on 2.6.23, and still applies cleanly.

In time.c I started with the per_cpu to __get_cpu_var transformations
which affect ppc64 (the calls were added in 2.6.24), and from there
went looking for redundant global accesses from objdump -d --reloc.
I primarly looked at the pseries_defconfig and checked the results on
chrp32_defconfig.

Optimization results were checked on debian using

gcc version 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)

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


[PATCH 1/6] push down or eliminate smp_processor_id in xics

2007-12-13 Thread Milton Miller
Delay callling smp_processor_id until its needed.

The per-processor interrupt request register and current processor 
priority register are only accessed on the current cpu.  In fact the
hypervisor doesn't even let us choose this.

The only function to use cpu twice is xics_migrate_irqs_away, not a fast
path.  But we can cache the result of get_hard_processor_id() instead of
calling get_hard_smp_processor_id(cpu) in a loop across the call to rtas.

Years ago the irq code passed smp_processor_id into get_irq, I thought
we might initialize the CPPR third party at boot as an extra measure of
saftey, and it made the code symetric with the qirr (queued interrupt for
software generated interrupts), but now it is just extra and sometimes
unneeded work to pass it down.

Signed-off-by: Milton Miller [EMAIL PROTECTED]
---

Index: kernel/arch/powerpc/platforms/pseries/xics.c
===
--- kernel.orig/arch/powerpc/platforms/pseries/xics.c   2007-10-10 
03:44:55.0 -0500
+++ kernel/arch/powerpc/platforms/pseries/xics.c2007-10-10 
04:28:58.0 -0500
@@ -87,19 +87,25 @@ static int ibm_int_off;
 /* Direct HW low level accessors */
 
 
-static inline unsigned int direct_xirr_info_get(int n_cpu)
+static inline unsigned int direct_xirr_info_get(void)
 {
-   return in_be32(xics_per_cpu[n_cpu]-xirr.word);
+   int cpu = smp_processor_id();
+
+   return in_be32(xics_per_cpu[cpu]-xirr.word);
 }
 
-static inline void direct_xirr_info_set(int n_cpu, int value)
+static inline void direct_xirr_info_set(int value)
 {
-   out_be32(xics_per_cpu[n_cpu]-xirr.word, value);
+   int cpu = smp_processor_id();
+
+   out_be32(xics_per_cpu[cpu]-xirr.word, value);
 }
 
-static inline void direct_cppr_info(int n_cpu, u8 value)
+static inline void direct_cppr_info(u8 value)
 {
-   out_8(xics_per_cpu[n_cpu]-xirr.bytes[0], value);
+   int cpu = smp_processor_id();
+
+   out_8(xics_per_cpu[cpu]-xirr.bytes[0], value);
 }
 
 static inline void direct_qirr_info(int n_cpu, u8 value)
@@ -111,7 +117,7 @@ static inline void direct_qirr_info(int 
 /* LPAR low level accessors */
 
 
-static inline unsigned int lpar_xirr_info_get(int n_cpu)
+static inline unsigned int lpar_xirr_info_get(void)
 {
unsigned long lpar_rc;
unsigned long return_value;
@@ -122,7 +128,7 @@ static inline unsigned int lpar_xirr_inf
return (unsigned int)return_value;
 }
 
-static inline void lpar_xirr_info_set(int n_cpu, int value)
+static inline void lpar_xirr_info_set(int value)
 {
unsigned long lpar_rc;
unsigned long val64 = value  0x;
@@ -133,7 +139,7 @@ static inline void lpar_xirr_info_set(in
  val64);
 }
 
-static inline void lpar_cppr_info(int n_cpu, u8 value)
+static inline void lpar_cppr_info(u8 value)
 {
unsigned long lpar_rc;
 
@@ -275,21 +281,19 @@ static unsigned int xics_startup(unsigne
 
 static void xics_eoi_direct(unsigned int virq)
 {
-   int cpu = smp_processor_id();
unsigned int irq = (unsigned int)irq_map[virq].hwirq;
 
iosync();
-   direct_xirr_info_set(cpu, (0xff  24) | irq);
+   direct_xirr_info_set((0xff  24) | irq);
 }
 
 
 static void xics_eoi_lpar(unsigned int virq)
 {
-   int cpu = smp_processor_id();
unsigned int irq = (unsigned int)irq_map[virq].hwirq;
 
iosync();
-   lpar_xirr_info_set(cpu, (0xff  24) | irq);
+   lpar_xirr_info_set((0xff  24) | irq);
 }
 
 static inline unsigned int xics_remap_irq(unsigned int vec)
@@ -312,16 +316,12 @@ static inline unsigned int xics_remap_ir
 
 static unsigned int xics_get_irq_direct(void)
 {
-   unsigned int cpu = smp_processor_id();
-
-   return xics_remap_irq(direct_xirr_info_get(cpu));
+   return xics_remap_irq(direct_xirr_info_get());
 }
 
 static unsigned int xics_get_irq_lpar(void)
 {
-   unsigned int cpu = smp_processor_id();
-
-   return xics_remap_irq(lpar_xirr_info_get(cpu));
+   return xics_remap_irq(lpar_xirr_info_get());
 }
 
 #ifdef CONFIG_SMP
@@ -387,12 +387,12 @@ void xics_cause_IPI(int cpu)
 
 #endif /* CONFIG_SMP */
 
-static void xics_set_cpu_priority(int cpu, unsigned char cppr)
+static void xics_set_cpu_priority(unsigned char cppr)
 {
if (firmware_has_feature(FW_FEATURE_LPAR))
-   lpar_cppr_info(cpu, cppr);
+   lpar_cppr_info(cppr);
else
-   direct_cppr_info(cpu, cppr);
+   direct_cppr_info(cppr);
iosync();
 }
 
@@ -440,9 +440,7 @@ static void xics_set_affinity(unsigned i
 
 void xics_setup_cpu(void)
 {
-   int cpu = smp_processor_id();
-
-   xics_set_cpu_priority(cpu, 0xff);
+   xics_set_cpu_priority(0xff);
 
/*
 * Put the calling processor into the GIQ.  This is really only
@@ -783,7 +781,7 @@ void xics_teardown_cpu(int secondary)
unsigned int ipi;
struct irq_desc *desc;
 
-   xics_set_cpu_priority(cpu, 0);
+

[PATCH 3/6] use __get_cpu_var in time.c

2007-12-13 Thread Milton Miller
use __get_cpu_var(x) instead of per_cpu(x, smp_processor_id()), as it
is optimied on ppc64 to access the current cpus per-cpu offset directly.

Its local_paca.offset instead of TOC-paca[local_paca-processor_id].offset.

This is the trivial portion, two functions with one use each.

Signed-off-by: Milton Miller [EMAIL PROTECTED]
---
Index: kernel/arch/powerpc/kernel/time.c
===
--- kernel.orig/arch/powerpc/kernel/time.c  2007-12-13 20:37:03.0 
-0600
+++ kernel/arch/powerpc/kernel/time.c   2007-12-13 20:37:03.0 -0600
@@ -327,7 +327,7 @@ void calculate_steal_time(void)
 
if (!cpu_has_feature(CPU_FTR_PURR))
return;
-   pme = per_cpu(cpu_purr_data, smp_processor_id());
+   pme = __get_cpu_var(cpu_purr_data);
if (!pme-initialized)
return; /* this can happen in early boot */
tb = mftb();
@@ -352,7 +352,7 @@ static void snapshot_purr(void)
if (!cpu_has_feature(CPU_FTR_PURR))
return;
local_irq_save(flags);
-   pme = per_cpu(cpu_purr_data, smp_processor_id());
+   pme = __get_cpu_var(cpu_purr_data);
pme-tb = mftb();
pme-purr = mfspr(SPRN_PURR);
pme-initialized = 1;
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH 4/6] timer interrupt: use a struct for two per_cpu varables

2007-12-13 Thread Milton Miller
timer_interrupt was calculating per_cpu_offset several times, having to
start from the toc because of potential aliasing issues.

Placing both decrementer per_cpu varables in a struct and calculating
the address once with __get_cpu_var results in better code on both 32
and 64 bit.

Signed-off-by: Milton Miller [EMAIL PROTECTED]
---
Index: kernel/arch/powerpc/kernel/time.c
===
--- kernel.orig/arch/powerpc/kernel/time.c  2007-12-13 17:56:37.0 
-0600
+++ kernel/arch/powerpc/kernel/time.c   2007-12-13 18:07:13.0 -0600
@@ -116,8 +116,12 @@ static struct clock_event_device decreme
.features   = CLOCK_EVT_FEAT_ONESHOT,
 };
 
-static DEFINE_PER_CPU(struct clock_event_device, decrementers);
-static DEFINE_PER_CPU(u64, decrementer_next_tb);
+struct decrementer_clock {
+   struct clock_event_device event;
+   u64 next_tb;
+};
+
+static DEFINE_PER_CPU(struct decrementer_clock, decrementers);
 
 #ifdef CONFIG_PPC_ISERIES
 static unsigned long __initdata iSeries_recal_titan;
@@ -555,8 +559,8 @@ void __init iSeries_time_init_early(void
 void timer_interrupt(struct pt_regs * regs)
 {
struct pt_regs *old_regs;
-   int cpu = smp_processor_id();
-   struct clock_event_device *evt = per_cpu(decrementers, cpu);
+   struct decrementer_clock *decrementer =  __get_cpu_var(decrementers);
+   struct clock_event_device *evt = decrementer-event;
u64 now;
 
/* Ensure a positive value is written to the decrementer, or else
@@ -569,9 +573,9 @@ void timer_interrupt(struct pt_regs * re
 #endif
 
now = get_tb_or_rtc();
-   if (now  per_cpu(decrementer_next_tb, cpu)) {
+   if (now  decrementer-next_tb) {
/* not time for this event yet */
-   now = per_cpu(decrementer_next_tb, cpu) - now;
+   now = decrementer-next_tb - now;
if (now = DECREMENTER_MAX)
set_dec((int)now);
return;
@@ -810,7 +814,7 @@ void __init clocksource_init(void)
 static int decrementer_set_next_event(unsigned long evt,
  struct clock_event_device *dev)
 {
-   __get_cpu_var(decrementer_next_tb) = get_tb_or_rtc() + evt;
+   __get_cpu_var(decrementers).next_tb = get_tb_or_rtc() + evt;
set_dec(evt);
return 0;
 }
@@ -824,7 +828,7 @@ static void decrementer_set_mode(enum cl
 
 static void register_decrementer_clockevent(int cpu)
 {
-   struct clock_event_device *dec = per_cpu(decrementers, cpu);
+   struct clock_event_device *dec = per_cpu(decrementers, cpu).event;
 
*dec = decrementer_clockevent;
dec-cpumask = cpumask_of_cpu(cpu);
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH 5/6] depend on -initialized in calc_steal_time

2007-12-13 Thread Milton Miller
If CPU_FTR_PURR is not set, we will never set cpu_purr_data-initialized.
Checking via __get_cpu_var on 64 bit avoids one dependent load compared
to cpu_has_feature in the not present case, and is always required when
it is present.  The code is under CONFIG_VIRT_CPU_ACCOUNTING so 32 bit
will not be affected.

Signed-off-by: Milton Miller [EMAIL PROTECTED]
---
Index: kernel/arch/powerpc/kernel/time.c
===
--- kernel.orig/arch/powerpc/kernel/time.c  2007-12-13 18:16:10.0 
-0600
+++ kernel/arch/powerpc/kernel/time.c   2007-12-13 18:23:55.0 -0600
@@ -329,11 +329,9 @@ void calculate_steal_time(void)
s64 stolen;
struct cpu_purr_data *pme;
 
-   if (!cpu_has_feature(CPU_FTR_PURR))
-   return;
pme = __get_cpu_var(cpu_purr_data);
if (!pme-initialized)
-   return; /* this can happen in early boot */
+   return; /* !CPU_FTR_PURR or early in early boot */
tb = mftb();
purr = mfspr(SPRN_PURR);
stolen = (tb - pme-tb) - (purr - pme-purr);
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH 6/6] optimize account_system_vtime

2007-12-13 Thread Milton Miller
We have multiple calls to has_feature being inlined, but gcc can't
be sure that the store via get_paca() doesn't alias the path to
cur_cpu_spec-feature.

Reorder to put the calls to read_purr and read_spurr adjacent to each
other.  To add a sense of consistency, reorder the remaining lines to
perform parallel steps on purr and scaled purr of each line instead of
calculating and then using one value before going on to the next.

In addition, we can tell gcc that no SPURR means no PURR.  The test is
completely hidden in the PURR case, and in the !PURR case the second test
is eliminated resulting in the simple register copy in the out-of-line
branch.

Further, gcc sees get_paca()-system_time referenced several times and
allocates a register to address it (shadowing r13) instead of caching its
value.  Reading into a local varable saves the shadow of r13 and removes
a potentially duplicate load (between the nested if and its parent).

Signed-off-by: Milton Miller [EMAIL PROTECTED]
---
The purr and spurr fields of the paca are only used in this c code,
but system_time and user_time are also used in asm and I decided to
leave all of these fields in the paca.

Index: kernel/arch/powerpc/kernel/time.c
===
--- kernel.orig/arch/powerpc/kernel/time.c  2007-12-13 21:58:10.0 
-0600
+++ kernel/arch/powerpc/kernel/time.c   2007-12-13 22:00:36.0 -0600
@@ -219,7 +219,11 @@ static u64 read_purr(void)
  */
 static u64 read_spurr(u64 purr)
 {
-   if (cpu_has_feature(CPU_FTR_SPURR))
+   /*
+* cpus without PURR won't have a SPURR
+* We already know the former when we use this, so tell gcc
+*/
+   if (cpu_has_feature(CPU_FTR_PURR)  cpu_has_feature(CPU_FTR_SPURR))
return mfspr(SPRN_SPURR);
return purr;
 }
@@ -230,29 +234,30 @@ static u64 read_spurr(u64 purr)
  */
 void account_system_vtime(struct task_struct *tsk)
 {
-   u64 now, nowscaled, delta, deltascaled;
+   u64 now, nowscaled, delta, deltascaled, sys_time;
unsigned long flags;
 
local_irq_save(flags);
now = read_purr();
-   delta = now - get_paca()-startpurr;
-   get_paca()-startpurr = now;
nowscaled = read_spurr(now);
+   delta = now - get_paca()-startpurr;
deltascaled = nowscaled - get_paca()-startspurr;
+   get_paca()-startpurr = now;
get_paca()-startspurr = nowscaled;
if (!in_interrupt()) {
/* deltascaled includes both user and system time.
 * Hence scale it based on the purr ratio to estimate
 * the system time */
+   sys_time = get_paca()-system_time;
if (get_paca()-user_time)
-   deltascaled = deltascaled * get_paca()-system_time /
-(get_paca()-system_time + get_paca()-user_time);
-   delta += get_paca()-system_time;
+   deltascaled = deltascaled * sys_time /
+(sys_time + get_paca()-user_time);
+   delta += sys_time;
get_paca()-system_time = 0;
}
account_system_time(tsk, 0, delta);
-   get_paca()-purrdelta = delta;
account_system_time_scaled(tsk, deltascaled);
+   get_paca()-purrdelta = delta;
get_paca()-spurrdelta = deltascaled;
local_irq_restore(flags);
 }
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


any more patches for 2.6.24?

2007-12-13 Thread Paul Mackerras
Currently I have just this one bugfix queued up to go to Linus for
2.6.24:

Stephen Rothwell (1):
  [POWERPC] iSeries: don't printk with HV spinlock held

Does anyone else have bugfixes that need to go in 2.6.24?

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


Re: [PATCH] mpc834x_mds: Fix whitespace and call of_platform_bus_probe().

2007-12-13 Thread Kumar Gala

On Dec 13, 2007, at 11:19 AM, Scott Wood wrote:

 Signed-off-by: Scott Wood [EMAIL PROTECTED]
 ---
 arch/powerpc/platforms/83xx/mpc834x_mds.c |   21 +++--
 1 files changed, 19 insertions(+), 2 deletions(-)

applied.

- k

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


[PATCH 0/15] [POWERPC] PCI updates merges

2007-12-13 Thread Benjamin Herrenschmidt
(THIS SERIES STILL NEEDS MORE TESTING)

(This version is rebased on top of current for-2.6.25, my remaining
 4xx patches will apply on top of this)

This serie of patches converts the 32 bits PCI code to use the generic
pci_assign_unassigned_resources() instead of its own assignment code
which was unable to deal with unassigned PCI-PCI bridges among
other issues.

It then merges the resource fixup and allocation code between 32 and
64 bits (mostly making 64 bits use the 32 bits code with a few fixups),
hopefully fixing the longstanding issue that not setting pci_probe_only
on ppc64 would generally not work.

We also add flags to control the behaviour of the PCI code, such as
letting some platforms force a full re-assignment (similar to what
pci-auto used to provide in arch/ppc) and remove a whole bunch of
hackish code that is made obsolete by that change.

32 bits platforms with 64 bits resources support will also need my
separate patch to fix the generic setup-bus.c for that situation.

Finally, I also merge the implementations of pcibios_enable_device()
and fixup the PowerMac code that used hooks in that area in ways
that don't work anymore.

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


[PATCH 2/6] init_decrementer_clockevent can be static __init

2007-12-13 Thread Milton Miller
as its only called from time_init, which is __init.

Also remove unneeded forward declaration.

Signed-off-by: Milton Miller [EMAIL PROTECTED]
---

Index: kernel/arch/powerpc/kernel/time.c
===
--- kernel.orig/arch/powerpc/kernel/time.c  2007-12-13 17:46:59.0 
-0600
+++ kernel/arch/powerpc/kernel/time.c   2007-12-13 17:56:37.0 -0600
@@ -117,7 +117,6 @@ static struct clock_event_device decreme
 };
 
 static DEFINE_PER_CPU(struct clock_event_device, decrementers);
-void init_decrementer_clockevent(void);
 static DEFINE_PER_CPU(u64, decrementer_next_tb);
 
 #ifdef CONFIG_PPC_ISERIES
@@ -836,7 +835,7 @@ static void register_decrementer_clockev
clockevents_register_device(dec);
 }
 
-void init_decrementer_clockevent(void)
+static void __init init_decrementer_clockevent(void)
 {
int cpu = smp_processor_id();
 
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH 1/15] [POWERPC] pci32: remove bogus alignment message

2007-12-13 Thread Benjamin Herrenschmidt
There's a stale  bogus piece of code in 32 bits PCI code that
complains about ISA related alignment issues. Just remove it.

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

 arch/powerpc/kernel/pci_32.c |6 --
 1 file changed, 6 deletions(-)

--- linux-merge.orig/arch/powerpc/kernel/pci_32.c   2007-12-14 
15:49:01.0 +1100
+++ linux-merge/arch/powerpc/kernel/pci_32.c2007-12-14 15:49:27.0 
+1100
@@ -199,12 +199,6 @@ void pcibios_align_resource(void *data, 
if (res-flags  IORESOURCE_IO) {
resource_size_t start = res-start;
 
-   if (size  0x100) {
-   printk(KERN_ERR PCI: I/O Region %s/%d too large
-   (%lld bytes)\n, pci_name(dev),
-  dev-resource - res, (unsigned long long)size);
-   }
-
if (start  0x300) {
start = (start + 0x3ff)  ~0x3ff;
res-start = start;
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH 2/15] [POWERPC] pci32: use generic pci_assign_unassign_resources

2007-12-13 Thread Benjamin Herrenschmidt
This makes the 32 bits PowerPC PCI code use the generic code to assign
resources to devices that had unassigned or conflicting resources.

This allow to remove the local implementation that was incomplete and
could not assign for example a PCI-PCI bridge from scratch, which is
needed on various embedded platforms.

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

 arch/powerpc/kernel/pci_32.c |  191 +++
 1 file changed, 17 insertions(+), 174 deletions(-)

--- linux-merge.orig/arch/powerpc/kernel/pci_32.c   2007-12-14 
15:49:27.0 +1100
+++ linux-merge/arch/powerpc/kernel/pci_32.c2007-12-14 15:49:27.0 
+1100
@@ -37,10 +37,6 @@ int pcibios_assign_bus_offset = 1;
 
 void pcibios_make_OF_bus_map(void);
 
-static int pci_relocate_bridge_resource(struct pci_bus *bus, int i);
-static int probe_resource(struct pci_bus *parent, struct resource *pr,
- struct resource *res, struct resource **conflict);
-static void update_bridge_base(struct pci_bus *bus, int i);
 static void pcibios_fixup_resources(struct pci_dev* dev);
 static void fixup_broken_pcnet32(struct pci_dev* dev);
 static int reparent_resources(struct resource *parent, struct resource *res);
@@ -134,7 +130,7 @@ pcibios_fixup_resources(struct pci_dev *
if (offset != 0) {
res-start = (res-start + offset)  mask;
res-end = (res-end + offset)  mask;
-   DBG(Fixup res %d (%lx) of dev %s: %llx - %llx\n,
+   DBG(PCI: Fixup res %d (0x%lx) of dev %s: %llx - 
%llx\n,
i, res-flags, pci_name(dev),
(u64)res-start - offset, (u64)res-start);
}
@@ -267,9 +263,12 @@ pcibios_allocate_bus_resources(struct li
}
}
 
-   DBG(PCI: bridge rsrc %llx..%llx (%lx), parent %p\n,
+   DBG(PCI: dev %s (bus 0x%02x) bridge rsrc %d: 
%016llx..%016llx 
+   (f:0x%08lx), parent %p\n,
+   bus-self ? pci_name(bus-self) : PHB, 
bus-number, i,
(u64)res-start, (u64)res-end, res-flags, pr);
-   if (pr) {
+
+   if (pr  !(pr-flags  IORESOURCE_UNSET)) {
if (request_resource(pr, res) == 0)
continue;
/*
@@ -280,10 +279,11 @@ pcibios_allocate_bus_resources(struct li
if (reparent_resources(pr, res) == 0)
continue;
}
-   printk(KERN_ERR PCI: Cannot allocate resource region 
-  %d of PCI bridge %d\n, i, bus-number);
-   if (pci_relocate_bridge_resource(bus, i))
-   bus-resource[i] = NULL;
+   printk(KERN_WARNING
+  PCI: Cannot allocate resource region 
+  %d of PCI bridge %d, will remap\n,
+  i, bus-number);
+   res-flags |= IORESOURCE_UNSET;
}
pcibios_allocate_bus_resources(bus-children);
}
@@ -324,112 +324,6 @@ reparent_resources(struct resource *pare
return 0;
 }
 
-/*
- * A bridge has been allocated a range which is outside the range
- * of its parent bridge, so it needs to be moved.
- */
-static int __init
-pci_relocate_bridge_resource(struct pci_bus *bus, int i)
-{
-   struct resource *res, *pr, *conflict;
-   resource_size_t try, size;
-   struct pci_bus *parent = bus-parent;
-   int j;
-
-   if (parent == NULL) {
-   /* shouldn't ever happen */
-   printk(KERN_ERR PCI: can't move host bridge resource\n);
-   return -1;
-   }
-   res = bus-resource[i];
-   if (res == NULL)
-   return -1;
-   pr = NULL;
-   for (j = 0; j  4; j++) {
-   struct resource *r = parent-resource[j];
-   if (!r)
-   continue;
-   if ((res-flags ^ r-flags)  (IORESOURCE_IO | IORESOURCE_MEM))
-   continue;
-   if (!((res-flags ^ r-flags)  IORESOURCE_PREFETCH)) {
-   pr = r;
-   break;
-   }
-   if (res-flags  IORESOURCE_PREFETCH)
-   pr = r;
-   }
-   if (pr == NULL)
-   return -1;
-   size = res-end - res-start;
-   if (pr-start  pr-end || size  pr-end - pr-start)
-   return -1;
-   try = pr-end;
-   for (;;) {
-   res-start = try - size;
-   res-end = try;
-   if (probe_resource(bus-parent, pr, res, conflict) == 0)
-   break;
-

[PATCH 3/15] [POWERPC] pci32: Remove PowerMac P2P bridge IO hack

2007-12-13 Thread Benjamin Herrenschmidt
The 32 bits PowerPC PCI code has a hack for use by some PowerMacs
to try to re-open PCI-PCI bridge IO resources that were closed
by the firmware. This is no longer necessary as the generic code
will now do that for us.

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

 arch/powerpc/kernel/pci_32.c |  215 ---
 1 file changed, 1 insertion(+), 214 deletions(-)

--- linux-merge.orig/arch/powerpc/kernel/pci_32.c   2007-12-14 
15:49:27.0 +1100
+++ linux-merge/arch/powerpc/kernel/pci_32.c2007-12-14 15:49:28.0 
+1100
@@ -711,217 +711,6 @@ void pcibios_make_OF_bus_map(void)
 }
 #endif /* CONFIG_PPC_OF */
 
-#ifdef CONFIG_PPC_PMAC
-/*
- * This set of routines checks for PCI-PCI bridges that have closed
- * IO resources and have child devices. It tries to re-open an IO
- * window on them.
- *
- * This is a _temporary_ fix to workaround a problem with Apple's OF
- * closing IO windows on P2P bridges when the OF drivers of cards
- * below this bridge don't claim any IO range (typically ATI or
- * Adaptec).
- *
- * A more complete fix would be to use drivers/pci/setup-bus.c, which
- * involves a working pcibios_fixup_pbus_ranges(), some more care about
- * ordering when creating the host bus resources, and maybe a few more
- * minor tweaks
- */
-
-/* Initialize bridges with base/limit values we have collected */
-static void __init
-do_update_p2p_io_resource(struct pci_bus *bus, int enable_vga)
-{
-   struct pci_dev *bridge = bus-self;
-   struct pci_controller* hose = (struct pci_controller *)bridge-sysdata;
-   u32 l;
-   u16 w;
-   struct resource res;
-
-   if (bus-resource[0] == NULL)
-   return;
-   res = *(bus-resource[0]);
-
-   DBG(Remapping Bus %d, bridge: %s\n, bus-number, pci_name(bridge));
-   res.start -= ((unsigned long) hose-io_base_virt - isa_io_base);
-   res.end -= ((unsigned long) hose-io_base_virt - isa_io_base);
-   DBG(  IO window: %016llx-%016llx\n, res.start, res.end);
-
-   /* Set up the top and bottom of the PCI I/O segment for this bus. */
-   pci_read_config_dword(bridge, PCI_IO_BASE, l);
-   l = 0x000f;
-   l |= (res.start  8)  0x00f0;
-   l |= res.end  0xf000;
-   pci_write_config_dword(bridge, PCI_IO_BASE, l);
-
-   if ((l  PCI_IO_RANGE_TYPE_MASK) == PCI_IO_RANGE_TYPE_32) {
-   l = (res.start  16) | (res.end  0x);
-   pci_write_config_dword(bridge, PCI_IO_BASE_UPPER16, l);
-   }
-
-   pci_read_config_word(bridge, PCI_COMMAND, w);
-   w |= PCI_COMMAND_IO;
-   pci_write_config_word(bridge, PCI_COMMAND, w);
-
-#if 0 /* Enabling this causes XFree 4.2.0 to hang during PCI probe */
-   if (enable_vga) {
-   pci_read_config_word(bridge, PCI_BRIDGE_CONTROL, w);
-   w |= PCI_BRIDGE_CTL_VGA;
-   pci_write_config_word(bridge, PCI_BRIDGE_CONTROL, w);
-   }
-#endif
-}
-
-/* This function is pretty basic and actually quite broken for the
- * general case, it's enough for us right now though. It's supposed
- * to tell us if we need to open an IO range at all or not and what
- * size.
- */
-static int __init
-check_for_io_childs(struct pci_bus *bus, struct resource* res, int *found_vga)
-{
-   struct pci_dev *dev;
-   int i;
-   int rc = 0;
-
-#define push_end(res, mask) do {   \
-   BUG_ON((mask+1)  mask);\
-   res-end = (res-end + mask) | mask;\
-} while (0)
-
-   list_for_each_entry(dev, bus-devices, bus_list) {
-   u16 class = dev-class  8;
-
-   if (class == PCI_CLASS_DISPLAY_VGA ||
-   class == PCI_CLASS_NOT_DEFINED_VGA)
-   *found_vga = 1;
-   if (class  8 == PCI_BASE_CLASS_BRIDGE  dev-subordinate)
-   rc |= check_for_io_childs(dev-subordinate, res, 
found_vga);
-   if (class == PCI_CLASS_BRIDGE_CARDBUS)
-   push_end(res, 0xfff);
-
-   for (i=0; iPCI_NUM_RESOURCES; i++) {
-   struct resource *r;
-   unsigned long r_size;
-
-   if (dev-class  8 == PCI_CLASS_BRIDGE_PCI
-i = PCI_BRIDGE_RESOURCES)
-   continue;
-   r = dev-resource[i];
-   r_size = r-end - r-start;
-   if (r_size  0xfff)
-   r_size = 0xfff;
-   if (r-flags  IORESOURCE_IO  (r_size) != 0) {
-   rc = 1;
-   push_end(res, r_size);
-   }
-   }
-   }
-
-   return rc;
-}
-
-/* Here we scan all P2P bridges of a given level that have a closed
- * IO window. Note that the test for the presence of a VGA card should
- * be improved to take into account already configured P2P bridges,

[PATCH 4/15] [POWERPC] pci32: Add flags modifying the PCI code behaviour

2007-12-13 Thread Benjamin Herrenschmidt
This adds to the 32 bits PCI code some flags, replacing the old
pci_assign_all_busses global, that allow to control various
aspects of the PCI probing, such as whether to re-assign all
resources or not, or to not try to assign anything at all.

This also adds the flag x86 already has to avoid ISA alignment
on bridges that don't have ISA forwarding enabled (no legacy
devices on the top level bus) and sets it for PowerMacs.

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

 arch/powerpc/kernel/pci_32.c  |   42 --
 arch/powerpc/kernel/pci_64.c  |1 
 arch/powerpc/kernel/rtas_pci.c|6 ++--
 arch/powerpc/platforms/52xx/mpc52xx_pci.c |2 -
 arch/powerpc/platforms/82xx/pq2.c |2 -
 arch/powerpc/platforms/83xx/pci.c |2 -
 arch/powerpc/platforms/chrp/pci.c |2 -
 arch/powerpc/platforms/powermac/pci.c |7 +++--
 arch/powerpc/sysdev/fsl_pci.c |2 -
 arch/powerpc/sysdev/grackle.c |2 -
 include/asm-powerpc/pci-bridge.h  |   20 ++
 include/asm-powerpc/pci.h |9 --
 12 files changed, 75 insertions(+), 22 deletions(-)

--- linux-merge.orig/arch/powerpc/kernel/pci_32.c   2007-12-14 
15:49:28.0 +1100
+++ linux-merge/arch/powerpc/kernel/pci_32.c2007-12-14 15:49:29.0 
+1100
@@ -35,6 +35,9 @@ unsigned long isa_io_base = 0;
 unsigned long pci_dram_offset = 0;
 int pcibios_assign_bus_offset = 1;
 
+/* Default PCI flags is 0 */
+unsigned int ppc_pci_flags;
+
 void pcibios_make_OF_bus_map(void);
 
 static void pcibios_fixup_resources(struct pci_dev* dev);
@@ -48,7 +51,7 @@ static u8* pci_to_OF_bus_map;
 /* By default, we don't re-assign bus numbers. We do this only on
  * some pmacs
  */
-int pci_assign_all_buses;
+static int pci_assign_all_buses;
 
 LIST_HEAD(hose_list);
 
@@ -174,6 +177,14 @@ void pcibios_bus_to_resource(struct pci_
 }
 EXPORT_SYMBOL(pcibios_bus_to_resource);
 
+static int skip_isa_ioresource_align(struct pci_dev *dev)
+{
+   if ((ppc_pci_flags  PPC_PCI_CAN_SKIP_ISA_ALIGN) 
+   !(dev-bus-bridge_ctl  PCI_BRIDGE_CTL_ISA))
+   return 1;
+   return 0;
+}
+
 /*
  * We need to avoid collisions with `mirrored' VGA ports
  * and other strange ISA hardware, so we always want the
@@ -195,6 +206,8 @@ void pcibios_align_resource(void *data, 
if (res-flags  IORESOURCE_IO) {
resource_size_t start = res-start;
 
+   if (skip_isa_ioresource_align(dev))
+   return;
if (start  0x300) {
start = (start + 0x3ff)  ~0x3ff;
res-start = start;
@@ -251,8 +264,13 @@ pcibios_allocate_bus_resources(struct li
continue;
if (bus-parent == NULL)
pr = (res-flags  IORESOURCE_IO)?
-   ioport_resource: iomem_resource;
+   ioport_resource : iomem_resource;
else {
+   /* Don't bother with non-root busses when
+* re-assigning all resources.
+*/
+   if (ppc_pci_flags  PPC_PCI_REASSIGN_ALL_RSRC)
+   continue;
pr = pci_find_parent_resource(bus-self, res);
if (pr == res) {
/* this happens when the generic PCI
@@ -720,6 +738,9 @@ pcibios_init(void)
 
printk(KERN_INFO PCI: Probing PCI hardware\n);
 
+   if (ppc_pci_flags  PPC_PCI_REASSIGN_ALL_BUS)
+   pci_assign_all_buses = 1;
+
/* Scan all of the recorded PCI controllers.  */
list_for_each_entry_safe(hose, tmp, hose_list, list_node) {
if (pci_assign_all_buses)
@@ -746,13 +767,18 @@ pcibios_init(void)
if (ppc_md.pcibios_fixup)
ppc_md.pcibios_fixup();
 
-   /* Allocate and assign resources */
+   /* Allocate and assign resources. If we re-assign everything, then
+* we skip the allocate phase
+*/
pcibios_allocate_bus_resources(pci_root_buses);
-   pcibios_allocate_resources(0);
-   pcibios_allocate_resources(1);
-
-   DBG(PCI: Assigning unassigned resouces...\n);
-   pci_assign_unassigned_resources();
+   if (!(ppc_pci_flags  PPC_PCI_REASSIGN_ALL_RSRC)) {
+   pcibios_allocate_resources(0);
+   pcibios_allocate_resources(1);
+   }
+   if (!(ppc_pci_flags  PPC_PCI_PROBE_ONLY)) {
+   DBG(PCI: Assigning unassigned resouces...\n);
+   pci_assign_unassigned_resources();
+   }
 
/* Call machine dependent post-init code */
if (ppc_md.pcibios_after_init)
Index: linux-merge/arch/powerpc/kernel/pci_64.c

[PATCH 5/15] [POWERPC] pci32: Remove obsolete PowerMac bus number hack

2007-12-13 Thread Benjamin Herrenschmidt
The 32 bits PCI code carries an old hack that was only useful for G5
machines. Nowdays, the 32 bits kernel doesn't support any of those
machines anymore so the hack is basically never used, remove it.

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

 arch/powerpc/kernel/pci_32.c |   11 ---
 1 file changed, 11 deletions(-)

--- linux-merge.orig/arch/powerpc/kernel/pci_32.c   2007-12-14 
15:49:29.0 +1100
+++ linux-merge/arch/powerpc/kernel/pci_32.c2007-12-14 15:49:29.0 
+1100
@@ -922,17 +922,6 @@ long sys_pciconfig_iobase(long which, un
struct pci_controller* hose;
long result = -EOPNOTSUPP;
 
-   /* Argh ! Please forgive me for that hack, but that's the
-* simplest way to get existing XFree to not lockup on some
-* G5 machines... So when something asks for bus 0 io base
-* (bus 0 is HT root), we return the AGP one instead.
-*/
-#ifdef CONFIG_PPC_PMAC
-   if (machine_is(powermac)  machine_is_compatible(MacRISC4))
-   if (bus == 0)
-   bus = 0xf0;
-#endif /* CONFIG_PPC_PMAC */
-
hose = pci_bus_to_hose(bus);
if (!hose)
return -ENODEV;
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH 6/15] [POWERPC] pci32: Add platform option to enable /proc PCI domains

2007-12-13 Thread Benjamin Herrenschmidt
This adds flags the platforms can use to enable domain numbers
in /proc/bus/pci.

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

 arch/powerpc/kernel/pci-common.c |   16 
 arch/powerpc/kernel/pci_64.c |8 
 include/asm-powerpc/pci-bridge.h |5 +
 include/asm-powerpc/pci.h|   14 --
 4 files changed, 25 insertions(+), 18 deletions(-)

--- linux-merge.orig/arch/powerpc/kernel/pci-common.c   2007-12-14 
15:49:00.0 +1100
+++ linux-merge/arch/powerpc/kernel/pci-common.c2007-12-14 
15:49:30.0 +1100
@@ -639,3 +639,19 @@ void __devinit pci_process_bridge_OF_ran
hose-mem_resources[memno-1] = tmp;
}
 }
+
+/* Decide whether to display the domain number in /proc */
+int pci_proc_domain(struct pci_bus *bus)
+{
+   struct pci_controller *hose = pci_bus_to_host(bus);
+#ifdef CONFIG_PPC64
+   return hose-buid != 0;
+#else
+   if (!(ppc_pci_flags  PPC_PCI_ENABLE_PROC_DOMAINS))
+   return 0;
+   if (ppc_pci_flags  PPC_PCI_COMPAT_DOMAIN_0)
+   return hose-global_number != 0;
+   return 1;
+#endif
+}
+
Index: linux-merge/arch/powerpc/kernel/pci_64.c
===
--- linux-merge.orig/arch/powerpc/kernel/pci_64.c   2007-12-14 
15:49:29.0 +1100
+++ linux-merge/arch/powerpc/kernel/pci_64.c2007-12-14 15:49:30.0 
+1100
@@ -570,14 +570,6 @@ int pcibios_enable_device(struct pci_dev
return 0;
 }
 
-/* Decide whether to display the domain number in /proc */
-int pci_proc_domain(struct pci_bus *bus)
-{
-   struct pci_controller *hose = pci_bus_to_host(bus);
-   return hose-buid != 0;
-}
-
-
 #ifdef CONFIG_HOTPLUG
 
 int pcibios_unmap_io_space(struct pci_bus *bus)
Index: linux-merge/include/asm-powerpc/pci-bridge.h
===
--- linux-merge.orig/include/asm-powerpc/pci-bridge.h   2007-12-14 
15:49:29.0 +1100
+++ linux-merge/include/asm-powerpc/pci-bridge.h2007-12-14 
15:49:30.0 +1100
@@ -30,6 +30,11 @@ enum {
 * ISA forwarding enabled
 */
PPC_PCI_CAN_SKIP_ISA_ALIGN  = 0x0008,
+
+   /* Enable domain numbers in /proc */
+   PPC_PCI_ENABLE_PROC_DOMAINS = 0x0010,
+   /* ... except for domain 0 */
+   PPC_PCI_COMPAT_DOMAIN_0 = 0x0020,
 };
 
 
Index: linux-merge/include/asm-powerpc/pci.h
===
--- linux-merge.orig/include/asm-powerpc/pci.h  2007-12-14 15:49:29.0 
+1100
+++ linux-merge/include/asm-powerpc/pci.h   2007-12-14 15:49:30.0 
+1100
@@ -98,9 +98,6 @@ static inline void pci_dma_burst_advice(
 #define get_pci_dma_ops()  NULL
 #endif
 
-/* Decide whether to display the domain number in /proc */
-extern int pci_proc_domain(struct pci_bus *bus);
-
 #else /* 32-bit */
 
 #ifdef CONFIG_PCI
@@ -112,17 +109,14 @@ static inline void pci_dma_burst_advice(
*strategy_parameter = ~0UL;
 }
 #endif
-
-/* Set the name of the bus as it appears in /proc/bus/pci */
-static inline int pci_proc_domain(struct pci_bus *bus)
-{
-   return 0;
-}
-
 #endif /* CONFIG_PPC64 */
 
 extern int pci_domain_nr(struct pci_bus *bus);
 
+/* Decide whether to display the domain number in /proc */
+extern int pci_proc_domain(struct pci_bus *bus);
+
+
 struct vm_area_struct;
 /* Map a range of PCI memory or I/O space for a device into user space */
 int pci_mmap_page_range(struct pci_dev *pdev, struct vm_area_struct *vma,
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH 8/15] [POWERPC] Merge PCI resource fixups

2007-12-13 Thread Benjamin Herrenschmidt
The PCI code in 32 and 64 bits fixes up resources differently.

32 bits uses a header quirk plus handles bridges in pcibios_fixup_bus()
while 64 bits does things in various places depending on whether you
are using OF probing, using PCI hotplug, etc...

This merges those by basically using the 32 bits approach for both,
with various tweaks to make 64 bits work with the new approach.

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

 arch/powerpc/kernel/pci-common.c   |  130 +
 arch/powerpc/kernel/pci_32.c   |   83 --
 arch/powerpc/kernel/pci_64.c   |  104 +++
 arch/powerpc/platforms/pseries/pci_dlpar.c |   14 +--
 drivers/pci/hotplug/rpadlpar_core.c|2 
 include/asm-powerpc/machdep.h  |   14 +--
 include/asm-powerpc/pci-bridge.h   |2 
 include/asm-powerpc/pci.h  |6 -
 8 files changed, 167 insertions(+), 188 deletions(-)

--- linux-merge.orig/arch/powerpc/kernel/pci-common.c   2007-12-14 
15:49:31.0 +1100
+++ linux-merge/arch/powerpc/kernel/pci-common.c2007-12-14 
15:49:31.0 +1100
@@ -691,3 +691,133 @@ void pcibios_bus_to_resource(struct pci_
res-end = (region-end + offset)  mask;
 }
 EXPORT_SYMBOL(pcibios_bus_to_resource);
+
+/* Fixup a bus resource into a linux resource */
+static void __devinit fixup_resource(struct resource *res, struct pci_dev *dev)
+{
+   struct pci_controller *hose = pci_bus_to_host(dev-bus);
+   resource_size_t offset = 0, mask = (resource_size_t)-1;
+
+   if (res-flags  IORESOURCE_IO) {
+   offset = (unsigned long)hose-io_base_virt - _IO_BASE;
+   mask = 0xu;
+   } else if (res-flags  IORESOURCE_MEM)
+   offset = hose-pci_mem_offset;
+
+   res-start = (res-start + offset)  mask;
+   res-end = (res-end + offset)  mask;
+
+   pr_debug(PCI:%s%016llx-%016llx\n,
+pci_name(dev),
+(unsigned long long)res-start,
+(unsigned long long)res-end);
+}
+
+
+/* This header fixup will do the resource fixup for all devices as they are
+ * probed, but not for bridge ranges
+ */
+static void __devinit pcibios_fixup_resources(struct pci_dev *dev)
+{
+   struct pci_controller *hose = pci_bus_to_host(dev-bus);
+   int i;
+
+   if (!hose) {
+   printk(KERN_ERR No host bridge for PCI dev %s !\n,
+  pci_name(dev));
+   return;
+   }
+   for (i = 0; i  DEVICE_COUNT_RESOURCE; i++) {
+   struct resource *res = dev-resource + i;
+   if (!res-flags)
+   continue;
+   if (res-end == 0x) {
+   pr_debug(PCI:%s Resource %d %016llx-%016llx [%x] is 
unassigned\n,
+pci_name(dev), i,
+(unsigned long long)res-start,
+(unsigned long long)res-end,
+(unsigned int)res-flags);
+   res-end -= res-start;
+   res-start = 0;
+   res-flags |= IORESOURCE_UNSET;
+   continue;
+   }
+
+   pr_debug(PCI:%s Resource %d %016llx-%016llx [%x] fixup...\n,
+pci_name(dev), i,
+(unsigned long long)res-start,\
+(unsigned long long)res-end,
+(unsigned int)res-flags);
+
+   fixup_resource(res, dev);
+   }
+
+   /* Call machine specific resource fixup */
+   if (ppc_md.pcibios_fixup_resources)
+   ppc_md.pcibios_fixup_resources(dev);
+}
+DECLARE_PCI_FIXUP_HEADER(PCI_ANY_ID, PCI_ANY_ID, pcibios_fixup_resources);
+
+static void __devinit __pcibios_fixup_bus(struct pci_bus *bus)
+{
+   struct pci_dev *dev = bus-self;
+
+   pr_debug(PCI: Fixup bus %d (%s)\n, bus-number, dev ? pci_name(dev) : 
PHB);
+
+   /* Fixup PCI-PCI bridges. Host bridges are handled separately, for
+* now differently between 32 and 64 bits.
+*/
+   if (dev != NULL) {
+   struct resource *res;
+   int i;
+
+   for (i = 0; i  PCI_BUS_NUM_RESOURCES; ++i) {
+   if ((res = bus-resource[i]) == NULL)
+   continue;
+   if (!res-flags || bus-self-transparent)
+   continue;
+
+   pr_debug(PCI:%s Bus rsrc %d %016llx-%016llx [%x] 
fixup...\n,
+pci_name(dev), i,
+(unsigned long long)res-start,\
+(unsigned long long)res-end,
+(unsigned int)res-flags);
+
+   fixup_resource(res, dev);
+   }
+   }
+
+   /* Additional setup that 

[PATCH 10/15] [POWERPC] fix iSeries PCI resource management

2007-12-13 Thread Benjamin Herrenschmidt
The way iSeries manages PCI IO and Memory resources is a bit strange
and is based on overriding the content of those resources with home
cooked ones afterward.

This changes it a bit to better integrate with the new resource handling
so that the virtual tokens that iSeries replaces resources with are
done from the proper per-device fixup hook, and bridge resources are
set to enclose that token space. This fixes various things such as
the output of /proc/iomem  ioports, among others. The patch also fixup
various boot messages as well.

Signed-off-by: Benjamin Herrenschmidt [EMAIL PROTECTED]
---
 
 arch/powerpc/kernel/pci-common.c   |   16 
 arch/powerpc/kernel/pci_64.c   |   19 -
 arch/powerpc/platforms/iseries/pci.c   |  123 +
 arch/powerpc/platforms/iseries/pci.h   |4 +
 arch/powerpc/platforms/iseries/setup.c |   37 +
 5 files changed, 121 insertions(+), 78 deletions(-)

--- linux-merge.orig/arch/powerpc/kernel/pci-common.c   2007-12-14 
15:49:32.0 +1100
+++ linux-merge/arch/powerpc/kernel/pci-common.c2007-12-14 
15:49:33.0 +1100
@@ -190,6 +190,20 @@ int pci_read_irq_line(struct pci_dev *pc
struct of_irq oirq;
unsigned int virq;
 
+   /* The current device-tree that iSeries generates from the HV
+* PCI informations doesn't contain proper interrupt routing,
+* and all the fallback would do is print out crap, so we
+* don't attempt to resolve the interrupts here at all, some
+* iSeries specific fixup does it.
+*
+* In the long run, we will hopefully fix the generated device-tree
+* instead.
+*/
+#ifdef CONFIG_PPC_ISERIES
+   if (firmware_has_feature(FW_FEATURE_ISERIES))
+   return -1;
+#endif
+
DBG(Try to map irq for %s...\n, pci_name(pci_dev));
 
 #ifdef DEBUG
@@ -946,7 +960,7 @@ static void __init pcibios_allocate_bus_
|| res-start  res-end)
continue;
if (bus-parent == NULL)
-   pr = (res-flags  IORESOURCE_IO)?
+   pr = (res-flags  IORESOURCE_IO) ?
ioport_resource : iomem_resource;
else {
/* Don't bother with non-root busses when
Index: linux-merge/arch/powerpc/kernel/pci_64.c
===
--- linux-merge.orig/arch/powerpc/kernel/pci_64.c   2007-12-14 
15:49:32.0 +1100
+++ linux-merge/arch/powerpc/kernel/pci_64.c2007-12-14 15:49:33.0 
+1100
@@ -343,7 +343,7 @@ void __devinit scan_phb(struct pci_contr
int i, mode;
struct resource *res;
 
-   DBG(Scanning PHB %s\n, node ? node-full_name : NO NAME);
+   DBG(PCI: Scanning PHB %s\n, node ? node-full_name : NO NAME);
 
/* Create an empty bus for the toplevel */
bus = pci_create_bus(hose-parent, hose-first_busno, hose-ops, node);
@@ -359,9 +359,22 @@ void __devinit scan_phb(struct pci_contr
pcibios_map_io_space(bus);
 
/* Wire up PHB bus resources */
-   bus-resource[0] = res = hose-io_resource;
-   for (i = 0; i  3; ++i)
+   if (hose-io_resource.flags) {
+   DBG(PCI: PHB IO resource= %016lx-%016lx [%lx]\n,
+   hose-io_resource.start, hose-io_resource.end,
+   hose-io_resource.flags);
+   bus-resource[0] = res = hose-io_resource;
+   }
+   for (i = 0; i  3; ++i) {
+   DBG(PCI: PHB MEM resource %d = %016lx-%016lx [%lx]\n, i,
+   hose-mem_resources[i].start,
+   hose-mem_resources[i].end,
+   hose-mem_resources[i].flags);
bus-resource[i+1] = hose-mem_resources[i];
+   }
+   DBG(PCI: PHB MEM offset = %016lx\n, hose-pci_mem_offset);
+   DBG(PCI: PHB IO  offset = %08lx\n,
+   (unsigned long)hose-io_base_virt - _IO_BASE);
 
/* Get probe mode and perform scan */
mode = PCI_PROBE_NORMAL;
Index: linux-merge/arch/powerpc/platforms/iseries/pci.c
===
--- linux-merge.orig/arch/powerpc/platforms/iseries/pci.c   2007-12-14 
15:48:59.0 +1100
+++ linux-merge/arch/powerpc/platforms/iseries/pci.c2007-12-14 
15:49:33.0 +1100
@@ -20,6 +20,9 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
  */
+
+#undef DEBUG
+
 #include linux/kernel.h
 #include linux/list.h
 #include linux/string.h
@@ -58,6 +61,7 @@ static int limit_pci_retries = 1; /* Set
 #define IOMM_TABLE_MAX_ENTRIES 1024
 #define IOMM_TABLE_ENTRY_SIZE  0x0040UL
 #define BASE_IO_MEMORY 0xE000UL
+#define END_IO_MEMORY  0xEFFFUL
 
 static 

[PATCH 15/15] [POWERPC] Various fixes to pcibios_enable_device()

2007-12-13 Thread Benjamin Herrenschmidt
Our implementation of pcibios_enable_device() has a couple of problems.

One is that it should not check IORESOURCE_UNSET, as this might be
left dangling after resource assignment (shouldn't but there are
bugs), but instead, we make it check resource-parent which should
be a reliable indication that the resource has been successfully
claimed (it's in the resource tree).

Then, we also need to skip ROM resources that haven't been enabled
as x86 does.

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

 arch/powerpc/kernel/pci-common.c |5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

--- linux-merge.orig/arch/powerpc/kernel/pci-common.c   2007-12-14 
15:49:34.0 +1100
+++ linux-merge/arch/powerpc/kernel/pci-common.c2007-12-14 
15:49:36.0 +1100
@@ -1147,7 +1147,10 @@ int pcibios_enable_device(struct pci_dev
r = dev-resource[idx];
if (!(r-flags  (IORESOURCE_IO | IORESOURCE_MEM)))
continue;
-   if (r-flags  IORESOURCE_UNSET) {
+   if ((idx == PCI_ROM_RESOURCE) 
+   (!(r-flags  IORESOURCE_ROM_ENABLE)))
+   continue;
+   if (r-parent == NULL) {
printk(KERN_ERR PCI: Device %s not available because
of resource collisions\n, pci_name(dev));
return -EINVAL;
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH] Fix rounding bug in emulation for double float operating

2007-12-13 Thread Kumar Gala

On Dec 9, 2007, at 11:00 PM, Liu Yu wrote:


 This patch fixes rounding bug in emulation for double float  
 operating on PowerPC platform.

 When pack double float operand, it need to truncate the tail due to  
 the limited precision.
 If the truncated part is not zero, the last bit of work bit (totally  
 3 bits) need to '|' 1.

 This patch is completed in _FP_FRAC_SRS_2(X,N,sz) (arch/powerpc/math- 
 emu/op-2.h).
 Originally the code leftwards rotates the operand to just keep the  
 truncated part,
 then check whether it is zero. However, the number it rotates is not  
 correct when
 N is not smaller than _FP_W_TYPE_SIZE, and it will cause the work  
 bit '|' 1 in the improper case.

 This patch fixes this issue.

 Signed-off-by: Liu Yu [EMAIL PROTECTED]

 ---
 arch/powerpc/math-emu/op-2.h |3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

applied.

- k

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


Please pull from 'for-2.6.24' branch

2007-12-13 Thread Kumar Gala
Please pull from 'for-2.6.24' branch of

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

to receive the following updates:

 arch/powerpc/configs/mpc8272_ads_defconfig |6 +++---
 arch/powerpc/configs/pq2fads_defconfig |6 +++---
 arch/powerpc/kernel/ppc_ksyms.c|   12 
 arch/powerpc/math-emu/op-2.h   |3 ++-
 arch/powerpc/sysdev/cpm2_common.c  |3 +--
 drivers/net/fs_enet/mac-scc.c  |2 +-
 include/asm-powerpc/commproc.h |3 ---
 7 files changed, 10 insertions(+), 25 deletions(-)

Jochen Friedrich (2):
  [POWERPC] Fix typo #ifdef - #ifndef
  [POWERPC] Kill non-existent symbols from ksyms and commproc.h

Liu Yu (1):
  [POWERPC] Fix rounding bug in emulation for double float operating

Scott Wood (2):
  [POWRPC] CPM2: Eliminate section mismatch warning in cpm2_reset().
  [POWERPC] 82xx: mpc8272ads, pq2fads: Update defconfig with 
CONFIG_FS_ENET_MDIO_FCC

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


Re: [PATCH 4/4] MPC8313 enhanced Local Bus Controller NAND support.

2007-12-13 Thread Kumar Gala
Patch title should really be someting like FSL enhanced local bus (not  
mpc8313).

On Dec 13, 2007, at 11:15 AM, Scott Wood wrote:

 Signed-off-by: Nick Spence [EMAIL PROTECTED]
 Signed-off-by: Scott Wood [EMAIL PROTECTED]
 ---
 drivers/mtd/nand/Kconfig |9 +
 drivers/mtd/nand/Makefile|1 +
 drivers/mtd/nand/fsl_elbc_nand.c | 1281 + 
 +
 3 files changed, 1291 insertions(+), 0 deletions(-)
 create mode 100644 drivers/mtd/nand/fsl_elbc_nand.c

 diff --git a/drivers/mtd/nand/Kconfig b/drivers/mtd/nand/Kconfig
 index 246d451..05d976c 100644
 --- a/drivers/mtd/nand/Kconfig
 +++ b/drivers/mtd/nand/Kconfig
 @@ -306,4 +306,13 @@ config MTD_ALAUDA
 These two (and possibly other) Alauda-based cardreaders for
 SmartMedia and xD allow raw flash access.

 +config MTD_NAND_FSL_ELBC
 + tristate NAND support for Freescale eLBC controllers
 + depends on MTD_NAND  PPC_OF
 + help
 +   Various Freescale chips, including the 8313, include a NAND Flash
 +   Controller Module with built-in hardware ECC capabilities.
 +   Enabling this option will enable you to use this to control
 +   external NAND devices.
 +
 endif # MTD_NAND
 diff --git a/drivers/mtd/nand/Makefile b/drivers/mtd/nand/Makefile
 index 3ad6c01..d0d4de2 100644
 --- a/drivers/mtd/nand/Makefile
 +++ b/drivers/mtd/nand/Makefile
 @@ -29,5 +29,6 @@ obj-$(CONFIG_MTD_NAND_CM_X270)  += cmx270_nand.o
 obj-$(CONFIG_MTD_NAND_BASLER_EXCITE)  += excite_nandflash.o
 obj-$(CONFIG_MTD_NAND_PLATFORM)   += plat_nand.o
 obj-$(CONFIG_MTD_ALAUDA)  += alauda.o
 +obj-$(CONFIG_MTD_NAND_FSL_ELBC)  += fsl_elbc_nand.o

 nand-objs := nand_base.o nand_bbt.o
 diff --git a/drivers/mtd/nand/fsl_elbc_nand.c b/drivers/mtd/nand/ 
 fsl_elbc_nand.c
 new file mode 100644
 index 000..ce8b0bf
 --- /dev/null
 +++ b/drivers/mtd/nand/fsl_elbc_nand.c
 @@ -0,0 +1,1281 @@
 +/* Freescale Enhanced Local Bus Controller NAND driver
 + *
 + * Copyright (c) 2006-2007 Freescale Semiconductor
 + *
 + * Authors: Nick Spence [EMAIL PROTECTED],
 + *  Scott Wood [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.
 + *
 + * This program is distributed in the hope that it will be useful,
 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 + * GNU General Public License for more details.
 + *
 + * You should have received a copy of the GNU General Public License
 + * along with this program; if not, write to the Free Software
 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA   
 02111-1307  USA
 + */
 +
 +#include linux/module.h
 +#include linux/types.h
 +#include linux/init.h
 +#include linux/kernel.h
 +#include linux/string.h
 +#include linux/ioport.h
 +#include linux/of_platform.h
 +#include linux/slab.h
 +#include linux/interrupt.h
 +
 +#include linux/mtd/mtd.h
 +#include linux/mtd/nand.h
 +#include linux/mtd/nand_ecc.h
 +#include linux/mtd/partitions.h
 +
 +#include asm/io.h
 +
 +
 +//#define ELBC_NAND_DEBUG_LVL 6

undef or something, not C++ comment.


 +
 +#ifdef ELBC_NAND_DEBUG_LVL
 +static int fcm_debug_level = ELBC_NAND_DEBUG_LVL;
 +#define FCM_DEBUG(n, args...)\
 + do {\
 + if (n = fcm_debug_level)   \
 + pr_dbg(args);   \
 + } while(0)
 +#else
 +#define FCM_DEBUG(n, dev, args...) do { } while(0)
 +#endif
 +
 +#define MAX_BANKS 8
 +#define ERR_BYTE 0xFF /* Value returned for read bytes when read  
 failed */
 +#define FCM_TIMEOUT_MSECS 500 /* Maximum number of mSecs to wait  
 for FCM */
 +
 +struct elbc_bank {
 + u32 br; /** Base Register  */
 +#define BR_BA   0x8000
 +#define BR_BA_SHIFT 15
 +#define BR_PS   0x1800
 +#define BR_PS_SHIFT 11
 +#define BR_PS_8 0x0800  /* Port Size 8 bit */
 +#define BR_PS_160x1000  /* Port Size 16 bit */
 +#define BR_PS_320x1800  /* Port Size 32 bit */
 +#define BR_DECC 0x0600
 +#define BR_DECC_SHIFT9
 +#define BR_DECC_OFF 0x  /* HW ECC checking and  
 generation off */
 +#define BR_DECC_CHK 0x0200  /* HW ECC checking on,  
 generation off */
 +#define BR_DECC_CHK_GEN 0x0400  /* HW ECC checking and  
 generation on */
 +#define BR_WP   0x0100
 +#define BR_WP_SHIFT  8
 +#define BR_MSEL 0x00E0
 +#define BR_MSEL_SHIFT5
 +#define BR_MS_GPCM  0x  /* GPCM */
 +#define BR_MS_FCM   0x0020  /* FCM */
 +#define BR_MS_SDRAM 0x0060  /* SDRAM */
 +#define BR_MS_UPMA  0x0080  /* UPMA 

Re: [PATCH 2/3] mpc82xx: Embedded Planet EP8248E support

2007-12-13 Thread Kumar Gala

On Dec 11, 2007, at 3:22 PM, Scott Wood wrote:

 This board is also resold by Freescale under the names
 QUICCStart MPC8248 Evaluation System and CWH-PPC-8248N-VE.

 Signed-off-by: Scott Wood [EMAIL PROTECTED]
 ---
 arch/powerpc/boot/Makefile |3 +-
 arch/powerpc/boot/dts/ep8248e.dts  |  193 +++
 arch/powerpc/boot/ep8248e.c|   55 ++
 arch/powerpc/boot/wrapper  |2 +-
 arch/powerpc/configs/ep8248e_defconfig |  864 +++ 
 +
 arch/powerpc/platforms/82xx/Kconfig|   13 +
 arch/powerpc/platforms/82xx/Makefile   |1 +
 arch/powerpc/platforms/82xx/ep8248e.c  |  321 
 include/asm-powerpc/mpc8260.h  |1 +
 9 files changed, 1451 insertions(+), 2 deletions(-)
 create mode 100644 arch/powerpc/boot/dts/ep8248e.dts
 create mode 100644 arch/powerpc/boot/ep8248e.c
 create mode 100644 arch/powerpc/configs/ep8248e_defconfig
 create mode 100644 arch/powerpc/platforms/82xx/ep8248e.c



 diff --git a/arch/powerpc/boot/dts/ep8248e.dts b/arch/powerpc/boot/ 
 dts/ep8248e.dts
 new file mode 100644
 index 000..ee8405d
 --- /dev/null
 +++ b/arch/powerpc/boot/dts/ep8248e.dts
 @@ -0,0 +1,193 @@
 +/*
 + * Device Tree for the Embedded Planet EP8248E board running  
 PlanetCore.
 + *
 + * 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.
 + */
 +

Can we make this a /dts-v1/; since its new.

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

Add a aliases { } and can we use that instead of linux,network-index  
and linux,planetcore-label.

 +
 + cpus {
 + #address-cells = 1;
 + #size-cells = 0;
 +
 + PowerPC,[EMAIL PROTECTED] {
 + device_type = cpu;
 + reg = 0;
 + d-cache-line-size = d#32;
 + i-cache-line-size = d#32;
 + d-cache-size = d#16384;
 + i-cache-size = d#16384;
 + timebase-frequency = 0;
 + clock-frequency = 0;
 + };
 + };
 +
 + localbus {
 + compatible = fsl,ep8248e-localbus,
 +  fsl,mpc8248-localbus,
 +  fsl,pq2-localbus;
 + #address-cells = 2;
 + #size-cells = 1;
 + reg = f0010100 40;
 +
 + ranges = 0 0 fc00 0400
 +   1 0 fa00 8000;
 +
 + [EMAIL PROTECTED],380 {
 + compatible = cfi-flash;
 + reg = 0 380 80;
 + bank-width = 4;
 + device-width = 2;
 + };
 +
 + [EMAIL PROTECTED],0 {
 + #address-cells = 2;
 + #size-cells = 1;
 + reg = 1 0 10;
 + compatible = fsl,ep8248e-bcsr;
 + ranges;
 +
 + mdio {
 + device_type = mdio;
 + compatible = fsl,ep8248e-mdio-bitbang;
 + #address-cells = 1;
 + #size-cells = 0;
 + reg = 1 8 1;
 +
 + PHY0: [EMAIL PROTECTED] {
 + interrupt-parent = PIC;
 + reg = 0;
 + device_type = ethernet-phy;
 + };
 +
 + PHY1: [EMAIL PROTECTED] {
 + interrupt-parent = PIC;
 + reg = 1;
 + device_type = ethernet-phy;
 + };
 + };
 + };
 + };
 +
 + memory {
 + device_type = memory;
 + reg = 0 0;
 + };
 +
 + [EMAIL PROTECTED] {
 + #address-cells = 1;
 + #size-cells = 1;
 + device_type = soc;
 + compatible = fsl,mpc8248, fsl,pq2-soc;
 + ranges =  f000 00053000;
 +
 + // Temporary -- will go away once kernel uses ranges for  
 get_immrbase().
 + reg = f000 00053000;
 +
 + [EMAIL PROTECTED] {
 + #address-cells = 1;
 + #size-cells = 1;
 + #interrupt-cells = 2;
 + compatible = fsl,mpc8248-cpm, fsl,cpm2;
 + reg = 119c0 30;
 + ranges;
 +
 + muram {
 + #address-cells = 1;
 +   

Re: [PATCH 2/2] powerpc: Add IPIC MSI support

2007-12-13 Thread Kumar Gala

On Dec 4, 2007, at 4:39 AM, Li Li wrote:

 Modified based on discussion on list.

 1. Adopt virq_to_hw routine
 2. Correct a legacy bug

 Implements the IPIC MSI as two level interrupt controller.

 Signed-off-by: Tony Li [EMAIL PROTECTED]

Tony, have you looked at the 85xx/86xx PCIe MSI mechanism?  The 2nd  
level PIC handling seems like its pretty similar between IPIC and  
MPIC.  Would like to see if we could somehow make the code common for  
to handle MSIs from both?

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


Re: [PATCH 19/20] [POWERPC] pci32: 4xx embedded platforms want to reassign all PCI resources

2007-12-13 Thread Stefan Roese
On Thursday 13 December 2007, Josh Boyer wrote:
  Keeping your embedded design tiny (and thus your own BSP) is one thing,
  but adding ifdef's all over the place so that somebody can tinify an
  eval board, I'm less sure about this... but if you want, you can fixup
  my patches.

 I'm not really advocating for ifdefs.  If it annoys me enough (which I
 doubt it will), then I'd try to come up with some way to avoid those
 too.  For now, I think selecting PCI in Kconfig for those boards is OK.

Yes, I think it is OK to select it this way an those boards since they are 
evaluation boards with PCI slots.

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


Re: Please pull linux-2.6-8xx.git for-paulus branch

2007-12-13 Thread Kumar Gala

On Dec 9, 2007, at 2:53 AM, Vitaly Bordug wrote:

 On Sat, 8 Dec 2007 09:17:06 -0600
 Kumar Gala wrote:


 On Dec 8, 2007, at 4:09 AM, Vitaly Bordug wrote:

 On Sat, 8 Dec 2007 13:00:25 +0300
 Vitaly Bordug wrote:

 Paul,

 please do
 git-pull
 git://git.kernel.org/pub/scm/linux/kernel/git/vitb/ 
 linux-2.6-8xx.git
 for-paulus

 to receive the following updates:

 Forgot to tell that this is .25 material...

 Vitaly, if you don't mind I'll pull these into my tree for Paul to
 collect all the FSL stuff in one place.

 I'm ok with either way.

I've pulled this and split the patches between for-2.6.24 (sent pull  
request to paulus) and for-2.6.25

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


Re: [PATCH] Fix rounding bug in emulation for double floatoperating

2007-12-13 Thread Kumar Gala
 When I run this on a G5 (w/HW FP) I get:

 dmul 3fe0 * 1 = 0 expected 0 (PASS)
 dmul bfe0 * 1 = 8000 expected 0 (PASS)
 dmul 8001 * bfe0 = 0 expected 0 (PASS)

 ddiv 1 / 4000 = 0 expected 0 (PASS)

 and on the 85xx w/FP emu:

 dmul 3fe0 * 1 = 0 expected 0 (PASS)
 dmul bfe0 * 1 = 8000 expected 0 (PASS)
 dmul 8001 * bfe0 = 0 expected 0 (PASS)

 ddiv 1 / 4000 = 0 expected 0 (PASS)

 Maybe I'm missing where the error is.
 I am missing ...
 It is supposed to run based on previous IEEE 754 patch.
 http://ozlabs.org/pipermail/linuxppc-dev/2007-February/031351.html

I'd really like to see to see a testcase show the issue with classic  
FP emu on a 85xx system.

(seems like it should be pretty straight forward).

- k

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


Re: [PATCH 2/2] ucc_geth: use rx-clock-name and tx-clock-name device tree properties

2007-12-13 Thread Kumar Gala

On Dec 3, 2007, at 3:17 PM, Timur Tabi wrote:

 Updates the ucc_geth device driver to check the new rx-clock-name and
 tx-clock-name properties first.  If present, it uses the new function
 qe_clock_source() to obtain the clock source.  Otherwise, it checks  
 the
 deprecated rx-clock and tx-clock properties.

 Update the device trees for 832x, 836x, and 8568 to contain the new  
 property
 names only.

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

 This patch applies to Kumar's for-2.6.25 branch.  ucc_geth will  
 compile but not
 run if my other patch, qe: add function qe_clock_source has not  
 also been
 applied.

Jeff, I'll take this patch via powerpc.git if you don't have any issue  
since its just touching probe/setup bits.

- k

 arch/powerpc/boot/dts/mpc832x_mds.dts |8 ++--
 arch/powerpc/boot/dts/mpc832x_rdb.dts |8 ++--
 arch/powerpc/boot/dts/mpc836x_mds.dts |8 ++--
 arch/powerpc/boot/dts/mpc8568mds.dts  |8 ++--
 drivers/net/ucc_geth.c|   55  
 ++--
 5 files changed, 67 insertions(+), 20 deletions(-)

 diff --git a/arch/powerpc/boot/dts/mpc832x_mds.dts b/arch/powerpc/ 
 boot/dts/mpc832x_mds.dts
 index c64f303..fe54489 100644
 --- a/arch/powerpc/boot/dts/mpc832x_mds.dts
 +++ b/arch/powerpc/boot/dts/mpc832x_mds.dts
 @@ -223,8 +223,8 @@
*/
   mac-address = [ 00 00 00 00 00 00 ];
   local-mac-address = [ 00 00 00 00 00 00 ];
 - rx-clock = 19;
 - tx-clock = 1a;
 + rx-clock-name = clk9;
 + tx-clock-name = clk10;
   phy-handle =  phy3 ;
   pio-handle =  pio3 ;
   };
 @@ -244,8 +244,8 @@
*/
   mac-address = [ 00 00 00 00 00 00 ];
   local-mac-address = [ 00 00 00 00 00 00 ];
 - rx-clock = 17;
 - tx-clock = 18;
 + rx-clock-name = clk7;
 + tx-clock-name = clk8;
   phy-handle =  phy4 ;
   pio-handle =  pio4 ;
   };
 diff --git a/arch/powerpc/boot/dts/mpc832x_rdb.dts b/arch/powerpc/ 
 boot/dts/mpc832x_rdb.dts
 index 388c8a7..e68a08b 100644
 --- a/arch/powerpc/boot/dts/mpc832x_rdb.dts
 +++ b/arch/powerpc/boot/dts/mpc832x_rdb.dts
 @@ -202,8 +202,8 @@
*/
   mac-address = [ 00 00 00 00 00 00 ];
   local-mac-address = [ 00 00 00 00 00 00 ];
 - rx-clock = 20;
 - tx-clock = 13;
 + rx-clock-name = clk16;
 + tx-clock-name = clk3;
   phy-handle = phy00;
   pio-handle = ucc2pio;
   };
 @@ -223,8 +223,8 @@
*/
   mac-address = [ 00 00 00 00 00 00 ];
   local-mac-address = [ 00 00 00 00 00 00 ];
 - rx-clock = 19;
 - tx-clock = 1a;
 + rx-clock-name = clk9;
 + tx-clock-name = clk10;
   phy-handle = phy04;
   pio-handle = ucc3pio;
   };
 diff --git a/arch/powerpc/boot/dts/mpc836x_mds.dts b/arch/powerpc/ 
 boot/dts/mpc836x_mds.dts
 index 0b2d2b5..bfd48d0 100644
 --- a/arch/powerpc/boot/dts/mpc836x_mds.dts
 +++ b/arch/powerpc/boot/dts/mpc836x_mds.dts
 @@ -254,8 +254,8 @@
*/
   mac-address = [ 00 00 00 00 00 00 ];
   local-mac-address = [ 00 00 00 00 00 00 ];
 - rx-clock = 0;
 - tx-clock = 19;
 + rx-clock-name = none;
 + tx-clock-name = clk9;
   phy-handle =  phy0 ;
   phy-connection-type = rgmii-id;
   pio-handle =  pio1 ;
 @@ -276,8 +276,8 @@
*/
   mac-address = [ 00 00 00 00 00 00 ];
   local-mac-address = [ 00 00 00 00 00 00 ];
 - rx-clock = 0;
 - tx-clock = 14;
 + rx-clock-name = none;
 + tx-clock-name = clk4;
   phy-handle =  phy1 ;
   phy-connection-type = rgmii-id;
   pio-handle =  pio2 ;
 diff --git a/arch/powerpc/boot/dts/mpc8568mds.dts b/arch/powerpc/ 
 boot/dts/mpc8568mds.dts
 index 5439437..cf45aab 100644
 --- a/arch/powerpc/boot/dts/mpc8568mds.dts
 +++ b/arch/powerpc/boot/dts/mpc8568mds.dts
 @@ -333,8 +333,8 @@
*/
   mac-address = [ 00 00 00 00 00 00 ];
   local-mac-address = [ 00 00 00 00 00 00 ];
 - rx-clock = 0;
 - tx-clock = 20;
 + rx-clock-name = none;
 

Re: [PATCH] Fix rounding bug in emulation for double floatoperating

2007-12-13 Thread Zang Roy-r61911
On Fri, 2007-12-14 at 13:46, Kumar Gala wrote:
  When I run this on a G5 (w/HW FP) I get:
 
  dmul 3fe0 * 1 = 0 expected 0 (PASS)
  dmul bfe0 * 1 = 8000 expected 0 (PASS)
  dmul 8001 * bfe0 = 0 expected 0 (PASS)
 
  ddiv 1 / 4000 = 0 expected 0 (PASS)
 
  and on the 85xx w/FP emu:
 
  dmul 3fe0 * 1 = 0 expected 0 (PASS)
  dmul bfe0 * 1 = 8000 expected 0 (PASS)
  dmul 8001 * bfe0 = 0 expected 0 (PASS)
 
  ddiv 1 / 4000 = 0 expected 0 (PASS)
 
  Maybe I'm missing where the error is.
  I am missing ...
  It is supposed to run based on previous IEEE 754 patch.
  http://ozlabs.org/pipermail/linuxppc-dev/2007-February/031351.html
 
 I'd really like to see to see a testcase show the issue with classic 
 FP emu on a 85xx system.
I can understand. 
You know, For a 85xx system without the previous patch or other
'classic' powerpc, it is hard to trigger this issue. Although I believe
it is a problem fixed up.
Do you have any idea?
Roy

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


Re: any more patches for 2.6.24?

2007-12-13 Thread Kumar Gala

On Dec 13, 2007, at 10:52 PM, Paul Mackerras wrote:

 Currently I have just this one bugfix queued up to go to Linus for
 2.6.24:

 Stephen Rothwell (1):
  [POWERPC] iSeries: don't printk with HV spinlock held

 Does anyone else have bugfixes that need to go in 2.6.24?

I've got a pull request I'm about to send you.

- k

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


Re: [PATCH] Fix rounding bug in emulation for double floatoperating

2007-12-13 Thread Kumar Gala

On Dec 14, 2007, at 12:06 AM, Zang Roy-r61911 wrote:

 On Fri, 2007-12-14 at 13:46, Kumar Gala wrote:
 When I run this on a G5 (w/HW FP) I get:

 dmul 3fe0 * 1 = 0 expected 0 (PASS)
 dmul bfe0 * 1 = 8000 expected 0 (PASS)
 dmul 8001 * bfe0 = 0 expected 0 (PASS)

 ddiv 1 / 4000 = 0 expected 0 (PASS)

 and on the 85xx w/FP emu:

 dmul 3fe0 * 1 = 0 expected 0 (PASS)
 dmul bfe0 * 1 = 8000 expected 0 (PASS)
 dmul 8001 * bfe0 = 0 expected 0 (PASS)

 ddiv 1 / 4000 = 0 expected 0 (PASS)

 Maybe I'm missing where the error is.
 I am missing ...
 It is supposed to run based on previous IEEE 754 patch.
 http://ozlabs.org/pipermail/linuxppc-dev/2007-February/031351.html

 I'd really like to see to see a testcase show the issue with classic
 FP emu on a 85xx system.
 I can understand.
 You know, For a 85xx system without the previous patch or other
 'classic' powerpc, it is hard to trigger this issue. Although I  
 believe
 it is a problem fixed up.
 Do you have any idea?

maybe I'm missing it, but can we not do the same operation w/classic  
FP that you are doing w/SPE fp?

is this in standard rounding mode, etc?

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


  1   2   >