Re: [PATCH 14/27] powerpc: ptrace generic resume

2007-12-03 Thread Srinivasa Ds
Roland McGrath wrote:
> This removes the handling for PTRACE_CONT et al from the powerpc
> ptrace code, so it uses the new generic code via ptrace_request.
 
   I have tested this patchset on powerpc successfully.

> 
> Signed-off-by: Roland McGrath <[EMAIL PROTECTED]>
> ---
>  arch/powerpc/kernel/ptrace.c |   46 
> --
>  1 files changed, 0 insertions(+), 46 deletions(-)
> 
> diff --git a/arch/powerpc/kernel/ptrace.c b/arch/powerpc/kernel/ptrace.c
> index b970d79..8b056d2 100644
> --- a/arch/powerpc/kernel/ptrace.c
> +++ b/arch/powerpc/kernel/ptrace.c
> @@ -445,52 +445,6 @@ long arch_ptrace(struct task_struct *child, long 
> request, long addr, long data)
>   break;
>   }


Thanks
 Srinivasa DS
 Linux Technology Centre
 IBM.

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


Re: [PATCH] Add IPIC MSI interrupt support

2007-12-03 Thread Li Li
Hi Michael,

I emulate mpic to write this IPIC MSI routines. :)


> > 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 
> 
> I'd rather you just include it unconditionally.

Yes. that is ok for me.

> 
> > @@ -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
> 
> If you have a no-op version of ipic_msi_init() in your header file then
> you can remove the #ifdef in the C code - which I think is nicer.
> 

Seems you do not like #ifdef. :)  I agree it.
So, I move this #ifdef into header file.

> Why do you pass the handler into the init routine, rather than have the
> init routine just set the handler. Then you could make the handler
> static.
> 

In IPIC, the 8 MSI interrupts is handled as level intrrupt.
I just provide a versatile in case it is changed.

> >  }
> >  
> >  /*
> > 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 ($(CONFIG_PPC_MERGE),y)
> >  obj-$(CONFIG_PPC_INDIRECT_PCI) += indirect_pci.o
> >  obj-$(CONFIG_PPC_I8259)+= i8259.o
> >  obj-$(CONFIG_PPC_83xx) += ipic.o
> > +obj-$(CONFIG_IPIC_MSI) += ipic_msi.o
> >  obj-$(CONFIG_4xx)  += uic.o
> >  obj-$(CONFIG_XILINX_VIRTEX)+= xilinx_intc.o
> >  endif
> > diff --git a/arch/powerpc/sysdev/ipic_msi.c b/arch/powerpc/sysdev/ipic_msi.c
> > new file mode 100644
> > index 000..57758f7
> > --- /dev/null
> > +++ b/arch/powerpc/sysdev/ipic_msi.c
> > @@ -0,0 +1,359 @@
> > +/*
> > + * arch/powerpc/sysdev/ipic_msi.c
> > + *
> > + * IPIC MSI routines implementations.
> > + *
> > + * Auther: Tony Li <[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 as published by the
> > + * Free Software Foundation;  either version 2 of the  License, or (at your
> > + * option) any later version.
> > + */
> > +
> > +
> > +#include 
> > +#include 
> > +#include 
> > +
> > +#include 
> > +
> > +#define MSIR0  0x43
> > +#define MSIR1  0x4
> > +#define MSIR2  0x51
> > +#define MSIR3  0x52
> > +#define MSIR4  0x56
> > +#define MSIR5  0x57
> > +#define MSIR6  0x58
> > +#define MSIR7  0x59
> > +
> > +
> > +static struct ipic_msi *ipic_msi;
> > +static DEFINE_SPINLOCK(ipic_msi_lock);
> > +static DEFINE_SPINLOCK(ipic_msi_bitmap_lock);
> > +
> > +static inline u32 ipic_msi_read(volatile u32 __iomem *base, unsigned int 
> > reg)
> > +{
> > +   return in_be32(base + (reg >> 2));
> > +}
> > +
> > +static inline void ipic_msi_write(volatile u32 __iomem *base,
> > +   unsigned int reg, u32 value)
> > +{
> > +   out_be32(base + (reg >> 2), value);
> > +}
> > +
> > +static struct ipic_msi * ipic_msi_from_irq(unsigned int virq)
> > +{
> > +   return ipic_msi;
> > +}
> > +
> > +#defineipic_msi_irq_to_hw(virq)((unsigned 
> > int)irq_map[virq].hwirq)
> 
> What's wrong with virq_to_hw() ?
> 

viqr_to_hw is not __inline__.

> 
> > +static void ipic_msi_unmask(unsigned int virq)
> > +{
> > +   struct ipic_msi *msi = ipic_msi_from_irq(virq);
> > +   unsigned int src = ipic_msi_irq_to_hw(virq);
> > +   unsigned long flags;
> > +   u32 temp;
> > +
> > +   spin_lock_irqsave(&ipic_msi_lock, flags);
> > +   temp = ipic_msi_read(msi->regs, IPIC_MSIMR);
> > +   ipic_msi_write(msi->regs, IPIC_MSIMR,
> > +   temp & ~(1 << (src / msi->int_per_msir)));
> > +
> > +   spin_unlock_irqrestore(&ipic_msi_lock, flags);
> > +}
> > +
> > +static void ipic_msi_mask(unsigned int virq)
> > +{
> > +   struct ipic_msi *msi = ipic_msi_from_irq(virq);
> > +   unsigned int src = ipic_msi_irq_to_hw(virq);
> > +   unsigned long flags;
> > +   u32 temp;
> > +
> > +   spin_lock_irqsave(&ipic_msi_lock, flags);
> > +
> > +   temp = ipic_msi_read(msi->regs, IPIC_MSIMR);
> > +   ipic_msi_write(msi->regs, IPIC_MSIMR,
> > +   temp | (1 << (src / msi->int_per_msir)));
> > +
> > +   spin_unlock_irqrestore(&ipic_msi_lock, flags);
> > +}
> > +/*
> > + * We do not need this actually. The MSIR register has been read once
> > + * in ipic_msi_get_irq. So, this MSI interrupt has been acked
> > + */
> > +static void ipi

[PATCH] ipic: change ack operation that register is accessed only when needed

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

Signed-off-by: Li Yang <[EMAIL PROTECTED]>
---
Replaces patch:  [PATCH 7/9] ipic: clean up unsupported ack operations

 arch/powerpc/sysdev/ipic.c |  107 +++
 arch/powerpc/sysdev/ipic.h |3 +-
 2 files changed, 39 insertions(+), 71 deletions(-)

