[ 1.146254] rockchip-iodomain ff770000.syscon:io-domains: Setting to 3000000 done
[ 1.146256] CPU: 5 PID: 45 Comm: kworker/5:1 Not tainted 4.4.227-g334d0b436-dirty #25
[ 1.146256] Hardware name: Pine64 RockPro64 (DT)
[ 1.146259] Workqueue: events_freezable mmc_rescan
[ 1.146260] Call trace:
[ 1.146262] [<ffffff8008088288>] dump_backtrace+0x0/0x220
[ 1.146264] [<ffffff80080884cc>] show_stack+0x24/0x30
[ 1.146266] [<ffffff80084149 b8>] dump_stack+0xa0/0xc8
[ 1.146268] [<ffffff800847461c>] rockchip_iodomain_notify+0xa4/0xf0
[ 1.146270] [<ffffff80080d4ee4>] notifier_call_chain+0x70/0x90
[ 1.146272] [<ffffff80080d5368>] __blocking_notifier_call_chain+0x58/0x84
[ 1.146274] [<ffffff80080d53d0>] blocking_notifier_call_chain+0x3c/0x4c
[ 1.146276] [<ffffff800850ff7c>] _regulator_do_set_voltage+0x1fc/0x3e0
[ 1.146277] [<ffffff8008510318>] regulator_set_voltage_unlocked+0x1b8/0x200
[ 1.146279] [<ffffff800851039c>] regulator_set_voltage+0x3c/0x5c
[ 1.146281] [<ffffff8008c5c16c>] mmc_regulator_set_ocr+0x54/0xe4
[ 1.146283] [<ffffff8008c7ac74>] dw_mci_set_ios+0x10c/0x23c
[ 1.146285] [<ffffff8008c5c9fc>] mmc_set_initial_state+0xe0/0xf8
[ 1.146286] [<ffffff8008c5cf68>] mmc_power_up+0x5c/0x164
[ 1.146288] [<ffffff8008c5d314>] mmc_power_cycle+0x3c/0x48
[ 1.146290 ] [<ffffff8008c64800>] mmc_sd_init_card+0x2b8/0x2e4
[ 1.146292] [<ffffff8008c64ac0>] mmc_attach_sd+0xe4/0x13c
[ 1.146294] [<ffffff8008c5dbd4>] mmc_rescan+0x288/0x2d8
[ 1.146296] [<ffffff80080ce0c0>] process_one_work+0x218/0x370
[ 1.146298] [<ffffff80080cef84>] worker_thread+0x2e0/0x3a0
[ 1.146300] [<ffffff80080d3ea4>] kthread+0xdc/0xec
[ 1.146302] [<ffffff8008082ef0>] ret_from_fork+0x10/0x20
mmc_set_initial_signal_voltage(host);
drivers/mmc/host/dw_mmc-rockchip.c static int dw_mci_rockchip_probe(struct platform_device *pdev)
drivers/mmc/host/dw_mmc-rockchip.c:380: return dw_mci_pltfm_register(pdev, drv_data);
drivers/mmc/host/dw_mmc-pltfm.c int dw_mci_pltfm_register(struct platform_device *pdev,
drivers/mmc/host/dw_mmc-pltfm.c:70: return dw_mci_probe(host);
drivers/mmc/host/dw_mmc.c int dw_mci_probe(struct dw_mci *host)
drivers/mmc/host/dw_mmc.c static int dw_mci_init_slot(struct dw_mci *host, unsigned int id)
drivers/mmc/host/dw_mmc.c:2757: mmc = mmc_alloc_host(sizeof(struct dw_mci_slot), host->dev);
drivers/mmc/core/host.c struct mmc_host *mmc_alloc_host(int extra, struct device *dev)
drivers/mmc/core/host.c:369: INIT_DELAYED_WORK(&host->detect, mmc_rescan);
drivers/mmc/core/host.c 里面是是通用接口函数 mmc 流程中
drivers/mmc/core/core.c:2647:void mmc_rescan(struct work_struct *work)
drivers/mmc/core/core.c--void mmc_rescan(struct work_struct *work)
drivers/mmc/core/core.c--static int mmc_rescan_try_freq(struct mmc_host *host, unsigned freq)
drivers/mmc/core/sd.c:1370:int mmc_attach_sd(struct mmc_host *host)
drivers/mmc/core/sd.c:939:static int mmc_sd_init_card(struct mmc_host *host, u32 ocr, struct mmc_card *oldcard) 1.8v
drivers/mmc/core/core.c:1828:void mmc_power_cycle(struct mmc_host *host, u32 ocr)
drivers/mmc/core/core.c 1764: void mmc_power_up(struct mmc_host *host, u32 ocr)
drivers/mmc/core/core.c1776 mmc_set_initial_signal_voltage(host);
drivers/mmc/core/core.c 1065 mmc_set_ios(host);
drivers/mmc/host/dw_mmc.c 1363 static void dw_mci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
ret = mmc_regulator_set_ocr(mmc, mmc->supply.vmmc,
drivers/mmc/core/core.c 1408 int mmc_regulator_set_ocr(struct mmc_host *mmc,
result = regulator_set_voltage(supply, min_uV, max_uV);
drivers/regulator/core.c:3112 int regulator_set_voltage(struct regulator *regulator, int min_uV, int max_uV)
2981 static int regulator_set_voltage_unlocked(struct regulator *regulator,int min_uV, int max_uV)
2874 static int _regulator_do_set_voltage(struct regulator_dev *rdev, int min_uV, int max_uV)
3597 static int _notifier_call_chain(struct regulator_dev *rdev,
kernel/notifier.c 325:int blocking_notifier_call_chain(struct blocking_notifier_head *nh,
304 int __blocking_notifier_call_chain(struct blocking_notifier_head *nh,
74 static int notifier_call_chain(struct notifier_block **nl,
drivers/power/avs/rockchip-io-domain.c supply->nb.notifier_call = rockchip_iodomain_notify;
1585 void mmc_set_initial_signal_voltage(struct mmc_host *host)
1619 int mmc_set_signal_voltage(struct mmc_host *host, int signal_voltage)
err = host->ops->start_signal_voltage_switch(host, &host->ios);
drivers/mmc/host/dw_mmc.c static int dw_mci_switch_voltage(struct mmc_host *mmc, struct mmc_ios *ios)
mmc 注册流程
module_platform_driver(dw_mci_rockchip_pltfm_driver);
static int dw_mci_rockchip_probe(struct platform_device *pdev)
dw_mci_pltfm_register(pdev, drv_data);
一些平台资源申请接下来
dw_mci_probe(host);
dw_mci_parse_dt(host);
devm_reset_control_get_optional(dev, "reset");
of_property_read_u32(dev->of_node, "num-slots"
of_property_read_u32(np, "card-detect-delay", &pdata->detect_delay_ms);
of_property_read_u32(np, "clock-frequency", &clock_frequency)
of_find_property(np, "supports-highspeed", NULL)
dw_mci_cto_timer
dw_mci_init_slot(host, i);
mmc_alloc_host(sizeof(struct dw_mci_slot), host->dev);
INIT_DELAYED_WORK(&host->detect, mmc_rescan);(这里只初始化 ,后面会有调用过程)
mmc_regulator_get_supply(mmc);
mmc->supply.vmmc = devm_regulator_get_optional(dev, "vmmc");
mmc->supply.vqmmc = devm_regulator_get_optional(dev, "vqmmc");
dw_mci_slot_of_parse(slot);
of_property_read_bool(np, "disable-wp")
mmc_of_parse(mmc) // 设备树 的核心函数
dw_mci_get_cd(mmc);
mmc_gpio_get_cd(mmc);
gpiod_get_value_cansleep(ctx->cd_gpio); // 平台sd卡检测
mmc_add_host(mmc);
device_add(&host->class_dev);
mmc_start_host(host);
_mmc_detect_change(host, 0, false);
mmc_schedule_delayed_work(&host->detect, delay);
前面初始化的 work -》 void mmc_rescan(struct work_struct *work)
mmc_rescan(struct work_struct *work)
mmc_rescan_try_freq(host, max(freqs[i], host->f_min))
mmc_power_up(host, host->ocr_avail);
mmc_set_initial_signal_voltage(host);
mmc_set_signal_voltage(struct mmc_host *host, int signal_voltage)
host->ios.signal_voltage = old_signal_voltage;
mmc_attach_sd(host)
mmc_send_app_op_cond(host, 0, &ocr);
mmc_wait_for_app_cmd(host, NULL, &cmd, MMC_CMD_RETRIES)
:#define SD_APP_OP_COND 41
mmc_select_voltage(host, ocr);
mmc_sd_init_card
mmc_sd_get_cid(host, ocr, cid, &rocr);
mmc_go_idle(host);
mmc_wait_for_cmd(host, &cmd, 0); (CMD0)
mmc_send_if_cond( ) (CMD8)
mmc_host_uhs(host)
mmc_send_app_op_cond(host, ocr, rocr)
-> mmc_set_uhs_voltage(host, MMC_SIGNAL_VOLTAGE_180
mmc_wait_for_cmd(host, &cmd, 0); (CMD11)
mmc_wait_for_req(host, &mrq);
mmc_host_set_uhs_voltage(host, signal_voltage)
mmc_delay(1);
mmc_power_cycle(host, ocr);
mmc_power_off(host);
/* Wait at least 1 ms according to SD spec */
mmc_delay(1);
mmc_power_up(host, ocr);
mmc_set_initial_signal_voltage(host);
mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_180/3.3v)
mmc_sd_get_csd(host, card);
mmc_send_csd(card, card->raw_csd);
mmc_select_card(card);
_mmc_select_card(card->host, card) ;
mmc_sd_card_using_v18(card)
mmc_read_switch(card);
mmc_sd_switch(card, 0, 0, 0, status); CMD6
mmc_sd_card_using_v18(card)
mmc_host_set_uhs_voltage(host, MMC_SIGNAL_VOLTAGE_180)
mmc_sd_init_uhs_card(card)
mmc_set_ios(host);
host->ops->set_ios(host, ios);
mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_180)
mmc_delay(10);
mmc_set_ios(host);
如果异常重新上电 mmc_power_cycle(host, ocr);
如果dts没有配置告诉 但是 rocr & SD_ROCR_S18A 卡回复了支持 超高速仍会设置 mmc_sd_init_uhs_card(card)
#define SD_ROCR_S18A SD_OCR_S18R /* 1.8V switching accepted by card */
否则 mmc_sd_switch_hs(card); 尝试切换到高速模式 mmc_set_timing(card->host, MMC_TIMING_SD_HS);
mmc_set_clock(host, mmc_sd_get_max_clock(card));
如上 插入 sd 卡的 log
# dmesg -c
[ 247.522189] [1: kworker/1:2: 177] mmc_power_up
[ 247.522219] [1: kworker/1:2: 177] mmc_set_initial_state
[ 247.522232] [1: kworker/1:2: 177] CPU: 1 PID: 177 Comm: kworker/1:2 Not tainted 4.4.227-g245d34e4a-dirty #89
[ 247.522239] [1: kworker/1:2: 177] Hardware name: Pine64 RockPro64 (DT)
[ 247.522264] [1: kworker/1:2: 177] Workqueue: events_freezable mmc_rescan
[ 247.522274] [1: kworker/1:2: 177] Call trace:
[ 247.522291] [1: kworker/1:2: 177] [<ffffff8008088288>] dump_backtrace+0x0/0x220
[ 247.522302] [1: kworker/1:2: 177] [<ffffff80080884cc>] show_stack+0x24/0x30
[ 247.522316] [1: kworker/1:2: 177] [<ffffff8008414ab8>] dump_stack+0xa0/0xc8
[ 247.522326] [1: kworker/1:2: 177] [<ffffff8008c5c9fc>] mmc_set_initial_state+0x80/0xec
[ 247.522335] [1: kworker/1:2: 177] [<ffffff8008c5cf70>] mmc_power_up+0x68/0x15c
[ 247.522345] [1: kworker/1:2: 177] [<ffffff8008c5db7c>] mmc_rescan+0x224/0x2d8
[ 247.522357] [1: kworker/1:2: 177] [<ffffff80080ce0c0>] process_one_work+0x218/0x370
[ 247.522369] [1: kworker/1:2: 177] [<ffffff80080cef84>] worker_thread+0x2e0/0x3a0
[ 247.522382] [1: kworker/1:2: 177] [<ffffff80080d3ea4>] kthread+0xdc/0xec
[ 247.522391] [1: kworker/1:2: 177] [<ffffff8008082ef0>] ret_from_fork+0x10/0x20
[ 247.522400] [1: kworker/1:2: 177] mmc1: clock 0Hz busmode 2 powermode 1 cs 0 Vdd 21 width 1 timing 0
[ 247.522408] [1: kworker/1:2: 177] dw_mci_set_ios
[ 247.522416] [1: kworker/1:2: 177] dw_mci_rk3288_set_ios
[ 247.522423] [1: kworker/1:2: 177] MMC_POWER_UP vmmc
[ 247.522431] [1: kworker/1:2: 177] dw_mci_switch_voltage
[ 247.522439] [1: kworker/1:2: 177] mmc_regulator_set_vqmmc 0
[ 247.522446] [1: kworker/1:2: 177] mmc_regulator_set_vqmmc ++0
[ 247.522454] [1: kworker/1:2: 177] mmc_regulator_set_vqmmc: found vmmc voltage range of 3300000-3400000uV
[ 247.522462] [1: kworker/1:2: 177] mmc_regulator_set_voltage_if_supported 3000000 3300000 3600000
[ 247.522474] [1: kworker/1:2: 177] mmc_regulator_set_voltage_if_supported 3000000 3300000 3600000 ok
[ 247.522481] [1: kworker/1:2: 177] regulator_set_voltage 3300000 3600000
[ 247.522489] [1: kworker/1:2: 177] regulator_set_voltage_unlocked 3300000 3600000
[ 247.522498] [1: kworker/1:2: 177] regulator_check_voltage min_uV=3300000 max_uV=3600000
[ 247.522506] [1: kworker/1:2: 177] regulator_check_voltage ccmin_uV=1800000 ccmax_uV=3000000
[ 247.522513] [1: kworker/1:2: 177] regulator_check_voltage min_uV=3300000 max_uV=3000000
[ 247.522521] [1: kworker/1:2: 177] ppvar_sd_card_io: unsupportable voltage range: 3300000-3000000uV
[ 247.522529] [1: kworker/1:2: 177] regulator_set_voltage 3000000 3600000
[ 247.522536] [1: kworker/1:2: 177] regulator_set_voltage_unlocked 3000000 3600000
[ 247.522544] [1: kworker/1:2: 177] regulator_check_voltage min_uV=3000000 max_uV=3600000
[ 247.522551] [1: kworker/1:2: 177] regulator_check_voltage ccmin_uV=1800000 ccmax_uV=3000000
[ 247.522558] [1: kworker/1:2: 177] regulator_check_voltage min_uV=3000000 max_uV=3000000
[ 247.522566] [1: kworker/1:2: 177] regulator_check_consumers min_uV=3000000 max_uV=3000000
[ 247.522573] [1: kworker/1:2: 177] regulator_check_consumers ccmin_uV=1800000 ccmax_uV=3000000
[ 247.522581] [1: kworker/1:2: 177] aa regulator_check_consumers min_uV=3000000 max_uV=3000000
[ 247.522588] [1: kworker/1:2: 177] aa regulator_check_consumers ccmin_uV=1800000 ccmax_uV=3000000
[ 247.522596] [1: kworker/1:2: 177] bb regulator_check_consumers fe310000.dwmmc-vqmmc ccmin_uV=3000000 ccmax_uV=3000000
[ 247.522603] [1: kworker/1:2: 177] regulator_check_consumers min_uV=3000000 max_uV=3000000
[ 247.522621] [1: kworker/1:2: 177] regulator gpio 155 = set 0 (我这个项目 通过gpio 控制ldo 控制电压切换的)
[ 247.522635] [1: kworker/1:2: 177] dwmmc_rockchip fe310000.dwmmc: Initial signal voltage of 3.3v
[ 247.535173] [1: kworker/1:2: 177] CPU: 1 PID: 177 Comm: kworker/1:2 Not tainted 4.4.227-g245d34e4a-dirty #89
[ 247.535192] [1: kworker/1:2: 177] Hardware name: Pine64 RockPro64 (DT)
[ 247.535210] [1: kworker/1:2: 177] Workqueue: events_freezable mmc_rescan
[ 247.535220] [1: kworker/1:2: 177] Call trace:
[ 247.535234] [1: kworker/1:2: 177] [<ffffff8008088288>] dump_backtrace+0x0/0x220
[ 247.535245] [1: kworker/1:2: 177] [<ffffff80080884cc>] show_stack+0x24/0x30
[ 247.535257] [1: kworker/1:2: 177] [<ffffff8008414ab8>] dump_stack+0xa0/0xc8
[ 247.535266] [1: kworker/1:2: 177] [<ffffff8008c5cfc0>] mmc_power_up+0xb8/0x15c
[ 247.535275] [1: kworker/1:2: 177] [<ffffff8008c5db7c>] mmc_rescan+0x224/0x2d8
[ 247.535286] [1: kworker/1:2: 177] [<ffffff80080ce0c0>] process_one_work+0x218/0x370
[ 247.535295] [1: kworker/1:2: 177] [<ffffff80080cef84>] worker_thread+0x2e0/0x3a0
[ 247.535307] [1: kworker/1:2: 177] [<ffffff80080d3ea4>] kthread+0xdc/0xec
[ 247.535316] [1: kworker/1:2: 177] [<ffffff8008082ef0>] ret_from_fork+0x10/0x20
[ 247.535326] [1: kworker/1:2: 177] mmc1: clock 400000Hz busmode 2 powermode 2 cs 0 Vdd 21 width 1 timing 0
[ 247.535333] [1: kworker/1:2: 177] dw_mci_set_ios
[ 247.535342] [1: kworker/1:2: 177] dw_mci_rk3288_set_ios
[ 247.535352] [1: kworker/1:2: 177] MMC_POWER_ON vqmmc
[ 247.547981] [1: kworker/1:2: 177] CPU: 1 PID: 177 Comm: kworker/1:2 Not tainted 4.4.227-g245d34e4a-dirty #89
[ 247.547999] [1: kworker/1:2: 177] Hardware name: Pine64 RockPro64 (DT)
[ 247.548017] [1: kworker/1:2: 177] Workqueue: events_freezable mmc_rescan
[ 247.548027] [1: kworker/1:2: 177] Call trace:
[ 247.548040] [1: kworker/1:2: 177] [<ffffff8008088288>] dump_backtrace+0x0/0x220
[ 247.548050] [1: kworker/1:2: 177] [<ffffff80080884cc>] show_stack+0x24/0x30
[ 247.548062] [1: kworker/1:2: 177] [<ffffff8008414ab8>] dump_stack+0xa0/0xc8
[ 247.548071] [1: kworker/1:2: 177] [<ffffff8008c5c6a4>] mmc_set_chip_select+0x2c/0x90
[ 247.548082] [1: kworker/1:2: 177] [<ffffff8008c626d4>] mmc_go_idle+0x3c/0xb0
[ 247.548091] [1: kworker/1:2: 177] [<ffffff8008c5dbb0>] mmc_rescan+0x258/0x2d8
[ 247.548102] [1: kworker/1:2: 177] [<ffffff80080ce0c0>] process_one_work+0x218/0x370
[ 247.548112] [1: kworker/1:2: 177] [<ffffff80080cef84>] worker_thread+0x2e0/0x3a0
[ 247.548123] [1: kworker/1:2: 177] [<ffffff80080d3ea4>] kthread+0xdc/0xec
[ 247.548132] [1: kworker/1:2: 177] [<ffffff8008082ef0>] ret_from_fork+0x10/0x20
[ 247.548166] [1: kworker/1:2: 177] mmc1: clock 400000Hz busmode 2 powermode 2 cs 1 Vdd 21 width 1 timing 0
[ 247.548174] [1: kworker/1:2: 177] dw_mci_set_ios
[ 247.548182] [1: kworker/1:2: 177] dw_mci_rk3288_set_ios
[ 247.548194] [1: kworker/1:2: 177] MMC_POWER_ON vqmmc
[ 247.551198] [1: kworker/1:2: 177] CPU: 1 PID: 177 Comm: kworker/1:2 Not tainted 4.4.227-g245d34e4a-dirty #89
[ 247.551209] [1: kworker/1:2: 177] Hardware name: Pine64 RockPro64 (DT)
[ 247.551220] [1: kworker/1:2: 177] Workqueue: events_freezable mmc_rescan
[ 247.551229] [1: kworker/1:2: 177] Call trace:
[ 247.551239] [1: kworker/1:2: 177] [<ffffff8008088288>] dump_backtrace+0x0/0x220
[ 247.551249] [1: kworker/1:2: 177] [<ffffff80080884cc>] show_stack+0x24/0x30
[ 247.551260] [1: kworker/1:2: 177] [<ffffff8008414ab8>] dump_stack+0xa0/0xc8
[ 247.551269] [1: kworker/1:2: 177] [<ffffff8008c5c6a4>] mmc_set_chip_select+0x2c/0x90
[ 247.551280] [1: kworker/1:2: 177] [<ffffff8008c62720>] mmc_go_idle+0x88/0xb0
[ 247.551288] [1: kworker/1:2: 177] [<ffffff8008c5dbb0>] mmc_rescan+0x258/0x2d8
[ 247.551298] [1: kworker/1:2: 177] [<ffffff80080ce0c0>] process_one_work+0x218/0x370
[ 247.551308] [1: kworker/1:2: 177] [<ffffff80080cef84>] worker_thread+0x2e0/0x3a0
[ 247.551317] [1: kworker/1:2: 177] [<ffffff80080d3ea4>] kthread+0xdc/0xec
[ 247.551326] [1: kworker/1:2: 177] [<ffffff8008082ef0>] ret_from_fork+0x10/0x20
[ 247.551336] [1: kworker/1:2: 177] mmc1: clock 400000Hz busmode 2 powermode 2 cs 0 Vdd 21 width 1 timing 0
[ 247.551343] [1: kworker/1:2: 177] dw_mci_set_ios
[ 247.551350] [1: kworker/1:2: 177] dw_mci_rk3288_set_ios
[ 247.551359] [1: kworker/1:2: 177] MMC_POWER_ON vqmmc
[ 247.552992] [1: kworker/1:2: 177] mmc_attach_sd
[ 247.553681] [1: kworker/1:2: 177] mmc_select_voltage
[ 247.553695] [1: kworker/1:2: 177] CPU: 1 PID: 177 Comm: kworker/1:2 Not tainted 4.4.227-g245d34e4a-dirty #89
[ 247.553703] [1: kworker/1:2: 177] Hardware name: Pine64 RockPro64 (DT)
[ 247.553717] [1: kworker/1:2: 177] Workqueue: events_freezable mmc_rescan
[ 247.553727] [1: kworker/1:2: 177] Call trace:
[ 247.553739] [1: kworker/1:2: 177] [<ffffff8008088288>] dump_backtrace+0x0/0x220
[ 247.553749] [1: kworker/1:2: 177] [<ffffff80080884cc>] show_stack+0x24/0x30
[ 247.553760] [1: kworker/1:2: 177] [<ffffff8008414ab8>] dump_stack+0xa0/0xc8
[ 247.553769] [1: kworker/1:2: 177] [<ffffff8008c5c6a4>] mmc_set_chip_select+0x2c/0x90
[ 247.553780] [1: kworker/1:2: 177] [<ffffff8008c626d4>] mmc_go_idle+0x3c/0xb0
[ 247.553790] [1: kworker/1:2: 177] [<ffffff8008c63bac>] mmc_sd_get_cid+0x4c/0x144
[ 247.553800] [1: kworker/1:2: 177] [<ffffff8008c64214>] mmc_sd_init_card+0x68/0x304
[ 247.553810] [1: kworker/1:2: 177] [<ffffff8008c64750>] mmc_attach_sd+0xf0/0x148
[ 247.553819] [1: kworker/1:2: 177] [<ffffff8008c5dbe0>] mmc_rescan+0x288/0x2d8
[ 247.553829] [1: kworker/1:2: 177] [<ffffff80080ce0c0>] process_one_work+0x218/0x370
[ 247.553838] [1: kworker/1:2: 177] [<ffffff80080cef84>] worker_thread+0x2e0/0x3a0
[ 247.553848] [1: kworker/1:2: 177] [<ffffff80080d3ea4>] kthread+0xdc/0xec
[ 247.553857] [1: kworker/1:2: 177] [<ffffff8008082ef0>] ret_from_fork+0x10/0x20
[ 247.553867] [1: kworker/1:2: 177] mmc1: clock 400000Hz busmode 2 powermode 2 cs 1 Vdd 21 width 1 timing 0
[ 247.553874] [1: kworker/1:2: 177] dw_mci_set_ios
[ 247.553881] [1: kworker/1:2: 177] dw_mci_rk3288_set_ios
[ 247.553891] [1: kworker/1:2: 177] MMC_POWER_ON vqmmc
[ 247.556486] [1: kworker/1:2: 177] CPU: 1 PID: 177 Comm: kworker/1:2 Not tainted 4.4.227-g245d34e4a-dirty #89
[ 247.556501] [1: kworker/1:2: 177] Hardware name: Pine64 RockPro64 (DT)
[ 247.556519] [1: kworker/1:2: 177] Workqueue: events_freezable mmc_rescan
[ 247.556531] [1: kworker/1:2: 177] Call trace:
[ 247.556545] [1: kworker/1:2: 177] [<ffffff8008088288>] dump_backtrace+0x0/0x220
[ 247.556557] [1: kworker/1:2: 177] [<ffffff80080884cc>] show_stack+0x24/0x30
[ 247.556569] [1: kworker/1:2: 177] [<ffffff8008414ab8>] dump_stack+0xa0/0xc8
[ 247.556580] [1: kworker/1:2: 177] [<ffffff8008c5c6a4>] mmc_set_chip_select+0x2c/0x90
[ 247.556592] [1: kworker/1:2: 177] [<ffffff8008c62720>] mmc_go_idle+0x88/0xb0
[ 247.556602] [1: kworker/1:2: 177] [<ffffff8008c63bac>] mmc_sd_get_cid+0x4c/0x144
[ 247.556614] [1: kworker/1:2: 177] [<ffffff8008c64214>] mmc_sd_init_card+0x68/0x304
[ 247.556624] [1: kworker/1:2: 177] [<ffffff8008c64750>] mmc_attach_sd+0xf0/0x148
[ 247.556633] [1: kworker/1:2: 177] [<ffffff8008c5dbe0>] mmc_rescan+0x288/0x2d8
[ 247.556643] [1: kworker/1:2: 177] [<ffffff80080ce0c0>] process_one_work+0x218/0x370
[ 247.556654] [1: kworker/1:2: 177] [<ffffff80080cef84>] worker_thread+0x2e0/0x3a0
[ 247.556665] [1: kworker/1:2: 177] [<ffffff80080d3ea4>] kthread+0xdc/0xec
[ 247.556677] [1: kworker/1:2: 177] [<ffffff8008082ef0>] ret_from_fork+0x10/0x20
[ 247.556687] [1: kworker/1:2: 177] mmc1: clock 400000Hz busmode 2 powermode 2 cs 0 Vdd 21 width 1 timing 0
[ 247.556695] [1: kworker/1:2: 177] dw_mci_set_ios
[ 247.556702] [1: kworker/1:2: 177] dw_mci_rk3288_set_ios
[ 247.556714] [1: kworker/1:2: 177] MMC_POWER_ON vqmmc
[ 247.626469] [1: kworker/1:2: 177] mmc_host_set_uhs_voltage
[ 247.626495] [1: kworker/1:2: 177] CPU: 1 PID: 177 Comm: kworker/1:2 Not tainted 4.4.227-g245d34e4a-dirty #89
[ 247.626503] [1: kworker/1:2: 177] Hardware name: Pine64 RockPro64 (DT)
[ 247.626522] [1: kworker/1:2: 177] Workqueue: events_freezable mmc_rescan
[ 247.626531] [1: kworker/1:2: 177] Call trace:
[ 247.626545] [1: kworker/1:2: 177] [<ffffff8008088288>] dump_backtrace+0x0/0x220
[ 247.626555] [1: kworker/1:2: 177] [<ffffff80080884cc>] show_stack+0x24/0x30
[ 247.626567] [1: kworker/1:2: 177] [<ffffff8008414ab8>] dump_stack+0xa0/0xc8
[ 247.626577] [1: kworker/1:2: 177] [<ffffff8008c5cc68>] mmc_host_set_uhs_voltage+0x44/0x134
[ 247.626586] [1: kworker/1:2: 177] [<ffffff8008c5d4b0>] mmc_set_uhs_voltage+0xc4/0x164
[ 247.626597] [1: kworker/1:2: 177] [<ffffff8008c63c5c>] mmc_sd_get_cid+0xfc/0x144
[ 247.626607] [1: kworker/1:2: 177] [<ffffff8008c64214>] mmc_sd_init_card+0x68/0x304
[ 247.626617] [1: kworker/1:2: 177] [<ffffff8008c64750>] mmc_attach_sd+0xf0/0x148
[ 247.626626] [1: kworker/1:2: 177] [<ffffff8008c5dbe0>] mmc_rescan+0x288/0x2d8
[ 247.626637] [1: kworker/1:2: 177] [<ffffff80080ce0c0>] process_one_work+0x218/0x370
[ 247.626646] [1: kworker/1:2: 177] [<ffffff80080cef84>] worker_thread+0x2e0/0x3a0
[ 247.626657] [1: kworker/1:2: 177] [<ffffff80080d3ea4>] kthread+0xdc/0xec
[ 247.626666] [1: kworker/1:2: 177] [<ffffff8008082ef0>] ret_from_fork+0x10/0x20
[ 247.626676] [1: kworker/1:2: 177] mmc1: clock 0Hz busmode 2 powermode 2 cs 0 Vdd 21 width 1 timing 0
[ 247.626684] [1: kworker/1:2: 177] dw_mci_set_ios
[ 247.626691] [1: kworker/1:2: 177] dw_mci_rk3288_set_ios
[ 247.626698] [1: kworker/1:2: 177] MMC_POWER_ON vqmmc
[ 247.626717] [1: kworker/1:2: 177] dw_mci_switch_voltage
[ 247.626725] [1: kworker/1:2: 177] mmc_regulator_set_vqmmc 1
[ 247.626732] [1: kworker/1:2: 177] mmc_regulator_set_vqmmc ++1
[ 247.626740] [1: kworker/1:2: 177] mmc_regulator_set_voltage_if_supported 1700000 1800000 1950000
[ 247.626751] [1: kworker/1:2: 177] mmc_regulator_set_voltage_if_supported 1700000 1800000 1950000 ok
[ 247.626759] [1: kworker/1:2: 177] regulator_set_voltage 1800000 1950000
[ 247.626767] [1: kworker/1:2: 177] regulator_set_voltage_unlocked 1800000 1950000
[ 247.626775] [1: kworker/1:2: 177] regulator_check_voltage min_uV=1800000 max_uV=1950000
[ 247.626782] [1: kworker/1:2: 177] regulator_check_voltage ccmin_uV=1800000 ccmax_uV=3000000
[ 247.626790] [1: kworker/1:2: 177] regulator_check_voltage min_uV=1800000 max_uV=1950000
[ 247.626797] [1: kworker/1:2: 177] regulator_check_consumers min_uV=1800000 max_uV=1950000
[ 247.626805] [1: kworker/1:2: 177] regulator_check_consumers ccmin_uV=1800000 ccmax_uV=3000000
[ 247.626813] [1: kworker/1:2: 177] aa regulator_check_consumers min_uV=1800000 max_uV=1950000
[ 247.626820] [1: kworker/1:2: 177] aa regulator_check_consumers ccmin_uV=1800000 ccmax_uV=3000000
[ 247.626828] [1: kworker/1:2: 177] bb regulator_check_consumers fe310000.dwmmc-vqmmc ccmin_uV=1800000 ccmax_uV=1950000
[ 247.626836] [1: kworker/1:2: 177] regulator_check_consumers min_uV=1800000 max_uV=1950000
[ 247.626853] [1: kworker/1:2: 177] regulator gpio 155 = set 1
[ 247.626863] [1: kworker/1:2: 177] ppvar_sd_card_io: ramp_delay not set
[ 247.639437] [1: kworker/1:2: 177] CPU: 1 PID: 177 Comm: kworker/1:2 Not tainted 4.4.227-g245d34e4a-dirty #89
[ 247.639454] [1: kworker/1:2: 177] Hardware name: Pine64 RockPro64 (DT)
[ 247.639472] [1: kworker/1:2: 177] Workqueue: events_freezable mmc_rescan
[ 247.639482] [1: kworker/1:2: 177] Call trace:
[ 247.639495] [1: kworker/1:2: 177] [<ffffff8008088288>] dump_backtrace+0x0/0x220
[ 247.639505] [1: kworker/1:2: 177] [<ffffff80080884cc>] show_stack+0x24/0x30
[ 247.639517] [1: kworker/1:2: 177] [<ffffff8008414ab8>] dump_stack+0xa0/0xc8
[ 247.639526] [1: kworker/1:2: 177] [<ffffff8008c5cce4>] mmc_host_set_uhs_voltage+0xc0/0x134
[ 247.639535] [1: kworker/1:2: 177] [<ffffff8008c5d4b0>] mmc_set_uhs_voltage+0xc4/0x164
[ 247.639547] [1: kworker/1:2: 177] [<ffffff8008c63c5c>] mmc_sd_get_cid+0xfc/0x144
[ 247.639557] [1: kworker/1:2: 177] [<ffffff8008c64214>] mmc_sd_init_card+0x68/0x304
[ 247.639567] [1: kworker/1:2: 177] [<ffffff8008c64750>] mmc_attach_sd+0xf0/0x148
[ 247.639575] [1: kworker/1:2: 177] [<ffffff8008c5dbe0>] mmc_rescan+0x288/0x2d8
[ 247.639586] [1: kworker/1:2: 177] [<ffffff80080ce0c0>] process_one_work+0x218/0x370
[ 247.639595] [1: kworker/1:2: 177] [<ffffff80080cef84>] worker_thread+0x2e0/0x3a0
[ 247.639607] [1: kworker/1:2: 177] [<ffffff80080d3ea4>] kthread+0xdc/0xec
[ 247.639616] [1: kworker/1:2: 177] [<ffffff8008082ef0>] ret_from_fork+0x10/0x20
[ 247.639626] [1: kworker/1:2: 177] mmc1: clock 400000Hz busmode 2 powermode 2 cs 0 Vdd 21 width 1 timing 0
[ 247.639633] [1: kworker/1:2: 177] dw_mci_set_ios
[ 247.639641] [1: kworker/1:2: 177] dw_mci_rk3288_set_ios
[ 247.639652] [1: kworker/1:2: 177] MMC_POWER_ON vqmmc
[ 247.647680] [1: kworker/1:2: 177] mmc try to use 1.8v into uhs mode ???
[ 247.648565] [1: kworker/1:2: 177] CPU: 1 PID: 177 Comm: kworker/1:2 Not tainted 4.4.227-g245d34e4a-dirty #89
[ 247.648578] [1: kworker/1:2: 177] Hardware name: Pine64 RockPro64 (DT)
[ 247.648600] [1: kworker/1:2: 177] Workqueue: events_freezable mmc_rescan
[ 247.648611] [1: kworker/1:2: 177] Call trace:
[ 247.648628] [1: kworker/1:2: 177] [<ffffff8008088288>] dump_backtrace+0x0/0x220
[ 247.648639] [1: kworker/1:2: 177] [<ffffff80080884cc>] show_stack+0x24/0x30
[ 247.648653] [1: kworker/1:2: 177] [<ffffff8008414ab8>] dump_stack+0xa0/0xc8
[ 247.648665] [1: kworker/1:2: 177] [<ffffff8008c5c918>] mmc_set_bus_width+0x2c/0x90
[ 247.648680] [1: kworker/1:2: 177] [<ffffff8008d0daf8>] mmc_sd_init_uhs_card+0x98/0x3b8
[ 247.648692] [1: kworker/1:2: 177] [<ffffff8008c64498>] mmc_sd_init_card+0x2ec/0x304
[ 247.648702] [1: kworker/1:2: 177] [<ffffff8008c64750>] mmc_attach_sd+0xf0/0x148
[ 247.648712] [1: kworker/1:2: 177] [<ffffff8008c5dbe0>] mmc_rescan+0x288/0x2d8
[ 247.648726] [1: kworker/1:2: 177] [<ffffff80080ce0c0>] process_one_work+0x218/0x370
[ 247.648736] [1: kworker/1:2: 177] [<ffffff80080cef84>] worker_thread+0x2e0/0x3a0
[ 247.648749] [1: kworker/1:2: 177] [<ffffff80080d3ea4>] kthread+0xdc/0xec
[ 247.648758] [1: kworker/1:2: 177] [<ffffff8008082ef0>] ret_from_fork+0x10/0x20
[ 247.648768] [1: kworker/1:2: 177] mmc1: clock 400000Hz busmode 2 powermode 2 cs 0 Vdd 21 width 4 timing 0
[ 247.648776] [1: kworker/1:2: 177] dw_mci_set_ios
[ 247.648784] [1: kworker/1:2: 177] dw_mci_rk3288_set_ios
[ 247.648799] [1: kworker/1:2: 177] MMC_POWER_ON vqmmc
[ 247.649621] [1: kworker/1:2: 177] CPU: 1 PID: 177 Comm: kworker/1:2 Not tainted 4.4.227-g245d34e4a-dirty #89
[ 247.649630] [1: kworker/1:2: 177] Hardware name: Pine64 RockPro64 (DT)
[ 247.649641] [1: kworker/1:2: 177] Workqueue: events_freezable mmc_rescan
[ 247.649650] [1: kworker/1:2: 177] Call trace:
[ 247.649659] [1: kworker/1:2: 177] [<ffffff8008088288>] dump_backtrace+0x0/0x220
[ 247.649669] [1: kworker/1:2: 177] [<ffffff80080884cc>] show_stack+0x24/0x30
[ 247.649680] [1: kworker/1:2: 177] [<ffffff8008414ab8>] dump_stack+0xa0/0xc8
[ 247.649689] [1: kworker/1:2: 177] [<ffffff8008c5cd84>] mmc_set_timing+0x2c/0x90
[ 247.649701] [1: kworker/1:2: 177] [<ffffff8008d0ddb0>] mmc_sd_init_uhs_card+0x350/0x3b8
[ 247.649711] [1: kworker/1:2: 177] [<ffffff8008c64498>] mmc_sd_init_card+0x2ec/0x304
[ 247.649721] [1: kworker/1:2: 177] [<ffffff8008c64750>] mmc_attach_sd+0xf0/0x148
[ 247.649731] [1: kworker/1:2: 177] [<ffffff8008c5dbe0>] mmc_rescan+0x288/0x2d8
[ 247.649740] [1:rker/1:2: 177] [<ffffff80080ce0c0>] process_one_work+0x218/0x370
[ 247.649749] [1: kworker/1:2: 177] [<ffffff80080cef84>] worker_thread+0x2e0/0x3a0
[ 247.649759] [1: kworker/1:2: 177] [<ffffff80080d3ea4>] kthread+0xdc/0xec
[ 247.649768] [1: kworker/1:2: 177] [<ffffff8008082ef0>] ret_from_fork+0x10/0x20
[ 247.649780] [1: kworker/1:2: 177] mmc1: clock 400000Hz busmode 2 powermode 2 cs 0 Vdd 21 width 4 timing 6
[ 247.649786] [1: kworker/1:2: 177] dw_mci_set_ios
[ 247.649794] [1: kworker/1:2: 177] dw_mci_rk3288_set_ios
[ 247.649806] [1: kworker/1:2: 177] MMC_POWER_ON vqmmc
[ 247.649815] [1: kworker/1:2: 177] CPU: 1 PID: 177 Comm: kworker/1:2 Not tainted 4.4.227-g245d34e4a-dirty #89
[ 247.649823] [1: kworker/1:2: 177] Hardware name: Pine64 RockPro64 (DT)
[ 247.649832] [1: kworker/1:2: 177] Workqueue: events_freezable mmc_rescan
[ 247.649840] [1: kworker/1:2: 177] Call trace:
[ 247.649850] [1: kworker/1:2: 177] [<ffffff8008088288>] dump_backtrace+0x0/0x220
[ 247.649861] [1: kworker/1:2: 177] [<ffffff80080884cc>] show_stack+0x24/0x30
[ 247.649871] [1: kworker/1:2: 177] [<ffffff8008414ab8>] dump_stack+0xa0/0xc8
[ 247.649881] [1: kworker/1:2: 177] [<ffffff8008c5c754>] mmc_set_clock+0x4c/0xb0
[ 247.649891] [1: kworker/1:2: 177] [<ffffff8008d0ddbc>] mmc_sd_init_uhs_card+0x35c/0x3b8
[ 247.649902] [1: kworker/1:2: 177] [<ffffff8008c64498>] mmc_sd_init_card+0x2ec/0x304
[ 247.649913] [1: kworker/1:2: 177] [<ffffff8008c64750>] mmc_attach_sd+0xf0/0x148
[ 247.649922] [1: kworker/1:2: 177] [<ffffff8008c5dbe0>] mmc_rescan+0x288/0x2d8
[ 247.649931] [1: kworker/1:2: 177] [<ffffff80080ce0c0>] process_one_work+0x218/0x370
[ 247.649941] [1: kworker/1:2: 177] [<ffffff80080cef84>] worker_thread+0x2e0/0x3a0
[ 247.649951] [1: kworker/1:2: 177] [<ffffff80080d3ea4>] kthread+0xdc/0xec
[ 247.649960] [1: kworker/1:2: 177] [<ffffff8008082ef0>] ret_from_fork+0x10/0x20
[ 247.649969] [1: kworker/1:2: 177] mmc1: clock 50000000Hz busmode 2 powermode 2 cs 0 Vdd 21 width 4 timing 6
[ 247.649976] [1: kworker/1:2: 177] dw_mci_set_ios
[ 247.649984] [1: kworker/1:2: 177] dw_mci_rk3288_set_ios
[ 247.650062] [1: kworker/1:2: 177] MMC_POWER_ON vqmmc
[ 247.650079] [1: kworker/1:2: 177] mmc_host mmc1: Bus speed (slot 0) = 50000000Hz (slot req 50000000Hz, actual 50000000HZ div = 0)
[ 247.666584] [1: kworker/1:2: 177] dwmmc_rockchip fe310000.dwmmc: All phases work, using default phase 0.
[ 247.666614] [1: kworker/1:2: 177] mmc use 1.8v UHS mode
[ 247.666636] [1: kworker/1:2: 177] mmc1: new ultra high speed SDR104 SDHC card at address 1234
[ 247.667755] [1: kworker/1:2: 177] mmcblk1: mmc1:1234 SA16G 14.5 GiB
[ 247.668919] [1: kworker/1:2: 177] mmcblk1: p1 p2
上述基彩色 log 是关键 函数,基本上是 mmc_rescan 配置属性,设置电压 ,get cid (如果uhs 切1.8v,切换不成功也会继续跑流程,因为卡可以在高压工作)
获取cid 流程中 会上电,会跑cmd0 稳定后 cmd8 获取电压 cmd 55 acmd41 收到 回复41xx xxxx ,就尝试切超高速UHS (CMD11) , mmc_set_uhs_voltage( 切换1.8v )
获取到 cid 后 跑 mmc_attach_sd 初始化 mmc_sd_init_card -》 get cid --- mmc_sd_get_csd (看情况 切 UHS --1.8v),最后 mmc_add_card,就是算识别到卡


本文详细记录了SD卡在UHS模式下初始化的过程,包括电压设置、信号电压选择及UHS模式的启用等关键步骤。
1944

被折叠的 条评论
为什么被折叠?



