Skip to content

Commit 3855629

Browse files
committed
Merge tag 'mmc-v6.13' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc
Pull MMC updates from Ulf Hansson: "MMC core: - Add support for Ultra Capacity SD cards (SDUC, 2TB to 128TB) - Add support for Ultra High-Speed II SD cards (UHS-II) - Use a reset control for pwrseq_simple - Add SD card quirk for broken poweroff notification - Use GFP_NOIO for SD ACMD22 MMC host: - bcm2835: Introduce proper clock handling - mtk-sd: Add support for the Host-Software-Queue interface - mtk-sd: Add support for the mt7988/mt8196 variants - mtk-sd: Fix a couple of error paths in ->probe() - sdhci: Add interface to support UHS-II SD cards - sdhci_am654: Fixup support for changing the signal voltage level - sdhci-cadence: Add support for the Microchip PIC64GX variant - sdhci-esdhc-imx: Add support for eMMC HW-reset - sdhci-msm: Add support for the X1E80100/IPQ5424/SAR2130P/QCS615 variants - sdhci-of-arasan: Add support for eMMC HW-reset - sdhci-pci-gli: Add UHS-II support for the GL9767/GL9755 variants MEMSTICK: - A couple of minor updates" * tag 'mmc-v6.13' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc: (78 commits) mmc: pwrseq_simple: Handle !RESET_CONTROLLER properly mmc: mtk-sd: Fix MMC_CAP2_CRYPTO flag setting mmc: mtk-sd: Fix error handle of probe function mmc: core: Correction a warning caused by incorrect type in assignment for UHS-II mmc: sdhci-esdhc-imx: Update esdhc sysctl dtocv bitmask mmc: sdhci-esdhc-imx: Implement emmc hardware reset mmc: core: Correct type in variable assignment for UHS-II mmc: sdhci-uhs2: correction a warning caused by incorrect type in argument mmc: sdhci-uhs2: Remove unnecessary variables mmc: sdhci-uhs2: Correct incorrect type in argument mmc: sdhci: Make MMC_SDHCI_UHS2 config symbol invisible mmc: sdhci-uhs2: Remove unnecessary NULL check mmc: core: Fix error paths for UHS-II card init and re-init mmc: core: Add error handling of sd_uhs2_power_up() mmc: core: Simplify sd_uhs2_power_up() mmc: bcm2835: Introduce proper clock handling mmc: bcm2835: Fix type of current clock speed dt-bindings: mmc: Add sdhci compatible for QCS615 mmc: core: Use GFP_NOIO in ACMD22 dt-bindings: mmc: sdhci-msm: Add SAR2130P compatible ...
2 parents 75f2b37 + c0baf6e commit 3855629

116 files changed

Lines changed: 4580 additions & 398 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ properties:
1515
- enum:
1616
- amd,pensando-elba-sd4hc
1717
- microchip,mpfs-sd4hc
18+
- microchip,pic64gx-sd4hc
1819
- socionext,uniphier-sd4hc
1920
- const: cdns,sd4hc
2021

@@ -120,7 +121,7 @@ required:
120121
- clocks
121122

122123
allOf:
123-
- $ref: mmc-controller.yaml
124+
- $ref: sdhci-common.yaml
124125
- if:
125126
properties:
126127
compatible:

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

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,11 @@ properties:
2121
- mediatek,mt7620-mmc
2222
- mediatek,mt7622-mmc
2323
- mediatek,mt7986-mmc
24+
- mediatek,mt7988-mmc
2425
- mediatek,mt8135-mmc
2526
- mediatek,mt8173-mmc
2627
- mediatek,mt8183-mmc
28+
- mediatek,mt8196-mmc
2729
- mediatek,mt8516-mmc
2830
- items:
2931
- const: mediatek,mt7623-mmc
@@ -190,6 +192,7 @@ allOf:
190192
- mediatek,mt8186-mmc
191193
- mediatek,mt8188-mmc
192194
- mediatek,mt8195-mmc
195+
- mediatek,mt8196-mmc
193196
- mediatek,mt8516-mmc
194197
then:
195198
properties:
@@ -263,6 +266,27 @@ allOf:
263266
- const: bus_clk
264267
- const: sys_cg
265268

