Commit Graph

6048 Commits

Author SHA1 Message Date
Yoshihiro Furudera
7c3a833a1d i2c: designware: Add ACPI HID for DWAPB I2C controller on FUJITSU-MONAKA
Enable DWAPB I2C controller support on FUJITSU-MONAKA.
This will be used in the FUJITSU-MONAKA server scheduled
for shipment in 2027.

The DSDT information obtained when verified using an
in-house simulator is presented below.

     Device (SMB0)
     {
         Name (_HID, "FUJI200B")  // _HID: Hardware ID
         Name (_UID, Zero)  // _UID: Unique ID
         ...
         Name (_CRS, ResourceTemplate ()
         {
             Memory32Fixed (ReadWrite,
                 0x2A4B0000,         // Address Base
                 0x00010000,         // Address Length
                 )
             Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive, ,, )
             {
                 0x00000159,
             }
         })
         ...
     }

The expression SMB0 is used to indicate SMBus HC#0,
a string of up to four characters.

Created the SMB0 object according to the following
specifications:

ACPI Specification
13.2. Accessing the SMBus from ASL Code
https://uefi.org/htmlspecs/ACPI_Spec_6_4_html/13_ACPI_System_Mgmt_Bus_Interface_Spec/accessing-the-smbus-from-asl-code.html

IPMI Specification
Example 4: SSIF Interface(P574)
https://www.intel.co.jp/content/www/jp/ja/products/docs/servers/ipmi/ipmi-second-gen-interface-spec-v2-rev1-1.html

Signed-off-by: Yoshihiro Furudera <fj5100bi@fujitsu.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
2024-11-24 16:03:50 +01:00
Bartosz Golaszewski
50b9d43e6c i2c: qup: use generic device property accessors
There's no reason for this driver to use OF-specific property helpers.
Drop the last one in favor of the generic variant and no longer include
of.h.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
2024-11-24 16:03:50 +01:00
Linus Torvalds
55ae3eef10 i2c-for-6.13-rc1
i2c-core (Wolfram)
 
  - drivers can now use a GPIO as a side channel for SMBus Alerts
    using a generic binding
 
  - regular stuff like mem leak fix, Makefile maintenance...
 
 i2c-host updates (Andi)
 
 Major Improvements and Refactoring:
 
  - All controllers using the 'remove_new' callback have been
    reverted to use the 'remove' callback.
 
  - Intel SCH controller underwent significant refactoring,
    this brings love and a modern look to the driver.
 
  - PIIX4 driver refactored to enable usage by other drivers
    (e.g., AMD ASF).
 
  - iMX/MXC improved message handling to reduce protocol overhead:
      Refactored DMA/non-DMA read/write and bus polling mechanisms
      to achieve this.
 
  - ACPI documentation for PIIX4.
 
 New Features:
 
  - i2c-cadence added support for atomic transfers.
  - Qualcomm CII added support for a 32MHz serial engine clock.
 
 Deprecated Features:
 
  - Dropped outdated support for AMD756 S4882 and NFORCE2 S4985. If
    somebody misses this, Jean will rewrite support using the proper
    i2c mux framework.
 
 New Hardware Support:
 
  - Added support for:
    - Intel Panther Lake (new ID)
    - AMD ASF (new driver)
    - S32G2/S32G3 SoCs (new ID)
    - Realtek RTL I2C Controller (new driver)
    - HJMC01 DesignWare ACPI HID (new ID)
    - PIC64GX to Microchip Core (new ID)
    - Qualcomm SDM670 to Qualcomm CCI (new ID)
 
 at24 updates (Bartosz)
 
 - add support for the lockable page on ST M24256E
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEOZGx6rniZ1Gk92RdFA3kzBSgKbYFAmc+/UUACgkQFA3kzBSg
 KbZrqA/+MqNiN8NIkgA3nIODQP1Cf/aUhywHITsRgoo85vVDHeiaJtKc25KMi6Tb
 I5GgHp9Q0TtYdXzKM+nC7xjO64h8obGRXPHv5fDbRAZlFbWSR8u+iQp9entuVJe4
 TiRFh9M8chAC82QNCvYVKx3jTHlmZaR7bXDtoAf7bG0LdWnjey1JSFfn6cPweVNM
 0sD95tjBDb53tCRPGVKrCsnrs5uGxugGvH5I16hB6iokbaiIlGosIBg/8YBGHCS8
 V8RqLSfzCl7X7xICeRv2ttRWx78Nz38RBC+truR5OEvvdZ+J2UCZ0710/w6FWfPp
 F85ReZrG5bh49Jobt/AyC7VXqL6djg+C6jVU1rX8Eb3G6TapL4iCJe9CcI4EXANY
 1mtzZ8fqg4EaVMVRQx3tiyjNFWQba9ssSyzRB8ZfCqmS6xV2HXJby3zNoDA9SoxH
 tNn3vp0FfOtdn4lGbYAJE4zUMupXiUkrgswj5sKltYjXh/OmaDLJfYeFhPp+SwvW
 uWuLZveM0mAn6BWyM4g9v6MIHWiUumkF5xwlAfNOh3ogxqUtAPtbzk7FQ332ni0Z
 X11J5EOBzbMQR24moRo7xtQSdoDDSQDpytOVXTY2QWv3rZuk0oVL57aifJdtTkrK
 QktmylTfYlfI2hWLRoWFJ1j7nQyBveiNHh/qq0hxCkXLP3vA5gs=
 =lrn5
 -----END PGP SIGNATURE-----

Merge tag 'i2c-for-6.13-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux

