Skip to content

Commit 2007758

Browse files
committed
Merge tag 'mmc-v6.8' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc
Pull MMC updates from Ulf Hansson: "MMC core: - Don't force a retune before eMMC RPMB switch - Add optional HS400 tuning in HS400es initialization - Add a sysfs node to for write-protect-group-size - Add re-tuning test to the mmc-test module - Use mrq.sbc to support close-ended ioctl requests MMC host: - mmci: Add support for SDIO in-band irqs for the stm32 variant - mmc_spi: Remove broken support custom DMA mapped buffers - mtk-sd: Improve and extend the support for tunings - renesas_sdhi: Document support for the RZ/Five variant - sdhci_am654: Drop support for the ti,otap-del-sel DT property - sdhci-brcmstb: Add support for the brcm 74165b0 variant - sdhci-msm: Add compatibles for IPQ4019 and IPQ8074 - sdhci-of-dwcmshc: Add support for the T-Head TH1520 variant - sdhci-xenon: Add support for the Marvell ac5 variant" * tag 'mmc-v6.8' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc: (27 commits) mmc: xenon: Add ac5 support via bounce buffer dt-bindings: mmc: add Marvell ac5 mmc: sdhci-brcmstb: add new sdhci reset sequence for brcm 74165b0 dt-bindings: mmc: brcm,sdhci-brcmstb: Add support for 74165b0 mmc: core: Do not force a retune before RPMB switch mmc: core: Add HS400 tuning in HS400es initialization mmc: sdhci_omap: Fix TI SoC dependencies mmc: sdhci_am654: Fix TI SoC dependencies mmc: core: Add wp_grp_size sysfs node mmc: mmc_test: Add re-tuning test mmc: mmc_spi: remove custom DMA mapped buffers dt-bindings: mmc: sdhci-msm: document dedicated IPQ4019 and IPQ8074 dt-bindings: mmc: synopsys-dw-mshc: add iommus for Intel SocFPGA mmc: mtk-sd: Extend number of tuning steps dt-bindings: mmc: mtk-sd: add tuning steps related property mmc: sdhci-omap: don't misuse kernel-doc marker mmc: mtk-sd: Increase the verbosity of msdc_track_cmd_data mmc: core: Use mrq.sbc in close-ended ffu mmc: sdhci_am654: Drop lookup for deprecated ti,otap-del-sel mmc: sdhci-of-dwcmshc: Use logical OR instead of bitwise OR in dwcmshc_probe() ...
2 parents 0c4b09c + 5d40213 commit 2007758

28 files changed

+771
-319
lines changed

Documentation/devicetree/bindings/mmc/arasan,sdhci.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -226,8 +226,8 @@ examples:
226226
interrupt-parent = <&gic>;
227227
interrupts = <0 48 4>;
228228
reg = <0xff160000 0x1000>;
229-
clocks = <&clk200>, <&clk200>;
230-
clock-names = "clk_xin", "clk_ahb";
229+
clocks = <&clk200>, <&clk200>, <&clk1200>;
230+
clock-names = "clk_xin", "clk_ahb", "gate";
231231
clock-output-names = "clk_out_sd0", "clk_in_sd0";
232232
#clock-cells = <1>;
233233
clk-phase-sd-hs = <63>, <72>;
@@ -239,8 +239,8 @@ examples:
239239
interrupt-parent = <&gic>;
240240
interrupts = <0 126 4>;
241241
reg = <0xf1040000 0x10000>;
242-
clocks = <&clk200>, <&clk200>;
243-
clock-names = "clk_xin", "clk_ahb";
242+
clocks = <&clk200>, <&clk200>, <&clk1200>;
243+
clock-names = "clk_xin", "clk_ahb", "gate";
244244
clock-output-names = "clk_out_sd0", "clk_in_sd0";
245245
#clock-cells = <1>;
246246
clk-phase-sd-hs = <132>, <60>;

Documentation/devicetree/bindings/mmc/brcm,sdhci-brcmstb.yaml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,8 @@ properties:
2020
- const: brcm,sdhci-brcmstb
2121
- items:
2222
- enum:
23+
- brcm,bcm74165b0-sdhci
2324
- brcm,bcm7445-sdhci
24-
- const: brcm,sdhci-brcmstb
25-
- items:
26-
- enum:
2725
- brcm,bcm7425-sdhci
2826
- const: brcm,sdhci-brcmstb
2927

