This is an automated email from the ASF dual-hosted git repository.

acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new 11d1965cc04 arch/rp23xx: Fix six register/bit macro name clashes.
11d1965cc04 is described below

commit 11d1965cc0445c1470ad6011513e53151216fddd
Author: Marco Casaroli <[email protected]>
AuthorDate: Sat Jul 25 16:14:40 2026 +0200

    arch/rp23xx: Fix six register/bit macro name clashes.
    
    The rp23xx hardware headers define a register address macro for every
    register, then a block of register bit definitions.  In three headers a bit
    definition reuses the name of a register address macro, so the register
    address is silently redefined as a bit mask:
    
      RP23XX_POWMAN_BADPASSWD           address 0x40100000 -> (1 << 0)
      RP23XX_POWMAN_BOD_CTRL            address 0x40100018 -> (1 << 12)
      RP23XX_POWMAN_DBG_PWRCFG          address 0x401000a4 -> (1 << 0)
      RP23XX_BUSCTRL_BUS_PRIORITY_ACK   address 0x40068004 -> (1 << 0)
      RP23XX_BUSCTRL_PERFCTR_EN         address 0x40068008 -> (1 << 0)
      RP23XX_PADS_QSPI_VOLTAGE_SELECT   address 0x40040000 -> (1 << 0)
    
    None of these headers has an in-tree user yet, which is why this has gone
    unnoticed; each clash appears as a "macro redefined" warning as soon as a
    driver includes the header.  Code that included one of them and used the
    register by name would have dereferenced 1 or 0x1000 instead of the 
register.
    
    Two of the POWMAN clashes were plain duplicates.  Per the RP2350 datasheet
    BOD_CTRL bit 12 is ISOLATE and DBG_PWRCFG bit 0 is IGNORE, and the correctly
    named RP23XX_POWMAN_BOD_CTRL_ISOLATE and RP23XX_POWMAN_DBG_PWRCFG_IGNORE 
were
    already defined with the same values on the following lines, so the bare 
names
    are simply removed.  The blank line separating the VREG_LP_EXIT and BOD_CTRL
    groups is restored at the same time; its absence is what let the duplicate
    hide inside the preceding group.
    
    The other four are single field registers whose field carries no separate 
name
    (the datasheet and the SDK describe each as a one bit register), so their 
bit
    definitions are renamed to <REGISTER>_MASK, following the _MASK spelling 
these
    headers already use for a field extent, and written in hex like their peers.
    
    The rp23xx-rv copies of the three headers are identical to the arm ones and
    carry the same clashes, so they get the same change and stay in sync.
    
    No functional change: none of the six names has any user in the tree.
    
    Assisted-by: Claude Code:claude-opus-5
    Signed-off-by: Marco Casaroli <[email protected]>
---
 arch/arm/src/rp23xx/hardware/rp23xx_busctrl.h         | 4 ++--
 arch/arm/src/rp23xx/hardware/rp23xx_pads_qspi.h       | 2 +-
 arch/arm/src/rp23xx/hardware/rp23xx_powman.h          | 5 ++---
 arch/risc-v/src/rp23xx-rv/hardware/rp23xx_busctrl.h   | 4 ++--
 arch/risc-v/src/rp23xx-rv/hardware/rp23xx_pads_qspi.h | 2 +-
 arch/risc-v/src/rp23xx-rv/hardware/rp23xx_powman.h    | 5 ++---
 6 files changed, 10 insertions(+), 12 deletions(-)

diff --git a/arch/arm/src/rp23xx/hardware/rp23xx_busctrl.h 
b/arch/arm/src/rp23xx/hardware/rp23xx_busctrl.h
index 32059ce0807..2ea6ef72583 100644
--- a/arch/arm/src/rp23xx/hardware/rp23xx_busctrl.h
+++ b/arch/arm/src/rp23xx/hardware/rp23xx_busctrl.h
@@ -56,8 +56,8 @@
 #define RP23XX_BUSCTRL_BUS_PRIORITY_DMA_R   (1 << 8)
 #define RP23XX_BUSCTRL_BUS_PRIORITY_PROC1   (1 << 4)
 #define RP23XX_BUSCTRL_BUS_PRIORITY_PROC0   (1 << 0)
