On Wed, May 5, 2021 at 9:33 AM Wolfram Sang <wsa+renesas@xxxxxxxxxxxxxxxxxxxx> wrote: > > Possible alternative interpretations of the note are: > > - Only IIC3 has the automatic transmission registers. But the > > automatic transmission feature is not useful as the SoCs lack DVFS > > support. > > I immediately thought "yeah, this is it", but had to do some resarch > where my assumption comes from. I found it in older H2 datasheets > (v0.9). Here in 56.1: > > "Automatic transmission for PMIC control: The IIC3 module of the R-Car > H2 and M2 supports automatic data transmission under PMIC control > (DVFS)." > > Or table 56.8: > > "Registers of IIC Command for Automatic Transmission Mode (IIC3 only) > [R-CarH2, M2, and V2H]" > > > This all is a strong indication for IIC3 only. Which SoCs that have is > still confusing. Table 56.8 mentions V2H but 56.1 doesn't. Then again, I > could imagine that V2H has it but simply DVFS is not advertised for V2H. > And in the later documents, DVFS advertisement was removed for H2 and M2 > as well. >From off-list experiments checking for the presence of automatic transmission registers by writing to them, and seeing if they retain their values, we know that all IIC instances checked on R-Car Gen2 SoCs do have these registers. The same is true for R-Car E3, which is explicitly documented _not_ to have the registers... In addition, Wolfram tried transmitting something on R-Car H2 from the U-Boot prompt, and noticed the ICINT.ADTE bit is set afterwards, indicating success. So I went one step further, and hooked up a logic analyzer, to see if anything is actually transmitted. Koelsch (R-Car M2-W): - IIC1 (I2C8) IIC1_SCL_C (GP6_22) EXIO Connector C pin 37 IIC1_SDA_C (GP6_23) EXIO Connector C pin 39 # Configure pinctrl for IIC1 mw.l e6060000 f77fffff mw.l e6060098 08800000 mw.l e6060000 ffffedff mw.l e6060058 00001200 mw.l e6060000 3000c0c0 mw.l e606001c cfff3f3f # Enable IIC0-2 clocks in SMSTPCR3 mw e615013c ff7bfffe # Reset using ICCR clears all ICINT flags mw.b e6510004 1 # Set up clock (ICC[LH]) mw.b e6510010 0x69 mw.b e6510014 0x1e # Write dummy data to ICATD00 mw.b e6510100 bf # ICSTART.AutoStart = 1 mw.b e6510070 80 # Logic Analyzer says: S / P / P / P => broken? # Check ICINT; 01 => ADTE md.b e6510054 1 - IIC3 (I2C6 DVFS) IIC3_SCL EXIO Connector C pin 19 IIC3_SDA EXIO Connector C pin 21 # Enable IIC3 clock in SMSTPCR9 mw e6150994 fbffffff # Reset using ICCR clears all ICINT flags mw.b e60b0004 1 # Set up clock (ICC[LH]) mw.b e60b0010 0x1b mw.b e60b0014 0x14 # Write dummy data to ICATD00 mw.b e60b0100 de # ICSTART.AutoStart = 1 mw.b e60b0070 80 # Logic Analyzer: S / Address: 0x6f / W / NACK => Good! # Check ICINT; 01 => ADTE md.b e60b0054 1 Ebisu (R-Car E3): - IIC (DVFS) IIC_SCL EXIO Connector D pin 75 IIC_SDA EXIO Connector D pin 77 # Enable IIC clock in SMSTPCR9 mw e6150994 fbffffff # Reset using ICCR clears all ICINT flags mw.b e60b0004 1 # Set up clock (ICC[LH]) mw.b e60b0010 0x1b mw.b e60b0014 0x14 # Write dummy data to ICATD00 mw.b e60b0100 ad # ICSTART.AutoStart = 1 mw.b e60b0070 80 # Logic Analyzer: S / Address: 0x56 / R / NACK => Good! # Check ICINT; 01 => ADTE md.b e60b0054 1 Preliminary conclusions: 1. Automatic transmission works on the last IIC instance on R-Car Gen2, which was originally intended for DVFS (which is not implemented, as of Hardware User's Manual Rev. 2.00). It works partially/not on other IIC instances. Perhaps I did something wrong in my setup? 2. Despite the Hardware User's Manual stating the single IIC instance on R-Car E3 does not have the automatic transmission registers, the feature seems to be present and working. So we can declare it to be compatible with the generic version. As the Linux (or other OS?) i2c driver doesn't use automatic transmission, and it's very unlikely it ever will (anyone with a use case?), I'm inclined to simplify, and declare all IIC instances compatible with the generic version. If we ever want to implement support for automatic transmission, we can still differentiate by the SoC-specific compatible values, as they are present anyway, and may have to resort to checking e.g. instance base addresses anyway. Thoughts? Thanks! Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds