History

Merge tag 'mmc-v6.2-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc

Pull MMC fixes from Ulf Hansson: "MMC core: - Fix potential resource leaks in SDIO card detection error path MMC host: - jz4740: Decrease maximum clock rate to workaround bug on JZ4760(B) - meson-gx: Fix SDIO support to get some WiFi modules to work again - mmc_spi: Fix error handling in ->probe()" * tag 'mmc-v6.2-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc: mmc: jz4740: Work around bug on JZ4760(B) mmc: mmc_spi: fix error handling in mmc_spi_probe() mmc: sdio: fix possible resource leaks in some error paths mmc: meson-gx: fix SDIO mode if cap_sdio_irq isn't set

Linus Torvalds committed 3 years ago

Commit bda6cfa2 parents 64e0253 3f18c505 files · +41 −29Browse files

Unified · Split

5 files
  1. drivers/mmc/core/sdio_bus.c +14 −3
  2. drivers/mmc/core/sdio_cis.c +0 −12
  3. drivers/mmc/host/jz4740_mmc.c +10 −0
  4. drivers/mmc/host/meson-gx-mmc.c +13 −10
  5. drivers/mmc/host/mmc_spi.c +4 −4
drivers/mmc/core/sdio_bus.c+14−3
@@ -294,6 +294,12 @@ static void sdio_release_func(struct device *dev) · 293 unmodified lines
294 if (!(func->card->quirks & MMC_QUIRK_NONSTD_SDIO))294 if (!(func->card->quirks & MMC_QUIRK_NONSTD_SDIO))
295 sdio_free_func_cis(func);295 sdio_free_func_cis(func);
296 296
297 /*
298 * We have now removed the link to the tuples in the
299 * card structure, so remove the reference.
300 */
301 put_device(&func->card->dev);
302
297 kfree(func->info);303 kfree(func->info);
298 kfree(func->tmpbuf);304 kfree(func->tmpbuf);
299 kfree(func);305 kfree(func);
@@ -324,6 +330,12 @@ struct sdio_func *sdio_alloc_func(struct mmc_card *card) · 24 unmodified lines
324 330
325 device_initialize(&func->dev);331 device_initialize(&func->dev);
326 332
333 /*
334 * We may link to tuples in the card structure,
335 * we need make sure we have a reference to it.
336 */
337 get_device(&func->card->dev);
338
327 func->dev.parent = &card->dev;339 func->dev.parent = &card->dev;
328 func->dev.bus = &sdio_bus_type;340 func->dev.bus = &sdio_bus_type;
329 func->dev.release = sdio_release_func;341 func->dev.release = sdio_release_func;
@@ -377,10 +389,9 @@ int sdio_add_func(struct sdio_func *func) · 47 unmodified lines
377 */389 */
378void sdio_remove_func(struct sdio_func *func)390void sdio_remove_func(struct sdio_func *func)
379{391{
380 if (!sdio_func_present(func))392 if (sdio_func_present(func))
381 return;393 device_del(&func->dev);
382 394
383 device_del(&func->dev);
384 of_node_put(func->dev.of_node);395 of_node_put(func->dev.of_node);
385 put_device(&func->dev);396 put_device(&func->dev);
386}397}
drivers/mmc/core/sdio_cis.c+0−12
@@ -403,12 +403,6 @@ int sdio_read_func_cis(struct sdio_func *func) · 402 unmodified lines
403 if (ret)403 if (ret)
404 return ret;404 return ret;
405 405
406 /*
407 * Since we've linked to tuples in the card structure,
408 * we must make sure we have a reference to it.
409 */
410 get_device(&func->card->dev);
411
412 /*406 /*
413 * Vendor/device id is optional for function CIS, so407 * Vendor/device id is optional for function CIS, so
414 * copy it from the card structure as needed.408 * copy it from the card structure as needed.
@@ -434,11 +428,5 @@ void sdio_free_func_cis(struct sdio_func *func) · 19 unmodified lines
434 }428 }
435 429
436 func->tuples = NULL;430 func->tuples = NULL;
437
438 /*
439 * We have now removed the link to the tuples in the
440 * card structure, so remove the reference.
441 */
442 put_device(&func->card->dev);
443}431}
444 432
drivers/mmc/host/jz4740_mmc.c+10−0
@@ -1053,6 +1053,16 @@ static int jz4740_mmc_probe(struct platform_device* pdev) · 1052 unmodified lines
1053 mmc->ops = &jz4740_mmc_ops;1053 mmc->ops = &jz4740_mmc_ops;
1054 if (!mmc->f_max)1054 if (!mmc->f_max)
1055 mmc->f_max = JZ_MMC_CLK_RATE;1055 mmc->f_max = JZ_MMC_CLK_RATE;
1056
1057 /*
1058 * There seems to be a problem with this driver on the JZ4760 and
1059 * JZ4760B SoCs. There, when using the maximum rate supported (50 MHz),
1060 * the communication fails with many SD cards.
1061 * Until this bug is sorted out, limit the maximum rate to 24 MHz.
1062 */
1063 if (host->version == JZ_MMC_JZ4760 && mmc->f_max > JZ_MMC_CLK_RATE)
1064 mmc->f_max = JZ_MMC_CLK_RATE;
1065
1056 mmc->f_min = mmc->f_max / 128;1066 mmc->f_min = mmc->f_max / 128;
1057 mmc->ocr_avail = MMC_VDD_32_33 | MMC_VDD_33_34;1067 mmc->ocr_avail = MMC_VDD_32_33 | MMC_VDD_33_34;
1058 1068
drivers/mmc/host/meson-gx-mmc.c+13−10
@@ -435,7 +435,8 @@ static int meson_mmc_clk_init(struct meson_host *host) · 434 unmodified lines
435 clk_reg |= FIELD_PREP(CLK_CORE_PHASE_MASK, CLK_PHASE_180);435 clk_reg |= FIELD_PREP(CLK_CORE_PHASE_MASK, CLK_PHASE_180);
436 clk_reg |= FIELD_PREP(CLK_TX_PHASE_MASK, CLK_PHASE_0);436 clk_reg |= FIELD_PREP(CLK_TX_PHASE_MASK, CLK_PHASE_0);
437 clk_reg |= FIELD_PREP(CLK_RX_PHASE_MASK, CLK_PHASE_0);437 clk_reg |= FIELD_PREP(CLK_RX_PHASE_MASK, CLK_PHASE_0);
438 clk_reg |= CLK_IRQ_SDIO_SLEEP(host);438 if (host->mmc->caps & MMC_CAP_SDIO_IRQ)
439 clk_reg |= CLK_IRQ_SDIO_SLEEP(host);
439 writel(clk_reg, host->regs + SD_EMMC_CLOCK);440 writel(clk_reg, host->regs + SD_EMMC_CLOCK);
440 441
441 /* get the mux parents */442 /* get the mux parents */
@@ -948,16 +949,18 @@ static irqreturn_t meson_mmc_irq(int irq, void *dev_id) · 506 unmodified lines
948{949{
949 struct meson_host *host = dev_id;950 struct meson_host *host = dev_id;
950 struct mmc_command *cmd;951 struct mmc_command *cmd;
951 u32 status, raw_status;952 u32 status, raw_status, irq_mask = IRQ_EN_MASK;
952 irqreturn_t ret = IRQ_NONE;953 irqreturn_t ret = IRQ_NONE;
953 954
955 if (host->mmc->caps & MMC_CAP_SDIO_IRQ)
956 irq_mask |= IRQ_SDIO;
954 raw_status = readl(host->regs + SD_EMMC_STATUS);957 raw_status = readl(host->regs + SD_EMMC_STATUS);
955 status = raw_status & (IRQ_EN_MASK | IRQ_SDIO);958 status = raw_status & irq_mask;
956 959
957 if (!status) {960 if (!status) {
958 dev_dbg(host->dev,961 dev_dbg(host->dev,
959 "Unexpected IRQ! irq_en 0x%08lx - status 0x%08x\n",962 "Unexpected IRQ! irq_en 0x%08x - status 0x%08x\n",
960 IRQ_EN_MASK | IRQ_SDIO, raw_status);963 irq_mask, raw_status);
961 return IRQ_NONE;964 return IRQ_NONE;
962 }965 }
963 966
@@ -1204,6 +1207,11 @@ static int meson_mmc_probe(struct platform_device *pdev) · 240 unmodified lines
1204 goto free_host;1207 goto free_host;
1205 }1208 }
1206 1209
1210 mmc->caps |= MMC_CAP_CMD23;
1211
1212 if (mmc->caps & MMC_CAP_SDIO_IRQ)
1213 mmc->caps2 |= MMC_CAP2_SDIO_IRQ_NOTHREAD;
1214
1207 host->data = (struct meson_mmc_data *)1215 host->data = (struct meson_mmc_data *)
1208 of_device_get_match_data(&pdev->dev);1216 of_device_get_match_data(&pdev->dev);
1209 if (!host->data) {1217 if (!host->data) {
@@ -1277,11 +1285,6 @@ static int meson_mmc_probe(struct platform_device *pdev) · 67 unmodified lines
1277 1285
1278 spin_lock_init(&host->lock);1286 spin_lock_init(&host->lock);
1279 1287
1280 mmc->caps |= MMC_CAP_CMD23;
1281
1282 if (mmc->caps & MMC_CAP_SDIO_IRQ)
1283 mmc->caps2 |= MMC_CAP2_SDIO_IRQ_NOTHREAD;
1284
1285 if (host->dram_access_quirk) {1288 if (host->dram_access_quirk) {
1286 /* Limit segments to 1 due to low available sram memory */1289 /* Limit segments to 1 due to low available sram memory */
1287 mmc->max_segs = 1;1290 mmc->max_segs = 1;
drivers/mmc/host/mmc_spi.c+4−4
@@ -1437,7 +1437,7 @@ static int mmc_spi_probe(struct spi_device *spi) · 1436 unmodified lines
1437 1437
1438 status = mmc_add_host(mmc);1438 status = mmc_add_host(mmc);
1439 if (status != 0)1439 if (status != 0)
1440 goto fail_add_host;1440 goto fail_glue_init;
1441 1441
1442 /*1442 /*
1443 * Index 0 is card detect1443 * Index 0 is card detect
@@ -1445,7 +1445,7 @@ static int mmc_spi_probe(struct spi_device *spi) · 1 unmodified line
1445 */1445 */
1446 status = mmc_gpiod_request_cd(mmc, NULL, 0, false, 1000);1446 status = mmc_gpiod_request_cd(mmc, NULL, 0, false, 1000);
1447 if (status == -EPROBE_DEFER)1447 if (status == -EPROBE_DEFER)
1448 goto fail_add_host;1448 goto fail_gpiod_request;
1449 if (!status) {1449 if (!status) {
1450 /*1450 /*
1451 * The platform has a CD GPIO signal that may support1451 * The platform has a CD GPIO signal that may support
@@ -1460,7 +1460,7 @@ static int mmc_spi_probe(struct spi_device *spi) · 8 unmodified lines
1460 /* Index 1 is write protect/read only */1460 /* Index 1 is write protect/read only */
1461 status = mmc_gpiod_request_ro(mmc, NULL, 1, 0);1461 status = mmc_gpiod_request_ro(mmc, NULL, 1, 0);
1462 if (status == -EPROBE_DEFER)1462 if (status == -EPROBE_DEFER)
1463 goto fail_add_host;1463 goto fail_gpiod_request;
1464 if (!status)1464 if (!status)
1465 has_ro = true;1465 has_ro = true;
1466 1466
@@ -1474,7 +1474,7 @@ static int mmc_spi_probe(struct spi_device *spi) · 7 unmodified lines
1474 ? ", cd polling" : "");1474 ? ", cd polling" : "");
1475 return 0;1475 return 0;
1476 1476
1477fail_add_host:1477fail_gpiod_request:
1478 mmc_remove_host(mmc);1478 mmc_remove_host(mmc);
1479fail_glue_init:1479fail_glue_init:
1480 mmc_spi_dma_free(host);1480 mmc_spi_dma_free(host);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t