1*75fb1a33SVinod Koul // SPDX-License-Identifier: GPL-2.0 2*75fb1a33SVinod Koul /* 3*75fb1a33SVinod Koul * SpacemiT K1 PCIe and PCIe/USB 3 combo PHY driver 4*75fb1a33SVinod Koul * 5*75fb1a33SVinod Koul * Copyright (C) 2025 by RISCstar Solutions Corporation. All rights reserved. 6*75fb1a33SVinod Koul */ 7*75fb1a33SVinod Koul 8*75fb1a33SVinod Koul #include <linux/bitfield.h> 9*75fb1a33SVinod Koul #include <linux/clk.h> 10*75fb1a33SVinod Koul #include <linux/clk-provider.h> 11*75fb1a33SVinod Koul #include <linux/iopoll.h> 12*75fb1a33SVinod Koul #include <linux/kernel.h> 13*75fb1a33SVinod Koul #include <linux/mfd/syscon.h> 14*75fb1a33SVinod Koul #include <linux/module.h> 15*75fb1a33SVinod Koul #include <linux/phy/phy.h> 16*75fb1a33SVinod Koul #include <linux/platform_device.h> 17*75fb1a33SVinod Koul #include <linux/regmap.h> 18*75fb1a33SVinod Koul #include <linux/reset.h> 19*75fb1a33SVinod Koul 20*75fb1a33SVinod Koul #include <dt-bindings/phy/phy.h> 21*75fb1a33SVinod Koul 22*75fb1a33SVinod Koul /* 23*75fb1a33SVinod Koul * Three PCIe ports are supported in the SpacemiT K1 SoC, and this driver 24*75fb1a33SVinod Koul * supports their PHYs. 25*75fb1a33SVinod Koul * 26*75fb1a33SVinod Koul * The PHY for PCIe port A is different from the PHYs for ports B and C: 27*75fb1a33SVinod Koul * - It has one lane, while ports B and C have two 28*75fb1a33SVinod Koul * - It is a combo PHY can be used for PCIe or USB 3 29*75fb1a33SVinod Koul * - It can automatically calibrate PCIe TX and RX termination settings 30*75fb1a33SVinod Koul * 31*75fb1a33SVinod Koul * The PHY functionality for PCIe ports B and C is identical: 32*75fb1a33SVinod Koul * - They have two PCIe lanes (but can be restricted to 1 via device tree) 33*75fb1a33SVinod Koul * - They are used for PCIe only 34*75fb1a33SVinod Koul * - They are configured using TX and RX values computed for port A 35*75fb1a33SVinod Koul * 36*75fb1a33SVinod Koul * A given board is designed to use the combo PHY for either PCIe or USB 3. 37*75fb1a33SVinod Koul * Whether the combo PHY is configured for PCIe or USB 3 is specified in 38*75fb1a33SVinod Koul * device tree using a phandle plus an argument. The argument indicates 39*75fb1a33SVinod Koul * the type (either PHY_TYPE_PCIE or PHY_TYPE_USB3). 40*75fb1a33SVinod Koul * 41*75fb1a33SVinod Koul * Each PHY has a reset that it gets and deasserts during initialization. 42*75fb1a33SVinod Koul * Each depends also on other clocks and resets provided by the controller 43*75fb1a33SVinod Koul * hardware (PCIe or USB) it is associated with. The controller drivers 44*75fb1a33SVinod Koul * are required to enable any clocks and de-assert any resets that affect 45*75fb1a33SVinod Koul * PHY operation. In addition each PHY implements an internal PLL, driven 46*75fb1a33SVinod Koul * by an external (24 MHz) oscillator. 47*75fb1a33SVinod Koul * 48*75fb1a33SVinod Koul * PCIe PHYs must be programmed with RX and TX calibration values. The 49*75fb1a33SVinod Koul * combo PHY is the only one that can determine these values. They are 50*75fb1a33SVinod Koul * determined by temporarily enabling the combo PHY in PCIe mode at probe 51*75fb1a33SVinod Koul * time (if necessary). This calibration only needs to be done once, and 52*75fb1a33SVinod Koul * when it has completed the TX and RX values are saved. 53*75fb1a33SVinod Koul * 54*75fb1a33SVinod Koul * To allow the combo PHY to be enabled for calibration, the resets and 55*75fb1a33SVinod Koul * clocks it uses in PCIe mode must be supplied. 56*75fb1a33SVinod Koul */ 57*75fb1a33SVinod Koul 58*75fb1a33SVinod Koul struct k1_pcie_phy { 59*75fb1a33SVinod Koul struct device *dev; /* PHY provider device */ 60*75fb1a33SVinod Koul struct phy *phy; 61*75fb1a33SVinod Koul void __iomem *regs; 62*75fb1a33SVinod Koul u32 pcie_lanes; /* Max (1 or 2) unless limited by DT */ 63*75fb1a33SVinod Koul struct clk *pll; 64*75fb1a33SVinod Koul struct clk_hw pll_hw; /* Private PLL clock */ 65*75fb1a33SVinod Koul 66*75fb1a33SVinod Koul /* The remaining fields are only used for the combo PHY */ 67*75fb1a33SVinod Koul u32 type; /* PHY_TYPE_PCIE or PHY_TYPE_USB3 */ 68*75fb1a33SVinod Koul struct regmap *pmu; /* MMIO regmap (no errors) */ 69*75fb1a33SVinod Koul }; 70*75fb1a33SVinod Koul 71*75fb1a33SVinod Koul #define CALIBRATION_TIMEOUT 500000 /* For combo PHY (usec) */ 72*75fb1a33SVinod Koul #define PLL_TIMEOUT 500000 /* For PHY PLL lock (usec) */ 73*75fb1a33SVinod Koul #define POLL_DELAY 500 /* Time between polls (usec) */ 74*75fb1a33SVinod Koul 75*75fb1a33SVinod Koul /* Selecting the combo PHY operating mode requires APMU regmap access */ 76*75fb1a33SVinod Koul #define SYSCON_APMU "spacemit,apmu" 77*75fb1a33SVinod Koul 78*75fb1a33SVinod Koul /* PMU space, for selecting between PCIe and USB 3 mode (combo PHY only) */ 79*75fb1a33SVinod Koul 80*75fb1a33SVinod Koul #define PMUA_USB_PHY_CTRL0 0x0110 81*75fb1a33SVinod Koul #define COMBO_PHY_SEL BIT(3) /* 0: PCIe; 1: USB 3 */ 82*75fb1a33SVinod Koul 83*75fb1a33SVinod Koul #define PCIE_CLK_RES_CTRL 0x03cc 84*75fb1a33SVinod Koul #define PCIE_APP_HOLD_PHY_RST BIT(30) 85*75fb1a33SVinod Koul 86*75fb1a33SVinod Koul /* PHY register space */ 87*75fb1a33SVinod Koul 88*75fb1a33SVinod Koul /* Offset between lane 0 and lane 1 registers when there are two */ 89*75fb1a33SVinod Koul #define PHY_LANE_OFFSET 0x0400 90*75fb1a33SVinod Koul 91*75fb1a33SVinod Koul /* PHY PLL configuration */ 92*75fb1a33SVinod Koul #define PCIE_PU_ADDR_CLK_CFG 0x0008 93*75fb1a33SVinod Koul #define PLL_READY BIT(0) /* read-only */ 94*75fb1a33SVinod Koul #define CFG_INTERNAL_TIMER_ADJ GENMASK(10, 7) 95*75fb1a33SVinod Koul #define TIMER_ADJ_USB 0x2 96*75fb1a33SVinod Koul #define TIMER_ADJ_PCIE 0x6 97*75fb1a33SVinod Koul #define CFG_SW_PHY_INIT_DONE BIT(11) /* We set after PLL config */ 98*75fb1a33SVinod Koul 99*75fb1a33SVinod Koul #define PCIE_RC_DONE_STATUS 0x0018 100*75fb1a33SVinod Koul #define CFG_FORCE_RCV_RETRY BIT(10) /* Used for PCIe */ 101*75fb1a33SVinod Koul 102*75fb1a33SVinod Koul /* PCIe PHY lane calibration; assumes 24MHz input clock */ 103*75fb1a33SVinod Koul #define PCIE_RC_CAL_REG2 0x0020 104*75fb1a33SVinod Koul #define RC_CAL_TOGGLE BIT(22) 105*75fb1a33SVinod Koul #define CLKSEL GENMASK(31, 29) 106*75fb1a33SVinod Koul #define CLKSEL_24M 0x3 107*75fb1a33SVinod Koul 108*75fb1a33SVinod Koul /* Additional PHY PLL configuration (USB 3 and PCIe) */ 109*75fb1a33SVinod Koul #define PCIE_PU_PLL_1 0x0048 110*75fb1a33SVinod Koul #define REF_100_WSSC BIT(12) /* 1: input is 100MHz, SSC */ 111*75fb1a33SVinod Koul #define FREF_SEL GENMASK(15, 13) 112*75fb1a33SVinod Koul #define FREF_24M 0x1 113*75fb1a33SVinod Koul #define SSC_DEP_SEL GENMASK(19, 16) 114*75fb1a33SVinod Koul #define SSC_DEP_NONE 0x0 115*75fb1a33SVinod Koul #define SSC_DEP_5000PPM 0xa 116*75fb1a33SVinod Koul 117*75fb1a33SVinod Koul /* PCIe PHY configuration */ 118*75fb1a33SVinod Koul #define PCIE_PU_PLL_2 0x004c 119*75fb1a33SVinod Koul #define GEN_REF100 BIT(4) /* 1: generate 100MHz clk */ 120*75fb1a33SVinod Koul 121*75fb1a33SVinod Koul #define PCIE_RX_REG1 0x0050 122*75fb1a33SVinod Koul #define EN_RTERM BIT(3) 123*75fb1a33SVinod Koul #define AFE_RTERM_REG GENMASK(11, 8) 124*75fb1a33SVinod Koul 125*75fb1a33SVinod Koul #define PCIE_RX_REG2 0x0054 126*75fb1a33SVinod Koul #define RX_RTERM_SEL BIT(5) /* 0: use AFE_RTERM_REG value */ 127*75fb1a33SVinod Koul 128*75fb1a33SVinod Koul #define PCIE_LTSSM_DIS_ENTRY 0x005c 129*75fb1a33SVinod Koul #define CFG_REFCLK_MODE GENMASK(9, 8) 130*75fb1a33SVinod Koul #define RFCLK_MODE_DRIVER 0x1 131*75fb1a33SVinod Koul #define OVRD_REFCLK_MODE BIT(10) /* 1: use CFG_RFCLK_MODE */ 132*75fb1a33SVinod Koul 133*75fb1a33SVinod Koul #define PCIE_TX_REG1 0x0064 134*75fb1a33SVinod Koul #define TX_RTERM_REG GENMASK(15, 12) 135*75fb1a33SVinod Koul #define TX_RTERM_SEL BIT(25) /* 1: use TX_RTERM_REG */ 136*75fb1a33SVinod Koul 137*75fb1a33SVinod Koul /* Zeroed for the combo PHY operating in USB mode */ 138*75fb1a33SVinod Koul #define USB3_TEST_CTRL 0x0068 139*75fb1a33SVinod Koul 140*75fb1a33SVinod Koul /* PHY calibration values, determined by the combo PHY at probe time */ 141*75fb1a33SVinod Koul #define PCIE_RCAL_RESULT 0x0084 /* Port A PHY only */ 142*75fb1a33SVinod Koul #define RTERM_VALUE_RX GENMASK(3, 0) 143*75fb1a33SVinod Koul #define RTERM_VALUE_TX GENMASK(7, 4) 144*75fb1a33SVinod Koul #define R_TUNE_DONE BIT(10) 145*75fb1a33SVinod Koul 146*75fb1a33SVinod Koul static u32 k1_phy_rterm = ~0; /* Invalid initial value */ 147*75fb1a33SVinod Koul 148*75fb1a33SVinod Koul /* Save the RX and TX receiver termination values */ 149*75fb1a33SVinod Koul static void k1_phy_rterm_set(u32 val) 150*75fb1a33SVinod Koul { 151*75fb1a33SVinod Koul k1_phy_rterm = val & (RTERM_VALUE_RX | RTERM_VALUE_TX); 152*75fb1a33SVinod Koul } 153*75fb1a33SVinod Koul 154*75fb1a33SVinod Koul static bool k1_phy_rterm_valid(void) 155*75fb1a33SVinod Koul { 156*75fb1a33SVinod Koul /* Valid if no bits outside those we care about are set */ 157*75fb1a33SVinod Koul return !(k1_phy_rterm & ~(RTERM_VALUE_RX | RTERM_VALUE_TX)); 158*75fb1a33SVinod Koul } 159*75fb1a33SVinod Koul 160*75fb1a33SVinod Koul static u32 k1_phy_rterm_rx(void) 161*75fb1a33SVinod Koul { 162*75fb1a33SVinod Koul return FIELD_GET(RTERM_VALUE_RX, k1_phy_rterm); 163*75fb1a33SVinod Koul } 164*75fb1a33SVinod Koul 165*75fb1a33SVinod Koul static u32 k1_phy_rterm_tx(void) 166*75fb1a33SVinod Koul { 167*75fb1a33SVinod Koul return FIELD_GET(RTERM_VALUE_TX, k1_phy_rterm); 168*75fb1a33SVinod Koul } 169*75fb1a33SVinod Koul 170*75fb1a33SVinod Koul /* Only the combo PHY has a PMU pointer defined */ 171*75fb1a33SVinod Koul static bool k1_phy_port_a(struct k1_pcie_phy *k1_phy) 172*75fb1a33SVinod Koul { 173*75fb1a33SVinod Koul return !!k1_phy->pmu; 174*75fb1a33SVinod Koul } 175*75fb1a33SVinod Koul 176*75fb1a33SVinod Koul /* The PLL clocks are driven by the external oscillator */ 177*75fb1a33SVinod Koul static const struct clk_parent_data k1_pcie_phy_data[] = { 178*75fb1a33SVinod Koul { .fw_name = "refclk", }, 179*75fb1a33SVinod Koul }; 180*75fb1a33SVinod Koul 181*75fb1a33SVinod Koul static struct k1_pcie_phy *clk_hw_to_k1_phy(struct clk_hw *clk_hw) 182*75fb1a33SVinod Koul { 183*75fb1a33SVinod Koul return container_of(clk_hw, struct k1_pcie_phy, pll_hw); 184*75fb1a33SVinod Koul } 185*75fb1a33SVinod Koul 186*75fb1a33SVinod Koul /* USB mode only works on the combo PHY, which has only one lane */ 187*75fb1a33SVinod Koul static void k1_pcie_phy_pll_prepare_usb(struct k1_pcie_phy *k1_phy) 188*75fb1a33SVinod Koul { 189*75fb1a33SVinod Koul void __iomem *regs = k1_phy->regs; 190*75fb1a33SVinod Koul u32 val; 191*75fb1a33SVinod Koul 192*75fb1a33SVinod Koul val = readl(regs + PCIE_PU_ADDR_CLK_CFG); 193*75fb1a33SVinod Koul val &= ~CFG_INTERNAL_TIMER_ADJ; 194*75fb1a33SVinod Koul val |= FIELD_PREP(CFG_INTERNAL_TIMER_ADJ, TIMER_ADJ_USB); 195*75fb1a33SVinod Koul writel(val, regs + PCIE_PU_ADDR_CLK_CFG); 196*75fb1a33SVinod Koul 197*75fb1a33SVinod Koul val = readl(regs + PCIE_PU_PLL_1); 198*75fb1a33SVinod Koul val &= ~SSC_DEP_SEL; 199*75fb1a33SVinod Koul val |= FIELD_PREP(SSC_DEP_SEL, SSC_DEP_5000PPM); 200*75fb1a33SVinod Koul writel(val, regs + PCIE_PU_PLL_1); 201*75fb1a33SVinod Koul } 202*75fb1a33SVinod Koul 203*75fb1a33SVinod Koul /* Perform PCIe-specific register updates before starting the PLL clock */ 204*75fb1a33SVinod Koul static void k1_pcie_phy_pll_prepare_pcie(struct k1_pcie_phy *k1_phy) 205*75fb1a33SVinod Koul { 206*75fb1a33SVinod Koul void __iomem *regs = k1_phy->regs; 207*75fb1a33SVinod Koul u32 val; 208*75fb1a33SVinod Koul u32 i; 209*75fb1a33SVinod Koul 210*75fb1a33SVinod Koul for (i = 0; i < k1_phy->pcie_lanes; i++) { 211*75fb1a33SVinod Koul val = readl(regs + PCIE_PU_ADDR_CLK_CFG); 212*75fb1a33SVinod Koul val &= ~CFG_INTERNAL_TIMER_ADJ; 213*75fb1a33SVinod Koul val |= FIELD_PREP(CFG_INTERNAL_TIMER_ADJ, TIMER_ADJ_PCIE); 214*75fb1a33SVinod Koul writel(val, regs + PCIE_PU_ADDR_CLK_CFG); 215*75fb1a33SVinod Koul 216*75fb1a33SVinod Koul regs += PHY_LANE_OFFSET; /* Next lane */ 217*75fb1a33SVinod Koul } 218*75fb1a33SVinod Koul 219*75fb1a33SVinod Koul regs = k1_phy->regs; 220*75fb1a33SVinod Koul val = readl(regs + PCIE_RC_DONE_STATUS); 221*75fb1a33SVinod Koul val |= CFG_FORCE_RCV_RETRY; 222*75fb1a33SVinod Koul writel(val, regs + PCIE_RC_DONE_STATUS); 223*75fb1a33SVinod Koul 224*75fb1a33SVinod Koul val = readl(regs + PCIE_PU_PLL_1); 225*75fb1a33SVinod Koul val &= ~SSC_DEP_SEL; 226*75fb1a33SVinod Koul val |= FIELD_PREP(SSC_DEP_SEL, SSC_DEP_NONE); 227*75fb1a33SVinod Koul writel(val, regs + PCIE_PU_PLL_1); 228*75fb1a33SVinod Koul 229*75fb1a33SVinod Koul val = readl(regs + PCIE_PU_PLL_2); 230*75fb1a33SVinod Koul val |= GEN_REF100; /* Enable 100 MHz PLL output clock */ 231*75fb1a33SVinod Koul writel(val, regs + PCIE_PU_PLL_2); 232*75fb1a33SVinod Koul } 233*75fb1a33SVinod Koul 234*75fb1a33SVinod Koul static int k1_pcie_phy_pll_prepare(struct clk_hw *clk_hw) 235*75fb1a33SVinod Koul { 236*75fb1a33SVinod Koul struct k1_pcie_phy *k1_phy = clk_hw_to_k1_phy(clk_hw); 237*75fb1a33SVinod Koul void __iomem *regs = k1_phy->regs; 238*75fb1a33SVinod Koul u32 val; 239*75fb1a33SVinod Koul u32 i; 240*75fb1a33SVinod Koul 241*75fb1a33SVinod Koul if (k1_phy_port_a(k1_phy) && k1_phy->type == PHY_TYPE_USB3) 242*75fb1a33SVinod Koul k1_pcie_phy_pll_prepare_usb(k1_phy); 243*75fb1a33SVinod Koul else 244*75fb1a33SVinod Koul k1_pcie_phy_pll_prepare_pcie(k1_phy); 245*75fb1a33SVinod Koul 246*75fb1a33SVinod Koul /* 247*75fb1a33SVinod Koul * Disable 100 MHz input reference with spread-spectrum 248*75fb1a33SVinod Koul * clocking and select the 24 MHz clock input frequency 249*75fb1a33SVinod Koul */ 250*75fb1a33SVinod Koul val = readl(regs + PCIE_PU_PLL_1); 251*75fb1a33SVinod Koul val &= ~REF_100_WSSC; 252*75fb1a33SVinod Koul val &= ~FREF_SEL; 253*75fb1a33SVinod Koul val |= FIELD_PREP(FREF_SEL, FREF_24M); 254*75fb1a33SVinod Koul writel(val, regs + PCIE_PU_PLL_1); 255*75fb1a33SVinod Koul 256*75fb1a33SVinod Koul /* Mark PLL configuration done on all lanes */ 257*75fb1a33SVinod Koul for (i = 0; i < k1_phy->pcie_lanes; i++) { 258*75fb1a33SVinod Koul val = readl(regs + PCIE_PU_ADDR_CLK_CFG); 259*75fb1a33SVinod Koul val |= CFG_SW_PHY_INIT_DONE; 260*75fb1a33SVinod Koul writel(val, regs + PCIE_PU_ADDR_CLK_CFG); 261*75fb1a33SVinod Koul 262*75fb1a33SVinod Koul regs += PHY_LANE_OFFSET; /* Next lane */ 263*75fb1a33SVinod Koul } 264*75fb1a33SVinod Koul 265*75fb1a33SVinod Koul /* 266*75fb1a33SVinod Koul * Wait for indication the PHY PLL is locked. Lanes for ports 267*75fb1a33SVinod Koul * B and C share a PLL, so it's enough to sample just lane 0. 268*75fb1a33SVinod Koul */ 269*75fb1a33SVinod Koul return readl_poll_timeout(k1_phy->regs + PCIE_PU_ADDR_CLK_CFG, 270*75fb1a33SVinod Koul val, val & PLL_READY, 271*75fb1a33SVinod Koul POLL_DELAY, PLL_TIMEOUT); 272*75fb1a33SVinod Koul } 273*75fb1a33SVinod Koul 274*75fb1a33SVinod Koul /* Prepare implies enable, and once enabled, it's always on */ 275*75fb1a33SVinod Koul static const struct clk_ops k1_pcie_phy_pll_ops = { 276*75fb1a33SVinod Koul .prepare = k1_pcie_phy_pll_prepare, 277*75fb1a33SVinod Koul }; 278*75fb1a33SVinod Koul 279*75fb1a33SVinod Koul /* We represent the PHY PLL as a private clock */ 280*75fb1a33SVinod Koul static int k1_pcie_phy_pll_setup(struct k1_pcie_phy *k1_phy) 281*75fb1a33SVinod Koul { 282*75fb1a33SVinod Koul struct clk_hw *hw = &k1_phy->pll_hw; 283*75fb1a33SVinod Koul struct device *dev = k1_phy->dev; 284*75fb1a33SVinod Koul struct clk_init_data init = { }; 285*75fb1a33SVinod Koul char *name; 286*75fb1a33SVinod Koul int ret; 287*75fb1a33SVinod Koul 288*75fb1a33SVinod Koul name = kasprintf(GFP_KERNEL, "pcie%u_phy_pll", k1_phy->phy->id); 289*75fb1a33SVinod Koul if (!name) 290*75fb1a33SVinod Koul return -ENOMEM; 291*75fb1a33SVinod Koul 292*75fb1a33SVinod Koul init.name = name; 293*75fb1a33SVinod Koul init.ops = &k1_pcie_phy_pll_ops; 294*75fb1a33SVinod Koul init.parent_data = k1_pcie_phy_data; 295*75fb1a33SVinod Koul init.num_parents = ARRAY_SIZE(k1_pcie_phy_data); 296*75fb1a33SVinod Koul 297*75fb1a33SVinod Koul hw->init = &init; 298*75fb1a33SVinod Koul 299*75fb1a33SVinod Koul ret = devm_clk_hw_register(dev, hw); 300*75fb1a33SVinod Koul 301*75fb1a33SVinod Koul kfree(name); /* __clk_register() duplicates the name we provide */ 302*75fb1a33SVinod Koul 303*75fb1a33SVinod Koul if (ret) 304*75fb1a33SVinod Koul return ret; 305*75fb1a33SVinod Koul 306*75fb1a33SVinod Koul k1_phy->pll = devm_clk_hw_get_clk(dev, hw, "pll"); 307*75fb1a33SVinod Koul if (IS_ERR(k1_phy->pll)) 308*75fb1a33SVinod Koul return PTR_ERR(k1_phy->pll); 309*75fb1a33SVinod Koul 310*75fb1a33SVinod Koul return 0; 311*75fb1a33SVinod Koul } 312*75fb1a33SVinod Koul 313*75fb1a33SVinod Koul /* Select PCIe or USB 3 mode for the combo PHY. */ 314*75fb1a33SVinod Koul static void k1_combo_phy_sel(struct k1_pcie_phy *k1_phy, bool usb) 315*75fb1a33SVinod Koul { 316*75fb1a33SVinod Koul struct regmap *pmu = k1_phy->pmu; 317*75fb1a33SVinod Koul 318*75fb1a33SVinod Koul /* Only change it if it's not already in the desired state */ 319*75fb1a33SVinod Koul if (!regmap_test_bits(pmu, PMUA_USB_PHY_CTRL0, COMBO_PHY_SEL) == usb) 320*75fb1a33SVinod Koul regmap_assign_bits(pmu, PMUA_USB_PHY_CTRL0, COMBO_PHY_SEL, usb); 321*75fb1a33SVinod Koul } 322*75fb1a33SVinod Koul 323*75fb1a33SVinod Koul static void k1_pcie_phy_init_pcie(struct k1_pcie_phy *k1_phy) 324*75fb1a33SVinod Koul { 325*75fb1a33SVinod Koul u32 rx_rterm = k1_phy_rterm_rx(); 326*75fb1a33SVinod Koul u32 tx_rterm = k1_phy_rterm_tx(); 327*75fb1a33SVinod Koul void __iomem *regs; 328*75fb1a33SVinod Koul u32 val; 329*75fb1a33SVinod Koul int i; 330*75fb1a33SVinod Koul 331*75fb1a33SVinod Koul /* For the combo PHY, set PHY to PCIe mode */ 332*75fb1a33SVinod Koul if (k1_phy_port_a(k1_phy)) 333*75fb1a33SVinod Koul k1_combo_phy_sel(k1_phy, false); 334*75fb1a33SVinod Koul 335*75fb1a33SVinod Koul regs = k1_phy->regs; 336*75fb1a33SVinod Koul for (i = 0; i < k1_phy->pcie_lanes; i++) { 337*75fb1a33SVinod Koul val = readl(regs + PCIE_RX_REG1); 338*75fb1a33SVinod Koul 339*75fb1a33SVinod Koul /* Set RX analog front-end receiver termination value */ 340*75fb1a33SVinod Koul val &= ~AFE_RTERM_REG; 341*75fb1a33SVinod Koul val |= FIELD_PREP(AFE_RTERM_REG, rx_rterm); 342*75fb1a33SVinod Koul 343*75fb1a33SVinod Koul /* And enable refclock receiver termination */ 344*75fb1a33SVinod Koul val |= EN_RTERM; 345*75fb1a33SVinod Koul writel(val, regs + PCIE_RX_REG1); 346*75fb1a33SVinod Koul 347*75fb1a33SVinod Koul val = readl(regs + PCIE_RX_REG2); 348*75fb1a33SVinod Koul /* Use PCIE_RX_REG1 AFE_RTERM_REG value */ 349*75fb1a33SVinod Koul val &= ~RX_RTERM_SEL; 350*75fb1a33SVinod Koul writel(val, regs + PCIE_RX_REG2); 351*75fb1a33SVinod Koul 352*75fb1a33SVinod Koul val = readl(regs + PCIE_TX_REG1); 353*75fb1a33SVinod Koul 354*75fb1a33SVinod Koul /* Set TX driver termination value */ 355*75fb1a33SVinod Koul val &= ~TX_RTERM_REG; 356*75fb1a33SVinod Koul val |= FIELD_PREP(TX_RTERM_REG, tx_rterm); 357*75fb1a33SVinod Koul 358*75fb1a33SVinod Koul /* Use PCIE_TX_REG1 TX_RTERM_REG value */ 359*75fb1a33SVinod Koul val |= TX_RTERM_SEL; 360*75fb1a33SVinod Koul writel(val, regs + PCIE_TX_REG1); 361*75fb1a33SVinod Koul 362*75fb1a33SVinod Koul /* Set the input clock to 24 MHz, and clear RC_CAL_TOGGLE */ 363*75fb1a33SVinod Koul val = readl(regs + PCIE_RC_CAL_REG2); 364*75fb1a33SVinod Koul val &= CLKSEL; 365*75fb1a33SVinod Koul val |= FIELD_PREP(CLKSEL, CLKSEL_24M); 366*75fb1a33SVinod Koul val &= ~RC_CAL_TOGGLE; 367*75fb1a33SVinod Koul writel(val, regs + PCIE_RC_CAL_REG2); 368*75fb1a33SVinod Koul 369*75fb1a33SVinod Koul /* Now trigger recalibration by setting RC_CAL_TOGGLE again */ 370*75fb1a33SVinod Koul val |= RC_CAL_TOGGLE; 371*75fb1a33SVinod Koul writel(val, regs + PCIE_RC_CAL_REG2); 372*75fb1a33SVinod Koul 373*75fb1a33SVinod Koul val = readl(regs + PCIE_LTSSM_DIS_ENTRY); 374*75fb1a33SVinod Koul /* Override the reference clock; set to refclk driver mode */ 375*75fb1a33SVinod Koul val |= OVRD_REFCLK_MODE; 376*75fb1a33SVinod Koul val &= ~CFG_REFCLK_MODE; 377*75fb1a33SVinod Koul val |= FIELD_PREP(CFG_REFCLK_MODE, RFCLK_MODE_DRIVER); 378*75fb1a33SVinod Koul writel(val, regs + PCIE_LTSSM_DIS_ENTRY); 379*75fb1a33SVinod Koul 380*75fb1a33SVinod Koul regs += PHY_LANE_OFFSET; /* Next lane */ 381*75fb1a33SVinod Koul } 382*75fb1a33SVinod Koul } 383*75fb1a33SVinod Koul 384*75fb1a33SVinod Koul /* Only called for combo PHY */ 385*75fb1a33SVinod Koul static void k1_pcie_phy_init_usb(struct k1_pcie_phy *k1_phy) 386*75fb1a33SVinod Koul { 387*75fb1a33SVinod Koul k1_combo_phy_sel(k1_phy, true); 388*75fb1a33SVinod Koul 389*75fb1a33SVinod Koul /* We're not doing any testing */ 390*75fb1a33SVinod Koul writel(0, k1_phy->regs + USB3_TEST_CTRL); 391*75fb1a33SVinod Koul } 392*75fb1a33SVinod Koul 393*75fb1a33SVinod Koul static int k1_pcie_phy_init(struct phy *phy) 394*75fb1a33SVinod Koul { 395*75fb1a33SVinod Koul struct k1_pcie_phy *k1_phy = phy_get_drvdata(phy); 396*75fb1a33SVinod Koul 397*75fb1a33SVinod Koul /* Note: port type is only valid for port A (both checks needed) */ 398*75fb1a33SVinod Koul if (k1_phy_port_a(k1_phy) && k1_phy->type == PHY_TYPE_USB3) 399*75fb1a33SVinod Koul k1_pcie_phy_init_usb(k1_phy); 400*75fb1a33SVinod Koul else 401*75fb1a33SVinod Koul k1_pcie_phy_init_pcie(k1_phy); 402*75fb1a33SVinod Koul 403*75fb1a33SVinod Koul 404*75fb1a33SVinod Koul return clk_prepare_enable(k1_phy->pll); 405*75fb1a33SVinod Koul } 406*75fb1a33SVinod Koul 407*75fb1a33SVinod Koul static int k1_pcie_phy_exit(struct phy *phy) 408*75fb1a33SVinod Koul { 409*75fb1a33SVinod Koul struct k1_pcie_phy *k1_phy = phy_get_drvdata(phy); 410*75fb1a33SVinod Koul 411*75fb1a33SVinod Koul clk_disable_unprepare(k1_phy->pll); 412*75fb1a33SVinod Koul 413*75fb1a33SVinod Koul return 0; 414*75fb1a33SVinod Koul } 415*75fb1a33SVinod Koul 416*75fb1a33SVinod Koul static const struct phy_ops k1_pcie_phy_ops = { 417*75fb1a33SVinod Koul .init = k1_pcie_phy_init, 418*75fb1a33SVinod Koul .exit = k1_pcie_phy_exit, 419*75fb1a33SVinod Koul .owner = THIS_MODULE, 420*75fb1a33SVinod Koul }; 421*75fb1a33SVinod Koul 422*75fb1a33SVinod Koul /* 423*75fb1a33SVinod Koul * Get values needed for calibrating PHYs operating in PCIe mode. Only 424*75fb1a33SVinod Koul * the combo PHY is able to do this, and its calibration values are used 425*75fb1a33SVinod Koul * for configuring all PCIe PHYs. 426*75fb1a33SVinod Koul * 427*75fb1a33SVinod Koul * We always need to de-assert the "global" reset on the combo PHY, 428*75fb1a33SVinod Koul * because the USB driver depends on it. If used for PCIe, that driver 429*75fb1a33SVinod Koul * will (also) de-assert this, but by leaving it de-asserted for the 430*75fb1a33SVinod Koul * combo PHY, the USB driver doesn't have to do this. Note: although 431*75fb1a33SVinod Koul * SpacemiT refers to this as the global reset, we name the "phy" reset. 432*75fb1a33SVinod Koul * 433*75fb1a33SVinod Koul * In addition, we guarantee the APP_HOLD_PHY_RESET bit is clear for the 434*75fb1a33SVinod Koul * combo PHY, so the USB driver doesn't have to manage that either. The 435*75fb1a33SVinod Koul * PCIe driver is free to change this bit for normal operation. 436*75fb1a33SVinod Koul * 437*75fb1a33SVinod Koul * Calibration only needs to be done once. It's possible calibration has 438*75fb1a33SVinod Koul * already completed (e.g., it might have happened in the boot loader, or 439*75fb1a33SVinod Koul * -EPROBE_DEFER might result in this function being called again). So we 440*75fb1a33SVinod Koul * check that early too, to avoid doing it more than once. 441*75fb1a33SVinod Koul * 442*75fb1a33SVinod Koul * Otherwise we temporarily power up the PHY using the PCIe app clocks 443*75fb1a33SVinod Koul * and resets, wait for the hardware to indicate calibration is done, 444*75fb1a33SVinod Koul * grab the value, then shut the PHY down again. 445*75fb1a33SVinod Koul */ 446*75fb1a33SVinod Koul static int k1_pcie_combo_phy_calibrate(struct k1_pcie_phy *k1_phy) 447*75fb1a33SVinod Koul { 448*75fb1a33SVinod Koul struct reset_control_bulk_data resets[] = { 449*75fb1a33SVinod Koul { .id = "dbi", }, 450*75fb1a33SVinod Koul { .id = "mstr", }, 451*75fb1a33SVinod Koul { .id = "slv", }, 452*75fb1a33SVinod Koul }; 453*75fb1a33SVinod Koul struct clk_bulk_data clocks[] = { 454*75fb1a33SVinod Koul { .id = "dbi", }, 455*75fb1a33SVinod Koul { .id = "mstr", }, 456*75fb1a33SVinod Koul { .id = "slv", }, 457*75fb1a33SVinod Koul }; 458*75fb1a33SVinod Koul struct device *dev = k1_phy->dev; 459*75fb1a33SVinod Koul int ret = 0; 460*75fb1a33SVinod Koul int val; 461*75fb1a33SVinod Koul 462*75fb1a33SVinod Koul /* Nothing to do if we already set the receiver termination value */ 463*75fb1a33SVinod Koul if (k1_phy_rterm_valid()) 464*75fb1a33SVinod Koul return 0; 465*75fb1a33SVinod Koul 466*75fb1a33SVinod Koul /* 467*75fb1a33SVinod Koul * We also guarantee the APP_HOLD_PHY_RESET bit is clear. We can 468*75fb1a33SVinod Koul * leave this bit clear even if an error happens below. 469*75fb1a33SVinod Koul */ 470*75fb1a33SVinod Koul regmap_assign_bits(k1_phy->pmu, PCIE_CLK_RES_CTRL, 471*75fb1a33SVinod Koul PCIE_APP_HOLD_PHY_RST, false); 472*75fb1a33SVinod Koul 473*75fb1a33SVinod Koul /* If the calibration already completed (e.g. by U-Boot), we're done */ 474*75fb1a33SVinod Koul val = readl(k1_phy->regs + PCIE_RCAL_RESULT); 475*75fb1a33SVinod Koul if (val & R_TUNE_DONE) 476*75fb1a33SVinod Koul goto out_tune_done; 477*75fb1a33SVinod Koul 478*75fb1a33SVinod Koul /* Put the PHY into PCIe mode */ 479*75fb1a33SVinod Koul k1_combo_phy_sel(k1_phy, false); 480*75fb1a33SVinod Koul 481*75fb1a33SVinod Koul /* Get and enable the PCIe app clocks */ 482*75fb1a33SVinod Koul ret = clk_bulk_get(dev, ARRAY_SIZE(clocks), clocks); 483*75fb1a33SVinod Koul if (ret < 0) 484*75fb1a33SVinod Koul goto out_tune_done; 485*75fb1a33SVinod Koul ret = clk_bulk_prepare_enable(ARRAY_SIZE(clocks), clocks); 486*75fb1a33SVinod Koul if (ret) 487*75fb1a33SVinod Koul goto out_put_clocks; 488*75fb1a33SVinod Koul 489*75fb1a33SVinod Koul /* Get the PCIe application resets (not the PHY reset) */ 490*75fb1a33SVinod Koul ret = reset_control_bulk_get_shared(dev, ARRAY_SIZE(resets), resets); 491*75fb1a33SVinod Koul if (ret) 492*75fb1a33SVinod Koul goto out_disable_clocks; 493*75fb1a33SVinod Koul 494*75fb1a33SVinod Koul /* De-assert the PCIe application resets */ 495*75fb1a33SVinod Koul ret = reset_control_bulk_deassert(ARRAY_SIZE(resets), resets); 496*75fb1a33SVinod Koul if (ret) 497*75fb1a33SVinod Koul goto out_put_resets; 498*75fb1a33SVinod Koul 499*75fb1a33SVinod Koul /* 500*75fb1a33SVinod Koul * This is the core activity here. Wait for the hardware to 501*75fb1a33SVinod Koul * signal that it has completed calibration/tuning. Once it 502*75fb1a33SVinod Koul * has, the register value will contain the values we'll 503*75fb1a33SVinod Koul * use to configure PCIe PHYs. 504*75fb1a33SVinod Koul */ 505*75fb1a33SVinod Koul ret = readl_poll_timeout(k1_phy->regs + PCIE_RCAL_RESULT, 506*75fb1a33SVinod Koul val, val & R_TUNE_DONE, 507*75fb1a33SVinod Koul POLL_DELAY, CALIBRATION_TIMEOUT); 508*75fb1a33SVinod Koul 509*75fb1a33SVinod Koul /* Clean up. We're done with the resets and clocks */ 510*75fb1a33SVinod Koul reset_control_bulk_assert(ARRAY_SIZE(resets), resets); 511*75fb1a33SVinod Koul out_put_resets: 512*75fb1a33SVinod Koul reset_control_bulk_put(ARRAY_SIZE(resets), resets); 513*75fb1a33SVinod Koul out_disable_clocks: 514*75fb1a33SVinod Koul clk_bulk_disable_unprepare(ARRAY_SIZE(clocks), clocks); 515*75fb1a33SVinod Koul out_put_clocks: 516*75fb1a33SVinod Koul clk_bulk_put(ARRAY_SIZE(clocks), clocks); 517*75fb1a33SVinod Koul out_tune_done: 518*75fb1a33SVinod Koul /* If we got the value without timing out, set k1_phy_rterm */ 519*75fb1a33SVinod Koul if (!ret) 520*75fb1a33SVinod Koul k1_phy_rterm_set(val); 521*75fb1a33SVinod Koul 522*75fb1a33SVinod Koul return ret; 523*75fb1a33SVinod Koul } 524*75fb1a33SVinod Koul 525*75fb1a33SVinod Koul static struct phy * 526*75fb1a33SVinod Koul k1_pcie_combo_phy_xlate(struct device *dev, const struct of_phandle_args *args) 527*75fb1a33SVinod Koul { 528*75fb1a33SVinod Koul struct k1_pcie_phy *k1_phy = dev_get_drvdata(dev); 529*75fb1a33SVinod Koul u32 type; 530*75fb1a33SVinod Koul 531*75fb1a33SVinod Koul /* The argument specifying the PHY mode is required */ 532*75fb1a33SVinod Koul if (args->args_count != 1) 533*75fb1a33SVinod Koul return ERR_PTR(-EINVAL); 534*75fb1a33SVinod Koul 535*75fb1a33SVinod Koul /* We only support PCIe and USB 3 mode */ 536*75fb1a33SVinod Koul type = args->args[0]; 537*75fb1a33SVinod Koul if (type != PHY_TYPE_PCIE && type != PHY_TYPE_USB3) 538*75fb1a33SVinod Koul return ERR_PTR(-EINVAL); 539*75fb1a33SVinod Koul 540*75fb1a33SVinod Koul /* This PHY can only be used once */ 541*75fb1a33SVinod Koul if (k1_phy->type != PHY_NONE) 542*75fb1a33SVinod Koul return ERR_PTR(-EBUSY); 543*75fb1a33SVinod Koul 544*75fb1a33SVinod Koul k1_phy->type = type; 545*75fb1a33SVinod Koul 546*75fb1a33SVinod Koul return k1_phy->phy; 547*75fb1a33SVinod Koul } 548*75fb1a33SVinod Koul 549*75fb1a33SVinod Koul /* Use the maximum number of PCIe lanes unless limited by device tree */ 550*75fb1a33SVinod Koul static u32 k1_pcie_num_lanes(struct k1_pcie_phy *k1_phy, bool port_a) 551*75fb1a33SVinod Koul { 552*75fb1a33SVinod Koul struct device *dev = k1_phy->dev; 553*75fb1a33SVinod Koul u32 count = 0; 554*75fb1a33SVinod Koul u32 max; 555*75fb1a33SVinod Koul int ret; 556*75fb1a33SVinod Koul 557*75fb1a33SVinod Koul ret = of_property_read_u32(dev_of_node(dev), "num-lanes", &count); 558*75fb1a33SVinod Koul if (count == 1) 559*75fb1a33SVinod Koul return 1; 560*75fb1a33SVinod Koul 561*75fb1a33SVinod Koul if (count == 2 && !port_a) 562*75fb1a33SVinod Koul return 2; 563*75fb1a33SVinod Koul 564*75fb1a33SVinod Koul max = port_a ? 1 : 2; 565*75fb1a33SVinod Koul if (ret != -EINVAL) 566*75fb1a33SVinod Koul dev_warn(dev, "bad lane count %u for port; using %u\n", 567*75fb1a33SVinod Koul count, max); 568*75fb1a33SVinod Koul 569*75fb1a33SVinod Koul return max; 570*75fb1a33SVinod Koul } 571*75fb1a33SVinod Koul 572*75fb1a33SVinod Koul static int k1_pcie_combo_phy_probe(struct k1_pcie_phy *k1_phy) 573*75fb1a33SVinod Koul { 574*75fb1a33SVinod Koul struct device *dev = k1_phy->dev; 575*75fb1a33SVinod Koul struct regmap *regmap; 576*75fb1a33SVinod Koul int ret; 577*75fb1a33SVinod Koul 578*75fb1a33SVinod Koul /* Setting the PHY mode requires access to the PMU regmap */ 579*75fb1a33SVinod Koul regmap = syscon_regmap_lookup_by_phandle(dev_of_node(dev), SYSCON_APMU); 580*75fb1a33SVinod Koul if (IS_ERR(regmap)) 581*75fb1a33SVinod Koul return dev_err_probe(dev, PTR_ERR(regmap), "failed to get PMU\n"); 582*75fb1a33SVinod Koul k1_phy->pmu = regmap; 583*75fb1a33SVinod Koul 584*75fb1a33SVinod Koul ret = k1_pcie_combo_phy_calibrate(k1_phy); 585*75fb1a33SVinod Koul if (ret) 586*75fb1a33SVinod Koul return dev_err_probe(dev, ret, "calibration failed\n"); 587*75fb1a33SVinod Koul 588*75fb1a33SVinod Koul /* Needed by k1_pcie_combo_phy_xlate(), which also sets k1_phy->type */ 589*75fb1a33SVinod Koul dev_set_drvdata(dev, k1_phy); 590*75fb1a33SVinod Koul 591*75fb1a33SVinod Koul return 0; 592*75fb1a33SVinod Koul } 593*75fb1a33SVinod Koul 594*75fb1a33SVinod Koul static int k1_pcie_phy_probe(struct platform_device *pdev) 595*75fb1a33SVinod Koul { 596*75fb1a33SVinod Koul struct phy *(*xlate)(struct device *dev, 597*75fb1a33SVinod Koul const struct of_phandle_args *args); 598*75fb1a33SVinod Koul struct device *dev = &pdev->dev; 599*75fb1a33SVinod Koul struct reset_control *phy_reset; 600*75fb1a33SVinod Koul struct phy_provider *provider; 601*75fb1a33SVinod Koul struct k1_pcie_phy *k1_phy; 602*75fb1a33SVinod Koul bool probing_port_a; 603*75fb1a33SVinod Koul int ret; 604*75fb1a33SVinod Koul 605*75fb1a33SVinod Koul xlate = of_device_get_match_data(dev); 606*75fb1a33SVinod Koul probing_port_a = xlate == k1_pcie_combo_phy_xlate; 607*75fb1a33SVinod Koul 608*75fb1a33SVinod Koul /* Only the combo PHY can calibrate, so it must probe first */ 609*75fb1a33SVinod Koul if (!k1_phy_rterm_valid() && !probing_port_a) 610*75fb1a33SVinod Koul return -EPROBE_DEFER; 611*75fb1a33SVinod Koul 612*75fb1a33SVinod Koul k1_phy = devm_kzalloc(dev, sizeof(*k1_phy), GFP_KERNEL); 613*75fb1a33SVinod Koul if (!k1_phy) 614*75fb1a33SVinod Koul return -ENOMEM; 615*75fb1a33SVinod Koul k1_phy->dev = dev; 616*75fb1a33SVinod Koul 617*75fb1a33SVinod Koul k1_phy->regs = devm_platform_ioremap_resource(pdev, 0); 618*75fb1a33SVinod Koul if (IS_ERR(k1_phy->regs)) 619*75fb1a33SVinod Koul return dev_err_probe(dev, PTR_ERR(k1_phy->regs), 620*75fb1a33SVinod Koul "error mapping registers\n"); 621*75fb1a33SVinod Koul 622*75fb1a33SVinod Koul /* De-assert the PHY (global) reset and leave it that way */ 623*75fb1a33SVinod Koul phy_reset = devm_reset_control_get_exclusive_deasserted(dev, "phy"); 624*75fb1a33SVinod Koul if (IS_ERR(phy_reset)) 625*75fb1a33SVinod Koul return PTR_ERR(phy_reset); 626*75fb1a33SVinod Koul 627*75fb1a33SVinod Koul if (probing_port_a) { 628*75fb1a33SVinod Koul ret = k1_pcie_combo_phy_probe(k1_phy); 629*75fb1a33SVinod Koul if (ret) 630*75fb1a33SVinod Koul return dev_err_probe(dev, ret, 631*75fb1a33SVinod Koul "error probing combo phy\n"); 632*75fb1a33SVinod Koul } 633*75fb1a33SVinod Koul 634*75fb1a33SVinod Koul k1_phy->pcie_lanes = k1_pcie_num_lanes(k1_phy, probing_port_a); 635*75fb1a33SVinod Koul 636*75fb1a33SVinod Koul k1_phy->phy = devm_phy_create(dev, NULL, &k1_pcie_phy_ops); 637*75fb1a33SVinod Koul if (IS_ERR(k1_phy->phy)) 638*75fb1a33SVinod Koul return dev_err_probe(dev, PTR_ERR(k1_phy->phy), 639*75fb1a33SVinod Koul "error creating phy\n"); 640*75fb1a33SVinod Koul phy_set_drvdata(k1_phy->phy, k1_phy); 641*75fb1a33SVinod Koul 642*75fb1a33SVinod Koul ret = k1_pcie_phy_pll_setup(k1_phy); 643*75fb1a33SVinod Koul if (ret) 644*75fb1a33SVinod Koul return dev_err_probe(dev, ret, "error initializing clock\n"); 645*75fb1a33SVinod Koul 646*75fb1a33SVinod Koul provider = devm_of_phy_provider_register(dev, xlate); 647*75fb1a33SVinod Koul if (IS_ERR(provider)) 648*75fb1a33SVinod Koul return dev_err_probe(dev, PTR_ERR(provider), 649*75fb1a33SVinod Koul "error registering provider\n"); 650*75fb1a33SVinod Koul return 0; 651*75fb1a33SVinod Koul } 652*75fb1a33SVinod Koul 653*75fb1a33SVinod Koul static const struct of_device_id k1_pcie_phy_of_match[] = { 654*75fb1a33SVinod Koul { .compatible = "spacemit,k1-combo-phy", k1_pcie_combo_phy_xlate, }, 655*75fb1a33SVinod Koul { .compatible = "spacemit,k1-pcie-phy", of_phy_simple_xlate, }, 656*75fb1a33SVinod Koul { }, 657*75fb1a33SVinod Koul }; 658*75fb1a33SVinod Koul MODULE_DEVICE_TABLE(of, k1_pcie_phy_of_match); 659*75fb1a33SVinod Koul 660*75fb1a33SVinod Koul static struct platform_driver k1_pcie_phy_driver = { 661*75fb1a33SVinod Koul .probe = k1_pcie_phy_probe, 662*75fb1a33SVinod Koul .driver = { 663*75fb1a33SVinod Koul .of_match_table = k1_pcie_phy_of_match, 664*75fb1a33SVinod Koul .name = "spacemit-k1-pcie-phy", 665*75fb1a33SVinod Koul } 666*75fb1a33SVinod Koul }; 667*75fb1a33SVinod Koul module_platform_driver(k1_pcie_phy_driver); 668*75fb1a33SVinod Koul 669*75fb1a33SVinod Koul MODULE_DESCRIPTION("SpacemiT K1 PCIe and USB 3 PHY driver"); 670*75fb1a33SVinod Koul MODULE_LICENSE("GPL"); 671