Re: [PATCH 1/11] ibm_newemac: Add BCM5248 and Marvell 88E1111 PHY support
On Fri, Nov 30, 2007 at 04:40:23PM +1100, Benjamin Herrenschmidt wrote: > From: Stefan Roese <[EMAIL PROTECTED]> > > This patch adds BCM5248 and Marvell 88E PHY support to NEW EMAC driver. > These PHY chips are used on PowerPC 440EPx boards. > The PHY code is based on the previous work by Stefan Roese <[EMAIL PROTECTED]> Is there a reason the emac driver isn't using the generic phy code? ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
Re: [PATCH] Add MPC837xEMDS PCIE RC mode support
On Nov 29, 2007, at 9:45 PM, Li Li wrote: > The PCIE controller is initiated in u-boot. > > This patch is based on Leo`s mpc837xe patches. > > > Signed-off-by: Tony Li <[EMAIL PROTECTED]> > --- > arch/powerpc/boot/dts/mpc8377_mds.dts | 56 -- > arch/powerpc/boot/dts/mpc8378_mds.dts | 56 -- > arch/powerpc/platforms/83xx/Kconfig |7 ++ > arch/powerpc/platforms/83xx/mpc8313_rdb.c |2 +- > arch/powerpc/platforms/83xx/mpc832x_mds.c |2 +- > arch/powerpc/platforms/83xx/mpc832x_rdb.c |2 +- > arch/powerpc/platforms/83xx/mpc834x_itx.c |2 +- > arch/powerpc/platforms/83xx/mpc834x_mds.c |2 +- > arch/powerpc/platforms/83xx/mpc836x_mds.c |2 +- > arch/powerpc/platforms/83xx/mpc837x_mds.c |7 +- > arch/powerpc/platforms/83xx/mpc83xx.h | 10 ++- > arch/powerpc/platforms/83xx/pci.c | 166 > +++- > 12 files changed, 283 insertions(+), 31 deletions(-) > > diff --git a/arch/powerpc/boot/dts/mpc8377_mds.dts b/arch/powerpc/ > boot/dts/mpc8377_mds.dts > index 4402e39..1f7819e 100644 > > + > + [EMAIL PROTECTED] { I agree w/Olof. This should be [EMAIL PROTECTED] > > + interrupt-map-mask = ; > + msi-available-ranges = <43 4 51 52 56 57 58 59>; > + interrupt-map = < > + 0 0 1 &ipic 1 8 > + 0 0 2 &ipic 1 8 > + 0 0 3 &ipic 1 8 > + 0 0 4 &ipic 1 8 > + >; > + interrupt-parent = < &ipic >; > + interrupts = <1 8>; > + bus-range = <0 0>; > + ranges = <0200 0 A800 A800 0 1000 > + 0100 0 B800 0 0080>; > + clock-frequency = <0>; > + #interrupt-cells = <1>; > + #size-cells = <2>; > + #address-cells = <3>; > + reg = +a000 0800>; Shouldn't the reg size for the cfg space be 256M? > diff --git a/arch/powerpc/platforms/83xx/Kconfig b/arch/powerpc/ > platforms/83xx/Kconfig > index 0c61e7a..00154c5 100644 > --- a/arch/powerpc/platforms/83xx/Kconfig > +++ b/arch/powerpc/platforms/83xx/Kconfig > @@ -87,3 +87,10 @@ config PPC_MPC837x > select PPC_INDIRECT_PCI > select FSL_SERDES > default y if MPC837x_MDS > + > +config PPC_MPC83XX_PCIE > + bool "MPC837X PCI Express support" > + depends on PCIEPORTBUS && PPC_MPC837x > + default n > + help > + Enables MPC837x PCI express RC mode This should be a hidden config that is just selected by PPC_MPC837x instead of a choice. Also drop the depends on. > diff --git a/arch/powerpc/platforms/83xx/mpc83xx.h b/arch/powerpc/ > platforms/83xx/mpc83xx.h > index b778cb4..2078da7 100644 > --- a/arch/powerpc/platforms/83xx/mpc83xx.h > +++ b/arch/powerpc/platforms/83xx/mpc83xx.h > @@ -43,12 +43,18 @@ > #define PORTSCX_PTS_UTMI 0x > #define PORTSCX_PTS_ULPI 0x8000 > > +/* PCIE Registers */ > +#define PEX_LTSSM_STAT 0x404 > +#define PEX_LTSSM_STAT_L00x16 > +#define PEX_GCLK_RATIO 0x440 > + just move these into the .c file. > > /* > * Declaration for the various functions exported by the > * mpc83xx_* files. Mostly for use by mpc83xx_setup > */ > - > -extern int mpc83xx_add_bridge(struct device_node *dev); > +#define PPC_83XX_PCI 0x1 > +#define PPC_83XX_PCIE0x2 > +extern int mpc83xx_add_bridge(struct device_node *dev, int flags); > extern void mpc83xx_restart(char *cmd); > extern long mpc83xx_time_init(void); > extern int mpc834x_usb_cfg(void); > diff --git a/arch/powerpc/platforms/83xx/pci.c b/arch/powerpc/ > platforms/83xx/pci.c > index 80425d7..0b52b2e 100644 > --- a/arch/powerpc/platforms/83xx/pci.c > +++ b/arch/powerpc/platforms/83xx/pci.c > @@ -25,6 +25,8 @@ > #include > #include > > +#include "mpc83xx.h" > + > #undef DEBUG > > #ifdef DEBUG > @@ -33,13 +35,157 @@ > #define DBG(x...) > #endif > > -int __init mpc83xx_add_bridge(struct device_node *dev) > +#if defined(CONFIG_PPC_MPC83XX_PCIE) > + > +/* PCIE config space Read/Write routines */ should really be called something like mpc83xx_pciex_read_config > > +static int direct_read_config_pcie(struct pci_bus *bus, > + uint devfn, int offset, int len, u32 *val) > +{ > + struct pci_controller *hose = bus->sysdata; > + void __iomem *cfg_addr; > + u32 bus_no; > + > + if (hose->indirect_type & PPC_INDIRECT_TYPE_NO_PCIE_LINK) > + return PCIBIOS_DEVICE_NOT_FOUND; > + > + if (ppc_md.pci_exclude_device) > + if (ppc_md.pci_exclude_device(hose, bus->number, devfn)) > + return PCIBIOS_DEVICE_NOT_FOUND; > + > + switch (len) { > + case 2: > + if (offset & 1) > + return -EINVAL; > + break; > + case 4: > + if (offset & 3) > + return -EINVAL; > + break;
Re: [BUG] 2.6.24-rc3-git2 softlockup detected
Andrew Morton wrote: > On Thu, 29 Nov 2007 23:00:47 -0800 Andrew Morton <[EMAIL PROTECTED]> wrote: > >> On Fri, 30 Nov 2007 01:39:29 -0500 Kyle McMartin <[EMAIL PROTECTED]> wrote: >> >>> On Thu, Nov 29, 2007 at 12:35:33AM -0800, Andrew Morton wrote: ten million is close enough to infinity for me to assume that we broke the driver and that's never going to terminate. >>> how about this? doesn't break things on my pa8800: >>> >>> diff --git a/drivers/scsi/sym53c8xx_2/sym_hipd.c >>> b/drivers/scsi/sym53c8xx_2/sym_hipd.c >>> index 463f119..ef01cb1 100644 >>> --- a/drivers/scsi/sym53c8xx_2/sym_hipd.c >>> +++ b/drivers/scsi/sym53c8xx_2/sym_hipd.c >>> @@ -1037,10 +1037,13 @@ restart_test: >>> /* >>> * Wait 'til done (with timeout) >>> */ >>> - for (i=0; i>> + do { >>> if (INB(np, nc_istat) & (INTF|SIP|DIP)) >>> break; >>> - if (i>=SYM_SNOOP_TIMEOUT) { >>> + msleep(10); >>> + } while (i++ < SYM_SNOOP_TIMEOUT); >>> + >>> + if (i >= SYM_SNOOP_TIMEOUT) { >>> printf ("CACHE TEST FAILED: timeout.\n"); >>> return (0x20); >>> } >>> diff --git a/drivers/scsi/sym53c8xx_2/sym_hipd.h >>> b/drivers/scsi/sym53c8xx_2/sym_hipd.h >>> index ad07880..85c483b 100644 >>> --- a/drivers/scsi/sym53c8xx_2/sym_hipd.h >>> +++ b/drivers/scsi/sym53c8xx_2/sym_hipd.h >>> @@ -339,7 +339,7 @@ >>> /* >>> * Misc. >>> */ >>> -#define SYM_SNOOP_TIMEOUT (1000) >>> +#define SYM_SNOOP_TIMEOUT (1000) >>> #define BUS_8_BIT 0 >>> #define BUS_16_BIT 1 >>> >> That might be the fix, but do we know what we're actually fixing? afaik >> 2.6.24-rc3 doesn't get this timeout, 2.6.24-rc3-mm2 does get it and we >> don't know why? >> > > > > > > So 2.6.24-rc3 was OK and 2.6.24-rc3-git2 is not? Yes, the 2.6.24-rc3 was Ok and this is seen from 2.6.24-rc3-git2/3/4. -- Thanks & Regards, Kamalesh Babulal, Linux Technology Center, IBM, ISTL. ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
Re: [BUG] 2.6.24-rc3-git2 softlockup detected
On Thu, 29 Nov 2007 23:00:47 -0800 Andrew Morton <[EMAIL PROTECTED]> wrote: > On Fri, 30 Nov 2007 01:39:29 -0500 Kyle McMartin <[EMAIL PROTECTED]> wrote: > > > On Thu, Nov 29, 2007 at 12:35:33AM -0800, Andrew Morton wrote: > > > ten million is close enough to infinity for me to assume that we broke the > > > driver and that's never going to terminate. > > > > > > > how about this? doesn't break things on my pa8800: > > > > diff --git a/drivers/scsi/sym53c8xx_2/sym_hipd.c > > b/drivers/scsi/sym53c8xx_2/sym_hipd.c > > index 463f119..ef01cb1 100644 > > --- a/drivers/scsi/sym53c8xx_2/sym_hipd.c > > +++ b/drivers/scsi/sym53c8xx_2/sym_hipd.c > > @@ -1037,10 +1037,13 @@ restart_test: > > /* > > * Wait 'til done (with timeout) > > */ > > - for (i=0; i > + do { > > if (INB(np, nc_istat) & (INTF|SIP|DIP)) > > break; > > - if (i>=SYM_SNOOP_TIMEOUT) { > > + msleep(10); > > + } while (i++ < SYM_SNOOP_TIMEOUT); > > + > > + if (i >= SYM_SNOOP_TIMEOUT) { > > printf ("CACHE TEST FAILED: timeout.\n"); > > return (0x20); > > } > > diff --git a/drivers/scsi/sym53c8xx_2/sym_hipd.h > > b/drivers/scsi/sym53c8xx_2/sym_hipd.h > > index ad07880..85c483b 100644 > > --- a/drivers/scsi/sym53c8xx_2/sym_hipd.h > > +++ b/drivers/scsi/sym53c8xx_2/sym_hipd.h > > @@ -339,7 +339,7 @@ > > /* > > * Misc. > > */ > > -#define SYM_SNOOP_TIMEOUT (1000) > > +#define SYM_SNOOP_TIMEOUT (1000) > > #define BUS_8_BIT 0 > > #define BUS_16_BIT 1 > > > > That might be the fix, but do we know what we're actually fixing? afaik > 2.6.24-rc3 doesn't get this timeout, 2.6.24-rc3-mm2 does get it and we > don't know why? > So 2.6.24-rc3 was OK and 2.6.24-rc3-git2 is not? ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
Re: [BUG] 2.6.24-rc3-git2 softlockup detected
On Fri, 30 Nov 2007 01:39:29 -0500 Kyle McMartin <[EMAIL PROTECTED]> wrote: > On Thu, Nov 29, 2007 at 12:35:33AM -0800, Andrew Morton wrote: > > ten million is close enough to infinity for me to assume that we broke the > > driver and that's never going to terminate. > > > > how about this? doesn't break things on my pa8800: > > diff --git a/drivers/scsi/sym53c8xx_2/sym_hipd.c > b/drivers/scsi/sym53c8xx_2/sym_hipd.c > index 463f119..ef01cb1 100644 > --- a/drivers/scsi/sym53c8xx_2/sym_hipd.c > +++ b/drivers/scsi/sym53c8xx_2/sym_hipd.c > @@ -1037,10 +1037,13 @@ restart_test: > /* >* Wait 'til done (with timeout) >*/ > - for (i=0; i + do { > if (INB(np, nc_istat) & (INTF|SIP|DIP)) > break; > - if (i>=SYM_SNOOP_TIMEOUT) { > + msleep(10); > + } while (i++ < SYM_SNOOP_TIMEOUT); > + > + if (i >= SYM_SNOOP_TIMEOUT) { > printf ("CACHE TEST FAILED: timeout.\n"); > return (0x20); > } > diff --git a/drivers/scsi/sym53c8xx_2/sym_hipd.h > b/drivers/scsi/sym53c8xx_2/sym_hipd.h > index ad07880..85c483b 100644 > --- a/drivers/scsi/sym53c8xx_2/sym_hipd.h > +++ b/drivers/scsi/sym53c8xx_2/sym_hipd.h > @@ -339,7 +339,7 @@ > /* > * Misc. > */ > -#define SYM_SNOOP_TIMEOUT (1000) > +#define SYM_SNOOP_TIMEOUT (1000) > #define BUS_8_BIT0 > #define BUS_16_BIT 1 > That might be the fix, but do we know what we're actually fixing? afaik 2.6.24-rc3 doesn't get this timeout, 2.6.24-rc3-mm2 does get it and we don't know why? ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
Re: [BUG] 2.6.24-rc3-git2 softlockup detected
On Thu, Nov 29, 2007 at 12:35:33AM -0800, Andrew Morton wrote: > ten million is close enough to infinity for me to assume that we broke the > driver and that's never going to terminate. > how about this? doesn't break things on my pa8800: diff --git a/drivers/scsi/sym53c8xx_2/sym_hipd.c b/drivers/scsi/sym53c8xx_2/sym_hipd.c index 463f119..ef01cb1 100644 --- a/drivers/scsi/sym53c8xx_2/sym_hipd.c +++ b/drivers/scsi/sym53c8xx_2/sym_hipd.c @@ -1037,10 +1037,13 @@ restart_test: /* * Wait 'til done (with timeout) */ - for (i=0; i=SYM_SNOOP_TIMEOUT) { + msleep(10); + } while (i++ < SYM_SNOOP_TIMEOUT); + + if (i >= SYM_SNOOP_TIMEOUT) { printf ("CACHE TEST FAILED: timeout.\n"); return (0x20); } diff --git a/drivers/scsi/sym53c8xx_2/sym_hipd.h b/drivers/scsi/sym53c8xx_2/sym_hipd.h index ad07880..85c483b 100644 --- a/drivers/scsi/sym53c8xx_2/sym_hipd.h +++ b/drivers/scsi/sym53c8xx_2/sym_hipd.h @@ -339,7 +339,7 @@ /* * Misc. */ -#define SYM_SNOOP_TIMEOUT (1000) +#define SYM_SNOOP_TIMEOUT (1000) #define BUS_8_BIT 0 #define BUS_16_BIT 1 ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
[PATCH 24/24] powerpc: Base support for 440SPe "Katmai" eval board
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]> --- 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/44x.h |1 arch/powerpc/boot/Makefile |7 arch/powerpc/boot/cuboot-katmai.c | 35 +++ arch/powerpc/boot/dts/katmai.dts| 392 arch/powerpc/boot/katmai.c | 64 + arch/powerpc/platforms/44x/Kconfig | 12 + arch/powerpc/platforms/44x/Makefile |3 arch/powerpc/platforms/44x/katmai.c | 63 + 8 files changed, 574 insertions(+), 3 deletions(-) Index: linux-work/arch/powerpc/platforms/44x/Kconfig === --- linux-work.orig/arch/powerpc/platforms/44x/Kconfig 2007-11-30 13:51:48.0 +1100 +++ linux-work/arch/powerpc/platforms/44x/Kconfig 2007-11-30 13:51:48.0 +1100 @@ -30,6 +30,14 @@ config TAISHAN help This option enables support for the IBM PPC440GX "Taishan" evaluation board. +config KATMAI + bool "Katmai" + depends on 44x + default n + select 440SPe + help + This option enables support for the AMCC PPC440SPe evaluation board. + #config LUAN # bool "Luan" # depends on 44x @@ -74,6 +82,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-work/arch/powerpc/platforms/44x/Makefile === --- linux-work.orig/arch/powerpc/platforms/44x/Makefile 2007-11-30 13:51:48.0 +1100 +++ linux-work/arch/powerpc/platforms/44x/Makefile 2007-11-30 13:51:48.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-work/arch/powerpc/boot/dts/katmai.dts === --- /dev/null 1970-01-01 00:00:00.0 + +++ linux-work/arch/powerpc/boot/dts/katmai.dts 2007-11-30 14:46:02.0 +1100 @@ -0,0 +1,392 @@ +/* + * Device Tree Source for AMCC Bamboo + * + * Copyright (c) 2006, 2007 IBM Corp. + * Benjamin Herrenschmidt <[EMAIL PROTECTED]> + * + * Copyright (c) 2006, 2007 IBM Corp. + * Josh Boyer <[EMAIL PROTECTED]> + * + * FIXME: Draft only! + * + * 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>; +
[PATCH 23/24] powerpc: Rework 4xx clock probing in boot wrapper
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. 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 |4 arch/powerpc/boot/dcr.h| 17 ++ arch/powerpc/boot/ebony.c | 60 arch/powerpc/boot/reg.h|8 + arch/powerpc/boot/taishan.c|4 8 files changed, 242 insertions(+), 136 deletions(-) Index: linux-work/arch/powerpc/boot/4xx.c === --- linux-work.orig/arch/powerpc/boot/4xx.c 2007-11-27 18:11:36.0 +1100 +++ linux-work/arch/powerpc/boot/4xx.c 2007-11-27 18:19:21.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_f
[PATCH 22/24] powerpc: Add mfspr/mtspr inline macros to 4xx bootwrapper
The 4xx bootwrapper occasionally needs to access SPR registers, this adds mfspr/mtspr wrappers to it. Signed-off-by: Benjamin Herrenschmidt <[EMAIL PROTECTED]> --- === --- linux-work.orig/arch/powerpc/boot/reg.h 2007-11-27 14:37:00.0 +1100 +++ linux-work/arch/powerpc/boot/reg.h 2007-11-27 14:37:58.0 +1100 @@ -16,6 +16,14 @@ static inline u32 mfpvr(void) return pvr; } +#define __stringify_1(x) #x +#define __stringify(x) __stringify_1(x) + +#define mfspr(rn) ({unsigned long rval; \ + asm volatile("mfspr %0," __stringify(rn) \ + : "=r" (rval)); rval;}) +#define mtspr(rn, v) asm volatile("mtspr " __stringify(rn) ",%0" : : "r" (v)) + register void *__stack_pointer asm("r1"); #define get_sp() (__stack_pointer) ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
[PATCH 21/24] powerpc: Adds decoding of 440SPE memory size to boot wrapper library
This adds a function to the bootwrapper 4xx library to decode memory size on 440SPE processors. Signed-off-by: Benjamin Herrenschmidt <[EMAIL PROTECTED]> --- arch/powerpc/boot/4xx.c | 85 +--- arch/powerpc/boot/4xx.h |3 - arch/powerpc/boot/bamboo.c |2 arch/powerpc/boot/dcr.h | 10 +++- arch/powerpc/boot/ebony.c |2 arch/powerpc/boot/taishan.c |2 arch/powerpc/boot/treeboot-walnut.c |2 7 files changed, 85 insertions(+), 21 deletions(-) Index: linux-work/arch/powerpc/boot/4xx.c === --- linux-work.orig/arch/powerpc/boot/4xx.c 2007-11-27 18:07:50.0 +1100 +++ linux-work/arch/powerpc/boot/4xx.c 2007-11-27 18:11:36.0 +1100 @@ -22,16 +22,14 @@ #include "dcr.h" /* Read the 4xx SDRAM controller to get size of system memory. */ -void ibm4xx_fixup_memsize(void) +void ibm4xx_sdram_fixup_memsize(void) { int i; unsigned long memsize, bank_config; memsize = 0; for (i = 0; i < ARRAY_SIZE(sdram_bxcr); i++) { - mtdcr(DCRN_SDRAM0_CFGADDR, sdram_bxcr[i]); - bank_config = mfdcr(DCRN_SDRAM0_CFGDATA); - + bank_config = SDRAM0_READ(sdram_bxcr[i]); if (bank_config & SDRAM_CONFIG_BANK_ENABLE) memsize += SDRAM_CONFIG_BANK_SIZE(bank_config); } @@ -39,6 +37,69 @@ void ibm4xx_fixup_memsize(void) dt_fixup_memory(0, memsize); } +/* Read the 440SPe MQ controller to get size of system memory. */ +#define DCRN_MQ0_B0BAS 0x40 +#define DCRN_MQ0_B1BAS 0x41 +#define DCRN_MQ0_B2BAS 0x42 +#define DCRN_MQ0_B3BAS 0x43 + +static u64 ibm440spe_decode_bas(u32 bas) +{ + u64 base = ((u64)(bas & 0xFFE0u)) << 2; + + /* open coded because I'm paranoid about invalid values */ + switch((bas >> 4) & 0xFFF) { + case 0: + return 0; + case 0xffc: + return base + 0x00080ull; + case 0xff8: + return base + 0x00100ull; + case 0xff0: + return base + 0x00200ull; + case 0xfe0: + return base + 0x00400ull; + case 0xfc0: + return base + 0x00800ull; + case 0xf80: + return base + 0x01000ull; + case 0xf00: + return base + 0x02000ull; + case 0xe00: + return base + 0x04000ull; + case 0xc00: + return base + 0x08000ull; + case 0x800: + return base + 0x1ull; + } + printf("Memory BAS value 0x%08x unsupported !\n", bas); + return 0; +} + +void ibm440spe_fixup_memsize(void) +{ + u64 banktop, memsize = 0; + + /* Ultimately, we should directly construct the memory node +* so we are able to handle holes in the memory address space +*/ + banktop = ibm440spe_decode_bas(mfdcr(DCRN_MQ0_B0BAS)); + if (banktop > memsize) + memsize = banktop; + banktop = ibm440spe_decode_bas(mfdcr(DCRN_MQ0_B1BAS)); + if (banktop > memsize) + memsize = banktop; + banktop = ibm440spe_decode_bas(mfdcr(DCRN_MQ0_B2BAS)); + if (banktop > memsize) + memsize = banktop; + banktop = ibm440spe_decode_bas(mfdcr(DCRN_MQ0_B3BAS)); + if (banktop > memsize) + memsize = banktop; + + dt_fixup_memory(0, memsize); +} + + /* 4xx DDR1/2 Denali memory controller support */ /* DDR0 registers */ #define DDR0_022 @@ -77,19 +138,13 @@ void ibm4xx_fixup_memsize(void) #define DDR_GET_VAL(val, mask, shift) (((val) >> (shift)) & (mask)) -static inline u32 mfdcr_sdram0(u32 reg) -{ -mtdcr(DCRN_SDRAM0_CFGADDR, reg); -return mfdcr(DCRN_SDRAM0_CFGDATA); -} - void ibm4xx_denali_fixup_memsize(void) { u32 val, max_cs, max_col, max_row; u32 cs, col, row, bank, dpath; unsigned long memsize; - val = mfdcr_sdram0(DDR0_02); + val = SDRAM0_READ(DDR0_02); if (!DDR_GET_VAL(val, DDR_START, DDR_START_SHIFT)) fatal("DDR controller is not initialized\n"); @@ -99,7 +154,7 @@ void ibm4xx_denali_fixup_memsize(void) max_row = DDR_GET_VAL(val, DDR_MAX_ROW_REG, DDR_MAX_ROW_REG_SHIFT); /* get CS value */ - val = mfdcr_sdram0(DDR0_10); + val = SDRAM0_READ(DDR0_10); val = DDR_GET_VAL(val, DDR_CS_MAP, DDR_CS_MAP_SHIFT); cs = 0; @@ -115,7 +170,7 @@ void ibm4xx_denali_fixup_memsize(void) fatal("DDR wrong CS configuration\n"); /* get data path bytes */ - val = mfdcr_sdram0(DDR0_14); + val = SDRAM0_READ(DDR0_14); if (DDR_GET_VAL(val, DDR_REDUC, DDR_REDUC_SHIFT)) dpath = 8; /* 64 bits */ @@ -123,7 +178,7 @@ void ibm4xx_denali_fixup_memsiz
[PATCH 20/24] powerpc: Wire up 440EP USB controlle support to Bamboo board
This adds the definition of the on-chip OHCI controller to the Bamboo board's device-tree. This is enough to get it probed and working, though a separate patch fixing a bug in the OHCI driver is needed to make it reliable. Signed-off-by: Benjamin Herrenschmidt <[EMAIL PROTECTED]> --- arch/powerpc/boot/dts/bamboo.dts |7 +++ 1 file changed, 7 insertions(+) Index: linux-work/arch/powerpc/boot/dts/bamboo.dts === --- linux-work.orig/arch/powerpc/boot/dts/bamboo.dts2007-11-26 10:11:09.0 +1100 +++ linux-work/arch/powerpc/boot/dts/bamboo.dts 2007-11-27 14:37:50.0 +1100 @@ -238,6 +238,13 @@ zmii-device = <&ZMII0>; zmii-channel = <1>; }; + + [EMAIL PROTECTED] { + compatible = "ohci-be"; + reg = ; + interrupts = <8 1 9 1>; + interrupt-parent = < &UIC1 >; + }; }; PCI0: [EMAIL PROTECTED] { ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
[PATCH 19/24] powerpc: Wire up PCI on Bamboo board
This adds the device-tree bits & call to ppc4xx_pci_find_bridges() to make PCI work on the Bamboo board Signed-off-by: Benjamin Herrenschmidt <[EMAIL PROTECTED]> --- arch/powerpc/boot/dts/bamboo.dts | 40 ++- 1 file changed, 39 insertions(+), 1 deletion(-) Index: linux-work/arch/powerpc/boot/dts/bamboo.dts === --- linux-work.orig/arch/powerpc/boot/dts/bamboo.dts2007-11-30 13:40:21.0 +1100 +++ linux-work/arch/powerpc/boot/dts/bamboo.dts 2007-11-30 13:40:45.0 +1100 @@ -239,10 +239,48 @@ zmii-channel = <1>; }; }; + + PCI0: [EMAIL PROTECTED] { + device_type = "pci"; + #interrupt-cells = <1>; + #size-cells = <2>; + #address-cells = <3>; + compatible = "ibm,plb440ep-pci", "ibm,plb-pci"; + primary; + reg = <0 eec0 8 /* Config space access */ + 0 eed8 4 /* IACK */ + 0 eed8 4 /* Special cycle */ + 0 ef48 40>; /* Internal registers */ + + /* Outbound ranges, one memory and one IO, +* later cannot be changed. Chip supports a second +* IO range but we don't use it for now +*/ + ranges = <0200 0 a000 0 a000 0 2000 + 0100 0 0 e800 0 0001>; + + /* Inbound 2GB range starting at 0 */ + dma-ranges = <4200 0 0 0 0 0 8000>; + + /* Walnut has all 4 IRQ pins tied together per slot */ + interrupt-map-mask = ; + interrupt-map = < + /* IDSEL 1 */ + 0800 0 0 0 &UIC0 1c 8 + + /* IDSEL 2 */ + 1000 0 0 0 &UIC0 1b 8 + + /* IDSEL 3 */ + 1800 0 0 0 &UIC0 1a 8 + + /* IDSEL 4 */ + 2000 0 0 0 &UIC0 19 8 + >; + }; }; chosen { linux,stdout-path = "/plb/opb/[EMAIL PROTECTED]"; - bootargs = "console=ttyS0,115200"; }; }; ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
[PATCH 18/24] powerpc: Base support for 440GX Taishan eval board
From: Hugh Blemings <[EMAIL PROTECTED]> Signed-off-by: Hugh Blemings <[EMAIL PROTECTED]> Signed-off-by: Benjamin Herrenschmidt <[EMAIL PROTECTED]> --- This needs a bit of cleanup still, probably not to be merged as-is just yet (like using mtdcri/mfdcri for CPR access). arch/powerpc/Kconfig.debug |6 arch/powerpc/boot/44x.h |1 arch/powerpc/boot/Makefile |7 arch/powerpc/boot/cuboot-taishan.c | 35 ++ arch/powerpc/boot/dcr.h | 32 ++ arch/powerpc/boot/dts/taishan.dts| 414 +++ arch/powerpc/boot/taishan.c | 64 + arch/powerpc/platforms/44x/Kconfig | 12 + arch/powerpc/platforms/44x/Makefile |1 arch/powerpc/platforms/44x/taishan.c | 74 ++ 10 files changed, 643 insertions(+), 3 deletions(-) Index: linux-work/arch/powerpc/boot/44x.h === --- linux-work.orig/arch/powerpc/boot/44x.h 2007-11-30 13:27:01.0 +1100 +++ linux-work/arch/powerpc/boot/44x.h 2007-11-30 13:39:18.0 +1100 @@ -12,5 +12,6 @@ void ebony_init(void *mac0, void *mac1); void bamboo_init(void *mac0, void *mac1); +void taishan_init(void *mac0, void *mac1); #endif /* _PPC_BOOT_44X_H_ */ Index: linux-work/arch/powerpc/boot/dcr.h === --- linux-work.orig/arch/powerpc/boot/dcr.h 2007-11-30 13:27:01.0 +1100 +++ linux-work/arch/powerpc/boot/dcr.h 2007-11-30 13:39:18.0 +1100 @@ -139,4 +139,36 @@ 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 + +//#defineCPC0_SYS0_TUNE 0xffc0 +//#defineCPC0_SYS0_FBDV_MASK 0x003c +//#defineCPC0_SYS0_FWDVA_MASK0x00038000 + + +/* 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_ */ Index: linux-work/arch/powerpc/boot/Makefile === --- linux-work.orig/arch/powerpc/boot/Makefile 2007-11-30 13:38:25.0 +1100 +++ linux-work/arch/powerpc/boot/Makefile 2007-11-30 13:39:18.0 +1100 @@ -37,8 +37,10 @@ BOOTCFLAGS += -I$(obj) -I$(srctree)/$(ob $(obj)/4xx.o: BOOTCFLAGS += -mcpu=440 $(obj)/ebony.o: BOOTCFLAGS += -mcpu=440 +$(obj)/taishan.o: BOOTCFLAGS += -mcpu=440 $(obj)/treeboot-walnut.o: BOOTCFLAGS += -mcpu=405 + zlib := inffast.c inflate.c inftrees.c zlibheader := inffast.h inffixed.h inflate.h inftrees.h infutil.h zliblinuxheader := zlib.h zconf.h zutil.h @@ -51,12 +53,12 @@ src-wlib := string.S crt0.S stdio.c main gunzip_util.c elf_util.c $(zlib) devtree.c oflib.c ofconsole.c \ 4xx.c ebony.c mv64x60.c mpsc.c mv64x60_i2c.c cuboot.c bamboo.c \ cpm-serial.c stdlib.c mpc52xx-psc.c planetcore.c uartlite.c \ - fsl-soc.c mpc8xx.c pq2.c + fsl-soc.c mpc8xx.c pq2.c taishan.c 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 ep405.c + fixed-head.S ep88xc.c cuboot-hpc2.c ep405.c cuboot-taishan.c src-boot := $(src-wlib) $(src-plat) empty.c src-boot := $(addprefix $(obj)/, $(src-boot)) @@ -160,6 +162,7 @@ image-$(CONFIG_EBONY) += treeImage.ebo image-$(CONFIG_BAMBOO) += treeImage.bamboo #cuImage.bamboo #image-$(CONFIG_SEQUOIA) += cuImage.sequoia image-$(CONFIG_WALNUT) += treeImage.walnut +image-$(CONFIG_TAISHAN)+= cuImage.taishan endif # For 32-bit powermacs, build the COFF and miboot images Index: linux-work/arch/powerpc/Kconfig.debug ==
[PATCH 17/24] powerpc: Add PCI to Walnut platform
This wires up the 4xx PCI support & device-tree bits for the 405GP based Walnut platform. Signed-off-by: Benjamin Herrenschmidt <[EMAIL PROTECTED]> --- This one is untested, haven't had time to dig my walnut and put it back into working condition. Josh, can you verify that IRQs are working (routing is correct ?) Thanks ! arch/powerpc/boot/dts/walnut.dts | 39 +++ 1 file changed, 39 insertions(+) Index: linux-work/arch/powerpc/boot/dts/walnut.dts === --- linux-work.orig/arch/powerpc/boot/dts/walnut.dts2007-11-13 11:39:44.0 +1100 +++ linux-work/arch/powerpc/boot/dts/walnut.dts 2007-11-27 18:28:07.0 +1100 @@ -190,6 +190,45 @@ virtual-reg = ; }; }; + + PCI0: [EMAIL PROTECTED] { + device_type = "pci"; + #interrupt-cells = <1>; + #size-cells = <2>; + #address-cells = <3>; + compatible = "ibm,plb405gp-pci", "ibm,plb-pci"; + primary; + reg = ;/* Internal registers */ + + /* Outbound ranges, one memory and one IO, +* later cannot be changed. Chip supports a second +* IO range but we don't use it for now +*/ + ranges = <0200 0 8000 8000 0 2000 + 0100 0 e800 0 0001>; + + /* Inbound 2GB range starting at 0 */ + dma-ranges = <4200 0 0 0 0 8000>; + + /* Walnut has all 4 IRQ pins tied together per slot */ + interrupt-map-mask = ; + interrupt-map = < + /* IDSEL 1 */ + 0800 0 0 0 &UIC0 1c 8 + + /* IDSEL 2 */ + 1000 0 0 0 &UIC0 1d 8 + + /* IDSEL 3 */ + 1800 0 0 0 &UIC0 1e 8 + + /* IDSEL 4 */ + 2000 0 0 0 &UIC0 1f 8 + >; + }; }; chosen { ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
[PATCH 16/24] powerpc: EP405 boards support for arch/powerpc
Brings EP405 support to arch/powerpc. The IRQ routing for the CPLD comes from a device-tree property, PCI is working to the point where I can see the video card, USB device, and south bridge. This should work with both EP405 and EP405PC. I've not totally figured out how IRQs are wired on this hardware though, thus at this stage, expect only USB interrupts working, pretty much the same as what arch/ppc did. Also, the flash, nvram, rtc and temp control still have to be wired. Signed-off-by: Benjamin Herrenschmidt <[EMAIL PROTECTED]> --- Note about IRQ routing: The doc is very obscure in that area. I _think_ the SB interrupt on the CPLD is actually the Windond's 8259 output and the NB interrupt is the PCI_A...PCI_D mux in there (which can be implemented as a cascaded controller) but I haven't sorted that out yet. If anybody from Embedded Planet is around, I could use some advice there. If my deductions are correct, then we would need to wire up the 8259 driver to SB, which should be trivial provided I stick the windbond bridge in the device-tree, or at least part of it, and probably implement a cascaded controller for the PCI IRQ A...D mux thingy, which should also be trivial. Note also that it tends to lockup during the transition from the boot wrapper to the kernel, before udbg is started. I didn't have a RiscWatch at hand so I haven't yet been able to track that down. It's random though, quite weird. Maybe some stale TLB entries or cache content that isn't cleared properly... arch/powerpc/boot/4xx.c | 55 +- arch/powerpc/boot/4xx.h |1 arch/powerpc/boot/Makefile |3 arch/powerpc/boot/dts/ep405.dts | 221 arch/powerpc/boot/ep405.c| 74 ++ arch/powerpc/boot/treeboot-walnut.c | 49 - arch/powerpc/boot/wrapper|2 arch/powerpc/configs/ep405_defconfig | 951 +++ arch/powerpc/platforms/40x/Kconfig | 21 arch/powerpc/platforms/40x/Makefile |1 arch/powerpc/platforms/40x/ep405.c | 125 11 files changed, 1437 insertions(+), 66 deletions(-) Index: linux-work/arch/powerpc/boot/Makefile === --- linux-work.orig/arch/powerpc/boot/Makefile 2007-11-30 13:31:51.0 +1100 +++ linux-work/arch/powerpc/boot/Makefile 2007-11-30 13:38:25.0 +1100 @@ -56,7 +56,7 @@ src-plat := of.c cuboot-52xx.c cuboot-83 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 ep405.c src-boot := $(src-wlib) $(src-plat) empty.c src-boot := $(addprefix $(obj)/, $(src-boot)) @@ -150,6 +150,7 @@ image-$(CONFIG_DEFAULT_UIMAGE) += uImag ifneq ($(CONFIG_DEVICE_TREE),"") image-$(CONFIG_PPC_8xx)+= cuImage.8xx image-$(CONFIG_PPC_EP88XC) += zImage.ep88xc +image-$(CONFIG_EP405) += zImage.ep405 image-$(CONFIG_8260) += cuImage.pq2 image-$(CONFIG_PPC_MPC52xx)+= cuImage.52xx image-$(CONFIG_PPC_83xx) += cuImage.83xx Index: linux-work/arch/powerpc/boot/ep405.c === --- /dev/null 1970-01-01 00:00:00.0 + +++ linux-work/arch/powerpc/boot/ep405.c2007-11-30 13:38:25.0 +1100 @@ -0,0 +1,74 @@ +/* + * Embedded Planet EP405 with PlanetCore firmware + * + * (c) Benjamin Herrenschmidt <[EMAIL PROTECTED]>, IBM Corp,\ + * + * Based on ep88xc.c by + * + * 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 "stdio.h" +#include "planetcore.h" +#include "dcr.h" +#include "4xx.h" +#include "io.h" + +static char *table; +static u64 mem_size; + +static void platform_fixups(void) +{ + u64 val; + void *nvrtc; + + dt_fixup_memory(0, mem_size); + planetcore_set_mac_addrs(table); + + if (!planetcore_get_decimal(table, PLANETCORE_KEY_CRYSTAL_HZ, &val)) { + printf("No PlanetCore crystal frequency key.\r\n"); + return; + } + ibm405gp_fixup_clocks(val, 0xa8c000); + ibm4xx_quiesce_eth((u32 *)0xef600800, NULL); + ibm4xx_fixup_ebc_ranges("/plb/ebc"); + + if (!planetcore_get_decimal(table, PLANETCORE_KEY_KB_NVRAM, &val)) { + printf("No PlanetCore NVRAM size key.\r\n"); + return; + } + nvrtc = finddevice("/plb/ebc/[EMAIL PROTECTED],20"); + if (nvrtc != NULL) { + u32 reg[
[PATCH 15/24] powerpc: early debug forces console log level to max
This patch makes the early debug option force the console loglevel to the max. The early debug option is meant to catch messages very early in the kernel boot process, in many cases, before the kernel has a chance to parse the "debug" command line argument. Thus it makes sense when CONFIG_PPC_EARLY_DEBUG is set, to force the console log level to the max at boot time. Signed-off-by: Benjamin Herrenschmidt <[EMAIL PROTECTED]> --- arch/powerpc/kernel/udbg.c |4 1 file changed, 4 insertions(+) Index: linux-work/arch/powerpc/kernel/udbg.c === --- linux-work.orig/arch/powerpc/kernel/udbg.c 2007-11-30 13:29:51.0 +1100 +++ linux-work/arch/powerpc/kernel/udbg.c 2007-11-30 13:29:56.0 +1100 @@ -60,6 +60,10 @@ void __init udbg_early_init(void) #elif defined(CONFIG_PPC_EARLY_DEBUG_CPM) udbg_init_cpm(); #endif + +#ifdef CONFIG_PPC_EARLY_DEBUG + console_loglevel = 10; +#endif } /* udbg library, used by xmon et al */ ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
[PATCH 14/24] powerpc: Add early udbg support for 40x processors
This adds some basic real mode based early udbg support for 40x in order to debug things more easily Signed-off-by: Benjamin Herrenschmidt <[EMAIL PROTECTED]> --- arch/powerpc/Kconfig.debug | 13 +++ arch/powerpc/kernel/misc_32.S | 39 + arch/powerpc/kernel/udbg.c |3 ++ arch/powerpc/kernel/udbg_16550.c | 33 +++ arch/powerpc/platforms/Kconfig.cputype |1 include/asm-powerpc/udbg.h |1 6 files changed, 90 insertions(+) Index: linux-work/arch/powerpc/Kconfig.debug === --- linux-work.orig/arch/powerpc/Kconfig.debug 2007-11-26 09:38:46.0 +1100 +++ linux-work/arch/powerpc/Kconfig.debug 2007-11-26 09:45:59.0 +1100 @@ -220,6 +220,14 @@ config PPC_EARLY_DEBUG_44x Select this to enable early debugging for IBM 44x chips via the inbuilt serial port. +config PPC_EARLY_DEBUG_40x + bool "Early serial debugging for IBM/AMCC 40x CPUs" + depends on 40x + help + Select this to enable early debugging for IBM 40x chips via the + inbuilt serial port. This works on chips with a 16550 compatible + UART. Xilinx chips with uartlite cannot use this option. + config PPC_EARLY_DEBUG_CPM bool "Early serial debugging for Freescale CPM-based serial ports" depends on SERIAL_CPM @@ -241,6 +249,11 @@ config PPC_EARLY_DEBUG_44x_PHYSHIGH depends on PPC_EARLY_DEBUG_44x default "0x1" +config PPC_EARLY_DEBUG_40x_PHYSADDR + hex "Early debug UART physical address" + depends on PPC_EARLY_DEBUG_40x + default "0xef600300" + config PPC_EARLY_DEBUG_CPM_ADDR hex "CPM UART early debug transmit descriptor address" depends on PPC_EARLY_DEBUG_CPM Index: linux-work/arch/powerpc/kernel/misc_32.S === --- linux-work.orig/arch/powerpc/kernel/misc_32.S 2007-11-26 09:38:46.0 +1100 +++ linux-work/arch/powerpc/kernel/misc_32.S2007-11-26 09:44:04.0 +1100 @@ -206,6 +206,45 @@ _GLOBAL(_nmask_and_or_msr) isync blr /* Done */ +#ifdef CONFIG_40x + +/* + * Do an IO access in real mode + */ +_GLOBAL(real_readb) + mfmsr r7 + ori r0,r7,MSR_DR + xorir0,r0,MSR_DR + sync + mtmsr r0 + sync + isync + lbz r3,0(r3) + sync + mtmsr r7 + sync + isync + blr + + /* + * Do an IO access in real mode + */ +_GLOBAL(real_writeb) + mfmsr r7 + ori r0,r7,MSR_DR + xorir0,r0,MSR_DR + sync + mtmsr r0 + sync + isync + stb r3,0(r4) + sync + mtmsr r7 + sync + isync + blr + +#endif /* CONFIG_40x */ /* * Flush MMU TLB Index: linux-work/arch/powerpc/kernel/udbg.c === --- linux-work.orig/arch/powerpc/kernel/udbg.c 2007-11-26 09:38:46.0 +1100 +++ linux-work/arch/powerpc/kernel/udbg.c 2007-11-26 09:44:04.0 +1100 @@ -54,6 +54,9 @@ void __init udbg_early_init(void) #elif defined(CONFIG_PPC_EARLY_DEBUG_44x) /* PPC44x debug */ udbg_init_44x_as1(); +#elif defined(CONFIG_PPC_EARLY_DEBUG_40x) + /* PPC40x debug */ + udbg_init_40x_realmode(); #elif defined(CONFIG_PPC_EARLY_DEBUG_CPM) udbg_init_cpm(); #endif Index: linux-work/arch/powerpc/kernel/udbg_16550.c === --- linux-work.orig/arch/powerpc/kernel/udbg_16550.c2007-11-26 09:38:46.0 +1100 +++ linux-work/arch/powerpc/kernel/udbg_16550.c 2007-11-26 09:44:04.0 +1100 @@ -225,3 +225,36 @@ void __init udbg_init_44x_as1(void) udbg_getc = udbg_44x_as1_getc; } #endif /* CONFIG_PPC_EARLY_DEBUG_44x */ + +#ifdef CONFIG_PPC_EARLY_DEBUG_40x +static void udbg_40x_real_putc(char c) +{ + if (udbg_comport) { + while ((real_readb(&udbg_comport->lsr) & LSR_THRE) == 0) + /* wait for idle */; + real_writeb(c, &udbg_comport->thr); eieio(); + if (c == '\n') + udbg_40x_real_putc('\r'); + } +} + +static int udbg_40x_real_getc(void) +{ + if (udbg_comport) { + while ((real_readb(&udbg_comport->lsr) & LSR_DR) == 0) + ; /* wait for char */ + return real_readb(&udbg_comport->rbr); + } + return -1; +} + +void __init udbg_init_40x_realmode(void) +{ + udbg_comport = (volatile struct NS16550 __iomem *) + CONFIG_PPC_EARLY_DEBUG_40x_PHYSADDR; + + udbg_putc = udbg_40x_real_putc; + udbg_getc = udbg_40x_real_getc; + udbg_getc_poll = NULL; +} +#endif /* CONFIG_PPC_EARLY_DEBUG_40x */ Index: linux-work/i
[PATCH 13/24] powerpc: PCI support for 4xx Ebony board
This wires up the 4xx PCI support & device tree bits for 440GP based Ebony platform. Signed-off-by: Benjamin Herrenschmidt <[EMAIL PROTECTED]> --- arch/powerpc/boot/dts/ebony.dts | 41 +++- 1 file changed, 36 insertions(+), 5 deletions(-) Index: linux-work/arch/powerpc/boot/dts/ebony.dts === --- linux-work.orig/arch/powerpc/boot/dts/ebony.dts 2007-10-15 11:19:35.0 +1000 +++ linux-work/arch/powerpc/boot/dts/ebony.dts 2007-11-27 18:27:37.0 +1100 @@ -284,12 +284,43 @@ }; - PCIX0: [EMAIL PROTECTED] { + PCIX0: [EMAIL PROTECTED] { device_type = "pci"; - /* FIXME */ - reg = <2 0ec0 8 - 2 0ec8 f0 - 2 0ec80100 fc>; + #interrupt-cells = <1>; + #size-cells = <2>; + #address-cells = <3>; + compatible = "ibm,plb440gp-pcix", "ibm,plb-pcix"; + primary; + reg = <2 0ec0 8 /* Config space access */ + 0 0 0/* no IACK cycles */ + 2 0ed0 4 /* Special cycles */ + 2 0ec8 f0/* Internal registers */ + 2 0ec80100 fc>; /* Internal messaging registers */ + + /* Outbound ranges, one memory and one IO, +* later cannot be changed +*/ + ranges = <0200 0 8000 0003 8000 0 8000 + 0100 0 0002 0800 0 0001>; + + /* Inbound 2GB range starting at 0 */ + dma-ranges = <4200 0 0 0 0 0 8000>; + + /* Ebony has all 4 IRQ pins tied together per slot */ + interrupt-map-mask = ; + interrupt-map = < + /* IDSEL 1 */ + 0800 0 0 0 &UIC0 17 8 + + /* IDSEL 2 */ + 1000 0 0 0 &UIC0 18 8 + + /* IDSEL 3 */ + 1800 0 0 0 &UIC0 19 8 + + /* IDSEL 4 */ + 2000 0 0 0 &UIC0 1a 8 + >; }; }; ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
[PATCH 12/24] powerpc: 4xx PLB to PCI Express support
This adds to the previous 2 patches the support for the 4xx PCI Express cells as found in the 440SPe revA, revB and 405EX. Unfortunately, due to significant differences between these, and other interesting "features" of those pieces of HW, the code isn't as simple as it is for PCI and PCI-X and some of the functions differ significantly between the 3 implementations. Thus, not only this code can only support those 3 implementations for now and will refuse to operate on any other, but there are added ifdef's to avoid the bloat of building a fairly large amount of code on platforms that don't need it. Also, this code currently only supports fully initializing root complex nodes, not endpoint. Some more code will have to be lifted from the arch/ppc implementation to add the endpoint support, though it's mostly differences in memory mapping, and the question on how to represent endpoint mode PCI in the device-tree is thus open. Signed-off-by: Benjamin Herrenschmidt <[EMAIL PROTECTED]> --- 440SPeA is untested, 440SPeB is slightly tested (with a sky2 network card on port 0 only for now) and 405EX is untested. arch/powerpc/Kconfig |1 arch/powerpc/sysdev/Kconfig |8 arch/powerpc/sysdev/ppc4xx_pci.c | 927 ++- arch/powerpc/sysdev/ppc4xx_pci.h | 237 + 4 files changed, 1172 insertions(+), 1 deletion(-) Index: linux-work/arch/powerpc/sysdev/ppc4xx_pci.c === --- linux-work.orig/arch/powerpc/sysdev/ppc4xx_pci.c2007-11-30 15:16:27.0 +1100 +++ linux-work/arch/powerpc/sysdev/ppc4xx_pci.c 2007-11-30 15:28:55.0 +1100 @@ -3,16 +3,31 @@ * * Copyright 2007 Ben. Herrenschmidt <[EMAIL PROTECTED]>, IBM Corp. * + * Most PCI Express code is coming from Stefan Roese implementation for + * arch/ppc in the Denx tree, slightly reworked by me. + * + * Copyright 2007 DENX Software Engineering, Stefan Roese <[EMAIL PROTECTED]> + * + * Some of that comes itself from a previous implementation for 440SPE only + * by Roland Dreier: + * + * Copyright (c) 2005 Cisco Systems. All rights reserved. + * Roland Dreier <[EMAIL PROTECTED]> + * */ #include #include #include #include +#include +#include #include #include #include +#include +#include #include "ppc4xx_pci.h" @@ -24,6 +39,9 @@ extern unsigned long total_memory; /* Defined in drivers/pci/pci.c but not exposed by a header */ extern u8 pci_cache_line_size; +#define U64_TO_U32_LOW(val)((u32)((val) & 0xULL)) +#define U64_TO_U32_HIGH(val) ((u32)((val) >> 32)) + static void fixup_ppc4xx_pci_bridge(struct pci_dev* dev) { struct pci_controller *hose; @@ -499,20 +517,927 @@ static void __init ppc4xx_probe_pcix_bri iounmap(reg); } +#ifdef CONFIG_PPC4xx_PCI_EXPRESS + /* * 4xx PCI-Express part + * + * We support 3 parts currently based on the compatible property: + * + * ibm,plb-pciex-440speA + * ibm,plb-pciex-440speB + * ibm,plb-pciex-405ex + * + * Anything else will be rejected for now as they are all subtly + * different unfortunately. + * */ + +#define MAX_PCIE_BUS_MAPPED0x10 + +struct ppc4xx_pciex_port +{ + struct pci_controller *hose; + struct device_node *node; + unsigned intindex; + int endpoint; + unsigned intsdr_base; + dcr_host_t dcrs; + struct resource cfg_space; + struct resource utl_regs; +}; + +static struct ppc4xx_pciex_port *ppc4xx_pciex_ports; +static unsigned int ppc4xx_pciex_port_count; + +struct ppc4xx_pciex_hwops +{ + int (*core_init)(struct device_node *np); + int (*port_init_hw)(struct ppc4xx_pciex_port *port); + int (*setup_utl)(struct ppc4xx_pciex_port *port); +}; + +static struct ppc4xx_pciex_hwops *ppc4xx_pciex_hwops; + +#ifdef CONFIG_44x + +/* Check various reset bits of the 440SPe PCIe core */ +static int __init ppc440spe_pciex_check_reset(struct device_node *np) +{ + u32 valPE0, valPE1, valPE2; + int err = 0; + + /* SDR0_PEGPLLLCT1 reset */ + if (!(valPE0 = mfdcri(SDR0, PESDR0_PLLLCT1) & 0x0100)) { + /* +* the PCIe core was probably already initialised +* by firmware - let's re-reset RCSSET regs +* +* -- Shouldn't we also re-reset the whole thing ? -- BenH +*/ + pr_debug("PCIE: SDR0_PLLLCT1 already reset.\n"); + mtdcri(SDR0, PESDR0_440SPE_RCSSET, 0x0101); + mtdcri(SDR0, PESDR1_440SPE_RCSSET, 0x0101); + mtdcri(SDR0, PESDR2_440SPE_RCSSET, 0x0101); + } + + valPE0 = mfdcri(SDR0, PESDR0_440SPE_RCSSET); + valPE1 = mfdcri(SDR0, PESDR1_440SPE_RCSSET); + valPE2 = mfdcri(SDR0, PESDR2_440SPE_RCSSET); + + /* SDR0_PExRCSSET rstgu */ + if (!(valPE0 & 0x01
[PATCH 11/24] powerpc: 4xx PLB to PCI 2.x support
This adds to the previous patch the support for the 4xx PCI 2.x bridges. Signed-off-by: Benjamin Herrenschmidt <[EMAIL PROTECTED]> --- This version implement the basic support for the 405GP bridge, I haven't yet looked at differences that other implementations may have for the PCI 2.x part. arch/powerpc/sysdev/ppc4xx_pci.c | 183 ++- arch/powerpc/sysdev/ppc4xx_pci.h | 19 2 files changed, 201 insertions(+), 1 deletion(-) Index: linux-work/arch/powerpc/sysdev/ppc4xx_pci.c === --- linux-work.orig/arch/powerpc/sysdev/ppc4xx_pci.c2007-11-30 13:49:30.0 +1100 +++ linux-work/arch/powerpc/sysdev/ppc4xx_pci.c 2007-11-30 13:49:56.0 +1100 @@ -24,6 +24,38 @@ extern unsigned long total_memory; /* Defined in drivers/pci/pci.c but not exposed by a header */ extern u8 pci_cache_line_size; +static void fixup_ppc4xx_pci_bridge(struct pci_dev* dev) +{ + struct pci_controller *hose; + struct device_node *np; + int i; + + if (dev->devfn != 0 || dev->bus->self != NULL) + return; + + hose = pci_bus_to_host(dev->bus); + if (hose == NULL) + return; + np = hose->arch_data; + + if (!of_device_is_compatible(np, "ibm,plb-pciex") && + !of_device_is_compatible(np, "ibm,plb-pcix") && + !of_device_is_compatible(np, "ibm,plb-pci")) + return; + + /* Hide the PCI host BARs from the kernel as their content doesn't +* fit well in the resource management +*/ + for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) { + dev->resource[i].start = dev->resource[i].end = 0; + dev->resource[i].flags = 0; + } + + printk(KERN_INFO "PCI: Hiding 4xx host bridge resources %s\n", + pci_name(dev)); +} +DECLARE_PCI_FIXUP_HEADER(PCI_ANY_ID, PCI_ANY_ID, fixup_ppc4xx_pci_bridge); + static int __init ppc4xx_parse_dma_ranges(struct pci_controller *hose, void __iomem *reg, struct resource *res) @@ -129,9 +161,158 @@ static int __init ppc4xx_parse_dma_range /* * 4xx PCI 2.x part */ + +static void __init ppc4xx_configure_pci_PMMs(struct pci_controller *hose, +void __iomem *reg) +{ + struct device_node *np = hose->arch_data; + u32 la, ma, pcila, pciha; + int i, j; + + /* Setup outbound memory windows */ + for(i = j = 0; i < 3; i++) { + struct resource *res = &hose->mem_resources[i]; + + /* we only care about memory windows */ + if (!(res->flags & IORESOURCE_MEM)) + continue; + if (j > 2) { + printk(KERN_WARNING "%s: Too many ranges\n", + np->full_name); + break; + } + + /* Calculate register values */ + la = res->start; +#ifdef CONFIG_RESOURCES_64BIT + pciha = (res->start - hose->pci_mem_offset) >> 32; + pcila = (res->start - hose->pci_mem_offset) & 0xu; +#else + pciha = 0; + pcila = res->start - hose->pci_mem_offset; +#endif + + ma = res->end + 1 - res->start; + if (!is_power_of_2(ma) || ma < 0x1000 || ma > 0xu) { + printk(KERN_WARNING "%s: Resource out of range\n", + np->full_name); + continue; + } + ma = (0xu << ilog2(ma)) | 0x1; + if (res->flags & IORESOURCE_PREFETCH) + ma |= 0x2; + + /* Program register values */ + writel(la, reg + PCIL0_PMM0LA + (0x10 * j)); + writel(pcila, reg + PCIL0_PMM0PCILA + (0x10 * j)); + writel(pciha, reg + PCIL0_PMM0PCIHA + (0x10 * j)); + writel(ma, reg + PCIL0_PMM0MA + (0x10 * j)); + j++; + } +} + +static void __init ppc4xx_configure_pci_PTMs(struct pci_controller *hose, +void __iomem *reg, +const struct resource *res) +{ + resource_size_t size = res->end - res->start + 1; + u32 sa; + + /* Calculate window size */ + sa = (0xu << ilog2(size)) | 1; + sa |= 0x1; + + /* RAM is always at 0 local for now */ + writel(0, reg + PCIL0_PTM1LA); + writel(sa, reg + PCIL0_PTM1MS); + + /* Map on PCI side */ + early_write_config_dword(hose, hose->first_busno, 0, +PCI_BASE_ADDRESS_1, res->start); + early_write_config_dword(hose, hose->first_busno, 0, +PCI_BASE_ADDRESS_2, 0x); + early_write_config_word(hose, hose->first_busno,
[PATCH 10/24] powerpc: 4xx PLB to PCI-X support
This adds base support code for the 4xx PCI-X bridge. It also provides placeholders for the PCI and PCI-E version but they aren't supported with this patch. The bridges are configured based on device-tree properties. Signed-off-by: Benjamin Herrenschmidt <[EMAIL PROTECTED]> --- Tested on 440GP only so far. arch/powerpc/sysdev/Makefile |3 arch/powerpc/sysdev/ppc4xx_pci.c | 343 +++ arch/powerpc/sysdev/ppc4xx_pci.h | 106 3 files changed, 452 insertions(+) Index: linux-work/arch/powerpc/sysdev/Makefile === --- linux-work.orig/arch/powerpc/sysdev/Makefile2007-11-30 15:14:36.0 +1100 +++ linux-work/arch/powerpc/sysdev/Makefile 2007-11-30 15:14:56.0 +1100 @@ -27,6 +27,9 @@ obj-$(CONFIG_PPC_I8259) += i8259.o obj-$(CONFIG_PPC_83xx) += ipic.o obj-$(CONFIG_4xx) += uic.o obj-$(CONFIG_XILINX_VIRTEX)+= xilinx_intc.o +ifeq ($(CONFIG_PCI),y) +obj-$(CONFIG_4xx) += ppc4xx_pci.o +endif endif # Temporary hack until we have migrated to asm-powerpc Index: linux-work/arch/powerpc/sysdev/ppc4xx_pci.c === --- /dev/null 1970-01-01 00:00:00.0 + +++ linux-work/arch/powerpc/sysdev/ppc4xx_pci.c 2007-11-30 15:14:56.0 +1100 @@ -0,0 +1,343 @@ +/* + * PCI / PCI-X / PCI-Express support for 4xx parts + * + * Copyright 2007 Ben. Herrenschmidt <[EMAIL PROTECTED]>, IBM Corp. + * + */ + +#include +#include +#include +#include + +#include +#include +#include + +#include "ppc4xx_pci.h" + +static int dma_offset_set; + +/* Move that to a useable header */ +extern unsigned long total_memory; + +/* Defined in drivers/pci/pci.c but not exposed by a header */ +extern u8 pci_cache_line_size; + +static int __init ppc4xx_parse_dma_ranges(struct pci_controller *hose, + void __iomem *reg, + struct resource *res) +{ + struct device_node *node = hose->arch_data; + u64 size; + const u32 *ranges; + int rlen; + int pna = of_n_addr_cells(node); + int np = pna + 5; + + /* Default */ + res->start = 0; + res->end = size = 0x8000; + res->flags = IORESOURCE_MEM | IORESOURCE_PREFETCH; + + /* Get dma-ranges property */ + ranges = of_get_property(node, "dma-ranges", &rlen); + if (ranges == NULL) + goto out; + + /* Walk it */ + while ((rlen -= np * 4) >= 0) { + u32 pci_space = ranges[0]; + u64 pci_addr = of_read_number(ranges + 1, 2); + u64 cpu_addr = of_translate_dma_address(node, ranges + 3); + size = of_read_number(ranges + pna + 3, 2); + ranges += np; + if (cpu_addr == OF_BAD_ADDR || size == 0) + continue; + + /* We only care about memory */ + if ((pci_space & 0x0300) != 0x0200) + continue; + + /* We currently only support memory at 0, and pci_addr +* within 32 bits space +*/ + if (cpu_addr != 0 || pci_addr > 0x) { + printk(KERN_WARNING "%s: Ignored unsupported dma range" + " 0x%016llx...0x%016llx -> 0x%016llx\n", + node->full_name, + pci_addr, pci_addr + size - 1, cpu_addr); + continue; + } + + /* Check if not prefetchable */ + if (!(pci_space & 0x4000)) + res->flags &= ~IORESOURCE_PREFETCH; + + + /* Use that */ + res->start = pci_addr; +#ifndef CONFIG_RESOURCES_64BIT + /* Beware of 32 bits resources */ + if ((pci_addr + size) > 0x1ull) + res->end = 0x; + else +#endif + res->end = res->start + size - 1; + break; + } + + /* We only support one global DMA offset */ + if (dma_offset_set && pci_dram_offset != res->start) { + printk(KERN_ERR "%s: dma-ranges(s) mismatch\n", + node->full_name); + return -ENXIO; + } + + /* Check that we can fit all of memory as we don't support +* DMA bounce buffers +*/ + if (size < total_memory) { + printk(KERN_ERR "%s: dma-ranges too small\n", + node->full_name); + return -ENXIO; + } + + /* Check we are a power of 2 size and that base is a multiple of size*/ + if (!is_power_of_2(size) || + (res->start & (size - 1)) != 0) { + printk(KERN_ERR "%s: dma-ranges unaligned\n", + no
[PATCH 9/24] powerpc: Improve support for 4xx indirect DCRs
Accessing indirect DCRs is done via a pair of address/data DCRs. Such accesses are thus inherently racy, vs. interrupts, preemption and possibly SMP if 4xx SMP cores are ever used. This updates the mfdcri/mtdcri macros in dcr-native.h (which were so far unused) to use a spinlock. In addition, add some common definitions to a new dcr-regs.h file. Signed-off-by: Benjamin Herrenschmidt <[EMAIL PROTECTED]> --- arch/powerpc/sysdev/dcr.c|1 include/asm-powerpc/dcr-native.h | 30 +++- include/asm-powerpc/dcr-regs.h | 72 +++ include/asm-powerpc/dcr.h|1 4 files changed, 96 insertions(+), 8 deletions(-) Index: linux-work/arch/powerpc/sysdev/dcr.c === --- linux-work.orig/arch/powerpc/sysdev/dcr.c 2007-11-28 13:34:45.0 +1100 +++ linux-work/arch/powerpc/sysdev/dcr.c2007-11-28 13:34:48.0 +1100 @@ -139,3 +139,4 @@ void dcr_unmap(dcr_host_t host, unsigned EXPORT_SYMBOL_GPL(dcr_unmap); #endif /* !defined(CONFIG_PPC_DCR_NATIVE) */ + Index: linux-work/include/asm-powerpc/dcr-native.h === --- linux-work.orig/include/asm-powerpc/dcr-native.h2007-11-28 13:33:51.0 +1100 +++ linux-work/include/asm-powerpc/dcr-native.h 2007-11-28 15:22:22.0 +1100 @@ -22,6 +22,8 @@ #ifdef __KERNEL__ #ifndef __ASSEMBLY__ +#include + typedef struct { unsigned int base; } dcr_host_t; @@ -55,18 +57,30 @@ do { \ } while (0) /* R/W of indirect DCRs make use of standard naming conventions for DCRs */ -#define mfdcri(base, reg) \ -({ \ - mtdcr(base ## _CFGADDR, base ## _ ## reg); \ - mfdcr(base ## _CFGDATA);\ +extern spinlock_t dcr_ind_lock; + +#define mfdcri(base, reg) \ +({ \ + unsigned long flags;\ + unsigned int val; \ + spin_lock_irqsave(&dcr_ind_lock, flags);\ + mtdcr(DCRN_ ## base ## _CONFIG_ADDR, reg); \ + val = mfdcr(DCRN_ ## base ## _CONFIG_DATA); \ + spin_unlock_irqrestore(&dcr_ind_lock, flags); \ + val;\ }) -#define mtdcri(base, reg, data)\ -do { \ - mtdcr(base ## _CFGADDR, base ## _ ## reg); \ - mtdcr(base ## _CFGDATA, data); \ +#define mtdcri(base, reg, data)\ +do { \ + unsigned long flags;\ + spin_lock_irqsave(&dcr_ind_lock, flags);\ + mtdcr(DCRN_ ## base ## _CONFIG_ADDR, reg); \ + mtdcr(DCRN_ ## base ## _CONFIG_DATA, data); \ + spin_unlock_irqrestore(&dcr_ind_lock, flags); \ } while (0) + + #endif /* __ASSEMBLY__ */ #endif /* __KERNEL__ */ #endif /* _ASM_POWERPC_DCR_NATIVE_H */ Index: linux-work/include/asm-powerpc/dcr.h === --- linux-work.orig/include/asm-powerpc/dcr.h 2007-11-28 13:40:13.0 +1100 +++ linux-work/include/asm-powerpc/dcr.h2007-11-28 13:49:37.0 +1100 @@ -40,6 +40,7 @@ extern unsigned int dcr_resource_len(str unsigned int index); #endif /* CONFIG_PPC_MERGE */ + #endif /* CONFIG_PPC_DCR */ #endif /* __KERNEL__ */ #endif /* _ASM_POWERPC_DCR_H */ Index: linux-work/include/asm-powerpc/dcr-regs.h === --- /dev/null 1970-01-01 00:00:00.0 + +++ linux-work/include/asm-powerpc/dcr-regs.h 2007-11-28 14:43:25.0 +1100 @@ -0,0 +1,72 @@ +/* + * Common DCR / SDR / CPR register definitions used on various IBM/AMCC + * 4xx processors + * + *Copyright 2007 Benjamin Herrenschmidt, IBM Corp + * <[EMAIL PROTECTED]> + * + * Mostly lifted from asm-ppc/ibm4xx.h by + * + *Copyright (c) 1999 Grant Erickson <[EMAIL PROTECTED]> + * + */ + +#ifndef __DCR_REGS_H__ +#define __DCR_REGS_H__ + +/* + * Most DCRs used for controlling devices such as the MAL, DMA engine, + * etc... are obtained for the device tree. + * + * The definitions in this files are fixed DCRs and indirect DCRs that + * are commonly used outside of specific drivers or refer to core + * common registers that may occasionally have to be tweaked outside + * of the driver main register set + */ + +/* CPRs (440GX and 440SP/440SPe) */ +#define DCRN_CPR0_CONFIG_ADDR 0xc +#define DCRN_CPR0_CONFIG_DATA 0xd + +/* SDRs (440GX and 440SP/440SPe) */ +#define DCRN_SDR0_CONFIG_ADDR 0xe +#define DCRN_SDR0_CONFIG_D
[PATCH 8/24] powerpc: Add of_translate_dma_address
This adds a variant of of_translate_address that uses the dma-ranges property instead of "ranges", it's to be used by PCI code in parsing the dma-ranges property. Signed-off-by: Benjamin Herrenschmidt <[EMAIL PROTECTED]> --- arch/powerpc/kernel/prom_parse.c | 20 include/asm-powerpc/prom.h |4 2 files changed, 20 insertions(+), 4 deletions(-) Index: linux-work/arch/powerpc/kernel/prom_parse.c === --- linux-work.orig/arch/powerpc/kernel/prom_parse.c2007-11-22 13:18:32.0 +1100 +++ linux-work/arch/powerpc/kernel/prom_parse.c 2007-11-22 13:50:45.0 +1100 @@ -419,7 +419,7 @@ static struct of_bus *of_match_bus(struc static int of_translate_one(struct device_node *parent, struct of_bus *bus, struct of_bus *pbus, u32 *addr, - int na, int ns, int pna) + int na, int ns, int pna, const char *rprop) { const u32 *ranges; unsigned int rlen; @@ -438,7 +438,7 @@ static int of_translate_one(struct devic * to translate addresses that aren't supposed to be translated in * the first place. --BenH. */ - ranges = of_get_property(parent, "ranges", &rlen); + ranges = of_get_property(parent, rprop, &rlen); if (ranges == NULL || rlen == 0) { offset = of_read_number(addr, na); memset(addr, 0, pna * 4); @@ -481,7 +481,8 @@ static int of_translate_one(struct devic * that can be mapped to a cpu physical address). This is not really specified * that way, but this is traditionally the way IBM at least do things */ -u64 of_translate_address(struct device_node *dev, const u32 *in_addr) +u64 __of_translate_address(struct device_node *dev, const u32 *in_addr, + const char *rprop) { struct device_node *parent = NULL; struct of_bus *bus, *pbus; @@ -540,7 +541,7 @@ u64 of_translate_address(struct device_n pbus->name, pna, pns, parent->full_name); /* Apply bus translation */ - if (of_translate_one(dev, bus, pbus, addr, na, ns, pna)) + if (of_translate_one(dev, bus, pbus, addr, na, ns, pna, rprop)) break; /* Complete the move up one level */ @@ -556,8 +557,19 @@ u64 of_translate_address(struct device_n return result; } + +u64 of_translate_address(struct device_node *dev, const u32 *in_addr) +{ + return __of_translate_address(dev, in_addr, "ranges"); +} EXPORT_SYMBOL(of_translate_address); +u64 of_translate_dma_address(struct device_node *dev, const u32 *in_addr) +{ + return __of_translate_address(dev, in_addr, "dma-ranges"); +} +EXPORT_SYMBOL(of_translate_dma_address); + const u32 *of_get_address(struct device_node *dev, int index, u64 *size, unsigned int *flags) { Index: linux-work/include/asm-powerpc/prom.h === --- linux-work.orig/include/asm-powerpc/prom.h 2007-11-22 13:48:21.0 +1100 +++ linux-work/include/asm-powerpc/prom.h 2007-11-22 13:48:57.0 +1100 @@ -202,6 +202,10 @@ static inline unsigned long of_read_ulon */ extern u64 of_translate_address(struct device_node *np, const u32 *addr); +/* Translate a DMA address from device space to CPU space */ +extern u64 of_translate_dma_address(struct device_node *dev, + const u32 *in_addr); + /* Extract an address from a device, returns the region size and * the address space flags too. The PCI version uses a BAR number * instead of an absolute index ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
[PATCH 7/24] powerpc: Change 32 bits PCI message about resource allocation
The 32 bits PCI code will display a rather scary error message PCI: Cannot allocate resource region N of device XXX at boot when the existing setup of a device as left by the firmware doesn't match the kernel needs and the device needs to be moved. This is often not an error at all, as the kernel will generally easily reallocate the device elsewhere. This changes the message to something less scary and lowers its level from error to warning. Signed-off-by: Benjamin Herrenschmidt <[EMAIL PROTECTED]> --- arch/powerpc/kernel/pci_32.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Index: linux-work/arch/powerpc/kernel/pci_32.c === --- linux-work.orig/arch/powerpc/kernel/pci_32.c2007-11-20 17:04:07.0 +1100 +++ linux-work/arch/powerpc/kernel/pci_32.c 2007-11-21 16:53:53.0 +1100 @@ -508,7 +508,7 @@ static inline void alloc_resource(struct pci_name(dev), idx, (u64)r->start, (u64)r->end, r->flags); pr = pci_find_parent_resource(dev, r); if (!pr || request_resource(pr, r) < 0) { - printk(KERN_ERR "PCI: Cannot allocate resource region %d" + printk(KERN_WARNING "PCI: Remapping resource region %d" " of device %s\n", idx, pci_name(dev)); if (pr) DBG("PCI: parent is %p: %016llx-%016llx (f=%lx)\n", ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
[PATCH 6/24] powerpc: Add xmon function to dump 44x TLB
This adds a function to xmon to dump the content of the 44x processor TLB with a little bit of decoding (but not much). Signed-off-by: Benjamin Herrenschmidt <[EMAIL PROTECTED]> --- Did that to track down some machine checks I was having while working on PCI support due to 32/64 bits resource screwage. Useful to see where a given MMIO virtual address really maps to. arch/powerpc/xmon/xmon.c | 38 ++ 1 file changed, 38 insertions(+) Index: linux-work/arch/powerpc/xmon/xmon.c === --- linux-work.orig/arch/powerpc/xmon/xmon.c2007-11-20 15:02:43.0 +1100 +++ linux-work/arch/powerpc/xmon/xmon.c 2007-11-20 17:04:48.0 +1100 @@ -153,6 +153,10 @@ static const char *getvecname(unsigned l static int do_spu_cmd(void); +#ifdef CONFIG_44x +static void dump_tlb_44x(void); +#endif + int xmon_no_auto_backtrace; extern void xmon_enter(void); @@ -231,6 +235,9 @@ Commands:\n\ #ifdef CONFIG_PPC_STD_MMU_32 " u dump segment registers\n" #endif +#ifdef CONFIG_44x +" u dump TLB\n" +#endif " ? help\n" " zr reboot\n\ zh halt\n" @@ -856,6 +863,11 @@ cmds(struct pt_regs *excp) dump_segments(); break; #endif +#ifdef CONFIG_44x + case 'u': + dump_tlb_44x(); + break; +#endif default: printf("Unrecognized command: "); do { @@ -2581,6 +2593,32 @@ void dump_segments(void) } #endif +#ifdef CONFIG_44x +static void dump_tlb_44x(void) +{ + int i; + + for (i = 0; i < PPC44x_TLB_SIZE; i++) { + unsigned long w0,w1,w2; + asm volatile("tlbre %0,%1,0" : "=r" (w0) : "r" (i)); + asm volatile("tlbre %0,%1,1" : "=r" (w1) : "r" (i)); + asm volatile("tlbre %0,%1,2" : "=r" (w2) : "r" (i)); + printf("[%02x] %08x %08x %08x ", i, w0, w1, w2); + if (w0 & PPC44x_TLB_VALID) { + printf("V %08x -> %01x%08x %c%c%c%c%c", + w0 & PPC44x_TLB_EPN_MASK, + w1 & PPC44x_TLB_ERPN_MASK, + w1 & PPC44x_TLB_RPN_MASK, + (w2 & PPC44x_TLB_W) ? 'W' : 'w', + (w2 & PPC44x_TLB_I) ? 'I' : 'i', + (w2 & PPC44x_TLB_M) ? 'M' : 'm', + (w2 & PPC44x_TLB_G) ? 'G' : 'g', + (w2 & PPC44x_TLB_E) ? 'E' : 'e'); + } + printf("\n"); + } +} +#endif /* CONFIG_44x */ void xmon_init(int enable) { #ifdef CONFIG_PPC_ISERIES ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
[PATCH 5/24] powerpc: Fix 440SPE machine check
The 440SPE has a 440A core, and thus needs a setup_cpu function to fixup its machine check handler. Signed-off-by: Benjamin Herrenschmidt <[EMAIL PROTECTED]> --- arch/powerpc/kernel/cpu_setup_44x.S |1 + arch/powerpc/kernel/cputable.c |3 +++ 2 files changed, 4 insertions(+) Index: linux-work/arch/powerpc/kernel/cpu_setup_44x.S === --- linux-work.orig/arch/powerpc/kernel/cpu_setup_44x.S 2007-11-27 16:13:04.0 +1100 +++ linux-work/arch/powerpc/kernel/cpu_setup_44x.S 2007-11-27 16:13:09.0 +1100 @@ -29,6 +29,7 @@ _GLOBAL(__setup_cpu_440epx) _GLOBAL(__setup_cpu_440grx) b __plb_disable_wrp _GLOBAL(__setup_cpu_440gx) +_GLOBAL(__setup_cpu_440spe) b __fixup_440A_mcheck /* Temporary fixup for arch/ppc until we kill the whole thing */ Index: linux-work/arch/powerpc/kernel/cputable.c === --- linux-work.orig/arch/powerpc/kernel/cputable.c 2007-11-27 16:11:27.0 +1100 +++ linux-work/arch/powerpc/kernel/cputable.c 2007-11-27 16:13:51.0 +1100 @@ -35,6 +35,7 @@ extern void __setup_cpu_440ep(unsigned l extern void __setup_cpu_440epx(unsigned long offset, struct cpu_spec* spec); extern void __setup_cpu_440gx(unsigned long offset, struct cpu_spec* spec); extern void __setup_cpu_440grx(unsigned long offset, struct cpu_spec* spec); +extern void __setup_cpu_440spe(unsigned long offset, struct cpu_spec* spec); extern void __setup_cpu_603(unsigned long offset, struct cpu_spec* spec); extern void __setup_cpu_604(unsigned long offset, struct cpu_spec* spec); extern void __setup_cpu_750(unsigned long offset, struct cpu_spec* spec); @@ -1248,6 +1249,7 @@ static struct cpu_spec __initdata cpu_sp .cpu_user_features = COMMON_USER_BOOKE, .icache_bsize = 32, .dcache_bsize = 32, + .cpu_setup = __setup_cpu_440spe, .platform = "ppc440", }, { /* 440SPe Rev. B */ @@ -1258,6 +1260,7 @@ static struct cpu_spec __initdata cpu_sp .cpu_user_features = COMMON_USER_BOOKE, .icache_bsize = 32, .dcache_bsize = 32, + .cpu_setup = __setup_cpu_440spe, .platform = "ppc440", }, #endif /* CONFIG_44x */ ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
[PATCH 4/24] powerpc: Fix 440/440A machine check handling
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. Signed-off-by: Benjamin Herrenschmidt <[EMAIL PROTECTED]> --- I know we should add a cputable hook for the processor machine check handler and get rid of the ifdef's, I just didn't have time to do it yet. arch/powerpc/kernel/cpu_setup_44x.S |8 arch/powerpc/kernel/cputable.c |5 +++ arch/powerpc/kernel/head_44x.S | 14 ++-- arch/powerpc/kernel/head_booke.h|2 - arch/powerpc/kernel/traps.c | 58 +--- arch/powerpc/platforms/44x/Kconfig |5 --- include/asm-powerpc/ptrace.h|3 + include/asm-powerpc/reg_booke.h |3 - 8 files changed, 75 insertions(+), 23 deletions(-) Index: linux-work/arch/powerpc/kernel/cpu_setup_44x.S === --- linux-work.orig/arch/powerpc/kernel/cpu_setup_44x.S 2007-11-26 09:38:47.0 +1100 +++ linux-work/arch/powerpc/kernel/cpu_setup_44x.S 2007-11-26 10:09:37.0 +1100 @@ -23,11 +23,19 @@ _GLOBAL(__setup_cpu_440epx) mflrr4 bl __init_fpu_44x bl __plb_disable_wrp + bl __fixup_440A_mcheck mtlrr4 blr _GLOBAL(__setup_cpu_440grx) b __plb_disable_wrp +_GLOBAL(__setup_cpu_440gx) + b __fixup_440A_mcheck + /* Temporary fixup for arch/ppc until we kill the whole thing */ +#ifndef CONFIG_PPC_MERGE +_GLOBAL(__fixup_440A_mcheck) + blr +#endif /* enable APU between CPU and FPU */ _GLOBAL(__init_fpu_44x) Index: linux-work/arch/powerpc/kernel/cputable.c === --- linux-work.orig/arch/powerpc/kernel/cputable.c 2007-11-26 09:38:47.0 +1100 +++ linux-work/arch/powerpc/kernel/cputable.c 2007-11-26 09:43:51.0 +1100 @@ -33,6 +33,7 @@ EXPORT_SYMBOL(cur_cpu_spec); #ifdef CONFIG_PPC32 extern void __setup_cpu_440ep(unsigned long offset, struct cpu_spec* spec); extern void __setup_cpu_440epx(unsigned long offset, struct cpu_spec* spec); +extern void __setup_cpu_440gx(unsigned long offset, struct cpu_spec* spec); extern void __setup_cpu_440grx(unsigned long offset, struct cpu_spec* spec); extern void __setup_cpu_603(unsigned long offset, struct cpu_spec* spec); extern void __setup_cpu_604(unsigned long offset, struct cpu_spec* spec); @@ -1193,6 +1194,7 @@ static struct cpu_spec __initdata cpu_sp .cpu_user_features = COMMON_USER_BOOKE, .icache_bsize = 32, .dcache_bsize = 32, + .cpu_setup = __setup_cpu_440gx, .platform = "ppc440", }, { /* 440GX Rev. B */ @@ -1203,6 +1205,7 @@ static struct cpu_spec __initdata cpu_sp .cpu_user_features = COMMON_USER_BOOKE, .icache_bsize = 32, .dcache_bsize = 32, + .cpu_setup = __setup_cpu_440gx, .platform = "ppc440", }, { /* 440GX Rev. C */ @@ -1213,6 +1216,7 @@ static struct cpu_spec __initdata cpu_sp .cpu_user_features = COMMON_USER_BOOKE, .icache_bsize = 32, .dcache_bsize = 32, + .cpu_setup = __setup_cpu_440gx, .platform = "ppc440", }, { /* 440GX Rev. F */ @@ -1223,6 +1227,7 @@ static struct cpu_spec __initdata cpu_sp .cpu_user_features = COMMON_USER_BOOKE, .icache_bsize = 32, .dcache_bsize = 32, + .cpu_setup = __setup_cpu_440gx, .platform = "ppc440", }, { /* 440SP Rev. A */ Index: linux-work/arch/powerpc/kernel/head_44x.S === --- linux-work.orig/arch/powerpc/kernel/head_44x.S 2007-11-26 09:38:47.0 +1100 +++ linux-work/arch/powerpc/kernel/head_44x.S 2007-11-26 09:43:51.0 +1100 @@ -289,11 +289,8 @@ interrupt_base: CRITICAL_EXCEPTION(0x0100, CriticalInput, unknown_exception) /* Machine Check Interrupt */ -#ifdef CONFIG_440A - MCHECK_EXCEPTION(0x0200, MachineCheck, machine_check_exception) -#else CRITICAL_EXCEPTION(0x0200, MachineCheck, machine_check_exception) -#endif + MCHECK_EXCEPTION(0x0210, MachineCheckA, machine_check_exception) /* Data Storage Interrupt */ START_EXCEPTION(DataStorage) @@ -674,6 +671,15 @@ finish_tlb_load: */ /* + * Adjust the machine check IVOR on 440A cores + */ +_GLOBAL(__fixup_440A_mcheck) + li r3
[PATCH 3/24] powerpc: Fix powerpc 32 bits resource fixup for 64 bits resources
The 32bits powerpc resource fixup code uses unsigned longs to do the offseting of resources which overflows on platforms such as 4xx where resources can be 64 bits. This fixes it by using resource_size_t instead. However, the IO stuff does rely on some 32 bits arithmetic, so we hack by cropping the result of the fixups for IO resources with a 32 bits mask. This isn't the prettiest but should work for now until we change the 32 bits PCI code to do IO mappings like 64 bits does, within a reserved are of the kernel address space. Signed-off-by: Benjamin Herrenschmidt <[EMAIL PROTECTED]> --- This needs some regression testing. arch/powerpc/kernel/pci_32.c | 44 +++ 1 file changed, 24 insertions(+), 20 deletions(-) Index: linux-work/arch/powerpc/kernel/pci_32.c === --- linux-work.orig/arch/powerpc/kernel/pci_32.c2007-11-16 15:48:27.0 +1100 +++ linux-work/arch/powerpc/kernel/pci_32.c 2007-11-16 15:55:54.0 +1100 @@ -104,7 +104,7 @@ pcibios_fixup_resources(struct pci_dev * { struct pci_controller* hose = (struct pci_controller *)dev->sysdata; int i; - unsigned long offset; + resource_size_t offset, mask; if (!hose) { printk(KERN_ERR "No hose for PCI dev %s!\n", pci_name(dev)); @@ -123,15 +123,17 @@ pcibios_fixup_resources(struct pci_dev * continue; } offset = 0; + mask = (resource_size_t)-1; if (res->flags & IORESOURCE_MEM) { offset = hose->pci_mem_offset; } else if (res->flags & IORESOURCE_IO) { offset = (unsigned long) hose->io_base_virt - isa_io_base; + mask = 0xu; } if (offset != 0) { - res->start += offset; - res->end += offset; + res->start = (res->start + offset) & mask; + res->end = (res->end + offset) & mask; DBG("Fixup res %d (%lx) of dev %s: %llx -> %llx\n", i, res->flags, pci_name(dev), (u64)res->start - offset, (u64)res->start); @@ -147,30 +149,32 @@ DECLARE_PCI_FIXUP_HEADER(PCI_ANY_ID, PC void pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region, struct resource *res) { - unsigned long offset = 0; + resource_size_t offset = 0, mask = (resource_size_t)-1; struct pci_controller *hose = dev->sysdata; - if (hose && res->flags & IORESOURCE_IO) + if (hose && res->flags & IORESOURCE_IO) { offset = (unsigned long)hose->io_base_virt - isa_io_base; - else if (hose && res->flags & IORESOURCE_MEM) + mask = 0xu; + } else if (hose && res->flags & IORESOURCE_MEM) offset = hose->pci_mem_offset; - region->start = res->start - offset; - region->end = res->end - offset; + region->start = (res->start - offset) & mask; + region->end = (res->end - offset) & mask; } EXPORT_SYMBOL(pcibios_resource_to_bus); void pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res, struct pci_bus_region *region) { - unsigned long offset = 0; + resource_size_t offset = 0, mask = (resource_size_t)-1; struct pci_controller *hose = dev->sysdata; - if (hose && res->flags & IORESOURCE_IO) + if (hose && res->flags & IORESOURCE_IO) { offset = (unsigned long)hose->io_base_virt - isa_io_base; - else if (hose && res->flags & IORESOURCE_MEM) + mask = 0xu; + } else if (hose && res->flags & IORESOURCE_MEM) offset = hose->pci_mem_offset; - res->start = region->start + offset; - res->end = region->end + offset; + res->start = (region->start + offset) & mask; + res->end = (region->end + offset) & mask; } EXPORT_SYMBOL(pcibios_bus_to_resource); @@ -334,9 +338,9 @@ static int __init pci_relocate_bridge_resource(struct pci_bus *bus, int i) { struct resource *res, *pr, *conflict; - unsigned long try, size; - int j; + resource_size_t try, size; struct pci_bus *parent = bus->parent; + int j; if (parent == NULL) { /* shouldn't ever happen */ @@ -438,7 +442,7 @@ update_bridge_resource(struct pci_dev *d u8 io_base_lo, io_limit_lo; u16 mem_base, mem_limit; u16 cmd; - unsigned long start, end, off; + resource_size_t start, end, off; struct pci_controller *hose = dev->sysdata; if (!hose) { @@ -1157,8 +1161,8 @@ void pcibios_fixup_bus(struct pci_bus *b res->end = IO_SPACE_L
[PATCH 2/24] powerpc: Merge pci_process_bridge_OF_ranges()
This patch merges the 32 and 64 bits implementations of pci_process_bridge_OF_ranges(). The new function is cleaner than both the old ones supports 64 bits ranges on ppc32 which is necessary for the 4xx port. It also adds some better (hopefully) output to the kernel log which should help disagnose problems and makes better use of existing OF parsing helpers (avoiding a few bugs of both implementations along the way). There are still a few unfortunate ifdef's but there is no way around these for now at least not until some other bits of the PCI code are made common. Signed-off-by: Benjamin Herrenschmidt <[EMAIL PROTECTED]> --- Tested on a few pSeries, PowerMac G5, and a 32 bits PowerMacs and a BriQ. Please let me know if it misbehaves anywhere else. arch/powerpc/kernel/pci-common.c | 176 +++ arch/powerpc/kernel/pci_32.c | 114 - arch/powerpc/kernel/pci_64.c | 93 include/asm-powerpc/pci-bridge.h |1 4 files changed, 177 insertions(+), 207 deletions(-) Index: linux-work/arch/powerpc/kernel/pci-common.c === --- linux-work.orig/arch/powerpc/kernel/pci-common.c2007-11-13 14:15:43.0 +1100 +++ linux-work/arch/powerpc/kernel/pci-common.c 2007-11-13 16:04:06.0 +1100 @@ -479,3 +479,179 @@ void pci_resource_to_user(const struct p *start = rsrc->start - offset; *end = rsrc->end - offset; } + +/** + * pci_process_bridge_OF_ranges - Parse PCI bridge resources from device tree + * @hose: newly allocated pci_controller to be setup + * @dev: device node of the host bridge + * @primary: set if primary bus (32 bits only, soon to be deprecated) + * + * This function will parse the "ranges" property of a PCI host bridge device + * node and setup the resource mapping of a pci controller based on its + * content. + * + * Life would be boring if it wasn't for a few issues that we have to deal + * with here: + * + * - We can only cope with one IO space range and up to 3 Memory space + * ranges. However, some machines (thanks Apple !) tend to split their + * space into lots of small contiguous ranges. So we have to coalesce. + * + * - We can only cope with all memory ranges having the same offset + * between CPU addresses and PCI addresses. Unfortunately, some bridges + * are setup for a large 1:1 mapping along with a small "window" which + * maps PCI address 0 to some arbitrary high address of the CPU space in + * order to give access to the ISA memory hole. + * The way out of here that I've chosen for now is to always set the + * offset based on the first resource found, then override it if we + * have a different offset and the previous was set by an ISA hole. + * + * - Some busses have IO space not starting at 0, which causes trouble with + * the way we do our IO resource renumbering. The code somewhat deals with + * it for 64 bits but I would expect problems on 32 bits. + * + * - Some 32 bits platforms such as 4xx can have physical space larger than + * 32 bits so we need to use 64 bits values for the parsing + */ +void __devinit pci_process_bridge_OF_ranges(struct pci_controller *hose, + struct device_node *dev, + int primary) +{ + const u32 *ranges; + int rlen; + int pna = of_n_addr_cells(dev); + int np = pna + 5; + int memno = 0, isa_hole = -1; + u32 pci_space; + unsigned long long pci_addr, cpu_addr, pci_next, cpu_next, size; + unsigned long long isa_mb = 0; + struct resource *res; + + printk(KERN_INFO "PCI host bridge %s %s ranges:\n", + dev->full_name, primary ? "(primary)" : ""); + + /* Get ranges property */ + ranges = of_get_property(dev, "ranges", &rlen); + if (ranges == NULL) + return; + + /* Parse it */ + while ((rlen -= np * 4) >= 0) { + /* Read next ranges element */ + pci_space = ranges[0]; + pci_addr = of_read_number(ranges + 1, 2); + cpu_addr = of_translate_address(dev, ranges + 3); + size = of_read_number(ranges + pna + 3, 2); + ranges += np; + if (cpu_addr == OF_BAD_ADDR || size == 0) + continue; + + /* Now consume following elements while they are contiguous */ + for (;rlen >= np * sizeof(u32); ranges += np, rlen -= np * 4) { + if (ranges[0] != pci_space) + break; + pci_next = of_read_number(ranges + 1, 2); + cpu_next = of_translate_address(dev, ranges + 3); + if (pci_next != pci_addr + size || + cpu_next != cpu_addr + size) + break;
[PATCH 1/24] powerpc: Make isa_mem_base common to 32 and 64 bits
This defines isa_mem_base on both 32 and 64 bits (it used to be 32 bits only). This avoids a few ifdef's in later patches and potentially can allow support for VGA text mode on 64 bits powerpc. Signed-off-by: Benjamin Herrenschmidt <[EMAIL PROTECTED]> --- Small cleanup pre-requisite for my next patch arch/powerpc/kernel/pci-common.c |4 arch/powerpc/kernel/pci_32.c |1 - include/asm-powerpc/io.h |5 +++-- 3 files changed, 7 insertions(+), 3 deletions(-) Index: linux-work/arch/powerpc/kernel/pci-common.c === --- linux-work.orig/arch/powerpc/kernel/pci-common.c2007-11-20 14:42:49.0 +1100 +++ linux-work/arch/powerpc/kernel/pci-common.c 2007-11-20 15:03:02.0 +1100 @@ -52,6 +52,10 @@ int global_phb_number; /* Global phb co extern struct list_head hose_list; +/* ISA Memory physical address */ +resource_size_t isa_mem_base; + + /* * pci_controller(phb) initialized common variables. */ Index: linux-work/include/asm-powerpc/io.h === --- linux-work.orig/include/asm-powerpc/io.h2007-11-20 14:42:49.0 +1100 +++ linux-work/include/asm-powerpc/io.h 2007-11-20 14:47:11.0 +1100 @@ -50,15 +50,16 @@ extern int check_legacy_ioport(unsigned #define PCI_DRAM_OFFSETpci_dram_offset #else #define _IO_BASE pci_io_base -#define _ISA_MEM_BASE 0 +#define _ISA_MEM_BASE isa_mem_base #define PCI_DRAM_OFFSET0 #endif extern unsigned long isa_io_base; -extern unsigned long isa_mem_base; extern unsigned long pci_io_base; extern unsigned long pci_dram_offset; +extern resource_size_t isa_mem_base; + #if defined(CONFIG_PPC32) && defined(CONFIG_PPC_INDIRECT_IO) #error CONFIG_PPC_INDIRECT_IO is not yet supported on 32 bits #endif Index: linux-work/arch/powerpc/kernel/pci_32.c === --- linux-work.orig/arch/powerpc/kernel/pci_32.c2007-11-20 14:42:49.0 +1100 +++ linux-work/arch/powerpc/kernel/pci_32.c 2007-11-20 15:02:43.0 +1100 @@ -32,7 +32,6 @@ #endif unsigned long isa_io_base = 0; -unsigned long isa_mem_base= 0; unsigned long pci_dram_offset = 0; int pcibios_assign_bus_offset = 1; ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
[PATCH 0/24] powerpc: 4xx PCI, PCI-X and PCI-Express support among others
Here's a set of patches that bring PCI, PCI-X and PCI-Express support to 4xx on arch/powerpc. It also changes/fixed various bits and pieces, such as a bit of rework of arch/powerpc/boot 4xx code, adding a couple of new platforms along the way. There are some issues with the SCSI stack vs. non-coherent DMA that I'm working on fixing separately, and there's a problem I noticed with the e1000 driver vs. 64 bits resources on 32 bits architectures for which I also have a patch that I posted separately. Appart from that, I got it working fine with a USB2 card in an ebony and 2 USB storage devices. Some of these patches are _NOT_ yet candidate for merging (mostly the board support ones), but you can review them and Josh can put them in an experimental tree. There will be further cleanups and fixes before 2.6.25 opens ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
Re: [PATCH] powerpc: fix os-term usage on kernel panic
On Tue, 27 Nov 2007 18:15:59 -0600 Will Schmidt <[EMAIL PROTECTED]> wrote: > > (resending with the proper "from" addr this time). > > > I'm seeing some funky behavior on power5/power6 partitions with this > patch.A "/sbin/reboot" is now behaving much more like a > "/sbin/halt". > > Anybody else seeing this, or is it time for me to call an exorcist for > my boxes? On my Power5+ box, I get an error (code B200A101) logged every time I reboot and about half the time, the machine does not reboot but need to be power cycled. Removing the cited patch makes the error not by logged and reboots work fine. Paul and I have been having a look at this and Paul has asked the architects for clarification of when os-term should be used. -- Cheers, Stephen Rothwell[EMAIL PROTECTED] http://www.canb.auug.org.au/~sfr/ pgp5ZBfk50k5s.pgp Description: PGP signature ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
Re: [PATCH] Add MPC837xEMDS PCIE RC mode support
On Fri, 2007-11-30 at 12:14 +0800, Olof Johansson wrote: > Hi, > > On Fri, Nov 30, 2007 at 11:45:34AM +0800, Li Li wrote: > > > + [EMAIL PROTECTED] { > > Why call it pci2@ (and pci3@ below)? They are clearly identifiable > with > their unit addresses anyway. > > > +config PPC_MPC83XX_PCIE > > + bool "MPC837X PCI Express support" > > + depends on PCIEPORTBUS && PPC_MPC837x > > + default n > > + help > > + Enables MPC837x PCI express RC mode > > Why have a separate config option for this? > > For systems where you don't want PCI-e configured, it should be left > out of the device tree instead. It is easy to configure kernel than modify and recompile the dts. The pcie is default enabled in dts. > > > > -Olof > - Tony ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
[PATCH 11/11] emac: Update file headers copyright notices
This updates the copyright notices of the new EMAC driver to avoid confusion as who is to be blamed for new bugs. Signed-off-by: Benjamin Herrenschmidt <[EMAIL PROTECTED]> --- drivers/net/ibm_newemac/core.c |5 + drivers/net/ibm_newemac/core.h |5 + drivers/net/ibm_newemac/debug.c |5 + drivers/net/ibm_newemac/debug.h |5 + drivers/net/ibm_newemac/emac.h |5 + drivers/net/ibm_newemac/mal.c |5 + drivers/net/ibm_newemac/mal.h |5 + drivers/net/ibm_newemac/phy.c |5 + drivers/net/ibm_newemac/phy.h |5 + drivers/net/ibm_newemac/rgmii.c |5 + drivers/net/ibm_newemac/rgmii.h |5 + drivers/net/ibm_newemac/tah.c |5 + drivers/net/ibm_newemac/tah.h |5 + drivers/net/ibm_newemac/zmii.c |5 + drivers/net/ibm_newemac/zmii.h |5 + 15 files changed, 75 insertions(+) Index: linux-work/drivers/net/ibm_newemac/core.c === --- linux-work.orig/drivers/net/ibm_newemac/core.c 2007-11-30 15:35:50.0 +1100 +++ linux-work/drivers/net/ibm_newemac/core.c 2007-11-30 16:03:30.0 +1100 @@ -3,6 +3,11 @@ * * Driver for PowerPC 4xx on-chip ethernet controller. * + * Copyright 2007 Benjamin Herrenschmidt, IBM Corp. + *<[EMAIL PROTECTED]> + * + * Based on the arch/ppc version of the driver: + * * Copyright (c) 2004, 2005 Zultys Technologies. * Eugene Surovegin <[EMAIL PROTECTED]> or <[EMAIL PROTECTED]> * Index: linux-work/drivers/net/ibm_newemac/core.h === --- linux-work.orig/drivers/net/ibm_newemac/core.h 2007-11-30 15:35:50.0 +1100 +++ linux-work/drivers/net/ibm_newemac/core.h 2007-11-30 16:03:23.0 +1100 @@ -3,6 +3,11 @@ * * Driver for PowerPC 4xx on-chip ethernet controller. * + * Copyright 2007 Benjamin Herrenschmidt, IBM Corp. + *<[EMAIL PROTECTED]> + * + * Based on the arch/ppc version of the driver: + * * Copyright (c) 2004, 2005 Zultys Technologies. * Eugene Surovegin <[EMAIL PROTECTED]> or <[EMAIL PROTECTED]> * Index: linux-work/drivers/net/ibm_newemac/debug.c === --- linux-work.orig/drivers/net/ibm_newemac/debug.c 2007-11-30 15:35:50.0 +1100 +++ linux-work/drivers/net/ibm_newemac/debug.c 2007-11-30 16:03:18.0 +1100 @@ -3,6 +3,11 @@ * * Driver for PowerPC 4xx on-chip ethernet controller, debug print routines. * + * Copyright 2007 Benjamin Herrenschmidt, IBM Corp. + *<[EMAIL PROTECTED]> + * + * Based on the arch/ppc version of the driver: + * * Copyright (c) 2004, 2005 Zultys Technologies * Eugene Surovegin <[EMAIL PROTECTED]> or <[EMAIL PROTECTED]> * Index: linux-work/drivers/net/ibm_newemac/debug.h === --- linux-work.orig/drivers/net/ibm_newemac/debug.h 2007-11-30 15:35:50.0 +1100 +++ linux-work/drivers/net/ibm_newemac/debug.h 2007-11-30 16:03:15.0 +1100 @@ -3,6 +3,11 @@ * * Driver for PowerPC 4xx on-chip ethernet controller, debug print routines. * + * Copyright 2007 Benjamin Herrenschmidt, IBM Corp. + *<[EMAIL PROTECTED]> + * + * Based on the arch/ppc version of the driver: + * * Copyright (c) 2004, 2005 Zultys Technologies * Eugene Surovegin <[EMAIL PROTECTED]> or <[EMAIL PROTECTED]> * Index: linux-work/drivers/net/ibm_newemac/emac.h === --- linux-work.orig/drivers/net/ibm_newemac/emac.h 2007-11-30 15:35:50.0 +1100 +++ linux-work/drivers/net/ibm_newemac/emac.h 2007-11-30 16:03:09.0 +1100 @@ -3,6 +3,11 @@ * * Register definitions for PowerPC 4xx on-chip ethernet contoller * + * Copyright 2007 Benjamin Herrenschmidt, IBM Corp. + *<[EMAIL PROTECTED]> + * + * Based on the arch/ppc version of the driver: + * * Copyright (c) 2004, 2005 Zultys Technologies. * Eugene Surovegin <[EMAIL PROTECTED]> or <[EMAIL PROTECTED]> * Index: linux-work/drivers/net/ibm_newemac/mal.c === --- linux-work.orig/drivers/net/ibm_newemac/mal.c 2007-11-30 15:35:51.0 +1100 +++ linux-work/drivers/net/ibm_newemac/mal.c2007-11-30 16:03:02.0 +1100 @@ -3,6 +3,11 @@ * * Memory Access Layer (MAL) support * + * Copyright 2007 Benjamin Herrenschmidt, IBM Corp. + *<[EMAIL PROTECTED]> + * + * Based on the arch/ppc version of the driver: + * * Copyright (c) 2004, 2005 Zultys Technologies. * Eugene Surovegin <[EMAIL PROTECTED]> or <[EMAIL PROTECTED]> * Index: linux-work/drivers/net/ibm_newemac/mal.h === --- linux-work.orig/drivers/net/ibm_newemac/mal.h 2007-11-30 15:35:51.0
[PATCH 10/11] ibm_newemac: Call dev_set_drvdata() before tah_reset()
From: Valentine Barshak <[EMAIL PROTECTED]> The patch moves dev_set_drvdata(&ofdev->dev, dev) up before tah_reset(ofdev) is called to avoid a NULL pointer dereference, since tah_reset uses drvdata. Signed-off-by: Valentine Barshak <[EMAIL PROTECTED]> Signed-off-by: Benjamin Herrenschmidt <[EMAIL PROTECTED]> --- diff -pruN linux-2.6.orig/drivers/net/ibm_newemac/tah.c linux-2.6/drivers/net/ibm_newemac/tah.c --- linux-2.6.orig/drivers/net/ibm_newemac/tah.c2007-11-23 21:27:57.0 +0300 +++ linux-2.6/drivers/net/ibm_newemac/tah.c 2007-11-23 21:35:12.0 +0300 @@ -116,13 +116,14 @@ static int __devinit tah_probe(struct of goto err_free; } + dev_set_drvdata(&ofdev->dev, dev); + /* Initialize TAH and enable IPv4 checksum verification, no TSO yet */ tah_reset(ofdev); printk(KERN_INFO "TAH %s initialized\n", ofdev->node->full_name); wmb(); - dev_set_drvdata(&ofdev->dev, dev); return 0; ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
[PATCH 9/11] ibm_newemac: Fix typo reading TAH channel info
From: Valentine Barshak <[EMAIL PROTECTED]> This patch fixes a typo in ibm_newemac/core.c (tah_port should be used instead of tah_ph) Signed-off-by: Valentine Barshak <[EMAIL PROTECTED]> Signed-off-by: Benjamin Herrenschmidt <[EMAIL PROTECTED]> --- drivers/net/ibm_newemac/core.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Index: linux-work/drivers/net/ibm_newemac/core.c === --- linux-work.orig/drivers/net/ibm_newemac/core.c 2007-11-26 09:43:04.0 +1100 +++ linux-work/drivers/net/ibm_newemac/core.c 2007-11-26 09:43:05.0 +1100 @@ -2442,7 +2442,7 @@ static int __devinit emac_init_config(st if (emac_read_uint_prop(np, "tah-device", &dev->tah_ph, 0)) dev->tah_ph = 0; if (emac_read_uint_prop(np, "tah-channel", &dev->tah_port, 0)) - dev->tah_ph = 0; + dev->tah_port = 0; if (emac_read_uint_prop(np, "mdio-device", &dev->mdio_ph, 0)) dev->mdio_ph = 0; if (emac_read_uint_prop(np, "zmii-device", &dev->zmii_ph, 0)) ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
[PATCH 8/11] ibm_newemac: Correct opb_bus_freq value
From: Valentine Barshak <[EMAIL PROTECTED]> The EMAC4_MR1_OBCI(freq) macro expects freg in MHz, while opb_bus_freq is kept in Hz. Correct this. Signed-off-by: Valentine Barshak <[EMAIL PROTECTED]> Signed-off-by: Benjamin Herrenschmidt <[EMAIL PROTECTED]> --- diff -pruN linux-2.6.orig/drivers/net/ibm_newemac/core.c linux-2.6/drivers/net/ibm_newemac/core.c --- linux-2.6.orig/drivers/net/ibm_newemac/core.c 2007-11-23 21:27:57.0 +0300 +++ linux-2.6/drivers/net/ibm_newemac/core.c2007-11-23 21:47:53.0 +0300 @@ -402,7 +402,7 @@ static u32 __emac_calc_base_mr1(struct e static u32 __emac4_calc_base_mr1(struct emac_instance *dev, int tx_size, int rx_size) { u32 ret = EMAC_MR1_VLE | EMAC_MR1_IST | EMAC4_MR1_TR | - EMAC4_MR1_OBCI(dev->opb_bus_freq); + EMAC4_MR1_OBCI(dev->opb_bus_freq / 100); DBG2(dev, "__emac4_calc_base_mr1" NL); ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
[PATCH 7/11] ibm_newemac: Skip EMACs that are marked unused by the firmware
From: Hugh Blemings <[EMAIL PROTECTED]> Depending on how the 44x processors are wired, some EMAC cells might not be useable (and not connected to a PHY). However, some device-trees may choose to still expose them (since their registers are present in the MMIO space) but with an "unused" property in them. Signed-off-by: Hugh Blemings <[EMAIL PROTECTED]> Signed-off-by: Benjamin Herrenschmidt <[EMAIL PROTECTED]> --- drivers/net/ibm_newemac/core.c |4 1 file changed, 4 insertions(+) Index: linux-work/drivers/net/ibm_newemac/core.c === --- linux-work.orig/drivers/net/ibm_newemac/core.c 2007-11-20 14:47:02.0 +1100 +++ linux-work/drivers/net/ibm_newemac/core.c 2007-11-20 14:47:05.0 +1100 @@ -2550,6 +2550,10 @@ static int __devinit emac_probe(struct o struct device_node **blist = NULL; int err, i; + /* Skip unused/unwired EMACS */ + if (of_get_property(np, "unused", NULL)) + return -ENODEV; + /* Find ourselves in the bootlist if we are there */ for (i = 0; i < EMAC_BOOT_LIST_SIZE; i++) if (emac_boot_list[i] == np) ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
[PATCH 6/11] ibm_newemac: Cleanup/fix support for STACR register variants
There are a few variants of the STACR register that affect more than just the "AXON" version of EMAC. Replace the current test of various chip models with tests for generic properties in the device-tree. Signed-off-by: Benjamin Herrenschmidt <[EMAIL PROTECTED]> Acked-by: Stefan Roese <[EMAIL PROTECTED]> --- arch/powerpc/boot/dts/sequoia.dts |4 drivers/net/ibm_newemac/core.c| 23 +-- drivers/net/ibm_newemac/core.h|6 +++--- 3 files changed, 20 insertions(+), 13 deletions(-) Index: linux-work/arch/powerpc/boot/dts/sequoia.dts === --- linux-work.orig/arch/powerpc/boot/dts/sequoia.dts 2007-11-20 14:47:01.0 +1100 +++ linux-work/arch/powerpc/boot/dts/sequoia.dts2007-11-20 14:47:02.0 +1100 @@ -274,6 +274,8 @@ zmii-channel = <0>; rgmii-device = <&RGMII0>; rgmii-channel = <0>; + has-inverted-stacr-oc; + has-new-stacr-staopc; }; EMAC1: [EMAIL PROTECTED] { @@ -302,6 +304,8 @@ zmii-channel = <1>; rgmii-device = <&RGMII0>; rgmii-channel = <1>; + has-inverted-stacr-oc; + has-new-stacr-staopc; }; }; }; Index: linux-work/drivers/net/ibm_newemac/core.c === --- linux-work.orig/drivers/net/ibm_newemac/core.c 2007-11-20 14:46:58.0 +1100 +++ linux-work/drivers/net/ibm_newemac/core.c 2007-11-20 14:47:02.0 +1100 @@ -711,7 +711,7 @@ static int __emac_mdio_read(struct emac_ r = EMAC_STACR_BASE(dev->opb_bus_freq); if (emac_has_feature(dev, EMAC_FTR_STACR_OC_INVERT)) r |= EMAC_STACR_OC; - if (emac_has_feature(dev, EMAC_FTR_HAS_AXON_STACR)) + if (emac_has_feature(dev, EMAC_FTR_HAS_NEW_STACR)) r |= EMACX_STACR_STAC_READ; else r |= EMAC_STACR_STAC_READ; @@ -783,7 +783,7 @@ static void __emac_mdio_write(struct ema r = EMAC_STACR_BASE(dev->opb_bus_freq); if (emac_has_feature(dev, EMAC_FTR_STACR_OC_INVERT)) r |= EMAC_STACR_OC; - if (emac_has_feature(dev, EMAC_FTR_HAS_AXON_STACR)) + if (emac_has_feature(dev, EMAC_FTR_HAS_NEW_STACR)) r |= EMACX_STACR_STAC_WRITE; else r |= EMAC_STACR_STAC_WRITE; @@ -2480,16 +2480,19 @@ static int __devinit emac_init_config(st /* Check EMAC version */ if (of_device_is_compatible(np, "ibm,emac4")) dev->features |= EMAC_FTR_EMAC4; - if (of_device_is_compatible(np, "ibm,emac-axon") - || of_device_is_compatible(np, "ibm,emac-440epx")) - dev->features |= EMAC_FTR_HAS_AXON_STACR - | EMAC_FTR_STACR_OC_INVERT; - if (of_device_is_compatible(np, "ibm,emac-440spe")) + + /* Fixup some feature bits based on the device tree */ + if (of_get_property(np, "has-inverted-stacr-oc", NULL)) dev->features |= EMAC_FTR_STACR_OC_INVERT; + if (of_get_property(np, "has-new-stacr-staopc", NULL)) + dev->features |= EMAC_FTR_HAS_NEW_STACR; - /* Fixup some feature bits based on the device tree and verify -* we have support for them compiled in -*/ + /* CAB lacks the appropriate properties */ + if (of_device_is_compatible(np, "ibm,emac-axon")) + dev->features |= EMAC_FTR_HAS_NEW_STACR | + EMAC_FTR_STACR_OC_INVERT; + + /* Enable TAH/ZMII/RGMII features as found */ if (dev->tah_ph != 0) { #ifdef CONFIG_IBM_NEW_EMAC_TAH dev->features |= EMAC_FTR_HAS_TAH; Index: linux-work/drivers/net/ibm_newemac/core.h === --- linux-work.orig/drivers/net/ibm_newemac/core.h 2007-11-20 14:46:51.0 +1100 +++ linux-work/drivers/net/ibm_newemac/core.h 2007-11-20 14:47:02.0 +1100 @@ -293,9 +293,9 @@ struct emac_instance { */ #define EMAC_FTR_HAS_RGMII 0x0020 /* - * Set if we have axon-type STACR + * Set if we have new type STACR with STAOPC */ -#define EMAC_FTR_HAS_AXON_STACR0x0040 +#define EMAC_FTR_HAS_NEW_STACR 0x0040 /* Right now, we don't quite handle the always/possible masks on the @@ -307,7 +307,7 @@ enum { EMAC_FTRS_POSSIBLE = #ifdef CONFIG_IBM_NEW_EMAC_EMAC4 - EMAC_FTR_EMAC4 | EMAC_FTR_HAS_AXON_STACR | + EMAC_FTR_EMAC4 | EMAC_FTR_HAS_NEW_STACR| EMAC_FTR_STACR_OC_INVERT| #endif #ifdef CONFIG_IB
[PATCH 5/11] ibm_newemac: Cleanup/Fix RGMII MDIO support detection
More than just "AXON" version of EMAC RGMII supports MDIO, so replace the current test with a generic property in the device-tree that indicates such support. Signed-off-by: Benjamin Herrenschmidt <[EMAIL PROTECTED]> Acked-by: Stefan Roese <[EMAIL PROTECTED]> --- arch/powerpc/boot/dts/sequoia.dts |1 + drivers/net/ibm_newemac/rgmii.c | 20 +++- drivers/net/ibm_newemac/rgmii.h |5 +++-- 3 files changed, 15 insertions(+), 11 deletions(-) Index: linux-work/drivers/net/ibm_newemac/rgmii.c === --- linux-work.orig/drivers/net/ibm_newemac/rgmii.c 2007-11-12 10:55:54.0 +1100 +++ linux-work/drivers/net/ibm_newemac/rgmii.c 2007-11-12 10:56:56.0 +1100 @@ -140,7 +140,7 @@ void rgmii_get_mdio(struct of_device *of RGMII_DBG2(dev, "get_mdio(%d)" NL, input); - if (dev->type != RGMII_AXON) + if (!(dev->flags & EMAC_RGMII_FLAG_HAS_MDIO)) return; mutex_lock(&dev->lock); @@ -161,7 +161,7 @@ void rgmii_put_mdio(struct of_device *of RGMII_DBG2(dev, "put_mdio(%d)" NL, input); - if (dev->type != RGMII_AXON) + if (!(dev->flags & EMAC_RGMII_FLAG_HAS_MDIO)) return; fer = in_be32(&p->fer); @@ -250,11 +250,13 @@ static int __devinit rgmii_probe(struct goto err_free; } - /* Check for RGMII type */ + /* Check for RGMII flags */ + if (of_get_property(ofdev->node, "has-mdio", NULL)) + dev->flags |= EMAC_RGMII_FLAG_HAS_MDIO; + + /* CAB lacks the right properties, fix this up */ if (of_device_is_compatible(ofdev->node, "ibm,rgmii-axon")) - dev->type = RGMII_AXON; - else - dev->type = RGMII_STANDARD; + dev->flags |= EMAC_RGMII_FLAG_HAS_MDIO; DBG2(dev, " Boot FER = 0x%08x, SSR = 0x%08x\n", in_be32(&dev->base->fer), in_be32(&dev->base->ssr)); @@ -263,9 +265,9 @@ static int __devinit rgmii_probe(struct out_be32(&dev->base->fer, 0); printk(KERN_INFO - "RGMII %s %s initialized\n", - dev->type == RGMII_STANDARD ? "standard" : "axon", - ofdev->node->full_name); + "RGMII %s initialized with%s MDIO support\n", + ofdev->node->full_name, + (dev->flags & EMAC_RGMII_FLAG_HAS_MDIO) ? "" : "out"); wmb(); dev_set_drvdata(&ofdev->dev, dev); Index: linux-work/drivers/net/ibm_newemac/rgmii.h === --- linux-work.orig/drivers/net/ibm_newemac/rgmii.h 2007-11-12 10:55:54.0 +1100 +++ linux-work/drivers/net/ibm_newemac/rgmii.h 2007-11-12 10:56:56.0 +1100 @@ -35,8 +35,9 @@ struct rgmii_regs { struct rgmii_instance { struct rgmii_regs __iomem *base; - /* Type of RGMII bridge */ - int type; + /* RGMII bridge flags */ + int flags; +#define EMAC_RGMII_FLAG_HAS_MDIO 0x0001 /* Only one EMAC whacks us at a time */ struct mutexlock; Index: linux-work/arch/powerpc/boot/dts/sequoia.dts === --- linux-work.orig/arch/powerpc/boot/dts/sequoia.dts 2007-11-12 10:58:38.0 +1100 +++ linux-work/arch/powerpc/boot/dts/sequoia.dts2007-11-12 10:58:47.0 +1100 @@ -245,6 +245,7 @@ device_type = "rgmii-interface"; compatible = "ibm,rgmii-440epx", "ibm,rgmii"; reg = ; + has-mdio; }; EMAC0: [EMAIL PROTECTED] { ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
[PATCH 4/11] ibm_newemac: Workaround reset timeout when no link
With some PHYs, when the link goes away, the EMAC reset fails due to the loss of the RX clock I believe. The old EMAC driver worked around that using some internal chip-specific clock force bits that are different on various 44x implementations. This is an attempt at doing it differently, by avoiding the reset when there is no link, but forcing loopback mode instead. It seems to work on my Taishan 440GX based board so far. Signed-off-by: Benjamin Herrenschmidt <[EMAIL PROTECTED]> Acked-by: Stefan Roese <[EMAIL PROTECTED]> --- drivers/net/ibm_newemac/core.c | 20 ++-- 1 file changed, 14 insertions(+), 6 deletions(-) Index: linux-work/drivers/net/ibm_newemac/core.c === --- linux-work.orig/drivers/net/ibm_newemac/core.c 2007-11-20 14:46:51.0 +1100 +++ linux-work/drivers/net/ibm_newemac/core.c 2007-11-20 14:46:58.0 +1100 @@ -464,26 +464,34 @@ static int emac_configure(struct emac_in { struct emac_regs __iomem *p = dev->emacp; struct net_device *ndev = dev->ndev; - int tx_size, rx_size; + int tx_size, rx_size, link = netif_carrier_ok(dev->ndev); u32 r, mr1 = 0; DBG(dev, "configure" NL); - if (emac_reset(dev) < 0) + if (!link) { + out_be32(&p->mr1, in_be32(&p->mr1) +| EMAC_MR1_FDE | EMAC_MR1_ILE); + udelay(100); + } else if (emac_reset(dev) < 0) return -ETIMEDOUT; if (emac_has_feature(dev, EMAC_FTR_HAS_TAH)) tah_reset(dev->tah_dev); - DBG(dev, " duplex = %d, pause = %d, asym_pause = %d\n", - dev->phy.duplex, dev->phy.pause, dev->phy.asym_pause); + DBG(dev, " link = %d duplex = %d, pause = %d, asym_pause = %d\n", + link, dev->phy.duplex, dev->phy.pause, dev->phy.asym_pause); /* Default fifo sizes */ tx_size = dev->tx_fifo_size; rx_size = dev->rx_fifo_size; + /* No link, force loopback */ + if (!link) + mr1 = EMAC_MR1_FDE | EMAC_MR1_ILE; + /* Check for full duplex */ - if (dev->phy.duplex == DUPLEX_FULL) + else if (dev->phy.duplex == DUPLEX_FULL) mr1 |= EMAC_MR1_FDE | EMAC_MR1_MWSW_001; /* Adjust fifo sizes, mr1 and timeouts based on link speed */ @@ -1165,9 +1173,9 @@ static void emac_link_timer(struct work_ link_poll_interval = PHY_POLL_LINK_ON; } else { if (netif_carrier_ok(dev->ndev)) { - emac_reinitialize(dev); netif_carrier_off(dev->ndev); netif_tx_disable(dev->ndev); + emac_reinitialize(dev); emac_print_link_status(dev); } link_poll_interval = PHY_POLL_LINK_OFF; ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
[PATCH 3/11] ibm_newemac: Fix ZMII refcounting bug
When using ZMII for MDIO only (such as 440GX with RGMII for data and ZMII for MDIO), the ZMII code would fail to properly refcount, thus triggering a BUG_ON(). Signed-off-by: Benjamin Herrenschmidt <[EMAIL PROTECTED]> Acked-by: Stefan Roese <[EMAIL PROTECTED]> --- drivers/net/ibm_newemac/zmii.c |4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) Index: linux-work/drivers/net/ibm_newemac/zmii.c === --- linux-work.orig/drivers/net/ibm_newemac/zmii.c 2007-11-08 15:45:32.0 +1100 +++ linux-work/drivers/net/ibm_newemac/zmii.c 2007-11-08 15:46:21.0 +1100 @@ -83,12 +83,14 @@ int __devinit zmii_attach(struct of_devi ZMII_DBG(dev, "init(%d, %d)" NL, input, *mode); - if (!zmii_valid_mode(*mode)) + if (!zmii_valid_mode(*mode)) { /* Probably an EMAC connected to RGMII, * but it still may need ZMII for MDIO so * we don't fail here. */ + dev->users++; return 0; + } mutex_lock(&dev->lock); ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
[PATCH 2/11] ibm_newemac: Add ET1011c PHY support
From: Stefan Roese <[EMAIL PROTECTED]> This adds support for the Agere ET1011c PHY as found on the AMCC Taishan board. Signed-off-by: Stefan Roese <[EMAIL PROTECTED]> Signed-off-by: Benjamin Herrenschmidt <[EMAIL PROTECTED]> --- drivers/net/ibm_newemac/phy.c | 37 + 1 file changed, 37 insertions(+) Index: linux-work/drivers/net/ibm_newemac/phy.c === --- linux-work.orig/drivers/net/ibm_newemac/phy.c 2007-11-08 18:54:12.0 +1100 +++ linux-work/drivers/net/ibm_newemac/phy.c2007-11-08 18:54:13.0 +1100 @@ -327,6 +327,42 @@ static int m88e_init(struct mii_phy return 0; } +static int et1011c_init(struct mii_phy *phy) +{ +u16 reg_short; + +reg_short = (u16)(phy_read(phy,0x16)); +reg_short &= ~(0x7); +reg_short |= 0x6; /* RGMII Trace Delay*/ +phy_write(phy, 0x16, reg_short); + +reg_short = (u16)(phy_read(phy, 0x17)); +reg_short &= ~(0x40); +phy_write(phy, 0x17, reg_short); + +phy_write(phy,0x1c,0x74f0); +return 0; +} + +static struct mii_phy_ops et1011c_phy_ops = { +.init = et1011c_init, +.setup_aneg = genmii_setup_aneg, +.setup_forced = genmii_setup_forced, +.poll_link = genmii_poll_link, +.read_link = genmii_read_link +}; + +static struct mii_phy_def et1011c_phy_def = { +.phy_id = 0x0282f000, +.phy_id_mask= 0x0f00, +.name = "ET1011C Gigabit Ethernet", +.ops= &et1011c_phy_ops +}; + + + + + static struct mii_phy_ops m88e_phy_ops = { .init = m88e_init, .setup_aneg = genmii_setup_aneg, @@ -344,6 +380,7 @@ static struct mii_phy_def m88e_phy_d }; static struct mii_phy_def *mii_phy_table[] = { + &et1011c_phy_def, &cis8201_phy_def, &bcm5248_phy_def, &m88e_phy_def, ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
[PATCH 1/11] ibm_newemac: Add BCM5248 and Marvell 88E1111 PHY support
From: Stefan Roese <[EMAIL PROTECTED]> This patch adds BCM5248 and Marvell 88E PHY support to NEW EMAC driver. These PHY chips are used on PowerPC 440EPx boards. The PHY code is based on the previous work by Stefan Roese <[EMAIL PROTECTED]> Signed-off-by: Stefan Roese <[EMAIL PROTECTED]> Signed-off-by: Valentine Barshak <[EMAIL PROTECTED]> Signed-off-by: Benjamin Herrenschmidt <[EMAIL PROTECTED]> --- --- linux.orig/drivers/net/ibm_newemac/phy.c2007-06-15 21:45:18.0 +0400 +++ linux/drivers/net/ibm_newemac/phy.c 2007-06-15 20:45:15.0 +0400 @@ -306,8 +306,47 @@ .ops= &cis8201_phy_ops }; +static struct mii_phy_def bcm5248_phy_def = { + + .phy_id = 0x0143bc00, + .phy_id_mask= 0x0ff0, + .name = "BCM5248 10/100 SMII Ethernet", + .ops= &generic_phy_ops +}; + +static int m88e_init(struct mii_phy *phy) +{ + printk("%s: Marvell 88E Ethernet\n", __FUNCTION__); + phy_write(phy, 0x14, 0x0ce3); + phy_write(phy, 0x18, 0x4101); + phy_write(phy, 0x09, 0x0e00); + phy_write(phy, 0x04, 0x01e1); + phy_write(phy, 0x00, 0x9140); + phy_write(phy, 0x00, 0x1140); + + return 0; +} + +static struct mii_phy_ops m88e_phy_ops = { + .init = m88e_init, + .setup_aneg = genmii_setup_aneg, + .setup_forced = genmii_setup_forced, + .poll_link = genmii_poll_link, + .read_link = genmii_read_link +}; + +static struct mii_phy_def m88e_phy_def = { + + .phy_id = 0x01410CC0, + .phy_id_mask= 0x0ff0, + .name = "Marvell 88E Ethernet", + .ops= &m88e_phy_ops, +}; + static struct mii_phy_def *mii_phy_table[] = { &cis8201_phy_def, + &bcm5248_phy_def, + &m88e_phy_def, &genmii_phy_def, NULL }; ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
[PATCH 0/11] ibm_newemac: Candidate patches for 2.6.25
Here are the patches I have pending for EMAC. With those, along with some other powerpc patches scheduled for 2.6.25 for adding support for those various boards, I have EMAC now working properly on a variety of platforms, such as Taishan (440GX), Katmai (440SP), EP405 (405GP), Bamboo (440EP), etc... This serie apply on top of the patch: "ibm_newemac: Fix possible lockup on close" Which should be on its way to 2.6.24 already. ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
Re: [BUG] 2.6.24-rc3-mm2 soft lockup while running tbench
Andrew Morton wrote: > On Wed, 28 Nov 2007 20:03:22 +0530 > Kamalesh Babulal <[EMAIL PROTECTED]> wrote: > >> Hi Andrew, >> >> while running tbench on the powerpc with 2.6.24-rc3-mm2 softlock up occurs >> >> BUG: soft lockup - CPU#0 stuck for 11s! [tbench:12183] >> NIP: c00ac978 LR: c00acff0 CTR: c005c648 >> REGS: C0076F0F3200 TRAP: 0901 Not tainted (2.6.24-rc3-mm2-autotest) >> MSR: 80009032 CR: 44000482 XER: >> TASK = C0076F4BC000[12183] 'tbench' THREAD: C0076F0F CPU: 0 >> NIP [c00ac978] .get_page_from_freelist+0x1cc/0x754 >> LR [c00acff0] .__alloc_pages+0xb0/0x3a8 >> Call Trace: >> [c0076f0f3480] [c0076f0f3560] 0xc0076f0f3560 (unreliable) >> [c0076f0f3590] [c00acff0] .__alloc_pages+0xb0/0x3a8 >> [c0076f0f3680] [c00ce2e4] .alloc_pages_current+0xa8/0xc8 >> [c0076f0f3710] [c00ac6ec] .__get_free_pages+0x20/0x70 >> [c0076f0f3790] [c00d75c8] .__kmalloc_node_track_caller+0x60/0x148 >> [c0076f0f3840] [c02c22b0] .__alloc_skb+0x98/0x184 >> [c0076f0f38f0] [c0306cd8] .tcp_sendmsg+0x1fc/0xe24 >> [c0076f0f3a10] [c02b963c] .sock_sendmsg+0xe4/0x128 >> [c0076f0f3c10] [c02ba4ec] .sys_sendto+0xd4/0x120 >> [c0076f0f3d90] [c02df2f8] .compat_sys_socketcall+0x148/0x214 >> [c0076f0f3e30] [c000872c] syscall_exit+0x0/0x40 >> Instruction dump: >> 720b0001 eb97 40820070 7202 4182000c e8bc 4818 72080004 >> 4182000c e8bc0008 4808 e8bc0010 7f83e378 7de407b4 7e078378 >> > > hm. Beats me. Does the machine recover OK? > - Hi Andrew, In the set of test cases ran serially, the softlockup in seen in tbench, then the remaining test cases get to run successfully after the softlockup. -- Thanks & Regards, Kamalesh Babulal, Linux Technology Center, IBM, ISTL. ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
Re: [PATCH] Add MPC837xEMDS PCIE RC mode support
Hi, On Fri, Nov 30, 2007 at 11:45:34AM +0800, Li Li wrote: > + [EMAIL PROTECTED] { Why call it pci2@ (and pci3@ below)? They are clearly identifiable with their unit addresses anyway. > +config PPC_MPC83XX_PCIE > + bool "MPC837X PCI Express support" > + depends on PCIEPORTBUS && PPC_MPC837x > + default n > + help > + Enables MPC837x PCI express RC mode Why have a separate config option for this? For systems where you don't want PCI-e configured, it should be left out of the device tree instead. -Olof ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
[PATCH] Add IPIC MSI interrupt support
The IPIC MSI is introduced on MPC837x chip. Implements the IPIC MSI as two level interrupt controller. Signed-off-by: Tony Li <[EMAIL PROTECTED]> --- arch/powerpc/boot/dts/mpc8377_mds.dts | 14 ++ arch/powerpc/boot/dts/mpc8378_mds.dts | 14 ++ arch/powerpc/boot/dts/mpc8379_mds.dts | 14 ++ arch/powerpc/platforms/83xx/Kconfig |6 + arch/powerpc/platforms/83xx/mpc837x_mds.c | 11 + arch/powerpc/sysdev/Makefile |1 + arch/powerpc/sysdev/ipic_msi.c| 359 + include/asm-powerpc/ipic_msi.h| 54 + 8 files changed, 473 insertions(+), 0 deletions(-) create mode 100644 arch/powerpc/sysdev/ipic_msi.c create mode 100644 include/asm-powerpc/ipic_msi.h diff --git a/arch/powerpc/boot/dts/mpc8377_mds.dts b/arch/powerpc/boot/dts/mpc8377_mds.dts index 1f7819e..1068fe2 100644 --- a/arch/powerpc/boot/dts/mpc8377_mds.dts +++ b/arch/powerpc/boot/dts/mpc8377_mds.dts @@ -210,6 +210,20 @@ #interrupt-cells = <2>; reg = <700 100>; }; + + [EMAIL PROTECTED] { + compatible = "fsl,ipic-msi"; + reg = <7c0 40>; + interrupts = < 43 8 + 4 8 + 51 8 + 52 8 + 56 8 + 57 8 + 58 8 + 59 8 >; + interrupt-parent = < &ipic >; + }; }; [EMAIL PROTECTED] { diff --git a/arch/powerpc/boot/dts/mpc8378_mds.dts b/arch/powerpc/boot/dts/mpc8378_mds.dts index 1503ae3..f12658f 100644 --- a/arch/powerpc/boot/dts/mpc8378_mds.dts +++ b/arch/powerpc/boot/dts/mpc8378_mds.dts @@ -192,6 +192,20 @@ #interrupt-cells = <2>; reg = <700 100>; }; + + [EMAIL PROTECTED] { + compatible = "fsl,ipic-msi"; + reg = <7c0 40>; + interrupts = < 43 8 + 4 8 + 51 8 + 52 8 + 56 8 + 57 8 + 58 8 + 59 8 >; + interrupt-parent = < &ipic >; + }; }; [EMAIL PROTECTED] { diff --git a/arch/powerpc/boot/dts/mpc8379_mds.dts b/arch/powerpc/boot/dts/mpc8379_mds.dts index cdb4426..9fe4bd2 100644 --- a/arch/powerpc/boot/dts/mpc8379_mds.dts +++ b/arch/powerpc/boot/dts/mpc8379_mds.dts @@ -236,6 +236,20 @@ #interrupt-cells = <2>; reg = <700 100>; }; + + [EMAIL PROTECTED] { + compatible = "fsl,ipic-msi"; + reg = <7c0 40>; + interrupts = < 43 8 + 4 8 + 51 8 + 52 8 + 56 8 + 57 8 + 58 8 + 59 8 >; + interrupt-parent = < &ipic >; + }; }; [EMAIL PROTECTED] { diff --git a/arch/powerpc/platforms/83xx/Kconfig b/arch/powerpc/platforms/83xx/Kconfig index 00154c5..4c51f78 100644 --- a/arch/powerpc/platforms/83xx/Kconfig +++ b/arch/powerpc/platforms/83xx/Kconfig @@ -88,6 +88,12 @@ config PPC_MPC837x select FSL_SERDES default y if MPC837x_MDS +config IPIC_MSI + bool + depends on PCI_MSI + default y if PPC_MPC837x + default n + config PPC_MPC83XX_PCIE bool "MPC837X PCI Express support" depends on PCIEPORTBUS && PPC_MPC837x diff --git a/arch/powerpc/platforms/83xx/mpc837x_mds.c b/arch/powerpc/platforms/83xx/mpc837x_mds.c index 6048f1b..dbea34b 100644 --- a/arch/powerpc/platforms/83xx/mpc837x_mds.c +++ b/arch/powerpc/platforms/83xx/mpc837x_mds.c @@ -17,6 +17,9 @@ #include #include +#if CONFIG_IPIC_MSI +#include +#endif #include #include @@ -84,6 +87,14 @@ static void __init mpc837x_mds_init_IRQ(void) * in case the boot rom changed something on us. */ ipic_set_default_priority(); + +#if CONFIG_IPIC_MSI + np = of_find_compatible_node(NULL, NULL, "fsl,ipic-msi"); + if (!np) + return; + + ipic_msi_init(np, ipic_msi_cascade); +#endif } /* diff --git a/arch/powerpc/sysdev/Makefile b/arch/powerpc/sysdev/Makefile index 99a77d7..5946b6a 100644 --- a/arch/powerpc/sysdev/Makefile +++ b/arch/powerpc/sysdev/Makefile @@ -25,6 +25,7 @@ ifeq ($(CONF
[PATCH] Add MPC837xEMDS PCIE RC mode support
The PCIE controller is initiated in u-boot. This patch is based on Leo`s mpc837xe patches. Signed-off-by: Tony Li <[EMAIL PROTECTED]> --- arch/powerpc/boot/dts/mpc8377_mds.dts | 56 -- arch/powerpc/boot/dts/mpc8378_mds.dts | 56 -- arch/powerpc/platforms/83xx/Kconfig |7 ++ arch/powerpc/platforms/83xx/mpc8313_rdb.c |2 +- arch/powerpc/platforms/83xx/mpc832x_mds.c |2 +- arch/powerpc/platforms/83xx/mpc832x_rdb.c |2 +- arch/powerpc/platforms/83xx/mpc834x_itx.c |2 +- arch/powerpc/platforms/83xx/mpc834x_mds.c |2 +- arch/powerpc/platforms/83xx/mpc836x_mds.c |2 +- arch/powerpc/platforms/83xx/mpc837x_mds.c |7 +- arch/powerpc/platforms/83xx/mpc83xx.h | 10 ++- arch/powerpc/platforms/83xx/pci.c | 166 +++- 12 files changed, 283 insertions(+), 31 deletions(-) diff --git a/arch/powerpc/boot/dts/mpc8377_mds.dts b/arch/powerpc/boot/dts/mpc8377_mds.dts index 4402e39..1f7819e 100644 --- a/arch/powerpc/boot/dts/mpc8377_mds.dts +++ b/arch/powerpc/boot/dts/mpc8377_mds.dts @@ -197,14 +197,6 @@ clock = ; }; - serdes2:[EMAIL PROTECTED] { - compatible = "fsl,serdes"; - reg = ; - vdd-1v; - protocol = "pcie"; - clock = ; - }; - /* IPIC * interrupts cell = * sense values match linux IORESOURCE_IRQ_* defines: @@ -279,4 +271,52 @@ compatible = "fsl,mpc8349-pci"; device_type = "pci"; }; + + [EMAIL PROTECTED] { + interrupt-map-mask = ; + msi-available-ranges = <43 4 51 52 56 57 58 59>; + interrupt-map = < + 0 0 1 &ipic 1 8 + 0 0 2 &ipic 1 8 + 0 0 3 &ipic 1 8 + 0 0 4 &ipic 1 8 + >; + interrupt-parent = < &ipic >; + interrupts = <1 8>; + bus-range = <0 0>; + ranges = <0200 0 A800 A800 0 1000 + 0100 0 B800 0 0080>; + clock-frequency = <0>; + #interrupt-cells = <1>; + #size-cells = <2>; + #address-cells = <3>; + reg = ; + compatible = "fsl,mpc8377-pcie"; + device_type = "pci"; + }; + + [EMAIL PROTECTED] { + interrupt-map-mask = ; + msi-available-ranges = <43 4 51 52 56 57 58 59>; + interrupt-map = < + 0 0 1 &ipic 2 8 + 0 0 2 &ipic 2 8 + 0 0 3 &ipic 2 8 + 0 0 4 &ipic 2 8 + >; + interrupt-parent = < &ipic >; + interrupts = <2 8>; + bus-range = <0 0>; + ranges = <0200 0 C800 C800 0 1000 + 0100 0 D800 0 0080>; + clock-frequency = <0>; + #interrupt-cells = <1>; + #size-cells = <2>; + #address-cells = <3>; + reg = ; + compatible = "fsl,mpc8377-pcie"; + device_type = "pci"; + }; }; diff --git a/arch/powerpc/boot/dts/mpc8378_mds.dts b/arch/powerpc/boot/dts/mpc8378_mds.dts index 54171f4..1503ae3 100644 --- a/arch/powerpc/boot/dts/mpc8378_mds.dts +++ b/arch/powerpc/boot/dts/mpc8378_mds.dts @@ -179,14 +179,6 @@ clock = ; }; - serdes2:[EMAIL PROTECTED] { - compatible = "fsl,serdes"; - reg = ; - vdd-1v; - protocol = "pcie"; - clock = ; - }; - /* IPIC * interrupts cell = * sense values match linux IORESOURCE_IRQ_* defines: @@ -261,4 +253,52 @@ compatible = "fsl,mpc8349-pci"; device_type = "pci"; }; + + [EMAIL PROTECTED] { + interrupt-map-mask = ; + msi-available-ranges = <43 4 51 52 56 57 58 59>; + interrupt-map = < + 0 0 1 &ipic 1 8 + 0 0 2 &ipic 1 8 + 0 0 3 &ipic 1 8 + 0 0 4 &ipic 1 8 + >; + interrupt-parent = < &ipic >; + interrupts = <1 8>; + bus-range = <0 0>; + ranges = <0200 0 A800 A800 0 1000 + 0100 0 B800 0 0080>; + clock-frequency = <0>; + #interrupt-cells = <1>; + #size-cells = <2>; + #addre
[PATCH 2/2] [POWERPC] pasemi: Register i2c_board_info
[POWERPC] pasemi: Register i2c_board_info Setup i2c_board_info based on device tree contents. This has to be a device_initcall since we need PCI to be probed by the time we run it, but before the actual driver is initialized. Signed-off-by: Olof Johansson <[EMAIL PROTECTED]> Index: 2.6.24/arch/powerpc/platforms/pasemi/Makefile === --- 2.6.24.orig/arch/powerpc/platforms/pasemi/Makefile +++ 2.6.24/arch/powerpc/platforms/pasemi/Makefile @@ -1,4 +1,4 @@ -obj-y += setup.o pci.o time.o idle.o powersave.o iommu.o +obj-y += setup.o pci.o time.o idle.o powersave.o iommu.o misc.o obj-$(CONFIG_PPC_PASEMI_MDIO) += gpio_mdio.o obj-$(CONFIG_ELECTRA_IDE) += electra_ide.o obj-$(CONFIG_PPC_PASEMI_CPUFREQ) += cpufreq.o Index: 2.6.24/arch/powerpc/platforms/pasemi/misc.c === --- /dev/null +++ 2.6.24/arch/powerpc/platforms/pasemi/misc.c @@ -0,0 +1,66 @@ +/* + * Copyright (C) 2007 PA Semi, Inc + * + * Parts based on arch/powerpc/sysdev/fsl_soc.c: + * + * 2006 (c) MontaVista Software, Inc. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + */ + +#include +#include +#include +#include +#include +#include + +#ifdef CONFIG_I2C_BOARDINFO +static int __init pasemi_register_i2c_devices(void) +{ + struct pci_dev *pdev; + struct device_node *adap_node; + struct device_node *node; + + pdev = NULL; + while ((pdev = pci_get_device(PCI_VENDOR_ID_PASEMI, 0xa003, pdev))) { + adap_node = pci_device_to_OF_node(pdev); + + if (!adap_node) + continue; + + node = NULL; + while ((node = of_get_next_child(adap_node, node))) { + struct i2c_board_info info = {}; + const u32 *addr; + int len; + + addr = of_get_property(node, "reg", &len); + if (!addr || len < sizeof(int) || + *addr > (1 << 10) - 1) { + printk(KERN_WARNING + "pasemi_register_i2c_devices: " + "invalid i2c device entry\n"); + continue; + } + + info.irq = irq_of_parse_and_map(node, 0); + if (info.irq == NO_IRQ) + info.irq = -1; + + if (of_fill_i2c_info(node, &info) < 0) + continue; + + info.addr = *addr; + + i2c_register_board_info(PCI_FUNC(pdev->devfn), &info, + 1); + } + } + return 0; +} +device_initcall(pasemi_register_i2c_devices); +#endif ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
[PATCH 1/2] [POWERPC] Consolidate compatible-to-i2c_boardinfo mapping code
[POWERPC] Consolidate compatible-to-i2c_boardinfo mapping code Move the mapping from device tree compatible field to i2c_boardinfo structures for powerpc, since several platforms now use this. Signed-off-by: Olof Johansson <[EMAIL PROTECTED]> --- arch/powerpc/sysdev/Makefile |1 arch/powerpc/sysdev/fsl_soc.c| 38 - arch/powerpc/sysdev/i2c_of_mapping.c | 61 +++ include/asm-powerpc/i2c_of.h | 14 4 files changed, 77 insertions(+), 37 deletions(-) Index: 2.6.24/arch/powerpc/sysdev/Makefile === --- 2.6.24.orig/arch/powerpc/sysdev/Makefile +++ 2.6.24/arch/powerpc/sysdev/Makefile @@ -20,6 +20,7 @@ obj-$(CONFIG_MV64X60) += $(mv64x60-y) m mv64x60_udbg.o obj-$(CONFIG_RTC_DRV_CMOS) += rtc_cmos_setup.o obj-$(CONFIG_AXON_RAM) += axonram.o +obj-$(CONFIG_I2C_BOARDINFO)+= i2c_of_mapping.o ifeq ($(CONFIG_PPC_MERGE),y) obj-$(CONFIG_PPC_INDIRECT_PCI) += indirect_pci.o Index: 2.6.24/arch/powerpc/sysdev/i2c_of_mapping.c === --- /dev/null +++ 2.6.24/arch/powerpc/sysdev/i2c_of_mapping.c @@ -0,0 +1,61 @@ +/* + * Parts based on arch/powerpc/sysdev/fsl_soc.c: + * + * 2006 (c) MontaVista Software, Inc. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + */ + +#include +#include +#include +#include +#include + +struct i2c_driver_device { + char*of_device; + char*i2c_driver; + char*i2c_type; +}; + + +/* This table is used to map from device tree compat fields to + * the driver and model used by the i2c board info structures. + * + * Add new mappings as needed. + */ + +static struct i2c_driver_device i2c_devices[] __initdata = { + {"ricoh,rs5c372a", "rtc-rs5c372", "rs5c372a",}, + {"ricoh,rs5c372b", "rtc-rs5c372", "rs5c372b",}, + {"ricoh,rv5c386", "rtc-rs5c372", "rv5c386",}, + {"ricoh,rv5c387a", "rtc-rs5c372", "rv5c387a",}, + {"dallas,ds1307", "rtc-ds1307", "ds1307",}, + {"dallas,ds1337", "rtc-ds1307", "ds1337",}, + {"dallas,ds1338", "rtc-ds1307", "ds1338",}, + {"dallas,ds1339", "rtc-ds1307", "ds1339",}, + {"dallas,ds1340", "rtc-ds1307", "ds1340",}, + {"stm,m41t00", "rtc-ds1307", "m41t00"}, + {"dallas,ds1374", "rtc-ds1374", "rtc-ds1374",}, +}; + +int __init of_fill_i2c_info(struct device_node *node, + struct i2c_board_info *info) +{ + int i; + + for (i = 0; i < ARRAY_SIZE(i2c_devices); i++) { + if (!of_device_is_compatible(node, i2c_devices[i].of_device)) + continue; + if (strlcpy(info->driver_name, i2c_devices[i].i2c_driver, + KOBJ_NAME_LEN) >= KOBJ_NAME_LEN || + strlcpy(info->type, i2c_devices[i].i2c_type, + I2C_NAME_SIZE) >= I2C_NAME_SIZE) + return -ENOMEM; + return 0; + } + return -ENODEV; +} Index: 2.6.24/include/asm-powerpc/i2c_of.h === --- /dev/null +++ 2.6.24/include/asm-powerpc/i2c_of.h @@ -0,0 +1,14 @@ +/* + * Functions to map device tree compatible fields to values used by i2c + * board info structures + */ + +#ifndef POWERPC_I2C_OF_H +#define POWERPC_I2C_OF_H + +#ifdef CONFIG_I2C_BOARDINFO +extern int __init of_fill_i2c_info(struct device_node *node, + struct i2c_board_info *info); +#endif + +#endif Index: 2.6.24/arch/powerpc/sysdev/fsl_soc.c === --- 2.6.24.orig/arch/powerpc/sysdev/fsl_soc.c +++ 2.6.24/arch/powerpc/sysdev/fsl_soc.c @@ -320,43 +320,7 @@ arch_initcall(gfar_of_init); #ifdef CONFIG_I2C_BOARDINFO #include -struct i2c_driver_device { - char*of_device; - char*i2c_driver; - char*i2c_type; -}; - -static struct i2c_driver_device i2c_devices[] __initdata = { - {"ricoh,rs5c372a", "rtc-rs5c372", "rs5c372a",}, - {"ricoh,rs5c372b", "rtc-rs5c372", "rs5c372b",}, - {"ricoh,rv5c386", "rtc-rs5c372", "rv5c386",}, - {"ricoh,rv5c387a", "rtc-rs5c372", "rv5c387a",}, - {"dallas,ds1307", "rtc-ds1307", "ds1307",}, - {"dallas,ds1337", "rtc-ds1307", "ds1337",}, - {"dallas,ds1338", "rtc-ds1307", "ds1338",}, - {"dallas,ds1339", "rtc-ds1307", "ds1339",}, - {"dallas,ds1340", "rtc-ds1307", "ds1340",}, - {"stm,m41t00", "rtc-ds1307", "m41t00"}, - {"dallas,ds1374", "rtc-ds1374", "rtc-ds1374",}, -}; - -static int __init of_find_i2c_driver(struct dev
Re: [PATCH v7 9/9] add MPC837x MDS board default device tree
On Oct 19, 2007, at 6:38 AM, Li Yang wrote: > Signed-off-by: Li Yang <[EMAIL PROTECTED]> > --- > Updated pci node. > arch/powerpc/boot/dts/mpc8377_mds.dts | 282 > +++ > arch/powerpc/boot/dts/mpc8378_mds.dts | 264 > + > arch/powerpc/boot/dts/mpc8379_mds.dts | 300 > + > 3 files changed, 846 insertions(+), 0 deletions(-) > create mode 100644 arch/powerpc/boot/dts/mpc8377_mds.dts > create mode 100644 arch/powerpc/boot/dts/mpc8378_mds.dts > create mode 100644 arch/powerpc/boot/dts/mpc8379_mds.dts Can you make the following updates: * Drop serdes and phy-handles * Update sata nodes: + [EMAIL PROTECTED] { + compatible = "fsl,mpc8315-sata", "fsl,sata-pq2pro; + reg = <19000 1000>; + interrupts = <2d 8>; + interrupt-parent = < &ipic >; +}; * Added labels for ethernet (enet), serial, pci (some examples below): - k > > > diff --git a/arch/powerpc/boot/dts/mpc8377_mds.dts b/arch/powerpc/ > boot/dts/mpc8377_mds.dts > new file mode 100644 > index 000..4402e39 > --- /dev/null > +++ b/arch/powerpc/boot/dts/mpc8377_mds.dts > @@ -0,0 +1,282 @@ > +/* > + * MPC8377E MDS Device Tree Source > + * > + * Copyright 2007 Freescale Semiconductor Inc. > + * > + * This program is free software; you can redistribute it and/or > modify it > + * under the terms of the GNU General Public License as > published by the > + * Free Software Foundation; either version 2 of the License, or > (at your > + * option) any later version. > + */ > + > +/ { > + model = "fsl,mpc8377emds"; > + compatible = "fsl,mpc8377emds","fsl,mpc837xmds"; > + #address-cells = <1>; > + #size-cells = <1>; [VERIFY THIS -- is copy/pasted from somewhere else] + aliases { + ethernet0 = "/[EMAIL PROTECTED]/[EMAIL PROTECTED]"; + ethernet1 = "/[EMAIL PROTECTED]/[EMAIL PROTECTED]"; + ethernet2 = "/[EMAIL PROTECTED]/[EMAIL PROTECTED]"; + serial0 = "/[EMAIL PROTECTED]/[EMAIL PROTECTED]"; + serial1 = "/[EMAIL PROTECTED]/[EMAIL PROTECTED]"; + pci0 = "/[EMAIL PROTECTED]"; + }; > + > + enet0: [EMAIL PROTECTED] { > > + device_type = "network"; > + model = "eTSEC"; > + compatible = "gianfar"; > + reg = <24000 1000>; > + local-mac-address = [ 00 00 00 00 00 00 ]; > + interrupts = <20 8 21 8 22 8>; > + phy-connection-type = "mii"; > + interrupt-parent = < &ipic >; > + phy-handle = < &phy2 >; > + }; > + > + enet1: [EMAIL PROTECTED] { > > + device_type = "network"; > + model = "eTSEC"; > + compatible = "gianfar"; > + reg = <25000 1000>; > + local-mac-address = [ 00 00 00 00 00 00 ]; > + interrupts = <23 8 24 8 25 8>; > + phy-connection-type = "mii"; > + interrupt-parent = < &ipic >; > + phy-handle = < &phy3 >; > + }; > + > + serial0: [EMAIL PROTECTED] { > > + device_type = "serial"; > + compatible = "ns16550"; > + reg = <4500 100>; > + clock-frequency = <0>; > + interrupts = <9 8>; > + interrupt-parent = < &ipic >; > + }; > + > + serial1: [EMAIL PROTECTED] { > > + device_type = "serial"; > + compatible = "ns16550"; > + reg = <4600 100>; > + clock-frequency = <0>; > + interrupts = ; > + interrupt-parent = < &ipic >; > + }; > + > + pci0: [EMAIL PROTECTED] { > + interrupt-map-mask = ; > + > device_type = "pci"; > + }; > +}; ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
Re: [PATCH v2] qe: change qe_setbrg() to take an enum qe_clock instead of an integer
On Nov 29, 2007, at 5:26 PM, Timur Tabi wrote: > qe_setbrg() currently takes an integer to indicate the BRG number. > Change that > to take an enum qe_clock instead, since this enum is intended to > represent > clock sources. > > Signed-off-by: Timur Tabi <[EMAIL PROTECTED]> > --- > > This patch applies to Kumar's for-2.6.25 branch. You might need to > apply my > other patch, "qe: fix device tree lookup code in qe_muram_init()", > first. > > It's safe to change the parameters to qe_setbrg() because no one is > using that > function yet. > > arch/powerpc/sysdev/qe_lib/qe.c | 14 -- > include/asm-powerpc/qe.h| 94 ++ > +--- > 2 files changed, 56 insertions(+), 52 deletions(-) applied. - k ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
Re: powerpc: fix guts_set_dmacr() and add guts_set_pmuxcr_dma() to immap_86xx.h
On Nov 29, 2007, at 2:19 PM, Timur Tabi wrote: > Updated guts_set_dmacr() to enumerate the DMA controllers at 0, > instead of 1, > so that it now matches other related functions. Added function > guts_set_pmuxcr_dma() to set the external DMA control bits in the > PMUXCR > register of the global utilities structure. > > Signed-off-by: Timur Tabi <[EMAIL PROTECTED]> > --- > > Changing the behavior of guts_set_dmacr() is okay because no one > uses that > function yet. > > This patch is for Kumar's for-2.6.25 branch. applied. - k ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
Re: [PATCH v7 8/9] add MPC837x MDS default kernel configuration
On Oct 19, 2007, at 6:38 AM, Li Yang wrote: > Signed-off-by: Li Yang <[EMAIL PROTECTED]> > --- > arch/powerpc/configs/mpc837x_mds_defconfig | 878 +++ > + > 1 files changed, 878 insertions(+), 0 deletions(-) > create mode 100644 arch/powerpc/configs/mpc837x_mds_defconfig applied. - k ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
Re: [PATCH v7 7/9] ipic: clean up unsupported ack operations
On Oct 19, 2007, at 6:38 AM, Li Yang wrote: > IPIC controller doesn't support ack operations. The pending registers > are read-only. The patch removes ack operations which are not needed. > > Signed-off-by: Li Yang <[EMAIL PROTECTED]> > --- > arch/powerpc/sysdev/ipic.c | 40 + > +-- > 1 files changed, 2 insertions(+), 38 deletions(-) applied. - ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
Re: [PATCH v7 4/9] add platform support for MPC837x MDS board
On Oct 19, 2007, at 6:38 AM, Li Yang wrote: > The MPC837x MDS is a new member of Freescale MDS reference system. > > Signed-off-by: Li Yang <[EMAIL PROTECTED]> > --- > arch/powerpc/platforms/83xx/Kconfig | 12 +++ > arch/powerpc/platforms/83xx/Makefile |1 + > arch/powerpc/platforms/83xx/mpc837x_mds.c | 104 > + > 3 files changed, 117 insertions(+), 0 deletions(-) > create mode 100644 arch/powerpc/platforms/83xx/mpc837x_mds.c applied. - k ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
Re: [PATCH v7 2/9] ipic: add new interrupts introduced by new chip
On Oct 19, 2007, at 6:38 AM, Li Yang wrote: > These interrupts are introduced by the latest Freescale SoC such as > MPC837x. > > Signed-off-by: Li Yang <[EMAIL PROTECTED]> > --- > arch/powerpc/sysdev/ipic.c | 138 +++ > +++-- > arch/powerpc/sysdev/ipic.h |7 +- > include/asm-powerpc/ipic.h | 12 ++-- > 3 files changed, 143 insertions(+), 14 deletions(-) applied. - k ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
Re: [PATCH v7 1/9] add e300c4 entry to cputable
On Oct 19, 2007, at 6:38 AM, Li Yang wrote: > Signed-off-by: Li Yang <[EMAIL PROTECTED]> > --- > arch/powerpc/kernel/cputable.c | 13 - > 1 files changed, 12 insertions(+), 1 deletions(-) applied. - k ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
Re: [PATCH Rev 2] 8xxx: Convert #include of asm/of_{platform, device}.h into linux/of_{platform, device}.h.
On Nov 6, 2007, at 12:11 PM, Jon Loeliger wrote: > From: Jon Loeliger <[EMAIL PROTECTED]> > > Signed-off-by: Jon Loeliger <[EMAIL PROTECTED]> > Acked-by: Stephen Rothwell <[EMAIL PROTECTED]> > --- > > Chip away at some janitor work. > Catch both asm/of_platform.h and asm/of_device.h this time. > Add sfr's ACK. > > arch/powerpc/platforms/82xx/pq2fads.c |2 +- > arch/powerpc/platforms/83xx/mpc832x_mds.c |4 ++-- > arch/powerpc/platforms/83xx/mpc832x_rdb.c |2 +- > arch/powerpc/platforms/83xx/mpc836x_mds.c |4 ++-- > arch/powerpc/platforms/85xx/mpc85xx_mds.c |4 ++-- > 5 files changed, 8 insertions(+), 8 deletions(-) > applied. - k ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
[PATCH v2] qe: change qe_setbrg() to take an enum qe_clock instead of an integer
qe_setbrg() currently takes an integer to indicate the BRG number. Change that to take an enum qe_clock instead, since this enum is intended to represent clock sources. Signed-off-by: Timur Tabi <[EMAIL PROTECTED]> --- This patch applies to Kumar's for-2.6.25 branch. You might need to apply my other patch, "qe: fix device tree lookup code in qe_muram_init()", first. It's safe to change the parameters to qe_setbrg() because no one is using that function yet. arch/powerpc/sysdev/qe_lib/qe.c | 14 -- include/asm-powerpc/qe.h| 94 +++--- 2 files changed, 56 insertions(+), 52 deletions(-) diff --git a/arch/powerpc/sysdev/qe_lib/qe.c b/arch/powerpc/sysdev/qe_lib/qe.c index 298e073..f26bc0c 100644 --- a/arch/powerpc/sysdev/qe_lib/qe.c +++ b/arch/powerpc/sysdev/qe_lib/qe.c @@ -167,19 +167,20 @@ unsigned int get_brg_clk(void) /* Program the BRG to the given sampling rate and multiplier * - * @brg: the BRG, 1-16 + * @brg: the BRG, QE_BRG1 - QE_BRG16 * @rate: the desired sampling rate * @multiplier: corresponds to the value programmed in GUMR_L[RDCR] or * GUMR_L[TDCR]. E.g., if this BRG is the RX clock, and GUMR_L[RDCR]=01, * then 'multiplier' should be 8. - * - * Also note that the value programmed into the BRGC register must be even. */ -void qe_setbrg(unsigned int brg, unsigned int rate, unsigned int multiplier) +int qe_setbrg(enum qe_clock brg, unsigned int rate, unsigned int multiplier) { u32 divisor, tempval; u32 div16 = 0; + if ((brg < QE_BRG1) || (brg > QE_BRG16)) + return -EINVAL; + divisor = get_brg_clk() / (rate * multiplier); if (divisor > QE_BRGC_DIVISOR_MAX + 1) { @@ -196,8 +197,11 @@ void qe_setbrg(unsigned int brg, unsigned int rate, unsigned int multiplier) tempval = ((divisor - 1) << QE_BRGC_DIVISOR_SHIFT) | QE_BRGC_ENABLE | div16; - out_be32(&qe_immr->brg.brgc[brg - 1], tempval); + out_be32(&qe_immr->brg.brgc[brg - QE_BRG1], tempval); + + return 0; } +EXPORT_SYMBOL(qe_setbrg); /* Initialize SNUMs (thread serial numbers) according to * QE Module Control chapter, SNUM table diff --git a/include/asm-powerpc/qe.h b/include/asm-powerpc/qe.h index 0dabe46..bcf60be 100644 --- a/include/asm-powerpc/qe.h +++ b/include/asm-powerpc/qe.h @@ -28,6 +28,52 @@ #define MEM_PART_SECONDARY 1 #define MEM_PART_MURAM 2 +/* Clocks and BRGs */ +enum qe_clock { + QE_CLK_NONE = 0, + QE_BRG1,/* Baud Rate Generator 1 */ + QE_BRG2,/* Baud Rate Generator 2 */ + QE_BRG3,/* Baud Rate Generator 3 */ + QE_BRG4,/* Baud Rate Generator 4 */ + QE_BRG5,/* Baud Rate Generator 5 */ + QE_BRG6,/* Baud Rate Generator 6 */ + QE_BRG7,/* Baud Rate Generator 7 */ + QE_BRG8,/* Baud Rate Generator 8 */ + QE_BRG9,/* Baud Rate Generator 9 */ + QE_BRG10, /* Baud Rate Generator 10 */ + QE_BRG11, /* Baud Rate Generator 11 */ + QE_BRG12, /* Baud Rate Generator 12 */ + QE_BRG13, /* Baud Rate Generator 13 */ + QE_BRG14, /* Baud Rate Generator 14 */ + QE_BRG15, /* Baud Rate Generator 15 */ + QE_BRG16, /* Baud Rate Generator 16 */ + QE_CLK1,/* Clock 1 */ + QE_CLK2,/* Clock 2 */ + QE_CLK3,/* Clock 3 */ + QE_CLK4,/* Clock 4 */ + QE_CLK5,/* Clock 5 */ + QE_CLK6,/* Clock 6 */ + QE_CLK7,/* Clock 7 */ + QE_CLK8,/* Clock 8 */ + QE_CLK9,/* Clock 9 */ + QE_CLK10, /* Clock 10 */ + QE_CLK11, /* Clock 11 */ + QE_CLK12, /* Clock 12 */ + QE_CLK13, /* Clock 13 */ + QE_CLK14, /* Clock 14 */ + QE_CLK15, /* Clock 15 */ + QE_CLK16, /* Clock 16 */ + QE_CLK17, /* Clock 17 */ + QE_CLK18, /* Clock 18 */ + QE_CLK19, /* Clock 19 */ + QE_CLK20, /* Clock 20 */ + QE_CLK21, /* Clock 21 */ + QE_CLK22, /* Clock 22 */ + QE_CLK23, /* Clock 23 */ + QE_CLK24, /* Clock 24 */ + QE_CLK_DUMMY +}; + /* Export QE common operations */ extern void qe_reset(void); extern int par_io_init(struct device_node *np); @@ -38,7 +84,7 @@ extern int par_io_data_set(u8 port, u8 pin, u8 val); /* QE internal API */ int qe_issue_cmd(u32 cmd, u32 device, u8 mcn_protocol, u32 cmd_input); -void qe_setbrg(unsigned int brg, unsigned int rate, unsigned int multiplier); +int qe_setbrg(enum
Re: qe: fix device tree lookup code in qe_muram_init()
On Nov 29, 2007, at 2:29 PM, Timur Tabi wrote: > Function qe_muram_init() was only looking for a node called "data- > only", > instead of making sure it is the correct node. This patch modifies > qe_muram_init() to find the QE node first, then the MURAM node > inside it, > and then the data-only node. It also reports errors. > > Signed-off-by: Timur Tabi <[EMAIL PROTECTED]> > --- > arch/powerpc/sysdev/qe_lib/qe.c | 39 ++ > + > 1 files changed, 31 insertions(+), 8 deletions(-) Add a compatible property in the muram data-only node called "fsl,qe- muram-data" and match on that compatible to find the node instead of walking the tree like you are. And report an error if there isn't a 'fsl,qe-muram-data' node - k ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
Re: qe: change qe_setbrg() to take an enum qe_clock instead of an integer
On Nov 29, 2007, at 3:56 PM, Timur Tabi wrote: > qe_setbrg() currently takes an integer to indicate the BRG number. > Change that > to take an enum qe_clock instead, since this enum is intended to > represent > clock sources. > > Signed-off-by: Timur Tabi <[EMAIL PROTECTED]> > --- > > This patch applies to Kumar's for-2.6.25 branch. You might need to > apply my > other patch, "qe: fix device tree lookup code in qe_muram_init()", > first. > > It's safe to change the parameters to qe_setbrg() because no one is > using that > function yet. > > arch/powerpc/sysdev/qe_lib/qe.c | 12 +++-- > include/asm-powerpc/qe.h| 94 ++ > +--- > 2 files changed, 54 insertions(+), 52 deletions(-) > > diff --git a/arch/powerpc/sysdev/qe_lib/qe.c b/arch/powerpc/sysdev/ > qe_lib/qe.c > index 298e073..8ef4690 100644 > --- a/arch/powerpc/sysdev/qe_lib/qe.c > +++ b/arch/powerpc/sysdev/qe_lib/qe.c > @@ -167,19 +167,20 @@ unsigned int get_brg_clk(void) > > /* Program the BRG to the given sampling rate and multiplier > * > - * @brg: the BRG, 1-16 > + * @brg: the BRG, QE_BRG1 - QE_BRG16 > * @rate: the desired sampling rate > * @multiplier: corresponds to the value programmed in GUMR_L[RDCR] or > * GUMR_L[TDCR]. E.g., if this BRG is the RX clock, and > GUMR_L[RDCR]=01, > * then 'multiplier' should be 8. > - * > - * Also note that the value programmed into the BRGC register must > be even. > */ > -void qe_setbrg(unsigned int brg, unsigned int rate, unsigned int > multiplier) > +void qe_setbrg(enum qe_clock brg, unsigned int rate, unsigned int > multiplier) > { > u32 divisor, tempval; > u32 div16 = 0; > > + if ((brg < QE_BRG1) || (brg > QE_BRG16)) > + return; seems like we should report some form of error like -EINVAL instead. > > + > divisor = get_brg_clk() / (rate * multiplier); > > if (divisor > QE_BRGC_DIVISOR_MAX + 1) { > @@ -196,8 +197,9 @@ void qe_setbrg(unsigned int brg, unsigned int > rate, unsigned int multiplier) > tempval = ((divisor - 1) << QE_BRGC_DIVISOR_SHIFT) | > QE_BRGC_ENABLE | div16; > > - out_be32(&qe_immr->brg.brgc[brg - 1], tempval); > + out_be32(&qe_immr->brg.brgc[brg - QE_BRG1], tempval); > } > +EXPORT_SYMBOL(qe_setbrg); > > /* Initialize SNUMs (thread serial numbers) according to > * QE Module Control chapter, SNUM table - k ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
qe: change qe_setbrg() to take an enum qe_clock instead of an integer
qe_setbrg() currently takes an integer to indicate the BRG number. Change that to take an enum qe_clock instead, since this enum is intended to represent clock sources. Signed-off-by: Timur Tabi <[EMAIL PROTECTED]> --- This patch applies to Kumar's for-2.6.25 branch. You might need to apply my other patch, "qe: fix device tree lookup code in qe_muram_init()", first. It's safe to change the parameters to qe_setbrg() because no one is using that function yet. arch/powerpc/sysdev/qe_lib/qe.c | 12 +++-- include/asm-powerpc/qe.h| 94 +++--- 2 files changed, 54 insertions(+), 52 deletions(-) diff --git a/arch/powerpc/sysdev/qe_lib/qe.c b/arch/powerpc/sysdev/qe_lib/qe.c index 298e073..8ef4690 100644 --- a/arch/powerpc/sysdev/qe_lib/qe.c +++ b/arch/powerpc/sysdev/qe_lib/qe.c @@ -167,19 +167,20 @@ unsigned int get_brg_clk(void) /* Program the BRG to the given sampling rate and multiplier * - * @brg: the BRG, 1-16 + * @brg: the BRG, QE_BRG1 - QE_BRG16 * @rate: the desired sampling rate * @multiplier: corresponds to the value programmed in GUMR_L[RDCR] or * GUMR_L[TDCR]. E.g., if this BRG is the RX clock, and GUMR_L[RDCR]=01, * then 'multiplier' should be 8. - * - * Also note that the value programmed into the BRGC register must be even. */ -void qe_setbrg(unsigned int brg, unsigned int rate, unsigned int multiplier) +void qe_setbrg(enum qe_clock brg, unsigned int rate, unsigned int multiplier) { u32 divisor, tempval; u32 div16 = 0; + if ((brg < QE_BRG1) || (brg > QE_BRG16)) + return; + divisor = get_brg_clk() / (rate * multiplier); if (divisor > QE_BRGC_DIVISOR_MAX + 1) { @@ -196,8 +197,9 @@ void qe_setbrg(unsigned int brg, unsigned int rate, unsigned int multiplier) tempval = ((divisor - 1) << QE_BRGC_DIVISOR_SHIFT) | QE_BRGC_ENABLE | div16; - out_be32(&qe_immr->brg.brgc[brg - 1], tempval); + out_be32(&qe_immr->brg.brgc[brg - QE_BRG1], tempval); } +EXPORT_SYMBOL(qe_setbrg); /* Initialize SNUMs (thread serial numbers) according to * QE Module Control chapter, SNUM table diff --git a/include/asm-powerpc/qe.h b/include/asm-powerpc/qe.h index 0dabe46..c779033 100644 --- a/include/asm-powerpc/qe.h +++ b/include/asm-powerpc/qe.h @@ -28,6 +28,52 @@ #define MEM_PART_SECONDARY 1 #define MEM_PART_MURAM 2 +/* Clocks and BRGs */ +enum qe_clock { + QE_CLK_NONE = 0, + QE_BRG1,/* Baud Rate Generator 1 */ + QE_BRG2,/* Baud Rate Generator 2 */ + QE_BRG3,/* Baud Rate Generator 3 */ + QE_BRG4,/* Baud Rate Generator 4 */ + QE_BRG5,/* Baud Rate Generator 5 */ + QE_BRG6,/* Baud Rate Generator 6 */ + QE_BRG7,/* Baud Rate Generator 7 */ + QE_BRG8,/* Baud Rate Generator 8 */ + QE_BRG9,/* Baud Rate Generator 9 */ + QE_BRG10, /* Baud Rate Generator 10 */ + QE_BRG11, /* Baud Rate Generator 11 */ + QE_BRG12, /* Baud Rate Generator 12 */ + QE_BRG13, /* Baud Rate Generator 13 */ + QE_BRG14, /* Baud Rate Generator 14 */ + QE_BRG15, /* Baud Rate Generator 15 */ + QE_BRG16, /* Baud Rate Generator 16 */ + QE_CLK1,/* Clock 1 */ + QE_CLK2,/* Clock 2 */ + QE_CLK3,/* Clock 3 */ + QE_CLK4,/* Clock 4 */ + QE_CLK5,/* Clock 5 */ + QE_CLK6,/* Clock 6 */ + QE_CLK7,/* Clock 7 */ + QE_CLK8,/* Clock 8 */ + QE_CLK9,/* Clock 9 */ + QE_CLK10, /* Clock 10 */ + QE_CLK11, /* Clock 11 */ + QE_CLK12, /* Clock 12 */ + QE_CLK13, /* Clock 13 */ + QE_CLK14, /* Clock 14 */ + QE_CLK15, /* Clock 15 */ + QE_CLK16, /* Clock 16 */ + QE_CLK17, /* Clock 17 */ + QE_CLK18, /* Clock 18 */ + QE_CLK19, /* Clock 19 */ + QE_CLK20, /* Clock 20 */ + QE_CLK21, /* Clock 21 */ + QE_CLK22, /* Clock 22 */ + QE_CLK23, /* Clock 23 */ + QE_CLK24, /* Clock 24 */ + QE_CLK_DUMMY +}; + /* Export QE common operations */ extern void qe_reset(void); extern int par_io_init(struct device_node *np); @@ -38,7 +84,7 @@ extern int par_io_data_set(u8 port, u8 pin, u8 val); /* QE internal API */ int qe_issue_cmd(u32 cmd, u32 device, u8 mcn_protocol, u32 cmd_input); -void qe_setbrg(unsigned int brg, unsigned int rate, unsigned int multiplier); +void qe_setbrg(enum qe_clock brg, unsigned int r
Re: [PATCH 1/5] PPC cleanup: sysdev - do use for_each macro
> From: Cyrill Gorcunov <[EMAIL PROTECTED]> > > Signed-off-by: Cyrill Gorcunov <[EMAIL PROTECTED]> > --- > > arch/powerpc/sysdev/fsl_soc.c |7 +++ > arch/powerpc/sysdev/mv64x60_dev.c | 24 ++-- > arch/powerpc/sysdev/mv64x60_pci.c |4 ++-- > arch/powerpc/sysdev/mv64x60_udbg.c |4 ++-- > arch/powerpc/sysdev/tsi108_dev.c |9 - > arch/powerpc/sysdev/uic.c | 17 + > 6 files changed, 26 insertions(+), 39 deletions(-) Ack of the mv64x60 bits. -Dale ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
Re: [BUG] 2.6.24-rc3-mm2 soft lockup while running tbench
On Wed, 28 Nov 2007 20:03:22 +0530 Kamalesh Babulal <[EMAIL PROTECTED]> wrote: > Hi Andrew, > > while running tbench on the powerpc with 2.6.24-rc3-mm2 softlock up occurs > > BUG: soft lockup - CPU#0 stuck for 11s! [tbench:12183] > NIP: c00ac978 LR: c00acff0 CTR: c005c648 > REGS: C0076F0F3200 TRAP: 0901 Not tainted (2.6.24-rc3-mm2-autotest) > MSR: 80009032 CR: 44000482 XER: > TASK = C0076F4BC000[12183] 'tbench' THREAD: C0076F0F CPU: 0 > NIP [c00ac978] .get_page_from_freelist+0x1cc/0x754 > LR [c00acff0] .__alloc_pages+0xb0/0x3a8 > Call Trace: > [c0076f0f3480] [c0076f0f3560] 0xc0076f0f3560 (unreliable) > [c0076f0f3590] [c00acff0] .__alloc_pages+0xb0/0x3a8 > [c0076f0f3680] [c00ce2e4] .alloc_pages_current+0xa8/0xc8 > [c0076f0f3710] [c00ac6ec] .__get_free_pages+0x20/0x70 > [c0076f0f3790] [c00d75c8] .__kmalloc_node_track_caller+0x60/0x148 > [c0076f0f3840] [c02c22b0] .__alloc_skb+0x98/0x184 > [c0076f0f38f0] [c0306cd8] .tcp_sendmsg+0x1fc/0xe24 > [c0076f0f3a10] [c02b963c] .sock_sendmsg+0xe4/0x128 > [c0076f0f3c10] [c02ba4ec] .sys_sendto+0xd4/0x120 > [c0076f0f3d90] [c02df2f8] .compat_sys_socketcall+0x148/0x214 > [c0076f0f3e30] [c000872c] syscall_exit+0x0/0x40 > Instruction dump: > 720b0001 eb97 40820070 7202 4182000c e8bc 4818 72080004 > 4182000c e8bc0008 4808 e8bc0010 7f83e378 7de407b4 7e078378 > hm. Beats me. Does the machine recover OK? ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
Re: [PATCH 5/5] PPC cleanup: powermac - do use for_each macro
On Thu, 2007-11-29 at 22:46 +0300, Cyrill Gorcunov wrote: > From: Cyrill Gorcunov <[EMAIL PROTECTED]> > > Signed-off-by: Cyrill Gorcunov <[EMAIL PROTECTED]> > --- Ack. > arch/powerpc/platforms/powermac/low_i2c.c |3 +-- > 1 files changed, 1 insertions(+), 2 deletions(-) > > diff --git a/arch/powerpc/platforms/powermac/low_i2c.c > b/arch/powerpc/platforms/powermac/low_i2c.c > index da2007e..864fbf4 100644 > --- a/arch/powerpc/platforms/powermac/low_i2c.c > +++ b/arch/powerpc/platforms/powermac/low_i2c.c > @@ -585,8 +585,7 @@ static void __init kw_i2c_probe(void) > struct device_node *np, *child, *parent; > > /* Probe keywest-i2c busses */ > - for (np = NULL; > - (np = of_find_compatible_node(np, "i2c","keywest-i2c")) != NULL;){ > + for_each_compatible_node(np, "i2c","keywest-i2c") { > struct pmac_i2c_host_kw *host; > int multibus, chans, i; > ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
qe: fix device tree lookup code in qe_muram_init()
Function qe_muram_init() was only looking for a node called "data-only", instead of making sure it is the correct node. This patch modifies qe_muram_init() to find the QE node first, then the MURAM node inside it, and then the data-only node. It also reports errors. Signed-off-by: Timur Tabi <[EMAIL PROTECTED]> --- arch/powerpc/sysdev/qe_lib/qe.c | 39 +++ 1 files changed, 31 insertions(+), 8 deletions(-) diff --git a/arch/powerpc/sysdev/qe_lib/qe.c b/arch/powerpc/sysdev/qe_lib/qe.c index 3d57d38..298e073 100644 --- a/arch/powerpc/sysdev/qe_lib/qe.c +++ b/arch/powerpc/sysdev/qe_lib/qe.c @@ -282,6 +282,12 @@ static DEFINE_SPINLOCK(qe_muram_lock); static rh_block_t qe_boot_muram_rh_block[16]; static rh_info_t qe_muram_info; +/* Initialize the MURAM remote heap + * + * This function queries the device tree to obtain the offset within MURAM + * to initialize the MURAM remote heap, and then it initializes the remote + * heap with that value. + */ static void qe_muram_init(void) { struct device_node *np; @@ -294,15 +300,32 @@ static void qe_muram_init(void) sizeof(qe_boot_muram_rh_block) / sizeof(qe_boot_muram_rh_block[0]), qe_boot_muram_rh_block); - /* Attach the usable muram area */ - /* XXX: This is a subset of the available muram. It -* varies with the processor and the microcode patches activated. -*/ - if ((np = of_find_node_by_name(NULL, "data-only")) != NULL) { - address = *of_get_address(np, 0, &size, &flags); - of_node_put(np); - rh_attach_region(&qe_muram_info, address, (int) size); + /* Find the data-only node in the QE's muram node */ + np = of_find_node_by_type(NULL, "qe"); + if (!np) { + printk(KERN_ERR + "qe-muram: cannot find 'qe' node in device tree\n"); + return; + } + + np = of_find_node_by_type(np, "muram"); + if (!np) { + printk(KERN_ERR + "qe-muram: cannot find 'muram' node in device tree\n"); + return; } + + np = of_find_node_by_name(np, "data-only"); + if (!np) { + printk(KERN_ERR "qe-muram: " + "cannot find 'data-only' node in device tree\n"); + return; + } + + /* Attach the usable muram area */ + address = *of_get_address(np, 0, &size, &flags); + of_node_put(np); + rh_attach_region(&qe_muram_info, address, (int) size); } /* This function returns an index into the MURAM area. -- 1.5.2.4 ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
powerpc: fix guts_set_dmacr() and add guts_set_pmuxcr_dma() to immap_86xx.h
Updated guts_set_dmacr() to enumerate the DMA controllers at 0, instead of 1, so that it now matches other related functions. Added function guts_set_pmuxcr_dma() to set the external DMA control bits in the PMUXCR register of the global utilities structure. Signed-off-by: Timur Tabi <[EMAIL PROTECTED]> --- Changing the behavior of guts_set_dmacr() is okay because no one uses that function yet. This patch is for Kumar's for-2.6.25 branch. include/asm-powerpc/immap_86xx.h | 25 +++-- 1 files changed, 23 insertions(+), 2 deletions(-) diff --git a/include/asm-powerpc/immap_86xx.h b/include/asm-powerpc/immap_86xx.h index 0ad4e65..0f165e5 100644 --- a/include/asm-powerpc/immap_86xx.h +++ b/include/asm-powerpc/immap_86xx.h @@ -89,14 +89,14 @@ struct ccsr_guts { * them. * * guts: Pointer to GUTS structure - * co: The DMA controller (1 or 2) + * co: The DMA controller (0 or 1) * ch: The channel on the DMA controller (0, 1, 2, or 3) * device: The device to set as the source (CCSR_GUTS_DMACR_DEV_xx) */ static inline void guts_set_dmacr(struct ccsr_guts __iomem *guts, unsigned int co, unsigned int ch, unsigned int device) { - unsigned int shift = 16 + (8 * (2 - co) + 2 * (3 - ch)); + unsigned int shift = 16 + (8 * (1 - co) + 2 * (3 - ch)); clrsetbits_be32(&guts->dmacr, 3 << shift, device << shift); } @@ -118,6 +118,27 @@ static inline void guts_set_dmacr(struct ccsr_guts __iomem *guts, #define CCSR_GUTS_PMUXCR_DMA1_00x0002 #define CCSR_GUTS_PMUXCR_DMA1_30x0001 +/* + * Set the DMA external control bits in the GUTS + * + * The DMA external control bits in the PMUXCR are only meaningful for + * channels 0 and 3. Any other channels are ignored. + * + * guts: Pointer to GUTS structure + * co: The DMA controller (0 or 1) + * ch: The channel on the DMA controller (0, 1, 2, or 3) + * value: the new value for the bit (0 or 1) + */ +static inline void guts_set_pmuxcr_dma(struct ccsr_guts __iomem *guts, + unsigned int co, unsigned int ch, unsigned int value) +{ + if ((ch == 0) || (ch == 3)) { + unsigned int shift = 2 * (co + 1) - (ch & 1) - 1; + + clrsetbits_be32(&guts->pmuxcr, 1 << shift, value << shift); + } +} + #define CCSR_GUTS_CLKDVDR_PXCKEN 0x8000 #define CCSR_GUTS_CLKDVDR_SSICKEN 0x2000 #define CCSR_GUTS_CLKDVDR_PXCKINV 0x1000 -- 1.5.2.4 ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
[PATCH 5/5] PPC cleanup: powermac - do use for_each macro
From: Cyrill Gorcunov <[EMAIL PROTECTED]> Signed-off-by: Cyrill Gorcunov <[EMAIL PROTECTED]> --- arch/powerpc/platforms/powermac/low_i2c.c |3 +-- 1 files changed, 1 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/platforms/powermac/low_i2c.c b/arch/powerpc/platforms/powermac/low_i2c.c index da2007e..864fbf4 100644 --- a/arch/powerpc/platforms/powermac/low_i2c.c +++ b/arch/powerpc/platforms/powermac/low_i2c.c @@ -585,8 +585,7 @@ static void __init kw_i2c_probe(void) struct device_node *np, *child, *parent; /* Probe keywest-i2c busses */ - for (np = NULL; -(np = of_find_compatible_node(np, "i2c","keywest-i2c")) != NULL;){ + for_each_compatible_node(np, "i2c","keywest-i2c") { struct pmac_i2c_host_kw *host; int multibus, chans, i; -- 1.5.3.5 ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
[PATCH 4/5] PPC cleanup: celleb - do use for_each macro
From: Cyrill Gorcunov <[EMAIL PROTECTED]> Signed-off-by: Cyrill Gorcunov <[EMAIL PROTECTED]> --- arch/powerpc/platforms/celleb/scc_sio.c |5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-) diff --git a/arch/powerpc/platforms/celleb/scc_sio.c b/arch/powerpc/platforms/celleb/scc_sio.c index 6100082..5e43bac 100644 --- a/arch/powerpc/platforms/celleb/scc_sio.c +++ b/arch/powerpc/platforms/celleb/scc_sio.c @@ -42,14 +42,13 @@ static struct { static int __init txx9_serial_init(void) { extern int early_serial_txx9_setup(struct uart_port *port); - struct device_node *node = NULL; + struct device_node *node; int i; struct uart_port req; struct of_irq irq; struct resource res; - while ((node = of_find_compatible_node(node, - "serial", "toshiba,sio-scc")) != NULL) { + for_each_compatible_node(node, "serial", "toshiba,sio-scc") { for (i = 0; i < ARRAY_SIZE(txx9_scc_tab); i++) { if (!(txx9_serial_bitmap & (1
[PATCH 3/5] PPC cleanup: 82xx - do use for_each macro
From: Cyrill Gorcunov <[EMAIL PROTECTED]> Signed-off-by: Cyrill Gorcunov <[EMAIL PROTECTED]> --- arch/powerpc/platforms/82xx/pq2.c |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/platforms/82xx/pq2.c b/arch/powerpc/platforms/82xx/pq2.c index a497cba..9e74393 100644 --- a/arch/powerpc/platforms/82xx/pq2.c +++ b/arch/powerpc/platforms/82xx/pq2.c @@ -72,11 +72,11 @@ err: void __init pq2_init_pci(void) { - struct device_node *np = NULL; + struct device_node *np; ppc_md.pci_exclude_device = pq2_pci_exclude_device; - while ((np = of_find_compatible_node(np, NULL, "fsl,pq2-pci"))) + for_each_compatible_node(np, NULL, "fsl,pq2-pci") pq2_pci_add_bridge(np); } #endif -- 1.5.3.5 ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
[PATCH 2/5] PPC cleanup: do use for_each macro
From: Cyrill Gorcunov <[EMAIL PROTECTED]> Signed-off-by: Cyrill Gorcunov <[EMAIL PROTECTED]> --- arch/powerpc/kernel/btext.c |2 +- arch/powerpc/kernel/legacy_serial.c |8 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/arch/powerpc/kernel/btext.c b/arch/powerpc/kernel/btext.c index 3ef51fb..04c9249 100644 --- a/arch/powerpc/kernel/btext.c +++ b/arch/powerpc/kernel/btext.c @@ -234,7 +234,7 @@ int __init btext_find_display(int allow_nonstdout) if (rc == 0 || !allow_nonstdout) return rc; - for (np = NULL; (np = of_find_node_by_type(np, "display"));) { + for_each_node_by_type(np, "display") { if (of_get_property(np, "linux,opened", NULL)) { printk("trying %s ...\n", np->full_name); rc = btext_initialize(np); diff --git a/arch/powerpc/kernel/legacy_serial.c b/arch/powerpc/kernel/legacy_serial.c index 4ed5887..b5dc646 100644 --- a/arch/powerpc/kernel/legacy_serial.c +++ b/arch/powerpc/kernel/legacy_serial.c @@ -307,7 +307,7 @@ void __init find_legacy_serial_ports(void) } /* First fill our array with SOC ports */ - for (np = NULL; (np = of_find_compatible_node(np, "serial", "ns16550")) != NULL;) { + for_each_compatible_node(np, "serial", "ns16550") { struct device_node *soc = of_get_parent(np); if (soc && !strcmp(soc->type, "soc")) { index = add_legacy_soc_port(np, np); @@ -318,7 +318,7 @@ void __init find_legacy_serial_ports(void) } /* First fill our array with ISA ports */ - for (np = NULL; (np = of_find_node_by_type(np, "serial"));) { + for_each_node_by_type(np, "serial") { struct device_node *isa = of_get_parent(np); if (isa && !strcmp(isa->name, "isa")) { index = add_legacy_isa_port(np, isa); @@ -329,7 +329,7 @@ void __init find_legacy_serial_ports(void) } /* First fill our array with tsi-bridge ports */ - for (np = NULL; (np = of_find_compatible_node(np, "serial", "ns16550")) != NULL;) { + for_each_compatible_node(np, "serial", "ns16550") { struct device_node *tsi = of_get_parent(np); if (tsi && !strcmp(tsi->type, "tsi-bridge")) { index = add_legacy_soc_port(np, np); @@ -340,7 +340,7 @@ void __init find_legacy_serial_ports(void) } /* First fill our array with opb bus ports */ - for (np = NULL; (np = of_find_compatible_node(np, "serial", "ns16550")) != NULL;) { + for_each_compatible_node(np, "serial", "ns16550") { struct device_node *opb = of_get_parent(np); if (opb && (!strcmp(opb->type, "opb") || of_device_is_compatible(opb, "ibm,opb"))) { -- 1.5.3.5 ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
[PATCH 1/5] PPC cleanup: sysdev - do use for_each macro
From: Cyrill Gorcunov <[EMAIL PROTECTED]> Signed-off-by: Cyrill Gorcunov <[EMAIL PROTECTED]> --- arch/powerpc/sysdev/fsl_soc.c |7 +++ arch/powerpc/sysdev/mv64x60_dev.c | 24 ++-- arch/powerpc/sysdev/mv64x60_pci.c |4 ++-- arch/powerpc/sysdev/mv64x60_udbg.c |4 ++-- arch/powerpc/sysdev/tsi108_dev.c |9 - arch/powerpc/sysdev/uic.c | 17 + 6 files changed, 26 insertions(+), 39 deletions(-) diff --git a/arch/powerpc/sysdev/fsl_soc.c b/arch/powerpc/sysdev/fsl_soc.c index 3ace747..927c238 100644 --- a/arch/powerpc/sysdev/fsl_soc.c +++ b/arch/powerpc/sysdev/fsl_soc.c @@ -1125,13 +1125,12 @@ arch_initcall(fs_enet_of_init); static int __init fsl_pcmcia_of_init(void) { - struct device_node *np = NULL; + struct device_node *np; /* * Register all the devices which type is "pcmcia" */ - while ((np = of_find_compatible_node(np, - "pcmcia", "fsl,pq-pcmcia")) != NULL) - of_platform_device_create(np, "m8xx-pcmcia", NULL); + for_each_compatible_node(np, "pcmcia", "fsl,pq-pcmcia") + of_platform_device_create(np, "m8xx-pcmcia", NULL); return 0; } diff --git a/arch/powerpc/sysdev/mv64x60_dev.c b/arch/powerpc/sysdev/mv64x60_dev.c index 548a320..304056c 100644 --- a/arch/powerpc/sysdev/mv64x60_dev.c +++ b/arch/powerpc/sysdev/mv64x60_dev.c @@ -241,7 +241,7 @@ static int __init mv64x60_eth_device_setup(struct device_node *np, int id) /* only register the shared platform device the first time through */ if (id == 0 && (err = eth_register_shared_pdev(np))) - return err;; + return err; memset(r, 0, sizeof(r)); of_irq_to_resource(np, 0, &r[0]); @@ -451,22 +451,19 @@ static int __init mv64x60_device_setup(void) int id; int err; - for (id = 0; -(np = of_find_compatible_node(np, "serial", "marvell,mpsc")); id++) - if ((err = mv64x60_mpsc_device_setup(np, id))) + id = 0; + for_each_compatible_node(np, "serial", "marvell,mpsc") + if ((err = mv64x60_mpsc_device_setup(np, id++))) goto error; - for (id = 0; -(np = of_find_compatible_node(np, "network", - "marvell,mv64x60-eth")); -id++) - if ((err = mv64x60_eth_device_setup(np, id))) + id = 0; + for_each_compatible_node(np, "network", "marvell,mv64x60-eth") + if ((err = mv64x60_eth_device_setup(np, id++))) goto error; - for (id = 0; -(np = of_find_compatible_node(np, "i2c", "marvell,mv64x60-i2c")); -id++) - if ((err = mv64x60_i2c_device_setup(np, id))) + id = 0; + for_each_compatible_node(np, "i2c", "marvell,mv64x60-i2c") + if ((err = mv64x60_i2c_device_setup(np, id++))) goto error; /* support up to one watchdog timer */ @@ -477,7 +474,6 @@ static int __init mv64x60_device_setup(void) of_node_put(np); } - return 0; error: diff --git a/arch/powerpc/sysdev/mv64x60_pci.c b/arch/powerpc/sysdev/mv64x60_pci.c index 6933f9c..d21ab8f 100644 --- a/arch/powerpc/sysdev/mv64x60_pci.c +++ b/arch/powerpc/sysdev/mv64x60_pci.c @@ -164,8 +164,8 @@ static int __init mv64x60_add_bridge(struct device_node *dev) void __init mv64x60_pci_init(void) { - struct device_node *np = NULL; + struct device_node *np; - while ((np = of_find_compatible_node(np, "pci", "marvell,mv64x60-pci"))) + for_each_compatible_node(np, "pci", "marvell,mv64x60-pci") mv64x60_add_bridge(np); } diff --git a/arch/powerpc/sysdev/mv64x60_udbg.c b/arch/powerpc/sysdev/mv64x60_udbg.c index 367e7b1..35c77c7 100644 --- a/arch/powerpc/sysdev/mv64x60_udbg.c +++ b/arch/powerpc/sysdev/mv64x60_udbg.c @@ -85,10 +85,10 @@ static void mv64x60_udbg_init(void) if (!stdout) return; - for (np = NULL; -(np = of_find_compatible_node(np, "serial", "marvell,mpsc")); ) + for_each_compatible_node(np, "serial", "marvell,mpsc") { if (np == stdout) break; + } of_node_put(stdout); if (!np) diff --git a/arch/powerpc/sysdev/tsi108_dev.c b/arch/powerpc/sysdev/tsi108_dev.c index a113d80..be2808a 100644 --- a/arch/powerpc/sysdev/tsi108_dev.c +++ b/arch/powerpc/sysdev/tsi108_dev.c @@ -66,14 +66,12 @@ EXPORT_SYMBOL(get_vir_csrbase); static int __init tsi108_eth_of_init(void) { struct device_node *np; - unsigned int i; + unsigned int i = 0; struct platform_device *tsi_eth_dev; struct resource res; int ret; - for (np = NULL, i = 0; -(np = of_find_compatible_node(np, "network", "tsi108-ethernet")) != NULL
[PATCH 0/5] PPC cleanup: do use for_each macro
This is a cleanup patch set. It does convert for(...)/while(...) cycles into appropriate for_each_...() macros calls. The patch set is splitted up in idea to hold changes localy to a specified platform. Any comments are welcome. Cyrill ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
Re: Timers on mpc8248 etc...
Though I'd like to move to a uboot fdt, I can't afford to port it yet, maybe in January. But until then ... It appears that a simple change in U-boot constant, #define CONFIG_8260_CLKIN6600/* in Hz */ to #define CONFIG_8260_CLKIN1 /* in Hz */ has fixed the speed mismatch, and I've verified that schedule_timeout(HZ/10) produces a 100 millisecond delay. However, my serial ports (brgs) are hosed. -Alan On 11/29/07, Alan Bennett <[EMAIL PROTECTED]> wrote: > My uboot is new-ish, but I don't have the fdt commands? U-Boot 1.3.0 > g992742a5-dirty > > u-boot:clock configuration > === > MPC8248 Clock Configuration > - Bus-to-Core Mult 3.5x, VCO Div 2, 60x Bus Freq 30-85 , Core Freq 100-300 > - dfbrg 1, corecnf 0x1e, busdf 3, cpmdf 1, plldf 0, pllmf 5, pcidf 5 > - vco_out 39600, scc_clk 9900, brg_clk 2475 > - cpu_clk 23100, cpm_clk 19800, bus_clk 6600 > > Boot Wrapper Reporting > === > Memory <- <0x0 0x800> (128MB) > CPU clock-frequency <- 0xdc4c7c0 (231MHz) > CPU timebase-frequency <- 0xfbc520 (17MHz) > CPU bus-frequency <- 0x3ef1480 (66MHz) > > Kernel reporting > === > clocksource: timebase mult[f26c9b2] shift[22] registered > > device tree in kernel (hex= `od -x`: > === > /proc/device-tree/cpus/PowerPC,[EMAIL PROTECTED]/name > PowerPC,8248 > /proc/device-tree/cpus/PowerPC,[EMAIL PROTECTED]/bus-frequency > 000 03ef 1480 > /proc/device-tree/cpus/PowerPC,[EMAIL PROTECTED]/clock-frequency > 000 0dc4 c7c0 > /proc/device-tree/cpus/PowerPC,[EMAIL PROTECTED]/timebase-frequency > 000 00fb c520 > /proc/device-tree/cpus/PowerPC,[EMAIL PROTECTED]/i-cache-size > 000 4000 > > > > On 11/29/07, Vitaly Bordug <[EMAIL PROTECTED]> wrote: > > On Wed, 28 Nov 2007 21:06:36 -0700 > > Alan Bennett wrote: > > > > > It comes from uboot. Can you point me in the right direction to make > > > sure its right? > > >PowerPC,[EMAIL PROTECTED] { > > >device_type = "cpu"; > > >reg = <0>; > > >d-cache-line-size = ; > > >i-cache-line-size = ; > > >d-cache-size = ; > > >i-cache-size = ; > > >timebase-frequency = <0>; > > >clock-frequency = <0>; > > >}; > > > > > if your u-boot is up to date, it will have fdt command, and by > > fdt boardsetup > > fdt print / > > > > inspect what u-boot did. Of course you should have dtb preloaded to memory > > and > > fdt addr should be said to let u-boot know where dtb resides. > > > > > > > > > > On 11/28/07, Scott Wood <[EMAIL PROTECTED]> wrote: > > > > Alan Bennett wrote: > > > > > I've got a routine that needs to delay for X microseconds, this > > > > > is a must. The command after schedule_timeout must has to wait > > > > > for the HW to complete a task that takes X microseconds. > > > > > > > > > > I would think that one way to do this is with a simple > > > > > schedule_timeout. But in the example below, the time that passes > > > > > from run1() to dontrun() is far less than 3.2 msecs. Infact, > > > > > sometimes its ~ 800 micros according the a analyzer looking at > > > > > points triggered in run1() and donrun(). Could this be a > > > > > configuration problem with the timer/interrupt that generates the > > > > > jiffies? > > > > > > > > Are you sure the timebase frequency is set correctly in the device > > > > tree? > > > > > > > > -Scott > > > > > > > ___ > > > Linuxppc-dev mailing list > > > Linuxppc-dev@ozlabs.org > > > https://ozlabs.org/mailman/listinfo/linuxppc-dev > > > > > > -- > > Sincerely, Vitaly > > > ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
Re: [PATCH] powerpc: fix os-term usage on kernel panic
On Wed, 2007-11-28 at 14:18 -0600, Linas Vepstas wrote: > On Tue, Nov 27, 2007 at 06:15:59PM -0600, Will Schmidt wrote: > > (resending with the proper "from" addr this time). > > > > > > I'm seeing some funky behavior on power5/power6 partitions with this > > patch.A "/sbin/reboot" is now behaving much more like a > > "/sbin/halt". > > > > Anybody else seeing this, or is it time for me to call an exorcist for > > my boxes? > > I beleive the patch > http://www.nabble.com/-PATCH--powerpc-pseries:-tell-phyp-to-auto-restart-t4847604.html > > will cure this problem. It does not. this code is getting called, but still turns the box into a doorstop at /sbin/reboot. It does clear up if I apply this patch, which is a revert of part of your earlier patch. My js2X also turns into a doorstop after /sbin/reboot.. Though I'm not going through a panic path, I wonder if the panic portion is OK and this is what Olaf is hitting. diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c index fdeefe5..c9fac5a 100644 --- a/arch/powerpc/platforms/pseries/setup.c +++ b/arch/powerpc/platforms/pseries/setup.c @@ -508,7 +508,7 @@ define_machine(pseries) { .power_off = pSeries_power_off, .halt = rtas_halt, .panic = rtas_panic_msg, - .machine_shutdown = rtas_os_term, +/* .machine_shutdown = rtas_os_term,*/ .get_boot_time = rtas_get_boot_time, .get_rtc_time = rtas_get_rtc_time, .set_rtc_time = rtas_set_rtc_time, ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
Re: [BUG] 2.6.24-rc3-mm2 kernel bug on nfs & cifs mounted partitions
On Thu 29-11-07 17:27:08, Kamalesh Babulal wrote: > Andrew Morton wrote: > > On Thu, 29 Nov 2007 14:30:14 +0530 Kamalesh Babulal <[EMAIL PROTECTED]> > > wrote: > > > >> Hi Andrew, > >> > >> While running file system stress on nfs and cifs mounted partitions, the > >> machine > >> drops to xmon > >> > >> 1:mon> e > >> cpu 0x1: Vector: 300 (Data Access) at [c00080a9f880] > >> pc: c01392c8: .inotify_inode_queue_event+0x50/0x158 > >> lr: c01074d0: .vfs_link+0x204/0x298 > >> sp: c00080a9fb00 > >>msr: 80009032 > >>dar: 280 > >> dsisr: 4001 > >> current = 0xc000c8e6f670 > >> paca= 0xc0512c00 > >> pid = 2848, comm = fsstress > >> 1:mon> t > >> [c00080a9fbd0] c01074d0 .vfs_link+0x204/0x298 > >> [c00080a9fc70] c010b6e0 .sys_linkat+0x134/0x1b4 > >> [c00080a9fe30] c000872c syscall_exit+0x0/0x40 > >> --- Exception: c00 (System Call) at 0ff1bdfc > >> SP (ffeaed10) is in userspace > >> 1:mon> r > >> R00 = c01074d0 R16 = > >> R01 = c00080a9fb00 R17 = > >> R02 = c060c380 R18 = > >> R03 = R19 = > >> R04 = 0004 R20 = > >> R05 = R21 = > >> R06 = R22 = > >> R07 = R23 = 0004 > >> R08 = R24 = 0280 > >> R09 = R25 = f000 > >> R10 = 0001 R26 = c00082827790 > >> R11 = c03963e8 R27 = c000828275a0 > >> R12 = d0deec78 R28 = > >> R13 = c0512c00 R29 = c0007b18fcf0 > >> R14 = R30 = c05bc088 > >> R15 = R31 = > >> pc = c01392c8 .inotify_inode_queue_event+0x50/0x158 > >> lr = c01074d0 .vfs_link+0x204/0x298 > >> msr = 80009032 cr = 24000882 > >> ctr = c03963e8 xer = trap = 300 > >> dar = 0280 dsisr = 4001 > >> > >> > >> The gdb output shows > >> > >> 0xc01076d4 is in vfs_symlink (include/linux/fsnotify.h:108). > >> 103 * fsnotify_create - 'name' was linked in > >> 104 */ > >> 105 static inline void fsnotify_create(struct inode *inode, struct > >> dentry *dentry) > >> 106 { > >> 107 inode_dir_notify(inode, DN_CREATE); > >> 108 inotify_inode_queue_event(inode, IN_CREATE, 0, > >> dentry->d_name.name, > >> 109 dentry->d_inode); > >> 110 audit_inode_child(dentry->d_name.name, dentry, inode); > >> 111 } > >> 112 > >> > > > > If it is reproducible can you please try reverting > > inotify-send-in_attrib-events-when-link-count-changes.patch? > > Hi Andrew, > > reverting the patch > inotify-send-in_attrib-events-when-link-count-changes.patch, the > bug is not reproduced. OK, it's a problem with CIFS. Its cifs_hardlink() function doesn't call d_instantiate() and thus returns a dentry with d_inode set to NULL. I'm not sure if such behavior is really correct but anyway, attached is a new version of the patch which should handle it gracefully. Kamalesh, can you please give it a try? Thanks. Honza -- Jan Kara <[EMAIL PROTECTED]> SUSE Labs, CR --- Currently, no notification event has been sent when inode's link count changed. This is inconvenient for the application in some cases: Suppose you have the following directory structure foo/test bar/ and you watch test. If someone does "mv foo/test bar/", you get event IN_MOVE_SELF and you know something has happened with the file "test". However if someone does "ln foo/test bar/test" and "rm foo/test" you get no inotify event for the file "test" (only directories "foo" and "bar" receive events). Furthermore it could be argued that link count belongs to file's metadata and thus IN_ATTRIB should be sent when it changes. The following patch implements sending of IN_ATTRIB inotify events when link count of the inode changes, i.e., when a hardlink to the inode is created or when it is removed. This event is sent in addition to all the events sent so far. In particular, when a last link to a file is removed, IN_ATTRIB event is sent in addition to IN_DELETE_SELF event. Signed-off-by: Jan Kara <[EMAIL PROTECTED]> diff --git a/fs/namei.c b/fs/namei.c index 3b993db..c1839d1 100644 --- a/fs/namei.c +++ b/fs/namei.c @@ -2188,6 +2188,7 @@ int vfs_unlink(struct inode *dir, struct dentry *dentry) /* We don't d_delete() NFS sillyrenamed files--they still exist. */ if (!error && !(dentry->d_flags & DCACHE_NFSFS_RENAMED)) { + fsnotify_link_count(dentry->d_inode); d_delete(dentry); } @@ -2360,7 +2361,7 @@ int vfs_link(s
Re: [BUG] 2.6.24-rc3-mm2 kernel bug on nfs & cifs mounted partitions
On Thu 29-11-07 17:27:08, Kamalesh Babulal wrote: > Andrew Morton wrote: > > On Thu, 29 Nov 2007 14:30:14 +0530 Kamalesh Babulal <[EMAIL PROTECTED]> > > wrote: > > > >> Hi Andrew, > >> > >> While running file system stress on nfs and cifs mounted partitions, the > >> machine > >> drops to xmon > >> > >> 1:mon> e > >> cpu 0x1: Vector: 300 (Data Access) at [c00080a9f880] > >> pc: c01392c8: .inotify_inode_queue_event+0x50/0x158 > >> lr: c01074d0: .vfs_link+0x204/0x298 > >> sp: c00080a9fb00 > >>msr: 80009032 > >>dar: 280 > >> dsisr: 4001 > >> current = 0xc000c8e6f670 > >> paca= 0xc0512c00 > >> pid = 2848, comm = fsstress > >> 1:mon> t > >> [c00080a9fbd0] c01074d0 .vfs_link+0x204/0x298 > >> [c00080a9fc70] c010b6e0 .sys_linkat+0x134/0x1b4 > >> [c00080a9fe30] c000872c syscall_exit+0x0/0x40 > >> --- Exception: c00 (System Call) at 0ff1bdfc > >> SP (ffeaed10) is in userspace > >> 1:mon> r > >> R00 = c01074d0 R16 = > >> R01 = c00080a9fb00 R17 = > >> R02 = c060c380 R18 = > >> R03 = R19 = > >> R04 = 0004 R20 = > >> R05 = R21 = > >> R06 = R22 = > >> R07 = R23 = 0004 > >> R08 = R24 = 0280 > >> R09 = R25 = f000 > >> R10 = 0001 R26 = c00082827790 > >> R11 = c03963e8 R27 = c000828275a0 > >> R12 = d0deec78 R28 = > >> R13 = c0512c00 R29 = c0007b18fcf0 > >> R14 = R30 = c05bc088 > >> R15 = R31 = > >> pc = c01392c8 .inotify_inode_queue_event+0x50/0x158 > >> lr = c01074d0 .vfs_link+0x204/0x298 > >> msr = 80009032 cr = 24000882 > >> ctr = c03963e8 xer = trap = 300 > >> dar = 0280 dsisr = 4001 > >> > >> > >> The gdb output shows > >> > >> 0xc01076d4 is in vfs_symlink (include/linux/fsnotify.h:108). > >> 103 * fsnotify_create - 'name' was linked in > >> 104 */ > >> 105 static inline void fsnotify_create(struct inode *inode, struct > >> dentry *dentry) > >> 106 { > >> 107 inode_dir_notify(inode, DN_CREATE); > >> 108 inotify_inode_queue_event(inode, IN_CREATE, 0, > >> dentry->d_name.name, > >> 109 dentry->d_inode); > >> 110 audit_inode_child(dentry->d_name.name, dentry, inode); > >> 111 } > >> 112 > >> > > > > If it is reproducible can you please try reverting > > inotify-send-in_attrib-events-when-link-count-changes.patch? > > Hi Andrew, > > reverting the patch > inotify-send-in_attrib-events-when-link-count-changes.patch, the > bug is not reproduced. OK, thanks for testing. I was trying to reproduce the problem locally but without success so far - I guess it's either NFS or CIFS which makes the problem appear. I'll investigate more. Honza -- Jan Kara <[EMAIL PROTECTED]> SUSE Labs, CR ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
[PATCH 5/5] PowerPC 74xx: Katana Qp default config
Default kernel config for Emerson Katana Qp board Signed-off-by: Andrei Dolnikov <[EMAIL PROTECTED]> --- katanaqp_defconfig | 941 + 1 files changed, 941 insertions(+) diff --git a/arch/powerpc/configs/katanaqp_defconfig b/arch/powerpc/configs/katanaqp_defconfig new file mode 100644 index 000..7ea32ca --- /dev/null +++ b/arch/powerpc/configs/katanaqp_defconfig @@ -0,0 +1,941 @@ +# +# Automatically generated make config: don't edit +# Linux kernel version: 2.6.24-rc2 +# Tue Nov 13 16:02:34 2007 +# +# CONFIG_PPC64 is not set + +# +# Processor support +# +CONFIG_6xx=y +# CONFIG_PPC_85xx is not set +# CONFIG_PPC_8xx is not set +# CONFIG_40x is not set +# CONFIG_44x is not set +# CONFIG_E200 is not set +CONFIG_PPC_FPU=y +CONFIG_ALTIVEC=y +CONFIG_PPC_STD_MMU=y +CONFIG_PPC_STD_MMU_32=y +# CONFIG_PPC_MM_SLICES is not set +# CONFIG_SMP is not set +CONFIG_NOT_COHERENT_CACHE=y +CONFIG_CHECK_CACHE_COHERENCY=y +CONFIG_PPC32=y +CONFIG_WORD_SIZE=32 +CONFIG_PPC_MERGE=y +CONFIG_MMU=y +CONFIG_GENERIC_CMOS_UPDATE=y +CONFIG_GENERIC_TIME=y +CONFIG_GENERIC_TIME_VSYSCALL=y +CONFIG_GENERIC_CLOCKEVENTS=y +CONFIG_GENERIC_HARDIRQS=y +CONFIG_IRQ_PER_CPU=y +CONFIG_RWSEM_XCHGADD_ALGORITHM=y +CONFIG_ARCH_HAS_ILOG2_U32=y +CONFIG_GENERIC_HWEIGHT=y +CONFIG_GENERIC_CALIBRATE_DELAY=y +CONFIG_GENERIC_FIND_NEXT_BIT=y +# CONFIG_ARCH_NO_VIRT_TO_BUS is not set +CONFIG_PPC=y +CONFIG_EARLY_PRINTK=y +CONFIG_GENERIC_NVRAM=y +CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y +CONFIG_ARCH_MAY_HAVE_PC_FDC=y +CONFIG_PPC_OF=y +CONFIG_OF=y +# CONFIG_PPC_UDBG_16550 is not set +# CONFIG_GENERIC_TBSYNC is not set +CONFIG_AUDIT_ARCH=y +CONFIG_GENERIC_BUG=y +# CONFIG_DEFAULT_UIMAGE is not set +# CONFIG_PPC_DCR_NATIVE is not set +# CONFIG_PPC_DCR_MMIO is not set +CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" + +# +# General setup +# +CONFIG_EXPERIMENTAL=y +CONFIG_BROKEN_ON_SMP=y +CONFIG_INIT_ENV_ARG_LIMIT=32 +CONFIG_LOCALVERSION="" +CONFIG_LOCALVERSION_AUTO=y +CONFIG_SWAP=y +CONFIG_SYSVIPC=y +CONFIG_SYSVIPC_SYSCTL=y +CONFIG_POSIX_MQUEUE=y +# CONFIG_BSD_PROCESS_ACCT is not set +# CONFIG_TASKSTATS is not set +# CONFIG_USER_NS is not set +# CONFIG_AUDIT is not set +# CONFIG_IKCONFIG is not set +CONFIG_LOG_BUF_SHIFT=14 +# CONFIG_CGROUPS is not set +CONFIG_FAIR_GROUP_SCHED=y +CONFIG_FAIR_USER_SCHED=y +# CONFIG_FAIR_CGROUP_SCHED is not set +# CONFIG_SYSFS_DEPRECATED is not set +# CONFIG_RELAY is not set +CONFIG_BLK_DEV_INITRD=y +CONFIG_INITRAMFS_SOURCE="" +# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set +CONFIG_SYSCTL=y +# CONFIG_EMBEDDED is not set +CONFIG_SYSCTL_SYSCALL=y +CONFIG_KALLSYMS=y +# CONFIG_KALLSYMS_EXTRA_PASS is not set +CONFIG_HOTPLUG=y +CONFIG_PRINTK=y +CONFIG_BUG=y +CONFIG_ELF_CORE=y +CONFIG_BASE_FULL=y +CONFIG_FUTEX=y +CONFIG_ANON_INODES=y +CONFIG_EPOLL=y +CONFIG_SIGNALFD=y +CONFIG_EVENTFD=y +CONFIG_SHMEM=y +CONFIG_VM_EVENT_COUNTERS=y +CONFIG_SLUB_DEBUG=y +# CONFIG_SLAB is not set +CONFIG_SLUB=y +# CONFIG_SLOB is not set +CONFIG_RT_MUTEXES=y +# CONFIG_TINY_SHMEM is not set +CONFIG_BASE_SMALL=0 +# CONFIG_MODULES is not set +CONFIG_BLOCK=y +CONFIG_LBD=y +# CONFIG_BLK_DEV_IO_TRACE is not set +# CONFIG_LSF is not set +# CONFIG_BLK_DEV_BSG is not set + +# +# IO Schedulers +# +CONFIG_IOSCHED_NOOP=y +CONFIG_IOSCHED_AS=y +# CONFIG_IOSCHED_DEADLINE is not set +# CONFIG_IOSCHED_CFQ is not set +CONFIG_DEFAULT_AS=y +# CONFIG_DEFAULT_DEADLINE is not set +# CONFIG_DEFAULT_CFQ is not set +# CONFIG_DEFAULT_NOOP is not set +CONFIG_DEFAULT_IOSCHED="anticipatory" + +# +# Platform support +# +CONFIG_PPC_MULTIPLATFORM=y +# CONFIG_PPC_82xx is not set +# CONFIG_PPC_83xx is not set +# CONFIG_PPC_86xx is not set +CONFIG_CLASSIC32=y +# CONFIG_PPC_CHRP is not set +# CONFIG_PPC_MPC52xx is not set +# CONFIG_PPC_MPC5200 is not set +# CONFIG_PPC_EFIKA is not set +# CONFIG_PPC_LITE5200 is not set +# CONFIG_PPC_PMAC is not set +# CONFIG_PPC_CELL is not set +# CONFIG_PPC_CELL_NATIVE is not set +# CONFIG_PQ2ADS is not set +CONFIG_EMBEDDED6xx=y +# CONFIG_LINKSTATION is not set +# CONFIG_MPC7448HPC2 is not set +# CONFIG_PPC_HOLLY is not set +# CONFIG_PPC_PRPMC2800 is not set +CONFIG_PPC_KATANAQP=y +CONFIG_MV64X60=y +# CONFIG_MPIC is not set +# CONFIG_MPIC_WEIRD is not set +# CONFIG_PPC_I8259 is not set +# CONFIG_PPC_RTAS is not set +# CONFIG_MMIO_NVRAM is not set +# CONFIG_PPC_MPC106 is not set +# CONFIG_PPC_970_NAP is not set +# CONFIG_PPC_INDIRECT_IO is not set +# CONFIG_GENERIC_IOMAP is not set +# CONFIG_CPU_FREQ is not set +# CONFIG_TAU is not set +# CONFIG_CPM2 is not set +# CONFIG_FSL_ULI1575 is not set + +# +# Kernel options +# +CONFIG_HIGHMEM=y +# CONFIG_TICK_ONESHOT is not set +# CONFIG_NO_HZ is not set +# CONFIG_HIGH_RES_TIMERS is not set +CONFIG_GENERIC_CLOCKEVENTS_BUILD=y +# CONFIG_HZ_100 is not set +CONFIG_HZ_250=y +# CONFIG_HZ_300 is not set +# CONFIG_HZ_1000 is not set +CONFIG_HZ=250 +CONFIG_PREEMPT_NONE=y +# CONFIG_PREEMPT_VOLUNTARY is not set +# CONFIG_PREEMPT is not set +CONFIG_BINFMT_ELF=y +CONFIG_BINFMT_MISC=y
[PATCH 4/5] PowerPC 74xx: Katana Qp base support
Emerson Katana Qp platform specific code Signed-off-by: Andrei Dolnikov <[EMAIL PROTECTED]> --- Kconfig|9 +++ Makefile |1 katanaqp.c | 168 + 3 files changed, 178 insertions(+) diff --git a/arch/powerpc/platforms/embedded6xx/Kconfig b/arch/powerpc/platforms/embedded6xx/Kconfig index 8924095..33190bd 100644 --- a/arch/powerpc/platforms/embedded6xx/Kconfig +++ b/arch/powerpc/platforms/embedded6xx/Kconfig @@ -46,6 +46,15 @@ config PPC_PRPMC2800 help This option enables support for the Motorola PrPMC2800 board +config PPC_KATANAQP + bool "Emerson-Katana Qp" + depends on EMBEDDED6xx + select MV64X60 + select NOT_COHERENT_CACHE + select WANT_DEVICE_TREE + help + This option enables support for the Emerson Katana Qp board + config TSI108_BRIDGE bool depends on MPC7448HPC2 || PPC_HOLLY diff --git a/arch/powerpc/platforms/embedded6xx/Makefile b/arch/powerpc/platforms/embedded6xx/Makefile index 844947c..c83558f 100644 --- a/arch/powerpc/platforms/embedded6xx/Makefile +++ b/arch/powerpc/platforms/embedded6xx/Makefile @@ -5,3 +5,4 @@ obj-$(CONFIG_MPC7448HPC2) += mpc7448_hpc2.o obj-$(CONFIG_LINKSTATION) += linkstation.o ls_uart.o obj-$(CONFIG_PPC_HOLLY)+= holly.o obj-$(CONFIG_PPC_PRPMC2800)+= prpmc2800.o +obj-$(CONFIG_PPC_KATANAQP) += katanaqp.o diff --git a/arch/powerpc/platforms/embedded6xx/katanaqp.c b/arch/powerpc/platforms/embedded6xx/katanaqp.c new file mode 100644 index 000..64fb608 --- /dev/null +++ b/arch/powerpc/platforms/embedded6xx/katanaqp.c @@ -0,0 +1,168 @@ +/* + * Board setup routines for the Emerson Katana Qp + * + * Authors: Vladislav Buzov <[EMAIL PROTECTED]> + * Andrei Dolnikov <[EMAIL PROTECTED]> + * + * Based on prpmc2800.c by Dale Farnsworth <[EMAIL PROTECTED]> + * + * 2007 (c) MontaVista, Software, Inc. This file is licensed under + * the terms of the GNU General Public License version 2. This program + * is licensed "as is" without any warranty of any kind, whether express + * or implied. + */ + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include + +#include + +#define PLATFORM_NAME_MAX 64 + +/* CPLD registers definitions */ +#define KATANAQP_CPLD_RCR 0x0004 /* Reset command */ +#define KATANAQP_CPLD_RCR_CPUHR(1 << 7) + +#define KATANAQP_CPLD_HVR 0x0020 + +#define KATANAQP_CPLD_PSR 0x0030 /* PCI status */ +#define KATANAQP_CPLD_PSR_PMCM (1 << 1) + +#define KATANAQP_CPLD_HCR 0x0044 + +static char katanaqp_platform_name[PLATFORM_NAME_MAX]; + +static void __iomem *cpld_base; + +static int katanaqp_exclude_device(struct pci_controller *hose, u_char bus, + u_char devfn) +{ + if (bus == 0 && PCI_SLOT(devfn) == 0) + return PCIBIOS_DEVICE_NOT_FOUND; + else + return PCIBIOS_SUCCESSFUL; +} + +static int __init katanaqp_is_monarch(void) +{ + return !(in_8(cpld_base + KATANAQP_CPLD_PSR) & +KATANAQP_CPLD_PSR_PMCM); +} + +static void __init katanaqp_setup_arch(void) +{ + struct device_node *cpld; + + /* +* ioremap cpld registers in case they are later +* needed by katanaqp_reset_board(). +*/ + cpld = of_find_compatible_node(NULL, NULL, "altera,maxii"); + cpld_base = of_iomap(cpld, 0); + +#ifdef CONFIG_PCI + if (katanaqp_is_monarch()) { + mv64x60_pci_init(); + ppc_md.pci_exclude_device = katanaqp_exclude_device; + } +#endif + + printk("Emerson Network Power %s\n", katanaqp_platform_name); +} + +static void katanaqp_reset_board(void) +{ + local_irq_disable(); + + /* issue hard reset to the reset command register */ + out_8(cpld_base + KATANAQP_CPLD_RCR, KATANAQP_CPLD_RCR_CPUHR); + for (;;) ; +} + +static void katanaqp_restart(char *cmd) +{ + katanaqp_reset_board(); +} + +static void katanaqp_show_cpuinfo(struct seq_file *m) +{ + uint memsize = total_memory; + + seq_printf(m, "vendor\t\t: Emerson Network Power\n"); + + seq_printf(m, "hardware rev\t: %d\n", + in_8(cpld_base + KATANAQP_CPLD_HVR)); + + seq_printf(m, "hardware config\t: %d\n", + in_8(cpld_base + KATANAQP_CPLD_HCR)); + + seq_printf(m, "memory size\t: %d MB\n", memsize / (1024 * 1024)); + + seq_printf(m, "PCI\t\t: %sMonarch\n", + katanaqp_is_monarch() ? "" : "Non-"); +} + +static int __init katanaqp_of_init(void) +{ + struct device_node *np; + + np = of_find_compatible_node(NULL, NULL, "cfi-flash"); + if (np) + of_platform_device_create(np, "of-flash", NULL); + + return 0; +} + +device_initcall(katanaqp_of_init); + +/* + * Called very early, device-tree isn't unflattened + */ +s
[PATCH 3/5] PowerPC 74xx: Katana Qp bootwrapper
Bootwrapper sources for Emerson Katana Qp Signed-off-by: Andrei Dolnikov <[EMAIL PROTECTED]> --- Makefile |3 cuboot-katanaqp.c | 470 ++ 2 files changed, 472 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile index 18e3271..92b8fac 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 cuboot-katanaqp.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_PPC_KATANAQP) += cuImage.katanaqp endif # For 32-bit powermacs, build the COFF and miboot images diff --git a/arch/powerpc/boot/cuboot-katanaqp.c b/arch/powerpc/boot/cuboot-katanaqp.c new file mode 100644 index 000..19ba901 --- /dev/null +++ b/arch/powerpc/boot/cuboot-katanaqp.c @@ -0,0 +1,470 @@ +/* + * Emerson Katana Qp platform code. + * + * Authors: Vladislav Buzov <[EMAIL PROTECTED]> + * Andrei Dolnikov <[EMAIL PROTECTED]> + * + * Based on prpmc2800.c by Mark A. Greer <[EMAIL PROTECTED]> + * + * 2007 (c) MontaVista, Software, Inc. This file is licensed under + * the terms of the GNU General Public License version 2. This program + * is licensed "as is" without any warranty of any kind, whether express + * or implied. + */ + +#include +#include +#include "cuboot.h" +#include "ppcboot.h" +#include "types.h" +#include "page.h" +#include "string.h" +#include "stdio.h" +#include "io.h" +#include "ops.h" +#include "mv64x60.h" + +#define Mb (1024U * 1024U) +#define Gb (Mb * 1024U) + +#define MHz(1000U * 1000U) +#define GHz(MHz * 1000U) + +#define BOARD_MODEL"Katana-Qp" +#define BOARD_MODEL_MAX12 /* max strlen(BOARD_MODEL) + 1 */ +#define BOARD_CFG_MAX 28 /* max strlen(BOARD_CFG) + 1 */ +#define BOARD_MODEL_LEN(BOARD_MODEL_MAX + BOARD_CFG_MAX) + +#define MTD_PART_NODE "partition" +#define MTD_PART_NUM 3 +#define MTD_PART_NODE_LEN 20 +#define MTD_PART_MONITOR_SIZE (1*Mb) +#define MTD_PART_KERNEL_SIZE (2*Mb) + +/* + * CPLD registers definitions + */ +#define KATANAQP_CPLD_RCR 0x0004 /* Reset command */ +#define KATANAQP_CPLD_RCR_CPUHR(1 << 7) + +#define KATANAQP_CPLD_JSR 0x0020 /* Jumper settings */ +#define KATANAQP_CPLD_JSR_EBFM (1 << 6) + +#define KATANAQP_CPLD_PSR 0x0030 /* PCI status */ +#define KATANAQP_CPLD_PSR_PMCM (1 << 1) + +#define KATANAQP_CPLD_HCR 0x0044 /* Hardware config */ + +static bd_t bd; + +static u8 *bridge_base; +static u8 *cpld_base; + +typedef enum { + KATANAQP_UNKNOWN, + KATANAQP_CFG_PRPMC_SINGLE, + KATANAQP_CFG_PRPMC_DUAL, + KATANAQP_CFG_PT2CC_SINGLE, + KATANAQP_CFG_PT5CC_SINGLE, + KATANAQP_CFG_MEDIA_DUAL, + KATANAQP_CFG_PT2CC_DUAL, + KATANAQP_CFG_PT5CC_DUAL, + KATANAQP_CFG_PT5CC_CUSTOM, + KATANAQP_CFG_MEDIA_SINGLE, + KATANAQP_CFG_UNKNOWN, +} katanaqp_board_model; + +static katanaqp_board_model katanaqp_cfg; + +struct katanaqp_board_info { + char *cfg_name; + char eth_phys[3]; +}; + +struct katanaqp_mtd_part { + char *name; + u32 size; + u32 ro; +}; + +static struct katanaqp_board_info katanaqp_board_info[] = { + + [KATANAQP_CFG_PRPMC_SINGLE] = { + .cfg_name = "PrPMC Single Core", + .eth_phys = {10, 13, 6}, + }, + + [KATANAQP_CFG_PRPMC_DUAL] = { + .cfg_name = "PrPMC Dual Core", + .eth_phys = {10, 13, 6} + }, + + [KATANAQP_CFG_PT2CC_SINGLE] = { + .cfg_name = "PT2CC Single Core", + .eth_phys = {9, 8, 6}, + }, + + [KATANAQP_CFG_PT5CC_SINGLE] = { + .cfg_name = "PT5CC Single Core", + .eth_phys = {10, 13, 6}, + }, + + [KATANAQP_CFG_MEDIA_DUAL] = { + .cfg_name = "Dual Core Media Blade", + .eth_phys = {10, 13, 6}, + }, + + [KATANAQP_CFG_PT2CC_DUAL] = { + .cfg_name = "PT2CC Dual Core", + .eth_phys = {9, 8, 6}, + }, + + [KATANAQP_CFG_PT5CC_DUAL] = { + .cfg_name = "PT5CC Dual Core", + .eth_phys = {10, 13, 6}, + }, + +
[PATCH 2/5] PowerPC 74xx: Minor updates to MV64x60 boot code
This patch adds new functionality to MV64x60 boot code. The changes are required to access DevCS windows registers and set PCI bus and devfn numbers for MV644x60 PCI/PCI-X interfaces. Signed-off-by: Andrei Dolnikov <[EMAIL PROTECTED]> --- mv64x60.c | 74 ++ mv64x60.h | 10 2 files changed, 84 insertions(+) diff --git a/arch/powerpc/boot/mv64x60.c b/arch/powerpc/boot/mv64x60.c index d207a0b..787a124 100644 --- a/arch/powerpc/boot/mv64x60.c +++ b/arch/powerpc/boot/mv64x60.c @@ -32,6 +32,16 @@ #define MV64x60_CPU2MEM_3_BASE 0x0218 #define MV64x60_CPU2MEM_3_SIZE 0x0220 +#define MV64x60_DEV2MEM_WINDOWS4 +#define MV64x60_DEV2MEM_0_BASE 0x0028 +#define MV64x60_DEV2MEM_0_SIZE 0x0030 +#define MV64x60_DEV2MEM_1_BASE 0x0228 +#define MV64x60_DEV2MEM_1_SIZE 0x0230 +#define MV64x60_DEV2MEM_2_BASE 0x0248 +#define MV64x60_DEV2MEM_2_SIZE 0x0250 +#define MV64x60_DEV2MEM_3_BASE 0x0038 +#define MV64x60_DEV2MEM_3_SIZE 0x0040 + #define MV64x60_ENET2MEM_BAR_ENABLE0x2290 #define MV64x60_ENET2MEM_0_BASE0x2200 #define MV64x60_ENET2MEM_0_SIZE0x2204 @@ -219,6 +229,25 @@ static struct mv64x60_mem_win mv64x60_cpu2mem[MV64x60_CPU2MEM_WINDOWS] = { }, }; +static struct mv64x60_mem_win mv64x60_devcs[MV64x60_DEV2MEM_WINDOWS] = { + [0] = { + .lo = MV64x60_DEV2MEM_0_BASE, + .size = MV64x60_DEV2MEM_0_SIZE, + }, + [1] = { + .lo = MV64x60_DEV2MEM_1_BASE, + .size = MV64x60_DEV2MEM_1_SIZE, + }, + [2] = { + .lo = MV64x60_DEV2MEM_2_BASE, + .size = MV64x60_DEV2MEM_2_SIZE, + }, + [3] = { + .lo = MV64x60_DEV2MEM_3_BASE, + .size = MV64x60_DEV2MEM_3_SIZE, + }, +}; + static struct mv64x60_mem_win mv64x60_enet2mem[MV64x60_CPU2MEM_WINDOWS] = { [0] = { .lo = MV64x60_ENET2MEM_0_BASE, @@ -567,6 +596,36 @@ void mv64x60_config_cpu2pci_window(u8 *bridge_base, u8 hose, u32 pci_base_hi, out_le32((u32 *)(bridge_base + offset_tbl[hose].size), size); } +/* Set PCI bus number for a PCI interface and force its devnum to 0 */ +void mv64x60_set_pci_bus(u8 *bridge_base, u8 hose, u32 bus, u32 devnum) +{ + u8 *pci_mode_reg, *p2p_cfg_reg; + u32 pci_mode, p2p_cfg; + u32 pci_cfg_offset; + + if (hose == 0) { + pci_mode_reg = bridge_base + MV64x60_PCI0_MODE; + p2p_cfg_reg = bridge_base + MV64x60_PCI0_P2P_CONF; + pci_cfg_offset = 0x64; + } else { + pci_mode_reg = bridge_base + MV64x60_PCI1_MODE; + p2p_cfg_reg = bridge_base + MV64x60_PCI1_P2P_CONF; + pci_cfg_offset = 0xe4; + } + + pci_mode = in_le32((u32*)pci_mode_reg) & MV64x60_PCI_MODE_MASK; + p2p_cfg = in_le32((u32*)p2p_cfg_reg); + + if (pci_mode == MV64x60_PCI_CONVENTIONAL_MODE) { + p2p_cfg &= 0xe000; + p2p_cfg |= (devnum << 24) | (bus << 16) | 0xff; + out_le32((u32*)p2p_cfg_reg, p2p_cfg); + } else + mv64x60_cfg_write(bridge_base, hose, (p2p_cfg >> 16) & 0xff, +PCI_DEVFN((p2p_cfg >> 24) & 0x1f, 0), +pci_cfg_offset, (devnum << 3) | (bus << 8)); +} + /* Read mem ctlr to get the amount of mem in system */ u32 mv64x60_get_mem_size(u8 *bridge_base) { @@ -586,6 +645,21 @@ u32 mv64x60_get_mem_size(u8 *bridge_base) return mem; } +/* Read a size of DEV_CS window */ +u32 mv64x60_get_devcs_size(u8 *bridge_base, u32 devcs) +{ + u32 enables, size = 0; + + enables = in_le32((u32 *)(bridge_base + MV64x60_CPU_BAR_ENABLE)) & 0xf0; + + if (devcs < 4 && !(enables && (0x10 << devcs))) { + size = in_le32((u32*)(bridge_base + mv64x60_devcs[devcs].size)); + size = ((size & 0x) + 1) << 16; + } + + return size; +} + /* Get physical address of bridge's registers */ u8 *mv64x60_get_bridge_pbase(void) { diff --git a/arch/powerpc/boot/mv64x60.h b/arch/powerpc/boot/mv64x60.h index d0b29a7..a633d2e 100644 --- a/arch/powerpc/boot/mv64x60.h +++ b/arch/powerpc/boot/mv64x60.h @@ -12,6 +12,14 @@ #define MV64x60_CPU_BAR_ENABLE 0x0278 +#define MV64x60_PCI0_MODE 0x0d00 +#define MV64x60_PCI1_MODE 0x0d80 +#define MV64x60_PCI0_P2P_CONF 0x1d14 +#define MV64x60_PCI1_P2P_CONF 0x1d94 + +#define MV64x60_PCI_MODE_MASK 0x0030 +#define MV64x60_PCI_CONVENTIONAL_MODE 0x + #define MV64x60_PCI_ACC_CNTL_ENABLE(1<<0) #define MV6
[PATCH 1/5] PowerPC 74xx: Katana Qp device tree
Device tree source file for the Emerson Katana Qp board Signed-off-by: Andrei Dolnikov <[EMAIL PROTECTED]> --- katanaqp.dts | 360 +++ 1 files changed, 360 insertions(+) diff --git a/arch/powerpc/boot/dts/katanaqp.dts b/arch/powerpc/boot/dts/katanaqp.dts new file mode 100644 index 000..98257a2 --- /dev/null +++ b/arch/powerpc/boot/dts/katanaqp.dts @@ -0,0 +1,360 @@ +/* Device Tree Source for Emerson Katana Qp + * + * Authors: Vladislav Buzov <[EMAIL PROTECTED]> + * Andrei Dolnikov <[EMAIL PROTECTED]> + * + * Based on prpmc8200.dts by Mark A. Greer <[EMAIL PROTECTED]> + * + * 2007 (c) MontaVista, Software, Inc. 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 = <1>; + #size-cells = <1>; + model = "Katana-Qp"; /* Default */ + compatible = "emerson,Katana-Qp"; + coherency-off; + + cpus { + #address-cells = <1>; + #size-cells = <0>; + + PowerPC,[EMAIL PROTECTED] { + device_type = "cpu"; + reg = <0>; + clock-frequency = <0>; /* From U-boot */ + bus-frequency = <0>;/* From U-boot */ + timebase-frequency = <0>; /* From U-boot */ + i-cache-line-size = <20>; + d-cache-line-size = <20>; + i-cache-size = <8000>; + d-cache-size = <8000>; + }; + }; + + memory { + device_type = "memory"; + reg = < >; /* Filled in by bootwrapper */ + }; + + [EMAIL PROTECTED] { /* Marvell Discovery */ + #address-cells = <1>; + #size-cells = <1>; + model = "mv64460"; /* Default */ + compatible = "marvell,mv64x60"; + clock-frequency = <7f28155>;/* 133.33 MHz */ + reg = ; + virtual-reg = ; + ranges = ; /* Integrated SRAM */ + + [EMAIL PROTECTED] { + compatible = "cfi-flash"; + reg = ; /* Default (16MB) */ + probe-type = "CFI"; + bank-width = <4>; + + [EMAIL PROTECTED] { + label = "Primary Monitor"; + reg = <0 10>; /* 1Mb */ + read-only; + }; + + [EMAIL PROTECTED] { + label = "Primary Kernel"; + reg = <10 20>; /* 2 Mb */ + }; + + [EMAIL PROTECTED] { + label = "Primary FS"; + reg = <30 d0>; /* 13 Mb */ + }; + + }; + + mdio { + #address-cells = <1>; + #size-cells = <0>; + compatible = "marvell,mv64x60-mdio"; + [EMAIL PROTECTED] { + block-index = <0>; + compatible = "marvell,mv88e"; + reg = ; + }; + [EMAIL PROTECTED] { + compatible = "marvell,mv88e"; + block-index = <1>; + reg = ; + }; + [EMAIL PROTECTED] { + compatible = "marvell,mv88e"; + block-index = <2>; + reg = <6>; + }; + }; + + [EMAIL PROTECTED] { + reg = <2000 2000>; + eth0 { + device_type = "network"; + compatible = "marvell,mv64x60-eth"; + block-index = <0>; + interrupts = <20>; + interrupt-parent = <&/mv64x60/pic>; + phy = <&/mv64x60/mdio/[EMAIL PROTECTED]>; + speed = <3e8>; + duplex = <1>; + tx_queue_size = <320>; + rx_queue_size = <190>; + local-mac-address = [ 00 00 00 00 00 00 ]; + /* Mac address filled in by bootwrapper */ + }; + eth1 { +
Re: [PATCH] [POWERPC] Emulate isel (Integer Select) instruction
On Wed, 28 Nov 2007, Geert Uytterhoeven wrote: > +static inline void warn_emulated_sysctl_register(void) > +{ > + int res = register_sysctl_table(warn_emulated_sysctl_root); ^^ > + printk("@@@ register_sysctl_table() returned %d\n", res); ^ > +} Woops, that part shouldn't have been there... With kind regards, Geert Uytterhoeven Software Architect Sony Network and Software Technology Center Europe The Corporate Village · Da Vincilaan 7-D1 · B-1935 Zaventem · Belgium Phone:+32 (0)2 700 8453 Fax: +32 (0)2 700 8622 E-mail: [EMAIL PROTECTED] Internet: http://www.sony-europe.com/ Sony Network and Software Technology Center Europe A division of Sony Service Centre (Europe) N.V. Registered office: Technologielaan 7 · B-1840 Londerzeel · Belgium VAT BE 0413.825.160 · RPR Brussels Fortis Bank Zaventem · Swift GEBABEBB08A · IBAN BE39001382358619___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
Re: Problems booting a 64k page kernel
Michael, thanks for your reply... I am seeing the segmentation fault both on the default SLES10 initrd and the default RHEL5.1 initrd. Therefore, I am reasonably sure this is a problem with my kernel build and not the initrd itself. On Thu, 2007-11-29 at 10:39 +1100, Michael Ellerman wrote: > On Wed, 2007-11-28 at 16:50 -0600, aglitke wrote: > > Hello all. I am new to building 64k page kernels and can't seem to get > > one to boot correctly. Everything looks okay until init gets a signal > > 11 while booting. Attached is my boot log and the kernel config I used. > > To generate this config I merely enabled the 64k page option in make > > menuconfig to alter a previously working config. > > > > Any help you can provide would be greatly appreciated. > > I've seen that happen with an init linked with uClibc, its dynamic > loader was doing mmap with MAP_FIXED on non-64K aligned addresses. > What user space are you using? > > cheers > -- Adam Litke - (agl at us.ibm.com) IBM Linux Technology Center ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
[PATCH 0/5] PowerPC 74xx: Add Emerson Katana Qp support
Hello folks, The following patch sequence is Emerson KatanaQp board support reworked after initial review/discussion. The patches are incremental to minor mv64x60 code fixups sent by Mark A. Greer on 11/08/07. Let me know if you think that some updates/changes needed. As for Vitaly's and Arnd's questions: Vitaly Bordug wrote: >> +clock-frequency = <7f28155>;/* >> 133.33 MHz */ >This should be updated somewhere in fw or bootwrapper.. Or is it hardcoded >value that is not going to change? Yep, it is :) About cfi-flash: I leave this code as is, according to Benjamin comment. Thanks, Andrei. ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
Re: [BUG] 2.6.24-rc3-mm2 kernel bug on nfs & cifs mounted partitions
Jan Kara wrote: > On Thu 29-11-07 17:27:08, Kamalesh Babulal wrote: >> Andrew Morton wrote: >>> On Thu, 29 Nov 2007 14:30:14 +0530 Kamalesh Babulal <[EMAIL PROTECTED]> >>> wrote: >>> Hi Andrew, While running file system stress on nfs and cifs mounted partitions, the machine drops to xmon 1:mon> e cpu 0x1: Vector: 300 (Data Access) at [c00080a9f880] pc: c01392c8: .inotify_inode_queue_event+0x50/0x158 lr: c01074d0: .vfs_link+0x204/0x298 sp: c00080a9fb00 msr: 80009032 dar: 280 dsisr: 4001 current = 0xc000c8e6f670 paca= 0xc0512c00 pid = 2848, comm = fsstress 1:mon> t [c00080a9fbd0] c01074d0 .vfs_link+0x204/0x298 [c00080a9fc70] c010b6e0 .sys_linkat+0x134/0x1b4 [c00080a9fe30] c000872c syscall_exit+0x0/0x40 --- Exception: c00 (System Call) at 0ff1bdfc SP (ffeaed10) is in userspace 1:mon> r R00 = c01074d0 R16 = R01 = c00080a9fb00 R17 = R02 = c060c380 R18 = R03 = R19 = R04 = 0004 R20 = R05 = R21 = R06 = R22 = R07 = R23 = 0004 R08 = R24 = 0280 R09 = R25 = f000 R10 = 0001 R26 = c00082827790 R11 = c03963e8 R27 = c000828275a0 R12 = d0deec78 R28 = R13 = c0512c00 R29 = c0007b18fcf0 R14 = R30 = c05bc088 R15 = R31 = pc = c01392c8 .inotify_inode_queue_event+0x50/0x158 lr = c01074d0 .vfs_link+0x204/0x298 msr = 80009032 cr = 24000882 ctr = c03963e8 xer = trap = 300 dar = 0280 dsisr = 4001 The gdb output shows 0xc01076d4 is in vfs_symlink (include/linux/fsnotify.h:108). 103 * fsnotify_create - 'name' was linked in 104 */ 105 static inline void fsnotify_create(struct inode *inode, struct dentry *dentry) 106 { 107 inode_dir_notify(inode, DN_CREATE); 108 inotify_inode_queue_event(inode, IN_CREATE, 0, dentry->d_name.name, 109 dentry->d_inode); 110 audit_inode_child(dentry->d_name.name, dentry, inode); 111 } 112 >>> If it is reproducible can you please try reverting >>> inotify-send-in_attrib-events-when-link-count-changes.patch? >> Hi Andrew, >> >> reverting the patch >> inotify-send-in_attrib-events-when-link-count-changes.patch, the >> bug is not reproduced. > OK, thanks for testing. I was trying to reproduce the problem locally but > without success so far - I guess it's either NFS or CIFS which makes the > problem appear. I'll investigate more. > > Honza Hi Jan, I was running file system stress parallely on NFS and CIFS mounted partitions. -- Thanks & Regards, Kamalesh Babulal, Linux Technology Center, IBM, ISTL. ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
Re: Timers on mpc8248 etc...
My uboot is new-ish, but I don't have the fdt commands? U-Boot 1.3.0 g992742a5-dirty u-boot:clock configuration === MPC8248 Clock Configuration - Bus-to-Core Mult 3.5x, VCO Div 2, 60x Bus Freq 30-85 , Core Freq 100-300 - dfbrg 1, corecnf 0x1e, busdf 3, cpmdf 1, plldf 0, pllmf 5, pcidf 5 - vco_out 39600, scc_clk 9900, brg_clk 2475 - cpu_clk 23100, cpm_clk 19800, bus_clk 6600 Boot Wrapper Reporting === Memory <- <0x0 0x800> (128MB) CPU clock-frequency <- 0xdc4c7c0 (231MHz) CPU timebase-frequency <- 0xfbc520 (17MHz) CPU bus-frequency <- 0x3ef1480 (66MHz) Kernel reporting === clocksource: timebase mult[f26c9b2] shift[22] registered device tree in kernel (hex= `od -x`: === /proc/device-tree/cpus/PowerPC,[EMAIL PROTECTED]/name PowerPC,8248 /proc/device-tree/cpus/PowerPC,[EMAIL PROTECTED]/bus-frequency 000 03ef 1480 /proc/device-tree/cpus/PowerPC,[EMAIL PROTECTED]/clock-frequency 000 0dc4 c7c0 /proc/device-tree/cpus/PowerPC,[EMAIL PROTECTED]/timebase-frequency 000 00fb c520 /proc/device-tree/cpus/PowerPC,[EMAIL PROTECTED]/i-cache-size 000 4000 On 11/29/07, Vitaly Bordug <[EMAIL PROTECTED]> wrote: > On Wed, 28 Nov 2007 21:06:36 -0700 > Alan Bennett wrote: > > > It comes from uboot. Can you point me in the right direction to make > > sure its right? > >PowerPC,[EMAIL PROTECTED] { > >device_type = "cpu"; > >reg = <0>; > >d-cache-line-size = ; > >i-cache-line-size = ; > >d-cache-size = ; > >i-cache-size = ; > >timebase-frequency = <0>; > >clock-frequency = <0>; > >}; > > > if your u-boot is up to date, it will have fdt command, and by > fdt boardsetup > fdt print / > > inspect what u-boot did. Of course you should have dtb preloaded to memory and > fdt addr should be said to let u-boot know where dtb resides. > > > > > > On 11/28/07, Scott Wood <[EMAIL PROTECTED]> wrote: > > > Alan Bennett wrote: > > > > I've got a routine that needs to delay for X microseconds, this > > > > is a must. The command after schedule_timeout must has to wait > > > > for the HW to complete a task that takes X microseconds. > > > > > > > > I would think that one way to do this is with a simple > > > > schedule_timeout. But in the example below, the time that passes > > > > from run1() to dontrun() is far less than 3.2 msecs. Infact, > > > > sometimes its ~ 800 micros according the a analyzer looking at > > > > points triggered in run1() and donrun(). Could this be a > > > > configuration problem with the timer/interrupt that generates the > > > > jiffies? > > > > > > Are you sure the timebase frequency is set correctly in the device > > > tree? > > > > > > -Scott > > > > > ___ > > Linuxppc-dev mailing list > > Linuxppc-dev@ozlabs.org > > https://ozlabs.org/mailman/listinfo/linuxppc-dev > > > -- > Sincerely, Vitaly > ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
Re: [BUG] 2.6.24-rc3-mm2 kernel bug on nfs & cifs mounted partitions
Andrew Morton wrote: > On Thu, 29 Nov 2007 14:30:14 +0530 Kamalesh Babulal <[EMAIL PROTECTED]> wrote: > >> Hi Andrew, >> >> While running file system stress on nfs and cifs mounted partitions, the >> machine >> drops to xmon >> >> 1:mon> e >> cpu 0x1: Vector: 300 (Data Access) at [c00080a9f880] >> pc: c01392c8: .inotify_inode_queue_event+0x50/0x158 >> lr: c01074d0: .vfs_link+0x204/0x298 >> sp: c00080a9fb00 >>msr: 80009032 >>dar: 280 >> dsisr: 4001 >> current = 0xc000c8e6f670 >> paca= 0xc0512c00 >> pid = 2848, comm = fsstress >> 1:mon> t >> [c00080a9fbd0] c01074d0 .vfs_link+0x204/0x298 >> [c00080a9fc70] c010b6e0 .sys_linkat+0x134/0x1b4 >> [c00080a9fe30] c000872c syscall_exit+0x0/0x40 >> --- Exception: c00 (System Call) at 0ff1bdfc >> SP (ffeaed10) is in userspace >> 1:mon> r >> R00 = c01074d0 R16 = >> R01 = c00080a9fb00 R17 = >> R02 = c060c380 R18 = >> R03 = R19 = >> R04 = 0004 R20 = >> R05 = R21 = >> R06 = R22 = >> R07 = R23 = 0004 >> R08 = R24 = 0280 >> R09 = R25 = f000 >> R10 = 0001 R26 = c00082827790 >> R11 = c03963e8 R27 = c000828275a0 >> R12 = d0deec78 R28 = >> R13 = c0512c00 R29 = c0007b18fcf0 >> R14 = R30 = c05bc088 >> R15 = R31 = >> pc = c01392c8 .inotify_inode_queue_event+0x50/0x158 >> lr = c01074d0 .vfs_link+0x204/0x298 >> msr = 80009032 cr = 24000882 >> ctr = c03963e8 xer = trap = 300 >> dar = 0280 dsisr = 4001 >> >> >> The gdb output shows >> >> 0xc01076d4 is in vfs_symlink (include/linux/fsnotify.h:108). >> 103 * fsnotify_create - 'name' was linked in >> 104 */ >> 105 static inline void fsnotify_create(struct inode *inode, struct >> dentry *dentry) >> 106 { >> 107 inode_dir_notify(inode, DN_CREATE); >> 108 inotify_inode_queue_event(inode, IN_CREATE, 0, >> dentry->d_name.name, >> 109 dentry->d_inode); >> 110 audit_inode_child(dentry->d_name.name, dentry, inode); >> 111 } >> 112 >> > > If it is reproducible can you please try reverting > inotify-send-in_attrib-events-when-link-count-changes.patch? Hi Andrew, reverting the patch inotify-send-in_attrib-events-when-link-count-changes.patch, the bug is not reproduced. -- Thanks & Regards, Kamalesh Babulal, Linux Technology Center, IBM, ISTL. ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
Re: Timers on mpc8248 etc...
On Wed, 28 Nov 2007 21:06:36 -0700 Alan Bennett wrote: > It comes from uboot. Can you point me in the right direction to make > sure its right? >PowerPC,[EMAIL PROTECTED] { >device_type = "cpu"; >reg = <0>; >d-cache-line-size = ; >i-cache-line-size = ; >d-cache-size = ; >i-cache-size = ; >timebase-frequency = <0>; >clock-frequency = <0>; >}; > if your u-boot is up to date, it will have fdt command, and by fdt boardsetup fdt print / inspect what u-boot did. Of course you should have dtb preloaded to memory and fdt addr should be said to let u-boot know where dtb resides. > > On 11/28/07, Scott Wood <[EMAIL PROTECTED]> wrote: > > Alan Bennett wrote: > > > I've got a routine that needs to delay for X microseconds, this > > > is a must. The command after schedule_timeout must has to wait > > > for the HW to complete a task that takes X microseconds. > > > > > > I would think that one way to do this is with a simple > > > schedule_timeout. But in the example below, the time that passes > > > from run1() to dontrun() is far less than 3.2 msecs. Infact, > > > sometimes its ~ 800 micros according the a analyzer looking at > > > points triggered in run1() and donrun(). Could this be a > > > configuration problem with the timer/interrupt that generates the > > > jiffies? > > > > Are you sure the timebase frequency is set correctly in the device > > tree? > > > > -Scott > > > ___ > Linuxppc-dev mailing list > Linuxppc-dev@ozlabs.org > https://ozlabs.org/mailman/listinfo/linuxppc-dev -- Sincerely, Vitaly ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
Re: MPC5200 I2C and 2.6 kernel
Hi, >> hwclock --debug tells me: > >> hwclock: Open of /dev/rtc failed, errno=19: No such device. > > Well... did you check how your /dev/rtc is set up? It used to be a > misc device with MAJ=10 MIN=135 in old kernel versions, but now it's > MAJ=254 MIN=4, i. e. it should look like this: > > crw-r--r-- 1 root root 254, 0 Jun 22 18:30 /dev/rtc > Yes this was not correct in my filesystem. But in your filesystem it looks like MAJ=254 MIN=0. I set MIN to 0 and applied Jon's suggestions and now it works! So many thanks to Wolfgang and Jon, this was really a hard problem for me! But I should mention that I modified my dts for the M41T00 RTC in the following way: [EMAIL PROTECTED] { compatible = "stm,m41t00"; reg = <68>; }; In some piece of an older driver I found the I2C Address for this RTC (0x68), although the data sheet tells me that the slave address is 0xD0. However, now it's up and running! Thanks and bye, -- Dipl. Ing. Oliver Rutsch EMail: [EMAIL PROTECTED] ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
Re: [PATCH] powerpc: fix os-term usage on kernel panic
On Wed, Nov 28, Linas Vepstas wrote: > On Wed, Nov 28, 2007 at 12:00:37PM +0100, Olaf Hering wrote: > > On Tue, Nov 27, Will Schmidt wrote: > > > > - if (panic_timeout) > > > > - return; > > > > This change is wrong. Booting with panic=123 really means the system > > has to reboot in 123 seconds after a panic. > > And it does. Have you ever tried it? Current state is that the JS20 hangs after panic, simply because it calls into the hypervisor (or whatever). To reproduce: mkdir ../O-os-term cp arch/powerpc/configs/pseries_defconfig ../O-os-term/.config yes '' | make -kj6 O=../O-os-term zImage scp -4pr ../O-os-term/arch/powerpc/boot/zImage [EMAIL PROTECTED]:/tftpboot/js20 boot /[EMAIL PROTECTED]/[EMAIL PROTECTED]/[EMAIL PROTECTED],1 debug panic=1 root=/dev/sdx42 Whoever relies on the string passing to the HMC can boot with panic=0 or use some sysctl to write to /proc/sys/kernel/panic So, please restore the panic_timeout check. ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
Re: [PATCH] Increase the upper bound on NR_CPUS.
On Thursday 29 November 2007, Tony Breeds wrote: > why not? In the past I've seen run-time problems because some parts of the code kmalloc NR_CPUS sized arrays, which can easily grow beyond the kmalloc limit of 128kb. Have you tried running some tests on a small machine with the big NR_CPUS? Arnd <>< ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
Re: [BUG] 2.6.24-rc3-git2 softlockup detected
Andrew Morton wrote: > On Thu, 29 Nov 2007 12:01:08 +0530 Kamalesh Babulal <[EMAIL PROTECTED]> wrote: > >> Andrew Morton wrote: >>> On Wed, 28 Nov 2007 12:47:19 +0530 Kamalesh Babulal <[EMAIL PROTECTED]> >>> wrote: >>> Andrew Morton wrote: > On Wed, 28 Nov 2007 11:59:00 +0530 Kamalesh Babulal <[EMAIL PROTECTED]> > wrote: > >> Hi, > (cc linux-scsi, for sym53c8xx) > >> Soft lockup is detected while bootup with 2.6.24-rc3-git2 on powerbox > I assume this is a post-2.6.23 regression? > >> BUG: soft lockup - CPU#1 stuck for 11s! [insmod:375] >> NIP: c002f02c LR: d01414fc CTR: c002f018 >> REGS: c0077cbef0b0 TRAP: 0901 Not tainted >> (2.6.24-rc3-git2-autotest) >> MSR: 80009032 CR: 24022088 XER: >> TASK = c0077cbd8000[375] 'insmod' THREAD: c0077cbec000 CPU: 1 >> GPR00: d01414fc c0077cbef330 c052b930 >> d80080002014 >> GPR04: d8008000202c c0077ca1cb00 >> d014ce54 >> GPR08: c0077ca1c63c 002a >> c002f018 >> GPR12: d0143610 c0473d00 >> NIP [c002f02c] .ioread8+0x14/0x60 >> LR [d01414fc] .sym_hcb_attach+0x1188/0x1378 [sym53c8xx] >> Call Trace: >> [c0077cbef330] [c0077cbef3c0] 0xc0077cbef3c0 (unreliable) >> [c0077cbef3a0] [d01414fc] .sym_hcb_attach+0x1188/0x1378 >> [sym53c8xx] >> [c0077cbef470] [d01395f8] .sym2_probe+0x700/0x99c [sym53c8xx] >> [c0077cbef710] [c01bc118] .pci_device_probe+0x124/0x1b0 >> [c0077cbef7b0] [c0221138] .driver_probe_device+0x144/0x20c >> [c0077cbef850] [c0221450] .__driver_attach+0xcc/0x154 >> [c0077cbef8e0] [c021ff94] .bus_for_each_dev+0x7c/0xd4 >> [c0077cbef9a0] [c0220e9c] .driver_attach+0x28/0x40 >> [c0077cbefa20] [c02204d8] .bus_add_driver+0x90/0x228 >> [c0077cbefac0] [c0221858] .driver_register+0x94/0xb0 >> [c0077cbefb40] [c01bc430] .__pci_register_driver+0x6c/0xcc >> [c0077cbefbe0] [d0143428] .sym2_init+0x108/0x15b0 [sym53c8xx] >> [c0077cbefc80] [c008ce80] .sys_init_module+0x17c4/0x1958 >> [c0077cbefe30] [c000872c] syscall_exit+0x0/0x40 >> Instruction dump: >> 6000 786b0420 38210070 7d635b78 e8010010 7c0803a6 4e800020 7c0802a6 >> f8010010 f821ff91 7c0004ac 8923 <0c09> 4c00012c 79290620 >> 2f8900ff > I see no obvious lockup sites near the end of sym_hcb_attach(). Maybe > it's > being called lots of times from a higher level.. Do the traces all look > the same? Hi Andrew, I see this call trace twice and both looks similar and on another reboot the following trace is seen twice in different cpu BUG: soft lockup detected on CPU#3! Call Trace: [C0003FEDEDA0] [C0010220] .show_stack+0x68/0x1b0 (unreliable) [C0003FEDEE40] [C00A061C] .softlockup_tick+0xf0/0x13c [C0003FEDEEF0] [C0072E2C] .run_local_timers+0x1c/0x30 [C0003FEDEF70] [C0022FA0] .timer_interrupt+0xa8/0x488 [C0003FEDF050] [C00034EC] decrementer_common+0xec/0x100 --- Exception: 901 at .ioread8+0x14/0x60 LR = .sym_hcb_attach+0x1194/0x1384 [sym53c8xx] [C0003FEDF340] [D02B3BC0] 0xd02b3bc0 (unreliable) [C0003FEDF3B0] [D029A3C0] .sym_hcb_attach+0x1194/0x1384 [sym53c8xx] [C0003FEDF480] [D0291D30] .sym2_probe+0x75c/0x9f8 [sym53c8xx] [C0003FEDF710] [C01B65A4] .pci_device_probe+0x13c/0x1dc [C0003FEDF7D0] [C0219A0C] .driver_probe_device+0xa0/0x15c [C0003FEDF870] [C0219C64] .__driver_attach+0xb4/0x138 [C0003FEDF900] [C021913C] .bus_for_each_dev+0x7c/0xd4 [C0003FEDF9C0] [C02198B0] .driver_attach+0x28/0x40 [C0003FEDFA40] [C0218BA4] .bus_add_driver+0x98/0x18c [C0003FEDFAE0] [C021A064] .driver_register+0xa8/0xc4 [C0003FEDFB60] [C01B68AC] .__pci_register_driver+0x5c/0xa4 [C0003FEDFBF0] [D029C204] .sym2_init+0x104/0x1550 [sym53c8xx] [C0003FEDFC90] [C008D1F4] .sys_init_module+0x1764/0x1998 [C0003FEDFE30] [C000869C] syscall_exit+0x0/0x40 >>> hm, odd. >>> >>> Can you look up sym_hcb_attach+0x1194/0x1384 in gdb? Something like >>> >> Hi Andrew, >> >> I tried with 2.6.24-rc3-git3 and got the following trace >> >> BUG: soft lockup - CPU#2 stuck for 11s! [insmod:375] >> NIP: c002f02c LR: d01414fc CTR: c002f018 >> REGS: c0077ca3b0b0 TRAP: 0901 Not tainted (2.6.24-rc3-git3-autokern1) >> MSR: 80009032 CR: 24022088 XER: >> TASK = c0077cc58000[375] 'insmod'
Re: [BUG] 2.6.24-rc3-mm2 kernel bug on nfs & cifs mounted partitions
On Thu, 29 Nov 2007 14:30:14 +0530 Kamalesh Babulal <[EMAIL PROTECTED]> wrote: > Hi Andrew, > > While running file system stress on nfs and cifs mounted partitions, the > machine > drops to xmon > > 1:mon> e > cpu 0x1: Vector: 300 (Data Access) at [c00080a9f880] > pc: c01392c8: .inotify_inode_queue_event+0x50/0x158 > lr: c01074d0: .vfs_link+0x204/0x298 > sp: c00080a9fb00 >msr: 80009032 >dar: 280 > dsisr: 4001 > current = 0xc000c8e6f670 > paca= 0xc0512c00 > pid = 2848, comm = fsstress > 1:mon> t > [c00080a9fbd0] c01074d0 .vfs_link+0x204/0x298 > [c00080a9fc70] c010b6e0 .sys_linkat+0x134/0x1b4 > [c00080a9fe30] c000872c syscall_exit+0x0/0x40 > --- Exception: c00 (System Call) at 0ff1bdfc > SP (ffeaed10) is in userspace > 1:mon> r > R00 = c01074d0 R16 = > R01 = c00080a9fb00 R17 = > R02 = c060c380 R18 = > R03 = R19 = > R04 = 0004 R20 = > R05 = R21 = > R06 = R22 = > R07 = R23 = 0004 > R08 = R24 = 0280 > R09 = R25 = f000 > R10 = 0001 R26 = c00082827790 > R11 = c03963e8 R27 = c000828275a0 > R12 = d0deec78 R28 = > R13 = c0512c00 R29 = c0007b18fcf0 > R14 = R30 = c05bc088 > R15 = R31 = > pc = c01392c8 .inotify_inode_queue_event+0x50/0x158 > lr = c01074d0 .vfs_link+0x204/0x298 > msr = 80009032 cr = 24000882 > ctr = c03963e8 xer = trap = 300 > dar = 0280 dsisr = 4001 > > > The gdb output shows > > 0xc01076d4 is in vfs_symlink (include/linux/fsnotify.h:108). > 103 * fsnotify_create - 'name' was linked in > 104 */ > 105 static inline void fsnotify_create(struct inode *inode, struct dentry > *dentry) > 106 { > 107 inode_dir_notify(inode, DN_CREATE); > 108 inotify_inode_queue_event(inode, IN_CREATE, 0, > dentry->d_name.name, > 109 dentry->d_inode); > 110 audit_inode_child(dentry->d_name.name, dentry, inode); > 111 } > 112 > If it is reproducible can you please try reverting inotify-send-in_attrib-events-when-link-count-changes.patch? ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
[BUG] 2.6.24-rc3-mm2 kernel bug on nfs & cifs mounted partitions
Hi Andrew, While running file system stress on nfs and cifs mounted partitions, the machine drops to xmon 1:mon> e cpu 0x1: Vector: 300 (Data Access) at [c00080a9f880] pc: c01392c8: .inotify_inode_queue_event+0x50/0x158 lr: c01074d0: .vfs_link+0x204/0x298 sp: c00080a9fb00 msr: 80009032 dar: 280 dsisr: 4001 current = 0xc000c8e6f670 paca= 0xc0512c00 pid = 2848, comm = fsstress 1:mon> t [c00080a9fbd0] c01074d0 .vfs_link+0x204/0x298 [c00080a9fc70] c010b6e0 .sys_linkat+0x134/0x1b4 [c00080a9fe30] c000872c syscall_exit+0x0/0x40 --- Exception: c00 (System Call) at 0ff1bdfc SP (ffeaed10) is in userspace 1:mon> r R00 = c01074d0 R16 = R01 = c00080a9fb00 R17 = R02 = c060c380 R18 = R03 = R19 = R04 = 0004 R20 = R05 = R21 = R06 = R22 = R07 = R23 = 0004 R08 = R24 = 0280 R09 = R25 = f000 R10 = 0001 R26 = c00082827790 R11 = c03963e8 R27 = c000828275a0 R12 = d0deec78 R28 = R13 = c0512c00 R29 = c0007b18fcf0 R14 = R30 = c05bc088 R15 = R31 = pc = c01392c8 .inotify_inode_queue_event+0x50/0x158 lr = c01074d0 .vfs_link+0x204/0x298 msr = 80009032 cr = 24000882 ctr = c03963e8 xer = trap = 300 dar = 0280 dsisr = 4001 The gdb output shows 0xc01076d4 is in vfs_symlink (include/linux/fsnotify.h:108). 103 * fsnotify_create - 'name' was linked in 104 */ 105 static inline void fsnotify_create(struct inode *inode, struct dentry *dentry) 106 { 107 inode_dir_notify(inode, DN_CREATE); 108 inotify_inode_queue_event(inode, IN_CREATE, 0, dentry->d_name.name, 109 dentry->d_inode); 110 audit_inode_child(dentry->d_name.name, dentry, inode); 111 } 112 -- Thanks & Regards, Kamalesh Babulal, Linux Technology Center, IBM, ISTL. ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
Re: [BUG] 2.6.24-rc3-git2 softlockup detected
On Thu, 29 Nov 2007 12:01:08 +0530 Kamalesh Babulal <[EMAIL PROTECTED]> wrote: > Andrew Morton wrote: > > On Wed, 28 Nov 2007 12:47:19 +0530 Kamalesh Babulal <[EMAIL PROTECTED]> > > wrote: > > > >> Andrew Morton wrote: > >>> On Wed, 28 Nov 2007 11:59:00 +0530 Kamalesh Babulal <[EMAIL PROTECTED]> > >>> wrote: > >>> > Hi, > >>> (cc linux-scsi, for sym53c8xx) > >>> > Soft lockup is detected while bootup with 2.6.24-rc3-git2 on powerbox > >>> I assume this is a post-2.6.23 regression? > >>> > BUG: soft lockup - CPU#1 stuck for 11s! [insmod:375] > NIP: c002f02c LR: d01414fc CTR: c002f018 > REGS: c0077cbef0b0 TRAP: 0901 Not tainted > (2.6.24-rc3-git2-autotest) > MSR: 80009032 CR: 24022088 XER: > TASK = c0077cbd8000[375] 'insmod' THREAD: c0077cbec000 CPU: 1 > GPR00: d01414fc c0077cbef330 c052b930 > d80080002014 > GPR04: d8008000202c c0077ca1cb00 > d014ce54 > GPR08: c0077ca1c63c 002a > c002f018 > GPR12: d0143610 c0473d00 > NIP [c002f02c] .ioread8+0x14/0x60 > LR [d01414fc] .sym_hcb_attach+0x1188/0x1378 [sym53c8xx] > Call Trace: > [c0077cbef330] [c0077cbef3c0] 0xc0077cbef3c0 (unreliable) > [c0077cbef3a0] [d01414fc] .sym_hcb_attach+0x1188/0x1378 > [sym53c8xx] > [c0077cbef470] [d01395f8] .sym2_probe+0x700/0x99c [sym53c8xx] > [c0077cbef710] [c01bc118] .pci_device_probe+0x124/0x1b0 > [c0077cbef7b0] [c0221138] .driver_probe_device+0x144/0x20c > [c0077cbef850] [c0221450] .__driver_attach+0xcc/0x154 > [c0077cbef8e0] [c021ff94] .bus_for_each_dev+0x7c/0xd4 > [c0077cbef9a0] [c0220e9c] .driver_attach+0x28/0x40 > [c0077cbefa20] [c02204d8] .bus_add_driver+0x90/0x228 > [c0077cbefac0] [c0221858] .driver_register+0x94/0xb0 > [c0077cbefb40] [c01bc430] .__pci_register_driver+0x6c/0xcc > [c0077cbefbe0] [d0143428] .sym2_init+0x108/0x15b0 [sym53c8xx] > [c0077cbefc80] [c008ce80] .sys_init_module+0x17c4/0x1958 > [c0077cbefe30] [c000872c] syscall_exit+0x0/0x40 > Instruction dump: > 6000 786b0420 38210070 7d635b78 e8010010 7c0803a6 4e800020 7c0802a6 > f8010010 f821ff91 7c0004ac 8923 <0c09> 4c00012c 79290620 > 2f8900ff > >>> I see no obvious lockup sites near the end of sym_hcb_attach(). Maybe > >>> it's > >>> being called lots of times from a higher level.. Do the traces all look > >>> the same? > >> Hi Andrew, > >> > >> I see this call trace twice and both looks similar and on another reboot > >> the following trace is seen twice in different cpu > >> > >> BUG: soft lockup detected on CPU#3! > >> Call Trace: > >> [C0003FEDEDA0] [C0010220] .show_stack+0x68/0x1b0 (unreliable) > >> [C0003FEDEE40] [C00A061C] .softlockup_tick+0xf0/0x13c > >> [C0003FEDEEF0] [C0072E2C] .run_local_timers+0x1c/0x30 > >> [C0003FEDEF70] [C0022FA0] .timer_interrupt+0xa8/0x488 > >> [C0003FEDF050] [C00034EC] decrementer_common+0xec/0x100 > >> --- Exception: 901 at .ioread8+0x14/0x60 > >> LR = .sym_hcb_attach+0x1194/0x1384 [sym53c8xx] > >> [C0003FEDF340] [D02B3BC0] 0xd02b3bc0 (unreliable) > >> [C0003FEDF3B0] [D029A3C0] .sym_hcb_attach+0x1194/0x1384 > >> [sym53c8xx] > >> [C0003FEDF480] [D0291D30] .sym2_probe+0x75c/0x9f8 [sym53c8xx] > >> [C0003FEDF710] [C01B65A4] .pci_device_probe+0x13c/0x1dc > >> [C0003FEDF7D0] [C0219A0C] .driver_probe_device+0xa0/0x15c > >> [C0003FEDF870] [C0219C64] .__driver_attach+0xb4/0x138 > >> [C0003FEDF900] [C021913C] .bus_for_each_dev+0x7c/0xd4 > >> [C0003FEDF9C0] [C02198B0] .driver_attach+0x28/0x40 > >> [C0003FEDFA40] [C0218BA4] .bus_add_driver+0x98/0x18c > >> [C0003FEDFAE0] [C021A064] .driver_register+0xa8/0xc4 > >> [C0003FEDFB60] [C01B68AC] .__pci_register_driver+0x5c/0xa4 > >> [C0003FEDFBF0] [D029C204] .sym2_init+0x104/0x1550 [sym53c8xx] > >> [C0003FEDFC90] [C008D1F4] .sys_init_module+0x1764/0x1998 > >> [C0003FEDFE30] [C000869C] syscall_exit+0x0/0x40 > >> > > > > hm, odd. > > > > Can you look up sym_hcb_attach+0x1194/0x1384 in gdb? Something like > > > Hi Andrew, > > I tried with 2.6.24-rc3-git3 and got the following trace > > BUG: soft lockup - CPU#2 stuck for 11s! [insmod:375] > NIP: c002f02c LR: d01414fc CTR: c002f018 > REGS: c0077ca3b0b0 TRAP: 0901 Not tainted (2.6.24-rc3-git3-autokern1) > MSR: 80009032 CR: 24022088 XER: > TASK = c0077cc58000[375] 'insmod' THREAD: c0077ca38000