From patchwork Wed Oct 23 08:12:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sascha Hauer X-Patchwork-Id: 13846692 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7AC0CD2E01E for ; Wed, 23 Oct 2024 08:23:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To: Content-Transfer-Encoding:Content-Type:MIME-Version:Message-Id:Date:Subject: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=hPuLSSevqz42Y0ZUrbdnGBTK9kTddSJJQI0aaXuXHik=; b=w1yS5pZptArgaW u2JI87ZEp1941q4Oy7DwxEBVtPftt5+5lORjjXt2j5ycQJynDNRFmd1ziduqUIqHZVE6CJEwsAJOw pOQjKZ4RSRguWv3bhsmIyP7DQAekS5my/SwD9UDknuFYFb1MewQWFsnujV+9aWCJ0Yn8cIjxvRn2T KyBw0O9JkHIRIdUBZWxXl4RZ2UYzDXVZSiZZvSYnuZLkHFUrpivXZT+ZDAf50LNu2JtbMuR1wTnzy a4cS3PdLQiL+YQYVcuD8+ZBblwuWUde/1X6Icu85u2oskV0arhtwCDBFUMws1OqphUAibq2yTVJ3Z +DO2X3/MAIetbVNsTeeg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t3Wdp-0000000DY5S-28bI; Wed, 23 Oct 2024 08:22:53 +0000 Received: from metis.whiteo.stw.pengutronix.de ([2a0a:edc0:2:b01:1d::104]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1t3WU4-0000000DVxi-2nvS for linux-arm-kernel@lists.infradead.org; Wed, 23 Oct 2024 08:12:50 +0000 Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1t3WTv-0004YR-3A; Wed, 23 Oct 2024 10:12:39 +0200 Received: from dude02.red.stw.pengutronix.de ([2a0a:edc0:0:1101:1d::28]) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1t3WTu-0010Hh-1X; Wed, 23 Oct 2024 10:12:38 +0200 Received: from localhost ([::1] helo=dude02.red.stw.pengutronix.de) by dude02.red.stw.pengutronix.de with esmtp (Exim 4.96) (envelope-from ) id 1t3WTu-00FrPY-1J; Wed, 23 Oct 2024 10:12:38 +0200 From: Sascha Hauer Subject: [PATCH 0/4] nvmem: imx-ocotp-ele: fix reading from ELE OCOTP Date: Wed, 23 Oct 2024 10:12:27 +0200 Message-Id: <20241023-imx-ele-ocotp-fixes-v1-0-4adc00ce288f@pengutronix.de> MIME-Version: 1.0 X-B4-Tracking: v=1; b=H4sIAOuvGGcC/x3L3QpAQBCG4VvRHJsyS5RbkQM/3zKF1a6kNvduc /j09kYK8IpAbRbJ49ag7kiQPKNpHY4FrHMymcJUUpiSdX8YG9hN7jrZ6oPAthmN1NIIBJTO0+M Paez69/0AxNLX7mUAAAA= To: Srinivas Kandagatla , Shawn Guo , Pengutronix Kernel Team , Fabio Estevam Cc: imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Sascha Hauer X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1729671158; l=1527; i=s.hauer@pengutronix.de; s=20230412; h=from:subject:message-id; bh=lJmLv8QEgZj8qr68MkJgML54hWdN7FQAB/B9Q49TT8M=; b=23/el6pD17uTVtS0E0e8yELD1xfAn93eobVXoT2FIMgXaKQMtd+nxG1fLT827oM2bNGnu+SXE Ur/AB/JB5/lAh9m5STiha+xFcrTUCFA3nlQltTXKREjaelINqoQWV0T X-Developer-Key: i=s.hauer@pengutronix.de; a=ed25519; pk=4kuc9ocmECiBJKWxYgqyhtZOHj5AWi7+d0n/UjhkwTg= X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: s.hauer@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-arm-kernel@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241023_011248_858688_A6CF6BEC X-CRM114-Status: GOOD ( 10.85 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Commits b2ab0edaf484 ("arm64: dts: imx93: add nvmem property for fec1") and 0d4fbaffbdca ("arm64: dts: imx93: add nvmem property for eqos") introduced NVMEM cell bindings for reading MAC addresses from the ELE OCOTP. This doesn't work as expected due to bugs in the driver: - imx_ocotp_reg_read() interprets the incoming offset as 32bit word offset, but it really is in bytes which means the driver reads bogus values whenever the offset is non zero - imx_ocotp_reg_read() reads wrong results when the offset is not 32bit word aligned - MAC addresses are stored in reverse byte order in the ELE OCOTP, we have to swap the order before passing them to the upper layer This likely went through unnoticed because the bootloader normally adds the MAC addresses to the ethernet nodes and in this case they are preferred over the NVMEM addresses. This series fixes these issues. Sascha Signed-off-by: Sascha Hauer --- Sascha Hauer (4): nvmem: imx-ocotp-ele: simplify read beyond device check nvmem: imx-ocotp-ele: fix reading from non zero offset nvmem: imx-ocotp-ele: fix MAC address byte order nvmem: imx-ocotp-ele: set word length to 1 drivers/nvmem/imx-ocotp-ele.c | 38 +++++++++++++++++++++++++++++++------- 1 file changed, 31 insertions(+), 7 deletions(-) --- base-commit: c2ee9f594da826bea183ed14f2cc029c719bf4da change-id: 20241023-imx-ele-ocotp-fixes-f7b216171e1e Best regards,