brcm63xx: probe gpio controllers through DT
authorJonas Gorski <jogo@openwrt.org>
Fri, 27 Feb 2015 17:39:49 +0000 (17:39 +0000)
committerJonas Gorski <jogo@openwrt.org>
Fri, 27 Feb 2015 17:39:49 +0000 (17:39 +0000)
Add a generic mmio gpio controller based driver and probe it
through device tree.

Use aliases for base calculation until we converted all users to
device tree or named gpios.

Convert bcm63xx_enet's ephy-reset gpio to use a named gpio.

While at it, remove the duplicate reset gpio defintion for livebox.

Signed-off-by: Jonas Gorski <jogo@openwrt.org>
SVN-Revision: 44565

50 files changed:
target/linux/brcm63xx/config-3.14
target/linux/brcm63xx/config-3.18
target/linux/brcm63xx/dts/bcm3368.dtsi
target/linux/brcm63xx/dts/bcm6318.dtsi
target/linux/brcm63xx/dts/bcm63268.dtsi
target/linux/brcm63xx/dts/bcm6328.dtsi
target/linux/brcm63xx/dts/bcm6338.dtsi
target/linux/brcm63xx/dts/bcm6345.dtsi
target/linux/brcm63xx/dts/bcm6348.dtsi
target/linux/brcm63xx/dts/bcm6358.dtsi
target/linux/brcm63xx/dts/bcm6362.dtsi
target/linux/brcm63xx/dts/bcm6368.dtsi
target/linux/brcm63xx/patches-3.14/374-gpio-add-a-simple-GPIO-driver-for-bcm63xx.patch [new file with mode: 0644]
target/linux/brcm63xx/patches-3.14/375-MIPS-BCM63XX-switch-to-new-gpio-driver.patch [new file with mode: 0644]
target/linux/brcm63xx/patches-3.14/376-net-bcm63xx_enet-use-named-gpio-for-ephy-reset-gpio.patch [new file with mode: 0644]
target/linux/brcm63xx/patches-3.14/377-MIPS-BCM63XX-register-lookup-for-ephy-reset-gpio.patch [new file with mode: 0644]
target/linux/brcm63xx/patches-3.14/378-MIPS-BCM63XX-calculate-labels-for-DT-registered-cont.patch [new file with mode: 0644]
target/linux/brcm63xx/patches-3.14/379-gpio-gpio-bcm63xx-use-alias-id-for-base-calculation.patch [new file with mode: 0644]
target/linux/brcm63xx/patches-3.14/402_bcm63xx_enet_vlan_incoming_fixed.patch
target/linux/brcm63xx/patches-3.14/404-NET-bcm63xx_enet-move-phy_-dis-connect-into-probe-re.patch
target/linux/brcm63xx/patches-3.14/408-bcm63xx_enet-enable-rgmii-clock-on-external-ports.patch
target/linux/brcm63xx/patches-3.14/413-BCM63XX-allow-providing-fixup-data-in-board-data.patch
target/linux/brcm63xx/patches-3.14/418-MIPS-BCM63XX-pass-caldata-info-to-flash.patch
target/linux/brcm63xx/patches-3.14/420-BCM63XX-add-endian-check-for-ath9k.patch
target/linux/brcm63xx/patches-3.14/421-BCM63XX-add-led-pin-for-ath9k.patch
target/linux/brcm63xx/patches-3.14/422-BCM63XX-add-a-fixup-for-rt2x00-devices.patch
target/linux/brcm63xx/patches-3.14/423-bcm63xx_enet_add_b53_support.patch
target/linux/brcm63xx/patches-3.14/424-bcm63xx_enet_no_request_mem_region.patch
target/linux/brcm63xx/patches-3.14/499-allow_better_context_for_board_patches.patch
target/linux/brcm63xx/patches-3.14/513-MIPS-BCM63XX-add-inventel-Livebox-support.patch
target/linux/brcm63xx/patches-3.14/519_board_CPVA502plus.patch
target/linux/brcm63xx/patches-3.18/374-gpio-add-a-simple-GPIO-driver-for-bcm63xx.patch [new file with mode: 0644]
target/linux/brcm63xx/patches-3.18/375-MIPS-BCM63XX-switch-to-new-gpio-driver.patch [new file with mode: 0644]
target/linux/brcm63xx/patches-3.18/376-net-bcm63xx_enet-use-named-gpio-for-ephy-reset-gpio.patch [new file with mode: 0644]
target/linux/brcm63xx/patches-3.18/377-MIPS-BCM63XX-register-lookup-for-ephy-reset-gpio.patch [new file with mode: 0644]
target/linux/brcm63xx/patches-3.18/378-MIPS-BCM63XX-calculate-labels-for-DT-registered-cont.patch [new file with mode: 0644]
target/linux/brcm63xx/patches-3.18/379-gpio-gpio-bcm63xx-use-alias-id-for-base-calculation.patch [new file with mode: 0644]
target/linux/brcm63xx/patches-3.18/402_bcm63xx_enet_vlan_incoming_fixed.patch
target/linux/brcm63xx/patches-3.18/404-NET-bcm63xx_enet-move-phy_-dis-connect-into-probe-re.patch
target/linux/brcm63xx/patches-3.18/408-bcm63xx_enet-enable-rgmii-clock-on-external-ports.patch
target/linux/brcm63xx/patches-3.18/413-BCM63XX-allow-providing-fixup-data-in-board-data.patch
target/linux/brcm63xx/patches-3.18/418-MIPS-BCM63XX-pass-caldata-info-to-flash.patch
target/linux/brcm63xx/patches-3.18/420-BCM63XX-add-endian-check-for-ath9k.patch
target/linux/brcm63xx/patches-3.18/421-BCM63XX-add-led-pin-for-ath9k.patch
target/linux/brcm63xx/patches-3.18/422-BCM63XX-add-a-fixup-for-rt2x00-devices.patch
target/linux/brcm63xx/patches-3.18/423-bcm63xx_enet_add_b53_support.patch
target/linux/brcm63xx/patches-3.18/424-bcm63xx_enet_no_request_mem_region.patch
target/linux/brcm63xx/patches-3.18/499-allow_better_context_for_board_patches.patch
target/linux/brcm63xx/patches-3.18/513-MIPS-BCM63XX-add-inventel-Livebox-support.patch
target/linux/brcm63xx/patches-3.18/519_board_CPVA502plus.patch

index dd27f473bbfbddb783dceb4aafdf7a3cee459ddd..390d4ecc8b5ce598ca77504b2c1c5f4187461673 100644 (file)
@@ -76,7 +76,9 @@ CONFIG_GENERIC_IRQ_SHOW=y
 CONFIG_GENERIC_PCI_IOMAP=y
 CONFIG_GENERIC_SMP_IDLE_THREAD=y
 CONFIG_GPIOLIB=y
+CONFIG_GPIO_BCM63XX=y
 CONFIG_GPIO_DEVRES=y
+CONFIG_GPIO_GENERIC=y
 CONFIG_GPIO_SYSFS=y
 # CONFIG_HAMRADIO is not set
 CONFIG_HAS_DMA=y
@@ -152,6 +154,7 @@ CONFIG_MTD_M25P80=y
 CONFIG_MTD_PHYSMAP=y
 CONFIG_MTD_REDBOOT_PARTS=y
 CONFIG_MTD_REDBOOT_PARTS_UNALLOCATED=y
+CONFIG_MTD_SPLIT_SUPPORT=y
 CONFIG_NEED_DMA_MAP_STATE=y
 CONFIG_NEED_PER_CPU_KM=y
 CONFIG_NO_GENERIC_PCI_IOPORT_MAP=y
index e3cf020a99c9d89a088915375a0feae345f70c82..5087033cb11e83f6c1e1e0d8b2f83734ddb1a9cc 100644 (file)
@@ -10,7 +10,6 @@ CONFIG_ARCH_MIGHT_HAVE_PC_SERIO=y
 CONFIG_ARCH_REQUIRE_GPIOLIB=y
 CONFIG_ARCH_SUSPEND_POSSIBLE=y
 CONFIG_ARCH_WANT_IPC_PARSE_VERSION=y
-# CONFIG_AUDIT_ARCH_COMPAT_GENERIC is not set
 CONFIG_B53=y
 CONFIG_B53_MMAP_DRIVER=y
 CONFIG_B53_PHY_DRIVER=y
@@ -71,6 +70,7 @@ CONFIG_DMA_NONCOHERENT=y
 CONFIG_DTC=y
 CONFIG_EARLY_PRINTK=y
 CONFIG_FIRMWARE_IN_KERNEL=y
+CONFIG_FW_LOADER_USER_HELPER=y
 CONFIG_GENERIC_ATOMIC64=y
 CONFIG_GENERIC_CLOCKEVENTS=y
 CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
@@ -80,7 +80,9 @@ CONFIG_GENERIC_IRQ_SHOW=y
 CONFIG_GENERIC_PCI_IOMAP=y
 CONFIG_GENERIC_SMP_IDLE_THREAD=y
 CONFIG_GPIOLIB=y
+CONFIG_GPIO_BCM63XX=y
 CONFIG_GPIO_DEVRES=y
+CONFIG_GPIO_GENERIC=y
 CONFIG_GPIO_SYSFS=y
 # CONFIG_HAMRADIO is not set
 CONFIG_HAS_DMA=y
@@ -143,7 +145,6 @@ CONFIG_MIPS_L1_CACHE_SHIFT=4
 CONFIG_MIPS_L1_CACHE_SHIFT_4=y
 # CONFIG_MIPS_MACHINE is not set
 CONFIG_MIPS_O32_FP64_SUPPORT=y
-# CONFIG_MIPS_PARAVIRT is not set
 CONFIG_MODULES_USE_ELF_REL=y
 CONFIG_MODULE_FORCE_LOAD=y
 CONFIG_MODULE_FORCE_UNLOAD=y
@@ -161,6 +162,7 @@ CONFIG_MTD_PHYSMAP=y
 CONFIG_MTD_REDBOOT_PARTS=y
 CONFIG_MTD_REDBOOT_PARTS_UNALLOCATED=y
 CONFIG_MTD_SPI_NOR=y
+CONFIG_MTD_SPLIT_SUPPORT=y
 CONFIG_NEED_DMA_MAP_STATE=y
 CONFIG_NEED_PER_CPU_KM=y
 CONFIG_NO_GENERIC_PCI_IOPORT_MAP=y
index dba73b56cce95932882daf2b640f26154372525a..ebf3d1cd08fd03e701653eed8fb66822707e2899 100644 (file)
@@ -5,6 +5,8 @@
 
        aliases {
                pflash = &pflash;
+               gpio0 = &gpio0;
+               gpio1 = &gpio1;
        };
 
        cpus {
                        interrupt-parent = <&periph_intc>;
                        interrupts = <24>, <25>, <26>, <27>;
                };
+
+               gpio1: gpio-controller@fff8c080 {
+                       compatible = "brcm,6345-gpio";
+                       reg = <0xfff8c080 4>, <0xfff8c088 4>;
+
+                       gpio-controller;
+                       #gpio-cells = <2>;
+
+                       ngpios = <8>;
+               };
+
+               gpio0: gpio-controller@fff8c084 {
+                       compatible = "brcm,6345-gpio";
+                       reg = <0xfff8c084 4>, <0xfff8c08c 4>;
+
+                       gpio-controller;
+                       #gpio-cells = <2>;
+               };
        };
 };
index 97bdea7b5bfd20a8e80a2a1a57763cf1cec34615..f851a9cbf5a2e06bbbe693bf0078e99a6c1ae8d1 100644 (file)
@@ -3,6 +3,11 @@
        #size-cells = <1>;
        compatible = "brcm,bcm6318";
 
+       aliases {
+               gpio0 = &gpio0;
+               gpio1 = &gpio1;
+       };
+
        cpus {
                #address-cells = <1>;
                #size-cells = <0>;
                        interrupt-parent = <&cpu_intc>;
                        interrupts = <2>;
                };
+
+               gpio1: gpio-controller@10000080 {
+                       compatible = "brcm,bcm6345-gpio";
+                       reg = <0x10000080 4>, <0x10000088 4>;
+
+                       gpio-controller;
+                       #gpio-cells = <2>;
+
+                       ngpios = <18>;
+               };
+
+               gpio0: gpio-controller@10000084 {
+                       compatible = "brcm,bcm6345-gpio";
+                       reg = <0x10000084 4>, <0x1000008c 4>;
+
+                       gpio-controller;
+                       #gpio-cells = <2>;
+               };
        };
 };
index bc80d70575f5790dd60874b292fa596d9d999391..0a1f8b17cfab34271477b5a3f4334065af5bd438 100644 (file)
@@ -3,6 +3,11 @@
        #size-cells = <1>;
        compatible = "brcm,bcm63268";
 
+       aliases {
+               gpio0 = &gpio0;
+               gpio1 = &gpio1;
+       };
+
        cpus {
                #address-cells = <1>;
                #size-cells = <0>;
                        interrupt-parent = <&cpu_intc>;
                        interrupts = <2>, <3>;
                };
+
+               gpio1: gpio-controller@100000c0 {
+                       compatible = "brcm,bcm6345-gpio";
+                       reg = <0x100000c0 4>, <0x100000c8 4>;
+
+                       gpio-controller;
+                       #gpio-cells = <2>;
+
+                       ngpios = <20>;
+               };
+
+               gpio0: gpio-controller@100000c4 {
+                       compatible = "brcm,bcm6345-gpio";
+                       reg = <0x100000c4 4>, <0x100000cc 4>;
+
+                       gpio-controller;
+                       #gpio-cells = <2>;
+               };
        };
 };
index 53f96ff009f4490dadda23e4f64c72e0034134f0..a0b13164234baebef38e0c682b48bab58b630ae0 100644 (file)
@@ -3,6 +3,10 @@
        #size-cells = <1>;
        compatible = "brcm,bcm6328";
 
