08 Mar, 2020

1 commit

  • Merge Linux stable release v5.4.24 into imx_5.4.y

    * tag 'v5.4.24': (3306 commits)
    Linux 5.4.24
    blktrace: Protect q->blk_trace with RCU
    kvm: nVMX: VMWRITE checks unsupported field before read-only field
    ...

    Signed-off-by: Jason Liu

    Conflicts:
    arch/arm/boot/dts/imx6sll-evk.dts
    arch/arm/boot/dts/imx7ulp.dtsi
    arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi
    drivers/clk/imx/clk-composite-8m.c
    drivers/gpio/gpio-mxc.c
    drivers/irqchip/Kconfig
    drivers/mmc/host/sdhci-of-esdhc.c
    drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c
    drivers/net/can/flexcan.c
    drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
    drivers/net/ethernet/mscc/ocelot.c
    drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
    drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
    drivers/net/phy/realtek.c
    drivers/pci/controller/mobiveil/pcie-mobiveil-host.c
    drivers/perf/fsl_imx8_ddr_perf.c
    drivers/tee/optee/shm_pool.c
    drivers/usb/cdns3/gadget.c
    kernel/sched/cpufreq.c
    net/core/xdp.c
    sound/soc/fsl/fsl_esai.c
    sound/soc/fsl/fsl_sai.c
    sound/soc/sof/core.c
    sound/soc/sof/imx/Kconfig
    sound/soc/sof/loader.c

    Jason Liu
     

05 Mar, 2020

2 commits

  • commit 9e661cedcc0a072d91a32cb88e0515ea26e35711 upstream.

    The printout for txabrt is way too talkative and is highly annoying with
    scanning programs like 'i2cdetect'. Reduce it to the minimum, the rest
    can be gained by I2C core debugging and datasheet information. Also,
    make it a debug printout, it won't help the regular user.

    Fixes: ba92222ed63a ("i2c: jz4780: Add i2c bus controller driver for Ingenic JZ4780")
    Reported-by: H. Nikolaus Schaller
    Tested-by: H. Nikolaus Schaller
    Signed-off-by: Wolfram Sang
    Signed-off-by: Greg Kroah-Hartman

    Wolfram Sang
     
  • commit 54498e8070e19e74498a72c7331348143e7e1f8c upstream.

    Factor out 100 from the equation and do 32-bit arithmetic (3 * clk_mhz / 10)
    instead of 64-bit.

    Notice that clk_mhz is MHz, so the multiplication will never wrap 32 bits
    and there is no need for div_u64().

    Addresses-Coverity: 1458369 ("Unintentional integer overflow")
    Fixes: 0560ad576268 ("i2c: altera: Add Altera I2C Controller driver")
    Suggested-by: David Laight
    Signed-off-by: Gustavo A. R. Silva
    Reviewed-by: Thor Thayer
    Signed-off-by: Wolfram Sang
    Signed-off-by: Greg Kroah-Hartman

    Gustavo A. R. Silva
     

26 Feb, 2020

1 commit


26 Jan, 2020

