aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorNimrod Andy <B38611@freescale.com>2014-12-24 04:30:40 -0500
committerDavid S. Miller <davem@davemloft.net>2014-12-31 13:06:51 -0500
commit456062b3ec6f5b96ffe7dd31c84e8666747f8720 (patch)
tree2e158abeec59596bb734b1a6b57cd490ac9cce68 /arch
parentde40ed31b3c577cefd7b54972365a272ecbe9dd6 (diff)
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 'arch')
-rw-r--r--arch/arm/mach-imx/mach-imx6q.c41
-rw-r--r--arch/arm/mach-imx/mach-imx6sx.c50
2 files changed, 90 insertions, 1 deletions
diff --git a/arch/arm/mach-imx/mach-imx6q.c b/arch/arm/mach-imx/mach-imx6q.c
index 5057d61298b7..2f7616889c3f 100644
--- a/arch/arm/mach-imx/mach-imx6q.c
+++ b/arch/arm/mach-imx/mach-imx6q.c
@@ -31,6 +31,8 @@
31#include <linux/micrel_phy.h> 31#include <linux/micrel_phy.h>
32#include <linux/mfd/syscon.h> 32#include <linux/mfd/syscon.h>
33#include <linux/mfd/syscon/imx6q-iomuxc-gpr.h> 33#include <linux/mfd/syscon/imx6q-iomuxc-gpr.h>
34#include <linux/fec.h>
35#include <linux/netdevice.h>
34#include <asm/mach/arch.h> 36#include <asm/mach/arch.h>
35#include <asm/mach/map.h> 37#include <asm/mach/map.h>
36#include <asm/system_misc.h> 38#include <asm/system_misc.h>
@@ -39,6 +41,35 @@
39#include "cpuidle.h" 41#include "cpuidle.h"
40#include "hardware.h" 42#include "hardware.h"
41 43
44static struct fec_platform_data fec_pdata;
45
46static void imx6q_fec_sleep_enable(int enabled)
47{
48 struct regmap *gpr;
49
50 gpr = syscon_regmap_lookup_by_compatible("fsl,imx6q-iomuxc-gpr");
51 if (!IS_ERR(gpr)) {
52 if (enabled)
53 regmap_update_bits(gpr, IOMUXC_GPR13,
54 IMX6Q_GPR13_ENET_STOP_REQ,
55 IMX6Q_GPR13_ENET_STOP_REQ);
56
57 else
58 regmap_update_bits(gpr, IOMUXC_GPR13,
59 IMX6Q_GPR13_ENET_STOP_REQ, 0);
60 } else
61 pr_err("failed to find fsl,imx6q-iomux-gpr regmap\n");
62}
63
64static void __init imx6q_enet_plt_init(void)
65{
66 struct device_node *np;
67
68 np = of_find_node_by_path("/soc/aips-bus@02100000/ethernet@02188000");
69 if (np && of_get_property(np, "fsl,magic-packet", NULL))
70 fec_pdata.sleep_mode_enable = imx6q_fec_sleep_enable;
71}
72
42/* For imx6q sabrelite board: set KSZ9021RN RGMII pad skew */ 73/* For imx6q sabrelite board: set KSZ9021RN RGMII pad skew */
43static int ksz9021rn_phy_fixup(struct phy_device *phydev) 74static int ksz9021rn_phy_fixup(struct phy_device *phydev)
44{ 75{
@@ -261,6 +292,12 @@ static void __init imx6q_axi_init(void)
261 } 292 }
262} 293}
263 294
295/* Add auxdata to pass platform data */
296static const struct of_dev_auxdata imx6q_auxdata_lookup[] __initconst = {
297 OF_DEV_AUXDATA("fsl,imx6q-fec", 0x02188000, NULL, &fec_pdata),
298 { /* sentinel */ }
299};
300
264static void __init imx6q_init_machine(void) 301static void __init imx6q_init_machine(void)
265{ 302{
266 struct device *parent; 303 struct device *parent;
@@ -274,11 +311,13 @@ static void __init imx6q_init_machine(void)
274 311
275 imx6q_enet_phy_init(); 312 imx6q_enet_phy_init();
276 313
277 of_platform_populate(NULL, of_default_bus_match_table, NULL, parent); 314 of_platform_populate(NULL, of_default_bus_match_table,
315 imx6q_auxdata_lookup, parent);
278 316
279 imx_anatop_init(); 317 imx_anatop_init();
280 cpu_is_imx6q() ? imx6q_pm_init() : imx6dl_pm_init(); 318 cpu_is_imx6q() ? imx6q_pm_init() : imx6dl_pm_init();
281 imx6q_1588_init(); 319 imx6q_1588_init();
320 imx6q_enet_plt_init();
282 imx6q_axi_init(); 321 imx6q_axi_init();
283} 322}
284 323
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 @@
12#include <linux/regmap.h> 12#include <linux/regmap.h>
13#include <linux/mfd/syscon.h> 13#include <linux/mfd/syscon.h>
14#include <linux/mfd/syscon/imx6q-iomuxc-gpr.h> 14#include <linux/mfd/syscon/imx6q-iomuxc-gpr.h>
15#include <linux/fec.h>
16#include <linux/netdevice.h>
15#include <asm/mach/arch.h> 17#include <asm/mach/arch.h>
16#include <asm/mach/map.h> 18#include <asm/mach/map.h>
17 19
18#include "common.h" 20#include "common.h"
19#include "cpuidle.h" 21#include "cpuidle.h"
20 22
23static struct fec_platform_data fec_pdata[2];
24
25static void imx6sx_fec1_sleep_enable(int enabled)
26{
27 struct regmap *gpr;
28
29 gpr = syscon_regmap_lookup_by_compatible("fsl,imx6sx-iomuxc-gpr");
30 if (!IS_ERR(gpr)) {
31 if (enabled)
32 regmap_update_bits(gpr, IOMUXC_GPR4,
33 IMX6SX_GPR4_FEC_ENET1_STOP_REQ,
34 IMX6SX_GPR4_FEC_ENET1_STOP_REQ);
35 else
36 regmap_update_bits(gpr, IOMUXC_GPR4,
37 IMX6SX_GPR4_FEC_ENET1_STOP_REQ, 0);
38 } else
39 pr_err("failed to find fsl,imx6sx-iomux-gpr regmap\n");
40}
41
42static void imx6sx_fec2_sleep_enable(int enabled)
43{
44 struct regmap *gpr;
45
46 gpr = syscon_regmap_lookup_by_compatible("fsl,imx6sx-iomuxc-gpr");
47 if (!IS_ERR(gpr)) {
48 if (enabled)
49 regmap_update_bits(gpr, IOMUXC_GPR4,
50 IMX6SX_GPR4_FEC_ENET2_STOP_REQ,
51 IMX6SX_GPR4_FEC_ENET2_STOP_REQ);
52 else
53 regmap_update_bits(gpr, IOMUXC_GPR4,
54 IMX6SX_GPR4_FEC_ENET2_STOP_REQ, 0);
55 } else
56 pr_err("failed to find fsl,imx6sx-iomux-gpr regmap\n");
57}
58
59static void __init imx6sx_enet_plt_init(void)
60{
61 struct device_node *np;
62
63 np = of_find_node_by_path("/soc/aips-bus@02100000/ethernet@02188000");
64 if (np && of_get_property(np, "fsl,magic-packet", NULL))
65 fec_pdata[0].sleep_mode_enable = imx6sx_fec1_sleep_enable;
66 np = of_find_node_by_path("/soc/aips-bus@02100000/ethernet@021b4000");
67 if (np && of_get_property(np, "fsl,magic-packet", NULL))
68 fec_pdata[1].sleep_mode_enable = imx6sx_fec2_sleep_enable;
69}
70
21static int ar8031_phy_fixup(struct phy_device *dev) 71static int ar8031_phy_fixup(struct phy_device *dev)
22{ 72{
23 u16 val; 73 u16 val;