aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-imx/mach-imx6sx.c
diff options
context:
space:
mode:
authorNimrod Andy <B38611@freescale.com>2014-12-24 17:30:40 +0800
committerDavid S. Miller <davem@davemloft.net>2014-12-31 13:06:51 -0500
commit456062b3ec6f5b96ffe7dd31c84e8666747f8720 (patch)
tree2e158abeec59596bb734b1a6b57cd490ac9cce68 /arch/arm/mach-imx/mach-imx6sx.c
parentnet: fec: add Wake-on-LAN support (diff)
downloadlinux-dev-456062b3ec6f5b96ffe7dd31c84e8666747f8720.tar.xz
linux-dev-456062b3ec6f5b96ffe7dd31c84e8666747f8720.zip
ARM: imx: add FEC sleep mode callback function
i.MX6q/dl, i.MX6SX SOCs enet support sleep mode that magic packet can wake up system in suspend status. For different SOCs, there have some SOC specifical GPR register to set sleep on/off mode. So add these to callback function for driver. Signed-off-by: Fugang Duan <B38611@freescale.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to '')
-rw-r--r--arch/arm/mach-imx/mach-imx6sx.c50
1 files changed, 50 insertions, 0 deletions
diff --git a/arch/arm/mach-imx/mach-imx6sx.c b/arch/arm/mach-imx/mach-imx6sx.c
index 7a96c6577234..747b012665f5 100644
--- a/arch/arm/mach-imx/mach-imx6sx.c
+++ b/arch/arm/mach-imx/mach-imx6sx.c
@@ -12,12 +12,62 @@
#include <linux/regmap.h>
#include <linux/mfd/syscon.h>
#include <linux/mfd/syscon/imx6q-iomuxc-gpr.h>
+#include <linux/fec.h>
+#include <linux/netdevice.h>
#include <asm/mach/arch.h>
#include <asm/mach/map.h>
#include "common.h"
#include "cpuidle.h"
+static struct fec_platform_data fec_pdata[2];
+
+static void imx6sx_fec1_sleep_enable(int enabled)
+{
+ struct regmap *gpr;
+
+ gpr = syscon_regmap_lookup_by_compatible("fsl,imx6sx-iomuxc-gpr");
+ if (!IS_ERR(gpr)) {
+ if (enabled)
+ regmap_update_bits(gpr, IOMUXC_GPR4,
+ IMX6SX_GPR4_FEC_ENET1_STOP_REQ,
+ IMX6SX_GPR4_FEC_ENET1_STOP_REQ);
+ else
+ regmap_update_bits(gpr, IOMUXC_GPR4,
+ IMX6SX_GPR4_FEC_ENET1_STOP_REQ, 0);
+ } else
+ pr_err("failed to find fsl,imx6sx-iomux-gpr regmap\n");
+}
+
+static void imx6sx_fec2_sleep_enable(int enabled)
+{
+ struct regmap *gpr;
+
+ gpr = syscon_regmap_lookup_by_compatible("fsl,imx6sx-iomuxc-gpr");
+ if (!IS_ERR(gpr)) {
+ if (enabled)
+ regmap_update_bits(gpr, IOMUXC_GPR4,
+ IMX6SX_GPR4_FEC_ENET2_STOP_REQ,
+ IMX6SX_GPR4_FEC_ENET2_STOP_REQ);
+ else
+ regmap_update_bits(gpr, IOMUXC_GPR4,
+ IMX6SX_GPR4_FEC_ENET2_STOP_REQ, 0);
+ } else
+ pr_err("failed to find fsl,imx6sx-iomux-gpr regmap\n");
+}
+
+static void __init imx6sx_enet_plt_init(void)
+{
+ struct device_node *np;
+
+ np = of_find_node_by_path("/soc/aips-bus@02100000/ethernet@02188000");
+ if (np && of_get_property(np, "fsl,magic-packet", NULL))
+ fec_pdata[0].sleep_mode_enable = imx6sx_fec1_sleep_enable;
+ np = of_find_node_by_path("/soc/aips-bus@02100000/ethernet@021b4000");
+ if (np && of_get_property(np, "fsl,magic-packet", NULL))
+ fec_pdata[1].sleep_mode_enable = imx6sx_fec2_sleep_enable;
+}
+
static int ar8031_phy_fixup(struct phy_device *dev)
{
u16 val;