Pull i2c updates from Wolfram Sang:
 "Core:

   - drivers can now use a GPIO as a side channel for SMBus Alerts using
     a generic binding

   - regular stuff like mem leak fix, Makefile maintenance...

  Host improvements and refactoring:

   - All controllers using the 'remove_new' callback have been reverted
     to use the 'remove' callback

   - Intel SCH controller underwent significant refactoring, this brings
     love and a modern look to the driver

   - PIIX4 driver refactored to enable usage by other drivers (e.g., AMD
     ASF)

   - iMX/MXC improved message handling to reduce protocol overhead:
     Refactored DMA/non-DMA read/write and bus polling mechanisms to
     achieve this.

   - ACPI documentation for PIIX4

  New host features:

   - i2c-cadence support for atomic transfers

   - Qualcomm CII support for a 32MHz serial engine clock

  Deprecated features:

   - Dropped outdated support for AMD756 S4882 and NFORCE2 S4985. If
     somebody misses this, Jean will rewrite support using the proper
     i2c mux framework.

  New hardware IDs for existing drivers:

   - Intel Panther Lake

   - S32G2/S32G3 SoCs

   - HJMC01 DesignWare ACPI HID

   - PIC64GX to Microchip Core

   - Qualcomm SDM670 to Qualcomm CCI

  New drivers:

   - AMD ASF

   - Realtek RTL I2C Controller

  at24 updates:

   - add support for the lockable page on ST M24256E"

* tag 'i2c-for-6.13-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux: (59 commits)
  docs: i2c: piix4: Add ACPI section
  i2c: Add driver for the RTL9300 I2C controller
  i2c: qcom-cci: Remove unused struct member cci_clk_rate
  dt-bindings: i2c: Add Realtek RTL I2C Controller
  i2c: busses: Use *-y instead of *-objs in Makefile
  i2c: imx: add support for S32G2/S32G3 SoCs
  dt-bindings: i2c: imx: add SoC specific compatible strings for S32G
  i2c: qcom-cci: Remove the unused variable cci_clk_rate
  i2c: Drop legacy muxing pseudo-drivers
  i2c: imx: prevent rescheduling in non dma mode
  i2c: imx: separate atomic, dma and non-dma use case
  i2c: imx: do not poll for bus busy in single master mode
  i2c: designware: Add a new ACPI HID for HJMC01 I2C controller
  i2c: qcom-geni: Keep comment why interrupts start disabled
  dt-bindings: i2c: microchip: corei2c: Add PIC64GX as compatible with driver
  i2c: designware: constify abort_sources
  i2c: Switch back to struct platform_driver::remove()
  i2c: qcom-geni: Support systems with 32MHz serial engine clock
  i2c: qcom-cci: Stop complaining about DT set clock rate
  dt-bindings: i2c: qcom-cci: Document SDM670 compatible
  ...
2024-11-21 13:19:29 -08:00
Linus Torvalds
131561f2ca gpio updates for v6.13-rc1
GPIOLIB core:
 - use the new mem_is_zero() instead of memchr_inv(s, 0, n)
 - don't store debounce period twice needlessly
 - clean-up debugfs handling
 - remove leftover comments referring to no longer used spinlocks
 - unduplicate some operations like SRCU locks and initializing GPIO descriptors
 - constify the sysfs class struct
 - use lock guards in GPIO sysfs code
 - update GPIO uAPI internal flags all at once atomically for consistency with
   other places
 - modify the behavior of the sysfs interface by no longer exporting lines that
   are named inside the driver code or board files with the sysfs links bearing
   the line names as this has for many years been largely unused due to the
   prevalence of DT, ACPI and firmware nodes over board files and made the API
   inconsistent
 - for GPIO interrupt providers: free irqs that are still requested by users
   when removing the chip
 
 GPIO uAPI:
 - notify user-space about changes to GPIO lines' state (requested, released,
   reconfigured) triggered from the kernel as well (until now we'd only do
   this for changes triggered from user-space)
 - to that end: modify the internal workings of the notification mechanism by
   switching to an atomic notifier which allows us to send events from atomic
   context
 - also to that end store the debounce period in the GPIO descriptor struct
   and not in the character device context struct
 - while at it, also cover the corner-case of users introducing changes over
   sysfs while others watch them via the character device
 - don't report GPIO lines requested as interrupts as "used" to user-space as it
   can still request them as GPIOs
 
 New drivers:
 - add a driver for the GPIO functionality of the MFD Congatec Board Controller
 - add a driver for the PolarFire GPIO controller
 - add a driver supporting the GPIOs on FTDI FT2232H
 
 Driver improvements:
 - use generic device property accessors instead of OF-specific ones across
   many GPIO drivers (mpc8xxx, vf610, eic-sprd, davinci, ts4900, xilinx, mvebu)
 - use devres helpers to simplify error paths and either shrink or entirely
   remove the driver's remove() callback (grgpio, amdpt, menz127, max730x,
   ftgpio010, 74x164, ljca)
 - use helper variables to store the address of pdev->dev and avoid some
   line-breaks
 - use device_for_each_child_node_scoped() to avoid having to put the fwnode
   on breaks or errors (gpio-sim, gpio-dwapb, gpiolib-acpi)
 - use a scoped bitmap to simplify the code and drop goto labels in
   gpio-aggregator
 - drop unneeded Kconfig dependencies on OF_GPIO (grgpio, mveby, xilinx)
 - add support for new models to gpio-aspeed, gpio-rockchip and gpio-dwapb
 - clean-up ACPI handling and some other bits in gpio-xgene-sb
 - replace deprecated PCI functions in pcie-idio-24 and pci-idio-16
 - allow to build davinci and mvebu drivers with COMPILE_TEST=y
 - remove dead code in gpio-mb86s7x
 - switch back to using platform_driver::remove() (after the conversion to
   remove_new()) across the GPIO drivers
 - remove remaining uses of GPIOF_ACTIVE_LOW across the tree and drop this
   deprecated symbol
 - convert the gpio-altera driver to no longer pull in the deprecated
   legacy-of-mm-gpiochip.h header
 - use of_property_present() instead of of_property_read_bool() in gpiolib-of
   and gpio-rockchip
 - allow to build the tegra186 driver on Tegra234 platforms in Kconfig
 
 Late fixes:
 - add a missing return value check after devm_kasprintf() to gpio-grgpio
 
 DT bindings:
 - document the ngpios property of gpio-mmio
 - add support for a new aspeed model
 - fix the example for st,nomadik-gpio
 
 Other:
 - kernel doc and comments tweaks
 - fix typos in TODO
 - reorder headers alphabetically in some drivers
 - fix incorrect format specifiers in gpio tools
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEFp3rbAvDxGAT0sefEacuoBRx13IFAmc7INQACgkQEacuoBRx
 13Kotg/8DDkhZ01Qc2uR817DjCdbalS0TDr4FYn/XusyeBEgNgQDm/TcfmIMiU4M
 Dazb7pOXfEc4VJqPTSpvqsTwTyMLN1pi58ZXZZA760rf8O8O+8c/cogVk36QK+IB
 3LX/w7JFFME6cC3kZ+mV3a6Cdxb4UIQdv1rWtLX8MjCiJ5+ax33VS0pe67n8sOft
 A6LeYwFr1ngk9NDg+OrFzExMTCGqk4aUYWiLd8ki3bw5ZMYzLwuenWLONQo3HOP5
 QuWQV+wF913mjB53omiZ8heJ7hN3ez071W4rXXPGXn5sAGipqJKWk6Nvx1wRZapD
 d+6XozBLGNEIcPvWJAWDfxnHmEjVpFyhavc9Id569DcQ0WVLm+CFPkNmp4mgOoOB
 k8f6R2CA2lheIKTRUk/Lt+Cu2+Za/07bM/WsxL6x/oCXZwL6NA5P+8VoNcBCDKrF
 PVUz7Jad6FVHkxySqwX4clHLW173pqyG47RJ7KxVv7g6g+YNW0WCM7crS+czRWIq
 KUT9sumw1dEFlYZ9IGZTuP/Pvur8f17powkS8VuYJ02N1yq3OhQZb52NX8stsmkW
 P6CsdZe9KRoGQUJp9nYVE5j09oz1gqqdbLdn4Byqg6G50w2U1mLNaWE1rtWLtcTx
 h7npUNOaX44JafnClFJvv1R9ovkuzgTaymEL4qo3QB6COHdvjlA=
 =ON7q
 -----END PGP SIGNATURE-----

