diff options
| -rw-r--r-- | Documentation/devicetree/bindings/i2c/i2c-omap.txt | 8 | ||||
| -rw-r--r-- | Documentation/i2c/busses/i2c-nvidia-gpu | 18 | ||||
| -rw-r--r-- | MAINTAINERS | 15 | ||||
| -rw-r--r-- | drivers/i2c/busses/Kconfig | 11 | ||||
| -rw-r--r-- | drivers/i2c/busses/Makefile | 1 | ||||
| -rw-r--r-- | drivers/i2c/busses/i2c-nvidia-gpu.c | 368 | ||||
| -rw-r--r-- | drivers/i2c/busses/i2c-qcom-geni.c | 15 | ||||
| -rw-r--r-- | drivers/usb/typec/ucsi/Kconfig | 10 | ||||
| -rw-r--r-- | drivers/usb/typec/ucsi/Makefile | 2 | ||||
| -rw-r--r-- | drivers/usb/typec/ucsi/ucsi_ccg.c | 307 |
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 @@ | |||
| 1 | I2C for OMAP platforms | 1 | I2C for OMAP platforms |
| 2 | 2 | ||
| 3 | Required properties : | 3 | Required 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 @@ | |||
| 1 | Kernel driver i2c-nvidia-gpu | ||
| 2 | |||
| 3 | Datasheet: not publicly available. | ||
| 4 | |||
| 5 | Authors: | ||
| 6 | Ajay Gupta <ajayg@nvidia.com> | ||
| 7 | |||
| 8 | Description | ||
| 9 | ----------- | ||
| 10 | |||
| 11 | i2c-nvidia-gpu is a driver for I2C controller included in NVIDIA Turing | ||
| 12 | and later GPUs and it is used to communicate with Type-C controller on GPUs. | ||
| 13 | |||
| 14 | If your 'lspci -v' listing shows something like the following, | ||
| 15 | |||
| 16 | 01:00.3 Serial bus controller [0c80]: NVIDIA Corporation Device 1ad9 (rev a1) | ||
| 17 | |||
| 18 | then 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 | |||
| 6861 | S: Maintained | 6861 | S: Maintained |
| 6862 | F: drivers/i2c/i2c-core-acpi.c | 6862 | F: drivers/i2c/i2c-core-acpi.c |
| 6863 | 6863 | ||
| 6864 | I2C CONTROLLER DRIVER FOR NVIDIA GPU | ||
| 6865 | M: Ajay Gupta <ajayg@nvidia.com> | ||
| 6866 | L: linux-i2c@vger.kernel.org | ||
| 6867 | S: Maintained | ||
| 6868 | F: Documentation/i2c/busses/i2c-nvidia-gpu | ||
| 6869 | F: drivers/i2c/busses/i2c-nvidia-gpu.c | ||
| 6870 | |||
| 6864 | I2C MUXES | 6871 | I2C MUXES |
| 6865 | M: Peter Rosin <peda@axentia.se> | 6872 | M: Peter Rosin <peda@axentia.se> |
| 6866 | L: linux-i2c@vger.kernel.org | 6873 | L: linux-i2c@vger.kernel.org |
| @@ -10784,6 +10791,14 @@ L: linux-omap@vger.kernel.org | |||
| 10784 | S: Maintained | 10791 | S: Maintained |
| 10785 | F: arch/arm/mach-omap2/omap_hwmod.* | 10792 | F: arch/arm/mach-omap2/omap_hwmod.* |
| 10786 | 10793 | ||
| 10794 | OMAP I2C DRIVER | ||
| 10795 | M: Vignesh R <vigneshr@ti.com> | ||
| 10796 | L: linux-omap@vger.kernel.org | ||
| 10797 | L: linux-i2c@vger.kernel.org | ||
| 10798 | S: Maintained | ||
| 10799 | F: Documentation/devicetree/bindings/i2c/i2c-omap.txt | ||
| 10800 | F: drivers/i2c/busses/i2c-omap.c | ||
| 10801 | |||
| 10787 | OMAP IMAGING SUBSYSTEM (OMAP3 ISP and OMAP4 ISS) | 10802 | OMAP IMAGING SUBSYSTEM (OMAP3 ISP and OMAP4 ISS) |
| 10788 | M: Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 10803 | M: Laurent Pinchart <laurent.pinchart@ideasonboard.com> |
| 10789 | L: linux-media@vger.kernel.org | 10804 | L: 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 | ||
| 227 | config 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 | |||
| 227 | config I2C_SIS5595 | 236 | config 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 | ||
| 753 | config I2C_OMAP | 762 | config 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 | |||
| 19 | obj-$(CONFIG_I2C_ISMT) += i2c-ismt.o | 19 | obj-$(CONFIG_I2C_ISMT) += i2c-ismt.o |
| 20 | obj-$(CONFIG_I2C_NFORCE2) += i2c-nforce2.o | 20 | obj-$(CONFIG_I2C_NFORCE2) += i2c-nforce2.o |
| 21 | obj-$(CONFIG_I2C_NFORCE2_S4985) += i2c-nforce2-s4985.o | 21 | obj-$(CONFIG_I2C_NFORCE2_S4985) += i2c-nforce2-s4985.o |
| 22 | obj-$(CONFIG_I2C_NVIDIA_GPU) += i2c-nvidia-gpu.o | ||
| 22 | obj-$(CONFIG_I2C_PIIX4) += i2c-piix4.o | 23 | obj-$(CONFIG_I2C_PIIX4) += i2c-piix4.o |
| 23 | obj-$(CONFIG_I2C_SIS5595) += i2c-sis5595.o | 24 | obj-$(CONFIG_I2C_SIS5595) += i2c-sis5595.o |
| 24 | obj-$(CONFIG_I2C_SIS630) += i2c-sis630.o | 25 | obj-$(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 | |||
| 49 | struct 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 | |||
| 56 | static 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 | |||
| 75 | static int gpu_i2c_check_status(struct gpu_i2c_dev *i2cd) | ||
| 76 | { | ||