3 commits

  • [ Upstream commit d77eceb2de99f5d7e0c645bad15511fe1af59e09 ]

    Distinguish between the case where dma information is not provided
    within the DT and the case of an error during the dma init.
    Exit the probe with error in case of an error during dma init.

    Fixes: bb8822cbbc53 ("i2c: i2c-stm32: Add generic DMA API")
    Signed-off-by: Alain Volmat
    Reviewed-by: Pierre-Yves MORDRET
    Signed-off-by: Wolfram Sang
    Signed-off-by: Sasha Levin

    Alain Volmat
     
  • commit 7787657d7ee55a9ecf4aea4907b46b87a44eda67 upstream.

    Fix a typo in the free slave id search loop. Instead of I2C_CLIENT_PEC,
    it should have been I2C_CLIENT_TEN. The slave id 1 can only handle 7-bit
    addresses and thus is not eligible in case of 10-bit addresses.
    As a matter of fact none of the slave id support I2C_CLIENT_PEC, overall
    check is performed at the beginning of the stm32f7_i2c_reg_slave function.

    Fixes: 60d609f30de2 ("i2c: i2c-stm32f7: Add slave support")
    Signed-off-by: Alain Volmat
    Reviewed-by: Pierre-Yves MORDRET
    Signed-off-by: Wolfram Sang
    Signed-off-by: Greg Kroah-Hartman

    Alain Volmat
     
  • commit 52d3be711e065a97a57c2f2ffba3098748855bd6 upstream.

    The IP can handle two slave addresses. One address can either be
    7 bits or 10 bits while the other can only be 7 bits.
    In order to ensure that a 10 bits address can always be allocated
    (assuming there is only one 7 bits address already allocated),
    pick up the 7-bits only address slot in priority when performing a 7-bits
    address allocation.

    Fixes: 60d609f30de2 ("i2c: i2c-stm32f7: Add slave support")
    Signed-off-by: Alain Volmat
    Reviewed-by: Pierre-Yves MORDRET
    Signed-off-by: Wolfram Sang
    Signed-off-by: Greg Kroah-Hartman

    Alain Volmat
     

23 Jan, 2020

3 commits

  • commit e64175776d06a8ceebbfd349d7e66a4a46ca39ef upstream.

    When handling devm_gpiod_get_optional() errors, free the memory already
    allocated. This fixes Smatch warnings:

    drivers/i2c/busses/i2c-iop3xx.c:437 iop3xx_i2c_probe() warn: possible memory leak of 'new_adapter'
    drivers/i2c/busses/i2c-iop3xx.c:442 iop3xx_i2c_probe() warn: possible memory leak of 'new_adapter'

    Fixes: fdb7e884ad61 ("i2c: iop: Use GPIO descriptors")
    Reported-by: kbuild test robot
    Reported-by: Dan Carpenter
    Signed-off-by: Krzysztof Kozlowski
    Signed-off-by: Wolfram Sang
    Signed-off-by: Greg Kroah-Hartman

    Krzysztof Kozlowski
     
  • commit 24a49678f5e20f18006e71b90ac1531876b27eb1 upstream.

    One of the recent Tegra I2C commits made a change that resumes runtime PM
    during driver's probe, but it missed to put the RPM in a case of error.
    Note that it's not correct to use pm_runtime_status_suspended because it
    breaks RPM refcounting.

    Fixes: 8ebf15e9c869 ("i2c: tegra: Move suspend handling to NOIRQ phase")
    Cc: # v5.4+
    Tested-by: Thierry Reding
    Signed-off-by: Dmitry Osipenko
    Signed-off-by: Wolfram Sang
    Signed-off-by: Greg Kroah-Hartman

    Dmitry Osipenko
     
  • commit 9f42de8d4ec2304f10bbc51dc0484f3503d61196 upstream.

    I noticed that sometime I2C clock is kept enabled during suspend-resume.
    This happens because runtime PM defers dynamic suspension and thus it may
    happen that runtime PM is in active state when system enters into suspend.
    In particular I2C controller that is used for CPU's DVFS is often kept ON
    during suspend because CPU's voltage scaling happens quite often.

    Fixes: 8ebf15e9c869 ("i2c: tegra: Move suspend handling to NOIRQ phase")
    Cc: # v5.4+
    Tested-by: Thierry Reding
    Signed-off-by: Dmitry Osipenko
    Signed-off-by: Wolfram Sang
    Signed-off-by: Greg Kroah-Hartman

    Dmitry Osipenko
     

18 Jan, 2020

1 commit

  • commit 3b722da6672df8392f9c43d7c7e04bddd81d7e37 upstream.

    The commit bebff81fb8b9 ("i2c: bcm2835: Model Divider in CCF") introduced
    a NULL pointer dereference on driver unload. It seems that we can't fetch
    the bus clock via devm_clk_get in bcm2835_i2c_remove. As an alternative
    approach store a pointer to the bus clock in the private driver structure.

    Fixes: bebff81fb8b9 ("i2c: bcm2835: Model Divider in CCF")
    Signed-off-by: Stefan Wahren
    Signed-off-by: Wolfram Sang
    Signed-off-by: Greg Kroah-Hartman

    Stefan Wahren
     