269+
- if:
270+
properties:
271+
compatible:
272+
contains:
273+
enum:
274+
- mediatek,mt7988-mmc
275+
then:
276+
properties:
277+
clocks:
278+
items:
279+
- description: source clock
280+
- description: HCLK which used for host
281+
- description: Advanced eXtensible Interface
282+
- description: Advanced High-performance Bus clock
283+
clock-names:
284+
items:
285+
- const: source
286+
- const: hclk
287+
- const: axi_cg
288+
- const: ahb_cg
289+
266290
- if:
267291
properties:
268292
compatible:

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,14 @@ properties:
3838
- enum:
3939
- qcom,ipq5018-sdhci
4040
- qcom,ipq5332-sdhci
41+
- qcom,ipq5424-sdhci
4142
- qcom,ipq6018-sdhci
4243
- qcom,ipq9574-sdhci
4344
- qcom,qcm2290-sdhci
4445
- qcom,qcs404-sdhci
46+
- qcom,qcs615-sdhci
4547
- qcom,qdu1000-sdhci
48+
- qcom,sar2130p-sdhci
4649
- qcom,sc7180-sdhci
4750
- qcom,sc7280-sdhci
4851
- qcom,sc8280xp-sdhci
@@ -62,6 +65,7 @@ properties:
6265
- qcom,sm8450-sdhci
6366
- qcom,sm8550-sdhci
6467
- qcom,sm8650-sdhci
68+
- qcom,x1e80100-sdhci
6569
- const: qcom,sdhci-msm-v5 # for sdcc version 5.0
6670

6771
reg:

drivers/memstick/core/memstick.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ static DEFINE_IDR(memstick_host_idr);
2626
static DEFINE_SPINLOCK(memstick_host_lock);
2727

