Skip to content

Conversation

6by9
Copy link
Contributor

@6by9 6by9 commented Aug 19, 2025

I'm wanting comments on approach more than a full review.

At present there is a fair amount of board specific stuff mixed in to bcm2712-ds.dtsi, which is why CM5 is disabled just to reduce the number of errors thrown out as I was fixing it up.
I'm suggesting we have bcm2712-rpi-5-b-ds.dtsi, bcm2712-rpi-500-ds.dtsi, bcm2712-rpi-cm5-ds.dtsi, etc, to contain the board specific stuff, and those will #include "bcm2712-ds.dtsi" which will define the devices. Hopefully the only changes to the main upstream files will then be to add the include that downstream one, therefore making Dom's life easier. As more devices get upstream support they will move from -ds.dtsi to the main files.

I'm aware that I'm missing HDMI audio dma configuration at present. I'm not seeing any other major omissions from the kernel logs, but haven't tested everything.

@pelwell - you'd reverted the clock driver to the downstream one. I know it's missing RP1_CLK_SDIO_TIMER and RP1_CLK_SDIO_ALT_SRC, but what else do you think it is missing? (I'll try and derive the entries for those two clocks now)

P33M and others added 30 commits August 19, 2025 16:18
Posted write tracking introduced in the commit below raced with re-use
of the requests between completion and submission, potentially causing
underflow of the pending write count.

Fixes: e6c1e86 ("mmc: restrict posted write counts for SD cards in CQ mode")

Signed-off-by: Jonathan Bell <[email protected]>
Samsung EVO Plus, Pro Plus and Evo Ultimate cards of this era appear to
have a broken cache-flush implementation when operating in CQ mode.

Unfortunately the cards seem to use a separate CID name string for every
variant and capacity, so nobble the cache feature for this MANFID, OEMID
and year. Turning this off seems to have negligible impact on
random-write throughput in non-CQ mode.

Signed-off-by: Jonathan Bell <[email protected]>
Cards with manufacture dates in 2019 and 2020 have been seen in the wild
that hang indefinitely if issued a cache flush command in CQ mode.

Signed-off-by: Jonathan Bell <[email protected]>
Only CMD38 with Arg=0x1 (Discard) is supported when in CQ mode, so
turn it off before issuing a non-discard erase op.

Signed-off-by: Jonathan Bell <[email protected]>
Recent Integral cards end up with corrupt sectors after a flash erase.
This covers sizes for the A2 range, which can't be differentiated from
the A1 range which might not have the same issue.

Signed-off-by: Jonathan Bell <[email protected]>
Newer versions of the DesignWare I2C block support the detection of
stuck signals, and a mechanism to recover from them. Add the required
software support to the driver.

This change was prompted by the observation that reading a single byte
from register 0 of a VEML7700 seems to cause it to issue an ACK too
early, and the controller to complain about losing arbitration. There
is a suspicion that this may be a more widespread problem, but at least
this patch prevents the bus from locking up.

See: raspberrypi#6057

Signed-off-by: Phil Elwell <[email protected]>
In the absence of a value in Device Tree, set the SDA hold time to half
the SCL low time.

Signed-off-by: Phil Elwell <[email protected]>
This code:
for_each_sg(sgl, sg, sg_len, i)
  num_sgs += DIV_ROUND_UP(sg_dma_len(sg), axi_block_len);

determines how many hw_desc are allocated.
If sg_dma_len(sg)=0 we don't allocate for this sgl.

However in the next loop, we will increment loop
for this case, and loop gets higher than num_sgs
and we trample memory.

Signed-off-by: Dom Cobley <[email protected]>
"rotation" is listed as a standard property of panels in panel-common.yaml,
therefore it would be logical to process that from within the core
code should a panel driver not implement the get_orientation hook.

Call of_drm_get_panel_orientation from
drm_connector_set_orientation_from_panel to get that information.

This removes the need for any boiler-plate in panel drivers for calling
drm_connector_set_orientation_from_panel or
drm_connector_set_panel_orientation.

Signed-off-by: Dave Stevenson <[email protected]>
The autodetection of resolution/timing by the TC358762 can lead
to the display being shifted by a pixel or two.

Program the TC358762 with the requested mode timing so that
it can reproduce it accurately.

Signed-off-by: Dave Stevenson <[email protected]>
Reverts 8a4b2fc ("drm/bridge: tc358762: Split register programming from pre-enable to enable")
as we want the config commands sent before video starts.

Signed-off-by: Dave Stevenson <[email protected]>
Having accepted the upstream change to add the persist_gpio_outputs
parameter, make it true by default.

See: raspberrypi#6117

Signed-off-by: Phil Elwell <[email protected]>
Even when configured to use only gpiod CS lines, the DW SPI controller
still expects a bit to be set in the SER register, otherwise transfers
stall. For the csgpiod case, nominate bit 0 for the job.

See: raspberrypi#6159

Signed-off-by: Phil Elwell <[email protected]>
The naming of backlight devices is not terribly useful for
associating a backlight controller with a display (assuming
it is attached to one).

Add a sysfs node that will return a display name that can be set
by other subsystems.

Signed-off-by: Dave Stevenson <[email protected]>
Pass the DRM connector name to any configured backlight
device so that userspace can associate the two items.

Ideally this should be in drm_panel, but it is bridge/panel
that creates the drm_connector and therefore knows the name.

Signed-off-by: Dave Stevenson <[email protected]>

drm/bridge: panel: Ensure backlight is reachable

Ensure that the various options of modules vs builtin results
in being able to call into the backlight code.

raspberrypi#6198

Fixes: 573f8fd ("drm/bridge: panel: Name an associated backlight device")
Signed-off-by: Dave Stevenson <[email protected]>
Add version 4.17.1 of the Hailo PCIe device drivers.
Sourced from https://github.com/hailo-ai/hailort-drivers/

Signed-off-by: Naushir Patuck <[email protected]>

drivers: media: pcie: hailo: Fix include paths

An attempt to fix the include paths - they look reasonable, but the
GitHub auto-builds fail.

Signed-off-by: Phil Elwell <[email protected]>

drivers: media: pci: Update Hailo accelerator device driver to v4.18.0

Sourced from https://github.com/hailo-ai/hailort-drivers/

Signed-off-by: Naushir Patuck <[email protected]>

drivers: media: pci: Add wrapper after removal of follow_pfn

drivers: media: pci: Fix Hailo compile warnings

Signed-off-by: Phil Elwell <[email protected]>

drivers: media: pci: Update Hailo accelerator device driver to v4.19

Sourced from https://github.com/hailo-ai/hailort-drivers/

Signed-off-by: Naushir Patuck <[email protected]>

drivers: media: pci: Update Hailo accelerator device driver to v4.20

Sourced from https://github.com/hailo-ai/hailort-drivers

Signed-off-by: Naushir Patuck <[email protected]>

drivers: pci: hailo: Fix kernel warning when calling find_vdma()

Calling this function without holding the mmap_read_lock causes the
kernel to throw an error message, spamming the dmesg logs when running
the Hailo hardware.

Fix it by adding the approprite lock/unlock functions around find_vdma().

Signed-off-by: Naushir Patuck <[email protected]>

drivers: pci: hailo: Better lock handling when calling find_vdma()

Due to possible instabilities, reduce the mmap read lock time to only
cover the call to find_vdma().

Signed-off-by: Naushir Patuck <[email protected]>
Add helpers to set and get vchiq driver data. vchiq_set_drvdata() and
vchiq_get_drvdata() wraps dev_set_drvdata() and dev_get_drvdata()
respectively.

Signed-off-by: Umang Jain <[email protected]>
Signed-off-by: Kieran Bingham <[email protected]>
Offset the backend dev-nodes starting at /dev/video20
onwards to maintain backward compatibility with the
pre-upstreamed kernel driver.

Signed-off-by: Naushir Patuck <[email protected]>
Add YAML device tree bindings for the Raspberry Pi RP2040 GPIO Bridge.

Signed-off-by: Richard Oliver <[email protected]>
The Raspberry Pi RP2040 GPIO bridge is an I2C-attached device exposing
both a Tx-only SPI controller, and a GPIO controller.

Due to the relative difference in transfer rates between standard-mode
I2C and SPI, the GPIO bridge makes use of 12 MiB of non-volatile storage
to cache repeated transfers. This cache is arranged in ~8 KiB blocks and
is addressed by the MD5 digest of the data contained therein.

Optionally, this driver is able to take advantage of Raspberry Pi RP1
GPIOs to achieve faster than I2C data transfer rates.

Signed-off-by: Richard Oliver <[email protected]>

spi: rp2040-gpio-bridge: Add debugfs progress indicator

Useful for tracking upload progress via userspace.

Signed-off-by: Naushir Patuck <[email protected]>

spi: rp2040-gpio-bridge: add missing MD5 dependency

rp2040-gpio-bridge relies on the md5 crypto driver. This dependency
cannot be determined automatically as rp2040-gpio-bridge does not
use any of md5's symbols directly.

Declare a soft 'pre' dependency on md5 to ensure that it is included and
loaded before rp2040-gpio-bridge.

Signed-off-by: Richard Oliver <[email protected]>

spi: rp2040-gpio-bridge: fix gpiod error handling

In some circumstances, devm_gpiod_get_array_optional() can return
PTR_ERR rather than NULL to indicate failure. Handle these cases.

Signed-off-by: Richard Oliver <[email protected]>

spi: rp2040-gpio-bridge: probe: Cfg fast_xfer clk

Fast transfer mode requires that the first bit of data is clocked with a
rising edge. This can cause extra bits of data to be clocked on hardware
where the clock signal uses a pull-up. This change ensures that clk is
driven low before fast data transfer mode is entered.

Signed-off-by: Richard Oliver <[email protected]>
The snps,block-size DT property declares the maximum block size for each
channel of the dw-axi-dmac. However, the driver ignores these when
setting max_seg_size and uses MAX_BLOCK_SIZE (4096) instead.

To take advantage of the efficiencies of larger blocks, calculate the
minimum block size across all channels and use that instead.

See: raspberrypi#6256

Signed-off-by: Phil Elwell <[email protected]>
The firmware advertises its features as a string of words separated by
spaces. Ensure that feature names are only matched in their entirety.

Signed-off-by: Phil Elwell <[email protected]>
The Cypress firmwares use "extsae" to indicate wpa_supplicant-hosted
SAE/WPA3.

Signed-off-by: Phil Elwell <[email protected]>
support sae executed in wpa_supplicant and offload 4-way handshake offload.

Signed-off-by: Chien-Chia Chen <[email protected]>

JIRA: SWWLAN-142424
TMOD_TO is the transmit-only mode that doesn't put data into the receive
FIFO. Using TMOD_TO when the user doesn't want the received data saves
CPU time and memory bandwidth.

Signed-off-by: Phil Elwell <[email protected]>
TMOD_RO is the receive-only mode that doesn't require data in the
transmit FIFO in order to generate clock cycles. Using TMOD_RO when the
device doesn't care about the data sent to it saves CPU time and memory
bandwidth.

Signed-off-by: Phil Elwell <[email protected]>
Disabling the peripheral resets controller state which has a dangerous
side-effect of disabling the DMA handshake interface while it is active.
This can cause DMA channels to hang.

The error recovery pathway will wait for DMA to stop and reset the chip
anyway, so mask further FIFO interrupts and let the transfer finish
gracefully.

Signed-off-by: Jonathan Bell <[email protected]>
There's no real need to constrain MEM access widths to 32-bit (or
narrower), as the DMAC is intelligent enough to size memory accesses
appropriately. Wider accesses are more efficient.

Similarly, MEM burst lengths don't need to be a function of DEV burst
lengths - the DMAC packs/unpacks data into/from its internal channel
FIFOs appropriately. Longer accesses are more efficient.

However, the DMAC doesn't have complete support for unaligned accesses,
and blocks are always defined in integer multiples of SRC_WIDTH, so odd
source lengths or buffer alignments will prevent wide accesses being
used, as before.

There is an implicit requirement to limit requested DEV read burst
lengths to less than the hardware's maximum configured MSIZE - otherwise
RX data will be left over at the end of a block. There is no config
register that reports this value, so the AXI burst length parameter is
used to produce a facsimile of it. Warn if such a request arrives that
doesn't respect this.

Signed-off-by: Jonathan Bell <[email protected]>
Do an end-run around ASoC in lieu of not being able to easily find the
associated DMA controller capabilities.

Signed-off-by: Jonathan Bell <[email protected]>
Ensure the transmit FIFO has emptied before ending the transfer by
dropping the TX threshold to 0 when the last byte has been pushed into
the FIFO. Include a similar fix for the non-IRQ paths.

See: raspberrypi#6285
Fixes: 6014649 ("spi: dw: Save bandwidth with the TMOD_TO feature")
Signed-off-by: Phil Elwell <[email protected]>
This at least compiles.

