diff options
| -rw-r--r-- | Documentation/devicetree/bindings/net/can/fsl-flexcan.txt | 2 | ||||
| -rw-r--r-- | arch/arm/boot/dts/imx28-evk.dts | 12 | ||||
| -rw-r--r-- | arch/arm/mach-imx/devices-imx25.h | 8 | ||||
| -rw-r--r-- | arch/arm/mach-imx/devices-imx35.h | 8 | ||||
| -rw-r--r-- | arch/arm/mach-imx/devices/devices-common.h | 4 | ||||
| -rw-r--r-- | arch/arm/mach-imx/devices/platform-flexcan.c | 5 | ||||
| -rw-r--r-- | arch/arm/mach-imx/eukrea_mbimxsd25-baseboard.c | 2 | ||||
| -rw-r--r-- | arch/arm/mach-imx/eukrea_mbimxsd35-baseboard.c | 2 | ||||
| -rw-r--r-- | arch/arm/mach-imx/mach-mx25_3ds.c | 2 | ||||
| -rw-r--r-- | arch/arm/mach-imx/mach-pcm043.c | 2 | ||||
| -rw-r--r-- | arch/arm/mach-mxs/mach-mxs.c | 50 | ||||
| -rw-r--r-- | drivers/net/can/at91_can.c | 4 | ||||
| -rw-r--r-- | drivers/net/can/flexcan.c | 25 | ||||
| -rw-r--r-- | include/linux/can/platform/flexcan.h | 20 |
14 files changed, 44 insertions, 102 deletions
diff --git a/Documentation/devicetree/bindings/net/can/fsl-flexcan.txt b/Documentation/devicetree/bindings/net/can/fsl-flexcan.txt index 8ff324eaa889..56d6cc336e1c 100644 --- a/Documentation/devicetree/bindings/net/can/fsl-flexcan.txt +++ b/Documentation/devicetree/bindings/net/can/fsl-flexcan.txt | |||
| @@ -16,6 +16,8 @@ Optional properties: | |||
| 16 | 16 | ||
| 17 | - clock-frequency : The oscillator frequency driving the flexcan device | 17 | - clock-frequency : The oscillator frequency driving the flexcan device |
| 18 | 18 | ||
| 19 | - xceiver-supply: Regulator that powers the CAN transceiver | ||
| 20 | |||
| 19 | Example: | 21 | Example: |
| 20 | 22 | ||
| 21 | can@1c000 { | 23 | can@1c000 { |
diff --git a/arch/arm/boot/dts/imx28-evk.dts b/arch/arm/boot/dts/imx28-evk.dts index 3637bf3b1d59..1f0d38d7b16f 100644 --- a/arch/arm/boot/dts/imx28-evk.dts +++ b/arch/arm/boot/dts/imx28-evk.dts | |||
| @@ -155,12 +155,14 @@ | |||
| 155 | can0: can@80032000 { | 155 | can0: can@80032000 { |
| 156 | pinctrl-names = "default"; | 156 | pinctrl-names = "default"; |
| 157 | pinctrl-0 = <&can0_pins_a>; | 157 | pinctrl-0 = <&can0_pins_a>; |
| 158 | xceiver-supply = <®_can_3v3>; | ||
| 158 | status = "okay"; | 159 | status = "okay"; |
| 159 | }; | 160 | }; |
| 160 | 161 | ||
| 161 | can1: can@80034000 { | 162 | can1: can@80034000 { |
| 162 | pinctrl-names = "default"; | 163 | pinctrl-names = "default"; |
| 163 | pinctrl-0 = <&can1_pins_a>; | 164 | pinctrl-0 = <&can1_pins_a>; |
| 165 | xceiver-supply = <®_can_3v3>; | ||
| 164 | status = "okay"; | 166 | status = "okay"; |
| 165 | }; | 167 | }; |
| 166 | }; | 168 | }; |
| @@ -319,6 +321,16 @@ | |||
| 319 | gpio = <&gpio3 30 0>; | 321 | gpio = <&gpio3 30 0>; |
| 320 | enable-active-high; | 322 | enable-active-high; |
| 321 | }; | 323 | }; |
| 324 | |||
| 325 | reg_can_3v3: can-3v3 { | ||
| 326 | compatible = "regulator-fixed"; | ||
| 327 | regulator-name = "can-3v3"; | ||
| 328 | regulator-min-microvolt = <3300000>; | ||
| 329 | regulator-max-microvolt = <3300000>; | ||
| 330 | gpio = <&gpio2 13 0>; | ||
| 331 | enable-active-high; | ||
| 332 | }; | ||
| 333 | |||
| 322 | }; | 334 | }; |
| 323 | 335 | ||
| 324 | sound { | 336 | sound { |
diff --git a/arch/arm/mach-imx/devices-imx25.h b/arch/arm/mach-imx/devices-imx25.h index 0d2922bc575c..769563fdeaa0 100644 --- a/arch/arm/mach-imx/devices-imx25.h +++ b/arch/arm/mach-imx/devices-imx25.h | |||
| @@ -13,10 +13,10 @@ extern const struct imx_fec_data imx25_fec_data; | |||
| 13 | imx_add_fec(&imx25_fec_data, pdata) | 13 | imx_add_fec(&imx25_fec_data, pdata) |
| 14 | 14 | ||
| 15 | extern const struct imx_flexcan_data imx25_flexcan_data[]; | 15 | extern const struct imx_flexcan_data imx25_flexcan_data[]; |
| 16 | #define imx25_add_flexcan(id, pdata) \ | 16 | #define imx25_add_flexcan(id) \ |
| 17 | imx_add_flexcan(&imx25_flexcan_data[id], pdata) | 17 | imx_add_flexcan(&imx25_flexcan_data[id]) |
| 18 | #define imx25_add_flexcan0(pdata) imx25_add_flexcan(0, pdata) | 18 | #define imx25_add_flexcan0() imx25_add_flexcan(0) |
| 19 | #define imx25_add_flexcan1(pdata) imx25_add_flexcan(1, pdata) | 19 | #define imx25_add_flexcan1() imx25_add_flexcan(1) |
| 20 | 20 | ||
| 21 | extern const struct imx_fsl_usb2_udc_data imx25_fsl_usb2_udc_data; | 21 | extern const struct imx_fsl_usb2_udc_data imx25_fsl_usb2_udc_data; |
| 22 | #define imx25_add_fsl_usb2_udc(pdata) \ | 22 | #define imx25_add_fsl_usb2_udc(pdata) \ |
diff --git a/arch/arm/mach-imx/devices-imx35.h b/arch/arm/mach-imx/devices-imx35.h index e2675f1b141c..780d8240281b 100644 --- a/arch/arm/mach-imx/devices-imx35.h +++ b/arch/arm/mach-imx/devices-imx35.h | |||
| @@ -17,10 +17,10 @@ extern const struct imx_fsl_usb2_udc_data imx35_fsl_usb2_udc_data; | |||
| 17 | imx_add_fsl_usb2_udc(&imx35_fsl_usb2_udc_data, pdata) | 17 | imx_add_fsl_usb2_udc(&imx35_fsl_usb2_udc_data, pdata) |
| 18 | 18 | ||
| 19 | extern const struct imx_flexcan_data imx35_flexcan_data[]; | 19 | extern const struct imx_flexcan_data imx35_flexcan_data[]; |
| 20 | #define imx35_add_flexcan(id, pdata) \ | 20 | #define imx35_add_flexcan(id) \ |
| 21 | imx_add_flexcan(&imx35_flexcan_data[id], pdata) | 21 | imx_add_flexcan(&imx35_flexcan_data[id]) |
| 22 | #define imx35_add_flexcan0(pdata) imx35_add_flexcan(0, pdata) | 22 | #define imx35_add_flexcan0() imx35_add_flexcan(0) |
| 23 | #define imx35_add_flexcan1(pdata) imx35_add_flexcan(1, pdata) | 23 | #define imx35_add_flexcan1() imx35_add_flexcan(1) |
| 24 | 24 | ||
| 25 | extern const struct imx_imx2_wdt_data imx35_imx2_wdt_data; | 25 | extern const struct imx_imx2_wdt_data imx35_imx2_wdt_data; |
| 26 | #define imx35_add_imx2_wdt() \ | 26 | #define imx35_add_imx2_wdt() \ |
diff --git a/arch/arm/mach-imx/devices/devices-common.h b/arch/arm/mach-imx/devices/devices-common.h index 453e20bc2657..c13b76b9f6b3 100644 --- a/arch/arm/mach-imx/devices/devices-common.h +++ b/arch/arm/mach-imx/devices/devices-common.h | |||
| @@ -50,7 +50,6 @@ struct platform_device *__init imx_add_fec( | |||
| 50 | const struct imx_fec_data *data, | 50 | const struct imx_fec_data *data, |
| 51 | const struct fec_platform_data *pdata); | 51 | const struct fec_platform_data *pdata); |
| 52 | 52 | ||
| 53 | #include <linux/can/platform/flexcan.h> | ||
| 54 | struct imx_flexcan_data { | 53 | struct imx_flexcan_data { |
| 55 | int id; | 54 | int id; |
| 56 | resource_size_t iobase; | 55 | resource_size_t iobase; |
| @@ -58,8 +57,7 @@ struct imx_flexcan_data { | |||
| 58 | resource_size_t irq; | 57 | resource_size_t irq; |
| 59 | }; | 58 | }; |
| 60 | struct platform_device *__init imx_add_flexcan( | 59 | struct platform_device *__init imx_add_flexcan( |
| 61 | const struct imx_flexcan_data *data, | 60 | const struct imx_flexcan_data *data); |
| 62 | const struct flexcan_platform_data *pdata); | ||
| 63 | 61 | ||
| 64 | #include <linux/fsl_devices.h> | 62 | #include <linux/fsl_devices.h> |
| 65 | struct imx_fsl_usb2_udc_data { | 63 | struct imx_fsl_usb2_udc_data { |
diff --git a/arch/arm/mach-imx/devices/platform-flexcan.c b/arch/arm/mach-imx/devices/platform-flexcan.c index 1078bf0a94ef..55d61eaf63c6 100644 --- a/arch/arm/mach-imx/devices/platform-flexcan.c +++ b/arch/arm/mach-imx/devices/platform-flexcan.c | |||
| @@ -38,8 +38,7 @@ const struct imx_flexcan_data imx35_flexcan_data[] __initconst = { | |||
| 38 | #endif /* ifdef CONFIG_SOC_IMX35 */ | 38 | #endif /* ifdef CONFIG_SOC_IMX35 */ |
| 39 | 39 | ||
| 40 | struct platform_device *__init imx_add_flexcan( | 40 | struct platform_device *__init imx_add_flexcan( |
| 41 | const struct imx_flexcan_data *data, | 41 | const struct imx_flexcan_data *data) |
| 42 | const struct flexcan_platform_data *pdata) | ||
| 43 | { | 42 | { |
| 44 | struct resource res[] = { | 43 | struct resource res[] = { |
| 45 | { | 44 | { |
| @@ -54,5 +53,5 @@ struct platform_device *__init imx_add_flexcan( | |||
| 54 | }; | 53 | }; |
| 55 | 54 | ||
| 56 | return imx_add_platform_device("flexcan", data->id, | 55 | return imx_add_platform_device("flexcan", data->id, |
| 57 | res, ARRAY_SIZE(res), pdata, sizeof(*pdata)); | 56 | res, ARRAY_SIZE(res), NULL, 0); |
| 58 | } | 57 | } |
diff --git a/arch/arm/mach-imx/eukrea_mbimxsd25-baseboard.c b/arch/arm/mach-imx/eukrea_mbimxsd25-baseboard.c index e2b70f4c1a2c..e77cc3af6db2 100644 --- a/arch/arm/mach-imx/eukrea_mbimxsd25-baseboard.c +++ b/arch/arm/mach-imx/eukrea_mbimxsd25-baseboard.c | |||
| @@ -279,7 +279,7 @@ void __init eukrea_mbimxsd25_baseboard_init(void) | |||
| 279 | imx25_add_imx_fb(&eukrea_mximxsd_fb_pdata); | 279 | imx25_add_imx_fb(&eukrea_mximxsd_fb_pdata); |
| 280 | imx25_add_imx_ssi(0, &eukrea_mbimxsd_ssi_pdata); | 280 | imx25_add_imx_ssi(0, &eukrea_mbimxsd_ssi_pdata); |
| 281 | 281 | ||
| 282 | imx25_add_flexcan1(NULL); | 282 | imx25_add_flexcan1(); |
| 283 | imx25_add_sdhci_esdhc_imx(0, &sd1_pdata); | 283 | imx25_add_sdhci_esdhc_imx(0, &sd1_pdata); |
| 284 | 284 | ||
| 285 | gpio_request(GPIO_LED1, "LED1"); | 285 | gpio_request(GPIO_LED1, "LED1"); |
diff --git a/arch/arm/mach-imx/eukrea_mbimxsd35-baseboard.c b/arch/arm/mach-imx/eukrea_mbimxsd35-baseboard.c index 5a2d5ef12dd5..14d6c8249b76 100644 --- a/arch/arm/mach-imx/eukrea_mbimxsd35-baseboard.c +++ b/arch/arm/mach-imx/eukrea_mbimxsd35-baseboard.c | |||
| @@ -287,7 +287,7 @@ void __init eukrea_mbimxsd35_baseboard_init(void) | |||
| 287 | 287 | ||
| 288 | imx35_add_imx_ssi(0, &eukrea_mbimxsd_ssi_pdata); | 288 | imx35_add_imx_ssi(0, &eukrea_mbimxsd_ssi_pdata); |
| 289 | 289 | ||
| 290 | imx35_add_flexcan1(NULL); | 290 | imx35_add_flexcan1(); |
| 291 | imx35_add_sdhci_esdhc_imx(0, &sd1_pdata); | 291 | imx35_add_sdhci_esdhc_imx(0, &sd1_pdata); |
| 292 | 292 | ||
| 293 | gpio_request(GPIO_LED1, "LED1"); | 293 | gpio_request(GPIO_LED1, "LED1"); |
diff --git a/arch/arm/mach-imx/mach-mx25_3ds.c b/arch/arm/mach-imx/mach-mx25_3ds.c index 8bcda688a006..13490c203050 100644 --- a/arch/arm/mach-imx/mach-mx25_3ds.c +++ b/arch/arm/mach-imx/mach-mx25_3ds.c | |||
| @@ -249,7 +249,7 @@ static void __init mx25pdk_init(void) | |||
| 249 | imx25_add_imx_i2c0(&mx25_3ds_i2c0_data); | 249 | imx25_add_imx_i2c0(&mx25_3ds_i2c0_data); |
| 250 | 250 | ||
| 251 | gpio_request_one(MX25PDK_CAN_PWDN, GPIOF_OUT_INIT_LOW, "can-pwdn"); | 251 | gpio_request_one(MX25PDK_CAN_PWDN, GPIOF_OUT_INIT_LOW, "can-pwdn"); |
| 252 | imx25_add_flexcan0(NULL); | 252 | imx25_add_flexcan0(); |
| 253 | } | 253 | } |
| 254 | 254 | ||
| 255 | static void __init mx25pdk_timer_init(void) | 255 | static void __init mx25pdk_timer_init(void) |
diff --git a/arch/arm/mach-imx/mach-pcm043.c b/arch/arm/mach-imx/mach-pcm043.c index 8ed533f0f8ca..b726cb1c5fdd 100644 --- a/arch/arm/mach-imx/mach-pcm043.c +++ b/arch/arm/mach-imx/mach-pcm043.c | |||
| @@ -385,7 +385,7 @@ static void __init pcm043_init(void) | |||
| 385 | if (!otg_mode_host) | 385 | if (!otg_mode_host) |
| 386 | imx35_add_fsl_usb2_udc(&otg_device_pdata); | 386 | imx35_add_fsl_usb2_udc(&otg_device_pdata); |
| 387 | 387 | ||
| 388 | imx35_add_flexcan1(NULL); | 388 | imx35_add_flexcan1(); |
| 389 | imx35_add_sdhci_esdhc_imx(0, &sd1_pdata); | 389 | imx35_add_sdhci_esdhc_imx(0, &sd1_pdata); |
| 390 | } | 390 | } |
| 391 | 391 | ||
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 |
diff --git a/drivers/net/can/at91_can.c b/drivers/net/can/at91_can.c index ce8421ac453a..dbbe97ae121e 100644 --- a/drivers/net/can/at91_can.c +++ b/drivers/net/can/at91_can.c | |||
| @@ -1264,8 +1264,6 @@ static const struct of_device_id at91_can_dt_ids[] = { | |||
| 1264 | } | 1264 | } |
| 1265 | }; | 1265 | }; |
| 1266 | MODULE_DEVICE_TABLE(of, at91_can_dt_ids); | 1266 | MODULE_DEVICE_TABLE(of, at91_can_dt_ids); |
| 1267 | #else | ||
| 1268 | #define at91_can_dt_ids NULL | ||
| 1269 | #endif | 1267 | #endif |
| 1270 | 1268 | ||
| 1271 | static const struct at91_devtype_data *at91_can_get_driver_data(struct platform_device *pdev) | 1269 | static const struct at91_devtype_data *at91_can_get_driver_data(struct platform_device *pdev) |
| @@ -1424,7 +1422,7 @@ static struct platform_driver at91_can_driver = { | |||
| 1424 | .driver = { | 1422 | .driver = { |
| 1425 | .name = KBUILD_MODNAME, | 1423 | .name = KBUILD_MODNAME, |
| 1426 | .owner = THIS_MODULE, | 1424 | .owner = THIS_MODULE, |
| 1427 | .of_match_table = at91_can_dt_ids, | 1425 | .of_match_table = of_match_ptr(at91_can_dt_ids), |
| 1428 | }, | 1426 | }, |
| 1429 | .id_table = at91_can_id_table, | 1427 | .id_table = at91_can_id_table, |
| 1430 | }; | 1428 | }; |
diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c index f873b9f8d4d4..7b0be0910f4b 100644 --- a/drivers/net/can/flexcan.c +++ b/drivers/net/can/flexcan.c | |||
| @@ -24,7 +24,6 @@ | |||
| 24 | #include <linux/can/dev.h> | 24 | #include <linux/can/dev.h> |
| 25 | #include <linux/can/error.h> | 25 | #include <linux/can/error.h> |
| 26 | #include <linux/can/led.h> | 26 | #include <linux/can/led.h> |
| 27 | #include <linux/can/platform/flexcan.h> | ||
| 28 | #include <linux/clk.h> | 27 | #include <linux/clk.h> |
| 29 | #include <linux/delay.h> | 28 | #include <linux/delay.h> |
| 30 | #include <linux/if_arp.h> | 29 | #include <linux/if_arp.h> |
| @@ -37,6 +36,7 @@ | |||
| 37 | #include <linux/of.h> | 36 | #include <linux/of.h> |
| 38 | #include <linux/of_device.h> | 37 | #include <linux/of_device.h> |
| 39 | #include <linux/platform_device.h> | 38 | #include <linux/platform_device.h> |
| 39 | #include <linux/regulator/consumer.h> | ||
| 40 | 40 | ||
| 41 | #define DRV_NAME "flexcan" | 41 | #define DRV_NAME "flexcan" |
| 42 | 42 | ||
| @@ -211,6 +211,7 @@ struct flexcan_priv { | |||
| 211 | struct clk *clk_per; | 211 | struct clk *clk_per; |
| 212 | struct flexcan_platform_data *pdata; | 212 | struct flexcan_platform_data *pdata; |
| 213 | const struct flexcan_devtype_data *devtype_data; | 213 | const struct flexcan_devtype_data *devtype_data; |
| 214 | struct regulator *reg_xceiver; | ||
| 214 | }; | 215 | }; |
| 215 | 216 | ||
| 216 | static struct flexcan_devtype_data fsl_p1010_devtype_data = { | 217 | static struct flexcan_devtype_data fsl_p1010_devtype_data = { |
| @@ -258,15 +259,6 @@ static inline void flexcan_write(u32 val, void __iomem *addr) | |||
| 258 | } | 259 | } |
| 259 | #endif | 260 | #endif |
| 260 | 261 | ||
| 261 | /* | ||
| 262 | * Swtich transceiver on or off | ||
| 263 | */ | ||
| 264 | static void flexcan_transceiver_switch(const struct flexcan_priv *priv, int on) | ||
| 265 | { | ||
| 266 | if (priv->pdata && priv->pdata->transceiver_switch) | ||
| 267 | priv->pdata->transceiver_switch(on); | ||
| 268 | } | ||
| 269 | |||
| 270 | static inline int flexcan_has_and_handle_berr(const struct flexcan_priv *priv, | 262 | static inline int flexcan_has_and_handle_berr(const struct flexcan_priv *priv, |
| 271 | u32 reg_esr) | 263 | u32 reg_esr) |
| 272 | { | 264 | { |
| @@ -799,7 +791,11 @@ static int flexcan_chip_start(struct net_device *dev) | |||
| 799 | if (priv->devtype_data->features & FLEXCAN_HAS_V10_FEATURES) | 791 | if (priv->devtype_data->features & FLEXCAN_HAS_V10_FEATURES) |
| 800 | flexcan_write(0x0, ®s->rxfgmask); | 792 | flexcan_write(0x0, ®s->rxfgmask); |
| 801 | 793 | ||
| 802 | flexcan_transceiver_switch(priv, 1); | 794 | if (priv->reg_xceiver) { |
| 795 | err = regulator_enable(priv->reg_xceiver); | ||
| 796 | if (err) | ||
| 797 | goto out; | ||
| 798 | } | ||
| 803 | 799 | ||
| 804 | /* synchronize with the can bus */ | 800 | /* synchronize with the can bus */ |
| 805 | reg_mcr = flexcan_read(®s->mcr); | 801 | reg_mcr = flexcan_read(®s->mcr); |
| @@ -842,7 +838,8 @@ static void flexcan_chip_stop(struct net_device *dev) | |||
| 842 | reg |= FLEXCAN_MCR_MDIS | FLEXCAN_MCR_HALT; | 838 | reg |= FLEXCAN_MCR_MDIS | FLEXCAN_MCR_HALT; |
| 843 | flexcan_write(reg, ®s->mcr); | 839 | flexcan_write(reg, ®s->mcr); |
| 844 | 840 | ||
| 845 | flexcan_transceiver_switch(priv, 0); | 841 | if (priv->reg_xceiver) |
| 842 | regulator_disable(priv->reg_xceiver); | ||
| 846 | priv->can.state = CAN_STATE_STOPPED; | 843 | priv->can.state = CAN_STATE_STOPPED; |
| 847 | 844 | ||
| 848 | return; | 845 | return; |
| @@ -1084,6 +1081,10 @@ static int flexcan_probe(struct platform_device *pdev) | |||
| 1084 | priv->pdata = pdev->dev.platform_data; | 1081 | priv->pdata = pdev->dev.platform_data; |
| 1085 | priv->devtype_data = devtype_data; | 1082 | priv->devtype_data = devtype_data; |
| 1086 | 1083 | ||
| 1084 | priv->reg_xceiver = devm_regulator_get(&pdev->dev, "xceiver"); | ||
| 1085 | if (IS_ERR(priv->reg_xceiver)) | ||
| 1086 | priv->reg_xceiver = NULL; | ||
| 1087 | |||
| 1087 | netif_napi_add(dev, &priv->napi, flexcan_poll, FLEXCAN_NAPI_WEIGHT); | 1088 | netif_napi_add(dev, &priv->napi, flexcan_poll, FLEXCAN_NAPI_WEIGHT); |
| 1088 | 1089 | ||
| 1089 | dev_set_drvdata(&pdev->dev, dev); | 1090 | dev_set_drvdata(&pdev->dev, dev); |
diff --git a/include/linux/can/platform/flexcan.h b/include/linux/can/platform/flexcan.h deleted file mode 100644 index 72b713ab57e9..000000000000 --- a/include/linux/can/platform/flexcan.h +++ /dev/null | |||
| @@ -1,20 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (C) 2010 Marc Kleine-Budde <kernel@pengutronix.de> | ||
| 3 | * | ||
| 4 | * This file is released under the GPLv2 | ||
| 5 | * | ||
| 6 | */ | ||
| 7 | |||
| 8 | #ifndef __CAN_PLATFORM_FLEXCAN_H | ||
| 9 | #define __CAN_PLATFORM_FLEXCAN_H | ||
| 10 | |||
| 11 | /** | ||
| 12 | * struct flexcan_platform_data - flex CAN controller platform data | ||
| 13 | * @transceiver_enable: - called to power on/off the transceiver | ||
| 14 | * | ||
| 15 | */ | ||
| 16 | struct flexcan_platform_data { | ||
| 17 | void (*transceiver_switch)(int enable); | ||
| 18 | }; | ||
| 19 | |||
| 20 | #endif /* __CAN_PLATFORM_FLEXCAN_H */ | ||
