From 22d886195a3aed2cfb0ae5d3a56af146c4ff182e Mon Sep 17 00:00:00 2001 From: W4HO <87742609+W4HO-ham@users.noreply.github.com> Date: Tue, 27 Oct 2026 21:24:33 -0647 Subject: [PATCH 1/2] dt-bindings: phy: Add the TI TUSB2E11 eUSB2 repeater The TUSB2E11 converts between an SoC's eUSB2 signalling and USB 2.0 on one port, as on the Pixel 9a between the zumapro eUSB2 PHY and the Type-C connector. It takes its role from the eUSB2 link, so the binding only describes its supply and the board's signal tuning, one property per tuning register; the register names follow Google's GPL eusb_repeater driver. Signed-off-by: W4HO <87742609+W4HO-ham@users.noreply.github.com> --- .../devicetree/bindings/phy/ti,tusb2e11.yaml | 96 +++++++++++++++++++ 1 file changed, 96 insertions(+) create mode 100644 Documentation/devicetree/bindings/phy/ti,tusb2e11.yaml diff --git a/Documentation/devicetree/bindings/phy/ti,tusb2e11.yaml b/Documentation/devicetree/bindings/phy/ti,tusb2e11.yaml new file mode 100644 index 0000000000..66a25b3476 --- /dev/null +++ b/Documentation/devicetree/bindings/phy/ti,tusb2e11.yaml @@ -0,0 +1,96 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/phy/ti,tusb2e11.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: TI TUSB2E11 eUSB2 to USB 2.0 repeater + +maintainers: + - W4HO <87742609+W4HO-ham@users.noreply.github.com> + +description: + The TUSB2E11 converts between an SoC's eUSB2 signalling and USB 2.0 on + one port. It takes its role, host or peripheral, from the eUSB2 link. + The optional properties are the board's signal tuning, written to the + repeater's register of the same name when the PHY is initialized; a + property left out keeps the repeater's reset value. + +properties: + compatible: + const: ti,tusb2e11 + + reg: + maxItems: 1 + + "#phy-cells": + const: 0 + + vdd3v3-supply: + description: 3.3 V supply + + ti,uart-port1: + $ref: /schemas/types.yaml#/definitions/uint32 + maximum: 0xff + description: UART_PORT1 (0x50), the port's mode control + + ti,usb2-tx-adjust: + $ref: /schemas/types.yaml#/definitions/uint32 + maximum: 0xff + description: U_TX_ADJUST_PORT1 (0x70) + + ti,usb2-hs-tx-pre-emphasis: + $ref: /schemas/types.yaml#/definitions/uint32 + maximum: 0xff + description: U_HS_TX_PRE_EMPHASIS_P1 (0x71) + + ti,usb2-rx-adjust: + $ref: /schemas/types.yaml#/definitions/uint32 + maximum: 0xff + description: U_RX_ADJUST_PORT1 (0x72) + + ti,usb2-disconnect-squelch: + $ref: /schemas/types.yaml#/definitions/uint32 + maximum: 0xff + description: U_DISCONNECT_SQUELCH_PORT1 (0x73) + + ti,eusb2-hs-tx-pre-emphasis: + $ref: /schemas/types.yaml#/definitions/uint32 + maximum: 0xff + description: E_HS_TX_PRE_EMPHASIS_P1 (0x77) + + ti,eusb2-tx-adjust: + $ref: /schemas/types.yaml#/definitions/uint32 + maximum: 0xff + description: E_TX_ADJUST_PORT1 (0x78) + + ti,eusb2-rx-adjust: + $ref: /schemas/types.yaml#/definitions/uint32 + maximum: 0xff + description: E_RX_ADJUST_PORT1 (0x79) + +required: + - compatible + - reg + - "#phy-cells" + - vdd3v3-supply + +additionalProperties: false + +examples: + - | + i2c { + #address-cells = <1>; + #size-cells = <0>; + + usb-repeater@3e { + compatible = "ti,tusb2e11"; + reg = <0x3e>; + #phy-cells = <0>; + vdd3v3-supply = <&vreg_l19m>; + ti,uart-port1 = <0x0a>; + ti,usb2-tx-adjust = <0x4f>; + ti,usb2-hs-tx-pre-emphasis = <0x3c>; + }; + }; +... From 3ec911670ec78779945ca746e154a54c21809c4c Mon Sep 17 00:00:00 2001 From: W4HO <87742609+W4HO-ham@users.noreply.github.com> Date: Tue, 27 Oct 2026 21:24:33 -0647 Subject: [PATCH 2/2] phy: Add the TI TUSB2E11 eUSB2 repeater Power the repeater, wait the 3 ms it needs before it answers I2C, enable its port and write the board's tuning from the device tree; at exit, disable the port and the supply. The role needs no driver: the repeater follows the eUSB2 link. Registers and timing follow Google's GPL eusb_repeater driver for the Pixel 9a, which writes the same tuning. Signed-off-by: W4HO <87742609+W4HO-ham@users.noreply.github.com> --- MAINTAINERS | 7 ++ drivers/phy/Kconfig | 11 +++ drivers/phy/Makefile | 1 + drivers/phy/phy-ti-tusb2e11.c | 167 ++++++++++++++++++++++++++++++++++ 4 files changed, 186 insertions(+) create mode 100644 drivers/phy/phy-ti-tusb2e11.c diff --git a/MAINTAINERS b/MAINTAINERS index 00e06c4795..efd3252777 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -27540,6 +27540,13 @@ S: Maintained F: Documentation/devicetree/bindings/iio/adc/ti,tsc2046.yaml F: drivers/iio/adc/ti-tsc2046.c +TI TUSB2E11 EUSB2 REPEATER DRIVER +M: W4HO <87742609+W4HO-ham@users.noreply.github.com> +L: linux-phy@lists.infradead.org +S: Maintained +F: Documentation/devicetree/bindings/phy/ti,tusb2e11.yaml +F: drivers/phy/phy-ti-tusb2e11.c + TI VPE/CAL DRIVERS M: Yemike Abhilash Chandra L: linux-media@vger.kernel.org diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig index 19f3b7d12b..b1a968c62a 100644 --- a/drivers/phy/Kconfig +++ b/drivers/phy/Kconfig @@ -125,6 +125,17 @@ config PHY_LPC18XX_USB_OTG This driver is need for USB0 support on LPC18xx/43xx and takes care of enabling and clock setup. +config PHY_TI_TUSB2E11 + tristate "TI TUSB2E11 eUSB2 to USB 2.0 repeater" + depends on I2C + depends on OF + select GENERIC_PHY + select REGMAP_I2C + help + Enable this to support the TI TUSB2E11 eUSB2 to USB 2.0 repeater, + as on the Google Pixel 9a. It powers the repeater, enables its port + and writes the board's signal tuning. + config PHY_NXP_PTN3222 tristate "NXP PTN3222 1-port eUSB2 to USB2 redriver" depends on I2C diff --git a/drivers/phy/Makefile b/drivers/phy/Makefile index d7aa516bcc..5d35bbbd8d 100644 --- a/drivers/phy/Makefile +++ b/drivers/phy/Makefile @@ -15,6 +15,7 @@ obj-$(CONFIG_PHY_GOOGLE_USB) += phy-google-usb.o obj-$(CONFIG_USB_LGM_PHY) += phy-lgm-usb.o obj-$(CONFIG_PHY_LPC18XX_USB_OTG) += phy-lpc18xx-usb-otg.o obj-$(CONFIG_PHY_NXP_PTN3222) += phy-nxp-ptn3222.o +obj-$(CONFIG_PHY_TI_TUSB2E11) += phy-ti-tusb2e11.o obj-$(CONFIG_PHY_NXP_TJA1145) += phy-nxp-tja1145.o obj-$(CONFIG_PHY_PISTACHIO_USB) += phy-pistachio-usb.o obj-$(CONFIG_PHY_SNPS_EUSB2) += phy-snps-eusb2.o diff --git a/drivers/phy/phy-ti-tusb2e11.c b/drivers/phy/phy-ti-tusb2e11.c new file mode 100644 index 0000000000..b69d3244ab --- /dev/null +++ b/drivers/phy/phy-ti-tusb2e11.c @@ -0,0 +1,167 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * TI TUSB2E11 eUSB2 to USB 2.0 repeater + * + * The repeater takes its role (host or peripheral) from the eUSB2 link, so + * the driver only powers it, enables its port and writes the board's + * signal tuning. The registers and the 3 ms ready time follow Google's GPL + * eusb_repeater driver for the Pixel 9a. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define TUSB2E11_UART_PORT1 0x50 +#define TUSB2E11_U_TX_ADJUST_PORT1 0x70 +#define TUSB2E11_U_HS_TX_PRE_EMPH_P1 0x71 +#define TUSB2E11_U_RX_ADJUST_PORT1 0x72 +#define TUSB2E11_U_DISCONNECT_SQUELCH 0x73 +#define TUSB2E11_E_HS_TX_PRE_EMPH_P1 0x77 +#define TUSB2E11_E_TX_ADJUST_PORT1 0x78 +#define TUSB2E11_E_RX_ADJUST_PORT1 0x79 +#define TUSB2E11_REV_ID 0xb0 +#define TUSB2E11_GLOBAL_CONFIG 0xb2 +#define TUSB2E11_GLOBAL_DISABLE_P1 BIT(6) + +/* time from power-up until the repeater accepts I2C and RAP requests */ +#define TUSB2E11_READY_US 3000 + +static const struct { + const char *prop; + u8 reg; +} tusb2e11_tunes[] = { + { "ti,uart-port1", TUSB2E11_UART_PORT1 }, + { "ti,usb2-tx-adjust", TUSB2E11_U_TX_ADJUST_PORT1 }, + { "ti,usb2-hs-tx-pre-emphasis", TUSB2E11_U_HS_TX_PRE_EMPH_P1 }, + { "ti,usb2-rx-adjust", TUSB2E11_U_RX_ADJUST_PORT1 }, + { "ti,usb2-disconnect-squelch", TUSB2E11_U_DISCONNECT_SQUELCH }, + { "ti,eusb2-hs-tx-pre-emphasis", TUSB2E11_E_HS_TX_PRE_EMPH_P1 }, + { "ti,eusb2-tx-adjust", TUSB2E11_E_TX_ADJUST_PORT1 }, + { "ti,eusb2-rx-adjust", TUSB2E11_E_RX_ADJUST_PORT1 }, +}; + +struct tusb2e11 { + struct regmap *regmap; + struct regulator *vdd; + struct phy *phy; + /* the board's tuning, one value per tusb2e11_tunes entry */ + u8 tune[ARRAY_SIZE(tusb2e11_tunes)]; + unsigned long tune_set; +}; + +static int tusb2e11_init(struct phy *phy) +{ + struct tusb2e11 *tusb = phy_get_drvdata(phy); + unsigned int i; + int ret; + + ret = regulator_enable(tusb->vdd); + if (ret) + return ret; + fsleep(TUSB2E11_READY_US); + + ret = regmap_clear_bits(tusb->regmap, TUSB2E11_GLOBAL_CONFIG, + TUSB2E11_GLOBAL_DISABLE_P1); + if (ret) + goto err; + + for_each_set_bit(i, &tusb->tune_set, ARRAY_SIZE(tusb2e11_tunes)) { + ret = regmap_write(tusb->regmap, tusb2e11_tunes[i].reg, + tusb->tune[i]); + if (ret) + goto err; + } + + return 0; + +err: + regulator_disable(tusb->vdd); + return ret; +} + +static int tusb2e11_exit(struct phy *phy) +{ + struct tusb2e11 *tusb = phy_get_drvdata(phy); + + regmap_set_bits(tusb->regmap, TUSB2E11_GLOBAL_CONFIG, + TUSB2E11_GLOBAL_DISABLE_P1); + + return regulator_disable(tusb->vdd); +} + +static const struct phy_ops tusb2e11_ops = { + .init = tusb2e11_init, + .exit = tusb2e11_exit, + .owner = THIS_MODULE, +}; + +static const struct regmap_config tusb2e11_regmap_config = { + .reg_bits = 8, + .val_bits = 8, + .max_register = 0xff, +}; + +static int tusb2e11_probe(struct i2c_client *client) +{ + struct device *dev = &client->dev; + struct phy_provider *provider; + struct tusb2e11 *tusb; + unsigned int i; + u32 val; + + tusb = devm_kzalloc(dev, sizeof(*tusb), GFP_KERNEL); + if (!tusb) + return -ENOMEM; + + for (i = 0; i < ARRAY_SIZE(tusb2e11_tunes); i++) { + if (of_property_read_u32(dev->of_node, tusb2e11_tunes[i].prop, &val)) + continue; + if (val > 0xff) + return dev_err_probe(dev, -EINVAL, "%s out of range\n", + tusb2e11_tunes[i].prop); + tusb->tune[i] = val; + __set_bit(i, &tusb->tune_set); + } + + tusb->regmap = devm_regmap_init_i2c(client, &tusb2e11_regmap_config); + if (IS_ERR(tusb->regmap)) + return PTR_ERR(tusb->regmap); + + tusb->vdd = devm_regulator_get(dev, "vdd3v3"); + if (IS_ERR(tusb->vdd)) + return dev_err_probe(dev, PTR_ERR(tusb->vdd), "no vdd3v3 supply\n"); + + tusb->phy = devm_phy_create(dev, dev->of_node, &tusb2e11_ops); + if (IS_ERR(tusb->phy)) + return dev_err_probe(dev, PTR_ERR(tusb->phy), "failed to create PHY\n"); + phy_set_drvdata(tusb->phy, tusb); + + provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate); + + return PTR_ERR_OR_ZERO(provider); +} + +static const struct of_device_id tusb2e11_of_match[] = { + { .compatible = "ti,tusb2e11" }, + { } +}; +MODULE_DEVICE_TABLE(of, tusb2e11_of_match); + +static struct i2c_driver tusb2e11_driver = { + .driver = { + .name = "tusb2e11", + .of_match_table = tusb2e11_of_match, + }, + .probe = tusb2e11_probe, +}; +module_i2c_driver(tusb2e11_driver); + +MODULE_DESCRIPTION("TI TUSB2E11 eUSB2 repeater"); +MODULE_LICENSE("GPL");