Thread (7 messages) 7 messages, 4 authors, 2023-12-13

Re: [PATCH net-next v6 1/6] ptp: clockmatrix: support 32-bit address space

From: Paolo Abeni <pabeni@redhat.com>
Date: 2023-12-05 09:30:02
Also in: lkml

On Tue, 2023-12-05 at 09:24 +0000, Simon Horman wrote:
On Thu, Nov 30, 2023 at 01:46:29PM -0500, Min Li wrote:
quoted
From: Min Li <redacted>

We used to assume 0x2010xxxx address. Now that
we need to access 0x2011xxxx address, we need
to support read/write the whole 32-bit address space.

Signed-off-by: Min Li <redacted>
...
quoted
diff --git a/drivers/ptp/ptp_clockmatrix.c b/drivers/ptp/ptp_clockmatrix.c
index f6f9d4adce04..f8556627befa 100644
--- a/drivers/ptp/ptp_clockmatrix.c
+++ b/drivers/ptp/ptp_clockmatrix.c
@@ -41,8 +41,8 @@ module_param(firmware, charp, 0);
 static int _idtcm_adjfine(struct idtcm_channel *channel, long scaled_ppm);
 
 static inline int idtcm_read(struct idtcm *idtcm,
-			     u16 module,
-			     u16 regaddr,
+			     u32 module,
+			     u32 regaddr,
 			     u8 *buf,
 			     u16 count)
 {
@@ -50,8 +50,8 @@ static inline int idtcm_read(struct idtcm *idtcm,
 }
 
 static inline int idtcm_write(struct idtcm *idtcm,
-			      u16 module,
-			      u16 regaddr,
+			      u32 module,
+			      u32 regaddr,
 			      u8 *buf,
 			      u16 count)
 {
Hi Min Li,

My understanding of Paolo's review of v5 was that it would be cleaner to:

1. Leave the type of the module parameter as u16
2. Update the type of the regaddr parameter to u32
[almost over the air conflict here ;) ]

I think the module parameter as u32 is needed, as later macro
definitions will leverage that.
And...

...
quoted
@@ -553,11 +554,11 @@ static int _sync_pll_output(struct idtcm *idtcm,
 	val = SYNCTRL1_MASTER_SYNC_RST;
 
 	/* Place master sync in reset */
-	err = idtcm_write(idtcm, 0, sync_ctrl1, &val, sizeof(val));
+	err = idtcm_write(idtcm, sync_ctrl1, 0, &val, sizeof(val));
 	if (err)
 		return err;
 
-	err = idtcm_write(idtcm, 0, sync_ctrl0, &sync_src, sizeof(sync_src));
+	err = idtcm_write(idtcm, sync_ctrl0, 0, &sync_src, sizeof(sync_src));
 	if (err)
 		return err;
 
... avoid the need for changes like the two above.
This part is correct/what I meant ;)

Cheers,

Paolo
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help