My MDIO is acting strange

2010-04-22 Thread Peter Pan
I'm porting Linux 2.6.32.6 to my MPC8247 based board. Our FCC1 and
FCC2 are used as 100MBps ethernet ports. MDIO is used to connect with
PHY chip. During boot, the of driver is checking the PHYID, it gets
all Fs. But after I comment the following lines:
//if ((phy_id & 0x1fff) == 0x1fff)
//return NULL;
I can use my FCC ethernet normally after boot into console.
I checked that while boot, all the read bit from MDIO pin is 1, that
makes no TA bit, and no PHYID.
I'm wondering why is that happening.
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: How to support scc-enet on MPC8247 in Linux 2.6.32.6

2010-04-22 Thread Peter Pan
There is an MDIO used by FCC, but the SCC is connected with LXT905,
which is Ethernet Interface Adapter. So I think the SCC should be
fixed-link. But how can I set the fixed-link property? I searched
through the Document directory, there is nothing about the fixed-link
property.

2010/4/23 Scott Wood :
> Peter Pan wrote:
>>
>> I'm porting Linux 2.6.32.6 to our MPC8247 based board. We use SCC3 and
>> SCC4 as ethernet port. These two ports are connect with LXT905 PHY
>> chip.
>> I'm now using fs_enet driver, how should I config the scc port in dtc
>> file. I copied from mgcoge.dts file, and my dtc file of scc enet is
>> follows:
>>
>>            eth2: ether...@11a40 {
>>                device_type = "network";
>>                compatible = "fsl,mpc8247-scc-enet",
>>                             "fsl,cpm2-scc-enet";
>>                reg = <0x11a40 0x20 0x8200 0x100 0x11390 0x1>;
>>                local-mac-address = [ 00 00 00 00 00 00 ]; /* filled
>> by U-Boot */
>>                interrupts = <42 8>;
>>                interrupt-parent = <&PIC>;
>>                linux,network-index = <0x2>;
>>                fsl,cpm-command = <0x8c0>;
>>                fixed-link = < 0 0 10 0 0 >;
>>            };
>> But i does not working. Linux says that PHY 0:00 is not found. I dive
>> into the code, and that's according to the fixed-link property.
>> I'm wondering how to support scc-enet in my situation.
>
> Do you really want fixed-link, or does the board have a working MDIO
> interface?  If the latter, you need a phy-handle property instead, pointing
> to a PHY node under an MDIO bus node that represents how MDIO is wired on
> your board.
>
> -Scott
>
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


[GIT PULL] Perf probe support for PowerPC, from Ian Munsie

2010-04-22 Thread Paul Mackerras
Ingo,

Please pull my perf.git master branch:

  git://git.kernel.org/pub/scm/linux/kernel/git/paulus/perf.git master

It has two commits from Ian Munsie that allow us to access local
variables with perf probe on PowerPC.  We also need a commit in Ben's
powerpc-next branch for it to function, but it compiles without that.

Thanks,
Paul.

---

The following changes since commit 6eca8cc35b50af1037bc919106dd6dd332c959c2:
  Frederic Weisbecker (1):
perf: Fix perf probe build error

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/paulus/perf.git master

Ian Munsie (2):
  perf: Move arch specific code into separate arch directory
  perf probe: Add PowerPC DWARF register number mappings

 tools/perf/Makefile   |   36 ++--
 tools/perf/arch/powerpc/Makefile  |4 +
 tools/perf/arch/powerpc/util/dwarf-regs.c |   88 +
 tools/perf/arch/x86/Makefile  |4 +
 tools/perf/arch/x86/util/dwarf-regs.c |   75 
 tools/perf/util/include/dwarf-regs.h  |8 +++
 tools/perf/util/probe-finder.c|   55 +-
 7 files changed, 211 insertions(+), 59 deletions(-)
 create mode 100644 tools/perf/arch/powerpc/Makefile
 create mode 100644 tools/perf/arch/powerpc/util/dwarf-regs.c
 create mode 100644 tools/perf/arch/x86/Makefile
 create mode 100644 tools/perf/arch/x86/util/dwarf-regs.c
 create mode 100644 tools/perf/util/include/dwarf-regs.h
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


[PATCH] powerpc: remove tls_ssl_stream descriptor type capability in sec3.3 node

2010-04-22 Thread Kim Phillips
Technically, whilst SEC v3.3 h/w honours the tls_ssl_stream descriptor
type, it lacks the ARC4 algorithm execution unit required to be able
to execute anything meaningful with it.  Change the node to agree with
the documentation that declares that the sec3.3 really doesn't have such
a descriptor type.

Reported-by: Haiying Wang 
Signed-off-by: Kim Phillips 
---
 arch/powerpc/boot/dts/mpc8315erdb.dts |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/powerpc/boot/dts/mpc8315erdb.dts 
b/arch/powerpc/boot/dts/mpc8315erdb.dts
index 8a3a4f3..508b770 100644
--- a/arch/powerpc/boot/dts/mpc8315erdb.dts
+++ b/arch/powerpc/boot/dts/mpc8315erdb.dts
@@ -292,7 +292,7 @@
fsl,num-channels = <4>;
fsl,channel-fifo-len = <24>;
fsl,exec-units-mask = <0x97c>;
-   fsl,descriptor-types-mask = <0x3ab0abf>;
+   fsl,descriptor-types-mask = <0x3a30abf>;
};
 