+       aliases {
+               gpio0 = &gpio0;
+       };
+
        cpus {
                #address-cells = <1>;
                #size-cells = <0>;
                        interrupt-parent = <&cpu_intc>;
                        interrupts = <2>;
                };
+
+               gpio0: gpio-controller@10000084 {
+                       compatible = "brcm,bcm6345-gpio";
+                       reg = <0x10000084 4>, <0x1000008c 4>;
+
+                       gpio-controller;
+                       #gpio-cells = <2>;
+               };
        };
 };
index c1980f40367abc4633e736f11019cd7d8ca52d89..d578a5b59b8e8118a6c9a95f73e1b6e1bf02cbd9 100644 (file)
@@ -5,6 +5,7 @@
 
        aliases {
                pflash = &pflash;
+               gpio0 = &gpio0;
        };
 
        cpus {
                        interrupt-parent = <&cpu_intc>;
                        interrupts = <3>, <4>, <5>, <6>;
                };
+
+               gpio0: gpio-controller@fffe0404 {
+                       compatible = "brcm,bcm6345-gpio";
+                       reg = <0xfffe0404 4>, <0xfffe040c 4>;
+
+                       gpio-controller;
+                       #gpio-cells = <2>;
+
+                       ngpios = <8>;
+               };
        };
 };
index e8e7016ff796a9557fa5ef9dcd47e7cf097a96c8..f70246860c62ad04a65fea3bb8082100181bd277 100644 (file)
@@ -5,6 +5,7 @@
 
        aliases {
                pflash = &pflash;
+               gpio0 = &gpio0;
        };
 
        cpus {
                        interrupt-parent = <&cpu_intc>;
                        interrupts = <3>, <4>, <5>, <6>;
                };
+
+               gpio0: gpio-controller@fffe0404 {
+                       compatible = "brcm,bcm6345-gpio";
+                       reg = <0xfffe0404 4>, <0xfffe0408 4>;
+
+                       gpio-controller;
+                       #gpio-cells = <2>;
+
+                       ngpios = <16>;
+               };
        };
 };
index 7dd423b9ca5ae75676c45d80a32e66237ec843ea..a4d8d9f0d0973e0bb5acb1b85961f0861821dee8 100644 (file)
@@ -5,6 +5,8 @@
 
        aliases {
                pflash = &pflash;
+               gpio0 = &gpio0;
+               gpio1 = &gpio1;
        };
 
        cpus {
 
                        brcm,field-width = <5>;
                };
+
+               gpio1: gpio-controller@fffe0400 {
+                       compatible = "brcm,bcm6345-gpio";
+                       reg = <0xfffe0400 4>, <0xfffe0408 4>;
+
+                       gpio-controller;
+                       #gpio-cells = <2>;
+
+                       ngpios = <5>;
+               };
+
+               gpio0: gpio-controller@fffe0404 {
+                       compatible = "brcm,bcm6345-gpio";
+                       reg = <0xfffe0404 4>, <0xfffe040c 4>;
+
+                       gpio-controller;
+                       #gpio-cells = <2>;
+               };
        };
 };
index 7217b8db6ebaf5f1a3b720280dd304feaea314be..bc3784a2216707a1e091e64fb239c07e5874faad 100644 (file)
@@ -5,6 +5,8 @@
 
        aliases {
                pflash = &pflash;
+               gpio0 = &gpio0;
+               gpio1 = &gpio1;
        };
 
        cpus {
                        interrupt-parent = <&periph_intc>;
                        interrupts = <20>, <21>;
                };
+
+               gpio1: gpio-controller@fffe0080 {
+                       compatible = "brcm,bcm6345-gpio";
+                       reg = <0xfffe0080 4>, <0xfffe0088 4>;
+
+                       gpio-controller;
+                       #gpio-cells = <2>;
+
+                       ngpios = <8>;
+               };
+
+               gpio0: gpio-controller@fffe0084 {
+                       compatible = "brcm,bcm6345-gpio";
+                       reg = <0xfffe0084 4>, <0xfffe008c 4>;
+
+                       gpio-controller;
+                       #gpio-cells = <2>;
+               };
        };
 };
index 4e2e41d5d46d980d99a85ba72ecb32ccaf0fc4af..6604f5cc62f652fd8542f89e96caa2a48a1c04dc 100644 (file)
@@ -3,6 +3,11 @@
        #size-cells = <1>;
        compatible = "brcm,bcm6362";
 
+       aliases {
+               gpio0 = &gpio0;
+               gpio1 = &gpio1;
+       };
+
        cpus {
                #address-cells = <1>;
                #size-cells = <0>;
                        interrupt-parent = <&cpu_intc>;
                        interrupts = <2>, <3>;
                };
+
+               gpio1: gpio-controller@10000080 {
+                       compatible = "brcm,bcm6345-gpio";
+                       reg = <0x10000080 4>, <0x10000088 4>;
+
+                       gpio-controller;
+                       #gpio-cells = <2>;
+
+                       ngpios = <16>;
+               };
+
+               gpio0: gpio-controller@10000084 {
+                       compatible = "brcm,bcm6345-gpio";
+                       reg = <0x10000084 4>, <0x1000008c 4>;
+
+                       gpio-controller;
+                       #gpio-cells = <2>;
+               };
        };
 };
index 27b9f62b69ab040e96ba19b626a39d725ccd2ed9..628c2d0d34f5680641bb4ecd2b2949ad80dfa37a 100644 (file)
@@ -5,6 +5,8 @@
 
        aliases {
                pflash = &pflash;
+               gpio0 = &gpio0;
+               gpio1 = &gpio1;
        };
 
        cpus {
                        interrupt-parent = <&cpu_intc>;
                        interrupts = <2>, <3>;
                };
