aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/devicetree/bindings/i2c/i2c-omap.txt8
-rw-r--r--Documentation/i2c/busses/i2c-nvidia-gpu18
-rw-r--r--MAINTAINERS15
-rw-r--r--drivers/i2c/busses/Kconfig11
-rw-r--r--drivers/i2c/busses/Makefile1
-rw-r--r--drivers/i2c/busses/i2c-nvidia-gpu.c368
-rw-r--r--drivers/i2c/busses/i2c-qcom-geni.c15
-rw-r--r--drivers/usb/typec/ucsi/Kconfig10
-rw-r--r--drivers/usb/typec/ucsi/Makefile2
-rw-r--r--drivers/usb/typec/ucsi/ucsi_ccg.c307
10 files changed, 745 insertions, 10 deletions
diff --git a/Documentation/devicetree/bindings/i2c/i2c-omap.txt b/Documentation/devicetree/bindings/i2c/i2c-omap.txt
index 7e49839d4124..4b90ba9f31b7 100644
--- a/Documentation/devicetree/bindings/i2c/i2c-omap.txt
+++ b/Documentation/devicetree/bindings/i2c/i2c-omap.txt
@@ -1,8 +1,12 @@
1I2C for OMAP platforms 1I2C for OMAP platforms
2 2
3Required properties : 3Required properties :
4- compatible : Must be "ti,omap2420-i2c", "ti,omap2430-i2c", "ti,omap3-i2c" 4- compatible : Must be
5 or "ti,omap4-i2c" 5 "ti,omap2420-i2c" for OMAP2420 SoCs
6 "ti,omap2430-i2c" for OMAP2430 SoCs
7 "ti,omap3-i2c" for OMAP3 SoCs
8 "ti,omap4-i2c" for OMAP4+ SoCs
9 "ti,am654-i2c", "ti,omap4-i2c" for AM654 SoCs
6- ti,hwmods : Must be "i2c<n>", n being the instance number (1-based) 10- ti,hwmods : Must be "i2c<n>", n being the instance number (1-based)
7- #address-cells = <1>; 11- #address-cells = <1>;
8- #size-cells = <0>; 12- #size-cells = <0>;
diff --git a/Documentation/i2c/busses/i2c-nvidia-gpu b/Documentation/i2c/busses/i2c-nvidia-gpu
new file mode 100644
index 000000000000..31884d2b2eb5
--- /dev/null
+++ b/Documentation/i2c/busses/i2c-nvidia-gpu
@@ -0,0 +1,18 @@
1Kernel driver i2c-nvidia-gpu
2
3Datasheet: not publicly available.
4
5Authors:
6 Ajay Gupta <ajayg@nvidia.com>
7
8Description
9-----------
10
11i2c-nvidia-gpu is a driver for I2C controller included in NVIDIA Turing
12and later GPUs and it is used to communicate with Type-C controller on GPUs.
13
14If your 'lspci -v' listing shows something like the following,
15
1601:00.3 Serial bus controller [0c80]: NVIDIA Corporation Device 1ad9 (rev a1)
17
18then this driver should support the I2C controller of your GPU.
diff --git a/MAINTAINERS b/MAINTAINERS
index 95e56fd128a5..0abecc528dac 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -6861,6 +6861,13 @@ L: linux-acpi@vger.kernel.org
6861S: Maintained 6861S: Maintained
6862F: drivers/i2c/i2c-core-acpi.c 6862F: drivers/i2c/i2c-core-acpi.c
6863 6863
6864I2C CONTROLLER DRIVER FOR NVIDIA GPU
6865M: Ajay Gupta <ajayg@nvidia.com>
6866L: linux-i2c@vger.kernel.org
6867S: Maintained
6868F: Documentation/i2c/busses/i2c-nvidia-gpu
6869F: drivers/i2c/busses/i2c-nvidia-gpu.c
6870
6864I2C MUXES 6871I2C MUXES
6865M: Peter Rosin <peda@axentia.se> 6872M: Peter Rosin <peda@axentia.se>
6866L: linux-i2c@vger.kernel.org 6873L: linux-i2c@vger.kernel.org
@@ -10784,6 +10791,14 @@ L: linux-omap@vger.kernel.org
10784S: Maintained 10791S: Maintained
10785F: arch/arm/mach-omap2/omap_hwmod.* 10792F: arch/arm/mach-omap2/omap_hwmod.*
10786 10793
10794OMAP I2C DRIVER
10795M: Vignesh R <vigneshr@ti.com>
10796L: linux-omap@vger.kernel.org
10797L: linux-i2c@vger.kernel.org
10798S: Maintained
10799F: Documentation/devicetree/bindings/i2c/i2c-omap.txt
10800F: drivers/i2c/busses/i2c-omap.c
10801
10787OMAP IMAGING SUBSYSTEM (OMAP3 ISP and OMAP4 ISS) 10802OMAP IMAGING SUBSYSTEM (OMAP3 ISP and OMAP4 ISS)
10788M: Laurent Pinchart <laurent.pinchart@ideasonboard.com> 10803M: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
10789L: linux-media@vger.kernel.org 10804L: linux-media@vger.kernel.org
diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig
index 56ccb1ea7da5..f2c681971201 100644
--- a/drivers/i2c/busses/Kconfig
+++ b/drivers/i2c/busses/Kconfig
@@ -224,6 +224,15 @@ config I2C_NFORCE2_S4985
224 This driver can also be built as a module. If so, the module 224 This driver can also be built as a module. If so, the module
225 will be called i2c-nforce2-s4985. 225 will be called i2c-nforce2-s4985.
226 226
227config I2C_NVIDIA_GPU
228 tristate "NVIDIA GPU I2C controller"
229 depends on PCI
230 help
231 If you say yes to this option, support will be included for the
232 NVIDIA GPU I2C controller which is used to communicate with the GPU's
233 Type-C controller. This driver can also be built as a module called
234 i2c-nvidia-gpu.
235
227config I2C_SIS5595 236config I2C_SIS5595
228 tristate "SiS 5595" 237 tristate "SiS 5595"
229 depends on PCI 238 depends on PCI
@@ -752,7 +761,7 @@ config I2C_OCORES
752 761
753config I2C_OMAP 762config I2C_OMAP
754 tristate "OMAP I2C adapter" 763 tristate "OMAP I2C adapter"
755 depends on ARCH_OMAP 764 depends on ARCH_OMAP || ARCH_K3
756 default y if MACH_OMAP_H3 || MACH_OMAP_OSK 765 default y if MACH_OMAP_H3 || MACH_OMAP_OSK
757 help 766 help
758 If you say yes to this option, support will be included for the 767 If you say yes to this option, support will be included for the
diff --git a/drivers/i2c/busses/Makefile b/drivers/i2c/busses/Makefile
index 18b26af82b1c..5f0cb6915969 100644
--- a/drivers/i2c/busses/Makefile
+++ b/drivers/i2c/busses/Makefile
@@ -19,6 +19,7 @@ obj-$(CONFIG_I2C_ISCH) += i2c-isch.o
19obj-$(CONFIG_I2C_ISMT) += i2c-ismt.o 19obj-$(CONFIG_I2C_ISMT) += i2c-ismt.o
20obj-$(CONFIG_I2C_NFORCE2) += i2c-nforce2.o 20obj-$(CONFIG_I2C_NFORCE2) += i2c-nforce2.o
21obj-$(CONFIG_I2C_NFORCE2_S4985) += i2c-nforce2-s4985.o 21obj-$(CONFIG_I2C_NFORCE2_S4985) += i2c-nforce2-s4985.o
22obj-$(CONFIG_I2C_NVIDIA_GPU) += i2c-nvidia-gpu.o
22obj-$(CONFIG_I2C_PIIX4) += i2c-piix4.o 23obj-$(CONFIG_I2C_PIIX4) += i2c-piix4.o
23obj-$(CONFIG_I2C_SIS5595) += i2c-sis5595.o 24obj-$(CONFIG_I2C_SIS5595) += i2c-sis5595.o
24obj-$(CONFIG_I2C_SIS630) += i2c-sis630.o 25obj-$(CONFIG_I2C_SIS630) += i2c-sis630.o
diff --git a/drivers/i2c/busses/i2c-nvidia-gpu.c b/drivers/i2c/busses/i2c-nvidia-gpu.c
new file mode 100644
index 000000000000..8822357bca0c
--- /dev/null
+++ b/drivers/i2c/busses/i2c-nvidia-gpu.c
@@ -0,0 +1,368 @@
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * Nvidia GPU I2C controller Driver
4 *
5 * Copyright (C) 2018 NVIDIA Corporation. All rights reserved.
6 * Author: Ajay Gupta <ajayg@nvidia.com>
7 */
8#include <linux/delay.h>
9#include <linux/i2c.h>
10#include <linux/interrupt.h>
11#include <linux/module.h>
12#include <linux/pci.h>
13#include <linux/platform_device.h>
14#include <linux/pm.h>
15#include <linux/pm_runtime.h>
16
17#include <asm/unaligned.h>
18
19/* I2C definitions */
20#define I2C_MST_CNTL 0x00
21#define I2C_MST_CNTL_GEN_START BIT(0)
22#define I2C_MST_CNTL_GEN_STOP BIT(1)
23#define I2C_MST_CNTL_CMD_READ (1 << 2)
24#define I2C_MST_CNTL_CMD_WRITE (2 << 2)
25#define I2C_MST_CNTL_BURST_SIZE_SHIFT 6
26#define I2C_MST_CNTL_GEN_NACK BIT(28)
27#define I2C_MST_CNTL_STATUS GENMASK(30, 29)
28#define I2C_MST_CNTL_STATUS_OKAY (0 << 29)
29#define I2C_MST_CNTL_STATUS_NO_ACK (1 << 29)
30#define I2C_MST_CNTL_STATUS_TIMEOUT (2 << 29)
31#define I2C_MST_CNTL_STATUS_BUS_BUSY (3 << 29)
32#define I2C_MST_CNTL_CYCLE_TRIGGER BIT(31)
33
34#define I2C_MST_ADDR 0x04
35
36#define I2C_MST_I2C0_TIMING 0x08
37#define I2C_MST_I2C0_TIMING_SCL_PERIOD_100KHZ 0x10e
38#define I2C_MST_I2C0_TIMING_TIMEOUT_CLK_CNT 16
39#define I2C_MST_I2C0_TIMING_TIMEOUT_CLK_CNT_MAX 255
40#define I2C_MST_I2C0_TIMING_TIMEOUT_CHECK BIT(24)
41
42#define I2C_MST_DATA 0x0c
43
44#define I2C_MST_HYBRID_PADCTL 0x20
45#define I2C_MST_HYBRID_PADCTL_MODE_I2C BIT(0)
46#define I2C_MST_HYBRID_PADCTL_I2C_SCL_INPUT_RCV BIT(14)
47#define I2C_MST_HYBRID_PADCTL_I2C_SDA_INPUT_RCV BIT(15)
48
49struct gpu_i2c_dev {
50 struct device *dev;
51 void __iomem *regs;
52 struct i2c_adapter adapter;
53 struct i2c_board_info *gpu_ccgx_ucsi;
54};
55
56static void gpu_enable_i2c_bus(struct gpu_i2c_dev *i2cd)
57{
58 u32 val;
59
60 /* enable I2C */
61 val = readl(i2cd->regs + I2C_MST_HYBRID_PADCTL);
62 val |= I2C_MST_HYBRID_PADCTL_MODE_I2C |
63 I2C_MST_HYBRID_PADCTL_I2C_SCL_INPUT_RCV |
64 I2C_MST_HYBRID_PADCTL_I2C_SDA_INPUT_RCV;
65 writel(val, i2cd->regs + I2C_MST_HYBRID_PADCTL);
66
67 /* enable 100KHZ mode */
68 val = I2C_MST_I2C0_TIMING_SCL_PERIOD_100KHZ;
69 val |= (I2C_MST_I2C0_TIMING_TIMEOUT_CLK_CNT_MAX
70 << I2C_MST_I2C0_TIMING_TIMEOUT_CLK_CNT);
71 val |= I2C_MST_I2C0_TIMING_TIMEOUT_CHECK;
72 writel(val, i2cd->regs + I2C_MST_I2C0_TIMING);
73}
74
75static int gpu_i2c_check_status(struct gpu_i2c_dev *i2cd)
76{