Skip to content

qspi: phytium: update phytium qspi controller driver support to 6.6.0.4#1721

Open
xiaqian1486 wants to merge 81 commits into
deepin-community:linux-6.6.yfrom
xiaqian1486:qspi-6.6.y
Open

qspi: phytium: update phytium qspi controller driver support to 6.6.0.4#1721
xiaqian1486 wants to merge 81 commits into
deepin-community:linux-6.6.yfrom
xiaqian1486:qspi-6.6.y

Conversation

@xiaqian1486
Copy link
Copy Markdown

@xiaqian1486 xiaqian1486 commented May 15, 2026

This patches updates the support for phytium qspi controller driver.

  1. Use the corresponding configurations for each chip
  2. Strict QSPI compile dependency

Summary by Sourcery

Update the Phytium QSPI controller driver to track per-chip configuration and correctly program controller registers for dirmap transfers.

Bug Fixes:

  • Store read and write configuration registers per chip select instead of globally to avoid conflicts when multiple flashes are attached.
  • Reprogram the read configuration register before each dirmap read to ensure correct controller state after other operations or power transitions.

Enhancements:

  • Simplify resume handling by only restoring the flash capacity register when dirmap is enabled, relying on per-chip configuration to be set during access.

Chengyulai and others added 30 commits May 12, 2026 14:07
Recording immediately after playing music will result in the
latter part of the recording have no sound. the reason as follows:

Playback and recording share the same clock. After playback stops,
the audio framework will shutdown clock after 5-second. if recording
within this 5-second period, the recording clock will be turned off.

Therefore, the CONTROL1 register should be modified so that
playback and recording use different clocks.

Signed-off-by: Cheng Yulai <chengyulai1490@phytium.com.cn>
Signed-off-by: Zhou Zheng <zhouzheng2069@phytium.com.cn>
Signed-off-by: Wang Yinfeng <wangyinfeng@phytium.com.cn>
This driver is exclusively for the PHYTIUM platform and is not
compatible with other SoCs. This restriction avoids compiling
this driver on other platforms.

Signed-off-by: Cheng Yulai <chengyulai1490@phytium.com.cn>
Signed-off-by: Zhou Zheng <zhouzheng2069@phytium.com.cn>
Signed-off-by: Wang Yinfeng <wangyinfeng@phytium.com.cn>
Add a controller status code for no initialzation error.

Signed-off-by: Cheng Yulai <chengyulai1490@phytium.com.cn>
Signed-off-by: Zhou Zheng <zhouzheng2069@phytium.com.cn>
Signed-off-by: Wang Yinfeng <wangyinfeng@phytium.com.cn>
Initialize channels and share memory before sending
command to prevent unknown errors.

Signed-off-by: Cheng Yulai <chengyulai1490@phytium.com.cn>
Signed-off-by: Zhou Zheng <zhouzheng2069@phytium.com.cn>
Signed-off-by: Wang Yinfeng <wangyinfeng@phytium.com.cn>
When executing the probe interface, the driver shound return actual
error code instead of zero to avoid creating sound card successfully
when hardware is not present.

Signed-off-by: Dai Jingtao <daijingtao1503@phytium.com.cn>
Signed-off-by: Wang Yinfeng <wangyinfeng@phytium.com.cn>
Add audio control node to disable/enable I2S and DMA function.
The node is used for dp-i2s to control audio whether it should
stop or continue. Such as changing resolution when playing.

Signed-off-by: Li Bing <libing1969@phytium.com.cn>
Signed-off-by: Dai Jingtao <daijingtao1503@phytium.com.cn>
Signed-off-by: Wang Yinfeng <wangyinfeng@phytium.com.cn>
This driver is exclusively for the PHYTIUM platform and is not
compatible with other SoCs. This restriction prevents errors
on unsupported platform.

Signed-off-by: Li Bing <libing1969@phytium.com.cn>
Signed-off-by: Dai Jingtao <daijingtao1503@phytium.com.cn>
Signed-off-by: Wang Yinfeng <wangyinfeng@phytium.com.cn>
The problem is that when the hardware card is not inserted, it
causes sound card loading to fail due to undefined behavior from
headphone detection. This detection is in the I2S driver's probe
function, but I2S cannot detect whether a daughter card actually
exists. Therefore, the codec's probe should execute first and return
directly if not daughter card is found.

