Skip to content

Commit

Permalink
Merge branch 'i2c/for-mergewindow' of git://git.kernel.org/pub/scm/li…
Browse files Browse the repository at this point in the history
…nux/kernel/git/wsa/linux

Pull i2c updates from Wolfram Sang:

 - tracepoints when Linux acts as an I2C client

 - added support for AMD PSP

 - whole subsystem now uses generic_handle_irq_safe()

 - piix4 driver gained MMIO access enabling so far missed controllers
   with AMD chipsets

 - a bulk of device driver updates, refactorization, and fixes.

* 'i2c/for-mergewindow' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux: (61 commits)
  i2c: mux: demux-pinctrl: do not deactivate a master that is not active
  i2c: meson: Fix wrong speed use from probe
  i2c: add tracepoints for I2C slave events
  i2c: designware: Remove code duplication
  i2c: cros-ec-tunnel: Fix syntax errors in comments
  MAINTAINERS: adjust XLP9XX I2C DRIVER after removing the devicetree binding
  i2c: designware: Mark dw_i2c_plat_{suspend,resume}() as __maybe_unused
  i2c: mediatek: Add i2c compatible for Mediatek MT8168
  dt-bindings: i2c: update bindings for MT8168 SoC
  i2c: mt65xx: Simplify with clk-bulk
  i2c: i801: Drop two outdated comments
  i2c: xiic: Make bus names unique
  i2c: i801: Add support for the Process Call command
  i2c: i801: Drop useless masking in i801_access
  i2c: tegra: Add SMBus block read function
  i2c: designware: Use the i2c_mark_adapter_suspended/resumed() helpers
  i2c: designware: Lock the adapter while setting the suspended flag
  i2c: mediatek: remove redundant null check
  i2c: mediatek: modify bus speed calculation formula
  i2c: designware: Fix improper usage of readl
  ...
  • Loading branch information
Linus Torvalds committed Mar 26, 2022
2 parents a060c94 + 1a22aab commit 5627ecb
Show file tree
Hide file tree
Showing 50 changed files with 1,545 additions and 363 deletions.
2 changes: 2 additions & 0 deletions Documentation/devicetree/bindings/i2c/i2c-mt65xx.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@ Required properties:
"mediatek,mt7622-i2c": for MediaTek MT7622
"mediatek,mt7623-i2c", "mediatek,mt6577-i2c": for MediaTek MT7623
"mediatek,mt7629-i2c", "mediatek,mt2712-i2c": for MediaTek MT7629
"mediatek,mt8168-i2c": for MediaTek MT8168
"mediatek,mt8173-i2c": for MediaTek MT8173
"mediatek,mt8183-i2c": for MediaTek MT8183
"mediatek,mt8186-i2c": for MediaTek MT8186
"mediatek,mt8192-i2c": for MediaTek MT8192
"mediatek,mt8195-i2c", "mediatek,mt8192-i2c": for MediaTek MT8195
"mediatek,mt8516-i2c", "mediatek,mt2712-i2c": for MediaTek MT8516
Expand Down
4 changes: 3 additions & 1 deletion Documentation/devicetree/bindings/i2c/i2c-qcom-cci.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ PROPERTIES:
"qcom,msm8996-cci"
"qcom,sdm845-cci"
"qcom,sm8250-cci"
"qcom,sm8450-cci"

- reg
Usage: required
Expand Down Expand Up @@ -43,7 +44,8 @@ PROPERTIES:
SUBNODES:

The CCI provides I2C masters for one (msm8916) or two i2c busses (msm8996,
sdm845 and sm8250), described as subdevices named "i2c-bus@0" and "i2c-bus@1".
sdm845, sm8250 and sm8450), described as subdevices named "i2c-bus@0" and
"i2c-bus@1".

PROPERTIES:

Expand Down
56 changes: 56 additions & 0 deletions Documentation/devicetree/bindings/i2c/microchip,corei2c.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/i2c/microchip,corei2c.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: Microchip MPFS I2C Controller Device Tree Bindings

maintainers:
- Daire McNamara <daire.mcnamara@microchip.com>

allOf:
- $ref: /schemas/i2c/i2c-controller.yaml#

properties:
compatible:
oneOf:
- items:
- const: microchip,mpfs-i2c # Microchip PolarFire SoC compatible SoCs
- const: microchip,corei2c-rtl-v7 # Microchip Fabric based i2c IP core
- const: microchip,corei2c-rtl-v7 # Microchip Fabric based i2c IP core