s...@18000 {
-- 
1.7.0.5

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


[PATCH] Fixes for MPC512x PSC

2010-04-22 Thread Steve Deiters
This will apply on the mpc512x-v2.6.33-devel branch of the DENX git
repository.  This is all mostly based
on what was in the Freescale LTIB release from the Freescale website.

On a somewhat unrelated note, does anyone know if the Freescale LTIB
drivers have been merged into any newer
kernel versions?  In particular, I could not find a branch that has
drivers for the newer NAND Flash controller
that was in the LTIB version.


 In clock.c replaced clk_enable with mpc5121_clk_enable as clk_functions
is not yet set.
 Added initialization of the FIFO address and size registers based on
device tree.
 Removed port-number property from mpc5121ads device tree as the driver
doesn't use it.
 Made sure PSC clocks are enabled early for console.
 Made sure interrupt is requested with IRQF_SHARED as they share the
FIFO irq.
 Moved initialization of CSR to mpc52xx_uart_set_termios so it is done
for the MPC512x
 and also so it is done early in the console setup.

---
 arch/powerpc/boot/dts/mpc5121ads.dts |3 +-
 arch/powerpc/platforms/512x/clock.c  |2 +-
 arch/powerpc/platforms/512x/mpc5121_ads.c|1 +
 arch/powerpc/platforms/512x/mpc512x.h|1 +
 arch/powerpc/platforms/512x/mpc512x_shared.c |   80
++
 drivers/serial/mpc52xx_uart.c|7 +-
 6 files changed, 87 insertions(+), 7 deletions(-)

diff --git a/arch/powerpc/boot/dts/mpc5121ads.dts
b/arch/powerpc/boot/dts/mpc5121ads.dts
index d2b2db7..bdaf534 100644
--- a/arch/powerpc/boot/dts/mpc5121ads.dts
+++ b/arch/powerpc/boot/dts/mpc5121ads.dts
@@ -325,6 +325,7 @@
interrupt-parent = < &ipic >;
};
 
+   // UART port numbers are enumerated in the order they
occur
// 512x PSCs are not 52xx PSC compatible
// PSC3 serial port A aka ttyPSC0
ser...@11300 {
@@ -332,7 +333,6 @@
compatible = "fsl,mpc5121-psc-uart",
"fsl,mpc5121-psc";
// Logical port assignment needed until driver
// learns to use aliases
-   port-number = <0>;
cell-index = <3>;
reg = <0x11300 0x100>;
interrupts = <40 0x8>;
@@ -347,7 +347,6 @@
compatible = "fsl,mpc5121-psc-uart",
"fsl,mpc5121-psc";
// Logical port assignment needed until driver
// learns to use aliases
-   port-number = <1>;
cell-index = <4>;
reg = <0x11400 0x100>;
interrupts = <40 0x8>;
diff --git a/arch/powerpc/platforms/512x/clock.c
b/arch/powerpc/platforms/512x/clock.c
index 8733143..d32c83f 100644
--- a/arch/powerpc/platforms/512x/clock.c
+++ b/arch/powerpc/platforms/512x/clock.c
@@ -681,7 +681,7 @@ static void psc_clks_init(void)
psc_calc_rate(clk, pscnum, np);
sprintf(clk->name, "psc%d_mclk", pscnum);
clk_register(clk);
-   clk_enable(clk);
+   mpc5121_clk_enable(clk);
}
}
 }
diff --git a/arch/powerpc/platforms/512x/mpc5121_ads.c
b/arch/powerpc/platforms/512x/mpc5121_ads.c
index aa4d5a8..44a0a51 100644
--- a/arch/powerpc/platforms/512x/mpc5121_ads.c
+++ b/arch/powerpc/platforms/512x/mpc5121_ads.c
@@ -64,6 +64,7 @@ static int __init mpc5121_ads_probe(void)
 void __init mpc5121_ads_init_early(void)
 {
mpc512x_init_diu();
+   mpc5121_psc_early_init();
 }
 
 define_machine(mpc5121_ads) {
diff --git a/arch/powerpc/platforms/512x/mpc512x.h
b/arch/powerpc/platforms/512x/mpc512x.h
index 1cfe9d5..fb69e3f 100644
--- a/arch/powerpc/platforms/512x/mpc512x.h
+++ b/arch/powerpc/platforms/512x/mpc512x.h
@@ -21,3 +21,4 @@ extern void __init mpc512x_init_diu(void);
 extern void __init mpc512x_setup_diu(void);
 extern struct fsl_diu_shared_fb diu_shared_fb;
 #endif /* __MPC512X_H__ */
+extern void __init mpc5121_psc_early_init(void);
diff --git a/arch/powerpc/platforms/512x/mpc512x_shared.c
b/arch/powerpc/platforms/512x/mpc512x_shared.c
index 65b0a5d..1d74046 100644
--- a/arch/powerpc/platforms/512x/mpc512x_shared.c
+++ b/arch/powerpc/platforms/512x/mpc512x_shared.c
@@ -61,6 +61,86 @@ void mpc512x_restart(char *cmd)
;
 }
 