Merge tag 'gpio-updates-for-v6.13-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux

Pull gpio updates from Bartosz Golaszewski:
 "Three new drivers, support for some new models in existing ones and
  lots of various tweaks and improvements across the board (switching to
  using recommended APIs, code shrink and simplification, etc.).

  Also a new feature in the character device uAPI where we now notify
  the user-space about changes triggered by in-kernel users as well, not
  only when they were done by other user-space agents.

  Summary:

  GPIOLIB core:
   - use the new mem_is_zero() instead of memchr_inv(s, 0, n)
   - don't store debounce period twice needlessly
   - clean-up debugfs handling
   - remove leftover comments referring to no longer used spinlocks
   - unduplicate some operations like SRCU locks and initializing GPIO
     descriptors
   - constify the sysfs class struct
   - use lock guards in GPIO sysfs code
   - update GPIO uAPI internal flags all at once atomically for
     consistency with other places
   - modify the behavior of the sysfs interface by no longer exporting
     lines that are named inside the driver code or board files with the
     sysfs links bearing the line names as this has for many years been
     largely unused due to the prevalence of DT, ACPI and firmware nodes
     over board files and made the API inconsistent
   - for GPIO interrupt providers: free irqs that are still requested by
     users when removing the chip

  GPIO uAPI:
   - notify user-space about changes to GPIO lines' state (requested,
     released, reconfigured) triggered from the kernel as well (until
     now we'd only do this for changes triggered from user-space)
   - to that end: modify the internal workings of the notification
     mechanism by switching to an atomic notifier which allows us to
     send events from atomic context
   - also to that end store the debounce period in the GPIO descriptor
     struct and not in the character device context struct
   - while at it, also cover the corner-case of users introducing
     changes over sysfs while others watch them via the character device
   - don't report GPIO lines requested as interrupts as "used" to
     user-space as it can still request them as GPIOs

  New drivers:
   - GPIO part of the MFD Congatec Board Controller
   - PolarFire GPIO controller
   - GPIOs on FTDI FT2232H

  Driver improvements:
   - use generic device property accessors instead of OF-specific ones
     across many GPIO drivers (mpc8xxx, vf610, eic-sprd, davinci,
     ts4900, xilinx, mvebu)
   - use devres helpers to simplify error paths and either shrink or
     entirely remove the driver's remove() callback (grgpio, amdpt,
     menz127, max730x, ftgpio010, 74x164, ljca)
   - use helper variables to store the address of pdev->dev and avoid
     some line-breaks
   - use device_for_each_child_node_scoped() to avoid having to put the
     fwnode on breaks or errors (gpio-sim, gpio-dwapb, gpiolib-acpi)
   - use a scoped bitmap to simplify the code and drop goto labels in
     gpio-aggregator
   - drop unneeded Kconfig dependencies on OF_GPIO (grgpio, mveby,
     xilinx)
   - add support for new models to gpio-aspeed, gpio-rockchip and
     gpio-dwapb
   - clean-up ACPI handling and some other bits in gpio-xgene-sb
   - replace deprecated PCI functions in pcie-idio-24 and pci-idio-16
   - allow to build davinci and mvebu drivers with COMPILE_TEST=y
   - remove dead code in gpio-mb86s7x
   - switch back to using platform_driver::remove() (after the
     conversion to remove_new()) across the GPIO drivers
   - remove remaining uses of GPIOF_ACTIVE_LOW across the tree and drop
     this deprecated symbol
   - convert the gpio-altera driver to no longer pull in the deprecated
     legacy-of-mm-gpiochip.h header
   - use of_property_present() instead of of_property_read_bool() in
     gpiolib-of and gpio-rockchip
   - allow to build the tegra186 driver on Tegra234 platforms in Kconfig

  Late fixes:
   - add a missing return value check after devm_kasprintf() to
     gpio-grgpio

  DT bindings:
   - document the ngpios property of gpio-mmio
   - add support for a new aspeed model
   - fix the example for st,nomadik-gpio

  Other:
   - kernel doc and comments tweaks
   - fix typos in TODO
   - reorder headers alphabetically in some drivers
   - fix incorrect format specifiers in gpio tools"

