From 977cd7b588a87f2b1c41a322a22bad817507dd74 Mon Sep 17 00:00:00 2001 From: Kumar Gala Date: Thu, 2 Apr 2020 11:59:08 -0500 Subject: [PATCH] soc: riscv: openisa_rv32m1: Add helper to get clock_ip_name from dts Add a helper macro that will go from a DT_DRV_INST number and return the clock_ip_name value for that instance. Signed-off-by: Kumar Gala --- soc/riscv/openisa_rv32m1/soc.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/soc/riscv/openisa_rv32m1/soc.h b/soc/riscv/openisa_rv32m1/soc.h index 8a0474a49b9..5a10ff6c31d 100644 --- a/soc/riscv/openisa_rv32m1/soc.h +++ b/soc/riscv/openisa_rv32m1/soc.h @@ -108,4 +108,9 @@ void soc_interrupt_init(void); #define RISCV_RAM_SIZE KB(CONFIG_SRAM_SIZE) #define RISCV_RAM_BASE CONFIG_SRAM_BASE_ADDRESS +/* helper macro to convert from a DT_INST to HAL clock_ip_name */ +#define INST_DT_CLOCK_IP_NAME(n) \ + MAKE_PCC_REGADDR(DT_REG_ADDR(DT_INST_PHANDLE(n, clocks)), \ + DT_INST_CLOCKS_CELL(n, name)) + #endif /* SOC_RISCV32_OPENISA_RV32M1_SOC_H_ */