Signed-off-by: Phil Elwell <[email protected]>
@pelwell
Copy link
Contributor

pelwell commented Aug 20, 2025

The Pi 5 dts file built from this tree references the following clocks:

RP1_CLK_ADC
RP1_CLK_AUDIO_OUT
RP1_CLK_DMA
RP1_CLK_DPI
RP1_CLK_ETH
RP1_CLK_ETH_TSU
RP1_CLK_GP0
RP1_CLK_GP1
RP1_CLK_GP2
RP1_CLK_GP3
RP1_CLK_GP4
RP1_CLK_GP5
RP1_CLK_I2S
RP1_CLK_MIPI0_CFG
RP1_CLK_MIPI0_DPI
RP1_CLK_MIPI0_DSI_BYTECLOCK
RP1_CLK_MIPI1_CFG
RP1_CLK_MIPI1_DPI
RP1_CLK_MIPI1_DSI_BYTECLOCK
RP1_CLK_PWM0
RP1_CLK_PWM1
RP1_CLK_SDIO_TIMER
RP1_CLK_SLOW_SYS
RP1_CLK_SYS
RP1_CLK_UART
RP1_CLK_VEC

And clk-rp1.c defines the following clocks:

RP1_CLK_ETH
RP1_CLK_ETH_TSU
RP1_CLK_SYS