* tag 'gpio-updates-for-v6.13-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux: (98 commits)
  gpio: tegra186: Allow to enable driver on Tegra234
  gpio: grgpio: Add NULL check in grgpio_probe
  tools: gpio: Fix several incorrect format specifiers
  gpio: mpfs: add CoreGPIO support
  gpio: rockchip: support new version GPIO
  gpio: rockchip: change the GPIO version judgment logic
  gpio: rockchip: explan the format of the GPIO version ID
  gpiolib: cdev: use !mem_is_zero() instead of memchr_inv(s, 0, n)
  MAINTAINERS: add gpio driver to PolarFire entry
  gpio: Get rid of GPIOF_ACTIVE_LOW
  USB: gadget: pxa27x_udc: Avoid using GPIOF_ACTIVE_LOW
  pcmcia: soc_common: Avoid using GPIOF_ACTIVE_LOW
  leds: gpio: Avoid using GPIOF_ACTIVE_LOW
  Input: gpio_keys_polled - avoid using GPIOF_ACTIVE_LOW
  Input: gpio_keys - avoid using GPIOF_ACTIVE_LOW
  gpio: Use of_property_present() for non-boolean properties
  gpio: mpfs: add polarfire soc gpio support
  gpio: altera: Drop legacy-of-mm-gpiochip.h header
  gpio: pcie-idio-24: Replace deprecated PCI functions
  gpio: pci-idio-16: Replace deprecated PCI functions
  ...
2024-11-20 12:37:06 -08:00
Wolfram Sang
1b3073291d i2c-host updates for v6.13, part 1
Improvements and Refactoring:
 
  - All controllers using the 'remove_new' callback have been
    reverted to use the 'remove' callback.
 
  - Makefile improvements (switched from '*-objs' to '*-y')
 
  - Intel SCH controller underwent significant refactoring:
    - Improved usage of private data references.
    - Transitioned to memory-mapped I/O functions.
    - Adopted 'devm' functions for resource management.
    - Added kernel-doc compatible comments.
    - Used 'const' where applicable.
    - Numerous smaller refinements.
    This brings love and a modern look to the driver.
 
  - Additional cleanups in the DesignWare driver.
 
  - PIIX4 driver updates:
    - Exposed functions and definitions in the header file to
      enable usage by other drivers (e.g., AMD ASF).
 
  - Nuvoton NPCM I2C controller:
    - Enhanced read/write operations and bus error (BER) flag
      management to address corner cases that could lead to
      timeouts.
 
  - Qualcomm CCI driver received several cleanups.
 
  - iMX/MXC:
    - Improved message handling to reduce I2C protocol overhead.
    - Refactored DMA/non-DMA read/write and bus polling mechanisms
      to achieve this.
 
 New Features:
 
  - i2c-cadence:
    - Added support for atomic transfers.
    - Refactored to group generic code into separate functions.
 
  - Qualcomm CCI:
    - Added support for a 32MHz serial engine clock.
 
  - Added support for:
    - HJMC01 DesignWare ACPI HID.
    - ACPI documentation for PIIX4.
 
 Deprecated Features:
 
  - Dropped support for AMD756 S4882 and NFORCE2 S4985.
 
 New Hardware Support:
 
  - Added support for:
    - Intel Panther Lake.
    - AMD ASF.
    - S32G2/S32G3 SoCs.
    - Realtek RTL I2C Controller.
 
  - New drivers:
    - 'i2c-amd-asf-plat.c' for AMD ASF.
    - 'i2c-rtl9300.c' for Realtek RTL.
 
 Fixes:
 
  - AMD ASF driver:
    - Fixed an uninitialised 'len' variable.
 
 Devicetree Updates:
 
  - Documented Qualcomm SDM670.
  - Added 'PIC64GX' compatibility to Microchip Core I2C binding.
  - Added support for S32G.
 -----BEGIN PGP SIGNATURE-----
 
 iIwEABYIADQWIQScDfrjQa34uOld1VLaeAVmJtMtbgUCZznN0xYcYW5kaS5zaHl0
 aUBrZXJuZWwub3JnAAoJENp4BWYm0y1unOcA+wdXrf10ntY7jsGdd17dKQ951k7m
 mPG1xfDXF/qbDa2bAQCKYGVBwv/efAREtthq9zhfIcRxgefH7iKQIUm2YOcCCw==
 =xYzW
 -----END PGP SIGNATURE-----

Merge tag 'i2c-host-6.13-p1' of git://git.kernel.org/pub/scm/linux/kernel/git/andi.shyti/linux into i2c/for-mergewindow

i2c-host updates for v6.13, part 1

Major Improvements and Refactoring:

 - All controllers using the 'remove_new' callback have been
   reverted to use the 'remove' callback.

 - Intel SCH controller underwent significant refactoring,
   this brings love and a modern look to the driver.

 - PIIX4 driver refactored to enable usage by other drivers
   (e.g., AMD ASF).

 - iMX/MXC improved message handling to reduce protocol overhead:
     Refactored DMA/non-DMA read/write and bus polling mechanisms
     to achieve this.

 - ACPI documentation for PIIX4.

New Features:

 - i2c-cadence added support for atomic transfers.
 - Qualcomm CII added support for a 32MHz serial engine clock.

Deprecated Features:

 - Dropped outdated support for AMD756 S4882 and NFORCE2 S4985. If
   somebody misses this, Jean will rewrite support using the proper
   i2c mux framework.

