summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorVictor Shih <victor.shih@genesyslogic.com.tw>2024-11-01 11:44:16 +0100
committerUlf Hansson <ulf.hansson@linaro.org>2024-11-04 12:11:37 +0100
commit53857ced9f23c8720d148748fff434386780afab (patch)
tree27b847fe3a73e86d5a44164a959d4e140adab243 /drivers
parentmmc: sdhci-uhs2: correction a warning caused by incorrect type in argument (diff)
downloadlinux-53857ced9f23c8720d148748fff434386780afab.tar.xz
linux-53857ced9f23c8720d148748fff434386780afab.zip
mmc: core: Correct type in variable assignment for UHS-II
There is a type issue in assignment in the sd_uhs2_dev_init(), sd_uhs2_enum() and sd_uhs2_config_write() that will generate a warning when building the kernel. Let's fix it. Reported-by: kernel test robot <lkp@intel.com> Closes: https://lore.kernel.org/oe-kbuild-all/202410260423.15jvE6qc-lkp@intel.com/ Closes: https://lore.kernel.org/oe-kbuild-all/202410261827.7h8YK8u2-lkp@intel.com/ Suggested-by: Adrian Hunter <adrian.hunter@intel.com> Signed-off-by: Ben Chuang <ben.chuang@genesyslogic.com.tw> Signed-off-by: Victor Shih <victor.shih@genesyslogic.com.tw> Message-ID: <20241101104416.4954-2-victorshihgli@gmail.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/mmc/core/sd_uhs2.c56
1 files changed, 29 insertions, 27 deletions
diff --git a/drivers/mmc/core/sd_uhs2.c b/drivers/mmc/core/sd_uhs2.c
index 618b46c37857..c5847a2084d5 100644
--- a/drivers/mmc/core/sd_uhs2.c
+++ b/drivers/mmc/core/sd_uhs2.c
@@ -140,6 +140,7 @@ static int sd_uhs2_dev_init(struct mmc_host *host)
struct uhs2_command uhs2_cmd = {};
u32 cnt;
u32 dap, gap, resp_gap;
+ u32 payload0;
u8 gd = 0;
int err;
@@ -176,10 +177,11 @@ static int sd_uhs2_dev_init(struct mmc_host *host)
* Let's retry the DEVICE_INIT command no more than 30 times.
*/
for (cnt = 0; cnt < 30; cnt++) {
- uhs2_cmd.payload[0] = ((dap & 0xF) << 12) |
- UHS2_DEV_INIT_COMPLETE_FLAG |
- ((gd & 0xF) << 4) |
- (gap & 0xF);
+ payload0 = ((dap & 0xF) << 12) |
+ UHS2_DEV_INIT_COMPLETE_FLAG |
+ ((gd & 0xF) << 4) |
+ (gap & 0xF);
+ uhs2_cmd.payload[0] = payload0;
sd_uhs2_cmd_assemble(&cmd, &uhs2_cmd, UHS2_DEV_INIT_PAYLOAD_LEN,
UHS2_DEV_INIT_RESP_LEN);
@@ -225,6 +227,7 @@ static int sd_uhs2_enum(struct mmc_host *host, u32 *node_id)
{
struct mmc_command cmd = {0};
struct uhs2_command uhs2_cmd = {};
+ u32 payload0;
u8 id_f = 0xF, id_l = 0x0;
int err;
@@ -243,8 +246,8 @@ static int sd_uhs2_enum(struct mmc_host *host, u32 *node_id)
UHS2_NATIVE_CMD_PLEN_4B |
(UHS2_DEV_CMD_ENUMERATE >> 8);
- uhs2_cmd.payload[0] = (id_f << 4) | id_l;
- uhs2_cmd.payload[0] = cpu_to_be32(uhs2_cmd.payload[0]);
+ payload0 = (id_f << 4) | id_l;
+ uhs2_cmd.payload[0] = cpu_to_be32(payload0);
sd_uhs2_cmd_assemble(&cmd, &uhs2_cmd, UHS2_DEV_ENUM_PAYLOAD_LEN, UHS2_DEV_ENUM_RESP_LEN);
@@ -465,6 +468,7 @@ static int sd_uhs2_config_write(struct mmc_host *host, struct mmc_card *card)
{
struct mmc_command cmd = {0};
struct uhs2_command uhs2_cmd = {};
+ u32 payload0, payload1;
u8 nMinDataGap;
int err;
@@ -487,10 +491,10 @@ static int sd_uhs2_config_write(struct mmc_host *host, struct mmc_card *card)
host->uhs2_caps.n_lanes_set = UHS2_DEV_CONFIG_GEN_SET_2L_FD_HD;
card->uhs2_config.n_lanes_set = UHS2_DEV_CONFIG_GEN_SET_2L_FD_HD;
- uhs2_cmd.payload[0] = card->uhs2_config.n_lanes_set << UHS2_DEV_CONFIG_N_LANES_POS;
- uhs2_cmd.payload[1] = 0;
- uhs2_cmd.payload[0] = cpu_to_be32(uhs2_cmd.payload[0]);
- uhs2_cmd.payload[1] = cpu_to_be32(uhs2_cmd.payload[1]);
+ payload0 = card->uhs2_config.n_lanes_set << UHS2_DEV_CONFIG_N_LANES_POS;
+ payload1 = 0;
+ uhs2_cmd.payload[0] = cpu_to_be32(payload0);
+ uhs2_cmd.payload[1] = cpu_to_be32(payload1);
/*
* There is no payload because per spec, there should be
@@ -545,8 +549,7 @@ static int sd_uhs2_config_write(struct mmc_host *host, struct mmc_card *card)
card->uhs2_config.speed_range_set = UHS2_DEV_CONFIG_PHY_SET_SPEED_A;
}
- uhs2_cmd.payload[0] =
- card->uhs2_config.speed_range_set << UHS2_DEV_CONFIG_PHY_SET_SPEED_POS;
+ payload0 = card->uhs2_config.speed_range_set << UHS2_DEV_CONFIG_PHY_SET_SPEED_POS;
card->uhs2_config.n_lss_sync_set = (max(card->uhs2_config.n_lss_sync,
host->uhs2_caps.n_lss_sync) >> 2) &
@@ -558,10 +561,10 @@ static int sd_uhs2_config_write(struct mmc_host *host, struct mmc_card *card)
UHS2_DEV_CONFIG_N_LSS_DIR_MASK;
host->uhs2_caps.n_lss_dir_set = card->uhs2_config.n_lss_dir_set;
- uhs2_cmd.payload[1] = (card->uhs2_config.n_lss_dir_set << UHS2_DEV_CONFIG_N_LSS_DIR_POS) |
- card->uhs2_config.n_lss_sync_set;
- uhs2_cmd.payload[0] = cpu_to_be32(uhs2_cmd.payload[0]);
- uhs2_cmd.payload[1] = cpu_to_be32(uhs2_cmd.payload[1]);
+ payload1 = (card->uhs2_config.n_lss_dir_set << UHS2_DEV_CONFIG_N_LSS_DIR_POS) |
+ card->uhs2_config.n_lss_sync_set;
+ uhs2_cmd.payload[0] = cpu_to_be32(payload0);
+ uhs2_cmd.payload[1] = cpu_to_be32(payload1);
memset(uhs2_cmd.uhs2_resp, 0, sizeof(uhs2_cmd.uhs2_resp));
@@ -608,13 +611,12 @@ static int sd_uhs2_config_write(struct mmc_host *host, struct mmc_card *card)
host->uhs2_caps.max_retry_set = 3;
card->uhs2_config.max_retry_set = host->uhs2_caps.max_retry_set;
- uhs2_cmd.payload[0] =
- (card->uhs2_config.maxblk_len_set << UHS2_DEV_CONFIG_MAX_BLK_LEN_POS) |
- (card->uhs2_config.max_retry_set << UHS2_DEV_CONFIG_LT_SET_MAX_RETRY_POS) |
- (card->uhs2_config.n_fcu_set << UHS2_DEV_CONFIG_N_FCU_POS);
- uhs2_cmd.payload[1] = card->uhs2_config.n_data_gap_set;
- uhs2_cmd.payload[0] = cpu_to_be32(uhs2_cmd.payload[0]);
- uhs2_cmd.payload[1] = cpu_to_be32(uhs2_cmd.payload[1]);
+ payload0 = (card->uhs2_config.maxblk_len_set << UHS2_DEV_CONFIG_MAX_BLK_LEN_POS) |
+ (card->uhs2_config.max_retry_set << UHS2_DEV_CONFIG_LT_SET_MAX_RETRY_POS) |
+ (card->uhs2_config.n_fcu_set << UHS2_DEV_CONFIG_N_FCU_POS);
+ payload1 = card->uhs2_config.n_data_gap_set;
+ uhs2_cmd.payload[0] = cpu_to_be32(payload0);
+ uhs2_cmd.payload[1] = cpu_to_be32(payload1);
sd_uhs2_cmd_assemble(&cmd, &uhs2_cmd, UHS2_CFG_WRITE_PAYLOAD_LEN, 0);
@@ -641,10 +643,10 @@ static int sd_uhs2_config_write(struct mmc_host *host, struct mmc_card *card)
UHS2_NATIVE_CMD_PLEN_8B |
(UHS2_DEV_CONFIG_GEN_SET >> 8);
- uhs2_cmd.payload[0] = 0;
- uhs2_cmd.payload[1] = UHS2_DEV_CONFIG_GEN_SET_CFG_COMPLETE;
- uhs2_cmd.payload[0] = cpu_to_be32(uhs2_cmd.payload[0]);
- uhs2_cmd.payload[1] = cpu_to_be32(uhs2_cmd.payload[1]);
+ payload0 = 0;
+ payload1 = UHS2_DEV_CONFIG_GEN_SET_CFG_COMPLETE;
+ uhs2_cmd.payload[0] = cpu_to_be32(payload0);
+ uhs2_cmd.payload[1] = cpu_to_be32(payload1);
memset(uhs2_cmd.uhs2_resp, 0, sizeof(uhs2_cmd.uhs2_resp));
sd_uhs2_cmd_assemble(&cmd, &uhs2_cmd, UHS2_CFG_WRITE_PAYLOAD_LEN,