Skip to content
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

fixed the MMC can not be partitioned #248

Open
wants to merge 1 commit into
base: develop-4.19
Choose a base branch
from
Open
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
11 changes: 11 additions & 0 deletions block/partitions/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,17 @@ config SYSV68_PARTITION
sysv68).
Otherwise, say N.

config RK_PARTITION
bool "Rockchip partition table support" if PARTITION_ADVANCED
default y if ARCH_ROCKCHIP
---help---
Like most systems, Rockchip use its own hard disk partition table
format, incompatible with all others. Say Y here if you would like
to be able to read the hard disk partition table format used by
Rockchip SoCs inside machines with eMMC as main storage disk.
Otherwise, say N.


config CMDLINE_PARTITION
bool "Command line partition support" if PARTITION_ADVANCED
select BLK_CMDLINE_PARSER
Expand Down
1 change: 1 addition & 0 deletions block/partitions/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ obj-$(CONFIG_ACORN_PARTITION) += acorn.o
obj-$(CONFIG_AMIGA_PARTITION) += amiga.o
obj-$(CONFIG_ATARI_PARTITION) += atari.o
obj-$(CONFIG_AIX_PARTITION) += aix.o
obj-$(CONFIG_RK_PARTITION) += rk.o
obj-$(CONFIG_CMDLINE_PARTITION) += cmdline.o
obj-$(CONFIG_MAC_PARTITION) += mac.o
obj-$(CONFIG_LDM_PARTITION) += ldm.o
Expand Down
5 changes: 5 additions & 0 deletions block/partitions/check.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
#include "karma.h"
#include "sysv68.h"
#include "cmdline.h"
#include "rk.h"

int warn_no_part = 1; /*This is ugly: should make genhd removable media aware*/

Expand Down Expand Up @@ -67,6 +68,10 @@ static int (*check_part[])(struct parsed_partitions *) = {
adfspart_check_ADFS,
#endif

#ifdef CONFIG_RK_PARTITION
rkpart_partition,
#endif

#ifdef CONFIG_CMDLINE_PARTITION
cmdline_partition,
#endif
Expand Down
10 changes: 8 additions & 2 deletions drivers/mmc/core/block.c
Original file line number Diff line number Diff line change
Expand Up @@ -2914,8 +2914,14 @@ static int mmc_blk_probe(struct mmc_card *card)
dev_set_drvdata(&card->dev, md);

#if IS_ENABLED(CONFIG_MMC_DW_ROCKCHIP) || IS_ENABLED(CONFIG_MMC_SDHCI_OF_ARASAN)
if (card->host->restrict_caps & RESTRICT_CARD_TYPE_EMMC)
this_card = card;
/*if (card->host->restrict_caps & RESTRICT_CARD_TYPE_EMMC)
this_card = card;*/
if (card->host->restrict_caps & RESTRICT_CARD_TYPE_EMMC) {
this_card = card;
md->disk->is_rk_disk = true;
} else {
md->disk->is_rk_disk = false;
}
#endif

if (mmc_add_disk(md))
Expand Down
10 changes: 7 additions & 3 deletions fs/block_dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -1519,9 +1519,13 @@ static int __blkdev_get(struct block_device *bdev, fmode_t mode, int for_part)
* The latter is necessary to prevent ghost
* partitions on a removed medium.
*/
if (bdev->bd_invalidated &&
(!ret || ret == -ENOMEDIUM))
bdev_disk_changed(bdev, ret == -ENOMEDIUM);
if (bdev->bd_invalidated){
if (!ret){
rescan_partitions(disk, bdev);
}
else if (ret == -ENOMEDIUM)
bdev_disk_changed(bdev, ret == -ENOMEDIUM);
}

if (ret)
goto out_clear;
Expand Down
4 changes: 3 additions & 1 deletion include/linux/genhd.h
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,9 @@ struct gendisk {
const struct block_device_operations *fops;
struct request_queue *queue;
void *private_data;


/* Flag of rockchip specific disk: eMMC/eSD, NVMe, etc. */
bool is_rk_disk;
int flags;
struct rw_semaphore lookup_sem;
struct kobject *slave_dir;
Expand Down