[PATCH v2 0/7] wireless: Use macros from wireless.h

2010-03-18 Thread Joe Perches
Move the STD_IW_HANDLER macro from orinoco to wireless.h
Use the wireless.h macros in various wireless files
Remove local #defines of IW_IOCTL

Joe Perches (7):
  wireless.h: Add STD_IW_HANDLER macro
  net/wireless/wext_core.c: Use IW_IOCTL_IDX macro
  net/wireless/wext-core.c: Use IW_EVENT_IDX macro
  drivers/net/wireless: Use STD_IW_HANDLER macro
  drivers/net: Remove local #define IW_IOCTL, use STD_IW_HANDLER
  orinoco/wext.c: Remove local #define STD_IW_HANDLER
  wireless.h: Use SIOCIWFIRST not SIOCSIWCOMMIT for range check

 drivers/net/ps3_gelic_wireless.c   |   35 
 drivers/net/wireless/ipw2x00/ipw2200.c |   83 ++--
 drivers/net/wireless/orinoco/wext.c|2 -
 drivers/net/wireless/ray_cs.c  |   40 +-
 drivers/net/wireless/wl3501_cs.c   |   52 ++--
 include/linux/wireless.h   |4 +-
 net/wireless/wext-core.c   |  134 
 7 files changed, 174 insertions(+), 176 deletions(-)

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


[PATCH v2 5/7] drivers/net: Remove local #define IW_IOCTL, use STD_IW_HANDLER

2010-03-18 Thread Joe Perches
Use #define STD_IW_HANDLER from wireless.h instead

Signed-off-by: Joe Perches j...@perches.com
---
 drivers/net/ps3_gelic_wireless.c   |   35 +++---
 drivers/net/wireless/ipw2x00/ipw2200.c |   83 
 2 files changed, 58 insertions(+), 60 deletions(-)

diff --git a/drivers/net/ps3_gelic_wireless.c b/drivers/net/ps3_gelic_wireless.c
index 2663b2f..2bc8935 100644
--- a/drivers/net/ps3_gelic_wireless.c
+++ b/drivers/net/ps3_gelic_wireless.c
@@ -2279,26 +2279,25 @@ void gelic_wl_interrupt(struct net_device *netdev, u64 
status)
 /*
  * driver helpers
  */
-#define IW_IOCTL(n) [(n) - SIOCSIWCOMMIT]
 static const iw_handler gelic_wl_wext_handler[] =
 {
-   IW_IOCTL(SIOCGIWNAME)   = gelic_wl_get_name,
-   IW_IOCTL(SIOCGIWRANGE)  = gelic_wl_get_range,
-   IW_IOCTL(SIOCSIWSCAN)   = gelic_wl_set_scan,
-   IW_IOCTL(SIOCGIWSCAN)   = gelic_wl_get_scan,
-   IW_IOCTL(SIOCSIWAUTH)   = gelic_wl_set_auth,
-   IW_IOCTL(SIOCGIWAUTH)   = gelic_wl_get_auth,
-   IW_IOCTL(SIOCSIWESSID)  = gelic_wl_set_essid,
-   IW_IOCTL(SIOCGIWESSID)  = gelic_wl_get_essid,
-   IW_IOCTL(SIOCSIWENCODE) = gelic_wl_set_encode,
-   IW_IOCTL(SIOCGIWENCODE) = gelic_wl_get_encode,
-   IW_IOCTL(SIOCSIWAP) = gelic_wl_set_ap,
-   IW_IOCTL(SIOCGIWAP) = gelic_wl_get_ap,
-   IW_IOCTL(SIOCSIWENCODEEXT)  = gelic_wl_set_encodeext,
-   IW_IOCTL(SIOCGIWENCODEEXT)  = gelic_wl_get_encodeext,
-   IW_IOCTL(SIOCSIWMODE)   = gelic_wl_set_mode,
-   IW_IOCTL(SIOCGIWMODE)   = gelic_wl_get_mode,
-   IW_IOCTL(SIOCGIWNICKN)  = gelic_wl_get_nick,
+   STD_IW_HANDLER(SIOCGIWNAME, gelic_wl_get_name),
+   STD_IW_HANDLER(SIOCGIWRANGE, gelic_wl_get_range),
+   STD_IW_HANDLER(SIOCSIWSCAN, gelic_wl_set_scan),
+   STD_IW_HANDLER(SIOCGIWSCAN, gelic_wl_get_scan),
+   STD_IW_HANDLER(SIOCSIWAUTH, gelic_wl_set_auth),
+   STD_IW_HANDLER(SIOCGIWAUTH, gelic_wl_get_auth),
+   STD_IW_HANDLER(SIOCSIWESSID, gelic_wl_set_essid),
+   STD_IW_HANDLER(SIOCGIWESSID, gelic_wl_get_essid),
+   STD_IW_HANDLER(SIOCSIWENCODE, gelic_wl_set_encode),
+   STD_IW_HANDLER(SIOCGIWENCODE, gelic_wl_get_encode),
+   STD_IW_HANDLER(SIOCSIWAP, gelic_wl_set_ap),
+   STD_IW_HANDLER(SIOCGIWAP, gelic_wl_get_ap),
+   STD_IW_HANDLER(SIOCSIWENCODEEXT, gelic_wl_set_encodeext),
+   STD_IW_HANDLER(SIOCGIWENCODEEXT, gelic_wl_get_encodeext),
+   STD_IW_HANDLER(SIOCSIWMODE, gelic_wl_set_mode),
+   STD_IW_HANDLER(SIOCGIWMODE, gelic_wl_get_mode),
+   STD_IW_HANDLER(SIOCGIWNICKN, gelic_wl_get_nick),
 };
 
 static const struct iw_handler_def gelic_wl_wext_handler_def = {
diff --git a/drivers/net/wireless/ipw2x00/ipw2200.c 
b/drivers/net/wireless/ipw2x00/ipw2200.c
index 5c7aa1b..1e84888 100644
--- a/drivers/net/wireless/ipw2x00/ipw2200.c
+++ b/drivers/net/wireless/ipw2x00/ipw2200.c
@@ -9995,49 +9995,48 @@ static int ipw_wx_sw_reset(struct net_device *dev,
 }
 
 /* Rebase the WE IOCTLs to zero for the handler array */
-#define IW_IOCTL(x) [(x)-SIOCSIWCOMMIT]
 static iw_handler ipw_wx_handlers[] = {
-   IW_IOCTL(SIOCGIWNAME) = (iw_handler) cfg80211_wext_giwname,
-   IW_IOCTL(SIOCSIWFREQ) = ipw_wx_set_freq,
-   IW_IOCTL(SIOCGIWFREQ) = ipw_wx_get_freq,
-   IW_IOCTL(SIOCSIWMODE) = ipw_wx_set_mode,
-   IW_IOCTL(SIOCGIWMODE) = ipw_wx_get_mode,
-   IW_IOCTL(SIOCSIWSENS) = ipw_wx_set_sens,
-   IW_IOCTL(SIOCGIWSENS) = ipw_wx_get_sens,
-   IW_IOCTL(SIOCGIWRANGE) = ipw_wx_get_range,
-   IW_IOCTL(SIOCSIWAP) = ipw_wx_set_wap,
-   IW_IOCTL(SIOCGIWAP) = ipw_wx_get_wap,
-   IW_IOCTL(SIOCSIWSCAN) = ipw_wx_set_scan,
-   IW_IOCTL(SIOCGIWSCAN) = ipw_wx_get_scan,
-   IW_IOCTL(SIOCSIWESSID) = ipw_wx_set_essid,
-   IW_IOCTL(SIOCGIWESSID) = ipw_wx_get_essid,
-   IW_IOCTL(SIOCSIWNICKN) = ipw_wx_set_nick,
-   IW_IOCTL(SIOCGIWNICKN) = ipw_wx_get_nick,
-   IW_IOCTL(SIOCSIWRATE) = ipw_wx_set_rate,
-   IW_IOCTL(SIOCGIWRATE) = ipw_wx_get_rate,
-   IW_IOCTL(SIOCSIWRTS) = ipw_wx_set_rts,
-   IW_IOCTL(SIOCGIWRTS) = ipw_wx_get_rts,
-   IW_IOCTL(SIOCSIWFRAG) = ipw_wx_set_frag,
-   IW_IOCTL(SIOCGIWFRAG) = ipw_wx_get_frag,
-   IW_IOCTL(SIOCSIWTXPOW) = ipw_wx_set_txpow,
-   IW_IOCTL(SIOCGIWTXPOW) = ipw_wx_get_txpow,
-   IW_IOCTL(SIOCSIWRETRY) = ipw_wx_set_retry,
-   IW_IOCTL(SIOCGIWRETRY) = ipw_wx_get_retry,
-   IW_IOCTL(SIOCSIWENCODE) = ipw_wx_set_encode,
-   IW_IOCTL(SIOCGIWENCODE) = ipw_wx_get_encode,
-   IW_IOCTL(SIOCSIWPOWER) = ipw_wx_set_power,
-   IW_IOCTL(SIOCGIWPOWER) = ipw_wx_get_power,
-   IW_IOCTL(SIOCSIWSPY) = iw_handler_set_spy,
-   IW_IOCTL(SIOCGIWSPY) = iw_handler_get_spy,
-   IW_IOCTL(SIOCSIWTHRSPY) = iw_handler_set_thrspy,
-   IW_IOCTL(SIOCGIWTHRSPY) = iw_handler_get_thrspy,
-   IW_IOCTL(SIOCSIWGENIE) = 

Re: [PATCH] powerpc/fsl-booke: Get coherent bit from PTE

2010-03-18 Thread Kumar Gala

On Mar 18, 2010, at 2:02 AM, Micha Nelissen wrote:

 Kumar Gala wrote:
 We shouldn't be always setting 'M' in the TLB entry since its reasonable
 for somethings to be mapped non-coherent.  The PTE should have 'M' set
 properly.
 
 properly = not at all? AFAICS the patch only removes the setting of the bit; 
 so where is that 'M' bit set then?
 
 Micha

Its set via things like the _PAGE_BASE define in 
arch/powerpc/include/asm/pte-common.h

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


Re: [PATCH] powerpc/fsl-booke: Get coherent bit from PTE

2010-03-18 Thread Micha Nelissen

Kumar Gala wrote:

We shouldn't be always setting 'M' in the TLB entry since its reasonable
for somethings to be mapped non-coherent.  The PTE should have 'M' set
properly.


properly = not at all? AFAICS the patch only removes the setting of the 
bit; so where is that 'M' bit set then?


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


Re: how can I write a Device Tree Source for PCI-PCI Bridge?

2010-03-18 Thread Benjamin Herrenschmidt
On Thu, 2010-03-18 at 01:05 +0800, Jianbin Hu wrote:
 My board have a PCIe switch(PLX PEX8608), which have a AMCC 460EX
 processor. I have parted the dts source file from canyonlands.dts. But
 I have no idea for the PCI bridge device node. Is anyone have a
 suggestion ? 

Hi !

First, you don't always need one. The kernel will be happy without a
device node, unless you want to also represent some devices below that
bridge for some reason (such as providing the driver with specific
properties from the FW), or your interrupt routing for devices below the
bridge doesn't follow the standard PCI swizzling.

If you really want to represent it, let me know, I'll try to cook up an
example for you tomorrow. You may want to read the Open Firmware PCI
binding too which contains all the explanation but it can be a tedious
read :-)

Cheers,
Ben.


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


Re: [PATCH] powerpc: Build fix for mpc52xx

2010-03-18 Thread Grant Likely
On Wed, Mar 10, 2010 at 3:03 PM, Jeff Mahoney je...@suse.com wrote:
 mpc52xx_gpt_wdt_setup is defined as 0, which causes the following build
 failure with gcc 4.5, since it's built with -Werror.

 arch/powerpc/platforms/52xx/mpc52xx_gpt.c:761:3: error: statement with no 
 effect

 Defining it as do { } while(0) fixes the problem.

Hi Jeff, thanks for the patch.  I've picked it up with a change.
Instead of a #define, I've changed it to an empty static inline.
As akpm likes to say, we should try to program in C, not pre-processor.  :-)

diff --git a/arch/powerpc/platforms/52xx/mpc52xx_gpt.c
b/arch/powerpc/platforms/52x
index 072b948..5d7cc88 100644
--- a/arch/powerpc/platforms/52xx/mpc52xx_gpt.c
+++ b/arch/powerpc/platforms/52xx/mpc52xx_gpt.c
@@ -711,7 +711,11 @@ static int __devinit mpc52xx_gpt_wdt_init(void)
return 0;
 }

-#define mpc52xx_gpt_wdt_setup(x, y)(0)
+static inline int mpc52xx_gpt_wdt_setup(struct mpc52xx_gpt_priv *gpt,
+   const u32 *period)
+{
+   return 0;
+}

 #endif /*  CONFIG_MPC5200_WDT  */


 Signed-off-by: Jeff Mahoney je...@suse.com
 ---
  arch/powerpc/platforms/52xx/mpc52xx_gpt.c |    2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

 --- a/arch/powerpc/platforms/52xx/mpc52xx_gpt.c
 +++ b/arch/powerpc/platforms/52xx/mpc52xx_gpt.c
 @@ -711,7 +711,7 @@ static int __devinit mpc52xx_gpt_wdt_ini
        return 0;
  }

 -#define mpc52xx_gpt_wdt_setup(x, y)            (0)
 +#define mpc52xx_gpt_wdt_setup(x, y)            do { } while(0)

  #endif /*  CONFIG_MPC5200_WDT  */

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




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


[git pull updated] driver bug fixes and mpc5200 defconfig updates

2010-03-18 Thread Grant Likely
Hi Linus,  I've updated my merge branch to add a build fix (mpc52xx)
and an OF regression (fix comparison...).  Please pull.

Thanks,
g.

The following changes since commit 57d54889cd00db2752994b389ba714138652e60c:
  Linus Torvalds (1):
Linux 2.6.34-rc1

are available in the git repository at:

  git://git.secretlab.ca/git/linux-2.6 merge

David Miller (1):
  uartlite: Fix build on sparc.

Grant Likely (3):
  powerpc/52xx: update defconfigs
  of: Fix comparison of compatible properties
  powerpc/5200: Build fix for mpc52xx watchdog timer code

