Message ID | 9e296859-0363-ecc4-2d99-fd0239efceff@gmail.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | mmc: meson-gx: fix SDIO mode if cap_sdio_irq isn't set | expand |
On Sun, Feb 12, 2023 at 10:54:25PM +0100, Heiner Kallweit wrote: > Some SDIO WiFi modules stopped working after SDIO interrupt mode > was added if cap_sdio_irq isn't set in device tree. This patch was > confirmed to fix the issue. Hi Heiner, with this patch, with cap-sdio-irq set or unset in the DT, it doesn't matter, I get the following warning on dmesg: meson-gx-mmc d0070000.mmc: unaligned sg offset 3148, disabling descriptor DMA for transfer The offset number varies between reboots. Is that to be expected?
On 12.02.2023 23:38, Geraldo Nascimento wrote: > On Sun, Feb 12, 2023 at 10:54:25PM +0100, Heiner Kallweit wrote: >> Some SDIO WiFi modules stopped working after SDIO interrupt mode >> was added if cap_sdio_irq isn't set in device tree. This patch was >> confirmed to fix the issue. > > Hi Heiner, > > with this patch, with cap-sdio-irq set or unset in the DT, it doesn't > matter, I get the following warning on dmesg: > > meson-gx-mmc d0070000.mmc: unaligned sg offset 3148, disabling descriptor DMA for transfer > > The offset number varies between reboots. > > Is that to be expected? It's a known issue that ath10k may pass buffers to meson-gx-mmc that don't meet the meson alignment requirement. See here: https://lore.kernel.org/linux-arm-kernel/CAFBinCCN88nfSnmPoFq4H_ROWFMbq=Kcpr1W6CpNs58XeHtV2w@mail.gmail.com/T/ This means there's nothing wrong with the SDIO IRQ fix.
Hi Heiner,
I love your patch! Perhaps something to improve:
[auto build test WARNING on linus/master]
[also build test WARNING on v6.2-rc8 next-20230210]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Heiner-Kallweit/mmc-meson-gx-fix-SDIO-mode-if-cap_sdio_irq-isn-t-set/20230213-055650
patch link: https://lore.kernel.org/r/9e296859-0363-ecc4-2d99-fd0239efceff%40gmail.com
patch subject: [PATCH] mmc: meson-gx: fix SDIO mode if cap_sdio_irq isn't set
config: alpha-allyesconfig (https://download.01.org/0day-ci/archive/20230213/202302130854.oj1Vrs2F-lkp@intel.com/config)
compiler: alpha-linux-gcc (GCC) 12.1.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/intel-lab-lkp/linux/commit/6aca20b626a6d75b5d74fc4441cdd99ff3252b23
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Heiner-Kallweit/mmc-meson-gx-fix-SDIO-mode-if-cap_sdio_irq-isn-t-set/20230213-055650
git checkout 6aca20b626a6d75b5d74fc4441cdd99ff3252b23
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=alpha olddefconfig
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=alpha SHELL=/bin/bash drivers/mmc/host/
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
| Link: https://lore.kernel.org/oe-kbuild-all/202302130854.oj1Vrs2F-lkp@intel.com/
All warnings (new ones prefixed by >>):
In file included from include/linux/printk.h:566,
from include/linux/kernel.h:29,
from drivers/mmc/host/meson-gx-mmc.c:8:
drivers/mmc/host/meson-gx-mmc.c: In function 'meson_mmc_irq':
>> drivers/mmc/host/meson-gx-mmc.c:962:25: warning: format '%lx' expects argument of type 'long unsigned int', but argument 4 has type 'u32' {aka 'unsigned int'} [-Wformat=]
962 | "Unexpected IRQ! irq_en 0x%08lx - status 0x%08x\n",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/dynamic_debug.h:223:29: note: in definition of macro '__dynamic_func_call_cls'
223 | func(&id, ##__VA_ARGS__); \
| ^~~~~~~~~~~
include/linux/dynamic_debug.h:249:9: note: in expansion of macro '_dynamic_func_call_cls'
249 | _dynamic_func_call_cls(_DPRINTK_CLASS_DFLT, fmt, func, ##__VA_ARGS__)
| ^~~~~~~~~~~~~~~~~~~~~~
include/linux/dynamic_debug.h:272:9: note: in expansion of macro '_dynamic_func_call'
272 | _dynamic_func_call(fmt, __dynamic_dev_dbg, \
| ^~~~~~~~~~~~~~~~~~
include/linux/dev_printk.h:155:9: note: in expansion of macro 'dynamic_dev_dbg'
155 | dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__)
| ^~~~~~~~~~~~~~~
include/linux/dev_printk.h:155:30: note: in expansion of macro 'dev_fmt'
155 | dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__)
| ^~~~~~~
drivers/mmc/host/meson-gx-mmc.c:961:17: note: in expansion of macro 'dev_dbg'
961 | dev_dbg(host->dev,
| ^~~~~~~
drivers/mmc/host/meson-gx-mmc.c:962:55: note: format string is defined here
962 | "Unexpected IRQ! irq_en 0x%08lx - status 0x%08x\n",
| ~~~~^
| |
| long unsigned int
| %08x
vim +962 drivers/mmc/host/meson-gx-mmc.c
066ecde6d826b4 Heiner Kallweit 2022-08-25 947
51c5d8447bd71b Kevin Hilman 2016-10-19 948 static irqreturn_t meson_mmc_irq(int irq, void *dev_id)
51c5d8447bd71b Kevin Hilman 2016-10-19 949 {
51c5d8447bd71b Kevin Hilman 2016-10-19 950 struct meson_host *host = dev_id;
19a91dd4e39e75 Heinrich Schuchardt 2016-12-23 951 struct mmc_command *cmd;
6aca20b626a6d7 Heiner Kallweit 2023-02-12 952 u32 status, raw_status, irq_mask = IRQ_EN_MASK;
74858655cbff05 Jerome Brunet 2017-08-28 953 irqreturn_t ret = IRQ_NONE;
51c5d8447bd71b Kevin Hilman 2016-10-19 954
6aca20b626a6d7 Heiner Kallweit 2023-02-12 955 if (host->mmc->caps & MMC_CAP_SDIO_IRQ)
6aca20b626a6d7 Heiner Kallweit 2023-02-12 956 irq_mask |= IRQ_SDIO;
18f92bc02f1739 Jerome Brunet 2018-12-06 957 raw_status = readl(host->regs + SD_EMMC_STATUS);
6aca20b626a6d7 Heiner Kallweit 2023-02-12 958 status = raw_status & irq_mask;
18f92bc02f1739 Jerome Brunet 2018-12-06 959
18f92bc02f1739 Jerome Brunet 2018-12-06 960 if (!status) {
18f92bc02f1739 Jerome Brunet 2018-12-06 961 dev_dbg(host->dev,
6f6fac8af6be0f Heiner Kallweit 2022-08-25 @962 "Unexpected IRQ! irq_en 0x%08lx - status 0x%08x\n",
6aca20b626a6d7 Heiner Kallweit 2023-02-12 963 irq_mask, raw_status);
18f92bc02f1739 Jerome Brunet 2018-12-06 964 return IRQ_NONE;
18f92bc02f1739 Jerome Brunet 2018-12-06 965 }
18f92bc02f1739 Jerome Brunet 2018-12-06 966
066ecde6d826b4 Heiner Kallweit 2022-08-25 967 if (WARN_ON(!host))
51c5d8447bd71b Kevin Hilman 2016-10-19 968 return IRQ_NONE;
51c5d8447bd71b Kevin Hilman 2016-10-19 969
c2c1e63a80d6e9 Jerome Brunet 2019-05-23 970 /* ack all raised interrupts */
c2c1e63a80d6e9 Jerome Brunet 2019-05-23 971 writel(status, host->regs + SD_EMMC_STATUS);
c2c1e63a80d6e9 Jerome Brunet 2019-05-23 972
74858655cbff05 Jerome Brunet 2017-08-28 973 cmd = host->cmd;
066ecde6d826b4 Heiner Kallweit 2022-08-25 974
066ecde6d826b4 Heiner Kallweit 2022-08-25 975 if (status & IRQ_SDIO) {
066ecde6d826b4 Heiner Kallweit 2022-08-25 976 spin_lock(&host->lock);
066ecde6d826b4 Heiner Kallweit 2022-08-25 977 __meson_mmc_enable_sdio_irq(host->mmc, 0);
066ecde6d826b4 Heiner Kallweit 2022-08-25 978 sdio_signal_irq(host->mmc);
066ecde6d826b4 Heiner Kallweit 2022-08-25 979 spin_unlock(&host->lock);
066ecde6d826b4 Heiner Kallweit 2022-08-25 980 status &= ~IRQ_SDIO;
066ecde6d826b4 Heiner Kallweit 2022-08-25 981 if (!status)
066ecde6d826b4 Heiner Kallweit 2022-08-25 982 return IRQ_HANDLED;
066ecde6d826b4 Heiner Kallweit 2022-08-25 983 }
066ecde6d826b4 Heiner Kallweit 2022-08-25 984
066ecde6d826b4 Heiner Kallweit 2022-08-25 985 if (WARN_ON(!cmd))
066ecde6d826b4 Heiner Kallweit 2022-08-25 986 return IRQ_NONE;
066ecde6d826b4 Heiner Kallweit 2022-08-25 987
51c5d8447bd71b Kevin Hilman 2016-10-19 988 cmd->error = 0;
74858655cbff05 Jerome Brunet 2017-08-28 989 if (status & IRQ_CRC_ERR) {
74858655cbff05 Jerome Brunet 2017-08-28 990 dev_dbg(host->dev, "CRC Error - status 0x%08x\n", status);
51c5d8447bd71b Kevin Hilman 2016-10-19 991 cmd->error = -EILSEQ;
18f92bc02f1739 Jerome Brunet 2018-12-06 992 ret = IRQ_WAKE_THREAD;
74858655cbff05 Jerome Brunet 2017-08-28 993 goto out;
51c5d8447bd71b Kevin Hilman 2016-10-19 994 }
74858655cbff05 Jerome Brunet 2017-08-28 995
74858655cbff05 Jerome Brunet 2017-08-28 996 if (status & IRQ_TIMEOUTS) {
74858655cbff05 Jerome Brunet 2017-08-28 997 dev_dbg(host->dev, "Timeout - status 0x%08x\n", status);
51c5d8447bd71b Kevin Hilman 2016-10-19 998 cmd->error = -ETIMEDOUT;
18f92bc02f1739 Jerome Brunet 2018-12-06 999 ret = IRQ_WAKE_THREAD;
74858655cbff05 Jerome Brunet 2017-08-28 1000 goto out;
51c5d8447bd71b Kevin Hilman 2016-10-19 1001 }
74858655cbff05 Jerome Brunet 2017-08-28 1002
74858655cbff05 Jerome Brunet 2017-08-28 1003 meson_mmc_read_resp(host->mmc, cmd);
74858655cbff05 Jerome Brunet 2017-08-28 1004
2c8d96a46dfd45 Heiner Kallweit 2017-03-22 1005 if (status & (IRQ_END_OF_CHAIN | IRQ_RESP_STATUS)) {
066ecde6d826b4 Heiner Kallweit 2022-08-25 1006 struct mmc_data *data = cmd->data;
066ecde6d826b4 Heiner Kallweit 2022-08-25 1007
2c8d96a46dfd45 Heiner Kallweit 2017-03-22 1008 if (data && !cmd->error)
2c8d96a46dfd45 Heiner Kallweit 2017-03-22 1009 data->bytes_xfered = data->blksz * data->blocks;
79ed05e329c34c Heiner Kallweit 2017-04-07 1010 if (meson_mmc_bounce_buf_read(data) ||
79ed05e329c34c Heiner Kallweit 2017-04-07 1011 meson_mmc_get_next_command(cmd))
51c5d8447bd71b Kevin Hilman 2016-10-19 1012 ret = IRQ_WAKE_THREAD;
74858655cbff05 Jerome Brunet 2017-08-28 1013 else
74858655cbff05 Jerome Brunet 2017-08-28 1014 ret = IRQ_HANDLED;
51c5d8447bd71b Kevin Hilman 2016-10-19 1015 }
51c5d8447bd71b Kevin Hilman 2016-10-19 1016
51c5d8447bd71b Kevin Hilman 2016-10-19 1017 out:
18f92bc02f1739 Jerome Brunet 2018-12-06 1018 if (cmd->error) {
18f92bc02f1739 Jerome Brunet 2018-12-06 1019 /* Stop desc in case of errors */
18f92bc02f1739 Jerome Brunet 2018-12-06 1020 u32 start = readl(host->regs + SD_EMMC_START);
18f92bc02f1739 Jerome Brunet 2018-12-06 1021
18f92bc02f1739 Jerome Brunet 2018-12-06 1022 start &= ~START_DESC_BUSY;
18f92bc02f1739 Jerome Brunet 2018-12-06 1023 writel(start, host->regs + SD_EMMC_START);
18f92bc02f1739 Jerome Brunet 2018-12-06 1024 }
18f92bc02f1739 Jerome Brunet 2018-12-06 1025
1f8066d90739eb Heiner Kallweit 2017-03-22 1026 if (ret == IRQ_HANDLED)
51c5d8447bd71b Kevin Hilman 2016-10-19 1027 meson_mmc_request_done(host->mmc, cmd->mrq);
51c5d8447bd71b Kevin Hilman 2016-10-19 1028
51c5d8447bd71b Kevin Hilman 2016-10-19 1029 return ret;
51c5d8447bd71b Kevin Hilman 2016-10-19 1030 }
51c5d8447bd71b Kevin Hilman 2016-10-19 1031
Hi Heiner, I love your patch! Perhaps something to improve: [auto build test WARNING on linus/master] [also build test WARNING on v6.2-rc8 next-20230210] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/Heiner-Kallweit/mmc-meson-gx-fix-SDIO-mode-if-cap_sdio_irq-isn-t-set/20230213-055650 patch link: https://lore.kernel.org/r/9e296859-0363-ecc4-2d99-fd0239efceff%40gmail.com patch subject: [PATCH] mmc: meson-gx: fix SDIO mode if cap_sdio_irq isn't set config: arm64-buildonly-randconfig-r006-20230213 (https://download.01.org/0day-ci/archive/20230213/202302130924.CSStKyHP-lkp@intel.com/config) compiler: clang version 17.0.0 (https://github.com/llvm/llvm-project db0e6591612b53910a1b366863348bdb9d7d2fb1) reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # install arm64 cross compiling tool for clang build # apt-get install binutils-aarch64-linux-gnu # https://github.com/intel-lab-lkp/linux/commit/6aca20b626a6d75b5d74fc4441cdd99ff3252b23 git remote add linux-review https://github.com/intel-lab-lkp/linux git fetch --no-tags linux-review Heiner-Kallweit/mmc-meson-gx-fix-SDIO-mode-if-cap_sdio_irq-isn-t-set/20230213-055650 git checkout 6aca20b626a6d75b5d74fc4441cdd99ff3252b23 # save the config file mkdir build_dir && cp config build_dir/.config COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=arm64 olddefconfig COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=arm64 SHELL=/bin/bash drivers/mmc/host/ If you fix the issue, kindly add following tag where applicable | Reported-by: kernel test robot <lkp@intel.com> | Link: https://lore.kernel.org/oe-kbuild-all/202302130924.CSStKyHP-lkp@intel.com/ All warnings (new ones prefixed by >>): >> drivers/mmc/host/meson-gx-mmc.c:963:5: warning: format specifies type 'unsigned long' but the argument has type 'u32' (aka 'unsigned int') [-Wformat] irq_mask, raw_status); ^~~~~~~~ include/linux/dev_printk.h:163:47: note: expanded from macro 'dev_dbg' dev_printk(KERN_DEBUG, dev, dev_fmt(fmt), ##__VA_ARGS__); \ ~~~ ^~~~~~~~~~~ include/linux/dev_printk.h:129:34: note: expanded from macro 'dev_printk' _dev_printk(level, dev, fmt, ##__VA_ARGS__); \ ~~~ ^~~~~~~~~~~ 1 warning generated. vim +963 drivers/mmc/host/meson-gx-mmc.c 947 948 static irqreturn_t meson_mmc_irq(int irq, void *dev_id) 949 { 950 struct meson_host *host = dev_id; 951 struct mmc_command *cmd; 952 u32 status, raw_status, irq_mask = IRQ_EN_MASK; 953 irqreturn_t ret = IRQ_NONE; 954 955 if (host->mmc->caps & MMC_CAP_SDIO_IRQ) 956 irq_mask |= IRQ_SDIO; 957 raw_status = readl(host->regs + SD_EMMC_STATUS); 958 status = raw_status & irq_mask; 959 960 if (!status) { 961 dev_dbg(host->dev, 962 "Unexpected IRQ! irq_en 0x%08lx - status 0x%08x\n", > 963 irq_mask, raw_status); 964 return IRQ_NONE; 965 } 966 967 if (WARN_ON(!host)) 968 return IRQ_NONE; 969 970 /* ack all raised interrupts */ 971 writel(status, host->regs + SD_EMMC_STATUS); 972 973 cmd = host->cmd; 974 975 if (status & IRQ_SDIO) { 976 spin_lock(&host->lock); 977 __meson_mmc_enable_sdio_irq(host->mmc, 0); 978 sdio_signal_irq(host->mmc); 979 spin_unlock(&host->lock); 980 status &= ~IRQ_SDIO; 981 if (!status) 982 return IRQ_HANDLED; 983 } 984 985 if (WARN_ON(!cmd)) 986 return IRQ_NONE; 987 988 cmd->error = 0; 989 if (status & IRQ_CRC_ERR) { 990 dev_dbg(host->dev, "CRC Error - status 0x%08x\n", status); 991 cmd->error = -EILSEQ; 992 ret = IRQ_WAKE_THREAD; 993 goto out; 994 } 995 996 if (status & IRQ_TIMEOUTS) { 997 dev_dbg(host->dev, "Timeout - status 0x%08x\n", status); 998 cmd->error = -ETIMEDOUT; 999 ret = IRQ_WAKE_THREAD; 1000 goto out; 1001 } 1002 1003 meson_mmc_read_resp(host->mmc, cmd); 1004 1005 if (status & (IRQ_END_OF_CHAIN | IRQ_RESP_STATUS)) { 1006 struct mmc_data *data = cmd->data; 1007 1008 if (data && !cmd->error) 1009 data->bytes_xfered = data->blksz * data->blocks; 1010 if (meson_mmc_bounce_buf_read(data) || 1011 meson_mmc_get_next_command(cmd)) 1012 ret = IRQ_WAKE_THREAD; 1013 else 1014 ret = IRQ_HANDLED; 1015 } 1016 1017 out: 1018 if (cmd->error) { 1019 /* Stop desc in case of errors */ 1020 u32 start = readl(host->regs + SD_EMMC_START); 1021 1022 start &= ~START_DESC_BUSY; 1023 writel(start, host->regs + SD_EMMC_START); 1024 } 1025 1026 if (ret == IRQ_HANDLED) 1027 meson_mmc_request_done(host->mmc, cmd->mrq); 1028 1029 return ret; 1030 } 1031
diff --git a/drivers/mmc/host/meson-gx-mmc.c b/drivers/mmc/host/meson-gx-mmc.c index 6e5ea0213..a80d48d23 100644 --- a/drivers/mmc/host/meson-gx-mmc.c +++ b/drivers/mmc/host/meson-gx-mmc.c @@ -435,7 +435,8 @@ static int meson_mmc_clk_init(struct meson_host *host) clk_reg |= FIELD_PREP(CLK_CORE_PHASE_MASK, CLK_PHASE_180); clk_reg |= FIELD_PREP(CLK_TX_PHASE_MASK, CLK_PHASE_0); clk_reg |= FIELD_PREP(CLK_RX_PHASE_MASK, CLK_PHASE_0); - clk_reg |= CLK_IRQ_SDIO_SLEEP(host); + if (host->mmc->caps & MMC_CAP_SDIO_IRQ) + clk_reg |= CLK_IRQ_SDIO_SLEEP(host); writel(clk_reg, host->regs + SD_EMMC_CLOCK); /* get the mux parents */ @@ -948,16 +949,18 @@ static irqreturn_t meson_mmc_irq(int irq, void *dev_id) { struct meson_host *host = dev_id; struct mmc_command *cmd; - u32 status, raw_status; + u32 status, raw_status, irq_mask = IRQ_EN_MASK; irqreturn_t ret = IRQ_NONE; + if (host->mmc->caps & MMC_CAP_SDIO_IRQ) + irq_mask |= IRQ_SDIO; raw_status = readl(host->regs + SD_EMMC_STATUS); - status = raw_status & (IRQ_EN_MASK | IRQ_SDIO); + status = raw_status & irq_mask; if (!status) { dev_dbg(host->dev, "Unexpected IRQ! irq_en 0x%08lx - status 0x%08x\n", - IRQ_EN_MASK | IRQ_SDIO, raw_status); + irq_mask, raw_status); return IRQ_NONE; } @@ -1204,6 +1207,11 @@ static int meson_mmc_probe(struct platform_device *pdev) goto free_host; } + mmc->caps |= MMC_CAP_CMD23; + + if (mmc->caps & MMC_CAP_SDIO_IRQ) + mmc->caps2 |= MMC_CAP2_SDIO_IRQ_NOTHREAD; + host->data = (struct meson_mmc_data *) of_device_get_match_data(&pdev->dev); if (!host->data) { @@ -1277,11 +1285,6 @@ static int meson_mmc_probe(struct platform_device *pdev) spin_lock_init(&host->lock); - mmc->caps |= MMC_CAP_CMD23; - - if (mmc->caps & MMC_CAP_SDIO_IRQ) - mmc->caps2 |= MMC_CAP2_SDIO_IRQ_NOTHREAD; - if (host->dram_access_quirk) { /* Limit segments to 1 due to low available sram memory */ mmc->max_segs = 1;