+#define DEFAULT_FIFO_SIZE 16
+
+static unsigned int get_fifo_size(struct device_node *np, int psc_num,
char *fifo_name)
+{
+   const unsigned int *fp;
+
+   fp = of_get_property(np, fifo_name, NULL);
+   if (fp) {
+   /* make sure has at least 1 byte */
+   return *fp ? *fp : 1;
+   }
+
+   printk(KERN_WARNING "no %s property for psc%d defaulting to
%d\n",
+   fifo_name, psc_num, DEFAULT_FIFO_SIZE);
+   return DEFAULT_FIFO_SIZE;
+}
+
+static void __init mpc5121_psc_lowlevel_clock_init(void)
+{

Re: Continual reading from the PowerPc time base register is not stable

2010-04-22 Thread Kim Phillips
On Thu, 22 Apr 2010 10:50:16 +1000
Benjamin Herrenschmidt  wrote:

> On Wed, 2010-04-21 at 19:44 -0500, Kim Phillips wrote:
> > I took an 8377 rdb board, and let it run timebase.c (with the isync &
> > long long casts) all weekend, and have failed to reproduce the issue.
> > That was on linux 2.6.33, and I've got another machine running the
> > same
> > thing under 2.6.28 for the last couple of hours, still unable to
> > reproduce the issue.
> 
> Do we need to add an isync to the vdso and kernel gettimeofday() ?

don't see why: I put two gettimeofday calls in a tight loop, checking
if (t2.tv_sec < t1.tv_sec) || (t2.tv_sec > t1.tv_sec + 1), and the
condition was never met.  I also removed all {i,}sync instructions from
timebase.c (but left the long long casts in), and no failures were
reported.

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


Re: [patch 11/14] powerpc: invoke oom-killer from page fault

2010-04-22 Thread David Rientjes
On Fri, 23 Apr 2010, npig...@suse.de wrote:

> As explained in commit 1c0fe6e3bd, we want to call the architecture 
> independent
> oom killer when getting an unexplained OOM from handle_mm_fault, rather than
> simply killing current.
> 
> Cc: linuxppc-...@ozlabs.org
> Cc: Benjamin Herrenschmidt 
> Cc: linux-a...@vger.kernel.org
> Signed-off-by: Nick Piggin 
> ---
> Index: linux-2.6/arch/powerpc/mm/fault.c
> ===
> --- linux-2.6.orig/arch/powerpc/mm/fault.c
> +++ linux-2.6/arch/powerpc/mm/fault.c
> @@ -359,15 +359,10 @@ bad_area_nosemaphore:
>   */
>  out_of_memory:
>   up_read(&mm->mmap_sem);
> - if (is_global_init(current)) {
> - yield();
> - down_read(&mm->mmap_sem);
> - goto survive;
> - }
> - printk("VM: killing process %s\n", current->comm);
> - if (user_mode(regs))
> - do_group_exit(SIGKILL);
> - return SIGKILL;
> + if (!user_mode(regs))
> + return SIGKILL;
> + pagefault_out_of_memory();
> + return 0;

Do we really want to return 0 and indicate that the fault was handled?  It 
seems more consistent to do

if (user_mode(regs))
pagefault_out_of_memory();
return SIGKILL;
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: Boot hang when setting console=none with MPC5200B custom board

2010-04-22 Thread Sylvain Lamontagne
[snip] 
> Can you halt the processor with JTAG and look at the contents of __log_buf?
Ok I'll try that as soon as I can get CodeWarrior to work again...

> > 1. Is it possible ?
> 
> Yes, I believe so, but I haven't tried.
Ok 
> 
> > 2. Do you have any idea how it can be achieve ?
> 
> You should be doing the right thing.  Are your userspace init scripts
> trying to start a getty on the non-existent console device?
> 
Nope and using init=/bin/sh 
gave me /bin/sh: can't access tty; job control turned off
And then 
/ # tty
not a tty

Is helpful ? This is while using console=ttyS1,115200 (so when I know
it's working)

> > 3. Do you know a bug in 2.6.29.2 that could prevent this to work ?
> 
> no
Ok :) 
> 
> > 4. The 'chosen' node is empty in my dts, does it require something to be
> > set ?
> 
> no
Good to know 
> 
> I think your best bet is to figure out some way to get at __log_buf to
> retrieve the kernel output after the failed boot.
Ok I'll try to revive CodeWarrior (I would better appreciate a BDI2000,
but I'm stuck with a Freescale USB TAP that require CodeWarrior)

> 
> Cheers,
> g.
> 
Thank you

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


Re: Boot hang when setting console=none with MPC5200B custom board

2010-04-22 Thread Sylvain Lamontagne
Hi Albrecht,

> > 1. Is it possible ?
> 
> Yes!  I tried this with several kernel versions (currently 2.6.33), using the 
> option 'console=tty0'.  Works just fine...
> 
Happy to know that it can be done !

> > 2. Do you have any idea how it can be achieve ?
> 
> Hmmm, iirc, I also saw the effect you have.  I *think* the solution was to 
> ensure that all /dev/* files were created manually in the jffs image, not by 
> running mdev (if you use busybox).  But I might be wrong here, sorry.  Being 
> at home, I don't have access to the device, but I can re-check tomorrow.
> 
Humm I see, here is the node I'm creating in the initial ramdisk, so
they are there before mdev is launched in one of my init scripts.

console   c   5   1
null  c   1   3
zero  c   1   5
ptmx  c   5   2
tty   c   5   0
randomc   1   8
urandom   c   1   9
initrdb   1   250
ram0  b   1   0
ram1  b   1   1
ram2  b   1   2
ram3  b   1   3
ramdisk -> ram0
ram -> ram0
loop0 b   7   0
loop1 b   7   1


I think I have all the necessary device for boot, but if you could
double check with yours I would appreciated it.

> > 3. Do you know a bug in 2.6.29.2 that could prevent this to work ?
> 
> Not sure if I used *exactly* that version w/o serial console, but (iirc) 
> 2.6.28.something, and then many different up to .33 - they all work!

Ok

> 
> Best, Albrecht.

Thank you 

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


Re: Boot hang when setting console=none with MPC5200B custom board

2010-04-22 Thread Albrecht Dreß

Hi Sylvain:

Am 22.04.10 20:58 schrieb(en) Sylvain Lamontagne:
[snip]

1. Is it possible ?


Yes!  I tried this with several kernel versions (currently 2.6.33), using the 
option 'console=tty0'.  Works just fine...


2. Do you have any idea how it can be achieve ?


Hmmm, iirc, I also saw the effect you have.  I *think* the solution was to 
ensure that all /dev/* files were created manually in the jffs image, not by 
running mdev (if you use busybox).  But I might be wrong here, sorry.  Being at 
home, I don't have access to the device, but I can re-check tomorrow.


3. Do you know a bug in 2.6.29.2 that could prevent this to work ?


Not sure if I used *exactly* that version w/o serial console, but (iirc) 
2.6.28.something, and then many different up to .33 - they all work!

Best, Albrecht.


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

Re: Boot hang when setting console=none with MPC5200B custom board

2010-04-22 Thread Grant Likely
On Thu, Apr 22, 2010 at 12:58 PM, Sylvain Lamontagne
 wrote:
> Hi everybody,
>
> I'm trying to remove the console from a custom board based on a
> MPC5200B. During development we used console=ttyS1,115200 in our bootcmd
> for the kernel, but now that the product is ready to be shipped we want
> to use ttyS1 for something else and would like to deactivate completely
> the console. So the unit would be accessible only by ssh if needed.
>
> (I'm not really confortable with this since a network problem would
> prevent us of even debugging the platform... but I've been ask to do
> it.)
>
> Anyway, whenever I try to change console= to null or to tty1 or anything
> else, the boot is hanging somewhere ( I know that, because some leds are
> not flashing like they should on a normal boot and I can't login in with
> ssh).
>
> I've tried to use tty1, none, null, zero and I've tried to completely
> remove the console= arguments... but nothing work, its hanging there
> without any flashing leds.
>
> I've tried redirecting another "real" serial port and it worked, so
> console=ttyPSC2,115200 work... but we need it also... so it can't do.
>
> I've also tried the U-Boot's silent variable trick ... but it did not
> work and I had to erase the environment of U-Boot with a JTAG to recover
> back my default setting of ttyS1.
>
> I'm now at a point where I think I have try everything that I know, and
> since I have no way of "seeing" what is going on ... it's pretty hard to
> debug.

Can you halt the processor with JTAG and look at the contents of __log_buf?

> The kernel is 2.6.29.2 and can't really be changed... (but it may be
> patch)
> This board doesn't have a framebuffer or a graphic chipset, everything
> was done with a serial connection and now we want to remove this serial
> connection (console) before sending it to a customer.
>
> 1. Is it possible ?

Yes, I believe so, but I haven't tried.

> 2. Do you have any idea how it can be achieve ?

You should be doing the right thing.  Are your userspace init scripts
trying to start a getty on the non-existent console device?

> 3. Do you know a bug in 2.6.29.2 that could prevent this to work ?

no

> 4. The 'chosen' node is empty in my dts, does it require something to be
> set ?

no

I think your best bet is to figure out some way to get at __log_buf to
retrieve the kernel output after the failed boot.

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


Boot hang when setting console=none with MPC5200B custom board

2010-04-22 Thread Sylvain Lamontagne
Hi everybody,

I'm trying to remove the console from a custom board based on a
MPC5200B. During development we used console=ttyS1,115200 in our bootcmd
for the kernel, but now that the product is ready to be shipped we want
to use ttyS1 for something else and would like to deactivate completely
the console. So the unit would be accessible only by ssh if needed.

(I'm not really confortable with this since a network problem would
prevent us of even debugging the platform... but I've been ask to do
it.)

Anyway, whenever I try to change console= to null or to tty1 or anything
else, the boot is hanging somewhere ( I know that, because some leds are
not flashing like they should on a normal boot and I can't login in with
ssh).

I've tried to use tty1, none, null, zero and I've tried to completely
remove the console= arguments... but nothing work, its hanging there
without any flashing leds.

I've tried redirecting another "real" serial port and it worked, so
console=ttyPSC2,115200 work... but we need it also... so it can't do.

I've also tried the U-Boot's silent variable trick ... but it did not
work and I had to erase the environment of U-Boot with a JTAG to recover
back my default setting of ttyS1.

I'm now at a point where I think I have try everything that I know, and
since I have no way of "seeing" what is going on ... it's pretty hard to
debug. 

The kernel is 2.6.29.2 and can't really be changed... (but it may be
patch)
This board doesn't have a framebuffer or a graphic chipset, everything
was done with a serial connection and now we want to remove this serial
connection (console) before sending it to a customer.

1. Is it possible ?
2. Do you have any idea how it can be achieve ?
3. Do you know a bug in 2.6.29.2 that could prevent this to work ?
4. The 'chosen' node is empty in my dts, does it require something to be
set ?

Thank you for your help ( I hope ;) )

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


Re: How to support scc-enet on MPC8247 in Linux 2.6.32.6

2010-04-22 Thread Scott Wood

Peter Pan wrote:

I'm porting Linux 2.6.32.6 to our MPC8247 based board. We use SCC3 and
SCC4 as ethernet port. These two ports are connect with LXT905 PHY
chip.
I'm now using fs_enet driver, how should I config the scc port in dtc
file. I copied from mgcoge.dts file, and my dtc file of scc enet is
follows:

eth2: ether...@11a40 {
device_type = "network";
compatible = "fsl,mpc8247-scc-enet",
 "fsl,cpm2-scc-enet";
reg = <0x11a40 0x20 0x8200 0x100 0x11390 0x1>;
local-mac-address = [ 00 00 00 00 00 00 ]; /* filled
by U-Boot */
interrupts = <42 8>;
interrupt-parent = <&PIC>;
linux,network-index = <0x2>;
fsl,cpm-command = <0x8c0>;
fixed-link = < 0 0 10 0 0 >;
};
But i does not working. Linux says that PHY 0:00 is not found. I dive
into the code, and that's according to the fixed-link property.
I'm wondering how to support scc-enet in my situation.