2828
static int memstick_dev_match(struct memstick_dev *card,
29-
struct memstick_device_id *id)
29+
const struct memstick_device_id *id)
3030
{
3131
if (id->match_flags & MEMSTICK_MATCH_ALL) {
3232
if ((id->type == card->id.type)
@@ -44,7 +44,7 @@ static int memstick_bus_match(struct device *dev, const struct device_driver *dr
4444
dev);
4545
const struct memstick_driver *ms_drv = container_of_const(drv, struct memstick_driver,
4646
driver);
47-
struct memstick_device_id *ids = ms_drv->id_table;
47+
const struct memstick_device_id *ids = ms_drv->id_table;
4848

4949
if (ids) {
5050
while (ids->match_flags) {

drivers/memstick/core/ms_block.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -996,7 +996,7 @@ static int msb_verify_block(struct msb_data *msb, u16 pba,
996996
return 0;
997997
}
998998

999-
/* Writes exectly one block + oob */
999+
/* Writes exactly one block + oob */
10001000
static int msb_write_block(struct msb_data *msb,
10011001
u16 pba, u32 lba, struct scatterlist *sg, int offset)
10021002
{
@@ -1684,7 +1684,7 @@ static int msb_cache_read(struct msb_data *msb, int lba,
16841684
*/
16851685

16861686
static const struct chs_entry chs_table[] = {
1687-
/* size sectors cylynders heads */
1687+
/* size sectors cylinders heads */
16881688
{ 4, 16, 247, 2 },
16891689
{ 8, 16, 495, 2 },
16901690
{ 16, 16, 495, 4 },
@@ -1729,7 +1729,7 @@ static int msb_init_card(struct memstick_dev *card)
17291729

17301730
boot_block = &msb->boot_page[0];
17311731

1732-
/* Save intersting attributes from boot page */
1732+
/* Save interesting attributes from boot page */
17331733
msb->block_count = boot_block->attr.number_of_blocks;
17341734
msb->page_size = boot_block->attr.page_size;
17351735

@@ -2279,7 +2279,7 @@ static int msb_resume(struct memstick_dev *card)
22792279

22802280
#endif /* CONFIG_PM */
22812281

2282-
static struct memstick_device_id msb_id_tbl[] = {
2282+
static const struct memstick_device_id msb_id_tbl[] = {
22832283
{MEMSTICK_MATCH_ALL, MEMSTICK_TYPE_LEGACY, MEMSTICK_CATEGORY_STORAGE,
22842284
MEMSTICK_CLASS_FLASH},
22852285

drivers/memstick/core/mspro_block.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1349,7 +1349,7 @@ static int mspro_block_resume(struct memstick_dev *card)
13491349

13501350
#endif /* CONFIG_PM */
13511351

1352-
static struct memstick_device_id mspro_block_id_tbl[] = {
1352+
static const struct memstick_device_id mspro_block_id_tbl[] = {
13531353
{MEMSTICK_MATCH_ALL, MEMSTICK_TYPE_PRO, MEMSTICK_CATEGORY_STORAGE_DUO,
13541354
MEMSTICK_CLASS_DUO},
13551355
{}

drivers/memstick/host/r592.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -675,7 +675,7 @@ static irqreturn_t r592_irq(int irq, void *data)
675675
return ret;
676676
}
677677

678-
/* External inteface: set settings */
678+
/* External interface: set settings */
679679
static int r592_set_param(struct memstick_host *host,
680680
enum memstick_param param, int value)
681681
{

drivers/mmc/core/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ obj-$(CONFIG_MMC) += mmc_core.o
77
mmc_core-y := core.o bus.o host.o \
88
mmc.o mmc_ops.o sd.o sd_ops.o \
99
sdio.o sdio_ops.o sdio_bus.o \
10-
sdio_cis.o sdio_io.o sdio_irq.o \
10+
sdio_cis.o sdio_io.o sdio_irq.o sd_uhs2.o\
1111
slot-gpio.o regulator.o
1212
mmc_core-$(CONFIG_OF) += pwrseq.o
1313
obj-$(CONFIG_PWRSEQ_SIMPLE) += pwrseq_simple.o

drivers/mmc/core/block.c

Lines changed: 31 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
#include <linux/mmc/sd.h>
5151

5252
#include <linux/uaccess.h>
53+
#include <linux/unaligned.h>
5354

5455
#include "queue.h"
5556
#include "block.h"
@@ -993,11 +994,12 @@ static int mmc_sd_num_wr_blocks(struct mmc_card *card, u32 *written_blocks)
993994
int err;
994995
u32 result;
995996
__be32 *blocks;
997+
u8 resp_sz = mmc_card_ult_capacity(card) ? 8 : 4;
998+
unsigned int noio_flag;
996999

9971000
struct mmc_request mrq = {};
9981001
struct mmc_command cmd = {};
9991002
struct mmc_data data = {};
1000-
10011003
struct scatterlist sg;
10021004

10031005
err = mmc_app_cmd(card->host, card);
@@ -1008,7 +1010,7 @@ static int mmc_sd_num_wr_blocks(struct mmc_card *card, u32 *written_blocks)
10081010
cmd.arg = 0;
10091011
cmd.flags = MMC_RSP_SPI_R1 | MMC_RSP_R1 | MMC_CMD_ADTC;
10101012

1011-
data.blksz = 4;
1013+
data.blksz = resp_sz;
10121014
data.blocks = 1;
10131015
data.flags = MMC_DATA_READ;
10141016
data.sg = &sg;
@@ -1018,15 +1020,29 @@ static int mmc_sd_num_wr_blocks(struct mmc_card *card, u32 *written_blocks)
10181020
mrq.cmd = &cmd;
10191021
mrq.data = &data;
10201022

1021-
blocks = kmalloc(4, GFP_KERNEL);
1023+
noio_flag = memalloc_noio_save();
1024+
blocks = kmalloc(resp_sz, GFP_KERNEL);
1025+
memalloc_noio_restore(noio_flag);
10221026
if (!blocks)
10231027
return -ENOMEM;
10241028

1025-
sg_init_one(&sg, blocks, 4);
1029+
sg_init_one(&sg, blocks, resp_sz);
10261030

10271031
mmc_wait_for_req(card->host, &mrq);
10281032

1029-
result = ntohl(*blocks);
1033+
if (mmc_card_ult_capacity(card)) {
1034+
/*
1035+
* Normally, ACMD22 returns the number of written sectors as
1036+
* u32. SDUC, however, returns it as u64. This is not a
1037+
* superfluous requirement, because SDUC writes may exceed 2TB.
1038+
* For Linux mmc however, the previously write operation could
1039+
* not be more than the block layer limits, thus just make room
1040+
* for a u64 and cast the response back to u32.
1041+
*/
1042+
result = clamp_val(get_unaligned_be64(blocks), 0, UINT_MAX);
1043+
} else {
1044+
result = ntohl(*blocks);
1045+
}
10301046
kfree(blocks);
10311047

10321048
if (cmd.error || data.error)
@@ -1199,7 +1215,8 @@ static void mmc_blk_issue_erase_rq(struct mmc_queue *mq, struct request *req,
11991215
{
12001216
struct mmc_blk_data *md = mq->blkdata;
12011217
struct mmc_card *card = md->queue.card;
1202-
unsigned int from, nr;
1218+
unsigned int nr;
1219+
sector_t from;
12031220
int err = 0;
12041221
blk_status_t status = BLK_STS_OK;
12051222

@@ -1254,7 +1271,8 @@ static void mmc_blk_issue_secdiscard_rq(struct mmc_queue *mq,
12541271
{
12551272
struct mmc_blk_data *md = mq->blkdata;
12561273
struct mmc_card *card = md->queue.card;
1257-
unsigned int from, nr, arg;
1274+
unsigned int nr, arg;
1275+
sector_t from;
12581276
int err = 0, type = MMC_BLK_SECDISCARD;
12591277
blk_status_t status = BLK_STS_OK;
12601278

@@ -1759,6 +1777,11 @@ static void mmc_blk_rw_rq_prep(struct mmc_queue_req *mqrq,
17591777
brq->sbc.flags = MMC_RSP_R1 | MMC_CMD_AC;
17601778
brq->mrq.sbc = &brq->sbc;
17611779
}
1780+
1781+
if (mmc_card_ult_capacity(card)) {
1782+
brq->cmd.ext_addr = blk_rq_pos(req) >> 32;
1783+
brq->cmd.has_ext_addr = true;
1784+
}
17621785
}
17631786

17641787
#define MMC_MAX_RETRIES 5
@@ -2598,7 +2621,7 @@ static struct mmc_blk_data *mmc_blk_alloc_req(struct mmc_card *card,
25982621
if (mmc_host_cmd23(card->host)) {
25992622
if ((mmc_card_mmc(card) &&
26002623
card->csd.mmca_vsn >= CSD_SPEC_VER_3) ||
2601-
(mmc_card_sd(card) &&
2624+
(mmc_card_sd(card) && !mmc_card_ult_capacity(card) &&
26022625
card->scr.cmds & SD_SCR_CMD23_SUPPORT))
26032626
md->flags |= MMC_BLK_CMD23;
26042627
}

drivers/mmc/core/bus.c

Lines changed: 25 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,7 @@ int mmc_add_card(struct mmc_card *card)
299299
{
300300
int ret;
301301
const char *type;
302+
const char *speed_mode = "";
302303
const char *uhs_bus_speed_mode = "";
303304
static const char *const uhs_speeds[] = {
304305
[UHS_SDR12_BUS_SPEED] = "SDR12 ",
@@ -321,7 +322,9 @@ int mmc_add_card(struct mmc_card *card)
321322
case MMC_TYPE_SD:
322323
type = "SD";
323324
if (mmc_card_blockaddr(card)) {
324-
if (mmc_card_ext_capacity(card))
325+
if (mmc_card_ult_capacity(card))
326+
type = "SDUC";
327+
else if (mmc_card_ext_capacity(card))
325328
type = "SDXC";
326329
else
327330
type = "SDHC";
@@ -340,27 +343,32 @@ int mmc_add_card(struct mmc_card *card)
340343
break;
341344
}
342345

346+
if (mmc_card_hs(card))
347+
speed_mode = "high speed ";
348+
else if (mmc_card_uhs(card))
349+
speed_mode = "UHS-I speed ";
350+
else if (mmc_card_uhs2(card->host))
351+
speed_mode = "UHS-II speed ";
352+
else if (mmc_card_ddr52(card))
353+
speed_mode = "high speed DDR ";
354+
else if (mmc_card_hs200(card))
355+
speed_mode = "HS200 ";
356+
else if (mmc_card_hs400es(card))
357+
speed_mode = "HS400 Enhanced strobe ";
358+
else if (mmc_card_hs400(card))
359+
speed_mode = "HS400 ";
360+
343361
if (mmc_card_uhs(card) &&
344362
(card->sd_bus_speed < ARRAY_SIZE(uhs_speeds)))
345363
uhs_bus_speed_mode = uhs_speeds[card->sd_bus_speed];
346364

347-
if (mmc_host_is_spi(card->host)) {
348-
pr_info("%s: new %s%s%s card on SPI\n",
349-
mmc_hostname(card->host),
350-
mmc_card_hs(card) ? "high speed " : "",
351-
mmc_card_ddr52(card) ? "DDR " : "",
352-
type);
353-
} else {
354-
pr_info("%s: new %s%s%s%s%s%s card at address %04x\n",
355-
mmc_hostname(card->host),
356-
mmc_card_uhs(card) ? "ultra high speed " :
357-
(mmc_card_hs(card) ? "high speed " : ""),
358-
mmc_card_hs400(card) ? "HS400 " :
359-
(mmc_card_hs200(card) ? "HS200 " : ""),
360-
mmc_card_hs400es(card) ? "Enhanced strobe " : "",
361-
mmc_card_ddr52(card) ? "DDR " : "",
365+
if (mmc_host_is_spi(card->host))
366+
pr_info("%s: new %s%s card on SPI\n",
367+
mmc_hostname(card->host), speed_mode, type);
368+
else
369+
pr_info("%s: new %s%s%s card at address %04x\n",
370+
mmc_hostname(card->host), speed_mode,
362371
uhs_bus_speed_mode, type, card->rca);
363-
}
364372

365373
mmc_add_card_debugfs(card);
366374
card->dev.of_node = mmc_of_find_child_device(card->host, 0);

0 commit comments

Comments
 (0)