aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mmc
diff options
context:
space:
mode:
authorStephen Boyd <sboyd@codeaurora.org>2014-09-22 15:26:09 -0400
committerUlf Hansson <ulf.hansson@linaro.org>2014-09-23 03:05:28 -0400
commitffed1b94cbf869e81de0525608193f367db2ba36 (patch)
tree6c1ce71029c2ac9754766ab16ce3818bb175a19d /drivers/mmc
parentd4d11449088ee9aca16fd1884b852b8b73a4bda1 (diff)
mmc: sdhci-msm: Make tuning block table endian agnostic
If we're tuning on a big-endian CPU we'll never determine we properly tuned the device because we compare the data we received from the controller with a table that assumes the CPU is little-endian. Change the table to be an array of bytes instead of 32-bit words so we can use memcmp() without needing to byte-swap every word depending on the endianess of the CPU. Cc: Asutosh Das <asutoshd@codeaurora.org> Cc: Venkat Gopalakrishnan <venkatg@codeaurora.org> Reviewed-by: Georgi Djakov <gdjakov@mm-sol.com> Fixes: 415b5a75da43 "mmc: sdhci-msm: Add platform_execute_tuning implementation" Signed-off-by: Stephen Boyd <sboyd@codeaurora.org> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Diffstat (limited to 'drivers/mmc')
-rw-r--r--drivers/mmc/host/sdhci-msm.c42
1 files changed, 27 insertions, 15 deletions
diff --git a/drivers/mmc/host/sdhci-msm.c b/drivers/mmc/host/sdhci-msm.c
index 2f19eabac3ea..19539c61353c 100644
--- a/drivers/mmc/host/sdhci-msm.c
+++ b/drivers/mmc/host/sdhci-msm.c
@@ -46,22 +46,34 @@
46#define CMUX_SHIFT_PHASE_SHIFT 24 46#define CMUX_SHIFT_PHASE_SHIFT 24
47#define CMUX_SHIFT_PHASE_MASK (7 << CMUX_SHIFT_PHASE_SHIFT) 47#define CMUX_SHIFT_PHASE_MASK (7 << CMUX_SHIFT_PHASE_SHIFT)
48 48
49static const u32 tuning_block_64[] = { 49static const u8 tuning_block_64[] = {
50 0x00ff0fff, 0xccc3ccff, 0xffcc3cc3, 0xeffefffe, 50 0xff, 0x0f, 0xff, 0x00, 0xff, 0xcc, 0xc3, 0xcc,
51 0xddffdfff, 0xfbfffbff, 0xff7fffbf, 0xefbdf777, 51 0xc3, 0x3c, 0xcc, 0xff, 0xfe, 0xff, 0xfe, 0xef,
52 0xf0fff0ff, 0x3cccfc0f, 0xcfcc33cc, 0xeeffefff, 52 0xff, 0xdf, 0xff, 0xdd, 0xff, 0xfb, 0xff, 0xfb,
53 0xfdfffdff, 0xffbfffdf, 0xfff7ffbb, 0xde7b7ff7 53 0xbf, 0xff, 0x7f, 0xff, 0x77, 0xf7, 0xbd, 0xef,
54 0xff, 0xf0, 0xff, 0xf0, 0x0f, 0xfc, 0xcc, 0x3c,
55 0xcc, 0x33, 0xcc, 0xcf, 0xff, 0xef, 0xff, 0xee,
56 0xff, 0xfd, 0xff, 0xfd, 0xdf, 0xff, 0xbf, 0xff,
57 0xbb, 0xff, 0xf7, 0xff, 0xf7, 0x7f, 0x7b, 0xde,
54}; 58};
55 59
56static const u32 tuning_block_128[] = { 60static const u8 tuning_block_128[] = {
57 0xff00ffff, 0x0000ffff, 0xccccffff, 0xcccc33cc, 61 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0x00, 0x00,
58 0xcc3333cc, 0xffffcccc, 0xffffeeff, 0xffeeeeff, 62 0xff, 0xff, 0xcc, 0xcc, 0xcc, 0x33, 0xcc, 0xcc,
59 0xffddffff, 0xddddffff, 0xbbffffff, 0xbbffffff, 63 0xcc, 0x33, 0x33, 0xcc, 0xcc, 0xcc, 0xff, 0xff,
60 0xffffffbb, 0xffffff77, 0x77ff7777, 0xffeeddbb, 64 0xff, 0xee, 0xff, 0xff, 0xff, 0xee, 0xee, 0xff,
61 0x00ffffff, 0x00ffffff, 0xccffff00, 0xcc33cccc, 65 0xff, 0xff, 0xdd, 0xff, 0xff, 0xff, 0xdd, 0xdd,
62 0x3333cccc, 0xffcccccc, 0xffeeffff, 0xeeeeffff, 66 0xff, 0xff, 0xff, 0xbb, 0xff, 0xff, 0xff, 0xbb,
63 0xddffffff, 0xddffffff, 0xffffffdd, 0xffffffbb, 67 0xbb, 0xff, 0xff, 0xff, 0x77, 0xff, 0xff, 0xff,
64 0xffffbbbb, 0xffff77ff, 0xff7777ff, 0xeeddbb77 68 0x77, 0x77, 0xff, 0x77, 0xbb, 0xdd, 0xee, 0xff,
69 0xff, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0x00,
70 0x00, 0xff, 0xff, 0xcc, 0xcc, 0xcc, 0x33, 0xcc,
71 0xcc, 0xcc, 0x33, 0x33, 0xcc, 0xcc, 0xcc, 0xff,
72 0xff, 0xff, 0xee, 0xff, 0xff, 0xff, 0xee, 0xee,
73 0xff, 0xff, 0xff, 0xdd, 0xff, 0xff, 0xff, 0xdd,
74 0xdd, 0xff, 0xff, 0xff, 0xbb, 0xff, 0xff, 0xff,
75 0xbb, 0xbb, 0xff, 0xff, 0xff, 0x77, 0xff, 0xff,
76 0xff, 0x77, 0x77, 0xff, 0x77, 0xbb, 0xdd, 0xee,
65}; 77};
66 78
67struct sdhci_msm_host { 79struct sdhci_msm_host {
@@ -358,7 +370,7 @@ static int sdhci_msm_execute_tuning(struct sdhci_host *host, u32 opcode)
358{ 370{
359 int tuning_seq_cnt = 3; 371 int tuning_seq_cnt = 3;
360 u8 phase, *data_buf, tuned_phases[16], tuned_phase_cnt = 0; 372 u8 phase, *data_buf, tuned_phases[16], tuned_phase_cnt = 0;
361 const u32 *tuning_block_pattern = tuning_block_64; 373 const u8 *tuning_block_pattern = tuning_block_64;
362 int size = sizeof(tuning_block_64); /* Pattern size in bytes */ 374 int size = sizeof(tuning_block_64); /* Pattern size in bytes */
363 int rc; 375 int rc;
364 struct mmc_host *mmc = host->mmc; 376 struct mmc_host *mmc = host->mmc;