Signed-off-by: Li Bing <libing1969@phytium.com.cn>
Signed-off-by: Dai Jingtao <daijingtao1503@phytium.com.cn>
Signed-off-by: Wang Yinfeng <wangyinfeng@phytium.com.cn>
This patch provides three methods for reading cpu type for
Phytium Socs, with priority from high to low as follows:
- read socid by arm-smccc
- read system register of SYS_AIDR_EL1
- read system register of MPIDR_EL1

Signed-off-by: Zhang Fuxiang <zhangfuxiang2144@phytium.com.cn>
Signed-off-by: Feng Jun <fengjun@phytium.com.cn>
Signed-off-by: Wang Yinfeng <wangyinfeng@phytium.com.cn>
This patch adjusts the machanism of obtaining the CPU type for
Phytium Socs. It can directly return current CPU type when
external interface calls the function.

Signed-off-by: Zhang Fuxiang <zhangfuxiang2144@phytium.com.cn>
Signed-off-by: Feng Jun <fengjun@phytium.com.cn>
Signed-off-by: Wang Yinfeng <wangyinfeng@phytium.com.cn>
Modify the definition of PE220x CPU name  from PHYTIUM_CPU_PART_FTC303
to PHYTIUM_CPU_PART_FTC310 to support initialization and features for
the FTC310 processor.

Signed-off-by: Li Mingzhe <limingzhe1839@phytium.com.cn>
Signed-off-by: Wang Yinfeng <wangyinfeng@phytium.com.cn>
Signed-off-by: Ma Mingrui <mamingrui1243@phytium.com.cn>
zhaoxin inclusion
category: feature

--------------------

This patch extends temperature monitoring support to include the new
Zhaoxin KX-8000 FMS CPU family by:

1. Adding model 0x8b to the MSR register mapping condition, so it uses
   the same temperature critical and maximum MSR addresses (0x175b and
   0x175a) as the existing 0x6b and 0x7b models.

2. Registering both CENTAUR and ZHAOXIN vendor variants of the 0x8b
   model in the CPU ID matching table to enable driver probe on these
   systems.

Signed-off-by: leoliu-oc <leoliu-oc@zhaoxin.com>
Let ghes_edac be the preferred driver to load on  __ZX__ and _BYO_
systems by extending the platform detection list in ghes.c

Signed-off-by: Tony W Wang-oc <TonyWWang-oc@zhaoxin.com>
Tested-by: Lyle Li <LyleLi@zhaoxin.com>
Acked-by: Borislav Petkov (AMD) <bp@alien8.de>
[ rjw: Subject and changelog edits ]
Link: https://patch.msgid.link/20260128025216.12564-1-TonyWWang-oc@zhaoxin.com
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: LeoLiu-oc <leoliu-oc@zhaoxin.com>
* Introduce socket‑aware pin definition macros for multi‑socket platforms
* Split global pin table into per‑socket pin tables with UID soc_data
* Use UID‑based probe to match multi‑socket instances
* Dynamically acquire PMIO IO resource instead of hard‑coding address
* Fix PMIO offset for multi‑socket compatibility

Signed-off-by: LeoLiu-oc <leoliu-oc@zhaoxin.com>
Signed-off-by: Wentao Guan <guanwentao@uniontech.com>
Currently, cper_print_pcie() only logs Uncorrectable Error Status, Mask
and Severity registers along with the TLP header.

If a correctable error is received immediately preceding or following an
Uncorrectable Fatal Error, its information is lost since Correctable
Error Status and Mask registers are not logged.

As such, to avoid skipping any possible error information, Correctable
Error Status and Mask registers should also be logged.

Additionally, ensure that AER information is also available through
cper_print_pcie() for Correctable and Uncorrectable Non-Fatal Errors.

Signed-off-by: Yazen Ghannam <yazen.ghannam@amd.com>
Tested-by: Avadhut Naik <avadhut.naik@amd.com>
Signed-off-by: Avadhut Naik <avadhut.naik@amd.com>
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: LeoLiu-oc <leoliu-oc@zhaoxin.com>
This adds the DEVFREQ driver for Phytium Net On Chip.It adjusts
frequency for noc based on load bandwidth obtained from register.

Signed-off-by: Li Jiayi <lijiayi1493@phytium.com.cn>
Signed-off-by: Li Mingzhe <limingzhe1839@phytium.com.cn>
Signed-off-by: Wang Yinfeng <wangyinfeng@phytium.com.cn>
Signed-off-by: Ma Mingrui <mamingrui1243@phytium.com.cn>
This adds the DEVFREQ driver for Phytium DDR Memory Unit.It adjusts
frequency for dmu based on load bandwidth obtained from register.