15 Jan, 2020

1 commit

  • commit cf8ce8b80f8bf9669f6ec4e71e16668430febdac upstream.

    The I2C specification states that tsu:sto for standard mode timing must
    be at minimum 4us. Pictographically, this is:

    SCL: ____/~~~~~~~~~
    SDA: _________/~~~~
    ->| |
    Signed-off-by: Wolfram Sang
    Signed-off-by: Greg Kroah-Hartman

    Russell King
     

05 Jan, 2020

1 commit

  • [ Upstream commit 53aaaa5d9b1e95eb40e877fbffa6f964a8394bb7 ]

    Add missing dma channels free calls in case of error during probe
    and reorder the remove function so that dma channels are freed after
    the i2c adapter is deleted.
    Overall, reorder the remove function so that probe error handling order
    and remove function order are same.

    Fixes: 7ecc8cfde553 ("i2c: i2c-stm32f7: Add DMA support")
    Signed-off-by: Alain Volmat
    Reviewed-by: Pierre-Yves MORDRET
    Signed-off-by: Wolfram Sang
    Signed-off-by: Sasha Levin

    Alain Volmat
     

27 Dec, 2019

1 commit


02 Dec, 2019

1 commit


29 Nov, 2019

2 commits


28 Nov, 2019

5 commits

  • This supports property idle-state,if present,
    overrides i2c-mux-idle-disconnect.

    My use cases:
    - Use the property idle-state to fix
    an errata on LS2085ARDB and LS2088ARDB.
    - Errata id: E-00013(board LS2085ARDB and
    LS2088ARDB revision on Rev.B, Rev.C and Rev.D).
    - About E-00013:
    - Description: I2C1 and I2C3 buses
    are missing pull-up.
    - Impact: When the PCA954x device is tri-stated, the I2C bus
    will float. This makes the I2C bus and its associated
    downstream devices inaccessible.
    - Hardware fix: Populate resistors R189 and R190 for I2C1
    and resistors R228 and R229 for I2C3.
    - Software fix: Remove the tri-state option from the PCA954x
    driver(PCA954x always on enable status, specify a
    channel zero in dts to fix the errata E-00013).

    Tested-by: Ioana Ciornei
    Signed-off-by: Biwen Li

    Biwen Li
     
  • The I2CR[MSTA] will be modified by software or hardware even in master
    mode. The judgment of slave mode by reading CR register is unreliable.
    Change to use i2c_imx->slave registered status to judge i2c mode.

    Acked-by: Fugang Duan
    Signed-off-by: Clark Wang

    Clark Wang
     
  • - Simplify code with helper function i2c_imx_clr_al_bit
    - Fix an error about clearing arbitration lost bit
    - Fix an error that not set I2Cx_IBCR following by
    the workaround of A-010650 (in step 5)

    Reviewed-by: Clark Wang
    Signed-off-by: Biwen Li

    Biwen Li
     
  • The patch supports slave mode for imx I2C driver

    Reviewed-by: Clark Wang
    Signed-off-by: Biwen Li

    Biwen Li
     
  • Add i2c backend frontend support.
    The transaction only support one msg each time.
    The frontend sends a request to backend, backend use i2c_transfer
    to do real transaction to hardware and return the results to frontend.

    Now i2cdump/get/set works.
    In domu cfg file, use
    "vi2c = ['backend=0,be-adapter=5a800000.i2c,addr=0x51;0x44']" to
    create a dummy controller in frontend and allowed slaves in backend.

    Currently the slave address check not added, it will be supported in
    furture patch.

    Signed-off-by: Peng Fan
    Acked-by: Leonard Crestez

    Peng Fan
     

25 Nov, 2019