Scott Ellis (2):
  spi/omap2_mcspi: fix NULL pointer dereference
  spi/omap2_mcspi: Use transaction speed if provided

 arch/powerpc/configs/52xx/cm5200_defconfig|   24 ++--
 arch/powerpc/configs/52xx/lite5200b_defconfig |   28 +++--
 arch/powerpc/configs/52xx/motionpro_defconfig |   25 +++--
 arch/powerpc/configs/52xx/pcm030_defconfig|   27 +++---
 arch/powerpc/configs/52xx/tqm5200_defconfig   |   28 +++---
 arch/powerpc/configs/mpc5200_defconfig|  134 -
 arch/powerpc/platforms/52xx/mpc52xx_gpt.c |6 +-
 drivers/serial/uartlite.c |   10 +-
 drivers/spi/omap2_mcspi.c |   18 ++-
 include/linux/of.h|2 +-
 10 files changed, 183 insertions(+), 119 deletions(-)


On Thu, Mar 11, 2010 at 3:11 PM, Grant Likely grant.lik...@secretlab.ca wrote:
 Hi Linus,

 Here are some driver bug fixes, and the requisite powerpc-mpc5200
 defconfig updates.  The defconfig updates would normally go through
 Ben's tree, but since that is the only change I have that would go
 through his tree I'm hoping that it is okay to have it here.

 Cheers,
 g.

 The following changes since commit 57d54889cd00db2752994b389ba714138652e60c:
  Linus Torvalds (1):
        Linux 2.6.34-rc1

 are available in the git repository at:

  git://git.secretlab.ca/git/linux-2.6 merge

 David Miller (1):
      uartlite: Fix build on sparc.

 Grant Likely (1):
      powerpc/52xx: update defconfigs

 Scott Ellis (2):
      spi/omap2_mcspi: fix NULL pointer dereference
      spi/omap2_mcspi: Use transaction speed if provided

  arch/powerpc/configs/52xx/cm5200_defconfig    |   24 ++--
  arch/powerpc/configs/52xx/lite5200b_defconfig |   28 +++--
  arch/powerpc/configs/52xx/motionpro_defconfig |   25 +++--
  arch/powerpc/configs/52xx/pcm030_defconfig    |   27 +++---
  arch/powerpc/configs/52xx/tqm5200_defconfig   |   28 +++---
  arch/powerpc/configs/mpc5200_defconfig        |  134 
 -
  drivers/serial/uartlite.c                     |   10 +-
  drivers/spi/omap2_mcspi.c                     |   18 ++-
  8 files changed, 177 insertions(+), 117 deletions(-)


 --
 Grant Likely, B.Sc., P.Eng.
 Secret Lab Technologies Ltd.




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


[PATCH] powerpc/fsl: Add multiple MSI bank support

2010-03-18 Thread Kumar Gala
From: Lan Chunhe-B25806 b25...@freescale.com

Freescale QorIQ P4080 has three MSI banks and the original code
can not work well. This patch adds multiple MSI banks support for
Freescale processor.

Signed-off-by: Lan Chunhe-B25806 b25...@freescale.com
Signed-off-by: Roy Zang tie-fei.z...@freescale.com
---
 arch/powerpc/sysdev/fsl_msi.c |   42 ++--
 1 files changed, 27 insertions(+), 15 deletions(-)

diff --git a/arch/powerpc/sysdev/fsl_msi.c b/arch/powerpc/sysdev/fsl_msi.c
index 4108713..5c7e68d 100644
--- a/arch/powerpc/sysdev/fsl_msi.c
+++ b/arch/powerpc/sysdev/fsl_msi.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2007-2009 Freescale Semiconductor, Inc. All rights reserved.
+ * Copyright (C) 2007-2010 Freescale Semiconductor, Inc. All rights reserved.
  *
  * Author: Tony Li tony...@freescale.com
  *Jason Jin jason@freescale.com
@@ -29,7 +29,6 @@ struct fsl_msi_feature {
u32 msiir_offset;
 };
 