New Hardware Support:

 - Added support for:
   - Intel Panther Lake (new ID)
   - AMD ASF (new driver)
   - S32G2/S32G3 SoCs (new ID)
   - Realtek RTL I2C Controller (new driver)
   - HJMC01 DesignWare ACPI HID (new ID)
   - PIC64GX to Microchip Core (new ID)
   - Qualcomm SDM670 to Qualcomm CCI (new ID)
2024-11-18 08:35:47 +01:00
Chris Packham
c366be7202 i2c: Add driver for the RTL9300 I2C controller
Add support for the I2C controller on the RTL9300 SoC. There are two I2C
controllers in the RTL9300 that are part of the Ethernet switch register
block. Each of these controllers owns a SCL pin (GPIO8 for the fiorst
I2C controller, GPIO17 for the second). There are 8 possible SDA pins
(GPIO9-16) that can be assigned to either I2C controller. This
relationship is represented in the device tree with a child node for
each SDA line in use.

This is based on the openwrt implementation[1] but has been
significantly modified

[1] - https://git.openwrt.org/?p=openwrt/openwrt.git;a=blob;f=target/linux/realtek/files-5.15/drivers/i2c/busses/i2c-rtl9300.c

Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
Reviewed-by: Andi Shyti <andi.shyti@kernel.org>
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
2024-11-17 11:58:57 +01:00
Vladimir Zapolskiy
b641af684f i2c: qcom-cci: Remove unused struct member cci_clk_rate
The removal of the supply clock rate check implies a need to remove
some unnecessary left-over data from the driver as well.

Signed-off-by: Vladimir Zapolskiy <vladimir.zapolskiy@linaro.org>
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
2024-11-17 11:58:56 +01:00
Andy Shevchenko
51616b0c4d i2c: busses: Use *-y instead of *-objs in Makefile
*-objs suffix is reserved rather for (user-space) host programs while
usually *-y suffix is used for kernel drivers (although *-objs works
for that purpose for now).

Let's correct the old usages of *-objs in Makefiles.

While at it, fix an obvious typo in help section of the Kconfig.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
2024-11-17 11:58:56 +01:00
Ciprian Marian Costea
311499ee56 i2c: imx: add support for S32G2/S32G3 SoCs
Some S32G2/S32G3 SoC I2C particularities exist
such as different <clock divider, register value> pairs.
Those are addressed by adding specific S32G2 and S32G3
compatible strings.

Co-developed-by: Ionut Vicovan <Ionut.Vicovan@nxp.com>
Signed-off-by: Ionut Vicovan <Ionut.Vicovan@nxp.com>
Signed-off-by: Ciprian Marian Costea <ciprianmarian.costea@oss.nxp.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
2024-11-17 11:58:56 +01:00
Jiapeng Chong
b88c79699d i2c: qcom-cci: Remove the unused variable cci_clk_rate
Variable cci_clk_rate is not effectively used, so delete it.

drivers/i2c/busses/i2c-qcom-cci.c:526:16: warning: variable ‘cci_clk_rate’ set but not used.

Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Closes: https://bugzilla.openanolis.cn/show_bug.cgi?id=11532
Fixes: 8284750a18 ("i2c: qcom-cci: Stop complaining about DT set clock rate")
Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Reviewed-by: Vladimir Zapolskiy <vladimir.zapolskiy@linaro.org>
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
2024-11-17 11:58:14 +01:00
Jean Delvare
b7ef4e0b1f i2c: Drop legacy muxing pseudo-drivers
The i2c-amd756-s4882 and i2c-nforce2-s4985 muxing pseudo-drivers were
written at a time when the i2c core did not support muxing. They are
essentially board-specific hacks. If we had to add support for these
boards today, we would implement it in a completely different way.

These Tyan server boards are 19 years old by now, so I very much doubt
any of these is still running today. So let's just drop this clumsy
code. If anyone really still needs this support and complains, I'll
rewrite it in a proper way on top of i2c-mux.

This also fixes the following warnings:
drivers/i2c/busses/i2c-amd756.c:286:20: warning: symbol 'amd756_smbus' was not declared. Should it be static?
drivers/i2c/busses/i2c-nforce2.c:123:20: warning: symbol 'nforce2_smbus' was not declared. Should it be static?

Signed-off-by: Jean Delvare <jdelvare@suse.de>
Cc: Andi Shyti <andi.shyti@kernel.org>
Cc: Nick Desaulniers <ndesaulniers@google.com>
Acked-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
2024-11-17 11:58:14 +01:00
Stefan Eichenberger
5f5c2d4579 i2c: imx: prevent rescheduling in non dma mode
We are experiencing a problem with the i.MX I2C controller when
communicating with SMBus devices. We are seeing devices time-out because
the time between sending/receiving two bytes is too long, and the SMBus
device returns to the idle state. This happens because the i.MX I2C
controller sends and receives byte by byte. When a byte is sent or
received, we get an interrupt and can send or receive the next byte.

The current implementation sends a byte and then waits for an event
generated by the interrupt subroutine. After the event is received, the
next byte is sent and we wait again. This waiting allows the scheduler
to reschedule other tasks, with the disadvantage that we may not send
the next byte for a long time because the send task is not immediately
scheduled. For example, if the rescheduling takes more than 25ms, this
can cause SMBus devices to timeout and communication to fail.

This patch changes the behavior so that we do not reschedule the
send/receive task, but instead send or receive the next byte in the
interrupt subroutine. This prevents rescheduling and drastically reduces
the time between sending/receiving bytes. The cost in the interrupt
subroutine is relatively small, we check what state we are in and then
send/receive the next byte. Before we had to call wake_up, which is even
less expensive. However, we also had to do some scheduling, which
increased the overall cost compared to the new solution. The wake_up
function to wake up the send/receive task is now only called when an
error occurs or when the transfer is complete.

Signed-off-by: Stefan Eichenberger <stefan.eichenberger@toradex.com>
Acked-by: Oleksij Rempel <o.rempel@pengutronix.de>
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
2024-11-17 11:58:14 +01:00
Stefan Eichenberger
b460b15b3c i2c: imx: separate atomic, dma and non-dma use case
Separate the atomic, dma and non-dma use case as a preparation step for
moving the non-dma use case to the isr to avoid rescheduling while a
transfer is in progress.