Signed-off-by: Li Jiayi <lijiayi1493@phytium.com.cn>
Signed-off-by: Li Mingzhe <limingzhe1839@phytium.com.cn>
Signed-off-by: Wang Yinfeng <wangyinfeng@phytium.com.cn>
Signed-off-by: Ma Mingrui <mamingrui1243@phytium.com.cn>
The patch fixed dmu/noc devfreq driver some memory leak problem.

Signed-off-by: Li Mingzhe <limingzhe1839@phytium.com.cn>
Signed-off-by: Wang Yinfeng <wangyinfeng@phytium.com.cn>
Signed-off-by: Ma Mingrui <mamingrui1243@phytium.com.cn>
The patch retrieves the base address from the ACPI table instead
of being directly exposed inside the driver.

Signed-off-by: Li Mingzhe <limingzhe1839@phytium.com.cn>
Signed-off-by: Wang Yinfeng <wangyinfeng@phytium.com.cn>
Signed-off-by: Ma Mingrui <mamingrui1243@phytium.com.cn>
This patch modifies and adds the following functions:
1). On account of DMU and DDR PMU drivers operate PMU
registers at the same time, which will result in conflict.
So the register operation of se in dmufreq is transferred
to the upper driver.

2). The notification chain of dmufreq to DDR PMU is added
in order to suspend dmufreq's register action and maintain
the rate at the current frequency when the PMU driver is loaded.

3). Add suspend and resume features.

Signed-off-by: Li Mingzhe <limingzhe1839@phytium.com.cn>
Signed-off-by: Wang Yinfeng <wangyinfeng@phytium.com.cn>
Signed-off-by: Ma Mingrui <mamingrui1243@phytium.com.cn>
Change the default strategy for the DMU freq driver from
simple demand to the performance mode.

Signed-off-by: Li Mingzhe <limingzhe1839@phytium.com.cn>
Signed-off-by: Wang Yinfeng <wangyinfeng@phytium.com.cn>
Signed-off-by: Ma Mingrui <mamingrui1243@phytium.com.cn>
Firstly, replace ioremap with devm_ioremap. The advantage of this
approach is that it can be automatically managed during the unloading
stage, eliminating the need for manual resource cleanup, thus
preventing resource leakage.

Secondly, resolve the repeated printing issues.

Signed-off-by: Li Mingzhe <limingzhe1839@phytium.com.cn>
Signed-off-by: Wang Yinfeng <wangyinfeng@phytium.com.cn>
Signed-off-by: Ma Mingrui <mamingrui1243@phytium.com.cn>
Delete the unnecessary release of resources when using devm_kzalloc
function to allocate memory.

Signed-off-by: Li Mingzhe <limingzhe1839@phytium.com.cn>
Signed-off-by: Wang Yinfeng <wangyinfeng@phytium.com.cn>
Signed-off-by: Ma Mingrui <mamingrui1243@phytium.com.cn>
This patch adds power mangement interface, Specifically adds the
phytium_nocfreq_suspend/phytium_nocfreq_resume functions so that
the frequency can be restored upon waking up.

Signed-off-by: Li Mingzhe <limingzhe1839@phytium.com.cn>
Signed-off-by: Wang Yinfeng <wangyinfeng@phytium.com.cn>
Signed-off-by: Ma Mingrui <mamingrui1243@phytium.com.cn>
Optimize the timer logic for sampling, with the aim of reducing
the frequent calls made by processes within the system. It is
very helpfull to reduce power consumption.

Signed-off-by: Li Mingzhe <limingzhe1839@phytium.com.cn>
Signed-off-by: Wang Yinfeng <wangyinfeng@phytium.com.cn>
Signed-off-by: Ma Mingrui <mamingrui1243@phytium.com.cn>
uring driver probe, functions like get_freq_count() and
phytium_noc_get_freq_info() call acpi_evaluate_object() with
ACPI_ALLOCATE_BUFFER. This interface allocates memory via kmalloc
to store the returned ACPI package, but the allocated buffer was never
released after use.

kmemleak reports unreferenced objects coming from
acpi_ut_initialize_buffer() when probing the Phytium DMU freq
drivers.

Fix this by calling kfree(buffer.pointer) after the ACPI package
has been parsed.

