mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 0/3] habv4/ocotp: style fixes
@ 2024-02-12 13:27 Marc Kleine-Budde
  2024-02-12 13:27 ` [PATCH 1/3] habv4: convert comments to common coding style Marc Kleine-Budde
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Marc Kleine-Budde @ 2024-02-12 13:27 UTC (permalink / raw)
  To: sha; +Cc: barebox

Hello,

while rebasing an internal branch, I found some style fixes for the
habv4 and ocotp driver.

regards,
Marc





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

* [PATCH 1/3] habv4: convert comments to common coding style
  2024-02-12 13:27 [PATCH 0/3] habv4/ocotp: style fixes Marc Kleine-Budde
@ 2024-02-12 13:27 ` Marc Kleine-Budde
  2024-02-12 13:27 ` [PATCH 2/3] nvmem: ocotp: use tab for indention only Marc Kleine-Budde
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Marc Kleine-Budde @ 2024-02-12 13:27 UTC (permalink / raw)
  To: sha; +Cc: barebox

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
 drivers/hab/habv4.c | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/drivers/hab/habv4.c b/drivers/hab/habv4.c
index c60a658b89af..6440ef7f5196 100644
--- a/drivers/hab/habv4.c
+++ b/drivers/hab/habv4.c
@@ -147,9 +147,11 @@ struct hab_header {
 typedef enum hab_status hab_loader_callback_fn(void **start, size_t *bytes, const void *boot_data);
 typedef void hab_image_entry_fn(void);
 
-/* This table is constructed from the NXP manual "High Assurance Boot Version 4
- * Application Programming Interface Reference Manual", section 4.5 ROM vector
- * table. Revision 1.4 */
+/*
+ * This table is constructed from the NXP manual "High Assurance Boot
+ * Version 4 Application Programming Interface Reference Manual",
+ * section 4.5 ROM vector table. Revision 1.4
+ */
 struct habv4_rvt {
 	struct hab_header header;
 	enum hab_status (*entry)(void);
@@ -169,9 +171,11 @@ struct habv4_rvt {
 
 #define FSL_SIP_HAB 0xC2000007
 
-/* These values correspondent to the jump table found in the upstream TF-A
- * version 2.10 `imx_hab_handler`, not all HAB rom functions are supported yet.
- * */
+/*
+ * These values correspondent to the jump table found in the upstream
+ * TF-A version 2.10 `imx_hab_handler`, not all HAB rom functions are
+ * supported yet.
+ */
 enum hab_sip_cmd {
 	FSL_SIP_HAB_AUTHENTICATE = 0x00,
 	FSL_SIP_HAB_ENTRY = 0x01,
-- 
2.43.0





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

* [PATCH 2/3] nvmem: ocotp: use tab for indention only
  2024-02-12 13:27 [PATCH 0/3] habv4/ocotp: style fixes Marc Kleine-Budde
  2024-02-12 13:27 ` [PATCH 1/3] habv4: convert comments to common coding style Marc Kleine-Budde
