]> git.ipfire.org Git - thirdparty/kernel/linux.git/blobdiff - drivers/mmc/host/sdhci-pci-o2micro.c
mmc: sdhci: sdhci-pci-o2micro: Correctly set bus width when tuning
[thirdparty/kernel/linux.git] / drivers / mmc / host / sdhci-pci-o2micro.c
index 05a012a694b2c6875a6189e5452b55af07fca04d..dd21315922c87da795852e75ac24a7de4a9a19cf 100644 (file)
@@ -1,19 +1,10 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Copyright (C) 2013 BayHub Technology Ltd.
  *
  * Authors: Peter Guo <peter.guo@bayhubtech.com>
  *          Adam Lee <adam.lee@canonical.com>
  *          Ernest Zhang <ernest.zhang@bayhubtech.com>
- *
- * This software is licensed under the terms of the GNU General Public
- * License version 2, as published by the Free Software Foundation, and
- * may be copied, distributed, and modified under those terms.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
  */
 
 #include <linux/pci.h>
@@ -124,6 +115,7 @@ static int sdhci_o2_execute_tuning(struct mmc_host *mmc, u32 opcode)
         */
        if (mmc->ios.bus_width == MMC_BUS_WIDTH_8) {
                current_bus_width = mmc->ios.bus_width;
+               mmc->ios.bus_width = MMC_BUS_WIDTH_4;
                sdhci_set_bus_width(host, MMC_BUS_WIDTH_4);
        }
 
@@ -135,8 +127,10 @@ static int sdhci_o2_execute_tuning(struct mmc_host *mmc, u32 opcode)
 
        sdhci_end_tuning(host);
 
-       if (current_bus_width == MMC_BUS_WIDTH_8)
+       if (current_bus_width == MMC_BUS_WIDTH_8) {
+               mmc->ios.bus_width = MMC_BUS_WIDTH_8;
                sdhci_set_bus_width(host, current_bus_width);
+       }
 
        host->flags &= ~SDHCI_HS400_TUNING;
        return 0;