+
+               gpio1: gpio-controller@10000080 {
+                       compatible = "brcm,bcm6345-gpio";
+                       reg = <0x10000080 4>, <0x10000088 4>;
+
+                       gpio-controller;
+                       #gpio-cells = <2>;
+
+                       ngpios = <6>;
+               };
+
+               gpio0: gpio-controller@10000084 {
+                       compatible = "brcm,bcm6345-gpio";
+                       reg = <0x10000084 4>, <0x1000008c 4>;
+
+                       gpio-controller;
+                       #gpio-cells = <2>;
+               };
        };
 
        pflash: nor@18000000 {
diff --git a/target/linux/brcm63xx/patches-3.14/374-gpio-add-a-simple-GPIO-driver-for-bcm63xx.patch b/target/linux/brcm63xx/patches-3.14/374-gpio-add-a-simple-GPIO-driver-for-bcm63xx.patch
new file mode 100644 (file)
index 0000000..7d1cd28
--- /dev/null
@@ -0,0 +1,161 @@
+From dbe94a8daaa63ef81b7414f2a17bca8e36dd6daa Mon Sep 17 00:00:00 2001
+From: Jonas Gorski <jogo@openwrt.org>
+Date: Fri, 20 Feb 2015 19:55:32 +0100
+Subject: [PATCH 1/6] gpio: add a simple GPIO driver for bcm63xx
+
+
+Signed-off-by: Jonas Gorski <jogo@openwrt.org>
+---
+ drivers/gpio/Kconfig        |    8 +++
+ drivers/gpio/Makefile       |    1 +
+ drivers/gpio/gpio-bcm63xx.c |  117 +++++++++++++++++++++++++++++++++++++++++++
+ 3 files changed, 126 insertions(+)
+ create mode 100644 drivers/gpio/gpio-bcm63xx.c
+
+--- a/drivers/gpio/Kconfig
++++ b/drivers/gpio/Kconfig
+@@ -821,6 +821,14 @@ config GPIO_BCM_KONA
+       help
+         Turn on GPIO support for Broadcom "Kona" chips.
++config GPIO_BCM63XX
++      bool "Broadcom BCM63XX GPIO"
++      depends on MIPS || COMPILE_TEST
++      select GPIO_GENERIC
++      help
++        Turn on GPIO support for Broadcom BCM63XX xDSL chips.
++
++
+ comment "USB GPIO expanders:"
+ config GPIO_VIPERBOARD
+--- a/drivers/gpio/Makefile
++++ b/drivers/gpio/Makefile
+@@ -17,6 +17,7 @@ obj-$(CONFIG_GPIO_ADP5588)   += gpio-adp55
+ obj-$(CONFIG_GPIO_AMD8111)    += gpio-amd8111.o
+ obj-$(CONFIG_GPIO_ARIZONA)    += gpio-arizona.o
+ obj-$(CONFIG_GPIO_BCM_KONA)   += gpio-bcm-kona.o
++obj-$(CONFIG_GPIO_BCM63XX)    += gpio-bcm63xx.o
+ obj-$(CONFIG_GPIO_BT8XX)      += gpio-bt8xx.o
+ obj-$(CONFIG_GPIO_CLPS711X)   += gpio-clps711x.o
+ obj-$(CONFIG_GPIO_CS5535)     += gpio-cs5535.o
+--- /dev/null
++++ b/drivers/gpio/gpio-bcm63xx.c
+@@ -0,0 +1,117 @@
++/*
++ * Driver for BCM63XX memory-mapped GPIO controllers, based on
++ * Generic driver for memory-mapped GPIO controllers.
++ *
++ * Copyright 2008 MontaVista Software, Inc.
++ * Copyright 2008,2010 Anton Vorontsov <cbouatmailru@gmail.com>
++ * Copyright 2015 Jonas Gorski <jogo@openwrt.org>
++ *
++ * 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.
++ */
++
++#include <linux/init.h>
++#include <linux/err.h>
++#include <linux/bug.h>
++#include <linux/kernel.h>
++#include <linux/module.h>
++#include <linux/spinlock.h>
++#include <linux/compiler.h>
++#include <linux/types.h>
++#include <linux/errno.h>
++#include <linux/log2.h>
++#include <linux/ioport.h>
++#include <linux/io.h>
++#include <linux/gpio.h>
++#include <linux/slab.h>
++#include <linux/platform_device.h>
++#include <linux/mod_devicetable.h>
++#include <linux/basic_mmio_gpio.h>
++#include <linux/of.h>
++#include <linux/of_gpio.h>
++
++static int bcm63xx_gpio_probe(struct platform_device *pdev)
++{
++      struct device *dev = &pdev->dev;
++      struct resource *dat_r, *dirout_r;
++      void __iomem *dat;
++      void __iomem *dirout;
++      unsigned long sz;
++      int err;
++      struct bgpio_chip *bgc;
++      struct bgpio_pdata *pdata = dev_get_platdata(dev);
++
++      dat_r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
++      dirout_r = platform_get_resource(pdev, IORESOURCE_MEM, 1);
++      if (!dat_r || !dirout_r)
++              return -EINVAL;
++
++      if (resource_size(dat_r) != resource_size(dirout_r))
++              return -EINVAL;
++
++      sz = resource_size(dat_r);
++
++      dat = devm_ioremap_resource(dev, dat_r);
++      if (IS_ERR(dat))
++              return PTR_ERR(dat);
++
++      dirout = devm_ioremap_resource(dev, dirout_r);
++      if (IS_ERR(dirout))
++              return PTR_ERR(dirout);
++
++      bgc = devm_kzalloc(&pdev->dev, sizeof(*bgc), GFP_KERNEL);
++      if (!bgc)
++              return -ENOMEM;
++
++      err = bgpio_init(bgc, dev, sz, dat, NULL, NULL, dirout, NULL,
++                       BGPIOF_BIG_ENDIAN_BYTE_ORDER);
++      if (err)
++              return err;
++
++      platform_set_drvdata(pdev, bgc);
++
++      if (dev->of_node) {
++              u32 ngpios;
++
++              if (!of_property_read_u32(dev->of_node, "ngpios", &ngpios))
++                      bgc->gc.ngpio = ngpios;
++
++      } else if (pdata) {
++              bgc->gc.base = pdata->base;
++              if (pdata->ngpio > 0)
++                      bgc->gc.ngpio = pdata->ngpio;
++      }
++
++      return gpiochip_add(&bgc->gc);
++}
++
++static int bcm63xx_gpio_remove(struct platform_device *pdev)
++{
++      struct bgpio_chip *bgc = platform_get_drvdata(pdev);
++
++      return bgpio_remove(bgc);
++}
++
++#ifdef CONFIG_OF
++static struct of_device_id bcm63xx_gpio_of_match[] = {
++      { .compatible = "brcm,bcm6345-gpio" },
++      { },
++};
++#endif
++
++static struct platform_driver bcm63xx_gpio_driver = {
++      .probe = bcm63xx_gpio_probe,
++      .remove = bcm63xx_gpio_remove,
++      .driver = {
++              .name = "bcm63xx-gpio",
++              .of_match_table = of_match_ptr(bcm63xx_gpio_of_match),
++      },
++};
++
++module_platform_driver(bcm63xx_gpio_driver);
++
++MODULE_DESCRIPTION("Driver for BCM63XX memory-mapped GPIO controllers");
++MODULE_AUTHOR("Jonas Gorski <jogo@openwrt.org>");
++MODULE_LICENSE("GPL");
diff --git a/target/linux/brcm63xx/patches-3.14/375-MIPS-BCM63XX-switch-to-new-gpio-driver.patch b/target/linux/brcm63xx/patches-3.14/375-MIPS-BCM63XX-switch-to-new-gpio-driver.patch
new file mode 100644 (file)
index 0000000..24dd3a9
--- /dev/null
@@ -0,0 +1,216 @@
+From cc99dca188bb63ba390008e2f7fa62d0300233e0 Mon Sep 17 00:00:00 2001
+From: Jonas Gorski <jogo@openwrt.org>
+Date: Fri, 20 Feb 2015 23:58:54 +0100
+Subject: [PATCH 2/6] MIPS: BCM63XX: switch to new gpio driver
+
+Signed-off-by: Jonas Gorski <jogo@openwrt.org>
+---
+ arch/mips/bcm63xx/boards/board_common.c |    2 +
+ arch/mips/bcm63xx/gpio.c                |  147 +++++++------------------------
+ arch/mips/bcm63xx/prom.c                |    3 -
+ 3 files changed, 33 insertions(+), 119 deletions(-)
+
+--- a/arch/mips/bcm63xx/boards/board_common.c
++++ b/arch/mips/bcm63xx/boards/board_common.c
+@@ -204,6 +204,8 @@ int __init board_register_devices(void)
+       }
+ #endif
++      bcm63xx_gpio_init();
++
+       if (board.has_uart0)
+               bcm63xx_uart_register(0);
+--- a/arch/mips/bcm63xx/gpio.c
++++ b/arch/mips/bcm63xx/gpio.c
+@@ -5,147 +5,62 @@
+  *
+  * Copyright (C) 2008 Maxime Bizon <mbizon@freebox.fr>
+  * Copyright (C) 2008-2011 Florian Fainelli <florian@openwrt.org>
++ * Copyright (C) Jonas Gorski <jogo@openwrt.org>
+  */
+ #include <linux/kernel.h>
+-#include <linux/module.h>
+-#include <linux/spinlock.h>
+ #include <linux/platform_device.h>
++#include <linux/basic_mmio_gpio.h>
+ #include <linux/gpio.h>
+ #include <bcm63xx_cpu.h>
+ #include <bcm63xx_gpio.h>
+-#include <bcm63xx_io.h>
+ #include <bcm63xx_regs.h>
+-static u32 gpio_out_low_reg;
+-
+-static void bcm63xx_gpio_out_low_reg_init(void)
++static void __init bcm63xx_gpio_init_one(int id, int dir, int data, int ngpio)
+ {
+-      switch (bcm63xx_get_cpu_id()) {
+-      case BCM6345_CPU_ID:
+-              gpio_out_low_reg = GPIO_DATA_LO_REG_6345;
+-              break;
+-      default:
+-              gpio_out_low_reg = GPIO_DATA_LO_REG;
+-              break;
+-      }
+-}
+-
+-static DEFINE_SPINLOCK(bcm63xx_gpio_lock);
+-static u32 gpio_out_low, gpio_out_high;
++      struct resource res[2];
++      struct bgpio_pdata pdata;
+-static void bcm63xx_gpio_set(struct gpio_chip *chip,
+-                           unsigned gpio, int val)
+-{
+-      u32 reg;
+-      u32 mask;
+-      u32 *v;
+-      unsigned long flags;
+-
+-      if (gpio >= chip->ngpio)
+-              BUG();
+-
+-      if (gpio < 32) {
+-              reg = gpio_out_low_reg;
+-              mask = 1 << gpio;
+-              v = &gpio_out_low;
+-      } else {
+-              reg = GPIO_DATA_HI_REG;
+-              mask = 1 << (gpio - 32);
+-              v = &gpio_out_high;
+-      }
+-
+-      spin_lock_irqsave(&bcm63xx_gpio_lock, flags);
+-      if (val)
+-              *v |= mask;
+-      else
+-              *v &= ~mask;
+-      bcm_gpio_writel(*v, reg);
+-      spin_unlock_irqrestore(&bcm63xx_gpio_lock, flags);
+-}
++      memset(res, 0, sizeof(res));
++      memset(&pdata, 0, sizeof(pdata));
+-static int bcm63xx_gpio_get(struct gpio_chip *chip, unsigned gpio)
+-{
+-      u32 reg;
+-      u32 mask;
++      res[0].flags = IORESOURCE_MEM;
++      res[0].start = bcm63xx_regset_address(RSET_GPIO);
++      res[0].start += data;
+-      if (gpio >= chip->ngpio)
+-              BUG();
++      res[0].end = res[0].start + 3;
+-      if (gpio < 32) {
+-              reg = gpio_out_low_reg;
+-              mask = 1 << gpio;
+-      } else {
+-              reg = GPIO_DATA_HI_REG;
+-              mask = 1 << (gpio - 32);
+-      }
++      res[1].flags = IORESOURCE_MEM;
++      res[1].start = bcm63xx_regset_address(RSET_GPIO);
++      res[1].start += dir;
+-      return !!(bcm_gpio_readl(reg) & mask);
+-}
++      res[1].end = res[1].start + 3;
+-static int bcm63xx_gpio_set_direction(struct gpio_chip *chip,
+-                                    unsigned gpio, int dir)
+-{
+-      u32 reg;
+-      u32 mask;
+-      u32 tmp;
+-      unsigned long flags;
+-
+-      if (gpio >= chip->ngpio)
+-              BUG();
+-
+-      if (gpio < 32) {
+-              reg = GPIO_CTL_LO_REG;
+-              mask = 1 << gpio;
+-      } else {
+-              reg = GPIO_CTL_HI_REG;
+-              mask = 1 << (gpio - 32);
+-      }
+-
+-      spin_lock_irqsave(&bcm63xx_gpio_lock, flags);
+-      tmp = bcm_gpio_readl(reg);
+-      if (dir == BCM63XX_GPIO_DIR_IN)
+-              tmp &= ~mask;
+-      else
+-              tmp |= mask;
+-      bcm_gpio_writel(tmp, reg);
+-      spin_unlock_irqrestore(&bcm63xx_gpio_lock, flags);
++      pdata.base = id * 32;
++      pdata.ngpio = ngpio;
+-      return 0;
++      platform_device_register_resndata(NULL, "bcm63xx-gpio", id, res, 2,
++                                        &pdata, sizeof(pdata));
+ }
+-static int bcm63xx_gpio_direction_input(struct gpio_chip *chip, unsigned gpio)
++int __init bcm63xx_gpio_init(void)
+ {
+-      return bcm63xx_gpio_set_direction(chip, gpio, BCM63XX_GPIO_DIR_IN);
+-}
++      int ngpio = bcm63xx_gpio_count();
++      int data_low_reg;
+-static int bcm63xx_gpio_direction_output(struct gpio_chip *chip,
+-                                       unsigned gpio, int value)
+-{
+-      bcm63xx_gpio_set(chip, gpio, value);
+-      return bcm63xx_gpio_set_direction(chip, gpio, BCM63XX_GPIO_DIR_OUT);
+-}
++      if (BCMCPU_IS_6345())
++              data_low_reg = GPIO_DATA_LO_REG_6345;
++      else
++              data_low_reg = GPIO_DATA_LO_REG;
++      bcm63xx_gpio_init_one(0, data_low_reg, GPIO_CTL_LO_REG, min(ngpio, 32));
+-static struct gpio_chip bcm63xx_gpio_chip = {
+-      .label                  = "bcm63xx-gpio",
+-      .direction_input        = bcm63xx_gpio_direction_input,
+-      .direction_output       = bcm63xx_gpio_direction_output,
+-      .get                    = bcm63xx_gpio_get,
+-      .set                    = bcm63xx_gpio_set,
+-      .base                   = 0,
+-};
++      if (ngpio <= 32)
++              return 0;
+-int __init bcm63xx_gpio_init(void)
+-{
+-      bcm63xx_gpio_out_low_reg_init();
++      bcm63xx_gpio_init_one(1, GPIO_DATA_HI_REG, GPIO_CTL_HI_REG, ngpio - 32);
+-      gpio_out_low = bcm_gpio_readl(gpio_out_low_reg);
+-      if (!BCMCPU_IS_6345())
+-              gpio_out_high = bcm_gpio_readl(GPIO_DATA_HI_REG);
+-      bcm63xx_gpio_chip.ngpio = bcm63xx_gpio_count();
+-      pr_info("registering %d GPIOs\n", bcm63xx_gpio_chip.ngpio);
++      return 0;
+-      return gpiochip_add(&bcm63xx_gpio_chip);
+ }
+--- a/arch/mips/bcm63xx/prom.c
++++ b/arch/mips/bcm63xx/prom.c
+@@ -54,9 +54,6 @@ void __init prom_init(void)
+       reg &= ~mask;
+       bcm_perf_writel(reg, PERF_CKCTL_REG);
+-      /* register gpiochip */
+-      bcm63xx_gpio_init();
+-
+       /* detect and setup flash access */
+       bcm63xx_flash_detect();
diff --git a/target/linux/brcm63xx/patches-3.14/376-net-bcm63xx_enet-use-named-gpio-for-ephy-reset-gpio.patch b/target/linux/brcm63xx/patches-3.14/376-net-bcm63xx_enet-use-named-gpio-for-ephy-reset-gpio.patch
new file mode 100644 (file)
index 0000000..0e691f7
--- /dev/null
@@ -0,0 +1,49 @@
+From ec905f2ea78ec40602a685ede31c5e4f9893d196 Mon Sep 17 00:00:00 2001
+From: Jonas Gorski <jogo@openwrt.org>
+Date: Sat, 21 Feb 2015 16:35:07 +0100
+Subject: [PATCH 3/6] net: bcm63xx_enet: use named gpio for ephy reset gpio
+
+Allow using a named optional gpio for ephy reset gpio registration.
+---
+ drivers/net/ethernet/broadcom/bcm63xx_enet.c |    12 ++++++++++++
+ 1 file changed, 12 insertions(+)
+
+--- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c
++++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c
+@@ -30,6 +30,7 @@
+ #include <linux/dma-mapping.h>
+ #include <linux/platform_device.h>
+ #include <linux/if_vlan.h>
++#include <linux/gpio/consumer.h>
+ #include <bcm63xx_dev_enet.h>
+ #include "bcm63xx_enet.h"
+@@ -2852,10 +2853,18 @@ static int bcm_enet_shared_probe(struct
+ {
+       struct resource *res;
+       void __iomem *p[3];
++      struct gpio_desc *ephy_reset;
+       unsigned int i;
+       memset(bcm_enet_shared_base, 0, sizeof(bcm_enet_shared_base));
++      ephy_reset = devm_gpiod_get(&pdev->dev, "ephy-reset");
++      if (IS_ERR(ephy_reset)) {
++              if (PTR_ERR(ephy_reset) != -ENOENT)
++                      return PTR_ERR(ephy_reset);
++              ephy_reset = NULL;
++      }
++      
+       for (i = 0; i < 3; i++) {
+               res = platform_get_resource(pdev, IORESOURCE_MEM, i);
+               p[i] = devm_ioremap_resource(&pdev->dev, res);
+@@ -2865,6 +2874,9 @@ static int bcm_enet_shared_probe(struct
+       memcpy(bcm_enet_shared_base, p, sizeof(bcm_enet_shared_base));
++      if (ephy_reset)
++              gpiod_direction_output(ephy_reset, 0);
++
+       return 0;
+ }
diff --git a/target/linux/brcm63xx/patches-3.14/377-MIPS-BCM63XX-register-lookup-for-ephy-reset-gpio.patch b/target/linux/brcm63xx/patches-3.14/377-MIPS-BCM63XX-register-lookup-for-ephy-reset-gpio.patch
new file mode 100644 (file)
index 0000000..288ccaa
--- /dev/null
@@ -0,0 +1,138 @@
+From d13bdf92ec885105cf107183f8464c40e5f3b93b Mon Sep 17 00:00:00 2001
+From: Jonas Gorski <jogo@openwrt.org>
+Date: Sat, 21 Feb 2015 17:21:59 +0100
+Subject: [PATCH 4/6] MIPS: BCM63XX: register lookup for ephy-reset gpio
+
+
+Signed-off-by: Jonas Gorski <jogo@openwrt.org>
+---
+ arch/mips/bcm63xx/boards/board_bcm963xx.c          |    2 +-
+ arch/mips/bcm63xx/boards/board_common.c            |    7 +++--
+ arch/mips/bcm63xx/gpio.c                           |   32 ++++++++++++++++++++
+ arch/mips/include/asm/mach-bcm63xx/bcm63xx_gpio.h  |    2 ++
+ .../mips/include/asm/mach-bcm63xx/board_bcm963xx.h |    5 +--
+ 5 files changed, 42 insertions(+), 6 deletions(-)
+
+--- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
++++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
+@@ -59,7 +59,7 @@ static struct board_info __initdata boar
+       },
+       .ephy_reset_gpio                = 36,
+-      .ephy_reset_gpio_flags          = GPIOF_INIT_HIGH,
++      .ephy_reset_gpio_flags          = GPIO_ACTIVE_LOW,
+ };
+ #endif
+--- a/arch/mips/bcm63xx/boards/board_common.c
++++ b/arch/mips/bcm63xx/boards/board_common.c
+@@ -278,9 +278,10 @@ int __init board_register_devices(void)
+               platform_device_register(&bcm63xx_gpio_leds);
+       }
+-      if (board.ephy_reset_gpio && board.ephy_reset_gpio_flags)
+-              gpio_request_one(board.ephy_reset_gpio,
+-                              board.ephy_reset_gpio_flags, "ephy-reset");
++      if (board.ephy_reset_gpio && board.ephy_reset_gpio_flags) {
++              bcm63xx_gpio_ephy_reset(board.ephy_reset_gpio,
++                                      board.ephy_reset_gpio_flags);
++      }
+       /* count number of BUTTONs defined by this device */
+       while (button_count < ARRAY_SIZE(board.buttons) && board.buttons[button_count].desc)
+--- a/arch/mips/bcm63xx/gpio.c
++++ b/arch/mips/bcm63xx/gpio.c
+@@ -8,15 +8,24 @@
+  * Copyright (C) Jonas Gorski <jogo@openwrt.org>
+  */
++#include <asm/addrspace.h>
++
+ #include <linux/kernel.h>
+ #include <linux/platform_device.h>
+ #include <linux/basic_mmio_gpio.h>
+ #include <linux/gpio.h>
++#include <linux/gpio/driver.h>
+ #include <bcm63xx_cpu.h>
+ #include <bcm63xx_gpio.h>
+ #include <bcm63xx_regs.h>
++/* for registering lookups; make them large enough to hold OF names */
++static char *gpio_chip_labels[] = {
++      "xxxxxxxx.gpio-controller",
++      "xxxxxxxx.gpio-controller",
++};
++
+ static void __init bcm63xx_gpio_init_one(int id, int dir, int data, int ngpio)
+ {
+       struct resource res[2];
+@@ -40,6 +49,7 @@ static void __init bcm63xx_gpio_init_one
+       pdata.base = id * 32;
+       pdata.ngpio = ngpio;
++      sprintf(gpio_chip_labels[id], "bcm63xx-gpio.%d", id);
+       platform_device_register_resndata(NULL, "bcm63xx-gpio", id, res, 2,
+                                         &pdata, sizeof(pdata));
+ }
+@@ -64,3 +74,25 @@ int __init bcm63xx_gpio_init(void)
+       return 0;
+ }
++
++static struct gpiod_lookup_table ephy_reset = {
++      .dev_id = "bcm63xx_enet_shared.0",
++      .table = {
++              { /* filled at runtime */ },
++              { },
++      },
++};
++
++
++void bcm63xx_gpio_ephy_reset(int hw_gpio, enum gpio_lookup_flags flags)
++{
++      if (ephy_reset.table[0].chip_label)
++              return;
++
++      ephy_reset.table[0].chip_label = gpio_chip_labels[hw_gpio / 32];
++      ephy_reset.table[0].chip_hwnum = hw_gpio % 32;
++      ephy_reset.table[0].con_id = "ephy-reset";
++      ephy_reset.table[0].flags = flags;
++
++      gpiod_add_lookup_table(&ephy_reset);
++}
+--- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_gpio.h
++++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_gpio.h
+@@ -2,9 +2,11 @@
+ #define BCM63XX_GPIO_H
+ #include <linux/init.h>
++#include <linux/gpio/driver.h>
+ #include <bcm63xx_cpu.h>
+ int __init bcm63xx_gpio_init(void);
++void bcm63xx_gpio_ephy_reset(int hw_gpio, enum gpio_lookup_flags flags);
+ static inline unsigned long bcm63xx_gpio_count(void)
+ {
+--- a/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h
++++ b/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h
+@@ -4,6 +4,7 @@
+ #include <linux/types.h>
+ #include <linux/gpio.h>
+ #include <linux/gpio_keys.h>
++#include <linux/gpio/driver.h>
+ #include <linux/leds.h>
+ #include <bcm63xx_dev_enet.h>
+ #include <bcm63xx_dev_usb_usbd.h>
+@@ -58,8 +59,8 @@ struct board_info {
+       /* External PHY reset GPIO */
+       unsigned int ephy_reset_gpio;
+-      /* External PHY reset GPIO flags from gpio.h */
+-      unsigned long ephy_reset_gpio_flags;
++      /* External PHY reset GPIO flags from gpio/machine.h */
++      enum gpio_lookup_flags ephy_reset_gpio_flags;
+       /* fallback sprom config */
+       struct fallback_sprom_data fallback_sprom;
diff --git a/target/linux/brcm63xx/patches-3.14/378-MIPS-BCM63XX-calculate-labels-for-DT-registered-cont.patch b/target/linux/brcm63xx/patches-3.14/378-MIPS-BCM63XX-calculate-labels-for-DT-registered-cont.patch
new file mode 100644 (file)
index 0000000..1f56c20
--- /dev/null
@@ -0,0 +1,49 @@
+From e55892aac9d5508a000647ca66f0e678e02be3bb Mon Sep 17 00:00:00 2001
+From: Jonas Gorski <jogo@openwrt.org>
+Date: Sat, 21 Feb 2015 17:26:50 +0100
+Subject: [PATCH 5/6] MIPS: BCM63XX: calculate labels for DT registered
+ controllers
+
+
+Signed-off-by: Jonas Gorski <jogo@openwrt.org>
+---
+ arch/mips/bcm63xx/gpio.c |   16 +++++++++++++---
+ 1 file changed, 13 insertions(+), 3 deletions(-)
+
+diff --git a/arch/mips/bcm63xx/gpio.c b/arch/mips/bcm63xx/gpio.c
+index 70cd05b..cf0b819 100644
+--- a/arch/mips/bcm63xx/gpio.c
++++ b/arch/mips/bcm63xx/gpio.c
+@@ -20,6 +20,8 @@
+ #include <bcm63xx_gpio.h>
+ #include <bcm63xx_regs.h>
++#include "boards/board_common.h"
++
+ /* for registering lookups; make them large enough to hold OF names */
+ static char *gpio_chip_labels[] = {
+       "xxxxxxxx.gpio-controller",
+@@ -49,9 +51,17 @@ static void __init bcm63xx_gpio_init_one(int id, int dir, int data, int ngpio)
+       pdata.base = id * 32;
+       pdata.ngpio = ngpio;
+-      sprintf(gpio_chip_labels[id], "bcm63xx-gpio.%d", id);
+-      platform_device_register_resndata(NULL, "bcm63xx-gpio", id, res, 2,
+-                                        &pdata, sizeof(pdata));
++      if (board_of_device_present("gpio0")) {
++              unsigned long base = res[0].start;
++
++              if (base < 0xf0000000U)
++                      base = CPHYSADDR(base);
++              sprintf(gpio_chip_labels[id], "%lx.gpio-controller", base);
++      } else {
++              sprintf(gpio_chip_labels[id], "bcm63xx-gpio.%d", id);
++              platform_device_register_resndata(NULL, "bcm63xx-gpio", id, res,
++                                                2, &pdata, sizeof(pdata));
++      }
+ }
+ int __init bcm63xx_gpio_init(void)
+-- 
+1.7.10.4
+
diff --git a/target/linux/brcm63xx/patches-3.14/379-gpio-gpio-bcm63xx-use-alias-id-for-base-calculation.patch b/target/linux/brcm63xx/patches-3.14/379-gpio-gpio-bcm63xx-use-alias-id-for-base-calculation.patch
new file mode 100644 (file)
index 0000000..5be625a
--- /dev/null
@@ -0,0 +1,34 @@
+From 6759a62f28bb1995afe6562c0adfbbb6e8540933 Mon Sep 17 00:00:00 2001
+From: Jonas Gorski <jogo@openwrt.org>
+Date: Sun, 22 Feb 2015 12:57:58 +0100
+Subject: [PATCH 6/6] gpio: gpio-bcm63xx: use alias id for base calculation
+
+Signed-off-by: Jonas Gorski <jogo@openwrt.org>
+---
+ drivers/gpio/gpio-bcm63xx.c |    6 ++++++
+ 1 file changed, 6 insertions(+)
+
+--- a/drivers/gpio/gpio-bcm63xx.c
++++ b/drivers/gpio/gpio-bcm63xx.c
+@@ -32,6 +32,8 @@
+ #include <linux/of.h>
+ #include <linux/of_gpio.h>
++#define BCM63XX_GPIOS_PER_BANK        32
++
+ static int bcm63xx_gpio_probe(struct platform_device *pdev)
+ {
+       struct device *dev = &pdev->dev;
+@@ -73,8 +75,12 @@ static int bcm63xx_gpio_probe(struct pla
+       platform_set_drvdata(pdev, bgc);
+       if (dev->of_node) {
++              int id = of_alias_get_id(dev->of_node, "gpio");
+               u32 ngpios;
++              if (id >= 0)
++                      bgc->gc.base = id * BCM63XX_GPIOS_PER_BANK;
++
+               if (!of_property_read_u32(dev->of_node, "ngpios", &ngpios))
+                       bgc->gc.ngpio = ngpios;
index fc2e8ab7a7170b22c618b2bd93cc0d6f9f31ac37..8e30ce45911903da096fa7822b9072a1b64989f6 100644 (file)
@@ -1,6 +1,6 @@
 --- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c
 +++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c
-@@ -1633,7 +1633,7 @@ static int compute_hw_mtu(struct bcm_ene
+@@ -1634,7 +1634,7 @@ static int compute_hw_mtu(struct bcm_ene
        actual_mtu = mtu;
  
        /* add ethernet header + vlan tag size */
index d8405f58a00105e4e45f182029dc9e0a36e9934b..b9420d5567ebb0dbdde3a524941247ec3aa08769 100644 (file)
@@ -15,7 +15,7 @@ Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
 
 --- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c
 +++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c
-@@ -870,10 +870,8 @@ static int bcm_enet_open(struct net_devi
+@@ -871,10 +871,8 @@ static int bcm_enet_open(struct net_devi
        struct bcm_enet_priv *priv;
        struct sockaddr addr;
        struct device *kdev;
@@ -26,7 +26,7 @@ Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
        void *p;
        u32 val;
  
-@@ -881,40 +879,10 @@ static int bcm_enet_open(struct net_devi
+@@ -882,40 +880,10 @@ static int bcm_enet_open(struct net_devi
        kdev = &priv->pdev->dev;
  
        if (priv->has_phy) {
@@ -68,7 +68,7 @@ Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
        }
  
        /* mask all interrupts and request them */
-@@ -924,7 +892,7 @@ static int bcm_enet_open(struct net_devi
+@@ -925,7 +893,7 @@ static int bcm_enet_open(struct net_devi
  
        ret = request_irq(dev->irq, bcm_enet_isr_mac, 0, dev->name, dev);
        if (ret)
@@ -77,7 +77,7 @@ Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
  
        ret = request_irq(priv->irq_rx, bcm_enet_isr_dma, 0,
                          dev->name, dev);
-@@ -1127,9 +1095,6 @@ out_freeirq_rx:
+@@ -1128,9 +1096,6 @@ out_freeirq_rx:
  out_freeirq:
        free_irq(dev->irq, dev);
  
@@ -87,7 +87,7 @@ Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
        return ret;
  }
  
-@@ -1234,12 +1199,6 @@ static int bcm_enet_stop(struct net_devi
+@@ -1235,12 +1200,6 @@ static int bcm_enet_stop(struct net_devi
        free_irq(priv->irq_rx, dev);
        free_irq(dev->irq, dev);
  
@@ -100,7 +100,7 @@ Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
        return 0;
  }
  
-@@ -1834,6 +1793,8 @@ static int bcm_enet_probe(struct platfor
+@@ -1835,6 +1794,8 @@ static int bcm_enet_probe(struct platfor
  
        /* MII bus registration */
        if (priv->has_phy) {
@@ -109,7 +109,7 @@ Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
  
                priv->mii_bus = mdiobus_alloc();
                if (!priv->mii_bus) {
-@@ -1871,6 +1832,38 @@ static int bcm_enet_probe(struct platfor
+@@ -1872,6 +1833,38 @@ static int bcm_enet_probe(struct platfor
                        dev_err(&pdev->dev, "unable to register mdio bus\n");
                        goto out_free_mdio;
                }
@@ -148,7 +148,7 @@ Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
        } else {
  
                /* run platform code to initialize PHY device */
-@@ -1916,6 +1909,9 @@ static int bcm_enet_probe(struct platfor
+@@ -1917,6 +1910,9 @@ static int bcm_enet_probe(struct platfor
        return 0;
  
  out_unregister_mdio:
@@ -158,7 +158,7 @@ Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
        if (priv->mii_bus)
                mdiobus_unregister(priv->mii_bus);
  
-@@ -1957,6 +1953,8 @@ static int bcm_enet_remove(struct platfo
+@@ -1958,6 +1954,8 @@ static int bcm_enet_remove(struct platfo
        enet_writel(priv, 0, ENET_MIISC_REG);
  
        if (priv->has_phy) {
index a6f35c5b5e6a1dc86669e60f6040222902fa9f38..1cff9c1ff933e1c57891b7b5ec3c1ae1f94c51c0 100644 (file)
@@ -32,7 +32,7 @@ Subject: [PATCH 54/81] bcm63xx_enet: enable rgmii clock on external ports
  #define ENETSW_MDIOC_EXT_MASK         (1 << 16)
 --- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c
 +++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c
-@@ -2228,6 +2228,18 @@ static int bcm_enetsw_open(struct net_de
+@@ -2229,6 +2229,18 @@ static int bcm_enetsw_open(struct net_de
                priv->sw_port_link[i] = 0;
        }
  
index bcb92a1893ce8333226c241e6cbc18fcfb8ff010..09600057c5a4ecfc9f7ef6bf402d728ff5d8f4a2 100644 (file)
@@ -26,7 +26,7 @@ Subject: [PATCH 58/72] BCM63XX: allow providing fixup data in board data
  
  #if CONFIG_OF
        if (of_have_populated_dt()) {
-@@ -293,6 +295,10 @@ int __init board_register_devices(void)
+@@ -296,6 +298,10 @@ int __init board_register_devices(void)
                platform_device_register(&bcm63xx_gpio_keys_device);
        }
  
@@ -39,7 +39,7 @@ Subject: [PATCH 58/72] BCM63XX: allow providing fixup data in board data
  
 --- a/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h
 +++ b/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h
-@@ -9,6 +9,7 @@
+@@ -10,6 +10,7 @@
  #include <bcm63xx_dev_usb_usbd.h>
  #include <bcm63xx_dev_dsp.h>
  #include <bcm63xx_fallback_sprom.h>
@@ -47,7 +47,7 @@ Subject: [PATCH 58/72] BCM63XX: allow providing fixup data in board data
  
  /*
   * flash mapping
-@@ -16,6 +17,11 @@
+@@ -17,6 +18,11 @@
  #define BCM963XX_CFE_VERSION_OFFSET   0x570
  #define BCM963XX_NVRAM_OFFSET         0x580
  
@@ -59,7 +59,7 @@ Subject: [PATCH 58/72] BCM63XX: allow providing fixup data in board data
  /*
   * board definition
   */
-@@ -36,6 +42,10 @@ struct board_info {
+@@ -37,6 +43,10 @@ struct board_info {
        unsigned int    has_uart0:1;
        unsigned int    has_uart1:1;
        unsigned int    use_fallback_sprom:1;
index fdcfa19e5e83d4b87532abee20180e2308138777..b329c312f5e4a0fe0fce1991a905d922f5098c3f 100644 (file)
@@ -11,7 +11,7 @@ Subject: [PATCH 69/80] MIPS: BCM63XX: pass caldata info to flash
 
 --- a/arch/mips/bcm63xx/boards/board_common.c
 +++ b/arch/mips/bcm63xx/boards/board_common.c
-@@ -267,7 +267,7 @@ int __init board_register_devices(void)
+@@ -269,7 +269,7 @@ int __init board_register_devices(void)
        if (board.num_spis)
                spi_register_board_info(board.spis, board.num_spis);
  
index 0e01be15b3bc9039ec5734ebfc9907d676612d5f..5398c3dd1f905c19d0cc4f982f4234aa25f7c99b 100644 (file)
@@ -11,7 +11,7 @@
  #endif /* _PCI_ATH9K_FIXUP */
 --- a/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h
 +++ b/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h
-@@ -20,6 +20,7 @@
+@@ -21,6 +21,7 @@
  struct ath9k_caldata {
        unsigned int    slot;
        u32             caldata_offset;
@@ -39,7 +39,7 @@
                return;
 --- a/arch/mips/bcm63xx/boards/board_common.c
 +++ b/arch/mips/bcm63xx/boards/board_common.c
-@@ -297,7 +297,8 @@ int __init board_register_devices(void)
+@@ -300,7 +300,8 @@ int __init board_register_devices(void)
  
        /* register any fixups */
        for (i = 0; i < board.has_caldata; i++)
index 27ea83f3cccd5681b4d0b92144a908514df04cd9..13101361e86bfcce1082d688a68224d278a358c2 100644 (file)
@@ -1,6 +1,6 @@
 --- a/arch/mips/bcm63xx/boards/board_common.c
 +++ b/arch/mips/bcm63xx/boards/board_common.c
-@@ -298,7 +298,7 @@ int __init board_register_devices(void)
+@@ -301,7 +301,7 @@ int __init board_register_devices(void)
        /* register any fixups */
        for (i = 0; i < board.has_caldata; i++)
                pci_enable_ath9k_fixup(board.caldata[i].slot, board.caldata[i].caldata_offset,
@@ -29,7 +29,7 @@
                return;
 --- a/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h
 +++ b/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h
-@@ -21,6 +21,7 @@ struct ath9k_caldata {
+@@ -22,6 +22,7 @@ struct ath9k_caldata {
        unsigned int    slot;
        u32             caldata_offset;
        unsigned int    endian_check:1;
index c07bd32e2a6d2f83417fd337101068bde15197c2..bff489b960f9da89d4f49bf9288dc9fd4207c909 100644 (file)
@@ -36,7 +36,7 @@ Subject: [PATCH 72/72] 446-BCM63XX-add-a-fixup-for-rt2x00-devices
  
  #include "board_common.h"
  
-@@ -296,9 +297,19 @@ int __init board_register_devices(void)
+@@ -299,9 +300,19 @@ int __init board_register_devices(void)
        }
  
        /* register any fixups */
@@ -158,7 +158,7 @@ Subject: [PATCH 72/72] 446-BCM63XX-add-a-fixup-for-rt2x00-devices
  
 --- a/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h
 +++ b/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h
-@@ -10,6 +10,7 @@
+@@ -11,6 +11,7 @@
  #include <bcm63xx_dev_dsp.h>
  #include <bcm63xx_fallback_sprom.h>
  #include <pci_ath9k_fixup.h>
@@ -166,7 +166,7 @@ Subject: [PATCH 72/72] 446-BCM63XX-add-a-fixup-for-rt2x00-devices
  
  /*
   * flash mapping
-@@ -17,11 +18,15 @@
+@@ -18,11 +19,15 @@
  #define BCM963XX_CFE_VERSION_OFFSET   0x570
  #define BCM963XX_NVRAM_OFFSET         0x580
  
@@ -183,7 +183,7 @@ Subject: [PATCH 72/72] 446-BCM63XX-add-a-fixup-for-rt2x00-devices
  };
  
  /*
-@@ -47,7 +52,7 @@ struct board_info {
+@@ -48,7 +53,7 @@ struct board_info {
        unsigned int    has_caldata:2;
  
        /* wifi calibration data config */
index 271119cf5902c121ffc238c906535d28afb958f7..48a33ef76197956afb894bd8bf87e9d9f9fc8378 100644 (file)
        spinlock_t enetsw_mdio_lock;
 --- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c
 +++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c
-@@ -30,6 +30,7 @@
- #include <linux/dma-mapping.h>
+@@ -31,6 +31,7 @@
  #include <linux/platform_device.h>
  #include <linux/if_vlan.h>
+ #include <linux/gpio/consumer.h>
 +#include <linux/platform_data/b53.h>
  
  #include <bcm63xx_dev_enet.h>
  #include "bcm63xx_enet.h"
-@@ -1978,7 +1979,8 @@ static int bcm_enet_remove(struct platfo
+@@ -1979,7 +1980,8 @@ static int bcm_enet_remove(struct platfo
        return 0;
  }
  
@@ -30,7 +30,7 @@
        .probe  = bcm_enet_probe,
        .remove = bcm_enet_remove,
        .driver = {
-@@ -1987,6 +1989,42 @@ struct platform_driver bcm63xx_enet_driv
+@@ -1988,6 +1990,42 @@ struct platform_driver bcm63xx_enet_driv
        },
  };
  
@@ -73,7 +73,7 @@
  /*
   * switch mii access callbacks
   */
-@@ -2240,29 +2278,6 @@ static int bcm_enetsw_open(struct net_de
+@@ -2241,29 +2279,6 @@ static int bcm_enetsw_open(struct net_de
                enetsw_writeb(priv, rgmii_ctrl, ENETSW_RGMII_CTRL_REG(i));
        }
  
        /* initialize flow control buffer allocation */
        enet_dma_writel(priv, ENETDMA_BUFALLOC_FORCE_MASK | 0,
                        ENETDMA_BUFALLOC_REG(priv->rx_chan));
-@@ -2722,6 +2737,9 @@ static int bcm_enetsw_probe(struct platf
+@@ -2723,6 +2738,9 @@ static int bcm_enetsw_probe(struct platf
        struct bcm63xx_enetsw_platform_data *pd;
        struct resource *res_mem;
        int ret, irq_rx, irq_tx;
  
        /* stop if shared driver failed, assume driver->probe will be
         * called in the same order we register devices (correct ?)
-@@ -2811,6 +2829,43 @@ static int bcm_enetsw_probe(struct platf
+@@ -2812,6 +2830,43 @@ static int bcm_enetsw_probe(struct platf
        priv->pdev = pdev;
        priv->net_dev = dev;
  
        return 0;
  
  out_put_clk:
-@@ -2839,6 +2894,9 @@ static int bcm_enetsw_remove(struct plat
+@@ -2840,6 +2895,9 @@ static int bcm_enetsw_remove(struct plat
        priv = netdev_priv(dev);
        unregister_netdev(dev);
  
index 24dd27a29257d79e26de49d6e0a2bd949108e9ee..47255835b32625162b6f3bde8e3b9d67b12f7545 100644 (file)
@@ -1,6 +1,6 @@
 --- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c
 +++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c
-@@ -2784,12 +2784,6 @@ static int bcm_enetsw_probe(struct platf
+@@ -2785,12 +2785,6 @@ static int bcm_enetsw_probe(struct platf
        if (ret)
                goto out;
  
index 5dcfa9dda62cc35eaa0b2daaa3289dffeb04a626..1fd440750a7aca45bc2b770c862afe64afb129fc 100644 (file)
@@ -2,7 +2,7 @@
 +++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
 @@ -61,7 +61,7 @@ static struct board_info __initdata boar
        .ephy_reset_gpio                = 36,
-       .ephy_reset_gpio_flags          = GPIOF_INIT_HIGH,
+       .ephy_reset_gpio_flags          = GPIO_ACTIVE_LOW,
  };
 -#endif
 +#endif /* CONFIG_BCM63XX_CPU_3368 */
index 3414379969db558b41496acdb1250a46e6daadc0..9775970105a1d7634c46c32eb7fd8a6d2c36a741 100644 (file)
@@ -57,7 +57,7 @@ Subject: [PATCH] MIPS: BCM63XX: add inventel Livebox support
  #endif /* __BOARD_COMMON_H */
 --- /dev/null
 +++ b/arch/mips/bcm63xx/boards/board_livebox.c
-@@ -0,0 +1,215 @@
+@@ -0,0 +1,212 @@
 +/*
 + * This file is subject to the terms and conditions of the GNU General Public
 + * License.  See the file "COPYING" in the main directory of this archive
@@ -111,7 +111,7 @@ Subject: [PATCH] MIPS: BCM63XX: add inventel Livebox support
 +      },
 +
 +      .ephy_reset_gpio                = 6,
-+      .ephy_reset_gpio_flags          = GPIOF_INIT_HIGH,
++      .ephy_reset_gpio_flags          = GPIO_ACTIVE_LOW,
 +
 +      .has_ohci0                      = 1,
 +      .has_pccard                     = 1,
@@ -168,9 +168,6 @@ Subject: [PATCH] MIPS: BCM63XX: add inventel Livebox support
 +              },
 +
 +      },
-+
-+      .ephy_reset_gpio                = 6,
-+      .ephy_reset_gpio_flags          = GPIOF_INIT_HIGH,
 +};
 +#endif
 +
index d7a808763c39671f4a3635eef1f9ccb4bf4d1b7d..58a793f670fb8030ddb4b8141793fe70d3538fbc 100644 (file)
@@ -36,7 +36,7 @@
 +      },
 +
 +      .ephy_reset_gpio                = 4,
-+      .ephy_reset_gpio_flags          = GPIOF_INIT_HIGH,
++      .ephy_reset_gpio_flags          = GPIO_ACTIVE_LOW,
 +};
  
  static struct board_info __initdata board_ct536_ct5621 = {
diff --git a/target/linux/brcm63xx/patches-3.18/374-gpio-add-a-simple-GPIO-driver-for-bcm63xx.patch b/target/linux/brcm63xx/patches-3.18/374-gpio-add-a-simple-GPIO-driver-for-bcm63xx.patch
new file mode 100644 (file)
index 0000000..82d7abe
--- /dev/null
@@ -0,0 +1,161 @@
+From dbe94a8daaa63ef81b7414f2a17bca8e36dd6daa Mon Sep 17 00:00:00 2001
+From: Jonas Gorski <jogo@openwrt.org>
+Date: Fri, 20 Feb 2015 19:55:32 +0100
+Subject: [PATCH 1/6] gpio: add a simple GPIO driver for bcm63xx
+
+
+Signed-off-by: Jonas Gorski <jogo@openwrt.org>
+---
+ drivers/gpio/Kconfig        |    8 +++
+ drivers/gpio/Makefile       |    1 +
+ drivers/gpio/gpio-bcm63xx.c |  117 +++++++++++++++++++++++++++++++++++++++++++
+ 3 files changed, 126 insertions(+)
+ create mode 100644 drivers/gpio/gpio-bcm63xx.c
+
+--- a/drivers/gpio/Kconfig
++++ b/drivers/gpio/Kconfig
+@@ -892,6 +892,14 @@ config GPIO_BCM_KONA
+       help
+         Turn on GPIO support for Broadcom "Kona" chips.
++config GPIO_BCM63XX
++      bool "Broadcom BCM63XX GPIO"
++      depends on MIPS || COMPILE_TEST
++      select GPIO_GENERIC
++      help
++        Turn on GPIO support for Broadcom BCM63XX xDSL chips.
++
++
+ comment "USB GPIO expanders:"
+ config GPIO_VIPERBOARD
+--- a/drivers/gpio/Makefile
++++ b/drivers/gpio/Makefile
+@@ -19,6 +19,7 @@ obj-$(CONFIG_GPIO_ADP5588)   += gpio-adp55
+ obj-$(CONFIG_GPIO_AMD8111)    += gpio-amd8111.o
+ obj-$(CONFIG_GPIO_ARIZONA)    += gpio-arizona.o
+ obj-$(CONFIG_GPIO_BCM_KONA)   += gpio-bcm-kona.o
++obj-$(CONFIG_GPIO_BCM63XX)    += gpio-bcm63xx.o
+ obj-$(CONFIG_GPIO_BT8XX)      += gpio-bt8xx.o
+ obj-$(CONFIG_GPIO_CLPS711X)   += gpio-clps711x.o
+ obj-$(CONFIG_GPIO_CS5535)     += gpio-cs5535.o
+--- /dev/null
++++ b/drivers/gpio/gpio-bcm63xx.c
+@@ -0,0 +1,117 @@
++/*
++ * Driver for BCM63XX memory-mapped GPIO controllers, based on
++ * Generic driver for memory-mapped GPIO controllers.
++ *
++ * Copyright 2008 MontaVista Software, Inc.
++ * Copyright 2008,2010 Anton Vorontsov <cbouatmailru@gmail.com>
++ * Copyright 2015 Jonas Gorski <jogo@openwrt.org>
++ *
++ * 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.
++ */
++
++#include <linux/init.h>
++#include <linux/err.h>
++#include <linux/bug.h>
++#include <linux/kernel.h>
++#include <linux/module.h>
++#include <linux/spinlock.h>
++#include <linux/compiler.h>
++#include <linux/types.h>
++#include <linux/errno.h>
++#include <linux/log2.h>
++#include <linux/ioport.h>
++#include <linux/io.h>
++#include <linux/gpio.h>
++#include <linux/slab.h>
++#include <linux/platform_device.h>
++#include <linux/mod_devicetable.h>
++#include <linux/basic_mmio_gpio.h>
++#include <linux/of.h>
++#include <linux/of_gpio.h>
++
++static int bcm63xx_gpio_probe(struct platform_device *pdev)
++{
++      struct device *dev = &pdev->dev;
++      struct resource *dat_r, *dirout_r;
++      void __iomem *dat;
++      void __iomem *dirout;
++      unsigned long sz;
++      int err;
++      struct bgpio_chip *bgc;
++      struct bgpio_pdata *pdata = dev_get_platdata(dev);
++
++      dat_r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
++      dirout_r = platform_get_resource(pdev, IORESOURCE_MEM, 1);
++      if (!dat_r || !dirout_r)
++              return -EINVAL;
++
++      if (resource_size(dat_r) != resource_size(dirout_r))
++              return -EINVAL;
++
++      sz = resource_size(dat_r);
++
++      dat = devm_ioremap_resource(dev, dat_r);
++      if (IS_ERR(dat))
++              return PTR_ERR(dat);
++
++      dirout = devm_ioremap_resource(dev, dirout_r);
++      if (IS_ERR(dirout))
++              return PTR_ERR(dirout);
++
++      bgc = devm_kzalloc(&pdev->dev, sizeof(*bgc), GFP_KERNEL);
++      if (!bgc)
++              return -ENOMEM;
++
++      err = bgpio_init(bgc, dev, sz, dat, NULL, NULL, dirout, NULL,
++                       BGPIOF_BIG_ENDIAN_BYTE_ORDER);
++      if (err)
++              return err;
++
++      platform_set_drvdata(pdev, bgc);
++
++      if (dev->of_node) {
++              u32 ngpios;
++
++              if (!of_property_read_u32(dev->of_node, "ngpios", &ngpios))
++                      bgc->gc.ngpio = ngpios;
++
++      } else if (pdata) {
++              bgc->gc.base = pdata->base;
++              if (pdata->ngpio > 0)
++                      bgc->gc.ngpio = pdata->ngpio;
++      }
++
++      return gpiochip_add(&bgc->gc);
++}
++
++static int bcm63xx_gpio_remove(struct platform_device *pdev)
++{
++      struct bgpio_chip *bgc = platform_get_drvdata(pdev);
++
++      return bgpio_remove(bgc);
++}
++
++#ifdef CONFIG_OF
++static struct of_device_id bcm63xx_gpio_of_match[] = {
++      { .compatible = "brcm,bcm6345-gpio" },
++      { },
++};
++#endif
++
++static struct platform_driver bcm63xx_gpio_driver = {
++      .probe = bcm63xx_gpio_probe,
++      .remove = bcm63xx_gpio_remove,
++      .driver = {
++              .name = "bcm63xx-gpio",
++              .of_match_table = of_match_ptr(bcm63xx_gpio_of_match),
++      },
++};
++
++module_platform_driver(bcm63xx_gpio_driver);
++
++MODULE_DESCRIPTION("Driver for BCM63XX memory-mapped GPIO controllers");
++MODULE_AUTHOR("Jonas Gorski <jogo@openwrt.org>");
++MODULE_LICENSE("GPL");
diff --git a/target/linux/brcm63xx/patches-3.18/375-MIPS-BCM63XX-switch-to-new-gpio-driver.patch b/target/linux/brcm63xx/patches-3.18/375-MIPS-BCM63XX-switch-to-new-gpio-driver.patch
new file mode 100644 (file)
index 0000000..24dd3a9
--- /dev/null
@@ -0,0 +1,216 @@
+From cc99dca188bb63ba390008e2f7fa62d0300233e0 Mon Sep 17 00:00:00 2001
+From: Jonas Gorski <jogo@openwrt.org>
+Date: Fri, 20 Feb 2015 23:58:54 +0100
+Subject: [PATCH 2/6] MIPS: BCM63XX: switch to new gpio driver
+
+Signed-off-by: Jonas Gorski <jogo@openwrt.org>
+---
+ arch/mips/bcm63xx/boards/board_common.c |    2 +
+ arch/mips/bcm63xx/gpio.c                |  147 +++++++------------------------
+ arch/mips/bcm63xx/prom.c                |    3 -
+ 3 files changed, 33 insertions(+), 119 deletions(-)
+
+--- a/arch/mips/bcm63xx/boards/board_common.c
++++ b/arch/mips/bcm63xx/boards/board_common.c
+@@ -204,6 +204,8 @@ int __init board_register_devices(void)
+       }
+ #endif
++      bcm63xx_gpio_init();
++
+       if (board.has_uart0)
+               bcm63xx_uart_register(0);
+--- a/arch/mips/bcm63xx/gpio.c
++++ b/arch/mips/bcm63xx/gpio.c
+@@ -5,147 +5,62 @@
+  *
+  * Copyright (C) 2008 Maxime Bizon <mbizon@freebox.fr>
+  * Copyright (C) 2008-2011 Florian Fainelli <florian@openwrt.org>
++ * Copyright (C) Jonas Gorski <jogo@openwrt.org>
+  */
+ #include <linux/kernel.h>
+-#include <linux/module.h>
+-#include <linux/spinlock.h>
+ #include <linux/platform_device.h>
++#include <linux/basic_mmio_gpio.h>
+ #include <linux/gpio.h>
+ #include <bcm63xx_cpu.h>
+ #include <bcm63xx_gpio.h>
+-#include <bcm63xx_io.h>
+ #include <bcm63xx_regs.h>
+-static u32 gpio_out_low_reg;
+-
+-static void bcm63xx_gpio_out_low_reg_init(void)
++static void __init bcm63xx_gpio_init_one(int id, int dir, int data, int ngpio)
+ {
+-      switch (bcm63xx_get_cpu_id()) {
+-      case BCM6345_CPU_ID:
+-              gpio_out_low_reg = GPIO_DATA_LO_REG_6345;
+-              break;
+-      default:
+-              gpio_out_low_reg = GPIO_DATA_LO_REG;
+-              break;
+-      }
+-}
+-
+-static DEFINE_SPINLOCK(bcm63xx_gpio_lock);
+-static u32 gpio_out_low, gpio_out_high;
++      struct resource res[2];
++      struct bgpio_pdata pdata;
+-static void bcm63xx_gpio_set(struct gpio_chip *chip,
+-                           unsigned gpio, int val)
+-{
+-      u32 reg;
+-      u32 mask;
+-      u32 *v;
+-      unsigned long flags;
+-
+-      if (gpio >= chip->ngpio)
+-              BUG();
+-
+-      if (gpio < 32) {
+-              reg = gpio_out_low_reg;
+-              mask = 1 << gpio;
+-              v = &gpio_out_low;
+-      } else {
+-              reg = GPIO_DATA_HI_REG;
+-              mask = 1 << (gpio - 32);
+-              v = &gpio_out_high;
+-      }
+-
+-      spin_lock_irqsave(&bcm63xx_gpio_lock, flags);
+-      if (val)
+-              *v |= mask;
+-      else
+-              *v &= ~mask;
+-      bcm_gpio_writel(*v, reg);
+-      spin_unlock_irqrestore(&bcm63xx_gpio_lock, flags);
+-}
++      memset(res, 0, sizeof(res));
++      memset(&pdata, 0, sizeof(pdata));
+-static int bcm63xx_gpio_get(struct gpio_chip *chip, unsigned gpio)
+-{
+-      u32 reg;
+-      u32 mask;
++      res[0].flags = IORESOURCE_MEM;
++      res[0].start = bcm63xx_regset_address(RSET_GPIO);
++      res[0].start += data;
+-      if (gpio >= chip->ngpio)
+-              BUG();
++      res[0].end = res[0].start + 3;
+-      if (gpio < 32) {
+-              reg = gpio_out_low_reg;
+-              mask = 1 << gpio;
+-      } else {
+-              reg = GPIO_DATA_HI_REG;
+-              mask = 1 << (gpio - 32);
+-      }
++      res[1].flags = IORESOURCE_MEM;
++      res[1].start = bcm63xx_regset_address(RSET_GPIO);
++      res[1].start += dir;
+-      return !!(bcm_gpio_readl(reg) & mask);
+-}
++      res[1].end = res[1].start + 3;
+-static int bcm63xx_gpio_set_direction(struct gpio_chip *chip,
+-                                    unsigned gpio, int dir)
+-{
+-      u32 reg;
+-      u32 mask;
+-      u32 tmp;
+-      unsigned long flags;
+-
+-      if (gpio >= chip->ngpio)
+-              BUG();
+-
+-      if (gpio < 32) {
+-              reg = GPIO_CTL_LO_REG;
+-              mask = 1 << gpio;
+-      } else {
+-              reg = GPIO_CTL_HI_REG;
+-              mask = 1 << (gpio - 32);
+-      }
+-
+-      spin_lock_irqsave(&bcm63xx_gpio_lock, flags);
+-      tmp = bcm_gpio_readl(reg);
+-      if (dir == BCM63XX_GPIO_DIR_IN)
+-              tmp &= ~mask;
+-      else
+-              tmp |= mask;
+-      bcm_gpio_writel(tmp, reg);
+-      spin_unlock_irqrestore(&bcm63xx_gpio_lock, flags);
++      pdata.base = id * 32;
++      pdata.ngpio = ngpio;
+-      return 0;
++      platform_device_register_resndata(NULL, "bcm63xx-gpio", id, res, 2,
++                                        &pdata, sizeof(pdata));
+ }
+-static int bcm63xx_gpio_direction_input(struct gpio_chip *chip, unsigned gpio)
++int __init bcm63xx_gpio_init(void)
+ {
+-      return bcm63xx_gpio_set_direction(chip, gpio, BCM63XX_GPIO_DIR_IN);
+-}
++      int ngpio = bcm63xx_gpio_count();
++      int data_low_reg;
+-static int bcm63xx_gpio_direction_output(struct gpio_chip *chip,
+-                                       unsigned gpio, int value)
+-{
+-      bcm63xx_gpio_set(chip, gpio, value);
+-      return bcm63xx_gpio_set_direction(chip, gpio, BCM63XX_GPIO_DIR_OUT);
+-}
++      if (BCMCPU_IS_6345())
++              data_low_reg = GPIO_DATA_LO_REG_6345;
++      else
++              data_low_reg = GPIO_DATA_LO_REG;
++      bcm63xx_gpio_init_one(0, data_low_reg, GPIO_CTL_LO_REG, min(ngpio, 32));
+-static struct gpio_chip bcm63xx_gpio_chip = {
+-      .label                  = "bcm63xx-gpio",
+-      .direction_input        = bcm63xx_gpio_direction_input,
+-      .direction_output       = bcm63xx_gpio_direction_output,
+-      .get                    = bcm63xx_gpio_get,
+-      .set                    = bcm63xx_gpio_set,
+-      .base                   = 0,
+-};
++      if (ngpio <= 32)
++              return 0;
+-int __init bcm63xx_gpio_init(void)
+-{
+-      bcm63xx_gpio_out_low_reg_init();
++      bcm63xx_gpio_init_one(1, GPIO_DATA_HI_REG, GPIO_CTL_HI_REG, ngpio - 32);
+-      gpio_out_low = bcm_gpio_readl(gpio_out_low_reg);
+-      if (!BCMCPU_IS_6345())
+-              gpio_out_high = bcm_gpio_readl(GPIO_DATA_HI_REG);
+-      bcm63xx_gpio_chip.ngpio = bcm63xx_gpio_count();
+-      pr_info("registering %d GPIOs\n", bcm63xx_gpio_chip.ngpio);
++      return 0;
+-      return gpiochip_add(&bcm63xx_gpio_chip);
+ }
+--- a/arch/mips/bcm63xx/prom.c
++++ b/arch/mips/bcm63xx/prom.c
+@@ -54,9 +54,6 @@ void __init prom_init(void)
+       reg &= ~mask;
+       bcm_perf_writel(reg, PERF_CKCTL_REG);
+-      /* register gpiochip */
+-      bcm63xx_gpio_init();
+-
+       /* detect and setup flash access */
+       bcm63xx_flash_detect();
diff --git a/target/linux/brcm63xx/patches-3.18/376-net-bcm63xx_enet-use-named-gpio-for-ephy-reset-gpio.patch b/target/linux/brcm63xx/patches-3.18/376-net-bcm63xx_enet-use-named-gpio-for-ephy-reset-gpio.patch
new file mode 100644 (file)
index 0000000..6d19cc0
--- /dev/null
@@ -0,0 +1,46 @@
+From ec905f2ea78ec40602a685ede31c5e4f9893d196 Mon Sep 17 00:00:00 2001
+From: Jonas Gorski <jogo@openwrt.org>
+Date: Sat, 21 Feb 2015 16:35:07 +0100
+Subject: [PATCH 3/6] net: bcm63xx_enet: use named gpio for ephy reset gpio
+
+Allow using a named optional gpio for ephy reset gpio registration.
+---
+ drivers/net/ethernet/broadcom/bcm63xx_enet.c |    9 +++++++++
+ 1 file changed, 9 insertions(+)
+
+--- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c
++++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c
+@@ -30,6 +30,7 @@
+ #include <linux/dma-mapping.h>
+ #include <linux/platform_device.h>
+ #include <linux/if_vlan.h>
++#include <linux/gpio/consumer.h>
+ #include <bcm63xx_dev_enet.h>
+ #include "bcm63xx_enet.h"
+@@ -2848,10 +2849,15 @@ static int bcm_enet_shared_probe(struct
+ {
+       struct resource *res;
+       void __iomem *p[3];
++      struct gpio_desc *ephy_reset;
+       unsigned int i;
+       memset(bcm_enet_shared_base, 0, sizeof(bcm_enet_shared_base));
++      ephy_reset = devm_gpiod_get_optional(&pdev->dev, "ephy-reset");
++      if (IS_ERR(ephy_reset))
++              return PTR_ERR(ephy_reset);
++
+       for (i = 0; i < 3; i++) {
+               res = platform_get_resource(pdev, IORESOURCE_MEM, i);
+               p[i] = devm_ioremap_resource(&pdev->dev, res);
+@@ -2861,6 +2867,9 @@ static int bcm_enet_shared_probe(struct
+       memcpy(bcm_enet_shared_base, p, sizeof(bcm_enet_shared_base));
++      if (ephy_reset)
++              gpiod_direction_output(ephy_reset, 0);
++
+       return 0;
+ }
diff --git a/target/linux/brcm63xx/patches-3.18/377-MIPS-BCM63XX-register-lookup-for-ephy-reset-gpio.patch b/target/linux/brcm63xx/patches-3.18/377-MIPS-BCM63XX-register-lookup-for-ephy-reset-gpio.patch
new file mode 100644 (file)
index 0000000..30f6ba5
--- /dev/null
@@ -0,0 +1,138 @@
+From d13bdf92ec885105cf107183f8464c40e5f3b93b Mon Sep 17 00:00:00 2001
+From: Jonas Gorski <jogo@openwrt.org>
+Date: Sat, 21 Feb 2015 17:21:59 +0100
+Subject: [PATCH 4/6] MIPS: BCM63XX: register lookup for ephy-reset gpio
+
+
+Signed-off-by: Jonas Gorski <jogo@openwrt.org>
+---
+ arch/mips/bcm63xx/boards/board_bcm963xx.c          |    2 +-
+ arch/mips/bcm63xx/boards/board_common.c            |    7 +++--
+ arch/mips/bcm63xx/gpio.c                           |   32 ++++++++++++++++++++
+ arch/mips/include/asm/mach-bcm63xx/bcm63xx_gpio.h  |    2 ++
+ .../mips/include/asm/mach-bcm63xx/board_bcm963xx.h |    5 +--
+ 5 files changed, 42 insertions(+), 6 deletions(-)
+
+--- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
++++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
+@@ -59,7 +59,7 @@ static struct board_info __initdata boar
+       },
+       .ephy_reset_gpio                = 36,
+-      .ephy_reset_gpio_flags          = GPIOF_INIT_HIGH,
++      .ephy_reset_gpio_flags          = GPIO_ACTIVE_LOW,
+ };
+ #endif
+--- a/arch/mips/bcm63xx/boards/board_common.c
++++ b/arch/mips/bcm63xx/boards/board_common.c
+@@ -278,9 +278,10 @@ int __init board_register_devices(void)
+               platform_device_register(&bcm63xx_gpio_leds);
+       }
+-      if (board.ephy_reset_gpio && board.ephy_reset_gpio_flags)
+-              gpio_request_one(board.ephy_reset_gpio,
+-                              board.ephy_reset_gpio_flags, "ephy-reset");
++      if (board.ephy_reset_gpio && board.ephy_reset_gpio_flags) {
++              bcm63xx_gpio_ephy_reset(board.ephy_reset_gpio,
++                                      board.ephy_reset_gpio_flags);
++      }
+       /* count number of BUTTONs defined by this device */
+       while (button_count < ARRAY_SIZE(board.buttons) && board.buttons[button_count].desc)
+--- a/arch/mips/bcm63xx/gpio.c
++++ b/arch/mips/bcm63xx/gpio.c
+@@ -8,15 +8,24 @@
+  * Copyright (C) Jonas Gorski <jogo@openwrt.org>
+  */
++#include <asm/addrspace.h>
++
+ #include <linux/kernel.h>
+ #include <linux/platform_device.h>
+ #include <linux/basic_mmio_gpio.h>
+ #include <linux/gpio.h>
++#include <linux/gpio/machine.h>
+ #include <bcm63xx_cpu.h>
+ #include <bcm63xx_gpio.h>
+ #include <bcm63xx_regs.h>
++/* for registering lookups; make them large enough to hold OF names */
++static char *gpio_chip_labels[] = {
++      "xxxxxxxx.gpio-controller",
++      "xxxxxxxx.gpio-controller",
++};
++
+ static void __init bcm63xx_gpio_init_one(int id, int dir, int data, int ngpio)
+ {
+       struct resource res[2];
+@@ -40,6 +49,7 @@ static void __init bcm63xx_gpio_init_one
+       pdata.base = id * 32;
+       pdata.ngpio = ngpio;
++      sprintf(gpio_chip_labels[id], "bcm63xx-gpio.%d", id);
+       platform_device_register_resndata(NULL, "bcm63xx-gpio", id, res, 2,
+                                         &pdata, sizeof(pdata));
+ }
+@@ -64,3 +74,25 @@ int __init bcm63xx_gpio_init(void)
+       return 0;
+ }
++
++static struct gpiod_lookup_table ephy_reset = {
++      .dev_id = "bcm63xx_enet_shared.0",
++      .table = {
++              { /* filled at runtime */ },
++              { },
++      },
++};
++
++
++void bcm63xx_gpio_ephy_reset(int hw_gpio, enum gpio_lookup_flags flags)
++{
++      if (ephy_reset.table[0].chip_label)
++              return;
++
++      ephy_reset.table[0].chip_label = gpio_chip_labels[hw_gpio / 32];
++      ephy_reset.table[0].chip_hwnum = hw_gpio % 32;
++      ephy_reset.table[0].con_id = "ephy-reset";
++      ephy_reset.table[0].flags = flags;
++
++      gpiod_add_lookup_table(&ephy_reset);
++}
+--- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_gpio.h
++++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_gpio.h
+@@ -2,9 +2,11 @@
+ #define BCM63XX_GPIO_H
+ #include <linux/init.h>
++#include <linux/gpio/machine.h>
+ #include <bcm63xx_cpu.h>
+ int __init bcm63xx_gpio_init(void);
++void bcm63xx_gpio_ephy_reset(int hw_gpio, enum gpio_lookup_flags flags);
+ static inline unsigned long bcm63xx_gpio_count(void)
+ {
+--- a/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h
++++ b/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h
+@@ -4,6 +4,7 @@
+ #include <linux/types.h>
+ #include <linux/gpio.h>
+ #include <linux/gpio_keys.h>
++#include <linux/gpio/machine.h>
+ #include <linux/leds.h>
+ #include <bcm63xx_dev_enet.h>
+ #include <bcm63xx_dev_usb_usbd.h>
+@@ -58,8 +59,8 @@ struct board_info {
+       /* External PHY reset GPIO */
+       unsigned int ephy_reset_gpio;
+-      /* External PHY reset GPIO flags from gpio.h */
+-      unsigned long ephy_reset_gpio_flags;
++      /* External PHY reset GPIO flags from gpio/machine.h */
++      enum gpio_lookup_flags ephy_reset_gpio_flags;
+       /* fallback sprom config */
+       struct fallback_sprom_data fallback_sprom;
diff --git a/target/linux/brcm63xx/patches-3.18/378-MIPS-BCM63XX-calculate-labels-for-DT-registered-cont.patch b/target/linux/brcm63xx/patches-3.18/378-MIPS-BCM63XX-calculate-labels-for-DT-registered-cont.patch
new file mode 100644 (file)
index 0000000..40f9e6d
--- /dev/null
@@ -0,0 +1,44 @@
+From e55892aac9d5508a000647ca66f0e678e02be3bb Mon Sep 17 00:00:00 2001
+From: Jonas Gorski <jogo@openwrt.org>
+Date: Sat, 21 Feb 2015 17:26:50 +0100
+Subject: [PATCH 5/6] MIPS: BCM63XX: calculate labels for DT registered
+ controllers
+
+
+Signed-off-by: Jonas Gorski <jogo@openwrt.org>
+---
+ arch/mips/bcm63xx/gpio.c |   16 +++++++++++++---
+ 1 file changed, 13 insertions(+), 3 deletions(-)
+
+--- a/arch/mips/bcm63xx/gpio.c
++++ b/arch/mips/bcm63xx/gpio.c
+@@ -20,6 +20,8 @@
+ #include <bcm63xx_gpio.h>
+ #include <bcm63xx_regs.h>
++#include "boards/board_common.h"
++
+ /* for registering lookups; make them large enough to hold OF names */
+ static char *gpio_chip_labels[] = {
+       "xxxxxxxx.gpio-controller",
+@@ -49,9 +51,17 @@ static void __init bcm63xx_gpio_init_one
+       pdata.base = id * 32;
+       pdata.ngpio = ngpio;
+-      sprintf(gpio_chip_labels[id], "bcm63xx-gpio.%d", id);
+-      platform_device_register_resndata(NULL, "bcm63xx-gpio", id, res, 2,
+-                                        &pdata, sizeof(pdata));
++      if (board_of_device_present("gpio0")) {
++              unsigned long base = res[0].start;
++
++              if (base < 0xf0000000U)
++                      base = CPHYSADDR(base);
++              sprintf(gpio_chip_labels[id], "%lx.gpio-controller", base);
++      } else {
++              sprintf(gpio_chip_labels[id], "bcm63xx-gpio.%d", id);
++              platform_device_register_resndata(NULL, "bcm63xx-gpio", id, res,
++                                                2, &pdata, sizeof(pdata));
++      }
+ }
+ int __init bcm63xx_gpio_init(void)
diff --git a/target/linux/brcm63xx/patches-3.18/379-gpio-gpio-bcm63xx-use-alias-id-for-base-calculation.patch b/target/linux/brcm63xx/patches-3.18/379-gpio-gpio-bcm63xx-use-alias-id-for-base-calculation.patch
new file mode 100644 (file)
index 0000000..5be625a
--- /dev/null
@@ -0,0 +1,34 @@
+From 6759a62f28bb1995afe6562c0adfbbb6e8540933 Mon Sep 17 00:00:00 2001
+From: Jonas Gorski <jogo@openwrt.org>
+Date: Sun, 22 Feb 2015 12:57:58 +0100
+Subject: [PATCH 6/6] gpio: gpio-bcm63xx: use alias id for base calculation
+
+Signed-off-by: Jonas Gorski <jogo@openwrt.org>
+---
+ drivers/gpio/gpio-bcm63xx.c |    6 ++++++
+ 1 file changed, 6 insertions(+)
+
+--- a/drivers/gpio/gpio-bcm63xx.c
++++ b/drivers/gpio/gpio-bcm63xx.c
+@@ -32,6 +32,8 @@
+ #include <linux/of.h>
+ #include <linux/of_gpio.h>
++#define BCM63XX_GPIOS_PER_BANK        32
++
+ static int bcm63xx_gpio_probe(struct platform_device *pdev)
+ {
+       struct device *dev = &pdev->dev;
+@@ -73,8 +75,12 @@ static int bcm63xx_gpio_probe(struct pla
+       platform_set_drvdata(pdev, bgc);
+       if (dev->of_node) {
++              int id = of_alias_get_id(dev->of_node, "gpio");
+               u32 ngpios;
++              if (id >= 0)
++                      bgc->gc.base = id * BCM63XX_GPIOS_PER_BANK;
++
+               if (!of_property_read_u32(dev->of_node, "ngpios", &ngpios))
+                       bgc->gc.ngpio = ngpios;
index 8cb8099e97dd8d65a4b0e21467e7acff13c48b16..fc2e8ab7a7170b22c618b2bd93cc0d6f9f31ac37 100644 (file)
@@ -1,6 +1,6 @@
 --- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c
 +++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c
-@@ -1632,7 +1632,7 @@ static int compute_hw_mtu(struct bcm_ene
+@@ -1633,7 +1633,7 @@ static int compute_hw_mtu(struct bcm_ene
        actual_mtu = mtu;
  
        /* add ethernet header + vlan tag size */
index 702e4ef14165c8d775fa9f162479ff115dd9b493..6036d2f7392e3b28b768606780657a94e71b6234 100644 (file)
@@ -15,7 +15,7 @@ Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
 
 --- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c
 +++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c
-@@ -870,10 +870,8 @@ static int bcm_enet_open(struct net_devi
+@@ -871,10 +871,8 @@ static int bcm_enet_open(struct net_devi
        struct bcm_enet_priv *priv;
        struct sockaddr addr;
        struct device *kdev;
@@ -26,7 +26,7 @@ Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
        void *p;
        u32 val;
  
-@@ -881,40 +879,10 @@ static int bcm_enet_open(struct net_devi
+@@ -882,40 +880,10 @@ static int bcm_enet_open(struct net_devi
        kdev = &priv->pdev->dev;
  
        if (priv->has_phy) {
@@ -68,7 +68,7 @@ Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
        }
  
        /* mask all interrupts and request them */
-@@ -924,7 +892,7 @@ static int bcm_enet_open(struct net_devi
+@@ -925,7 +893,7 @@ static int bcm_enet_open(struct net_devi
  
        ret = request_irq(dev->irq, bcm_enet_isr_mac, 0, dev->name, dev);
        if (ret)
@@ -77,7 +77,7 @@ Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
  
        ret = request_irq(priv->irq_rx, bcm_enet_isr_dma, 0,
                          dev->name, dev);
-@@ -1127,9 +1095,6 @@ out_freeirq_rx:
+@@ -1128,9 +1096,6 @@ out_freeirq_rx:
  out_freeirq:
        free_irq(dev->irq, dev);
  
@@ -87,7 +87,7 @@ Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
        return ret;
  }
  
-@@ -1234,12 +1199,6 @@ static int bcm_enet_stop(struct net_devi
+@@ -1235,12 +1200,6 @@ static int bcm_enet_stop(struct net_devi
        free_irq(priv->irq_rx, dev);
        free_irq(dev->irq, dev);
  
@@ -100,7 +100,7 @@ Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
        return 0;
  }
  
-@@ -1830,6 +1789,8 @@ static int bcm_enet_probe(struct platfor
+@@ -1831,6 +1790,8 @@ static int bcm_enet_probe(struct platfor
  
        /* MII bus registration */
        if (priv->has_phy) {
@@ -109,7 +109,7 @@ Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
  
                priv->mii_bus = mdiobus_alloc();
                if (!priv->mii_bus) {
-@@ -1867,6 +1828,38 @@ static int bcm_enet_probe(struct platfor
+@@ -1868,6 +1829,38 @@ static int bcm_enet_probe(struct platfor
                        dev_err(&pdev->dev, "unable to register mdio bus\n");
                        goto out_free_mdio;
                }
@@ -148,7 +148,7 @@ Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
        } else {
  
                /* run platform code to initialize PHY device */
-@@ -1912,6 +1905,9 @@ static int bcm_enet_probe(struct platfor
+@@ -1913,6 +1906,9 @@ static int bcm_enet_probe(struct platfor
        return 0;
  
  out_unregister_mdio:
@@ -158,7 +158,7 @@ Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
        if (priv->mii_bus)
                mdiobus_unregister(priv->mii_bus);
  
-@@ -1953,6 +1949,8 @@ static int bcm_enet_remove(struct platfo
+@@ -1954,6 +1950,8 @@ static int bcm_enet_remove(struct platfo
        enet_writel(priv, 0, ENET_MIISC_REG);
  
        if (priv->has_phy) {
index 0a97b25bcd885216d73c35cc0acfacb5d7aa31fe..2f2eecf38c884253fe5be0dc690200c5197eed3f 100644 (file)
@@ -32,7 +32,7 @@ Subject: [PATCH 54/81] bcm63xx_enet: enable rgmii clock on external ports
  #define ENETSW_MDIOC_EXT_MASK         (1 << 16)
 --- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c
 +++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c
-@@ -2224,6 +2224,18 @@ static int bcm_enetsw_open(struct net_de
+@@ -2225,6 +2225,18 @@ static int bcm_enetsw_open(struct net_de
                priv->sw_port_link[i] = 0;
        }
  
index bcb92a1893ce8333226c241e6cbc18fcfb8ff010..09600057c5a4ecfc9f7ef6bf402d728ff5d8f4a2 100644 (file)
@@ -26,7 +26,7 @@ Subject: [PATCH 58/72] BCM63XX: allow providing fixup data in board data
  
  #if CONFIG_OF
        if (of_have_populated_dt()) {
-@@ -293,6 +295,10 @@ int __init board_register_devices(void)
+@@ -296,6 +298,10 @@ int __init board_register_devices(void)
                platform_device_register(&bcm63xx_gpio_keys_device);
        }
  
@@ -39,7 +39,7 @@ Subject: [PATCH 58/72] BCM63XX: allow providing fixup data in board data
  
 --- a/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h
 +++ b/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h
-@@ -9,6 +9,7 @@
+@@ -10,6 +10,7 @@
  #include <bcm63xx_dev_usb_usbd.h>
  #include <bcm63xx_dev_dsp.h>
  #include <bcm63xx_fallback_sprom.h>
@@ -47,7 +47,7 @@ Subject: [PATCH 58/72] BCM63XX: allow providing fixup data in board data
  
  /*
   * flash mapping
-@@ -16,6 +17,11 @@
+@@ -17,6 +18,11 @@
  #define BCM963XX_CFE_VERSION_OFFSET   0x570
  #define BCM963XX_NVRAM_OFFSET         0x580
  
@@ -59,7 +59,7 @@ Subject: [PATCH 58/72] BCM63XX: allow providing fixup data in board data
  /*
   * board definition
   */
-@@ -36,6 +42,10 @@ struct board_info {
+@@ -37,6 +43,10 @@ struct board_info {
        unsigned int    has_uart0:1;
        unsigned int    has_uart1:1;
        unsigned int    use_fallback_sprom:1;
index fdcfa19e5e83d4b87532abee20180e2308138777..b329c312f5e4a0fe0fce1991a905d922f5098c3f 100644 (file)
@@ -11,7 +11,7 @@ Subject: [PATCH 69/80] MIPS: BCM63XX: pass caldata info to flash
 
 --- a/arch/mips/bcm63xx/boards/board_common.c
 +++ b/arch/mips/bcm63xx/boards/board_common.c
-@@ -267,7 +267,7 @@ int __init board_register_devices(void)
+@@ -269,7 +269,7 @@ int __init board_register_devices(void)
        if (board.num_spis)
                spi_register_board_info(board.spis, board.num_spis);
  
index 0e01be15b3bc9039ec5734ebfc9907d676612d5f..5398c3dd1f905c19d0cc4f982f4234aa25f7c99b 100644 (file)
@@ -11,7 +11,7 @@
  #endif /* _PCI_ATH9K_FIXUP */
 --- a/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h
 +++ b/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h
-@@ -20,6 +20,7 @@
+@@ -21,6 +21,7 @@
  struct ath9k_caldata {
        unsigned int    slot;
        u32             caldata_offset;
@@ -39,7 +39,7 @@
                return;
 --- a/arch/mips/bcm63xx/boards/board_common.c
 +++ b/arch/mips/bcm63xx/boards/board_common.c
-@@ -297,7 +297,8 @@ int __init board_register_devices(void)
+@@ -300,7 +300,8 @@ int __init board_register_devices(void)
  
        /* register any fixups */
        for (i = 0; i < board.has_caldata; i++)
index 27ea83f3cccd5681b4d0b92144a908514df04cd9..13101361e86bfcce1082d688a68224d278a358c2 100644 (file)
@@ -1,6 +1,6 @@
 --- a/arch/mips/bcm63xx/boards/board_common.c
 +++ b/arch/mips/bcm63xx/boards/board_common.c
-@@ -298,7 +298,7 @@ int __init board_register_devices(void)
+@@ -301,7 +301,7 @@ int __init board_register_devices(void)
        /* register any fixups */
        for (i = 0; i < board.has_caldata; i++)
                pci_enable_ath9k_fixup(board.caldata[i].slot, board.caldata[i].caldata_offset,
@@ -29,7 +29,7 @@
                return;
 --- a/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h
 +++ b/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h
-@@ -21,6 +21,7 @@ struct ath9k_caldata {
+@@ -22,6 +22,7 @@ struct ath9k_caldata {
        unsigned int    slot;
        u32             caldata_offset;
        unsigned int    endian_check:1;
index c07bd32e2a6d2f83417fd337101068bde15197c2..bff489b960f9da89d4f49bf9288dc9fd4207c909 100644 (file)
@@ -36,7 +36,7 @@ Subject: [PATCH 72/72] 446-BCM63XX-add-a-fixup-for-rt2x00-devices
  
  #include "board_common.h"
  
-@@ -296,9 +297,19 @@ int __init board_register_devices(void)
+@@ -299,9 +300,19 @@ int __init board_register_devices(void)
        }
  
        /* register any fixups */
@@ -158,7 +158,7 @@ Subject: [PATCH 72/72] 446-BCM63XX-add-a-fixup-for-rt2x00-devices
  
 --- a/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h
 +++ b/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h
-@@ -10,6 +10,7 @@
+@@ -11,6 +11,7 @@
  #include <bcm63xx_dev_dsp.h>
  #include <bcm63xx_fallback_sprom.h>
  #include <pci_ath9k_fixup.h>
@@ -166,7 +166,7 @@ Subject: [PATCH 72/72] 446-BCM63XX-add-a-fixup-for-rt2x00-devices
  
  /*
   * flash mapping
-@@ -17,11 +18,15 @@
+@@ -18,11 +19,15 @@
  #define BCM963XX_CFE_VERSION_OFFSET   0x570
  #define BCM963XX_NVRAM_OFFSET         0x580
  
@@ -183,7 +183,7 @@ Subject: [PATCH 72/72] 446-BCM63XX-add-a-fixup-for-rt2x00-devices
  };
  
  /*
-@@ -47,7 +52,7 @@ struct board_info {
+@@ -48,7 +53,7 @@ struct board_info {
        unsigned int    has_caldata:2;
  
        /* wifi calibration data config */
index 469a365b911c970dc6cd8fae701ffdd5a6513037..f7697e1faa5d2cef04d8be9649e25b0685c5e3b8 100644 (file)
        spinlock_t enetsw_mdio_lock;
 --- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c
 +++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c
-@@ -30,6 +30,7 @@
- #include <linux/dma-mapping.h>
+@@ -31,6 +31,7 @@
  #include <linux/platform_device.h>
  #include <linux/if_vlan.h>
+ #include <linux/gpio/consumer.h>
 +#include <linux/platform_data/b53.h>
  
  #include <bcm63xx_dev_enet.h>
  #include "bcm63xx_enet.h"
-@@ -1974,7 +1975,8 @@ static int bcm_enet_remove(struct platfo
+@@ -1975,7 +1976,8 @@ static int bcm_enet_remove(struct platfo
        return 0;
  }
  
@@ -30,7 +30,7 @@
        .probe  = bcm_enet_probe,
        .remove = bcm_enet_remove,
        .driver = {
-@@ -1983,6 +1985,42 @@ struct platform_driver bcm63xx_enet_driv
+@@ -1984,6 +1986,42 @@ struct platform_driver bcm63xx_enet_driv
        },
  };
  
@@ -73,7 +73,7 @@
  /*
   * switch mii access callbacks
   */
-@@ -2236,29 +2274,6 @@ static int bcm_enetsw_open(struct net_de
+@@ -2237,29 +2275,6 @@ static int bcm_enetsw_open(struct net_de
                enetsw_writeb(priv, rgmii_ctrl, ENETSW_RGMII_CTRL_REG(i));
        }
  
        /* initialize flow control buffer allocation */
        enet_dma_writel(priv, ENETDMA_BUFALLOC_FORCE_MASK | 0,
                        ENETDMA_BUFALLOC_REG(priv->rx_chan));
-@@ -2718,6 +2733,9 @@ static int bcm_enetsw_probe(struct platf
+@@ -2719,6 +2734,9 @@ static int bcm_enetsw_probe(struct platf
        struct bcm63xx_enetsw_platform_data *pd;
        struct resource *res_mem;
        int ret, irq_rx, irq_tx;
  
        /* stop if shared driver failed, assume driver->probe will be
         * called in the same order we register devices (correct ?)
-@@ -2807,6 +2825,43 @@ static int bcm_enetsw_probe(struct platf
+@@ -2808,6 +2826,43 @@ static int bcm_enetsw_probe(struct platf
        priv->pdev = pdev;
        priv->net_dev = dev;
  
        return 0;
  
  out_put_clk:
-@@ -2835,6 +2890,9 @@ static int bcm_enetsw_remove(struct plat
+@@ -2836,6 +2891,9 @@ static int bcm_enetsw_remove(struct plat
        priv = netdev_priv(dev);
        unregister_netdev(dev);
  
index 12e366c99cc505f93d2684d8330d58dbf8c8e744..a0873085c9a3e9a3ef7c193609ea253a180d7d85 100644 (file)
@@ -1,6 +1,6 @@
 --- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c
 +++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c
-@@ -2780,12 +2780,6 @@ static int bcm_enetsw_probe(struct platf
+@@ -2781,12 +2781,6 @@ static int bcm_enetsw_probe(struct platf
        if (ret)
                goto out;
  
index 5dcfa9dda62cc35eaa0b2daaa3289dffeb04a626..1fd440750a7aca45bc2b770c862afe64afb129fc 100644 (file)
@@ -2,7 +2,7 @@
 +++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
 @@ -61,7 +61,7 @@ static struct board_info __initdata boar
        .ephy_reset_gpio                = 36,
-       .ephy_reset_gpio_flags          = GPIOF_INIT_HIGH,
+       .ephy_reset_gpio_flags          = GPIO_ACTIVE_LOW,
  };
 -#endif
 +#endif /* CONFIG_BCM63XX_CPU_3368 */
index 3414379969db558b41496acdb1250a46e6daadc0..9775970105a1d7634c46c32eb7fd8a6d2c36a741 100644 (file)
@@ -57,7 +57,7 @@ Subject: [PATCH] MIPS: BCM63XX: add inventel Livebox support
  #endif /* __BOARD_COMMON_H */
 --- /dev/null
 +++ b/arch/mips/bcm63xx/boards/board_livebox.c
-@@ -0,0 +1,215 @@
+@@ -0,0 +1,212 @@
 +/*
 + * This file is subject to the terms and conditions of the GNU General Public
 + * License.  See the file "COPYING" in the main directory of this archive
@@ -111,7 +111,7 @@ Subject: [PATCH] MIPS: BCM63XX: add inventel Livebox support
 +      },
 +
 +      .ephy_reset_gpio                = 6,
-+      .ephy_reset_gpio_flags          = GPIOF_INIT_HIGH,
++      .ephy_reset_gpio_flags          = GPIO_ACTIVE_LOW,
 +
 +      .has_ohci0                      = 1,
 +      .has_pccard                     = 1,
@@ -168,9 +168,6 @@ Subject: [PATCH] MIPS: BCM63XX: add inventel Livebox support
 +              },
 +
 +      },
-+
-+      .ephy_reset_gpio                = 6,
-+      .ephy_reset_gpio_flags          = GPIOF_INIT_HIGH,
 +};
 +#endif
 +
index d7a808763c39671f4a3635eef1f9ccb4bf4d1b7d..58a793f670fb8030ddb4b8141793fe70d3538fbc 100644 (file)
@@ -36,7 +36,7 @@
 +      },
 +
 +      .ephy_reset_gpio                = 4,
-+      .ephy_reset_gpio_flags          = GPIOF_INIT_HIGH,
++      .ephy_reset_gpio_flags          = GPIO_ACTIVE_LOW,
 +};
  
  static struct board_info __initdata board_ct536_ct5621 = {