-
Notifications
You must be signed in to change notification settings - Fork 5.3k
bsp: k230: support sdio #10295
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
bsp: k230: support sdio #10295
Conversation
📌 Code Review Assignment🏷️ Tag: bsp_k230Path: Changed Files (Click to expand)
📊 Current Review Status (Last Updated: 2025-05-20 10:34 UTC)
📝 Review Instructions
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Adds SDIO support for the k230 BSP by introducing selectable SDIO devices, switching the default root filesystem to elmFAT, updating mount logic, and cleaning up driver formatting.
- Exposed SDIO device choice and root-FS type in Kconfig, defaulting to SDIO0 and elmFAT
- Enabled vDSO and updated
rtconfig.hdefaults (mount partition, root-FS) - Refactored
drv_sdhci.cto remove warnings and unify brace usage - Updated
mnt.cto mount elmFAT or CROMFS based on config
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| bsp/k230/rtconfig.h | Enable SDIO, vDSO, set default SD partition and elmFAT |
| bsp/k230/drivers/interdrv/sdio/drv_sdhci.c | Clean up warnings, include mm_aspace, unify if/while braces |
| bsp/k230/board/Kconfig | Add SDIO device choice, default to SDIO0 |
| bsp/k230/Kconfig | Add root-FS type choice, default to elmFAT |
| bsp/k230/applications/mnt.c | Mount root from SDIO elmFAT or CROMFS, update console output |
| bsp/k230/.config | Reflect chosen defaults for SDIO and elmFAT in generated config |
Comments suppressed due to low confidence (1)
bsp/k230/board/Kconfig:36
- [nitpick] Indentation of this
defaultdiffers from surrounding entries; aligning it with the rest of the block improves Kconfig readability.
default n
bsp/k230/applications/mnt.c
Outdated
| while (mmcsd_wait_cd_changed(100) != MMCSD_HOST_PLUGED) | ||
| ; |
Copilot
AI
May 20, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avoid an infinite busy-wait loop without a timeout or yielding; consider adding a timeout counter or yielding to the scheduler to prevent blocking other tasks.
| while (mmcsd_wait_cd_changed(100) != MMCSD_HOST_PLUGED) | |
| ; | |
| int timeout = 50; // Timeout after 50 iterations (5 seconds if each iteration waits 100ms) | |
| while (mmcsd_wait_cd_changed(100) != MMCSD_HOST_PLUGED) | |
| { | |
| if (--timeout <= 0) | |
| { | |
| rt_kprintf("Timeout waiting for MMCSD host to be plugged!\n"); | |
| return -1; // Return an error code to indicate failure | |
| } | |
| rt_thread_mdelay(100); // Yield to the scheduler | |
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
accepted and fixed
bsp/k230/applications/mnt.c
Outdated
| rt_kprintf("tempfs mounted on /dev/shm failed!\n"); | ||
| } | ||
|
|
||
| #ifdef BSP_SD_SDIO_DEV | ||
| while (mmcsd_wait_cd_changed(100) != MMCSD_HOST_PLUGED) | ||
| ; | ||
|
|
||
| if (dfs_mount(BSP_SD_MNT_DEVNAME, "/mnt", "elm", 0, 0) != 0) | ||
| { | ||
| rt_kprintf("Dir /mnt mount failed!\n"); | ||
| else { | ||
| rt_kprintf("tempfs mounted on /dev/shm success!\n"); |
Copilot
AI
May 20, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The filesystem name 'tempfs' appears to be a typo; the standard name is 'tmpfs', so updating the message improves clarity.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
| if (host->tx_delay_line > 256) | ||
| { | ||
| LOG_E("host%d: tx_delay_line err\n", host->index); | ||
| } else if (host->tx_delay_line > 128) { | ||
| } else if (host->tx_delay_line > 128) | ||
| { |
Copilot
AI
May 20, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] The brace style around this if (and many following blocks) has been shifted from the project's usual K&R style; consider restoring consistent brace placement for readability and compliance with the coding standard.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
没有问题
Support sdio work for 01Studio board. 01Studio connect TF socket with sdio0, which is different from standard canmv v1.0/v1.1 board (which uses sdio1). Updated configuration menu, - SDIO devices are now a choice of two. - Root file system types are also a choice of multiple. Currently only cromfs and elmFAT are supported. - Modified the default mount partition of the root file system to sd0p1 Deleted the configuration BSP_SD_SDIO_DEV, and now directly set mmcsd_change according to the selection of the SDIO device. Eliminated the warning of the drv_sdhci.c and egularized the code format. The logic of this file has not been essentially modified. Sync and update the .config/rtconfig.h to the latest. Signed-off-by: Chen Wang <unicorn_wang@outlook.com>
not an issue, rejected. |
支持 01Studio 开发板使用 sdio 工作。
01Studio 将 TF 插槽连接到 sdio0,这与标准 canmv v1.0/v1.1 开发板(使用 sdio1)不同。
更新配置菜单,
删除配置 BSP_SD_SDIO_DEV,目前直接根据 SDIO 设备的选择结构设置 mmcsd_change。
消除 drv_sdhci.c 文件的告警以及规整代码格式。该文件逻辑没有本质修改。
同步并更新.config/rtconfig.h 到最新版本。
拉取/合并请求描述:(PR description)
[
为什么提交这份PR (why to submit this PR)
你的解决方案是什么 (what is your solution)
请提供验证的bsp和config (provide the config and bsp)
]
当前拉取/合并请求的状态 Intent for your PR
必须选择一项 Choose one (Mandatory):
代码质量 Code Quality:
我在这个拉取/合并请求中已经考虑了 As part of this pull request, I've considered the following:
#if 0代码,不包含已经被注释了的代码 All redundant code is removed and cleaned up