06 Jun, 2019

2 commits

  • i2c_idle_bus is already used in i2c_init_transfer. So before each tranfer
    if the bus is not ready, the i2c_idle_bus will be used to force idle.
    It is unnecessary to call it again in probe.

    We found a issue when enabling i2c mux with the mxc_i2c. The mxc_i2c is probed
    after mux probing. However, at this moment the mux is still in idle state,
    won't select port. So if we call i2c_idle_bus in probe, it will fail and cause
    mxc_i2c probe failed.

    Signed-off-by: Ye Li

    Ye Li
     
  • When requesting GPIO, the GPIOD_IS_OUT is missed in flag, so the GPIO
    is set the input mode not output and cause mux not work.

    Signed-off-by: Ye Li

    Ye Li
     

27 May, 2019

1 commit


24 May, 2019

6 commits

  • Add the fuse checking in drivers, when the module is disabled in fuse,
    the driver will not work.

    Changed drivers: BEE, GPMI, APBH-DMA, ESDHC, FEC, QSPI, ECSPI, I2C,
    USB-EHCI, GIS, LCDIF and EPDC.

    Signed-off-by: Ye Li
    (cherry picked from commit 1704e116f9b39aeb99201919a18bc2b1e19a980e)
    (cherry picked from commit 2d3b5df8530cd5ef883750378838dea7c40259af)
    (cherry picked from commit 6e8c9ae136bee8ec0121c1db4b935510caad09db)

    Ye Li
     
  • When we probe device with virtual i2c driver, it will definitely
    fail to power up the PD. Becasue the resource is owned by M4. So
    set this driver to ignore the power up result

    Signed-off-by: Ye Li
    (cherry picked from commit 7f753d1b5950015b11be58aa937e5c14b9f26d7a)

    Ye Li
     
  • Add a new private flag I2C_M_SRTM_STOP(0x0200) to indicate if STOP
    is needed for current message.
    When reading/writing registers for slave devices, generally we have two messages,
    the first message writes the register address, second message reads/writes the value.
    Only the last message needs STOP. But previously M4 sends STOP for each message,
    this causes some slave devices treat it as end of transfer. Then, second message won't
    have any effect. To solve the problem, we introduce this private STOP flag, so M4 can
    STOP according to the flag.

    Signed-off-by: Ye Li
    Reviewed-by: Peng Fan
    (cherry picked from commit e8f70409620da897917dfa29dbe65be82c9129fd)

    Ye Li
     
  • When we probe device with virtual i2c driver, assigning default clock
    will definitely return false, becasue the resource is owned by M4. So
    set this driver to ignore the default clocks

    Signed-off-by: Ye Li

    Ye Li
     
  • We provide override binding function, so the ARCH level can use it
    to determine if it is ok to bind with lpi2c driver.

    Signed-off-by: Ye Li
    (cherry picked from commit b19418270a3d532eacb1069606fa2ab100e04601)

    Ye Li
     
  • Add virtual i2c driver which replies on the VService to send SRTM i2c
    messages with M4.
    For each output on i2c mux, M4 side abstracts a i2c bus with special bus
    id. The virtual i2c mux follows basic mux design, but uses dedicated flag
    to pass the abstract bus id for the mux output to virtual i2c driver.

    Virtual i2c and virtual i2c mux will bind nodes with compatible string
    "fsl,imx-virt-i2c" and "fsl,imx-virt-i2c-mux".

    To support binding local i2c driver or virtual i2c driver at runtime. We
    provides a override function for the driver bind. ARCH level is responsible
    to implement it.

    Signed-off-by: Ye Li
    (cherry picked from commit 25095e9f0d9816c22da97945b66439dfa277aa2b)

    Ye Li
     

21 Mar, 2019