-#define RP23XX_BUSCTRL_BUS_PRIORITY_ACK     (1 << 0)
-#define RP23XX_BUSCTRL_PERFCTR_EN           (1 << 0)
+#define RP23XX_BUSCTRL_BUS_PRIORITY_ACK_MASK 0x00000001
+#define RP23XX_BUSCTRL_PERFCTR_EN_MASK      0x00000001
 #define RP23XX_BUSCTRL_PERFCTR_MASK         0x00ffffff
 #define RP23XX_BUSCTRL_PERFSEL_MASK         0x0000007f
 
diff --git a/arch/arm/src/rp23xx/hardware/rp23xx_pads_qspi.h 
b/arch/arm/src/rp23xx/hardware/rp23xx_pads_qspi.h
index 378a510ade2..6985ad7f6ac 100644
--- a/arch/arm/src/rp23xx/hardware/rp23xx_pads_qspi.h
+++ b/arch/arm/src/rp23xx/hardware/rp23xx_pads_qspi.h
@@ -55,7 +55,7 @@
 
 /* Register bit definitions *************************************************/
 
-#define RP23XX_PADS_QSPI_VOLTAGE_SELECT             (1 << 0)
+#define RP23XX_PADS_QSPI_VOLTAGE_SELECT_MASK        0x00000001
 #define RP23XX_PADS_QSPI_GPIO_QSPI_SCLK_MASK        0x000001ff
 #define RP23XX_PADS_QSPI_GPIO_QSPI_SCLK_ISO         (1 << 8)
 #define RP23XX_PADS_QSPI_GPIO_QSPI_SCLK_OD          (1 << 7)
diff --git a/arch/arm/src/rp23xx/hardware/rp23xx_powman.h 
b/arch/arm/src/rp23xx/hardware/rp23xx_powman.h
index e694d56d57f..aa660232e66 100644
--- a/arch/arm/src/rp23xx/hardware/rp23xx_powman.h
+++ b/arch/arm/src/rp23xx/hardware/rp23xx_powman.h
@@ -161,7 +161,7 @@
 
 /* Register bit definitions *************************************************/
 
-#define RP23XX_POWMAN_BADPASSWD                         (1 << 0)
+#define RP23XX_POWMAN_BADPASSWD_MASK                    0x00000001
 
 #define RP23XX_POWMAN_VREG_CTRL_RST_N                   (1 << 15)
 #define RP23XX_POWMAN_VREG_CTRL_UNLOCK                  (1 << 13)
@@ -183,7 +183,7 @@
 #define RP23XX_POWMAN_VREG_LP_EXIT_VSEL_MASK            0x000001f0
 #define RP23XX_POWMAN_VREG_LP_EXIT_MODE                 (1 << 2)
 #define RP23XX_POWMAN_VREG_LP_EXIT_HIZ                  (1 << 1)
-#define RP23XX_POWMAN_BOD_CTRL                          (1 << 12)
+
 #define RP23XX_POWMAN_BOD_CTRL_ISOLATE                  (1 << 12)
 
 #define RP23XX_POWMAN_BOD_VSEL_MASK                     0x000001f0
@@ -317,7 +317,6 @@
 #define RP23XX_POWMAN_PWRUP3_SOURCE_MASK                0x0000003f
 #define RP23XX_POWMAN_CURRENT_PWRUP_REQ_MASK            0x0000007f
 #define RP23XX_POWMAN_LAST_SWCORE_PWRUP_MASK            0x0000007f
-#define RP23XX_POWMAN_DBG_PWRCFG                        (1 << 0)
 #define RP23XX_POWMAN_DBG_PWRCFG_IGNORE                 (1 << 0)
 #define RP23XX_POWMAN_BOOTDIS_MASK                      0x00000003
 #define RP23XX_POWMAN_BOOTDIS_NEXT                      (1 << 1)
diff --git a/arch/risc-v/src/rp23xx-rv/hardware/rp23xx_busctrl.h 
b/arch/risc-v/src/rp23xx-rv/hardware/rp23xx_busctrl.h
index dc4353b7adc..733689c0d9a 100644
--- a/arch/risc-v/src/rp23xx-rv/hardware/rp23xx_busctrl.h
+++ b/arch/risc-v/src/rp23xx-rv/hardware/rp23xx_busctrl.h
@@ -56,8 +56,8 @@
 #define RP23XX_BUSCTRL_BUS_PRIORITY_DMA_R   (1 << 8)
 #define RP23XX_BUSCTRL_BUS_PRIORITY_PROC1   (1 << 4)
 #define RP23XX_BUSCTRL_BUS_PRIORITY_PROC0   (1 << 0)