Do you really want fixed-link, or does the board have a working MDIO 
interface?  If the latter, you need a phy-handle property instead, 
pointing to a PHY node under an MDIO bus node that represents how MDIO 
is wired on your board.


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


[patch 11/14] powerpc: invoke oom-killer from page fault

2010-04-22 Thread npiggin
As explained in commit 1c0fe6e3bd, we want to call the architecture independent
oom killer when getting an unexplained OOM from handle_mm_fault, rather than
simply killing current.

Cc: linuxppc-...@ozlabs.org
Cc: Benjamin Herrenschmidt 
Cc: linux-a...@vger.kernel.org
Signed-off-by: Nick Piggin 
---
Index: linux-2.6/arch/powerpc/mm/fault.c
===
--- linux-2.6.orig/arch/powerpc/mm/fault.c
+++ linux-2.6/arch/powerpc/mm/fault.c
@@ -359,15 +359,10 @@ bad_area_nosemaphore:
  */
 out_of_memory:
up_read(&mm->mmap_sem);
-   if (is_global_init(current)) {
-   yield();
-   down_read(&mm->mmap_sem);
-   goto survive;
-   }
-   printk("VM: killing process %s\n", current->comm);
-   if (user_mode(regs))
-   do_group_exit(SIGKILL);
-   return SIGKILL;
+   if (!user_mode(regs))
+   return SIGKILL;
+   pagefault_out_of_memory();
+   return 0;
 
 do_sigbus:
up_read(&mm->mmap_sem);


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


[PATCH] powerpc/85xx: Fix P1020RDB boot hang due USB2

2010-04-22 Thread Anton Vorontsov
Since USB2 is shared with local bus, either local bus or USB2
should be disabled. By default U-Boot enables local bus, so we
have to disable USB2, otherwise kernel hangs:

 ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
 fsl-ehci fsl-ehci.0: Freescale On-Chip EHCI Host Controller
 fsl-ehci fsl-ehci.0: new USB bus registered, assigned bus number 1
 fsl-ehci fsl-ehci.0: irq 28, io base 0xffe22000
 fsl-ehci fsl-ehci.0: USB 2.0 started, EHCI 1.00
 hub 1-0:1.0: USB hub found
 hub 1-0:1.0: 1 port detected
 fsl-ehci fsl-ehci.1: Freescale On-Chip EHCI Host Controller
 fsl-ehci fsl-ehci.1: new USB bus registered, assigned bus number 2
 

