aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/brcm63xx/patches-4.19/377-MIPS-BCM63XX-register-lookup-for-ephy-reset-gpio.patch
diff options
context:
space:
mode:
authorÁlvaro Fernández Rojas <noltari@gmail.com>2019-09-14 09:39:52 +0200
committerJonas Gorski <jonas.gorski@gmail.com>2019-11-09 13:16:01 +0100
commitf586dd67ac58a908092fedaa550a7ef99ff84d22 (patch)
tree5b6f119b20c573f1e58fe1531ae412310d4938d1 /target/linux/brcm63xx/patches-4.19/377-MIPS-BCM63XX-register-lookup-for-ephy-reset-gpio.patch
parent9673d5c7ab9b9018a6e87fa6a4b26624c7b1f96f (diff)
downloadupstream-f586dd67ac58a908092fedaa550a7ef99ff84d22.tar.gz
upstream-f586dd67ac58a908092fedaa550a7ef99ff84d22.tar.bz2
upstream-f586dd67ac58a908092fedaa550a7ef99ff84d22.zip
brcm63xx: add linux 4.19 support
Boot tested on Comtrend AR-5387un: https://gist.github.com/Noltari/57e5030455da8dc38e61f8c3a5922254 Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com> [jonas.gorski: make 4.19 an optional testing version; add gcc 8.3 fix] Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
Diffstat (limited to 'target/linux/brcm63xx/patches-4.19/377-MIPS-BCM63XX-register-lookup-for-ephy-reset-gpio.patch')
-rw-r--r--target/linux/brcm63xx/patches-4.19/377-MIPS-BCM63XX-register-lookup-for-ephy-reset-gpio.patch129
1 files changed, 129 insertions, 0 deletions
diff --git a/target/linux/brcm63xx/patches-4.19/377-MIPS-BCM63XX-register-lookup-for-ephy-reset-gpio.patch b/target/linux/brcm63xx/patches-4.19/377-MIPS-BCM63XX-register-lookup-for-ephy-reset-gpio.patch
new file mode 100644
index 0000000000..c061ec4e60
--- /dev/null
+++ b/target/linux/brcm63xx/patches-4.19/377-MIPS-BCM63XX-register-lookup-for-ephy-reset-gpio.patch
@@ -0,0 +1,129 @@
+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
+@@ -55,7 +55,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
+@@ -247,9 +247,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);
++ }
+
+ return 0;
+ }
+--- a/arch/mips/bcm63xx/gpio.c
++++ b/arch/mips/bcm63xx/gpio.c
+@@ -8,15 +8,23 @@
+ * Copyright (C) Jonas Gorski <jogo@openwrt.org>
+ */
+
++#include <asm/addrspace.h>
++
+ #include <linux/kernel.h>
+ #include <linux/init.h>
+ #include <linux/platform_device.h>
+ #include <linux/gpio/driver.h>
++#include <linux/gpio/machine.h>
+
+ #include <bcm63xx_cpu.h>
+ #include <bcm63xx_gpio.h>
+ #include <bcm63xx_regs.h>
+
++static const char * const gpio_chip_labels[] = {
++ "bcm63xx-gpio.0",
++ "bcm63xx-gpio.1",
++};
++
+ static void __init bcm63xx_gpio_init_one(int id, int dir, int data, int ngpio)
+ {
+ struct resource res[2];
+@@ -64,3 +72,25 @@ int __init bcm63xx_gpio_init(void)
+ return 0;
+
+ }
++
++static struct gpiod_lookup_table ephy_reset = {
++ .dev_id = "bcm63xx_enet-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 = "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
+@@ -3,9 +3,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/machine.h>
+ #include <linux/leds.h>
+ #include <bcm63xx_dev_enet.h>
+ #include <bcm63xx_dev_usb_usbd.h>
+@@ -50,8 +51,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;