-#define RP23XX_BUSCTRL_BUS_PRIORITY_ACK     (1 << 0)
-#define RP23XX_BUSCTRL_PERFCTR_EN           (1 << 0)
+#define RP23XX_BUSCTRL_BUS_PRIORITY_ACK_MASK 0x00000001
+#define RP23XX_BUSCTRL_PERFCTR_EN_MASK      0x00000001
 #define RP23XX_BUSCTRL_PERFCTR_MASK         0x00ffffff
 #define RP23XX_BUSCTRL_PERFSEL_MASK         0x0000007f
 
diff --git a/arch/risc-v/src/rp23xx-rv/hardware/rp23xx_pads_qspi.h 
b/arch/risc-v/src/rp23xx-rv/hardware/rp23xx_pads_qspi.h
index ea948eb4111..43141c94bf1 100644
--- a/arch/risc-v/src/rp23xx-rv/hardware/rp23xx_pads_qspi.h
+++ b/arch/risc-v/src/rp23xx-rv/hardware/rp23xx_pads_qspi.h
@@ -55,7 +55,7 @@
 
 /* Register bit definitions *************************************************/
 
-#define RP23XX_PADS_QSPI_VOLTAGE_SELECT             (1 << 0)
+#define RP23XX_PADS_QSPI_VOLTAGE_SELECT_MASK        0x00000001
 #define RP23XX_PADS_QSPI_GPIO_QSPI_SCLK_MASK        0x000001ff
 #define RP23XX_PADS_QSPI_GPIO_QSPI_SCLK_ISO         (1 << 8)
 #define RP23XX_PADS_QSPI_GPIO_QSPI_SCLK_OD          (1 << 7)
diff --git a/arch/risc-v/src/rp23xx-rv/hardware/rp23xx_powman.h 
b/arch/risc-v/src/rp23xx-rv/hardware/rp23xx_powman.h
index 83eff35245a..bd423693586 100644
--- a/arch/risc-v/src/rp23xx-rv/hardware/rp23xx_powman.h
+++ b/arch/risc-v/src/rp23xx-rv/hardware/rp23xx_powman.h
@@ -161,7 +161,7 @@
 
 /* Register bit definitions *************************************************/
 
-#define RP23XX_POWMAN_BADPASSWD                         (1 << 0)
+#define RP23XX_POWMAN_BADPASSWD_MASK                    0x00000001
 
 #define RP23XX_POWMAN_VREG_CTRL_RST_N                   (1 << 15)
 #define RP23XX_POWMAN_VREG_CTRL_UNLOCK                  (1 << 13)
@@ -183,7 +183,7 @@
 #define RP23XX_POWMAN_VREG_LP_EXIT_VSEL_MASK            0x000001f0
 #define RP23XX_POWMAN_VREG_LP_EXIT_MODE                 (1 << 2)
 #define RP23XX_POWMAN_VREG_LP_EXIT_HIZ                  (1 << 1)
-#define RP23XX_POWMAN_BOD_CTRL                          (1 << 12)
+
 #define RP23XX_POWMAN_BOD_CTRL_ISOLATE                  (1 << 12)
 
 #define RP23XX_POWMAN_BOD_VSEL_MASK                     0x000001f0
@@ -317,7 +317,6 @@
 #define RP23XX_POWMAN_PWRUP3_SOURCE_MASK                0x0000003f
 #define RP23XX_POWMAN_CURRENT_PWRUP_REQ_MASK            0x0000007f
 #define RP23XX_POWMAN_LAST_SWCORE_PWRUP_MASK            0x0000007f
-#define RP23XX_POWMAN_DBG_PWRCFG                        (1 << 0)
 #define RP23XX_POWMAN_DBG_PWRCFG_IGNORE                 (1 << 0)
 #define RP23XX_POWMAN_BOOTDIS_MASK                      0x00000003
 #define RP23XX_POWMAN_BOOTDIS_NEXT                      (1 << 1)

Reply via email to