We can ignore the GP clocks for now, but quite a few of the others are important.

@6by9
Copy link
Contributor Author

6by9 commented Aug 20, 2025

I think https://lore.kernel.org/linux-arm-kernel/17e5c6e0c085cfa0bf4b63b639cdc92c6a4c1418.1750714412.git.andrea.porta@suse.com/ (which is in linux-next ie 6.18) should add all of those for us.
I'll cherry-pick it.

@6by9
Copy link
Contributor Author

6by9 commented Aug 20, 2025

All the ethernet patches for RP1 have at least got R-b tags, so it may be worth backporting the official versions of those as well.
https://lore.kernel.org/linux-arm-kernel/[email protected]/

@6by9 6by9 force-pushed the rpi-6.17.y-mainline-dt branch from da331a3 to 02c6dac Compare August 20, 2025 15:23
@6by9
Copy link
Contributor Author

6by9 commented Aug 20, 2025

Branch updated with the updated clock driver. It appears to include all the clocks you've listed.

clk_summary gives me:

pi@pi5-nvme:~ $ cat /sys/kernel/debug/clk/clk_summary 
                                 enable  prepare  protect                                duty  hardware                            connection
   clock                          count    count    count        rate   accuracy phase  cycle    enable   consumer                         id
---------------------------------------------------------------------------------------------------------------------------------------------
 fw-clk-disp                         1       1        0        0           0          0     50000      Y   107c580000.hvs                  disp                     
                                                                                                           deviceless                      no_connection_id         
 fw-clk-vec                          0       0        0        0           0          0     50000      Y   deviceless                      no_connection_id         
 fw-clk-pixel-bvb                    1       1        0        324000000   0          0     50000      Y   107c706400.hdmi                 bvb                      
                                                                                                           107c701400.hdmi                 bvb                      
                                                                                                           deviceless                      no_connection_id         
 fw-clk-m2mc                         3       3        0        599940000   0          0     50000      Y   107c706400.hdmi                 hdmi                     
                                                                                                           107c701400.hdmi                 hdmi                     
                                                                                                           deviceless                      no_connection_id         
 fw-clk-hevc                         0       0        0        500000000   0          0     50000      Y   1000800000.codec                no_connection_id         
                                                                                                           deviceless                      no_connection_id         
 fw-clk-pixel                        0       0        0        0           0          0     50000      Y   deviceless                      no_connection_id         
 fw-clk-isp                          0       0        0        500000000   0          0     50000      Y   1000880000.pisp_be              no_connection_id         
                                                                                                           deviceless                      no_connection_id         
 fw-clk-v3d                          1       1        0        500000000   0          0     50000      Y   1002000000.v3d                  no_connection_id         
                                                                                                           deviceless                      no_connection_id         
 fw-clk-core                         1       1        0        500000000   0          0     50000      Y   107c580000.hvs                  core                     
                                                                                                           deviceless                      no_connection_id         
 fw-clk-arm                          0       0        0        1500000000  0          0     50000      Y   cpu0                            no_connection_id         
                                                                                                           cpu0                            no_connection_id         
                                                                                                           deviceless                      no_connection_id         
 rp1-xosc                            5       5        0        50000000    0          0     50000      Y   deviceless                      no_connection_id         
    clksrc_mipi1_dsi_byteclk         0       0        0        0           0          0     50000      Y      deviceless                      no_connection_id         
    clksrc_mipi0_dsi_byteclk         0       0        0        0           0          0     50000      Y      deviceless                      no_connection_id         
    clk_gp5                          0       0        0        50000000    0          0     50000      Y      deviceless                      no_connection_id         
    clk_gp4                          0       0        0        50000000    0          0     50000      Y      deviceless                      no_connection_id         
    clk_gp3                          0       0        0        50000000    0          0     50000      Y      deviceless                      no_connection_id         
    clk_gp0                          0       0        0        50000000    0          0     50000      Y      deviceless                      no_connection_id         
    clk_sdio_timer                   0       0        0        1000000     0          0     50000      Y      deviceless                      no_connection_id         
       clk_gp1                       0       0        0        1000000     0          0     50000      Y         deviceless                      no_connection_id         
    clk_adc                          0       0        0        50000000    0          0     50000      Y      deviceless                      no_connection_id         
    clk_eth_tsu                      1       1        0        50000000    0          0     50000      Y      1f00100000.ethernet             tsu_clk                  
                                                                                                              1f00100000.ethernet             tsu_clk                  
                                                                                                              deviceless                      no_connection_id         
    clk_mipi1_cfg                    0       0        0        50000000    0          0     50000      Y      deviceless                      no_connection_id         
    clk_mipi0_cfg                    0       0        0        50000000    0          0     50000      Y      deviceless                      no_connection_id         
    clk_i2s                          0       0        0        50000000    0          0     50000      Y      deviceless                      no_connection_id         
    clk_uart                         0       0        0        50000000    0          0     50000      Y      deviceless                      no_connection_id         
    clk_slow_sys                     1       1        0        50000000    0          0     50000      Y      deviceless                      no_connection_id         
    pll_video_core                   1       1        0        0           0          0     50000      Y      deviceless                      no_connection_id         
       pll_video_sec                 0       0        0        0           0          0     50000      Y         deviceless                      no_connection_id         
       pll_video                     0       0        0        0           0          0     50000      Y         deviceless                      no_connection_id         
          pll_video_pri_ph           0       0        0        0           0          0     50000      Y            deviceless                      no_connection_id         
    pll_audio_core                   1       1        0        1536000001  0          0     50000      Y      deviceless                      no_connection_id         
       pll_audio_tern                0       0        0        80842106    0          0     50000      Y         deviceless                      no_connection_id         
       pll_audio_sec                 0       0        0        153600001   0          0     50000      Y         deviceless                      no_connection_id         
       pll_audio                     0       0        0        61440000    0          0     50000      Y         deviceless                      no_connection_id         
          pll_audio_pri_ph           0       0        0        30720000    0          0     50000      Y            deviceless                      no_connection_id         
    pll_sys_core                     3       3        0        1000000000  0          0     50000      Y      deviceless                      no_connection_id         
       pll_sys_sec                   1       1        0        125000000   0          0     50000      Y         deviceless                      no_connection_id         
          clk_eth                    1       1        0        125000000   0          0     50000      Y            1f00100000.ethernet             tx_clk                   
                                                                                                                    deviceless                      no_connection_id         
       pll_sys                       2       2        0        200000000   0          0     50000      Y         deviceless                      no_connection_id         
          clk_mipi1_dpi              0       0        0        200000000   0          0     50000      Y            deviceless                      no_connection_id         
          clk_mipi0_dpi              0       0        0        200000000   0          0     50000      Y            deviceless                      no_connection_id         
          clk_dpi                    0       0        0        200000000   0          0     50000      Y            deviceless                      no_connection_id         
          clk_sdio_alt_src           0       0        0        200000000   0          0     50000      Y            deviceless                      no_connection_id         
             clk_gp2                 0       0        0        200000000   0          0     50000      Y               deviceless                      no_connection_id         
          clk_sys                    4       4        0        200000000   0          0     50000      Y            1f00188000.dma                  cfgr-clk                 
                                                                                                                    1f00100000.ethernet             hclk                     
                                                                                                                    1f00100000.ethernet             pclk                     
                                                                                                                    deviceless                      no_connection_id         
          pll_sys_pri_ph             1       1        0        100000000   0          0     50000      Y            deviceless                      no_connection_id         
             clk_vec                 0       0        0        100000000   0          0     50000      Y               deviceless                      no_connection_id         
             clk_dma                 1       1        0        100000000   0          0     50000      Y               1f00188000.dma                  core-clk                 
                                                                                                                       deviceless                      no_connection_id         
 108MHz-clock                        1       1        0        108000000   0          0     50000      Y   deviceless                      no_connection_id         
    hdmi1-108MHz                     0       0        0        108000000   0          0     50000      N      107c706400.hdmi                 audio                    
                                                                                                              deviceless                      no_connection_id         
    hdmi0-108MHz                     1       1        0        108000000   0          0     50000      Y      107c701400.hdmi                 audio                    
                                                                                                              deviceless                      no_connection_id         
 27MHz-clock                         0       0        0        27000000    0          0     50000      Y   107c706400.hdmi                 cec                      
                                                                                                           107c701400.hdmi                 cec                      
                                                                                                           deviceless                      no_connection_id         
 otg                                 1       1        0        480000000   0          0     50000      Y   1000480000.usb                  otg                      
                                                                                                           deviceless                      no_connection_id         
 core                                0       0        0        50000000    0          0     50000      Y   deviceless                      no_connection_id         
 src                                 0       0        0        1000000000  0          0     50000      Y   deviceless                      no_connection_id         
 emmc2-clock                         2       2        0        200000000   0          0     50000      Y   1001100000.mmc                  no_connection_id         
                                                                                                           1000fff000.mmc                  no_connection_id         
                                                                                                           deviceless                      no_connection_id         
 uart-clock                          1       2        0        44236800    0          0     50000      Y   107d001000.serial               no_connection_id         
                                                                                                           deviceless                      no_connection_id         
 vpu-clock                           1       1        0        750000000   0          0     50000      Y   107d001000.serial               apb_pclk                 
                                                                                                           deviceless                      no_connection_id         
 osc                                 0       0        0        54000000    0          0     50000      Y   deviceless                      no_connection_id         
 clk_audio_out                       0       0        0        0           0          0     50000      Y   deviceless                      no_connection_id         
 clk_audio_in                        0       0        0        0           0          0     50000      Y   deviceless                      no_connection_id         
 clk_pwm1                            0       0        0        0           0          0     50000      Y   deviceless                      no_connection_id         
 clk_pwm0                            0       0        0        0           0          0     50000      Y   deviceless                      no_connection_id         

