qspi: phytium: update phytium qspi controller driver support to 6.6.0.4#1721
qspi: phytium: update phytium qspi controller driver support to 6.6.0.4#1721xiaqian1486 wants to merge 2 commits into
Conversation
Solve the problem of abnormal reading and writing of data when simultaneously accessing flash chips of different capacities. Mainline: Open-Source Signed-off-by: Peng Min<pengmin1540@phytium.com.cn> Signed-off-by: Wang Yinfeng <wangyinfeng@phytium.com.cn> Signed-off-by: Xia Qian <xiaqian1486@phytium.com.cn>
Reviewer's guide (collapsed on small PRs)Reviewer's GuideUpdates the Phytium QSPI controller driver to maintain per-chip read/write configuration registers and ensure the correct configuration is applied per chip-select during dirmap operations, while also tightening Kconfig dependencies for QSPI build integration. Sequence diagram for per-chip dirmap read/write configurationsequenceDiagram
participant Caller
participant phytium_qspi_dirmap_create
participant phytium_qspi_dirmap_read
participant phytium_qspi_dirmap_write
participant QSPI_HW
Caller->>phytium_qspi_dirmap_create: phytium_qspi_dirmap_create(desc)
activate phytium_qspi_dirmap_create
phytium_qspi_dirmap_create->>QSPI_HW: writel_relaxed(cmd, QSPI_RD_CFG_REG)
phytium_qspi_dirmap_create-->>Caller: rd_cfg_reg[spi->chip_select] = cmd
deactivate phytium_qspi_dirmap_create
Caller->>phytium_qspi_dirmap_read: phytium_qspi_dirmap_read(desc, offs, len, buf)
activate phytium_qspi_dirmap_read
phytium_qspi_dirmap_read->>QSPI_HW: writel_relaxed(rd_cfg_reg[spi->chip_select], QSPI_RD_CFG_REG)
phytium_qspi_dirmap_read->>QSPI_HW: memcpy_fromio(buf_rx, src, len)
phytium_qspi_dirmap_read-->>Caller: return len
deactivate phytium_qspi_dirmap_read
Caller->>phytium_qspi_dirmap_write: phytium_qspi_dirmap_write(desc, offs, len, buf)
activate phytium_qspi_dirmap_write
phytium_qspi_dirmap_write->>QSPI_HW: writel_relaxed(wr_cfg_reg[spi->chip_select], QSPI_WR_CFG_REG)
phytium_qspi_dirmap_write-->>Caller: return len
deactivate phytium_qspi_dirmap_write
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Hi @xiaqian1486. Thanks for your PR. I'm waiting for a deepin-community member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
|
/ok-to-test |
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- When indexing
wr_cfg_reg[]andrd_cfg_reg[]byspi->chip_select, consider adding a sanity check or at least a clear comment thatchip_select < PHYTIUM_QSPI_MAX_NORCHIPis guaranteed by the core, to make the per-CS storage assumption explicit and guard against future changes. - Now that
rd_cfg_regis per-chip and only programmed inphytium_qspi_dirmap_create(), it may be worth clarifying (via a comment nearphytium_qspi_dirmap_read()/write()) that these paths are only reachable after a successful dirmap setup, so using the stored per-CS config cannot hit an uninitialized slot.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- When indexing `wr_cfg_reg[]` and `rd_cfg_reg[]` by `spi->chip_select`, consider adding a sanity check or at least a clear comment that `chip_select < PHYTIUM_QSPI_MAX_NORCHIP` is guaranteed by the core, to make the per-CS storage assumption explicit and guard against future changes.
- Now that `rd_cfg_reg` is per-chip and only programmed in `phytium_qspi_dirmap_create()`, it may be worth clarifying (via a comment near `phytium_qspi_dirmap_read()`/`write()`) that these paths are only reachable after a successful dirmap setup, so using the stored per-CS config cannot hit an uninitialized slot.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
There was a problem hiding this comment.
Pull request overview
Updates the Phytium QSPI controller driver to keep per-chip-select read/write configuration and to reprogram the controller’s read configuration before each direct-mapped read, improving correctness when multiple flashes share the controller and across state transitions.
Changes:
- Store
RD_CFG/WR_CFGprogramming values per chip select instead of globally. - Reprogram
RD_CFG_REGon each dirmap read and simplify resume handling by no longer restoringRD_CFG_REGthere. - Tighten Kconfig dependencies for
SPI_PHYTIUM_QSPI.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| drivers/spi/spi-phytium-qspi.c | Track RD/WR config per chip select and reapply RD config before each dirmap read; adjust resume behavior accordingly. |
| drivers/spi/Kconfig | Update build dependencies for the Phytium QSPI driver. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| config SPI_PHYTIUM_QSPI | ||
| tristate "Phytium Quad SPI controller" | ||
| depends on ARCH_PHYTIUM || COMPILE_TEST | ||
| depends on ARCH_PHYTIUM && COMPILE_TEST |
Require both ARCH_PHYTIUM and COMPILE_TEST for SPI_PHYTIUM_QSPI. Ensures driver only builds when explicitly tested on Phytium platforms. Prevents accidental inclusion in production builds, enforcing controlled testing visibility for experimental hardware support. Mainline: Open-Source Signed-off-by: zhuling <zhuling2709@phytium.com.cn> Signed-off-by: Wang Yinfeng <wangyinfeng@phytium.com.cn> Signed-off-by: Xia Qian <xiaqian1486@phytium.com.cn>
This patches updates the support for phytium qspi controller driver.
Summary by Sourcery
Update the Phytium QSPI controller driver to track per-chip configuration and correctly program controller registers for dirmap transfers.
Bug Fixes:
Enhancements: