Currently, the RIIC driver may run the I2C bus faster than requested,
which may cause subtle failures. E.g. Biju reported a measured bus
speed of 450 kHz instead of the expected maximum of 400 kHz on RZ/G2L.
The initial calculation of the bus period uses DIV_ROUND_UP(), to make
sure the actual bus speed never becomes faster than the requested bus
speed. However, the subsequent division-by-two steps do not use
round-up, which may lead to a too-small period, hence a too-fast and
possible out-of-spec bus speed. E.g. on RZ/Five, requesting a bus speed
of 100 resp. 400 kHz will yield too-fast target bus speeds of 100806
resp. 403226 Hz instead of 97656 resp. 390625 Hz.
Fix this by using DIV_ROUND_UP() in the subsequent divisions, too.
Tested on RZ/A1H, RZ/A2M, and RZ/Five.
Fixes: d982d66514 ("i2c: riic: remove clock and frequency restrictions")
Reported-by: Biju Das <biju.das.jz@bp.renesas.com>
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Cc: <stable@vger.kernel.org> # v4.15+
Link: https://lore.kernel.org/r/c59aea77998dfea1b4456c4b33b55ab216fcbf5e.1732284746.git.geert+renesas@glider.be
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
The OF match table is not NULL-terminated.
Fix this by adding a sentinel to nmk_i2c_eyeq_match_table[].
Fixes: a0d15cc47f ("i2c: nomadik: switch from of_device_is_compatible() to of_match_device()")
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Théo Lebrun <theo.lebrun@bootlin.com>
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
Since commit f63b94be69 ("i2c: pnx: Fix potential deadlock warning
from del_timer_sync() call in isr") jiffies are stored in
i2c_pnx_algo_data.timeout, but wait_timeout and wait_reset are still
using it as milliseconds. Convert jiffies back to milliseconds to wait
for the expected amount of time.
Fixes: f63b94be69 ("i2c: pnx: Fix potential deadlock warning from del_timer_sync() call in isr")
Signed-off-by: Vladimir Riabchun <ferr.lambarginio@gmail.com>
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
Commit cdd30ebb1b ("module: Convert symbol namespace to string
literal") only converted MODULE_IMPORT_NS() and EXPORT_SYMBOL_NS(),
leaving DEFAULT_SYMBOL_NAMESPACE as a macro expansion.
This commit converts DEFAULT_SYMBOL_NAMESPACE in the same way to avoid
annoyance for the default namespace as well.
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Reviewed-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
The continual trickle of small conversion patches is grating on me, and
is really not helping. Just get rid of the 'remove_new' member
function, which is just an alias for the plain 'remove', and had a
comment to that effect:
/*
* .remove_new() is a relic from a prototype conversion of .remove().
* New drivers are supposed to implement .remove(). Once all drivers are
* converted to not use .remove_new any more, it will be dropped.
*/
This was just a tree-wide 'sed' script that replaced '.remove_new' with
'.remove', with some care taken to turn a subsequent tab into two tabs
to make things line up.
I did do some minimal manual whitespace adjustment for places that used
spaces to line things up.
Then I just removed the old (sic) .remove_new member function, and this
is the end result. No more unnecessary conversion noise.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This patch fixes a coding style issue in the alignment of parameters
in the function i2c_smbus_write_bytes(). It replaces spaces with tabs for
alignment, as per the coding style guidelines.
Signed-off-by: Liam Zuiderhoek <zuiderhoekl@gmail.com>
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Add GPIO support to the simple helpers for the I2C OF component prober.
Components that the prober intends to probe likely require their
regulator supplies be enabled, and GPIOs be toggled to enable them or
bring them out of reset before they will respond to probe attempts.
Regulator supplies were handled in the previous patch.
The assumption is that the same class of components to be probed are
always connected in the same fashion with the same regulator supply
and GPIO. The names may vary due to binding differences, but the
physical layout does not change.
This supports at most one GPIO pin. The user must specify the GPIO name,
the polarity, and the amount of time to wait after the GPIO is toggled.
Devices with more than one GPIO pin likely require specific power
sequencing beyond what generic code can easily support.
Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Tested-by: Andrey Skvortsov <andrej.skvortzov@gmail.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Add helpers to do regulator management for the I2C OF component prober.
Components that the prober intends to probe likely require their
regulator supplies be enabled, and GPIOs be toggled to enable them or
bring them out of reset before they will respond to probe attempts.
GPIOs will be handled in the next patch.
The assumption is that the same class of components to be probed are
always connected in the same fashion with the same regulator supply
and GPIO. The names may vary due to binding differences, but the
physical layout does not change.
This set of helpers supports at most one regulator supply. The user
must specify the node from which the supply is retrieved. The supply
name and the amount of time to wait after the supply is enabled are
also given by the user.
Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Some devices are designed and manufactured with some components having
multiple drop-in replacement options. These components are often
connected to the mainboard via ribbon cables, having the same signals
and pin assignments across all options. These may include the display
panel and touchscreen on laptops and tablets, and the trackpad on
laptops. Sometimes which component option is used in a particular device
can be detected by some firmware provided identifier, other times that
information is not available, and the kernel has to try to probe each
device.
This change attempts to make the "probe each device" case cleaner. The
current approach is to have all options added and enabled in the device
tree. The kernel would then bind each device and run each driver's probe
function. This works, but has been broken before due to the introduction
of asynchronous probing, causing multiple instances requesting "shared"
resources, such as pinmuxes, GPIO pins, interrupt lines, at the same
time, with only one instance succeeding. Work arounds for these include
moving the pinmux to the parent I2C controller, using GPIO hogs or
pinmux settings to keep the GPIO pins in some fixed configuration, and
requesting the interrupt line very late. Such configurations can be seen
on the MT8183 Krane Chromebook tablets, and the Qualcomm sc8280xp-based
Lenovo Thinkpad 13S.
Instead of this delicate dance between drivers and device tree quirks,
this change introduces a simple I2C component probe function. For a
given class of devices on the same I2C bus, it will go through all of
them, doing a simple I2C read transfer and see which one of them responds.
It will then enable the device that responds.
This requires some minor modifications in the existing device tree. The
status for all the device nodes for the component options must be set
to "fail-needs-probe". This makes it clear that some mechanism is
needed to enable one of them, and also prevents the prober and device
drivers running at the same time.
Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
In commit 35eba185fd ("i2c: designware: Calculate SCL timing parameter
for High Speed Mode") the SCL high period count and low period count for
high speed mode are calculated based on fixed tHIGH = 160 and tLOW = 120.
However, the set of two fixed values is only applicable to the combination
of hardware parameters IC_CAP_LOADING is 400 and IC_CLK_FREQ_OPTIMIZATION
is true. Outside of this combination, the SCL frequency may not reach
3.4 MHz because the fixed tHIGH and tLOW are not small enough.
If IC_CAP_LOADING is 400, it means the bus capacitance is 400pF;
Otherwise, 100 pF. If IC_CLK_FREQ_OPTIMIZATION is true, it means that the
hardware reduces its internal clock frequency by reducing the internal
latency required to generate the high period and low period of the SCL line.
Section 3.15.4.5 in DesignWare DW_apb_i2b Databook v2.03 says that when
IC_CLK_FREQ_OPTIMIZATION = 0,
MIN_SCL_HIGHtime = 60 ns for 3.4 Mbps, bus loading = 100pF
= 120 ns for 3.4 Mbps, bus loading = 400pF
MIN_SCL_LOWtime = 160 ns for 3.4 Mbps, bus loading = 100pF
= 320 ns for 3.4 Mbps, bus loading = 400pF
and section 3.15.4.6 says that when IC_CLK_FREQ_OPTIMIZATION = 1,
MIN_SCL_HIGHtime = 60 ns for 3.4 Mbps, bus loading = 100pF
= 160 ns for 3.4 Mbps, bus loading = 400pF
MIN_SCL_LOWtime = 120 ns for 3.4 Mbps, bus loading = 100pF
= 320 ns for 3.4 Mbps, bus loading = 400pF
In order to calculate more accurate SCL high period count and low period
count for high speed mode, two hardware parameters IC_CAP_LOADING and
IC_CLK_FREQ_OPTIMIZATION must be considered together. Since there're no
registers controlliing these these two hardware parameters, users can
declare them in the device tree so that the driver can obtain them.
Signed-off-by: Michael Wu <michael.wu@kneron.us>
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>
- BRCR value must go into the BRCR1 field when in high-speed mode.
It goes into BRCR2 otherwise.
- Remove fallback to standard mode if priv->sm > I2C_FREQ_MODE_FAST.
- Set SM properly in probe; previously it only checked STANDARD versus
FAST. Now we set STANDARD, FAST, FAST_PLUS or HIGH_SPEED.
- Remove all comment sections saying we only support low-speeds.
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Théo Lebrun <theo.lebrun@bootlin.com>
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Current BRCR computation is:
brcr = floor(i2cclk / (clkfreq * div))
With brcr: "baud rate counter", an internal clock divider,
and i2cclk: input clock rate (24MHz, 38.4MHz or 48MHz),
and clkfreq: desired bus rate,
and div: speed-mode dependent divider (2 for standard, 3 otherwise).
Assume i2cclk=48MHz, clkfreq=3.4MHz, div=3,
then brcr = floor(48MHz / (3.4MHz * 3)) = 4
and resulting bus rate = 48MHz / (4 * 3) = 4MHz
Assume i2cclk=38.4MHz, clkfreq=1.0MHz, div=3,
then brcr = floor(38.4MHz / (1.0MHz * 3)) = 12
and resulting bus rate = 38.4MHz / (12 * 3) = 1066kHz
The current computation means we always pick the smallest divider that
gives a bus rate above target. We should instead pick the largest
divider that gives a bus rate below target, using:
brcr = floor(i2cclk / (clkfreq * div)) + 1
If we redo the above examples:
Assume i2cclk=48MHz, clkfreq=3.4MHz, div=3,
then brcr = floor(48MHz / (3.4MHz * 3)) + 1 = 5
and resulting bus rate = 48MHz / (5 * 3) = 3.2MHz
Assume i2cclk=38.4MHz, clkfreq=1.0MHz, div=3,
then brcr = floor(38.4MHz / (1.0MHz * 3)) + 1 = 13
and resulting bus rate = 38.4MHz / (13 * 3) = 985kHz
In kernel C code, floor(x) is DIV_ROUND_DOWN() and,
floor(x)+1 is DIV_ROUND_UP().
This is much less of an issue with slower bus rates (ie those currently
supported), because the gap from one divider to the next is much
smaller. It however keeps us from always using bus rates superior to
the target.
This fix is required for later on supporting faster bus rates:
I2C_FREQ_MODE_FAST_PLUS (1MHz) and I2C_FREQ_MODE_HIGH_SPEED (3.4MHz).
Signed-off-by: Théo Lebrun <theo.lebrun@bootlin.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Add EyeQ6H support to the nmk-i2c AMBA driver. It shares the same quirk
as EyeQ5: the memory bus only supports 32-bit accesses. Avoid writeb()
and readb() by reusing the same `priv->has_32b_bus` flag.
It does NOT need to write speed-mode specific value into a register;
therefore it does not depend on the mobileye,olb DT property.
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Théo Lebrun <theo.lebrun@bootlin.com>
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Compatible-specific behavior is implemented using a if-condition on the
return value from of_device_is_compatible(), from probe. It does not
scale well when compatible number increases. Switch to using a match
table and a call to of_match_device().
We DO NOT attach a .of_match_table field to our amba driver, as we do
not use the table to match our driver to devices.
Sort probe variable declarations in reverse christmas tree to try and
introduce some logic into the ordering.
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Théo Lebrun <theo.lebrun@bootlin.com>
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
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>
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>
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
...
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
...
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)
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>
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>
*-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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>