From 9e7fe4dcd9e7c5c79247cd628f1335ce6fb31c30 Mon Sep 17 00:00:00 2001 From: Chris Gray Date: Wed, 11 Nov 2026 12:20:02 -0600 Subject: [PATCH 1/3] dt-bindings: PCI: google,gs201-pcie: describe GS101 controller and PHY Add the GS101 compatible and its two analog supplies without changing the current zuma/zumapro alternatives. Forbid the unqualified coherent DMA and CMU diagnostic path on GS101. Endpoint enable GPIOs belong to the regulator and PCI power-control description, not the host binding. Assisted-by: LLM Signed-off-by: Chris Gray --- .../bindings/pci/google,gs201-pcie.yaml | 24 +++++++++++++++++-- .../bindings/phy/google,gs201-pcie-phy.yaml | 6 +++-- 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/Documentation/devicetree/bindings/pci/google,gs201-pcie.yaml b/Documentation/devicetree/bindings/pci/google,gs201-pcie.yaml index 19181b1434..2031a9e8a2 100644 --- a/Documentation/devicetree/bindings/pci/google,gs201-pcie.yaml +++ b/Documentation/devicetree/bindings/pci/google,gs201-pcie.yaml @@ -4,13 +4,13 @@ $id: http://devicetree.org/schemas/pci/google,gs201-pcie.yaml# $schema: http://devicetree.org/meta-schemas/core.yaml# -title: Google gs201 and zuma PCIe host controllers +title: Google gs101, gs201 and zuma PCIe host controllers maintainers: - Derek Ross description: - The PCIe controllers of the Google gs201 (Tensor G2) and zuma (Tensor G3) + The PCIe controllers of Google gs101 (Tensor G1), gs201 (Tensor G2) and zuma (Tensor G3) SoCs are Synopsys DesignWare cores (IP versions 0x984500 and 0x986500) in a Samsung wrapper. The wrapper adds a sub-control block (ELBI) with link training control and interrupt @@ -36,10 +36,24 @@ allOf: reg-names: maxItems: 3 + - if: + properties: + compatible: + contains: + const: google,gs101-pcie + then: + properties: + dma-coherent: false + samsung,cmu: false + required: + - vpcie0v85-supply + - vpcie1v8-supply + properties: compatible: oneOf: - enum: + - google,gs101-pcie - google,gs201-pcie - google,zuma-pcie - items: @@ -95,6 +109,12 @@ properties: description: Needed with dma-coherent, to make the controller's DMA shareable. + vpcie0v85-supply: + description: PCIe analog 0.85 V supply. + + vpcie1v8-supply: + description: PCIe analog 1.8 V supply. + num-lanes: maximum: 2 diff --git a/Documentation/devicetree/bindings/phy/google,gs201-pcie-phy.yaml b/Documentation/devicetree/bindings/phy/google,gs201-pcie-phy.yaml index d0292e6f6c..8ff12364b2 100644 --- a/Documentation/devicetree/bindings/phy/google,gs201-pcie-phy.yaml +++ b/Documentation/devicetree/bindings/phy/google,gs201-pcie-phy.yaml @@ -4,7 +4,7 @@ $id: http://devicetree.org/schemas/phy/google,gs201-pcie-phy.yaml# $schema: http://devicetree.org/meta-schemas/core.yaml# -title: Google gs201 PCIe PHY +title: Google gs101 / gs201 PCIe PHY maintainers: - Derek Ross @@ -18,7 +18,9 @@ description: properties: compatible: - const: google,gs201-pcie-phy + enum: + - google,gs101-pcie-phy + - google,gs201-pcie-phy reg: items: From 273b3bc92fe6875435d8dc2c998cd37f077b0977 Mon Sep 17 00:00:00 2001 From: Chris Gray Date: Wed, 11 Nov 2026 12:20:02 -0600 Subject: [PATCH 2/3] phy: samsung: gs201-pcie: add the GS101 calibration path Use the ordered GS101 CAL writes and its PCS, timing and power-down sequence. Leave the existing GS201 path selected on its compatible. The earlier development path ran on Bluejay; the current rebased source has not been booted. Keep the TCXO diagnostic unsupported for GS101. Link: https://android.googlesource.com/kernel/google-modules/soc/gs/+/204078758737776959ecc85c527a00fd2cabb62f/drivers/pci/controller/dwc-whi/pcie-exynos-gs101-rc-cal.c Assisted-by: LLM Signed-off-by: Chris Gray --- drivers/phy/samsung/phy-gs201-pcie.c | 103 ++++++++++++++++++++++----- 1 file changed, 86 insertions(+), 17 deletions(-) diff --git a/drivers/phy/samsung/phy-gs201-pcie.c b/drivers/phy/samsung/phy-gs201-pcie.c index 4218f86745..893cc93f2e 100644 --- a/drivers/phy/samsung/phy-gs201-pcie.c +++ b/drivers/phy/samsung/phy-gs201-pcie.c @@ -8,6 +8,7 @@ * Most PMA registers have no public names, so the tables keep Samsung's raw * offsets and values. * + * Copyright (C) 2020 Samsung Electronics Co., Ltd. * Copyright (C) 2021 Samsung Electronics Co., Ltd. */ @@ -161,6 +162,46 @@ static const struct gs201_pcie_phy_reg gs201_pma_lane[] = { { 0x9b4, 0x76 }, }; +/* + * gs101 CAL from Google's pcie-exynos-gs101-rc-cal.c at + * 204078758737776959ecc85c527a00fd2cabb62f. Keep the ordered writes, + * including TX termination, pre-emphasis and RX overrides. Unlike gs201, + * gs101 has no 38.4 MHz table, Auto FBB or DFE override. + */ +static const struct gs201_pcie_phy_reg gs101_pma_common[] = { + { 0x018, 0x50 }, { 0x048, 0x33 }, { 0x068, 0x01 }, { 0x070, 0x12 }, + { 0x08c, 0x00 }, { 0x090, 0x21 }, { 0x0b0, 0x14 }, { 0x0b8, 0x50 }, + { 0x0e0, 0x51 }, { 0x100, 0x00 }, { 0x104, 0x80 }, { 0x140, 0x38 }, + { 0x180, 0xa4 }, { 0x188, 0x03 }, { 0x2a8, 0x38 }, { 0x2e4, 0x12 }, + { 0x400, 0x80 }, { 0x408, 0x20 }, { 0x550, 0x00 }, { 0x5a8, 0x00 }, + { 0x5ec, 0xff }, { 0x458, 0x02 }, { 0x5b0, 0x34 }, { 0x450, 0x20 }, +}; + +static const struct gs201_pcie_phy_reg gs101_pma_lane[] = { + { 0x82c, 0x08 }, { 0x830, 0x24 }, { 0x878, 0x80 }, { 0x894, 0x40 }, + { 0x8c0, 0x00 }, { 0x8f4, 0x30 }, { 0x908, 0x05 }, { 0x90c, 0xe0 }, + { 0x914, 0xd4 }, { 0x91c, 0xd3 }, { 0x920, 0xce }, { 0x924, 0x01 }, + { 0x928, 0x35 }, { 0x92c, 0xba }, { 0x930, 0x41 }, { 0x934, 0x15 }, + { 0x938, 0x13 }, { 0x93c, 0x4e }, { 0x948, 0x43 }, { 0x94c, 0xfc }, + { 0x954, 0x10 }, { 0x958, 0x69 }, { 0x964, 0x40 }, { 0x9b4, 0xf6 }, + { 0x9c0, 0x2d }, { 0x9c4, 0xb7 }, { 0x9cc, 0x3c }, { 0x9dc, 0x7e }, + { 0xa40, 0x02 }, { 0xa70, 0x26 }, { 0xa74, 0x00 }, { 0xb40, 0x06 }, + { 0xb44, 0x06 }, { 0xb48, 0x04 }, { 0xb4c, 0x03 }, { 0xb50, 0x03 }, + { 0xb54, 0x03 }, { 0xb58, 0x03 }, { 0xb5c, 0x03 }, { 0xc10, 0x1b }, + { 0xc44, 0x10 }, { 0xc48, 0x10 }, { 0xc4c, 0x10 }, { 0xc50, 0x10 }, + { 0xc54, 0x02 }, { 0xc58, 0x02 }, { 0xc5c, 0x02 }, { 0xc60, 0x02 }, + { 0xc6c, 0x02 }, { 0xc70, 0x02 }, { 0xca8, 0xe7 }, { 0xcac, 0x00 }, + { 0xcb0, 0x0e }, { 0xccc, 0x1c }, { 0xcd4, 0x05 }, { 0xcd8, 0x77 }, + { 0xcdc, 0x7a }, { 0xdb4, 0x2f }, { 0x9cc, 0x00 }, { 0xcd8, 0xff }, + { 0xcdc, 0x6e }, { 0x82c, 0x0f }, { 0x830, 0x60 }, { 0x834, 0x7e }, + { 0x824, 0x10 }, { 0x82c, 0x4f }, { 0x818, 0x1f }, { 0x820, 0x00 }, + { 0x928, 0x3d }, { 0x920, 0xca }, { 0xa08, 0x2f }, { 0x92c, 0xb8 }, + { 0x914, 0xf4 }, { 0x96c, 0x55 }, { 0x988, 0x78 }, { 0x934, 0x17 }, + { 0x93c, 0x4c }, { 0x994, 0x3b }, { 0x948, 0x73 }, { 0xb9c, 0x3f }, + { 0x9c8, 0x20 }, { 0x9c4, 0xff }, { 0xc08, 0x05 }, { 0xc3c, 0x04 }, + { 0xc40, 0x04 }, +}; + /* 38.4 MHz input clock, per lane, written for both lanes of the PHY */ static const struct gs201_pcie_phy_reg gs201_pma_lane_clk[] = { { 0xbcc, 0x41 }, { 0xbd4, 0x41 }, { 0xbdc, 0x68 }, { 0xbe0, 0x00 }, @@ -184,6 +225,7 @@ static const struct gs201_pcie_phy_reg gs201_pma_reset_vals[] = { struct gs201_pcie_phy { struct device *dev; + bool gs101; void __iomem *pma; void __iomem *pcs; void __iomem *rst; @@ -254,6 +296,10 @@ static void gs201_pcie_phy_pwrdn(struct gs201_pcie_phy *gp) gs201_pcie_phy_rmw(gp->pma + GS201_PMA_CMN_CTRL, GS201_PMA_CMN_CTRL_PMA_EN, 0); + /* The gs101 power-down sequence ends after disabling PMA. */ + if (gp->gs101) + return; + gs201_phy_trace(gp, "about to read PCS 0x184 (first PCS read): rate switching off"); gs201_pcie_phy_rmw(gp->pcs + GS201_PCS_RATE_CTRL, GS201_PCS_RATE_CTRL_SWITCH, 0); @@ -277,6 +323,9 @@ static void gs201_pcie_phy_pwrdn_clear(struct gs201_pcie_phy *gp) writel(0, gp->pma + lane * GS201_PMA_LANE_STRIDE + gs201_pma_lane_pwrdn[i].off); + if (gp->gs101) + return; + gs201_phy_trace(gp, "about to write PCS 0x184 (rate change and power-down reset)"); writel(0, gp->pcs + GS201_PCS_RATE_CTRL); } @@ -305,7 +354,8 @@ static void gs201_pcie_phy_config(struct gs201_pcie_phy *gp, unsigned int lanes) dev_dbg(gp->dev, "OC initial status %#x\n", readl(gp->pma + GS201_PMA_OC_STATUS)); - gs201_pcie_phy_check_reset(gp); + if (!gp->gs101) + gs201_pcie_phy_check_reset(gp); /* Input clock path */ writel(GS201_PMA_INPUT_CLK_VAL, gp->pma + GS201_PMA_INPUT_CLK); @@ -327,22 +377,31 @@ static void gs201_pcie_phy_config(struct gs201_pcie_phy *gp, unsigned int lanes) writel(1, gp->rst + GS201_PHY_RST_INIT); udelay(10); - gs201_phy_trace(gp, "about to write the PMA tables (common, %u lane(s), lane clocks)", + gs201_phy_trace(gp, "about to write variant PMA tables (common, %u lane(s))", lanes); - gs201_pcie_phy_write_table(gp->pma, gs201_pma_common, - ARRAY_SIZE(gs201_pma_common)); - - for (lane = 0; lane < lanes; lane++) - gs201_pcie_phy_write_table(gp->pma + lane * GS201_PMA_LANE_STRIDE, - gs201_pma_lane, - ARRAY_SIZE(gs201_pma_lane)); - - for (lane = 0; lane < GS201_PHY_MAX_LANES; lane++) - gs201_pcie_phy_write_table(gp->pma + lane * GS201_PMA_LANE_STRIDE, - gs201_pma_lane_clk, - ARRAY_SIZE(gs201_pma_lane_clk)); + if (gp->gs101) { + gs201_pcie_phy_write_table(gp->pma, gs101_pma_common, + ARRAY_SIZE(gs101_pma_common)); + for (lane = 0; lane < lanes; lane++) + gs201_pcie_phy_write_table(gp->pma + lane * GS201_PMA_LANE_STRIDE, + gs101_pma_lane, + ARRAY_SIZE(gs101_pma_lane)); + } else { + gs201_pcie_phy_write_table(gp->pma, gs201_pma_common, + ARRAY_SIZE(gs201_pma_common)); + + for (lane = 0; lane < lanes; lane++) + gs201_pcie_phy_write_table(gp->pma + lane * GS201_PMA_LANE_STRIDE, + gs201_pma_lane, + ARRAY_SIZE(gs201_pma_lane)); + + for (lane = 0; lane < GS201_PHY_MAX_LANES; lane++) + gs201_pcie_phy_write_table(gp->pma + lane * GS201_PMA_LANE_STRIDE, + gs201_pma_lane_clk, + ARRAY_SIZE(gs201_pma_lane_clk)); + } - gs201_phy_trace(gp, "about to write PCS 0x004 0x154 0x150 0x170 0x008 0x190"); + gs201_phy_trace(gp, "about to write variant PCS settings"); for (lane = 0; lane < lanes; lane++) { void __iomem *pcs = gp->pcs + lane * GS201_PCS_LANE_STRIDE; @@ -357,10 +416,11 @@ static void gs201_pcie_phy_config(struct gs201_pcie_phy *gp, unsigned int lanes) gs201_pcie_phy_rmw(gp->pcs + lane * GS201_PCS_LANE_STRIDE + GS201_PCS_CLK_CTRL, GS201_PCS_ERIO_CLK_GATE_MASK, - GS201_PCS_ERIO_CLK_GATE_MASK); + gp->gs101 ? BIT(4) : GS201_PCS_ERIO_CLK_GATE_MASK); /* PLL and bias enable off delay */ - writel(0x100b0808, gp->pcs + GS201_PCS_PLL_BIAS_OFF_DELAY); + if (!gp->gs101) + writel(0x100b0808, gp->pcs + GS201_PCS_PLL_BIAS_OFF_DELAY); gs201_phy_trace(gp, "about to release CMN_RST and PORT_RST"); writel(1, gp->rst + GS201_PHY_RST_CMN); @@ -466,6 +526,10 @@ static int gs201_pcie_phy_init(struct phy *phy) struct gs201_pcie_phy *gp = phy_get_drvdata(phy); int ret; + /* check_tcxo can also be changed after probe through sysfs. */ + if (gp->gs101 && check_tcxo) + return -EINVAL; + ret = gs201_pcie_phy_clks_on(gp); if (ret) return ret; @@ -570,6 +634,10 @@ static int gs201_pcie_phy_probe(struct platform_device *pdev) return -ENOMEM; gp->dev = dev; + gp->gs101 = of_device_is_compatible(dev->of_node, "google,gs101-pcie-phy"); + if (gp->gs101 && check_tcxo) + return dev_err_probe(dev, -EINVAL, + "check_tcxo is not supported on gs101\n"); /* Only mappings here: the PHY is not touched until phy_init() */ gp->pma = devm_platform_ioremap_resource_byname(pdev, "pma"); @@ -616,6 +684,7 @@ static int gs201_pcie_phy_probe(struct platform_device *pdev) } static const struct of_device_id gs201_pcie_phy_of_match[] = { + { .compatible = "google,gs101-pcie-phy" }, { .compatible = "google,gs201-pcie-phy" }, { } }; From f90429400883782ae50e47905ebf56dff3a954a2 Mon Sep 17 00:00:00 2001 From: Chris Gray Date: Wed, 11 Nov 2026 12:20:02 -0600 Subject: [PATCH 3/3] PCI: dwc: gs201: select GS101 behavior through match data Extend the current SoC match data for GS101 supply votes, inaccessible CMU diagnostics and bounded link attempts. The already merged 9a match-data paths are retained. Endpoint power uses the existing PCI power-control sequence, including its error and teardown handling; remove the proposed direct WLAN GPIO ownership from the host driver. The companion disabled Bluejay DT supplies a fixed WL_REG_ON regulator to the root port. That reworked sequencing is not hardware-qualified. Assisted-by: LLM Signed-off-by: Chris Gray --- drivers/pci/controller/dwc/pcie-gs201.c | 71 ++++++++++++++++++++++++- 1 file changed, 69 insertions(+), 2 deletions(-) diff --git a/drivers/pci/controller/dwc/pcie-gs201.c b/drivers/pci/controller/dwc/pcie-gs201.c index b114c6be96..6ba9f650c4 100644 --- a/drivers/pci/controller/dwc/pcie-gs201.c +++ b/drivers/pci/controller/dwc/pcie-gs201.c @@ -40,6 +40,7 @@ #include #include #include +#include #include "pcie-designware.h" @@ -172,6 +173,11 @@ MODULE_PARM_DESC(cmu_acg_off, * set before the PHY configuration, and not again after it. zuma's * CAL does them in the middle of its PHY configuration; gs201's * establish_link() does them after. + * @phy_supplies: acquire the controller's two analog supplies before clocks + * @skip_cmu: the CMU diagnostic window has inaccessible holes + * @noncoherent_only: coherent DMA is not qualified for this controller + * @skip_link_history: do not read unqualified history registers on failure + * @link_tries: maximum link attempts, zero for the existing default * @pwr_reset_before_phy_off: the power-down turns the LTSSM off and pulses * the soft power reset before the PHY powers down, as Google's * exynos_pcie_rc_poweroff() does for the zuma family. Only zumapro so @@ -180,6 +186,11 @@ MODULE_PARM_DESC(cmu_acg_off, struct gs201_pcie_soc_data { bool ctrl_reset_before_phy; bool pwr_reset_before_phy_off; + bool phy_supplies; + bool skip_cmu; + bool noncoherent_only; + bool skip_link_history; + unsigned int link_tries; }; struct gs201_pcie { @@ -198,6 +209,8 @@ struct gs201_pcie { int clks_on; struct phy *phy; struct gpio_desc *perst; + struct regulator_bulk_data supplies[2]; + bool supplies_on; bool coherent; bool phy_inited; bool phy_on; @@ -510,6 +523,14 @@ static int gs201_pcie_stage_clocks(struct gs201_pcie *gp) u32 opt; int ret; + if (gp->data->phy_supplies && !gp->supplies_on) { + gs201_trace(gp, "enable PCIe1 LDO17/LDO19 supplies"); + ret = regulator_bulk_enable(ARRAY_SIZE(gp->supplies), gp->supplies); + if (ret) + return ret; + gp->supplies_on = true; + } + if (gp->cmu) { gs201_trace(gp, "about to read CMU_HSI2 CONTROLLER_OPTION (0x14400800)"); opt = readl(gp->cmu + GS201_CMU_OPTION); @@ -767,17 +788,28 @@ static void gs201_pcie_bringdown(struct gs201_pcie *gp) gp->phy_inited = false; } gs201_pcie_clocks_off(gp); + if (gp->supplies_on) { + int ret; + + gs201_trace(gp, "release PCIe1 supply votes"); + ret = regulator_bulk_disable(ARRAY_SIZE(gp->supplies), gp->supplies); + if (ret) + dev_err(gp->pci.dev, "supply release failed: %d\n", ret); + else + gp->supplies_on = false; + } } static int gs201_pcie_start_link(struct dw_pcie *pci) { struct gs201_pcie *gp = to_gs201_pcie(pci); struct device *dev = pci->dev; + unsigned int tries = gp->data->link_tries ?: GS201_LINK_TRIES; unsigned int try; u32 val; int ret; - for (try = 1; try <= GS201_LINK_TRIES; try++) { + for (try = 1; try <= tries; try++) { gs201_trace(gp, "link try %u: about to write ELBI 0x054 = 1 and poll 0x2c8 for L0 (48 ms)", try); gs201_elbi_writel(gp, GS201_ELBI_LTSSM_EN, 1); @@ -793,7 +825,9 @@ static int gs201_pcie_start_link(struct dw_pcie *pci) dev_warn(dev, "link training failed (try %u), LTSSM %#lx\n", try, FIELD_GET(GS201_ELBI_LTSSM_STATE_MASK, val)); - if (try == GS201_LINK_TRIES) { + if (try == tries) { + if (gp->data->skip_link_history) + return ret; gs201_pcie_dump_history(gp); break; } @@ -1111,6 +1145,10 @@ static int gs201_pcie_get_cmu(struct gs201_pcie *gp) struct resource res; int ret; + /* gs101 has holes in the gs201 CMU gate range (including 0x20e0). */ + if (gp->data->skip_cmu) + return 0; + cmu_np = of_parse_phandle(dev->of_node, "samsung,cmu", 0); if (!cmu_np) return 0; @@ -1170,6 +1208,10 @@ static int gs201_pcie_probe(struct platform_device *pdev) raw_spin_lock_init(&gp->lock); gp->data = of_device_get_match_data(dev); + if (gp->data->noncoherent_only && + (cmu_acg_off || of_dma_is_coherent(np))) + return dev_err_probe(dev, -EINVAL, + "gs101 needs noncoherent DMA and no CMU override\n"); pci = &gp->pci; pci->dev = dev; @@ -1222,6 +1264,18 @@ static int gs201_pcie_probe(struct platform_device *pdev) return dev_err_probe(dev, PTR_ERR(gp->perst), "failed to get PERST# GPIO\n"); + if (gp->data->phy_supplies) { + if (!of_property_present(np, "vpcie0v85-supply") || + !of_property_present(np, "vpcie1v8-supply")) + return dev_err_probe(dev, -EINVAL, "missing PCIe1 supplies\n"); + gp->supplies[0].supply = "vpcie0v85"; + gp->supplies[1].supply = "vpcie1v8"; + ret = devm_regulator_bulk_get(dev, ARRAY_SIZE(gp->supplies), + gp->supplies); + if (ret) + return dev_err_probe(dev, ret, "PCIe1 supplies unavailable\n"); + } + /* The DWC core reads num-lanes in host_init; stages need it earlier */ if (of_property_read_u32(np, "num-lanes", &pci->num_lanes)) pci->num_lanes = 1; @@ -1255,6 +1309,18 @@ static void gs201_pcie_remove(struct platform_device *pdev) gs201_pcie_remove_irq(gp); } +/* + * Initial GS101 bring-up qualifies one link attempt. Retry power cycles and + * failure-path link-history reads are not qualified on this controller. + */ +static const struct gs201_pcie_soc_data gs101_pcie_data = { + .phy_supplies = true, + .skip_cmu = true, + .noncoherent_only = true, + .skip_link_history = true, + .link_tries = 1, +}; + static const struct gs201_pcie_soc_data gs201_pcie_data = { }; @@ -1268,6 +1334,7 @@ static const struct gs201_pcie_soc_data zumapro_pcie_data = { }; static const struct of_device_id gs201_pcie_of_match[] = { + { .compatible = "google,gs101-pcie", .data = &gs101_pcie_data }, { .compatible = "google,gs201-pcie", .data = &gs201_pcie_data }, { .compatible = "google,zumapro-pcie", .data = &zumapro_pcie_data }, { .compatible = "google,zuma-pcie", .data = &zuma_pcie_data },