@pelwell
Copy link
Contributor

pelwell commented Aug 21, 2025

In 6.16 and earlier, the Pi 5 dts files have the following structure:

bcm2712-rpi-5-b.dts  // Board-specific (shared)
    bcm2712-ds.dtsi    // Downstream changes common to BCM2712-based devices
        bcm2712.dtsi    // Pure upstream file
    rp1.dtsi
    bcm2712-rpi.dtsi   // Downstream file common to all members of the Pi 5 family

The new structure is:

bcm2712-rpi-5-b.dts
    bcm2712-rpi-5-b-ovl-rp1.dts
        bcm2712.dtsi
    rp1-nexus.dtsi
        rp1-common.dtsi
    bcm2712-ds.dtsi

It lacks any clear equivalent of the last file, which is important for adding things such as RP1, the DT overrides, gpiomem declarations etc. Some of the features have been folded into bcm2712-ds.dtsi, which shouldn't contain any references to RP1, and some are in bcm2712-rpi-5-b-ovl-rp1.dts.

6by9 added 5 commits August 21, 2025 14:35
The driver was calling pinctrl_lookup_state on the result from
devm_pinctrl_get without ensuring it wasn't NULL or an error,
which could result in a seg fault.

Signed-off-by: Dave Stevenson <[email protected]>
CHECK ME!
pinctrl-rp1 looks up the RP1 node to try and find the parent and
then pokes at the registers thereof.
"rp1" has been renamed "rp1_nexus", so accept that.