reg:
maxItems: 1

interrupts:
maxItems: 1

clocks:
maxItems: 1

clock-frequency:
description: |
Desired I2C bus clock frequency in Hz. As only Standard and Fast
modes are supported, possible values are 100000 and 400000.
enum: [100000, 400000]

required:
- compatible
- reg
- interrupts
- clocks

unevaluatedProperties: false

examples:
- |
i2c@2010a000 {
compatible = "microchip,mpfs-i2c", "microchip,corei2c-rtl-v7";
reg = <0x2010a000 0x1000>;
clocks = <&clkcfg 15>;
interrupt-parent = <&plic>;
interrupts = <58>;
clock-frequency = <100000>;
};
...
6 changes: 6 additions & 0 deletions Documentation/devicetree/bindings/i2c/renesas,rcar-i2c.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ properties:
- renesas,i2c-r8a779a0 # R-Car V3U
- const: renesas,rcar-gen3-i2c # R-Car Gen3 and RZ/G2

- items:
- enum:
- renesas,i2c-r8a779f0 # R-Car S4-8
- const: renesas,rcar-gen4-i2c # R-Car Gen4

reg:
maxItems: 1

Expand Down Expand Up @@ -132,6 +137,7 @@ allOf:
enum:
- renesas,rcar-gen2-i2c
- renesas,rcar-gen3-i2c
- renesas,rcar-gen4-i2c
then:
required:
- resets
Expand Down
39 changes: 39 additions & 0 deletions Documentation/firmware-guide/acpi/enumeration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,45 @@ In robust cases the client unfortunately needs to call
acpi_dma_request_slave_chan_by_index() directly and therefore choose the
specific FixedDMA resource by its index.

Named Interrupts
================

Drivers enumerated via ACPI can have names to interrupts in the ACPI table
which can be used to get the IRQ number in the driver.

The interrupt name can be listed in _DSD as 'interrupt-names'. The names
should be listed as an array of strings which will map to the Interrupt()
resource in the ACPI table corresponding to its index.

The table below shows an example of its usage::

Device (DEV0) {
...
Name (_CRS, ResourceTemplate() {
...
Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) {
0x20,
0x24
}
})

Name (_DSD, Package () {
ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
Package () {
Package () {"interrupt-names",
Package (2) {"default", "alert"}},
}
...
})
}

The interrupt name 'default' will correspond to 0x20 in Interrupt()
resource and 'alert' to 0x24. Note that only the Interrupt() resource
is mapped and not GpioInt() or similar.

The driver can call the function - fwnode_irq_get_byname() with the fwnode
and interrupt name as arguments to get the corresponding IRQ number.

SPI serial bus support
======================

Expand Down
1 change: 1 addition & 0 deletions Documentation/i2c/busses/i2c-i801.rst
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ Supported adapters:
* Intel Jasper Lake (SOC)
* Intel Emmitsburg (PCH)
* Intel Alder Lake (PCH)
* Intel Raptor Lake (PCH)

Datasheets: Publicly available at the Intel website

Expand Down
2 changes: 1 addition & 1 deletion MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -18877,6 +18877,7 @@ SYNOPSYS DESIGNWARE I2C DRIVER
M: Jarkko Nikula <jarkko.nikula@linux.intel.com>
R: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
R: Mika Westerberg <mika.westerberg@linux.intel.com>
R: Jan Dabros <jsd@semihalf.com>
L: linux-i2c@vger.kernel.org
S: Maintained
F: drivers/i2c/busses/i2c-designware-*
Expand Down Expand Up @@ -21520,7 +21521,6 @@ M: George Cherian <gcherian@marvell.com>
L: linux-i2c@vger.kernel.org
S: Supported
W: http://www.marvell.com
F: Documentation/devicetree/bindings/i2c/i2c-xlp9xx.txt
F: drivers/i2c/busses/i2c-xlp9xx.c

