Skip to content

Fixes mmc_spi on C1 #113

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions arch/arm/boot/dts/meson8b_odroidc.dts
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,13 @@
num_chipselect = <2>;
cs_gpios = "GPIOX_20", "GPIOX_21";

mmc-slot@0 {
compatible = "mmc-spi-slot";
reg = <0x0>;
spi-max-frequency = <2000000>;
voltage-ranges = <3300 3300>;
};

spidev@0 {
spi-max-frequency = <2000000>;
compatible = "spidev";
Expand Down
25 changes: 12 additions & 13 deletions drivers/mmc/card/block.c
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,10 @@ enum {
MMC_PACKED_NR_SINGLE,
};

#if defined(CONFIG_MACH_MESON8B_ODROIDC)
#define AML_SDHC_RESERVED_IDX 0
#endif

module_param(perdev_minors, int, 0444);
MODULE_PARM_DESC(perdev_minors, "Minors numbers to allocate per device");

Expand Down Expand Up @@ -2205,25 +2209,16 @@ static struct mmc_blk_data *mmc_blk_alloc_req(struct mmc_card *card,
*/
#if defined(CONFIG_MACH_MESON8B_ODROIDC)
if (strncmp(dev_name(mmc_dev(card->host)), "aml_sdhc.0", 8) == 0) {
md->name_idx = 0;
__set_bit(md->name_idx, name_use);
} else if (strncmp(dev_name(mmc_dev(card->host)), "aml_sdio.0", 8) == 0) {
if (!subname) {
md->name_idx = find_first_zero_bit(name_use, max_devices);
__set_bit(md->name_idx, name_use);
} else {
md->name_idx = ((struct mmc_blk_data *)
dev_to_disk(parent)->private_data)->name_idx;
}
}
#else
md->name_idx = AML_SDHC_RESERVED_IDX;
} else
#endif
if (!subname) {
md->name_idx = find_first_zero_bit(name_use, max_devices);
__set_bit(md->name_idx, name_use);
} else
md->name_idx = ((struct mmc_blk_data *)
dev_to_disk(parent)->private_data)->name_idx;
#endif

md->area_type = area_type;

/*
Expand Down Expand Up @@ -2660,6 +2655,10 @@ static int __init mmc_blk_init(void)
{
int res;

#if defined(CONFIG_MACH_MESON8B_ODROIDC)
__set_bit(AML_SDHC_RESERVED_IDX, name_use);
#endif

if (perdev_minors != CONFIG_MMC_BLOCK_MINORS)
pr_info("mmcblk: using %d minors per device\n", perdev_minors);

Expand Down
4 changes: 4 additions & 0 deletions drivers/mmc/host/mmc_spi.c
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ struct mmc_spi_host {
dma_addr_t ones_dma;
};

static struct mmc_claim mmc_spi_claim;

/****************************************************************************/

Expand Down Expand Up @@ -1365,6 +1366,9 @@ static int mmc_spi_probe(struct spi_device *spi)
if (!mmc)
goto nomem;

spin_lock_init(&mmc_spi_claim.lock);
init_waitqueue_head(&mmc_spi_claim.wq);
mmc->alldev_claim = &mmc_spi_claim;
mmc->ops = &mmc_spi_ops;
mmc->max_blk_size = MMC_SPI_BLOCKSIZE;
mmc->max_segs = MMC_SPI_BLOCKSATONCE;
Expand Down