Signed-off-by: Stefan Eichenberger <stefan.eichenberger@toradex.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Acked-by: Oleksij Rempel <o.rempel@pengutronix.de>
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
2024-11-17 11:58:14 +01:00
Stefan Eichenberger
6692694aca i2c: imx: do not poll for bus busy in single master mode
According to the i.MX8M Mini reference manual chapter "16.1.4.2
Generation of Start" it is only necessary to poll for bus busy and
arbitration lost in multi master mode. This helps to avoid rescheduling
while the i2c bus is busy and avoids SMBus devices to timeout. For
backward compatibility, the single-master property needs to be
explicitly set to disable the bus busy polling.

Signed-off-by: Stefan Eichenberger <stefan.eichenberger@toradex.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Acked-by: Oleksij Rempel <o.rempel@pengutronix.de>
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
2024-11-17 11:58:14 +01:00
Hunter Yu
6816ce57c4 i2c: designware: Add a new ACPI HID for HJMC01 I2C controller
Define a new ACPI HID for HJMC01

Signed-off-by: Hunter Yu <hunter.yu@hj-micro.com>
Acked-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
2024-11-17 11:58:14 +01:00
Wolfram Sang
e586685c38 i2c: qcom-geni: Keep comment why interrupts start disabled
The to-be-fixed commit rightfully reduced a race window, but also
removed a comment which is still helpful after the fix. Bring the
comment back.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Reviewed-by: Bjorn Andersson <andersson@kernel.org>
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
2024-11-17 11:58:14 +01:00
Raag Jadav
1953ebef60 i2c: designware: constify abort_sources
We never modify abort_sources, mark it as const.

