aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/ar71xx/patches-3.8/144-MIPS-pci-ar71xx-convert-to-a-platform-driver.patch
diff options
context:
space:
mode:
authorGabor Juhos <juhosg@openwrt.org>2013-02-21 17:47:15 +0000
committerGabor Juhos <juhosg@openwrt.org>2013-02-21 17:47:15 +0000
commit48222aa3da1720266e778a16cdd975a8f896e5fe (patch)
treeb66e38d9adb7fc703bd859d53128f1466017e3c6 /target/linux/ar71xx/patches-3.8/144-MIPS-pci-ar71xx-convert-to-a-platform-driver.patch
parent5d734cf6e9ab4aa36b2b6516212b0e0959a6efae (diff)
downloadupstream-48222aa3da1720266e778a16cdd975a8f896e5fe.tar.gz
upstream-48222aa3da1720266e778a16cdd975a8f896e5fe.tar.bz2
upstream-48222aa3da1720266e778a16cdd975a8f896e5fe.zip
ar71xx: add support for 3.8
Signed-off-by: Gabor Juhos <juhosg@openwrt.org> git-svn-id: svn://svn.openwrt.org/openwrt/trunk@35728 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux/ar71xx/patches-3.8/144-MIPS-pci-ar71xx-convert-to-a-platform-driver.patch')
-rw-r--r--target/linux/ar71xx/patches-3.8/144-MIPS-pci-ar71xx-convert-to-a-platform-driver.patch104
1 files changed, 104 insertions, 0 deletions
diff --git a/target/linux/ar71xx/patches-3.8/144-MIPS-pci-ar71xx-convert-to-a-platform-driver.patch b/target/linux/ar71xx/patches-3.8/144-MIPS-pci-ar71xx-convert-to-a-platform-driver.patch
new file mode 100644
index 0000000000..98000a0aae
--- /dev/null
+++ b/target/linux/ar71xx/patches-3.8/144-MIPS-pci-ar71xx-convert-to-a-platform-driver.patch
@@ -0,0 +1,104 @@
+From d1a22e73f991145a4abd7d0c37bcf318703c89ed Mon Sep 17 00:00:00 2001
+From: Gabor Juhos <juhosg@openwrt.org>
+Date: Mon, 11 Jun 2012 13:24:55 +0200
+Subject: [PATCH 05/34] MIPS: pci-ar71xx: convert to a platform driver
+
+Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
+---
+ arch/mips/pci/pci-ar71xx.c | 60 +++++++++++++++++++++++++++++++++++++++++---
+ 1 files changed, 56 insertions(+), 4 deletions(-)
+
+--- a/arch/mips/pci/pci-ar71xx.c
++++ b/arch/mips/pci/pci-ar71xx.c
+@@ -18,6 +18,8 @@
+ #include <linux/pci.h>
+ #include <linux/pci_regs.h>
+ #include <linux/interrupt.h>
++#include <linux/module.h>
++#include <linux/platform_device.h>
+
+ #include <asm/mach-ath79/ar71xx_regs.h>
+ #include <asm/mach-ath79/ath79.h>
+@@ -309,7 +311,7 @@ static struct irq_chip ar71xx_pci_irq_ch
+ .irq_mask_ack = ar71xx_pci_irq_mask,
+ };
+
+-static __init void ar71xx_pci_irq_init(void)
++static void ar71xx_pci_irq_init(int irq)
+ {
+ void __iomem *base = ath79_reset_base;
+ int i;
+@@ -324,10 +326,10 @@ static __init void ar71xx_pci_irq_init(v
+ irq_set_chip_and_handler(i, &ar71xx_pci_irq_chip,
+ handle_level_irq);
+
+- irq_set_chained_handler(ATH79_CPU_IRQ_IP2, ar71xx_pci_irq_handler);
++ irq_set_chained_handler(irq, ar71xx_pci_irq_handler);
+ }
+
+-static __init void ar71xx_pci_reset(void)
++static void ar71xx_pci_reset(void)
+ {
+ void __iomem *ddr_base = ath79_ddr_base;
+
+@@ -367,9 +369,59 @@ __init int ar71xx_pcibios_init(void)
+ /* clear bus errors */
+ ar71xx_pci_check_error(1);
+
+- ar71xx_pci_irq_init();
++ ar71xx_pci_irq_init(ATH79_CPU_IRQ_IP2);
+
+ register_pci_controller(&ar71xx_pci_controller);
+
+ return 0;
+ }
++
++static int ar71xx_pci_probe(struct platform_device *pdev)
++{
++ struct resource *res;
++ int irq;
++ u32 t;
++
++ res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "cfg_base");
++ if (!res)
++ return -EINVAL;
++
++ ar71xx_pcicfg_base = devm_request_and_ioremap(&pdev->dev, res);
++ if (!ar71xx_pcicfg_base)
++ return -ENOMEM;
++
++ irq = platform_get_irq(pdev, 0);
++ if (irq < 0)
++ return -EINVAL;
++
++ ar71xx_pci_reset();
++
++ /* setup COMMAND register */
++ t = PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER | PCI_COMMAND_INVALIDATE
++ | PCI_COMMAND_PARITY | PCI_COMMAND_SERR | PCI_COMMAND_FAST_BACK;
++ ar71xx_pci_local_write(PCI_COMMAND, 4, t);
++
++ /* clear bus errors */
++ ar71xx_pci_check_error(1);
++
++ ar71xx_pci_irq_init(irq);
++
++ register_pci_controller(&ar71xx_pci_controller);
++
++ return 0;
++}
++
++static struct platform_driver ar71xx_pci_driver = {
++ .probe = ar71xx_pci_probe,
++ .driver = {
++ .name = "ar71xx-pci",
++ .owner = THIS_MODULE,
++ },
++};
++
++static int __init ar71xx_pci_init(void)
++{
++ return platform_driver_register(&ar71xx_pci_driver);
++}
++
++postcore_initcall(ar71xx_pci_init);