Invalid i2c DT node names

Open
#5,469 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Tech stack
c, linux

Research direction

Start with arch/arm/boot/dts/bcm2711-rpi-4-b.dts and the bcm2711.dtsi, bcm283x-rpi-wifi-bt.dtsi, bcm270x.dtsi, and bcm2711-rpi.dtsi includes shown in the report; compare preprocessing with and without a9865ec3e1a0. Trace why the i2c0 macro changes hyphenated node names, then verify generated names remain valid and match the expected grep output.

Written by the indexing model from the issue text.

Description

Describe the bug

Since commit a9865ec3e1a0 some i2c DT node names look funny. This is because of the #defines added by downstream commit 'BCM270X_DT: Use bcm283x.dtsi, bcm2835.dtsi and bcm2836.dtsi' (I think) and the pre-processor somehow tripping over the new dashes in the node names.

I.e.

$ head  arch/arm/boot/dts/bcm2711-rpi-4-b.dts 
// SPDX-License-Identifier: GPL-2.0
/dts-v1/;
#define BCM2711
#define i2c0 i2c0if
#include "bcm2711.dtsi"
#include "bcm283x-rpi-wifi-bt.dtsi"
#undef i2c0
#include "bcm270x.dtsi"
#define i2c0 i2c0mux
#include "bcm2711-rpi.dtsi"

That #define i2c0 i2c0if results in:

$ grep i2c0if bcm2711-rpi-4-b.dts
			i2c0if-gpio0 {
			i2c0if-gpio28 {
			i2c0if-gpio44 {
			i2c0if-gpio46 {
		i2c0_gpio0 = "/soc/gpio@7e200000/i2c0if-gpio0";
		i2c0_gpio28 = "/soc/gpio@7e200000/i2c0if-gpio28";
		i2c0_gpio44 = "/soc/gpio@7e200000/i2c0if-gpio44";
		i2c0_gpio46 = "/soc/gpio@7e200000/i2c0if-gpio46";
		i2c0if = "/soc/i2c@7e205000";

After reverting a9865ec3e1a0:

$ grep i2c0if bcm2711-rpi-4-b.dts
		i2c0if = "/soc/i2c@7e205000";
Steps to reproduce the behaviour

See description.

Device (s)

Other

System

N/A

Logs

No response

Additional context

No response

Dominant language
C
Stars
13.2k
Forks
5.5k
Avg merge
2d 21h
Merged PRs (30d)
21

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from raspberrypi/linux

All issues in raspberrypi/linux

Similar issues

More C issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.