Documentation/devicetree/bindings/mmc/marvell,xenon-sdhci.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ properties:
2727
- marvell,armada-ap806-sdhci
2828

2929
- items:
30-
- const: marvell,armada-ap807-sdhci
30+
- enum:
31+
- marvell,armada-ap807-sdhci
32+
- marvell,ac5-sdhci
3133
- const: marvell,armada-ap806-sdhci
3234

3335
- items:

Documentation/devicetree/bindings/mmc/mtk-sd.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,15 @@ properties:
145145
minimum: 0
146146
maximum: 7
147147

148+
mediatek,tuning-step:
149+
$ref: /schemas/types.yaml#/definitions/uint32
150+
description:
151+
Some SoCs need extend tuning step for better delay value to avoid CRC issue.
152+
If not present, default tuning step is 32. For eMMC and SD, this can yield
153+
satisfactory calibration results in most cases.
154+
enum: [32, 64]
155+
default: 32
156+
148157
resets:
149158
maxItems: 1
150159

Documentation/devicetree/bindings/mmc/renesas,sdhi.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ properties:
5656
- renesas,sdhi-r8a77980 # R-Car V3H
5757
- renesas,sdhi-r8a77990 # R-Car E3
5858
- renesas,sdhi-r8a77995 # R-Car D3
59-
- renesas,sdhi-r9a07g043 # RZ/G2UL
59+
- renesas,sdhi-r9a07g043 # RZ/G2UL and RZ/Five
6060
- renesas,sdhi-r9a07g044 # RZ/G2{L,LC}
6161
- renesas,sdhi-r9a07g054 # RZ/V2L
6262
- renesas,sdhi-r9a08g045 # RZ/G3S

Documentation/devicetree/bindings/mmc/sdhci-msm.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ properties:
2222
- items:
2323
- enum:
2424
- qcom,apq8084-sdhci
25+
- qcom,ipq4019-sdhci
26+
- qcom,ipq8074-sdhci
2527
- qcom,msm8226-sdhci
2628
- qcom,msm8953-sdhci
2729
- qcom,msm8974-sdhci

Documentation/devicetree/bindings/mmc/snps,dwcmshc-sdhci.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ properties:
1919
- rockchip,rk3568-dwcmshc
2020
- rockchip,rk3588-dwcmshc
2121
- snps,dwcmshc-sdhci
22+
- thead,th1520-dwcmshc
2223

2324
reg:
2425
maxItems: 1

Documentation/devicetree/bindings/mmc/synopsys-dw-mshc.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ properties:
3535
- const: biu
3636
- const: ciu
3737

38+
iommus:
39+
maxItems: 1
40+
3841
altr,sysmgr-syscon:
3942
$ref: /schemas/types.yaml#/definitions/phandle-array
4043
items:
@@ -62,6 +65,7 @@ allOf:
6265
altr,sysmgr-syscon: true
6366
else:
6467
properties:
68+
iommus: false
6569
altr,sysmgr-syscon: false
6670

6771
required:

drivers/mmc/core/block.c

Lines changed: 43 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -400,6 +400,10 @@ struct mmc_blk_ioc_data {
400400
struct mmc_ioc_cmd ic;
401401
unsigned char *buf;
402402
u64 buf_bytes;
403+
unsigned int flags;
404+
#define MMC_BLK_IOC_DROP BIT(0) /* drop this mrq */
405+
#define MMC_BLK_IOC_SBC BIT(1) /* use mrq.sbc */
406+
403407
struct mmc_rpmb_data *rpmb;
404408
};
405409

@@ -465,7 +469,7 @@ static int mmc_blk_ioctl_copy_to_user(struct mmc_ioc_cmd __user *ic_ptr,
465469
}
466470