1 commit

  • This patch fixes below warnings found with checker tool.
    The variable len in i2c_msg struct is of unsigned type
    and it is received as recv_count which is unsigned type
    but it is checked with < 0 which is always false, hence
    removed it.
    The local variable curr_recv_count is declared as signed
    type and compared aginst unsigned recv_count which is
    incorrect. This is fixed by declaring it as unsigned type.

    drivers/i2c/i2c-cdns.c: In function ‘cdns_i2c_read_data’:
    drivers/i2c/i2c-cdns.c:317:18: warning: comparison of
    unsigned expression < 0 is always false [-Wtype-limits]
    if ((recv_count < 0))
    ^
    drivers/i2c/i2c-cdns.c:340:24: warning: comparison of
    integer expressions of different signedness:
    ‘u32’ {aka ‘unsigned int’} and ‘int’ [-Wsign-compare]
    updatetx = recv_count > curr_recv_count;
    ^
    drivers/i2c/i2c-cdns.c:361:39: warning: comparison of
    integer expressions of different signedness:
    ‘u32’ {aka ‘unsigned int’} and ‘int’ [-Wsign-compare]
    while (readl(®s->transfer_size) !=

    Signed-off-by: Siva Durga Prasad Paladugu
    Signed-off-by: Michal Simek
    Reviewed-by: Heiko Schocher

    Siva Durga Prasad Paladugu
     

08 Mar, 2019

8 commits


07 Mar, 2019

2 commits

  • Add support for R-Car Gen3 SoCs into the driver, which encompases
    the Gen3 SoC extra timing register handling and 64bit build fixes.

    Signed-off-by: Marek Vasut
    Cc: Heiko Schocher
    Reviewed-by: Heiko Schocher

    Marek Vasut
     
  • Read ICSR only once to avoid missing interrupts. This happens on R8A7791
    Porter during reset, when reading the PMIC register 0x13, which may fail
    sometimes because of the missed DTE interrupt.

    Signed-off-by: Marek Vasut
    Cc: Heiko Schocher
    Cc: Nobuhiro Iwamatsu
    Reviewed-by: Heiko Schocher

    Marek Vasut
     

21 Feb, 2019

2 commits


20 Feb, 2019

1 commit

  • At present this driver does not check whether it is able to actually
    communicate with the I2C controller. It prints a timeout message but still
    considers the probe to be successful.

    To fix this, add some checking that the init succeeds.

    Signed-off-by: Simon Glass
    Reviewed-by: Bin Meng
    Reviewed-by: Heiko Schocher

    Simon Glass
     

14 Feb, 2019

1 commit


11 Feb, 2019

3 commits

  • For !DM case busses are listed as
    ZynqMP> i2c bus
    Bus 0: zynq_0
    Bus 1: zynq_0->PCA9544A@0x75:0
    Bus 2: zynq_0->PCA9544A@0x75:1
    Bus 3: zynq_0->PCA9544A@0x75:2
    Bus 4: zynq_1
    Bus 5: zynq_1->PCA9548@0x74:0
    Bus 6: zynq_1->PCA9548@0x74:1
    Bus 7: zynq_1->PCA9548@0x74:2
    Bus 8: zynq_1->PCA9548@0x74:3
    Bus 9: zynq_1->PCA9548@0x74:4
    Bus 10: zynq_1->PCA9548@0x75:0
    Bus 11: zynq_1->PCA9548@0x75:1
    Bus 12: zynq_1->PCA9548@0x75:2
    Bus 13: zynq_1->PCA9548@0x75:3
    Bus 14: zynq_1->PCA9548@0x75:4
    Bus 15: zynq_1->PCA9548@0x75:5
    Bus 16: zynq_1->PCA9548@0x75:6
    Bus 17: zynq_1->PCA9548@0x75:7

    where is exactly describing i2c bus topology.
    By moving to DM case i2c mux buses are using names from DT and because
    i2c-muxes describing sub busses with the same names like i2c@0, etc it
    is hard to identify which bus is where.
    Linux is adding topology information to i2c-mux busses to identify them
    better.
    This patch is doing the same and composing bus name with topology
    information.

    When patch is applied with topology information on zcu102-revA.
    ZynqMP> i2c bus
    Bus 0: i2c@ff020000
    20: gpio@20, offset len 1, flags 0
    21: gpio@21, offset len 1, flags 0
    75: i2c-mux@75, offset len 1, flags 0
    Bus 2: i2c@ff020000->i2c-mux@75->i2c@0
    Bus 3: i2c@ff020000->i2c-mux@75->i2c@1
    Bus 4: i2c@ff020000->i2c-mux@75->i2c@2
    Bus 1: i2c@ff030000 (active 1)
    74: i2c-mux@74, offset len 1, flags 0
    75: i2c-mux@75, offset len 1, flags 0
    Bus 5: i2c@ff030000->i2c-mux@74->i2c@0 (active 5)
    54: eeprom@54, offset len 1, flags 0
    Bus 6: i2c@ff030000->i2c-mux@74->i2c@1
    Bus 7: i2c@ff030000->i2c-mux@74->i2c@2
    Bus 8: i2c@ff030000->i2c-mux@74->i2c@3
    Bus 9: i2c@ff030000->i2c-mux@74->i2c@4
    Bus 10: i2c@ff030000->i2c-mux@75->i2c@0
    Bus 11: i2c@ff030000->i2c-mux@75->i2c@1
    Bus 12: i2c@ff030000->i2c-mux@75->i2c@2
    Bus 13: i2c@ff030000->i2c-mux@75->i2c@3
    Bus 14: i2c@ff030000->i2c-mux@75->i2c@4
    Bus 15: i2c@ff030000->i2c-mux@75->i2c@5
    Bus 16: i2c@ff030000->i2c-mux@75->i2c@6
    Bus 17: i2c@ff030000->i2c-mux@75->i2c@7

    Behavior before the patch is applied.
    ZynqMP> i2c bus
    Bus 0: i2c@ff020000
    20: gpio@20, offset len 1, flags 0
    21: gpio@21, offset len 1, flags 0
    75: i2c-mux@75, offset len 1, flags 0
    Bus 2: i2c@0
    Bus 3: i2c@1
    Bus 4: i2c@2
    Bus 1: i2c@ff030000 (active 1)
    74: i2c-mux@74, offset len 1, flags 0
    75: i2c-mux@75, offset len 1, flags 0
    Bus 5: i2c@0 (active 5)
    54: eeprom@54, offset len 1, flags 0
    Bus 6: i2c@1
    Bus 7: i2c@2
    Bus 8: i2c@3
    Bus 9: i2c@4
    Bus 10: i2c@0
    Bus 11: i2c@1
    Bus 12: i2c@2
    Bus 13: i2c@3
    Bus 14: i2c@4
    Bus 15: i2c@5
    Bus 16: i2c@6
    Bus 17: i2c@7

    Signed-off-by: Michal Simek
    Reviewed-by: Simon Glass
    Reviewed-by: Heiko Schocher

    Michal Simek
     
  • For i2c controllers which are missing alias in DT there is no req_seq
    setup. This function is setting up proper ID based on highest found
    alias ID.

    On zcu102 this is the behavior when patch is applied.
    ZynqMP> i2c bus
    Bus 0: i2c@ff020000
    20: gpio@20, offset len 1, flags 0
    21: gpio@21, offset len 1, flags 0
    75: i2c-mux@75, offset len 1, flags 0
    Bus 2: i2c@0
    Bus 3: i2c@1
    Bus 4: i2c@2
    Bus 1: i2c@ff030000 (active 1)
    74: i2c-mux@74, offset len 1, flags 0
    75: i2c-mux@75, offset len 1, flags 0
    Bus 5: i2c@0 (active 5)
    54: eeprom@54, offset len 1, flags 0
    Bus 6: i2c@1
    Bus 7: i2c@2
    Bus 8: i2c@3
    Bus 9: i2c@4
    Bus 10: i2c@0
    Bus 11: i2c@1
    Bus 12: i2c@2
    Bus 13: i2c@3
    Bus 14: i2c@4
    Bus 15: i2c@5
    Bus 16: i2c@6
    Bus 17: i2c@7

    Before this patch applied (controllers have -1 ID)
    ZynqMP> i2c bus
    Bus 0: i2c@ff020000
    20: gpio@20, offset len 1, flags 0
    21: gpio@21, offset len 1, flags 0
    75: i2c-mux@75, offset len 1, flags 0
    Bus -1: i2c@0
    Bus -1: i2c@1
    Bus -1: i2c@2
    Bus 1: i2c@ff030000 (active 1)
    74: i2c-mux@74, offset len 1, flags 0
    75: i2c-mux@75, offset len 1, flags 0
    Bus -1: i2c@0 (active 0)
    54: eeprom@54, offset len 1, flags 0
    Bus -1: i2c@1
    Bus -1: i2c@2
    Bus -1: i2c@3
    Bus -1: i2c@4
    Bus -1: i2c@0
    Bus -1: i2c@1
    Bus -1: i2c@2
    Bus -1: i2c@3
    Bus -1: i2c@4
    Bus -1: i2c@5
    Bus -1: i2c@6
    Bus -1: i2c@7

    Signed-off-by: Michal Simek
    Reviewed-by: Heiko Schocher

    Michal Simek
     
  • There is a need to find out the first free i2c ID which can be used for
    i2s buses (including i2c buses connected to i2c mux). Do it early in
    init and share this variable with other i2c classes for uniq bus
    identification.

    add from hs:
    fix build problem in i2c-uclass.c for omap devices

    Signed-off-by: Michal Simek
    Reviewed-by: Heiko Schocher

    Michal Simek
     

24 Jan, 2019

1 commit


18 Jan, 2019

1 commit


15 Jan, 2019

4 commits

  • Setup proper DM_I2C dependency.

    Signed-off-by: Michal Simek

    Michal Simek
     
  • Updates i2c muxes drivers to support livetree.
    Similar changes were done by:
    "net: zynq_gem: convert to use livetree"
    (sha1: 26026e695afa794ac018a09e79a48120d322b60d)

    Signed-off-by: Michal Simek

    Michal Simek
     
  • This is needed to properly calculate i2c bus speed divisors.

    Signed-off-by: Tomasz Gorochowik
    Signed-off-by: Wojciech Tatarski
    Signed-off-by: Michal Simek

    Tomasz Gorochowik
     
  • Add Xilinx AXI I2C controller driver based on the Linux i2c-xiic driver.
    This driver is stripped of all the IRQ handling and uses pure polling,
    yet tries to retain most of the structure of the Linux driver to make
    backporting of fixes easy.

    Note that the IP has a known limitation on 255 bytes read and write,
    according to xilinx this is still being worked on [1].

    [1] https://forums.xilinx.com/t5/Embedded-Processor-System-Design/AXI-IIC-V2-0-I2C-Master-Reading-multiple-bytes-from-I2C-slave/m-p/854419/highlight/true#M39387

    Signed-off-by: Marek Vasut
    Cc: Michal Simek
    Cc: Michal Simek
    Cc: Heiko Schocher
    Reviewed-by: Heiko Schocher

    Marek Vasut
     

12 Dec, 2018

1 commit

  • Commit f32a8007ef0f ("dm: i2c: Make i2c_get_chip_for_busnum() fail if the
    chip is not detected") introduced a regression for the NVIDIA Jetson TX2.

    For some reason the xfer callback of the tegra i2c driver doesn't support
    probing the I2C devices with a 0-length message.
    Fixing the regression by providing a dummy implementation of probe_chip()
    that does nothing.

    Signed-off-by: Jean-Jacques Hiblot
    Tested-by: Stephen Warren

    Jean-Jacques Hiblot
     

10 Dec, 2018

3 commits


30 Nov, 2018

2 commits

  • Update the device tree, sandbox i2c driver and tests to use the new
    emulation parent to hold emulators.

    Signed-off-by: Simon Glass

    Simon Glass
     
  • Sandbox i2c works using emulation drivers which are currently children of
    the i2c device:

    rtc_0: rtc@43 {
    reg = ;
    compatible = "sandbox-rtc";
    emul {
    compatible = "sandbox,i2c-rtc";
    };
    };

    In this case the emulation device is attached to i2c bus on address 0x43
    and provides the Real-Time-Clock (RTC) functionality.

    However this is not ideal, since every device on an I2C bus has a child
    device. This is only really the case for sandbox, but we want to avoid
    special-case code for sandbox.

    A better approach seems to be to add a separate node on the bus, an
    'emulation parent'. This can be given a bogus address (such as 0xff) and
    hides all the emulators away. Then we can use a phandle to point from the
    device to the correct emualtor, and only on sandbox. The code to find an
    emulator does not interfere with normal i2c operation.

    Add a new UCLASS_I2C_EMUL_PARENT uclass which allows finding an emulator
    given a bus, and finding a bus given an emulator. This will be used in a
    follow-on patch.

    Signed-off-by: Simon Glass

    Simon Glass
     

17 Nov, 2018

1 commit