From a3e51689d0ef7d204b4a6b74afd064c0315b09e8 Mon Sep 17 00:00:00 2001 From: "Ye.Li" Date: Thu, 26 Mar 2015 15:24:04 +0800 Subject: MLK-10476 imx: mx7dsabresd: Fix 74LV driver issue Should write the bits to SDI in reverse order because of the bits will be shifted. Signed-off-by: Ye.Li (cherry picked from commit 83389e054d3cb7a905a3f81c20f395e784beb258) Signed-off-by: Peng Fan --- board/freescale/mx7dsabresd/mx7dsabresd.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'board') diff --git a/board/freescale/mx7dsabresd/mx7dsabresd.c b/board/freescale/mx7dsabresd/mx7dsabresd.c index a653c08..815fd68 100644 --- a/board/freescale/mx7dsabresd/mx7dsabresd.c +++ b/board/freescale/mx7dsabresd/mx7dsabresd.c @@ -203,13 +203,15 @@ static enum qn_level seq[3][2] = { }; static enum qn_func qn_output[8] = { - qn_disable, qn_reset, qn_reset, qn_reset, qn_reset, qn_enable, qn_enable + qn_disable, qn_reset, qn_reset, qn_reset, qn_reset, qn_reset, qn_enable, + qn_enable }; void iox74lv_init(void) { - int i = 0; - for (i = 0; i < 8; i++) { + int i; + + for (i = 7; i >= 0; i--) { gpio_direction_output(IOX_SHCP, 0); gpio_direction_output(IOX_SDI, seq[qn_output[i]][0]); udelay(500); @@ -224,14 +226,13 @@ void iox74lv_init(void) */ gpio_direction_output(IOX_STCP, 1); - for (i = 0; i < 8; i++) { + for (i = 7; i >= 0; i--) { gpio_direction_output(IOX_SHCP, 0); gpio_direction_output(IOX_SDI, seq[qn_output[i]][1]); udelay(500); gpio_direction_output(IOX_SHCP, 1); udelay(500); } - gpio_direction_output(IOX_STCP, 0); udelay(500); /* @@ -242,8 +243,8 @@ void iox74lv_init(void) void iox74lv_set(int index) { - int i = 0; - for (i = 0; i < 8; i++) { + int i; + for (i = 7; i >= 0; i--) { gpio_direction_output(IOX_SHCP, 0); if (i == index) @@ -262,7 +263,7 @@ void iox74lv_set(int index) */ gpio_direction_output(IOX_STCP, 1); - for (i = 0; i < 8; i++) { + for (i = 7; i >= 0; i--) { gpio_direction_output(IOX_SHCP, 0); gpio_direction_output(IOX_SDI, seq[qn_output[i]][1]); udelay(500); -- cgit v1.1