Signed-off-by: Raag Jadav <raag.jadav@intel.com>
Acked-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
2024-11-17 11:58:14 +01:00
Uwe Kleine-König
32a0a94aa0 i2c: Switch back to struct platform_driver::remove()
After commit 0edb555a65 ("platform: Make platform_driver::remove()
return void") .remove() is (again) the right callback to implement for
platform drivers.

Convert all platform drivers below drivers/i2c to use .remove(), with
the eventual goal to drop struct platform_driver::remove_new(). As
.remove() and .remove_new() have the same prototypes, conversion is done
by just changing the structure member name in the driver initializer.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
2024-11-17 11:58:14 +01:00
Manikanta Mylavarapu
506bb2ab00 i2c: qcom-geni: Support systems with 32MHz serial engine clock
In existing socs, I2C serial engine is sourced from XO (19.2MHz).
Where as in IPQ5424, I2C serial engine is sourced from GPLL0 (32MHz).

The existing map table is based on 19.2MHz. This patch incorporates
the clock map table to derive the SCL clock from the 32MHz source
clock frequency.

Signed-off-by: Manikanta Mylavarapu <quic_mmanikan@quicinc.com>
Reviewed-by: Bjorn Andersson <andersson@kernel.org>
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
2024-11-17 11:58:14 +01:00
Bryan O'Donoghue
8284750a18 i2c: qcom-cci: Stop complaining about DT set clock rate
It is common practice in the downstream and upstream CCI dt to set CCI
clock rates to 19.2 MHz. It appears to be fairly common for initial code to
set the CCI clock rate to 37.5 MHz.

Applying the widely used CCI clock rates from downstream ought not to cause
warning messages in the upstream kernel where our general policy is to
usually copy downstream hardware clock rates across the range of Qualcomm
drivers.

Drop the warning it is pervasive across CAMSS users but doesn't add any
information or warrant any changes to the DT to align the DT clock rate to
the bootloader clock rate.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Reviewed-by: Vladimir Zapolskiy <vladimir.zapolskiy@linaro.org>
Link: https://lore.kernel.org/linux-arm-msm/20240824115900.40702-1-bryan.odonoghue@linaro.org
Signed-off-by: Richard Acayan <mailingradian@gmail.com>
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
2024-11-17 11:58:14 +01:00
Tyrone Ting
b011810572 i2c: npcm: use a software flag to indicate a BER condition
If not clearing the BB (bus busy) condition in the BER (bus error)
interrupt, the driver causes a timeout and hence the i2c core
doesn't do the i2c transfer retry but returns the driver's return
value to the upper layer instead.

Clear the BB condition in the BER interrupt and a software flag is
used. The driver does an i2c recovery without causing the timeout
if the flag is set.

Signed-off-by: Tyrone Ting <kfting@nuvoton.com>
Reviewed-by: Tali Perry <tali.perry1@gmail.com>
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
2024-11-17 11:58:13 +01:00
Tyrone Ting
e365422cef i2c: npcm: correct the read/write operation procedure
Originally the driver uses the XMIT bit in SMBnST register to decide
the upcoming i2c transaction. If XMIT bit is 1, then it will be an i2c
write operation. If it's 0, then a read operation will be executed.

In slave mode the XMIT bit can simply be used directly to set the state.
XMIT bit can be used as an indication to the current state of the state
machine during slave operation. (meaning XMIT = 1 during writing and
XMIT = 0 during reading).

In master operation XMIT is valid only if there are no bus errors.
For example: in a multi master where the same module is switching from
master to slave at runtime, and there are collisions, the XMIT bit
cannot be trusted.

However the maser already "knows" what the bus state is, so this bit
is not needed and the driver can just track what it is currently doing.

Signed-off-by: Tyrone Ting <kfting@nuvoton.com>
Reviewed-by: Tali Perry <tali.perry1@gmail.com>
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
2024-11-17 11:58:13 +01:00
Qianqiang Liu
a5089cd23b i2c: amd-asf: Fix uninitialized variables issue in amd_asf_process_target
The len variable is not initialized, which may cause the for loop to
behave unexpectedly.

Fixes: 9b25419ad3 ("i2c: amd-asf: Add routine to handle the ASF slave process")
Signed-off-by: Qianqiang Liu <qianqiang.liu@163.com>
Reviewed-by: Dan Carpenter <dan.carpenter@linaro.org>
Acked-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
2024-11-17 11:57:29 +01:00
Igor Pylypiv
48730a9d04 i2c: dev: Fix memory leak when underlying adapter does not support I2C
Early return in i2cdev_ioctl_rdwr() failed to free the memory allocated
by the caller. Move freeing the memory to the function where it has been
allocated to prevent similar leaks in the future.

Fixes: 97ca843f6a ("i2c: dev: Check for I2C_FUNC_I2C before calling i2c_transfer")
Signed-off-by: Igor Pylypiv <ipylypiv@google.com>
[wsa: replaced '== NULL' with '!']
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
2024-11-14 11:22:57 +01:00
Andy Shevchenko
63ae99f7e6 i2c: designware: Fix spelling and other issues in the comments
Fix spelling and other issues, such as kernel-doc reported about,
in the comments. While at it, fix some indentation issues as well.

Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
2024-11-13 23:29:47 +01:00
Andy Shevchenko
7a48e71397 i2c: designware: Use sda_hold_time variable name everywhere
Currently the PCI glue driver uses sda_hold variable name, while
the rest of the driver use sda_hold_time. This makes things harder
to grep. Use sda_hold_time variable name everywhere.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
2024-11-13 23:29:47 +01:00
Andy Shevchenko
86bdd8e033 i2c: designware: Remove 'cond' from i2c_dw_scl_hcnt()
The 'cond' parameter is not being used (always default, hence drop it
and hence make it consistent with i2c_dw_scl_lcnt().

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
2024-11-13 23:29:47 +01:00
Andy Shevchenko
dd05a76e69 i2c: designware: Get rid of redundant 'else'
In the snippets like the following

	if (...)
		return / goto / break / continue ...;
	else
		...

the 'else' is redundant. Get rid of it.

Reviewed-by: Andi Shyti <andi.shyti@kernel.org>
Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Tested-by: Serge Semin <fancer.lancer@gmail.com>
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
2024-11-13 23:29:47 +01:00
Andy Shevchenko
d2f94dccab i2c: designware: Use temporary variable for struct device
Use temporary variable for struct device to make code neater.

Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
Reviewed-by: Andi Shyti <andi.shyti@kernel.org>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
2024-11-13 23:29:47 +01:00
Shyam Sundar S K
b1f8921dfb i2c: amd-asf: Clear remote IRR bit to get successive interrupt
To ensure successive interrupts upon packet reception, it is necessary to
clear the remote IRR bit by writing the interrupt number to the EOI
register. The base address for this operation is provided by the BIOS and
retrieved by the driver by traversing the ASF object's namespace.

Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Co-developed-by: Sanket Goswami <Sanket.Goswami@amd.com>
Signed-off-by: Sanket Goswami <Sanket.Goswami@amd.com>
Signed-off-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
2024-11-13 23:29:46 +01:00
Shyam Sundar S K
9b25419ad3 i2c: amd-asf: Add routine to handle the ASF slave process
Add support for handling ASF slave process events as described in the AMD
ASF databook. This involves implementing the correct programming sequence
to manage each ASF packet appropriately.

Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Co-developed-by: Sanket Goswami <Sanket.Goswami@amd.com>
Signed-off-by: Sanket Goswami <Sanket.Goswami@amd.com>
Signed-off-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
2024-11-13 23:29:46 +01:00
Shyam Sundar S K
78a78b3215 i2c: amd-asf: Add i2c_algorithm operations to support AMD ASF with SMBus
Implement the i2c_algorithm operations to enable support for AMD ASF
(Alert Standard Format) with SMBus. This enhancement includes:

- Adding functionality to identify and select the supported ASF functions.
- Implementing mechanisms for registering and deregistering I2C slave
  devices.
- Providing support for data transfer operations over ASF.

Additionally, include a 'select' Kconfig entry as the current patch
utilizes .reg_slave() and .unreg_slave() callbacks, which are controlled
by CONFIG_I2C_SLAVE.

Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Co-developed-by: Sanket Goswami <Sanket.Goswami@amd.com>
Signed-off-by: Sanket Goswami <Sanket.Goswami@amd.com>
Signed-off-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
2024-11-13 23:29:46 +01:00
Shyam Sundar S K
c509ebdb95 i2c: amd-asf: Add ACPI support for AMD ASF Controller
The AMD ASF controller is presented to the operating system as an ACPI
device. The AMD ASF driver can use ACPI to obtain information about the
ASF controller's attributes, such as the ASF address space and interrupt
number, and to handle ASF interrupts.

Currently, the piix4 driver assumes that a specific port address is
designated for AUX operations. However, with the introduction of ASF, the
same port address may also be used by the ASF controller. Therefore, a
check needs to be added to ensure that if ASF is advertised and enabled in
ACPI, the AUX port should not be configured.

Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Co-developed-by: Sanket Goswami <Sanket.Goswami@amd.com>
Signed-off-by: Sanket Goswami <Sanket.Goswami@amd.com>
Signed-off-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
2024-11-13 23:29:46 +01:00
Shyam Sundar S K
05d980046f i2c: piix4: Export i2c_piix4 driver functions as library
Export the following i2c_piix4 driver functions as a library so that the
AMD ASF driver can utilize these core functionalities from the i2c_piix4
driver:

- piix4_sb800_region_request(): Request access to a specific SMBus region
on the SB800 chipset.

- piix4_sb800_region_release(): Release the previously requested SMBus
region on the SB800 chipset.

- piix4_transaction(): Handle SMBus transactions between the SMBus
controller and connected devices.

- piix4_sb800_port_sel(): Select the appropriate SMBus port on the SB800
chipset.

By making these functions available as a library, enable the AMD ASF
driver to leverage the established mechanisms in the i2c_piix4 driver,
promoting code reuse and consistency across different drivers.

Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Co-developed-by: Sanket Goswami <Sanket.Goswami@amd.com>
Signed-off-by: Sanket Goswami <Sanket.Goswami@amd.com>
Signed-off-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
2024-11-13 23:29:46 +01:00
Shyam Sundar S K
650e2c396a i2c: piix4: Move i2c_piix4 macros and structures to common header
Add a separate header file to relocate the common code from the i2c_piix4
driver, allowing the AMD ASF driver to utilize the same code.

Update the MAINTAINERS file to include information about the new common
header file.

Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Co-developed-by: Sanket Goswami <Sanket.Goswami@amd.com>
Signed-off-by: Sanket Goswami <Sanket.Goswami@amd.com>
Signed-off-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
2024-11-13 23:29:46 +01:00
Shyam Sundar S K
9d9929e992 i2c: piix4: Change the parameter list of piix4_transaction function
Currently, `piix4_transaction()` accepts only one parameter, which is the
`i2c_adapter` information. This approach works well as long as SB800 SMBus
port accesses are confined to the piix4 driver. However, with the
implementation of a separate ASF driver and the varying address spaces
across drivers, it is necessary to change the function parameter list of
`piix4_transaction()` to include the port address. This modification
allows other drivers that use piix4 to pass the specific port details they
need to operate on.

Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Co-developed-by: Sanket Goswami <Sanket.Goswami@amd.com>
Signed-off-by: Sanket Goswami <Sanket.Goswami@amd.com>
Signed-off-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
2024-11-13 23:29:46 +01:00
Jarkko Nikula
bd492b5837 i2c: i801: Add support for Intel Panther Lake
Add SMBus PCI IDs on Intel Panther Lake-P and -U.

Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
2024-11-13 23:29:46 +01:00
Andy Shevchenko
71754212c0 i2c: isch: Convert to kernel-doc
Convert existing descriptions to kernel-doc format and unify
the rest of the comments to follow the modern style.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
2024-11-13 23:29:46 +01:00
Andy Shevchenko
e1d9e16c39 i2c: isch: Prefer to use octal permission
Octal permissions are preferred over the symbolics ones
for readbility. This ceases warning message pointed by checkpatch.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
2024-11-13 23:29:46 +01:00
Andy Shevchenko
f7c6153f61 i2c: isch: Don't use "proxy" headers
Update header inclusions to follow IWYU (Include What You Use)
principle.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
2024-11-13 23:29:46 +01:00
Andy Shevchenko
a8d9aabcaa i2c: isch: Unify the name of the variable to hold an error code
There are two different names used for the variable that holds
an error code. Unify to use one variant in all cases.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
2024-11-13 23:29:46 +01:00
Andy Shevchenko
9dca29ee9b i2c: isch: Use read_poll_timeout()
Simplify the code by using read_poll_timeout().

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
2024-11-13 23:29:45 +01:00
Andy Shevchenko
78ea39e6e9 i2c: isch: Utilize temporary variable to hold device pointer
Introduce a temporary variable to hold a device pointer.
It can be utilized in the ->probe() and save a bit of LoCs.
To make it consistent, rename currently used dev to pdev.

While at it, convert the only error message to dev_err_probe().

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
2024-11-13 23:29:45 +01:00
Andy Shevchenko
cc97ef79fc i2c: isch: switch i2c registration to devm functions
Switch from i2c_add_adapter() to resource managed devm_i2c_add_adapter()
for matching rest of driver initialization, and more concise code.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
2024-11-13 23:29:45 +01:00
Andy Shevchenko
d8e1ac747c i2c: isch: Use custom private data structure
Use custom private data structure instead of global variables.
With that, remove not anymore true comment.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
2024-11-13 23:29:45 +01:00
Andy Shevchenko
0da6d93720 i2c: isch: Switch to memory mapped IO accessors
Convert driver to use memory mapped IO accessors.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
2024-11-13 23:29:45 +01:00
Andy Shevchenko
4b91878d92 i2c: isch: Use string_choices API instead of ternary operator
Use modern string_choices API instead of manually determining the
output using ternary operator.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
2024-11-13 23:29:45 +01:00
Andy Shevchenko
3fe09719a0 i2c: isch: Pass pointer to struct i2c_adapter down
There are a lot of messaging calls that use global variable of
struct i2c_adapter. Instead, to make code better and flexible
for further improvements, pass the pointer to the actual adapter
used for transfers.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
2024-11-13 23:29:45 +01:00
Manikanta Guntupalli
7cfe1a45de i2c: cadence: Add atomic transfer support for controller version 1.4
Rework the read and write code paths in the driver to support operation
in atomic contexts in master mode. This change does not apply to slave
mode because there is no way to handle interruptions in that context.

Adjust the message timeout to include some extra time. For non-atomic
contexts, 500 ms is added to the timeout. For atomic contexts,
2000 ms is added because transfers happen in polled mode, requiring
more time to account for the polling overhead.

Similar changes have been implemented in other drivers, including:
commit 3a5ee18d2a ("i2c: imx: implement master_xfer_atomic callback")
commit 445094c8a9 ("i2c: exynos5: add support for atomic transfers")
commit ede2299f71 ("i2c: tegra: Support atomic transfers")
commit fe402bd090 ("i2c: meson: implement the master_xfer_atomic
callback")

Signed-off-by: Manikanta Guntupalli <manikanta.guntupalli@amd.com>
Reviewed-by: Andi Shyti <andi.shyti@kernel.org>
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
2024-11-13 23:29:45 +01:00
Manikanta Guntupalli
ed866f4161 i2c: cadence: Split cdns_i2c_master_xfer for Atomic Mode
The cdns_i2c_master_xfer function has been refactored to separate
the common code. This change facilitates better support for atomic
mode operations by isolating the shared logic.

Signed-off-by: Manikanta Guntupalli <manikanta.guntupalli@amd.com>
Reviewed-by: Andi Shyti <andi.shyti@kernel.org>
Acked-by: Michal Simek <michal.simek@amd.com>
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
2024-11-13 23:29:45 +01:00