[LEDE-DEV] [PATCH] kernel: b53: look for NVRAM's "robo_reset" entry on every platform

Rafał Miłecki zajec5 at gmail.com
Tue Mar 13 04:09:20 PDT 2018


From: Rafał Miłecki <rafal at milecki.pl>

Since kernel 4.1 bcm47xx_nvram_gpio_pin() is now defined in a global
header and can be safely called even on non-Broadcom platforms.

This change makes b53 look for "robo_reset" on ARCH_BCM_5301X and
slightly simplifies the code.

Signed-off-by: Rafał Miłecki <rafal at milecki.pl>
---
 target/linux/generic/files/drivers/net/phy/b53/b53_priv.h | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/target/linux/generic/files/drivers/net/phy/b53/b53_priv.h b/target/linux/generic/files/drivers/net/phy/b53/b53_priv.h
index 0c0358206d..d148c03349 100644
--- a/target/linux/generic/files/drivers/net/phy/b53/b53_priv.h
+++ b/target/linux/generic/files/drivers/net/phy/b53/b53_priv.h
@@ -311,6 +311,7 @@ static inline int b53_write64(struct b53_device *dev, u8 page, u8 reg,
 
 #ifdef CONFIG_BCM47XX
 #include <bcm47xx_board.h>
+#endif
 
 #include <linux/version.h>
 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 1, 0))
@@ -318,20 +319,21 @@ static inline int b53_write64(struct b53_device *dev, u8 page, u8 reg,
 #endif
 static inline int b53_switch_get_reset_gpio(struct b53_device *dev)
 {
+#ifdef CONFIG_BCM47XX
 	enum bcm47xx_board board = bcm47xx_board_get();
 
 	switch (board) {
 	case BCM47XX_BOARD_LINKSYS_WRT300NV11:
 	case BCM47XX_BOARD_LINKSYS_WRT310NV1:
 		return 8;
-	default:
-		return bcm47xx_nvram_gpio_pin("robo_reset");
 	}
-}
+#endif
+
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 1, 0))
+	return bcm47xx_nvram_gpio_pin("robo_reset");
 #else
-static inline int b53_switch_get_reset_gpio(struct b53_device *dev)
-{
 	return -ENOENT;
-}
 #endif
+}
+
 #endif
-- 
2.11.0




More information about the Lede-dev mailing list