Skip to content

Commit 795c633

Browse files
jbrun3tstorulf
authored andcommitted
mmc: meson-gx: fix __ffsdi2 undefined on arm32
Using __bf_shf does not compile on arm 32 architecture. This has gone unnoticed till now cause the driver is only used on arm64. In addition, __bf_shf was already used in the driver without any issue. It was used on a constant value, so the call was probably optimized away. Replace __bf_shf by __ffs fixes the problem Signed-off-by: Jerome Brunet <[email protected]> Signed-off-by: Ulf Hansson <[email protected]>
1 parent a027b2c commit 795c633

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

drivers/mmc/host/meson-gx-mmc.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -196,13 +196,13 @@ static int meson_mmc_clk_get_phase(struct clk_hw *hw)
196196
u32 val;
197197

198198
val = readl(mmc->reg);
199-
p = (val & mmc->phase_mask) >> __bf_shf(mmc->phase_mask);
199+
p = (val & mmc->phase_mask) >> __ffs(mmc->phase_mask);
200200
degrees = p * 360 / phase_num;
201201

202202
if (mmc->delay_mask) {
203203
period_ps = DIV_ROUND_UP((unsigned long)NSEC_PER_SEC * 1000,
204204
clk_get_rate(hw->clk));
205-
d = (val & mmc->delay_mask) >> __bf_shf(mmc->delay_mask);
205+
d = (val & mmc->delay_mask) >> __ffs(mmc->delay_mask);
206206
degrees += d * mmc->delay_step_ps * 360 / period_ps;
207207
degrees %= 360;
208208
}
@@ -218,11 +218,11 @@ static void meson_mmc_apply_phase_delay(struct meson_mmc_phase *mmc,
218218

219219
val = readl(mmc->reg);
220220
val &= ~mmc->phase_mask;
221-
val |= phase << __bf_shf(mmc->phase_mask);
221+
val |= phase << __ffs(mmc->phase_mask);
222222

223223
if (mmc->delay_mask) {
224224
val &= ~mmc->delay_mask;
225-
val |= delay << __bf_shf(mmc->delay_mask);
225+
val |= delay << __ffs(mmc->delay_mask);
226226
}
227227

228228
writel(val, mmc->reg);
@@ -249,7 +249,7 @@ static int meson_mmc_clk_set_phase(struct clk_hw *hw, int degrees)
249249
r = do_div(p, 360 / phase_num);
250250
d = DIV_ROUND_CLOSEST(r * period_ps,
251251
360 * mmc->delay_step_ps);
252-
d = min(d, mmc->delay_mask >> __bf_shf(mmc->delay_mask));
252+
d = min(d, mmc->delay_mask >> __ffs(mmc->delay_mask));
253253
}
254254

255255
meson_mmc_apply_phase_delay(mmc, p, d);
@@ -506,7 +506,7 @@ static int meson_mmc_clk_init(struct meson_host *host)
506506
init.num_parents = MUX_CLK_NUM_PARENTS;
507507

508508
mux->reg = host->regs + SD_EMMC_CLOCK;
509-
mux->shift = __bf_shf(CLK_SRC_MASK);
509+
mux->shift = __ffs(CLK_SRC_MASK);
510510
mux->mask = CLK_SRC_MASK >> mux->shift;
511511
mux->hw.init = &init;
512512

@@ -528,7 +528,7 @@ static int meson_mmc_clk_init(struct meson_host *host)
528528
init.num_parents = 1;
529529

530530
div->reg = host->regs + SD_EMMC_CLOCK;
531-
div->shift = __bf_shf(CLK_DIV_MASK);
531+
div->shift = __ffs(CLK_DIV_MASK);
532532
div->width = __builtin_popcountl(CLK_DIV_MASK);
533533
div->hw.init = &init;
534534
div->flags = (CLK_DIVIDER_ONE_BASED |

0 commit comments

Comments
 (0)