@ 2024-02-12 13:27 ` Marc Kleine-Budde
  2024-02-12 13:27 ` [PATCH 3/3] nvmem: ocotp: mark data as const Marc Kleine-Budde
  2024-02-13  9:11 ` [PATCH 0/3] habv4/ocotp: style fixes Sascha Hauer
  3 siblings, 0 replies; 5+ messages in thread
From: Marc Kleine-Budde @ 2024-02-12 13:27 UTC (permalink / raw)
  To: sha; +Cc: barebox

Replace space+tabs by tabs only for indention.

Fixes: 1c2d1d4e5985 ("ARM: i.MX8MP: enhance support for ocotp driver")
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
 drivers/nvmem/ocotp.c | 50 ++++++++++++++++++++++---------------------
 1 file changed, 26 insertions(+), 24 deletions(-)

diff --git a/drivers/nvmem/ocotp.c b/drivers/nvmem/ocotp.c
index 28c121152e8b..16d2a6be9fce 100644
--- a/drivers/nvmem/ocotp.c
+++ b/drivers/nvmem/ocotp.c
@@ -53,12 +53,12 @@
 #define OCOTP_READ_CTRL			0x30
 #define OCOTP_READ_FUSE_DATA		0x40
 
-#define MX7_OCOTP_DATA0 		0x20
-#define MX7_OCOTP_DATA1 		0x30
-#define MX7_OCOTP_DATA2 		0x40
-#define MX7_OCOTP_DATA3 		0x50
-#define MX7_OCOTP_READ_CTRL 		0x60
-#define MX7_OCOTP_READ_FUSE_DATA0 	0x70
+#define MX7_OCOTP_DATA0			0x20
+#define MX7_OCOTP_DATA1			0x30
+#define MX7_OCOTP_DATA2			0x40
+#define MX7_OCOTP_DATA3			0x50
+#define MX7_OCOTP_READ_CTRL		0x60
+#define MX7_OCOTP_READ_FUSE_DATA0	0x70
 #define MX7_OCOTP_READ_FUSE_DATA1	0x80
 #define MX7_OCOTP_READ_FUSE_DATA2	0x90
 #define MX7_OCOTP_READ_FUSE_DATA3	0xA0
@@ -67,27 +67,29 @@
 #define DEF_STROBE_PROG			10000	/* IPG clocks */
 
 /* OCOTP Registers bits and masks */
-#define OCOTP_CTRL_ADDR		  GENMASK(7, 0)
-#define OCOTP_CTRL_BUSY		  BIT(8)
-#define OCOTP_CTRL_ERROR	  BIT(9)
-#define OCOTP_CTRL_RELOAD_SHADOWS BIT(10)
-#define OCOTP_CTRL_WR_UNLOCK	  GENMASK(31, 16)
-#define OCOTP_CTRL_WR_UNLOCK_KEY  0x3E77
+#define OCOTP_CTRL_ADDR			GENMASK(7, 0)
+#define OCOTP_CTRL_BUSY			BIT(8)
+#define OCOTP_CTRL_ERROR		BIT(9)
+#define OCOTP_CTRL_RELOAD_SHADOWS	BIT(10)
+#define OCOTP_CTRL_WR_UNLOCK		GENMASK(31, 16)
+#define OCOTP_CTRL_WR_UNLOCK_KEY	0x3E77
 
-/* i.MX8MP OCOTP CTRL has a different layout. See RM Rev.1 06/2021 Section
-	* 6.3.5.1.2.4 */
-#define OCOTP_CTRL_ADDR_8MP	      GENMASK(8, 0)
-#define OCOTP_CTRL_BUSY_8MP	      BIT(9)
-#define OCOTP_CTRL_ERROR_8MP	      BIT(10)
-#define OCOTP_CTRL_RELOAD_SHADOWS_8MP BIT(11)
-#define OCOTP_CTRL_WR_UNLOCK_8MP      GENMASK(31, 16)
+/*
+ * i.MX8MP OCOTP CTRL has a different layout. See RM Rev.1 06/2021
+ * Section 6.3.5.1.2.4
+ */
+#define OCOTP_CTRL_ADDR_8MP		GENMASK(8, 0)
+#define OCOTP_CTRL_BUSY_8MP		BIT(9)
+#define OCOTP_CTRL_ERROR_8MP		BIT(10)
+#define OCOTP_CTRL_RELOAD_SHADOWS_8MP	BIT(11)
+#define OCOTP_CTRL_WR_UNLOCK_8MP	GENMASK(31, 16)
 
-#define OCOTP_TIMING_STROBE_READ GENMASK(21, 16)
-#define OCOTP_TIMING_RELAX	 GENMASK(15, 12)
-#define OCOTP_TIMING_STROBE_PROG GENMASK(11, 0)
-#define OCOTP_TIMING_WAIT	 GENMASK(27, 22)
+#define OCOTP_TIMING_STROBE_READ	GENMASK(21, 16)
+#define OCOTP_TIMING_RELAX		GENMASK(15, 12)
+#define OCOTP_TIMING_STROBE_PROG	GENMASK(11, 0)
+#define OCOTP_TIMING_WAIT		GENMASK(27, 22)
 
-#define OCOTP_READ_CTRL_READ_FUSE BIT(1)
+#define OCOTP_READ_CTRL_READ_FUSE	BIT(1)
 
 #define OCOTP_OFFSET_TO_ADDR(o) (OCOTP_OFFSET_TO_INDEX(o) * 4)
 
-- 
2.43.0





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

* [PATCH 3/3] nvmem: ocotp: mark data as const
  2024-02-12 13:27 [PATCH 0/3] habv4/ocotp: style fixes Marc Kleine-Budde
  2024-02-12 13:27 ` [PATCH 1/3] habv4: convert comments to common coding style Marc Kleine-Budde
  2024-02-12 13:27 ` [PATCH 2/3] nvmem: ocotp: use tab for indention only Marc Kleine-Budde
@ 2024-02-12 13:27 ` Marc Kleine-Budde
  2024-02-13  9:11 ` [PATCH 0/3] habv4/ocotp: style fixes Sascha Hauer
  3 siblings, 0 replies; 5+ messages in thread
From: Marc Kleine-Budde @ 2024-02-12 13:27 UTC (permalink / raw)
  To: sha; +Cc: barebox

Mark values obtained from "priv->data->ctrl" as const.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
 drivers/nvmem/ocotp.c | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/drivers/nvmem/ocotp.c b/drivers/nvmem/ocotp.c
index 16d2a6be9fce..c282efefa824 100644
--- a/drivers/nvmem/ocotp.c
+++ b/drivers/nvmem/ocotp.c
@@ -275,11 +275,11 @@ static int imx6_ocotp_prepare(struct ocotp_priv *priv)
 
 static int imx6_fuse_read_addr(struct ocotp_priv *priv, u32 addr, u32 *pdata)
 {
+	const u32 bm_ctrl_error = priv->data->ctrl->bm_error;
+	const u32 bm_ctrl_addr = priv->data->ctrl->bm_addr;
+	const u32 bm_ctrl_wr_unlock = priv->data->ctrl->bm_wr_unlock;
 	u32 ctrl_reg;
 	int ret;
-	u32 bm_ctrl_error = priv->data->ctrl->bm_error;
-	u32 bm_ctrl_addr = priv->data->ctrl->bm_addr;
-	u32 bm_ctrl_wr_unlock = priv->data->ctrl->bm_wr_unlock;
 
 	writel(bm_ctrl_error, priv->base + OCOTP_CTRL_CLR);
 
@@ -304,13 +304,13 @@ static int imx6_fuse_read_addr(struct ocotp_priv *priv, u32 addr, u32 *pdata)
 
 static int imx7_fuse_read_addr(struct ocotp_priv *priv, u32 index, u32 *pdata)
 {
+	const u32 bm_ctrl_error = priv->data->ctrl->bm_error;
+	const u32 bm_ctrl_addr = priv->data->ctrl->bm_addr;
+	const u32 bm_ctrl_wr_unlock = priv->data->ctrl->bm_wr_unlock;
 	u32 ctrl_reg;
 	u32 bank_addr;
 	u16 word;
 	int ret;
-	u32 bm_ctrl_error = priv->data->ctrl->bm_error;
-	u32 bm_ctrl_addr = priv->data->ctrl->bm_addr;
-	u32 bm_ctrl_wr_unlock = priv->data->ctrl->bm_wr_unlock;
 
 	word = index & 0x3;
 	bank_addr = index >> 2;
@@ -391,10 +391,10 @@ static int imx_ocotp_reg_read(void *ctx, unsigned int reg, unsigned int *val)
 
 static void imx_ocotp_clear_unlock(struct ocotp_priv *priv, u32 index)
 {
+	const u32 bm_ctrl_error = priv->data->ctrl->bm_error;
+	const u32 bm_ctrl_addr = priv->data->ctrl->bm_addr;
+	const u32 bm_ctrl_wr_unlock = priv->data->ctrl->bm_wr_unlock;
 	u32 ctrl_reg;
-	u32 bm_ctrl_error = priv->data->ctrl->bm_error;
-	u32 bm_ctrl_addr = priv->data->ctrl->bm_addr;
-	u32 bm_ctrl_wr_unlock = priv->data->ctrl->bm_wr_unlock;
 
 	writel(bm_ctrl_error, priv->base + OCOTP_CTRL_CLR);
 
@@ -408,8 +408,8 @@ static void imx_ocotp_clear_unlock(struct ocotp_priv *priv, u32 index)
 
 static int imx6_fuse_blow_addr(struct ocotp_priv *priv, u32 index, u32 value)
 {
+	const u32 bm_ctrl_error = priv->data->ctrl->bm_error;
 	int ret;
-	u32 bm_ctrl_error = priv->data->ctrl->bm_error;
 
 	imx_ocotp_clear_unlock(priv, index);
 
@@ -474,7 +474,7 @@ static int imx7_fuse_blow_addr(struct ocotp_priv *priv, u32 index, u32 value)
 
 static int imx6_ocotp_reload_shadow(struct ocotp_priv *priv)
 {
-	u32 bm_ctrl_reload_shadows = priv->data->ctrl->bm_reload_shadows;
+	const u32 bm_ctrl_reload_shadows = priv->data->ctrl->bm_reload_shadows;
 
 	dev_info(&priv->dev, "reloading shadow registers...\n");
 	writel(bm_ctrl_reload_shadows, priv->base + OCOTP_CTRL_SET);
@@ -486,8 +486,8 @@ static int imx6_ocotp_reload_shadow(struct ocotp_priv *priv)
 static int imx6_ocotp_blow_one_u32(struct ocotp_priv *priv, u32 index, u32 data,
 			    u32 *pfused_value)
 {
+	const u32 bm_ctrl_error = priv->data->ctrl->bm_error;
 	int ret;
-	u32 bm_ctrl_error = priv->data->ctrl->bm_error;
 
 	ret = imx6_ocotp_prepare(priv);
 	if (ret) {
-- 
2.43.0





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

* Re: [PATCH 0/3] habv4/ocotp: style fixes
  2024-02-12 13:27 [PATCH 0/3] habv4/ocotp: style fixes Marc Kleine-Budde
                   ` (2 preceding siblings ...)
  2024-02-12 13:27 ` [PATCH 3/3] nvmem: ocotp: mark data as const Marc Kleine-Budde
@ 2024-02-13  9:11 ` Sascha Hauer
  3 siblings, 0 replies; 5+ messages in thread