Signed-off-by: Li Mingzhe <limingzhe1839@phytium.com.cn>
Signed-off-by: Wang Yinfeng <wangyinfeng@phytium.com.cn>
Signed-off-by: Ma Mingrui <mamingrui1243@phytium.com.cn>
During driver probe, functions like get_freq_count() and
phytium_noc_get_freq_info() call acpi_evaluate_object() with
ACPI_ALLOCATE_BUFFER. This interface allocates memory via kmalloc
to store the returned ACPI package, but the allocated buffer was never
released after use.

kmemleak reports unreferenced objects coming from
acpi_ut_initialize_buffer() when probing the Phytium NOC freq
drivers.

Fix this by calling kfree(buffer.pointer) after the ACPI package
has been parsed.

Signed-off-by: Li Mingzhe <limingzhe1839@phytium.com.cn>
Signed-off-by: Wang Yinfeng <wangyinfeng@phytium.com.cn>
Signed-off-by: Ma Mingrui <mamingrui1243@phytium.com.cn>
Add DMU DEVFREQ driver Support for Phytium PS260xxx SoCs,
and complatible with PD2408.

Signed-off-by: Li Mingzhe <limingzhe1839@phytium.com.cn>
Signed-off-by: Wang Yinfeng <wangyinfeng@phytium.com.cn>
Signed-off-by: Ma Mingrui <mamingrui1243@phytium.com.cn>
Add NOC DEVFREQ driver Support for Phytium PS260xxx SoCs,
and complatible with PD2408.

Signed-off-by: Li Mingzhe <limingzhe1839@phytium.com.cn>
Signed-off-by: Wang Yinfeng <wangyinfeng@phytium.com.cn>
Signed-off-by: Ma Mingrui <mamingrui1243@phytium.com.cn>
zhangfuxiang123 and others added 13 commits May 15, 2026 10:07
When CONFIG_ARCH_PHYTIUM and CONFIG_ACPI are not set,
but CONFIG_COMPILE_TEST is enabled, the pcie pmu driver
fails to compile.

Signed-off-by: Zhang Fuxiang <zhangfuxiang2144@phytium.com.cn>
Signed-off-by: Tan Rui <tanrui2142@phytium.com.cn>
Signed-off-by: Wang Yinfeng <wangyinfeng@phytium.com.cn>
Modify the enable logic in PCIe Link PMU driver to properly set up
time mode and start-stop mode.

Signed-off-by: Zhang Fuxiang <zhangfuxiang2144@phytium.com.cn>
Signed-off-by: Fu Boyi <fuboyi2150@phytium.com.cn>
Signed-off-by: Wang Yinfeng <wangyinfeng@phytium.com.cn>
Some PCI devices have IO space access limit and only supporting
16 bit addresses. We update upper 16 bits of I/O base/limit according
to the bridge and the RC root port.

Signed-off-by: Zhang Fuxiang <zhangfuxiang2144@phytium.com.cn>
Signed-off-by: Xiao Cong <xiaocong1866@phytium.com.cn>
Signed-off-by: Wang Yinfeng <wangyinfeng@phytium.com.cn>
When the PCIe device is unplugged or under hotreset, the PCIe
controller's protrction mechanism is triggered, which will make the
link inaccessible. This patch disables the protection after the link
is up and makes the PCIe hotplug or hotreset process work well.

Signed-off-by: Zhang Fuxiang <zhangfuxiang2144@phytium.com.cn>
Signed-off-by: Long Shixiang <longshixiang1718@phytium.com.cn>
Signed-off-by: Wang Yinfeng <wangyinfeng@phytium.com.cn>
The phytium PCIe root ports and X100 switch do not support ACS at this point.
However, the hardware provides isolation and source validation
through the SMMU. The stream ID generated by the PCIe ports contain
both the bus/device/function number as well as the port ID in its 3
most significant bits. Turn on ACS but disable all the peer-to-peer
features.

Signed-off-by: Zhang Fuxiang <zhangfuxiang2144@phytium.com.cn>
Signed-off-by: Xiao Cong <xiaocong1866@phytium.com.cn>
Signed-off-by: Wang Yinfeng <wangyinfeng@phytium.com.cn>
In the phytium ps2308 platforms, when host PCIe bridge
operate hotreset, then host pcie bridge config register
will restore default value. So before hotreset, it need save
host PCIe bridge config register. Then after hotreset, it need
restore save host PCIe bridge config register.

