|
|
@@ -1,24 +1,21 @@
|
|
|
-From 6c3ef689e4364dca74eaaecd72384be09e5a6bc8 Mon Sep 17 00:00:00 2001
|
|
|
+From 0f0f7d810226c734141a20de85289dbb0dda8f96 Mon Sep 17 00:00:00 2001
|
|
|
From: Gabor Juhos <[email protected]>
|
|
|
-Date: Mon, 25 Jun 2012 09:19:08 +0200
|
|
|
-Subject: [PATCH 14/34] MIPS: pci-ar71xx: use dynamically allocated PCI controller structure
|
|
|
+Date: Thu, 7 Feb 2013 19:28:14 +0000
|
|
|
+Subject: [PATCH] MIPS: pci-ar71xx: use dynamically allocated PCI controller
|
|
|
+ structure
|
|
|
+
|
|
|
+commit f18118a868f1f7e7bdfea176a204fcc44fae2985 upstream.
|
|
|
|
|
|
Signed-off-by: Gabor Juhos <[email protected]>
|
|
|
+Patchwork: http://patchwork.linux-mips.org/patch/4926/
|
|
|
+Signed-off-by: John Crispin <[email protected]>
|
|
|
---
|
|
|
- arch/mips/pci/pci-ar71xx.c | 84 +++++++++++++++++++++++++++----------------
|
|
|
- 1 files changed, 53 insertions(+), 31 deletions(-)
|
|
|
+ arch/mips/pci/pci-ar71xx.c | 84 ++++++++++++++++++++++++++++----------------
|
|
|
+ 1 file changed, 53 insertions(+), 31 deletions(-)
|
|
|
|
|
|
--- a/arch/mips/pci/pci-ar71xx.c
|
|
|
+++ b/arch/mips/pci/pci-ar71xx.c
|
|
|
-@@ -20,6 +20,7 @@
|
|
|
- #include <linux/interrupt.h>
|
|
|
- #include <linux/module.h>
|
|
|
- #include <linux/platform_device.h>
|
|
|
-+#include <linux/slab.h>
|
|
|
-
|
|
|
- #include <asm/mach-ath79/ar71xx_regs.h>
|
|
|
- #include <asm/mach-ath79/ath79.h>
|
|
|
-@@ -48,8 +49,12 @@
|
|
|
+@@ -48,8 +48,12 @@
|
|
|
|
|
|
#define AR71XX_PCI_IRQ_COUNT 5
|
|
|
|
|
|
@@ -33,7 +30,7 @@ Signed-off-by: Gabor Juhos <[email protected]>
|
|
|
|
|
|
/* Byte lane enable bits */
|
|
|
static const u8 ar71xx_pci_ble_table[4][4] = {
|
|
|
-@@ -92,9 +97,18 @@ static inline u32 ar71xx_pci_bus_addr(st
|
|
|
+@@ -92,9 +96,18 @@ static inline u32 ar71xx_pci_bus_addr(st
|
|
|
return ret;
|
|
|
}
|
|
|
|
|
|
@@ -54,7 +51,7 @@ Signed-off-by: Gabor Juhos <[email protected]>
|
|
|
u32 pci_err;
|
|
|
u32 ahb_err;
|
|
|
|
|
|
-@@ -129,9 +143,10 @@ static int ar71xx_pci_check_error(int qu
|
|
|
+@@ -129,9 +142,10 @@ static int ar71xx_pci_check_error(int qu
|
|
|
return !!(ahb_err | pci_err);
|
|
|
}
|
|
|
|
|
|
@@ -67,7 +64,7 @@ Signed-off-by: Gabor Juhos <[email protected]>
|
|
|
u32 ad_cbe;
|
|
|
|
|
|
value = value << (8 * (where & 3));
|
|
|
-@@ -147,7 +162,8 @@ static inline int ar71xx_pci_set_cfgaddr
|
|
|
+@@ -147,7 +161,8 @@ static inline int ar71xx_pci_set_cfgaddr
|
|
|
unsigned int devfn,
|
|
|
int where, int size, u32 cmd)
|
|
|
{
|
|
|
@@ -77,7 +74,7 @@ Signed-off-by: Gabor Juhos <[email protected]>
|
|
|
u32 addr;
|
|
|
|
|
|
addr = ar71xx_pci_bus_addr(bus, devfn, where);
|
|
|
-@@ -156,13 +172,14 @@ static inline int ar71xx_pci_set_cfgaddr
|
|
|
+@@ -156,13 +171,14 @@ static inline int ar71xx_pci_set_cfgaddr
|
|
|
__raw_writel(cmd | ar71xx_pci_get_ble(where, size, 0),
|
|
|
base + AR71XX_PCI_REG_CFG_CBE);
|
|
|
|
|
|
@@ -94,7 +91,7 @@ Signed-off-by: Gabor Juhos <[email protected]>
|
|
|
unsigned long flags;
|
|
|
u32 data;
|
|
|
int err;
|
|
|
-@@ -171,7 +188,7 @@ static int ar71xx_pci_read_config(struct
|
|
|
+@@ -171,7 +187,7 @@ static int ar71xx_pci_read_config(struct
|
|
|
ret = PCIBIOS_SUCCESSFUL;
|
|
|
data = ~0;
|
|
|
|
|
|
@@ -103,7 +100,7 @@ Signed-off-by: Gabor Juhos <[email protected]>
|
|
|
|
|
|
err = ar71xx_pci_set_cfgaddr(bus, devfn, where, size,
|
|
|
AR71XX_PCI_CFG_CMD_READ);
|
|
|
-@@ -180,7 +197,7 @@ static int ar71xx_pci_read_config(struct
|
|
|
+@@ -180,7 +196,7 @@ static int ar71xx_pci_read_config(struct
|
|
|
else
|
|
|
data = __raw_readl(base + AR71XX_PCI_REG_CFG_RDDATA);
|
|
|
|
|
|
@@ -112,7 +109,7 @@ Signed-off-by: Gabor Juhos <[email protected]>
|
|
|
|
|
|
*value = (data >> (8 * (where & 3))) & ar71xx_pci_read_mask[size & 7];
|
|
|
|
|
|
-@@ -190,7 +207,8 @@ static int ar71xx_pci_read_config(struct
|
|
|
+@@ -190,7 +206,8 @@ static int ar71xx_pci_read_config(struct
|
|
|
static int ar71xx_pci_write_config(struct pci_bus *bus, unsigned int devfn,
|
|
|
int where, int size, u32 value)
|
|
|
{
|
|
|
@@ -122,7 +119,7 @@ Signed-off-by: Gabor Juhos <[email protected]>
|
|
|
unsigned long flags;
|
|
|
int err;
|
|
|
int ret;
|
|
|
-@@ -198,7 +216,7 @@ static int ar71xx_pci_write_config(struc
|
|
|
+@@ -198,7 +215,7 @@ static int ar71xx_pci_write_config(struc
|
|
|
value = value << (8 * (where & 3));
|
|
|
ret = PCIBIOS_SUCCESSFUL;
|
|
|
|
|
|
@@ -131,7 +128,7 @@ Signed-off-by: Gabor Juhos <[email protected]>
|
|
|
|
|
|
err = ar71xx_pci_set_cfgaddr(bus, devfn, where, size,
|
|
|
AR71XX_PCI_CFG_CMD_WRITE);
|
|
|
-@@ -207,7 +225,7 @@ static int ar71xx_pci_write_config(struc
|
|
|
+@@ -207,7 +224,7 @@ static int ar71xx_pci_write_config(struc
|
|
|
else
|
|
|
__raw_writel(value, base + AR71XX_PCI_REG_CFG_WRDATA);
|
|
|
|
|
|
@@ -140,7 +137,7 @@ Signed-off-by: Gabor Juhos <[email protected]>
|
|
|
|
|
|
return ret;
|
|
|
}
|
|
|
-@@ -231,12 +249,6 @@ static struct resource ar71xx_pci_mem_re
|
|
|
+@@ -231,12 +248,6 @@ static struct resource ar71xx_pci_mem_re
|
|
|
.flags = IORESOURCE_MEM
|
|
|
};
|
|
|
|
|
|
@@ -153,7 +150,7 @@ Signed-off-by: Gabor Juhos <[email protected]>
|
|
|
static void ar71xx_pci_irq_handler(unsigned int irq, struct irq_desc *desc)
|
|
|
{
|
|
|
void __iomem *base = ath79_reset_base;
|
|
|
-@@ -294,7 +306,7 @@ static struct irq_chip ar71xx_pci_irq_ch
|
|
|
+@@ -294,7 +305,7 @@ static struct irq_chip ar71xx_pci_irq_ch
|
|
|
.irq_mask_ack = ar71xx_pci_irq_mask,
|
|
|
};
|
|
|
|
|
|
@@ -162,7 +159,7 @@ Signed-off-by: Gabor Juhos <[email protected]>
|
|
|
{
|
|
|
void __iomem *base = ath79_reset_base;
|
|
|
int i;
|
|
|
-@@ -309,7 +321,7 @@ static void ar71xx_pci_irq_init(int irq)
|
|
|
+@@ -309,7 +320,7 @@ static void ar71xx_pci_irq_init(int irq)
|
|
|
irq_set_chip_and_handler(i, &ar71xx_pci_irq_chip,
|
|
|
handle_level_irq);
|
|
|
|
|
|
@@ -171,7 +168,7 @@ Signed-off-by: Gabor Juhos <[email protected]>
|
|
|
}
|
|
|
|
|
|
static void ar71xx_pci_reset(void)
|
|
|
-@@ -336,20 +348,26 @@ static void ar71xx_pci_reset(void)
|
|
|
+@@ -336,20 +347,27 @@ static void ar71xx_pci_reset(void)
|
|
|
|
|
|
static int ar71xx_pci_probe(struct platform_device *pdev)
|
|
|
{
|
|
|
@@ -180,7 +177,8 @@ Signed-off-by: Gabor Juhos <[email protected]>
|
|
|
- int irq;
|
|
|
u32 t;
|
|
|
|
|
|
-+ apc = kzalloc(sizeof(struct ar71xx_pci_controller), GFP_KERNEL);
|
|
|
++ apc = devm_kzalloc(&pdev->dev, sizeof(struct ar71xx_pci_controller),
|
|
|
++ GFP_KERNEL);
|
|
|
+ if (!apc)
|
|
|
+ return -ENOMEM;
|
|
|
+
|