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

2010-07-23 Thread Stefan Roese
Hi Marri,

On Friday 23 July 2010 02:57:18 tma...@amcc.com wrote:
 From: Tirumala Marri tma...@amcc.com
 
   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][RFC] preempt_count corruption across H_CEDE call with CONFIG_PREEMPT on pseries

2010-07-23 Thread Vaidyanathan Srinivasan
* Benjamin Herrenschmidt b...@kernel.crashing.org [2010-07-23 15:11:00]:

 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 ?

Decrementer expiry event handling is bit complex.  The event as such
may not bring back the extended_cede_processor() cpu, but may be
marked pending when we get out of this state eventually.  I will find
more information on this event and update.

  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.

Yes.  We will immediately return to the extended_cede_processor() in
the while loop until the preferred_offline_state is changed.

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


[next-20100722] drivers/input/serio/i8042.ko undefined error Bad Relocations warning

2010-07-23 Thread Subrata Modak
With linux-next-20100722 on Power7 and allmodconfig, i get the following
undefined error and Bad relocation warning:

ERROR: of_i8042_kbd_irq [drivers/input/serio/i8042.ko] undefined!
ERROR: of_i8042_aux_irq [drivers/input/serio/i8042.ko] undefined!

...
and
...

WARNING: 3 bad relocations
c0008590 R_PPC64_ADDR32.text+0x40008460
c0008594 R_PPC64_ADDR32.text+0x40008598
c0add890 R_PPC64_ADDR64__crc_softirq_work_list

I reported the above on 2.6.35-rc5 alone few days back:
http://marc.info/?t=12791938332r=1w=2,

However,
c0add890 R_PPC64_ADDR64__crc_softirq_work_list

is newly seen apart from:
c0008590 R_PPC64_ADDR32.text+0x40008460
c0008594 R_PPC64_ADDR32.text+0x40008598

Regards--
Subrata


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


Where can I get help about crosstool commands on powerpc?

2010-07-23 Thread Judy
I've just installed crosstool 0.43 for powerpc 405, and got the following
commands:

powerpc-405-linux-gnu-ar

powerpc-405-linux-gnu-as

powerpc-405-linux-gnu-c++

powerpc-405-linux-gnu-c++filt

powerpc-405-linux-gnu-cpp

powerpc-405-linux-gnu-g++

powerpc-405-linux-gnu-gcc

powerpc-405-linux-gnu-gcc-4.1.0

powerpc-405-linux-gnu-gccbug

powerpc-405-linux-gnu-gcov

powerpc-405-linux-gnu-gprof

powerpc-405-linux-gnu-ld

powerpc-405-linux-gnu-nm

powerpc-405-linux-gnu-objcopy

powerpc-405-linux-gnu-objdump

powerpc-405-linux-gnu-ranlib

powerpc-405-linux-gnu-readelf

powerpc-405-linux-gnu-size

powerpc-405-linux-gnu-strings

powerpc-405-linux-gnu-strip

I'm quite confused by the usage of these commands. I wanna know how to use
them. I've searched the man directories and help doc, but found little
information. Where can I get some help in detail?

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

Re: [PATCH v2] powerpc/kexec: Switch to a static PACA on the way out

