mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/3] nvmem: ocotp: add support for second MAC address on i.MX8MP
@ 2023-01-11 18:21 Lucas Stach
  2023-01-11 18:21 ` [PATCH 2/3] ARM: dts: i.MX8MP: move MAC address description to common location Lucas Stach
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Lucas Stach @ 2023-01-11 18:21 UTC (permalink / raw)
  To: barebox

i.MX8MP has the same quirk as the i.MX6UL: the MAC address for the
second ethernet interface is stored at an unaligned location and thus
needs to be handled by skipping the first 2 bytes from the OCOTP
register.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
---
 drivers/nvmem/ocotp.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/nvmem/ocotp.c b/drivers/nvmem/ocotp.c
index 7cc2b3b3db58..9d4d6e91db74 100644
--- a/drivers/nvmem/ocotp.c
+++ b/drivers/nvmem/ocotp.c
@@ -88,6 +88,7 @@
 #define MAC_OFFSET_0			(0x22 * 4)
 #define IMX6UL_MAC_OFFSET_1		(0x23 * 4)
 #define MAC_OFFSET_1			(0x24 * 4)
+#define IMX8MP_MAC_OFFSET_1		(0x25 * 4)
 #define MAX_MAC_OFFSETS			2
 #define MAC_BYTES			8
 #define UNIQUE_ID_NUM			2
@@ -598,7 +599,7 @@ static int imx_ocotp_read_mac(const struct imx_ocotp_data *data,
 	if (ret < 0)
 		return ret;
 
-	if (offset != IMX6UL_MAC_OFFSET_1)
+	if (offset != IMX6UL_MAC_OFFSET_1 && offset != IMX8MP_MAC_OFFSET_1)
 		data->format_mac(mac, buf, OCOTP_HW_TO_MAC);
 	else
 		data->format_mac(mac, buf + 2, OCOTP_HW_TO_MAC);
@@ -624,7 +625,8 @@ static int imx_ocotp_set_mac(struct param_d *param, void *priv)
 	if (ret < 0)
 		return ret;
 
-	if (ethaddr->offset != IMX6UL_MAC_OFFSET_1)
+	if (ethaddr->offset != IMX6UL_MAC_OFFSET_1 &&
+	    ethaddr->offset != IMX8MP_MAC_OFFSET_1)
 		ethaddr->data->format_mac(buf, ethaddr->value,
 					  OCOTP_MAC_TO_HW);
 	else
@@ -898,7 +900,7 @@ static struct imx_ocotp_data imx8mp_ocotp_data = {
 	.num_regs = 1024,
 	.addr_to_offset = imx6sl_addr_to_offset,
 	.mac_offsets_num = 2,
-	.mac_offsets = { 0x90, 0x96 },
+	.mac_offsets = { 0x90, 0x94 },
 	.format_mac = imx_ocotp_format_mac,
 	.feat = &imx8mp_featctrl_data,
 };
-- 
2.39.0




^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2023-01-27 14:16 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-11 18:21 [PATCH 1/3] nvmem: ocotp: add support for second MAC address on i.MX8MP Lucas Stach
2023-01-11 18:21 ` [PATCH 2/3] ARM: dts: i.MX8MP: move MAC address description to common location Lucas Stach
2023-01-11 19:03   ` Ahmad Fatoum
2023-01-11 20:00     ` Lucas Stach
2023-01-11 20:13       ` Ahmad Fatoum
2023-01-12  8:41         ` Lucas Stach
2023-01-11 18:21 ` [PATCH 3/3] net: eqos: add i.MX8MP support Lucas Stach
2023-01-12 14:59   ` Ahmad Fatoum
2023-01-27 14:14 ` [PATCH 1/3] nvmem: ocotp: add support for second MAC address on i.MX8MP Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox