summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDong Aisheng <b29396@freescale.com>2014-12-09 16:43:37 +0800
committerDong Aisheng <b29396@freescale.com>2014-12-12 18:01:59 +0800
commit3141bfc97e667de4b3d88968aa18668699d735ea (patch)
tree7bada4c2b592cfac513a00edc55bc97d066c8880
parent9fa3b150ae0c4249ca1b6a7aba57d844540aa383 (diff)
MLK-9975-2 imx6sx-ard: fix CAN unwork if power up the borad on first time
The CAN transceiver on MX6SX Sabreauto board seems in sleep mode by default after power up the board. User has to press the wakeup key on ARD baseboard before using the transceiver, or it may not work properly when power up the board at the first time(warm reset does not have such issue). This patch wakeup the transceiver firstly if needed during intialization by control the wakeup pin, then user do not have to press wakeup key button to enable the transceiver. BTW, stby gpio is also updated which is wrong before. Signed-off-by: Dong Aisheng <b29396@freescale.com>
-rw-r--r--arch/arm/boot/dts/imx6sx-sabreauto.dts6
-rw-r--r--arch/arm/mach-imx/mach-imx6sx.c14
2 files changed, 17 insertions, 3 deletions
diff --git a/arch/arm/boot/dts/imx6sx-sabreauto.dts b/arch/arm/boot/dts/imx6sx-sabreauto.dts
index ba30c90ce233..ea3457e41a50 100644
--- a/arch/arm/boot/dts/imx6sx-sabreauto.dts
+++ b/arch/arm/boot/dts/imx6sx-sabreauto.dts
@@ -283,7 +283,8 @@
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_flexcan1_1>;
trx-en-gpio = <&max7310_b 5 GPIO_ACTIVE_HIGH>;
- trx-stby-gpio = <&max7310_b 3 GPIO_ACTIVE_HIGH>;
+ trx-stby-gpio = <&max7310_b 4 GPIO_ACTIVE_HIGH>;
+ trx-wakeup-gpio = <&max7310_b 7 GPIO_ACTIVE_HIGH>;
status = "okay";
};
@@ -291,7 +292,8 @@
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_flexcan2_1>;
trx-en-gpio = <&max7310_b 5 GPIO_ACTIVE_HIGH>;
- trx-stby-gpio = <&max7310_b 3 GPIO_ACTIVE_HIGH>;
+ trx-stby-gpio = <&max7310_b 4 GPIO_ACTIVE_HIGH>;
+ trx-wakeup-gpio = <&max7310_b 7 GPIO_ACTIVE_HIGH>;
status = "okay";
};
diff --git a/arch/arm/mach-imx/mach-imx6sx.c b/arch/arm/mach-imx/mach-imx6sx.c
index 33ebb5a7065c..7a29cc710115 100644
--- a/arch/arm/mach-imx/mach-imx6sx.c
+++ b/arch/arm/mach-imx/mach-imx6sx.c
@@ -80,13 +80,24 @@ static int __init imx6sx_arm2_flexcan_fixup(void)
struct device_node *np;
enum of_gpio_flags en_flags, stby_flags;
bool canfd_en = false;
+ int wakeup_gpio;
np = of_find_node_by_path("/soc/aips-bus@02000000/can@02090000");
if (!np)
return -ENODEV;
+
+ /* Wakeup transceiver first in case it's in sleep mode by default */
+ wakeup_gpio = of_get_named_gpio(np, "trx-wakeup-gpio", 0);
+ if (gpio_is_valid(wakeup_gpio) &&
+ !gpio_request_one(wakeup_gpio, GPIOF_OUT_INIT_HIGH, "flexcan-trx-wakeup")) {
+ gpio_set_value_cansleep(wakeup_gpio, 0);
+ gpio_set_value_cansleep(wakeup_gpio, 1);
+ }
+
flexcan_en_gpio = of_get_named_gpio_flags(np, "trx-en-gpio", 0, &en_flags);
flexcan_stby_gpio = of_get_named_gpio_flags(np, "trx-stby-gpio", 0, &stby_flags);
+
if (gpio_is_valid(flexcan_en_gpio) && gpio_is_valid(flexcan_stby_gpio) &&
!gpio_request_one(flexcan_en_gpio, GPIOF_DIR_OUT, "flexcan-trx-en") &&
!gpio_request_one(flexcan_stby_gpio, GPIOF_DIR_OUT, "flexcan-trx-stby")) {
@@ -354,7 +365,8 @@ static void __init imx6sx_init_late(void)
imx6sx_cpuidle_init();
if (of_machine_is_compatible("fsl,imx6sx-17x17-arm2") ||
- of_machine_is_compatible("fsl,imx6sx-sdb"))
+ of_machine_is_compatible("fsl,imx6sx-sdb") ||
+ of_machine_is_compatible("fsl,imx6sx-sabreauto"))
imx6sx_arm2_flexcan_fixup();
if (IS_ENABLED(CONFIG_ARM_IMX6_CPUFREQ)) {