[PATCH 14/18] rockchip: rk3588: add constants for some register address spaces

Kever Yang kever.yang at rock-chips.com
Thu Feb 1 03:58:29 CET 2024


On 2024/1/23 22:49, Quentin Schulz wrote:
> From: Quentin Schulz <quentin.schulz at theobroma-systems.com>
>
> It's one thing to have the register mapped via a well-defined struct but
> it's another to be able to make use of it. For that to happen, one needs
> to cast the physical address memory of the beginning of the register
> address space with the struct. Since this cannot change, let's hardcode
> it in the include files so that users do not need to duplicate this line
> of code in their own implementation.
Usually only one place using these base address when the dts is not 
using, so it's not a
big issue to define at where it's used.


Reviewed-by: Kever Yang <kever.yang at rock-chips.com>

Thanks,
- Kever

>
> Cc: Quentin Schulz <foss+uboot at 0leil.net>
> Signed-off-by: Quentin Schulz <quentin.schulz at theobroma-systems.com>
> ---
>   arch/arm/include/asm/arch-rockchip/cru_rk3588.h | 2 ++
>   arch/arm/include/asm/arch-rockchip/ioc_rk3588.h | 6 ++++++
>   arch/arm/mach-rockchip/rk3588/rk3588.c          | 4 ----
>   3 files changed, 8 insertions(+), 4 deletions(-)
>
> diff --git a/arch/arm/include/asm/arch-rockchip/cru_rk3588.h b/arch/arm/include/asm/arch-rockchip/cru_rk3588.h
> index 7f4a9085392..a4507e5fdd7 100644
> --- a/arch/arm/include/asm/arch-rockchip/cru_rk3588.h
> +++ b/arch/arm/include/asm/arch-rockchip/cru_rk3588.h
> @@ -63,6 +63,8 @@ struct rk3588_pll {
>   	unsigned int reserved0[3];
>   };
>   
> +#define CRU_BASE	0xfd7c0000
> +
>   struct rk3588_cru {
>   	struct rk3588_pll pll[18];
>   	unsigned int reserved0[16];/* Address Offset: 0x0240 */
> diff --git a/arch/arm/include/asm/arch-rockchip/ioc_rk3588.h b/arch/arm/include/asm/arch-rockchip/ioc_rk3588.h
> index 5a656f850c7..7ad98466c39 100644
> --- a/arch/arm/include/asm/arch-rockchip/ioc_rk3588.h
> +++ b/arch/arm/include/asm/arch-rockchip/ioc_rk3588.h
> @@ -5,6 +5,8 @@
>   #ifndef _ASM_ARCH_IOC_RK3588_H
>   #define _ASM_ARCH_IOC_RK3588_H
>   
> +#define BUS_IOC_BASE	0xfd5f8000
> +
>   struct rk3588_bus_ioc {
>   	unsigned int reserved0000[3];      /* Address Offset: 0x0000 */
>   	unsigned int gpio0b_iomux_sel_h;   /* Address Offset: 0x000C */
> @@ -48,6 +50,8 @@ struct rk3588_bus_ioc {
>   
>   check_member(rk3588_bus_ioc, gpio4d_iomux_sel_h, 0x009C);
>   
> +#define PMU1_IOC_BASE	0xfd5f0000
> +
>   struct rk3588_pmu1_ioc {
>   	unsigned int gpio0a_iomux_sel_l;   /* Address Offset: 0x0000 */
>   	unsigned int gpio0a_iomux_sel_h;   /* Address Offset: 0x0004 */
> @@ -70,6 +74,8 @@ struct rk3588_pmu1_ioc {
>   
>   check_member(rk3588_pmu1_ioc, xin_con, 0x0040);
>   
> +#define PMU2_IOC_BASE	0xfd5f4000
> +
>   struct rk3588_pmu2_ioc {
>   	unsigned int gpio0b_iomux_sel_h;  /* Address Offset: 0x0000 */
>   	unsigned int gpio0c_iomux_sel_l;  /* Address Offset: 0x0004 */
> diff --git a/arch/arm/mach-rockchip/rk3588/rk3588.c b/arch/arm/mach-rockchip/rk3588/rk3588.c
> index c5eeda9d751..53ee9f1cebc 100644
> --- a/arch/arm/mach-rockchip/rk3588/rk3588.c
> +++ b/arch/arm/mach-rockchip/rk3588/rk3588.c
> @@ -26,10 +26,6 @@
>   #define FW_SYSM_MST26_REG		0xa8
>   #define FW_SYSM_MST27_REG		0xac
>   
> -#define PMU1_IOC_BASE			0xfd5f0000
> -#define PMU2_IOC_BASE			0xfd5f4000
> -
> -#define BUS_IOC_BASE			0xfd5f8000
>   #define BUS_IOC_GPIO2A_IOMUX_SEL_L	0x40
>   #define BUS_IOC_GPIO2B_IOMUX_SEL_L	0x48
>   #define BUS_IOC_GPIO2D_IOMUX_SEL_L	0x58
>


More information about the U-Boot mailing list