Signed-off-by: Zhang Fuxiang <zhangfuxiang2144@phytium.com.cn>
Signed-off-by: Xiao Cong <xiaocong1866@phytium.com.cn>
Signed-off-by: Wang Yinfeng <wangyinfeng@phytium.com.cn>
Some Phytium-based systems can come up with reduced PCIe link speed or
lane count after a hotreset. A second reset attempt often restores the
original link characteristics.

Signed-off-by: Zhang Fuxiang <zhangfuxiang2144@phytium.com.cn>
Signed-off-by: Li Tongfeng <litongfeng1497@phytium.com.cn>
Signed-off-by: Wang Yinfeng <wangyinfeng@phytium.com.cn>
On Phytium 24080 platform, reading the PCIe Link Status (LNKSTA)
register through the standard PCIe capability interface may return
an incorrect value for the Data Link Layer Link Active (DLLLA) bit.
This causes the kernel to report wrong link state after a device
is hot-unplugged.

Signed-off-by: Zhang Fuxiang <zhangfuxiang2144@phytium.com.cn>
Signed-off-by: Li Tongfeng <litongfeng1497@phytium.com.cn>
Add the device tree binding schema for phytium,pe2201-pcie-ep.

Signed-off-by: Zhang Fuxiang <zhangfuxiang2144@phytium.com.cn>
Signed-off-by: Li Tongfeng <litongfeng1497@phytium.com.cn>
Signed-off-by: Wang Yinfeng <wangyinfeng@phytium.com.cn>
Add phytium ep driver DMA Controller support and add
function_num_map to the configfs of EPC.

Signed-off-by: Zhang Fuxiang <zhangfuxiang2144@phytium.com.cn>
Signed-off-by: Li Tongfeng <litongfeng1497@phytium.com.cn>
Signed-off-by: Wang Yinfeng <wangyinfeng@phytium.com.cn>
On PD2308 platform, it only setup root bridge I/O BAR address,
and don't modify other bridge I/O BAR address after root.

Signed-off-by: Zhang Fuxiang <zhangfuxiang2144@phytium.com.cn>
Signed-off-by: Li Wencheng <liwencheng@phytium.com.cn>
Signed-off-by: Wang Yinfeng <wangyinfeng@phytium.com.cn>
This reverts commit 6dd7290.

Signed-off-by: Zhang Fuxiang <zhangfuxiang2144@phytium.com.cn>
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>
@sourcery-ai
Copy link
Copy Markdown

sourcery-ai Bot commented May 15, 2026

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Updates 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 configuration

sequenceDiagram
    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
Loading

File-Level Changes

Change Details Files
Track and apply separate read/write configuration registers per NOR flash chip-select in the Phytium QSPI driver.
  • Change single wr_cfg_reg and rd_cfg_reg fields in the driver state to per-chip arrays indexed by PHYTIUM_QSPI_MAX_NORCHIP.
  • On dirmap creation, store the computed RD_CFG and WR_CFG register values into the per-chip arrays using spi->chip_select as the index.
  • Before each dirmap read, reload the RD_CFG hardware register from the stored per-chip configuration for the corresponding chip-select.
  • Before each dirmap write, reload the WR_CFG hardware register from the stored per-chip configuration for the corresponding chip-select.
  • Remove the resume-time restoration of the single RD_CFG register value, relying instead on other mechanisms or per-chip reprogramming.
drivers/spi/spi-phytium-qspi.c
Tighten SPI Phytium QSPI driver Kconfig dependency on QSPI to ensure correct compilation configuration.
  • Adjust the Phytium QSPI driver Kconfig entry to express a strict dependency on QSPI support.
  • Aligns driver build configuration with kernel 6.6.0.4 expectations.
drivers/spi/Kconfig

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@deepin-ci-robot deepin-ci-robot requested review from Wenlp and shy129 May 15, 2026 06:32
@deepin-ci-robot
Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign avenger-285714 for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@deepin-ci-robot
Copy link
Copy Markdown

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 /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions 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.

@Avenger-285714
Copy link
Copy Markdown
Member

/ok-to-test

Copy link
Copy Markdown

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've left some high level feedback:

  • 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.
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.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_CFG programming values per chip select instead of globally.
  • Reprogram RD_CFG_REG on each dirmap read and simplify resume handling by no longer restoring RD_CFG_REG there.
  • 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.

Comment thread drivers/spi/Kconfig
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.