diff options
author | Fabio Estevam <fabio.estevam@freescale.com> | 2013-06-10 22:12:57 -0400 |
---|---|---|
committer | Marc Kleine-Budde <mkl@pengutronix.de> | 2013-06-27 09:15:25 -0400 |
commit | b7c4114b07bbacfe0aee1d04ad1ade9e42309620 (patch) | |
tree | c21e4f17d4149674db3761dd782c3f8056662f81 /arch/arm/mach-mxs | |
parent | 30caa4b763bf5973800633de55bae586ab443f78 (diff) |
can: flexcan: Use a regulator to control the CAN transceiver
Instead of using a GPIO to turn on/off the CAN transceiver, it is better to
use a regulator as some systems may use a PMIC to power the CAN transceiver.
Acked-by: Shawn Guo <shawn.guo@linaro.org>
Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Diffstat (limited to 'arch/arm/mach-mxs')
-rw-r--r-- | arch/arm/mach-mxs/mach-mxs.c | 50 |
1 files changed, 1 insertions, 49 deletions
diff --git a/arch/arm/mach-mxs/mach-mxs.c b/arch/arm/mach-mxs/mach-mxs.c index 5b62b6489d4b..97b8a44101cd 100644 --- a/arch/arm/mach-mxs/mach-mxs.c +++ b/arch/arm/mach-mxs/mach-mxs.c | |||
@@ -14,7 +14,6 @@ | |||
14 | #include <linux/clk/mxs.h> | 14 | #include <linux/clk/mxs.h> |
15 | #include <linux/clkdev.h> | 15 | #include <linux/clkdev.h> |
16 | #include <linux/clocksource.h> | 16 | #include <linux/clocksource.h> |
17 | #include <linux/can/platform/flexcan.h> | ||
18 | #include <linux/delay.h> | 17 | #include <linux/delay.h> |
19 | #include <linux/err.h> | 18 | #include <linux/err.h> |
20 | #include <linux/gpio.h> | 19 | #include <linux/gpio.h> |
@@ -60,41 +59,6 @@ static inline void __mxs_togl(u32 mask, void __iomem *reg) | |||
60 | __raw_writel(mask, reg + MXS_TOG_ADDR); | 59 | __raw_writel(mask, reg + MXS_TOG_ADDR); |
61 | } | 60 | } |
62 | 61 | ||
63 | /* | ||
64 | * MX28EVK_FLEXCAN_SWITCH is shared between both flexcan controllers | ||
65 | */ | ||
66 | #define MX28EVK_FLEXCAN_SWITCH MXS_GPIO_NR(2, 13) | ||
67 | |||
68 | static int flexcan0_en, flexcan1_en; | ||
69 | |||
70 | static void mx28evk_flexcan_switch(void) | ||
71 | { | ||
72 | if (flexcan0_en || flexcan1_en) | ||
73 | gpio_set_value(MX28EVK_FLEXCAN_SWITCH, 1); | ||
74 | else | ||
75 | gpio_set_value(MX28EVK_FLEXCAN_SWITCH, 0); | ||
76 | } | ||
77 | |||
78 | static void mx28evk_flexcan0_switch(int enable) | ||
79 | { | ||
80 | flexcan0_en = enable; | ||
81 | mx28evk_flexcan_switch(); | ||
82 | } | ||
83 | |||
84 | static void mx28evk_flexcan1_switch(int enable) | ||
85 | { | ||
86 | flexcan1_en = enable; | ||
87 | mx28evk_flexcan_switch(); | ||
88 | } | ||
89 | |||
90 | static struct flexcan_platform_data flexcan_pdata[2]; | ||
91 | |||
92 | static struct of_dev_auxdata mxs_auxdata_lookup[] __initdata = { | ||
93 | OF_DEV_AUXDATA("fsl,imx28-flexcan", 0x80032000, NULL, &flexcan_pdata[0]), | ||
94 | OF_DEV_AUXDATA("fsl,imx28-flexcan", 0x80034000, NULL, &flexcan_pdata[1]), | ||
95 | { /* sentinel */ } | ||
96 | }; | ||
97 | |||
98 | #define OCOTP_WORD_OFFSET 0x20 | 62 | #define OCOTP_WORD_OFFSET 0x20 |
99 | #define OCOTP_WORD_COUNT 0x20 | 63 | #define OCOTP_WORD_COUNT 0x20 |
100 | 64 | ||
@@ -254,15 +218,6 @@ static void __init imx28_evk_init(void) | |||
254 | mxs_saif_clkmux_select(MXS_DIGCTL_SAIF_CLKMUX_EXTMSTR0); | 218 | mxs_saif_clkmux_select(MXS_DIGCTL_SAIF_CLKMUX_EXTMSTR0); |
255 | } | 219 | } |
256 | 220 | ||
257 | static void __init imx28_evk_post_init(void) | ||
258 | { | ||
259 | if (!gpio_request_one(MX28EVK_FLEXCAN_SWITCH, GPIOF_DIR_OUT, | ||
260 | "flexcan-switch")) { | ||
261 | flexcan_pdata[0].transceiver_switch = mx28evk_flexcan0_switch; | ||
262 | flexcan_pdata[1].transceiver_switch = mx28evk_flexcan1_switch; | ||
263 | } | ||
264 | } | ||
265 | |||
266 | static int apx4devkit_phy_fixup(struct phy_device *phy) | 221 | static int apx4devkit_phy_fixup(struct phy_device *phy) |
267 | { | 222 | { |
268 | phy->dev_flags |= MICREL_PHY_50MHZ_CLK; | 223 | phy->dev_flags |= MICREL_PHY_50MHZ_CLK; |
@@ -374,13 +329,10 @@ static void __init mxs_machine_init(void) | |||
374 | cfa10049_init(); | 329 | cfa10049_init(); |
375 | 330 | ||
376 | of_platform_populate(NULL, of_default_bus_match_table, | 331 | of_platform_populate(NULL, of_default_bus_match_table, |
377 | mxs_auxdata_lookup, NULL); | 332 | NULL, NULL); |
378 | 333 | ||
379 | if (of_machine_is_compatible("karo,tx28")) | 334 | if (of_machine_is_compatible("karo,tx28")) |
380 | tx28_post_init(); | 335 | tx28_post_init(); |
381 | |||
382 | if (of_machine_is_compatible("fsl,imx28-evk")) | ||
383 | imx28_evk_post_init(); | ||
384 | } | 336 | } |
385 | 337 | ||
386 | #define MX23_CLKCTRL_RESET_OFFSET 0x120 | 338 | #define MX23_CLKCTRL_RESET_OFFSET 0x120 |