-static struct fsl_msi *fsl_msi;
 
 static inline u32 fsl_msi_read(u32 __iomem *base, unsigned int reg)
 {
@@ -54,10 +53,12 @@ static struct irq_chip fsl_msi_chip = {
 static int fsl_msi_host_map(struct irq_host *h, unsigned int virq,
irq_hw_number_t hw)
 {
+   struct fsl_msi *msi_data = h-host_data;
struct irq_chip *chip = fsl_msi_chip;
 
get_irq_desc(virq)-status |= IRQ_TYPE_EDGE_FALLING;
 
+   set_irq_chip_data(virq, msi_data);
set_irq_chip_and_handler(virq, chip, handle_edge_irq);
 
return 0;
@@ -96,11 +97,12 @@ static int fsl_msi_check_device(struct pci_dev *pdev, int 
nvec, int type)
 static void fsl_teardown_msi_irqs(struct pci_dev *pdev)
 {
struct msi_desc *entry;
-   struct fsl_msi *msi_data = fsl_msi;
+   struct fsl_msi *msi_data;
 
list_for_each_entry(entry, pdev-msi_list, list) {
if (entry-irq == NO_IRQ)
continue;
+   msi_data = get_irq_chip_data(entry-irq);
set_irq_msi(entry-irq, NULL);
msi_bitmap_free_hwirqs(msi_data-bitmap,
   virq_to_hw(entry-irq), 1);
@@ -111,9 +113,10 @@ static void fsl_teardown_msi_irqs(struct pci_dev *pdev)
 }
 
 static int fsl_compose_msi_msg(struct pci_dev *pdev, int hwirq,
- struct msi_msg *msg)
+   struct msi_msg *msg,
+   struct fsl_msi *fsl_msi_data)
 {
-   struct fsl_msi *msi_data = fsl_msi;
+   struct fsl_msi *msi_data = fsl_msi_data;
 
if ((msi_data-feature  FSL_PIC_IP_MASK) == FSL_PIC_IP_VMPIC) {
const u32* reg;
@@ -146,9 +149,13 @@ static int fsl_setup_msi_irqs(struct pci_dev *pdev, int 
nvec, int type)
unsigned int virq;
struct msi_desc *entry;
struct msi_msg msg;
-   struct fsl_msi *msi_data = fsl_msi;
+   struct fsl_msi *msi_data;
 
list_for_each_entry(entry, pdev-msi_list, list) {
+   if (entry-irq == NO_IRQ)
+   continue;
+   msi_data = get_irq_chip_data(entry-irq);
+
hwirq = msi_bitmap_alloc_hwirqs(msi_data-bitmap, 1);
if (hwirq  0) {
rc = hwirq;
@@ -168,7 +175,7 @@ static int fsl_setup_msi_irqs(struct pci_dev *pdev, int 
nvec, int type)
}
set_irq_msi(virq, entry);
 
-   rc = fsl_compose_msi_msg(pdev, hwirq, msg);
+   rc = fsl_compose_msi_msg(pdev, hwirq, msg, msi_data);
if (rc  0)
goto out_free;
write_msi_msg(virq, msg);
@@ -182,7 +189,7 @@ out_free:
 static void fsl_msi_cascade(unsigned int irq, struct irq_desc *desc)
 {
unsigned int cascade_irq;
-   struct fsl_msi *msi_data = fsl_msi;
+   struct fsl_msi *msi_data = get_irq_chip_data(irq);
int msir_index = -1;
u32 msir_value = 0;
u32 intr_index;
@@ -207,7 +214,7 @@ static void fsl_msi_cascade(unsigned int irq, struct 
irq_desc *desc)
cascade_irq = NO_IRQ;
 
desc-status |= IRQ_INPROGRESS;
-   switch (fsl_msi-feature  FSL_PIC_IP_MASK) {
+   switch (msi_data-feature  FSL_PIC_IP_MASK) {
case FSL_PIC_IP_MPIC:
msir_value = fsl_msi_read(msi_data-msi_regs,
msir_index * 0x10);
@@ -327,15 +334,20 @@ static int __devinit fsl_of_msi_probe(struct of_device 
*dev,
if (virt_msir != NO_IRQ) {
set_irq_data(virt_msir, (void *)i);
set_irq_chained_handler(virt_msir, fsl_msi_cascade);
+   set_irq_chip_data(virt_msir, msi);
}
}
 
-   fsl_msi = msi;
-
-   WARN_ON(ppc_md.setup_msi_irqs);
-   ppc_md.setup_msi_irqs = fsl_setup_msi_irqs;
-   ppc_md.teardown_msi_irqs = fsl_teardown_msi_irqs;
-   ppc_md.msi_check_device = fsl_msi_check_device;
+   /* The multiple 

[V2 PATCH 00/10] of: Consolidate scattered device node pointers in struct device

2010-03-18 Thread Grant Likely
Currently, each of_device has a copy of the device tree node pointer in both
.node, and in .dev.archdata.of_node (microblaze and powerpc) or
.dev.archdata.prom_node (sparc).  Also, other architectures will be adding
CONFIG_OF support, and they will also need a reference to the device tree
node pointer from struct device.

This series consolidates the device node pointer by adding .of_node to
struct device (conditional on CONFIG_OF) and removing the archdata.of_node,
archdata.prom_node and of_device.node users.  The pointer is moved out of
dev_archdata and into struct device proper so that of_node doesn't need to
get manually added to archdata for each architecture that enables CONFIG_OF.

Based on v2.6.34-rc1

Series should be fully bisectable.
 - Patch 1 adds the new device.of_node pointer and sets the value in all the
   needed places.
 - Patches 2-6 eliminate all readers of the old values
 - Patch 7 removes references to the archdata stuff from drivers/of (there
   are no more users at this point)
 - Patches 8-10 finally remove the old versions.

My goal is to get patches 1-5 into linux-next as soon as I've collected acks.
Dave, Michal and Ben, it would be fantastic if you're able to give this
series a spin.  Once I've gotten the okay from you I can then start merging
the driver changes from patch 6 as I receive acks from the various subsystem
maintainers (I'm still maintaining the drivers changes in a large series of
per-subsystem patches so I can add them to linux-next as maintainers
respond, but for this posting I've rolled them all up to make it easy to
handle.)  I'll add the last 4 patches to linux-next once all the driver
changes are committed.

Build tested on powerpc (32  64 bit), sparc (32  64), microblaze.  Booted
on MPC5200.

Difference from v1:
 - some cleanups and fixed more references to the old properties.
 - rolled all the drivers/ and sound/ changes into a single patch to
   simplify review.
---

Grant Likely (10):
  arch/sparc: Remove obsolete dev_archdata.prom_node and of_devce.node
  arch/microblaze: Remove obsolete dev_archdata.of_node and of_devce.node
  arch/powerpc: Remove obsolete dev_archdata.of_node and of_devce.node
  of: eliminate calls to dev_archdata_set_node()
  of/drivers: Always use struct device.of_node to get node pointer
  arch/microblaze: Always use 'struct device.of_node' to get device node 
pointer.
  arch/powerpc: Always use 'struct device.of_node' to get device node 
pointer.
  arch/sparc: Always use 'struct device.of_node' to get device node pointer.
  i2c/of: Allow device node to be passed via i2c_board_info
  driver-core: Add device node pointer to struct device


 arch/microblaze/include/asm/device.h  |   14 
 arch/microblaze/include/asm/of_device.h   |1 -
 arch/microblaze/kernel/of_device.c|   11 -
 arch/microblaze/kernel/of_platform.c  |4 ++-
 arch/powerpc/include/asm/device.h |   15 -
 arch/powerpc/include/asm/macio.h  |2 +-
 arch/powerpc/include/asm/of_device.h  |1 -
 arch/powerpc/kernel/ibmebus.c |4 ++-
 arch/powerpc/kernel/of_device.c   |   11 -
 arch/powerpc/kernel/of_platform.c |   16 +++---
 arch/powerpc/kernel/pci-common.c  |4 ++-
 arch/powerpc/kernel/vio.c |   18 
 arch/powerpc/platforms/52xx/mpc52xx_gpio.c|4 ++-
 arch/powerpc/platforms/52xx/mpc52xx_gpt.c |   16 +++---
 arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c |6 +++--
 arch/powerpc/platforms/82xx/ep8248e.c |6 +++--
 arch/powerpc/platforms/83xx/suspend.c |2 +-
 arch/powerpc/platforms/cell/axon_msi.c|2 +-
 arch/powerpc/platforms/cell/iommu.c   |5 ++--
 arch/powerpc/platforms/pasemi/gpio_mdio.c |2 +-
 arch/powerpc/platforms/pasemi/setup.c |4 ++-
 arch/powerpc/platforms/ps3/system-bus.c   |2 +-
 arch/powerpc/platforms/pseries/iommu.c|2 +-
 arch/powerpc/sysdev/axonram.c |6 +++--
 arch/powerpc/sysdev/bestcomm/bestcomm.c   |8 +++
 arch/powerpc/sysdev/fsl_msi.c |   14 ++--
 arch/powerpc/sysdev/fsl_pmc.c |2 +-
 arch/powerpc/sysdev/pmi.c |2 +-
 arch/sparc/include/asm/device.h   |   15 -
 arch/sparc/include/asm/fb.h   |2 +-
 arch/sparc/include/asm/floppy_64.h|4 ++-
 arch/sparc/include/asm/of_device.h|1 -
 arch/sparc/include/asm/parport.h  |2 +-
 arch/sparc/kernel/auxio_64.c  |2 +-
 arch/sparc/kernel/central.c   |4 ++-
 arch/sparc/kernel/chmc.c  |   10 -
 arch/sparc/kernel/ioport.c|2 +-
 arch/sparc/kernel/of_device_32.c  |   17 +++

[V2 PATCH 01/10] driver-core: Add device node pointer to struct device

2010-03-18 Thread Grant Likely
Currently, platforms using CONFIG_OF add a 'struct device_node *of_node'
to dev-archdata.  However, with CONFIG_OF becoming generic for all
architectures, it makes sense for commonality to move it out of archdata
and into struct device proper.

This patch adds a struct device_node *of_node member to struct device
and updates all locations which currently write the device_node pointer
into archdata to also update dev-of_node.  Subsequent patches will
modify callers to use the archdata location and ultimately remove
the archdata member entirely.

Signed-off-by: Grant Likely grant.lik...@secretlab.ca
Acked-by: Greg Kroah-Hartman gre...@suse.de
---

 arch/microblaze/kernel/of_device.c  |1 +
 arch/powerpc/kernel/of_device.c |1 +
 arch/powerpc/kernel/pci-common.c|3 ++-
 arch/powerpc/kernel/vio.c   |3 ++-
 arch/powerpc/platforms/ps3/system-bus.c |1 +
 arch/sparc/kernel/of_device_32.c|1 +
 arch/sparc/kernel/of_device_64.c|1 +
 arch/sparc/kernel/pci.c |1 +
 drivers/of/of_mdio.c|1 +
 drivers/of/of_spi.c |1 +
 include/linux/device.h  |4 
 11 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/arch/microblaze/kernel/of_device.c 
b/arch/microblaze/kernel/of_device.c
index 9a0f763..f6c5218 100644
--- a/arch/microblaze/kernel/of_device.c
+++ b/arch/microblaze/kernel/of_device.c
@@ -54,6 +54,7 @@ struct of_device *of_device_alloc(struct device_node *np,
dev-dev.parent = parent;
dev-dev.release = of_release_dev;
dev-dev.archdata.of_node = np;
+   dev-dev.of_node = np;
 
if (bus_id)
dev_set_name(dev-dev, bus_id);
diff --git a/arch/powerpc/kernel/of_device.c b/arch/powerpc/kernel/of_device.c
index a359cb0..9577e6f 100644
--- a/arch/powerpc/kernel/of_device.c
+++ b/arch/powerpc/kernel/of_device.c
@@ -74,6 +74,7 @@ struct of_device *of_device_alloc(struct device_node *np,
dev-dev.parent = parent;
dev-dev.release = of_release_dev;
dev-dev.archdata.of_node = np;
+   dev-dev.of_node = np;
 
if (bus_id)
dev_set_name(dev-dev, %s, bus_id);
diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
index 2597f95..5f9e2c8 100644
--- a/arch/powerpc/kernel/pci-common.c
+++ b/arch/powerpc/kernel/pci-common.c
@@ -,8 +,9 @@ void __devinit pcibios_setup_bus_devices(struct pci_bus 
*bus)
if (dev-is_added)
continue;
 
-   /* Setup OF node pointer in archdata */
+   /* Setup OF node pointer in the device */
sd-of_node = pci_device_to_OF_node(dev);
+   dev-dev.of_node = pci_device_to_OF_node(dev);
 
/* Fixup NUMA node as it may not be setup yet by the generic
 * code and is needed by the DMA init
diff --git a/arch/powerpc/kernel/vio.c b/arch/powerpc/kernel/vio.c
index 77f6421..0670843 100644
--- a/arch/powerpc/kernel/vio.c
+++ b/arch/powerpc/kernel/vio.c
@@ -1229,7 +1229,8 @@ struct vio_dev *vio_register_device_node(struct 
device_node *of_node)
if (unit_address != NULL)
viodev-unit_address = *unit_address;
}
-   viodev-dev.archdata.of_node = of_node_get(of_node);
+   viodev-dev.of_node = of_node_get(of_node);
+   viodev-dev.archdata.of_node = viodev-dev.of_node;
 
if (firmware_has_feature(FW_FEATURE_CMO))
vio_cmo_set_dma_ops(viodev);
diff --git a/arch/powerpc/platforms/ps3/system-bus.c 
b/arch/powerpc/platforms/ps3/system-bus.c
index e34b305..2171a5b 100644
--- a/arch/powerpc/platforms/ps3/system-bus.c
+++ b/arch/powerpc/platforms/ps3/system-bus.c
@@ -765,6 +765,7 @@ int ps3_system_bus_device_register(struct 
ps3_system_bus_device *dev)
BUG();
};
 
+   dev-core.of_node = NULL;
dev-core.archdata.of_node = NULL;
set_dev_node(dev-core, 0);
 
diff --git a/arch/sparc/kernel/of_device_32.c b/arch/sparc/kernel/of_device_32.c
index da527b3..4926c1b 100644
--- a/arch/sparc/kernel/of_device_32.c
+++ b/arch/sparc/kernel/of_device_32.c
@@ -348,6 +348,7 @@ static struct of_device * __init scan_one_device(struct 
device_node *dp,
sd-prom_node = dp;
sd-op = op;
 
+   op-dev.of_node = dp;
op-node = dp;
 
op-clock_freq = of_getintprop_default(dp, clock-frequency,
diff --git a/arch/sparc/kernel/of_device_64.c b/arch/sparc/kernel/of_device_64.c
index b3d4cb5..5bc7416 100644
--- a/arch/sparc/kernel/of_device_64.c
+++ b/arch/sparc/kernel/of_device_64.c
@@ -643,6 +643,7 @@ static struct of_device * __init scan_one_device(struct 
device_node *dp,
sd-prom_node = dp;
sd-op = op;
 
+   op-dev.of_node = dp;
op-node = dp;
 
op-clock_freq = of_getintprop_default(dp, clock-frequency,
diff --git a/arch/sparc/kernel/pci.c b/arch/sparc/kernel/pci.c

[V2 PATCH 02/10] i2c/of: Allow device node to be passed via i2c_board_info

2010-03-18 Thread Grant Likely
The struct device_node *of_node pointer is moving out of dev-archdata
and into the struct device proper.  of_i2c.c needs to set the of_node
pointer before the device is registered.  Since the i2c subsystem
doesn't allow 2 stage allocation and registration of i2c devices, the
of_node pointer needs to be passed via the i2c_board_info structure
so that it is set prior to registration.

This patch adds of_node to struct i2c_board_info (conditional on
CONFIG_OF), sets of_node in i2c_new_device(), and modifies of_i2c.c
to use the new parameter.  The calling of dev_archdata_set_node()
from of_i2c will be removed in a subsequent patch when of_node is
removed from archdata and all users are converted over.

Signed-off-by: Grant Likely grant.lik...@secretlab.ca
---

 drivers/i2c/i2c-core.c |3 +++
 drivers/of/of_i2c.c|1 +
 include/linux/i2c.h|4 
 3 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
index 3202a86..4099b2b 100644
--- a/drivers/i2c/i2c-core.c
+++ b/drivers/i2c/i2c-core.c
@@ -387,6 +387,9 @@ i2c_new_device(struct i2c_adapter *adap, struct 
i2c_board_info const *info)
client-dev.parent = client-adapter-dev;
client-dev.bus = i2c_bus_type;
client-dev.type = i2c_client_type;
+#ifdef CONFIG_OF
+   client-dev.of_node = info-of_node;
+#endif
 
dev_set_name(client-dev, %d-%04x, i2c_adapter_id(adap),
 client-addr);
diff --git a/drivers/of/of_i2c.c b/drivers/of/of_i2c.c
index a3a708e..e690a2a 100644
--- a/drivers/of/of_i2c.c
+++ b/drivers/of/of_i2c.c
@@ -43,6 +43,7 @@ void of_register_i2c_devices(struct i2c_adapter *adap,
info.addr = be32_to_cpup(addr);
 
dev_archdata_set_node(dev_ad, node);
+   info.of_node = node;
info.archdata = dev_ad;
 
request_module(%s, info.type);
diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index 0a5da63..4f37ff1 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -34,6 +34,7 @@
 #include linux/device.h  /* for struct device */
 #include linux/sched.h   /* for completion */
 #include linux/mutex.h
+#include linux/of.h  /* for struct device_node */
 
 extern struct bus_type i2c_bus_type;
 
@@ -251,6 +252,9 @@ struct i2c_board_info {
unsigned short  addr;
void*platform_data;
struct dev_archdata *archdata;
+#ifdef CONFIG_OF
+   struct device_node *of_node;
+#endif
int irq;
 };
 

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


[V2 PATCH 03/10] arch/sparc: Always use 'struct device.of_node' to get device node pointer.

2010-03-18 Thread Grant Likely
The following structure elements duplicate the information in
'struct device.of_node' and so are being eliminated.  This patch
makes all readers of the following elements use device.of_node instead.

struct of_device.node
struct dev_archdata.prom_node

Signed-off-by: Grant Likely grant.lik...@secretlab.ca
---

 arch/sparc/include/asm/fb.h  |2 +-
 arch/sparc/include/asm/floppy_64.h   |4 ++--
 arch/sparc/include/asm/parport.h |2 +-
 arch/sparc/kernel/auxio_64.c |2 +-
 arch/sparc/kernel/central.c  |4 ++--
 arch/sparc/kernel/chmc.c |   10 +-
 arch/sparc/kernel/ioport.c   |2 +-
 arch/sparc/kernel/of_device_32.c |   14 +++---
 arch/sparc/kernel/of_device_64.c |   26 +-
 arch/sparc/kernel/of_device_common.c |4 ++--
 arch/sparc/kernel/pci.c  |   12 +---
 arch/sparc/kernel/pci_common.c   |9 +
 arch/sparc/kernel/pci_fire.c |4 ++--
 arch/sparc/kernel/pci_msi.c  |   18 +-
 arch/sparc/kernel/pci_psycho.c   |4 ++--
 arch/sparc/kernel/pci_sabre.c|4 ++--
 arch/sparc/kernel/pci_schizo.c   |   14 +++---
 arch/sparc/kernel/pci_sun4v.c|8 
 arch/sparc/kernel/power.c|4 ++--
 arch/sparc/kernel/psycho_common.c|2 +-
 arch/sparc/kernel/sbus.c |   16 
 arch/sparc/kernel/time_32.c  |2 +-
 arch/sparc/kernel/time_64.c  |6 +++---
 23 files changed, 86 insertions(+), 87 deletions(-)

diff --git a/arch/sparc/include/asm/fb.h b/arch/sparc/include/asm/fb.h
index b83e447..e834880 100644
--- a/arch/sparc/include/asm/fb.h
+++ b/arch/sparc/include/asm/fb.h
@@ -18,7 +18,7 @@ static inline int fb_is_primary_device(struct fb_info *info)
struct device *dev = info-device;
struct device_node *node;
 
-   node = dev-archdata.prom_node;
+   node = dev-of_node;
if (node 
node == of_console_device)
return 1;
diff --git a/arch/sparc/include/asm/floppy_64.h 
b/arch/sparc/include/asm/floppy_64.h
index 36439d6..8fac3ab 100644
--- a/arch/sparc/include/asm/floppy_64.h
+++ b/arch/sparc/include/asm/floppy_64.h
@@ -589,7 +589,7 @@ static unsigned long __init sun_floppy_init(void)
if (!op)
return 0;
 
-   state_prop = of_get_property(op-node, status, NULL);
+   state_prop = of_get_property(op-dev.of_node, status, NULL);
if (state_prop  !strncmp(state_prop, disabled, 8))
return 0;
 
@@ -716,7 +716,7 @@ static unsigned long __init sun_floppy_init(void)
 
return sun_floppy_types[0];
}
-   prop = of_get_property(op-node, status, NULL);
+   prop = of_get_property(op-dev.of_node, status, NULL);
if (prop  !strncmp(state, disabled, 8))
return 0;
 
diff --git a/arch/sparc/include/asm/parport.h b/arch/sparc/include/asm/parport.h
index ff9ead6..1bb6a41 100644
--- a/arch/sparc/include/asm/parport.h
+++ b/arch/sparc/include/asm/parport.h
@@ -113,7 +113,7 @@ static int __devinit ecpp_probe(struct of_device *op, const 
struct of_device_id
struct parport *p;
int slot, err;
 
-   parent = op-node-parent;
+   parent = op-dev.of_node-parent;
if (!strcmp(parent-name, dma)) {
p = parport_pc_probe_port(base, base + 0x400,
  op-irqs[0], PARPORT_DMA_NOFIFO,
diff --git a/arch/sparc/kernel/auxio_64.c b/arch/sparc/kernel/auxio_64.c
index 9f52db2..bd8421a 100644
--- a/arch/sparc/kernel/auxio_64.c
+++ b/arch/sparc/kernel/auxio_64.c
@@ -104,7 +104,7 @@ MODULE_DEVICE_TABLE(of, auxio_match);
 
 static int __devinit auxio_probe(struct of_device *dev, const struct 
of_device_id *match)
 {
-   struct device_node *dp = dev-node;
+   struct device_node *dp = dev-dev.of_node;
unsigned long size;
 
if (!strcmp(dp-parent-name, ebus)) {
diff --git a/arch/sparc/kernel/central.c b/arch/sparc/kernel/central.c
index 4589ca3..dfc3698 100644
--- a/arch/sparc/kernel/central.c
+++ b/arch/sparc/kernel/central.c
@@ -167,7 +167,7 @@ static int __devinit fhc_probe(struct of_device *op,
goto out;
}
 
-   if (!strcmp(op-node-parent-name, central))
+   if (!strcmp(op-dev.of_node-parent-name, central))
p-central = true;
 
p-pregs = of_ioremap(op-resource[0], 0,
@@ -182,7 +182,7 @@ static int __devinit fhc_probe(struct of_device *op,
reg = upa_readl(p-pregs + FHC_PREGS_BSR);
p-board_num = ((reg  16)  1) | ((reg  12)  0x0e);
} else {
-   p-board_num = of_getintprop_default(op-node, board#, -1);
+   p-board_num = of_getintprop_default(op-dev.of_node, board#, 
-1);
if (p-board_num == -1) {
printk(KERN_ERR fhc: No board# 

[V2 PATCH 04/10] arch/powerpc: Always use 'struct device.of_node' to get device node pointer.

2010-03-18 Thread Grant Likely
The following structure elements duplicate the information in
'struct device.of_node' and so are being eliminated.  This patch
makes all readers of the following elements use device.of_node instead.

struct of_device.node
struct dev_archdata.of_node

Signed-off-by: Grant Likely grant.lik...@secretlab.ca
---

 arch/powerpc/include/asm/macio.h  |2 +-
 arch/powerpc/kernel/ibmebus.c |4 ++--
 arch/powerpc/kernel/of_device.c   |8 
 arch/powerpc/kernel/of_platform.c |   16 
 arch/powerpc/platforms/52xx/mpc52xx_gpio.c|4 ++--
 arch/powerpc/platforms/52xx/mpc52xx_gpt.c |   16 
 arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c |6 +++---
 arch/powerpc/platforms/82xx/ep8248e.c |6 +++---
 arch/powerpc/platforms/83xx/suspend.c |2 +-
 arch/powerpc/platforms/cell/axon_msi.c|2 +-
 arch/powerpc/platforms/pasemi/gpio_mdio.c |2 +-
 arch/powerpc/sysdev/axonram.c |6 +++---
 arch/powerpc/sysdev/bestcomm/bestcomm.c   |8 
 arch/powerpc/sysdev/fsl_msi.c |   14 +++---
 arch/powerpc/sysdev/fsl_pmc.c |2 +-
 arch/powerpc/sysdev/pmi.c |2 +-
 16 files changed, 50 insertions(+), 50 deletions(-)

diff --git a/arch/powerpc/include/asm/macio.h b/arch/powerpc/include/asm/macio.h
index a062c57..19a661b 100644
--- a/arch/powerpc/include/asm/macio.h
+++ b/arch/powerpc/include/asm/macio.h
@@ -108,7 +108,7 @@ static inline void* macio_get_drvdata(struct macio_dev *dev)
 
 static inline struct device_node *macio_get_of_node(struct macio_dev *mdev)
 {
-   return mdev-ofdev.node;
+   return mdev-ofdev.dev.of_node;
 }
 
 #ifdef CONFIG_PCI
diff --git a/arch/powerpc/kernel/ibmebus.c b/arch/powerpc/kernel/ibmebus.c
index a4c8b38..797e9ac 100644
--- a/arch/powerpc/kernel/ibmebus.c
+++ b/arch/powerpc/kernel/ibmebus.c
@@ -139,14 +139,14 @@ static struct dma_map_ops ibmebus_dma_ops = {
 
 static int ibmebus_match_path(struct device *dev, void *data)
 {
-   struct device_node *dn = to_of_device(dev)-node;
+   struct device_node *dn = to_of_device(dev)-dev.of_node;
return (dn-full_name 
(strcasecmp((char *)data, dn-full_name) == 0));
 }
 
 static int ibmebus_match_node(struct device *dev, void *data)
 {
-   return to_of_device(dev)-node == data;
+   return to_of_device(dev)-dev.of_node == data;
 }
 
 static int ibmebus_create_device(struct device_node *dn)
diff --git a/arch/powerpc/kernel/of_device.c b/arch/powerpc/kernel/of_device.c
index 9577e6f..285c849 100644
--- a/arch/powerpc/kernel/of_device.c
+++ b/arch/powerpc/kernel/of_device.c
@@ -13,7 +13,7 @@
 static void of_device_make_bus_id(struct of_device *dev)
 {
static atomic_t bus_no_reg_magic;
-   struct device_node *node = dev-node;
+   struct device_node *node = dev-dev.of_node;
const u32 *reg;
u64 addr;
int magic;
@@ -96,17 +96,17 @@ int of_device_uevent(struct device *dev, struct 
kobj_uevent_env *env)
 
ofdev = to_of_device(dev);
 
-   if (add_uevent_var(env, OF_NAME=%s, ofdev-node-name))
+   if (add_uevent_var(env, OF_NAME=%s, ofdev-dev.of_node-name))
return -ENOMEM;
 
-   if (add_uevent_var(env, OF_TYPE=%s, ofdev-node-type))
+   if (add_uevent_var(env, OF_TYPE=%s, ofdev-dev.of_node-type))
return -ENOMEM;
 
 /* Since the compatible field can contain pretty much anything
  * it's not really legal to split it out with commas. We split it
  * up using a number of environment variables instead. */
 
-   compat = of_get_property(ofdev-node, compatible, cplen);
+   compat = of_get_property(ofdev-dev.of_node, compatible, cplen);
while (compat  *compat  cplen  0) {
if (add_uevent_var(env, OF_COMPATIBLE_%d=%s, seen, compat))
return -ENOMEM;
diff --git a/arch/powerpc/kernel/of_platform.c 
b/arch/powerpc/kernel/of_platform.c
index 666d08d..5a5f624 100644
--- a/arch/powerpc/kernel/of_platform.c
+++ b/arch/powerpc/kernel/of_platform.c
@@ -196,7 +196,7 @@ EXPORT_SYMBOL(of_platform_bus_probe);
 
 static int of_dev_node_match(struct device *dev, void *data)
 {
-   return to_of_device(dev)-node == data;
+   return to_of_device(dev)-dev.of_node == data;
 }
 
 struct of_device *of_find_device_by_node(struct device_node *np)
@@ -214,7 +214,7 @@ EXPORT_SYMBOL(of_find_device_by_node);
 static int of_dev_phandle_match(struct device *dev, void *data)
 {
phandle *ph = data;
-   return to_of_device(dev)-node-phandle == *ph;
+   return to_of_device(dev)-dev.of_node-phandle == *ph;
 }
 
 struct of_device *of_find_device_by_phandle(phandle ph)
@@ -247,10 +247,10 @@ static int __devinit of_pci_phb_probe(struct of_device 
*dev,
if (ppc_md.pci_setup_phb == NULL)
return -ENODEV;
 
-   printk(KERN_INFO 

[V2 PATCH 05/10] arch/microblaze: Always use 'struct device.of_node' to get device node pointer.

2010-03-18 Thread Grant Likely
The following structure elements duplicate the information in
'struct device.of_node' and so are being eliminated.  This patch
makes all readers of the following elements use device.of_node instead.

struct of_device.node
struct dev_archdata.of_node

Signed-off-by: Grant Likely grant.lik...@secretlab.ca
---

 arch/microblaze/kernel/of_device.c   |8 
 arch/microblaze/kernel/of_platform.c |4 ++--
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/arch/microblaze/kernel/of_device.c 
b/arch/microblaze/kernel/of_device.c
index f6c5218..90d2246 100644
--- a/arch/microblaze/kernel/of_device.c
+++ b/arch/microblaze/kernel/of_device.c
@@ -12,7 +12,7 @@
 void of_device_make_bus_id(struct of_device *dev)
 {
static atomic_t bus_no_reg_magic;
-   struct device_node *node = dev-node;
+   struct device_node *node = dev-dev.of_node;
const u32 *reg;
u64 addr;
int magic;
@@ -76,17 +76,17 @@ int of_device_uevent(struct device *dev, struct 
kobj_uevent_env *env)
 
ofdev = to_of_device(dev);
 
-   if (add_uevent_var(env, OF_NAME=%s, ofdev-node-name))
+   if (add_uevent_var(env, OF_NAME=%s, ofdev-dev.of_node-name))
return -ENOMEM;
 
-   if (add_uevent_var(env, OF_TYPE=%s, ofdev-node-type))
+   if (add_uevent_var(env, OF_TYPE=%s, ofdev-dev.of_node-type))
return -ENOMEM;
 
/* Since the compatible field can contain pretty much anything
 * it's not really legal to split it out with commas. We split it
 * up using a number of environment variables instead. */
 
-   compat = of_get_property(ofdev-node, compatible, cplen);
+   compat = of_get_property(ofdev-dev.of_node, compatible, cplen);
while (compat  *compat  cplen  0) {
if (add_uevent_var(env, OF_COMPATIBLE_%d=%s, seen, compat))
return -ENOMEM;
diff --git a/arch/microblaze/kernel/of_platform.c 
b/arch/microblaze/kernel/of_platform.c
index 1c6d684..ea7d024 100644
--- a/arch/microblaze/kernel/of_platform.c
+++ b/arch/microblaze/kernel/of_platform.c
@@ -167,7 +167,7 @@ EXPORT_SYMBOL(of_platform_bus_probe);
 
 static int of_dev_node_match(struct device *dev, void *data)
 {
-   return to_of_device(dev)-node == data;
+   return to_of_device(dev)-dev.of_node == data;
 }
 
 struct of_device *of_find_device_by_node(struct device_node *np)
@@ -185,7 +185,7 @@ EXPORT_SYMBOL(of_find_device_by_node);
 static int of_dev_phandle_match(struct device *dev, void *data)
 {
phandle *ph = data;
-   return to_of_device(dev)-node-phandle == *ph;
+   return to_of_device(dev)-dev.of_node-phandle == *ph;
 }
 
 struct of_device *of_find_device_by_phandle(phandle ph)

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


[V2 PATCH 07/10] of: eliminate calls to dev_archdata_set_node()

2010-03-18 Thread Grant Likely
At this point, there are no more users of the archdata node pointer,
so the calls to set it can be dropped.

Signed-off-by: Grant Likely grant.lik...@secretlab.ca
---

 drivers/of/of_i2c.c  |1 -
 drivers/of/of_mdio.c |1 -
 drivers/of/of_spi.c  |1 -
 3 files changed, 0 insertions(+), 3 deletions(-)

diff --git a/drivers/of/of_i2c.c b/drivers/of/of_i2c.c
index 604ba96..ab6522c 100644
--- a/drivers/of/of_i2c.c
+++ b/drivers/of/of_i2c.c
@@ -42,7 +42,6 @@ void of_register_i2c_devices(struct i2c_adapter *adap,
 
info.addr = be32_to_cpup(addr);
 
-   dev_archdata_set_node(dev_ad, node);
info.of_node = node;
info.archdata = dev_ad;
 
diff --git a/drivers/of/of_mdio.c b/drivers/of/of_mdio.c
index 01d794a..794fbc2 100644
--- a/drivers/of/of_mdio.c
+++ b/drivers/of/of_mdio.c
@@ -79,7 +79,6 @@ int of_mdiobus_register(struct mii_bus *mdio, struct 
device_node *np)
/* Associate the OF node with the device structure so it
 * can be looked up later */
of_node_get(child);
-   dev_archdata_set_node(phy-dev.archdata, child);
phy-dev.of_node = child;
 
/* All data is now stored in the phy struct; register it */
diff --git a/drivers/of/of_spi.c b/drivers/of/of_spi.c
index f3119a0..5fed7e3 100644
--- a/drivers/of/of_spi.c
+++ b/drivers/of/of_spi.c
@@ -80,7 +80,6 @@ void of_register_spi_devices(struct spi_master *master, 
struct device_node *np)
/* Store a pointer to the node in the device structure */
of_node_get(nc);
spi-dev.of_node = nc;
-   spi-dev.archdata.of_node = nc;
 
/* Register the new device */
request_module(spi-modalias);

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


[V2 PATCH 08/10] arch/powerpc: Remove obsolete dev_archdata.of_node and of_devce.node

2010-03-18 Thread Grant Likely
Both dev_archdata.of_node and of_device.node are duplications of the
device.of_node value.  This patch removes them.

Signed-off-by: Grant Likely grant.lik...@secretlab.ca
---

 arch/powerpc/include/asm/device.h   |   15 ---
 arch/powerpc/include/asm/of_device.h|1 -
 arch/powerpc/kernel/of_device.c |4 +---
 arch/powerpc/kernel/pci-common.c|1 -
 arch/powerpc/kernel/vio.c   |   17 -
 arch/powerpc/platforms/cell/iommu.c |5 ++---
 arch/powerpc/platforms/pasemi/setup.c   |4 ++--
 arch/powerpc/platforms/ps3/system-bus.c |1 -
 arch/powerpc/platforms/pseries/iommu.c  |2 +-
 9 files changed, 14 insertions(+), 36 deletions(-)

diff --git a/arch/powerpc/include/asm/device.h 
b/arch/powerpc/include/asm/device.h
index 6d94d27..f23f8d8 100644
--- a/arch/powerpc/include/asm/device.h
+++ b/arch/powerpc/include/asm/device.h
@@ -10,9 +10,6 @@ struct dma_map_ops;
 struct device_node;
 
 struct dev_archdata {
-   /* Optional pointer to an OF device node */
-   struct device_node  *of_node;
-
/* DMA operations on that device */
struct dma_map_ops  *dma_ops;
 
@@ -30,18 +27,6 @@ struct dev_archdata {
 #endif
 };
 
-static inline void dev_archdata_set_node(struct dev_archdata *ad,
-struct device_node *np)
-{
-   ad-of_node = np;
-}
-
-static inline struct device_node *
-dev_archdata_get_node(const struct dev_archdata *ad)
-{
-   return ad-of_node;
-}
-
 struct pdev_archdata {
 };
 
diff --git a/arch/powerpc/include/asm/of_device.h 
b/arch/powerpc/include/asm/of_device.h
index a64debf..8b26f96 100644
--- a/arch/powerpc/include/asm/of_device.h
+++ b/arch/powerpc/include/asm/of_device.h
@@ -12,7 +12,6 @@
  */
 struct of_device
 {
-   struct device_node  *node;  /* to be obsoleted */
u64 dma_mask;   /* DMA mask */
struct device   dev;/* Generic device interface */
 };
diff --git a/arch/powerpc/kernel/of_device.c b/arch/powerpc/kernel/of_device.c
index 285c849..20b3474 100644
--- a/arch/powerpc/kernel/of_device.c
+++ b/arch/powerpc/kernel/of_device.c
@@ -69,12 +69,10 @@ struct of_device *of_device_alloc(struct device_node *np,
if (!dev)
return NULL;
 
-   dev-node = of_node_get(np);
+   dev-dev.of_node = of_node_get(np);
dev-dev.dma_mask = dev-dma_mask;
dev-dev.parent = parent;
dev-dev.release = of_release_dev;
-   dev-dev.archdata.of_node = np;
-   dev-dev.of_node = np;
 
if (bus_id)
dev_set_name(dev-dev, %s, bus_id);
diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
index 5f9e2c8..ba3bb42 100644
--- a/arch/powerpc/kernel/pci-common.c
+++ b/arch/powerpc/kernel/pci-common.c
@@ -1112,7 +1112,6 @@ void __devinit pcibios_setup_bus_devices(struct pci_bus 
*bus)
continue;
 
/* Setup OF node pointer in the device */
-   sd-of_node = pci_device_to_OF_node(dev);
dev-dev.of_node = pci_device_to_OF_node(dev);
 
/* Fixup NUMA node as it may not be setup yet by the generic
diff --git a/arch/powerpc/kernel/vio.c b/arch/powerpc/kernel/vio.c
index 0670843..d4981c6 100644
--- a/arch/powerpc/kernel/vio.c
+++ b/arch/powerpc/kernel/vio.c
@@ -704,7 +704,7 @@ static int vio_cmo_bus_probe(struct vio_dev *viodev)
 * Check to see that device has a DMA window and configure
 * entitlement for the device.
 */
-   if (of_get_property(viodev-dev.archdata.of_node,
+   if (of_get_property(viodev-dev.of_node,
ibm,my-dma-window, NULL)) {
/* Check that the driver is CMO enabled and get desired DMA */
if (!viodrv-get_desired_dma) {
@@ -1048,7 +1048,7 @@ static struct iommu_table *vio_build_iommu_table(struct 
vio_dev *dev)
if (firmware_has_feature(FW_FEATURE_ISERIES))
return vio_build_iommu_table_iseries(dev);
 
-   dma_window = of_get_property(dev-dev.archdata.of_node,
+   dma_window = of_get_property(dev-dev.of_node,
  ibm,my-dma-window, NULL);
if (!dma_window)
return NULL;
@@ -1057,7 +1057,7 @@ static struct iommu_table *vio_build_iommu_table(struct 
vio_dev *dev)
if (tbl == NULL)
return NULL;
 
-   of_parse_dma_window(dev-dev.archdata.of_node, dma_window,
+   of_parse_dma_window(dev-dev.of_node, dma_window,
tbl-it_index, offset, size);
 
/* TCE table size - measured in tce entries */
@@ -1085,7 +1085,7 @@ static const struct vio_device_id *vio_match_device(
 {
while (ids-type[0] != '\0') {
if ((strncmp(dev-type, ids-type, strlen(ids-type)) == 0) 
-   of_device_is_compatible(dev-dev.archdata.of_node,
+   

[V2 PATCH 09/10] arch/microblaze: Remove obsolete dev_archdata.of_node and of_devce.node

2010-03-18 Thread Grant Likely
Both dev_archdata.of_node and of_device.node are duplications of the
device.of_node value.  This patch removes them.

Signed-off-by: Grant Likely grant.lik...@secretlab.ca
---

 arch/microblaze/include/asm/device.h|   14 --
 arch/microblaze/include/asm/of_device.h |1 -
 arch/microblaze/kernel/of_device.c  |4 +---
 3 files changed, 1 insertions(+), 18 deletions(-)

diff --git a/arch/microblaze/include/asm/device.h 
b/arch/microblaze/include/asm/device.h
index 78a0384..8d46822 100644
--- a/arch/microblaze/include/asm/device.h
+++ b/arch/microblaze/include/asm/device.h
@@ -12,25 +12,11 @@
 struct device_node;
 
 struct dev_archdata {
-   /* Optional pointer to an OF device node */
-   struct device_node  *of_node;
 };
 
 struct pdev_archdata {
 };
 
-static inline void dev_archdata_set_node(struct dev_archdata *ad,
-struct device_node *np)
-{
-   ad-of_node = np;
-}
-
-static inline struct device_node *
-dev_archdata_get_node(const struct dev_archdata *ad)
-{
-   return ad-of_node;
-}
-
 #endif /* _ASM_MICROBLAZE_DEVICE_H */
 
 
diff --git a/arch/microblaze/include/asm/of_device.h 
b/arch/microblaze/include/asm/of_device.h
index ba917cf..ab25a40 100644
--- a/arch/microblaze/include/asm/of_device.h
+++ b/arch/microblaze/include/asm/of_device.h
@@ -21,7 +21,6 @@
  * probed using OF properties.
  */
 struct of_device {
-   struct device_node  *node; /* to be obsoleted */
u64 dma_mask; /* DMA mask */
struct device   dev; /* Generic device interface */
 };
diff --git a/arch/microblaze/kernel/of_device.c 
b/arch/microblaze/kernel/of_device.c
index 90d2246..ac7e6e1 100644
--- a/arch/microblaze/kernel/of_device.c
+++ b/arch/microblaze/kernel/of_device.c
@@ -49,12 +49,10 @@ struct of_device *of_device_alloc(struct device_node *np,
if (!dev)
return NULL;
 
-   dev-node = of_node_get(np);
+   dev-dev.of_node = of_node_get(np);
dev-dev.dma_mask = dev-dma_mask;
dev-dev.parent = parent;
dev-dev.release = of_release_dev;
-   dev-dev.archdata.of_node = np;
-   dev-dev.of_node = np;
 
if (bus_id)
dev_set_name(dev-dev, bus_id);

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


[V2 PATCH 10/10] arch/sparc: Remove obsolete dev_archdata.prom_node and of_devce.node

2010-03-18 Thread Grant Likely
Both dev_archdata.prom_node and of_device.node are duplications of the
device.of_node value.  This patch removes them.

Signed-off-by: Grant Likely grant.lik...@secretlab.ca
---

 arch/sparc/include/asm/device.h|   15 ---
 arch/sparc/include/asm/of_device.h |1 -
 arch/sparc/kernel/of_device_32.c   |2 --
 arch/sparc/kernel/of_device_64.c   |2 --
 arch/sparc/kernel/pci.c|3 +--
 5 files changed, 1 insertions(+), 22 deletions(-)

diff --git a/arch/sparc/include/asm/device.h b/arch/sparc/include/asm/device.h
index f3b85b6..d4c4521 100644
--- a/arch/sparc/include/asm/device.h
+++ b/arch/sparc/include/asm/device.h
@@ -13,25 +13,10 @@ struct dev_archdata {
void*iommu;
void*stc;
void*host_controller;
-
-   struct device_node  *prom_node;
struct of_device*op;
-
int numa_node;
 };
 
-static inline void dev_archdata_set_node(struct dev_archdata *ad,
-struct device_node *np)
-{
-   ad-prom_node = np;
-}
-
-static inline struct device_node *
-dev_archdata_get_node(const struct dev_archdata *ad)
-{
-   return ad-prom_node;
-}
-
 struct pdev_archdata {
 };
 
diff --git a/arch/sparc/include/asm/of_device.h 
b/arch/sparc/include/asm/of_device.h
index a5d9811..f320246 100644
--- a/arch/sparc/include/asm/of_device.h
+++ b/arch/sparc/include/asm/of_device.h
@@ -14,7 +14,6 @@
  */
 struct of_device
 {
-   struct device_node  *node;
struct device   dev;
struct resource resource[PROMREG_MAX];
unsigned intirqs[PROMINTR_MAX];
diff --git a/arch/sparc/kernel/of_device_32.c b/arch/sparc/kernel/of_device_32.c
index 7073117..47e63f1 100644
--- a/arch/sparc/kernel/of_device_32.c
+++ b/arch/sparc/kernel/of_device_32.c
@@ -345,11 +345,9 @@ static struct of_device * __init scan_one_device(struct 
device_node *dp,
return NULL;
 
sd = op-dev.archdata;
-   sd-prom_node = dp;
sd-op = op;
 
op-dev.of_node = dp;
-   op-node = dp;
 
op-clock_freq = of_getintprop_default(dp, clock-frequency,
   (25*1000*1000));
diff --git a/arch/sparc/kernel/of_device_64.c b/arch/sparc/kernel/of_device_64.c
index c8e352e..1dae807 100644
--- a/arch/sparc/kernel/of_device_64.c
+++ b/arch/sparc/kernel/of_device_64.c
@@ -640,11 +640,9 @@ static struct of_device * __init scan_one_device(struct 
device_node *dp,
return NULL;
 
sd = op-dev.archdata;
-   sd-prom_node = dp;
sd-op = op;
 
op-dev.of_node = dp;
-   op-node = dp;
 
op-clock_freq = of_getintprop_default(dp, clock-frequency,
   (25*1000*1000));
diff --git a/arch/sparc/kernel/pci.c b/arch/sparc/kernel/pci.c
index c7a214e..8a8363a 100644
--- a/arch/sparc/kernel/pci.c
+++ b/arch/sparc/kernel/pci.c
@@ -261,8 +261,6 @@ static struct pci_dev *of_create_pci_dev(struct 
pci_pbm_info *pbm,
sd-iommu = pbm-iommu;
sd-stc = pbm-stc;
sd-host_controller = pbm;
-   sd-prom_node = node;
-   dev-dev.of_node = node;
sd-op = op = of_find_device_by_node(node);
sd-numa_node = pbm-numa_node;
 
@@ -286,6 +284,7 @@ static struct pci_dev *of_create_pci_dev(struct 
pci_pbm_info *pbm,
dev-sysdata = node;
dev-dev.parent = bus-bridge;
dev-dev.bus = pci_bus_type;
+   dev-dev.of_node = node;
dev-devfn = devfn;
dev-multifunction = 0; /* maybe a lie? */
set_pcie_port_type(dev);

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


Re: [V2 PATCH 00/10] of: Consolidate scattered device node pointers in struct device

2010-03-18 Thread Grant Likely
On Thu, Mar 18, 2010 at 9:22 AM, Grant Likely grant.lik...@secretlab.ca wrote:
 Currently, each of_device has a copy of the device tree node pointer in both
 .node, and in .dev.archdata.of_node (microblaze and powerpc) or
 .dev.archdata.prom_node (sparc).  Also, other architectures will be adding
 CONFIG_OF support, and they will also need a reference to the device tree
 node pointer from struct device.

 This series consolidates the device node pointer by adding .of_node to
 struct device (conditional on CONFIG_OF) and removing the archdata.of_node,
 archdata.prom_node and of_device.node users.  The pointer is moved out of
 dev_archdata and into struct device proper so that of_node doesn't need to
 get manually added to archdata for each architecture that enables CONFIG_OF.

This series is also available in my git tree:

git://git.secretlab.ca/git/linux-2.6 experimental-devicetree
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: [V2 PATCH 08/10] arch/powerpc: Remove obsolete dev_archdata.of_node and of_devce.node

2010-03-18 Thread Anton Vorontsov
Hi Grant,

On Thu, Mar 18, 2010 at 09:22:50AM -0600, Grant Likely wrote:
 Both dev_archdata.of_node and of_device.node are duplications of the
 device.of_node value.  This patch removes them.

Yeah, they're plain duplications since you introduced dev.of_node.
I wonder what was the problem with using dev.archdata.of_node?
Why dev.of_node is better?

Also, by using dev.of_node directly you have to introduce ugly
#ifdefs in the non-OF code (as in i2c patch), which you don't
need with transparent archdata and accessors, which you've just
removed:

 -static inline void dev_archdata_set_node(struct dev_archdata *ad,
 -  struct device_node *np)
 -{
 - ad-of_node = np;
 -}
 -
 -static inline struct device_node *
 -dev_archdata_get_node(const struct dev_archdata *ad)
 -{
 - return ad-of_node;
 -}

Thanks,

-- 
Anton Vorontsov
email: cbouatmai...@gmail.com
irc://irc.freenode.net/bd2
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: [V2 PATCH 06/10] of/drivers: Always use struct device.of_node to get node pointer

2010-03-18 Thread Jochen Friedrich

Hi Grant,


The following structure elements duplicate the information in
'struct device.of_node' and so are being eliminated.  This patches
makes all readers of the following elements use device.of_node instead.

struct dev_archdata.prom_node (sparc)
struct dev_archdata.of_node (powerpc)
struct of_device.node

Signed-off-by: Grant Likely grant.lik...@secretlab.ca
---

 drivers/i2c/busses/i2c-ibm_iic.c  |4 ++--
 drivers/i2c/busses/i2c-mpc.c  |   17 ---


drivers/i2c/busses/i2c-cpm.c is missing in this patch.

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


Re: [V2 PATCH 08/10] arch/powerpc: Remove obsolete dev_archdata.of_node and of_devce.node

2010-03-18 Thread Grant Likely
On Thu, Mar 18, 2010 at 9:47 AM, Anton Vorontsov
avoront...@ru.mvista.com wrote:
 Hi Grant,

 On Thu, Mar 18, 2010 at 09:22:50AM -0600, Grant Likely wrote:
 Both dev_archdata.of_node and of_device.node are duplications of the
 device.of_node value.  This patch removes them.

 Yeah, they're plain duplications since you introduced dev.of_node.
 I wonder what was the problem with using dev.archdata.of_node?
 Why dev.of_node is better?

CONFIG_OF support is not going to be an arch-specific thing any
longer.  The code is being generalized, and I'm removing as many
things as possible that arch code needs to add to enable CONFIG_OF.
That includes the dev_archdata element.

The impact of moving of_node from dev_archdata to device is pretty
small anyway.  Most current users are getting the device node from
of_device.node instead of archdata.  The number of dev_archdata users
is comparatively small.

 Also, by using dev.of_node directly you have to introduce ugly
 #ifdefs in the non-OF code (as in i2c patch), which you don't
 need with transparent archdata and accessors, which you've just
 removed:

The #ifdefs are only needed in the i2c code because the i2c API
doesn't currently support separate allocation and registration of i2c
devices.  With separate allocation and registration, the of_i2c code
could set the device node pointer directly without touching the common
i2c code at all (like how of_register_spi_devices handles it).  I do
plan to write a patch to do this, but that is a task for another patch
series.

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


Re: [V2 PATCH 06/10] of/drivers: Always use struct device.of_node to get node pointer

2010-03-18 Thread Grant Likely
On Thu, Mar 18, 2010 at 9:58 AM, Jochen Friedrich joc...@scram.de wrote:
 Hi Grant,

 The following structure elements duplicate the information in
 'struct device.of_node' and so are being eliminated.  This patches
 makes all readers of the following elements use device.of_node instead.

 struct dev_archdata.prom_node (sparc)
 struct dev_archdata.of_node (powerpc)
 struct of_device.node

 Signed-off-by: Grant Likely grant.lik...@secretlab.ca
 ---

  drivers/i2c/busses/i2c-ibm_iic.c              |    4 ++--
  drivers/i2c/busses/i2c-mpc.c                  |   17 ---

 drivers/i2c/busses/i2c-cpm.c is missing in this patch.

Good catch, Thanks.

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


PPC405EX PCI CPU vs bus address mapping question

2010-03-18 Thread Steven A. Falco
I have a Kilauea board with one custom PCIE card plugged
into the PCIE1 slot.  The custom card contains four PCI
devices which are connected via a PCIE-PCI bridge to the
Kilauea.

These devices need to communicate directly with each other.
This is done by telling each device the PCI bus address of
its partners.

I tried using pci_resource_start() to get the bus address,
but that apparently gives me the cpu address.

Specifically, pci_resource_start() returns the following
addresses for the four devices:

0x9000, 0x9400,
0x9800, and 0x9c00.

However, if I look at the BAR registers in config space, they
are set to 8000, 8400, 8800, and 8c00.

During boot, I see:

PCI host bridge /plb/pc...@0c000 (primary) ranges:
 MEM 0x9000..0x9fff - 0x8000

And that does correspond to the ranges line in my dts file.

So there is clearly an offset of 0x1000 between the CPU and
bus address.

My question is:  What is the correct way for the driver to learn
of this offset, so that it can tell the devices where to find
their partners?

I see in pci_process_bridge_OF_ranges() that hose-pci_mem_offset
is calculated.  That is probably the value I want, but I don't
see a clean way to access it.

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


Re: [PATCH] powerpc/of: Fix comparison of compatible properties

2010-03-18 Thread Michal Simek

Grant Likely wrote:

On Wed, Mar 17, 2010 at 6:09 PM, Benjamin Herrenschmidt
b...@kernel.crashing.org wrote:

Commit 7c7b60cb87547b1664a4385c187f029bf514a737
of: put default string compare and #a/s-cell values into common header

Breaks various things on powerpc due to using strncasecmp instead of
strcasecmp for comparing against compatible strings.

This causes things like the 4xx PCI code to fail miserably due to the
partial matches in code like this:

   for_each_compatible_node(np, NULL, ibm,plb-pcix)
   ppc4xx_probe_pcix_bridge(np);
   for_each_compatible_node(np, NULL, ibm,plb-pci)
   ppc4xx_probe_pci_bridge(np);

This reverts us to use strcasecmp. I do wonder why microblase and sparc
want the partial matches though. For sparc it could be historical, but
microblaze might want to change.

It's not quite right to do partial name match. Entries in a compatible
list are meant to be matched whole. If a device is compatible with both
foo and foo1, then the device should have both strings in its
compatible property.


Hmmm.  That's a mistake I made then in commit 7c7b60cb.  I had meant
to use strcasecmp(), and had missed that microblaze was doing it
differently.  I certainly don't want to carry over partial name match
when other architectures pick up device tree support.  If anything,
microblaze should have the exception and the common code fixed.

Michal, why does microblaze differ from powerpc on this point?


As I wrote. Microblaze doesn't need any partial name match.

Michal



Cheers,
g.


Signed-off-by: Benjamin Herrenschmidt b...@kernel.crashing.org
---
 arch/powerpc/include/asm/prom.h |8 
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/arch/powerpc/include/asm/prom.h b/arch/powerpc/include/asm/prom.h
index ddd408a..47ce796 100644
--- a/arch/powerpc/include/asm/prom.h
+++ b/arch/powerpc/include/asm/prom.h
@@ -23,6 +23,14 @@
 #include asm/irq.h
 #include asm/atomic.h

+/* We do -not- want the generic strncasecmp here for of_compat_cmp.
+ * We have cases where we could otherwise mismatch pcix and pci
+ * and similar.
+ */
+#define of_compat_cmp(s1, s2, l)   strcasecmp((s1), (s2))
+#define of_prop_cmp(s1, s2)strcmp((s1), (s2))
+#define of_node_cmp(s1, s2)strcasecmp((s1), (s2))
+
 #define HAVE_ARCH_DEVTREE_FIXUPS

 #ifdef CONFIG_PPC32











--
Michal Simek, Ing. (M.Eng)
PetaLogix - Linux Solutions for a Reconfigurable World
w: www.petalogix.com p: +61-7-30090663,+42-0-721842854 f: +61-7-30090663
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: [V2 PATCH 06/10] of/drivers: Always use struct device.of_node to get node pointer

2010-03-18 Thread Sean MacLennan
On Thu, 18 Mar 2010 09:22:39 -0600
Grant Likely grant.lik...@secretlab.ca wrote:

 The following structure elements duplicate the information in
 'struct device.of_node' and so are being eliminated.  This patches
 makes all readers of the following elements use device.of_node
 instead.

The NDFC driver also needs a patch... or at least the version from your
last of_patch set does. I am included the patch I needed to get it to
compile.

Cheers,
   Sean

diff --git a/drivers/mtd/nand/ndfc.c b/drivers/mtd/nand/ndfc.c
index 19d94a2..5a232ec 100644
--- a/drivers/mtd/nand/ndfc.c
+++ b/drivers/mtd/nand/ndfc.c
@@ -238,14 +238,14 @@ static int __devinit ndfc_probe(struct of_device *ofdev,
dev_set_drvdata(ofdev-dev, ndfc);
 
/* Read the reg property to get the chip select */
-   reg = of_get_property(ofdev-node, reg, len);
+   reg = of_get_property(ofdev-dev.of_node, reg, len);
if (reg == NULL || len != 12) {
dev_err(ofdev-dev, unable read reg property (%d)\n, len);
return -ENOENT;
}
ndfc-chip_select = reg[0];
 
-   ndfc-ndfcbase = of_iomap(ofdev-node, 0);
+   ndfc-ndfcbase = of_iomap(ofdev-dev.of_node, 0);
if (!ndfc-ndfcbase) {
dev_err(ofdev-dev, failed to get memory\n);
return -EIO;
@@ -254,20 +254,20 @@ static int __devinit ndfc_probe(struct of_device *ofdev,
ccr = NDFC_CCR_BS(ndfc-chip_select);
 
/* It is ok if ccr does not exist - just default to 0 */
-   reg = of_get_property(ofdev-node, ccr, NULL);
+   reg = of_get_property(ofdev-dev.of_node, ccr, NULL);
if (reg)
ccr |= *reg;
 
out_be32(ndfc-ndfcbase + NDFC_CCR, ccr);
 
/* Set the bank settings if given */
-   reg = of_get_property(ofdev-node, bank-settings, NULL);
+   reg = of_get_property(ofdev-dev.of_node, bank-settings, NULL);
if (reg) {
int offset = NDFC_BCFG0 + (ndfc-chip_select  2);
out_be32(ndfc-ndfcbase + offset, *reg);
}
 
-   err = ndfc_chip_init(ndfc, ofdev-node);
+   err = ndfc_chip_init(ndfc, ofdev-dev.of_node);
if (err) {
iounmap(ndfc-ndfcbase);
return err;

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


Re: [PATCH v2 0/7] wireless: Use macros from wireless.h

2010-03-18 Thread Johannes Berg
On Wed, 2010-03-17 at 23:21 -0700, Joe Perches wrote:
 Move the STD_IW_HANDLER macro from orinoco to wireless.h
 Use the wireless.h macros in various wireless files
 Remove local #defines of IW_IOCTL

I really don't want to debug any breakage here, but otherwise I don't
care and this is fine with me.

johannes

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


Re: [V2 PATCH 06/10] of/drivers: Always use struct device.of_node to get node pointer

2010-03-18 Thread Grant Likely
On Thu, Mar 18, 2010 at 10:59 AM, Sean MacLennan
smaclen...@pikatech.com wrote:
 On Thu, 18 Mar 2010 09:22:39 -0600
 Grant Likely grant.lik...@secretlab.ca wrote:

 The following structure elements duplicate the information in
 'struct device.of_node' and so are being eliminated.  This patches
 makes all readers of the following elements use device.of_node
 instead.

 The NDFC driver also needs a patch... or at least the version from your
 last of_patch set does. I am included the patch I needed to get it to
 compile.

Thanks Sean, I've added this patch to my series.  s-o-b line please?

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


Re: [V2 PATCH 06/10] of/drivers: Always use struct device.of_node to get node pointer

2010-03-18 Thread Sean MacLennan
On Thu, 18 Mar 2010 11:07:35 -0600
Grant Likely grant.lik...@secretlab.ca wrote:

 On Thu, Mar 18, 2010 at 10:59 AM, Sean MacLennan
 smaclen...@pikatech.com wrote:
  On Thu, 18 Mar 2010 09:22:39 -0600
  Grant Likely grant.lik...@secretlab.ca wrote:
 
  The following structure elements duplicate the information in
  'struct device.of_node' and so are being eliminated.  This patches
  makes all readers of the following elements use device.of_node
  instead.
 
  The NDFC driver also needs a patch... or at least the version from
  your last of_patch set does. I am included the patch I needed to
  get it to compile.
 
 Thanks Sean, I've added this patch to my series.  s-o-b line please?
 
 g.

Signed-off-by: Sean MacLennan smaclen...@pikatech.com
---
diff --git a/drivers/mtd/nand/ndfc.c b/drivers/mtd/nand/ndfc.c
index 19d94a2..5a232ec 100644
--- a/drivers/mtd/nand/ndfc.c
+++ b/drivers/mtd/nand/ndfc.c
@@ -238,14 +238,14 @@ static int __devinit ndfc_probe(struct of_device *ofdev,
dev_set_drvdata(ofdev-dev, ndfc);
 
/* Read the reg property to get the chip select */
-   reg = of_get_property(ofdev-node, reg, len);
+   reg = of_get_property(ofdev-dev.of_node, reg, len);
if (reg == NULL || len != 12) {
dev_err(ofdev-dev, unable read reg property (%d)\n, len);
return -ENOENT;
}
ndfc-chip_select = reg[0];
 
-   ndfc-ndfcbase = of_iomap(ofdev-node, 0);
+   ndfc-ndfcbase = of_iomap(ofdev-dev.of_node, 0);
if (!ndfc-ndfcbase) {
dev_err(ofdev-dev, failed to get memory\n);
return -EIO;
@@ -254,20 +254,20 @@ static int __devinit ndfc_probe(struct of_device *ofdev,
ccr = NDFC_CCR_BS(ndfc-chip_select);
 
/* It is ok if ccr does not exist - just default to 0 */
-   reg = of_get_property(ofdev-node, ccr, NULL);
+   reg = of_get_property(ofdev-dev.of_node, ccr, NULL);
if (reg)
ccr |= *reg;
 
out_be32(ndfc-ndfcbase + NDFC_CCR, ccr);
 
/* Set the bank settings if given */
-   reg = of_get_property(ofdev-node, bank-settings, NULL);
+   reg = of_get_property(ofdev-dev.of_node, bank-settings, NULL);
if (reg) {
int offset = NDFC_BCFG0 + (ndfc-chip_select  2);
out_be32(ndfc-ndfcbase + offset, *reg);
}
 
-   err = ndfc_chip_init(ndfc, ofdev-node);
+   err = ndfc_chip_init(ndfc, ofdev-dev.of_node);
if (err) {
iounmap(ndfc-ndfcbase);
return err;
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: [V2 PATCH 06/10] of/drivers: Always use struct device.of_node to get node pointer

2010-03-18 Thread Sean MacLennan
On Thu, 18 Mar 2010 09:22:39 -0600
Grant Likely grant.lik...@secretlab.ca wrote:

 The following structure elements duplicate the information in
 'struct device.of_node' and so are being eliminated.  This patches
 makes all readers of the following elements use device.of_node
 instead.

Acked-by: Sean MacLennan smaclen...@pikatech.com
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Does ppc cpio have limit in size?

2010-03-18 Thread wilbur.chan
Recently I 'm using cpio filesystem (kernel and filesystem compressed
as a whole) on ppc8270 .

However I found that the bigger the size of uImage is , the easier
kernel failed when booting.

Everytime it failed when calling populate_rootfs  when booting, so I
guess maybe the size of uImage effect booting procedure.


Anyone know how to boot a large cpio uImage ?  Thank you!

regards,

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


Re: IRQ's missing with MPC5200 GPT as an interrupt controller

2010-03-18 Thread Grant Likely
Hi Henk,

On Mon, Mar 8, 2010 at 8:20 AM, Henk Stegeman henk.stege...@gmail.com wrote:
 I'm trying to make use of the GPT as interrupt controller.
 My driver is getting most, but not all of the interrupts, besides that
 I'm getting a whole bunch of spurious IRQs, so I'm trying to figure
 out what's wrong.

                gpt6: ti...@660 {
                        compatible = fsl,mpc5200b-gpt,fsl,mpc5200-gpt;
                        reg = 0x660 0x10;
                        interrupts = 1 15 0;
                        interrupt-controller;
                        #interrupt-cells = 1;
                };

 My device has the interrupt-parent property which links it to the
 above interrupt controller.

                ...@f00 {
                        #address-cells = 1;
                        #size-cells = 0;
                        compatible = fsl,mpc5200b-spi,fsl,mpc5200-spi;
                        reg = 0xf00 0x20;
                        interrupts = 2 13 0 2 14 0;

                        io-control...@0 {
                                compatible = microkey,smc4000io;
                                linux,modalias = of_smc4000io;
                                spi-max-frequency = 80;
                                spi-cpha;
                                reg = 0;
                                word-delay-us = 30;
                                interrupt-parent = gpt6;
                                interrupts = 2; // And make it edge falling
                        };

 There are two things I find suspicious:
 - First of all my interrupt is listed as virq# 16, shouldn't it be
 virq# 0x50 ? (16 is te L2 value virq# 0x50 of mpc52xx_irqhost_map)

The GPT irq registered as a different IRQ controller, so it will be
assigned an entirely different number within the virq range.

 - Secondly in mpc52xx_gpt.c  mpc52xx_gpt_irq_mask() and
 mpc52xx_gpt_irq_unmask() resp. clear and set the IrqEn bit of the GPT,
 which is described in the MPC5200B_UM as enables interrupt generation
 to the CPU for all modes. The word 'generation' makes me suspicious,
 because it could mean that while irqEn is cleared an edge on the GPT's
 input does not even request an IRQ immediately after the bit is
 cleared.  Or in other words, clearing the bit could do more that just
 masking.

Could be, the IRQ support has not gotten extensive testing.  It may
require additional work.

 ~ # cat /proc/interrupts
           CPU0
  16:    1338686   MPC52xx GPT      Edge         smc4000io
 129:      83224   MPC52xx Peripherals Level        mpc52xx_psc_uart
 130:          1   MPC52xx Peripherals Level        mpc52xx_psc_uart
 133:          0   MPC52xx Peripherals Level        mpc52xx-fec_ctrl
 134:          0   MPC52xx Peripherals Level        ohci_hcd:usb1
 135:      16127   MPC52xx Peripherals Level        mpc52xx_ata
 141:          0   MPC52xx Peripherals Level        mpc5200-spi-modf
 142:      79184   MPC52xx Peripherals Level        mpc5200-spi-spif
 192:          0   MPC52xx SDMA     Level        ATA task
 193:         15   MPC52xx SDMA     Level        mpc52xx-fec_rx
 194:      35615   MPC52xx SDMA     Level        mpc52xx-fec_tx
 LOC:     134286   Local timer interrupts
 SPU:     576958   Spurious interrupts
 CNT:          0   Performance monitoring interrupts
 MCE:          0   Machine check exceptions

 ~ # dmesg |grep 660
 [    1.975928] irq: irq 0 on host /soc5...@f000/ti...@660 mapped
 to virtual irq 16

 ~ # dmesg | grep host_map
 [    0.00] mpc52xx_irqhost_map: virq=81, l1=2, l2=1
 [    0.319272] mpc52xx_irqhost_map: External IRQ1 virq=41, hw=41. type=8
 [    0.376117] mpc52xx_irqhost_map: virq=49, l1=1, l2=9
 [    0.417213] mpc52xx_irqhost_map: virq=4a, l1=1, l2=10
 [    0.452119] mpc52xx_irqhost_map: virq=4b, l1=1, l2=11
 [    0.487031] mpc52xx_irqhost_map: virq=4c, l1=1, l2=12
 [    0.529899] mpc52xx_irqhost_map: virq=4d, l1=1, l2=13
 [    0.564821] mpc52xx_irqhost_map: virq=4e, l1=1, l2=14
 [    0.599744] mpc52xx_irqhost_map: virq=4f, l1=1, l2=15
 [    0.634669] mpc52xx_irqhost_map: virq=50, l1=1, l2=16
 [    1.629764] mpc52xx_irqhost_map: virq=82, l1=2, l2=2
 [    1.667194] mpc52xx_irqhost_map: virq=84, l1=2, l2=4
 [    1.763299] mpc52xx_irqhost_map: virq=87, l1=2, l2=7
 [    1.790510] mpc52xx_irqhost_map: virq=c0, l1=3, l2=0
 [    1.909341] mpc52xx_irqhost_map: virq=8d, l1=2, l2=13
 [    1.936712] mpc52xx_irqhost_map: virq=8e, l1=2, l2=14
 [    2.055579] mpc52xx_irqhost_map: virq=c1, l1=3, l2=1
 [    2.083018] mpc52xx_irqhost_map: virq=c2, l1=3, l2=2
 [    2.110345] mpc52xx_irqhost_map: virq=85, l1=2, l2=5
 [    2.211890] mpc52xx_irqhost_map: virq=86, l1=2, l2=6

This grep only shows the output from mpc52xx_intc.c.  The GPT driver
has its own IRQ mapping function; mpc52xx_gpt_irq_map(), which is why
you're not seeing your IRQ map debug message.

Cheers,
g.

-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
___
Linuxppc-dev mailing list

Re: [PATCH v2] powerpc/perf_events: Implement perf_arch_fetch_caller_regs

2010-03-18 Thread Frederic Weisbecker
On Thu, Mar 18, 2010 at 04:05:13PM +1100, Paul Mackerras wrote:
 This implements a powerpc version of perf_arch_fetch_caller_regs.
 It's implemented in assembly because that way we can be sure there
 isn't a stack frame for perf_arch_fetch_caller_regs.  If it was in
 C, gcc might or might not create a stack frame for it, which would
 affect the number of levels we have to skip.
 
 With this, we see results from perf record -e lock:lock_acquire like
 this:
 
 # Samples: 24878
 #
 # Overhead Command  Shared Object  Symbol
 #   ..  .  ..
 #
 14.99%perf  [kernel.kallsyms]  [k] ._raw_spin_lock
   |
   --- ._raw_spin_lock
  |
  |--25.00%-- .alloc_fd
  |  (nil)
  |  |
  |  |--50.00%-- .anon_inode_getfd
  |  |  .sys_perf_event_open
  |  |  syscall_exit
  |  |  syscall
  |  |  create_counter
  |  |  __cmd_record
  |  |  run_builtin
  |  |  main
  |  |  0xfd2e704
  |  |  0xfd2e8c0
  |  |  (nil)
 
 ... etc.
 
 Signed-off-by: Paul Mackerras pau...@samba.org
 Acked-by: Benjamin Herrenschmidt b...@kernel.crashing.org
 ---
  arch/powerpc/include/asm/asm-compat.h |2 ++
  arch/powerpc/kernel/misc.S|   28 
  2 files changed, 30 insertions(+)
 
 diff --git a/arch/powerpc/include/asm/asm-compat.h 
 b/arch/powerpc/include/asm/asm-compat.h
 index c1b475a..a9b91ed 100644
 --- a/arch/powerpc/include/asm/asm-compat.h
 +++ b/arch/powerpc/include/asm/asm-compat.h
 @@ -28,6 +28,7 @@
  #define PPC_LLARX(t, a, b, eh)   PPC_LDARX(t, a, b, eh)
  #define PPC_STLCXstringify_in_c(stdcx.)
  #define PPC_CNTLZL   stringify_in_c(cntlzd)
 +#define PPC_LR_STKOFF16
  
  /* Move to CR, single-entry optimized version. Only available
   * on POWER4 and later.
 @@ -51,6 +52,7 @@
  #define PPC_STLCXstringify_in_c(stwcx.)
  #define PPC_CNTLZL   stringify_in_c(cntlzw)
  #define PPC_MTOCRF   stringify_in_c(mtcrf)
 +#define PPC_LR_STKOFF4
  
  #endif
  
 diff --git a/arch/powerpc/kernel/misc.S b/arch/powerpc/kernel/misc.S
 index 2d29752..b485a87 100644
 --- a/arch/powerpc/kernel/misc.S
 +++ b/arch/powerpc/kernel/misc.S
 @@ -127,3 +127,31 @@ _GLOBAL(__setup_cpu_power7)
  _GLOBAL(__restore_cpu_power7)
   /* place holder */
   blr
 +
 +#ifdef CONFIG_EVENT_TRACING
 +/*
 + * Get a minimal set of registers for our caller's nth caller.
 + * r3 = regs pointer, r5 = n.
 + *
 + * We only get R1 (stack pointer), NIP (next instruction pointer)
 + * and LR (link register).  These are all we can get in the
 + * general case without doing complicated stack unwinding, but
 + * fortunately they are enough to do a stack backtrace, which
 + * is all we need them for.
 + */
 +_GLOBAL(perf_arch_fetch_caller_regs)
 + mr  r6,r1
 + cmpwi   r5,0
 + mflrr4
 + ble 2f
 + mtctr   r5
 +1:   PPC_LL  r6,0(r6)
 + bdnz1b
 + PPC_LL  r4,PPC_LR_STKOFF(r6)
 +2:   PPC_LL  r7,0(r6)
 + PPC_LL  r7,PPC_LR_STKOFF(r7)
 + PPC_STL r6,GPR1-STACK_FRAME_OVERHEAD(r3)
 + PPC_STL r4,_NIP-STACK_FRAME_OVERHEAD(r3)
 + PPC_STL r7,_LINK-STACK_FRAME_OVERHEAD(r3)
 + blr
 +#endif /* CONFIG_EVENT_TRACING */


Ingo has reported me that context-switches software events
(not the trace event version) have crappy callchains.

So, while looking into it:

- PERF_COUNT_SW_CPU_MIGRATIONS provides no regs.
Heh, and it event doesn't work because of this perf_swevent_add
give up if regs are NULL.
Has PERF_COUNT_SW_CPU_MIGRATIONS ever worked?

- PERF_COUNT_SW_CONTEXT_SWITCHES uses task_pt_regs(). This
seems a very wrong thing. We don't want the regs when a user
task was interrupted or before a syscall.
That notwithstanding task_pt_regs() on kernel threads
has insane effects.

What we want for both is a hot regs snapshot.
I'm going to fix this. But it means the CONFIG_EVENT_TRACING
dependency is not true anymore. So I can't keep the exported
symbol of perf_arch_fetch_caller_regs() in trace_event_perf.c.

The ideal would be to put the EXPORT_SYMBOL in perf_event.c
but doing so in the same file a weak symbol is defined has
unpredictable effects. So I'm going to make it a macro as I
don't have the choice. I'll update ppc at the same time but I
can't guarantee it will even build :)

Thanks.

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


Re: BUG in dma-mapping.h:218 // MESH SCSI driver not working

2010-03-18 Thread Benjamin Herrenschmidt
On Fri, 2010-03-19 at 00:21 +0100, Stef Simoens wrote:
 Hello,
 
 Some time ago (July 24th 2009 my mailbox says) I emailed you and the
 linuxppc-dev list about my problems booting from the mesh SCSI
 controller.
 
 I just compiled 2.6.31 (actually, gentoo-sources-2.6.31-r10); but the
 problem remains
 I know that 2.6.33 is out, but as I didn't see any changes to the
 mesh-driver I guess that the problem is still there ...

Sadly I haven't had a chance to look. The MESH driver is a pretty
complicated thing that I didn't write and am not familiar with, so it's
going to take some work to sort out what's going on, and so far I
haven't had time to dedicate to this.

Cheers,
Ben.

 This is the logging I get when I boot (2.6.31):
 
 mesh_abort(ef8501e0)
 mesh: state at ef9eaa50, regs at f101, dma at f1014a00
 ct=   1 seq=47 bs=4027 fc= 0 exc= 0 err= 0 im= 7 int= 0 sp=f0
 dma stat=e0 cmdptr=2f8c2010
 phase=5 msgphase=0 conn_tgt=0 data_ptr=0
 dma_st=0 dma_ct=0 n_msgout=0
 target 0: req=ef85901e0 goes_out=0 saved_ptr=0
 mesh_abort(ef850280)
 mesh: state at ef9eaa50, regs at f101, dma at f1014a00
 ct=   1 seq=47 bs=4027 fc= 0 exc= 0 err= 0 im= 7 int= 0 sp=f0
 dma stat=e0 cmdptr=2f8c2010
 phase=5 msgphase=0 conn_tgt=0 data_ptr=0
 dma_st=0 dma_ct=0 n_msgout=0
 target 0: req=ef8501e0 goes_out=0 saved_ptr=0
 mesh_host_reset
 mesh_abort(ef8501e0)
 mesh: state at ef9eaa50, regs at f101, dma at f1014a00
 ct=   0 seq=6a bs=4026 fc= 5 exc= 0 err= 0 im= 7 int= 0 sp= 2
  fifo data=c0
  fifo data=01
  fifo data=03
  fifo data=01
  fifo data=19
 dma stat=e0 cmdptr=2f8c2010
 phase=3 msgphase=1 conn_tgt=0 data_ptr=0
 dma_st=0 dma_ct=0 n_msgout=6
 target 0: req=ef8501e0 goes_out=0 saved_ptr=0
 mesh_host_reset
 ...
 [afterwards, it disconnects all the disks and then it panics as it
 cannot find the root partition]
 
 2.6.29 runs fine ... but I guess that at some point, I would like to
 upgrade to the latest stable kernel.
 
 The machine is a PowerPC9600 with a 740 upgrade card, 1GB memory,
 kernel compiled with GCC 4.3.4 ...
 
 Of course I am willing to offer you all assistance you need to help
 you pin-point the problem...
 
 Thanks for your help
 
 Stef
 
 Stef Simoens schreef: 
  Hello Ben,
  
  Thank you for your reply.

   On Fri, 2009-07-24 at 00:18 +0200, Stef Simoens wrote:
   
I tried the latest 2.6.31-rc3-git3 (without any other patch).
However, I have the same behaviour as the patched 2.6.30 (so: no BUG,
but the mesh_abort messages).
  
   Would it be possible for you to roughly find out at what kernel version
   it stopped working ? (Some kernels may need my patch to avoid crashing)
   
  
  I am currently running 2.6.29-gentoo-r5 (that's somewhere at the end of
  2.6.29, probably 2.6.29.5).
  
  I compiled 2.6.30 as soon as it came 'stable'.
  In any version of 2.6.30,  I encounter the BUG (dma-mapping.h:218).
  
  I didn't react immediately, I actually guessed that the problem would have
  been reported and solved in another 2.6.30.x.
  Because it didn't, I started browsing the mailing-list (and found your
  patch).
  2.6.30-gentoo-r3 with your patch applied doesn't give the bug,
  but gives the mesh_abort.
  
  Before asking the question, I wanted to build the latest 2.6.31-rc
  available to make sure my problem didn't get solved in the meantime.
  2.6.31-rc3 gives the same mesh_abort.
  
  Would you like me to try all the linux-2.6.30-rc?
  Could you give me your best guess starting-point?
  
  I know that there exists something as git-disect ... but I have never used
  git (there always needs to be the first time, of course).
  
  Kind regards,
  
  Stef

 -- 
 Stef Simoens stef.simo...@numericable.be
 +32 486 577 963 http://users.numericable.be/stef


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


Re: [PATCH 4/6] powerpc: Rename LWSYNC_ON_SMP to PPC_RELEASE_BARRIER, ISYNC_ON_SMP to PPC_ACQUIRE_BARRIER

2010-03-18 Thread Nick Piggin
On Wed, Feb 10, 2010 at 10:04:06PM +1100, Anton Blanchard wrote:
 
 For performance reasons we are about to change ISYNC_ON_SMP to sometimes be
 lwsync. Now that the macro name doesn't make sense, change it and 
 LWSYNC_ON_SMP
 to better explain what the barriers are doing.
 
 Signed-off-by: Anton Blanchard an...@samba.org
 ---
 
 Index: powerpc.git/arch/powerpc/include/asm/atomic.h
 ===
 --- powerpc.git.orig/arch/powerpc/include/asm/atomic.h2010-02-10 
 17:12:30.264322204 +1100
 +++ powerpc.git/arch/powerpc/include/asm/atomic.h 2010-02-10 
 17:13:05.355571902 +1100
 @@ -49,13 +49,13 @@ static __inline__ int atomic_add_return(
   int t;
  
   __asm__ __volatile__(
 - LWSYNC_ON_SMP
 + PPC_RELEASE_BARRIER
  1:  lwarx   %0,0,%2 # atomic_add_return\n\
   add %0,%1,%0\n
   PPC405_ERR77(0,%2)
  stwcx.  %0,0,%2 \n\
   bne-1b
 - ISYNC_ON_SMP
 + PPC_ACQUIRE_BARRIER

I wonder if this shouldn't be called PPC_ISYNC_ACQUIRE_BARRIER ?

Unlike PPC_RELEASE_BARRIER, it is not an acquire barrier unless it
is used like an isync.

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


[PATCH v3 0/9] wireless: Use macros from wireless.h

2010-03-18 Thread Joe Perches
Create a IW_HANDLER macro for iw_handler array entries in wireless.h
Use the wireless.h macros in various wireless files
Use starting index define SIOCIWFIRST where appropriate 
Remove local #defines of IW_IOCTL
Remove STD_IW_HANDLER macro in orinoco, use IW_HANDLER instead

Joe Perches (9):
  include/linux/wireless.h: Add IW_HANDLER macro to initialize array entry
  wireless.h: Use SIOCIWFIRST not SIOCSIWCOMMIT for range check
  include/net/iw_handler.h: Use SIOCIWFIRST not SIOCSIWCOMMIT in comment
  net/wireless/wext_core.c: Use IW_IOCTL_IDX macro
  net/wireless/wext-core.c: Use IW_EVENT_IDX macro
  drivers/net/wireless: Use IW_HANDLER macro
  drivers/net: Remove local #define IW_IOCTL, use IW_HANDLER
  orinoco/wext.c: Remove local #define STD_IW_HANDLER
  drivers/net/wireless/ray_cs.c: Use iw_handler function prototypes

 drivers/net/ps3_gelic_wireless.c   |   35 +++---
 drivers/net/wireless/ipw2x00/ipw2200.c |   83 ++---
 drivers/net/wireless/orinoco/wext.c|   94 +++---
 drivers/net/wireless/ray_cs.c  |  212 +++-
 drivers/net/wireless/wl3501_cs.c   |   52 
 include/linux/wireless.h   |4 +-
 include/net/iw_handler.h   |2 +-
 net/wireless/wext-core.c   |  134 ++--
 8 files changed, 298 insertions(+), 318 deletions(-)
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


[PATCH v3 7/9] drivers/net: Remove local #define IW_IOCTL, use IW_HANDLER

2010-03-18 Thread Joe Perches
Use #define IW_HANDLER from wireless.h instead

Signed-off-by: Joe Perches j...@perches.com
---
 drivers/net/ps3_gelic_wireless.c   |   35 +++---
 drivers/net/wireless/ipw2x00/ipw2200.c |   83 
 2 files changed, 58 insertions(+), 60 deletions(-)

diff --git a/drivers/net/ps3_gelic_wireless.c b/drivers/net/ps3_gelic_wireless.c
index 2663b2f..f5fc0f7 100644
--- a/drivers/net/ps3_gelic_wireless.c
+++ b/drivers/net/ps3_gelic_wireless.c
@@ -2279,26 +2279,25 @@ void gelic_wl_interrupt(struct net_device *netdev, u64 
status)
 /*
  * driver helpers
  */
-#define IW_IOCTL(n) [(n) - SIOCSIWCOMMIT]
 static const iw_handler gelic_wl_wext_handler[] =
 {
-   IW_IOCTL(SIOCGIWNAME)   = gelic_wl_get_name,
-   IW_IOCTL(SIOCGIWRANGE)  = gelic_wl_get_range,
-   IW_IOCTL(SIOCSIWSCAN)   = gelic_wl_set_scan,
-   IW_IOCTL(SIOCGIWSCAN)   = gelic_wl_get_scan,
-   IW_IOCTL(SIOCSIWAUTH)   = gelic_wl_set_auth,
-   IW_IOCTL(SIOCGIWAUTH)   = gelic_wl_get_auth,
-   IW_IOCTL(SIOCSIWESSID)  = gelic_wl_set_essid,
-   IW_IOCTL(SIOCGIWESSID)  = gelic_wl_get_essid,
-   IW_IOCTL(SIOCSIWENCODE) = gelic_wl_set_encode,
-   IW_IOCTL(SIOCGIWENCODE) = gelic_wl_get_encode,
-   IW_IOCTL(SIOCSIWAP) = gelic_wl_set_ap,
-   IW_IOCTL(SIOCGIWAP) = gelic_wl_get_ap,
-   IW_IOCTL(SIOCSIWENCODEEXT)  = gelic_wl_set_encodeext,
-   IW_IOCTL(SIOCGIWENCODEEXT)  = gelic_wl_get_encodeext,
-   IW_IOCTL(SIOCSIWMODE)   = gelic_wl_set_mode,
-   IW_IOCTL(SIOCGIWMODE)   = gelic_wl_get_mode,
-   IW_IOCTL(SIOCGIWNICKN)  = gelic_wl_get_nick,
+   IW_HANDLER(SIOCGIWNAME, gelic_wl_get_name),
+   IW_HANDLER(SIOCGIWRANGE, gelic_wl_get_range),
+   IW_HANDLER(SIOCSIWSCAN, gelic_wl_set_scan),
+   IW_HANDLER(SIOCGIWSCAN, gelic_wl_get_scan),
+   IW_HANDLER(SIOCSIWAUTH, gelic_wl_set_auth),
+   IW_HANDLER(SIOCGIWAUTH, gelic_wl_get_auth),
+   IW_HANDLER(SIOCSIWESSID, gelic_wl_set_essid),
+   IW_HANDLER(SIOCGIWESSID, gelic_wl_get_essid),
+   IW_HANDLER(SIOCSIWENCODE, gelic_wl_set_encode),
+   IW_HANDLER(SIOCGIWENCODE, gelic_wl_get_encode),
+   IW_HANDLER(SIOCSIWAP, gelic_wl_set_ap),
+   IW_HANDLER(SIOCGIWAP, gelic_wl_get_ap),
+   IW_HANDLER(SIOCSIWENCODEEXT, gelic_wl_set_encodeext),
+   IW_HANDLER(SIOCGIWENCODEEXT, gelic_wl_get_encodeext),
+   IW_HANDLER(SIOCSIWMODE, gelic_wl_set_mode),
+   IW_HANDLER(SIOCGIWMODE, gelic_wl_get_mode),
+   IW_HANDLER(SIOCGIWNICKN, gelic_wl_get_nick),
 };
 
 static const struct iw_handler_def gelic_wl_wext_handler_def = {
diff --git a/drivers/net/wireless/ipw2x00/ipw2200.c 
b/drivers/net/wireless/ipw2x00/ipw2200.c
index 5c7aa1b..9e9c532 100644
--- a/drivers/net/wireless/ipw2x00/ipw2200.c
+++ b/drivers/net/wireless/ipw2x00/ipw2200.c
@@ -9995,49 +9995,48 @@ static int ipw_wx_sw_reset(struct net_device *dev,
 }
 
 /* Rebase the WE IOCTLs to zero for the handler array */
-#define IW_IOCTL(x) [(x)-SIOCSIWCOMMIT]
 static iw_handler ipw_wx_handlers[] = {
-   IW_IOCTL(SIOCGIWNAME) = (iw_handler) cfg80211_wext_giwname,
-   IW_IOCTL(SIOCSIWFREQ) = ipw_wx_set_freq,
-   IW_IOCTL(SIOCGIWFREQ) = ipw_wx_get_freq,
-   IW_IOCTL(SIOCSIWMODE) = ipw_wx_set_mode,
-   IW_IOCTL(SIOCGIWMODE) = ipw_wx_get_mode,
-   IW_IOCTL(SIOCSIWSENS) = ipw_wx_set_sens,
-   IW_IOCTL(SIOCGIWSENS) = ipw_wx_get_sens,
-   IW_IOCTL(SIOCGIWRANGE) = ipw_wx_get_range,
-   IW_IOCTL(SIOCSIWAP) = ipw_wx_set_wap,
-   IW_IOCTL(SIOCGIWAP) = ipw_wx_get_wap,
-   IW_IOCTL(SIOCSIWSCAN) = ipw_wx_set_scan,
-   IW_IOCTL(SIOCGIWSCAN) = ipw_wx_get_scan,
-   IW_IOCTL(SIOCSIWESSID) = ipw_wx_set_essid,
-   IW_IOCTL(SIOCGIWESSID) = ipw_wx_get_essid,
-   IW_IOCTL(SIOCSIWNICKN) = ipw_wx_set_nick,
-   IW_IOCTL(SIOCGIWNICKN) = ipw_wx_get_nick,
-   IW_IOCTL(SIOCSIWRATE) = ipw_wx_set_rate,
-   IW_IOCTL(SIOCGIWRATE) = ipw_wx_get_rate,
-   IW_IOCTL(SIOCSIWRTS) = ipw_wx_set_rts,
-   IW_IOCTL(SIOCGIWRTS) = ipw_wx_get_rts,
-   IW_IOCTL(SIOCSIWFRAG) = ipw_wx_set_frag,
-   IW_IOCTL(SIOCGIWFRAG) = ipw_wx_get_frag,
-   IW_IOCTL(SIOCSIWTXPOW) = ipw_wx_set_txpow,
-   IW_IOCTL(SIOCGIWTXPOW) = ipw_wx_get_txpow,
-   IW_IOCTL(SIOCSIWRETRY) = ipw_wx_set_retry,
-   IW_IOCTL(SIOCGIWRETRY) = ipw_wx_get_retry,
-   IW_IOCTL(SIOCSIWENCODE) = ipw_wx_set_encode,
-   IW_IOCTL(SIOCGIWENCODE) = ipw_wx_get_encode,
-   IW_IOCTL(SIOCSIWPOWER) = ipw_wx_set_power,
-   IW_IOCTL(SIOCGIWPOWER) = ipw_wx_get_power,
-   IW_IOCTL(SIOCSIWSPY) = iw_handler_set_spy,
-   IW_IOCTL(SIOCGIWSPY) = iw_handler_get_spy,
-   IW_IOCTL(SIOCSIWTHRSPY) = iw_handler_set_thrspy,
-   IW_IOCTL(SIOCGIWTHRSPY) = iw_handler_get_thrspy,
-   IW_IOCTL(SIOCSIWGENIE) = ipw_wx_set_genie,
-   IW_IOCTL(SIOCGIWGENIE) = ipw_wx_get_genie,
-   

Re: [PATCH 4/6] powerpc: Rename LWSYNC_ON_SMP to PPC_RELEASE_BARRIER, ISYNC_ON_SMP to PPC_ACQUIRE_BARRIER

2010-03-18 Thread Benjamin Herrenschmidt
On Fri, 2010-03-19 at 12:08 +1100, Nick Piggin wrote:
  - ISYNC_ON_SMP
  + PPC_ACQUIRE_BARRIER
 
 I wonder if this shouldn't be called PPC_ISYNC_ACQUIRE_BARRIER ?
 
 Unlike PPC_RELEASE_BARRIER, it is not an acquire barrier unless it
 is used like an isync.

Right. The semantic of isync would be more something like
PPC_IFETCH_BARRIER or similar :-)

Cheers,
Ben.


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


Re: [PATCH] powerpc/fsl: Add multiple MSI bank support

2010-03-18 Thread Michael Ellerman
On Thu, 2010-03-18 at 09:53 -0500, Kumar Gala wrote:
 From: Lan Chunhe-B25806 b25...@freescale.com
 
 Freescale QorIQ P4080 has three MSI banks and the original code
 can not work well. This patch adds multiple MSI banks support for
 Freescale processor.
 
 Signed-off-by: Lan Chunhe-B25806 b25...@freescale.com
 Signed-off-by: Roy Zang tie-fei.z...@freescale.com

 @@ -146,9 +149,13 @@ static int fsl_setup_msi_irqs(struct pci_dev *pdev, int 
 nvec, int type)
   unsigned int virq;
   struct msi_desc *entry;
   struct msi_msg msg;
 - struct fsl_msi *msi_data = fsl_msi;
 + struct fsl_msi *msi_data;
  
   list_for_each_entry(entry, pdev-msi_list, list) {
 + if (entry-irq == NO_IRQ)
 + continue;

This looks wrong, entry-irq should always be 0 here because it was just
kzalloc'ed - you should only be doing this check in teardown.

 - WARN_ON(ppc_md.setup_msi_irqs);
 - ppc_md.setup_msi_irqs = fsl_setup_msi_irqs;
 - ppc_md.teardown_msi_irqs = fsl_teardown_msi_irqs;
 - ppc_md.msi_check_device = fsl_msi_check_device;
 + /* 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;
 + ppc_md.teardown_msi_irqs = fsl_teardown_msi_irqs;
 + ppc_md.msi_check_device = fsl_msi_check_device;
 + } else if (ppc_md.setup_msi_irqs != fsl_setup_msi_irqs) {
 + dev_err(dev-dev, Different MSI driver already installed!\n);
 + err = -EBUSY; /* or some other error code */
 + goto error_out;
 + }

I liked it the way it was, because having two competing MSI backends
means something's probably not going to work. But it's your driver so
whatever you like.

cheers


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

Re: [PATCH] PPC: Skip over OF_DT_NOP when unflattening the device tree

2010-03-18 Thread Benjamin Herrenschmidt
On Tue, 2010-03-09 at 12:30 -0700, Jason Gunthorpe wrote:
 NOPs within the property section are skipped, but NOPs between
 OF_DT_END_NODE and OF_DT_BEGIN_NODE were not. My firmware NOPs out
 entire nodes depending on various environment parameters.
 
 of_scan_flat_dt already handles NOP more generally..

Good catch, though that code has now moved over to drivers/of
and is a bit different. Grant is going to fix it up though.

Cheers,
Ben.

 Signed-off-by: Jason Gunthorpe jguntho...@obsidianresearch.com
 ---
  arch/powerpc/kernel/prom.c |7 +--
  1 files changed, 5 insertions(+), 2 deletions(-)
 
 diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
 index 4ec3008..92137b2 100644
 --- a/arch/powerpc/kernel/prom.c
 +++ b/arch/powerpc/kernel/prom.c
 @@ -408,8 +408,11 @@ static unsigned long __init unflatten_dt_node(unsigned 
 long mem,
   if (!np-type)
   np-type = NULL;
   }
 - while (tag == OF_DT_BEGIN_NODE) {
 - mem = unflatten_dt_node(mem, p, np, allnextpp, fpsize);
 + while (tag == OF_DT_BEGIN_NODE || tag == OF_DT_NOP) {
 + if (tag == OF_DT_NOP)
 + *p += 4;
 + else
 + mem = unflatten_dt_node(mem, p, np, allnextpp, fpsize);
   tag = *((u32 *)(*p));
   }
   if (tag != OF_DT_END_NODE) {


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