Signed-off-by: Dave Stevenson <[email protected]>
@6by9
Copy link
Contributor Author

6by9 commented Aug 21, 2025

Happy to restructure. The existing files were lacking in comments with regard the segregation of devices nodes.

A couple of notes:

We ought to be trying to direct upstreaming of Pi500 and CM5. As there are common blocks between those and Pi5, those want to move out of bcm2712-rpi-5-b.dts and into what mainline would normally be called bcm2712-rpi.dtsi.
Is it better to create bcm2712-rpi-ds.dtsi to avoid merge conflicts with upstream gaining similar common sections?

The old files had a bundle of duplication in bcm2712-rpi-5-b.dts and bcm2712-rpi-cm5.dtsi that presumably should be factored out (eg PCIe qos settings, RP1 PCIe address layout, ethernet config, enabling rp1 blocks, etc). Sounds like they should be in bcm2712-rpi(-ds).dtsi based on your description of the split.

In 6.16, rp1.dtsi included defining a number of external clocks, /rp1_firmware and /rp1_vdd_3v3 - https://github.com/raspberrypi/linux/blob/rpi-6.16.y/arch/arm64/boot/dts/broadcom/rp1.dtsi#L1247-L1343
rp1-nexus.dtsi is included from within the &pcie2 node, therefore it can not define these external nodes. They therefore need to move, presumably bcm2712-rpi(-ds).dtsi.
Or are they actually internal to RP1, and hence should be under rp1? rp1/rp1_pio then links to /rp1_firmware. /rp1_firmware links to rp1/rp1_fw_shmem and rp1/rp1_mbox. So that does imply /rp1_firmware should be under rp1. Is it not due to address mapping?