Note that U-Boot doesn't clear 'status' property when it enables
USB2, so we have to comment out the whole node.

To enable USB2, one can issue
'setenv hwconfig usb2:dr_mode=' command at the
U-Boot prompt.

Signed-off-by: Anton Vorontsov 
---
 arch/powerpc/boot/dts/p1020rdb.dts |6 ++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/arch/powerpc/boot/dts/p1020rdb.dts 
b/arch/powerpc/boot/dts/p1020rdb.dts
index df52690..865795e 100644
--- a/arch/powerpc/boot/dts/p1020rdb.dts
+++ b/arch/powerpc/boot/dts/p1020rdb.dts
@@ -356,6 +356,11 @@
phy_type = "ulpi";
};
 
+   /* USB2 is shared with localbus, so it must be disabled
+  by default. We can't put 'status = "disabled";' here
+  since U-Boot doesn't clear the status property when
+  it enables USB2. OTOH, U-Boot does create a new node
+  when there isn't any. So, just comment it out.
u...@23000 {
#address-cells = <1>;
#size-cells = <0>;
@@ -365,6 +370,7 @@
interrupts = <46 0x2>;
phy_type = "ulpi";
};
+   */
 
sd...@2e000 {
compatible = "fsl,p1020-esdhc", "fsl,esdhc";
-- 
1.7.0.4
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


[PATCH 2/2] genirq: update doc

2010-04-22 Thread Guillaume Knispel
Following "genirq: always build resend_irqs" and previous changes, this
commit updates the genirq DocBook.

Signed-off-by: Guillaume Knispel 
CC: linux-ker...@vger.kernel.org
CC: Linuxppc-dev@lists.ozlabs.org
CC: Bartlomiej Zolnierkiewicz 
CC: Benjamin Herrenschmidt 
CC: Haavard Skinnemoen 
CC: Ingo Molnar 
CC: Lars-Peter Clausen 
CC: Linus Torvalds 
CC: Michael Buesch 
CC: Peter Zijlstra 
CC: Russell King 
CC: Thomas Gleixner 
---
 Documentation/DocBook/genericirq.tmpl |   73 ++--
 1 files changed, 41 insertions(+), 32 deletions(-)

diff --git a/Documentation/DocBook/genericirq.tmpl 
b/Documentation/DocBook/genericirq.tmpl
index 1448b33..5ee204c 100644
--- a/Documentation/DocBook/genericirq.tmpl
+++ b/Documentation/DocBook/genericirq.tmpl
@@ -240,8 +240,6 @@ default_enable(irq)
 
 default_disable(irq)
 {
-   if (!delay_disable(irq))
-   desc->chip->mask(irq);
 }
 
 default_ack(irq)
@@ -264,7 +262,11 @@ noop(irq)
 }
 

-   
+   Note: default_disable is empty so that an edge-triggered
+   interrupt happening between a disable_irq() and an enable_irq()
+   is catched by the kernel for later replay. See
+for details.
+   



@@ -278,9 +280,14 @@ noop(irq)

The following control flow is implemented (simplified excerpt):

-desc->chip->start();
+desc->chip->mask_ack();
+if (desc->status & inprogress)
+   return;
+desc->status |= inprogress;
 handle_IRQ_event(desc->action);
-desc->chip->end();
+desc->status &= inprogress;
+if (!(desc->status & disabled))
+   desc->chip->unmask_ack();



@@ -293,21 +300,23 @@ desc->chip->end();

The following control flow is implemented (simplified excerpt):

-if (desc->status & running) {
-   desc->chip->hold();
+if (desc->status & (inprogress | disabled)) {
desc->status |= pending | masked;
+   desc->chip->mask_ack();
return;
 }
-desc->chip->start();
-desc->status |= running;
+desc->chip->ack();
+desc->status |= inprogress;
 do {
-   if (desc->status & masked)
-   desc->chip->enable();
+   if ((desc->status & (pending | masked | disabled))
+== (pending | masked)) {
+   desc->chip->unmask();
+   desc->status &= ~masked;
+   }
desc->status &= ~pending;
handle_IRQ_event(desc->action);
-} while (status & pending);
-desc->status &= ~running;
-desc->chip->end();
+} while ((status & (pending | disabled)) == pending);
+desc->status &= inprogress;



@@ -342,9 +351,9 @@ handle_IRQ_event(desc->action);

The following control flow is implemented (simplified excerpt):

-desc->chip->start();
+desc->chip->ack();
 handle_IRQ_event(desc->action);
-desc->chip->end();
+desc->chip->eoi();



@@ -361,22 +370,20 @@ desc->chip->end();

Delayed interrupt disable

-   This per interrupt selectable feature, which was introduced by Russell
-   King in the ARM interrupt implementation, does not mask an interrupt
-   at the hardware level when disable_irq() is called. The interrupt is
-   kept enabled and is masked in the flow handler when an interrupt event
-   happens. This prevents losing edge interrupts on hardware which does
-   not store an edge interrupt event while the interrupt is disabled at
-   the hardware level. When an interrupt arrives while the IRQ_DISABLED
-   flag is set, then the interrupt is masked at the hardware level and
-   the IRQ_PENDING bit is set. When the interrupt is re-enabled by
-   enable_irq() the pending bit is checked and if it is set, the
-   interrupt is resent either via hardware or by a software resend
-   mechanism. (It's necessary to enable CONFIG_HARDIRQS_SW_RESEND when
-   you want to use the delayed interrupt disable feature and your
-   hardware is not capable of retriggering an interrupt.)
-   The delayed interrupt disable can be runtime enabled, per interrupt,
-   by setting the IRQ_DELAYED_DISABLE flag in the irq_desc status field.
+   At least when using default_disable as the ->disable() callback of a
+   chip handler, an interrupt is not masked at the hardware level when
+   disable_irq() is called. The interrupt is kept enabled and is masked
+   in the flow handler when an interrupt event happens. This prevents
+   losing edge interrupts on hardware which does not store an edge
+   interrupt event while the interrupt is disabled at the hardware level.
+   This makes use of the replay mechanism that is mandatory anyway to
+   prevent potential race conditions between an interrupt even

[PATCH 0/2] genirq: reliably replay pending edge-triggered irq (plus doc)

2010-04-22 Thread Guillaume Knispel
In the following series:


[1/2] implements the proposal I made at the end of the thread
http://lkml.org/lkml/2010/4/19/129 to reliably support replay
of edge-triggered interrupts on all architectures when using
disable_irq() / enable_irq().

Proper replays of pending edge-triggered interrupts was
depending on CONFIG_HARDIRQS_SW_RESEND which only seems to have
been noticed for plateforms of ARM and AVR32 architecture while
it should also have been used on other architectures to get the
correct behavior. So the patch removes CONFIG_HARDIRQS_SW_RESEND
and unconditionally builds the resend_irqs() tasklet and its
scheduling.

I only tested an equivalent patch for linux-2.6.22.18 on powerpc
for a board with an MPC8555E (using a portC line on the CPM2 PIC),
and build-tested this one for x86.


[2/2] updates Documentation/DocBook/genericirq.tmpl, taking
into account 1/2 other previous undocumented changes to genirq.


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


[PATCH v3 5/5] fsl_msi: add removal path and probe failing path

2010-04-22 Thread Li Yang
Also cleanup the probe function.

Signed-off-by: Li Yang 
---
 arch/powerpc/sysdev/fsl_msi.c |   36 ++--
 arch/powerpc/sysdev/fsl_msi.h |1 +
 2 files changed, 31 insertions(+), 6 deletions(-)

diff --git a/arch/powerpc/sysdev/fsl_msi.c b/arch/powerpc/sysdev/fsl_msi.c
index 7c442e2..025aa9b 100644
--- a/arch/powerpc/sysdev/fsl_msi.c
+++ b/arch/powerpc/sysdev/fsl_msi.c
@@ -249,6 +249,30 @@ unlock:
spin_unlock(&desc->lock);
 }
 