2010-07-23 Thread Michael Ellerman
On Thu, 2010-07-08 at 17:55 +1000, Matt Evans wrote:
 With dynamic PACAs, the kexecing CPU's PACA won't lie within the kernel
 static data and there is a chance that something may stomp it when preparing
 to kexec.  This patch switches this final CPU to a static PACA just before
 we pull the switch.
 
 Signed-off-by: Matt Evans m...@ozlabs.org
 ---
 v2:   Changes from Milton's review:
   - Use setup_paca() and move from setup_64.c,
   - SLB cache inval. not required,
   - Adjust 'paca' (oops..), and
   - Poison data_offset/per_cpu_offset
 
  arch/powerpc/include/asm/paca.h|2 +-
  arch/powerpc/kernel/machine_kexec_64.c |   20 
  arch/powerpc/kernel/paca.c |   10 ++
  arch/powerpc/kernel/setup_64.c |   10 --
  4 files changed, 31 insertions(+), 11 deletions(-)
 
 diff --git a/arch/powerpc/include/asm/paca.h b/arch/powerpc/include/asm/paca.h
 index 8ce7963..1ff6662 100644
 --- a/arch/powerpc/include/asm/paca.h
 +++ b/arch/powerpc/include/asm/paca.h
 @@ -146,7 +146,7 @@ struct paca_struct {
  extern struct paca_struct *paca;
  extern __initdata struct paca_struct boot_paca;
  extern void initialise_paca(struct paca_struct *new_paca, int cpu);
 -
 +extern void setup_paca(struct paca_struct *new_paca);
  extern void allocate_pacas(void);
  extern void free_unused_pacas(void);
  
 diff --git a/arch/powerpc/kernel/machine_kexec_64.c 
 b/arch/powerpc/kernel/machine_kexec_64.c
 index 26f9900..c4d0123 100644
 --- a/arch/powerpc/kernel/machine_kexec_64.c
 +++ b/arch/powerpc/kernel/machine_kexec_64.c
 @@ -273,6 +273,12 @@ static void kexec_prepare_cpus(void)
  static union thread_union kexec_stack __init_task_data =
   { };
  
 +/*
 + * For similar reasons to the stack above, the kexecing CPU needs to be on a
 + * static PACA; we switch to kexec_paca.
 + */
 +struct paca_struct kexec_paca;
 +

Hopelessly late probably but .. we could use boot_paca which already
exists and is static.

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

[PATCH v3 2/2] powerpc/mpc5121: add initial support for PDM360NG board

2010-07-23 Thread Anatolij Gustschin
Adds IFM PDM360NG device tree, and platform code.

Currently following is supported:
 - Spansion S29GL512P 256 MB NOR flash
 - ST Micro NAND 1 GiB flash
 - DIU, please use fbcon=map:5 video=fslfb:800x480...@60
   at the kernel command line to enable PrimeView PM070WL3
   Display support.
 - FEC
 - I2C
 - RTC, EEPROM
 - MSCAN
 - PSC UART, please pass console=tty0 console=ttyPSC5,115200
   on the kernel command line.
 - SPI, ADS7845 Touchscreen
 - USB0/1 Host
 - USB0 OTG Host/Device
 - VIU, Overlay/Capture support

Signed-off-by: Markus Fischer markus.fischer...@ifm.com
Signed-off-by: Wolfgang Grandegger w...@denx.de
Signed-off-by: Michael Weiss michael.we...@ifm.com
Signed-off-by: Detlev Zundel d...@denx.de
Signed-off-by: Anatolij Gustschin ag...@denx.de
Cc: devicetree-disc...@lists.ozlabs.org
Cc: Grant Likely grant.lik...@secretlab.ca
---
v3:
 - uncomment and correct .irq_flags field of touchscreen
   platform data struct as proposed extension to this
   data struct has been accepted and merged via input tree
   a short while ago

v1 - v2:
 - fix interrupt-parent property in nfc node
 - drop #address-cells in ipic node
 - remove device_type from ethernet-phy sub-node
 - remove device_type from ethernet node
 - add aliases node for eth0, needed for MAC address
   update by U-Boot
 - removed spaces around ipic

 arch/powerpc/boot/dts/pdm360ng.dts |  432 
 arch/powerpc/platforms/512x/Kconfig|7 +
 arch/powerpc/platforms/512x/Makefile   |1 +
 arch/powerpc/platforms/512x/pdm360ng.c |  158 
 4 files changed, 598 insertions(+), 0 deletions(-)
 create mode 100644 arch/powerpc/boot/dts/pdm360ng.dts
 create mode 100644 arch/powerpc/platforms/512x/pdm360ng.c

diff --git a/arch/powerpc/boot/dts/pdm360ng.dts 
b/arch/powerpc/boot/dts/pdm360ng.dts
new file mode 100644
index 000..7dc42e9
--- /dev/null
+++ b/arch/powerpc/boot/dts/pdm360ng.dts
@@ -0,0 +1,432 @@
+/*
+ * Device Tree Source for IFM PDM360NG.
+ *
+ * Copyright 2009 - 2010 DENX Software Engineering.
+ * Anatolij Gustschin ag...@denx.de
+ *
+ * Based on MPC5121E ADS dts.
+ * Copyright 2008 Freescale Semiconductor Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ */
+
+/dts-v1/;
+
+/ {
+   model = pdm360ng;
+   compatible = ifm,pdm360ng;
+   #address-cells = 1;
+   #size-cells = 1;
+
+   aliases {
+   ethernet0 = eth0;
+   };
+
+   cpus {
+   #address-cells = 1;
+   #size-cells = 0;
+
+   PowerPC,5...@0 {
+   device_type = cpu;
+   reg = 0;
+   d-cache-line-size = 0x20; // 32 bytes
+   i-cache-line-size = 0x20; // 32 bytes
+   d-cache-size = 0x8000;// L1, 32K
+   i-cache-size = 0x8000;// L1, 32K
+   timebase-frequency = 4950;// 49.5 MHz (csb/4)
+   bus-frequency = 19800;// 198 MHz csb bus
+   clock-frequency = 39600;  // 396 MHz ppc core
+   };
+   };
+
+   memory {
+   device_type = memory;
+   reg = 0x 0x2000;  // 512MB at 0
+   };
+
+   n...@4000 {
+   compatible = fsl,mpc5121-nfc;
+   reg = 0x4000 0x10;
+   interrupts = 0x6 0x8;
+   interrupt-parent = ipic;
+   #address-cells = 0x1;
+   #size-cells = 0x1;
+   bank-width = 0x1;
+   chips = 0x1;
+
+   partit...@0 {
+   label = nand0;
+   reg = 0x0 0x4000;
+   };
+   };
+
+   s...@5000 {
+   compatible = fsl,mpc5121-sram;
+   reg = 0x5000 0x2; // 128K at 0x5000
+   };
+
+   local...@8020 {
+   compatible = fsl,mpc5121-localbus;
+   #address-cells = 2;
+   #size-cells = 1;
+   reg = 0x8020 0x40;
+
+   ranges = 0x0 0x0 0xf000 0x1000   /* Flash */
+ 0x2 0x0 0x5004 0x0002; /* CS2: MRAM */
+
+   fl...@0,0 {
+   compatible = amd,s29gl01gp, cfi-flash;
+   reg = 0 0x 0x0800
+  0 0x0800 0x0800;
+   #address-cells = 1;
+   #size-cells = 1;
+   bank-width = 4;
+   device-width = 2;
+
+   partit...@0 {
+   label = u-boot;
+   reg = 0x 0x0008;
+   read-only;
+   

[PATCH] powerpc/mpc512x: add clock structure for Video-IN (VIU) unit

2010-07-23 Thread Anatolij Gustschin
Allows using clk_get()/clk_enable()/clk_disable() for VIU
clock in the v4l2 video driver.

Signed-off-by: Hongjun Chen hong-jun.c...@freescale.com
Signed-off-by: Anatolij Gustschin ag...@denx.de
---
 arch/powerpc/platforms/512x/clock.c |   18 ++
 1 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/arch/powerpc/platforms/512x/clock.c 
b/arch/powerpc/platforms/512x/clock.c
index 4c42246..e1c5cd6 100644
--- a/arch/powerpc/platforms/512x/clock.c
+++ b/arch/powerpc/platforms/512x/clock.c
@@ -292,6 +292,15 @@ static void diu_clk_calc(struct clk *clk)
clk-rate = rate;
 }
 
+static void viu_clk_calc(struct clk *clk)
+{
+   unsigned long rate;
+
+   rate = sys_clk.rate;
+   rate /= 2;
+   clk-rate = rate;
+}
+
 static void half_clk_calc(struct clk *clk)
 {
clk-rate = clk-parent-rate / 2;
@@ -412,6 +421,14 @@ static struct clk diu_clk = {
.calc = diu_clk_calc,
 };
 
+static struct clk viu_clk = {
+   .name = viu_clk,
+   .flags = CLK_HAS_CTRL,
+   .reg = 1,
+   .bit = 18,
+   .calc = viu_clk_calc,
+};
+
 static struct clk axe_clk = {
.name = axe_clk,
.flags = CLK_HAS_CTRL,
@@ -535,6 +552,7 @@ struct clk *rate_clks[] = {
ref_clk,
sys_clk,
diu_clk,
+   viu_clk,
csb_clk,
e300_clk,
ips_clk,
-- 
1.7.0.4

___
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-23 Thread Sam Ravnborg
On Thu, Jul 22, 2010 at 07:50:08PM -0400, Sean MacLennan wrote:
 On Tue, 13 Jul 2010 11:50:24 +0200
 Sam Ravnborg s...@ravnborg.org wrote:
 
  From 851e645a7eee68380caaf026eb6d3be118876370 Mon Sep 17 00:00:00 2001
  From: Sam Ravnborg s...@ravnborg.org
  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 smaclen...@pikatech.com
  Signed-off-by: Sam Ravnborg s...@ravnborg.org
  ---
  
  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

Sorry for the bad initial subject line!
As Sean reported that the patch fixes his isuse it
deserves a:

Tested-by: Sean MacLennan smaclen...@pikatech.com

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


[PATCH v4 0/5] Rework MPC5121 DIU support (for 2.6.36)

2010-07-23 Thread Anatolij Gustschin
Support for MPC5121 DIU in mainline kernel is currently
brocken. The intention of this patch series is to provide
working 5121 DIU support in v2.6.36.

This patch series rework DIU support patches submitted
previously. Comments to the previos patch series have
been addressed, not related changes are dropped and some
changes are split out to separate patches to simplify
review. Furthermore a patch has been added to support
setting display mode using EDID block in the device tree.

v4 series is rebased to apply on current tree. Timur did
some testing of patches from previous version to ensure
that these do not break DIU support for MPC8610 HPCD.
He then has send his Acked-by, so I added it to the
related patches.

The first patch is changed to provide another complete
workaround to the observed issue as suggested by Freescale
technical support.

Anatolij Gustschin (5):
  fsl-diu-fb: fix issue with re-enabling DIU area descriptor
  fsl-diu-fb: move fsl-diu-fb.h to include/linux
  powerpc/mpc5121: shared DIU framebuffer support
  powerpc: doc/dts-bindings: update doc of FSL DIU bindings
  fsl-diu-fb: Support setting display mode using EDID

 Documentation/powerpc/dts-bindings/fsl/diu.txt |   20 ++-
 arch/powerpc/include/asm/mpc5121.h |   32 +++
 arch/powerpc/platforms/512x/mpc5121_ads.c  |2 +
 arch/powerpc/platforms/512x/mpc5121_generic.c  |2 +
 arch/powerpc/platforms/512x/mpc512x.h  |2 +
 arch/powerpc/platforms/512x/mpc512x_shared.c   |  284 
 arch/powerpc/sysdev/fsl_soc.h  |1 +
 drivers/video/Kconfig  |1 +
 drivers/video/fsl-diu-fb.c |  137 ++--
 {drivers/video = include/linux}/fsl-diu-fb.h  |0
 10 files changed, 455 insertions(+), 26 deletions(-)
 rename {drivers/video = include/linux}/fsl-diu-fb.h (100%)

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


[PATCH v4 1/5] fsl-diu-fb: fix issue with re-enabling DIU area descriptor

2010-07-23 Thread Anatolij Gustschin
On MPC5121e Rev 2.0 re-configuring the DIU area descriptor
by writing new descriptor address doesn't always work.
As a result, DIU continues to display using old area descriptor
even if the new one has been written to the descriptor register of
the plane.

Add the code from Freescale MPC5121EADS BSP for writing descriptor
addresses properly. This fixes the problem for Rev 2.0 silicon.

Signed-off-by: Anatolij Gustschin ag...@denx.de
---
v4:
 - use workaround code as suggested by FSL technical support.

v3:
 - no changes since v1

 drivers/video/fsl-diu-fb.c |   38 +++---
 1 files changed, 23 insertions(+), 15 deletions(-)

diff --git a/drivers/video/fsl-diu-fb.c b/drivers/video/fsl-diu-fb.c
index 27455ce..9b8c991 100644
--- a/drivers/video/fsl-diu-fb.c
+++ b/drivers/video/fsl-diu-fb.c
@@ -317,6 +317,17 @@ static void fsl_diu_free(void *virt, size_t size)
free_pages_exact(virt, size);
 }
 
+/*
+ * Workaround for failed writing desc register of planes.
+ * Needed with MPC5121 DIU rev 2.0 silicon.
+ */
+void wr_reg_wa(u32 *reg, u32 val)
+{
+   do {
+   out_be32(reg, val);
+   } while (in_be32(reg) != val);
+}
+
 static int fsl_diu_enable_panel(struct fb_info *info)
 {
struct mfb_info *pmfbi, *cmfbi, *mfbi = info-par;
@@ -330,7 +341,7 @@ static int fsl_diu_enable_panel(struct fb_info *info)
switch (mfbi-index) {
case 0: /* plane 0 */
if (hw-desc[0] != ad-paddr)
-   out_be32(hw-desc[0], ad-paddr);
+   wr_reg_wa(hw-desc[0], ad-paddr);
break;
case 1: /* plane 1 AOI 0 */
cmfbi = machine_data-fsl_diu_info[2]-par;
@@ -340,7 +351,7 @@ static int fsl_diu_enable_panel(struct fb_info *info)
cpu_to_le32(cmfbi-ad-paddr);
else
ad-next_ad = 0;
-   out_be32(hw-desc[1], ad-paddr);
+   wr_reg_wa(hw-desc[1], ad-paddr);
}
break;
case 3: /* plane 2 AOI 0 */
@@ -351,14 +362,14 @@ static int fsl_diu_enable_panel(struct fb_info *info)
cpu_to_le32(cmfbi-ad-paddr);
else
ad-next_ad = 0;
-   out_be32(hw-desc[2], ad-paddr);
+   wr_reg_wa(hw-desc[2], ad-paddr);
}
break;
case 2: /* plane 1 AOI 1 */
pmfbi = machine_data-fsl_diu_info[1]-par;
ad-next_ad = 0;
if (hw-desc[1] == machine_data-dummy_ad-paddr)
-   out_be32(hw-desc[1], ad-paddr);
+   wr_reg_wa(hw-desc[1], ad-paddr);
else/* AOI0 open */
pmfbi-ad-next_ad = cpu_to_le32(ad-paddr);
break;
@@ -366,7 +377,7 @@ static int fsl_diu_enable_panel(struct fb_info *info)
pmfbi = machine_data-fsl_diu_info[3]-par;
ad-next_ad = 0;
if (hw-desc[2] == machine_data-dummy_ad-paddr)
-   out_be32(hw-desc[2], ad-paddr);
+   wr_reg_wa(hw-desc[2], ad-paddr);
else/* AOI0 was open */
pmfbi-ad-next_ad = cpu_to_le32(ad-paddr);
break;
@@ -390,27 +401,24 @@ static int fsl_diu_disable_panel(struct fb_info *info)
switch (mfbi-index) {
case 0: /* plane 0 */
if (hw-desc[0] != machine_data-dummy_ad-paddr)
-   out_be32(hw-desc[0],
-   machine_data-dummy_ad-paddr);
+   wr_reg_wa(hw-desc[0], machine_data-dummy_ad-paddr);
break;
case 1: /* plane 1 AOI 0 */
cmfbi = machine_data-fsl_diu_info[2]-par;
if (cmfbi-count  0)   /* AOI1 is open */
-   out_be32(hw-desc[1], cmfbi-ad-paddr);
+   wr_reg_wa(hw-desc[1], cmfbi-ad-paddr);
/* move AOI1 to the first */
else/* AOI1 was closed */
-   out_be32(hw-desc[1],
-   machine_data-dummy_ad-paddr);
+   wr_reg_wa(hw-desc[1], machine_data-dummy_ad-paddr);
/* close AOI 0 */
 

[PATCH v4 2/5] fsl-diu-fb: move fsl-diu-fb.h to include/linux

2010-07-23 Thread Anatolij Gustschin
Some DIU structures will be used in platform code in
subsequent MPC5121 DIU patch, so we move this header
to be able to include it elsewhere.

Signed-off-by: Anatolij Gustschin ag...@denx.de
Acked-by: Timur Tabi ti...@freescale.com
---
v4:
 - added ack tag

v3:
 - no changes since v1

 drivers/video/fsl-diu-fb.c|2 +-
 {drivers/video = include/linux}/fsl-diu-fb.h |0
 2 files changed, 1 insertions(+), 1 deletions(-)
 rename {drivers/video = include/linux}/fsl-diu-fb.h (100%)

diff --git a/drivers/video/fsl-diu-fb.c b/drivers/video/fsl-diu-fb.c
index 9b8c991..48905d5 100644
--- a/drivers/video/fsl-diu-fb.c
+++ b/drivers/video/fsl-diu-fb.c
@@ -34,7 +34,7 @@
 #include linux/of_platform.h
 
 #include sysdev/fsl_soc.h
-#include fsl-diu-fb.h
+#include linux/fsl-diu-fb.h
 
 /*
  * These parameters give default parameters
diff --git a/drivers/video/fsl-diu-fb.h b/include/linux/fsl-diu-fb.h
similarity index 100%
rename from drivers/video/fsl-diu-fb.h
rename to include/linux/fsl-diu-fb.h
-- 
1.7.0.4

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


[PATCH v4 3/5] powerpc/mpc5121: shared DIU framebuffer support

2010-07-23 Thread Anatolij Gustschin
MPC5121 DIU configuration/setup as initialized by the boot
loader currently will get lost while booting Linux. As a
result displaying the boot splash is not possible through
the boot process.

To prevent this we reserve configured DIU frame buffer
address range while booting and preserve AOI descriptor
and gamma table so that DIU continues displaying through
the whole boot process. On first open from user space
DIU frame buffer driver releases the reserved frame
buffer area and continues to operate as usual.

Signed-off-by: John Rigby jcri...@gmail.com
Signed-off-by: Anatolij Gustschin ag...@denx.de
Acked-by: Timur Tabi ti...@freescale.com
Cc: Grant Likely grant.lik...@secretlab.ca
---
v4:
 - rebased to apply on current tree
 - added ack tag

v3:
 - remove generic wrappers for early_init() and
   setup_arch() and assign needed callbacks directly
   as requested by Timur
 - add comment explaning the reason for using
   reserve_bootmem()
 - use less confusing name for speed variable in
   mpc512x_set_pixel_clock() and add a comment. Also
   initialize err variable to LONG_MAX.

v1 - v2:
 - use struct for CCM register access, don't use offset macros,
   so CCM struct definition is added now
 - use struct for DIU descriptors access
 - simplify code and correct variable types as suggested by Timur

 arch/powerpc/include/asm/mpc5121.h|   32 +++
 arch/powerpc/platforms/512x/mpc5121_ads.c |2 +
 arch/powerpc/platforms/512x/mpc5121_generic.c |2 +
 arch/powerpc/platforms/512x/mpc512x.h |2 +
 arch/powerpc/platforms/512x/mpc512x_shared.c  |  284 +
 arch/powerpc/sysdev/fsl_soc.h |1 +
 drivers/video/fsl-diu-fb.c|   17 ++-
 7 files changed, 338 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/include/asm/mpc5121.h 
b/arch/powerpc/include/asm/mpc5121.h
index e6a30bb..8c0ab2c 100644
--- a/arch/powerpc/include/asm/mpc5121.h
+++ b/arch/powerpc/include/asm/mpc5121.h
@@ -21,4 +21,36 @@ struct mpc512x_reset_module {
u32 rcer;   /* Reset Control Enable Register */
 };
 
+/*
+ * Clock Control Module
+ */
+struct mpc512x_ccm {
+   u32 spmr;   /* System PLL Mode Register */
+   u32 sccr1;  /* System Clock Control Register 1 */
+   u32 sccr2;  /* System Clock Control Register 2 */
+   u32 scfr1;  /* System Clock Frequency Register 1 */
+   u32 scfr2;  /* System Clock Frequency Register 2 */
+   u32 scfr2s; /* System Clock Frequency Shadow Register 2 */
+   u32 bcr;/* Bread Crumb Register */
+   u32 p0ccr;  /* PSC0 Clock Control Register */
+   u32 p1ccr;  /* PSC1 CCR */
+   u32 p2ccr;  /* PSC2 CCR */
+   u32 p3ccr;  /* PSC3 CCR */
+   u32 p4ccr;  /* PSC4 CCR */
+   u32 p5ccr;  /* PSC5 CCR */
+   u32 p6ccr;  /* PSC6 CCR */
+   u32 p7ccr;  /* PSC7 CCR */
+   u32 p8ccr;  /* PSC8 CCR */
+   u32 p9ccr;  /* PSC9 CCR */
+   u32 p10ccr; /* PSC10 CCR */
+   u32 p11ccr; /* PSC11 CCR */
+   u32 spccr;  /* SPDIF Clock Control Register */
+   u32 cccr;   /* CFM Clock Control Register */
+   u32 dccr;   /* DIU Clock Control Register */
+   u32 m1ccr;  /* MSCAN1 CCR */
+   u32 m2ccr;  /* MSCAN2 CCR */
+   u32 m3ccr;  /* MSCAN3 CCR */
+   u32 m4ccr;  /* MSCAN4 CCR */
+   u8  res[0x98]; /* Reserved */
+};
 #endif /* __ASM_POWERPC_MPC5121_H__ */
diff --git a/arch/powerpc/platforms/512x/mpc5121_ads.c 
b/arch/powerpc/platforms/512x/mpc5121_ads.c
index ee6ae12..dcef6ad 100644
--- a/arch/powerpc/platforms/512x/mpc5121_ads.c
+++ b/arch/powerpc/platforms/512x/mpc5121_ads.c
@@ -42,6 +42,7 @@ static void __init mpc5121_ads_setup_arch(void)
for_each_compatible_node(np, pci, fsl,mpc5121-pci)
mpc83xx_add_bridge(np);
 #endif
+   mpc512x_setup_diu();
 }
 
 static void __init mpc5121_ads_init_IRQ(void)
@@ -65,6 +66,7 @@ define_machine(mpc5121_ads) {
.probe  = mpc5121_ads_probe,
.setup_arch = mpc5121_ads_setup_arch,
.init   = mpc512x_init,
+   .init_early = mpc512x_init_diu,
.init_IRQ   = mpc5121_ads_init_IRQ,
.get_irq= ipic_get_irq,
.calibrate_decr = generic_calibrate_decr,
diff --git a/arch/powerpc/platforms/512x/mpc5121_generic.c 
b/arch/powerpc/platforms/512x/mpc5121_generic.c
index a6c0e3a..e487eb0 100644
--- a/arch/powerpc/platforms/512x/mpc5121_generic.c
+++ b/arch/powerpc/platforms/512x/mpc5121_generic.c
@@ -52,6 +52,8 @@ define_machine(mpc5121_generic) {
.name   = MPC5121 generic,
.probe  = mpc5121_generic_probe,
.init   = mpc512x_init,
+   .init_early = mpc512x_init_diu,
+   .setup_arch = mpc512x_setup_diu,
.init_IRQ   = 

[PATCH v4 4/5] powerpc: doc/dts-bindings: update doc of FSL DIU bindings

2010-07-23 Thread Anatolij Gustschin
Update compatible and interrupt properties description.
Furthermore an example for the MPC5121 has been added.

Signed-off-by: Anatolij Gustschin ag...@denx.de
Acked-by: Timur Tabi ti...@freescale.com
Cc: devicetree-disc...@lists.ozlabs.org
---
v4:
 - added ack tag

v2 and v3:
 - no changes since v1

 Documentation/powerpc/dts-bindings/fsl/diu.txt |   14 --
 1 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/Documentation/powerpc/dts-bindings/fsl/diu.txt 
b/Documentation/powerpc/dts-bindings/fsl/diu.txt
index deb35de..326cddf 100644
--- a/Documentation/powerpc/dts-bindings/fsl/diu.txt
+++ b/Documentation/powerpc/dts-bindings/fsl/diu.txt
@@ -4,10 +4,12 @@ The Freescale DIU is a LCD controller, with proper hardware, 
it can also
 drive DVI monitors.
 
 Required properties:
-- compatible : should be fsl-diu.
+- compatible : should be fsl,diu or fsl,mpc5121-diu.
 - reg : should contain at least address and length of the DIU register
   set.
-- Interrupts : one DIU interrupt should be describe here.
+- interrupts : one DIU interrupt should be described here.
+- interrupt-parent : the phandle for the interrupt controller that
+  services interrupts for this device.
 
 Example (MPC8610HPCD):
disp...@2c000 {
@@ -16,3 +18,11 @@ Example (MPC8610HPCD):
interrupts = 72 2;
interrupt-parent = mpic;
};
+
+Example for MPC5121:
+   disp...@2100 {
+   compatible = fsl,mpc5121-diu;
+   reg = 0x2100 0x100;
+   interrupts = 64 0x8;
+   interrupt-parent = ipic;
+   };
-- 
1.7.0.4

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


[PATCH v4 5/5] fsl-diu-fb: Support setting display mode using EDID

2010-07-23 Thread Anatolij Gustschin
Adds support for encoding display mode information
in the device tree using verbatim EDID block.

If the EDID entry in the DIU node is present, the
driver will build mode database using EDID data
and allow setting the display modes from this database.
Otherwise display mode will be set using mode
entries from driver's internal database as usual.

This patch also updates device tree bindings.

Signed-off-by: Anatolij Gustschin ag...@denx.de
Acked-by: Timur Tabi ti...@freescale.com
Cc: devicetree-disc...@lists.ozlabs.org
---
v4:
 - rebased to apply on current tree
 - added ack tag

v3:
 - no changes

v1 - v2:
 - fix EDID property to be lower-case
 - use u8 * type for EDID block pointer
 - simplify info-monspecs.modedb != NULL condition test

 Documentation/powerpc/dts-bindings/fsl/diu.txt |6 ++
 drivers/video/Kconfig  |1 +
 drivers/video/fsl-diu-fb.c |   80 ++--
 3 files changed, 81 insertions(+), 6 deletions(-)

diff --git a/Documentation/powerpc/dts-bindings/fsl/diu.txt 
b/Documentation/powerpc/dts-bindings/fsl/diu.txt
index 326cddf..b66cb6d 100644
--- a/Documentation/powerpc/dts-bindings/fsl/diu.txt
+++ b/Documentation/powerpc/dts-bindings/fsl/diu.txt
@@ -11,6 +11,11 @@ Required properties:
 - interrupt-parent : the phandle for the interrupt controller that
   services interrupts for this device.
 
+Optional properties:
+- edid : verbatim EDID data block describing attached display.
+  Data from the detailed timing descriptor will be used to
+  program the display controller.
+
 Example (MPC8610HPCD):
disp...@2c000 {
compatible = fsl,diu;
@@ -25,4 +30,5 @@ Example for MPC5121:
reg = 0x2100 0x100;
interrupts = 64 0x8;
interrupt-parent = ipic;
+   edid = [edid-data];
};
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
index a9f9e5e..c01b648 100644
--- a/drivers/video/Kconfig
+++ b/drivers/video/Kconfig
@@ -1871,6 +1871,7 @@ config FB_MBX_DEBUG
 config FB_FSL_DIU
tristate Freescale DIU framebuffer support
depends on FB  FSL_SOC
+   select FB_MODE_HELPERS
select FB_CFB_FILLRECT
select FB_CFB_COPYAREA
select FB_CFB_IMAGEBLIT
diff --git a/drivers/video/fsl-diu-fb.c b/drivers/video/fsl-diu-fb.c
index db3e360..e38ad22 100644
--- a/drivers/video/fsl-diu-fb.c
+++ b/drivers/video/fsl-diu-fb.c
@@ -35,6 +35,7 @@
 
 #include sysdev/fsl_soc.h
 #include linux/fsl-diu-fb.h
+#include edid.h
 
 /*
  * These parameters give default parameters
@@ -217,6 +218,7 @@ struct mfb_info {
int x_aoi_d;/* aoi display x offset to physical screen */
int y_aoi_d;/* aoi display y offset to physical screen */
struct fsl_diu_data *parent;
+   u8 *edid_data;
 };
 
 
@@ -1185,18 +1187,30 @@ static int __devinit install_fb(struct fb_info *info)
int rc;
struct mfb_info *mfbi = info-par;
const char *aoi_mode, *init_aoi_mode = 320x240;
+   struct fb_videomode *db = fsl_diu_mode_db;
+   unsigned int dbsize = ARRAY_SIZE(fsl_diu_mode_db);
+   int has_default_mode = 1;
 
if (init_fbinfo(info))
return -EINVAL;
 
-   if (mfbi-index == 0)   /* plane 0 */
+   if (mfbi-index == 0) { /* plane 0 */
+   if (mfbi-edid_data) {
+   /* Now build modedb from EDID */
+   fb_edid_to_monspecs(mfbi-edid_data, info-monspecs);
+   fb_videomode_to_modelist(info-monspecs.modedb,
+info-monspecs.modedb_len,
+info-modelist);
+   db = info-monspecs.modedb;
+   dbsize = info-monspecs.modedb_len;
+   }
aoi_mode = fb_mode;
-   else
+   } else {
aoi_mode = init_aoi_mode;
+   }
pr_debug(mode used = %s\n, aoi_mode);
-   rc = fb_find_mode(info-var, info, aoi_mode, fsl_diu_mode_db,
-ARRAY_SIZE(fsl_diu_mode_db), fsl_diu_default_mode, default_bpp);
-
+   rc = fb_find_mode(info-var, info, aoi_mode, db, dbsize,
+ fsl_diu_default_mode, default_bpp);
switch (rc) {
case 1:
pr_debug(using mode specified in @mode\n);
@@ -1214,10 +1228,50 @@ static int __devinit install_fb(struct fb_info *info)
default:
pr_debug(rc = %d\n, rc);
pr_debug(failed to find mode\n);
-   return -EINVAL;
+   /*
+* For plane 0 we continue and look into
+* driver's internal modedb.
+*/
+   if (mfbi-index == 0  mfbi-edid_data)
+   has_default_mode = 0;
+   else
+   return -EINVAL;
break;
}
 
+   if (!has_default_mode) {
+   rc = 

[PATCH] i2c: adapt i2c_ram struct according to MPC8272 manual

2010-07-23 Thread Holger brunck
Additionaly to the MPC8260, the MPC8272 I2C PRAM memory map
has an additional entry for the SDMATMP (word). This patch
adds this at offset 0x34 to the i2c_ram struct.

Signed-off-by: Holger Brunck holger.bru...@keymile.com
---
 drivers/i2c/busses/i2c-cpm.c |3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/i2c/busses/i2c-cpm.c b/drivers/i2c/busses/i2c-cpm.c
index a6dbfb1..95d204f 100644
--- a/drivers/i2c/busses/i2c-cpm.c
+++ b/drivers/i2c/busses/i2c-cpm.c
@@ -77,7 +77,8 @@ struct i2c_ram {
uinttxtmp;  /* Internal */
charres1[4];/* Reserved */
ushort  rpbase; /* Relocation pointer */
-   charres2[2];/* Reserved */
+   charres2[6];/* Reserved */
+   uintsdmatmp;/* Internal */
 };

 #define I2COM_START0x80
-- 
1.7.0.5

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


[PATCH] PCI: MSI: Restore read_msi_msg_desc(); add get_cached_msi_msg_desc()

2010-07-23 Thread Ben Hutchings
commit 2ca1af9aa3285c6a5f103ed31ad09f7399fc65d7 PCI: MSI: Remove
unsafe and unnecessary hardware access changed read_msi_msg_desc() to
return the last MSI message written instead of reading it from the
device, since it may be called while the device is in a reduced
power state.

However, the pSeries platform code really does need to read messages
from the device, since they are initially written by firmware.
Therefore:
- Restore the previous behaviour of read_msi_msg_desc()
- Add new functions get_cached_msi_msg{,_desc}() which return the
  last MSI message written
- Use the new functions where appropriate

Signed-off-by: Ben Hutchings bhutchi...@solarflare.com
---
Compile-tested only.

Ben.

 arch/ia64/kernel/msi_ia64.c|2 +-
 arch/ia64/sn/kernel/msi_sn.c   |2 +-
 arch/x86/kernel/apic/io_apic.c |2 +-
 drivers/pci/msi.c  |   47 +++
 include/linux/msi.h|2 +
 5 files changed, 47 insertions(+), 8 deletions(-)

diff --git a/arch/ia64/kernel/msi_ia64.c b/arch/ia64/kernel/msi_ia64.c
index 6c89228..4a746ea 100644
--- a/arch/ia64/kernel/msi_ia64.c
+++ b/arch/ia64/kernel/msi_ia64.c
@@ -25,7 +25,7 @@ static int ia64_set_msi_irq_affinity(unsigned int irq,
if (irq_prepare_move(irq, cpu))
return -1;
 
-   read_msi_msg(irq, msg);
+   get_cached_msi_msg(irq, msg);
 
addr = msg.address_lo;
addr = MSI_ADDR_DEST_ID_MASK;
diff --git a/arch/ia64/sn/kernel/msi_sn.c b/arch/ia64/sn/kernel/msi_sn.c
index ebfdd6a..0c72dd4 100644
--- a/arch/ia64/sn/kernel/msi_sn.c
+++ b/arch/ia64/sn/kernel/msi_sn.c
@@ -175,7 +175,7 @@ static int sn_set_msi_irq_affinity(unsigned int irq,
 * Release XIO resources for the old MSI PCI address
 */
 
-   read_msi_msg(irq, msg);
+   get_cached_msi_msg(irq, msg);
 sn_pdev = (struct pcidev_info *)sn_irq_info-irq_pciioinfo;
pdev = sn_pdev-pdi_linux_pcidev;
provider = SN_PCIDEV_BUSPROVIDER(pdev);
diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c
index e41ed24..4dc0084 100644
--- a/arch/x86/kernel/apic/io_apic.c
+++ b/arch/x86/kernel/apic/io_apic.c
@@ -3397,7 +3397,7 @@ static int set_msi_irq_affinity(unsigned int irq, const 
struct cpumask *mask)
 
cfg = desc-chip_data;
 
-   read_msi_msg_desc(desc, msg);
+   get_cached_msi_msg_desc(desc, msg);
 
msg.data = ~MSI_DATA_VECTOR_MASK;
msg.data |= MSI_DATA_VECTOR(cfg-vector);
diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
index 4c14f31..69b7be3 100644
--- a/drivers/pci/msi.c
+++ b/drivers/pci/msi.c
@@ -197,9 +197,46 @@ void read_msi_msg_desc(struct irq_desc *desc, struct 
msi_msg *msg)
 {
struct msi_desc *entry = get_irq_desc_msi(desc);
 
-   /* We do not touch the hardware (which may not even be
-* accessible at the moment) but return the last message
-* written.  Assert that this is valid, assuming that
+   BUG_ON(entry-dev-current_state != PCI_D0);
+
+   if (entry-msi_attrib.is_msix) {
+   void __iomem *base = entry-mask_base +
+   entry-msi_attrib.entry_nr * PCI_MSIX_ENTRY_SIZE;
+
+   msg-address_lo = readl(base + PCI_MSIX_ENTRY_LOWER_ADDR);
+   msg-address_hi = readl(base + PCI_MSIX_ENTRY_UPPER_ADDR);
+   msg-data = readl(base + PCI_MSIX_ENTRY_DATA);
+   } else {
+   struct pci_dev *dev = entry-dev;
+   int pos = entry-msi_attrib.pos;
+   u16 data;
+
+   pci_read_config_dword(dev, msi_lower_address_reg(pos),
+   msg-address_lo);
+   if (entry-msi_attrib.is_64) {
+   pci_read_config_dword(dev, msi_upper_address_reg(pos),
+   msg-address_hi);
+   pci_read_config_word(dev, msi_data_reg(pos, 1), data);
+   } else {
+   msg-address_hi = 0;
+   pci_read_config_word(dev, msi_data_reg(pos, 0), data);
+   }
+   msg-data = data;
+   }
+}
+
+void read_msi_msg(unsigned int irq, struct msi_msg *msg)
+{
+   struct irq_desc *desc = irq_to_desc(irq);
+
+   read_msi_msg_desc(desc, msg);
+}
+
+void get_cached_msi_msg_desc(struct irq_desc *desc, struct msi_msg *msg)
+{
+   struct msi_desc *entry = get_irq_desc_msi(desc);
+
+   /* Assert that the cache is valid, assuming that
 * valid messages are not all-zeroes. */
BUG_ON(!(entry-msg.address_hi | entry-msg.address_lo |
 entry-msg.data));
@@ -207,11 +244,11 @@ void read_msi_msg_desc(struct irq_desc *desc, struct 
msi_msg *msg)
*msg = entry-msg;
 }
 
-void read_msi_msg(unsigned int irq, struct msi_msg *msg)
+void get_cached_msi_msg(unsigned int irq, struct msi_msg *msg)
 {
struct irq_desc *desc = irq_to_desc(irq);
 
-   read_msi_msg_desc(desc, msg);
+   

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

2010-07-23 Thread Will Schmidt
dvh...@linux.vnet.ibm.com wrote on 07/22/2010 06:57:18 PM:
 Subject

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

 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: 

I'm not seeing the preempt_count value corrupted with my current set of
debug, however, I have added buffers to the thread_info struct, so
wonder if I've moved the preempt_count variable out of the way of
the corruption.  (Still investigating that point..)

Why..   because I had been trying to set a DABR on the preempt_count
value to catch the corrupter, and due to hits on the nearby _flags fields,
getting
false positives..


struct thread_info {
|---struct task_struct *task;|--|---/* main task structure */
|---struct exec_domain *exec_domain;|---/* execution domain */
|---int||---cpu;|---|---|---/* cpu we're on */
|---int||---pad_buffer[64];
|---int||---preempt_count;|-|---/* 0 = preemptable,
|---|---|---|---|---|---   0 = BUG */
|---int||---pad_buffer2[256];
|---struct restart_block restart_block;
|---unsigned long|--local_flags;|---|---/* private flags for thread
*/

|---/* low level flags - has atomic operations done on it */
|---unsigned long|--flags cacheline_aligned_in_smp;
};



 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


problems flashing custom board

2010-07-23 Thread moises dominguez
Hi,

I am having problems programming u-boot(from ltib) in ads5121 based custom
board with CodeWarrior USB TAP(sector not erased). I hope you could help me.

Instead of 64 MB NOR flash(2xS29-GL256P) I am using a 16 MB (S29-GL128P) in
muxed-mode. I have choosen 5121ADS_init_sram_flash.cfg as base file, and
modified flash size and configuration on this way:
..
- writemem.l 0x8020 0xfc00fcff // CS0 from 0xfc00_ to
0xfcff_, 16 MB flash
- writemem.l 0x8001 0x05059110 //16 bit data, muxed mode
...

I have doubts about RST_CONF_LOC and RST_CONF_BMS; afaik, this two bits
select where u-boot should be programed, am I wrong? but, according
RST_CONF_BMS description there are only two boot start possible address for
CS0:
- 0x_ if BMS=0
- 0XFFF0_ if BMS=1 (as in eval. board).

But, if I map my flash to 0xfc00_.. it does not reach oxfff0_.. I
tried to map it to 0x_ (where SRAM is according cfg) and SRAM to
0xfc00_ but  I got : flash ID error (as if flash driver could not be
loaded?) Can u-boot be programed to any flash position? and .. can SRAM not
be mapped to any position different to cero?

I read too that we should change TEXT_BASE u-boot macro. I changed it to
0xFC00_ that is where I want to have u-boot.. but no success.

Regards,

Moises.
___
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-23 Thread Liam Girdwood
On Thu, 2010-07-22 at 13:43 -0500, Kumar Gala wrote:
 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 ti...@freescale.com
  
  Acked-by: Mark Brown broo...@opensource.wolfsonmicro.com
 
 Acked-by: Kumar Gala ga...@kernel.crashing.org
 
 - k

Applied.

Thanks

Liam
-- 
Freelance Developer, SlimLogic Ltd
ASoC and Voltage Regulator Maintainer.
http://www.slimlogic.co.uk

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


[PATCH][v2] fix of_flat_dt_is_compatible to match the full compatible string

2010-07-23 Thread Stuart Yoder
From: Stuart Yoder stuart.yo...@freescale.com

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 stuart.yo...@freescale.com
---
 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..28c0c2b 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 (!strcasecmp(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


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

2010-07-23 Thread Dan Williams
On Thu, Jul 22, 2010 at 11:15 PM, Stefan Roese s...@denx.de wrote:
 Hi Marri,

 On Friday 23 July 2010 02:57:18 tma...@amcc.com wrote:
 From: Tirumala Marri tma...@amcc.com

   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?


Yes, and you might look to drivers/dma/iop-adma.c as an example of a
way to support similar hardware with a single code base.

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


[PATCH] of: make of_find_device_by_node generic

2010-07-23 Thread Grant Likely
From: Jonas Bonn jo...@southpole.se

There's no need for this function to be architecture specific and all four
architectures defining it had the same definition.  The function has been
moved to drivers/of/platform.c.

Signed-off-by: Jonas Bonn jo...@southpole.se
[grant.lik...@secretlab.ca: moved to drivers/of/platform.c, simplified code, 
and added kerneldoc comment]
Signed-off-by: Grant Likely grant.lik...@secretlab.ca
---
 arch/microblaze/kernel/of_platform.c |   16 
 arch/powerpc/kernel/of_platform.c|   16 
 arch/sparc/kernel/of_device_common.c |   20 
 drivers/of/platform.c|   20 
 4 files changed, 20 insertions(+), 52 deletions(-)

diff --git a/arch/microblaze/kernel/of_platform.c 
b/arch/microblaze/kernel/of_platform.c
index c664b27..6cffadb 100644
--- a/arch/microblaze/kernel/of_platform.c
+++ b/arch/microblaze/kernel/of_platform.c
@@ -47,19 +47,3 @@ const struct of_device_id of_default_bus_ids[] = {
{ .type = simple, },
{},
 };
-
-static int of_dev_node_match(struct device *dev, void *data)
-{
-   return to_platform_device(dev)-dev.of_node == data;
-}
-
-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_platform_device(dev);
-   return NULL;
-}
-EXPORT_SYMBOL(of_find_device_by_node);
diff --git a/arch/powerpc/kernel/of_platform.c 
b/arch/powerpc/kernel/of_platform.c
index 84439d1..760a7af 100644
--- a/arch/powerpc/kernel/of_platform.c
+++ b/arch/powerpc/kernel/of_platform.c
@@ -52,22 +52,6 @@ const struct of_device_id of_default_bus_ids[] = {
{},
 };
 
-static int of_dev_node_match(struct device *dev, void *data)
-{
-   return to_platform_device(dev)-dev.of_node == data;
-}
-
-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_platform_device(dev);
-   return NULL;
-}
-EXPORT_SYMBOL(of_find_device_by_node);
-
 #ifdef CONFIG_PPC_OF_PLATFORM_PCI
 
 /* The probing of PCI controllers from of_platform is currently
diff --git a/arch/sparc/kernel/of_device_common.c 
b/arch/sparc/kernel/of_device_common.c
index e80729b..49ddff5 100644
--- a/arch/sparc/kernel/of_device_common.c
+++ b/arch/sparc/kernel/of_device_common.c
@@ -11,26 +11,6 @@
 
 #include of_device_common.h
 
-static int node_match(struct device *dev, void *data)
-{
-   struct platform_device *op = to_platform_device(dev);
-   struct device_node *dp = data;
-
-   return (op-dev.of_node == dp);
-}
-
-struct platform_device *of_find_device_by_node(struct device_node *dp)
-{
-   struct device *dev = bus_find_device(platform_bus_type, NULL,
-dp, node_match);
-
-   if (dev)
-   return to_platform_device(dev);
-
-   return NULL;
-}
-EXPORT_SYMBOL(of_find_device_by_node);
-
 unsigned int irq_of_parse_and_map(struct device_node *node, int index)
 {
struct platform_device *op = of_find_device_by_node(node);
diff --git a/drivers/of/platform.c b/drivers/of/platform.c
index 9b2d5b1..9126064 100644
--- a/drivers/of/platform.c
+++ b/drivers/of/platform.c
@@ -22,6 +22,26 @@
 #include linux/of_platform.h
 #include linux/platform_device.h
 
+static int of_dev_node_match(struct device *dev, void *data)
+{
+   return dev-of_node == data;
+}
+
+/**
+ * of_find_device_by_node - Find the platform_device associated with a node
+ * @np: Pointer to device tree node
+ *
+ * Returns platform_device pointer, or NULL if not found
+ */
+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);
+   return dev ? to_platform_device(dev) : NULL;
+}
+EXPORT_SYMBOL(of_find_device_by_node);
+
 static int platform_driver_probe_shim(struct platform_device *pdev)
 {
struct platform_driver *pdrv;

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


[PATCH] of: remove of_default_bus_ids

2010-07-23 Thread Grant Likely
From: Jonas Bonn jo...@southpole.se

This list used was by only two platforms with all other platforms defining an
own list of valid bus id's to pass to of_platform_bus_probe.  This patch:

i)   copies the default list to the two platforms that depended on it (powerpc)
ii)  remove the usage of of_default_bus_ids in of_platform_bus_probe
iii) removes the definition of the list from all architectures that defined it

Passing a NULL 'matches' parameter to of_platform_bus_probe is still valid; the
function returns no error in that case as the NULL value is equivalent to an
empty list.

Signed-off-by: Jonas Bonn jo...@southpole.se
[grant.lik...@secretlab.ca: added __initdata annotations, warn on and return 
error on missing match table, and fix whitespace errors]
Signed-off-by: Grant Likely grant.lik...@secretlab.ca
---
 arch/microblaze/kernel/Makefile   |2 +
 arch/microblaze/kernel/of_platform.c  |   49 -
 arch/powerpc/kernel/of_platform.c |   24 --
 arch/powerpc/platforms/cell/qpace_setup.c |   14 
 arch/powerpc/platforms/cell/setup.c   |   14 
 drivers/of/platform.c |4 +-
 include/linux/of_platform.h   |2 -
 7 files changed, 28 insertions(+), 81 deletions(-)
 delete mode 100644 arch/microblaze/kernel/of_platform.c

diff --git a/arch/microblaze/kernel/Makefile b/arch/microblaze/kernel/Makefile
index 727e2cb..7fcc5f7 100644
--- a/arch/microblaze/kernel/Makefile
+++ b/arch/microblaze/kernel/Makefile
@@ -16,7 +16,7 @@ extra-y := head.o vmlinux.lds
 
 obj-y += dma.o exceptions.o \
hw_exception_handler.o init_task.o intc.o irq.o \
-   of_platform.o process.o prom.o prom_parse.o ptrace.o \
+   process.o prom.o prom_parse.o ptrace.o \
setup.o signal.o sys_microblaze.o timer.o traps.o reset.o
 
 obj-y += cpu/
diff --git a/arch/microblaze/kernel/of_platform.c 
b/arch/microblaze/kernel/of_platform.c
deleted file mode 100644
index 6cffadb..000
--- a/arch/microblaze/kernel/of_platform.c
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- *Copyright (C) 2006 Benjamin Herrenschmidt, IBM Corp.
- *  b...@kernel.crashing.org
- *and   Arnd Bergmann, IBM Corp.
- *
- *  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.
- *
- */
-
-#undef DEBUG
-
-#include linux/string.h
-#include linux/kernel.h
-#include linux/init.h
-#include linux/module.h
-#include linux/mod_devicetable.h
-#include linux/pci.h
-#include linux/of.h
-#include linux/of_device.h
-#include linux/of_platform.h
-
-#include linux/errno.h
-#include linux/topology.h
-#include asm/atomic.h
-
-/*
- * The list of OF IDs below is used for matching bus types in the
- * system whose devices are to be exposed as of_platform_devices.
- *
- * This is the default list valid for most platforms. This file provides
- * functions who can take an explicit list if necessary though
- *
- * The search is always performed recursively looking for children of
- * the provided device_node and recursively if such a children matches
- * a bus type in the list
- */
-
-const struct of_device_id of_default_bus_ids[] = {
-   { .type = soc, },
-   { .compatible = soc, },
-   { .type = plb5, },
-   { .type = plb4, },
-   { .type = opb, },
-   { .type = simple, },
-   {},
-};
diff --git a/arch/powerpc/kernel/of_platform.c 
b/arch/powerpc/kernel/of_platform.c
index 760a7af..b2c363e 100644
--- a/arch/powerpc/kernel/of_platform.c
+++ b/arch/powerpc/kernel/of_platform.c
@@ -28,30 +28,6 @@
 #include asm/ppc-pci.h
 #include asm/atomic.h
 
-/*
- * The list of OF IDs below is used for matching bus types in the
- * system whose devices are to be exposed as of_platform_devices.
- *
- * This is the default list valid for most platforms. This file provides
- * functions who can take an explicit list if necessary though
- *
- * The search is always performed recursively looking for children of
- * the provided device_node and recursively if such a children matches
- * a bus type in the list
- */
-
-const struct of_device_id of_default_bus_ids[] = {
-   { .type = soc, },
-   { .compatible = soc, },
-   { .type = spider, },
-   { .type = axon, },
-   { .type = plb5, },
-   { .type = plb4, },
-   { .type = opb, },
-   { .type = ebc, },
-   {},
-};
-
 #ifdef CONFIG_PPC_OF_PLATFORM_PCI
 
 /* The probing of PCI controllers from of_platform is currently
diff --git a/arch/powerpc/platforms/cell/qpace_setup.c 
b/arch/powerpc/platforms/cell/qpace_setup.c
index c5ce02e..1b57490 100644
--- a/arch/powerpc/platforms/cell/qpace_setup.c
+++ b/arch/powerpc/platforms/cell/qpace_setup.c
@@ -61,12 +61,24 @@ static void qpace_progress(char *s, unsigned short hex)
printk(*** %04x : %s\n, 

Re: [PATCH] of: make of_find_device_by_node generic

2010-07-23 Thread David Miller
From: Grant Likely grant.lik...@secretlab.ca
Date: Fri, 23 Jul 2010 14:02:17 -0600

 From: Jonas Bonn jo...@southpole.se
 
 There's no need for this function to be architecture specific and all four
 architectures defining it had the same definition.  The function has been
 moved to drivers/of/platform.c.
 
 Signed-off-by: Jonas Bonn jo...@southpole.se
 [grant.lik...@secretlab.ca: moved to drivers/of/platform.c, simplified code, 
 and added kerneldoc comment]
 Signed-off-by: Grant Likely grant.lik...@secretlab.ca

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


[PATCH] of: Fix phandle endian issues

2010-07-23 Thread Grant Likely
The flat tree code wasn't fixing the endianness on phandle values when
unflattening the tree, and the code in drivers/of wasn't always doing a
be32_to_cpu before trying to dereference the phandle values.  This patch
fixes them.

Signed-off-by: Grant Likely grant.lik...@secretlab.ca
---
 drivers/of/base.c |   12 ++--
 drivers/of/fdt.c  |4 ++--
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/of/base.c b/drivers/of/base.c
index e3f7af8..aa80525 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -605,14 +605,14 @@ EXPORT_SYMBOL(of_find_node_by_phandle);
 struct device_node *
 of_parse_phandle(struct device_node *np, const char *phandle_name, int index)
 {
-   const phandle *phandle;
+   const __be32 *phandle;
int size;
 
phandle = of_get_property(np, phandle_name, size);
if ((!phandle) || (size  sizeof(*phandle) * (index + 1)))
return NULL;
 
-   return of_find_node_by_phandle(phandle[index]);
+   return of_find_node_by_phandle(be32_to_cpup(phandle + index));
 }
 EXPORT_SYMBOL(of_parse_phandle);
 
@@ -668,16 +668,16 @@ int of_parse_phandles_with_args(struct device_node *np, 
const char *list_name,
 
while (list  list_end) {
const __be32 *cells;
-   const phandle *phandle;
+   phandle phandle;
 
-   phandle = list++;
+   phandle = be32_to_cpup(list++);
args = list;
 
/* one cell hole in the list = ; */
-   if (!*phandle)
+   if (!phandle)
goto next;
 
-   node = of_find_node_by_phandle(*phandle);
+   node = of_find_node_by_phandle(phandle);
if (!node) {
pr_debug(%s: could not find phandle\n,
 np-full_name);
diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
index d61fda8..f3a7b4f 100644
--- a/drivers/of/fdt.c
+++ b/drivers/of/fdt.c
@@ -320,13 +320,13 @@ unsigned long __init unflatten_dt_node(unsigned long mem,
if ((strcmp(pname, phandle) == 0) ||
(strcmp(pname, linux,phandle) == 0)) {
if (np-phandle == 0)
-   np-phandle = *((u32 *)*p);
+   np-phandle = be32_to_cpup((__be32*)*p);
}
/* And we process the ibm,phandle property
 * used in pSeries dynamic device tree
 * stuff */
if (strcmp(pname, ibm,phandle) == 0)
-   np-phandle = *((u32 *)*p);
+   np-phandle = be32_to_cpup((__be32 *)*p);
pp-name = pname;
pp-length = sz;
pp-value = (void *)*p;

___
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-23 Thread Benjamin Herrenschmidt

   
   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
 
 Sorry for the bad initial subject line!
 As Sean reported that the patch fixes his isuse it
 deserves a:
 
 Tested-by: Sean MacLennan smaclen...@pikatech.com

Heh. Too late, I already sent it to Linus :-)

Ben.



___
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-23 Thread Dmitry Eremin-Solenikov
Hello,

On 7/22/10, Grant Likely grant.lik...@secretlab.ca wrote:
 On Thu, Jul 22, 2010 at 10:48 AM, Dmitry Eremin-Solenikov
 dbarysh...@gmail.com wrote:
 Hello,

 On Thu, Jul 22, 2010 at 7:38 PM, Kumar Gala ga...@kernel.crashing.org
 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 dbarysh...@gmail.com
 ---
 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 something)?

 Try the attached patch (lightly tested).  If it works for you then
 I'll post it for wider review.

Yes, this patch worked for me. However it looks a bit like a hack for me.

-- 
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-23 Thread Grant Likely
On Fri, Jul 23, 2010 at 6:20 PM, Dmitry Eremin-Solenikov
dbarysh...@gmail.com wrote:
 Hello,

 On 7/22/10, Grant Likely grant.lik...@secretlab.ca wrote:
 On Thu, Jul 22, 2010 at 10:48 AM, Dmitry Eremin-Solenikov
 dbarysh...@gmail.com wrote:
 Hello,

 On Thu, Jul 22, 2010 at 7:38 PM, Kumar Gala ga...@kernel.crashing.org
 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 dbarysh...@gmail.com
 ---
 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 something)?

 Try the attached patch (lightly tested).  If it works for you then
 I'll post it for wider review.

 Yes, this patch worked for me. However it looks a bit like a hack for me.

I'll probably refine it a bit before merging, but I don't think it is
a hack.  It reflects the behaviour that makes sense when registering
devices hanging off the root node.  If a device node is a child of the
root, then we know it isn't hanging off an i2c or pci bus, or anything
else.  It is essentially a system device.

The troublesome bit is that the root node also has memory, cpus,
chosen and aliases nodes which are not devices.  In the vast majority
of cases, we want all the device nodes that are children of the root
to be registered, but we don't want to register the special nodes.
Checking for the presence of a compatible property is a pretty good
test for determining whether or not a node actually represents a
device, especially because all users of of_platform_bus_probe() seem
to be FDT users where we've been very strict about enforcing that
drivers must use the compatible property for matching to device nodes.

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


Re: [PATCH 4/8] v3 Allow memory_block to span multiple memory sections

2010-07-23 Thread Nathan Fontenot
On 07/20/2010 02:18 PM, Dave Hansen wrote:
 On Mon, 2010-07-19 at 22:55 -0500, Nathan Fontenot wrote:
 +static int add_memory_section(int nid, struct mem_section *section,
 +   unsigned long state, enum mem_add_context context)
 +{
 +   struct memory_block *mem;
 +   int ret = 0;
 +
 +   mem = find_memory_block(section);
 +   if (mem) {
 +   atomic_inc(mem-section_count);
 +   kobject_put(mem-sysdev.kobj);
 +   } else
 +   ret = init_memory_block(mem, section, state);
 +
 if (!ret) {
 -   if (context == HOTPLUG)
 +   if (context == HOTPLUG 
 +   atomic_read(mem-section_count) == sections_per_block)
 ret = register_mem_sect_under_node(mem, nid);
 } 
 
 I think the atomic_inc() can race with the atomic_dec_and_test() in
 remove_memory_block().
 
 Thread 1 does:
 
   mem = find_memory_block(section);
 
 Thread 2 does 
 
   atomic_dec_and_test(mem-section_count);
 
 and destroys the memory block,  Thread 1 runs again:
   
if (mem) {
atomic_inc(mem-section_count);
kobject_put(mem-sysdev.kobj);
} else
 
 but now mem got destroyed by Thread 2.  You probably need to change
 find_memory_block() to itself take a reference, and to use
 atomic_inc_unless().
 

You're right but I think the fix you suggested will narrow the window for the
race condition, not eliminate it.  We could still take a time splice in
find_memory_block prior to the container_of() calls to get the memory
block pointer and end up de-referencing a invalid kobject o sysdev pointer.

I think if we want to eliminate this we may need to have lock that protects
access to any of the memory_block structures.  This would need to be taken
any time find_memory_block is called and released when use of the memory_block
returned is finished.  If we're going to fix this we should eliminate the
window completely instead of just closing it further.

If we add a lock should I submit it as part of this patchset? or submit it
as a follow-on?

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