IMHO it makes more sense to directly include the downstream files from bcm2712-rpi-5-b.dts, rather than the chain of includes that we have on the other boards. bcm2712-rpi-5-b.dts, bcm2712-rpi-5-b-ovl-rp1.dts, and bcm2712.dtsi are already upstream, therefore there seems little point in breaking the include chain to insert something in the middle.

@pelwell
Copy link
Contributor

pelwell commented Aug 21, 2025

Is it better to create bcm2712-rpi-ds.dtsi to avoid merge conflicts with upstream gaining similar common sections?

We could rename bcm2712-rpi.dtsi now - it might save popcornmix a few minutes someday.

Sounds like they should be in bcm2712-rpi(-ds).dtsi based on your description of the split.

Yes, if they are effectively universal.

In 6.16, rp1.dtsi included defining a number of external clocks, /rp1_firmware and /rp1_vdd_3v3 - https://github.com/raspberrypi/linux/blob/rpi-6.16.y/arch/arm64/boot/dts/broadcom/rp1.dtsi#L1247-L1343
rp1-nexus.dtsi is included from within the &pcie2 node, therefore it can not define these external nodes.

External in what way? If you mean sitting outside the rp1 node, I don't think there's any technical reason they have to. There's no address mapping involved in the firmware - no addresses are exchanged. Clocks and regulators can be declared anywhere, even if they may need a simple-bus to get them enumerated.

IMHO it makes more sense to directly include the downstream files from bcm2712-rpi-5-b.dts, rather than the chain of includes that we have on the other boards.