+static int fsl_of_msi_remove(struct of_device *ofdev)
+{
+   struct fsl_msi *msi = ofdev->dev.platform_data;
+   int virq, i;
+   struct fsl_msi_cascade_data *cascade_data;
+
+   if (msi->list.prev != NULL)
+   list_del(&msi->list);
+   for (i = 0; i < NR_MSI_REG; i++) {
+   virq = msi->msi_virqs[i];
+   if (virq != NO_IRQ) {
+   cascade_data = get_irq_data(virq);
+   kfree(cascade_data);
+   irq_dispose_mapping(virq);
+   }
+   }
+   if (msi->bitmap.bitmap)
+   msi_bitmap_free(&msi->bitmap);
+   iounmap(msi->msi_regs);
+   kfree(msi);
+
+   return 0;
+}
+
 static int __devinit fsl_of_msi_probe(struct of_device *dev,
const struct of_device_id *match)
 {
@@ -268,9 +292,9 @@ static int __devinit fsl_of_msi_probe(struct of_device *dev,
msi = kzalloc(sizeof(struct fsl_msi), GFP_KERNEL);
if (!msi) {
dev_err(&dev->dev, "No memory for MSI structure\n");
-   err = -ENOMEM;
-   goto error_out;
+   return -ENOMEM;
}
+   dev->dev.platform_data = msi;
 
msi->irqhost = irq_alloc_host(dev->node, IRQ_HOST_MAP_LINEAR,
  NR_MSI_IRQS, &fsl_msi_host_ops, 0);
@@ -327,9 +351,7 @@ static int __devinit fsl_of_msi_probe(struct of_device *dev,
offset = *p / IRQS_PER_MSI_REG;
 
count /= sizeof(u32);
-   for (i = 0; i < count / 2; i++) {
-   if (i > NR_MSI_REG)
-   break;
+   for (i = 0; i < min(count / 2, NR_MSI_REG); i++) {
virt_msir = irq_of_parse_and_map(dev->node, i);
if (virt_msir != NO_IRQ) {
cascade_data = kzalloc(
@@ -341,6 +363,7 @@ static int __devinit fsl_of_msi_probe(struct of_device *dev,
err = -ENOMEM;
goto error_out;
}
+   msi->msi_virqs[i] = virt_msir;
cascade_data->index = i + offset;
cascade_data->msi_data = msi;
set_irq_data(virt_msir, (void *)cascade_data);
@@ -362,7 +385,7 @@ static int __devinit fsl_of_msi_probe(struct of_device *dev,
}
return 0;
 error_out:
-   kfree(msi);
+   fsl_of_msi_remove(dev);
return err;
 }
 
@@ -392,6 +415,7 @@ static struct of_platform_driver fsl_of_msi_driver = {
.name = "fsl-msi",
.match_table = fsl_of_msi_ids,
.probe = fsl_of_msi_probe,
+   .remove = fsl_of_msi_remove,
 };
 
 static __init int fsl_of_msi_init(void)
diff --git a/arch/powerpc/sysdev/fsl_msi.h b/arch/powerpc/sysdev/fsl_msi.h
index 8fc5523..624580c 100644
--- a/arch/powerpc/sysdev/fsl_msi.h
+++ b/arch/powerpc/sysdev/fsl_msi.h
@@ -32,6 +32,7 @@ struct fsl_msi {
u32 msi_addr_hi;
void __iomem *msi_regs;
u32 feature;
+   int msi_virqs[NR_MSI_REG];
 
struct msi_bitmap bitmap;
 
-- 
1.6.6-rc1.GIT

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


[PATCH v3 4/5] mpc8572ds: change camp dtses for MSI sharing

2010-04-22 Thread Li Yang
Enable the sharing of MSI interrupt through AMP OSes in the mpc8572ds
dtses.

Signed-off-by: Zhao Chenhui 
Signed-off-by: Li Yang 
---
 arch/powerpc/boot/dts/mpc8572ds_camp_core0.dts |   15 +--
 arch/powerpc/boot/dts/mpc8572ds_camp_core1.dts |7 ++-
 2 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/arch/powerpc/boot/dts/mpc8572ds_camp_core0.dts 
b/arch/powerpc/boot/dts/mpc8572ds_camp_core0.dts
index 5bd1011..3375c2a 100644
--- a/arch/powerpc/boot/dts/mpc8572ds_camp_core0.dts
+++ b/arch/powerpc/boot/dts/mpc8572ds_camp_core0.dts
@@ -215,6 +215,18 @@
clock-frequency = <0>;
};
 
+   m...@41600 {
+   compatible = "fsl,mpc8572-msi", "fsl,mpic-msi";
+   reg = <0x41600 0x80>;
+   msi-available-ranges = <0 0x80>;
+   interrupts = <
+   0xe0 0
+   0xe1 0
+   0xe2 0
+   0xe3 0>;
+   interrupt-parent = <&mpic>;
+   };
+
global-utilit...@e {//global utilities block
compatible = "fsl,mpc8572-guts";
reg = <0xe 0x1000>;
@@ -243,8 +255,7 @@
protected-sources = <
31 32 33 37 38 39   /* enet2 enet3 */
76 77 78 79 26 42   /* dma2 pci2 serial*/
-   0xe0 0xe1 0xe2 0xe3 /* msi */
-   0xe4 0xe5 0xe6 0xe7
+   0xe4 0xe5 0xe6 0xe7 /* msi */
>;
};
};
diff --git a/arch/powerpc/boot/dts/mpc8572ds_camp_core1.dts 
b/arch/powerpc/boot/dts/mpc8572ds_camp_core1.dts
index 0efc345..e7b477f 100644
--- a/arch/powerpc/boot/dts/mpc8572ds_camp_core1.dts
+++ b/arch/powerpc/boot/dts/mpc8572ds_camp_core1.dts
@@ -154,12 +154,8 @@
m...@41600 {
compatible = "fsl,mpc8572-msi", "fsl,mpic-msi";
reg = <0x41600 0x80>;
-   msi-available-ranges = <0 0x100>;
+   msi-available-ranges = <0x80 0x80>;
interrupts = <
-   0xe0 0
-   0xe1 0
-   0xe2 0
-   0xe3 0
0xe4 0
0xe5 0
0xe6 0
@@ -190,6 +186,7 @@
0x1 0x2 0x3 0x4 /* pci slot */
0x9 0xa 0xb 0xc /* usb */
0x6 0x7 0xe 0x5 /* Audio elgacy SATA */
+   0xe0 0xe1 0xe2 0xe3 /* msi */
>;
};
};
-- 
1.6.6-rc1.GIT

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


[PATCH v3 3/5] fsl_msi: enable msi sharing through AMP OSes

2010-04-22 Thread Li Yang
Make a single PCIe MSI bank shareable through CAMP OSes. The number of
MSI used by each core can be configured by dts file.

Signed-off-by: Zhao Chenhui 
Signed-off-by: Li Yang 
---
 arch/powerpc/sysdev/fsl_msi.c |8 +++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/arch/powerpc/sysdev/fsl_msi.c b/arch/powerpc/sysdev/fsl_msi.c
index b7ea19a..7c442e2 100644
--- a/arch/powerpc/sysdev/fsl_msi.c
+++ b/arch/powerpc/sysdev/fsl_msi.c
@@ -260,6 +260,8 @@ static int __devinit fsl_of_msi_probe(struct of_device *dev,
const u32 *p;
struct fsl_msi_feature *features = match->data;
struct fsl_msi_cascade_data *cascade_data = NULL;
+   int len;
+   u32 offset;
 
printk(KERN_DEBUG "Setting up Freescale MSI support\n");
 
@@ -319,6 +321,10 @@ static int __devinit fsl_of_msi_probe(struct of_device 
*dev,
err = -EINVAL;
goto error_out;
}
+   offset = 0;
+   p = of_get_property(dev->node, "msi-available-ranges", &len);
+   if (p)
+   offset = *p / IRQS_PER_MSI_REG;
 
count /= sizeof(u32);
for (i = 0; i < count / 2; i++) {
@@ -335,7 +341,7 @@ static int __devinit fsl_of_msi_probe(struct of_device *dev,
err = -ENOMEM;
goto error_out;
}
-   cascade_data->index = i;
+   cascade_data->index = i + offset;
cascade_data->msi_data = msi;
set_irq_data(virt_msir, (void *)cascade_data);
set_irq_chained_handler(virt_msir, fsl_msi_cascade);
-- 
1.6.6-rc1.GIT

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


[PATCH v3 2/5] fsl_msi: enable msi allocation in all banks

2010-04-22 Thread Li Yang
Put all fsl_msi banks in a linked list. The list of banks then can be
traversed when allocating new msi interrupts.  Also fix failing path
of fsl_setup_msi_irqs().

Signed-off-by: Zhao Chenhui 
Signed-off-by: Li Yang 
---
 arch/powerpc/sysdev/fsl_msi.c |   14 +++---
 arch/powerpc/sysdev/fsl_msi.h |2 ++
 2 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/arch/powerpc/sysdev/fsl_msi.c b/arch/powerpc/sysdev/fsl_msi.c
index 93a638a..b7ea19a 100644
--- a/arch/powerpc/sysdev/fsl_msi.c
+++ b/arch/powerpc/sysdev/fsl_msi.c
@@ -24,6 +24,8 @@
 #include 
 #include "fsl_msi.h"
 
+LIST_HEAD(msi_head);
+
 struct fsl_msi_feature {
u32 fsl_pic_ip;
u32 msiir_offset;
@@ -137,16 +139,19 @@ static void fsl_compose_msi_msg(struct pci_dev *pdev, int 
hwirq,
 
 static int fsl_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type)
 {
-   int rc, hwirq = NO_IRQ;
+   int rc, hwirq = -ENOMEM;
unsigned int virq;
struct msi_desc *entry;
struct msi_msg msg;
struct fsl_msi *msi_data;
 
list_for_each_entry(entry, &pdev->msi_list, list) {
-   msi_data = get_irq_chip_data(entry->irq);
+   list_for_each_entry(msi_data, &msi_head, list) {
+   hwirq = msi_bitmap_alloc_hwirqs(&msi_data->bitmap, 1);
+   if (hwirq >= 0)
+   break;
+   }
 
-   hwirq = msi_bitmap_alloc_hwirqs(&msi_data->bitmap, 1);
if (hwirq < 0) {
rc = hwirq;
pr_debug("%s: fail allocating msi interrupt\n",
@@ -172,6 +177,7 @@ static int fsl_setup_msi_irqs(struct pci_dev *pdev, int 
nvec, int type)
return 0;
 
 out_free:
+   /* free by the caller of this function */
return rc;
 }
 
@@ -336,6 +342,8 @@ static int __devinit fsl_of_msi_probe(struct of_device *dev,
}
}
 
+   list_add_tail(&msi->list, &msi_head);
+
/* The multiple setting ppc_md.setup_msi_irqs will not harm things */
if (!ppc_md.setup_msi_irqs) {
ppc_md.setup_msi_irqs = fsl_setup_msi_irqs;
diff --git a/arch/powerpc/sysdev/fsl_msi.h b/arch/powerpc/sysdev/fsl_msi.h
index 331c7e7..8fc5523 100644
--- a/arch/powerpc/sysdev/fsl_msi.h
+++ b/arch/powerpc/sysdev/fsl_msi.h
@@ -34,6 +34,8 @@ struct fsl_msi {
u32 feature;
 
struct msi_bitmap bitmap;
+
+   struct list_head list;  /* support multiple MSI banks */
 };
 
 #endif /* _POWERPC_SYSDEV_FSL_MSI_H */
-- 
1.6.6-rc1.GIT

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


[PATCH v3 1/5] fsl_msi: fix the conflict of virt_msir's chip_data

2010-04-22 Thread Li Yang
In fsl_of_msi_probe(), the virt_msir's chip_data have been stored
the pointer to struct mpic. We add a struct fsl_msi_cascade_data
to store the pointer to struct fsl_msi and msir_index in hanler_data.
Otherwise, the pointer to struct mpic will be over-written, and will
cause problem when calling eoi() of the irq.

Signed-off-by: Zhao Chenhui 
Signed-off-by: Li Yang 
---
 arch/powerpc/sysdev/fsl_msi.c |   33 +++--
 1 files changed, 27 insertions(+), 6 deletions(-)

diff --git a/arch/powerpc/sysdev/fsl_msi.c b/arch/powerpc/sysdev/fsl_msi.c
index ad453ca..93a638a 100644
--- a/arch/powerpc/sysdev/fsl_msi.c
+++ b/arch/powerpc/sysdev/fsl_msi.c
@@ -21,6 +21,7 @@
 #include 
 #include 
 #include 
+#include 
 #include "fsl_msi.h"
 
 struct fsl_msi_feature {
@@ -28,6 +29,10 @@ struct fsl_msi_feature {
u32 msiir_offset;
 };
 
+struct fsl_msi_cascade_data {
+   struct fsl_msi *msi_data;
+   int index;
+};
 
 static inline u32 fsl_msi_read(u32 __iomem *base, unsigned int reg)
 {
@@ -101,7 +106,7 @@ static void fsl_teardown_msi_irqs(struct pci_dev *pdev)
list_for_each_entry(entry, &pdev->msi_list, list) {
if (entry->irq == NO_IRQ)
continue;
-   msi_data = get_irq_chip_data(entry->irq);
+   msi_data = get_irq_data(entry->irq);
set_irq_msi(entry->irq, NULL);
msi_bitmap_free_hwirqs(&msi_data->bitmap,
   virq_to_hw(entry->irq), 1);
@@ -132,7 +137,7 @@ static void fsl_compose_msi_msg(struct pci_dev *pdev, int 
hwirq,
 
 static int fsl_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type)
 {
-   int rc, hwirq;
+   int rc, hwirq = NO_IRQ;
unsigned int virq;
struct msi_desc *entry;
struct msi_msg msg;
@@ -158,6 +163,7 @@ static int fsl_setup_msi_irqs(struct pci_dev *pdev, int 
nvec, int type)
rc = -ENOSPC;
goto out_free;
}
+   set_irq_data(virq, msi_data);
set_irq_msi(virq, entry);
 
fsl_compose_msi_msg(pdev, hwirq, &msg, msi_data);
@@ -172,11 +178,15 @@ out_free:
 static void fsl_msi_cascade(unsigned int irq, struct irq_desc *desc)
 {
unsigned int cascade_irq;
-   struct fsl_msi *msi_data = get_irq_chip_data(irq);
+   struct fsl_msi *msi_data;
int msir_index = -1;
u32 msir_value = 0;
u32 intr_index;
u32 have_shift = 0;
+   struct fsl_msi_cascade_data *cascade_data;
+
+   cascade_data = (struct fsl_msi_cascade_data *)get_irq_data(irq);
+   msi_data = cascade_data->msi_data;
 
spin_lock(&desc->lock);
if ((msi_data->feature &  FSL_PIC_IP_MASK) == FSL_PIC_IP_IPIC) {
@@ -191,7 +201,7 @@ static void fsl_msi_cascade(unsigned int irq, struct 
irq_desc *desc)
if (unlikely(desc->status & IRQ_INPROGRESS))
goto unlock;
 
-   msir_index = (int)desc->handler_data;
+   msir_index = cascade_data->index;
 
if (msir_index >= NR_MSI_REG)
cascade_irq = NO_IRQ;
@@ -243,6 +253,7 @@ static int __devinit fsl_of_msi_probe(struct of_device *dev,
int virt_msir;
const u32 *p;
struct fsl_msi_feature *features = match->data;
+   struct fsl_msi_cascade_data *cascade_data = NULL;
 
printk(KERN_DEBUG "Setting up Freescale MSI support\n");
 
@@ -309,9 +320,19 @@ static int __devinit fsl_of_msi_probe(struct of_device 
*dev,
break;
virt_msir = irq_of_parse_and_map(dev->node, i);
if (virt_msir != NO_IRQ) {
-   set_irq_data(virt_msir, (void *)i);
+   cascade_data = kzalloc(
+   sizeof(struct fsl_msi_cascade_data),
+   GFP_KERNEL);
+   if (!cascade_data) {
+   dev_err(&dev->dev,
+   "No memory for MSI cascade data\n");
+   err = -ENOMEM;
+   goto error_out;
+   }
+   cascade_data->index = i;
+   cascade_data->msi_data = msi;
+   set_irq_data(virt_msir, (void *)cascade_data);
set_irq_chained_handler(virt_msir, fsl_msi_cascade);
-   set_irq_chip_data(virt_msir, msi);
}
}
 
-- 
1.6.6-rc1.GIT

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