From: Sascha Hauer @ 2024-02-13  9:11 UTC (permalink / raw)
  To: sha, Marc Kleine-Budde; +Cc: barebox


On Mon, 12 Feb 2024 14:27:50 +0100, Marc Kleine-Budde wrote:
> while rebasing an internal branch, I found some style fixes for the
> habv4 and ocotp driver.
> 
> regards,
> Marc
> 

Applied, thanks!

[1/3] habv4: convert comments to common coding style
      https://git.pengutronix.de/cgit/barebox/commit/?id=d25f91d2fa4e (link may not be stable)
[2/3] nvmem: ocotp: use tab for indention only
      https://git.pengutronix.de/cgit/barebox/commit/?id=5f9093be28b4 (link may not be stable)
[3/3] nvmem: ocotp: mark data as const
      https://git.pengutronix.de/cgit/barebox/commit/?id=2c2bec416b2c (link may not be stable)

Best regards,
-- 
Sascha Hauer <s.hauer@pengutronix.de>




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

end of thread, other threads:[~2024-02-13  9:12 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-12 13:27 [PATCH 0/3] habv4/ocotp: style fixes Marc Kleine-Budde
2024-02-12 13:27 ` [PATCH 1/3] habv4: convert comments to common coding style Marc Kleine-Budde
2024-02-12 13:27 ` [PATCH 2/3] nvmem: ocotp: use tab for indention only Marc Kleine-Budde
2024-02-12 13:27 ` [PATCH 3/3] nvmem: ocotp: mark data as const Marc Kleine-Budde
2024-02-13  9:11 ` [PATCH 0/3] habv4/ocotp: style fixes Sascha Hauer

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