Re: [U-Boot] [PATCH v3 2/6] i2c: rcar_i2c: Add comments about registers & values

2019-03-06 Thread Heiko Schocher

Hello Ismael,

Am 06.03.2019 um 11:46 schrieb Ismael Luceno Cortes:

Document the meaning of macros related to registers and values to be
written to them.

Signed-off-by: Ismael Luceno 
---
  drivers/i2c/rcar_i2c.c | 47 +++---
  1 file changed, 26 insertions(+), 21 deletions(-)


Reviewed-by: Heiko Schocher 

bye,
Heiko
--
DENX Software Engineering GmbH,  Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-52   Fax: +49-8142-66989-80   Email: h...@denx.de
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v3 2/6] i2c: rcar_i2c: Add comments about registers & values

2019-03-06 Thread Marek Vasut
On 3/6/19 11:46 AM, Ismael Luceno Cortes wrote:
> Document the meaning of macros related to registers and values to be
> written to them.
> 
> Signed-off-by: Ismael Luceno 


Reviewed-by: Marek Vasut 

-- 
Best regards,
Marek Vasut
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v3 2/6] i2c: rcar_i2c: Add comments about registers & values

2019-03-06 Thread Ismael Luceno Cortes
Document the meaning of macros related to registers and values to be
written to them.

Signed-off-by: Ismael Luceno 
---
 drivers/i2c/rcar_i2c.c | 47 +++---
 1 file changed, 26 insertions(+), 21 deletions(-)

diff --git a/drivers/i2c/rcar_i2c.c b/drivers/i2c/rcar_i2c.c
index a57f72a228..d7b27204cb 100644
--- a/drivers/i2c/rcar_i2c.c
+++ b/drivers/i2c/rcar_i2c.c
@@ -18,35 +18,40 @@
 #include 
 #include 
 
-#define RCAR_I2C_ICSCR 0x00
-#define RCAR_I2C_ICMCR 0x04
-#define RCAR_I2C_ICMCR_MDBSBIT(7)
-#define RCAR_I2C_ICMCR_FSCLBIT(6)
-#define RCAR_I2C_ICMCR_FSDABIT(5)
-#define RCAR_I2C_ICMCR_OBPCBIT(4)
-#define RCAR_I2C_ICMCR_MIE BIT(3)
+#define RCAR_I2C_ICSCR 0x00 /* slave ctrl */
+#define RCAR_I2C_ICMCR 0x04 /* master ctrl */
+#define RCAR_I2C_ICMCR_MDBSBIT(7) /* non-fifo mode switch */
+#define RCAR_I2C_ICMCR_FSCLBIT(6) /* override SCL pin */
+#define RCAR_I2C_ICMCR_FSDABIT(5) /* override SDA pin */
+#define RCAR_I2C_ICMCR_OBPCBIT(4) /* override pins */
+#define RCAR_I2C_ICMCR_MIE BIT(3) /* master if enable */
 #define RCAR_I2C_ICMCR_TSBEBIT(2)
-#define RCAR_I2C_ICMCR_FSB BIT(1)
-#define RCAR_I2C_ICMCR_ESG BIT(0)
-#define RCAR_I2C_ICSSR 0x08
-#define RCAR_I2C_ICMSR 0x0c
+#define RCAR_I2C_ICMCR_FSB BIT(1) /* force stop bit */
+#define RCAR_I2C_ICMCR_ESG BIT(0) /* enable start bit gen */
+#define RCAR_I2C_ICSSR 0x08 /* slave status */
+#define RCAR_I2C_ICMSR 0x0c /* master status */
 #define RCAR_I2C_ICMSR_MASK0x7f
-#define RCAR_I2C_ICMSR_MNR BIT(6)
-#define RCAR_I2C_ICMSR_MAL BIT(5)
-#define RCAR_I2C_ICMSR_MST BIT(4)
+#define RCAR_I2C_ICMSR_MNR BIT(6) /* Nack */
+#define RCAR_I2C_ICMSR_MAL BIT(5) /* Arbitration lost */
+#define RCAR_I2C_ICMSR_MST BIT(4) /* Stop */
 #define RCAR_I2C_ICMSR_MDE BIT(3)
 #define RCAR_I2C_ICMSR_MDT BIT(2)
 #define RCAR_I2C_ICMSR_MDR BIT(1)
 #define RCAR_I2C_ICMSR_MAT BIT(0)
-#define RCAR_I2C_ICSIER0x10
-#define RCAR_I2C_ICMIER0x14
-#define RCAR_I2C_ICCCR 0x18
+#define RCAR_I2C_ICSIER0x10 /* slave irq enable */
+#define RCAR_I2C_ICMIER0x14 /* master irq enable */
+#define RCAR_I2C_ICCCR 0x18 /* clock dividers */
 #define RCAR_I2C_ICCCR_SCGD_OFF3
-#define RCAR_I2C_ICSAR 0x1c
-#define RCAR_I2C_ICMAR 0x20
-#define RCAR_I2C_ICRXD_ICTXD   0x24
+#define RCAR_I2C_ICSAR 0x1c /* slave address */
+#define RCAR_I2C_ICMAR 0x20 /* master address */
+#define RCAR_I2C_ICRXD_ICTXD   0x24 /* data port */
+/*
+ * First Bit Setup Cycle (Gen3).
+ * Defines 1st bit delay between SDA and SCL.
+ */
 #define RCAR_I2C_ICFBSCR   0x38
-#define RCAR_I2C_ICFBSCR_TCYC170x0f
+#define RCAR_I2C_ICFBSCR_TCYC170x0f /* 17*Tcyc */
+
 
 enum rcar_i2c_type {
RCAR_I2C_TYPE_GEN2,
-- 
2.19.1
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot