diff options
author | Shawn Guo <shawn.guo@freescale.com> | 2011-03-03 09:13:38 -0500 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2011-03-08 07:24:11 -0500 |
commit | acc9cdca62e596ca77e41e24a9d2c020a461bd99 (patch) | |
tree | 6a2006664fba2c8e3f4fd9cb7caae17db4f62a57 | |
parent | 208277f74e449fca082c1895086bd44c159efba5 (diff) |
ARM: mxs/mx28evk: add flexcan devices
Signed-off-by: Shawn Guo <shawn.guo@freescale.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r-- | arch/arm/mach-mxs/Kconfig | 1 | ||||
-rw-r--r-- | arch/arm/mach-mxs/mach-mx28evk.c | 55 |
2 files changed, 56 insertions, 0 deletions
diff --git a/arch/arm/mach-mxs/Kconfig b/arch/arm/mach-mxs/Kconfig index 989c08c6dd93..5ea676af8608 100644 --- a/arch/arm/mach-mxs/Kconfig +++ b/arch/arm/mach-mxs/Kconfig | |||
@@ -34,6 +34,7 @@ config MACH_MX28EVK | |||
34 | select MXS_HAVE_AMBA_DUART | 34 | select MXS_HAVE_AMBA_DUART |
35 | select MXS_HAVE_PLATFORM_AUART | 35 | select MXS_HAVE_PLATFORM_AUART |
36 | select MXS_HAVE_PLATFORM_FEC | 36 | select MXS_HAVE_PLATFORM_FEC |
37 | select MXS_HAVE_PLATFORM_FLEXCAN | ||
37 | select MXS_OCOTP | 38 | select MXS_OCOTP |
38 | default y | 39 | default y |
39 | help | 40 | help |
diff --git a/arch/arm/mach-mxs/mach-mx28evk.c b/arch/arm/mach-mxs/mach-mx28evk.c index 987e3d54280c..8bb221754e4e 100644 --- a/arch/arm/mach-mxs/mach-mx28evk.c +++ b/arch/arm/mach-mxs/mach-mx28evk.c | |||
@@ -28,6 +28,7 @@ | |||
28 | #include "devices-mx28.h" | 28 | #include "devices-mx28.h" |
29 | #include "gpio.h" | 29 | #include "gpio.h" |
30 | 30 | ||
31 | #define MX28EVK_FLEXCAN_SWITCH MXS_GPIO_NR(2, 13) | ||
31 | #define MX28EVK_FEC_PHY_POWER MXS_GPIO_NR(2, 15) | 32 | #define MX28EVK_FEC_PHY_POWER MXS_GPIO_NR(2, 15) |
32 | #define MX28EVK_FEC_PHY_RESET MXS_GPIO_NR(4, 13) | 33 | #define MX28EVK_FEC_PHY_RESET MXS_GPIO_NR(4, 13) |
33 | 34 | ||
@@ -69,6 +70,15 @@ static const iomux_cfg_t mx28evk_pads[] __initconst = { | |||
69 | MX28_PAD_SSP1_DATA3__GPIO_2_15 | MXS_PAD_CTRL, | 70 | MX28_PAD_SSP1_DATA3__GPIO_2_15 | MXS_PAD_CTRL, |
70 | /* phy reset line */ | 71 | /* phy reset line */ |
71 | MX28_PAD_ENET0_RX_CLK__GPIO_4_13 | MXS_PAD_CTRL, | 72 | MX28_PAD_ENET0_RX_CLK__GPIO_4_13 | MXS_PAD_CTRL, |
73 | |||
74 | /* flexcan0 */ | ||
75 | MX28_PAD_GPMI_RDY2__CAN0_TX, | ||
76 | MX28_PAD_GPMI_RDY3__CAN0_RX, | ||
77 | /* flexcan1 */ | ||
78 | MX28_PAD_GPMI_CE2N__CAN1_TX, | ||
79 | MX28_PAD_GPMI_CE3N__CAN1_RX, | ||
80 | /* transceiver power control */ | ||
81 | MX28_PAD_SSP1_CMD__GPIO_2_13, | ||
72 | }; | 82 | }; |
73 | 83 | ||
74 | /* fec */ | 84 | /* fec */ |
@@ -152,8 +162,44 @@ error: | |||
152 | return -ETIMEDOUT; | 162 | return -ETIMEDOUT; |
153 | } | 163 | } |
154 | 164 | ||
165 | /* | ||
166 | * MX28EVK_FLEXCAN_SWITCH is shared between both flexcan controllers | ||
167 | */ | ||
168 | static int flexcan0_en, flexcan1_en; | ||
169 | |||
170 | static void mx28evk_flexcan_switch(void) | ||
171 | { | ||
172 | if (flexcan0_en || flexcan1_en) | ||
173 | gpio_set_value(MX28EVK_FLEXCAN_SWITCH, 1); | ||
174 | else | ||
175 | gpio_set_value(MX28EVK_FLEXCAN_SWITCH, 0); | ||
176 | } | ||
177 | |||
178 | static void mx28evk_flexcan0_switch(int enable) | ||
179 | { | ||
180 | flexcan0_en = enable; | ||
181 | mx28evk_flexcan_switch(); | ||
182 | } | ||
183 | |||
184 | static void mx28evk_flexcan1_switch(int enable) | ||
185 | { | ||
186 | flexcan1_en = enable; | ||
187 | mx28evk_flexcan_switch(); | ||
188 | } | ||
189 | |||
190 | static const struct flexcan_platform_data | ||
191 | mx28evk_flexcan_pdata[] __initconst = { | ||
192 | { | ||
193 | .transceiver_switch = mx28evk_flexcan0_switch, | ||
194 | }, { | ||
195 | .transceiver_switch = mx28evk_flexcan1_switch, | ||
196 | } | ||
197 | }; | ||
198 | |||
155 | static void __init mx28evk_init(void) | 199 | static void __init mx28evk_init(void) |
156 | { | 200 | { |
201 | int ret; | ||
202 | |||
157 | mxs_iomux_setup_multiple_pads(mx28evk_pads, ARRAY_SIZE(mx28evk_pads)); | 203 | mxs_iomux_setup_multiple_pads(mx28evk_pads, ARRAY_SIZE(mx28evk_pads)); |
158 | 204 | ||
159 | mx28_add_duart(); | 205 | mx28_add_duart(); |
@@ -166,6 +212,15 @@ static void __init mx28evk_init(void) | |||
166 | mx28evk_fec_reset(); | 212 | mx28evk_fec_reset(); |
167 | mx28_add_fec(0, &mx28_fec_pdata[0]); | 213 | mx28_add_fec(0, &mx28_fec_pdata[0]); |
168 | mx28_add_fec(1, &mx28_fec_pdata[1]); | 214 | mx28_add_fec(1, &mx28_fec_pdata[1]); |
215 | |||
216 | ret = gpio_request_one(MX28EVK_FLEXCAN_SWITCH, GPIOF_DIR_OUT, | ||
217 | "flexcan-switch"); | ||
218 | if (ret) { | ||
219 | pr_err("failed to request gpio flexcan-switch: %d\n", ret); | ||
220 | } else { | ||
221 | mx28_add_flexcan(0, &mx28evk_flexcan_pdata[0]); | ||
222 | mx28_add_flexcan(1, &mx28evk_flexcan_pdata[1]); | ||
223 | } | ||
169 | } | 224 | } |
170 | 225 | ||
171 | static void __init mx28evk_timer_init(void) | 226 | static void __init mx28evk_timer_init(void) |