Now that we have a struct mci_ios inside struct mci_host, let's make use of it directly in mci_set_ios instead of copying out the struct members one by one.
While at it, let's also add a debug print describing the configuration being applied. Signed-off-by: Ahmad Fatoum <a.fat...@pengutronix.de> --- drivers/mci/mci-core.c | 48 +++++++++++++++++++++--------------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/drivers/mci/mci-core.c b/drivers/mci/mci-core.c index 262535d63006..7b33b4c8df88 100644 --- a/drivers/mci/mci-core.c +++ b/drivers/mci/mci-core.c @@ -1024,6 +1024,24 @@ static int sd_change_freq(struct mci *mci) return 0; } +static const char *mci_timing_tostr(unsigned timing) +{ + switch (timing) { + case MMC_TIMING_LEGACY: + return "legacy"; + case MMC_TIMING_MMC_HS: + return "MMC HS"; + case MMC_TIMING_SD_HS: + return "SD HS"; + case MMC_TIMING_MMC_DDR52: + return "MMC DDR52"; + case MMC_TIMING_MMC_HS200: + return "HS200"; + default: + return "unknown"; /* shouldn't happen */ + } +} + /** * Setup host's interface bus width and transfer frequency * @param mci MCI instance @@ -1031,13 +1049,13 @@ static int sd_change_freq(struct mci *mci) static void mci_set_ios(struct mci *mci) { struct mci_host *host = mci->host; - struct mci_ios ios = { - .bus_width = host->ios.bus_width, - .clock = host->ios.clock, - .timing = host->ios.timing, - }; + struct mci_ios *ios = &host->ios; - host->ops.set_ios(host, &ios); + dev_dbg(&mci->dev, "clock %u.%uMHz width %u timing %s\n", + ios->clock / 1000000, ios->clock % 1000000, + 1 << ios->bus_width, mci_timing_tostr(ios->timing)); + + host->ops.set_ios(host, ios); host->actual_clock = host->ios.clock; } @@ -2313,24 +2331,6 @@ static int mci_sd_read(struct block_device *blk, void *buffer, sector_t block, /* ------------------ attach to the device API --------------------------- */ -static const char *mci_timing_tostr(unsigned timing) -{ - switch (timing) { - case MMC_TIMING_LEGACY: - return "legacy"; - case MMC_TIMING_MMC_HS: - return "MMC HS"; - case MMC_TIMING_SD_HS: - return "SD HS"; - case MMC_TIMING_MMC_DDR52: - return "MMC DDR52"; - case MMC_TIMING_MMC_HS200: - return "HS200"; - default: - return "unknown"; /* shouldn't happen */ - } -} - static void mci_print_caps(unsigned caps) { printf(" capabilities: %s%s%s%s%s%s%s%s\n", -- 2.39.5