XRA1403 GPIO EXPANDER
Expand Down
7 changes: 4 additions & 3 deletions drivers/acpi/acpi_apd.c
Original file line number Diff line number Diff line change
Expand Up @@ -232,12 +232,13 @@ static const struct acpi_device_id acpi_apd_device_ids[] = {
/* Generic apd devices */
#ifdef CONFIG_X86_AMD_PLATFORM_DEVICE
{ "AMD0010", APD_ADDR(cz_i2c_desc) },
{ "AMDI0010", APD_ADDR(wt_i2c_desc) },
{ "AMD0020", APD_ADDR(cz_uart_desc) },
{ "AMDI0020", APD_ADDR(cz_uart_desc) },
{ "AMDI0022", APD_ADDR(cz_uart_desc) },
{ "AMD0030", },
{ "AMD0040", APD_ADDR(fch_misc_desc)},
{ "AMDI0010", APD_ADDR(wt_i2c_desc) },
{ "AMDI0019", APD_ADDR(wt_i2c_desc) },
{ "AMDI0020", APD_ADDR(cz_uart_desc) },
{ "AMDI0022", APD_ADDR(cz_uart_desc) },
{ "HYGO0010", APD_ADDR(wt_i2c_desc) },
#endif
#ifdef CONFIG_ARM64
Expand Down
29 changes: 29 additions & 0 deletions drivers/base/property.c
Original file line number Diff line number Diff line change
Expand Up @@ -935,6 +935,35 @@ void __iomem *fwnode_iomap(struct fwnode_handle *fwnode, int index)
}
EXPORT_SYMBOL(fwnode_iomap);

/**
* fwnode_irq_get_byname - Get IRQ from a fwnode using its name
* @fwnode: Pointer to the firmware node
* @name: IRQ name
*
* Description:
* Find a match to the string @name in the 'interrupt-names' string array
* in _DSD for ACPI, or of_node for Device Tree. Then get the Linux IRQ
* number of the IRQ resource corresponding to the index of the matched
* string.
*
* Return:
* Linux IRQ number on success, or negative errno otherwise.
*/
int fwnode_irq_get_byname(const struct fwnode_handle *fwnode, const char *name)
{
int index;

if (!name)
return -EINVAL;

index = fwnode_property_match_string(fwnode, "interrupt-names", name);
if (index < 0)
return index;

return fwnode_irq_get(fwnode, index);
}
EXPORT_SYMBOL(fwnode_irq_get_byname);

