[PATCH 2/2] gpio: pca953x: add powerpc irq support

2010-06-04 Thread Esben Haabendal
Signed-off-by: Esben Haabendal 
---
 drivers/gpio/pca953x.c |  347 +---
 1 files changed, 240 insertions(+), 107 deletions(-)

diff --git a/drivers/gpio/pca953x.c b/drivers/gpio/pca953x.c
index a2b12aa..a47d55f 100644
--- a/drivers/gpio/pca953x.c
+++ b/drivers/gpio/pca953x.c
@@ -3,6 +3,7 @@
  *
  *  Copyright (C) 2005 Ben Gardner 
  *  Copyright (C) 2007 Marvell International Ltd.
+ *  Copyright (C) 2010 DoreDevelopment ApS
  *
  *  Derived from drivers/i2c/chips/pca9539.c
  *
@@ -67,8 +68,11 @@ struct pca953x_chip {
uint16_t irq_stat;
uint16_t irq_trig_raise;
uint16_t irq_trig_fall;
-   int  irq_base;
-#endif
+   int irq_base;
+#ifdef CONFIG_PPC
+   struct irq_host *irq_host;
+#endif /* CONFIG_PPC */
+#endif /* CONFIG_GPIO_PCA953X_IRQ */
 
struct i2c_client *client;
struct pca953x_platform_data *dyn_pdata;
@@ -120,6 +124,10 @@ static int pca953x_gpio_direction_input(struct gpio_chip 
*gc, unsigned off)
chip = container_of(gc, struct pca953x_chip, gpio_chip);
 
reg_val = chip->reg_direction | (1u << off);
+
+   if (reg_val == chip->reg_direction)
+   return 0;
+
ret = pca953x_write_reg(chip, PCA953X_DIRECTION, reg_val);
if (ret)
return ret;
@@ -220,63 +228,41 @@ static void pca953x_setup_gpio(struct pca953x_chip *chip, 
int gpios)
 }
 
 #ifdef CONFIG_GPIO_PCA953X_IRQ
-static int pca953x_gpio_to_irq(struct gpio_chip *gc, unsigned off)
-{
-   struct pca953x_chip *chip;
 
-   chip = container_of(gc, struct pca953x_chip, gpio_chip);
-   return chip->irq_base + off;
-}
+#ifdef CONFIG_PPC
 
-static void pca953x_irq_mask(unsigned int irq)
-{
-   struct pca953x_chip *chip = get_irq_chip_data(irq);
-
-   chip->irq_mask &= ~(1 << (irq - chip->irq_base));
-}
+#define pca953x_pin_to_virq(chip, pin) \
+   (irq_linear_revmap((chip)->irq_host, pin))
+#define pca953x_virq_to_pin(chip, virq) \
+   (virq_to_hw(virq))
 
-static void pca953x_irq_unmask(unsigned int irq)
+static void pca953x_irq_mask(unsigned int virq)
 {
-   struct pca953x_chip *chip = get_irq_chip_data(irq);
-
-   chip->irq_mask |= 1 << (irq - chip->irq_base);
+   struct pca953x_chip *chip = get_irq_chip_data(virq);
+   int pin = pca953x_virq_to_pin(chip, virq);
+   pr_debug("%s: virq=%d pin=%d\n", __func__, virq, pin);
+   chip->irq_mask &= ~(1 << pin);
 }
 
-static void pca953x_irq_bus_lock(unsigned int irq)
+static void pca953x_irq_unmask(unsigned int virq)
 {
-   struct pca953x_chip *chip = get_irq_chip_data(irq);
-
-   mutex_lock(&chip->irq_lock);
+   struct pca953x_chip *chip = get_irq_chip_data(virq);
+   int pin = pca953x_virq_to_pin(chip, virq);
+   pr_debug("%s: virq=%d hwirq=%d\n", __func__, virq, pin);
+   chip->irq_mask |= 1 << pin;
 }
 
-static void pca953x_irq_bus_sync_unlock(unsigned int irq)
+static int pca953x_irq_set_type(unsigned int virq, unsigned int type)
 {
-   struct pca953x_chip *chip = get_irq_chip_data(irq);
-   uint16_t new_irqs;
-   uint16_t level;
+   struct pca953x_chip *chip = get_irq_chip_data(virq);
+   int pin = pca953x_virq_to_pin(chip, virq);
+   uint16_t mask = 1 << pin;
 
-   /* Look for any newly setup interrupt */
-   new_irqs = chip->irq_trig_fall | chip->irq_trig_raise;
-   new_irqs &= ~chip->reg_direction;
-
-   while (new_irqs) {
-   level = __ffs(new_irqs);
-   pca953x_gpio_direction_input(&chip->gpio_chip, level);
-   new_irqs &= ~(1 << level);
-   }
-
-   mutex_unlock(&chip->irq_lock);
-}
-
-static int pca953x_irq_set_type(unsigned int irq, unsigned int type)
-{
-   struct pca953x_chip *chip = get_irq_chip_data(irq);
-   uint16_t level = irq - chip->irq_base;
-   uint16_t mask = 1 << level;
+   pr_debug("%s: virq=%d pin=%d type=0x%x\n", __func__, virq, pin, type);
 
if (!(type & IRQ_TYPE_EDGE_BOTH)) {
-   dev_err(&chip->client->dev, "irq %d: unsupported type %d\n",
-   irq, type);
+   dev_err(&chip->client->dev, "virq %d: unsupported type %d\n",
+   virq, type);
return -EINVAL;
}
 
@@ -297,11 +283,140 @@ static struct irq_chip pca953x_irq_chip = {
.name   = "pca953x",
.mask   = pca953x_irq_mask,
.unmask = pca953x_irq_unmask,
+#ifndef CONFIG_PPC
.bus_lock   = pca953x_irq_bus_lock,
.bus_sync_unlock= pca953x_irq_bus_sync_unlock,
+#endif /* !CONFIG_PPC */
.set_type   = pca953x_irq_set_type,
 };
 
+static int pca953x_irq_host_match(struct irq_host *h, struct device_node *node)
+{
+   pr_debug("%s: node=%s\n", __func__, node->full_name);
+   return h->of_node == NULL || h->of_node == node;
+}
+
+static int pca953x_irq_host_map(struct irq_host *h, unsigned

[PATCH 1/2] powerpc: ipic: use set_irq_chip to ensure irq_chip defaults are applied

2010-06-04 Thread Esben Haabendal
Signed-off-by: Esben Haabendal 
---
 arch/powerpc/sysdev/ipic.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/sysdev/ipic.c b/arch/powerpc/sysdev/ipic.c
index d7b9b9c..8464b86 100644
--- a/arch/powerpc/sysdev/ipic.c
+++ b/arch/powerpc/sysdev/ipic.c
@@ -630,10 +630,10 @@ static int ipic_set_irq_type(unsigned int virq, unsigned 
int flow_type)
if (flow_type & IRQ_TYPE_LEVEL_LOW)  {
desc->status |= IRQ_LEVEL;
desc->handle_irq = handle_level_irq;
-   desc->chip = &ipic_level_irq_chip;
+   set_irq_chip(virq, &ipic_level_irq_chip);
} else {
desc->handle_irq = handle_edge_irq;
-   desc->chip = &ipic_edge_irq_chip;
+   set_irq_chip(virq, &ipic_edge_irq_chip);
}
 
/* only EXT IRQ senses are programmable on ipic
-- 
1.7.1




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


[PATCH 0/2] ipic and pca953x irq patches

2010-06-04 Thread Esben Haabendal
A minor bugfix for the ipic driver, and powerpc support for pca953x irq.

Esben Haabendal (2):
  powerpc: ipic: use set_irq_chip to ensure irq_chip defaults are
applied
  gpio: pca953x: add powerpc irq support

 arch/powerpc/sysdev/ipic.c |4 +-
 drivers/gpio/pca953x.c |  347 ++--
 2 files changed, 242 insertions(+), 109 deletions(-)



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


[PATCH 0/5] Consolidate OF IRQ handling code

2010-06-04 Thread Grant Likely
This series merges the common IRQ handling code between Microblaze and Powerpc.

I'll be adding these patches to linux-next next week unless there are
objections.

Cheers,
g.

Grant Likely (5):
  of/irq: Move irq_of_parse_and_map() to common code
  of/microblaze: strip out of_irq_workarounds code
  of/irq: merge of_irq_find_parent()
  of/irq: Merge of_irq_map_raw()
  of/irq: merge of_irq_map_one()

 arch/microblaze/include/asm/irq.h   |   13 --
 arch/microblaze/include/asm/prom.h  |   63 +---
 arch/microblaze/kernel/irq.c|   14 +--
 arch/microblaze/kernel/prom_parse.c |  321 +-
 arch/powerpc/include/asm/irq.h  |   13 --
 arch/powerpc/include/asm/prom.h |   51 +-
 arch/powerpc/kernel/irq.c   |   14 +--
 arch/powerpc/kernel/prom_parse.c|  254 +--
 arch/sparc/include/asm/prom.h   |1 -
 drivers/of/Kconfig  |4 +
 drivers/of/Makefile |1 +
 drivers/of/irq.c|  336 +++
 drivers/of/of_mdio.c|1 +
 include/linux/of_irq.h  |   49 +
 14 files changed, 405 insertions(+), 730 deletions(-)
 create mode 100644 drivers/of/irq.c
 create mode 100644 include/linux/of_irq.h
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


[PATCH 5/5] of/irq: merge of_irq_map_one()

2010-06-04 Thread Grant Likely
Merge common implementation of of_irq_map_one().  Rename it to
__of_irq_map_one() so that arch code can either use the stock
implementation, or override it to handle platform quirks.

Signed-off-by: Grant Likely 
CC: Michal Simek 
CC: Wolfram Sang 
CC: Stephen Rothwell 
CC: Benjamin Herrenschmidt 
CC: microblaze-ucli...@itee.uq.edu.au
CC: linuxppc-...@ozlabs.org
CC: devicetree-disc...@lists.ozlabs.org
---
 arch/microblaze/include/asm/prom.h  |3 -
 arch/microblaze/kernel/prom_parse.c |   73 --
 arch/powerpc/include/asm/prom.h |3 -
 arch/powerpc/kernel/prom_parse.c|   55 ---
 drivers/of/irq.c|   85 +++
 include/linux/of_irq.h  |6 ++
 6 files changed, 91 insertions(+), 134 deletions(-)

diff --git a/arch/microblaze/include/asm/prom.h 
b/arch/microblaze/include/asm/prom.h
index 89fca70..3659930 100644
--- a/arch/microblaze/include/asm/prom.h
+++ b/arch/microblaze/include/asm/prom.h
@@ -107,9 +107,6 @@ extern const void *of_get_mac_address(struct device_node 
*np);
 struct pci_dev;
 extern int of_irq_map_pci(struct pci_dev *pdev, struct of_irq *out_irq);
 
-extern int of_irq_to_resource(struct device_node *dev, int index,
-   struct resource *r);
-
 /**
  * of_iomap - Maps the memory mapped IO for a given device_node
  * @device:the device whose io range will be mapped
diff --git a/arch/microblaze/kernel/prom_parse.c 
b/arch/microblaze/kernel/prom_parse.c
index 02ec946..70c0471 100644
--- a/arch/microblaze/kernel/prom_parse.c
+++ b/arch/microblaze/kernel/prom_parse.c
@@ -656,49 +656,7 @@ struct device_node *of_irq_find_parent_by_phandle(phandle 
p)
 int of_irq_map_one(struct device_node *device,
int index, struct of_irq *out_irq)
 {
-   struct device_node *p;
-   const u32 *intspec, *tmp, *addr;
-   u32 intsize, intlen;
-   int res;
-
-   pr_debug("of_irq_map_one: dev=%s, index=%d\n",
-   device->full_name, index);
-
-   /* Get the interrupts property */
-   intspec = of_get_property(device, "interrupts", (int *) &intlen);
-   if (intspec == NULL)
-   return -EINVAL;
-   intlen /= sizeof(u32);
-
-   pr_debug(" intspec=%d intlen=%d\n", *intspec, intlen);
-
-   /* Get the reg property (if any) */
-   addr = of_get_property(device, "reg", NULL);
-
-   /* Look for the interrupt parent. */
-   p = of_irq_find_parent(device);
-   if (p == NULL)
-   return -EINVAL;
-
-   /* Get size of interrupt specifier */
-   tmp = of_get_property(p, "#interrupt-cells", NULL);
-   if (tmp == NULL) {
-   of_node_put(p);
-   return -EINVAL;
-   }
-   intsize = *tmp;
-
-   pr_debug(" intsize=%d intlen=%d\n", intsize, intlen);
-
-   /* Check index */
-   if ((index + 1) * intsize > intlen)
-   return -EINVAL;
-
-   /* Get new specifier and map it */
-   res = of_irq_map_raw(p, intspec + index * intsize, intsize,
-   addr, out_irq);
-   of_node_put(p);
-   return res;
+   return __of_irq_map_one(device, index, out_irq);
 }
 EXPORT_SYMBOL_GPL(of_irq_map_one);
 
@@ -740,35 +698,6 @@ const void *of_get_mac_address(struct device_node *np)
 }
 EXPORT_SYMBOL(of_get_mac_address);
 
-int of_irq_to_resource(struct device_node *dev, int index, struct resource *r)
-{
-   struct of_irq out_irq;
-   int irq;
-   int res;
-
-   res = of_irq_map_one(dev, index, &out_irq);
-
-   /* Get irq for the device */
-   if (res) {
-   pr_debug("IRQ not found... code = %d", res);
-   return NO_IRQ;
-   }
-   /* Assuming single interrupt controller... */
-   irq = out_irq.specifier[0];
-
-   pr_debug("IRQ found = %d", irq);
-
-   /* Only dereference the resource if both the
-* resource and the irq are valid. */
-   if (r && irq != NO_IRQ) {
-   r->start = r->end = irq;
-   r->flags = IORESOURCE_IRQ;
-   }
-
-   return irq;
-}
-EXPORT_SYMBOL_GPL(of_irq_to_resource);
-
 void __iomem *of_iomap(struct device_node *np, int index)
 {
struct resource res;
diff --git a/arch/powerpc/include/asm/prom.h b/arch/powerpc/include/asm/prom.h
index 187ef4e..2440984 100644
--- a/arch/powerpc/include/asm/prom.h
+++ b/arch/powerpc/include/asm/prom.h
@@ -136,9 +136,6 @@ extern void of_irq_map_init(unsigned int flags);
 struct pci_dev;
 extern int of_irq_map_pci(struct pci_dev *pdev, struct of_irq *out_irq);
 
-extern int of_irq_to_resource(struct device_node *dev, int index,
-   struct resource *r);
-
 /**
  * of_iomap - Maps the memory mapped IO for a given device_node
  * @device:the device whose io range will be mapped
diff --git a/arch/powerpc/kernel/prom_parse.c b/arch/powerpc/kernel/prom_parse.c
index 89ca7b3..ef518e3 100644
--- a/arch/powerpc/

[PATCH 4/5] of/irq: Merge of_irq_map_raw()

2010-06-04 Thread Grant Likely
Merge common code between PowerPC and Microblaze

Signed-off-by: Grant Likely 
CC: Michal Simek 
CC: Wolfram Sang 
CC: Stephen Rothwell 
CC: Benjamin Herrenschmidt 
CC: microblaze-ucli...@itee.uq.edu.au
CC: linuxppc-...@ozlabs.org
CC: devicetree-disc...@lists.ozlabs.org
---
 arch/microblaze/include/asm/prom.h  |   21 
 arch/microblaze/kernel/prom_parse.c |  176 -
 arch/powerpc/include/asm/prom.h |   21 
 arch/powerpc/kernel/prom_parse.c|  171 
 drivers/of/irq.c|  188 +++
 include/linux/of_irq.h  |2 
 6 files changed, 190 insertions(+), 389 deletions(-)

diff --git a/arch/microblaze/include/asm/prom.h 
b/arch/microblaze/include/asm/prom.h
index da7069c..89fca70 100644
--- a/arch/microblaze/include/asm/prom.h
+++ b/arch/microblaze/include/asm/prom.h
@@ -94,27 +94,6 @@ extern const void *of_get_mac_address(struct device_node 
*np);
  */
 
 /**
- * of_irq_map_raw - Low level interrupt tree parsing
- * @parent:the device interrupt parent
- * @intspec:   interrupt specifier ("interrupts" property of the device)
- * @ointsize:  size of the passed in interrupt specifier
- * @addr:  address specifier (start of "reg" property of the device)
- * @out_irq:   structure of_irq filled by this function
- *
- * Returns 0 on success and a negative number on error
- *
- * This function is a low-level interrupt tree walking function. It
- * can be used to do a partial walk with synthetized reg and interrupts
- * properties, for example when resolving PCI interrupts when no device
- * node exist for the parent.
- *
- */
-
-extern int of_irq_map_raw(struct device_node *parent, const u32 *intspec,
-   u32 ointsize, const u32 *addr,
-   struct of_irq *out_irq);
-
-/**
  * of_irq_map_pci - Resolve the interrupt for a PCI device
  * @pdev:  the device whose interrupt is to be resolved
  * @out_irq:   structure of_irq filled by this function
diff --git a/arch/microblaze/kernel/prom_parse.c 
b/arch/microblaze/kernel/prom_parse.c
index 946f14d..02ec946 100644
--- a/arch/microblaze/kernel/prom_parse.c
+++ b/arch/microblaze/kernel/prom_parse.c
@@ -653,182 +653,6 @@ struct device_node *of_irq_find_parent_by_phandle(phandle 
p)
return of_find_node_by_phandle(p);
 }
 
-int of_irq_map_raw(struct device_node *parent, const u32 *intspec, u32 
ointsize,
-   const u32 *addr, struct of_irq *out_irq)
-{
-   struct device_node *ipar, *tnode, *old = NULL, *newpar = NULL;
-   const u32 *tmp, *imap, *imask;
-   u32 intsize = 1, addrsize, newintsize = 0, newaddrsize = 0;
-   int imaplen, match, i;
-
-   pr_debug("of_irq_map_raw: par=%s,intspec=[0x%08x 0x%08x...],"
-   "ointsize=%d\n",
-   parent->full_name, intspec[0], intspec[1], ointsize);
-
-   ipar = of_node_get(parent);
-
-   /* First get the #interrupt-cells property of the current cursor
-* that tells us how to interpret the passed-in intspec. If there
-* is none, we are nice and just walk up the tree
-*/
-   do {
-   tmp = of_get_property(ipar, "#interrupt-cells", NULL);
-   if (tmp != NULL) {
-   intsize = *tmp;
-   break;
-   }
-   tnode = ipar;
-   ipar = of_irq_find_parent(ipar);
-   of_node_put(tnode);
-   } while (ipar);
-   if (ipar == NULL) {
-   pr_debug(" -> no parent found !\n");
-   goto fail;
-   }
-
-   pr_debug("of_irq_map_raw: ipar=%s, size=%d\n",
-   ipar->full_name, intsize);
-
-   if (ointsize != intsize)
-   return -EINVAL;
-
-   /* Look for this #address-cells. We have to implement the old linux
-* trick of looking for the parent here as some device-trees rely on it
-*/
-   old = of_node_get(ipar);
-   do {
-   tmp = of_get_property(old, "#address-cells", NULL);
-   tnode = of_get_parent(old);
-   of_node_put(old);
-   old = tnode;
-   } while (old && tmp == NULL);
-   of_node_put(old);
-   old = NULL;
-   addrsize = (tmp == NULL) ? 2 : *tmp;
-
-   pr_debug(" -> addrsize=%d\n", addrsize);
-
-   /* Now start the actual "proper" walk of the interrupt tree */
-   while (ipar != NULL) {
-   /* Now check if cursor is an interrupt-controller and if it is
-* then we are done
-*/
-   if (of_get_property(ipar, "interrupt-controller", NULL) !=
-   NULL) {
-   pr_debug(" -> got it !\n");
-   memcpy(out_irq->specifier, intspec,
-   intsize * sizeof(u32));
-   out_irq->size = intsize;
-   out_irq->controller = ipar;

[PATCH 3/5] of/irq: merge of_irq_find_parent()

2010-06-04 Thread Grant Likely
Merge common code between PowerPC and Microblaze.  Also create a new
arch hook, of_irq_find_parent_by_phandle() to handle arch-specific
quirks.

Signed-off-by: Grant Likely 
CC: Michal Simek 
CC: Benjamin Herrenschmidt 
CC: Stephen Rothwell 
CC: microblaze-ucli...@itee.uq.edu.au
CC: linuxppc-dev@lists.ozlabs.org
CC: devicetree-disc...@lists.ozlabs.org
---
 arch/microblaze/kernel/prom_parse.c |   22 +++---
 arch/powerpc/kernel/prom_parse.c|   30 +-
 drivers/of/irq.c|   28 
 include/linux/of_irq.h  |2 ++
 4 files changed, 38 insertions(+), 44 deletions(-)

diff --git a/arch/microblaze/kernel/prom_parse.c 
b/arch/microblaze/kernel/prom_parse.c
index af1b2a7..946f14d 100644
--- a/arch/microblaze/kernel/prom_parse.c
+++ b/arch/microblaze/kernel/prom_parse.c
@@ -648,25 +648,9 @@ void of_parse_dma_window(struct device_node *dn, const 
void *dma_window_prop,
  * Interrupt remapper
  */
 
-static struct device_node *of_irq_find_parent(struct device_node *child)
+struct device_node *of_irq_find_parent_by_phandle(phandle p)
 {
-   struct device_node *p;
-   const phandle *parp;
-
-   if (!of_node_get(child))
-   return NULL;
-
-   do {
-   parp = of_get_property(child, "interrupt-parent", NULL);
-   if (parp == NULL)
-   p = of_get_parent(child);
-   else
-   p = of_find_node_by_phandle(*parp);
-   of_node_put(child);
-   child = p;
-   } while (p && of_get_property(p, "#interrupt-cells", NULL) == NULL);
-
-   return p;
+   return of_find_node_by_phandle(p);
 }
 
 int of_irq_map_raw(struct device_node *parent, const u32 *intspec, u32 
ointsize,
@@ -783,7 +767,7 @@ int of_irq_map_raw(struct device_node *parent, const u32 
*intspec, u32 ointsize,
pr_debug(" -> match=%d (imaplen=%d)\n", match, imaplen);
 
/* Get the interrupt parent */
-   newpar = of_find_node_by_phandle((phandle)*imap);
+   newpar = of_irq_find_parent_by_phandle((phandle)*imap);
imap++;
--imaplen;
 
diff --git a/arch/powerpc/kernel/prom_parse.c b/arch/powerpc/kernel/prom_parse.c
index 8362620..39e977d 100644
--- a/arch/powerpc/kernel/prom_parse.c
+++ b/arch/powerpc/kernel/prom_parse.c
@@ -685,29 +685,12 @@ void of_parse_dma_window(struct device_node *dn, const 
void *dma_window_prop,
 static unsigned int of_irq_workarounds;
 static struct device_node *of_irq_dflt_pic;
 
-static struct device_node *of_irq_find_parent(struct device_node *child)
+struct device_node *of_irq_find_parent_by_phandle(phandle p)
 {
-   struct device_node *p;
-   const phandle *parp;
-
-   if (!of_node_get(child))
-   return NULL;
-
-   do {
-   parp = of_get_property(child, "interrupt-parent", NULL);
-   if (parp == NULL)
-   p = of_get_parent(child);
-   else {
-   if (of_irq_workarounds & OF_IMAP_NO_PHANDLE)
-   p = of_node_get(of_irq_dflt_pic);
-   else
-   p = of_find_node_by_phandle(*parp);
-   }
-   of_node_put(child);
-   child = p;
-   } while (p && of_get_property(p, "#interrupt-cells", NULL) == NULL);
+   if (of_irq_workarounds & OF_IMAP_NO_PHANDLE)
+   return of_node_get(of_irq_dflt_pic);
 
-   return p;
+   return of_find_node_by_phandle(p);
 }
 
 /* This doesn't need to be called if you don't have any special workaround
@@ -859,10 +842,7 @@ int of_irq_map_raw(struct device_node *parent, const u32 
*intspec, u32 ointsize,
DBG(" -> match=%d (imaplen=%d)\n", match, imaplen);
 
/* Get the interrupt parent */
-   if (of_irq_workarounds & OF_IMAP_NO_PHANDLE)
-   newpar = of_node_get(of_irq_dflt_pic);
-   else
-   newpar = 
of_find_node_by_phandle((phandle)*imap);
+   newpar = of_irq_find_parent_by_phandle((phandle)*imap);
imap++;
--imaplen;
 
diff --git a/drivers/of/irq.c b/drivers/of/irq.c
index 56ad1aa..ad569ca 100644
--- a/drivers/of/irq.c
+++ b/drivers/of/irq.c
@@ -24,6 +24,34 @@
 #include 
 #include 
 
+/**
+ * of_irq_find_parent - Given a device node, find its interrupt parent node
+ * @child: pointer to device node
+ *
+ * Returns a pointer to the interrupt parent node, or NULL if the interrupt
+ * parent could not be determined.
+ */
+struct device_node *of_irq_find_parent(struct device_node *child)
+{
+   struct device_node *p;
+   const phandle *parp;
+
+   if (!of_node_get(child))
+   return NULL;
+
+   

[PATCH 0/2] Replace of_device with platform_device

2010-06-04 Thread Grant Likely
This series is based on Linus' current tree.  It eliminate struct
of_device in preparation for the merge of of_platform_bus_type and
platform_bus_type.

Assuming there are no objections, I'll be putting these to linux-next
to stew sometime next week.

g.

---

Grant Likely (2):
     sparc/of: Move of_device fields into struct pdev_archdata
     of: kill struct of_device


 arch/microblaze/include/asm/of_device.h |   10 --
 arch/powerpc/include/asm/of_device.h    |   11 ---
 arch/powerpc/include/asm/smu.h          |    4 ++--
 arch/sparc/include/asm/device.h         |    9 +++--
 arch/sparc/include/asm/floppy_64.h      |    4 ++--
 arch/sparc/include/asm/of_device.h      |   19 ---
 arch/sparc/include/asm/parport.h        |    4 ++--
 arch/sparc/kernel/of_device_32.c        |   28 
 arch/sparc/kernel/of_device_64.c        |   24 ++--
 arch/sparc/kernel/of_device_common.c    |    4 ++--
 arch/sparc/kernel/pci.c                 |    2 +-
 arch/sparc/kernel/pci_psycho.c          |    8 
 arch/sparc/kernel/pci_sabre.c           |    8 
 arch/sparc/kernel/pci_schizo.c          |   20 ++--
 arch/sparc/kernel/power.c               |    2 +-
 drivers/atm/fore200e.c                  |    2 +-
 drivers/input/serio/i8042-sparcio.h     |    8 
 drivers/net/myri_sbus.c                 |    2 +-
 drivers/net/niu.c                       |    6 +++---
 drivers/net/niu.h                       |    4 ++--
 drivers/net/sunbmac.c                   |    2 +-
 drivers/net/sunhme.c                    |    6 +++---
 drivers/net/sunlance.c                  |    2 +-
 drivers/net/sunqe.c                     |    6 +++---
 drivers/parport/parport_sunbpp.c        |    2 +-
 drivers/sbus/char/bbc_i2c.c             |    6 +++---
 drivers/sbus/char/uctrl.c               |    2 +-
 drivers/scsi/qlogicpti.c                |    4 ++--
 drivers/scsi/sun_esp.c                  |    2 +-
 drivers/serial/sunhv.c                  |    4 ++--
 drivers/serial/sunsab.c                 |    2 +-
 drivers/serial/sunsu.c                  |    2 +-
 drivers/serial/sunzilog.c               |   10 +-
 drivers/watchdog/cpwd.c                 |    2 +-
 include/linux/of_device.h               |   17 +
 sound/sparc/amd7930.c                   |    2 +-
 sound/sparc/cs4231.c                    |   14 +++---
 sound/sparc/dbri.c                      |    2 +-
 38 files changed, 120 insertions(+), 146 deletions(-)

--
Signature



-- 
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 1/5] of/irq: Move irq_of_parse_and_map() to common code

2010-06-04 Thread Grant Likely
Merge common code between PowerPC and Microblaze.  SPARC implements
irq_of_parse_and_map(), but the implementation is different, so it
does not use this code.

Signed-off-by: Grant Likely 
CC: Michal Simek 
CC: "David S. Miller" 
CC: Stephen Rothwell 
CC: Benjamin Herrenschmidt 
CC: Jeremy Kerr 
CC: microblaze-ucli...@itee.uq.edu.au
CC: linuxppc-...@ozlabs.org
CC: sparcli...@vger.kernel.org
CC: devicetree-disc...@lists.ozlabs.org
---
 arch/microblaze/include/asm/irq.h  |   13 ---
 arch/microblaze/include/asm/prom.h |   26 +--
 arch/microblaze/kernel/irq.c   |   14 ++--
 arch/powerpc/include/asm/irq.h |   13 ---
 arch/powerpc/include/asm/prom.h|   27 +---
 arch/powerpc/kernel/irq.c  |   14 ++--
 arch/sparc/include/asm/prom.h  |1 -
 drivers/of/Kconfig |4 
 drivers/of/Makefile|1 +
 drivers/of/irq.c   |   37 
 drivers/of/of_mdio.c   |1 +
 include/linux/of_irq.h |   41 
 12 files changed, 90 insertions(+), 102 deletions(-)
 create mode 100644 drivers/of/irq.c
 create mode 100644 include/linux/of_irq.h

diff --git a/arch/microblaze/include/asm/irq.h 
b/arch/microblaze/include/asm/irq.h
index 31a35c3..10d75c1 100644
--- a/arch/microblaze/include/asm/irq.h
+++ b/arch/microblaze/include/asm/irq.h
@@ -62,17 +62,4 @@ struct irq_host;
 extern unsigned int irq_create_mapping(struct irq_host *host,
irq_hw_number_t hwirq);
 
-/**
- * irq_create_of_mapping - Map a hardware interrupt into linux virq space
- * @controller: Device node of the interrupt controller
- * @inspec: Interrupt specifier from the device-tree
- * @intsize: Size of the interrupt specifier from the device-tree
- *
- * This function is identical to irq_create_mapping except that it takes
- * as input informations straight from the device-tree (typically the results
- * of the of_irq_map_*() functions.
- */
-extern unsigned int irq_create_of_mapping(struct device_node *controller,
-   u32 *intspec, unsigned int intsize);
-
 #endif /* _ASM_MICROBLAZE_IRQ_H */
diff --git a/arch/microblaze/include/asm/prom.h 
b/arch/microblaze/include/asm/prom.h
index e7d67a3..e9fb2eb 100644
--- a/arch/microblaze/include/asm/prom.h
+++ b/arch/microblaze/include/asm/prom.h
@@ -20,6 +20,7 @@
 #ifndef __ASSEMBLY__
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -92,18 +93,6 @@ extern const void *of_get_mac_address(struct device_node 
*np);
  * OF interrupt mapping
  */
 
-/* This structure is returned when an interrupt is mapped. The controller
- * field needs to be put() after use
- */
-
-#define OF_MAX_IRQ_SPEC4 /* We handle specifiers of at most 4 
cells */
-
-struct of_irq {
-   struct device_node *controller; /* Interrupt controller node */
-   u32 size; /* Specifier size */
-   u32 specifier[OF_MAX_IRQ_SPEC]; /* Specifier copy */
-};
-
 /**
  * of_irq_map_init - Initialize the irq remapper
  * @flags: flags defining workarounds to enable
@@ -139,19 +128,6 @@ extern int of_irq_map_raw(struct device_node *parent, 
const u32 *intspec,
struct of_irq *out_irq);
 
 /**
- * of_irq_map_one - Resolve an interrupt for a device
- * @device:the device whose interrupt is to be resolved
- * @index: index of the interrupt to resolve
- * @out_irq:   structure of_irq filled by this function
- *
- * This function resolves an interrupt, walking the tree, for a given
- * device-tree node. It's the high level pendant to of_irq_map_raw().
- * It also implements the workarounds for OldWolrd Macs.
- */
-extern int of_irq_map_one(struct device_node *device, int index,
-   struct of_irq *out_irq);
-
-/**
  * of_irq_map_pci - Resolve the interrupt for a PCI device
  * @pdev:  the device whose interrupt is to be resolved
  * @out_irq:   structure of_irq filled by this function
diff --git a/arch/microblaze/kernel/irq.c b/arch/microblaze/kernel/irq.c
index 8f120ac..dd32b09 100644
--- a/arch/microblaze/kernel/irq.c
+++ b/arch/microblaze/kernel/irq.c
@@ -17,20 +17,10 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
-unsigned int irq_of_parse_and_map(struct device_node *dev, int index)
-{
-   struct of_irq oirq;
-
-   if (of_irq_map_one(dev, index, &oirq))
-   return NO_IRQ;
-
-   return oirq.specifier[0];
-}
-EXPORT_SYMBOL_GPL(irq_of_parse_and_map);
-
 static u32 concurrent_irq;
 
 void __irq_entry do_IRQ(struct pt_regs *regs)
@@ -104,7 +94,7 @@ unsigned int irq_create_mapping(struct irq_host *host, 
irq_hw_number_t hwirq)
 EXPORT_SYMBOL_GPL(irq_create_mapping);
 
 unsigned int irq_create_of_mapping(struct device_node *controller,
-   u32 *intspec, unsigned int intsize)
+  con

[PATCH 2/2] of: kill struct of_device

2010-06-04 Thread Grant Likely
Now that the device tree node pointer has been moved out of struct
of_device and into the common struct device, there isn't anything
unique about of_device anymore.  In fact, there isn't much need
for a separate of_bus when all busses have access to OF style
probing.

arch/powerpc and arch/microblaze are moving away from using the of_bus
and using the regular platform bus instead for mmio devices.  This
patch makes of_device the same as platform_device as a stepping stone
in migrating of_platform_drivers over to the platform bus.

Signed-off-by: Grant Likely 
CC: Michal Simek 
CC: Benjamin Herrenschmidt 
CC: "David S. Miller" 
CC: Stephen Rothwell 
CC: microblaze-ucli...@itee.uq.edu.au
CC: linuxppc-...@ozlabs.org
CC: sparcli...@vger.kernel.org
CC: devicetree-disc...@lists.ozlabs.org
---
 arch/microblaze/include/asm/of_device.h |   10 --
 arch/powerpc/include/asm/of_device.h|   11 ---
 arch/powerpc/include/asm/smu.h  |4 ++--
 arch/sparc/include/asm/device.h |4 ++--
 arch/sparc/include/asm/of_device.h  |   14 --
 drivers/net/niu.h   |4 ++--
 include/linux/of_device.h   |   17 +
 7 files changed, 23 insertions(+), 41 deletions(-)

diff --git a/arch/microblaze/include/asm/of_device.h 
b/arch/microblaze/include/asm/of_device.h
index 73cb980..0a5f3f9 100644
--- a/arch/microblaze/include/asm/of_device.h
+++ b/arch/microblaze/include/asm/of_device.h
@@ -15,16 +15,6 @@
 #include 
 #include 
 
-/*
- * The of_device is a kind of "base class" that is a superset of
- * struct device for use by devices attached to an OF node and
- * probed using OF properties.
- */
-struct of_device {
-   struct device   dev; /* Generic device interface */
-   struct pdev_archdataarchdata;
-};
-
 extern ssize_t of_device_get_modalias(struct of_device *ofdev,
char *str, ssize_t len);
 
diff --git a/arch/powerpc/include/asm/of_device.h 
b/arch/powerpc/include/asm/of_device.h
index 444e97e..cb36632 100644
--- a/arch/powerpc/include/asm/of_device.h
+++ b/arch/powerpc/include/asm/of_device.h
@@ -5,17 +5,6 @@
 #include 
 #include 
 
-/*
- * The of_device is a kind of "base class" that is a superset of
- * struct device for use by devices attached to an OF node and
- * probed using OF properties.
- */
-struct of_device
-{
-   struct device   dev;/* Generic device interface */
-   struct pdev_archdataarchdata;
-};
-
 extern struct of_device *of_device_alloc(struct device_node *np,
 const char *bus_id,
 struct device *parent);
diff --git a/arch/powerpc/include/asm/smu.h b/arch/powerpc/include/asm/smu.h
index 7ae2753..e3bdada 100644
--- a/arch/powerpc/include/asm/smu.h
+++ b/arch/powerpc/include/asm/smu.h
@@ -457,8 +457,8 @@ extern void smu_poll(void);
  */
 extern int smu_init(void);
 extern int smu_present(void);
-struct of_device;
-extern struct of_device *smu_get_ofdev(void);
+struct platform_device;
+extern struct platform_device *smu_get_ofdev(void);
 
 
 /*
diff --git a/arch/sparc/include/asm/device.h b/arch/sparc/include/asm/device.h
index f9740d0..fb220e4 100644
--- a/arch/sparc/include/asm/device.h
+++ b/arch/sparc/include/asm/device.h
@@ -9,13 +9,13 @@
 #include 
 
 struct device_node;
-struct of_device;
+struct platform_device;
 
 struct dev_archdata {
void*iommu;
void*stc;
void*host_controller;
-   struct of_device*op;
+   struct platform_device  *op;
int numa_node;
 };
 
diff --git a/arch/sparc/include/asm/of_device.h 
b/arch/sparc/include/asm/of_device.h
index 6d1844a..22b9828 100644
--- a/arch/sparc/include/asm/of_device.h
+++ b/arch/sparc/include/asm/of_device.h
@@ -7,20 +7,6 @@
 #include 
 #include 
 
-/*
- * The of_device is a kind of "base class" that is a superset of
- * struct device for use by devices attached to an OF node and
- * probed using OF properties.
- */
-struct of_device
-{
-   struct device   dev;
-   u32 num_resources;
-   struct resource *resource;
-
-   struct pdev_archdataarchdata;
-};
-
 extern void __iomem *of_ioremap(struct resource *res, unsigned long offset, 
unsigned long size, char *name);
 extern void of_iounmap(struct resource *res, void __iomem *base, unsigned long 
size);
 
diff --git a/drivers/net/niu.h b/drivers/net/niu.h
index d671546..a41fa8e 100644
--- a/drivers/net/niu.h
+++ b/drivers/net/niu.h
@@ -3236,7 +3236,7 @@ struct niu_phy_ops {
int (*link_status)(struct niu *np, int *);
 };
 
-struct of_device;
+struct platform_device;
 struct niu {
void __iomem*regs;
struct net_device   *dev;
@@ -3297,7 +3297,7 @@ struct niu {
struct niu_vpd

Re: fsl_rio.c build problem

2010-06-04 Thread Scott Wood

On 06/04/2010 06:24 AM, kerstin jonsson wrote:

Hi,

I'm using:

git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git

and building for ARCH=powerpc - mpc85xx_defconfig

arch/powerpc/sysdev/fsl_rio.c will not build due to a missing
MCSR_MASK bitmask definition.

The attached patch is based on code found in

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

and - at the least - will fix the build problem.


Can we remove the use of MCSR_MASK from fsl_rio.c instead?  I don't see 
what it's accomplishing here.  MCSR_MASK will be wrong on e500mc, so 
exporting it as something that looks generic doesn't seem right.


MCSR_BUS_RBERR also needs to change on e500mc -- you'll probably get 
MCSR_LDG.


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


Re: [PATCH 1/1] [SCSI] ipr: fix resource path display and formatting

2010-06-04 Thread Brian King
Acked-by: Brian King 


On 06/03/2010 06:02 PM, Wayne Boyer wrote:
> It was possible to overflow the buffer used to print out the formatted
> version of the resource path.  The fix is to limit the number of
> bytes that get formatted.
> 
> This patch also updates the ipr_show_resource_path function to display the
> resource address for devices that are attached to adapters that don't
> support resource paths.
> 
> Signed-off-by: Wayne Boyer 
> ---
> 
> James, this patch needs to go into rc-fixes.  It fixes an oops that is
> currently being seen on Power.
> 
> ---
>  drivers/scsi/ipr.c |   51 +--
>  drivers/scsi/ipr.h |5 +++--
>  2 files changed, 36 insertions(+), 20 deletions(-)
> 
> Index: b/drivers/scsi/ipr.c
> ===
> --- a/drivers/scsi/ipr.c  2010-05-26 16:01:22.0 -0700
> +++ b/drivers/scsi/ipr.c  2010-06-03 15:31:59.0 -0700
> @@ -1129,20 +1129,22 @@ static int ipr_is_same_device(struct ipr
>  }
> 
>  /**
> - * ipr_format_resource_path - Format the resource path for printing.
> + * ipr_format_res_path - Format the resource path for printing.
>   * @res_path:resource path
>   * @buf: buffer
>   *
>   * Return value:
>   *   pointer to buffer
>   **/
> -static char *ipr_format_resource_path(u8 *res_path, char *buffer)
> +static char *ipr_format_res_path(u8 *res_path, char *buffer, int len)
>  {
>   int i;
> + char *p = buffer;
> 
> - sprintf(buffer, "%02X", res_path[0]);
> - for (i=1; res_path[i] != 0xff; i++)
> - sprintf(buffer, "%s-%02X", buffer, res_path[i]);
> + res_path[0] = '\0';
> + p += snprintf(p, buffer + len - p, "%02X", res_path[0]);
> + for (i = 1; res_path[i] != 0xff && ((i * 3) < len); i++)
> + p += snprintf(p, buffer + len - p, "-%02X", res_path[i]);
> 
>   return buffer;
>  }
> @@ -1187,7 +1189,8 @@ static void ipr_update_res_entry(struct 
> 
>   if (res->sdev && new_path)
>   sdev_printk(KERN_INFO, res->sdev, "Resource path: %s\n",
> - ipr_format_resource_path(&res->res_path[0], 
> &buffer[0]));
> + ipr_format_res_path(res->res_path, buffer,
> + sizeof(buffer)));
>   } else {
>   res->flags = cfgtew->u.cfgte->flags;
>   if (res->flags & IPR_IS_IOA_RESOURCE)
> @@ -1573,7 +1576,8 @@ static void ipr_log_sis64_config_error(s
>   ipr_err_separator;
> 
>   ipr_err("Device %d : %s", i + 1,
> -  ipr_format_resource_path(&dev_entry->res_path[0], 
> &buffer[0]));
> +  ipr_format_res_path(dev_entry->res_path, buffer,
> +  sizeof(buffer)));
>   ipr_log_ext_vpd(&dev_entry->vpd);
> 
>   ipr_err("-New Device Information-\n");
> @@ -1919,13 +1923,14 @@ static void ipr_log64_fabric_path(struct
> 
>   ipr_hcam_err(hostrcb, "%s %s: Resource Path=%s\n",
>path_active_desc[i].desc, 
> path_state_desc[j].desc,
> -  
> ipr_format_resource_path(&fabric->res_path[0], &buffer[0]));
> +  ipr_format_res_path(fabric->res_path, 
> buffer,
> +  sizeof(buffer)));
>   return;
>   }
>   }
> 
>   ipr_err("Path state=%02X Resource Path=%s\n", path_state,
> - ipr_format_resource_path(&fabric->res_path[0], &buffer[0]));
> + ipr_format_res_path(fabric->res_path, buffer, sizeof(buffer)));
>  }
> 
>  static const struct {
> @@ -2066,7 +2071,8 @@ static void ipr_log64_path_elem(struct i
> 
>   ipr_hcam_err(hostrcb, "%s %s: Resource Path=%s, Link 
> rate=%s, WWN=%08X%08X\n",
>path_status_desc[j].desc, 
> path_type_desc[i].desc,
> -  
> ipr_format_resource_path(&cfg->res_path[0], &buffer[0]),
> +  ipr_format_res_path(cfg->res_path, buffer,
> +  sizeof(buffer)),
>link_rate[cfg->link_rate & 
> IPR_PHY_LINK_RATE_MASK],
>be32_to_cpu(cfg->wwid[0]), 
> be32_to_cpu(cfg->wwid[1]));
>   return;
> @@ -2074,7 +2080,7 @@ static void ipr_log64_path_elem(struct i
>   }
>   ipr_hcam_err(hostrcb, "Path element=%02X: Resource Path=%s, Link 
> rate=%s "
>"WWN=%08X%08X\n", cfg->type_status,
> -  ipr_format_resource_path(&cfg->res_path[0], &buffer[0]),
> +  ipr_format_res_path(cfg->res_path, buffer, sizeof(buffer)),
>link_rate[cfg->link_rate & IPR_PHY_LINK_RATE_MASK],
>

Re: [PATCH 0/5] Rework MPC5121 DIU support (for 2.6.35)

2010-06-04 Thread Timur Tabi
On Tue, Jun 1, 2010 at 4:38 AM, Anatolij Gustschin  wrote:

> Could you please test these patches on MPC8610 HPCD? I think these
> changes won't break that platform. The patches apply cleanly on
> 2.6.35-rc1.

I'll try to get to them as soon as I can.

-- 
Timur Tabi
Linux kernel developer at Freescale
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: [PATCH] kvm/powerpc: fix a build error in e500_tlb.c

2010-06-04 Thread Alexander Graf

On 03.06.2010, at 07:52, Kevin Hao wrote:

> We use the wrong number arguments when invoking trace_kvm_stlb_inval,
> and cause the following build error.
> arch/powerpc/kvm/e500_tlb.c: In function 'kvmppc_e500_stlbe_invalidate':
> arch/powerpc/kvm/e500_tlb.c:230: error: too many arguments to function 
> 'trace_kvm_stlb_inval'

Liu, I'd like to get an ack from you here.

Alex

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


[PATCH]460EX on-chip SATA driver

2010-06-04 Thread Rupjyoti Sarmah
This patch enables the on-chip DWC SATA controller of the AppliedMicro 
processor 460EX.

Signed-off-by: Rupjyoti Sarmah  
Signed-off-by: Mark Miesfeld 
Signed-off-by: Prodyut Hazarika 

---
 drivers/ata/Kconfig  |9 +
 drivers/ata/Makefile |1 +
 drivers/ata/sata_dwc_460ex.c | 1808 ++
 3 files changed, 1818 insertions(+), 0 deletions(-)
 create mode 100644 drivers/ata/sata_dwc_460ex.c

diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig
index 56c6374..bba7b8a 100644
--- a/drivers/ata/Kconfig
+++ b/drivers/ata/Kconfig
@@ -82,6 +82,15 @@ config SATA_FSL
 
  If unsure, say N.
 
+config SATA_DWC
+   tristate "DesignWare Cores SATA support"
+   depends on 460EX
+   help
+ This option enables support for the on-chip SATA controller of the
+ AppliedMicro processor 460EX.
+
+ If unsure, say N.
+
 config ATA_SFF
bool "ATA SFF support"
default y
diff --git a/drivers/ata/Makefile b/drivers/ata/Makefile
index fc936d4..96ff315 100644
--- a/drivers/ata/Makefile
+++ b/drivers/ata/Makefile
@@ -19,6 +19,7 @@ obj-$(CONFIG_SATA_INIC162X)   += sata_inic162x.o
 obj-$(CONFIG_PDC_ADMA) += pdc_adma.o
 obj-$(CONFIG_SATA_FSL) += sata_fsl.o
 obj-$(CONFIG_PATA_MACIO)   += pata_macio.o
+obj-$(CONFIG_SATA_DWC) += sata_dwc_460ex.o
 
 obj-$(CONFIG_PATA_ALI) += pata_ali.o
 obj-$(CONFIG_PATA_AMD) += pata_amd.o
diff --git a/drivers/ata/sata_dwc_460ex.c b/drivers/ata/sata_dwc_460ex.c
new file mode 100644
index 000..e6e2896
--- /dev/null
+++ b/drivers/ata/sata_dwc_460ex.c
@@ -0,0 +1,1808 @@
+/*
+ * drivers/ata/sata_dwc_460ex.c
+ *
+ * Synopsys DesignWare Cores (DWC) SATA host driver
+ *
+ * Author: Mark Miesfeld 
+ *
+ * Ported from 2.6.19.2 to 2.6.25/26 by Stefan Roese 
+ * Copyright 2008 DENX Software Engineering
+ *
+ * Based on versions provided by AMCC and Synopsys which are:
+ *  Copyright 2006 Applied Micro Circuits Corporation
+ *  COPYRIGHT (C) 2005  SYNOPSYS, INC.  ALL RIGHTS RESERVED
+ *
+ * This program is free software; you can redistribute  it and/or modify it
+ * under  the terms of  the GNU General  Public License as published by the
+ * Free Software Foundation;  either version 2 of the  License, or (at your
+ * option) any later version.
+ *
+ */
+
+#ifdef CONFIG_SATA_DWC_DEBUG
+#define DEBUG
+#endif
+
+#ifdef CONFIG_SATA_DWC_VDEBUG
+#define VERBOSE_DEBUG
+#define DEBUG_NCQ
+#endif
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include "libata.h"
+
+#include 
+#include 
+
+#define DRV_NAME"sata-dwc"
+#define DRV_VERSION "1.0"
+
+/* SATA DMA driver Globals */
+#define DMA_NUM_CHANS  1
+#define DMA_NUM_CHAN_REGS  8
+
+/* SATA DMA Register definitions */
+#define AHB_DMA_BRST_DFLT  64  /* 16 data items burst length*/
+
+struct dmareg {
+   u32 low;/* Low bits 0-31 */
+   u32 high;   /* High bits 32-63 */
+};
+
+/* DMA Per Channel registers */
+
+struct dma_chan_regs {
+   struct dmareg sar;  /* Source Address */
+   struct dmareg dar;  /* Destination address */
+   struct dmareg llp;  /* Linked List Pointer */
+   struct dmareg ctl;  /* Control */
+   struct dmareg sstat;/* Source Status not implemented in core */
+   struct dmareg dstat;/* Destination Status not implemented in core*/
+   struct dmareg sstatar;  /* Source Status Address not impl in core */
+   struct dmareg dstatar;  /* Destination Status Address not implemente */
+   struct dmareg cfg;  /* Config */
+   struct dmareg sgr;  /* Source Gather */
+   struct dmareg dsr;  /* Destination Scatter */
+};
+
+/* Generic Interrupt Registers */
+struct dma_interrupt_regs {
+   struct dmareg tfr;  /* Transfer Interrupt */
+   struct dmareg block;/* Block Interrupt */
+   struct dmareg srctran;  /* Source Transfer Interrupt */
+   struct dmareg dsttran;  /* Dest Transfer Interrupt */
+   struct dmareg error;/* Error */
+};
+
+struct ahb_dma_regs {
+   struct dma_chan_regschan_regs[DMA_NUM_CHAN_REGS];
+   struct dma_interrupt_regs interrupt_raw;/* Raw Interrupt */
+   struct dma_interrupt_regs interrupt_status; /* Interrupt Status */
+   struct dma_interrupt_regs interrupt_mask;   /* Interrupt Mask */
+   struct dma_interrupt_regs interrupt_clear;  /* Interrupt Clear */
+   struct dmareg   statusInt;  /* Interrupt combined*/
+   struct dmareg   rq_srcreg;  /* Src Trans Req */
+   struct dmareg   rq_dstreg;  /* Dst Trans Req */
+   struct dmareg   rq_sgl_srcreg;  /* Sngl Src Trans Req*/
+   struct dmareg   rq_sgl_dstreg;  /* Sngl Dst Trans Req*/
+   struct dmareg   rq_lst_srcreg;  /* Last Src Trans Req*/
+   struct dmareg   rq_lst_dstreg;  /* Last Dst Tr

fsl_rio.c build problem

2010-06-04 Thread kerstin jonsson

Hi,

I'm using:

git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git

and building for ARCH=powerpc - mpc85xx_defconfig

arch/powerpc/sysdev/fsl_rio.c will not build due to a missing
MCSR_MASK bitmask definition.

The attached patch is based on code found in

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

and - at the least - will fix the build problem.

BR,
Kerstin

>From 42d0a01865beda04b70549245ce1854c8f0074d3 Mon Sep 17 00:00:00 2001
From: Kerstin Jonsson 
Date: Fri, 4 Jun 2010 12:56:02 +0200
Subject: [PATCH] fix fsl_rio.c build problem in powerpc mpc85xx_defconfig

---
 arch/powerpc/include/asm/reg_booke.h |   11 +++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/arch/powerpc/include/asm/reg_booke.h b/arch/powerpc/include/asm/reg_booke.h
index 2360317..68c3833 100644
--- a/arch/powerpc/include/asm/reg_booke.h
+++ b/arch/powerpc/include/asm/reg_booke.h
@@ -231,6 +231,12 @@
 #define MCSR_LDG	0x2000UL /* Guarded Load */
 #define MCSR_TLBSYNC	0x0002UL /* Multiple tlbsyncs detected */
 #define MCSR_BSL2_ERR	0x0001UL /* Backside L2 cache error */
+
+/* e500 parts may set unused bits in MCSR; mask these off */
+#define MCSR_MASK	(MCSR_MCP | MCSR_ICPERR | MCSR_DCP_PERR | \
+			MCSR_DCPERR | MCSR_BUS_IAERR | MCSR_BUS_RAERR | \
+			MCSR_BUS_WAERR | MCSR_BUS_IBERR | MCSR_BUS_RBERR | \
+			MCSR_BUS_WBERR | MCSR_BUS_IPERR | MCSR_BUS_RPERR)
 #endif
 
 #ifdef CONFIG_E200
@@ -243,6 +249,11 @@
 #define MCSR_BUS_DRERR 	0x0008UL /* Read Bus Error on data load */
 #define MCSR_BUS_WRERR 	0x0004UL /* Write Bus Error on buffered
 	store or cache line push */
+
+/* e200 parts may set unused bits in MCSR; mask these off */
+#define MCSR_MASK	(MCSR_MCP | MCSR_CP_PERR | MCSR_CPERR | \
+			MCSR_EXCP_ERR | MCSR_BUS_IRERR | MCSR_BUS_DRERR | \
+			MCSR_BUS_WRERR)
 #endif
 
 /* Bit definitions for the DBSR. */
-- 
1.7.1

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

Re: [PATCH] powerpc/oprofile: fix potential buffer overrun in op_model_cell.c

2010-06-04 Thread Robert Richter
On 01.06.10 15:43:34, Denis Kirjanov wrote:
> Fix potential initial_lfsr buffer overrun.
> Writing past the end of the buffer could happen when index == ENTRIES
> 
> Signed-off-by: Denis Kirjanov 

Patch applied to

 git://git.kernel.org/pub/scm/linux/kernel/git/rric/oprofile.git urgent

Thanks Denis.

-Robert

-- 
Advanced Micro Devices, Inc.
Operating System Research Center
email: robert.rich...@amd.com

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


[PATCH]Device tree update for the 460ex DWC SATA

2010-06-04 Thread Rupjyoti Sarmah

Device tree update for the Applied micro processor 460ex on-chip SATA
Signed-off-by: Rupjyoti Sarmah 
---
 arch/powerpc/boot/dts/canyonlands.dts |8 
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/arch/powerpc/boot/dts/canyonlands.dts 
b/arch/powerpc/boot/dts/canyonlands.dts
index cd56bb5..3f86564 100644
--- a/arch/powerpc/boot/dts/canyonlands.dts
+++ b/arch/powerpc/boot/dts/canyonlands.dts
@@ -163,6 +163,14 @@
interrupts = <0x1e 4>;
};
 
+   SATA0: s...@bffd1000 {
+   compatible = "amcc,sata-460ex";
+   reg = <4 0xbffd1000 0x800 4 0xbffd0800 0x400>;
+   interrupt-parent = <&UIC3>;
+   interrupts = <0x0 0x4   /* SATA */
+ 0x5 0x4>; /* AHBDMA */
+   };
+
POB0: opb {
compatible = "ibm,opb-460ex", "ibm,opb";
#address-cells = <1>;
-- 
1.5.6.3

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


Re: [Patch 0/5] PPC64-HWBKPT: Hardware Breakpoint interfaces - ver XXII

2010-06-04 Thread Paul Mackerras
On Fri, Jun 04, 2010 at 12:21:45PM +0530, K.Prasad wrote:

> Meanwhile I tested the per-cpu breakpoints with the new emulate_step
> patch (refer linuxppc-dev message-id:
> 20100602112903.gb30...@brick.ozlabs.ibm.com) and they continue to fail
> due to emulate_step() failure, in my case, on a "lwz r0,0(r28)"
> instruction.

Strange, what was in r28?  The emulator should handle that instruction.

> About the latest patchset, given that we chose to ignore extraneous
> interrupts for non-ptrace breakpoints, I thought that re-using
> current->thread.ptrace_bps as a flag would be efficient than introducing
> a new member in 'struct thread_struct' to do the same. I'm not sure if
> you foresee any issues with that.

I just wonder what provides exclusion between its use as a flag and
its use to hold a real ptrace breakpoint.  As far as I can see nothing
does.  If there is something, it's off in some other source file,
unless I'm missing something.  And in that case there should be a bit
fat comment explaining why it's safe.

> If so, I'd like to send a new patch (rather than a new version of the
> complete patchset) to fix it along with the dangling put_cpu() in
> arch_unregister_hw_breakpoint() (I forgot to remove parts of the code
> between versions XIX and XX).

OK.

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


[PATCH]Device tree update for the 460ex DWC SATA

2010-06-04 Thread Rupjyoti Sarmah

Device tree update for the Applied micro processor 460ex on-chip SATA
Signed-off-by: Rupjyoti Sarmah 
---
 arch/powerpc/boot/dts/canyonlands.dts |8 
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/arch/powerpc/boot/dts/canyonlands.dts 
b/arch/powerpc/boot/dts/canyonlands.dts
index cd56bb5..3f86564 100644
--- a/arch/powerpc/boot/dts/canyonlands.dts
+++ b/arch/powerpc/boot/dts/canyonlands.dts
@@ -163,6 +163,14 @@
interrupts = <0x1e 4>;
};
 
+   SATA0: s...@bffd1000 {
+   compatible = "amcc,sata-460ex";
+   reg = <4 0xbffd1000 0x800 4 0xbffd0800 0x400>;
+   interrupt-parent = <&UIC3>;
+   interrupts = <0x0 0x4   /* SATA */
+ 0x5 0x4>; /* AHBDMA */
+   };
+
POB0: opb {
compatible = "ibm,opb-460ex", "ibm,opb";
#address-cells = <1>;
-- 
1.5.6.3

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


[PATCH] powerpc/44x: Fix UART2/3 interrupt assignment in PPC460EX/GT dts files

2010-06-04 Thread Stefan Roese
UART2 and UART3 on 460EX/GT have incorrect interrupt mappings right now.
UART2 should be 28 (0x1c) and UART3 29 (0x1d). This patch fixes this and
switches to using decimal number instead of hex, since the AppliedMicro
(AMCC) users manuals describe their inerrupt numbers in decimal.

Thanks to Fabien Proriol for pointing this out.

Signed-off-by: Stefan Roese 
Cc: Fabien Proriol 
Cc: Josh Boyer 
---
 arch/powerpc/boot/dts/canyonlands.dts |4 ++--
 arch/powerpc/boot/dts/glacier.dts |4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/powerpc/boot/dts/canyonlands.dts 
b/arch/powerpc/boot/dts/canyonlands.dts
index cd56bb5..5806ef0 100644
--- a/arch/powerpc/boot/dts/canyonlands.dts
+++ b/arch/powerpc/boot/dts/canyonlands.dts
@@ -270,7 +270,7 @@
clock-frequency = <0>; /* Filled in by U-Boot */
current-speed = <0>; /* Filled in by U-Boot */
interrupt-parent = <&UIC1>;
-   interrupts = <0x1d 0x4>;
+   interrupts = <28 0x4>;
};
 
UART3: ser...@ef600600 {
@@ -281,7 +281,7 @@
clock-frequency = <0>; /* Filled in by U-Boot */
current-speed = <0>; /* Filled in by U-Boot */
interrupt-parent = <&UIC1>;
-   interrupts = <0x1e 0x4>;
+   interrupts = <29 0x4>;
};
 
IIC0: i...@ef600700 {
diff --git a/arch/powerpc/boot/dts/glacier.dts 
b/arch/powerpc/boot/dts/glacier.dts
index d62a4fb..e618fc4 100644
--- a/arch/powerpc/boot/dts/glacier.dts
+++ b/arch/powerpc/boot/dts/glacier.dts
@@ -259,7 +259,7 @@
clock-frequency = <0>; /* Filled in by U-Boot */
current-speed = <0>; /* Filled in by U-Boot */
interrupt-parent = <&UIC1>;
-   interrupts = <0x1d 0x4>;
+   interrupts = <28 0x4>;
};
 
UART3: ser...@ef600600 {
@@ -270,7 +270,7 @@
clock-frequency = <0>; /* Filled in by U-Boot */
current-speed = <0>; /* Filled in by U-Boot */
interrupt-parent = <&UIC1>;
-   interrupts = <0x1e 0x4>;
+   interrupts = <29 0x4>;
};
 
IIC0: i...@ef600700 {
-- 
1.7.1

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