467471
static int __mmc_blk_ioctl_cmd(struct mmc_card *card, struct mmc_blk_data *md,
468-
struct mmc_blk_ioc_data *idata)
472+
struct mmc_blk_ioc_data **idatas, int i)
469473
{
470474
struct mmc_command cmd = {}, sbc = {};
471475
struct mmc_data data = {};
@@ -475,10 +479,18 @@ static int __mmc_blk_ioctl_cmd(struct mmc_card *card, struct mmc_blk_data *md,
475479
unsigned int busy_timeout_ms;
476480
int err;
477481
unsigned int target_part;
482+
struct mmc_blk_ioc_data *idata = idatas[i];
483+
struct mmc_blk_ioc_data *prev_idata = NULL;
478484

479485
if (!card || !md || !idata)
480486
return -EINVAL;
481487

488+
if (idata->flags & MMC_BLK_IOC_DROP)
489+
return 0;
490+
491+
if (idata->flags & MMC_BLK_IOC_SBC)
492+
prev_idata = idatas[i - 1];
493+
482494
/*
483495
* The RPMB accesses comes in from the character device, so we
484496
* need to target these explicitly. Else we just target the
@@ -532,14 +544,16 @@ static int __mmc_blk_ioctl_cmd(struct mmc_card *card, struct mmc_blk_data *md,
532544
return err;
533545
}
534546

535-
if (idata->rpmb) {
547+
if (idata->rpmb || prev_idata) {
536548
sbc.opcode = MMC_SET_BLOCK_COUNT;
537549
/*
538550
* We don't do any blockcount validation because the max size
539551
* may be increased by a future standard. We just copy the
540552
* 'Reliable Write' bit here.
541553
*/
542554
sbc.arg = data.blocks | (idata->ic.write_flag & BIT(31));
555+
if (prev_idata)
556+
sbc.arg = prev_idata->ic.arg;
543557
sbc.flags = MMC_RSP_R1 | MMC_CMD_AC;
544558
mrq.sbc = &sbc;
545559
}
@@ -557,6 +571,15 @@ static int __mmc_blk_ioctl_cmd(struct mmc_card *card, struct mmc_blk_data *md,
557571
mmc_wait_for_req(card->host, &mrq);
558572
memcpy(&idata->ic.response, cmd.resp, sizeof(cmd.resp));
559573

574+
if (prev_idata) {
575+
memcpy(&prev_idata->ic.response, sbc.resp, sizeof(sbc.resp));
576+
if (sbc.error) {
577+
dev_err(mmc_dev(card->host), "%s: sbc error %d\n",
578+
__func__, sbc.error);
579+
return sbc.error;
580+
}
581+
}
582+
560583
if (cmd.error) {
561584
dev_err(mmc_dev(card->host), "%s: cmd error %d\n",
562585
__func__, cmd.error);
@@ -1034,6 +1057,20 @@ static inline void mmc_blk_reset_success(struct mmc_blk_data *md, int type)
10341057
md->reset_done &= ~type;
10351058
}
10361059

1060+
static void mmc_blk_check_sbc(struct mmc_queue_req *mq_rq)
1061+
{
1062+
struct mmc_blk_ioc_data **idata = mq_rq->drv_op_data;
1063+
int i;
1064+
1065+
for (i = 1; i < mq_rq->ioc_count; i++) {
1066+
if (idata[i - 1]->ic.opcode == MMC_SET_BLOCK_COUNT &&
1067+
mmc_op_multi(idata[i]->ic.opcode)) {
1068+
idata[i - 1]->flags |= MMC_BLK_IOC_DROP;
1069+
idata[i]->flags |= MMC_BLK_IOC_SBC;
1070+
}
1071+
}
1072+
}
1073+
10371074
/*
10381075
* The non-block commands come back from the block layer after it queued it and
10391076
* processed it with all other requests and then they get issued in this
@@ -1061,11 +1098,14 @@ static void mmc_blk_issue_drv_op(struct mmc_queue *mq, struct request *req)
10611098
if (ret)
10621099
break;
10631100
}
1101+
1102+
mmc_blk_check_sbc(mq_rq);
1103+
10641104
fallthrough;
10651105
case MMC_DRV_OP_IOCTL_RPMB:
10661106
idata = mq_rq->drv_op_data;
10671107
for (i = 0, ret = 0; i < mq_rq->ioc_count; i++) {
1068-
ret = __mmc_blk_ioctl_cmd(card, md, idata[i]);
1108+
ret = __mmc_blk_ioctl_cmd(card, md, idata, i);
10691109
if (ret)
10701110
break;
10711111
}

drivers/mmc/core/host.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,13 +119,12 @@ void mmc_retune_enable(struct mmc_host *host)
119119

120120
/*
121121
* Pause re-tuning for a small set of operations. The pause begins after the
122-
* next command and after first doing re-tuning.
122+
* next command.
123123
*/
124124
void mmc_retune_pause(struct mmc_host *host)
125125
{
126126
if (!host->retune_paused) {
127127
host->retune_paused = 1;
128-
mmc_retune_needed(host);
129128
mmc_retune_hold(host);
130129
}
131130
}

0 commit comments

Comments
 (0)