Message ID | 20230712134730.30229-3-francesco@dolcini.it |
---|---|
State | Changes Requested |
Delegated to: | Tom Rini |
Headers | show |
Series | arm: mach-k3: am62: Add core number autodetection and fix fdt | expand |
On 7/12/23 8:47 AM, Francesco Dolcini wrote: > From: Emanuele Ghidoli <emanuele.ghidoli@toradex.com> > > Add register address and relevant bitmasks and shifts. > Allow reading these information: > - device identification > - number of cores (part of device identification) > - features (currently: PRU / no PRU) > - security > - functional safety > - speed grade > - temperature grade > - package > > Signed-off-by: Emanuele Ghidoli <emanuele.ghidoli@toradex.com> > Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com> > --- > arch/arm/mach-k3/include/mach/am62_hardware.h | 18 ++++++++++++++++++ > 1 file changed, 18 insertions(+) > > diff --git a/arch/arm/mach-k3/include/mach/am62_hardware.h b/arch/arm/mach-k3/include/mach/am62_hardware.h > index 88d58947269a..d67045a697df 100644 > --- a/arch/arm/mach-k3/include/mach/am62_hardware.h > +++ b/arch/arm/mach-k3/include/mach/am62_hardware.h > @@ -20,6 +20,24 @@ > #define MCU_CTRL_MMR0_BASE 0x04500000 > #define WKUP_CTRL_MMR0_BASE 0x43000000 > > +#define CTRLMMR_WKUP_JTAG_DEVICE_ID (WKUP_CTRL_MMR0_BASE + 0x18) We have similar defines in arch/arm/mach-k3/include/mach/hardware.h, if these are common that might be a better spot. Andrew > +#define JTAG_DEV_ID_MASK GENMASK(31, 18) > +#define JTAG_DEV_ID_SHIFT 18 > +#define JTAG_DEV_CORE_NR_MASK GENMASK(21, 19) > +#define JTAG_DEV_CORE_NR_SHIFT 19 > +#define JTAG_DEV_FEATURES_MASK GENMASK(17, 13) > +#define JTAG_DEV_FEATURES_SHIFT 13 > +#define JTAG_DEV_SECURITY_MASK BIT(12) > +#define JTAG_DEV_SECURITY_SHIFT 12 > +#define JTAG_DEV_SAFETY_MASK BIT(11) > +#define JTAG_DEV_SAFETY_SHIFT 11 > +#define JTAG_DEV_SPEED_MASK GENMASK(10, 6) > +#define JTAG_DEV_SPEED_SHIFT 6 > +#define JTAG_DEV_TEMP_MASK GENMASK(5, 3) > +#define JTAG_DEV_TEMP_SHIFT 3 > +#define JTAG_DEV_PKG_MASK GENMASK(2, 0) > +#define JTAG_DEV_PKG_SHIFT 0 > + > #define CTRLMMR_MAIN_DEVSTAT (WKUP_CTRL_MMR0_BASE + 0x30) > #define MAIN_DEVSTAT_PRIMARY_BOOTMODE_MASK GENMASK(6, 3) > #define MAIN_DEVSTAT_PRIMARY_BOOTMODE_SHIFT 3
On Wed, Jul 12, 2023 at 09:18:42AM -0500, Andrew Davis wrote: > On 7/12/23 8:47 AM, Francesco Dolcini wrote: > > From: Emanuele Ghidoli <emanuele.ghidoli@toradex.com> > > > > Add register address and relevant bitmasks and shifts. > > Allow reading these information: > > - device identification > > - number of cores (part of device identification) > > - features (currently: PRU / no PRU) > > - security > > - functional safety > > - speed grade > > - temperature grade > > - package > > > > Signed-off-by: Emanuele Ghidoli <emanuele.ghidoli@toradex.com> > > Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com> > > --- > > arch/arm/mach-k3/include/mach/am62_hardware.h | 18 ++++++++++++++++++ > > 1 file changed, 18 insertions(+) > > > > diff --git a/arch/arm/mach-k3/include/mach/am62_hardware.h b/arch/arm/mach-k3/include/mach/am62_hardware.h > > index 88d58947269a..d67045a697df 100644 > > --- a/arch/arm/mach-k3/include/mach/am62_hardware.h > > +++ b/arch/arm/mach-k3/include/mach/am62_hardware.h > > @@ -20,6 +20,24 @@ > > #define MCU_CTRL_MMR0_BASE 0x04500000 > > #define WKUP_CTRL_MMR0_BASE 0x43000000 > > +#define CTRLMMR_WKUP_JTAG_DEVICE_ID (WKUP_CTRL_MMR0_BASE + 0x18) > > We have similar defines in arch/arm/mach-k3/include/mach/hardware.h, > if these are common that might be a better spot. I do not have complete visibility on the whole k3 architecture and I can only test on AM62. From what we were able to understand AM65 has the exact same register, but the actual content is just different. Should we just move CTRLMMR_WKUP_JTAG_DEVICE_ID to mach-k3/include/mach/hardware.h ? Francesco
diff --git a/arch/arm/mach-k3/include/mach/am62_hardware.h b/arch/arm/mach-k3/include/mach/am62_hardware.h index 88d58947269a..d67045a697df 100644 --- a/arch/arm/mach-k3/include/mach/am62_hardware.h +++ b/arch/arm/mach-k3/include/mach/am62_hardware.h @@ -20,6 +20,24 @@ #define MCU_CTRL_MMR0_BASE 0x04500000 #define WKUP_CTRL_MMR0_BASE 0x43000000 +#define CTRLMMR_WKUP_JTAG_DEVICE_ID (WKUP_CTRL_MMR0_BASE + 0x18) +#define JTAG_DEV_ID_MASK GENMASK(31, 18) +#define JTAG_DEV_ID_SHIFT 18 +#define JTAG_DEV_CORE_NR_MASK GENMASK(21, 19) +#define JTAG_DEV_CORE_NR_SHIFT 19 +#define JTAG_DEV_FEATURES_MASK GENMASK(17, 13) +#define JTAG_DEV_FEATURES_SHIFT 13 +#define JTAG_DEV_SECURITY_MASK BIT(12) +#define JTAG_DEV_SECURITY_SHIFT 12 +#define JTAG_DEV_SAFETY_MASK BIT(11) +#define JTAG_DEV_SAFETY_SHIFT 11 +#define JTAG_DEV_SPEED_MASK GENMASK(10, 6) +#define JTAG_DEV_SPEED_SHIFT 6 +#define JTAG_DEV_TEMP_MASK GENMASK(5, 3) +#define JTAG_DEV_TEMP_SHIFT 3 +#define JTAG_DEV_PKG_MASK GENMASK(2, 0) +#define JTAG_DEV_PKG_SHIFT 0 + #define CTRLMMR_MAIN_DEVSTAT (WKUP_CTRL_MMR0_BASE + 0x30) #define MAIN_DEVSTAT_PRIMARY_BOOTMODE_MASK GENMASK(6, 3) #define MAIN_DEVSTAT_PRIMARY_BOOTMODE_SHIFT 3