Isn't that already the case? The hierarchies I included above are complete, simple as they are. The upstream additions have made it worse, but we don't need to make it worser.

6by9 and others added 9 commits August 21, 2025 18:32
Adds bcm2712-ds.dtsi to define all the bits that aren't in the
mainline file.

Currently there are going to be various Pi5 specific sections
in there. Propose splitting into a set of
- bcm2712-rpi-5-b-ds.dtsi
- bcm2712-rpi-500-ds.dtsi
- bcm2712-rpi-cm5-ds.dtsi
etc, so that the those files can contain the platform specific
modifications required.

Signed-off-by: Dave Stevenson <[email protected]>
Declare the positional index for the RP1 MIPI clocks.

Signed-off-by: Andrea della Porta <[email protected]>
Reviewed-by: Stephen Boyd <[email protected]>
The RP1 clock generator driver currently defines only the fundamental
clocks such as the front PLLs for system, audio and video subsystems
and the ethernet clock.

Add the remaining clocks to the tree so as to be completed, which means
that the following RP1 peripherals could now consume their specific clocks
and be enabled to work (provided that the relevant driver changes for each
specific peripheral, if any, are committed):

- ADC
- Audio IN/OUT
- DMA controller
- I2S
- MIPI DPI/DSI
- PWM
- SDIO
- UART
- Video Encoder

Signed-off-by: Andrea della Porta <[email protected]>
Reviewed-by: Stephen Boyd <[email protected]>
@6by9 6by9 force-pushed the rpi-6.17.y-mainline-dt branch from 02c6dac to a5aa476 Compare August 21, 2025 17:33
@6by9 6by9 force-pushed the rpi-6.17.y-mainline-dt branch from a5aa476 to 77a0132 Compare August 21, 2025 17:40
@6by9
Copy link
Contributor Author

6by9 commented Aug 21, 2025

Is it better to create bcm2712-rpi-ds.dtsi to avoid merge conflicts with upstream gaining similar common sections?

We could rename bcm2712-rpi.dtsi now - it might save popcornmix a few minutes someday.

Done, and will be looking to do the equivalent as bcm2712-rpi.dtsi on mainline next week.

Sounds like they should be in bcm2712-rpi(-ds).dtsi based on your description of the split.

Yes, if they are effectively universal.

Branch updated doing that.

In 6.16, rp1.dtsi included defining a number of external clocks, /rp1_firmware and /rp1_vdd_3v3 - https://github.com/raspberrypi/linux/blob/rpi-6.16.y/arch/arm64/boot/dts/broadcom/rp1.dtsi#L1247-L1343
rp1-nexus.dtsi is included from within the &pcie2 node, therefore it can not define these external nodes.

External in what way? If you mean sitting outside the rp1 node, I don't think there's any technical reason they have to. There's no address mapping involved in the firmware - no addresses are exchanged. Clocks and regulators can be declared anywhere, even if they may need a simple-bus to get them enumerated.

Moved inside rp1 node. Seems to work.

IMHO it makes more sense to directly include the downstream files from bcm2712-rpi-5-b.dts, rather than the chain of includes that we have on the other boards.

Isn't that already the case? The hierarchies I included above are complete, simple as they are. The upstream additions have made it worse, but we don't need to make it worser.

With the new tree, yes. I was saying that I didn't want to revert to the old massive heirarchy.

Branch updated and boots Pi5 OK. Has working ethernet, USB, HDMI, serial console (although I do still have the extra entry in cmdline.txt).

One error to resolve:

[    0.776778] sram 1000120000.pcie:rp1_nexus:pci-ep-bus@1:sram@40400000: error -EINVAL: invalid resource (null)
[    0.777109] sram 1000120000.pcie:rp1_nexus:pci-ep-bus@1:sram@40400000: could not map SRAM registers
[    0.777435] sram 1000120000.pcie:rp1_nexus:pci-ep-bus@1:sram@40400000: probe with driver sram failed with error -22

Looks like address mapping issues

CM5 needs updating still to use the new files.

@pelwell
Copy link
Contributor

pelwell commented Aug 21, 2025

I didn't want to revert to the old massive heirarchy.

Show me what you consider to be the old massive hierarchy?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.