18 commits

  • Currently, i2c_imx_bus_busy in i2c_imx_xfer is called before
    pm_runtime_get which means the clocks are still not enabled.
    This will cause a hang on IMX as IMX requires accessing registers
    with clocks.

    So let's change the order to ensure the clocks are enabled before
    accessing registers. This is also a more safe way to access registers,
    suppose shouldn't affect other platforms.

    Fixes: 4a6ebf1c125c ("i2c: imx: add workaround for erratum ERR010027")
    Reviewed-by: Biwen Li
    Signed-off-by: Dong Aisheng

    Dong Aisheng
     
  • We can't use CONFIG_ARCH_LAYERSCAPE for one Image multiple platforms
    support.

    Reviewed-by: Biwen Li
    Signed-off-by: Dong Aisheng

    Dong Aisheng
     
  • Based on the I2C specification, if the data line (SDA) is stuck low,
    the master should send nine clock pulses. The I2C slave device that
    held the bus low should release it sometime within those nine clocks.

    Because pinctrl is not supported on Layerscape, current bus recovery
    is not avalible for Layerscape. This patch uses an open drain GPIO
    pin to connect to the IICx_SCL to drive nine clock pulses to unlock
    the I2C bus.

    Signed-off-by: Zhang Ying-22455

    Zhang Ying-22455
     
  • ERR010027: Attempting a start cycle while the bus is busy may
    generate a short clock pulse.

    Software must ensure that the I2C BUS is idle by checking the
    bus busy before switching to master mode and attempting a Start
    cycle.

    Signed-off-by: Zhang Ying-22455

    Zhang Ying-22455
     
  • "i2c_clk_rate / 2" might be zero when the i2c_clk_rate gets the clock is
    0 or 1, so add a judgment to avoid the denominator is equal to 0.

    Signed-off-by: Clark Wang
    [Arul: Add support to check return value everywhere in the driver]
    Signed-off-by: Arulpandiyan Vadivel

    Signed-off-by: Shrikant Bobade
    (cherry picked from commit d382de595bffc0975ab7c0582e08dd4f7afc0c1a)
    (cherry picked from commit 456caa9ba270ca8f4f962918a0625d1a8348f316)

    Clark Wang
     
  • According the e7805 in Errata, the SCK low level period should be less
    than 1.3us.

    The other series platform use this same IP can match the errata, and
    ensure the low level period longer than 1.3us when the speed set to
    400KHz. However, only at imx7d platform, the low level period is less
    than 1.3us in the same situation.

    Therefore, limit the maximum transfer speed to 384KHz when probe at
    imx7d platform.

    Signed-off-by: Clark Wang
    (cherry picked from commit 19f553846e872b5c379b37ed029132b79566cab0)
    (cherry picked from commit 5d355407812025e5157f82b7763580e7295a40fd)

    Clark Wang
     
  • When we do system suspend, the runtime pm will be disabled, but we need
    to control the PMIC to power on/off the regulator, if the runtime pm is
    disabled, if will failed to request runtime wakeup. So data transfer will
    failed.

    Signed-off-by: Bai Ping
    Signed-off-by: Gao Pan
    Signed-off-by: Vipul Kumar
    (cherry picked from commit 93adab71408f1f162015e77715dd04ce2301d673)

    Gao Pan
     
  • restore pin setting for i2c in suspend/resume

    Signed-off-by: Gao Pan
    (Vipul: Fixed merge conflicts)
    Signed-off-by: Vipul Kumar
    (cherry picked from commit 42b5aa1d72c09015d435459c6a59022255e3ef21)

    Gao Pan
     
  • The i2c irq is masked when pcie starts a i2c transfer process
    during noirq suspend stage. As a result, i2c transfer fails.
    To solve the problem, IRQF_NO_SUSPEND is added to i2c bus.

    Signed-off-by: Gao Pan
    Signed-off-by: Fugang Duan
    Signed-off-by: Vipul Kumar
    (cherry picked from commit d21259d913effcad322e30d389323e72a0f9709d)

    gaopan
     
  • use subsys_initcall for i2c driver to improve i2c driver probe priority

    Signed-off-by: Gao Pan
    (cherry picked from commit 3661eef81a308dab2bfae3790c045ae2d2fd3f49)
    (cherry picked from commit 9c867985d2657b9b74813d8143a87e9c9a9a158e)

    Gao Pan
     
  • During porting commit ede264acf031 ("MLK-14982-1 imx8: lpi2c: add ipg
    clk for lpi2c driver") which replaced the single clk
    with clk_ipg and clk_per was skipped.

    Part of the code was later added in commit 96dbdd8c3d0b ("MLK-16713 i2c:
    imx-lpi2c: add runtime pm support") except the "clk" field was kept and
    clk_get calls were not updated.

    Fix imx7ulp boot by fetching both clocks.

    Fixes: 96dbdd8c3d0b ("MLK-16713 i2c: imx-lpi2c: add runtime pm support")

    Signed-off-by: Leonard Crestez
    Acked-by: Fugang Duan
    (cherry picked from commit 1b9c92f3446307b7b24fe143b19dd388811558e9)

    Leonard Crestez
     
  • add debug message when i2c peripheral clk rate is 0, then
    directly return -EINVAL.

    Signed-off-by: Gao Pan
    Reviewed-by: Andy Duan
    (Vipul: Fixed merge conflicts)
    Signed-off-by: Vipul Kumar
    (cherry picked from commit 1e6707bb5e0cd0dcf72af71f01792fe4e3721e7f)

    Gao Pan
     
  • Manage irq resource request/release in runtime pm to save irq domain's
    power.

    Signed-off-by: Frank Li
    Signed-off-by: Fugang Duan
    Tested-by: Guoniu.Zhou
    Reviewed-by: Frank Li
    (Vipul: Fixed merge conflicts)
    Signed-off-by: Vipul Kumar
    (cherry picked from commit e1aa13df4b2e7b3e6114dbbf94dc242278f02916)

    Fugang Duan
     
  • - Add runtime pm support to dynamicly manage the ipg and per clocks.
    - Put the suspend to suspend_noirq.
    - Call .pm_runtime_force_suspend() to force runtime pm suspended
    in .suspend_noirq().

    BuildInfo:
    - SCFW 88456c73, IMX-MKIMAGE 06bc2767, ATF a438801
    - U-Boot 2017.03-imx_v2017.03_4.9.51_imx8_beta1+g7953d47

    Signed-off-by: Fugang Duan
    Signed-off-by: Gao Pan
    Reviewed-by: Anson Huang

    During 4.14 rebase added pm_runtime_get_sync/pm_runtime_put around
    the reading of LPI2C_PARAM.

    Signed-off-by: Leonard Crestez
    (Vipul: Fixed merge conflicts)
    Signed-off-by: Vipul Kumar
    (cherry picked from commit 31cc4be3e80a53d890657a06458e04c1527313a9)

    Fugang Duan
     
  • A NACK flag in ISR means i2c bus error. In such codition,
    there is no need to do read/write operation. It's better
    to return ISR directly and then stop i2c transfer.

    Signed-off-by: Gao Pan
    (cherry-pick from 839d59e48b6fdbd882776a48a88ce26ff14d8b86)
    Signed-off-by: Vipul Kumar
    (cherry picked from commit 3d05274613f55f4f6745a7d05a856fbc7cb91e6f)

    Gao Pan
     
  • Add defer probe when rpbus probe, so if the rpmsg channel is not
    created, the rpbus will try to probe later.

    Signed-off-by: Clark Wang

    Clark Wang
     
  • For some chips may need long time to get the response from M4 sometimes,
    enlarge timeout to 500ms.

    Add a judgement to check if the received data is the current transfer
    wanted.

    Signed-off-by: Clark Wang
    (cherry picked from commit 222e201b520cbd01b611fc45ae2f6b2f0b9d73a1)
    (cherry picked from commit 6cfc8578ccce0e664b5428738090a51322773366)

    Clark Wang
     
  • I2c_lock_bus function in i2c-core-base will not stop the transfer to
    different devices on different buses at the same time.

    Since the multiple rpmsg i2c buses share one rpmsg channel, so it has to
    add mutex to protect rpmsg resource accessing.

    Signed-off-by: Clark Wang
    (cherry picked from commit d592afe9018e193f675b8c710fb1e66e44851ec8)
    (cherry picked from commit 44622ff8c847031d65fd75a03459061faf07d0f2)

    Clark Wang