> -----Original Message----- > From: Ravulapalli, Naresh Kumar <[email protected]> > Sent: Friday, August 8, 2025 5:37 PM > To: [email protected] > Cc: Marek Vasut <[email protected]>; Simon Goldschmidt > <[email protected]>; Chee, Tien Fong > <[email protected]>; Tom Rini <[email protected]>; Ravulapalli, > Naresh Kumar <[email protected]> > Subject: [PATCH] drivers: ddr: altera: Check IOSSM mailbox compatibility > > Compatibility check of IOSSM mailbox with U-Boot is performed by verifying > the mailbox specification version. If check fails, appropriate error message > is > displayed. > > Signed-off-by: Naresh Kumar Ravulapalli > <[email protected]> > --- > drivers/ddr/altera/iossm_mailbox.c | 24 ++++++++++++++++++++++++ > 1 file changed, 24 insertions(+) > > diff --git a/drivers/ddr/altera/iossm_mailbox.c > b/drivers/ddr/altera/iossm_mailbox.c > index 21f94959a04..2a2f86a650e 100644 > --- a/drivers/ddr/altera/iossm_mailbox.c > +++ b/drivers/ddr/altera/iossm_mailbox.c > @@ -38,6 +38,8 @@ > #define IOSSM_STATUS_CMD_RESPONSE_ERROR(n) > FIELD_GET(IOSSM_STATUS_CMD_RESPONSE_ERROR_MASK, n) > #define IOSSM_STATUS_GENERAL_ERROR_MASK GENMASK(4, > 1) > #define IOSSM_STATUS_GENERAL_ERROR(n) > FIELD_GET(IOSSM_STATUS_GENERAL_ERROR_MASK, n) > +#define IOSSM_MAILBOX_SPEC_VERSION_MASK GENMASK(2, > 0) > +#define IOSSM_MAILBOX_SPEC_VERSION(n) > FIELD_GET(IOSSM_MAILBOX_SPEC_VERSION_MASK, n) > > /* Offset of Mailbox Read-only Registers */ > #define IOSSM_MAILBOX_HEADER_OFFSET 0x0 > @@ -383,6 +385,23 @@ err: > return ret; > } > > +static bool is_mailbox_spec_compatible(struct io96b_info *io96b_ctrl) { > + u32 mailbox_header; > + u8 mailbox_spec_ver; > + > + mailbox_header = readl(io96b_ctrl->io96b[0].io96b_csr_addr + > + IOSSM_MAILBOX_HEADER_OFFSET); > + mailbox_spec_ver = > IOSSM_MAILBOX_SPEC_VERSION(mailbox_header); > + printf("%s: IOSSM mailbox version: %d\n", __func__, > mailbox_spec_ver); > + > + /* for now there are two mailbox spec versions, 0 and 1; only version > 1 is compatible */ > + if (!mailbox_spec_ver) > + return false; > + > + return true; > +} > + > /* > * Initial function to be called to set memory interface IP type and > instance ID > * IP type and instance ID need to be determined before sending mailbox > command @@ -392,6 +411,11 @@ void io96b_mb_init(struct io96b_info > *io96b_ctrl) > int i, j; > u32 mem_intf_info_0, mem_intf_info_1; > > + if (!is_mailbox_spec_compatible(io96b_ctrl)) { > + printf("DDR: Failed to get compatible mailbox version\n"); > + hang(); > + } > + > debug("%s: num_instance %d\n", __func__, io96b_ctrl- > >num_instance); > > for (i = 0; i < io96b_ctrl->num_instance; i++) { > -- > 2.35.3 Reviewed-by: Tien Fong Chee <[email protected]> Best regards, Tien Fong

