From 1c111c5e95e3514e2907ef483fefd2bd993e10c3 Mon Sep 17 00:00:00 2001 From: Dongjin Kim Date: Wed, 13 Mar 2019 06:43:20 -0400 Subject: [PATCH] ODROID-N2: phy/realtek: add to support Wake On Lan enable Adding new kernel command line "enable_wol=<1|0>" will configure the WOL features on next power off. Change-Id: I4830aeb1651e90d4699887199000def1163fb6db Signed-off-by: Dongjin Kim (cherry picked from commit 22d698f4d279be20db337f72190d0cf1b805a9be) --- drivers/net/phy/realtek.c | 20 ++++++++++++++++++++ include/linux/amlogic/scpi_protocol.h | 3 +++ 2 files changed, 23 insertions(+) diff --git a/drivers/net/phy/realtek.c b/drivers/net/phy/realtek.c index 3e4ab5b16b40..2e22c60e1860 100644 --- a/drivers/net/phy/realtek.c +++ b/drivers/net/phy/realtek.c @@ -185,10 +185,30 @@ static int rtl8211f_config_init(struct phy_device *phydev) } #ifdef CONFIG_AMLOGIC_ETH_PRIVE + +#if defined(CONFIG_ARCH_MESON64_ODROID_COMMON) +#include + +static u32 enable_wol = 0; + +static int __init enable_wol_setup(char *str) +{ + enable_wol = (str[0] != '0'); + support_external_phy_wol = enable_wol; + + return 0; +} +__setup("enable_wol=", enable_wol_setup); +#endif + int rtl8211f_suspend(struct phy_device *phydev) { int value = 0; +#if defined(CONFIG_ARCH_MESON64_ODROID_COMMON) + scpi_send_usr_data(SCPI_CL_WOL, &enable_wol, sizeof(enable_wol)); +#endif + if (support_external_phy_wol) { mutex_lock(&phydev->lock); phy_write(phydev, RTL8211F_PAGE_SELECT, 0xd8a); diff --git a/include/linux/amlogic/scpi_protocol.h b/include/linux/amlogic/scpi_protocol.h index c886ce4f522e..1fe5a19eb67d 100644 --- a/include/linux/amlogic/scpi_protocol.h +++ b/include/linux/amlogic/scpi_protocol.h @@ -27,6 +27,9 @@ enum scpi_client_id { SCPI_CL_THERMAL, SCPI_CL_REMOTE, SCPI_CL_LED_TIMER, +#if defined(CONFIG_ARCH_MESON64_ODROID_COMMON) + SCPI_CL_WOL, +#endif SCPI_MAX, };