Re: [PATCH] Adding ADMA support for PPC460EX DMA engine.

2010-07-22 Thread Stefan Roese
Hi Marri,

On Friday 23 July 2010 02:57:18 tma...@amcc.com wrote:
> From: Tirumala Marri 
> 
>   This patch will add ADMA support for DMA engine and HW offload for
>   XOR/ADG (RAID-5/6) functionalities.
>   1. It supports memcpy, xor, GF(2) based RAID-6.
>   2. It supports interrupt based DMA completions.
>   3. Also supports memcpy in RAID-1 case.
> 
>   Kernel version: 2.6.35-rc5
> 
>   Testing:
> Created RAID-5/6 arrays usign mdadm.
> And ran raw IO and filesystem IO to the RAID array.
> Chunk size 4k,64k was tested.
> RAID rebuild , disk fail, resync tested.
> 
>   File names:
> This code is similar to ppc440spe . So I named the files as
> drivers/dma/ppc4xx/adma1.c and drivers/dma/ppc4xx/adma1.h

As you describe above, a lot of the code seems to be copied from 
drivers/dma/ppc4xx/adma.c/h. Wouldn't it make more sense to factor out the 
common code instead of duplicating it?
 
Thanks.

Cheers,
Stefan

--
DENX Software Engineering GmbH,  MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich,  Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-0 Fax: (+49)-8142-66989-80 Email: off...@denx.de
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: [PATCH 3/4] sparc: remove references to of_device and to_of_device

2010-07-22 Thread David Miller
From: Grant Likely 
Date: Thu, 22 Jul 2010 16:30:16 -0600

> of_device is just a #define alias to platform_device.  This patch
> replaces all references to it with platform_device.
> 
> Signed-off-by: Grant Likely 

Acked-by: David S. Miller 
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: [PATCH 1/4] of/device: Replace of_device with platform_device in includes and core code

2010-07-22 Thread David Miller
From: Grant Likely 
Date: Thu, 22 Jul 2010 16:30:06 -0600

> of_device is currently just an #define alias to platform_device until it
> gets removed entirely.  This patch removes references to it from the
> include directories and the core drivers/of code.
> 
> Signed-off-by: Grant Likely 

Acked-by: David S. Miller 
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: [PATCH][RFC] preempt_count corruption across H_CEDE call with CONFIG_PREEMPT on pseries

2010-07-22 Thread Benjamin Herrenschmidt
On Fri, 2010-07-23 at 10:38 +0530, Vaidyanathan Srinivasan wrote:
> Yes.  extended_cede_processor() will return with interrupts enabled in
> the cpu. (This is done by the hypervisor).  Under normal cases we
> cannot be interrupted because no IO interrupts are routed to us after
> xics_teardown_cpu() and since the CPU is out of the map, nobody will
> send us IPIs.

What about decrementer ?

> Though H_CEDE will return with interrupts enabled, it is unlikely that
> an interrupt can be delivered in this context. 

Well, if interrupts are soft-disabled, even if one occurs, we will just
mask and return, so that at least should be ok.

Cheers,
Ben.


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


Re: [PATCH][RFC] preempt_count corruption across H_CEDE call with CONFIG_PREEMPT on pseries

2010-07-22 Thread Benjamin Herrenschmidt
On Thu, 2010-07-22 at 21:44 -0700, Darren Hart wrote:

>  suggestion I updated the instrumentation to display the
> local_save_flags and irqs_disabled_flags:

> Jul 22 23:36:58 igoort1 kernel: local flags: 0, irqs disabled: 1
> Jul 22 23:36:58 igoort1 kernel: before H_CEDE current->stack: 
> c0010e9e3ce0, pcnt: 1
> Jul 22 23:36:58 igoort1 kernel: after H_CEDE current->stack: 
> c0010e9e3ce0, pcnt: 1
> 
> I'm not sure if I'm reading that right, but I believe interrupts are
> intended to be disabled here. If accomplished via the
> spin_lock_irqsave() this would behave differently on RT. However, this
> path disables the interrupts handled by xics, all but the IPIs anyway.
> On RT I disabled the decrementer as well.
> 
> Is it possible for RT to be receiving other interrupts here?

Also you may want to call hard_irq_disable() to -really- disable
interrupts ... since we do lazy-disable on powerpc

Cheers,
Ben.


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


Re: [PATCH][RFC] preempt_count corruption across H_CEDE call with CONFIG_PREEMPT on pseries

2010-07-22 Thread Vaidyanathan Srinivasan
* Darren Hart  [2010-07-22 21:44:04]:

> On 07/22/2010 04:57 PM, Darren Hart wrote:
> > On 07/22/2010 03:25 PM, Benjamin Herrenschmidt wrote:
> >> On Thu, 2010-07-22 at 11:24 -0700, Darren Hart wrote:
> >>>
> >>> 1) How can the preempt_count() get mangled across the H_CEDE hcall?
> >>> 2) Should we call preempt_enable() in cpu_idle() prior to cpu_die() ?
> >>
> >> The preempt count is on the thread info at the bottom of the stack.
> >>
> >> Can you check the stack pointers ?
> > 
> > Hi Ben, thanks for looking.
> > 
> > I instrumented the area around extended_cede_processor() as follows
> > (please confirm I'm getting the stack pointer correctly).
> > 
> > while (get_preferred_offline_state(cpu) == CPU_STATE_INACTIVE) {
> > asm("mr %0,1" : "=r" (sp));
> > printk("before H_CEDE current->stack: %lx, pcnt: %x\n", sp, 
> > preempt_count());
> > extended_cede_processor(cede_latency_hint);
> > asm("mr %0,1" : "=r" (sp));
> > printk("after H_CEDE current->stack: %lx, pcnt: %x\n", sp, 
> > preempt_count());
> >   }
> > 
> > 
> > On Mainline (2.6.33.6, CONFIG_PREEMPT=y) I see this:
> > Jul 22 18:37:08 igoort1 kernel: before H_CEDE current->stack: 
> > c0010e9e3ce0, pcnt: 1
> > Jul 22 18:37:08 igoort1 kernel: after H_CEDE current->stack:  
> > c0010e9e3ce0, pcnt: 1
> > 
> > This surprised me as preempt_count is 1 before and after, so no
> > corruption appears to occur on mainline. This makes the pcnt of 65 I see
> > without the preempt_count()=0 hack very strange. I ran several hundred
> > off/on cycles. The issue of preempt_count being 1 is still addressed by
> > this patch however.
> > 
> > On PREEMPT_RT (2.6.33.5-rt23 - tglx, sorry, rt/2.6.33 next time, promise):
> > Jul 22 18:51:11 igoort1 kernel: before H_CEDE current->stack: 
> > c00089bcfcf0, pcnt: 1
> > Jul 22 18:51:11 igoort1 kernel: after H_CEDE current->stack:  
> > c00089bcfcf0, pcnt: 
> > 
> > In both cases the stack pointer appears unchanged.
> > 
> > Note: there is a BUG triggered in between these statements as the
> > preempt_count causes the printk to trigger:
> > Badness at kernel/sched.c:5572
> 
> At Steven's suggestion I updated the instrumentation to display the
> local_save_flags and irqs_disabled_flags:
> 
> while (get_preferred_offline_state(cpu) == CPU_STATE_INACTIVE) {
> local_save_flags(flags);
> printk("local flags: %lx, irqs disabled: %d\n", flags, 
> irqs_disabled_flags(flags));
> asm("mr %0,1" : "=r" (sp));
> printk("before H_CEDE current->stack: %lx, pcnt: %x\n", sp, 
> preempt_count());
> extended_cede_processor(cede_latency_hint);
> asm("mr %0,1" : "=r" (sp));
> printk("after H_CEDE current->stack: %lx, pcnt: %x\n", sp, 
> preempt_count());
> }
> 
> 
> Jul 22 23:36:58 igoort1 kernel: local flags: 0, irqs disabled: 1
> Jul 22 23:36:58 igoort1 kernel: before H_CEDE current->stack: 
> c0010e9e3ce0, pcnt: 1
> Jul 22 23:36:58 igoort1 kernel: after H_CEDE current->stack: 
> c0010e9e3ce0, pcnt: 1
> 
> I'm not sure if I'm reading that right, but I believe interrupts are
> intended to be disabled here. If accomplished via the
> spin_lock_irqsave() this would behave differently on RT. However, this
> path disables the interrupts handled by xics, all but the IPIs anyway.
> On RT I disabled the decrementer as well.
> 
> Is it possible for RT to be receiving other interrupts here?

Yes.  extended_cede_processor() will return with interrupts enabled in
the cpu. (This is done by the hypervisor).  Under normal cases we
cannot be interrupted because no IO interrupts are routed to us after
xics_teardown_cpu() and since the CPU is out of the map, nobody will
send us IPIs.

Though H_CEDE will return with interrupts enabled, it is unlikely that
an interrupt can be delivered in this context.

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


Re: [PATCH][RFC] preempt_count corruption across H_CEDE call with CONFIG_PREEMPT on pseries

2010-07-22 Thread Darren Hart
On 07/22/2010 04:57 PM, Darren Hart wrote:
> On 07/22/2010 03:25 PM, Benjamin Herrenschmidt wrote:
>> On Thu, 2010-07-22 at 11:24 -0700, Darren Hart wrote:
>>>
>>> 1) How can the preempt_count() get mangled across the H_CEDE hcall?
>>> 2) Should we call preempt_enable() in cpu_idle() prior to cpu_die() ?
>>
>> The preempt count is on the thread info at the bottom of the stack.
>>
>> Can you check the stack pointers ?
> 
> Hi Ben, thanks for looking.
> 
> I instrumented the area around extended_cede_processor() as follows
> (please confirm I'm getting the stack pointer correctly).
> 
> while (get_preferred_offline_state(cpu) == CPU_STATE_INACTIVE) {
>   asm("mr %0,1" : "=r" (sp));
>   printk("before H_CEDE current->stack: %lx, pcnt: %x\n", sp, 
> preempt_count());
>   extended_cede_processor(cede_latency_hint);
>   asm("mr %0,1" : "=r" (sp));
>   printk("after H_CEDE current->stack: %lx, pcnt: %x\n", sp, 
> preempt_count());
>   }
> 
> 
> On Mainline (2.6.33.6, CONFIG_PREEMPT=y) I see this:
> Jul 22 18:37:08 igoort1 kernel: before H_CEDE current->stack: 
> c0010e9e3ce0, pcnt: 1
> Jul 22 18:37:08 igoort1 kernel: after H_CEDE current->stack:  
> c0010e9e3ce0, pcnt: 1
> 
> This surprised me as preempt_count is 1 before and after, so no
> corruption appears to occur on mainline. This makes the pcnt of 65 I see
> without the preempt_count()=0 hack very strange. I ran several hundred
> off/on cycles. The issue of preempt_count being 1 is still addressed by
> this patch however.
> 
> On PREEMPT_RT (2.6.33.5-rt23 - tglx, sorry, rt/2.6.33 next time, promise):
> Jul 22 18:51:11 igoort1 kernel: before H_CEDE current->stack: 
> c00089bcfcf0, pcnt: 1
> Jul 22 18:51:11 igoort1 kernel: after H_CEDE current->stack:  
> c00089bcfcf0, pcnt: 
> 
> In both cases the stack pointer appears unchanged.
> 
> Note: there is a BUG triggered in between these statements as the
> preempt_count causes the printk to trigger:
> Badness at kernel/sched.c:5572

At Steven's suggestion I updated the instrumentation to display the
local_save_flags and irqs_disabled_flags:

while (get_preferred_offline_state(cpu) == CPU_STATE_INACTIVE) {
local_save_flags(flags);
printk("local flags: %lx, irqs disabled: %d\n", flags, 
irqs_disabled_flags(flags));
asm("mr %0,1" : "=r" (sp));
printk("before H_CEDE current->stack: %lx, pcnt: %x\n", sp, 
preempt_count());
extended_cede_processor(cede_latency_hint);
asm("mr %0,1" : "=r" (sp));
printk("after H_CEDE current->stack: %lx, pcnt: %x\n", sp, 
preempt_count());
}


Jul 22 23:36:58 igoort1 kernel: local flags: 0, irqs disabled: 1
Jul 22 23:36:58 igoort1 kernel: before H_CEDE current->stack: c0010e9e3ce0, 
pcnt: 1
Jul 22 23:36:58 igoort1 kernel: after H_CEDE current->stack: c0010e9e3ce0, 
pcnt: 1

I'm not sure if I'm reading that right, but I believe interrupts are
intended to be disabled here. If accomplished via the
spin_lock_irqsave() this would behave differently on RT. However, this
path disables the interrupts handled by xics, all but the IPIs anyway.
On RT I disabled the decrementer as well.

Is it possible for RT to be receiving other interrupts here?

-- 
Darren Hart
IBM Linux Technology Center
Real-Time Linux Team
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


RE: [PATCH] RapidIO,powerpc/85xx: remove MCSR_MASK in fsl_rio

2010-07-22 Thread Li Yang-R58472
>Subject: [PATCH] RapidIO,powerpc/85xx: remove MCSR_MASK in fsl_rio
>
>Fixes compile problem caused by MCSR_MASK removal from book-E definitions.

Hi Alex,

Only with your patch, there will still be problem on SRIO platforms other than 
MPC85xx.

I have posted a patch series to fix this together with several compatibility 
issues a month before.

http://patchwork.ozlabs.org/patch/56135/
http://patchwork.ozlabs.org/patch/56136/
http://patchwork.ozlabs.org/patch/56138/
http://patchwork.ozlabs.org/patch/56137/


Can anyone pick the patch series quickly as currently there is a compile error 
when SRIO is enabled.

- Leo

>
>Signed-off-by: Alexandre Bounine 
>Cc: Kumar Gala 
>Cc: Grant Likely 
>Cc: Matt Porter 
>---
> arch/powerpc/sysdev/fsl_rio.c |2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
>diff --git a/arch/powerpc/sysdev/fsl_rio.c b/arch/powerpc/sysdev/fsl_rio.c
>index 30e1626..c58df58 100644
>--- a/arch/powerpc/sysdev/fsl_rio.c
>+++ b/arch/powerpc/sysdev/fsl_rio.c
>@@ -245,7 +245,7 @@ static int (*saved_mcheck_exception)(struct pt_regs
>*regs);  static int fsl_rio_mcheck_exception(struct pt_regs *regs)  {
>   const struct exception_table_entry *entry = NULL;
>-  unsigned long reason = (mfspr(SPRN_MCSR) & MCSR_MASK);
>+  unsigned long reason = mfspr(SPRN_MCSR);
>
>   if (reason & MCSR_BUS_RBERR) {
>   reason = in_be32((u32 *)(rio_regs_win + RIO_LTLEDCSR));


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


[git pull] Please pull powerpc.git merge branch

2010-07-22 Thread Benjamin Herrenschmidt
Hi Linus !

Here's a few things for 2.6.35.

One's a fallover from the lmb->memblock rename that I missed, which causes
a bunch of pseries machine to boot with 128M of memory and that's it :-)

There's a few patches fixing a nasty race we found in our hugepage code,
a kexec fix from Kumar, and an .lds fix from Sam for a bug that as far
as we know only affects powerpc.

Cheers,
Ben.

The following changes since commit b37fa16e78d6f9790462b3181602a26b5af36260:
  Linus Torvalds (1):
Linux 2.6.35-rc6

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc.git merge

Anton Blanchard (1):
  powerpc/mm: Handle hypervisor pte insert failure in __hash_page_huge

Benjamin Herrenschmidt (5):
  powerpc/mm: Move around testing of _PAGE_PRESENT in hash code
  powerpc/mm: Fix bugs in huge page hashing
  powerpc/mm: Add some debug output when hash insertion fails
  powerpc: Fix erroneous lmb->memblock conversions
  Merge commit 'kumar/merge' into merge

Kumar Gala (1):
  powerpc/kexec: Fix boundary case for book-e kexec memory limits

Sam Ravnborg (1):
  vmlinux.lds: fix .data..init_task output section (fix popwerpc boot)

 arch/powerpc/include/asm/kexec.h|6 +-
 arch/powerpc/include/asm/mmu-hash64.h   |4 +-
 arch/powerpc/kernel/prom.c  |2 +-
 arch/powerpc/mm/hash_low_64.S   |9 
 arch/powerpc/mm/hash_utils_64.c |   53 +--
 arch/powerpc/mm/hugetlbpage-hash64.c|   40 +
 arch/powerpc/mm/numa.c  |   24 +-
 arch/powerpc/platforms/pseries/hotplug-memory.c |   22 +-
 include/asm-generic/vmlinux.lds.h   |2 +-
 9 files changed, 93 insertions(+), 69 deletions(-)


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


Re: [PATCH] powerpc: ONLINE to OFFLINE CPU state transition during removal

2010-07-22 Thread Vaidyanathan Srinivasan
* Robert Jennings  [2010-07-22 21:43:44]:

> If a CPU remove is attempted using the 'release' interface on hardware
> which supports extended cede, the CPU will be put in the INACTIVE state
> rather than the OFFLINE state due to the default preferred_offline_state
> in that situation.  In the INACTIVE state it will fail to be removed.
> 
> This patch changes the preferred offline state to OFFLINE when an CPU is
> in the ONLINE state.  After cpu_down() is called in dlpar_offline_cpu()
> the CPU will be OFFLINE and CPU removal can continue.

Hi Robert,

Thanks for the patch.  In dlpar operation, we would offline the CPU
first using the sysfs online file and then write to the sysfs release
file to complete the sequence right?  The current code in
dlpar_offline_cpu() would work as long as the cpu is in either
inactive state or offline state (in case of unsupported platform).

Is the dlpar tools being changed to complete the operation with one
sysfs write to release file?

> Signed-off-by: Robert Jennings 
> 
> ---
> 
> diff --git a/arch/powerpc/platforms/pseries/dlpar.c 
> b/arch/powerpc/platforms/pseries/dlpar.c
> index d71e585..227c1c3 100644
> --- a/arch/powerpc/platforms/pseries/dlpar.c
> +++ b/arch/powerpc/platforms/pseries/dlpar.c
> @@ -463,6 +463,7 @@ static int dlpar_offline_cpu(struct device_node *dn)
>   break;
> 
>   if (get_cpu_current_state(cpu) == CPU_STATE_ONLINE) {
> + set_preferred_offline_state(cpu, 
> CPU_STATE_OFFLINE);
>   cpu_maps_update_done();
>   rc = cpu_down(cpu);
>   if (rc)

The patch looks good.  Will need to test out the various scenarios so
that the preferred_offline_state do not get flipped before cpu_down()
is called.  This is unlikely, but still we need to validate
a concurrent sysfs online file write and sysfs release file write.

--Vaidy

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


[PATCH 3/5 v2] powerpc/mm: Fix bugs in huge page hashing

2010-07-22 Thread Benjamin Herrenschmidt
There's a couple of nasty bugs lurking in our huge page hashing code.

First, we don't check the access permission atomically with setting
the _PAGE_BUSY bit, which means that the PTE value we end up using
for the hashing might be different than the one we have checked
the access permissions for.

We've seen cases where that leads us to try to use an invalidated
PTE for hashing, causing all sort of "interesting" issues.

Then, we also failed to set _PAGE_DIRTY on a write access.

Finally, a minor tweak but we should return 0 when we find the
PTE busy, in order to just re-execute the access, rather than 1
which means going to do_page_fault().

Signed-off-by: Benjamin Herrenschmidt 
---
 arch/powerpc/mm/hugetlbpage-hash64.c |   31 +--
 1 files changed, 13 insertions(+), 18 deletions(-)

diff --git a/arch/powerpc/mm/hugetlbpage-hash64.c 
b/arch/powerpc/mm/hugetlbpage-hash64.c
index c9acd79..faae9ec 100644
--- a/arch/powerpc/mm/hugetlbpage-hash64.c
+++ b/arch/powerpc/mm/hugetlbpage-hash64.c
@@ -21,21 +21,13 @@ int __hash_page_huge(unsigned long ea, unsigned long 
access, unsigned long vsid,
unsigned long old_pte, new_pte;
unsigned long va, rflags, pa, sz;
long slot;
-   int err = 1;
 
BUG_ON(shift != mmu_psize_defs[mmu_psize].shift);
 
/* Search the Linux page table for a match with va */
va = hpt_va(ea, vsid, ssize);
 
-   /*
-* Check the user's access rights to the page.  If access should be
-* prevented then send the problem up to do_page_fault.
-*/
-   if (unlikely(access & ~pte_val(*ptep)))
-   goto out;
-   /*
-* At this point, we have a pte (old_pte) which can be used to build
+   /* At this point, we have a pte (old_pte) which can be used to build
 * or update an HPTE. There are 2 cases:
 *
 * 1. There is a valid (present) pte with no associated HPTE (this is
@@ -49,9 +41,17 @@ int __hash_page_huge(unsigned long ea, unsigned long access, 
unsigned long vsid,
 
do {
old_pte = pte_val(*ptep);
-   if (old_pte & _PAGE_BUSY)
-   goto out;
+   /* If PTE busy, retry the access */
+   if (unlikely(old_pte & _PAGE_BUSY))
+   return 0;
+   /* If PTE permissions don't match, take page fault */
+   if (unlikely(access & ~old_pte))
+   return 1;
+   /* Try to lock the PTE, add ACCESSED and DIRTY if it was
+* a write access */
new_pte = old_pte | _PAGE_BUSY | _PAGE_ACCESSED;
+   if (access & _PAGE_RW)
+   new_pte |= _PAGE_DIRTY;
} while(old_pte != __cmpxchg_u64((unsigned long *)ptep,
 old_pte, new_pte));
 
@@ -127,8 +127,7 @@ repeat:
 */
if (unlikely(slot == -2)) {
*ptep = __pte(old_pte);
-   err = -1;
-   goto out;
+   return -1;
}
 
new_pte |= (slot << 12) & (_PAGE_F_SECOND | _PAGE_F_GIX);
@@ -138,9 +137,5 @@ repeat:
 * No need to use ldarx/stdcx here
 */
*ptep = __pte(new_pte & ~_PAGE_BUSY);
-
-   err = 0;
-
- out:
-   return err;
+   return 0;
 }



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


Re: [PATCH 3/5] powerpc/mm: Fix bugs in huge page hashing

2010-07-22 Thread Benjamin Herrenschmidt
On Fri, 2010-07-23 at 10:41 +1000, Benjamin Herrenschmidt wrote:
> There's a couple of nasty bugs lurking in our huge page hashing code.
> 
> First, we don't check the access permission atomically with setting
> the _PAGE_BUSY bit, which means that the PTE value we end up using
> for the hashing might be different than the one we have checked
> the access permissions for.
> 
> We've seen cases where that leads us to try to use an invalidated
> PTE for hashing, causing all sort of "interesting" issues.
> 
> Then, we also failed to set _PAGE_DIRTY on a write access.
> 
> This fixes both, while also simplifying the code a bit.

The changeset lacks a comment about a change to the return value
when hitting _PAGE_BUSY and ...

>   do {
>   old_pte = pte_val(*ptep);
> - if (old_pte & _PAGE_BUSY)
> - goto out;
> + /* If PTE busy, retry the access */
> + if (unlikely(old_pte & _PAGE_BUSY))
> + return 0;
> + /* If PTE permissions don't match, take page fault */
> + if (unlikely(access & ~pte_val(*ptep)))
> + return 1;

old_pte will do just fine instead of reloading it

Thanks Michael !

I'll respin that one.

Cheers,
Ben.

> + /* Try to lock the PTE, add ACCESSED and DIRTY if it was
> +  * a write access */
>   new_pte = old_pte | _PAGE_BUSY | _PAGE_ACCESSED;
> + if (access & _PAGE_RW)
> + new_pte |= _PAGE_DIRTY;
>   } while(old_pte != __cmpxchg_u64((unsigned long *)ptep,
>old_pte, new_pte));
>  
> @@ -127,8 +127,7 @@ repeat:
>*/
>   if (unlikely(slot == -2)) {
>   *ptep = __pte(old_pte);
> - err = -1;
> - goto out;
> + return -1;
>   }
>  
>   new_pte |= (slot << 12) & (_PAGE_F_SECOND | _PAGE_F_GIX);
> @@ -138,9 +137,5 @@ repeat:
>* No need to use ldarx/stdcx here
>*/
>   *ptep = __pte(new_pte & ~_PAGE_BUSY);
> -
> - err = 0;
> -
> - out:
> - return err;
> + return 0;
>  }


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


Re: [PATCH] fix of_flat_dt_is_compatible to match the full compatible string

2010-07-22 Thread Benjamin Herrenschmidt
On Thu, 2010-07-22 at 18:28 -0500, Stuart Yoder wrote:
> From: Stuart Yoder 
> 
> With the previous string comparison, a device tree
> compatible of "foo-bar" would match as compatible
> with a driver looking for "foo".
> 
> Signed-off-by: Stuart Yoder 

Beware you are doing two changes in one here and only documenting one...

You also removed the case insenstivity.

Now, those things are supposed to be case sensitive afaik, but we have
enough legacy HW with more/less crap DTs and I'd be careful with
changing that without a good reason (ie, it breaks not to do it ?).

No objection with fixing the partial match tho.

Cheers,
Ben.

> ---
>  drivers/of/fdt.c |2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
> index dee4fb5..f5239c0 100644
> --- a/drivers/of/fdt.c
> +++ b/drivers/of/fdt.c
> @@ -169,7 +169,7 @@ int __init of_flat_dt_is_compatible(unsigned long node, 
> const char *compat)
>   if (cp == NULL)
>   return 0;
>   while (cplen > 0) {
> - if (strncasecmp(cp, compat, strlen(compat)) == 0)
> + if (!strcmp(cp, compat))
>   return 1;
>   l = strlen(cp) + 1;
>   cp += l;


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


[PATCH] powerpc: ONLINE to OFFLINE CPU state transition during removal

2010-07-22 Thread Robert Jennings
If a CPU remove is attempted using the 'release' interface on hardware
which supports extended cede, the CPU will be put in the INACTIVE state
rather than the OFFLINE state due to the default preferred_offline_state
in that situation.  In the INACTIVE state it will fail to be removed.

This patch changes the preferred offline state to OFFLINE when an CPU is
in the ONLINE state.  After cpu_down() is called in dlpar_offline_cpu()
the CPU will be OFFLINE and CPU removal can continue.

Signed-off-by: Robert Jennings 

---

diff --git a/arch/powerpc/platforms/pseries/dlpar.c 
b/arch/powerpc/platforms/pseries/dlpar.c
index d71e585..227c1c3 100644
--- a/arch/powerpc/platforms/pseries/dlpar.c
+++ b/arch/powerpc/platforms/pseries/dlpar.c
@@ -463,6 +463,7 @@ static int dlpar_offline_cpu(struct device_node *dn)
break;
 
if (get_cpu_current_state(cpu) == CPU_STATE_ONLINE) {
+   set_preferred_offline_state(cpu, 
CPU_STATE_OFFLINE);
cpu_maps_update_done();
rc = cpu_down(cpu);
if (rc)
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


[PATCH 1/1] Added PowerMac10,2 device descriptor

2010-07-22 Thread Mark Crichton
Small patch to recognize the Mac Mini's that were quietly rolled out
~2005. Work needs to
be done on the WOL (Radeon and network card).

Signed-off-by: Mark Crichton 
---
 arch/powerpc/platforms/powermac/feature.c |4 
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/arch/powerpc/platforms/powermac/feature.c
b/arch/powerpc/platforms/powermac/feature.c
index 9e1b9fd..fa90384 100644
--- a/arch/powerpc/platforms/powermac/feature.c
+++ b/arch/powerpc/platforms/powermac/feature.c
@@ -2191,6 +2191,10 @@ static struct pmac_mb_def pmac_mb_defs[] = {
PMAC_TYPE_UNKNOWN_INTREPID, intrepid_features,
PMAC_MB_MAY_SLEEP,
},
+   {   "PowerMac10,2", "Mac mini (Late 2005)",
+   PMAC_TYPE_UNKNOWN_INTREPID, intrepid_features,
+   PMAC_MB_MAY_SLEEP,
+   },
{   "iMac,1",   "iMac (first generation)",
PMAC_TYPE_ORIG_IMAC,paddington_features,
0
-- 
1.7.1
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: linux-next: OOPS at bot time

2010-07-22 Thread Michael Ellerman
On Fri, 2010-07-23 at 02:19 +0100, Ben Hutchings wrote:
> On Fri, 2010-07-23 at 10:22 +1000, Stephen Rothwell wrote:
> > Hi all,
> > 
> > My Power7 boot test paniced like this: (next-20100722)
> > 
> > %GQLogic Fibre Channel HBA Driver: 8.03.03-k0
> > qla2xxx 0002:01:00.2: enabling device (0144 -> 0146)
> > qla2xxx 0002:01:00.2: Found an ISP8001, irq 35, iobase 0xd80080014000
> > [ cut here ]
> > kernel BUG at drivers/pci/msi.c:205!
> [...]
> > Call Trace:
> > [c278b270] [c0048d9c] .rtas_setup_msi_irqs+0x1d8/0x254 
> > (unreliable)
> > [c278b360] [c002a9cc] .arch_setup_msi_irqs+0x34/0x4c
> > [c278b3e0] [c02fd3fc] .pci_enable_msix+0x49c/0x4ac
> [...]
> > That line number is this:
> > 
> > BUG_ON(!(entry->msg.address_hi | entry->msg.address_lo |
> >  entry->msg.data));
> > 
> > in read_msi_msg_desc().  That BUG_ON was added by commit
> > 2ca1af9aa3285c6a5f103ed31ad09f7399fc65d7 ("PCI: MSI: Remove unsafe and
> > unnecessary hardware access") from the pci tree.
> 
> I wanted to assert that read_msi_msg_desc() is only used to update
> MSI/MSI-X descriptors that have already been generated by Linux.  It
> looks like you found an exception.
>
> We could make read_msi_msg() fall back to reading from the hardware, but
> I think that what the pSeries code is trying to do - save an MSI message
> generated by firmware - is different from what the other callers want.
> Instead we could add:
> 
> void save_msi_msg(unsigned int irq)
> {
>   struct irq_desc *desc = irq_to_desc(irq);
>   struct msi_desc *entry = get_irq_desc_msi(desc);
>   struct msi_msg *msg = &entry->msg;
> 
>   /* ...followed by the old implementation of read_msi_msg_desc() */
> }
> 
> Possibly conditional on something like CONFIG_ARCH_NEEDS_SAVE_MSI_MSG.

Maybe.

But then you end up with read_msi_msg(), which doesn't actually read
anything, which I think is confusing. I'd rather read_msi_msg() read the
message, from the device, and we have another routine which returns the
previously saved msg from the msi_desc.

cheers


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

Re: linux-next: OOPS at bot time

2010-07-22 Thread Ben Hutchings
On Fri, 2010-07-23 at 10:22 +1000, Stephen Rothwell wrote:
> Hi all,
> 
> My Power7 boot test paniced like this: (next-20100722)
> 
> %GQLogic Fibre Channel HBA Driver: 8.03.03-k0
> qla2xxx 0002:01:00.2: enabling device (0144 -> 0146)
> qla2xxx 0002:01:00.2: Found an ISP8001, irq 35, iobase 0xd80080014000
> [ cut here ]
> kernel BUG at drivers/pci/msi.c:205!
[...]
> Call Trace:
> [c278b270] [c0048d9c] .rtas_setup_msi_irqs+0x1d8/0x254 
> (unreliable)
> [c278b360] [c002a9cc] .arch_setup_msi_irqs+0x34/0x4c
> [c278b3e0] [c02fd3fc] .pci_enable_msix+0x49c/0x4ac
[...]
> That line number is this:
> 
>   BUG_ON(!(entry->msg.address_hi | entry->msg.address_lo |
>entry->msg.data));
> 
> in read_msi_msg_desc().  That BUG_ON was added by commit
> 2ca1af9aa3285c6a5f103ed31ad09f7399fc65d7 ("PCI: MSI: Remove unsafe and
> unnecessary hardware access") from the pci tree.

I wanted to assert that read_msi_msg_desc() is only used to update
MSI/MSI-X descriptors that have already been generated by Linux.  It
looks like you found an exception.

We could make read_msi_msg() fall back to reading from the hardware, but
I think that what the pSeries code is trying to do - save an MSI message
generated by firmware - is different from what the other callers want.
Instead we could add:

void save_msi_msg(unsigned int irq)
{
struct irq_desc *desc = irq_to_desc(irq);
struct msi_desc *entry = get_irq_desc_msi(desc);
struct msi_msg *msg = &entry->msg;

/* ...followed by the old implementation of read_msi_msg_desc() */
}

Possibly conditional on something like CONFIG_ARCH_NEEDS_SAVE_MSI_MSG.

Ben.

-- 
Ben Hutchings, Senior Software Engineer, Solarflare Communications
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.

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


Re: [PATCH] powerpc: print cores passed to firmware in decimal

2010-07-22 Thread Michael Neuling
Currently we look pretty stupid when printing out the number of cores
passed to FW

  Max number of cores passed to firmware: 0x0080

So I've change this to print in decimal:

  Max number of cores passed to firmware: 128 (NR_CPUS = 256)

This required adding a prom_print_dec() function. 

Signed-off-by: Michael Neuling 

---
> > cores = (u32 *)PTRRELOC(&ibm_architecture_vec[IBM_ARCH_VEC_NRCO
RES_OFFSET]);
> > if (*cores != NR_CPUS) {
> > prom_printf("WARNING ! "
> > -   "ibm_architecture_vec structure inconsisten
t: 0x%x !\n",
> > +   "ibm_architecture_vec structure inconsisten
t: 0x%i !\n",
> > *cores);
> >
> 
> Since we're changing from hex to decimal, we shouldn't print the "0x".

Oops yes.  Thanks!

BTW please CC me directly rather than sending only to the list.

 arch/powerpc/kernel/prom_init.c |   35 ---
 1 files changed, 32 insertions(+), 3 deletions(-)

diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c
index 3b6f8ae..28b9116 100644
--- a/arch/powerpc/kernel/prom_init.c
+++ b/arch/powerpc/kernel/prom_init.c
@@ -311,6 +311,27 @@ static void __init prom_print_hex(unsigned long val)
call_prom("write", 3, 1, _prom->stdout, buf, nibbles);
 }
 
+/* max number of decimal digits in an unsigned long */
+#define UL_DIGITS 21
+static void __init prom_print_dec(unsigned long val)
+{
+   int i, size;
+   char buf[UL_DIGITS+1];
+   struct prom_t *_prom = &RELOC(prom);
+
+   for (i = UL_DIGITS-1; i >= 0;  i--) {
+   buf[i] = (val % 10) + '0';
+   val = val/10;
+   if (val == 0)
+   break;
+   }
+   /* shift stuff down */
+   size = UL_DIGITS - i;
+   for (i = 0 ; i < size ; i++)
+   buf[i] = buf[i + UL_DIGITS - size];
+   buf[size+1] = '\0';
+   call_prom("write", 3, 1, _prom->stdout, buf, size);
+}
 
 static void __init prom_printf(const char *format, ...)
 {
@@ -350,6 +371,14 @@ static void __init prom_printf(const char *format, ...)
v = va_arg(args, unsigned long);
prom_print_hex(v);
break;
+   case 'l':
+   ++q;
+   if (*q == 'u') { /* '%lu' */
+   ++q;
+   v = va_arg(args, unsigned long);
+   prom_print_dec(v);
+   }
+   break;
}
}
 }
@@ -869,12 +898,12 @@ static void __init prom_send_capabilities(void)
cores = (u32 
*)PTRRELOC(&ibm_architecture_vec[IBM_ARCH_VEC_NRCORES_OFFSET]);
if (*cores != NR_CPUS) {
prom_printf("WARNING ! "
-   "ibm_architecture_vec structure 
inconsistent: 0x%x !\n",
+   "ibm_architecture_vec structure 
inconsistent: %lu !\n",
*cores);
} else {
*cores = DIV_ROUND_UP(NR_CPUS, 
prom_count_smt_threads());
-   prom_printf("Max number of cores passed to firmware: 
0x%x\n",
-   (unsigned long)*cores);
+   prom_printf("Max number of cores passed to firmware: 
%lu (NR_CPUS = %lu)\n",
+   *cores, NR_CPUS);
}
 
/* try calling the ibm,client-architecture-support method */
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


[PATCH 4/5] powerpc/mm: Add some debug output when hash insertion fails

2010-07-22 Thread Benjamin Herrenschmidt
This adds some debug output to our MMU hash code to print out some
useful debug data if the hypervisor refuses the insertion (which
should normally never happen).

Signed-off-by: Benjamin Herrenschmidt 
---
---
 arch/powerpc/include/asm/mmu-hash64.h |4 ++-
 arch/powerpc/mm/hash_utils_64.c   |   34 
 arch/powerpc/mm/hugetlbpage-hash64.c  |2 +
 3 files changed, 34 insertions(+), 6 deletions(-)

diff --git a/arch/powerpc/include/asm/mmu-hash64.h 
b/arch/powerpc/include/asm/mmu-hash64.h
index 2102b21..0e398cf 100644
--- a/arch/powerpc/include/asm/mmu-hash64.h
+++ b/arch/powerpc/include/asm/mmu-hash64.h
@@ -250,7 +250,9 @@ extern int hash_page(unsigned long ea, unsigned long 
access, unsigned long trap)
 int __hash_page_huge(unsigned long ea, unsigned long access, unsigned long 
vsid,
 pte_t *ptep, unsigned long trap, int local, int ssize,
 unsigned int shift, unsigned int mmu_psize);
-
+extern void hash_failure_debug(unsigned long ea, unsigned long access,
+  unsigned long vsid, unsigned long trap,
+  int ssize, int psize, unsigned long pte);
 extern int htab_bolt_mapping(unsigned long vstart, unsigned long vend,
 unsigned long pstart, unsigned long prot,
 int psize, int ssize);
diff --git a/arch/powerpc/mm/hash_utils_64.c b/arch/powerpc/mm/hash_utils_64.c
index 40847a9..09dffe6 100644
--- a/arch/powerpc/mm/hash_utils_64.c
+++ b/arch/powerpc/mm/hash_utils_64.c
@@ -871,6 +871,18 @@ static inline int subpage_protection(struct mm_struct *mm, 
unsigned long ea)
 }
 #endif
 
+void hash_failure_debug(unsigned long ea, unsigned long access,
+   unsigned long vsid, unsigned long trap,
+   int ssize, int psize, unsigned long pte)
+{
+   if (!printk_ratelimit())
+   return;
+   pr_info("mm: Hashing failure ! EA=0x%lx access=0x%lx current=%s\n",
+   ea, access, current->comm);
+   pr_info("trap=0x%lx vsid=0x%lx ssize=%d psize=%d pte=0x%lx\n",
+   trap, vsid, ssize, psize, pte);
+}
+
 /* Result code is:
  *  0 - handled
  *  1 - normal page fault
@@ -1036,6 +1048,12 @@ int hash_page(unsigned long ea, unsigned long access, 
unsigned long trap)
local, ssize, spp);
}
 
+   /* Dump some info in case of hash insertion failure, they should
+* never happen so it is really useful to know if/when they do
+*/
+   if (rc == -1)
+   hash_failure_debug(ea, access, vsid, trap, ssize, psize,
+  pte_val(*ptep));
 #ifndef CONFIG_PPC_64K_PAGES
DBG_LOW(" o-pte: %016lx\n", pte_val(*ptep));
 #else
@@ -1054,8 +1072,7 @@ void hash_preload(struct mm_struct *mm, unsigned long ea,
void *pgdir;
pte_t *ptep;
unsigned long flags;
-   int local = 0;
-   int ssize;
+   int rc, ssize, local = 0;
 
BUG_ON(REGION_ID(ea) != USER_REGION_ID);
 
@@ -1101,11 +1118,18 @@ void hash_preload(struct mm_struct *mm, unsigned long 
ea,
/* Hash it in */
 #ifdef CONFIG_PPC_HAS_HASH_64K
if (mm->context.user_psize == MMU_PAGE_64K)
-   __hash_page_64K(ea, access, vsid, ptep, trap, local, ssize);
+   rc = __hash_page_64K(ea, access, vsid, ptep, trap, local, 
ssize);
else
 #endif /* CONFIG_PPC_HAS_HASH_64K */
-   __hash_page_4K(ea, access, vsid, ptep, trap, local, ssize,
-  subpage_protection(pgdir, ea));
+   rc = __hash_page_4K(ea, access, vsid, ptep, trap, local, ssize,
+   subpage_protection(pgdir, ea));
+
+   /* Dump some info in case of hash insertion failure, they should
+* never happen so it is really useful to know if/when they do
+*/
+   if (rc == -1)
+   hash_failure_debug(ea, access, vsid, trap, ssize,
+  mm->context.user_psize, pte_val(*ptep));
 
local_irq_restore(flags);
 }
diff --git a/arch/powerpc/mm/hugetlbpage-hash64.c 
b/arch/powerpc/mm/hugetlbpage-hash64.c
index fd0a15e..db70c0d 100644
--- a/arch/powerpc/mm/hugetlbpage-hash64.c
+++ b/arch/powerpc/mm/hugetlbpage-hash64.c
@@ -127,6 +127,8 @@ repeat:
 */
if (unlikely(slot == -2)) {
*ptep = __pte(old_pte);
+   hash_failure_debug(ea, access, vsid, trap, ssize,
+  mmu_psize, old_pte);
return -1;
}
 
-- 
1.6.3.3

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


[PATCH 3/5] powerpc/mm: Fix bugs in huge page hashing

2010-07-22 Thread Benjamin Herrenschmidt
There's a couple of nasty bugs lurking in our huge page hashing code.

First, we don't check the access permission atomically with setting
the _PAGE_BUSY bit, which means that the PTE value we end up using
for the hashing might be different than the one we have checked
the access permissions for.

We've seen cases where that leads us to try to use an invalidated
PTE for hashing, causing all sort of "interesting" issues.

Then, we also failed to set _PAGE_DIRTY on a write access.

This fixes both, while also simplifying the code a bit.

Signed-off-by: Benjamin Herrenschmidt 
---
---
 arch/powerpc/mm/hugetlbpage-hash64.c |   31 +--
 1 files changed, 13 insertions(+), 18 deletions(-)

diff --git a/arch/powerpc/mm/hugetlbpage-hash64.c 
b/arch/powerpc/mm/hugetlbpage-hash64.c
index c9acd79..fd0a15e 100644
--- a/arch/powerpc/mm/hugetlbpage-hash64.c
+++ b/arch/powerpc/mm/hugetlbpage-hash64.c
@@ -21,21 +21,13 @@ int __hash_page_huge(unsigned long ea, unsigned long 
access, unsigned long vsid,
unsigned long old_pte, new_pte;
unsigned long va, rflags, pa, sz;
long slot;
-   int err = 1;
 
BUG_ON(shift != mmu_psize_defs[mmu_psize].shift);
 
/* Search the Linux page table for a match with va */
va = hpt_va(ea, vsid, ssize);
 
-   /*
-* Check the user's access rights to the page.  If access should be
-* prevented then send the problem up to do_page_fault.
-*/
-   if (unlikely(access & ~pte_val(*ptep)))
-   goto out;
-   /*
-* At this point, we have a pte (old_pte) which can be used to build
+   /* At this point, we have a pte (old_pte) which can be used to build
 * or update an HPTE. There are 2 cases:
 *
 * 1. There is a valid (present) pte with no associated HPTE (this is
@@ -49,9 +41,17 @@ int __hash_page_huge(unsigned long ea, unsigned long access, 
unsigned long vsid,
 
do {
old_pte = pte_val(*ptep);
-   if (old_pte & _PAGE_BUSY)
-   goto out;
+   /* If PTE busy, retry the access */
+   if (unlikely(old_pte & _PAGE_BUSY))
+   return 0;
+   /* If PTE permissions don't match, take page fault */
+   if (unlikely(access & ~pte_val(*ptep)))
+   return 1;
+   /* Try to lock the PTE, add ACCESSED and DIRTY if it was
+* a write access */
new_pte = old_pte | _PAGE_BUSY | _PAGE_ACCESSED;
+   if (access & _PAGE_RW)
+   new_pte |= _PAGE_DIRTY;
} while(old_pte != __cmpxchg_u64((unsigned long *)ptep,
 old_pte, new_pte));
 
@@ -127,8 +127,7 @@ repeat:
 */
if (unlikely(slot == -2)) {
*ptep = __pte(old_pte);
-   err = -1;
-   goto out;
+   return -1;
}
 
new_pte |= (slot << 12) & (_PAGE_F_SECOND | _PAGE_F_GIX);
@@ -138,9 +137,5 @@ repeat:
 * No need to use ldarx/stdcx here
 */
*ptep = __pte(new_pte & ~_PAGE_BUSY);
-
-   err = 0;
-
- out:
-   return err;
+   return 0;
 }
-- 
1.6.3.3

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


[PATCH 2/5] powerpc/mm: Move around testing of _PAGE_PRESENT in hash code

2010-07-22 Thread Benjamin Herrenschmidt
Instead of adding _PAGE_PRESENT to the access permission mask
in each low level routine independently, we add it once from
hash_page().

We also move the preliminary access check (the racy one before
the PTE is locked) up so it applies to the huge page case. This
duplicates code in __hash_page_huge() which we'll remove in a
subsequent patch to fix a race in there.

Signed-off-by: Benjamin Herrenschmidt 
---
 arch/powerpc/mm/hash_low_64.S   |9 -
 arch/powerpc/mm/hash_utils_64.c |   19 +++
 2 files changed, 11 insertions(+), 17 deletions(-)

diff --git a/arch/powerpc/mm/hash_low_64.S b/arch/powerpc/mm/hash_low_64.S
index a719f53..3079f6b 100644
--- a/arch/powerpc/mm/hash_low_64.S
+++ b/arch/powerpc/mm/hash_low_64.S
@@ -68,9 +68,6 @@ _GLOBAL(__hash_page_4K)
std r8,STK_PARM(r8)(r1)
std r9,STK_PARM(r9)(r1)

-   /* Add _PAGE_PRESENT to access */
-   ori r4,r4,_PAGE_PRESENT
-
/* Save non-volatile registers.
 * r31 will hold "old PTE"
 * r30 is "new PTE"
@@ -347,9 +344,6 @@ _GLOBAL(__hash_page_4K)
std r8,STK_PARM(r8)(r1)
std r9,STK_PARM(r9)(r1)
 
-   /* Add _PAGE_PRESENT to access */
-   ori r4,r4,_PAGE_PRESENT
-
/* Save non-volatile registers.
 * r31 will hold "old PTE"
 * r30 is "new PTE"
@@ -687,9 +681,6 @@ _GLOBAL(__hash_page_64K)
std r8,STK_PARM(r8)(r1)
std r9,STK_PARM(r9)(r1)
 
-   /* Add _PAGE_PRESENT to access */
-   ori r4,r4,_PAGE_PRESENT
-
/* Save non-volatile registers.
 * r31 will hold "old PTE"
 * r30 is "new PTE"
diff --git a/arch/powerpc/mm/hash_utils_64.c b/arch/powerpc/mm/hash_utils_64.c
index 98f262d..40847a9 100644
--- a/arch/powerpc/mm/hash_utils_64.c
+++ b/arch/powerpc/mm/hash_utils_64.c
@@ -955,6 +955,17 @@ int hash_page(unsigned long ea, unsigned long access, 
unsigned long trap)
return 1;
}
 
+   /* Add _PAGE_PRESENT to the required access perm */
+   access |= _PAGE_PRESENT;
+
+   /* Pre-check access permissions (will be re-checked atomically
+* in __hash_page_XX but this pre-check is a fast path
+*/
+   if (access & ~pte_val(*ptep)) {
+   DBG_LOW(" no access !\n");
+   return 1;
+   }
+
 #ifdef CONFIG_HUGETLB_PAGE
if (hugeshift)
return __hash_page_huge(ea, access, vsid, ptep, trap, local,
@@ -967,14 +978,6 @@ int hash_page(unsigned long ea, unsigned long access, 
unsigned long trap)
DBG_LOW(" i-pte: %016lx %016lx\n", pte_val(*ptep),
pte_val(*(ptep + PTRS_PER_PTE)));
 #endif
-   /* Pre-check access permissions (will be re-checked atomically
-* in __hash_page_XX but this pre-check is a fast path
-*/
-   if (access & ~pte_val(*ptep)) {
-   DBG_LOW(" no access !\n");
-   return 1;
-   }
-
/* Do actual hashing */
 #ifdef CONFIG_PPC_64K_PAGES
/* If _PAGE_4K_PFN is set, make sure this is a 4k segment */
-- 
1.6.3.3

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


[PATCH 5/5] powerpc: Fix erroneous lmb->memblock conversions

2010-07-22 Thread Benjamin Herrenschmidt
Oooops... we missed these. We incorrectly converted strings
used when parsing the device-tree on pseries, thus breaking
access to drconf memory and hotplug memory.

While at it, also revert some variable names that represent
something the FW calls "lmb" and thus don't need to be converted
to "memblock".

Signed-off-by: Benjamin Herrenschmidt 
---
---
 arch/powerpc/kernel/prom.c  |2 +-
 arch/powerpc/mm/numa.c  |   24 +++---
 arch/powerpc/platforms/pseries/hotplug-memory.c |   22 ++--
 3 files changed, 24 insertions(+), 24 deletions(-)

diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index 9d39539..fed9bf6 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -414,7 +414,7 @@ static int __init early_init_dt_scan_drconf_memory(unsigned 
long node)
u64 base, size, memblock_size;
unsigned int is_kexec_kdump = 0, rngs;
 
-   ls = of_get_flat_dt_prop(node, "ibm,memblock-size", &l);
+   ls = of_get_flat_dt_prop(node, "ibm,lmb-size", &l);
if (ls == NULL || l < dt_root_size_cells * sizeof(__be32))
return 0;
memblock_size = dt_mem_next_cell(dt_root_size_cells, &ls);
diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c
index f473645..aa731af 100644
--- a/arch/powerpc/mm/numa.c
+++ b/arch/powerpc/mm/numa.c
@@ -398,15 +398,15 @@ static int of_get_drconf_memory(struct device_node 
*memory, const u32 **dm)
 }
 
 /*
- * Retreive and validate the ibm,memblock-size property for drconf memory
+ * Retreive and validate the ibm,lmb-size property for drconf memory
  * from the device tree.
  */
-static u64 of_get_memblock_size(struct device_node *memory)
+static u64 of_get_lmb_size(struct device_node *memory)
 {
const u32 *prop;
u32 len;
 
-   prop = of_get_property(memory, "ibm,memblock-size", &len);
+   prop = of_get_property(memory, "ibm,lmb-size", &len);
if (!prop || len < sizeof(unsigned int))
return 0;
 
@@ -562,7 +562,7 @@ static unsigned long __init 
numa_enforce_memory_limit(unsigned long start,
 static inline int __init read_usm_ranges(const u32 **usm)
 {
/*
-* For each memblock in ibm,dynamic-memory a corresponding
+* For each lmb in ibm,dynamic-memory a corresponding
 * entry in linux,drconf-usable-memory property contains
 * a counter followed by that many (base, size) duple.
 * read the counter from linux,drconf-usable-memory
@@ -578,7 +578,7 @@ static void __init parse_drconf_memory(struct device_node 
*memory)
 {
const u32 *dm, *usm;
unsigned int n, rc, ranges, is_kexec_kdump = 0;
-   unsigned long memblock_size, base, size, sz;
+   unsigned long lmb_size, base, size, sz;
int nid;
struct assoc_arrays aa;
 
@@ -586,8 +586,8 @@ static void __init parse_drconf_memory(struct device_node 
*memory)
if (!n)
return;
 
-   memblock_size = of_get_memblock_size(memory);
-   if (!memblock_size)
+   lmb_size = of_get_lmb_size(memory);
+   if (!lmb_size)
return;
 
rc = of_get_assoc_arrays(memory, &aa);
@@ -611,7 +611,7 @@ static void __init parse_drconf_memory(struct device_node 
*memory)
continue;
 
base = drmem.base_addr;
-   size = memblock_size;
+   size = lmb_size;
ranges = 1;
 
if (is_kexec_kdump) {
@@ -1072,7 +1072,7 @@ static int hot_add_drconf_scn_to_nid(struct device_node 
*memory,
 {
const u32 *dm;
unsigned int drconf_cell_cnt, rc;
-   unsigned long memblock_size;
+   unsigned long lmb_size;
struct assoc_arrays aa;
int nid = -1;
 
@@ -1080,8 +1080,8 @@ static int hot_add_drconf_scn_to_nid(struct device_node 
*memory,
if (!drconf_cell_cnt)
return -1;
 
-   memblock_size = of_get_memblock_size(memory);
-   if (!memblock_size)
+   lmb_size = of_get_lmb_size(memory);
+   if (!lmb_size)
return -1;
 
rc = of_get_assoc_arrays(memory, &aa);
@@ -1100,7 +1100,7 @@ static int hot_add_drconf_scn_to_nid(struct device_node 
*memory,
continue;
 
if ((scn_addr < drmem.base_addr)
-   || (scn_addr >= (drmem.base_addr + memblock_size)))
+   || (scn_addr >= (drmem.base_addr + lmb_size)))
continue;
 
nid = of_drconf_to_nid_single(&drmem, &aa);
diff --git a/arch/powerpc/platforms/pseries/hotplug-memory.c 
b/arch/powerpc/platforms/pseries/hotplug-memory.c
index deab5f9..bc88036 100644
--- a/arch/powerpc/platforms/pseries/hotplug-memory.c
+++ b/arch/powerpc/platforms/pseries/hotplug-memory.c
@@ -69,7 +69,7 @@ static int pseries_remove_memory(struct device_node *np)
const char *type;
const unsigned int *regs;
unsigned long base;
- 

[PATCH 1/5] powerpc/mm: Handle hypervisor pte insert failure in __hash_page_huge

2010-07-22 Thread Benjamin Herrenschmidt
From: Anton Blanchard 

If the hypervisor gives us an error on a hugepage insert we panic. The
normal page code already handles this by returning an error instead and we end
calling low_hash_fault which will just kill the task if possible.

The patch below does a similar thing for the hugepage case.

Signed-off-by: Anton Blanchard 
Signed-off-by: Benjamin Herrenschmidt 
---
 arch/powerpc/mm/hugetlbpage-hash64.c |   11 +--
 1 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/mm/hugetlbpage-hash64.c 
b/arch/powerpc/mm/hugetlbpage-hash64.c
index 1995398..c9acd79 100644
--- a/arch/powerpc/mm/hugetlbpage-hash64.c
+++ b/arch/powerpc/mm/hugetlbpage-hash64.c
@@ -121,8 +121,15 @@ repeat:
 }
}
 
-   if (unlikely(slot == -2))
-   panic("hash_huge_page: pte_insert failed\n");
+   /*
+* Hypervisor failure. Restore old pte and return -1
+* similar to __hash_page_*
+*/
+   if (unlikely(slot == -2)) {
+   *ptep = __pte(old_pte);
+   err = -1;
+   goto out;
+   }
 
new_pte |= (slot << 12) & (_PAGE_F_SECOND | _PAGE_F_GIX);
}
-- 
1.6.3.3

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


Re: [PATCH 1/9 v1.02] Add Synopsys DesignWare HS USB OTG Controller driver.

2010-07-22 Thread Greg KH
On Thu, Jul 22, 2010 at 05:11:08PM -0700, David Daney wrote:
> Also the subject line for all nine patches seems to be identical,
> yet the patches are distinct.  Perhaps you could find better subject
> lines.

s/Perhaps/Must/

As noted, I can't accept this series, please work to resolve these
issues.

thanks,

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


linux-next: OOPS at bot time

2010-07-22 Thread Stephen Rothwell
Hi all,

My Power7 boot test paniced like this: (next-20100722)

%GQLogic Fibre Channel HBA Driver: 8.03.03-k0
qla2xxx 0002:01:00.2: enabling device (0144 -> 0146)
qla2xxx 0002:01:00.2: Found an ISP8001, irq 35, iobase 0xd80080014000
[ cut here ]
kernel BUG at drivers/pci/msi.c:205!
Oops: Exception in kernel mode, sig: 5 [#1]
SMP NR_CPUS=128 NUMA pSeries
last sysfs file: /sys/devices/virtual/tty/ptyz8/uevent
Modules linked in: qla2xxx(+)
NIP: c02fcd54 LR: c0048d9c CTR: 0001
REGS: c278aff0 TRAP: 0700   Not tainted  
(2.6.35-rc5-autokern1-next-20100721)
MSR: 80029032   CR: 28422488  XER: 2008
TASK = c2008000[2226] 'modprobe' THREAD: c2788000 CPU: 12
GPR00: 0001 c278b270 c09a36d0 c09b8900 
GPR04: c278b2e8   0002 
GPR08: 33e7 ca38b280   
GPR12: 88422488 cf331800 0fff921750a0  
GPR16: 10033110 100334b8   
GPR20: d80080018000 0005 c09f7bb4 00010200 
GPR24: 220d 0025 c278b2e0 c278b2e8 
GPR28: 0001 cd0ac5f8 c0af8f00 ca38b280 
NIP [c02fcd54] .read_msi_msg_desc+0x24/0x3c
LR [c0048d9c] .rtas_setup_msi_irqs+0x1d8/0x254
Call Trace:
[c278b270] [c0048d9c] .rtas_setup_msi_irqs+0x1d8/0x254 
(unreliable)
[c278b360] [c002a9cc] .arch_setup_msi_irqs+0x34/0x4c
[c278b3e0] [c02fd3fc] .pci_enable_msix+0x49c/0x4ac
[c278b4c0] [d01a5e30] .qla2x00_request_irqs+0x158/0x5b4 
[qla2xxx]
[c278b580] [d01cb41c] .qla2x00_probe_one+0xeac/0x63b0 [qla2xxx]
[c278b6f0] [c02f5c4c] .local_pci_probe+0x34/0x48
[c278b760] [c02f6078] .pci_device_probe+0xe8/0x130
[c278b810] [c036e648] .driver_probe_device+0xdc/0x1a4
[c278b8a0] [c036e7a4] .__driver_attach+0x94/0xd8
[c278b930] [c036dabc] .bus_for_each_dev+0x7c/0xe0
[c278b9e0] [c036e410] .driver_attach+0x28/0x40
[c278ba60] [c036d134] .bus_add_driver+0x144/0x310
[c278bb10] [c036ec28] .driver_register+0xd8/0x198
[c278bbb0] [c02f63d0] .__pci_register_driver+0x60/0x10c
[c278bc50] [d01ca520] .qla2x00_module_init+0x150/0x1a0 [qla2xxx]
[c278bce0] [c000947c] .do_one_initcall+0x80/0x1a8
[c278bd90] [c00a4364] .SyS_init_module+0xd8/0x244
[c278be30] [c000852c] syscall_exit+0x0/0x40
Instruction dump:
ebe1fff8 7c0803a6 4e800020 e9230028 81490030 80090034 81690038 7d400378 
7c005b78 7c34 5400d97e 7820 <0b00> 81690038 e8090030 91640008 
---[ end trace f67a78811ed47c60 ]---
%Gudevd-work[1379]: '/sbin/modprobe -b 
pci:v1077d8001sv1077sd017Fbc0Csc04i00' unexpected exit with 
status 0x0005

That line number is this:

BUG_ON(!(entry->msg.address_hi | entry->msg.address_lo |
 entry->msg.data));

in read_msi_msg_desc().  That BUG_ON was added by commit
2ca1af9aa3285c6a5f103ed31ad09f7399fc65d7 ("PCI: MSI: Remove unsafe and
unnecessary hardware access") from the pci tree.

-- 
Cheers,
Stephen Rothwells...@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/


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

Re: [PATCH 1/9 v1.02] Add Synopsys DesignWare HS USB OTG Controller driver.

2010-07-22 Thread David Daney

On 07/22/2010 03:15 PM, Fushen Chen wrote:

The DWC OTG driver module provides the initialization and cleanup
entry points for the DWC OTG USB driver.

Signed-off-by: Fushen Chen
Signed-off-by: Mark Miesfeld
---
  drivers/Makefile |1 +
  drivers/usb/Kconfig  |2 +
  drivers/usb/dwc_otg/Kconfig  |   96 +++
  drivers/usb/dwc_otg/Makefile |   13 +
  drivers/usb/dwc_otg/dwc_otg_driver.c | 1246 ++
  drivers/usb/dwc_otg/dwc_otg_driver.h |   97 +++
  drivers/usb/gadget/Kconfig   |   21 +
  drivers/usb/gadget/gadget_chips.h|7 +
  8 files changed, 1483 insertions(+), 0 deletions(-)
  create mode 100644 drivers/usb/dwc_otg/Kconfig
  create mode 100644 drivers/usb/dwc_otg/Makefile
  create mode 100644 drivers/usb/dwc_otg/dwc_otg_driver.c
  create mode 100644 drivers/usb/dwc_otg/dwc_otg_driver.h

diff --git a/drivers/Makefile b/drivers/Makefile
index 20dcced..f3fc7c7 100644
--- a/drivers/Makefile
+++ b/drivers/Makefile
@@ -67,6 +67,7 @@ obj-$(CONFIG_UWB) += uwb/
  obj-$(CONFIG_USB_OTG_UTILS)   += usb/otg/
  obj-$(CONFIG_USB) += usb/
  obj-$(CONFIG_USB_MUSB_HDRC)   += usb/musb/
+obj-$(CONFIG_USB_DWC_OTG)  += usb/dwc_otg/
  obj-$(CONFIG_PCI) += usb/
  obj-$(CONFIG_USB_GADGET)  += usb/gadget/
  obj-$(CONFIG_SERIO)   += input/serio/
diff --git a/drivers/usb/Kconfig b/drivers/usb/Kconfig
index 6a58cb1..f48920b 100644
--- a/drivers/usb/Kconfig
+++ b/drivers/usb/Kconfig
@@ -113,6 +113,8 @@ source "drivers/usb/host/Kconfig"

  source "drivers/usb/musb/Kconfig"

+source "drivers/usb/dwc_otg/Kconfig"
+
  source "drivers/usb/class/Kconfig"

  source "drivers/usb/storage/Kconfig"
diff --git a/drivers/usb/dwc_otg/Kconfig b/drivers/usb/dwc_otg/Kconfig
new file mode 100644
index 000..27ae0d5
--- /dev/null
+++ b/drivers/usb/dwc_otg/Kconfig
@@ -0,0 +1,96 @@
+#
+# USB Dual Role (OTG-ready) Controller Drivers
+# for silicon based on Synopsys DesignWare IP
+#

[...]

diff --git a/drivers/usb/dwc_otg/Makefile b/drivers/usb/dwc_otg/Makefile
new file mode 100644
index 000..337ff81
--- /dev/null
+++ b/drivers/usb/dwc_otg/Makefile
@@ -0,0 +1,13 @@
+#
+# OTG infrastructure and transceiver drivers
+#
+obj-$(CONFIG_USB_DWC_OTG)  += dwc_otg.o
+
+dwc_otg-objs := dwc_otg_driver.o dwc_otg_cil.o dwc_otg_cil_intr.o
+ifneq ($(CONFIG_DWC_DEVICE_ONLY),y)
+dwc_otg-objs += dwc_otg_hcd.o dwc_otg_hcd_intr.o \
+   dwc_otg_hcd_queue.o
+endif
+ifneq ($(CONFIG_DWC_HOST_ONLY),y)
+dwc_otg-objs += dwc_otg_pcd.o dwc_otg_pcd_intr.o
+endif
diff --git a/drivers/usb/dwc_otg/dwc_otg_driver.c 
b/drivers/usb/dwc_otg/dwc_otg_driver.c
new file mode 100644
index 000..3aae30e


Look at all those files you reference in your Makefile.  Most of them 
don't exist.  This will cause the kernel to be unbuildable and break the 
ability to use git bisect.


One way to remedy this situation would be to make your Kconfig changes 
the last patch in the series.


Also the subject line for all nine patches seems to be identical, yet 
the patches are distinct.  Perhaps you could find better subject lines.


The very last patch contains exactly one file (dwc_otg_regs.h), but this 
file is required by most of the preceding patches.  This indicates that 
the ordering of the patches and the way that the files were distributed 
among the patches could improve.  Could you just fold most of the file 
addition patches into a single patch?


Or if that is untenable, put the core files in one patch, and then maybe 
hcd and pcd seperatly.


This patch contains many lines that are indented with spaces instead of 
tabs.  How did it manage to pass checkpatch.pl formatted like that?


And finally I would like to suggest taking all the glue-logic functions 
in dwc_otg_driver.c and putting them in a separate file (perhaps 
something like dwc_otg_amppc.c or something like that).  It could be 
that initially you just rename dwc_otg_driver.c to dwc_otg_amppc.c. 
That would make it easy for me to then add my dwc_otg_octeon.c and use 
the driver with OCTEON (in arch/mips/cavium-octeon).


See: http://marc.info/?l=linux-mips&m=125502126531841&w=2


Thanks,
David Daney
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: [PATCH] powerpc: fix .data..init_task output section

2010-07-22 Thread Sean MacLennan
>From 851e645a7eee68380caaf026eb6d3be118876370 Mon Sep 17 00:00:00 2001
From: Sam Ravnborg 
Date: Tue, 13 Jul 2010 11:39:42 +0200
Subject: [PATCH] vmlinux.lds: fix .data..init_task output section (fix popwerpc 
boot)

The .data..init_task output section was missing
a load offset causing a popwerpc target to fail to boot.

Sean MacLennan tracked it down to the definition of
INIT_TASK_DATA_SECTION().

There are only two users of INIT_TASK_DATA_SECTION()
in the kernel today: cris and popwerpc.
cris do not support relocatable kernels and is thus not
impacted by this change.

Fix INIT_TASK_DATA_SECTION() to specify load offset like
all other output sections.

Reported-by: Sean MacLennan 
Signed-off-by: Sam Ravnborg 
---
 include/asm-generic/vmlinux.lds.h |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/include/asm-generic/vmlinux.lds.h 
b/include/asm-generic/vmlinux.lds.h
index 48c5299..cdfff74 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -435,7 +435,7 @@
  */
 #define INIT_TASK_DATA_SECTION(align)  \
. = ALIGN(align);   \
-   .data..init_task : {\
+   .data..init_task :  AT(ADDR(.data..init_task) - LOAD_OFFSET) {  \
INIT_TASK_DATA(align)   \
}
 
-- 
1.6.0.6

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


Re: [PATCH][RFC] preempt_count corruption across H_CEDE call with CONFIG_PREEMPT on pseries

2010-07-22 Thread Darren Hart
On 07/22/2010 03:25 PM, Benjamin Herrenschmidt wrote:
> On Thu, 2010-07-22 at 11:24 -0700, Darren Hart wrote:
>>
>> 1) How can the preempt_count() get mangled across the H_CEDE hcall?
>> 2) Should we call preempt_enable() in cpu_idle() prior to cpu_die() ?
> 
> The preempt count is on the thread info at the bottom of the stack.
> 
> Can you check the stack pointers ?

Hi Ben, thanks for looking.

I instrumented the area around extended_cede_processor() as follows
(please confirm I'm getting the stack pointer correctly).

while (get_preferred_offline_state(cpu) == CPU_STATE_INACTIVE) {
asm("mr %0,1" : "=r" (sp));
printk("before H_CEDE current->stack: %lx, pcnt: %x\n", sp, 
preempt_count());  
extended_cede_processor(cede_latency_hint);
asm("mr %0,1" : "=r" (sp));
printk("after H_CEDE current->stack: %lx, pcnt: %x\n", sp, 
preempt_count());
 }


On Mainline (2.6.33.6, CONFIG_PREEMPT=y) I see this:
Jul 22 18:37:08 igoort1 kernel: before H_CEDE current->stack: c0010e9e3ce0, 
pcnt: 1
Jul 22 18:37:08 igoort1 kernel: after H_CEDE current->stack:  c0010e9e3ce0, 
pcnt: 1

This surprised me as preempt_count is 1 before and after, so no
corruption appears to occur on mainline. This makes the pcnt of 65 I see
without the preempt_count()=0 hack very strange. I ran several hundred
off/on cycles. The issue of preempt_count being 1 is still addressed by
this patch however.

On PREEMPT_RT (2.6.33.5-rt23 - tglx, sorry, rt/2.6.33 next time, promise):
Jul 22 18:51:11 igoort1 kernel: before H_CEDE current->stack: c00089bcfcf0, 
pcnt: 1
Jul 22 18:51:11 igoort1 kernel: after H_CEDE current->stack:  c00089bcfcf0, 
pcnt: 

In both cases the stack pointer appears unchanged.

Note: there is a BUG triggered in between these statements as the
preempt_count causes the printk to trigger:
Badness at kernel/sched.c:5572

Thanks,

-- 
Darren Hart
IBM Linux Technology Center
Real-Time Linux Team
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


[PATCH] powerpc: fix .data..init_task output section

2010-07-22 Thread Sean MacLennan
>From 851e645a7eee68380caaf026eb6d3be118876370 Mon Sep 17 00:00:00 2001
From: Sam Ravnborg 
Date: Tue, 13 Jul 2010 11:39:42 +0200
Subject: [PATCH] vmlinux.lds: fix .data..init_task output section (fix
popwerpc boot)

The .data..init_task output section was missing
a load offset causing a popwerpc target to fail to boot.

Sean MacLennan tracked it down to the definition of
INIT_TASK_DATA_SECTION().

There are only two users of INIT_TASK_DATA_SECTION()
in the kernel today: cris and popwerpc.
cris do not support relocatable kernels and is thus not
impacted by this change.

Fix INIT_TASK_DATA_SECTION() to specify load offset like
all other output sections.

Reported-by: Sean MacLennan 
Signed-off-by: Sam Ravnborg 
---
 include/asm-generic/vmlinux.lds.h |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/include/asm-generic/vmlinux.lds.h
b/include/asm-generic/vmlinux.lds.h index 48c5299..cdfff74 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -435,7 +435,7 @@
  */
 #define
INIT_TASK_DATA_SECTION(align)
\ . = ALIGN(align); \
-   .data..init_task :
{   \
+   .data..init_task :  AT(ADDR(.data..init_task) - LOAD_OFFSET)
{   \ INIT_TASK_DATA(align)
\ }
 
-- 
1.6.0.6

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


[PATCH] fix of_flat_dt_is_compatible to match the full compatible string

2010-07-22 Thread Stuart Yoder
From: Stuart Yoder 

With the previous string comparison, a device tree
compatible of "foo-bar" would match as compatible
with a driver looking for "foo".

Signed-off-by: Stuart Yoder 
---
 drivers/of/fdt.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
index dee4fb5..f5239c0 100644
--- a/drivers/of/fdt.c
+++ b/drivers/of/fdt.c
@@ -169,7 +169,7 @@ int __init of_flat_dt_is_compatible(unsigned long node, 
const char *compat)
if (cp == NULL)
return 0;
while (cplen > 0) {
-   if (strncasecmp(cp, compat, strlen(compat)) == 0)
+   if (!strcmp(cp, compat))
return 1;
l = strlen(cp) + 1;
cp += l;
-- 
1.6.2.5


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


[PATCH] powerpc: fix .data..init_task output section

2010-07-22 Thread Sean MacLennan
On Tue, 13 Jul 2010 11:50:24 +0200
Sam Ravnborg  wrote:

> From 851e645a7eee68380caaf026eb6d3be118876370 Mon Sep 17 00:00:00 2001
> From: Sam Ravnborg 
> Date: Tue, 13 Jul 2010 11:39:42 +0200
> Subject: [PATCH] vmlinux.lds: fix .data..init_task output section
> (fix popwerpc boot)
> 
> The .data..init_task output section was missing
> a load offset causing a popwerpc target to fail to boot.
> 
> Sean MacLennan tracked it down to the definition of
> INIT_TASK_DATA_SECTION().
> 
> There are only two users of INIT_TASK_DATA_SECTION()
> in the kernel today: cris and popwerpc.
> cris do not support relocatable kernels and is thus not
> impacted by this change.
> 
> Fix INIT_TASK_DATA_SECTION() to specify load offset like
> all other output sections.
> 
> Reported-by: Sean MacLennan 
> Signed-off-by: Sam Ravnborg 
> ---
> 
> On the assumption that Sean reports that it fixes
> the warnings/boot issue here is a real patch.
> 
> Ben - will you take it via the popwerpc tree
> or shall I ask Michal to take it via kbuild?
> 
>   Sam
> 
>  include/asm-generic/vmlinux.lds.h |2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/include/asm-generic/vmlinux.lds.h
> b/include/asm-generic/vmlinux.lds.h index 48c5299..cdfff74 100644
> --- a/include/asm-generic/vmlinux.lds.h
> +++ b/include/asm-generic/vmlinux.lds.h
> @@ -435,7 +435,7 @@
>   */
>  #define
> INIT_TASK_DATA_SECTION(align)
> \ . = ALIGN(align);   \
> - .data..init_task :
> { \
> + .data..init_task :  AT(ADDR(.data..init_task) - LOAD_OFFSET)
> { \
> INIT_TASK_DATA(align) \ }
>  
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: [PATCH] powerpc: print cores passed to firmware in decimal

2010-07-22 Thread Michael Neuling
Currently we look pretty stupid when printing out the number of cores
passed to FW

  Max number of cores passed to firmware: 0x0080

So I've change this to print in decimal:

  Max number of cores passed to firmware: 128 (NR_CPUS = 256)

This required adding a prom_print_dec() function. 

Signed-off-by: Michael Neuling 
--
> Unsigned long should be "%lu".

Changed %i to %lu as per Segher request

 arch/powerpc/kernel/prom_init.c |   35 ---
 1 files changed, 32 insertions(+), 3 deletions(-)

diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c
index 3b6f8ae..e8b68ff 100644
--- a/arch/powerpc/kernel/prom_init.c
+++ b/arch/powerpc/kernel/prom_init.c
@@ -311,6 +311,27 @@ static void __init prom_print_hex(unsigned long val)
call_prom("write", 3, 1, _prom->stdout, buf, nibbles);
 }
 
+/* max number of decimal digits in an unsigned long */
+#define UL_DIGITS 21
+static void __init prom_print_dec(unsigned long val)
+{
+   int i, size;
+   char buf[UL_DIGITS+1];
+   struct prom_t *_prom = &RELOC(prom);
+
+   for (i = UL_DIGITS-1; i >= 0;  i--) {
+   buf[i] = (val % 10) + '0';
+   val = val/10;
+   if (val == 0)
+   break;
+   }
+   /* shift stuff down */
+   size = UL_DIGITS - i;
+   for (i = 0 ; i < size ; i++)
+   buf[i] = buf[i + UL_DIGITS - size];
+   buf[size+1] = '\0';
+   call_prom("write", 3, 1, _prom->stdout, buf, size);
+}
 
 static void __init prom_printf(const char *format, ...)
 {
@@ -350,6 +371,14 @@ static void __init prom_printf(const char *format, ...)
v = va_arg(args, unsigned long);
prom_print_hex(v);
break;
+   case 'l':
+   ++q;
+   if (*q == 'u') { /* '%lx' */
+   ++q;
+   v = va_arg(args, unsigned long);
+   prom_print_dec(v);
+   }
+   break;
}
}
 }
@@ -869,12 +898,12 @@ static void __init prom_send_capabilities(void)
cores = (u32 
*)PTRRELOC(&ibm_architecture_vec[IBM_ARCH_VEC_NRCORES_OFFSET]);
if (*cores != NR_CPUS) {
prom_printf("WARNING ! "
-   "ibm_architecture_vec structure 
inconsistent: 0x%x !\n",
+   "ibm_architecture_vec structure 
inconsistent: 0x%lu !\n",
*cores);
} else {
*cores = DIV_ROUND_UP(NR_CPUS, 
prom_count_smt_threads());
-   prom_printf("Max number of cores passed to firmware: 
0x%x\n",
-   (unsigned long)*cores);
+   prom_printf("Max number of cores passed to firmware: 
%lu (NR_CPUS = %lu)\n",
+   *cores, NR_CPUS);
}
 
/* try calling the ibm,client-architecture-support method */
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: [

2010-07-22 Thread Benjamin Herrenschmidt
On Thu, 2010-07-22 at 18:27 -0400, Sean MacLennan wrote:
> On Tue, 13 Jul 2010 11:50:24 +0200
> Sam Ravnborg  wrote:
> 
> > Ben - will you take it via the popwerpc tree
> > or shall I ask Michal to take it via kbuild?
> 
> Anything happening with this patch?

The subject line tripped my spam filter ... 

I'm happy to take it.

Sean, make sure it's on patchwork and it will be in one of my next
batches.

Cheers,
Ben.


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


[PATCH 4/4] microblaze: remove references to of_device and to_of_device

2010-07-22 Thread Grant Likely
of_device is just a #define alias to platform_device.  This patch
replaces all references to it with platform_device.

Signed-off-by: Grant Likely 
---
 arch/microblaze/kernel/of_platform.c |6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/microblaze/kernel/of_platform.c 
b/arch/microblaze/kernel/of_platform.c
index 80c9c49..c664b27 100644
--- a/arch/microblaze/kernel/of_platform.c
+++ b/arch/microblaze/kernel/of_platform.c
@@ -50,16 +50,16 @@ const struct of_device_id of_default_bus_ids[] = {
 
 static int of_dev_node_match(struct device *dev, void *data)
 {
-   return to_of_device(dev)->dev.of_node == data;
+   return to_platform_device(dev)->dev.of_node == data;
 }
 
-struct of_device *of_find_device_by_node(struct device_node *np)
+struct platform_device *of_find_device_by_node(struct device_node *np)
 {
struct device *dev;
 
dev = bus_find_device(&platform_bus_type, NULL, np, of_dev_node_match);
if (dev)
-   return to_of_device(dev);
+   return to_platform_device(dev);
return NULL;
 }
 EXPORT_SYMBOL(of_find_device_by_node);

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


[PATCH 3/4] sparc: remove references to of_device and to_of_device

2010-07-22 Thread Grant Likely
of_device is just a #define alias to platform_device.  This patch
replaces all references to it with platform_device.

Signed-off-by: Grant Likely 
---
 arch/sparc/include/asm/prom.h|2 +-
 arch/sparc/kernel/apc.c  |4 ++--
 arch/sparc/kernel/auxio_64.c |3 ++-
 arch/sparc/kernel/central.c  |4 ++--
 arch/sparc/kernel/chmc.c |   12 ++--
 arch/sparc/kernel/ioport.c   |2 +-
 arch/sparc/kernel/of_device_32.c |   14 +++---
 arch/sparc/kernel/of_device_64.c |   16 
 arch/sparc/kernel/of_device_common.c |   14 +++---
 arch/sparc/kernel/pci.c  |4 ++--
 arch/sparc/kernel/pci_fire.c |4 ++--
 arch/sparc/kernel/pci_impl.h |2 +-
 arch/sparc/kernel/pci_psycho.c   |6 +++---
 arch/sparc/kernel/pci_sabre.c|6 +++---
 arch/sparc/kernel/pci_schizo.c   |   10 +-
 arch/sparc/kernel/pci_sun4v.c|4 ++--
 arch/sparc/kernel/pmc.c  |2 +-
 arch/sparc/kernel/power.c|2 +-
 arch/sparc/kernel/prom_irqtrans.c|2 +-
 arch/sparc/kernel/psycho_common.c|2 +-
 arch/sparc/kernel/psycho_common.h|2 +-
 arch/sparc/kernel/sbus.c |   16 
 arch/sparc/kernel/time_32.c  |2 +-
 arch/sparc/kernel/time_64.c  |6 +++---
 arch/sparc/mm/io-unit.c  |4 ++--
 arch/sparc/mm/iommu.c|4 ++--
 26 files changed, 75 insertions(+), 74 deletions(-)

diff --git a/arch/sparc/include/asm/prom.h b/arch/sparc/include/asm/prom.h
index d35df5a..c82a7da 100644
--- a/arch/sparc/include/asm/prom.h
+++ b/arch/sparc/include/asm/prom.h
@@ -57,7 +57,7 @@ extern void of_iounmap(struct resource *res, void __iomem 
*base, unsigned long s
 
 /* These routines are here to provide compatibility with how powerpc
  * handles IRQ mapping for OF device nodes.  We precompute and permanently
- * register them in the of_device objects, whereas powerpc computes them
+ * register them in the platform_device objects, whereas powerpc computes them
  * on request.
  */
 static inline void irq_dispose_mapping(unsigned int virq)
diff --git a/arch/sparc/kernel/apc.c b/arch/sparc/kernel/apc.c
index c471251..2c0046e 100644
--- a/arch/sparc/kernel/apc.c
+++ b/arch/sparc/kernel/apc.c
@@ -68,7 +68,7 @@ static void apc_swift_idle(void)
 #endif
 } 
 
-static inline void apc_free(struct of_device *op)
+static inline void apc_free(struct platform_device *op)
 {
of_iounmap(&op->resource[0], regs, resource_size(&op->resource[0]));
 }
@@ -136,7 +136,7 @@ static const struct file_operations apc_fops = {
 
 static struct miscdevice apc_miscdev = { APC_MINOR, APC_DEVNAME, &apc_fops };
 
-static int __devinit apc_probe(struct of_device *op,
+static int __devinit apc_probe(struct platform_device *op,
   const struct of_device_id *match)
 {
int err;
diff --git a/arch/sparc/kernel/auxio_64.c b/arch/sparc/kernel/auxio_64.c
index 46ba58a..3efd3c5 100644
--- a/arch/sparc/kernel/auxio_64.c
+++ b/arch/sparc/kernel/auxio_64.c
@@ -102,7 +102,8 @@ static struct of_device_id __initdata auxio_match[] = {
 
 MODULE_DEVICE_TABLE(of, auxio_match);
 
-static int __devinit auxio_probe(struct of_device *dev, const struct 
of_device_id *match)
+static int __devinit auxio_probe(struct platform_device *dev,
+const struct of_device_id *match)
 {
struct device_node *dp = dev->dev.of_node;
unsigned long size;
diff --git a/arch/sparc/kernel/central.c b/arch/sparc/kernel/central.c
index b6080c3..cfa2624 100644
--- a/arch/sparc/kernel/central.c
+++ b/arch/sparc/kernel/central.c
@@ -59,7 +59,7 @@ static int __devinit clock_board_calc_nslots(struct 
clock_board *p)
}
 }
 
-static int __devinit clock_board_probe(struct of_device *op,
+static int __devinit clock_board_probe(struct platform_device *op,
   const struct of_device_id *match)
 {
struct clock_board *p = kzalloc(sizeof(*p), GFP_KERNEL);
@@ -157,7 +157,7 @@ static struct of_platform_driver clock_board_driver = {
},
 };
 
-static int __devinit fhc_probe(struct of_device *op,
+static int __devinit fhc_probe(struct platform_device *op,
   const struct of_device_id *match)
 {
struct fhc *p = kzalloc(sizeof(*p), GFP_KERNEL);
diff --git a/arch/sparc/kernel/chmc.c b/arch/sparc/kernel/chmc.c
index 04bb7df..08c466e 100644
--- a/arch/sparc/kernel/chmc.c
+++ b/arch/sparc/kernel/chmc.c
@@ -392,7 +392,7 @@ static void __devinit jbusmc_construct_dimm_groups(struct 
jbusmc *p,
}
 }
 
-static int __devinit jbusmc_probe(struct of_device *op,
+static int __devinit jbusmc_probe(struct platform_device *op,
  const struct of_device_id *match)
 {
const struct linux_prom64_registers *mem_regs;
@@ -690,7 +690,7 @@ static void chmc_fetch_decode_r

[PATCH 2/4] powerpc: remove references to of_device and to_of_device

2010-07-22 Thread Grant Likely
of_device is just a #define alias to platform_device.  This patch
replaces all references to it with platform_device.

Signed-off-by: Grant Likely 
---
 arch/powerpc/kernel/ibmebus.c |8 
 arch/powerpc/kernel/of_platform.c |8 
 arch/powerpc/platforms/512x/clock.c   |2 +-
 arch/powerpc/platforms/52xx/mpc52xx_gpio.c|6 +++---
 arch/powerpc/platforms/52xx/mpc52xx_gpt.c |4 ++--
 arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c |6 +++---
 arch/powerpc/platforms/82xx/ep8248e.c |4 ++--
 arch/powerpc/platforms/83xx/suspend.c |6 +++---
 arch/powerpc/platforms/cell/axon_msi.c|4 ++--
 arch/powerpc/platforms/pasemi/gpio_mdio.c |4 ++--
 arch/powerpc/sysdev/axonram.c |   12 ++--
 arch/powerpc/sysdev/bestcomm/bestcomm.c   |7 +++
 arch/powerpc/sysdev/fsl_msi.c |4 ++--
 arch/powerpc/sysdev/fsl_pmc.c |3 ++-
 arch/powerpc/sysdev/fsl_rio.c |4 ++--
 arch/powerpc/sysdev/pmi.c |6 +++---
 arch/powerpc/sysdev/qe_lib/qe.c   |5 +++--
 17 files changed, 47 insertions(+), 46 deletions(-)

diff --git a/arch/powerpc/kernel/ibmebus.c b/arch/powerpc/kernel/ibmebus.c
index 21266ab..9b626cf 100644
--- a/arch/powerpc/kernel/ibmebus.c
+++ b/arch/powerpc/kernel/ibmebus.c
@@ -140,19 +140,19 @@ static struct dma_map_ops ibmebus_dma_ops = {
 
 static int ibmebus_match_path(struct device *dev, void *data)
 {
-   struct device_node *dn = to_of_device(dev)->dev.of_node;
+   struct device_node *dn = to_platform_device(dev)->dev.of_node;
return (dn->full_name &&
(strcasecmp((char *)data, dn->full_name) == 0));
 }
 
 static int ibmebus_match_node(struct device *dev, void *data)
 {
-   return to_of_device(dev)->dev.of_node == data;
+   return to_platform_device(dev)->dev.of_node == data;
 }
 
 static int ibmebus_create_device(struct device_node *dn)
 {
-   struct of_device *dev;
+   struct platform_device *dev;
int ret;
 
dev = of_device_alloc(dn, NULL, &ibmebus_bus_device);
@@ -298,7 +298,7 @@ static ssize_t ibmebus_store_remove(struct bus_type *bus,
 
if ((dev = bus_find_device(&ibmebus_bus_type, NULL, path,
   ibmebus_match_path))) {
-   of_device_unregister(to_of_device(dev));
+   of_device_unregister(to_platform_device(dev));
 
kfree(path);
return count;
diff --git a/arch/powerpc/kernel/of_platform.c 
b/arch/powerpc/kernel/of_platform.c
index b093d4b..84439d1 100644
--- a/arch/powerpc/kernel/of_platform.c
+++ b/arch/powerpc/kernel/of_platform.c
@@ -54,16 +54,16 @@ const struct of_device_id of_default_bus_ids[] = {
 
 static int of_dev_node_match(struct device *dev, void *data)
 {
-   return to_of_device(dev)->dev.of_node == data;
+   return to_platform_device(dev)->dev.of_node == data;
 }
 
-struct of_device *of_find_device_by_node(struct device_node *np)
+struct platform_device *of_find_device_by_node(struct device_node *np)
 {
struct device *dev;
 
dev = bus_find_device(&platform_bus_type, NULL, np, of_dev_node_match);
if (dev)
-   return to_of_device(dev);
+   return to_platform_device(dev);
return NULL;
 }
 EXPORT_SYMBOL(of_find_device_by_node);
@@ -76,7 +76,7 @@ EXPORT_SYMBOL(of_find_device_by_node);
  * lacking some bits needed here.
  */
 
-static int __devinit of_pci_phb_probe(struct of_device *dev,
+static int __devinit of_pci_phb_probe(struct platform_device *dev,
  const struct of_device_id *match)
 {
struct pci_controller *phb;
diff --git a/arch/powerpc/platforms/512x/clock.c 
b/arch/powerpc/platforms/512x/clock.c
index 4c42246..65e2d67 100644
--- a/arch/powerpc/platforms/512x/clock.c
+++ b/arch/powerpc/platforms/512x/clock.c
@@ -660,7 +660,7 @@ static void psc_clks_init(void)
 {
struct device_node *np;
const u32 *cell_index;
-   struct of_device *ofdev;
+   struct platform_device *ofdev;
 
for_each_compatible_node(np, NULL, "fsl,mpc5121-psc") {
cell_index = of_get_property(np, "cell-index", NULL);
diff --git a/arch/powerpc/platforms/52xx/mpc52xx_gpio.c 
b/arch/powerpc/platforms/52xx/mpc52xx_gpio.c
index 0855e80..0dad9a9 100644
--- a/arch/powerpc/platforms/52xx/mpc52xx_gpio.c
+++ b/arch/powerpc/platforms/52xx/mpc52xx_gpio.c
@@ -147,7 +147,7 @@ mpc52xx_wkup_gpio_dir_out(struct gpio_chip *gc, unsigned 
int gpio, int val)
return 0;
 }
 
-static int __devinit mpc52xx_wkup_gpiochip_probe(struct of_device *ofdev,
+static int __devinit mpc52xx_wkup_gpiochip_probe(struct platform_device *ofdev,
const struct of_device_id *match)
 {
struct mpc52xx_gpiochip *chip;
@@ -179,7 +179,7 @@ static int __devinit mpc52xx_wkup_gpiochip_pr

[PATCH 1/4] of/device: Replace of_device with platform_device in includes and core code

2010-07-22 Thread Grant Likely
of_device is currently just an #define alias to platform_device until it
gets removed entirely.  This patch removes references to it from the
include directories and the core drivers/of code.

Signed-off-by: Grant Likely 
---
 arch/powerpc/include/asm/macio.h   |2 +-
 arch/sparc/include/asm/floppy_64.h |6 +++---
 arch/sparc/include/asm/parport.h   |4 ++--
 drivers/of/device.c|   22 +++---
 drivers/of/platform.c  |   24 
 include/linux/of_device.h  |   10 +-
 include/linux/of_platform.h|   16 
 7 files changed, 42 insertions(+), 42 deletions(-)

diff --git a/arch/powerpc/include/asm/macio.h b/arch/powerpc/include/asm/macio.h
index 675e159..7ab82c8 100644
--- a/arch/powerpc/include/asm/macio.h
+++ b/arch/powerpc/include/asm/macio.h
@@ -38,7 +38,7 @@ struct macio_dev
 {
struct macio_bus*bus;   /* macio bus this device is on 
*/
struct macio_dev*media_bay; /* Device is part of a media 
bay */
-   struct of_deviceofdev;
+   struct platform_device  ofdev;
struct device_dma_parameters dma_parms; /* ide needs that */
int n_resources;
struct resource resource[MACIO_DEV_COUNT_RESOURCES];
diff --git a/arch/sparc/include/asm/floppy_64.h 
b/arch/sparc/include/asm/floppy_64.h
index 4f5bde6..6597ce8 100644
--- a/arch/sparc/include/asm/floppy_64.h
+++ b/arch/sparc/include/asm/floppy_64.h
@@ -43,7 +43,7 @@ struct sun_flpy_controller {
 /* You'll only ever find one controller on an Ultra anyways. */
 static struct sun_flpy_controller *sun_fdc = (struct sun_flpy_controller *)-1;
 unsigned long fdc_status;
-static struct of_device *floppy_op = NULL;
+static struct platform_device *floppy_op = NULL;
 
 struct sun_floppy_ops {
unsigned char   (*fd_inb) (unsigned long port);
@@ -548,7 +548,7 @@ static unsigned long __init sun_floppy_init(void)
 {
static int initialized = 0;
struct device_node *dp;
-   struct of_device *op;
+   struct platform_device *op;
const char *prop;
char state[128];
 
@@ -661,7 +661,7 @@ static unsigned long __init sun_floppy_init(void)
config = 0;
for (dp = ebus_dp->child; dp; dp = dp->sibling) {
if (!strcmp(dp->name, "ecpp")) {
-   struct of_device *ecpp_op;
+   struct platform_device *ecpp_op;
 
ecpp_op = of_find_device_by_node(dp);
if (ecpp_op)
diff --git a/arch/sparc/include/asm/parport.h b/arch/sparc/include/asm/parport.h
index 4891fbc..4f7afa0 100644
--- a/arch/sparc/include/asm/parport.h
+++ b/arch/sparc/include/asm/parport.h
@@ -103,7 +103,7 @@ static inline unsigned int get_dma_residue(unsigned int 
dmanr)
return ebus_dma_residue(&sparc_ebus_dmas[dmanr].info);
 }
 
-static int __devinit ecpp_probe(struct of_device *op, const struct 
of_device_id *match)
+static int __devinit ecpp_probe(struct platform_device *op, const struct 
of_device_id *match)
 {
unsigned long base = op->resource[0].start;
unsigned long config = op->resource[1].start;
@@ -192,7 +192,7 @@ out_err:
return err;
 }
 
-static int __devexit ecpp_remove(struct of_device *op)
+static int __devexit ecpp_remove(struct platform_device *op)
 {
struct parport *p = dev_get_drvdata(&op->dev);
int slot = p->dma;
diff --git a/drivers/of/device.c b/drivers/of/device.c
index 12a44b4..0d8a064 100644
--- a/drivers/of/device.c
+++ b/drivers/of/device.c
@@ -26,7 +26,7 @@ const struct of_device_id *of_match_device(const struct 
of_device_id *matches,
 }
 EXPORT_SYMBOL(of_match_device);
 
-struct of_device *of_dev_get(struct of_device *dev)
+struct platform_device *of_dev_get(struct platform_device *dev)
 {
struct device *tmp;
 
@@ -34,13 +34,13 @@ struct of_device *of_dev_get(struct of_device *dev)
return NULL;
tmp = get_device(&dev->dev);
if (tmp)
-   return to_of_device(tmp);
+   return to_platform_device(tmp);
else
return NULL;
 }
 EXPORT_SYMBOL(of_dev_get);
 
-void of_dev_put(struct of_device *dev)
+void of_dev_put(struct platform_device *dev)
 {
if (dev)
put_device(&dev->dev);
@@ -50,18 +50,18 @@ EXPORT_SYMBOL(of_dev_put);
 static ssize_t devspec_show(struct device *dev,
struct device_attribute *attr, char *buf)
 {
-   struct of_device *ofdev;
+   struct platform_device *ofdev;
 
-   ofdev = to_of_device(dev);
+   ofdev = to_platform_device(dev);
return sprintf(buf, "%s\n", ofdev->dev.of_node->full_name);
 }
 
 static ssize_t name_show(struct device *dev,
struct device_attribute *attr, char *buf)
 {
-   struct of_device *ofdev;
+   struct platfor

[PATCH 0/4] Replace reference to of_device with platform_device in arch and drivers/of/* code

2010-07-22 Thread Grant Likely
This series removes a lot of references to struct of_device which is
just a #define alias to struct platform_device.  It also replaces usage
of to_of_device() with to_platform_device().  There shouldn't be anything
risky or earth shattering here.  Certainly no functional changes.  I'll
be putting it into my experimental branch for compile testing on multiple
architectures before pushing it out to linux-next next week.

Similar patches to change over drivers/* will come later.

g.

---

Grant Likely (4):
  of/device: Replace of_device with platform_device in includes and core 
code
  powerpc: remove references to of_device and to_of_device
  sparc: remove references to of_device and to_of_device
  microblaze: remove references to of_device and to_of_device


 arch/microblaze/kernel/of_platform.c  |6 +++---
 arch/powerpc/include/asm/macio.h  |2 +-
 arch/powerpc/kernel/ibmebus.c |8 
 arch/powerpc/kernel/of_platform.c |8 
 arch/powerpc/platforms/512x/clock.c   |2 +-
 arch/powerpc/platforms/52xx/mpc52xx_gpio.c|6 +++---
 arch/powerpc/platforms/52xx/mpc52xx_gpt.c |4 ++--
 arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c |6 +++---
 arch/powerpc/platforms/82xx/ep8248e.c |4 ++--
 arch/powerpc/platforms/83xx/suspend.c |6 +++---
 arch/powerpc/platforms/cell/axon_msi.c|4 ++--
 arch/powerpc/platforms/pasemi/gpio_mdio.c |4 ++--
 arch/powerpc/sysdev/axonram.c |   12 ++--
 arch/powerpc/sysdev/bestcomm/bestcomm.c   |7 +++
 arch/powerpc/sysdev/fsl_msi.c |4 ++--
 arch/powerpc/sysdev/fsl_pmc.c |3 ++-
 arch/powerpc/sysdev/fsl_rio.c |4 ++--
 arch/powerpc/sysdev/pmi.c |6 +++---
 arch/powerpc/sysdev/qe_lib/qe.c   |5 +++--
 arch/sparc/include/asm/floppy_64.h|6 +++---
 arch/sparc/include/asm/parport.h  |4 ++--
 arch/sparc/include/asm/prom.h |2 +-
 arch/sparc/kernel/apc.c   |4 ++--
 arch/sparc/kernel/auxio_64.c  |3 ++-
 arch/sparc/kernel/central.c   |4 ++--
 arch/sparc/kernel/chmc.c  |   12 ++--
 arch/sparc/kernel/ioport.c|2 +-
 arch/sparc/kernel/of_device_32.c  |   14 +++---
 arch/sparc/kernel/of_device_64.c  |   16 
 arch/sparc/kernel/of_device_common.c  |   14 +++---
 arch/sparc/kernel/pci.c   |4 ++--
 arch/sparc/kernel/pci_fire.c  |4 ++--
 arch/sparc/kernel/pci_impl.h  |2 +-
 arch/sparc/kernel/pci_psycho.c|6 +++---
 arch/sparc/kernel/pci_sabre.c |6 +++---
 arch/sparc/kernel/pci_schizo.c|   10 +-
 arch/sparc/kernel/pci_sun4v.c |4 ++--
 arch/sparc/kernel/pmc.c   |2 +-
 arch/sparc/kernel/power.c |2 +-
 arch/sparc/kernel/prom_irqtrans.c |2 +-
 arch/sparc/kernel/psycho_common.c |2 +-
 arch/sparc/kernel/psycho_common.h |2 +-
 arch/sparc/kernel/sbus.c  |   16 
 arch/sparc/kernel/time_32.c   |2 +-
 arch/sparc/kernel/time_64.c   |6 +++---
 arch/sparc/mm/io-unit.c   |4 ++--
 arch/sparc/mm/iommu.c |4 ++--
 drivers/of/device.c   |   22 +++---
 drivers/of/platform.c |   24 
 include/linux/of_device.h |   10 +-
 include/linux/of_platform.h   |   16 
 51 files changed, 167 insertions(+), 165 deletions(-)

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


Re: [

2010-07-22 Thread Sean MacLennan
On Tue, 13 Jul 2010 11:50:24 +0200
Sam Ravnborg  wrote:

> Ben - will you take it via the popwerpc tree
> or shall I ask Michal to take it via kbuild?

Anything happening with this patch?

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


Re: [PATCH][RFC] preempt_count corruption across H_CEDE call with CONFIG_PREEMPT on pseries

2010-07-22 Thread Benjamin Herrenschmidt
On Thu, 2010-07-22 at 11:24 -0700, Darren Hart wrote:
> 
> 1) How can the preempt_count() get mangled across the H_CEDE hcall?
> 2) Should we call preempt_enable() in cpu_idle() prior to cpu_die() ?

The preempt count is on the thread info at the bottom of the stack.

Can you check the stack pointers ?

Cheers,
Ben.


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


[PATCH 6/9 v1.02] Add Synopsys DesignWare HS USB OTG Controller driver.

2010-07-22 Thread Fushen Chen
Implements functions to manage Queue Heads and Queue
Transfer Descriptors of DWC USB OTG Controller.

Signed-off-by: Fushen Chen 
Signed-off-by: Mark Miesfeld 
---
 drivers/usb/dwc_otg/dwc_otg_hcd_queue.c |  719 +++
 1 files changed, 719 insertions(+), 0 deletions(-)
 create mode 100644 drivers/usb/dwc_otg/dwc_otg_hcd_queue.c

diff --git a/drivers/usb/dwc_otg/dwc_otg_hcd_queue.c 
b/drivers/usb/dwc_otg/dwc_otg_hcd_queue.c
new file mode 100644
index 000..97a7867
--- /dev/null
+++ b/drivers/usb/dwc_otg/dwc_otg_hcd_queue.c
@@ -0,0 +1,719 @@
+/*
+ * DesignWare HS OTG controller driver
+ *
+ * Author: Mark Miesfeld 
+ *
+ * Based on versions provided by APM and Synopsis which are:
+ * Copyright (C) 2009-2010 AppliedMicro(www.apm.com)
+ * Modified by Stefan Roese , DENX Software Engineering
+ * Modified by Chuck Meade 
+ *
+ * Synopsys HS OTG Linux Software Driver and documentation (hereinafter,
+ * "Software") is an Unsupported proprietary work of Synopsys, Inc. unless
+ * otherwise expressly agreed to in writing between Synopsys and you.
+ *
+ * The Software IS NOT an item of Licensed Software or Licensed Product under
+ * any End User Software License Agreement or Agreement for Licensed Product
+ * with Synopsys or any supplement thereto. You are permitted to use and
+ * redistribute this Software in source and binary forms, with or without
+ * modification, provided that redistributions of source code must retain this
+ * notice. You may not view, use, disclose, copy or distribute this file or
+ * any information contained herein except pursuant to this license grant from
+ * Synopsys. If you do not agree with this notice, including the disclaimer
+ * below, then you are not authorized to use the Software.
+ *
+ * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" BASIS
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+ * DAMAGE.
+ *
+ * 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.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+/*
+ * This file contains the functions to manage Queue Heads and Queue
+ * Transfer Descriptors.
+ */
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "dwc_otg_driver.h"
+#include "dwc_otg_hcd.h"
+#include "dwc_otg_regs.h"
+
+static inline int is_fs_ls(enum usb_device_speed speed)
+{
+   return speed == USB_SPEED_FULL || speed == USB_SPEED_LOW;
+}
+
+/* Allocates memory for a QH structure. */
+static inline struct dwc_qh *dwc_otg_hcd_qh_alloc(void)
+{
+   return kmalloc(sizeof(struct dwc_qh), GFP_ATOMIC);
+}
+
+/**
+ * Initializes a QH structure to initialize the QH.
+ */
+#define SCHEDULE_SLOP 10
+static void dwc_otg_hcd_qh_init(struct dwc_hcd *hcd, struct dwc_qh *qh,
+   struct urb *urb)
+{
+   memset(qh, 0, sizeof(struct dwc_qh));
+
+   /* Initialize QH */
+   switch (usb_pipetype(urb->pipe)) {
+   case PIPE_CONTROL:
+   qh->ep_type = USB_ENDPOINT_XFER_CONTROL;
+   break;
+   case PIPE_BULK:
+   qh->ep_type = USB_ENDPOINT_XFER_BULK;
+   break;
+   case PIPE_ISOCHRONOUS:
+   qh->ep_type = USB_ENDPOINT_XFER_ISOC;
+   break;
+   case PIPE_INTERRUPT:
+   qh->ep_type = USB_ENDPOINT_XFER_INT;
+   break;
+   }
+
+   qh->ep_is_in = usb_pipein(urb->pipe) ? 1 : 0;
+   qh->data_toggle = DWC_OTG_HC_PID_DATA0;
+   qh->maxp = usb_maxpacket(urb->dev, urb->pipe, !(usb_pipein(urb->pipe)));
+
+   INIT_LIST_HEAD(&qh->qtd_list);
+   INIT_LIST_HEAD(&qh->qh_list_entry);
+
+   qh->channel = NULL;
+   qh->speed = urb->dev->speed;
+
+   /*
+* FS/LS Enpoint on HS Hub NOT virtual root hub
+*/
+   qh->do_split = 0;
+   if (is_fs_ls(u

[PATCH 1/9 v1.02] Add Synopsys DesignWare HS USB OTG Controller driver.

2010-07-22 Thread Fushen Chen
The DWC OTG driver module provides the initialization and cleanup
entry points for the DWC OTG USB driver.

Signed-off-by: Fushen Chen 
Signed-off-by: Mark Miesfeld 
---
 drivers/Makefile |1 +
 drivers/usb/Kconfig  |2 +
 drivers/usb/dwc_otg/Kconfig  |   96 +++
 drivers/usb/dwc_otg/Makefile |   13 +
 drivers/usb/dwc_otg/dwc_otg_driver.c | 1246 ++
 drivers/usb/dwc_otg/dwc_otg_driver.h |   97 +++
 drivers/usb/gadget/Kconfig   |   21 +
 drivers/usb/gadget/gadget_chips.h|7 +
 8 files changed, 1483 insertions(+), 0 deletions(-)
 create mode 100644 drivers/usb/dwc_otg/Kconfig
 create mode 100644 drivers/usb/dwc_otg/Makefile
 create mode 100644 drivers/usb/dwc_otg/dwc_otg_driver.c
 create mode 100644 drivers/usb/dwc_otg/dwc_otg_driver.h

diff --git a/drivers/Makefile b/drivers/Makefile
index 20dcced..f3fc7c7 100644
--- a/drivers/Makefile
+++ b/drivers/Makefile
@@ -67,6 +67,7 @@ obj-$(CONFIG_UWB) += uwb/
 obj-$(CONFIG_USB_OTG_UTILS)+= usb/otg/
 obj-$(CONFIG_USB)  += usb/
 obj-$(CONFIG_USB_MUSB_HDRC)+= usb/musb/
+obj-$(CONFIG_USB_DWC_OTG)  += usb/dwc_otg/
 obj-$(CONFIG_PCI)  += usb/
 obj-$(CONFIG_USB_GADGET)   += usb/gadget/
 obj-$(CONFIG_SERIO)+= input/serio/
diff --git a/drivers/usb/Kconfig b/drivers/usb/Kconfig
index 6a58cb1..f48920b 100644
--- a/drivers/usb/Kconfig
+++ b/drivers/usb/Kconfig
@@ -113,6 +113,8 @@ source "drivers/usb/host/Kconfig"
 
 source "drivers/usb/musb/Kconfig"
 
+source "drivers/usb/dwc_otg/Kconfig"
+
 source "drivers/usb/class/Kconfig"
 
 source "drivers/usb/storage/Kconfig"
diff --git a/drivers/usb/dwc_otg/Kconfig b/drivers/usb/dwc_otg/Kconfig
new file mode 100644
index 000..27ae0d5
--- /dev/null
+++ b/drivers/usb/dwc_otg/Kconfig
@@ -0,0 +1,96 @@
+#
+# USB Dual Role (OTG-ready) Controller Drivers
+# for silicon based on Synopsys DesignWare IP
+#
+
+comment "Enable Host or Gadget support for DesignWare OTG controller"
+   depends on !USB && USB_GADGET=n
+
+config USB_DWC_OTG
+   depends on (USB || USB_GADGET)
+   depends on 405EZ || 405EX || 460EX
+   select NOP_USB_XCEIV
+   select USB_OTG_UTILS
+   tristate "Synopsys DWC OTG Controller"
+   default USB_GADGET
+   help
+ This driver provides USB Device Controller support for the
+ Synopsys DesignWare USB OTG Core used on the AppliedMicro PowerPC SoC.
+
+config DWC_DEBUG
+   bool "Enable DWC Debugging"
+   depends on USB_DWC_OTG
+   default n
+   help
+ Enable DWC driver debugging
+
+choice
+   prompt "DWC Mode Selection"
+   depends on USB_DWC_OTG
+   default DWC_OTG_MODE
+   help
+ Select the DWC Core in OTG, Host only, or Device only mode.
+
+config DWC_OTG_MODE
+   bool "DWC OTG Mode" if 405EX || 460EX
+   select USB_GADGET_SELECTED
+
+config DWC_HOST_ONLY
+   bool "DWC Host Only Mode" if 405EX || 460EX
+
+config DWC_DEVICE_ONLY
+   bool "DWC Device Only Mode"
+   select USB_GADGET_SELECTED
+
+endchoice
+
+# enable peripheral support (including with OTG)
+config USB_GADGET_DWC_HDRC
+bool
+depends on USB_DWC_OTG && (DWC_DEVICE_ONLY || USB_DWC_OTG)
+
+choice
+   prompt "DWC DMA/SlaveMode Selection"
+   depends on USB_DWC_OTG
+   default DWC_DMA_MODE
+   help
+ Select the DWC DMA or Slave Mode.
+ DMA mode uses the DWC core internal DMA engines.
+ Slave mode uses the processor PIO to tranfer data.
+ In Slave mode, processor's DMA channels can be used if available.
+
+config DWC_SLAVE
+   bool "DWC Slave Mode" if 405EX || 460EX
+
+config DWC_DMA_MODE
+   bool "DWC DMA Mode" if 405EX || (460EX && \
+   (!USB_EHCI_HCD  || !USB_OHCI_HCD))
+
+endchoice
+
+config USB_OTG_WHITELIST
+   bool "Rely on OTG Targeted Peripherals List"
+   depends on !USB_SUSPEND
+   default n
+   help
+This is the same flag as in ../core/Kconfig.
+It is here for easy deselect.
+
+config DWC_OTG_REG_LE
+   depends on USB_DWC_OTG
+   bool "DWC Little Endian Register" if 405EX || 460EX
+   default y
+   help
+OTG core register access is Little-Endian.
+
+config DWC_OTG_FIFO_LE
+   depends on USB_DWC_OTG
+   bool "DWC FIFO Little Endian" if 405EZ
+   default n
+   help
+OTG core FIFO access is Little-Endian.
+
+config DWC_LIMITED_XFER_SIZE
+   depends on USB_DWC_OTG
+   bool "DWC Endpoint Limited Xfer Size" if 405EZ
+   default n
diff --git a/drivers/usb/dwc_otg/Makefile b/drivers/usb/dwc_otg/Makefile
new file mode 100644
index 000..337ff81
--- /dev/null
+++ b/drivers/usb/dwc_otg/Makefile
@@ -0,0 +1,13 @@
+#
+# OTG infrastructure and transceiver drivers
+#
+obj-$(CONFIG_USB_DWC_OTG)  += dwc_otg.o
+
+dwc_otg-objs := dwc_otg_driver.o dwc_otg_cil.o dwc_otg_cil_intr.o
+ifneq ($(CONFIG_DWC_DEVICE_ONLY),y)
+dwc_o

[PATCH 3/9 v1.02] Add Synopsys DesignWare HS USB OTG Controller driver.

2010-07-22 Thread Fushen Chen
Core Interface Layer Common Interrupt handlers provides common interrupt
handler for both host controller and peripheral controller.

Signed-off-by: Fushen Chen 
Signed-off-by: Mark Miesfeld 
---
 drivers/usb/dwc_otg/dwc_otg_cil_intr.c |  631 
 1 files changed, 631 insertions(+), 0 deletions(-)
 create mode 100644 drivers/usb/dwc_otg/dwc_otg_cil_intr.c

diff --git a/drivers/usb/dwc_otg/dwc_otg_cil_intr.c 
b/drivers/usb/dwc_otg/dwc_otg_cil_intr.c
new file mode 100644
index 000..e25ea37
--- /dev/null
+++ b/drivers/usb/dwc_otg/dwc_otg_cil_intr.c
@@ -0,0 +1,631 @@
+/*
+ * DesignWare HS OTG controller driver
+ *
+ * Author: Mark Miesfeld 
+ *
+ * Based on versions provided by APM and Synopsis which are:
+ * Copyright (C) 2009-2010 AppliedMicro(www.apm.com)
+ * Modified by Stefan Roese , DENX Software Engineering
+ *
+ * Synopsys HS OTG Linux Software Driver and documentation (hereinafter,
+ * "Software") is an Unsupported proprietary work of Synopsys, Inc. unless
+ * otherwise expressly agreed to in writing between Synopsys and you.
+ *
+ * The Software IS NOT an item of Licensed Software or Licensed Product under
+ * any End User Software License Agreement or Agreement for Licensed Product
+ * with Synopsys or any supplement thereto. You are permitted to use and
+ * redistribute this Software in source and binary forms, with or without
+ * modification, provided that redistributions of source code must retain this
+ * notice. You may not view, use, disclose, copy or distribute this file or
+ * any information contained herein except pursuant to this license grant from
+ * Synopsys. If you do not agree with this notice, including the disclaimer
+ * below, then you are not authorized to use the Software.
+ *
+ * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" BASIS
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+ * DAMAGE.
+ *
+ * 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.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+/*
+ * The Core Interface Layer provides basic services for accessing and
+ * managing the DWC_otg hardware. These services are used by both the
+ * Host Controller Driver and the Peripheral Controller Driver.
+ *
+ * This file contains the Common Interrupt handlers.
+ */
+#include 
+#include 
+
+#include "dwc_otg_regs.h"
+#include "dwc_otg_cil.h"
+
+/**
+ *  This function will log a debug message
+ */
+static int dwc_otg_handle_mode_mismatch_intr(struct core_if *core_if)
+{
+   union gintsts_data gintsts;
+
+   printk(KERN_WARNING "Mode Mismatch Interrupt: currently in %s mode\n",
+   dwc_otg_mode(core_if) ? "Host" : "Device");
+
+   /* Clear interrupt */
+   gintsts.d32 = 0;
+   gintsts.b.modemismatch = 1;
+   dwc_write_reg32(&core_if->core_global_regs->gintsts, gintsts.d32);
+
+   return 1;
+}
+
+/**
+ *  Start the HCD.  Helper function for using the HCD callbacks.
+ */
+static inline void hcd_start(struct core_if *core_if)
+{
+   if (core_if->hcd_cb && core_if->hcd_cb->start)
+   core_if->hcd_cb->start(core_if->hcd_cb->p);
+}
+
+/**
+ *  Stop the HCD.  Helper function for using the HCD callbacks.
+ */
+static inline void hcd_stop(struct core_if *core_if)
+{
+   if (core_if->hcd_cb && core_if->hcd_cb->stop)
+   core_if->hcd_cb->stop(core_if->hcd_cb->p);
+}
+
+/**
+ *  Disconnect the HCD.  Helper function for using the HCD callbacks.
+ */
+static inline void hcd_disconnect(struct core_if *core_if)
+{
+   if (core_if->hcd_cb && core_if->hcd_cb->disconnect)
+   core_if->hcd_cb->disconnect(core_if->hcd_cb->p);
+}
+
+/**
+ *  Inform the HCD the a New Session has begun.  Helper function for using the
+ *  HCD callbacks.
+ */
+static inline void hcd_session_start(struct core_if *co

[PATCH 7/9 v1.02] Add Synopsys DesignWare HS USB OTG Controller driver.

2010-07-22 Thread Fushen Chen
The Peripheral Controller Driver (PCD) is responsible for translating
requests from the Function Driver into the appropriate actions on the
DWC OTG controller.

Signed-off-by: Fushen Chen 
Signed-off-by: Mark Miesfeld 
---
 drivers/usb/dwc_otg/dwc_otg_pcd.c | 1758 +
 drivers/usb/dwc_otg/dwc_otg_pcd.h |  160 
 2 files changed, 1918 insertions(+), 0 deletions(-)
 create mode 100644 drivers/usb/dwc_otg/dwc_otg_pcd.c
 create mode 100644 drivers/usb/dwc_otg/dwc_otg_pcd.h

diff --git a/drivers/usb/dwc_otg/dwc_otg_pcd.c 
b/drivers/usb/dwc_otg/dwc_otg_pcd.c
new file mode 100644
index 000..9bf663b
--- /dev/null
+++ b/drivers/usb/dwc_otg/dwc_otg_pcd.c
@@ -0,0 +1,1758 @@
+/*
+ * DesignWare HS OTG controller driver
+ *
+ * Author: Mark Miesfeld 
+ *
+ * Based on versions provided by APM and Synopsis which are:
+ * Copyright (C) 2009-2010 AppliedMicro(www.apm.com)
+ * Modified by Stefan Roese , DENX Software Engineering
+ *
+ * Synopsys HS OTG Linux Software Driver and documentation (hereinafter,
+ * "Software") is an Unsupported proprietary work of Synopsys, Inc. unless
+ * otherwise expressly agreed to in writing between Synopsys and you.
+ *
+ * The Software IS NOT an item of Licensed Software or Licensed Product under
+ * any End User Software License Agreement or Agreement for Licensed Product
+ * with Synopsys or any supplement thereto. You are permitted to use and
+ * redistribute this Software in source and binary forms, with or without
+ * modification, provided that redistributions of source code must retain this
+ * notice. You may not view, use, disclose, copy or distribute this file or
+ * any information contained herein except pursuant to this license grant from
+ * Synopsys. If you do not agree with this notice, including the disclaimer
+ * below, then you are not authorized to use the Software.
+ *
+ * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" BASIS
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+ * DAMAGE.
+ *
+ * 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.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+/*
+ * This file implements the Peripheral Controller Driver.
+ *
+ * The Peripheral Controller Driver (PCD) is responsible for
+ * translating requests from the Function Driver into the appropriate
+ * actions on the DWC_otg controller. It isolates the Function Driver
+ * from the specifics of the controller by providing an API to the
+ * Function Driver.
+ *
+ * The Peripheral Controller Driver for Linux will implement the
+ * Gadget API, so that the existing Gadget drivers can be used.
+ * (Gadget Driver is the Linux terminology for a Function Driver.)
+ *
+ * The Linux Gadget API is defined in the header file linux/usb/gadget.h. The
+ * USB EP operations API is defined in the structure usb_ep_ops and the USB
+ * Controller API is defined in the structure usb_gadget_ops
+ *
+ * An important function of the PCD is managing interrupts generated
+ * by the DWC_otg controller. The implementation of the DWC_otg device
+ * mode interrupt service routines is in dwc_otg_pcd_intr.c.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "dwc_otg_driver.h"
+#include "dwc_otg_pcd.h"
+
+/*
+ * Static PCD pointer for use in usb_gadget_register_driver and
+ * usb_gadget_unregister_driver.  Initialized in dwc_otg_pcd_init.
+ */
+static struct dwc_pcd *s_pcd;
+
+static inline int need_stop_srp_timer(struct core_if *core_if)
+{
+   if (core_if->core_params->phy_type != DWC_PHY_TYPE_PARAM_FS ||
+   !core_if->core_params->i2c_enable)
+   return core_if->srp_timer_started ? 1 : 0;
+   return 0;
+}
+
+/**
+ * Tests if the module 

[PATCH 5/9 v1.02] Add Synopsys DesignWare HS USB OTG Controller driver.

2010-07-22 Thread Fushen Chen
Implements DWC OTG USB Host Controller Driver (HCD) interrupt
service routine.

Signed-off-by: Fushen Chen 
Signed-off-by: Mark Miesfeld 
---
 drivers/usb/dwc_otg/dwc_otg_hcd_intr.c | 1477 
 1 files changed, 1477 insertions(+), 0 deletions(-)
 create mode 100644 drivers/usb/dwc_otg/dwc_otg_hcd_intr.c

diff --git a/drivers/usb/dwc_otg/dwc_otg_hcd_intr.c 
b/drivers/usb/dwc_otg/dwc_otg_hcd_intr.c
new file mode 100644
index 000..a6c93a1
--- /dev/null
+++ b/drivers/usb/dwc_otg/dwc_otg_hcd_intr.c
@@ -0,0 +1,1477 @@
+/*
+ * DesignWare HS OTG controller driver
+ *
+ * Author: Mark Miesfeld 
+ *
+ * Based on versions provided by APM and Synopsis which are:
+ * Copyright (C) 2009-2010 AppliedMicro(www.apm.com)
+ * Modified by Stefan Roese , DENX Software Engineering
+ * Modified by Chuck Meade 
+ *
+ * Synopsys HS OTG Linux Software Driver and documentation (hereinafter,
+ * "Software") is an Unsupported proprietary work of Synopsys, Inc. unless
+ * otherwise expressly agreed to in writing between Synopsys and you.
+ *
+ * The Software IS NOT an item of Licensed Software or Licensed Product under
+ * any End User Software License Agreement or Agreement for Licensed Product
+ * with Synopsys or any supplement thereto. You are permitted to use and
+ * redistribute this Software in source and binary forms, with or without
+ * modification, provided that redistributions of source code must retain this
+ * notice. You may not view, use, disclose, copy or distribute this file or
+ * any information contained herein except pursuant to this license grant from
+ * Synopsys. If you do not agree with this notice, including the disclaimer
+ * below, then you are not authorized to use the Software.
+ *
+ * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" BASIS
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+ * DAMAGE.
+ *
+ * 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.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+#include "dwc_otg_driver.h"
+#include "dwc_otg_hcd.h"
+#include "dwc_otg_regs.h"
+
+/* This file contains the implementation of the HCD Interrupt handlers.
*/
+static const int erratum_usb09_patched;
+static const int deferral_on = 1;
+static const int nak_deferral_delay = 8;
+static const int nyet_deferral_delay = 1;
+
+/**
+ * Handles the start-of-frame interrupt in host mode. Non-periodic
+ * transactions may be queued to the DWC_otg controller for the current
+ * (micro)frame. Periodic transactions may be queued to the controller for the
+ * next (micro)frame.
+ */
+static int dwc_otg_hcd_handle_sof_intr(struct dwc_hcd *hcd)
+{
+   union hfnum_data hfnum;
+   struct list_head *qh_entry;
+   struct dwc_qh *qh;
+   enum dwc_transaction_type tr_type;
+   union gintsts_data gintsts = {.d32 = 0};
+
+   hfnum.d32 =
+   dwc_read_reg32(&hcd->core_if->host_if->host_global_regs->hfnum);
+
+   hcd->frame_number = hfnum.b.frnum;
+
+   /* Determine whether any periodic QHs should be executed. */
+   qh_entry = hcd->periodic_sched_inactive.next;
+   while (qh_entry != &hcd->periodic_sched_inactive) {
+   qh = list_entry(qh_entry, struct dwc_qh, qh_list_entry);
+   qh_entry = qh_entry->next;
+
+   /*
+* If needed, move QH to the ready list to be executed next
+* (micro)frame.
+*/
+   if (dwc_frame_num_le(qh->sched_frame, hcd->frame_number))
+   list_move(&qh->qh_list_entry,
+   &hcd->periodic_sched_ready);
+   }
+
+   tr_type = dwc_otg_hcd_select_transactions(hcd);
+   if (tr_type != DWC_OTG_TRANSACTION_NONE)
+   dwc_otg_hcd_queue_transactions(hcd, tr_type);
+
+   /* Clea

sec 1.0 talitos driver

2010-07-22 Thread Jayasri Sangu
Hi,

   Does anybody developed sec 1.0 talitos driver fro mpc8248 freescale 
processor.

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

Re: Commit 3da34aa brakes MSI support on MPC8308 (possibly all MPC83xx) [REPOST]

2010-07-22 Thread Ilya Yanok

 23.07.2010 1:09, Ilya Yanok wrote:

I hope to disturb you but I haven't got any reply for my first posting...


I shouldn't be working at night... It's 'hate' not 'hope'...

Regards, Ilya.

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


Commit 3da34aa brakes MSI support on MPC8308 (possibly all MPC83xx) [REPOST]

2010-07-22 Thread Ilya Yanok

 Hi Kumar, Kim, Josh, everybody,

I hope to disturb you but I haven't got any reply for my first posting...

I've found that MSI work correctly with older kernels on my MPC8308RDB 
board and don't work with newer ones. After bisecting I've found that 
the source of the problem is commit 3da34aa:


commit 3da34aae03d498ee62f75aa7467de93cce3030fd
Author: Kumar Gala 
Date:   Tue May 12 15:51:56 2009 -0500

powerpc/fsl: Support unique MSI addresses per PCIe Root Complex

Its feasible based on how the PCI address map is setup that the region
of PCI address space used for MSIs differs for each PHB on the same 
SoC.


Instead of assuming that the address mappes to CCSRBAR 1:1 we read
PEXCSRBAR (BAR0) for the PHB that the given pci_dev is on.

Signed-off-by: Kumar Gala 

I can see BAR0 initialization for 85xx/86xx hardware but not for 83xx 
neigher in the kernel nor in U-Boot (that makes me think that all 83xx 
can be affected).
I'm not actually an PCI expert so I've just tried to write IMMR base 
address to the BAR0 register from the U-Boot to get the correct address 
but this doesn't help.
Please direct me how to init 83xx PCIE controller to make it compatible 
with this patch.


Kim, I think MPC8315E is affected too, could you please test it?

Thanks in advance.

Regards, Ilya.

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


[PATCH 1/1] powerpc: Increase pseries_cpu_die delay

2010-07-22 Thread Brian King

In testing SMT disable, we have been regularly seeing the following message:

Querying DEAD? cpu %i (%i) shows %i

This indicates the current delay in pseries_cpu_die where we wait
for the specified CPU to die, is insufficient. Usually, this does
not cause a problem, but we've seen this result in BUG_ON's going
off in the timer code when we try to migrate the timers off the
dead cpu while a timer is still running. Increasing this delay,
as is done in this patch, seems to resolve this issue.

Signed-off-by: Brian King 
---

 arch/powerpc/platforms/pseries/hotplug-cpu.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff -puN arch/powerpc/platforms/pseries/hotplug-cpu.c~powerpc_cpu_die_delay 
arch/powerpc/platforms/pseries/hotplug-cpu.c
--- 
linux-2.6/arch/powerpc/platforms/pseries/hotplug-cpu.c~powerpc_cpu_die_delay
2010-07-20 09:24:01.0 -0500
+++ linux-2.6-bjking1/arch/powerpc/platforms/pseries/hotplug-cpu.c  
2010-07-20 09:24:20.0 -0500
@@ -193,12 +193,12 @@ static void pseries_cpu_die(unsigned int
 
if (get_preferred_offline_state(cpu) == CPU_STATE_INACTIVE) {
cpu_status = 1;
-   for (tries = 0; tries < 1000; tries++) {
+   for (tries = 0; tries < 5000; tries++) {
if (get_cpu_current_state(cpu) == CPU_STATE_INACTIVE) {
cpu_status = 0;
break;
}
-   cpu_relax();
+   msleep(1);
}
} else if (get_preferred_offline_state(cpu) == CPU_STATE_OFFLINE) {
 
_
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: [PATCH] powerpc: print cores passed to firmware in decimal

2010-07-22 Thread Jesse Larrew

On 07/22/2010 12:15 AM, Michael Neuling wrote:

@@ -869,12 +895,12 @@ static void __init prom_send_capabilities(void)
cores = (u32 
*)PTRRELOC(&ibm_architecture_vec[IBM_ARCH_VEC_NRCORES_OFFSET]);
if (*cores != NR_CPUS) {
prom_printf("WARNING ! "
-   "ibm_architecture_vec structure inconsistent: 
0x%x !\n",
+   "ibm_architecture_vec structure inconsistent: 
0x%i !\n",
*cores);
   


Since we're changing from hex to decimal, we shouldn't print the "0x".

Sincerely,

--

Jesse Larrew
Software Engineer, Linux on Power Kernel Team
IBM Linux Technology Center
Phone: (512) 973-2052 (T/L: 363-2052)
jlar...@linux.vnet.ibm.com

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


[git pull] Please pull powerpc.git merge branch

2010-07-22 Thread Kumar Gala
The following changes since commit cd5b8f8755a89a57fc8c408d284b8b613f090345:
  Linus Torvalds (1):
Merge branch 'urgent' of git://git.kernel.org/.../brodo/pcmcia-2.6

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/galak/powerpc.git merge

Kumar Gala (1):
  powerpc/kexec: Fix boundary case for book-e kexec memory limits

 arch/powerpc/include/asm/kexec.h |6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: [PATCH 2/2] mpc85xx_edac: change to use new definitions for PCI EDAC regspace

2010-07-22 Thread Scott Wood
On Thu, 22 Jul 2010 23:03:03 +0400
Dmitry Eremin-Solenikov  wrote:

> Hello,
> 
> On Thu, Jul 22, 2010 at 10:40 PM, Kumar Gala  
> wrote:
> >
> > On Jul 22, 2010, at 1:25 PM, Scott Wood wrote:
> >> How about keeping the error stuff as a separate device from Linux's
> >> perspective, but have the main Freescale PCI code create it as a
> >> platform device instead of putting it in the device tree?
> >
> > I'd be good with that solution.
> 
> Then we come back to the question that was raised before (during initial
> review of edac driver): as PCI code is probbed long before other parts
> of the kernel and mpc85xx_edac code can be compiled as module,
> it's not possible to directly call mpc85xx_edac code from fsl_pci.c

Right, that's why I suggested creating a platform device rather than
just a function call.

> Two initial suggestions were:
> 1) creating special platform device
> 2) creating special of_platform device from dts
> 
> Which approach should I choose? Did i miss any other opportunities?

#1, as it keeps the split out of the device tree.

Besides the theoretical/aesthetic issues of putting Linux
implementation concerns into the device tree, #2 would mean that the
edac driver wouldn't work when Linux is booted with an old device tree.

-Scott

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


Re: [PATCH 2/2] mpc85xx_edac: change to use new definitions for PCI EDAC regspace

2010-07-22 Thread Grant Likely
On Thu, Jul 22, 2010 at 1:03 PM, Dmitry Eremin-Solenikov
 wrote:
> Hello,
>
> On Thu, Jul 22, 2010 at 10:40 PM, Kumar Gala  
> wrote:
>>
>> On Jul 22, 2010, at 1:25 PM, Scott Wood wrote:
>>
>>> On Thu, 22 Jul 2010 20:48:15 +0400
>>> Dmitry Eremin-Solenikov  wrote:
>>>
 Hello,

 On Thu, Jul 22, 2010 at 7:38 PM, Kumar Gala  
 wrote:
>
> On Jul 21, 2010, at 7:03 PM, Dmitry Eremin-Solenikov wrote:
>
>> Currently (as mpc8540-pci) devices are not created on of_platform bus,
>> mpc85xx_edac can't probe to them. Follow the change to dts trees to bind
>> not to the main mpc8540-pci node but to special mpc85xx-pci-error nodes,
>> present on soc bus.
>>
>> Signed-off-by: Dmitry Eremin-Solenikov 
>> ---
>> drivers/edac/mpc85xx_edac.c |   18 +-
>> 1 files changed, 9 insertions(+), 9 deletions(-)
>
> Nak.
>
> We already have a node in the dts for the PCI controller.  Lets update 
> the platform code to add the pci controller to the of_platform_bus_probe 
> list.

 I've had that idea. However it's really look strange to me to call
 of_platform_bus_probe() on the bus node, for which we (IMO) explicitly
 won't like for
 child devices (PCI devices) to be added to of_platform bus.
>>>
>>> Right, and it's also not great for a driver for one aspect of PCI to
>>> claim to be the driver for the whole thing.
>>>
>>> But changing the device tree because of this Linux-internal concern is
>>> also not good.
>>>
>>> How about keeping the error stuff as a separate device from Linux's
>>> perspective, but have the main Freescale PCI code create it as a
>>> platform device instead of putting it in the device tree?
>>
>> I'd be good with that solution.
>
> Then we come back to the question that was raised before (during initial
> review of edac driver): as PCI code is probbed long before other parts
> of the kernel and mpc85xx_edac code can be compiled as module,
> it's not possible to directly call mpc85xx_edac code from fsl_pci.c

Not sure what you mean here.  If the driver is compiled as a module,
then it must be handled the same way all other drivers are handled.
The platform code registers an of_platform_device at boot time, and
the driver gets bound to it whenever it happens to show up.  None of
the children of that bus can be available until after the driver is
probed.

> Two initial suggestions were:
> 1) creating special platform device
> 2) creating special of_platform device from dts

g.

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


Re: [PATCH 2/2] mpc85xx_edac: change to use new definitions for PCI EDAC regspace

2010-07-22 Thread Grant Likely
On Thu, Jul 22, 2010 at 10:48 AM, Dmitry Eremin-Solenikov
 wrote:
> Hello,
>
> On Thu, Jul 22, 2010 at 7:38 PM, Kumar Gala  wrote:
>>
>> On Jul 21, 2010, at 7:03 PM, Dmitry Eremin-Solenikov wrote:
>>
>>> Currently (as mpc8540-pci) devices are not created on of_platform bus,
>>> mpc85xx_edac can't probe to them. Follow the change to dts trees to bind
>>> not to the main mpc8540-pci node but to special mpc85xx-pci-error nodes,
>>> present on soc bus.
>>>
>>> Signed-off-by: Dmitry Eremin-Solenikov 
>>> ---
>>> drivers/edac/mpc85xx_edac.c |   18 +-
>>> 1 files changed, 9 insertions(+), 9 deletions(-)
>>
>> Nak.
>>
>> We already have a node in the dts for the PCI controller.  Lets update the 
>> platform code to add the pci controller to the of_platform_bus_probe list.
>
> I've had that idea. However it's really look strange to me to call
> of_platform_bus_probe() on the bus node, for which we (IMO) explicitly
> won't like for
> child devices (PCI devices) to be added to of_platform bus. Would it
> be suitable to just call of_platform_device_create for it (Or do i
> miss someth BTW: While I'm at it, should I change all mpc8540-pci/-pcix device
> names to include respective SoC name?

It is good practice to include both the specific name, and the name of
the device it is backwards compatible to.

g.
From d84af195dbcd99ce172bf639538231141176d402 Mon Sep 17 00:00:00 2001
From: Grant Likely 
Date: Thu, 22 Jul 2010 13:01:11 -0600
Subject: [PATCH] of/device: Register children with a compatible value in of_platform_bus_probe()

Currently, of_platform_bus_probe() completely skips nodes which do not
explicitly match the 'matches' table passed in.  Or, if the root node
matches, then it registers all the children unconditionally.  However,
there are situations, such as registering devices from the root node,
when it is desirable to register child nodes, but only if they actually
represent devices.  For example, the root node may contain both a local
bus and a PCI device, but it also contains the chosen, aliases and cpus
nodes which don't represent real devices.

This patch changes of_platform_bus_probe() to register all nodes at the
top level if they either match the matches table (the current behaviour),
or if they have a 'compatible' value (indicating it represents a device).
---
 drivers/of/platform.c |   31 ++-
 1 files changed, 26 insertions(+), 5 deletions(-)

diff --git a/drivers/of/platform.c b/drivers/of/platform.c
index f3f1ec8..2ead562 100644
--- a/drivers/of/platform.c
+++ b/drivers/of/platform.c
@@ -709,16 +709,37 @@ int of_platform_bus_probe(struct device_node *root,
 		rc = of_platform_bus_create(root, matches, &dev->dev);
 		goto bail;
 	}
+
+	/* Register each child node if either:
+	 *  a) it has a 'compatible' value indicating they are a device, or
+	 *  b) it is specified by the 'matches' table (by name or device_type)
+	 * If a node is specified in the matches table, then all its children
+	 * also get registered.
+	 */
 	for_each_child_of_node(root, child) {
-		if (!of_match_node(matches, child))
+		void *compat = of_get_property(child, "compatible", NULL);
+		struct of_device_id *match = of_match_node(matches, child);
+
+		/* Skip if node neither matches nor has a compatible property */
+		if (!compat && !match)
 			continue;
 
-		pr_debug("  match: %s\n", child->full_name);
+		pr_debug("  register device: %s\n", child->full_name);
+
+		/* Passed the first test, register node as a platform device */
 		dev = of_platform_device_create(child, NULL, parent);
-		if (dev == NULL)
+		if (!dev) {
 			rc = -ENOMEM;
-		else
-			rc = of_platform_bus_create(child, matches, &dev->dev);
+			of_node_put(child);
+			break;
+		}
+
+		/* Only register child nodes if specified by matches table */
+		if (!match)
+			continue;
+
+		pr_debug("  register children of: %s\n", child->full_name);
+		rc = of_platform_bus_create(child, matches, &dev->dev);
 		if (rc) {
 			of_node_put(child);
 			break;
-- 
1.7.0.4

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

Re: [PATCH 2/2] mpc85xx_edac: change to use new definitions for PCI EDAC regspace

2010-07-22 Thread Dmitry Eremin-Solenikov
Hello,

On Thu, Jul 22, 2010 at 10:40 PM, Kumar Gala  wrote:
>
> On Jul 22, 2010, at 1:25 PM, Scott Wood wrote:
>
>> On Thu, 22 Jul 2010 20:48:15 +0400
>> Dmitry Eremin-Solenikov  wrote:
>>
>>> Hello,
>>>
>>> On Thu, Jul 22, 2010 at 7:38 PM, Kumar Gala  
>>> wrote:

 On Jul 21, 2010, at 7:03 PM, Dmitry Eremin-Solenikov wrote:

> Currently (as mpc8540-pci) devices are not created on of_platform bus,
> mpc85xx_edac can't probe to them. Follow the change to dts trees to bind
> not to the main mpc8540-pci node but to special mpc85xx-pci-error nodes,
> present on soc bus.
>
> Signed-off-by: Dmitry Eremin-Solenikov 
> ---
> drivers/edac/mpc85xx_edac.c |   18 +-
> 1 files changed, 9 insertions(+), 9 deletions(-)

 Nak.

 We already have a node in the dts for the PCI controller.  Lets update the 
 platform code to add the pci controller to the of_platform_bus_probe list.
>>>
>>> I've had that idea. However it's really look strange to me to call
>>> of_platform_bus_probe() on the bus node, for which we (IMO) explicitly
>>> won't like for
>>> child devices (PCI devices) to be added to of_platform bus.
>>
>> Right, and it's also not great for a driver for one aspect of PCI to
>> claim to be the driver for the whole thing.
>>
>> But changing the device tree because of this Linux-internal concern is
>> also not good.
>>
>> How about keeping the error stuff as a separate device from Linux's
>> perspective, but have the main Freescale PCI code create it as a
>> platform device instead of putting it in the device tree?
>
> I'd be good with that solution.

Then we come back to the question that was raised before (during initial
review of edac driver): as PCI code is probbed long before other parts
of the kernel and mpc85xx_edac code can be compiled as module,
it's not possible to directly call mpc85xx_edac code from fsl_pci.c

Two initial suggestions were:
1) creating special platform device
2) creating special of_platform device from dts

Which approach should I choose? Did i miss any other opportunities?

-- 
With best wishes
Dmitry
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: [PATCH][v2] powerpc: rename immap_86xx.h to fsl_guts.h, and add 85xx support

2010-07-22 Thread Kumar Gala

On Jul 22, 2010, at 11:49 AM, Mark Brown wrote:

> On Thu, Jul 22, 2010 at 11:33:30AM -0500, Timur Tabi wrote:
>> The immap_86xx.h header file only defines one data structure: the "global
>> utilities" register set found on Freescale PowerPC SOCs.  Rename this file
>> to fsl_guts.h to reflect its true purpose, and extend it to cover the "GUTS"
>> register set on 85xx chips.
>> 
>> Signed-off-by: Timur Tabi 
> 
> Acked-by: Mark Brown 

Acked-by: Kumar Gala 

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


Re: [PATCH][RFC] preempt_count corruption across H_CEDE call with CONFIG_PREEMPT on pseries

2010-07-22 Thread Thomas Gleixner
On Thu, 22 Jul 2010, Darren Hart wrote:
 
> Also of interest is that this path
> cpu_idle()->cpu_die()->pseries_mach_cpu_die() to start_secondary()
> enters with a preempt_count=1 if it wasn't corrupted across the hcall.

That triggers the problem as well. preempt_count needs to be 0 when
entering start_secondary(). So I really wonder how that ever worked.

> The early boot path from _start however appears to call
> start_secondary() with a preempt_count of 0.

Which is correct.
 
> The following patch is most certainly not correct, but it does eliminate

It is correct, but i think it is incomplete as other portions of the
thread_info on the stack might be in some weird state as well.

> the situation on mainline 100% of the time (there is still a 25%
> reproduction rate on PREEMPT_RT).

But those are diffferent issues, for which we have reasonable
explanations and patches/workarounds.

> 2) Should we call preempt_enable() in cpu_idle() prior to cpu_die() ?

No
 
Thanks,

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


Re: [PATCH 2/2] mpc85xx_edac: change to use new definitions for PCI EDAC regspace

2010-07-22 Thread Kumar Gala

On Jul 22, 2010, at 1:25 PM, Scott Wood wrote:

> On Thu, 22 Jul 2010 20:48:15 +0400
> Dmitry Eremin-Solenikov  wrote:
> 
>> Hello,
>> 
>> On Thu, Jul 22, 2010 at 7:38 PM, Kumar Gala  
>> wrote:
>>> 
>>> On Jul 21, 2010, at 7:03 PM, Dmitry Eremin-Solenikov wrote:
>>> 
 Currently (as mpc8540-pci) devices are not created on of_platform bus,
 mpc85xx_edac can't probe to them. Follow the change to dts trees to bind
 not to the main mpc8540-pci node but to special mpc85xx-pci-error nodes,
 present on soc bus.
 
 Signed-off-by: Dmitry Eremin-Solenikov 
 ---
 drivers/edac/mpc85xx_edac.c |   18 +-
 1 files changed, 9 insertions(+), 9 deletions(-)
>>> 
>>> Nak.
>>> 
>>> We already have a node in the dts for the PCI controller.  Lets update the 
>>> platform code to add the pci controller to the of_platform_bus_probe list.
>> 
>> I've had that idea. However it's really look strange to me to call
>> of_platform_bus_probe() on the bus node, for which we (IMO) explicitly
>> won't like for
>> child devices (PCI devices) to be added to of_platform bus.
> 
> Right, and it's also not great for a driver for one aspect of PCI to
> claim to be the driver for the whole thing.
> 
> But changing the device tree because of this Linux-internal concern is
> also not good.
> 
> How about keeping the error stuff as a separate device from Linux's
> perspective, but have the main Freescale PCI code create it as a
> platform device instead of putting it in the device tree?

I'd be good with that solution.

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


Re: [PATCH][RFC] preempt_count corruption across H_CEDE call with CONFIG_PREEMPT on pseries

2010-07-22 Thread Darren Hart

On 07/22/2010 11:24 AM, Darren Hart wrote:


The following patch is most certainly not correct, but it does eliminate
the situation on mainline 100% of the time (there is still a 25%
reproduction rate on PREEMPT_RT). Can someone comment on:


Apologies. This particular issue is also 100% eliminated on PREEMPT_RT. 
We hit another issue possibly unrelated to this 25% of time. Please 
disregard the comment regarding 25% failure on PREEMPT_RT.


--
Darren Hart
IBM Linux Technology Center
Real-Time Linux Team
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


[PATCH] powerpc/kexec: Fix boundary case for book-e kexec memory limits

2010-07-22 Thread Kumar Gala
The KEXEC_*_MEMORY_LIMITs are inclusive addresses.  We define them as
2Gs as that is what we allow mapping via TLBs.  However, this should be
2G - 1 to be inclusive, otherwise if we have >2G of memory in a system
we fail to boot properly via kexec.

Signed-off-by: Kumar Gala 
---
 arch/powerpc/include/asm/kexec.h |6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/powerpc/include/asm/kexec.h b/arch/powerpc/include/asm/kexec.h
index 2a9cd74..076327f 100644
--- a/arch/powerpc/include/asm/kexec.h
+++ b/arch/powerpc/include/asm/kexec.h
@@ -8,9 +8,9 @@
  * On FSL-BookE we setup a 1:1 mapping which covers the first 2GiB of memory
  * and therefore we can only deal with memory within this range
  */
-#define KEXEC_SOURCE_MEMORY_LIMIT  (2 * 1024 * 1024 * 1024UL)
-#define KEXEC_DESTINATION_MEMORY_LIMIT (2 * 1024 * 1024 * 1024UL)
-#define KEXEC_CONTROL_MEMORY_LIMIT (2 * 1024 * 1024 * 1024UL)
+#define KEXEC_SOURCE_MEMORY_LIMIT  (2 * 1024 * 1024 * 1024UL - 1)
+#define KEXEC_DESTINATION_MEMORY_LIMIT (2 * 1024 * 1024 * 1024UL - 1)
+#define KEXEC_CONTROL_MEMORY_LIMIT (2 * 1024 * 1024 * 1024UL - 1)
 
 #else
 
-- 
1.6.0.6

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


Re: [PATCH 2/2] mpc85xx_edac: change to use new definitions for PCI EDAC regspace

2010-07-22 Thread Scott Wood
On Thu, 22 Jul 2010 20:48:15 +0400
Dmitry Eremin-Solenikov  wrote:

> Hello,
> 
> On Thu, Jul 22, 2010 at 7:38 PM, Kumar Gala  wrote:
> >
> > On Jul 21, 2010, at 7:03 PM, Dmitry Eremin-Solenikov wrote:
> >
> >> Currently (as mpc8540-pci) devices are not created on of_platform bus,
> >> mpc85xx_edac can't probe to them. Follow the change to dts trees to bind
> >> not to the main mpc8540-pci node but to special mpc85xx-pci-error nodes,
> >> present on soc bus.
> >>
> >> Signed-off-by: Dmitry Eremin-Solenikov 
> >> ---
> >> drivers/edac/mpc85xx_edac.c |   18 +-
> >> 1 files changed, 9 insertions(+), 9 deletions(-)
> >
> > Nak.
> >
> > We already have a node in the dts for the PCI controller.  Lets update the 
> > platform code to add the pci controller to the of_platform_bus_probe list.
> 
> I've had that idea. However it's really look strange to me to call
> of_platform_bus_probe() on the bus node, for which we (IMO) explicitly
> won't like for
> child devices (PCI devices) to be added to of_platform bus.

Right, and it's also not great for a driver for one aspect of PCI to
claim to be the driver for the whole thing.

But changing the device tree because of this Linux-internal concern is
also not good.

How about keeping the error stuff as a separate device from Linux's
perspective, but have the main Freescale PCI code create it as a
platform device instead of putting it in the device tree?

-Scott

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


[PATCH][RFC] preempt_count corruption across H_CEDE call with CONFIG_PREEMPT on pseries

2010-07-22 Thread Darren Hart
While testing CPU offline/online, we hit various preempt_count related
bugs. Various hacks have been employed for several theoretical corner
cases. One situation however is perfectly repeatable on 2.6.33.6 with
CONFIG_PREEMPT=y.

BUG: scheduling while atomic: swapper/0/0x0065
Modules linked in: autofs4 sunrpc ipv6 dm_mirror dm_region_hash dm_log
dm_mod ehea sg ext4 jbd2 mbcache sd_mod crc_t10dif ibmvscsic
scsi_transport_srp scsi_tgt [last unloaded: scsi_wait_scan]
Call Trace:
[c0010e9e39f0] [c00144d4] .show_stack+0x74/0x1c0 (unreliable)
[c0010e9e3aa0] [c007a680] .__schedule_bug+0xa0/0xb0
[c0010e9e3b30] [c056dea4] .schedule+0x7a4/0xd60
[c0010e9e3cd0] [c0016be8] .cpu_idle+0x1f8/0x220
[c0010e9e3d80] [c057d858] .start_secondary+0x388/0x3c0
[c0010e9e3e30] [c0008278] .start_secondary_resume+0x10/0x14

With some instrumentation we were able to determine that the
preempt_count() appears to change across the extended_cede_processor()
call.  Specifically across the plpar_hcall_norets(H_CEDE) call. On
PREEMPT_RT we call this with preempt_count=1 and return with
preempt_count=0x. On mainline with CONFIG_PREEMPT=y, the value
is different (0x65) but is still incorrect.

Also of interest is that this path
cpu_idle()->cpu_die()->pseries_mach_cpu_die() to start_secondary()
enters with a preempt_count=1 if it wasn't corrupted across the hcall.
The early boot path from _start however appears to call
start_secondary() with a preempt_count of 0.

The following patch is most certainly not correct, but it does eliminate
the situation on mainline 100% of the time (there is still a 25%
reproduction rate on PREEMPT_RT). Can someone comment on:

1) How can the preempt_count() get mangled across the H_CEDE hcall?
2) Should we call preempt_enable() in cpu_idle() prior to cpu_die() ?

Hacked-up-by: Darren Hart 

Index: linux-2.6.33.6/arch/powerpc/platforms/pseries/hotplug-cpu.c
===
--- linux-2.6.33.6.orig/arch/powerpc/platforms/pseries/hotplug-cpu.c
+++ linux-2.6.33.6/arch/powerpc/platforms/pseries/hotplug-cpu.c
@@ -138,6 +138,7 @@ static void pseries_mach_cpu_die(void)
 * Kernel stack will be reset and start_secondary()
 * will be called to continue the online operation.
 */
+   preempt_count() = 0;
start_secondary_resume();
}
}


-- 
Darren Hart
IBM Linux Technology Center
Real-Time Linux Team
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: [PATCH v2 2/2] EDAC: Remove deprecated bindings for MPC85xx

2010-07-22 Thread Scott Wood
On Wed, 21 Jul 2010 18:04:10 -0400
Bradley Hughes  wrote:

> The "fsl,85..." style bindings for the l2-cache-controller
> and memory-controller were intended to be deprected as of 2.6.30
> per comment in drivers/edac/mpc85xx_edac.c.

And yet they were only removed from the in-kernel dts files in patch
1/2.

> Previous patch in this
> series updates all DTS to use the "fsl,mpc85..." style binding
> for these two nodes, allowing us to finally deprecate said
> notation.

Please leave this around.  Once a binding is used, we try to stay
compatible with it when practical.  Not all device trees in use come
straight from arch/powerpc/boot/dts (consider custom boards, and
firmware device tree manipulation), and even those that do come
straihgt from the kernel tree are not necessarily rebuilt at the same
time as the kernel.

-Scott

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


Re: [PATCH 1/2] MPC85xx: add definitions for PCI error detection soc part

2010-07-22 Thread Peter Tyser

> > On Thu, 2010-07-22 at 04:03 +0400, Dmitry Eremin-Solenikov wrote:
> >> Add definitions for PCI error detection device to be handled by (already
> >> existing) mpc85xx_edac.c driver.
> >>
> >> Signed-off-by: Dmitry Eremin-Solenikov 
> >> ---
> >>  arch/powerpc/boot/dts/mpc8536ds.dts|7 +++
> >>  arch/powerpc/boot/dts/mpc8536ds_36b.dts|7 +++
> >>  arch/powerpc/boot/dts/mpc8540ads.dts   |8 
> >>  arch/powerpc/boot/dts/mpc8541cds.dts   |   14 ++
> >>  arch/powerpc/boot/dts/mpc8544ds.dts|7 +++
> >>  arch/powerpc/boot/dts/mpc8548cds.dts   |   14 ++
> >>  arch/powerpc/boot/dts/mpc8555cds.dts   |   14 ++
> >>  arch/powerpc/boot/dts/mpc8560ads.dts   |7 +++
> >>  arch/powerpc/boot/dts/mpc8568mds.dts   |7 +++
> >>  arch/powerpc/boot/dts/sbc8548.dts  |7 +++
> >>  arch/powerpc/boot/dts/sbc8560.dts  |7 +++
> >>  arch/powerpc/boot/dts/socrates.dts |7 +++
> >>  arch/powerpc/boot/dts/stx_gp3_8560.dts |7 +++
> >>  arch/powerpc/boot/dts/tqm8540.dts  |   10 ++
> >>  arch/powerpc/boot/dts/tqm8541.dts  |7 +++
> >>  arch/powerpc/boot/dts/tqm8548-bigflash.dts |7 +++
> >>  arch/powerpc/boot/dts/tqm8548.dts  |7 +++
> >>  arch/powerpc/boot/dts/tqm8555.dts  |7 +++
> >>  arch/powerpc/boot/dts/tqm8560.dts  |7 +++
> >>  arch/powerpc/boot/dts/xpedite5200.dts  |7 +++
> >>  arch/powerpc/boot/dts/xpedite5200_xmon.dts |7 +++
> >>  21 files changed, 172 insertions(+), 0 deletions(-)
> >
> > It looks like the dts files for the MPC8572-based boards weren't
> > included in this change despite patch 2/2 adding support for them.  I'd
> > guess some other Freescale CPUs (eg P1020, P2020, etc) could be
> > supported by the same driver if you are inclined to add them to this
> > patch series.
> 
> I just did a quick search for all dts including mpc8540-pci node and added
> respective mpc85xx-pci-error node. Current MPC85xx EDAC driver doesn't
> support error handling on PCI-E busses (which MPC8572 and other CPUs
> you mentioned have). I'll maybe look into PCI-E EDAC later. Also I don't have
> access to P10xx/P20xx manuals, so support for them may require some
> more time.

Thanks for the explanation.  I noticed this because patch 2/2 adds
support for the 8572 to the mpc85xx_pci_err_of_match[] table.  Sounds
like that was the bug instead of my comment above.

Best,
Peter

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


Re: [PATCH][v2] powerpc: rename immap_86xx.h to fsl_guts.h, and add 85xx support

2010-07-22 Thread Mark Brown
On Thu, Jul 22, 2010 at 11:33:30AM -0500, Timur Tabi wrote:
> The immap_86xx.h header file only defines one data structure: the "global
> utilities" register set found on Freescale PowerPC SOCs.  Rename this file
> to fsl_guts.h to reflect its true purpose, and extend it to cover the "GUTS"
> register set on 85xx chips.
> 
> Signed-off-by: Timur Tabi 

Acked-by: Mark Brown 
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: [PATCH 1/2] MPC85xx: add definitions for PCI error detection soc part

2010-07-22 Thread Dmitry Eremin-Solenikov
Hello,

On Thu, Jul 22, 2010 at 7:19 PM, Peter Tyser  wrote:
> Hi Dmitry,
>
> On Thu, 2010-07-22 at 04:03 +0400, Dmitry Eremin-Solenikov wrote:
>> Add definitions for PCI error detection device to be handled by (already
>> existing) mpc85xx_edac.c driver.
>>
>> Signed-off-by: Dmitry Eremin-Solenikov 
>> ---
>>  arch/powerpc/boot/dts/mpc8536ds.dts        |    7 +++
>>  arch/powerpc/boot/dts/mpc8536ds_36b.dts    |    7 +++
>>  arch/powerpc/boot/dts/mpc8540ads.dts       |    8 
>>  arch/powerpc/boot/dts/mpc8541cds.dts       |   14 ++
>>  arch/powerpc/boot/dts/mpc8544ds.dts        |    7 +++
>>  arch/powerpc/boot/dts/mpc8548cds.dts       |   14 ++
>>  arch/powerpc/boot/dts/mpc8555cds.dts       |   14 ++
>>  arch/powerpc/boot/dts/mpc8560ads.dts       |    7 +++
>>  arch/powerpc/boot/dts/mpc8568mds.dts       |    7 +++
>>  arch/powerpc/boot/dts/sbc8548.dts          |    7 +++
>>  arch/powerpc/boot/dts/sbc8560.dts          |    7 +++
>>  arch/powerpc/boot/dts/socrates.dts         |    7 +++
>>  arch/powerpc/boot/dts/stx_gp3_8560.dts     |    7 +++
>>  arch/powerpc/boot/dts/tqm8540.dts          |   10 ++
>>  arch/powerpc/boot/dts/tqm8541.dts          |    7 +++
>>  arch/powerpc/boot/dts/tqm8548-bigflash.dts |    7 +++
>>  arch/powerpc/boot/dts/tqm8548.dts          |    7 +++
>>  arch/powerpc/boot/dts/tqm8555.dts          |    7 +++
>>  arch/powerpc/boot/dts/tqm8560.dts          |    7 +++
>>  arch/powerpc/boot/dts/xpedite5200.dts      |    7 +++
>>  arch/powerpc/boot/dts/xpedite5200_xmon.dts |    7 +++
>>  21 files changed, 172 insertions(+), 0 deletions(-)
>
> It looks like the dts files for the MPC8572-based boards weren't
> included in this change despite patch 2/2 adding support for them.  I'd
> guess some other Freescale CPUs (eg P1020, P2020, etc) could be
> supported by the same driver if you are inclined to add them to this
> patch series.

I just did a quick search for all dts including mpc8540-pci node and added
respective mpc85xx-pci-error node. Current MPC85xx EDAC driver doesn't
support error handling on PCI-E busses (which MPC8572 and other CPUs
you mentioned have). I'll maybe look into PCI-E EDAC later. Also I don't have
access to P10xx/P20xx manuals, so support for them may require some
more time.

-- 
With best wishes
Dmitry
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: [PATCH 2/2] mpc85xx_edac: change to use new definitions for PCI EDAC regspace

2010-07-22 Thread Dmitry Eremin-Solenikov
Hello,

On Thu, Jul 22, 2010 at 7:38 PM, Kumar Gala  wrote:
>
> On Jul 21, 2010, at 7:03 PM, Dmitry Eremin-Solenikov wrote:
>
>> Currently (as mpc8540-pci) devices are not created on of_platform bus,
>> mpc85xx_edac can't probe to them. Follow the change to dts trees to bind
>> not to the main mpc8540-pci node but to special mpc85xx-pci-error nodes,
>> present on soc bus.
>>
>> Signed-off-by: Dmitry Eremin-Solenikov 
>> ---
>> drivers/edac/mpc85xx_edac.c |   18 +-
>> 1 files changed, 9 insertions(+), 9 deletions(-)
>
> Nak.
>
> We already have a node in the dts for the PCI controller.  Lets update the 
> platform code to add the pci controller to the of_platform_bus_probe list.

I've had that idea. However it's really look strange to me to call
of_platform_bus_probe() on the bus node, for which we (IMO) explicitly
won't like for
child devices (PCI devices) to be added to of_platform bus. Would it
be suitable to just call of_platform_device_create for it (Or do i
miss somethhttps://lists.ozlabs.org/listinfo/linuxppc-dev


[PATCH][v2] powerpc: rename immap_86xx.h to fsl_guts.h, and add 85xx support

2010-07-22 Thread Timur Tabi
The immap_86xx.h header file only defines one data structure: the "global
utilities" register set found on Freescale PowerPC SOCs.  Rename this file
to fsl_guts.h to reflect its true purpose, and extend it to cover the "GUTS"
register set on 85xx chips.

Signed-off-by: Timur Tabi 
---

Liam,

This patch is a powerpc-patch, but it's much simpler if you apply it to
multi-component, since only the SSI audio drivers are affected.

 .../include/asm/{immap_86xx.h => fsl_guts.h}   |  111 +--
 sound/soc/fsl/fsl_ssi.c|2 -
 sound/soc/fsl/mpc8610_hpcd.c   |   10 +-
 3 files changed, 81 insertions(+), 42 deletions(-)
 rename arch/powerpc/include/asm/{immap_86xx.h => fsl_guts.h} (66%)

diff --git a/arch/powerpc/include/asm/immap_86xx.h 
b/arch/powerpc/include/asm/fsl_guts.h
similarity index 66%
rename from arch/powerpc/include/asm/immap_86xx.h
rename to arch/powerpc/include/asm/fsl_guts.h
index 0f165e5..bebd124 100644
--- a/arch/powerpc/include/asm/immap_86xx.h
+++ b/arch/powerpc/include/asm/fsl_guts.h
@@ -1,5 +1,5 @@
 /**
- * MPC86xx Internal Memory Map
+ * Freecale 85xx and 86xx Global Utilties register set
  *
  * Authors: Jeff Brown
  *  Timur Tabi 
@@ -10,73 +10,112 @@
  * under  the terms of  the GNU General  Public License as published by the
  * Free Software Foundation;  either version 2 of the  License, or (at your
  * option) any later version.
- *
- * This header file defines structures for various 86xx SOC devices that are
- * used by multiple source files.
  */

-#ifndef __ASM_POWERPC_IMMAP_86XX_H__
-#define __ASM_POWERPC_IMMAP_86XX_H__
+#ifndef __ASM_POWERPC_FSL_GUTS_H__
+#define __ASM_POWERPC_FSL_GUTS_H__
 #ifdef __KERNEL__

-/* Global Utility Registers */
-struct ccsr_guts {
+/*
+ * These #ifdefs are safe because it's not possible to build a kernel that
+ * runs on e500 and e600 cores.
+ */
+
+#if !defined(CONFIG_PPC_85xx) && !defined(CONFIG_PPC_86xx)
+#error Only 85xx and 86xx SOCs are supported
+#endif
+
+/**
+ * Global Utility Registers.
+ *
+ * Not all registers defined in this structure are available on all chips, so
+ * you are expected to know whether a given register actually exists on your
+ * chip before you access it.
+ *
+ * Also, some registers are similar on different chips but have slightly
+ * different names.  In these cases, one name is chosen to avoid extraneous
+ * #ifdefs.
+ */
+#ifdef CONFIG_PPC_85xx
+struct ccsr_guts_85xx {
+#else
+struct ccsr_guts_86xx {
+#endif
__be32  porpllsr;   /* 0x. - POR PLL Ratio Status Register */
__be32  porbmsr;/* 0x.0004 - POR Boot Mode Status Register */
__be32  porimpscr;  /* 0x.0008 - POR I/O Impedance Status and 
Control Register */
__be32  pordevsr;   /* 0x.000c - POR I/O Device Status Register */
__be32  pordbgmsr;  /* 0x.0010 - POR Debug Mode Status Register */
-   u8  res1[0x20 - 0x14];
+   __be32  pordevsr2;  /* 0x.0014 - POR device status register 2 */
+   u8  res018[0x20 - 0x18];
__be32  porcir; /* 0x.0020 - POR Configuration Information 
Register */
-   u8  res2[0x30 - 0x24];
+   u8  res024[0x30 - 0x24];
__be32  gpiocr; /* 0x.0030 - GPIO Control Register */
-   u8  res3[0x40 - 0x34];
+   u8  res034[0x40 - 0x34];
__be32  gpoutdr;/* 0x.0040 - General-Purpose Output Data 
Register */
-   u8  res4[0x50 - 0x44];
+   u8  res044[0x50 - 0x44];
__be32  gpindr; /* 0x.0050 - General-Purpose Input Data 
Register */
-   u8  res5[0x60 - 0x54];
+   u8  res054[0x60 - 0x54];
__be32  pmuxcr; /* 0x.0060 - Alternate Function Signal 
Multiplex Control */
-   u8  res6[0x70 - 0x64];
+__be32  pmuxcr2;   /* 0x.0064 - Alternate function signal 
multiplex control 2 */
+__be32  dmuxcr;/* 0x.0068 - DMA Mux Control Register */
+u8 res06c[0x70 - 0x6c];
__be32  devdisr;/* 0x.0070 - Device Disable Control */
__be32  devdisr2;   /* 0x.0074 - Device Disable Control 2 */
-   u8  res7[0x80 - 0x78];
+   u8  res078[0x7c - 0x78];
+   __be32  pmjcr;  /* 0x.007c - 4 Power Management Jog Control 
Register */
__be32  powmgtcsr;  /* 0x.0080 - Power Management Status and 
Control Register */
-   u8  res8[0x90 - 0x84];
+   __be32  pmrccr; /* 0x.0084 - Power Management Reset Counter 
Configuration Register */
+   __be32  pmpdccr;/* 0x.0088 - Power Management Power Down 
Counter Configuration Register */
+   __be32  pmcdr;  /* 0x.008c - 4Power management clock disable 
register */
__be32  mcpsumr;/* 0x.0090 - Machine Check Summary Register */
__be32  rstrscr;/* 0x.0094 - Reset Request Status and Control 
Register */
-   u8  res9[0xA0 - 0x98];
+   __be32  ectrstcr; 

[PATCH 3/3] USB: add USB EHCI support for MPC5121 SoC

2010-07-22 Thread Anatolij Gustschin
Extends FSL EHCI platform driver glue layer to support
MPC5121 USB controllers. MPC5121 Rev 2.0 silicon EHCI
registers are in big endian format. The appropriate flags
are set using the information in the platform data structure.
MPC83xx system interface registers are not available on
MPC512x, so the access to these registers is isolated in
MPC512x case. Furthermore the USB controller clocks
must be enabled before 512x register accesses which is
done by providing platform specific init callback.

The MPC512x internal USB PHY doesn't provide supply voltage.
For boards using different power switches allow specifying
DRVVBUS and PWR_FAULT signal polarity of the MPC5121 internal
PHY using "fsl,invert-drvvbus" and "fsl,invert-pwr-fault"
properties in the device tree USB nodes. Adds documentation
for this new device tree bindings.

Signed-off-by: Anatolij Gustschin 
Cc: Grant Likely 
---
 Documentation/powerpc/dts-bindings/fsl/usb.txt |   22 +
 drivers/usb/Kconfig|1 +
 drivers/usb/host/Kconfig   |6 +-
 drivers/usb/host/ehci-fsl.c|  107 +--
 drivers/usb/host/ehci-fsl.h|   19 -
 drivers/usb/host/ehci-mem.c|2 +-
 drivers/usb/host/fsl-mph-dr-of.c   |   89 
 include/linux/fsl_devices.h|   15 
 8 files changed, 229 insertions(+), 32 deletions(-)

diff --git a/Documentation/powerpc/dts-bindings/fsl/usb.txt 
b/Documentation/powerpc/dts-bindings/fsl/usb.txt
index b001524..bd5723f 100644
--- a/Documentation/powerpc/dts-bindings/fsl/usb.txt
+++ b/Documentation/powerpc/dts-bindings/fsl/usb.txt
@@ -8,6 +8,7 @@ and additions :
 Required properties :
  - compatible : Should be "fsl-usb2-mph" for multi port host USB
controllers, or "fsl-usb2-dr" for dual role USB controllers
+   or "fsl,mpc5121-usb2-dr" for dual role USB controllers of MPC5121
  - phy_type : For multi port host USB controllers, should be one of
"ulpi", or "serial". For dual role USB controllers, should be
one of "ulpi", "utmi", "utmi_wide", or "serial".
@@ -33,6 +34,12 @@ Recommended properties :
  - interrupt-parent : the phandle for the interrupt controller that
services interrupts for this device.
 
+Optional properties :
+ - fsl,invert-drvvbus : boolean; for MPC5121 USB0 only. Indicates the
+   port power polarity of internal PHY signal DRVVBUS is inverted.
+ - fsl,invert-pwr-fault : boolean; for MPC5121 USB0 only. Indicates
+   the PWR_FAULT signal polarity is inverted.
+
 Example multi port host USB controller device node :
u...@22000 {
compatible = "fsl-usb2-mph";
@@ -57,3 +64,18 @@ Example dual role USB controller device node :
dr_mode = "otg";
phy = "ulpi";
};
+
+Example dual role USB controller device node for MPC5121ADS:
+
+   u...@4000 {
+   compatible = "fsl,mpc5121-usb2-dr";
+   reg = <0x4000 0x1000>;
+   #address-cells = <1>;
+   #size-cells = <0>;
+   interrupt-parent = < &ipic >;
+   interrupts = <44 0x8>;
+   dr_mode = "otg";
+   phy_type = "utmi_wide";
+   fsl,invert-drvvbus;
+   fsl,invert-pwr-fault;
+   };
diff --git a/drivers/usb/Kconfig b/drivers/usb/Kconfig
index 6a58cb1..6e547b5 100644
--- a/drivers/usb/Kconfig
+++ b/drivers/usb/Kconfig
@@ -58,6 +58,7 @@ config USB_ARCH_HAS_OHCI
 config USB_ARCH_HAS_EHCI
boolean
default y if PPC_83xx
+   default y if PPC_MPC512x
default y if SOC_AU1200
default y if ARCH_IXP4XX
default y if ARCH_W90X900
diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig
index 6687523..90e50f0 100644
--- a/drivers/usb/host/Kconfig
+++ b/drivers/usb/host/Kconfig
@@ -93,12 +93,14 @@ config USB_EHCI_TT_NEWSCHED
 
 config USB_EHCI_BIG_ENDIAN_MMIO
bool
-   depends on USB_EHCI_HCD && (PPC_CELLEB || PPC_PS3 || 440EPX || 
ARCH_IXP4XX || XPS_USB_HCD_XILINX)
+   depends on USB_EHCI_HCD && (PPC_CELLEB || PPC_PS3 || 440EPX || 
ARCH_IXP4XX || \
+   XPS_USB_HCD_XILINX || PPC_MPC512x)
default y
 
 config USB_EHCI_BIG_ENDIAN_DESC
bool
-   depends on USB_EHCI_HCD && (440EPX || ARCH_IXP4XX || XPS_USB_HCD_XILINX)
+   depends on USB_EHCI_HCD && (440EPX || ARCH_IXP4XX || XPS_USB_HCD_XILINX 
|| \
+   PPC_MPC512x)
default y
 
 config XPS_USB_HCD_XILINX
diff --git a/drivers/usb/host/ehci-fsl.c b/drivers/usb/host/ehci-fsl.c
index a416421..ff50f5c 100644
--- a/drivers/usb/host/ehci-fsl.c
+++ b/drivers/usb/host/ehci-fsl.c
@@ -116,13 +116,39 @@ static int usb_hcd_fsl_probe(const struct hc_driver 
*driver,
goto err3;
}
 
-   /* Enable USB controller */
-   temp = in_be32(hcd->regs + 0x500);
-   out_be32(hcd->regs + 0x500, temp | 0x4);
+   pd

[PATCH 2/3] USB: add of_platform glue driver for FSL USB DR controller

2010-07-22 Thread Anatolij Gustschin
The driver creates platform devices based on the information
from USB nodes in the flat device tree. This is the replacement
for old arch fsl_soc usb code removed by the previous patch.
It uses usual of-style binding, available EHCI-HCD and UDC
drivers can be bound to the created devices. The new of-style
driver additionaly instantiates USB OTG platform device, as the
appropriate USB OTG driver will be added soon.

Signed-off-by: Anatolij Gustschin 
Cc: Kumar Gala 
Cc: Grant Likely 
---
 drivers/usb/gadget/Kconfig   |1 +
 drivers/usb/host/Kconfig |5 +
 drivers/usb/host/Makefile|1 +
 drivers/usb/host/fsl-mph-dr-of.c |  189 ++
 4 files changed, 196 insertions(+), 0 deletions(-)
 create mode 100644 drivers/usb/host/fsl-mph-dr-of.c

diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig
index cd27f9b..e15e314 100644
--- a/drivers/usb/gadget/Kconfig
+++ b/drivers/usb/gadget/Kconfig
@@ -158,6 +158,7 @@ config USB_GADGET_FSL_USB2
boolean "Freescale Highspeed USB DR Peripheral Controller"
depends on FSL_SOC || ARCH_MXC
select USB_GADGET_DUALSPEED
+   select USB_FSL_MPH_DR_OF
help
   Some of Freescale PowerPC processors have a High Speed
   Dual-Role(DR) USB controller, which supports device mode.
diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig
index 2d926ce..6687523 100644
--- a/drivers/usb/host/Kconfig
+++ b/drivers/usb/host/Kconfig
@@ -112,10 +112,15 @@ config XPS_USB_HCD_XILINX
support both high speed and full speed devices, or high speed
devices only.
 
+config USB_FSL_MPH_DR_OF
+   bool
+   depends on PPC_OF
+
 config USB_EHCI_FSL
bool "Support for Freescale on-chip EHCI USB controller"
depends on USB_EHCI_HCD && FSL_SOC
select USB_EHCI_ROOT_HUB_TT
+   select USB_FSL_MPH_DR_OF
---help---
  Variation of ARC USB block used in some Freescale chips.
 
diff --git a/drivers/usb/host/Makefile b/drivers/usb/host/Makefile
index b6315aa..aacbe82 100644
--- a/drivers/usb/host/Makefile
+++ b/drivers/usb/host/Makefile
@@ -33,4 +33,5 @@ obj-$(CONFIG_USB_R8A66597_HCD)+= r8a66597-hcd.o
 obj-$(CONFIG_USB_ISP1760_HCD)  += isp1760.o
 obj-$(CONFIG_USB_HWA_HCD)  += hwa-hc.o
 obj-$(CONFIG_USB_IMX21_HCD)+= imx21-hcd.o
+obj-$(CONFIG_USB_FSL_MPH_DR_OF)+= fsl-mph-dr-of.o
 
diff --git a/drivers/usb/host/fsl-mph-dr-of.c b/drivers/usb/host/fsl-mph-dr-of.c
new file mode 100644
index 000..020a939
--- /dev/null
+++ b/drivers/usb/host/fsl-mph-dr-of.c
@@ -0,0 +1,189 @@
+/*
+ * Setup platform devices needed by the Freescale multi-port host
+ * and/or dual-role USB controller modules based on the description
+ * in flat device tree.
+ *
+ * This program is free software; you can redistribute  it and/or modify it
+ * under  the terms of  the GNU General  Public License as published by the
+ * Free Software Foundation;  either version 2 of the  License, or (at your
+ * option) any later version.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+struct fsl_usb2_dev_data {
+   char *dr_mode;  /* controller mode */
+   char *drivers[3];   /* drivers to instantiate for this mode */
+   enum fsl_usb2_operating_modes op_mode;  /* operating mode */
+};
+
+struct fsl_usb2_dev_data dr_mode_data[] __devinitdata = {
+   {
+   "host",
+   { "fsl-ehci", NULL, NULL, },
+   FSL_USB2_DR_HOST,
+   },
+   {
+   "otg",
+   { "fsl-ehci", "fsl-usb2-udc", "fsl-usb2-otg", },
+   FSL_USB2_DR_OTG,
+   },
+   {
+   "periferal",
+   { "fsl-usb2-udc", NULL, NULL, },
+   FSL_USB2_DR_DEVICE,
+   },
+};
+
+struct fsl_usb2_dev_data * __devinit get_dr_mode_data(struct device_node *np)
+{
+   const unsigned char *prop;
+   int i;
+
+   prop = of_get_property(np, "dr_mode", NULL);
+   if (prop) {
+   for (i = 0; i < ARRAY_SIZE(dr_mode_data); i++) {
+   if (!strcmp(prop, dr_mode_data[i].dr_mode))
+   return &dr_mode_data[i];
+   }
+   }
+   return &dr_mode_data[0]; /* mode not specified, use host */
+}
+
+static enum fsl_usb2_phy_modes __devinit determine_usb_phy(const char 
*phy_type)
+{
+   if (!phy_type)
+   return FSL_USB2_PHY_NONE;
+   if (!strcasecmp(phy_type, "ulpi"))
+   return FSL_USB2_PHY_ULPI;
+   if (!strcasecmp(phy_type, "utmi"))
+   return FSL_USB2_PHY_UTMI;
+   if (!strcasecmp(phy_type, "utmi_wide"))
+   return FSL_USB2_PHY_UTMI_WIDE;
+   if (!strcasecmp(phy_type, "serial"))
+   return FSL_USB2_PHY_SERIAL;
+
+   return FSL_USB2_PHY_NONE;
+}
+
+struct platform_device * __devinit
+fsl_usb2_device_register(struct of_device *ofdev,
+struct fsl_u

[PATCH 1/3] powerpc/fsl_soc.c: remove FSL USB platform code

2010-07-22 Thread Anatolij Gustschin
This removed code will be replaced by simple of_platform
driver for creation of FSL USB platform devices which is
added by next patch of the series.

Signed-off-by: Anatolij Gustschin 
Cc: Kumar Gala 
Cc: Grant Likely 
---
 arch/powerpc/sysdev/fsl_soc.c |  163 -
 1 files changed, 0 insertions(+), 163 deletions(-)

diff --git a/arch/powerpc/sysdev/fsl_soc.c b/arch/powerpc/sysdev/fsl_soc.c
index b91f7ac..49a51f1 100644
--- a/arch/powerpc/sysdev/fsl_soc.c
+++ b/arch/powerpc/sysdev/fsl_soc.c
@@ -209,169 +209,6 @@ static int __init of_add_fixed_phys(void)
 arch_initcall(of_add_fixed_phys);
 #endif /* CONFIG_FIXED_PHY */
 
-static enum fsl_usb2_phy_modes determine_usb_phy(const char *phy_type)
-{
-   if (!phy_type)
-   return FSL_USB2_PHY_NONE;
-   if (!strcasecmp(phy_type, "ulpi"))
-   return FSL_USB2_PHY_ULPI;
-   if (!strcasecmp(phy_type, "utmi"))
-   return FSL_USB2_PHY_UTMI;
-   if (!strcasecmp(phy_type, "utmi_wide"))
-   return FSL_USB2_PHY_UTMI_WIDE;
-   if (!strcasecmp(phy_type, "serial"))
-   return FSL_USB2_PHY_SERIAL;
-
-   return FSL_USB2_PHY_NONE;
-}
-
-static int __init fsl_usb_of_init(void)
-{
-   struct device_node *np;
-   unsigned int i = 0;
-   struct platform_device *usb_dev_mph = NULL, *usb_dev_dr_host = NULL,
-   *usb_dev_dr_client = NULL;
-   int ret;
-
-   for_each_compatible_node(np, NULL, "fsl-usb2-mph") {
-   struct resource r[2];
-   struct fsl_usb2_platform_data usb_data;
-   const unsigned char *prop = NULL;
-
-   memset(&r, 0, sizeof(r));
-   memset(&usb_data, 0, sizeof(usb_data));
-
-   ret = of_address_to_resource(np, 0, &r[0]);
-   if (ret)
-   goto err;
-
-   of_irq_to_resource(np, 0, &r[1]);
-
-   usb_dev_mph =
-   platform_device_register_simple("fsl-ehci", i, r, 2);
-   if (IS_ERR(usb_dev_mph)) {
-   ret = PTR_ERR(usb_dev_mph);
-   goto err;
-   }
-
-   usb_dev_mph->dev.coherent_dma_mask = 0xUL;
-   usb_dev_mph->dev.dma_mask = &usb_dev_mph->dev.coherent_dma_mask;
-
-   usb_data.operating_mode = FSL_USB2_MPH_HOST;
-
-   prop = of_get_property(np, "port0", NULL);
-   if (prop)
-   usb_data.port_enables |= FSL_USB2_PORT0_ENABLED;
-
-   prop = of_get_property(np, "port1", NULL);
-   if (prop)
-   usb_data.port_enables |= FSL_USB2_PORT1_ENABLED;
-
-   prop = of_get_property(np, "phy_type", NULL);
-   usb_data.phy_mode = determine_usb_phy(prop);
-
-   ret =
-   platform_device_add_data(usb_dev_mph, &usb_data,
-sizeof(struct
-   fsl_usb2_platform_data));
-   if (ret)
-   goto unreg_mph;
-   i++;
-   }
-
-   for_each_compatible_node(np, NULL, "fsl-usb2-dr") {
-   struct resource r[2];
-   struct fsl_usb2_platform_data usb_data;
-   const unsigned char *prop = NULL;
-
-   if (!of_device_is_available(np))
-   continue;
-
-   memset(&r, 0, sizeof(r));
-   memset(&usb_data, 0, sizeof(usb_data));
-
-   ret = of_address_to_resource(np, 0, &r[0]);
-   if (ret)
-   goto unreg_mph;
-
-   of_irq_to_resource(np, 0, &r[1]);
-
-   prop = of_get_property(np, "dr_mode", NULL);
-
-   if (!prop || !strcmp(prop, "host")) {
-   usb_data.operating_mode = FSL_USB2_DR_HOST;
-   usb_dev_dr_host = platform_device_register_simple(
-   "fsl-ehci", i, r, 2);
-   if (IS_ERR(usb_dev_dr_host)) {
-   ret = PTR_ERR(usb_dev_dr_host);
-   goto err;
-   }
-   } else if (prop && !strcmp(prop, "peripheral")) {
-   usb_data.operating_mode = FSL_USB2_DR_DEVICE;
-   usb_dev_dr_client = platform_device_register_simple(
-   "fsl-usb2-udc", i, r, 2);
-   if (IS_ERR(usb_dev_dr_client)) {
-   ret = PTR_ERR(usb_dev_dr_client);
-   goto err;
-   }
-   } else if (prop && !strcmp(prop, "otg")) {
-   usb_data.operating_mode = FSL_USB2_DR_OTG;
-   usb_dev_dr_host = platform_device_register_simple(
-   "fsl-ehci", i, r, 2);
-   if 

[PATCH 0/3] Add USB Host support for MPC5121 SoC

2010-07-22 Thread Anatolij Gustschin
This is new attempt to add MPC512x USB support in mainline kernel.
USB OTG support is not included in this patch series, it will be
submitted later.

Anatolij Gustschin (3):
  powerpc/fsl_soc.c: remove FSL USB platform code
  USB: add of_platform glue driver for FSL USB DR controller
  USB: add USB EHCI support for MPC5121 SoC

 Documentation/powerpc/dts-bindings/fsl/usb.txt |   22 ++
 arch/powerpc/sysdev/fsl_soc.c  |  163 --
 drivers/usb/Kconfig|1 +
 drivers/usb/gadget/Kconfig |1 +
 drivers/usb/host/Kconfig   |   11 +-
 drivers/usb/host/Makefile  |1 +
 drivers/usb/host/ehci-fsl.c|  107 +++---
 drivers/usb/host/ehci-fsl.h|   19 ++-
 drivers/usb/host/ehci-mem.c|2 +-
 drivers/usb/host/fsl-mph-dr-of.c   |  278 
 include/linux/fsl_devices.h|   15 ++
 11 files changed, 425 insertions(+), 195 deletions(-)
 create mode 100644 drivers/usb/host/fsl-mph-dr-of.c

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


Re: [PATCH 1/2] MPC85xx: add definitions for PCI error detection soc part

2010-07-22 Thread Peter Tyser
Hi Dmitry,

On Thu, 2010-07-22 at 04:03 +0400, Dmitry Eremin-Solenikov wrote:
> Add definitions for PCI error detection device to be handled by (already
> existing) mpc85xx_edac.c driver.
> 
> Signed-off-by: Dmitry Eremin-Solenikov 
> ---
>  arch/powerpc/boot/dts/mpc8536ds.dts|7 +++
>  arch/powerpc/boot/dts/mpc8536ds_36b.dts|7 +++
>  arch/powerpc/boot/dts/mpc8540ads.dts   |8 
>  arch/powerpc/boot/dts/mpc8541cds.dts   |   14 ++
>  arch/powerpc/boot/dts/mpc8544ds.dts|7 +++
>  arch/powerpc/boot/dts/mpc8548cds.dts   |   14 ++
>  arch/powerpc/boot/dts/mpc8555cds.dts   |   14 ++
>  arch/powerpc/boot/dts/mpc8560ads.dts   |7 +++
>  arch/powerpc/boot/dts/mpc8568mds.dts   |7 +++
>  arch/powerpc/boot/dts/sbc8548.dts  |7 +++
>  arch/powerpc/boot/dts/sbc8560.dts  |7 +++
>  arch/powerpc/boot/dts/socrates.dts |7 +++
>  arch/powerpc/boot/dts/stx_gp3_8560.dts |7 +++
>  arch/powerpc/boot/dts/tqm8540.dts  |   10 ++
>  arch/powerpc/boot/dts/tqm8541.dts  |7 +++
>  arch/powerpc/boot/dts/tqm8548-bigflash.dts |7 +++
>  arch/powerpc/boot/dts/tqm8548.dts  |7 +++
>  arch/powerpc/boot/dts/tqm8555.dts  |7 +++
>  arch/powerpc/boot/dts/tqm8560.dts  |7 +++
>  arch/powerpc/boot/dts/xpedite5200.dts  |7 +++
>  arch/powerpc/boot/dts/xpedite5200_xmon.dts |7 +++
>  21 files changed, 172 insertions(+), 0 deletions(-)

It looks like the dts files for the MPC8572-based boards weren't
included in this change despite patch 2/2 adding support for them.  I'd
guess some other Freescale CPUs (eg P1020, P2020, etc) could be
supported by the same driver if you are inclined to add them to this
patch series.

Best,
Peter

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


Re: [PATCH] powerpc: rename immap_86xx.h to fsl_guts.h, and add 85xx support

2010-07-22 Thread Kumar Gala

On Jul 22, 2010, at 10:30 AM, Peter Tyser wrote:

> Hi Timur,
> 
>> +/**
>> + * Global Utility Registers.
>> + *
>> + * Not all registers defined in this structure are available on all chips, 
>> so
>> + * you are expected to know whether a given register actually exists on your
>> + * chip before you access it.
>> + *
>> + * Also, some registers are similar on different chips but have slightly
>> + * different names.  In these cases, one name is chosen to avoid extraneous
>> + * #ifdefs.
>> + */
>> +#ifdef CONFIG_PPC_85xx
>> +struct ccsr_guts_85xx {
>> +#else
>> +struct ccsr_guts_86xx {
>> +#endif
> 
> Is there a good reason to have 2 different names for the same structure
> depending on the architecture?  I'd think keeping a common "ccsr_guts"
> name would get rid of the ifdefs above as well as in code that can be
> used on both 85xx and 86xx processors down the road.

I asked for separate structs since the feeling is the GUTS code should be 
limited to platform specific locations.  Additionally the new P3/P4/P5 class 
parts have a completely different guts immap so if/when we add them in things 
would have to change.

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


Re: [PATCH 2/2] mpc85xx_edac: change to use new definitions for PCI EDAC regspace

2010-07-22 Thread Kumar Gala

On Jul 21, 2010, at 7:03 PM, Dmitry Eremin-Solenikov wrote:

> Currently (as mpc8540-pci) devices are not created on of_platform bus,
> mpc85xx_edac can't probe to them. Follow the change to dts trees to bind
> not to the main mpc8540-pci node but to special mpc85xx-pci-error nodes,
> present on soc bus.
> 
> Signed-off-by: Dmitry Eremin-Solenikov 
> ---
> drivers/edac/mpc85xx_edac.c |   18 +-
> 1 files changed, 9 insertions(+), 9 deletions(-)

Nak.

We already have a node in the dts for the PCI controller.  Lets update the 
platform code to add the pci controller to the of_platform_bus_probe list.

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


Re: [PATCH] powerpc: rename immap_86xx.h to fsl_guts.h, and add 85xx support

2010-07-22 Thread Peter Tyser
Hi Timur,

> +/**
> + * Global Utility Registers.
> + *
> + * Not all registers defined in this structure are available on all chips, so
> + * you are expected to know whether a given register actually exists on your
> + * chip before you access it.
> + *
> + * Also, some registers are similar on different chips but have slightly
> + * different names.  In these cases, one name is chosen to avoid extraneous
> + * #ifdefs.
> + */
> +#ifdef CONFIG_PPC_85xx
> +struct ccsr_guts_85xx {
> +#else
> +struct ccsr_guts_86xx {
> +#endif

Is there a good reason to have 2 different names for the same structure
depending on the architecture?  I'd think keeping a common "ccsr_guts"
name would get rid of the ifdefs above as well as in code that can be
used on both 85xx and 86xx processors down the road.

Best,
Peter

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


Re: [PATCH] powerpc: print cores passed to firmware in decimal

2010-07-22 Thread Segher Boessenkool

+   case 'i':
+   ++q;
+   v = va_arg(args, unsigned long);
+   prom_print_dec(v);
+   break;


Unsigned long should be "%lu".


Segher

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


[PATCH] RapidIO,powerpc/85xx: remove MCSR_MASK in fsl_rio

2010-07-22 Thread Alexandre Bounine
Fixes compile problem caused by MCSR_MASK removal from book-E definitions.

Signed-off-by: Alexandre Bounine 
Cc: Kumar Gala 
Cc: Grant Likely 
Cc: Matt Porter 
---
 arch/powerpc/sysdev/fsl_rio.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/powerpc/sysdev/fsl_rio.c b/arch/powerpc/sysdev/fsl_rio.c
index 30e1626..c58df58 100644
--- a/arch/powerpc/sysdev/fsl_rio.c
+++ b/arch/powerpc/sysdev/fsl_rio.c
@@ -245,7 +245,7 @@ static int (*saved_mcheck_exception)(struct pt_regs *regs);
 static int fsl_rio_mcheck_exception(struct pt_regs *regs)
 {
const struct exception_table_entry *entry = NULL;
-   unsigned long reason = (mfspr(SPRN_MCSR) & MCSR_MASK);
+   unsigned long reason = mfspr(SPRN_MCSR);
 
if (reason & MCSR_BUS_RBERR) {
reason = in_be32((u32 *)(rio_regs_win + RIO_LTLEDCSR));
-- 
1.7.0.5

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


Re: build failure with kernel 2.6.35-rc5-git6/git7 on power box

2010-07-22 Thread Stephen Rothwell
Hi,

On Thu, 22 Jul 2010 13:20:57 +0530 divya  wrote:
>
> The kernel versions 2.6.35-rc5-git6(commitid f4b23cc2d5dc78ef) and 
> 2.6.35-rc5-git7(commitid cd5b8f8755a89a5) fails
> to build on power6 and power5 machines with the following error
> 
> 
>drivers/gpu/drm/ttm/ttm_page_alloc.c: In function 'set_pages_array_wb':
>drivers/gpu/drm/ttm/ttm_page_alloc.c:227: error: implicit declaration of 
> function 'unmap_page_from_agp'
>drivers/gpu/drm/ttm/ttm_page_alloc.c: In function 'set_pages_array_wc':
>drivers/gpu/drm/ttm/ttm_page_alloc.c:238: error: implicit declaration of 
> function 'map_page_into_agp'
>drivers/gpu/drm/ttm/ttm_page_alloc.c: In function 
> 'ttm_pool_mm_shrink_init':
>drivers/gpu/drm/ttm/ttm_page_alloc.c:419: warning: assignment from 
> incompatible pointer type
>make[4]: *** [drivers/gpu/drm/ttm/ttm_page_alloc.o] Error 1
>make[3]: *** [drivers/gpu/drm/ttm] Error 2

See https://patchwork.kernel.org/patch/113504/
-- 
Cheers,
Stephen Rothwells...@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/


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

build failure with kernel 2.6.35-rc5-git6/git7 on power box

2010-07-22 Thread divya

Hi,

The kernel versions 2.6.35-rc5-git6(commitid f4b23cc2d5dc78ef) and 
2.6.35-rc5-git7(commitid cd5b8f8755a89a5) fails
to build on power6 and power5 machines with the following error


  drivers/gpu/drm/ttm/ttm_page_alloc.c: In function 'set_pages_array_wb':
  drivers/gpu/drm/ttm/ttm_page_alloc.c:227: error: implicit declaration of 
function 'unmap_page_from_agp'
  drivers/gpu/drm/ttm/ttm_page_alloc.c: In function 'set_pages_array_wc':
  drivers/gpu/drm/ttm/ttm_page_alloc.c:238: error: implicit declaration of 
function 'map_page_into_agp'
  drivers/gpu/drm/ttm/ttm_page_alloc.c: In function 'ttm_pool_mm_shrink_init':
  drivers/gpu/drm/ttm/ttm_page_alloc.c:419: warning: assignment from 
incompatible pointer type
  make[4]: *** [drivers/gpu/drm/ttm/ttm_page_alloc.o] Error 1
  make[3]: *** [drivers/gpu/drm/ttm] Error 2

Thanks
Divya

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