diff --git a/arch/powerpc/sysdev/ipic.c b/arch/powerpc/sysdev/ipic.c
index 7168b03..388fa59 100644
--- a/arch/powerpc/sysdev/ipic.c
+++ b/arch/powerpc/sysdev/ipic.c
@@ -34,7 +34,6 @@ static DEFINE_SPINLOCK(ipic_lock);
 
 static struct ipic_info ipic_info[] = {
[1] = {
-   .pend   = IPIC_SIPNR_H,
.mask   = IPIC_SIMSR_H,
.prio   = IPIC_SIPRR_C,
.force  = IPIC_SIFCR_H,
@@ -42,7 +41,6 @@ static struct ipic_info ipic_info[] = {
.prio_mask = 0,
},
[2] = {
-   .pend   = IPIC_SIPNR_H,
.mask   = IPIC_SIMSR_H,
.prio   = IPIC_SIPRR_C,
.force  = IPIC_SIFCR_H,
@@ -50,7 +48,6 @@ static struct ipic_info ipic_info[] = {
.prio_mask = 1,
},
[4] = {
-   .pend   = IPIC_SIPNR_H,
.mask   = IPIC_SIMSR_H,
.prio   = IPIC_SIPRR_C,
.force  = IPIC_SIFCR_H,
@@ -58,7 +55,6 @@ static struct ipic_info ipic_info[] = {
.prio_mask = 3,
},
[9] = {
-   .pend   = IPIC_SIPNR_H,
.mask   = IPIC_SIMSR_H,
.prio   = IPIC_SIPRR_D,
.force  = IPIC_SIFCR_H,
@@ -66,7 +62,6 @@ static struct ipic_info ipic_info[] = {
.prio_mask = 0,
},
[10] = {
-   .pend   = IPIC_SIPNR_H,
.mask   = IPIC_SIMSR_H,
.prio   = IPIC_SIPRR_D,
.force  = IPIC_SIFCR_H,
@@ -74,7 +69,6 @@ static struct ipic_info ipic_info[] = {
.prio_mask = 1,
},
[11] = {
-   .pend   = IPIC_SIPNR_H,
.mask   = IPIC_SIMSR_H,
.prio   = IPIC_SIPRR_D,
.force  = IPIC_SIFCR_H,
@@ -82,7 +76,6 @@ static struct ipic_info ipic_info[] = {
.prio_mask = 2,
},
[12] = {
-   .pend   = IPIC_SIPNR_H,
.mask   = IPIC_SIMSR_H,
.prio   = IPIC_SIPRR_D,
.force  = IPIC_SIFCR_H,
@@ -90,7 +83,6 @@ static struct ipic_info ipic_info[] = {
.prio_mask = 3,
},
[13] = {
-   .pend   = IPIC_SIPNR_H,
.mask   = IPIC_SIMSR_H,
.prio   = IPIC_SIPRR_D,
.force  = IPIC_SIFCR_H,
@@ -98,7 +90,6 @@ static struct ipic_info ipic_info[] = {
.prio_mask = 4,
},
[14] = {
-   .pend   = IPIC_SIPNR_H,
.mask   = IPIC_SIMSR_H,
.prio   = IPIC_SIPRR_D,
.force  = IPIC_SIFCR_H,
@@ -106,7 +97,6 @@ static struct ipic_info ipic_info[] = {
.prio_mask = 5,
},
[15] = {
-   .pend   = IPIC_SIPNR_H,
.mask   = IPIC_SIMSR_H,
.prio   = IPIC_SIPRR_D,
.force  = IPIC_SIFCR_H,
@@ -114,7 +104,6 @@ static struct ipic_info ipic_info[] = {
.prio_mask = 6,
},
[16] = {
-   .pend   = IPIC_SIPNR_H,
.mask   = IPIC_SIMSR_H,
.prio   = IPIC_SIPRR_D,
.force  = IPIC_SIFCR_H,
@@ -122,7 +111,7 @@ static struct ipic_info ipic_info[] = {
.prio_mask = 7,
},
[17] = {
-   .pend   = IPIC_SEPNR,
+   .ack= IPIC_SEPNR,
.mask   = IPIC_SEMSR,
.prio   = IPIC_SMPRR_A,
.force  = IPIC_SEFCR,
@@ -130,7 +119,7 @@ static struct ipic_info ipic_info[] = {
.prio_mask = 5,
},
[18] = {
-   .pend   = IPIC_SEPNR,
+   .ack= IPIC_SEPNR,
.mask   = IPIC_SEMSR,
.prio   = IPIC_SMPRR_A,
.force  = IPIC_SEFCR,
@@ -138,7 +127,7 @@ static struct ipic_info ipic_info[] = {
.prio_mask = 6,
},
[19] = {
-   .pend   = IPIC_SEPNR,
+   .ack= IPIC_SEPNR,
.mask   = IPIC_SEMSR,
.prio   = IPIC_SMPRR_A,
.force  = IPIC_SEFCR,
@@ -146,7 +135,7 @@ static struct ipic_info ipic_info[] = {
.prio_mask = 7,
},
[20] = {
-   .pend   = IPIC_SEPNR,
+   .ack= IPIC_SEPNR,
.mask   = IPIC_SEMSR,
.prio   = IPIC_SMPRR_B,
.force  = IPIC_SEFCR,
@@ -154,7 +143,7 @@ static struct ip

[PATCH] add MPC837x MDS default kernel configuration

2007-12-03 Thread Li Yang
Signed-off-by: Li Yang <[EMAIL PROTECTED]>
---
Updated to remove CONFIG_SERDES.

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

diff --git a/arch/powerpc/configs/mpc837x_mds_defconfig 
b/arch/powerpc/configs/mpc837x_mds_defconfig
new file mode 100644
index 000..36659a4
--- /dev/null
+++ b/arch/powerpc/configs/mpc837x_mds_defconfig
@@ -0,0 +1,875 @@
+#
+# Automatically generated make config: don't edit
+# Linux kernel version: 2.6.24-rc3
+# Mon Dec  3 20:14:53 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_83xx=y
+CONFIG_PPC_FPU=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_PPC32=y
+CONFIG_WORD_SIZE=32
+CONFIG_PPC_MERGE=y
+CONFIG_MMU=y
+CONFIG_GENERIC_CMOS_UPDATE=y
+CONFIG_GENERIC_TIME=y
+CONFIG_GENERIC_TIME_VSYSCALL=y
+CONFIG_GENERIC_CLOCKEVENTS=y
+CONFIG_GENERIC_HARDIRQS=y
+CONFIG_IRQ_PER_CPU=y
+CONFIG_RWSEM_XCHGADD_ALGORITHM=y
+CONFIG_ARCH_HAS_ILOG2_U32=y
+CONFIG_GENERIC_HWEIGHT=y
+CONFIG_GENERIC_CALIBRATE_DELAY=y
+CONFIG_GENERIC_FIND_NEXT_BIT=y
+# CONFIG_ARCH_NO_VIRT_TO_BUS is not set
+CONFIG_PPC=y
+CONFIG_EARLY_PRINTK=y
+CONFIG_GENERIC_NVRAM=y
+CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y
+CONFIG_ARCH_MAY_HAVE_PC_FDC=y
+CONFIG_PPC_OF=y
+CONFIG_OF=y
+CONFIG_PPC_UDBG_16550=y
+# CONFIG_GENERIC_TBSYNC is not set
+CONFIG_AUDIT_ARCH=y
+CONFIG_GENERIC_BUG=y
+CONFIG_DEFAULT_UIMAGE=y
+# CONFIG_PPC_DCR_NATIVE is not set
+# CONFIG_PPC_DCR_MMIO is not set
+CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
+
+#
+# General setup
+#
+CONFIG_EXPERIMENTAL=y
+CONFIG_BROKEN_ON_SMP=y
+CONFIG_INIT_ENV_ARG_LIMIT=32
+CONFIG_LOCALVERSION=""
+CONFIG_LOCALVERSION_AUTO=y
+CONFIG_SWAP=y
+CONFIG_SYSVIPC=y
+CONFIG_SYSVIPC_SYSCTL=y
+# CONFIG_POSIX_MQUEUE is not set
+# CONFIG_BSD_PROCESS_ACCT is not set
+# CONFIG_TASKSTATS is not set
+# CONFIG_USER_NS is not set
+# CONFIG_PID_NS is not set
+# CONFIG_AUDIT is not set
+# CONFIG_IKCONFIG is not set
+CONFIG_LOG_BUF_SHIFT=14
+# CONFIG_CGROUPS is not set
+CONFIG_FAIR_GROUP_SCHED=y
+CONFIG_FAIR_USER_SCHED=y
+# CONFIG_FAIR_CGROUP_SCHED is not set
+CONFIG_SYSFS_DEPRECATED=y
+# CONFIG_RELAY is not set
+CONFIG_BLK_DEV_INITRD=y
+CONFIG_INITRAMFS_SOURCE=""
+# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
+CONFIG_SYSCTL=y
+CONFIG_EMBEDDED=y
+CONFIG_SYSCTL_SYSCALL=y
+CONFIG_KALLSYMS=y
+# CONFIG_KALLSYMS_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 is not set
+CONFIG_SIGNALFD=y
+CONFIG_EVENTFD=y
+CONFIG_SHMEM=y
+CONFIG_VM_EVENT_COUNTERS=y
+CONFIG_SLAB=y
+# CONFIG_SLUB is not set
+# CONFIG_SLOB is not set
+CONFIG_RT_MUTEXES=y
+# CONFIG_TINY_SHMEM is not set
+CONFIG_BASE_SMALL=0
+CONFIG_MODULES=y
+CONFIG_MODULE_UNLOAD=y
+# CONFIG_MODULE_FORCE_UNLOAD is not set
+# CONFIG_MODVERSIONS is not set
+# CONFIG_MODULE_SRCVERSION_ALL is not set
+# CONFIG_KMOD is not set
+CONFIG_BLOCK=y
+# CONFIG_LBD is not set
+# CONFIG_BLK_DEV_IO_TRACE is not set
+# CONFIG_LSF is not set
+# CONFIG_BLK_DEV_BSG is not set
+
+#
+# IO Schedulers
+#
+CONFIG_IOSCHED_NOOP=y
+CONFIG_IOSCHED_AS=y
+CONFIG_IOSCHED_DEADLINE=y
+CONFIG_IOSCHED_CFQ=y
+CONFIG_DEFAULT_AS=y
+# CONFIG_DEFAULT_DEADLINE is not set
+# CONFIG_DEFAULT_CFQ is not set
+# CONFIG_DEFAULT_NOOP is not set
+CONFIG_DEFAULT_IOSCHED="anticipatory"
+
+#
+# Platform support
+#
+# CONFIG_PPC_MULTIPLATFORM is not set
+# CONFIG_PPC_82xx is not set
+CONFIG_PPC_83xx=y
+# CONFIG_PPC_86xx is not set
+# CONFIG_PPC_MPC52xx is not set
+# CONFIG_PPC_MPC5200 is not set
+# CONFIG_PPC_CELL is not set
+# CONFIG_PPC_CELL_NATIVE is not set
+# CONFIG_PQ2ADS is not set
+# CONFIG_MPC8313_RDB is not set
+# CONFIG_MPC832x_MDS is not set
+# CONFIG_MPC832x_RDB is not set
+# CONFIG_MPC834x_MDS is not set
+# CONFIG_MPC834x_ITX is not set
+# CONFIG_MPC836x_MDS is not set
+CONFIG_MPC837x_MDS=y
+CONFIG_PPC_MPC837x=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_CPM2 is not set
+# CONFIG_FSL_ULI1575 is not set
+
+#
+# Kernel options
+#
+# CONFIG_HIGHMEM is not set
+# CONFIG_TICK_ONESHOT is not set
+# CONFIG_NO_HZ is not set
+# CONFIG_HIGH_RES_TIMERS is not set
+CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
+# CONFIG_HZ_100 is not set
+CONFIG_HZ_250=y
+# CONFIG_HZ_300 is not set
+# CONFIG_HZ_1000 is not set
+CONFIG_HZ=250
+CONFIG_PREEMPT_NONE=y
+# CONFIG_PREEMPT_VOLUNTARY is not set
+# CONFIG_PREEMPT is not set
+CONFIG_BINFMT_ELF=y
+# CON

Re: for-2.6.25 branch created in powerpc.git

2007-12-03 Thread Jon Loeliger
So, like, the other day Paul Mackerras mumbled:
> I have created a for-2.6.25 branch in my powerpc.git repository and
> added the patches listed below to it.  The master branch points to the
> same place as the for-2.6.25 branch.
> 
> Paul.
> 
> Benjamin Herrenschmidt (2):
> Johannes Berg (3):
> Linas Vepstas (3):
> Nathan Lynch (1):
> Stephen Rothwell (5):
> [EMAIL PROTECTED] (2):

Paul,

Could you please add these two:

http://patchwork.ozlabs.org/linuxppc/patch?id=14713
http://patchwork.ozlabs.org/linuxppc/patch?id=14714

and possibly this Cell variant:

http://patchwork.ozlabs.org/linuxppc/patch?id=14712

if Arnd doesn't get to it.   Kumar has picked up the 8xxx
variant already, and Josh has grabbed 4xx version has already
been applied.

Please let me know if rebasing is needed.

Thanks,
jdl

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


Re: for-2.6.25 branch created in powerpc.git

2007-12-03 Thread Josh Boyer
On Mon, 3 Dec 2007 15:45:50 +1100
Paul Mackerras <[EMAIL PROTECTED]> wrote:

> I have created a for-2.6.25 branch in my powerpc.git repository and
> added the patches listed below to it.  The master branch points to the
> same place as the for-2.6.25 branch.

Are we going to merge DTC into the kernel?  If so, can we get that in
this branch soon-ish, and with a version that supports dts-v1 files?

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


Re: for-2.6.25 branch created in powerpc.git

2007-12-03 Thread Josh Boyer
On Mon, 03 Dec 2007 16:16:39 +1100
Benjamin Herrenschmidt <[EMAIL PROTECTED]> wrote:

> 
> On Mon, 2007-12-03 at 15:45 +1100, Paul Mackerras wrote:
> >   [POWERPC] Add xmon function to dump 44x TLB
> 
> That will go via jwb, there's already some updated versions of that in
> my tree.

Just send me an incremental version.  If it's already in Paul's tree, I
don't really see a reason to play the revert and reapply game.

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


Re: [PPC BOOT] Find device-tree source file in default directory.

2007-12-03 Thread David Woodhouse

On Mon, 2007-12-03 at 09:08 -0600, Scott Wood wrote:
> Shouldn't this be $srctree (which doesn't seem to be passed to wrapper at
> the moment), not $object?
> 
> BTW, if we do this, we should remove the part in arch/powerpc/boot/Makefile
> where this is done.

It wasn't really done for the benefit of the in-kernel invocation -- it
was done so that the installed standalone copy of the wrapper doesn't
need a full path.

We _could_ make the in-kernel setup use it -- but then you just have to
pass the directory as a separate argument, instead of prepending it to
the name of the dts file, as you observe... so there didn't seem to be a
lot of point.

-- 
dwmw2

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


Re: [PPC BOOT] Find device-tree source file in default directory.

2007-12-03 Thread Scott Wood
On Mon, Dec 03, 2007 at 02:49:24AM +, David Woodhouse wrote:
> If a .dts file is given to the bootwrapper script without a full path
> name, look in a sensible place for it.
> 
> Signed-off-by: David Woodhouse <[EMAIL PROTECTED]>
> 
> --- a/arch/powerpc/boot/wrapper
> +++ b/arch/powerpc/boot/wrapper
> @@ -116,6 +118,9 @@ while [ "$#" -gt 0 ]; do
>  done
>  
>  if [ -n "$dts" ]; then
> +if [ ! -r "$dts" -a -r "$object/dts/$dts" ]; then
> + dts="$object/dts/$dts"
> +fi
>  if [ -z "$dtb" ]; then
>   dtb="$platform.dtb"
>  fi

Shouldn't this be $srctree (which doesn't seem to be passed to wrapper at
the moment), not $object?

BTW, if we do this, we should remove the part in arch/powerpc/boot/Makefile
where this is done.

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


[PATCH] Generic RTC class support for ppc_md.[gs]et_rtc_time

2007-12-03 Thread David Woodhouse
It would be good to migrate the platform code to register RTC devices
directly, but for now this will make them functional enough for most
purposes...

Signed-off-by: David Woodhouse <[EMAIL PROTECTED]>

diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig
index 1e6715e..3e788b7 100644
--- a/drivers/rtc/Kconfig
+++ b/drivers/rtc/Kconfig
@@ -461,4 +461,12 @@ config RTC_DRV_RS5C313
help
  If you say yes here you get support for the Ricoh RS5C313 RTC chips.
 
+config RTC_DRV_PPC
+   tristate "PowerPC machine dependent RTC support"
+   depends on PPC_MERGE
+   help
+ The PowerPC kernel has machine-specific functions for accessing
+the RTC. This exposes that functionality through the generic RTC
+class.
+
 endif # RTC_CLASS
diff --git a/drivers/rtc/Makefile b/drivers/rtc/Makefile
index 465db4d..e822e56 100644
--- a/drivers/rtc/Makefile
+++ b/drivers/rtc/Makefile
@@ -49,3 +49,4 @@ obj-$(CONFIG_RTC_DRV_TEST)+= rtc-test.o
 obj-$(CONFIG_RTC_DRV_V3020)+= rtc-v3020.o
 obj-$(CONFIG_RTC_DRV_VR41XX)   += rtc-vr41xx.o
 obj-$(CONFIG_RTC_DRV_X1205)+= rtc-x1205.o
+obj-$(CONFIG_RTC_DRV_PPC)  += rtc-ppc.o
--- /dev/null   2007-12-03 03:08:41.854157978 +
+++ b/drivers/rtc/rtc-ppc.c 2007-12-03 16:56:15.0 +
@@ -0,0 +1,69 @@
+/*
+ * RTC driver for ppc_md RTC functions
+ *
+ * © 2007 Red Hat, Inc.
+ *
+ * Author: David Woodhouse <[EMAIL PROTECTED]>
+ *
+ * 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 
+#include 
+#include 
+#include 
+#include 
+
+static int ppc_rtc_read_time(struct device *dev, struct rtc_time *tm)
+{
+   ppc_md.get_rtc_time(tm);
+   return 0;
+}
+
+static int ppc_rtc_set_time(struct device *dev, struct rtc_time *tm)
+{
+   return ppc_md.set_rtc_time(tm);
+}
+
+static const struct rtc_class_ops ppc_rtc_ops = {
+   .set_time = ppc_rtc_set_time,
+   .read_time = ppc_rtc_read_time,
+};
+
+static struct rtc_device *rtc;
+static struct platform_device *ppc_rtc_pdev;
+
+static int __init ppc_rtc_init(void)
+{
+   if (!ppc_md.get_rtc_time || !ppc_md.set_rtc_time)
+   return -ENODEV;
+
+   ppc_rtc_pdev = platform_device_register_simple("ppc-rtc", 0, NULL, 0);
+   if (IS_ERR(ppc_rtc_pdev))
+   return PTR_ERR(ppc_rtc_pdev);
+
+   rtc = rtc_device_register("ppc_md", &ppc_rtc_pdev->dev,
+ &ppc_rtc_ops, THIS_MODULE);
+   if (IS_ERR(rtc)) {
+   platform_device_unregister(ppc_rtc_pdev);
+   return PTR_ERR(rtc);
+   }
+
+   return 0;
+}
+
+static void __exit ppc_rtc_exit(void)
+{
+   rtc_device_unregister(rtc);
+   platform_device_unregister(ppc_rtc_pdev);
+}
+
+module_init(ppc_rtc_init);
+module_exit(ppc_rtc_exit);
+
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("David Woodhouse <[EMAIL PROTECTED]>");
+MODULE_DESCRIPTION("Generic RTC class driver for PowerPC");

-- 
dwmw2

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

[PATCH] [POWERPC] Improved documentation of device tree 'ranges'.

2007-12-03 Thread Stephen Neuendorffer
I was misled by the prior language.  I've attempted to clarify how
'ranges' are used, in particular, how to get a 1:1 mapping.

Signed-off-by: Stephen Neuendorffer <[EMAIL PROTECTED]>
---
 Documentation/powerpc/booting-without-of.txt |   11 +++
 1 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/Documentation/powerpc/booting-without-of.txt 
b/Documentation/powerpc/booting-without-of.txt
index e9a3cb1..aad8bf5 100644
--- a/Documentation/powerpc/booting-without-of.txt
+++ b/Documentation/powerpc/booting-without-of.txt
@@ -711,13 +711,14 @@ define a bus type with a more complex address format, 
including things
 like address space bits, you'll have to add a bus translator to the
 prom_parse.c file of the recent kernels for your bus type.
 
-The "reg" property only defines addresses and sizes (if #size-cells
-is non-0) within a given bus. In order to translate addresses upward
+The "reg" property only defines addresses and sizes (if #size-cells is
+non-0) within a given bus. In order to translate addresses upward
 (that is into parent bus addresses, and possibly into CPU physical
 addresses), all busses must contain a "ranges" property. If the
 "ranges" property is missing at a given level, it's assumed that
-translation isn't possible. The format of the "ranges" property for a
-bus is a list of:
+translation isn't possible, i.e., the registers are not visible on the
+parent bus.  The format of the "ranges" property for a bus is a list
+of:
 
bus address, parent bus address, size
 
@@ -735,6 +736,8 @@ fit in a single 32-bit word.   New 32-bit powerpc boards 
should use a
 1/1 format, unless the processor supports physical addresses greater
 than 32-bits, in which case a 2/1 format is recommended.
 
+Alternatively, the "ranges" property may be empty, indicating that the
+registers are visible on the parent bus, with 1:1 address translation.
 
 2) Note about "compatible" properties
 -
-- 
1.5.3.4



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


Re: [PATCH] [POWERPC] Improved documentation of device tree 'ranges'.

2007-12-03 Thread Grant Likely
On 12/3/07, Stephen Neuendorffer <[EMAIL PROTECTED]> wrote:
> I was misled by the prior language.  I've attempted to clarify how
> 'ranges' are used, in particular, how to get a 1:1 mapping.
>
> Signed-off-by: Stephen Neuendorffer <[EMAIL PROTECTED]>

Acked-by: Grant Likely <[EMAIL PROTECTED]>

> ---
>  Documentation/powerpc/booting-without-of.txt |   11 +++
>  1 files changed, 7 insertions(+), 4 deletions(-)
>
> diff --git a/Documentation/powerpc/booting-without-of.txt 
> b/Documentation/powerpc/booting-without-of.txt
> index e9a3cb1..aad8bf5 100644
> --- a/Documentation/powerpc/booting-without-of.txt
> +++ b/Documentation/powerpc/booting-without-of.txt
> @@ -711,13 +711,14 @@ define a bus type with a more complex address format, 
> including things
>  like address space bits, you'll have to add a bus translator to the
>  prom_parse.c file of the recent kernels for your bus type.
>
> -The "reg" property only defines addresses and sizes (if #size-cells
> -is non-0) within a given bus. In order to translate addresses upward
> +The "reg" property only defines addresses and sizes (if #size-cells is
> +non-0) within a given bus. In order to translate addresses upward
>  (that is into parent bus addresses, and possibly into CPU physical
>  addresses), all busses must contain a "ranges" property. If the
>  "ranges" property is missing at a given level, it's assumed that
> -translation isn't possible. The format of the "ranges" property for a
> -bus is a list of:
> +translation isn't possible, i.e., the registers are not visible on the
> +parent bus.  The format of the "ranges" property for a bus is a list
> +of:
>
> bus address, parent bus address, size
>
> @@ -735,6 +736,8 @@ fit in a single 32-bit word.   New 32-bit powerpc boards 
> should use a
>  1/1 format, unless the processor supports physical addresses greater
>  than 32-bits, in which case a 2/1 format is recommended.
>
> +Alternatively, the "ranges" property may be empty, indicating that the
> +registers are visible on the parent bus, with 1:1 address translation.
>
>  2) Note about "compatible" properties
>  -
> --
> 1.5.3.4
>
>
>
>


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


Re: [PATCH 1/5] PowerPC 74xx: Katana Qp device tree

2007-12-03 Thread Jon Loeliger
On Sun, 2007-12-02 at 19:50, David Gibson wrote:

> > +   clock-frequency = <7f28155>;/* 133.33 MHz */
> You can use  to avoid the ugly hex.

Better still, blaze a new trail, convert it to /dts-v1/ and
use clock-frequency = <1> straight up!


jdl


___
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

2007-12-03 Thread Linas Vepstas
On Thu, Nov 29, 2007 at 11:41:47AM +0100, Olaf Hering wrote:
> 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, 

It should printout the "Rebooting in timeout_wait seconds ..."
Then it should wait timeout_wait number of seconds, as usual,
and *then* call the hypervisor.

> simply because it calls into the hypervisor (or whatever).

The hypervisor is not supposed to return at this point. Its supposed
to reboot. Appearently, its not rebooting. Either we are using it 
wrong, or the hypervisor is buggy on some systems. It did work on 
the machines I was on; but I did not try power5's or blades.

> So, please restore the panic_timeout check.

The problem with this check was that was that the value was never 
ever set, and so the branch was never ever taken. 

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


Re: [PATCH] Generic RTC class support for ppc_md.[gs]et_rtc_time

2007-12-03 Thread Benjamin Herrenschmidt

On Mon, 2007-12-03 at 17:04 +, David Woodhouse wrote:
> It would be good to migrate the platform code to register RTC devices
> directly, but for now this will make them functional enough for most
> purposes...

Wouldn't it be best to do the other way around at some stage ?

We need to solve the problem of ppc_md. stuff being called by the core
in atomic contexts first though.

Ben.
 

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


Re: [PATCH 1/5] PowerPC 74xx: Katana Qp device tree

2007-12-03 Thread Benjamin Herrenschmidt
>   #address-cells = <1>;
> + #size-cells = <1>;
> + model = "Katana-Qp"; /* Default */
> + compatible = "emerson,Katana-Qp";
> + coherency-off;
> +

What do that mean (coherency-off) ?

Somebody is trying again to use a 74xx with non cache coherent DMA ?
That isn't going to fly...

Ben.
 

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


Re: [PATCH 4/5] PowerPC 74xx: Katana Qp base support

2007-12-03 Thread Benjamin Herrenschmidt

On Thu, 2007-11-29 at 18:42 +0300, Andrei Dolnikov wrote:
> +config PPC_KATANAQP
> +   bool "Emerson-Katana Qp"
> +   depends on EMBEDDED6xx
> +   select MV64X60
> +   select NOT_COHERENT_CACHE
 ^^

Just one word: ARG !

Oh and another one: WHY ?

Ben.


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


[PATCH] Fix 8xx compile errors

2007-12-03 Thread John Tyner
Building for 8xx fails to compile due to errors in a couple of places. 
The first is due to the casting of an lvalue (if I remember correctly), 
and the second was due to the cpmp variable being declared static even 
though the headers previously defined it as extern. The following patch 
corrects these errors. The patch is against 2.4 since that's what I'm 
working with. (I've been unable to get 2.6 to run properly on my 
hardware so far.)

Please CC me on any responses since I'm not subscribed.

Thanks,
John


diff -ruNa linux-2.4.35.4.orig/arch/ppc/8xx_io/uart.c 
linux-2.4.35.4/arch/ppc/8xx_io/uart.c
--- linux-2.4.35.4.orig/arch/ppc/8xx_io/uart.c  2007-11-17 09:23:15.0 
-0800
+++ linux-2.4.35.4/arch/ppc/8xx_io/uart.c   2007-11-27 11:28:09.0 
-0800
@@ -2292,7 +2292,8 @@
 
/* Get the address of the host memory buffer.*/
info = &consinfo;
-   info->tx_bd_base = (cbd_t *)bdbase = (cbd_t 
*)&cpmp->cp_dpmem[up->smc_tbase];
+   bdbase = (cbd_t *)&cpmp->cp_dpmem[up->smc_tbase];
+   info->tx_bd_base = (cbd_t *)bdbase;
info->tx_cur = (cbd_t *)bdbase;
}
max_tx_size = console_tx_buf_len;
diff -ruNa linux-2.4.35.4.orig/arch/ppc/boot/simple/m8xx_tty.c 
linux-2.4.35.4/arch/ppc/boot/simple/m8xx_tty.c
--- linux-2.4.35.4.orig/arch/ppc/boot/simple/m8xx_tty.c 2007-11-17 
09:23:15.0 -0800
+++ linux-2.4.35.4/arch/ppc/boot/simple/m8xx_tty.c  2007-11-27 
11:28:42.0 -0800
@@ -30,7 +30,7 @@
 #define SMC_INDEX  0
 #endif
 
-static cpm8xx_t*cpmp = (cpm8xx_t *)&(((immap_t *)IMAP_ADDR)->im_cpm);
+cpm8xx_t   *cpmp = (cpm8xx_t *)&(((immap_t *)IMAP_ADDR)->im_cpm);
 
 unsigned long
 serial_init(int ignored, bd_t *bd)
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev

Re: [PATCH] ipic: change ack operation that register is accessed only when needed

2007-12-03 Thread Benjamin Herrenschmidt

>  static void ipic_ack_irq(unsigned int virq)
>  {
> - struct ipic *ipic = ipic_from_irq(virq);
>   unsigned int src = ipic_irq_to_hw(virq);
> - unsigned long flags;
> - u32 temp;
>  
> - spin_lock_irqsave(&ipic_lock, flags);
> + /* Only external interrupts in edge mode support ACK */
> + if (unlikely(ipic_info[src].ack &&
> + ((get_irq_desc(virq)->status & IRQ_TYPE_SENSE_MASK) ==
> + IRQ_TYPE_EDGE_FALLING))) {
> + struct ipic *ipic = ipic_from_irq(virq);
> + unsigned long flags;
> + u32 temp;
>  
> - temp = ipic_read(ipic->regs, ipic_info[src].pend);
> - temp |= (1 << (31 - ipic_info[src].bit));
> - ipic_write(ipic->regs, ipic_info[src].pend, temp);
> + spin_lock_irqsave(&ipic_lock, flags);
>  
> - spin_unlock_irqrestore(&ipic_lock, flags);
> + temp = ipic_read(ipic->regs, ipic_info[src].ack);
> + temp |= (1 << (31 - ipic_info[src].bit));
> + ipic_write(ipic->regs, ipic_info[src].ack, temp);
> +
> + spin_unlock_irqrestore(&ipic_lock, flags);
> + }
>  }

That doesn't look right... 

That should be handled by the higher level flow handler. The generic
edge one calls ack and the level one mask_and_ack. Just make them do the
right thing, no need to test for the flow type in the low level
function.

Ben.


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


Re: [PATCH] Add IPIC MSI interrupt support

2007-12-03 Thread Benjamin Herrenschmidt

On Mon, 2007-12-03 at 17:07 +0800, Li Li wrote:
> 
> In IPIC, the 8 MSI interrupts is handled as level intrrupt.
> I just provide a versatile in case it is changed.

Level ? Are you sure ? MSIs are by definition edge interrupts... Or do
you have some weird logic that asserts a level input until you go ack
something ? Sounds weird...

Ben.


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


[PATCH] Make QSpan PCI work

2007-12-03 Thread John Tyner
The following patch makes the QSpan PCI code compile and work on my 
hardware. The patch is against 2.4, but I'm hoping it will still be viewed 
as useful since the code currently does not even compile (2.6 is the 
same). I had to make a change to move the PCI setup later in the 
m8xx_setup code as well because the kernel would crash during the 
pcibios_alloc_controller because the bootmem stuff had not come up yet.

Please CC me on any responses since I'm not subscribed.

Thanks,
John
diff -ruNa linux-2.4.35.4.orig/arch/ppc/kernel/m8xx_setup.c 
linux-2.4.35.4/arch/ppc/kernel/m8xx_setup.c
--- linux-2.4.35.4.orig/arch/ppc/kernel/m8xx_setup.c2007-11-17 
09:23:15.0 -0800
+++ linux-2.4.35.4/arch/ppc/kernel/m8xx_setup.c 2007-11-29 14:38:41.0 
-0800
@@ -65,6 +65,10 @@
 {
int cpm_page;
 
+#ifdef CONFIG_PCI
+   m8xx_setup_pci_ptrs();
+#endif
+
cpm_page = (int) alloc_bootmem_pages(PAGE_SIZE);
 
/* Reset the Communication Processor Module.
@@ -364,10 +368,6 @@
if ( r3 )
memcpy( (void *)__res,(void *)(r3+KERNELBASE), sizeof(bd_t) );
 
-#ifdef CONFIG_PCI
-   m8xx_setup_pci_ptrs();
-#endif
-
 #ifdef CONFIG_BLK_DEV_INITRD
/* take care of initrd if we have one */
if ( r4 )
diff -ruNa linux-2.4.35.4.orig/arch/ppc/kernel/qspan_pci.c 
linux-2.4.35.4/arch/ppc/kernel/qspan_pci.c
--- linux-2.4.35.4.orig/arch/ppc/kernel/qspan_pci.c 2007-11-17 
09:23:15.0 -0800
+++ linux-2.4.35.4/arch/ppc/kernel/qspan_pci.c  2007-12-03 11:22:44.0 
-0800
@@ -28,6 +28,7 @@
 #include 
 #include 
 
+#include "qspan_pci.h"
 
 /*
  * This blows..
@@ -83,7 +84,7 @@
"   .align 2\n" \
"   .long 1b,3b\n"  \
".text" \
-   : "=r"(x) : "r"(addr) : " %0")
+   : "+r"(x) : "r"(addr) )
 
 #define QS_CONFIG_ADDR ((volatile uint *)(PCI_CSR_ADDR + 0x500))
 #define QS_CONFIG_DATA ((volatile uint *)(PCI_CSR_ADDR + 0x504))
@@ -94,8 +95,8 @@
 #define mk_config_type1(bus, dev, offset) \
mk_config_addr(bus, dev, offset) | 1;
 
-int qspan_pcibios_read_config_byte(unsigned char bus, unsigned char dev_fn,
- unsigned char offset, unsigned char *val)
+static int qspan_pcibios_read_config_byte(struct pci_dev * const dev,
+  int offset, u8 * const val)
 {
uinttemp;
u_char  *cp;
@@ -103,7 +104,7 @@
unsigned long flags;
 #endif
 
-   if ((bus > 7) || (dev_fn > 127)) {
+   if ((dev->bus->number > 7) || (dev->devfn > 127)) {
*val = 0xff;
return PCIBIOS_DEVICE_NOT_FOUND;
}
@@ -115,10 +116,10 @@
eieio();
 #endif
 
-   if (bus == 0)
-   *QS_CONFIG_ADDR = mk_config_addr(bus, dev_fn, offset);
+   if (dev->bus->number == 0)
+   *QS_CONFIG_ADDR = mk_config_addr(dev->bus->number, dev->devfn, 
offset);
else
-   *QS_CONFIG_ADDR = mk_config_type1(bus, dev_fn, offset);
+   *QS_CONFIG_ADDR = mk_config_type1(dev->bus->number, dev->devfn, 
offset);
__get_qspan_pci_config(temp, QS_CONFIG_DATA, "lwz");
 
 #ifdef CONFIG_RPXCLASSIC
@@ -133,8 +134,8 @@
return PCIBIOS_SUCCESSFUL;
 }
 
-int qspan_pcibios_read_config_word(unsigned char bus, unsigned char dev_fn,
- unsigned char offset, unsigned short *val)
+static int qspan_pcibios_read_config_word(struct pci_dev * const dev,
+  int offset, u16 * const val)
 {
uinttemp;
ushort  *sp;
@@ -142,7 +143,7 @@
unsigned long flags;
 #endif
 
-   if ((bus > 7) || (dev_fn > 127)) {
+   if ((dev->bus->number > 7) || (dev->devfn > 127)) {
*val = 0x;
return PCIBIOS_DEVICE_NOT_FOUND;
}
@@ -154,10 +155,10 @@
eieio();
 #endif
 
-   if (bus == 0)
-   *QS_CONFIG_ADDR = mk_config_addr(bus, dev_fn, offset);
+   if (dev->bus->number == 0)
+   *QS_CONFIG_ADDR = mk_config_addr(dev->bus->number, dev->devfn, 
offset);
else
-   *QS_CONFIG_ADDR = mk_config_type1(bus, dev_fn, offset);
+   *QS_CONFIG_ADDR = mk_config_type1(dev->bus->number, dev->devfn, 
offset);
__get_qspan_pci_config(temp, QS_CONFIG_DATA, "lwz");
offset ^= 0x02;
 
@@ -172,14 +173,14 @@
return PCIBIOS_SUCCESSFUL;
 }
 
-int qspan_pcibios_read_config_dword(unsigned char bus, unsigned char dev_fn,
-  unsigned char offset, unsigned int *val)
+static int qspan_pcibios_read_config_dword(struct pci_dev * const dev,
+   const int offset, u32 * const val)
 {
 #ifdef CONFIG_RPXCLASSIC
unsigned long flags;
 #endif
 
-   if ((bus > 7) || (dev_fn > 127)) {
+   if ((dev->bus->number > 7) || (dev->de

Re: [PATCH] Generic RTC class support for ppc_md.[gs]et_rtc_time

2007-12-03 Thread David Woodhouse
On Tue, 2007-12-04 at 07:45 +1100, Benjamin Herrenschmidt wrote:
> On Mon, 2007-12-03 at 17:04 +, David Woodhouse wrote:
> > It would be good to migrate the platform code to register RTC devices
> > directly, but for now this will make them functional enough for most
> > purposes...
> 
> Wouldn't it be best to do the other way around at some stage ?

Yes, definitely. We can migrate them one at a time to the RTC class.

> We need to solve the problem of ppc_md. stuff being called by the core
> in atomic contexts first though.

Where from?

-- 
dwmw2

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


Re: [BUG] 2.6.24-rc3-git2 softlockup detected

2007-12-03 Thread Andrew Morton
On Fri, 30 Nov 2007 12:58:06 +0530
Kamalesh Babulal <[EMAIL PROTECTED]> wrote:

> 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_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?
> >>
> > 
> > 
> > 
> > 
> > 
> > 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.
> 

There are effectively no drivers/scsi/ changes after 2.6.24-rc3 and we
don't (I believe) have a clue what caused this regression.

Can you please do a bisection search on this?

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


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

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

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

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

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

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

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

[PATCH 0/2] QE clock source improvements

2007-12-03 Thread Timur Tabi

This patch set adds a new property to make specifying QE clock sources
easier, adds a function to help parse the property, and updates the ucc_geth
driver to take advantage of all this.

Patch #1 is an arch/powerpc patch meant for Kumar's for-2.6.25 branch.
Patch #2 is a netdev patch, so it's either for Jeff G and/or Kumar.
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH 2/2] powerpc: make 64K huge pages more reliable

2007-12-03 Thread Jon Tollefson
David Gibson wrote:
> On Tue, Nov 27, 2007 at 11:03:16PM -0600, Jon Tollefson wrote:
>   
>> This patch adds reliability to the 64K huge page option by making use of 
>> the PMD for 64K huge pages when base pages are 4k.  So instead of a 12 
>> bit pte it would be 7 bit pmd and a 5 bit pte. The pgd and pud offsets 
>> would continue as 9 bits and 7 bits respectively.  This will allow the 
>> pgtable to fit in one base page.  This patch would have to be applied 
>> after part 1.
>> 
>
> Hrm.. shouldn't we just ban 64K hugepages on a 64K base page size
> setup?  There's not a whole lot of point to it, after all...
>   

Banning the base and huge page size from being the same size feels like
an artificial barrier.  It is probably not the most massively useful
combination, but it shouldn't hurt performance. 

Jon

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


[PATCH 1/2] qe: add function qe_clock_source()

2007-12-03 Thread Timur Tabi
Add function qe_clock_source() which takes a string containing the name of a
QE clock source (as is typically found in device trees) and returns the
matching enum qe_clock value.

Update booting-without-of.txt to indicate that the UCC properties rx-clock
and tx-clock are deprecated and replaced with rx-clock-name and tx-clock-name,
which use strings instead of numbers to indicate QE clock sources.

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

This patch applies to Kumar's for-2.6.25 branch.  You may need to apply
my other pending patch, "qe: add ability to upload QE firmware", first.

 Documentation/powerpc/booting-without-of.txt |   13 ++
 arch/powerpc/sysdev/qe_lib/qe.c  |   32 ++
 include/asm-powerpc/qe.h |1 +
 3 files changed, 46 insertions(+), 0 deletions(-)

diff --git a/Documentation/powerpc/booting-without-of.txt 
b/Documentation/powerpc/booting-without-of.txt
index e9a3cb1..c4342d3 100644
--- a/Documentation/powerpc/booting-without-of.txt
+++ b/Documentation/powerpc/booting-without-of.txt
@@ -1626,6 +1626,19 @@ platforms are moved over to use the 
flattened-device-tree model.
- interrupt-parent : the phandle for the interrupt controller that
  services interrupts for this device.
- pio-handle : The phandle for the Parallel I/O port configuration.
+   - rx-clock-name: the UCC receive clock source
+ "none": clock source is disabled
+ "brg1" through "brg16": clock source is BRG1-BRG16, respectively
+ "clk1" through "clk24": clock source is CLK1-CLK24, respectively
+   - tx-clock-name: the UCC transmit clock source
+ "none": clock source is disabled
+ "brg1" through "brg16": clock source is BRG1-BRG16, respectively
+ "clk1" through "clk24": clock source is CLK1-CLK24, respectively
+   The following two properties are deprecated.  rx-clock has been replaced
+   with rx-clock-name, and tx-clock has been replaced with tx-clock-name.
+   Drivers that currently use the deprecated properties should continue to
+   do so, in order to support older device trees, but they should be updated
+   to check for the new properties first.
- rx-clock : represents the UCC receive clock source.
  0x00 : clock source is disabled;
  0x1~0x10 : clock source is BRG1~BRG16 respectively;
diff --git a/arch/powerpc/sysdev/qe_lib/qe.c b/arch/powerpc/sysdev/qe_lib/qe.c
index 865277b..5df8530 100644
--- a/arch/powerpc/sysdev/qe_lib/qe.c
+++ b/arch/powerpc/sysdev/qe_lib/qe.c
@@ -204,6 +204,38 @@ int qe_setbrg(enum qe_clock brg, unsigned int rate, 
unsigned int multiplier)
 }
 EXPORT_SYMBOL(qe_setbrg);
 
+/* Convert a string to a QE clock source enum
+ *
+ * This function takes a string, typically from a property in the device
+ * tree, and returns the corresponding "enum qe_clock" value.
+*/
+enum qe_clock qe_clock_source(const char *source)
+{
+   unsigned int i;
+
+   if (strcasecmp(source, "none") == 0)
+   return QE_CLK_NONE;
+
+   if (strncasecmp(source, "brg", 3) == 0) {
+   i = simple_strtoul(source + 3, NULL, 10);
+   if ((i >= 1) && (i <= 16))
+   return (QE_BRG1 - 1) + i;
+   else
+   return QE_CLK_DUMMY;
+   }
+
+   if (strncasecmp(source, "clk", 3) == 0) {
+   i = simple_strtoul(source + 3, NULL, 10);
+   if ((i >= 1) && (i <= 24))
+   return (QE_CLK1 - 1) + i;
+   else
+   return QE_CLK_DUMMY;
+   }
+
+   return QE_CLK_DUMMY;
+}
+EXPORT_SYMBOL(qe_clock_source);
+
 /* 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 35c7b8d..430dc77 100644
--- a/include/asm-powerpc/qe.h
+++ b/include/asm-powerpc/qe.h
@@ -84,6 +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);
+enum qe_clock qe_clock_source(const char *source);
 int qe_setbrg(enum qe_clock brg, unsigned int rate, unsigned int multiplier);
 int qe_get_snum(void);
 void qe_put_snum(u8 snum);
-- 
1.5.2.4

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


[PATCH 3/4] Convert PowerPC MPC i2c to of_platform_driver from platform_driver

2007-12-03 Thread Jon Smirl
Convert MPC i2c driver from being a platform_driver to an open firmware 
version. Error returns were improved. Routine names were changed from fsl_ to 
mpc_ to make them match the file name.
---

 arch/powerpc/sysdev/fsl_soc.c |   96 -
 drivers/i2c/busses/i2c-mpc.c  |  185 +++--
 2 files changed, 123 insertions(+), 158 deletions(-)


diff --git a/arch/powerpc/sysdev/fsl_soc.c b/arch/powerpc/sysdev/fsl_soc.c
index e4c766e..d6ef264 100644
--- a/arch/powerpc/sysdev/fsl_soc.c
+++ b/arch/powerpc/sysdev/fsl_soc.c
@@ -318,102 +318,6 @@ err:
 
 arch_initcall(gfar_of_init);
 
-#ifdef CONFIG_I2C_BOARDINFO
-#include 
-
-static void __init of_register_i2c_devices(struct device_node *adap_node,
-  int bus_num)
-{
-   struct device_node *node = NULL;
-   const char *compatible;
-
-   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 "fsl_soc.c: invalid i2c device 
entry\n");
-   continue;
-   }
-
-   info.irq = irq_of_parse_and_map(node, 0);
-   if (info.irq == NO_IRQ)
-   info.irq = -1;
-
-   compatible = of_get_property(node, "compatible", &len);
-   if (!compatible) {
-   printk(KERN_WARNING "i2c-mpc.c: invalid entry, missing 
compatible attribute\n");
-   continue;
-   }
-   strncpy(info.driver_name, compatible, sizeof(info.driver_name));
-   
-   info.addr = *addr;
-
-   i2c_register_board_info(bus_num, &info, 1);
-   }
-}
-
-static int __init fsl_i2c_of_init(void)
-{
-   struct device_node *np;
-   unsigned int i;
-   struct platform_device *i2c_dev;
-   int ret;
-
-   for (np = NULL, i = 0;
-(np = of_find_compatible_node(np, "i2c", "fsl-i2c")) != NULL;
-i++) {
-   struct resource r[2];
-   struct fsl_i2c_platform_data i2c_data;
-   const unsigned char *flags = NULL;
-
-   memset(&r, 0, sizeof(r));
-   memset(&i2c_data, 0, sizeof(i2c_data));
-
-   ret = of_address_to_resource(np, 0, &r[0]);
-   if (ret)
-   goto err;
-
-   of_irq_to_resource(np, 0, &r[1]);
-
-   i2c_dev = platform_device_register_simple("fsl-i2c", i, r, 2);
-   if (IS_ERR(i2c_dev)) {
-   ret = PTR_ERR(i2c_dev);
-   goto err;
-   }
-
-   i2c_data.device_flags = 0;
-   flags = of_get_property(np, "dfsrr", NULL);
-   if (flags)
-   i2c_data.device_flags |= FSL_I2C_DEV_SEPARATE_DFSRR;
-
-   flags = of_get_property(np, "fsl5200-clocking", NULL);
-   if (flags)
-   i2c_data.device_flags |= FSL_I2C_DEV_CLOCK_5200;
-
-   ret =
-   platform_device_add_data(i2c_dev, &i2c_data,
-sizeof(struct
-   fsl_i2c_platform_data));
-   if (ret)
-   goto unreg;
-
-   of_register_i2c_devices(np, i);
-   }
-
-   return 0;
-
-unreg:
-   platform_device_unregister(i2c_dev);
-err:
-   return ret;
-}
-
-arch_initcall(fsl_i2c_of_init);
-#endif
-
 #ifdef CONFIG_PPC_83xx
 static int __init mpc83xx_wdt_init(void)
 {
diff --git a/drivers/i2c/busses/i2c-mpc.c b/drivers/i2c/busses/i2c-mpc.c
index d8de4ac..bb6284e 100644
--- a/drivers/i2c/busses/i2c-mpc.c
+++ b/drivers/i2c/busses/i2c-mpc.c
@@ -17,7 +17,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 
 #include 
 #include 
@@ -25,13 +25,13 @@
 #include 
 #include 
 
-#define MPC_I2C_ADDR  0x00
+#define DRV_NAME "mpc-i2c"
+
 #define MPC_I2C_FDR0x04
 #define MPC_I2C_CR 0x08
 #define MPC_I2C_SR 0x0c
 #define MPC_I2C_DR 0x10
 #define MPC_I2C_DFSRR 0x14
-#define MPC_I2C_REGION 0x20
 
 #define CCR_MEN  0x80
 #define CCR_MIEN 0x40
@@ -180,7 +180,7 @@ static void mpc_i2c_stop(struct mpc_i2c *i2c)
 static int mpc_write(struct mpc_i2c *i2c, int target,
 const u8 * data, int length, int restart)
 {
-   int i;
+   int i, result;
unsigned timeout = i2c->adap.timeout;
u32 flags = restart ? CCR_RSTA : 0;
 
@@ -192,15 +192,15 @@ static int mpc_write(struct mpc_i2c *i2c, int target,
/* Write target byte */
writeb((target << 1), i2c->base + MPC_I2C_DR);
 
-   if (i2c_wait(i2c, timeout, 1) < 0)
-   return -1;
+   if ((result = i2c_wait(i2c, timeout,

[PATCH 1/4] Implement module aliasing for i2c to translate from device tree names

2007-12-03 Thread Jon Smirl
This patch allows new style i2c chip drivers to have alias names using
the official kernel aliasing system and MODULE_DEVICE_TABLE(). I've
tested it on PowerPC and x86. This change is required for PowerPC
device tree support.
---

 drivers/i2c/i2c-core.c  |   34 +++---
 include/linux/i2c.h |5 ++---
 include/linux/mod_devicetable.h |9 +
 3 files changed, 38 insertions(+), 10 deletions(-)


diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
index b5e13e4..76f48be 100644
--- a/drivers/i2c/i2c-core.c
+++ b/drivers/i2c/i2c-core.c
@@ -47,10 +47,26 @@ static DEFINE_IDR(i2c_adapter_idr);
 
 /* - */
 
-static int i2c_device_match(struct device *dev, struct device_driver *drv)
+static const struct i2c_device_id * i2c_device_match(const struct 
i2c_device_id *id, struct i2c_client *client)
+{
+   /* new style drivers use the same kind of driver matching policy
+* as platform devices or SPI:  compare device and driver IDs.
+*/
+   if (id) {
+   while (id->name[0]) {
+   if (strcmp(client->driver_name, id->name) == 0)
+   return id;
+id++;
+}
+}
+return NULL;
+}
+
+static int i2c_bus_match(struct device *dev, struct device_driver *drv)
 {
struct i2c_client   *client = to_i2c_client(dev);
struct i2c_driver   *driver = to_i2c_driver(drv);
+   const struct i2c_device_id *found_id;
 
/* make legacy i2c drivers bypass driver model probing entirely;
 * such drivers scan each i2c adapter/bus themselves.
@@ -58,10 +74,11 @@ static int i2c_device_match(struct device *dev, struct 
device_driver *drv)
if (!is_newstyle_driver(driver))
return 0;
 
-   /* new style drivers use the same kind of driver matching policy
-* as platform devices or SPI:  compare device and driver IDs.
-*/
-   return strcmp(client->driver_name, drv->name) == 0;
+found_id = i2c_device_match(driver->id_table, client);
+if (found_id)
+return 1;
+
+return 0;
 }
 
 #ifdef CONFIG_HOTPLUG
@@ -89,12 +106,15 @@ static int i2c_device_probe(struct device *dev)
 {
struct i2c_client   *client = to_i2c_client(dev);
struct i2c_driver   *driver = to_i2c_driver(dev->driver);
+   const struct i2c_device_id *id;
 
if (!driver->probe)
return -ENODEV;
client->driver = driver;
dev_dbg(dev, "probe\n");
-   return driver->probe(client);
+   
+id = i2c_device_match(driver->id_table, client);
+   return driver->probe(client, id);
 }
 
 static int i2c_device_remove(struct device *dev)
@@ -189,7 +209,7 @@ static struct device_attribute i2c_dev_attrs[] = {
 static struct bus_type i2c_bus_type = {
.name   = "i2c",
.dev_attrs  = i2c_dev_attrs,
-   .match  = i2c_device_match,
+   .match  = i2c_bus_match,
.uevent = i2c_device_uevent,
.probe  = i2c_device_probe,
.remove = i2c_device_remove,
diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index a100c9f..56d2dca 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -126,7 +126,7 @@ struct i2c_driver {
 * With the driver model, device enumeration is NEVER done by drivers;
 * it's done by infrastructure.  (NEW STYLE DRIVERS ONLY)
 */
-   int (*probe)(struct i2c_client *);
+   int (*probe)(struct i2c_client *, const struct i2c_device_id *id);
int (*remove)(struct i2c_client *);
 
/* driver model interfaces that don't relate to enumeration  */
@@ -141,11 +141,10 @@ struct i2c_driver {
 
struct device_driver driver;
struct list_head list;
+   struct i2c_device_id *id_table; 
 };
 #define to_i2c_driver(d) container_of(d, struct i2c_driver, driver)
 
-#define I2C_NAME_SIZE  20
-
 /**
  * struct i2c_client - represent an I2C slave device
  * @flags: I2C_CLIENT_TEN indicates the device uses a ten bit chip address;
diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h
index e9fddb4..688fad6 100644
--- a/include/linux/mod_devicetable.h
+++ b/include/linux/mod_devicetable.h
@@ -367,4 +367,13 @@ struct virtio_device_id {
 };
 #define VIRTIO_DEV_ANY_ID  0x
 
+/* i2c */
+
+#define I2C_NAME_SIZE  40
+struct i2c_device_id {
+   char name[I2C_NAME_SIZE];
+   kernel_ulong_t driver_data; /* Data private to the driver */
+};
+
+
 #endif /* LINUX_MOD_DEVICETABLE_H */

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


[PATCH 4/4] Convert pfc8563 i2c driver from old style to new style

2007-12-03 Thread Jon Smirl
Convert pfc8563 i2c driver from old style to new style. The
driver is also modified to support device tree names via the
i2c mod alias mechanism.
---

 drivers/rtc/rtc-pcf8563.c |  114 +
 1 files changed, 32 insertions(+), 82 deletions(-)


diff --git a/drivers/rtc/rtc-pcf8563.c b/drivers/rtc/rtc-pcf8563.c
index 0242d80..20b1acf 100644
--- a/drivers/rtc/rtc-pcf8563.c
+++ b/drivers/rtc/rtc-pcf8563.c
@@ -25,10 +25,6 @@
  * located at 0x51 will pass the validation routine due to
  * the way the registers are implemented.
  */
-static unsigned short normal_i2c[] = { I2C_CLIENT_END };
-
-/* Module parameters */
-I2C_CLIENT_INSMOD;
 
 #define PCF8563_REG_ST10x00 /* status */
 #define PCF8563_REG_ST20x01
@@ -72,9 +68,6 @@ struct pcf8563 {
int c_polarity; /* 0: MO_C=1 means 19xx, otherwise MO_C=1 means 20xx */
 };
 
-static int pcf8563_probe(struct i2c_adapter *adapter, int address, int kind);
-static int pcf8563_detach(struct i2c_client *client);
-
 /*
  * In the routines that deal directly with the pcf8563 hardware, we use
  * rtc_time -- month 0-11, hour 0-23, yr = calendar year-epoch.
@@ -257,98 +250,55 @@ static const struct rtc_class_ops pcf8563_rtc_ops = {
.set_time   = pcf8563_rtc_set_time,
 };
 
-static int pcf8563_attach(struct i2c_adapter *adapter)
+static int pcf8563_remove(struct i2c_client *client)
 {
-   return i2c_probe(adapter, &addr_data, pcf8563_probe);
+   struct rtc_device *rtc = i2c_get_clientdata(client);
+
+   if (rtc)
+   rtc_device_unregister(rtc);
+   
+   return 0;
 }
 
+static struct i2c_device_id pcf8563_id[] = {
+   {"rtc-pcf8563", 0},
+   {"pcf8563", 0},
+   {"philips,pcf8563", 0},
+   {"rtc8564", 0},
+   {"epson,rtc8564", 0},
+   {},
+};
+MODULE_DEVICE_TABLE(i2c, pcf8563_id);
+
+static int pcf8563_probe(struct i2c_client *client, const struct i2c_device_id 
*id);
+
 static struct i2c_driver pcf8563_driver = {
.driver = {
-   .name   = "pcf8563",
+   .name   = "rtc-pcf8563",
},
.id = I2C_DRIVERID_PCF8563,
-   .attach_adapter = &pcf8563_attach,
-   .detach_client  = &pcf8563_detach,
+   .probe = &pcf8563_probe,
+   .remove = &pcf8563_remove,
+   .id_table   = pcf8563_id,
 };
 
-static int pcf8563_probe(struct i2c_adapter *adapter, int address, int kind)
+static int pcf8563_probe(struct i2c_client *client, const struct i2c_device_id 
*id)
 {
-   struct pcf8563 *pcf8563;
-   struct i2c_client *client;
+   int result;
struct rtc_device *rtc;
-
-   int err = 0;
-
-   dev_dbg(&adapter->dev, "%s\n", __FUNCTION__);
-
-   if (!i2c_check_functionality(adapter, I2C_FUNC_I2C)) {
-   err = -ENODEV;
-   goto exit;
-   }
-
-   if (!(pcf8563 = kzalloc(sizeof(struct pcf8563), GFP_KERNEL))) {
-   err = -ENOMEM;
-   goto exit;
-   }
-
-   client = &pcf8563->client;
-   client->addr = address;
-   client->driver = &pcf8563_driver;
-   client->adapter = adapter;
-
-   strlcpy(client->name, pcf8563_driver.driver.name, I2C_NAME_SIZE);
-
-   /* Verify the chip is really an PCF8563 */
-   if (kind < 0) {
-   if (pcf8563_validate_client(client) < 0) {
-   err = -ENODEV;
-   goto exit_kfree;
-   }
-   }
-
-   /* Inform the i2c layer */
-   if ((err = i2c_attach_client(client)))
-   goto exit_kfree;
-
-   dev_info(&client->dev, "chip found, driver version " DRV_VERSION "\n");
-
+   
+   result = pcf8563_validate_client(client);
+   if (result)
+   return result;
+   
rtc = rtc_device_register(pcf8563_driver.driver.name, &client->dev,
&pcf8563_rtc_ops, THIS_MODULE);
-
-   if (IS_ERR(rtc)) {
-   err = PTR_ERR(rtc);
-   goto exit_detach;
-   }
+   if (IS_ERR(rtc))
+   return PTR_ERR(rtc);
 
i2c_set_clientdata(client, rtc);
 
return 0;
-
-exit_detach:
-   i2c_detach_client(client);
-
-exit_kfree:
-   kfree(pcf8563);
-
-exit:
-   return err;
-}
-
-static int pcf8563_detach(struct i2c_client *client)
-{
-   struct pcf8563 *pcf8563 = container_of(client, struct pcf8563, client);
-   int err;
-   struct rtc_device *rtc = i2c_get_clientdata(client);
-
-   if (rtc)
-   rtc_device_unregister(rtc);
-
-   if ((err = i2c_detach_client(client)))
-   return err;
-
-   kfree(pcf8563);
-
-   return 0;
 }
 
 static int __init pcf8563_init(void)

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


Re: [PATCH] Generic RTC class support for ppc_md.[gs]et_rtc_time

2007-12-03 Thread Benjamin Herrenschmidt

On Mon, 2007-12-03 at 21:06 +, David Woodhouse wrote:
> On Tue, 2007-12-04 at 07:45 +1100, Benjamin Herrenschmidt wrote:
> > On Mon, 2007-12-03 at 17:04 +, David Woodhouse wrote:
> > > It would be good to migrate the platform code to register RTC devices
> > > directly, but for now this will make them functional enough for most
> > > purposes...
> > 
> > Wouldn't it be best to do the other way around at some stage ?
> 
> Yes, definitely. We can migrate them one at a time to the RTC class.
> 
> > We need to solve the problem of ppc_md. stuff being called by the core
> > in atomic contexts first though.
> 
> Where from?

Worst one is time_init :-) Way too early to do any i2c babbling. Then
there used to be something with the NTP writeback, dunno if it's
changed.

Ben.


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


[PATCH 2/4] Modify several rtc drivers to use the alias names list property of i2c

2007-12-03 Thread Jon Smirl
This patch modifies the ds1307, ds1374, and rs5c372 i2c drivers to support
device tree names using the new i2c mod alias support
---

 arch/powerpc/sysdev/fsl_soc.c |   46 ++---
 drivers/rtc/rtc-ds1307.c  |   38 ++
 drivers/rtc/rtc-ds1374.c  |   11 +-
 drivers/rtc/rtc-rs5c372.c |   31 +++-
 4 files changed, 54 insertions(+), 72 deletions(-)


diff --git a/arch/powerpc/sysdev/fsl_soc.c b/arch/powerpc/sysdev/fsl_soc.c
index 3ace747..e4c766e 100644
--- a/arch/powerpc/sysdev/fsl_soc.c
+++ b/arch/powerpc/sysdev/fsl_soc.c
@@ -320,48 +320,12 @@ 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 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;
-}
 
 static void __init of_register_i2c_devices(struct device_node *adap_node,
   int bus_num)
 {
struct device_node *node = NULL;
+   const char *compatible;
 
while ((node = of_get_next_child(adap_node, node))) {
struct i2c_board_info info = {};
@@ -378,9 +342,13 @@ static void __init of_register_i2c_devices(struct 
device_node *adap_node,
if (info.irq == NO_IRQ)
info.irq = -1;
 
-   if (of_find_i2c_driver(node, &info) < 0)
+   compatible = of_get_property(node, "compatible", &len);
+   if (!compatible) {
+   printk(KERN_WARNING "i2c-mpc.c: invalid entry, missing 
compatible attribute\n");
continue;
-
+   }
+   strncpy(info.driver_name, compatible, sizeof(info.driver_name));
+   
info.addr = *addr;
 
i2c_register_board_info(bus_num, &info, 1);
diff --git a/drivers/rtc/rtc-ds1307.c b/drivers/rtc/rtc-ds1307.c
index bc1c7fe..a4dec4b 100644
--- a/drivers/rtc/rtc-ds1307.c
+++ b/drivers/rtc/rtc-ds1307.c
@@ -99,45 +99,46 @@ struct ds1307 {
 };
 
 struct chip_desc {
-   charname[9];
unsignednvram56:1;
unsignedalarm:1;
enum ds_typetype;
 };
 
 static const struct chip_desc chips[] = { {
-   .name   = "ds1307",
.type   = ds_1307,
.nvram56= 1,
 }, {
-   .name   = "ds1337",
.type   = ds_1337,
.alarm  = 1,
 }, {
-   .name   = "ds1338",
.type   = ds_1338,
.nvram56= 1,
 }, {
-   .name   = "ds1339",
.type   = ds_1339,
.alarm  = 1,
 }, {
-   .name   = "ds1340",
.type   = ds_1340,
 }, {
-   .name   = "m41t00",
.type   = m41t00,
 }, };
 
-static inline const struct chip_desc *find_chip(const char *s)
-{
-   unsigned i;
-
-   for (i = 0; i < ARRAY_SIZE(chips); i++)
-   if (strnicmp(s, chips[i].name, sizeof chips[i].name) == 0)
-   return &chips[i];
-   return NULL;
-}
+static struct i2c_device_id ds1307_id[] = {
+   {"rtc-ds1307", ds_1307},
+   {"ds1307", ds_1307},
+   {"ds1337", ds_1337},
+   {"ds1338", ds_1338},
+   {"ds1339", ds_1339},
+   {"ds1340", ds_1340},
+   {"m41t00", m41t00},
+   {"dallas,ds1307", ds_1307},
+   {"dallas,ds1337", ds_1337},
+   {"dallas,ds1338", ds_1338},
+   {"dallas,ds1339", ds_1339},
+   {"dallas,ds1340", ds_1340},
+   {"stm,m41t00", m41t00},
+   {},
+};
+MODULE_DE

Re: [PATCH 2/2] powerpc: make 64K huge pages more reliable

2007-12-03 Thread Chris Snook
David Gibson wrote:
> On Tue, Nov 27, 2007 at 11:03:16PM -0600, Jon Tollefson wrote:
>> This patch adds reliability to the 64K huge page option by making use of 
>> the PMD for 64K huge pages when base pages are 4k.  So instead of a 12 
>> bit pte it would be 7 bit pmd and a 5 bit pte. The pgd and pud offsets 
>> would continue as 9 bits and 7 bits respectively.  This will allow the 
>> pgtable to fit in one base page.  This patch would have to be applied 
>> after part 1.
> 
> Hrm.. shouldn't we just ban 64K hugepages on a 64K base page size
> setup?  There's not a whole lot of point to it, after all...
> 

Actually, it sounds to me like an ideal way to benchmark the efficiency of the 
hugepage implementation and VM effects, without the TLB performance obscuring 
the results.

I agree that it's not something people will want to do very often, but the same 
can be said about quite a lot of strange things that we allow just because 
there's no fundamental reason why they cannot be.

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


[PATCH 0/4] Series to add device tree naming to i2c

2007-12-03 Thread Jon Smirl
The following series implements standard linux module aliasing for i2c modules
It then converts the mpc i2c driver from being a platform driver to an open
firmware one. I2C device names are picked up from the device tree. Module
aliasing is used to translate from device tree names into to linux kernel
names. Several i2c drivers are updated to use the new aliasing. 

--
Jon Smirl
[EMAIL PROTECTED] 
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH] Generic RTC class support for ppc_md.[gs]et_rtc_time

2007-12-03 Thread David Woodhouse
On Tue, 2007-12-04 at 09:36 +1100, Benjamin Herrenschmidt wrote:
> Worst one is time_init :-) Way too early to do any i2c babbling. Then
> there used to be something with the NTP writeback, dunno if it's
> changed.

Setting the system time seems to be done in the new RTC class by a
late_initcall() in drivers/rtc/hctosys.c. In fact, it could even be done
in userspace.

NTP uses update_persistent_clock() and doesn't seem to have been
'solved' yet for the new RTC class. I don't think there's any particular
reason for it to do i2c stuff in that context though.

-- 
dwmw2

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


Re: [PATCH 0/4] Series to add device tree naming to i2c

2007-12-03 Thread Scott Wood
Olof Johansson wrote:
> On Mon, Dec 03, 2007 at 04:20:32PM -0500, Jon Smirl wrote:
>> The following series implements standard linux module aliasing for i2c 
>> modules
>> It then converts the mpc i2c driver from being a platform driver to an open
>> firmware one. I2C device names are picked up from the device tree. Module
>> aliasing is used to translate from device tree names into to linux kernel
>> names. Several i2c drivers are updated to use the new aliasing. 
> 
> May I ask why you want to modify the i2c layer instead of keeping the
> OF->i2c driver mapping in PPC code?

Because it doesn't belong there -- at the least, it should be in 
drivers/of.  But putting it in the driver is better, IMHO.

> It seems simpler to keep it in the
> PPC-specific code, since otherwise you might end up with confused i2c
> driver writers that make up their own OF names without knowing for sure
> that's what will be used. No?

How is this different from drivers that have of_platform bindings?

That said, there should probably be some sort of tag to indicate the 
namespace being matched against (OF, Linux, etc), to avoid matching an 
OF device with a non-OF name (or vice versa).

> I recently posted (and asked Paulus to pull) a patch where I consolidate
> the fsl_soc mapping code so I can also use that on pasemi, and modified
> the pasemi platform code to setup the board_info from the device tree
> accordingly.

Having just one bit i2c glue code for arch/powerpc is certainly an 
improvement over the current situation, but it's not really powerpc 
specific.  Just because other architectures don't use it now doesn't 
mean they won't in the future -- and I don't like the "we'll move it 
when they do" argument because I want to make it easy for other 
architectures to decide to use it. :-)

-Scott

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


Re: [PATCH 0/4] Series to add device tree naming to i2c

2007-12-03 Thread Olof Johansson
On Mon, Dec 03, 2007 at 06:52:06PM -0500, Jon Smirl wrote:
> On 12/3/07, Olof Johansson <[EMAIL PROTECTED]> wrote:
> > On Mon, Dec 03, 2007 at 04:20:32PM -0500, Jon Smirl wrote:
> > > The following series implements standard linux module aliasing for i2c 
> > > modules
> > > It then converts the mpc i2c driver from being a platform driver to an 
> > > open
> > > firmware one. I2C device names are picked up from the device tree. Module
> > > aliasing is used to translate from device tree names into to linux kernel
> > > names. Several i2c drivers are updated to use the new aliasing.
> >
> > May I ask why you want to modify the i2c layer instead of keeping the
> > OF->i2c driver mapping in PPC code? It seems simpler to keep it in the
> > PPC-specific code, since otherwise you might end up with confused i2c
> > driver writers that make up their own OF names without knowing for sure
> > that's what will be used. No?
> 
> Audio codecs have the same problem. That table is could end up with
> hundreds of entries. The right place to store the mappings is in the
> device driver for the device.
> 
> A side effect of moving the mappings into the device drivers is that
> the correct i2c drivers can be automatically loaded by the kernel.
> This lets you make distro CDs with all of the i2c drivers on disk and
> the device tree will cause insmod of the correct ones.

Ok, good enough reasons. I'll back out my i2c commits and wait for yours
to settle, then add the pasemi stuff in the same way.

(Whitespace comments still apply).


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


Re: Please pull pasemi.git for-2.6.25 branch

2007-12-03 Thread Olof Johansson
On Sun, Dec 02, 2007 at 11:04:47PM -0600, Olof Johansson wrote:
> Paul,
> 
> Please do:
> 
> git pull \
> git://git.kernel.org/pub/scm/linux/kernel/git/olof/pasemi.git for-2.6.25
> 
> For the following patches queued up for 2.6.25. All but one are PA
> Semi-specific (the i2c boardinfo consolidation that's a pre-req for the
> platform-specific one).

Sorry for the churn here, I hope you haven't pulled yet.

Based on today's i2c patches from Jon Smirl, it makes more sense for me
to hold off on my i2c changes and make them on top of his work once that
has been merged.

I've backed out and rebased the patch set, new shortlog and diffstat:

 arch/powerpc/platforms/pasemi/Kconfig |2 
 arch/powerpc/platforms/pasemi/cpufreq.c   |   19 +-
 arch/powerpc/platforms/pasemi/gpio_mdio.c |   94 ++
 arch/powerpc/platforms/pasemi/pasemi.h|6 +
 arch/powerpc/platforms/pasemi/powersave.S |   11 +++
 arch/powerpc/platforms/pasemi/setup.c |   16 -
 drivers/char/hw_random/Kconfig|2 
 drivers/char/hw_random/pasemi-rng.c   |7 --
 drivers/edac/pasemi_edac.c|4 -
 9 files changed, 111 insertions(+), 50 deletions(-)

Olof Johansson (5):
  [POWERPC] pasemi: clean up mdio_gpio a bit
  [POWERPC] pasemi: Broaden specific references to 1682M
  [POWERPC] pasemi: Don't enter powersaving states from elevated astates
  [POWERPC] pasemi: Move cpus to hold loop before restart
  [POWERPC] pasemi: Fix module information for gpio-mdio


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


Re: [PATCH 0/4] Series to add device tree naming to i2c

2007-12-03 Thread Jon Smirl
On 12/3/07, Olof Johansson <[EMAIL PROTECTED]> wrote:
> On Mon, Dec 03, 2007 at 04:20:32PM -0500, Jon Smirl wrote:
> > The following series implements standard linux module aliasing for i2c 
> > modules
> > It then converts the mpc i2c driver from being a platform driver to an open
> > firmware one. I2C device names are picked up from the device tree. Module
> > aliasing is used to translate from device tree names into to linux kernel
> > names. Several i2c drivers are updated to use the new aliasing.
>
> May I ask why you want to modify the i2c layer instead of keeping the
> OF->i2c driver mapping in PPC code? It seems simpler to keep it in the
> PPC-specific code, since otherwise you might end up with confused i2c
> driver writers that make up their own OF names without knowing for sure
> that's what will be used. No?

Audio codecs have the same problem. That table is could end up with
hundreds of entries. The right place to store the mappings is in the
device driver for the device.

A side effect of moving the mappings into the device drivers is that
the correct i2c drivers can be automatically loaded by the kernel.
This lets you make distro CDs with all of the i2c drivers on disk and
the device tree will cause insmod of the correct ones.

I'm working on a parallel patch for Alsa SOC but it isn't ready yet.

>
> I recently posted (and asked Paulus to pull) a patch where I consolidate
> the fsl_soc mapping code so I can also use that on pasemi, and modified
> the pasemi platform code to setup the board_info from the device tree
> accordingly.
>
> Finally, whitespace is broken in several of your patches.
>
>
> -Olof
>


-- 
Jon Smirl
[EMAIL PROTECTED]
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH 0/4] Series to add device tree naming to i2c

2007-12-03 Thread Olof Johansson
On Mon, Dec 03, 2007 at 04:20:32PM -0500, Jon Smirl wrote:
> The following series implements standard linux module aliasing for i2c modules
> It then converts the mpc i2c driver from being a platform driver to an open
> firmware one. I2C device names are picked up from the device tree. Module
> aliasing is used to translate from device tree names into to linux kernel
> names. Several i2c drivers are updated to use the new aliasing. 

May I ask why you want to modify the i2c layer instead of keeping the
OF->i2c driver mapping in PPC code? It seems simpler to keep it in the
PPC-specific code, since otherwise you might end up with confused i2c
driver writers that make up their own OF names without knowing for sure
that's what will be used. No?

I recently posted (and asked Paulus to pull) a patch where I consolidate
the fsl_soc mapping code so I can also use that on pasemi, and modified
the pasemi platform code to setup the board_info from the device tree
accordingly.

Finally, whitespace is broken in several of your patches.


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


Re: [PATCH 09/28] blk_end_request: changing ps3disk (take 3)

2007-12-03 Thread Kiyoshi Ueda
Hi Geert,

On Sun, 2 Dec 2007 10:34:56 +0100 (CET), Geert Uytterhoeven <[EMAIL PROTECTED]> 
wrote:
> On Fri, 30 Nov 2007, Kiyoshi Ueda wrote:
> > This patch converts ps3disk to use blk_end_request().
>  ^^^
> Patch subject and description are inconsistent with actual change.
> 
> > Signed-off-by: Kiyoshi Ueda <[EMAIL PROTECTED]>
> > Signed-off-by: Jun'ichi Nomura <[EMAIL PROTECTED]>
> > ---
> >  drivers/block/ps3disk.c |6 +-
> >  1 files changed, 1 insertion(+), 5 deletions(-)
> > 
> > Index: 2.6.24-rc3-mm2/drivers/block/ps3disk.c
> > ===
> > --- 2.6.24-rc3-mm2.orig/drivers/block/ps3disk.c
> > +++ 2.6.24-rc3-mm2/drivers/block/ps3disk.c
> > @@ -280,11 +280,7 @@ static irqreturn_t ps3disk_interrupt(int
> > }
> >  
> > spin_lock(&priv->lock);
> > -   if (!end_that_request_first(req, uptodate, num_sectors)) {
> > -   add_disk_randomness(req->rq_disk);
> > -   blkdev_dequeue_request(req);
> > -   end_that_request_last(req, uptodate);
> > -   }
> > +   __blk_end_request(req, uptodate, num_sectors << 9);
>   ^

Thank you for the comment.
The description meant the blk_end_request family, not actual function,
blk_end_request().  But as you pointed out, it is misleading.
I'll change the description of all related patches.

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


Re: [PATCH 1/5] PowerPC 74xx: Katana Qp device tree

2007-12-03 Thread David Gibson
On Mon, Dec 03, 2007 at 01:26:34PM -0600, Jon Loeliger wrote:
> On Sun, 2007-12-02 at 19:50, David Gibson wrote:
> 
> > > + clock-frequency = <7f28155>;/* 133.33 MHz */
> > You can use  to avoid the ugly hex.
> 
> Better still, blaze a new trail, convert it to /dts-v1/ and
> use clock-frequency = <1> straight up!

Hrm.. probably best to wait for dtc to go into the kernel for that.

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


dtc: Fix uninitialized use of structure_ok

2007-12-03 Thread David Gibson
My rework of the tree checking code introduced a potentially nasty bug
- it uses the structure_ok variable uninitialized.  This patch fixes
the problem.  It's a fairly ugly bandaid approach, but the ugly will
disappear once future patches have folded the semantic checks into the
new framework.

Signed-off-by: David Gibson <[EMAIL PROTECTED]>

Index: dtc/checks.c
===
--- dtc.orig/checks.c   2007-12-03 17:14:27.0 +1100
+++ dtc/checks.c2007-12-03 17:14:39.0 +1100
@@ -270,8 +270,12 @@ static struct check *check_table[] = {
&phandle_references,
 };
 
-void process_checks(int force, struct node *dt)
+int check_semantics(struct node *dt, int outversion, int boot_cpuid_phys);
+
+void process_checks(int force, struct boot_info *bi,
+   int checkflag, int outversion, int boot_cpuid_phys)
 {
+   struct node *dt = bi->dt;
int i;
int error = 0;
 
@@ -292,6 +296,16 @@ void process_checks(int force, struct no
"output forced\n");
}
}
+
+   if (checkflag) {
+   if (error) {
+   fprintf(stderr, "Warning: Skipping semantic checks due 
to structural errors\n");
+   } else {
+   if (!check_semantics(bi->dt, outversion,
+boot_cpuid_phys))
+   fprintf(stderr, "Warning: Input tree has 
semantic errors\n");
+   }
+   }
 }
 
 /*
Index: dtc/dtc.c
===
--- dtc.orig/dtc.c  2007-12-03 17:14:27.0 +1100
+++ dtc/dtc.c   2007-12-03 17:14:39.0 +1100
@@ -119,7 +119,6 @@ int main(int argc, char *argv[])
FILE *outf = NULL;
int outversion = DEFAULT_FDT_VERSION;
int boot_cpuid_phys = 0xfeedbeef;
-   int structure_ok;
 
quiet  = 0;
reservenum = 0;
@@ -193,17 +192,7 @@ int main(int argc, char *argv[])
if (! bi || ! bi->dt)
die("Couldn't read input tree\n");
 
-   process_checks(force, bi->dt);
-
-   if (check) {
-   if (!structure_ok) {
-   fprintf(stderr, "Warning: Skipping semantic checks due 
to structural errors\n");
-   } else {
-   if (!check_semantics(bi->dt, outversion,
-boot_cpuid_phys))
-   fprintf(stderr, "Warning: Input tree has 
semantic errors\n");
-   }
-   }
+   process_checks(force, bi, check, outversion, boot_cpuid_phys);
 
if (streq(outname, "-")) {
outf = stdout;
Index: dtc/dtc.h
===
--- dtc.orig/dtc.h  2007-12-03 17:15:04.0 +1100
+++ dtc/dtc.h   2007-12-03 17:15:14.0 +1100
@@ -236,8 +236,8 @@ struct boot_info *build_boot_info(struct
 
 /* Checks */
 
-void process_checks(int force, struct node *dt);
-int check_semantics(struct node *dt, int outversion, int boot_cpuid_phys);
+void process_checks(int force, struct boot_info *bi,
+   int checkflag, int outversion, int boot_cpuid_phys);
 
 /* Flattened trees */
 

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


Re: [PATCH 2/2] powerpc: make 64K huge pages more reliable

2007-12-03 Thread David Gibson
On Mon, Dec 03, 2007 at 04:51:53PM -0500, Chris Snook wrote:
> David Gibson wrote:
> > On Tue, Nov 27, 2007 at 11:03:16PM -0600, Jon Tollefson wrote:
> >> This patch adds reliability to the 64K huge page option by making use of 
> >> the PMD for 64K huge pages when base pages are 4k.  So instead of a 12 
> >> bit pte it would be 7 bit pmd and a 5 bit pte. The pgd and pud offsets 
> >> would continue as 9 bits and 7 bits respectively.  This will allow the 
> >> pgtable to fit in one base page.  This patch would have to be applied 
> >> after part 1.
> > 
> > Hrm.. shouldn't we just ban 64K hugepages on a 64K base page size
> > setup?  There's not a whole lot of point to it, after all...
> > 
> 
> Actually, it sounds to me like an ideal way to benchmark the
> efficiency of the hugepage implementation and VM effects, without
> the TLB performance obscuring the results.

Well.. maybe.  The pagetable format, and therefore the hugepage size,
will affect the size of that overhead so even with this its not clear
how meaningful test results would be.

> I agree that it's not something people will want to do very often,
> but the same can be said about quite a lot of strange things that we
> allow just because there's no fundamental reason why they cannot be.

Hrm, yeah I guess, since this was a fairly simple fix.  I still don't
think it's worth jumping through too many hoops to make this possible,
though.

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


Re: [PATCH] [POWERPC] Improved documentation of device tree 'ranges'.

2007-12-03 Thread David Gibson
On Mon, Dec 03, 2007 at 09:45:03AM -0800, Stephen Neuendorffer wrote:
> I was misled by the prior language.  I've attempted to clarify how
> 'ranges' are used, in particular, how to get a 1:1 mapping.

Sounds good, except for one detail.  I think we should avoid using
the "1:1" terminology: to a mathematician, at least, "1:1" is much
weaker than "identity mapping" which is what an empty ranges actually
implies.

So, I think we should explicitly say that an empty ranges implies that
parent bus address space is identical to child bus address space.

> Signed-off-by: Stephen Neuendorffer <[EMAIL PROTECTED]>
> ---
>  Documentation/powerpc/booting-without-of.txt |   11 +++
>  1 files changed, 7 insertions(+), 4 deletions(-)
> 
> diff --git a/Documentation/powerpc/booting-without-of.txt 
> b/Documentation/powerpc/booting-without-of.txt
> index e9a3cb1..aad8bf5 100644
> --- a/Documentation/powerpc/booting-without-of.txt
> +++ b/Documentation/powerpc/booting-without-of.txt
> @@ -711,13 +711,14 @@ define a bus type with a more complex address format, 
> including things
>  like address space bits, you'll have to add a bus translator to the
>  prom_parse.c file of the recent kernels for your bus type.
>  
> -The "reg" property only defines addresses and sizes (if #size-cells
> -is non-0) within a given bus. In order to translate addresses upward
> +The "reg" property only defines addresses and sizes (if #size-cells is
> +non-0) within a given bus. In order to translate addresses upward
>  (that is into parent bus addresses, and possibly into CPU physical
>  addresses), all busses must contain a "ranges" property. If the
>  "ranges" property is missing at a given level, it's assumed that
> -translation isn't possible. The format of the "ranges" property for a
> -bus is a list of:
> +translation isn't possible, i.e., the registers are not visible on the
> +parent bus.  The format of the "ranges" property for a bus is a list
> +of:
>  
>   bus address, parent bus address, size
>  
> @@ -735,6 +736,8 @@ fit in a single 32-bit word.   New 32-bit powerpc boards 
> should use a
>  1/1 format, unless the processor supports physical addresses greater
>  than 32-bits, in which case a 2/1 format is recommended.
>  
> +Alternatively, the "ranges" property may be empty, indicating that the
> +registers are visible on the parent bus, with 1:1 address translation.
>  
>  2) Note about "compatible" properties
>  -

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


Re: [PATCH 1/5] PowerPC 74xx: Katana Qp device tree

2007-12-03 Thread Mark A. Greer
On Tue, Dec 04, 2007 at 07:52:50AM +1100, Benjamin Herrenschmidt wrote:
> > #address-cells = <1>;
> > +   #size-cells = <1>;
> > +   model = "Katana-Qp"; /* Default */
> > +   compatible = "emerson,Katana-Qp";
> > +   coherency-off;
> > +
> 
> What do that mean (coherency-off) ?
> 
> Somebody is trying again to use a 74xx with non cache coherent DMA ?

Hi Ben.

I suspect Andrei got that from the prpmc2800 dts which I made so I'll
jump in.  (BTW, this is the same debate we have every year or two. :)

By looking at the dts, that board has an mv64460 which has a couple
issues when it comes to coherency (depending on the rev of the chip).

One is about not being able to use DCBST instructions with coherency on
and the other is about limiting the length of one of the traces (which
at least one board manufacturer that I know of refuses to implement).
The first one is supposed to be fixed by rev A1 of the part and the second
is supposed to be fixed by rev B0 of the part.  I don't know what rev(s)
are on the board(s) Andrei is using.  If its B0 or later, in theory, the
part should work with coherency on.

Andrei, have you tested with coherency on?

--

As far as the prpmc2800 (mv64360)...

[I don't know what an NDA let's me say or not so I'll just give
summaries of the errata.  If you or another reader has signed the NDA
you/they can look them up.]

I don't recall all of the details anymore but these are the errata I saw
by quickly scanning the 64360's list.

- "FEr CPU-#1":

Basically the CPU could read a stale cache line.  Supposed to be fixed
in rev A2 & B0 but I haven't verified.

- "FEr MPSC-#1":

The MPSC can't access a coherent memory region.
This is pretty much a show stopper for the prpmc2800.

There are no plans to fix that erratum.

- "FEr PCI-#4" (Detailed by Application Note AN-84):

[This isn't strictly a coherency issue but having coherency enabled
exacerbates the problem.]  Basically, the bridge can let the cpu read
a pci device's registers before all of the data the PCI devices has
written has actually made it to memory.  This and the fact that the
device's write data may be stuck in the PCI Slave Write Buffer
(which isn't checked for coherency), the cpu can get stale data.

There are no plans to fix that erratum.

- "FEr PCI-#5" (Detailed by Application Note AN-85):

With certain PCI devices and with coherency enabled, some combinations
of PCI transactions can cause a deadlock.  There is a workaround
documented but I've tried it and it didn't work for me (but I can't be
sure that was the erratum I was bumping into).

There are no plans to fix that erratum.
--

So, the answer depends on what part & what rev of the part you have
(e.g., the pegasos doesn't use the MPSC and apparently has the other
issues worked around so it can turn on coherency but the prpmc2800
doesn't so it needs coherency off).

BTW, I haven't forgotten the inherent bug you described when coherency
is off (/me too lazy to find link to the email) but AFAIK I've never run
into it.  However, if I turn on coherency and stress the PCI bus, it
hangs (I can't even look at memory thru a bdi).

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


[PATCH] [POWERPC] [v2] Improved documentation of device tree 'ranges'.

2007-12-03 Thread Stephen Neuendorffer
I was misled by the prior language.  I've attempted to clarify how
'ranges' are used, in particular, how to get an identity mapping.

Signed-off-by: Stephen Neuendorffer <[EMAIL PROTECTED]>
---
 Documentation/powerpc/booting-without-of.txt |   13 +
 1 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/Documentation/powerpc/booting-without-of.txt 
b/Documentation/powerpc/booting-without-of.txt
index e9a3cb1..7327f37 100644
--- a/Documentation/powerpc/booting-without-of.txt
+++ b/Documentation/powerpc/booting-without-of.txt
@@ -711,13 +711,14 @@ define a bus type with a more complex address format, 
including things
 like address space bits, you'll have to add a bus translator to the
 prom_parse.c file of the recent kernels for your bus type.
 
-The "reg" property only defines addresses and sizes (if #size-cells
-is non-0) within a given bus. In order to translate addresses upward
+The "reg" property only defines addresses and sizes (if #size-cells is
+non-0) within a given bus. In order to translate addresses upward
 (that is into parent bus addresses, and possibly into CPU physical
 addresses), all busses must contain a "ranges" property. If the
 "ranges" property is missing at a given level, it's assumed that
-translation isn't possible. The format of the "ranges" property for a
-bus is a list of:
+translation isn't possible, i.e., the registers are not visible on the
+parent bus.  The format of the "ranges" property for a bus is a list
+of:
 
bus address, parent bus address, size
 
@@ -735,6 +736,10 @@ fit in a single 32-bit word.   New 32-bit powerpc boards 
should use a
 1/1 format, unless the processor supports physical addresses greater
 than 32-bits, in which case a 2/1 format is recommended.
 
+Alternatively, the "ranges" property may be empty, indicating that the
+registers are visible on the parent bus using an identity mapping
+translation.  In other words, the parent bus address space is the same
+as the child bus address space.
 
 2) Note about "compatible" properties
 -
-- 
1.5.3.4-dirty



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


Re: [PATCH] Add IPIC MSI interrupt support

2007-12-03 Thread Li Li
On Tue, 2007-12-04 at 05:03 +0800, Benjamin Herrenschmidt wrote:
> 
> On Mon, 2007-12-03 at 17:07 +0800, Li Li wrote: 
> > 
> > In IPIC, the 8 MSI interrupts is handled as level intrrupt. 
> > I just provide a versatile in case it is changed.
> 
> Level ? Are you sure ? MSIs are by definition edge interrupts... Or
> do 
> you have some weird logic that asserts a level input until you go ack 
> something ? Sounds weird...
> 

The second one.
The MSI is edge interrupt. The 256 MSI interrupts are divided into 8
groups. Each group can generate a interrupt to core. This interrupts are
level and asserted untile ack MSI interrupt. A little weird.

> Ben.
> 
> 

- Tony


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


Re: Merge dtc

2007-12-03 Thread David Woodhouse

On Tue, 2007-10-16 at 15:02 +1000, David Gibson wrote:
> This very large patch incorporates a copy of dtc into the kernel
> source, in arch/powerpc/boot/dtc-src.  This means that dtc is no
> longer an external dependency to build kernels with configurations
> which need a dtb file.
> 
> Signed-off-by: David Gibson <[EMAIL PROTECTED]>
> 
> Too big for the list, full patch at
> http://ozlabs.org/~dgibson/home/merge-dtc.patch

I think this is a bad idea -- it's hardly a difficult for those people
who _do_ need dts to obtain it separately.

It's bad enough that I have to separate out the bootwrapper code, which
probably ought to live outside the kernel. We shouldn't be merging
_more_ stuff in.

-- 
dwmw2

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


Re: [PATCH 4/5] PowerPC 74xx: Katana Qp base support

2007-12-03 Thread Mark A. Greer
On Tue, Dec 04, 2007 at 07:54:59AM +1100, Benjamin Herrenschmidt wrote:
> 
> On Thu, 2007-11-29 at 18:42 +0300, Andrei Dolnikov wrote:
> > +config PPC_KATANAQP
> > +   bool "Emerson-Katana Qp"
> > +   depends on EMBEDDED6xx
> > +   select MV64X60
> > +   select NOT_COHERENT_CACHE
>  ^^
> 
> Just one word: ARG !
> 
> Oh and another one: WHY ?

I responded to your other email regarding this.

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


RE: [PATCH] ipic: change ack operation that register is accessedonly when needed

2007-12-03 Thread Li Yang
> -Original Message-
> From: Benjamin Herrenschmidt [mailto:[EMAIL PROTECTED] 
> Sent: Tuesday, December 04, 2007 5:02 AM
> To: Li Yang
> Cc: [EMAIL PROTECTED]; linuxppc-dev@ozlabs.org
> Subject: Re: [PATCH] ipic: change ack operation that register 
> is accessedonly when needed
> 
> 
> >  static void ipic_ack_irq(unsigned int virq)  {
> > -   struct ipic *ipic = ipic_from_irq(virq);
> > unsigned int src = ipic_irq_to_hw(virq);
> > -   unsigned long flags;
> > -   u32 temp;
> >  
> > -   spin_lock_irqsave(&ipic_lock, flags);
> > +   /* Only external interrupts in edge mode support ACK */
> > +   if (unlikely(ipic_info[src].ack &&
> > +   ((get_irq_desc(virq)->status & 
> IRQ_TYPE_SENSE_MASK) ==
> > +   IRQ_TYPE_EDGE_FALLING))) {
> > +   struct ipic *ipic = ipic_from_irq(virq);
> > +   unsigned long flags;
> > +   u32 temp;
> >  
> > -   temp = ipic_read(ipic->regs, ipic_info[src].pend);
> > -   temp |= (1 << (31 - ipic_info[src].bit));
> > -   ipic_write(ipic->regs, ipic_info[src].pend, temp);
> > +   spin_lock_irqsave(&ipic_lock, flags);
> >  
> > -   spin_unlock_irqrestore(&ipic_lock, flags);
> > +   temp = ipic_read(ipic->regs, ipic_info[src].ack);
> > +   temp |= (1 << (31 - ipic_info[src].bit));
> > +   ipic_write(ipic->regs, ipic_info[src].ack, temp);
> > +
> > +   spin_unlock_irqrestore(&ipic_lock, flags);
> > +   }
> >  }
> 
> That doesn't look right... 
> 
> That should be handled by the higher level flow handler. The 
> generic edge one calls ack and the level one mask_and_ack. 
> Just make them do the right thing, no need to test for the 
> flow type in the low level function.

But actually ack is called by edge and per cpu handlers.  Mask_and_ack
is also called by edge handler when the same interrupt is already in
progress.  So I don't think that ack/mask_and_ack implicates flow type
by design.

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


Re: [PATCH 1/5] PowerPC 74xx: Katana Qp device tree

2007-12-03 Thread Mark A. Greer
On Mon, Dec 03, 2007 at 12:50:18PM +1100, David Gibson wrote:
> On Thu, Nov 29, 2007 at 06:28:36PM +0300, Andrei Dolnikov wrote:
> > 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;
> 
> What is this property for?

Its needed to tell the bootwrapper that the platform does not have
coherency enabled (since our policy is that you can't use a CONFIG_ option).
The bootwrapper needs to know that if/when it sets up the windows for
its I/O devices (e.g., enet, mpsc) to system memory.  I needed to do
this on the prpmc2800 because the firmware didn't set up those windows
correctly.  I don't know if the Katana Qp's firmware sets the up
correctly or not.

> > +   [EMAIL PROTECTED] { /* Marvell Discovery */
> > +   #address-cells = <1>;
> > +   #size-cells = <1>;
> > +   model = "mv64460";  /* Default */
> > +   compatible = "marvell,mv64x60";
> 
> Compatible properties should not have "x" asn in 64x60 here.  If
> there's a suitable name for the general register interface use that,
> otherwise use the specific model number of the earliest device to
> implement this register interface.  Later models should have a
> compatible property which lists their specific model, followed by the
> earlier model number with which they're compatible.

This came from the prpmc2800's dts which has become out-of-date.
Both dts files need to be updated.

> > +   [EMAIL PROTECTED] {
> > +   reg = <2000 2000>;
> 
> Are the registers for the 3 ethernets really all together?  This bank
> can't be subdivided into seperate register blocks for each MAC?

Unfortunately there are some registers that are shared so you can't
divide them up nicely.

> > +   eth0 {
> > +   device_type = "network";
> > +   compatible = "marvell,mv64x60-eth";
> > +   block-index = <0>;
> 
> This block-index thing is crap.  If you really need to subindex nodes
> like this, use "reg", with an appropriate #address-cells in the
> parent, then the nodes will also get sensible unit addresses.

So how would that work for the "PHY Address Register 0x2000", say,
where bits 0-4 set the device addr for PHY 0; bits 5-9 set the device
addr for PHY 1; bts 10-14 set the devce addr for PHY 2?

> > +   interrupts = <20>;
> > +   interrupt-parent = <&/mv64x60/pic>;
> 
> You should use a label for the PIC to make things more readable.

More that needs to be updated in prpmc2800.  :(

> > +   [EMAIL PROTECTED] {
> > +   compatible = "marvell,mv64x60-sdma";
> > +   reg = <4000 c18>;
> > +   virtual-reg = ;
> 
> Why does this node have virtual-reg?

"virtual-reg" is a special property that doesn't get translated thru
the parent mappings.  It should never be used in the kernel.  Its
purpose is to give code in the bootwrapper the exact address that it
should use to access a register or block of registers or ...
Its needed here because the MPSC (serial) driver uses the SDMA unit
to perform console I/O in the bootwrapper (e.g., cmdline editing, printf's).

Yes, this needs to be documented.

> > +   [EMAIL PROTECTED] {
> > +   device_type = "serial";
> > +   compatible = "marvell,mpsc";
> > +   reg = <8000 38>;
> > +   virtual-reg = ;
> > +   sdma = <&/mv64x60/[EMAIL PROTECTED]>;
> > +   brg = <&/mv64x60/[EMAIL PROTECTED]>;
> > +   cunit = <&/mv64x60/[EMAIL PROTECTED]>;
> > +   mpscrouting = <&/mv64x60/[EMAIL PROTECTED]>;
> > +   mpscintr = <&/mv64x60/[EMAIL PROTECTED]>;
> > +   block-index = <0>;
> 
> What is this block-index thing about here?  Since the

Re: [PATCH 1/5] PowerPC 74xx: Katana Qp device tree

2007-12-03 Thread Benjamin Herrenschmidt

 .../... (snip scary bunch of errata)

> - "FEr PCI-#4" (Detailed by Application Note AN-84):
> 
> [This isn't strictly a coherency issue but having coherency enabled
> exacerbates the problem.]  Basically, the bridge can let the cpu read
> a pci device's registers before all of the data the PCI devices has
> written has actually made it to memory.  This and the fact that the
> device's write data may be stuck in the PCI Slave Write Buffer
> (which isn't checked for coherency), the cpu can get stale data.
> 
> There are no plans to fix that erratum.

So if I understand correctly, there's no plan to fix a major PCI spec
violation which prevent any kind of reliable implementation whatsoever ?

Or rather... the part just doesn't work, period. Don't use it. If you
do, you're on your own.

> - "FEr PCI-#5" (Detailed by Application Note AN-85):
> 
> With certain PCI devices and with coherency enabled, some combinations
> of PCI transactions can cause a deadlock.  There is a workaround
> documented but I've tried it and it didn't work for me (but I can't be
> sure that was the erratum I was bumping into).
> 
> There are no plans to fix that erratum.

Yeah... great. Oh well, Paul, what about we just don't support people
using that chip ?

> So, the answer depends on what part & what rev of the part you have
> (e.g., the pegasos doesn't use the MPSC and apparently has the other
> issues worked around so it can turn on coherency but the prpmc2800
> doesn't so it needs coherency off).
> 
> BTW, I haven't forgotten the inherent bug you described when coherency
> is off (/me too lazy to find link to the email) but AFAIK I've never run
> into it.  However, if I turn on coherency and stress the PCI bus, it
> hangs (I can't even look at memory thru a bdi).

Well, as it is today, the "classic" MMU code cannot deal with !coherent.
The entire linear mapping is always mapped cacheable with BATs, so stuff
may be brought into the cache at any time, potentially polluting DMA
data.

Dealing with that would be hard. It might be possible by using G on the
entire linear mapping like we do on 4xx (yuck), and/or by not using
D-BATs (the kernel will blow up in various areas without I-BATs).

Ben.


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


RE: [PATCH] ipic: change ack operation that register is accessedonly when needed

2007-12-03 Thread Benjamin Herrenschmidt

On Tue, 2007-12-04 at 10:06 +0800, Li Yang wrote:
> > That should be handled by the higher level flow handler. The 
> > generic edge one calls ack and the level one mask_and_ack. 
> > Just make them do the right thing, no need to test for the 
> > flow type in the low level function.
> 
> But actually ack is called by edge and per cpu handlers.  Mask_and_ack
> is also called by edge handler when the same interrupt is already in
> progress.  So I don't think that ack/mask_and_ack implicates flow type
> by design.

They do and you can pass different irq_chip with different mask/ack
routines if necessary.

Ben.


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


Re: [PATCH] [POWERPC] [v2] Improved documentation of device tree 'ranges'.

2007-12-03 Thread David Gibson

On Mon, Dec 03, 2007 at 05:08:57PM -0800, Stephen Neuendorffer wrote:
> I was misled by the prior language.  I've attempted to clarify how
> 'ranges' are used, in particular, how to get an identity mapping.
> 
> Signed-off-by: Stephen Neuendorffer <[EMAIL PROTECTED]>

Acked-by: David Gibson <[EMAIL PROTECTED]>

Thanks for the update.  I particularly dislike the "1:1" terminology,
because in maths-speak *any* ranges translation is 1:1, unless it
includes overlapping ranges.

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


Re: [PATCH 1/5] PowerPC 74xx: Katana Qp device tree

2007-12-03 Thread David Gibson
On Mon, Dec 03, 2007 at 07:10:26PM -0700, Mark A. Greer wrote:
> On Mon, Dec 03, 2007 at 12:50:18PM +1100, David Gibson wrote:
> > On Thu, Nov 29, 2007 at 06:28:36PM +0300, Andrei Dolnikov wrote:
[snip]
> > > + [EMAIL PROTECTED] {
> > > + reg = <2000 2000>;
> > 
> > Are the registers for the 3 ethernets really all together?  This bank
> > can't be subdivided into seperate register blocks for each MAC?
> 
> Unfortunately there are some registers that are shared so you can't
> divide them up nicely.

Ok, fair enough then.  But, see below..

> > > + eth0 {
> > > + device_type = "network";
> > > + compatible = "marvell,mv64x60-eth";
> > > + block-index = <0>;
> > 
> > This block-index thing is crap.  If you really need to subindex nodes
> > like this, use "reg", with an appropriate #address-cells in the
> > parent, then the nodes will also get sensible unit addresses.
> 
> So how would that work for the "PHY Address Register 0x2000", say,
> where bits 0-4 set the device addr for PHY 0; bits 5-9 set the device
> addr for PHY 1; bts 10-14 set the devce addr for PHY 2?

So use 'reg' to do the indexing.  As long as you have no 'ranges'
property in the parent 'ethernet' node, which you don't, you can use
'reg' as a private index.  That's basically what non-translatable reg
values are about.

Incidentally you should probably call the subnodes "[EMAIL PROTECTED]"
etc. and the parent one "multiethernet" or something.  It's the
subnodes that represent an individual ethernet interface, so they
should take the "ethernet" name and not the parent, by generic names
conventions.

[snip]
> > > + [EMAIL PROTECTED] {
> > > + compatible = "marvell,mv64x60-sdma";
> > > + reg = <4000 c18>;
> > > + virtual-reg = ;
> > 
> > Why does this node have virtual-reg?
> 
> "virtual-reg" is a special property that doesn't get translated thru
> the parent mappings.  It should never be used in the kernel.  Its
> purpose is to give code in the bootwrapper the exact address that it
> should use to access a register or block of registers or ...
> Its needed here because the MPSC (serial) driver uses the SDMA unit
> to perform console I/O in the bootwrapper (e.g., cmdline editing, printf's).
> 
> Yes, this needs to be documented.

Ok.  "it's used for serial in the bootwrapper" would have sufficed - I
questioned it because it wasn't obvious that this was needed to use
the mpsc.

> 
> > > + [EMAIL PROTECTED] {
> > > + device_type = "serial";
> > > + compatible = "marvell,mpsc";
> > > + reg = <8000 38>;
> > > + virtual-reg = ;
> > > + sdma = <&/mv64x60/[EMAIL PROTECTED]>;
> > > + brg = <&/mv64x60/[EMAIL PROTECTED]>;
> > > + cunit = <&/mv64x60/[EMAIL PROTECTED]>;
> > > + mpscrouting = <&/mv64x60/[EMAIL PROTECTED]>;
> > > + mpscintr = <&/mv64x60/[EMAIL PROTECTED]>;
> > > + block-index = <0>;
> > 
> > What is this block-index thing about here?  Since the devices are
> > disambiguated by their register address, why do you need it?
> 
> This particular one is needed to access the correct MPSC interrupt reg.
> Maybe it would be better to make a new property for this but it was only
> one reg and block-index was already there and basically served that
> purpose so I used it.  I'd be happy to use an alternative if you have
> something you think is better.

No, that's an acceptable use for something like this, except that
"cell-index" seems to be the name we've standardised on for other
similar cases.

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


iSeries_defconfig update

2007-12-03 Thread Stephen Rothwell
Hi Paul,

I think http://patchwork.ozlabs.org/linuxppc/patch?id=14835 should go
into 2.6.24 (along with some other defconfig updates).

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


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

Re: [PATCH 2/2] [POWERPC] Use of_register_driver to implement of_register_platform_driver

2007-12-03 Thread Stephen Rothwell
Hi Paul,

Is there some reason http://patchwork.ozlabs.org/linuxppc/patch?id=14223
should not be in 2.6.25?

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


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

Re: [PATCH] [POWERPC] [v2] Improved documentation of device tree 'ranges'.

2007-12-03 Thread Grant Likely
On 12/3/07, David Gibson <[EMAIL PROTECTED]> wrote:
>
> On Mon, Dec 03, 2007 at 05:08:57PM -0800, Stephen Neuendorffer wrote:
> > I was misled by the prior language.  I've attempted to clarify how
> > 'ranges' are used, in particular, how to get an identity mapping.
> >
> > Signed-off-by: Stephen Neuendorffer <[EMAIL PROTECTED]>
>
> Acked-by: David Gibson <[EMAIL PROTECTED]>

Acked-by: Grant Likely <[EMAIL PROTECTED]>

>
> Thanks for the update.  I particularly dislike the "1:1" terminology,
> because in maths-speak *any* ranges translation is 1:1, unless it
> includes overlapping ranges.
>
> --
> David Gibson| I'll have my music baroque, and my code
> david AT gibson.dropbear.id.au  | minimalist, thank you.  NOT _the_ _other_
> | _way_ _around_!
> http://www.ozlabs.org/~dgibson
>


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


dtc: Add may const qualifications

2007-12-03 Thread David Gibson
This adds 'const' qualifiers to many variables and functions.  In
particular it's now used for passing names to the tree accesor
functions.

Signed-off-by: David Gibson <[EMAIL PROTECTED]>

Index: dtc/data.c
===
--- dtc.orig/data.c 2007-12-04 11:49:54.0 +1100
+++ dtc/data.c  2007-12-04 14:11:35.0 +1100
@@ -64,7 +64,7 @@ struct data data_grow_for(struct data d,
return nd;
 }
 
-struct data data_copy_mem(char *mem, int len)
+struct data data_copy_mem(const char *mem, int len)
 {
struct data d;
 
@@ -76,7 +76,7 @@ struct data data_copy_mem(char *mem, int
return d;
 }
 
-static char get_oct_char(char *s, int *i)
+static char get_oct_char(const char *s, int *i)
 {
char x[4];
char *endx;
@@ -98,7 +98,7 @@ static char get_oct_char(char *s, int *i
return val;
 }
 
-static char get_hex_char(char *s, int *i)
+static char get_hex_char(const char *s, int *i)
 {
char x[3];
char *endx;
@@ -117,7 +117,7 @@ static char get_hex_char(char *s, int *i
return val;
 }
 
-struct data data_copy_escape_string(char *s, int len)
+struct data data_copy_escape_string(const char *s, int len)
 {
int i = 0;
struct data d;
@@ -194,7 +194,7 @@ struct data data_copy_file(FILE *f, size
return d;
 }
 
-struct data data_append_data(struct data d, void *p, int len)
+struct data data_append_data(struct data d, const void *p, int len)
 {
d = data_grow_for(d, len);
memcpy(d.val + d.len, p, len);
@@ -237,7 +237,7 @@ struct data data_append_cell(struct data
return data_append_data(d, &beword, sizeof(beword));
 }
 
-struct data data_append_re(struct data d, struct fdt_reserve_entry *re)
+struct data data_append_re(struct data d, const struct fdt_reserve_entry *re)
 {
struct fdt_reserve_entry bere;
 
Index: dtc/dtc.c
===
--- dtc.orig/dtc.c  2007-12-04 11:49:55.0 +1100
+++ dtc/dtc.c   2007-12-04 14:16:51.0 +1100
@@ -30,7 +30,7 @@ int quiet;/* Level of quietness */
 int reservenum;/* Number of memory reservation slots */
 int minsize;   /* Minimum blob size */
 
-char *join_path(char *path, char *name)
+char *join_path(const char *path, const char *name)
 {
int lenp = strlen(path);
int lenn = strlen(name);
@@ -54,10 +54,10 @@ char *join_path(char *path, char *name)
return str;
 }
 
-void fill_fullpaths(struct node *tree, char *prefix)
+void fill_fullpaths(struct node *tree, const char *prefix)
 {
struct node *child;
-   char *unit;
+   const char *unit;
 
tree->fullpath = join_path(prefix, tree->name);
 
@@ -109,11 +109,11 @@ static void  __attribute__ ((noreturn)) 
 int main(int argc, char *argv[])
 {
struct boot_info *bi;
-   char *inform = "dts";
-   char *outform = "dts";
-   char *outname = "-";
+   const char *inform = "dts";
+   const char *outform = "dts";
+   const char *outname = "-";
int force = 0, check = 0;
-   char *arg;
+   const char *arg;
int opt;
FILE *inf = NULL;
FILE *outf = NULL;
Index: dtc/flattree.c
===
--- dtc.orig/flattree.c 2007-12-04 11:49:54.0 +1100
+++ dtc/flattree.c  2007-12-04 14:22:47.0 +1100
@@ -51,9 +51,9 @@ struct emitter {
void (*string)(void *, char *, int);
void (*align)(void *, int);
void (*data)(void *, struct data);
-   void (*beginnode)(void *, char *);
-   void (*endnode)(void *, char *);
-   void (*property)(void *, char *);
+   void (*beginnode)(void *, const char *);
+   void (*endnode)(void *, const char *);
+   void (*property)(void *, const char *);
 };
 
 static void bin_emit_cell(void *e, cell_t val)
@@ -88,17 +88,17 @@ static void bin_emit_data(void *e, struc
*dtbuf = data_append_data(*dtbuf, d.val, d.len);
 }
 
-static void bin_emit_beginnode(void *e, char *label)
+static void bin_emit_beginnode(void *e, const char *label)
 {
bin_emit_cell(e, FDT_BEGIN_NODE);
 }
 
-static void bin_emit_endnode(void *e, char *label)
+static void bin_emit_endnode(void *e, const char *label)
 {
bin_emit_cell(e, FDT_END_NODE);
 }
 
-static void bin_emit_property(void *e, char *label)
+static void bin_emit_property(void *e, const char *label)
 {
bin_emit_cell(e, FDT_PROP);
 }
@@ -113,14 +113,14 @@ static struct emitter bin_emitter = {
.property = bin_emit_property,
 };
 
-static void emit_label(FILE *f, char *prefix, char *label)
+static void emit_label(FILE *f, const char *prefix, const char *label)
 {
fprintf(f, "\t.globl\t%s_%s\n", prefix, label);
fprintf(f, "%s_%s:\n", prefix, label);
fprintf(f, "_%s_%s:\n", prefix, label);
 }
 
-static void emit_offset_label(FILE *f, char *label, in

[PATCH 2.6.24] pasemi_mac: Fix reuse of free'd skb

2007-12-03 Thread Olof Johansson
Turns out we're freeing the skb when we detect CRC error, but we're
not clearing out info->skb. We could either clear it and have the stack
reallocate it, or just leave it and the rx ring refill code will reuse
the one that was allocated.

Reusing a freed skb obviously caused some nasty crashes of various kind,
as reported by Brent Baude and David Woodhouse.


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

---

Jeff, I'd like to see this in 2.6.24, it's causing some real problems
out there. It's not needed in the 2.6.25 queue since the other changes
there have already covered these cases.

My test network at home is quiet enough to not cause CRC errors, we
mainly get those during interface bringup before speed is configured.

diff --git a/drivers/net/pasemi_mac.c b/drivers/net/pasemi_mac.c
index 09b4fde..6617e24 100644
--- a/drivers/net/pasemi_mac.c
+++ b/drivers/net/pasemi_mac.c
@@ -586,7 +586,7 @@ static int pasemi_mac_clean_rx(struct pasemi_mac *mac, int 
limit)
/* CRC error flagged */
mac->netdev->stats.rx_errors++;
mac->netdev->stats.rx_crc_errors++;
-   dev_kfree_skb_irq(skb);
+   /* No need to free skb, it'll be reused */
goto next;
}
 
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: Merge dtc

2007-12-03 Thread David Gibson
On Tue, Dec 04, 2007 at 01:59:04AM +, David Woodhouse wrote:
> 
> On Tue, 2007-10-16 at 15:02 +1000, David Gibson wrote:
> > This very large patch incorporates a copy of dtc into the kernel
> > source, in arch/powerpc/boot/dtc-src.  This means that dtc is no
> > longer an external dependency to build kernels with configurations
> > which need a dtb file.
> > 
> > Signed-off-by: David Gibson <[EMAIL PROTECTED]>
> > 
> > Too big for the list, full patch at
> > http://ozlabs.org/~dgibson/home/merge-dtc.patch
> 
> I think this is a bad idea -- it's hardly a difficult for those people
> who _do_ need dts to obtain it separately.
> 
> It's bad enough that I have to separate out the bootwrapper code, which
> probably ought to live outside the kernel. We shouldn't be merging
> _more_ stuff in.

We've been back and forth on this several times, Paul and I finally
concluded this was the better option.

It means we can feel free to use dtc for whatever new platforms we
wish to without people whinging about having to install a new tool.
And it means as dtc evolves to have new useful features, we just need
to ensure that the dts files in the kernel are buildable with the dtc
in the kernel, rather than requireing people to keep updating their
dtc to match what the kernel build needs.

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


[PATCH] Fix hardware IRQ time accounting problem.

2007-12-03 Thread Tony Breeds
The commit fa13a5a1f25f671d084d8884be96fc48d9b68275, unconditionally calls
update_process_tick() in system context.  In the deterministic accounting case
this is the correct thing to do.  However, in the non-deterministic accounting
case we need to not do this, and results in the time accounted as
hardware irq time being artificially elevated.

Also this patch collapses 2 consecutive '#ifdef CONFIG_VIRT_CPU_ACCOUNTING'
checks in time.h into for neatness.

Signed-off-by: Tony Breeds <[EMAIL PROTECTED]>
---
The problem was seen and reported by Johannes Berg  and Frederik Himpe.
Paul, I think this is good for 2.6.24.


 arch/powerpc/kernel/process.c |2 +-
 include/asm-powerpc/time.h|   12 
 2 files changed, 5 insertions(+), 9 deletions(-)

diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
index 41e13f4..b9d8837 100644
--- a/arch/powerpc/kernel/process.c
+++ b/arch/powerpc/kernel/process.c
@@ -350,7 +350,7 @@ struct task_struct *__switch_to(struct task_struct *prev,
local_irq_save(flags);
 
account_system_vtime(current);
-   account_process_tick(current, 0);
+   account_process_vtime(current);
calculate_steal_time();
 
last = _switch(old_thread, new_thread);
diff --git a/include/asm-powerpc/time.h b/include/asm-powerpc/time.h
index 780f826..8a2c8db 100644
--- a/include/asm-powerpc/time.h
+++ b/include/asm-powerpc/time.h
@@ -237,18 +237,14 @@ struct cpu_usage {
 
 DECLARE_PER_CPU(struct cpu_usage, cpu_usage_array);
 
-#ifdef CONFIG_VIRT_CPU_ACCOUNTING
-extern void account_process_vtime(struct task_struct *tsk);
-#else
-#define account_process_vtime(tsk) do { } while (0)
-#endif
-
 #if defined(CONFIG_VIRT_CPU_ACCOUNTING)
 extern void calculate_steal_time(void);
 extern void snapshot_timebases(void);
+#define account_process_vtime(tsk) account_process_tick(current, 0);
 #else
-#define calculate_steal_time() do { } while (0)
-#define snapshot_timebases()   do { } while (0)
+#define calculate_steal_time() do { } while (0)
+#define snapshot_timebases()   do { } while (0)
+#define account_process_vtime(tsk) do { } while (0)
 #endif
 
 extern void secondary_cpu_time_init(void);
-- 
1.5.3.6


Yours Tony

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

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


Re: [PATCH 1/5] PowerPC 74xx: Katana Qp device tree

2007-12-03 Thread Mark A. Greer
On Tue, Dec 04, 2007 at 01:50:32PM +1100, David Gibson wrote:
> On Mon, Dec 03, 2007 at 07:10:26PM -0700, Mark A. Greer wrote:
> > On Mon, Dec 03, 2007 at 12:50:18PM +1100, David Gibson wrote:
> > > On Thu, Nov 29, 2007 at 06:28:36PM +0300, Andrei Dolnikov wrote:

> > > > +   eth0 {
> > > > +   device_type = "network";
> > > > +   compatible = "marvell,mv64x60-eth";
> > > > +   block-index = <0>;
> > > 
> > > This block-index thing is crap.  If you really need to subindex nodes
> > > like this, use "reg", with an appropriate #address-cells in the
> > > parent, then the nodes will also get sensible unit addresses.
> > 
> > So how would that work for the "PHY Address Register 0x2000", say,
> > where bits 0-4 set the device addr for PHY 0; bits 5-9 set the device
> > addr for PHY 1; bts 10-14 set the devce addr for PHY 2?
> 
> So use 'reg' to do the indexing.  As long as you have no 'ranges'
> property in the parent 'ethernet' node, which you don't, you can use
> 'reg' as a private index.  That's basically what non-translatable reg
> values are about.
> 
> Incidentally you should probably call the subnodes "[EMAIL PROTECTED]"
> etc. and the parent one "multiethernet" or something.  It's the
> subnodes that represent an individual ethernet interface, so they
> should take the "ethernet" name and not the parent, by generic names
> conventions.

Okay, thanks for the advice.  I'll fix the prpmc2800 dts file.
Presumably Andrei will fix his.

> [snip]
> > > > +   [EMAIL PROTECTED] {
> > > > +   compatible = "marvell,mv64x60-sdma";
> > > > +   reg = <4000 c18>;
> > > > +   virtual-reg = ;
> > > 
> > > Why does this node have virtual-reg?
> > 
> > "virtual-reg" is a special property that doesn't get translated thru
> > the parent mappings.  It should never be used in the kernel.  Its
> > purpose is to give code in the bootwrapper the exact address that it
> > should use to access a register or block of registers or ...
> > Its needed here because the MPSC (serial) driver uses the SDMA unit
> > to perform console I/O in the bootwrapper (e.g., cmdline editing, printf's).
> > 
> > Yes, this needs to be documented.
> 
> Ok.  "it's used for serial in the bootwrapper" would have sufficed - I
> questioned it because it wasn't obvious that this was needed to use
> the mpsc.

Sorry  :)

> > 
> > > > +   [EMAIL PROTECTED] {
> > > > +   device_type = "serial";
> > > > +   compatible = "marvell,mpsc";
> > > > +   reg = <8000 38>;
> > > > +   virtual-reg = ;
> > > > +   sdma = <&/mv64x60/[EMAIL PROTECTED]>;
> > > > +   brg = <&/mv64x60/[EMAIL PROTECTED]>;
> > > > +   cunit = <&/mv64x60/[EMAIL PROTECTED]>;
> > > > +   mpscrouting = <&/mv64x60/[EMAIL PROTECTED]>;
> > > > +   mpscintr = <&/mv64x60/[EMAIL PROTECTED]>;
> > > > +   block-index = <0>;
> > > 
> > > What is this block-index thing about here?  Since the devices are
> > > disambiguated by their register address, why do you need it?
> > 
> > This particular one is needed to access the correct MPSC interrupt reg.
> > Maybe it would be better to make a new property for this but it was only
> > one reg and block-index was already there and basically served that
> > purpose so I used it.  I'd be happy to use an alternative if you have
> > something you think is better.
> 
> No, that's an acceptable use for something like this, except that
> "cell-index" seems to be the name we've standardised on for other
> similar cases.

Yeah, I realize that but block-index was here first!
More seriously, I don't like "cell" because it isn't a cell, its a
block or an instance or an...I dunno but its not a cell IMHO.
Anyway, I'll think about changing it to cell but I already feel
dirty just thinking about it.

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


RE: [PATCH] [POWERPC] [v2] Improved documentation of device tree'ranges'.

2007-12-03 Thread Stephen Neuendorffer

I'm actually a little embarrassed that I didn't pick that nit myself.. :)

-Original Message-
From: David Gibson [mailto:[EMAIL PROTECTED]
Sent: Mon 12/3/2007 6:40 PM
To: Stephen Neuendorffer
Cc: [EMAIL PROTECTED]; linuxppc-dev@ozlabs.org
Subject: Re: [PATCH] [POWERPC] [v2] Improved documentation of device 
tree'ranges'.
 

On Mon, Dec 03, 2007 at 05:08:57PM -0800, Stephen Neuendorffer wrote:
> I was misled by the prior language.  I've attempted to clarify how
> 'ranges' are used, in particular, how to get an identity mapping.
> 
> Signed-off-by: Stephen Neuendorffer <[EMAIL PROTECTED]>

Acked-by: David Gibson <[EMAIL PROTECTED]>

Thanks for the update.  I particularly dislike the "1:1" terminology,
because in maths-speak *any* ranges translation is 1:1, unless it
includes overlapping ranges.

-- 
David Gibson| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au  | minimalist, thank you.  NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson


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

Re: [PATCH 1/5] PowerPC 74xx: Katana Qp device tree

2007-12-03 Thread Mark A. Greer
On Tue, Dec 04, 2007 at 01:14:43PM +1100, Benjamin Herrenschmidt wrote:
> 
>  .../... (snip scary bunch of errata)
> 
> > - "FEr PCI-#4" (Detailed by Application Note AN-84):
> > 
> > [This isn't strictly a coherency issue but having coherency enabled
> > exacerbates the problem.]  Basically, the bridge can let the cpu read
> > a pci device's registers before all of the data the PCI devices has
> > written has actually made it to memory.  This and the fact that the
> > device's write data may be stuck in the PCI Slave Write Buffer
> > (which isn't checked for coherency), the cpu can get stale data.
> > 
> > There are no plans to fix that erratum.
> 
> So if I understand correctly, there's no plan to fix a major PCI spec
> violation which prevent any kind of reliable implementation whatsoever ?

That's just for that particular part (e.g., 64360).  Newer parts like
the 64460 have it fixed.

> > So, the answer depends on what part & what rev of the part you have
> > (e.g., the pegasos doesn't use the MPSC and apparently has the other
> > issues worked around so it can turn on coherency but the prpmc2800
> > doesn't so it needs coherency off).
> > 
> > BTW, I haven't forgotten the inherent bug you described when coherency
> > is off (/me too lazy to find link to the email) but AFAIK I've never run
> > into it.  However, if I turn on coherency and stress the PCI bus, it
> > hangs (I can't even look at memory thru a bdi).
> 
> Well, as it is today, the "classic" MMU code cannot deal with !coherent.
> The entire linear mapping is always mapped cacheable with BATs, so stuff
> may be brought into the cache at any time, potentially polluting DMA
> data.
>
> Dealing with that would be hard. It might be possible by using G on the
> entire linear mapping like we do on 4xx (yuck), and/or by not using
> D-BATs (the kernel will blow up in various areas without I-BATs).

Hrm, I didn't realize it was in such bad shape.  I'll have to take a
closer look.

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


[RFC 0/7] powerpc: Rework pm_power_off & machine_[restart|power_off|halt]

2007-12-03 Thread Mark A. Greer
We seem to have the pm_power_off hook wrong in arch/powerpc.  From the
other arches and from how its used by the rest of the kernel (e.g., ipmi),
it should point to the lowest-level power off function not to
machine_power_off().  Actually, machine_power_off() should call pm_power_off
since AFAICT it is the one and only interface used by the rest of the kernel
to power a machine off (with one exception which I believe to be a bug and
have a patch in this series to fix).

While looking at this, I found several bits of code that needed minor
rework and/or cleaning up.  These bits include: refactoring some
common code used by the machine_xxx routines, having machine_power_off
call ppc_md.halt if there ppc_md.power_off is NULL or returns, having
machine_halt call ppc_md.power_off it ppc_md.halt is NULL or returns,
and removing some useless xxx_halt and xxx_power_off routines in
platform code.

With the new usage of pm_power_off, the ppc_md.power_off hook is
no longer needed and pm_power_off will be assigned in the platform
probe routine.

The end result of all of these patches should make the check of
pm_power_off being NULL in kernel/sys.c:sys_reboot useful for powerpc,
eliminate the need for platform halt routines to call the power off routine
(and vice versa), allow things like IPMI to take over pm_power_off
when they need to, and make the power off/halt related code a bit cleaner
& consistent.

I still have to make sure I didn't miss anything and I haven't compiled
all the files I've touched so these aren't submission candidates yet.

I'd appreciate any feedback.

Thanks,

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


Re: [PATCH] Add IPIC MSI interrupt support

2007-12-03 Thread Michael Ellerman
On Mon, 2007-12-03 at 17:07 +0800, Li Li wrote:
> Hi Michael,
> 
> I emulate mpic to write this IPIC MSI routines. :)
> 
> 
> > > 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

> > > +
> > > +#define  ipic_msi_irq_to_hw(virq)((unsigned 
> > > int)irq_map[virq].hwirq)
> > 
> > What's wrong with virq_to_hw() ?
> > 
> 
> viqr_to_hw is not __inline__.

Hmm, ok. The three places you use it you also take a spin lock, so I'm
not sure the function call's really going to kill you performance wise.

> > > +
> > > +static void ipic_msi_compose_msg(struct ipic_msi *msi, int hwirq,
> > > + struct msi_msg *msg)
> > > +{
> > > + unsigned int srs;
> > > + unsigned int ibs;
> > > +
> > > + srs = hwirq / msi->int_per_msir;
> > > + ibs = hwirq - srs * msi->int_per_msir;
> > > +
> > > + msg->address_lo = msi->msi_addr_lo;
> > > + msg->address_hi = msi->msi_addr_hi;
> > > + msg->data = (srs << 5) | (ibs & 0x1F);
> > > +
> > > + pr_debug("%s: allocated srs: %d, ibs: %d\n",
> > > + __FUNCTION__, srs, ibs);
> > > +
> > > +}
> > > +
> > > +static int ipic_msi_setup_irqs(struct pci_dev *pdev, int nvec, int type)
> > > +{
> > > + struct ipic_msi *msi = ipic_msi;
> > > + irq_hw_number_t hwirq;
> > > + unsigned int virq;
> > > + struct msi_desc *entry;
> > > + struct msi_msg msg;
> > > +
> > > + list_for_each_entry(entry, &pdev->msi_list, list) {
> > > + hwirq = ipic_msi_alloc_hwirqs(msi, 1);
> > > + if (hwirq < 0) {
> > > + pr_debug("%s: fail allocating msi interrupt\n",
> > > + __FUNCTION__);
> > > + return hwirq;
> > > + }
> > > +
> > > + /* This hwirq belongs to the irq_host other than irq_host of 
> > > IPIC
> > > +  * So, it is independent to hwirq of IPIC */
> > > + virq = irq_create_mapping(msi->irqhost, hwirq);
> > > + if (virq == NO_IRQ) {
> > > + pr_debug("%s: fail mapping hwirq 0x%lx\n",
> > > + __FUNCTION__, hwirq);
> > > + ipic_msi_free_hwirqs(msi, hwirq, 1);
> > > + return -ENOSPC;
> > > + }
> > > + set_irq_msi(virq, entry);
> > > + ipic_msi_compose_msg(msi, hwirq, &msg);
> > > + write_msi_msg(virq, &msg);
> > > +
> > > + hwirq++;
> > 
> >    this looks like my bug
> 
> I have a question here. Do we support more MSI interrupts on ONE pci
> device?

I'm not sure what you mean? For MSI there is only one MSI per device,
but this code is used also for MSI-X which supports > 1 MSI per device.

Either way we shouldn't be incrementing hwirq by hand, it's reassigned
at the top of the loop. I think that's left over from old code that
allocated nvec hwirqs in a block and then created virq mappings for each
one, whereas the new code allocates each hwirq separately.

cheers

-- 
Michael Ellerman
OzLabs, IBM Australia Development Lab

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

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


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

[PATCH 1/7] powerpc: Drivers should call machine_power_off not pm_power_off

2007-12-03 Thread Mark A. Greer
From: Mark A. Greer <[EMAIL PROTECTED]>

Drivers should call machine_power_off() not pm_power_off to power off
a machine.

Signed-off-by: Mark A. Greer <[EMAIL PROTECTED]>
---
 drivers/parisc/power.c |6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/parisc/power.c b/drivers/parisc/power.c
index 90cca5e..188a1ac 100644
--- a/drivers/parisc/power.c
+++ b/drivers/parisc/power.c
@@ -93,11 +93,9 @@ static void process_shutdown(void)
lcd_print(msg);
 
/* send kill signal */
-   if (kill_cad_pid(SIGINT, 1)) {
+   if (kill_cad_pid(SIGINT, 1))
/* just in case killing init process failed */
-   if (pm_power_off)
-   pm_power_off();
-   }
+   machine_power_off();
}
 }
 
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH 3/7] powerpc: ras.c should call machine_power_off()

2007-12-03 Thread Mark A. Greer
From: Mark A. Greer <[EMAIL PROTECTED]>

machine_power_off() is the proper interface to use for powering
off a machine.

Signed-off-by: Mark A. Greer <[EMAIL PROTECTED]>
---
 arch/powerpc/platforms/pseries/ras.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/platforms/pseries/ras.c 
b/arch/powerpc/platforms/pseries/ras.c
index a1ab25c..64564b2 100644
--- a/arch/powerpc/platforms/pseries/ras.c
+++ b/arch/powerpc/platforms/pseries/ras.c
@@ -242,7 +242,7 @@ static irqreturn_t ras_error_interrupt(int irq, void 
*dev_id)
 * without actually failing while injecting errors.
 * Error data will not be logged to syslog.
 */
-   ppc_md.power_off();
+   machine_power_off();
 #endif
} else {
udbg_printf("Recoverable HW Error <0x%lx 0x%x>\n",
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH 5/7] powerpc: Replace ppc_md.power_off with pm_power_off

2007-12-03 Thread Mark A. Greer
From: Mark A. Greer <[EMAIL PROTECTED]>

The ppc_md.power_off hook performs the same function that the
pm_power_off hook is supposed to.  However, it is powerpc-specific
and prevents kernel drivers (e.g., IPMI) from changing how a platform
is powered off.  So, get rid of ppc_md.power_off and replace it with
pm_power_off.

Signed-off-by: Mark A. Greer <[EMAIL PROTECTED]>
---
 arch/powerpc/kernel/setup-common.c   |   14 +--
 arch/powerpc/platforms/52xx/efika.c  |2 
 arch/powerpc/platforms/cell/setup.c  |2 
 arch/powerpc/platforms/celleb/setup.c|2 
 arch/powerpc/platforms/chrp/setup.c  |2 
 arch/powerpc/platforms/embedded6xx/linkstation.c |3 
 arch/powerpc/platforms/iseries/setup.c   |2 
 arch/powerpc/platforms/maple/setup.c |4 
 arch/powerpc/platforms/powermac/setup.c  |2 
 arch/powerpc/platforms/ps3/setup.c   |2 
 arch/powerpc/platforms/pseries/setup.c   |   59 ++---
 include/asm-powerpc/machdep.h|1 
 12 files changed, 48 insertions(+), 47 deletions(-)


diff --git a/arch/powerpc/kernel/setup-common.c 
b/arch/powerpc/kernel/setup-common.c
index 1f8f9aa..d9f2e07 100644
--- a/arch/powerpc/kernel/setup-common.c
+++ b/arch/powerpc/kernel/setup-common.c
@@ -76,6 +76,9 @@ EXPORT_SYMBOL(ppc_md);
 struct machdep_calls *machine_id;
 EXPORT_SYMBOL(machine_id);
 
+void (*pm_power_off)(void);
+EXPORT_SYMBOL_GPL(pm_power_off);
+
 unsigned long klimit = (unsigned long) _end;
 
 char cmd_line[COMMAND_LINE_SIZE];
@@ -127,8 +130,8 @@ void machine_restart(char *cmd)
 void machine_power_off(void)
 {
machine_shutdown();
-   if (ppc_md.power_off)
-   ppc_md.power_off();
+   if (pm_power_off)
+   pm_power_off();
printk(KERN_EMERG "System not powered off; halting instead.\n");
if (ppc_md.halt)
ppc_md.halt();
@@ -137,17 +140,14 @@ void machine_power_off(void)
 /* Used by the G5 thermal driver */
 EXPORT_SYMBOL_GPL(machine_power_off);
 
-void (*pm_power_off)(void) = machine_power_off;
-EXPORT_SYMBOL_GPL(pm_power_off);
-
 void machine_halt(void)
 {
machine_shutdown();
if (ppc_md.halt)
ppc_md.halt();
-   if (ppc_md.power_off) {
+   if (pm_power_off) {
printk(KERN_EMERG "System not halted; powering off instead.\n");
-   ppc_md.power_off();
+   pm_power_off();
printk(KERN_EMERG "Poweroff failed.\n");
}
default_halt("OK to turn off power\n");
diff --git a/arch/powerpc/platforms/52xx/efika.c 
b/arch/powerpc/platforms/52xx/efika.c
index a0da70c..c2d5f06 100644
--- a/arch/powerpc/platforms/52xx/efika.c
+++ b/arch/powerpc/platforms/52xx/efika.c
@@ -205,6 +205,7 @@ static int __init efika_probe(void)
DMA_MODE_READ = 0x44;
DMA_MODE_WRITE = 0x48;
 
+   pm_power_off = rtas_power_off;
return 1;
 }
 
@@ -218,7 +219,6 @@ define_machine(efika)
.init_IRQ   = mpc52xx_init_irq,
.get_irq= mpc52xx_get_irq,
.restart= rtas_restart,
-   .power_off  = rtas_power_off,
.halt   = rtas_halt,
.set_rtc_time   = rtas_set_rtc_time,
.get_rtc_time   = rtas_get_rtc_time,
diff --git a/arch/powerpc/platforms/cell/setup.c 
b/arch/powerpc/platforms/cell/setup.c
index 98e7ef8..06f44f5 100644
--- a/arch/powerpc/platforms/cell/setup.c
+++ b/arch/powerpc/platforms/cell/setup.c
@@ -191,6 +191,7 @@ static int __init cell_probe(void)
return 0;
 
hpte_init_native();
+   pm_power_off = rtas_power_off;
 
return 1;
 }
@@ -201,7 +202,6 @@ define_machine(cell) {
.setup_arch = cell_setup_arch,
.show_cpuinfo   = cell_show_cpuinfo,
.restart= rtas_restart,
-   .power_off  = rtas_power_off,
.halt   = rtas_halt,
.get_boot_time  = rtas_get_boot_time,
.get_rtc_time   = rtas_get_rtc_time,
diff --git a/arch/powerpc/platforms/celleb/setup.c 
b/arch/powerpc/platforms/celleb/setup.c
index ddfb35a..450841a 100644
--- a/arch/powerpc/platforms/celleb/setup.c
+++ b/arch/powerpc/platforms/celleb/setup.c
@@ -116,6 +116,7 @@ static int __init celleb_probe(void)
 
powerpc_firmware_features |= FW_FEATURE_CELLEB_POSSIBLE;
hpte_init_beat_v3();
+   pm_power_off = beat_power_off;
return 1;
 }
 
@@ -145,7 +146,6 @@ define_machine(celleb) {
.setup_arch = celleb_setup_arch,
.show_cpuinfo   = celleb_show_cpuinfo,
.restart= beat_restart,
-   .power_off  = beat_power_off,
.halt   = beat_halt,
.get_rtc_time   = beat_get_rtc_time,
.set_rtc_time   = beat_set_rtc_time,
diff --git 

[PATCH 6/7] powerpc: Remove redundant power_off and halt routines

2007-12-03 Thread Mark A. Greer
From: Mark A. Greer <[EMAIL PROTECTED]>

Remove platform-specific power_off and halt routines, and ppc_md
initializations that are not necessary.

Signed-off-by: Mark A. Greer <[EMAIL PROTECTED]>
---
 arch/powerpc/platforms/embedded6xx/holly.c|   12 
 arch/powerpc/platforms/embedded6xx/linkstation.c  |7 ---
 arch/powerpc/platforms/embedded6xx/mpc7448_hpc2.c |   11 ---
 arch/powerpc/platforms/iseries/setup.c|1 -
 arch/powerpc/platforms/maple/setup.c  |6 --
 arch/powerpc/platforms/powermac/setup.c   |7 ---
 6 files changed, 44 deletions(-)

diff --git a/arch/powerpc/platforms/embedded6xx/holly.c 
b/arch/powerpc/platforms/embedded6xx/holly.c
index b6de2b5..70cfd37 100644
--- a/arch/powerpc/platforms/embedded6xx/holly.c
+++ b/arch/powerpc/platforms/embedded6xx/holly.c
@@ -253,18 +253,6 @@ void holly_restart(char *cmd)
for (;;) ;
 }
 
-void holly_power_off(void)
-{
-   local_irq_disable();
-   /* No way to shut power off with software */
-   for (;;) ;
-}
-
-void holly_halt(void)
-{
-   holly_power_off();
-}
-
 /*
  * Called very early, device-tree isn't unflattened
  */
diff --git a/arch/powerpc/platforms/embedded6xx/linkstation.c 
b/arch/powerpc/platforms/embedded6xx/linkstation.c
index 8792840..3382eef 100644
--- a/arch/powerpc/platforms/embedded6xx/linkstation.c
+++ b/arch/powerpc/platforms/embedded6xx/linkstation.c
@@ -162,12 +162,6 @@ static void linkstation_power_off(void)
/* NOTREACHED */
 }
 
-static void linkstation_halt(void)
-{
-   linkstation_power_off();
-   /* NOTREACHED */
-}
-
 static void linkstation_show_cpuinfo(struct seq_file *m)
 {
seq_printf(m, "vendor\t\t: Buffalo Technology\n");
@@ -195,6 +189,5 @@ define_machine(linkstation){
.show_cpuinfo   = linkstation_show_cpuinfo,
.get_irq= mpic_get_irq,
.restart= linkstation_restart,
-   .halt   = linkstation_halt,
.calibrate_decr = generic_calibrate_decr,
 };
diff --git a/arch/powerpc/platforms/embedded6xx/mpc7448_hpc2.c 
b/arch/powerpc/platforms/embedded6xx/mpc7448_hpc2.c
index a2c04b9..557a6fe 100644
--- a/arch/powerpc/platforms/embedded6xx/mpc7448_hpc2.c
+++ b/arch/powerpc/platforms/embedded6xx/mpc7448_hpc2.c
@@ -179,17 +179,6 @@ void mpc7448_hpc2_restart(char *cmd)
for (;;) ;  /* Spin until reset happens */
 }
 
-void mpc7448_hpc2_power_off(void)
-{
-   local_irq_disable();
-   for (;;) ;  /* No way to shut power off with software */
-}
-
-void mpc7448_hpc2_halt(void)
-{
-   mpc7448_hpc2_power_off();
-}
-
 /*
  * Called very early, device-tree isn't unflattened
  */
diff --git a/arch/powerpc/platforms/iseries/setup.c 
b/arch/powerpc/platforms/iseries/setup.c
index 362084e..0eabbc3 100644
--- a/arch/powerpc/platforms/iseries/setup.c
+++ b/arch/powerpc/platforms/iseries/setup.c
@@ -650,7 +650,6 @@ define_machine(iseries) {
.init_early = iSeries_init_early,
.pcibios_fixup  = iSeries_pci_final_fixup,
.restart= mf_reboot,
-   .halt   = mf_power_off,
.get_boot_time  = iSeries_get_boot_time,
.set_rtc_time   = iSeries_set_rtc_time,
.get_rtc_time   = iSeries_get_rtc_time,
diff --git a/arch/powerpc/platforms/maple/setup.c 
b/arch/powerpc/platforms/maple/setup.c
index d0eb901..ac5f99a 100644
--- a/arch/powerpc/platforms/maple/setup.c
+++ b/arch/powerpc/platforms/maple/setup.c
@@ -151,11 +151,6 @@ static void maple_power_off(void)
printk(KERN_EMERG "Maple: Manual Power-Down Required\n");
 }
 
-static void maple_halt(void)
-{
-   maple_power_off();
-}
-
 #ifdef CONFIG_SMP
 struct smp_ops_t maple_smp_ops = {
.probe  = smp_mpic_probe,
@@ -329,7 +324,6 @@ define_machine(maple_md) {
.pci_irq_fixup  = maple_pci_irq_fixup,
.pci_get_legacy_ide_irq = maple_pci_get_legacy_ide_irq,
.restart= maple_restart,
-   .halt   = maple_halt,
.get_boot_time  = maple_get_boot_time,
.set_rtc_time   = maple_set_rtc_time,
.get_rtc_time   = maple_get_rtc_time,
diff --git a/arch/powerpc/platforms/powermac/setup.c 
b/arch/powerpc/platforms/powermac/setup.c
index 8429002..002b0b4 100644
--- a/arch/powerpc/platforms/powermac/setup.c
+++ b/arch/powerpc/platforms/powermac/setup.c
@@ -499,12 +499,6 @@ static void pmac_power_off(void)
}
 }
 
-static void
-pmac_halt(void)
-{
-   pmac_power_off();
-}
-
 /* 
  * Early initialization.
  */
@@ -677,7 +671,6 @@ define_machine(powermac) {
.get_irq= NULL, /* changed later */
.pci_irq_fixup  = pmac_pci_irq_fixup,
.restart= pmac_restart,
-   .halt   = pmac_halt,
.time_init  = pmac_time_init,
.get_boot_time  

Re: [PATCH] powermac: proper sleep management

2007-12-03 Thread Paul Mackerras
Johannes Berg writes:

> + printk(KERN_INFO
> +"via-pmu: the PMU_IOC_SLEEP ioctl is deprecated.\n");
> + printk(KERN_INFO "via-pmu: use \"echo mem >"
> +" /sys/power/state\"  instead!\n");
> + printk(KERN_INFO
> +"via-pmu: this ioctl will be removed soon.\n");

I don't like this.  I would rather keep the ioctls indefinitely and
not make any noise about programs using them.  The ioctls are part of
the kernel/user ABI, and thus need to be preserved, especially since
it only takes about 6 or 7 lines of code to implement them.

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


[PATCH v2] Fix hardware IRQ time accounting problem.

2007-12-03 Thread Tony Breeds
The commit fa13a5a1f25f671d084d8884be96fc48d9b68275 (sched: restore
deterministic CPU accounting on powerpc), unconditionally calls
update_process_tick() in system context.  In the deterministic accounting case
this is the correct thing to do.  However, in the non-deterministic accounting
case we need to not do this, and results in the time accounted as hardware irq
time being artificially elevated.

Also this patch collapses 2 consecutive '#ifdef CONFIG_VIRT_CPU_ACCOUNTING'
checks in time.h into one for neatness.

Signed-off-by: Tony Breeds <[EMAIL PROTECTED]>
---
The problem was seen and reported by Johannes Berg  and Frederik Himpe.
Paul, I think this is good for 2.6.24.

Changes since v1:
 - I noticed that the #define was explictly using "current" rather than
   the task passed in.  Using tsk is the right thing to do.
 - The whiteapce changes dirty-up the patch and are un-needed with the
   change above.

 arch/powerpc/kernel/process.c |2 +-
 include/asm-powerpc/time.h|8 ++--
 2 files changed, 3 insertions(+), 7 deletions(-)

diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
index 41e13f4..b9d8837 100644
--- a/arch/powerpc/kernel/process.c
+++ b/arch/powerpc/kernel/process.c
@@ -350,7 +350,7 @@ struct task_struct *__switch_to(struct task_struct *prev,
local_irq_save(flags);
 
account_system_vtime(current);
-   account_process_tick(current, 0);
+   account_process_vtime(current);
calculate_steal_time();
 
last = _switch(old_thread, new_thread);
diff --git a/include/asm-powerpc/time.h b/include/asm-powerpc/time.h
index 780f826..a7281e0 100644
--- a/include/asm-powerpc/time.h
+++ b/include/asm-powerpc/time.h
@@ -237,18 +237,14 @@ struct cpu_usage {
 
 DECLARE_PER_CPU(struct cpu_usage, cpu_usage_array);
 
-#ifdef CONFIG_VIRT_CPU_ACCOUNTING
-extern void account_process_vtime(struct task_struct *tsk);
-#else
-#define account_process_vtime(tsk) do { } while (0)
-#endif
-
 #if defined(CONFIG_VIRT_CPU_ACCOUNTING)
 extern void calculate_steal_time(void);
 extern void snapshot_timebases(void);
+#define account_process_vtime(tsk) account_process_tick(tsk, 0);
 #else
 #define calculate_steal_time() do { } while (0)
 #define snapshot_timebases()   do { } while (0)
+#define account_process_vtime(tsk) do { } while (0)
 #endif
 
 extern void secondary_cpu_time_init(void);
-- 
1.5.3.6

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


[PATCH 7/7] powerpc: Remove incorrect panic() calls

2007-12-03 Thread Mark A. Greer
From: Mark A. Greer <[EMAIL PROTECTED]>

Platform-specific restart routines should not call panic() when they
fail.  Instead, they should return so the caller (machine_restart())
can halt the system more gracefully.

Signed-off-by: Mark A. Greer <[EMAIL PROTECTED]>
---
 arch/powerpc/platforms/82xx/pq2.c  |2 --
 arch/powerpc/platforms/8xx/m8xx_setup.c|1 -
 arch/powerpc/platforms/embedded6xx/prpmc2800.c |1 -
 3 files changed, 4 deletions(-)

diff --git a/arch/powerpc/platforms/82xx/pq2.c 
b/arch/powerpc/platforms/82xx/pq2.c
index a497cba..16cd460 100644
--- a/arch/powerpc/platforms/82xx/pq2.c
+++ b/arch/powerpc/platforms/82xx/pq2.c
@@ -31,8 +31,6 @@ void pq2_restart(char *cmd)
/* Clear the ME,EE,IR & DR bits in MSR to cause checkstop */
mtmsr(mfmsr() & ~(MSR_ME | MSR_EE | MSR_IR | MSR_DR));
in_8(&cpm2_immr->im_clkrst.res[0]);
-
-   panic("Restart failed\n");
 }
 
 #ifdef CONFIG_PCI
diff --git a/arch/powerpc/platforms/8xx/m8xx_setup.c 
b/arch/powerpc/platforms/8xx/m8xx_setup.c
index d35eda8..1014310 100644
--- a/arch/powerpc/platforms/8xx/m8xx_setup.c
+++ b/arch/powerpc/platforms/8xx/m8xx_setup.c
@@ -221,7 +221,6 @@ void mpc8xx_restart(char *cmd)
mtmsr(mfmsr() & ~0x1000);
 
in_8(&clk_r->res[0]);
-   panic("Restart failed\n");
 }
 
 static void cpm_cascade(unsigned int irq, struct irq_desc *desc)
diff --git a/arch/powerpc/platforms/embedded6xx/prpmc2800.c 
b/arch/powerpc/platforms/embedded6xx/prpmc2800.c
index 653a5eb..fe5920c 100644
--- a/arch/powerpc/platforms/embedded6xx/prpmc2800.c
+++ b/arch/powerpc/platforms/embedded6xx/prpmc2800.c
@@ -108,7 +108,6 @@ static void prpmc2800_restart(char *cmd)
prpmc2800_reset_board();
 
while (i-- > 0);
-   panic("restart failed\n");
 }
 
 #ifdef CONFIG_NOT_COHERENT_CACHE
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH] pci: Fix bus resource assignment on 32 bits with 64b resources

2007-12-03 Thread Benjamin Herrenschmidt
The current pci_assign_unassigned_resources() code doesn't work properly
on 32 bits platforms with 64 bits resources. The main reason is the use
of unsigned long in various places instead of resource_size_t.

This fixes it, along with some tricks to avoid casting to 64 bits on
platforms that don't need it in every printk around.

This is a pre-requisite for making powerpc use the generic code instead of
its own half-useful implementation.

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

 drivers/pci/pci.h   |   11 +++
 drivers/pci/setup-bus.c |   32 +---
 drivers/pci/setup-res.c |5 ++---
 include/linux/pci.h |4 ++--
 4 files changed, 32 insertions(+), 20 deletions(-)

Index: linux-work/drivers/pci/pci.h
===
--- linux-work.orig/drivers/pci/pci.h   2007-12-04 17:00:43.0 +1100
+++ linux-work/drivers/pci/pci.h2007-12-04 17:02:11.0 +1100
@@ -91,3 +91,14 @@ pci_match_one_device(const struct pci_de
 }
 
 struct pci_dev *pci_find_upstream_pcie_bridge(struct pci_dev *pdev);
+
+#ifdef CONFIG_RESOURCES_64BIT
+#define RESOURCE_ORDER(order)  (1ULL << (order))
+#define RES_PR "%016llx"
+#else
+#define RESOURCE_ORDER(order)  (1UL << (order))
+#define RES_PR "%08lx"
+#endif
+
+#define RANGE_PR   RES_PR "-" RES_PR
+
Index: linux-work/drivers/pci/setup-bus.c
===
--- linux-work.orig/drivers/pci/setup-bus.c 2007-12-04 17:00:43.0 
+1100
+++ linux-work/drivers/pci/setup-bus.c  2007-12-04 17:04:23.0 +1100
@@ -26,6 +26,7 @@
 #include 
 #include 
 
+#include "pci.h"
 
 #define DEBUG_CONFIG 1
 #if DEBUG_CONFIG
@@ -89,8 +90,9 @@ void pci_setup_cardbus(struct pci_bus *b
 * The IO resource is allocated a range twice as large as it
 * would normally need.  This allows us to set both IO regs.
 */
-   printk("  IO window: %08lx-%08lx\n",
-   region.start, region.end);
+   printk(KERN_INFO "  IO window: 0x%08lx-0x%08lx\n",
+  (unsigned long)region.start,
+  (unsigned long)region.end);
pci_write_config_dword(bridge, PCI_CB_IO_BASE_0,
region.start);
pci_write_config_dword(bridge, PCI_CB_IO_LIMIT_0,
@@ -99,7 +101,7 @@ void pci_setup_cardbus(struct pci_bus *b
 
pcibios_resource_to_bus(bridge, ®ion, bus->resource[1]);
if (bus->resource[1]->flags & IORESOURCE_IO) {
-   printk("  IO window: %08lx-%08lx\n",
+   printk(KERN_INFO "  IO window: "RANGE_PR"\n",
region.start, region.end);
pci_write_config_dword(bridge, PCI_CB_IO_BASE_1,
region.start);
@@ -109,7 +111,7 @@ void pci_setup_cardbus(struct pci_bus *b
 
pcibios_resource_to_bus(bridge, ®ion, bus->resource[2]);
if (bus->resource[2]->flags & IORESOURCE_MEM) {
-   printk("  PREFETCH window: %08lx-%08lx\n",
+   printk(KERN_INFO "  PREFETCH window: "RANGE_PR"\n",
region.start, region.end);
pci_write_config_dword(bridge, PCI_CB_MEMORY_BASE_0,
region.start);
@@ -119,7 +121,7 @@ void pci_setup_cardbus(struct pci_bus *b
 
pcibios_resource_to_bus(bridge, ®ion, bus->resource[3]);
if (bus->resource[3]->flags & IORESOURCE_MEM) {
-   printk("  MEM window: %08lx-%08lx\n",
+   printk(KERN_INFO "  MEM window: "RANGE_PR"\n",
region.start, region.end);
pci_write_config_dword(bridge, PCI_CB_MEMORY_BASE_1,
region.start);
@@ -159,7 +161,8 @@ pci_setup_bridge(struct pci_bus *bus)
/* Set up upper 16 bits of I/O base/limit. */
io_upper16 = (region.end & 0x) | (region.start >> 16);
DBG(KERN_INFO "  IO window: %04lx-%04lx\n",
-   region.start, region.end);
+   (unsigned long)region.start,
+   (unsigned long)region.end);
}
else {
/* Clear upper 16 bits of I/O base/limit. */
@@ -180,7 +183,7 @@ pci_setup_bridge(struct pci_bus *bus)
if (bus->resource[1]->flags & IORESOURCE_MEM) {
l = (region.start >> 16) & 0xfff0;
l |= region.end & 0xfff0;
-   DBG(KERN_INFO "  MEM window: %08lx-%08lx\n",
+   DBG(KERN_INFO "  MEM window: "RANGE_PR"\n",
region.start, region.end);
}
else {
@@ -199,7 +202,7 @@ pci_setup_bridge(struct pci_bus *bus)
if (bus->resource[2]->flags & IORESOURCE_PREFETCH) {
l = (region.start >> 16) & 0xff

[PATCH 2/7] powerpc: xmon should call machine_xxx not ppc_md.xxx directly

2007-12-03 Thread Mark A. Greer
From: Mark A. Greer <[EMAIL PROTECTED]>

xmon should call machine_[restart|halt|power_off] instead of
ppc_md.[restart|halt|power_off].

Signed-off-by: Mark A. Greer <[EMAIL PROTECTED]>
---
I'm not sure about this one.  Does anyone see a problem with this?

 arch/powerpc/xmon/xmon.c |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c
index 121b04d..56267e3 100644
--- a/arch/powerpc/xmon/xmon.c
+++ b/arch/powerpc/xmon/xmon.c
@@ -908,11 +908,11 @@ static void bootcmds(void)
 
cmd = inchar();
if (cmd == 'r')
-   ppc_md.restart(NULL);
+   machine_restart();
else if (cmd == 'h')
-   ppc_md.halt();
+   machine_halt();
else if (cmd == 'p')
-   ppc_md.power_off();
+   machine_power_off();
 }
 
 static int cpu_cmd(void)
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH 4/7] powerpc: Rework the machine_[restart|power_off|halt] routines

2007-12-03 Thread Mark A. Greer
From: Mark A. Greer <[EMAIL PROTECTED]>

Factor out common code from the machine_xxx routines and make them better
handle a ppc_md hook that doesn't exist or fails better.  In particular,
have machine_power_off() try ppc_md.halt if ppc_md.power_off is NULL or fails,
and have machine_halt() try to power off when ppc_md.halt is NULL or fails.

Signed-off-by: Mark A. Greer <[EMAIL PROTECTED]>
---
 arch/powerpc/kernel/setup-common.c |   40 ++-
 1 file changed, 22 insertions(+), 18 deletions(-)

diff --git a/arch/powerpc/kernel/setup-common.c 
b/arch/powerpc/kernel/setup-common.c
index 6adb5a1..1f8f9aa 100644
--- a/arch/powerpc/kernel/setup-common.c
+++ b/arch/powerpc/kernel/setup-common.c
@@ -105,17 +105,23 @@ void machine_shutdown(void)
ppc_md.machine_shutdown();
 }
 
-void machine_restart(char *cmd)
+static void default_halt(const char *s)
 {
-   machine_shutdown();
-   if (ppc_md.restart)
-   ppc_md.restart(cmd);
 #ifdef CONFIG_SMP
smp_send_stop();
 #endif
-   printk(KERN_EMERG "System Halted, OK to turn off power\n");
+   printk(KERN_EMERG "%s", s);
local_irq_disable();
-   while (1) ;
+   while (1);
+}
+
+void machine_restart(char *cmd)
+{
+   machine_shutdown();
+   if (ppc_md.restart)
+   ppc_md.restart(cmd);
+   default_halt("System not restarted; halting instead.\n"
+   "OK to turn off power\n");
 }
 
 void machine_power_off(void)
@@ -123,12 +129,10 @@ void machine_power_off(void)
machine_shutdown();
if (ppc_md.power_off)
ppc_md.power_off();
-#ifdef CONFIG_SMP
-   smp_send_stop();
-#endif
-   printk(KERN_EMERG "System Halted, OK to turn off power\n");
-   local_irq_disable();
-   while (1) ;
+   printk(KERN_EMERG "System not powered off; halting instead.\n");
+   if (ppc_md.halt)
+   ppc_md.halt();
+   default_halt("OK to turn off power\n");
 }
 /* Used by the G5 thermal driver */
 EXPORT_SYMBOL_GPL(machine_power_off);
@@ -141,12 +145,12 @@ void machine_halt(void)
machine_shutdown();
if (ppc_md.halt)
ppc_md.halt();
-#ifdef CONFIG_SMP
-   smp_send_stop();
-#endif
-   printk(KERN_EMERG "System Halted, OK to turn off power\n");
-   local_irq_disable();
-   while (1) ;
+   if (ppc_md.power_off) {
+   printk(KERN_EMERG "System not halted; powering off instead.\n");
+   ppc_md.power_off();
+   printk(KERN_EMERG "Poweroff failed.\n");
+   }
+   default_halt("OK to turn off power\n");
 }
 
 
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH 4/7] powerpc: Rework the machine_[restart|power_off|halt] routines

2007-12-03 Thread Benjamin Herrenschmidt

On Mon, 2007-12-03 at 22:47 -0700, Mark A. Greer wrote:
> From: Mark A. Greer <[EMAIL PROTECTED]>
> 
> Factor out common code from the machine_xxx routines and make them better
> handle a ppc_md hook that doesn't exist or fails better.  In particular,
> have machine_power_off() try ppc_md.halt if ppc_md.power_off is NULL or fails,
> and have machine_halt() try to power off when ppc_md.halt is NULL or fails.
> 
> Signed-off-by: Mark A. Greer <[EMAIL PROTECTED]>

Quick glance... looks fine.

> ---
>  arch/powerpc/kernel/setup-common.c |   40 ++-
>  1 file changed, 22 insertions(+), 18 deletions(-)
> 
> diff --git a/arch/powerpc/kernel/setup-common.c 
> b/arch/powerpc/kernel/setup-common.c
> index 6adb5a1..1f8f9aa 100644
> --- a/arch/powerpc/kernel/setup-common.c
> +++ b/arch/powerpc/kernel/setup-common.c
> @@ -105,17 +105,23 @@ void machine_shutdown(void)
>   ppc_md.machine_shutdown();
>  }
>  
> -void machine_restart(char *cmd)
> +static void default_halt(const char *s)
>  {
> - machine_shutdown();
> - if (ppc_md.restart)
> - ppc_md.restart(cmd);
>  #ifdef CONFIG_SMP
>   smp_send_stop();
>  #endif
> - printk(KERN_EMERG "System Halted, OK to turn off power\n");
> + printk(KERN_EMERG "%s", s);
>   local_irq_disable();
> - while (1) ;
> + while (1);
> +}
> +
> +void machine_restart(char *cmd)
> +{
> + machine_shutdown();
> + if (ppc_md.restart)
> + ppc_md.restart(cmd);
> + default_halt("System not restarted; halting instead.\n"
> + "OK to turn off power\n");
>  }
>  
>  void machine_power_off(void)
> @@ -123,12 +129,10 @@ void machine_power_off(void)
>   machine_shutdown();
>   if (ppc_md.power_off)
>   ppc_md.power_off();
> -#ifdef CONFIG_SMP
> - smp_send_stop();
> -#endif
> - printk(KERN_EMERG "System Halted, OK to turn off power\n");
> - local_irq_disable();
> - while (1) ;
> + printk(KERN_EMERG "System not powered off; halting instead.\n");
> + if (ppc_md.halt)
> + ppc_md.halt();
> + default_halt("OK to turn off power\n");
>  }
>  /* Used by the G5 thermal driver */
>  EXPORT_SYMBOL_GPL(machine_power_off);
> @@ -141,12 +145,12 @@ void machine_halt(void)
>   machine_shutdown();
>   if (ppc_md.halt)
>   ppc_md.halt();
> -#ifdef CONFIG_SMP
> - smp_send_stop();
> -#endif
> - printk(KERN_EMERG "System Halted, OK to turn off power\n");
> - local_irq_disable();
> - while (1) ;
> + if (ppc_md.power_off) {
> + printk(KERN_EMERG "System not halted; powering off instead.\n");
> + ppc_md.power_off();
> + printk(KERN_EMERG "Poweroff failed.\n");
> + }
> + default_halt("OK to turn off power\n");
>  }
>  
> 

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


Re: [PATCH 5/7] powerpc: Replace ppc_md.power_off with pm_power_off

2007-12-03 Thread Benjamin Herrenschmidt

On Mon, 2007-12-03 at 22:48 -0700, Mark A. Greer wrote:
> From: Mark A. Greer <[EMAIL PROTECTED]>
> 
> The ppc_md.power_off hook performs the same function that the
> pm_power_off hook is supposed to.  However, it is powerpc-specific
> and prevents kernel drivers (e.g., IPMI) from changing how a platform
> is powered off.  So, get rid of ppc_md.power_off and replace it with
> pm_power_off.

I'm less happy with that one... probably aesthetics :-)

Can't we just have the generic code call pm_power_off and ppc_md and
which ever powers the machine off wins ?

> Signed-off-by: Mark A. Greer <[EMAIL PROTECTED]>
> ---
>  arch/powerpc/kernel/setup-common.c   |   14 +--
>  arch/powerpc/platforms/52xx/efika.c  |2 
>  arch/powerpc/platforms/cell/setup.c  |2 
>  arch/powerpc/platforms/celleb/setup.c|2 
>  arch/powerpc/platforms/chrp/setup.c  |2 
>  arch/powerpc/platforms/embedded6xx/linkstation.c |3 
>  arch/powerpc/platforms/iseries/setup.c   |2 
>  arch/powerpc/platforms/maple/setup.c |4 
>  arch/powerpc/platforms/powermac/setup.c  |2 
>  arch/powerpc/platforms/ps3/setup.c   |2 
>  arch/powerpc/platforms/pseries/setup.c   |   59 ++---
>  include/asm-powerpc/machdep.h|1 
>  12 files changed, 48 insertions(+), 47 deletions(-)
> 
> 
> diff --git a/arch/powerpc/kernel/setup-common.c 
> b/arch/powerpc/kernel/setup-common.c
> index 1f8f9aa..d9f2e07 100644
> --- a/arch/powerpc/kernel/setup-common.c
> +++ b/arch/powerpc/kernel/setup-common.c
> @@ -76,6 +76,9 @@ EXPORT_SYMBOL(ppc_md);
>  struct machdep_calls *machine_id;
>  EXPORT_SYMBOL(machine_id);
>  
> +void (*pm_power_off)(void);
> +EXPORT_SYMBOL_GPL(pm_power_off);
> +
>  unsigned long klimit = (unsigned long) _end;
>  
>  char cmd_line[COMMAND_LINE_SIZE];
> @@ -127,8 +130,8 @@ void machine_restart(char *cmd)
>  void machine_power_off(void)
>  {
>   machine_shutdown();
> - if (ppc_md.power_off)
> - ppc_md.power_off();
> + if (pm_power_off)
> + pm_power_off();
>   printk(KERN_EMERG "System not powered off; halting instead.\n");
>   if (ppc_md.halt)
>   ppc_md.halt();
> @@ -137,17 +140,14 @@ void machine_power_off(void)
>  /* Used by the G5 thermal driver */
>  EXPORT_SYMBOL_GPL(machine_power_off);
>  
> -void (*pm_power_off)(void) = machine_power_off;
> -EXPORT_SYMBOL_GPL(pm_power_off);
> -
>  void machine_halt(void)
>  {
>   machine_shutdown();
>   if (ppc_md.halt)
>   ppc_md.halt();
> - if (ppc_md.power_off) {
> + if (pm_power_off) {
>   printk(KERN_EMERG "System not halted; powering off instead.\n");
> - ppc_md.power_off();
> + pm_power_off();
>   printk(KERN_EMERG "Poweroff failed.\n");
>   }
>   default_halt("OK to turn off power\n");
> diff --git a/arch/powerpc/platforms/52xx/efika.c 
> b/arch/powerpc/platforms/52xx/efika.c
> index a0da70c..c2d5f06 100644
> --- a/arch/powerpc/platforms/52xx/efika.c
> +++ b/arch/powerpc/platforms/52xx/efika.c
> @@ -205,6 +205,7 @@ static int __init efika_probe(void)
>   DMA_MODE_READ = 0x44;
>   DMA_MODE_WRITE = 0x48;
>  
> + pm_power_off = rtas_power_off;
>   return 1;
>  }
>  
> @@ -218,7 +219,6 @@ define_machine(efika)
>   .init_IRQ   = mpc52xx_init_irq,
>   .get_irq= mpc52xx_get_irq,
>   .restart= rtas_restart,
> - .power_off  = rtas_power_off,
>   .halt   = rtas_halt,
>   .set_rtc_time   = rtas_set_rtc_time,
>   .get_rtc_time   = rtas_get_rtc_time,
> diff --git a/arch/powerpc/platforms/cell/setup.c 
> b/arch/powerpc/platforms/cell/setup.c
> index 98e7ef8..06f44f5 100644
> --- a/arch/powerpc/platforms/cell/setup.c
> +++ b/arch/powerpc/platforms/cell/setup.c
> @@ -191,6 +191,7 @@ static int __init cell_probe(void)
>   return 0;
>  
>   hpte_init_native();
> + pm_power_off = rtas_power_off;
>  
>   return 1;
>  }
> @@ -201,7 +202,6 @@ define_machine(cell) {
>   .setup_arch = cell_setup_arch,
>   .show_cpuinfo   = cell_show_cpuinfo,
>   .restart= rtas_restart,
> - .power_off  = rtas_power_off,
>   .halt   = rtas_halt,
>   .get_boot_time  = rtas_get_boot_time,
>   .get_rtc_time   = rtas_get_rtc_time,
> diff --git a/arch/powerpc/platforms/celleb/setup.c 
> b/arch/powerpc/platforms/celleb/setup.c
> index ddfb35a..450841a 100644
> --- a/arch/powerpc/platforms/celleb/setup.c
> +++ b/arch/powerpc/platforms/celleb/setup.c
> @@ -116,6 +116,7 @@ static int __init celleb_probe(void)
>  
>   powerpc_firmware_features |= FW_FEATURE_CELLEB_POSSIBLE;
>   hpte_init_beat_v3();
> + pm_power_off = beat_power_off;
>   return 1;
>  }
>  
> @@ -145,7 +146,6 @@ define

RE: [PATCH] ipic: change ack operation that register isaccessedonly when needed

2007-12-03 Thread Li Yang
> -Original Message-
> From: Benjamin Herrenschmidt [mailto:[EMAIL PROTECTED] 
> Sent: Tuesday, December 04, 2007 10:16 AM
> To: Li Yang
> Cc: [EMAIL PROTECTED]; linuxppc-dev@ozlabs.org
> Subject: RE: [PATCH] ipic: change ack operation that register 
> isaccessedonly when needed
> 
> 
> On Tue, 2007-12-04 at 10:06 +0800, Li Yang wrote:
> > > That should be handled by the higher level flow handler. 
> The generic 
> > > edge one calls ack and the level one mask_and_ack.
> > > Just make them do the right thing, no need to test for 
> the flow type 
> > > in the low level function.
> > 
> > But actually ack is called by edge and per cpu handlers.  
> Mask_and_ack 
> > is also called by edge handler when the same interrupt is 
> already in 
> > progress.  So I don't think that ack/mask_and_ack 
> implicates flow type 
> > by design.
> 
> They do and you can pass different irq_chip with different 
> mask/ack routines if necessary.
Hi Ben,

I mean that mask_ack_irq() routine is used by both generic
handle_edge_irq() and handle_level_irq().  mask_ack_irq doesn't know if
the flow type is level or edge.  Do you suggest to use different
irq_chip for level and edge?

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


RE: [PATCH] ipic: change ack operation that register isaccessedonly when needed

2007-12-03 Thread Benjamin Herrenschmidt

On Tue, 2007-12-04 at 15:23 +0800, Li Yang wrote:
> > -Original Message-
> > From: Benjamin Herrenschmidt [mailto:[EMAIL PROTECTED] 
> > Sent: Tuesday, December 04, 2007 10:16 AM
> > To: Li Yang
> > Cc: [EMAIL PROTECTED]; linuxppc-dev@ozlabs.org
> > Subject: RE: [PATCH] ipic: change ack operation that register 
> > isaccessedonly when needed
> > 
> > 
> > On Tue, 2007-12-04 at 10:06 +0800, Li Yang wrote:
> > > > That should be handled by the higher level flow handler. 
> > The generic 
> > > > edge one calls ack and the level one mask_and_ack.
> > > > Just make them do the right thing, no need to test for 
> > the flow type 
> > > > in the low level function.
> > > 
> > > But actually ack is called by edge and per cpu handlers.  
> > Mask_and_ack 
> > > is also called by edge handler when the same interrupt is 
> > already in 
> > > progress.  So I don't think that ack/mask_and_ack 
> > implicates flow type 
> > > by design.
> > 
> > They do and you can pass different irq_chip with different 
> > mask/ack routines if necessary.
> Hi Ben,
> 
> I mean that mask_ack_irq() routine is used by both generic
> handle_edge_irq() and handle_level_irq().  mask_ack_irq doesn't know if
> the flow type is level or edge.  Do you suggest to use different
> irq_chip for level and edge?

That would be an option. I dislike testing the flow type in the fast
path.

Ben.


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


Re: [PATCH] Add IPIC MSI interrupt support

2007-12-03 Thread Benjamin Herrenschmidt
> I'm not sure what you mean? For MSI there is only one MSI per device,
> but this code is used also for MSI-X which supports > 1 MSI per device.

Or more specifically, for MSI, -linux- supports only one per device (in
theory, it's possible to have multiple MSI non-X but it's a mess).

> Either way we shouldn't be incrementing hwirq by hand, it's reassigned
> at the top of the loop. I think that's left over from old code that
> allocated nvec hwirqs in a block and then created virq mappings for each
> one, whereas the new code allocates each hwirq separately.
> 
> cheers
> 
> ___
> 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