/**
* fwnode_graph_get_next_endpoint - Get next endpoint firmware node
* @fwnode: Pointer to the parent firmware node
Expand Down
25 changes: 23 additions & 2 deletions drivers/i2c/busses/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@ menu "I2C Hardware Bus support"
comment "PC SMBus host controller drivers"
depends on PCI

config I2C_CCGX_UCSI
tristate
help
A common module to provide an API to instantiate UCSI device
for Cypress CCGx Type-C controller. Individual bus drivers
need to select this one on demand.

config I2C_ALI1535
tristate "ALI 1535"
depends on PCI
Expand Down Expand Up @@ -148,6 +155,7 @@ config I2C_I801
Jasper Lake (SOC)
Emmitsburg (PCH)
Alder Lake (PCH)
Raptor Lake (PCH)

This driver can also be built as a module. If so, the module
will be called i2c-i801.
Expand Down Expand Up @@ -245,6 +253,7 @@ config I2C_NFORCE2_S4985
config I2C_NVIDIA_GPU
tristate "NVIDIA GPU I2C controller"
depends on PCI
select I2C_CCGX_UCSI
help
If you say yes to this option, support will be included for the
NVIDIA GPU I2C controller which is used to communicate with the GPU's
Expand Down Expand Up @@ -477,8 +486,8 @@ config I2C_BCM_KONA

config I2C_BRCMSTB
tristate "BRCM Settop/DSL I2C controller"
depends on ARCH_BCM2835 || ARCH_BRCMSTB || BMIPS_GENERIC || \
ARCH_BCM_63XX || COMPILE_TEST
depends on ARCH_BCM2835 || ARCH_BCM4908 || ARCH_BCM_63XX || \
ARCH_BRCMSTB || BMIPS_GENERIC || COMPILE_TEST
default y
help
If you say yes to this option, support will be included for the
Expand Down Expand Up @@ -553,6 +562,17 @@ config I2C_DESIGNWARE_PLATFORM
This driver can also be built as a module. If so, the module
will be called i2c-designware-platform.

config I2C_DESIGNWARE_AMDPSP
bool "AMD PSP I2C semaphore support"
depends on X86_MSR
depends on ACPI
depends on I2C_DESIGNWARE_PLATFORM
help
This driver enables managed host access to the selected I2C bus shared
between AMD CPU and AMD PSP.

You should say Y if running on an AMD system equipped with the PSP.

config I2C_DESIGNWARE_BAYTRAIL
bool "Intel Baytrail I2C semaphore support"
depends on ACPI
Expand All @@ -570,6 +590,7 @@ config I2C_DESIGNWARE_PCI
tristate "Synopsys DesignWare PCI"
depends on PCI
select I2C_DESIGNWARE_CORE
select I2C_CCGX_UCSI
help
If you say yes to this option, support will be included for the
Synopsys DesignWare I2C adapter. Only master mode is supported.
Expand Down
4 changes: 4 additions & 0 deletions drivers/i2c/busses/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
# ACPI drivers
obj-$(CONFIG_I2C_SCMI) += i2c-scmi.o

# Auxiliary I2C/SMBus modules
obj-$(CONFIG_I2C_CCGX_UCSI) += i2c-ccgx-ucsi.o

# PC SMBus host controller drivers
obj-$(CONFIG_I2C_ALI1535) += i2c-ali1535.o
obj-$(CONFIG_I2C_ALI1563) += i2c-ali1563.o
Expand Down Expand Up @@ -54,6 +57,7 @@ i2c-designware-core-y += i2c-designware-master.o
i2c-designware-core-$(CONFIG_I2C_DESIGNWARE_SLAVE) += i2c-designware-slave.o
obj-$(CONFIG_I2C_DESIGNWARE_PLATFORM) += i2c-designware-platform.o
i2c-designware-platform-y := i2c-designware-platdrv.o
i2c-designware-platform-$(CONFIG_I2C_DESIGNWARE_AMDPSP) += i2c-designware-amdpsp.o
i2c-designware-platform-$(CONFIG_I2C_DESIGNWARE_BAYTRAIL) += i2c-designware-baytrail.o
obj-$(CONFIG_I2C_DESIGNWARE_PCI) += i2c-designware-pci.o
i2c-designware-pci-y := i2c-designware-pcidrv.o
Expand Down
7 changes: 2 additions & 5 deletions drivers/i2c/busses/i2c-amd-mp2-pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -308,11 +308,8 @@ static int amd_mp2_pci_init(struct amd_mp2_dev *privdata,
pci_set_master(pci_dev);

rc = dma_set_mask(&pci_dev->dev, DMA_BIT_MASK(64));
if (rc) {
rc = dma_set_mask(&pci_dev->dev, DMA_BIT_MASK(32));
if (rc)
goto err_dma_mask;
}
if (rc)
goto err_dma_mask;

/* Set up intx irq */
writel(0, privdata->mmio + AMD_P2C_MSG_INTEN);
Expand Down
21 changes: 16 additions & 5 deletions drivers/i2c/busses/i2c-bcm2835.c
Original file line number Diff line number Diff line change
Expand Up @@ -454,18 +454,20 @@ static int bcm2835_i2c_probe(struct platform_device *pdev)
ret = clk_prepare_enable(i2c_dev->bus_clk);
if (ret) {
dev_err(&pdev->dev, "Couldn't prepare clock");
return ret;
goto err_put_exclusive_rate;
}

i2c_dev->irq = platform_get_irq(pdev, 0);
if (i2c_dev->irq < 0)
return i2c_dev->irq;
if (i2c_dev->irq < 0) {
ret = i2c_dev->irq;
goto err_disable_unprepare_clk;
}

ret = request_irq(i2c_dev->irq, bcm2835_i2c_isr, IRQF_SHARED,
dev_name(&pdev->dev), i2c_dev);
if (ret) {
dev_err(&pdev->dev, "Could not request IRQ\n");
return -ENODEV;
goto err_disable_unprepare_clk;
}

adap = &i2c_dev->adapter;
Expand All @@ -489,7 +491,16 @@ static int bcm2835_i2c_probe(struct platform_device *pdev)

ret = i2c_add_adapter(adap);
if (ret)
free_irq(i2c_dev->irq, i2c_dev);
goto err_free_irq;

return 0;

err_free_irq:
free_irq(i2c_dev->irq, i2c_dev);
err_disable_unprepare_clk:
clk_disable_unprepare(i2c_dev->bus_clk);
err_put_exclusive_rate:
clk_rate_exclusive_put(i2c_dev->bus_clk);

return ret;
}
Expand Down
Loading

0 comments on commit 5627ecb

Please sign in to comment.