PHY: Add support for SERDES in TI's J721E SoC
Subsystems (2)
v4 cover PHY: Add support for SERDES in TI's J721E SoC
TI's J721E SoC uses Cadence Sierra SERDES for USB, PCIe and SGMII. TI has a wrapper named WIZ to control input signals to Sierra and Torrent SERDES.
This patch series:
1) Add support to WIZ module present in TI's J721E SoC
2) Adapt Cadence Sierra PHY driver to be used for J721E SoC
Changes from v3:
*) Fix Rob's comments on dt bindings
-> Add properties to be added in WIZ child nodes to binding
-> Use '-' rather than '_' in node namesChanges from v2:
*) Deprecate "phy_clk" binding
*) Fix Rob's comment on dt bindings
-> Include BSD-2-Clause license identifier
-> drop "oneOf" and "items" for compatible
-> Fixed "num-lanes" to include only scalar keywords
-> Change to 32-bit address space for child nodes*) Rename cmn_refclk/cmn_refclk1 to cmn_refclk_dig_div/
cmn_refclk1_dig_div
Changes from v1:
*) Change the dt binding Documentation of WIZ wrapper to YAML format *) Fix an issue in Sierra while doimg rmmod
The series has also been pushed to
https://github.com/kishon/linux-wip.git j7_serdes_v4
Anil Varughese (1):
phy: cadence: Sierra: Configure both lane cdb and common cdb registers
for external SSC
Kishon Vijay Abraham I (13):
dt-bindings: phy: Sierra: Add bindings for Sierra in TI's J721E
phy: cadence: Sierra: Make "phy_clk" and "sierra_apb" optional
resources
phy: cadence: Sierra: Use "regmap" for read and write to Sierra
registers
phy: cadence: Sierra: Add support for SERDES_16G used in J721E SoC
phy: cadence: Sierra: Make cdns_sierra_phy_init() as phy_ops
phy: cadence: Sierra: Modify register macro names to be in sync with
Sierra user guide
phy: cadence: Sierra: Get reset control "array" for each link
phy: cadence: Sierra: Check for PLL lock during PHY power on
phy: cadence: Sierra: Change MAX_LANES of Sierra to 16
phy: cadence: Sierra: Set cmn_refclk_dig_div/cmn_refclk1_dig_div
frequency to 25MHz
phy: cadence: Sierra: Use correct dev pointer in
cdns_sierra_phy_remove()
dt-bindings: phy: Document WIZ (SERDES wrapper) bindings
phy: ti: j721e-wiz: Add support for WIZ module present in TI J721E SoC
.../bindings/phy/phy-cadence-sierra.txt | 13 +- .../bindings/phy/ti,phy-j721e-wiz.yaml | 204 ++++ drivers/phy/cadence/phy-cadence-sierra.c | 699 +++++++++++--- drivers/phy/ti/Kconfig | 15 + drivers/phy/ti/Makefile | 1 + drivers/phy/ti/phy-j721e-wiz.c | 898 ++++++++++++++++++ 6 files changed, 1691 insertions(+), 139 deletions(-) create mode 100644 Documentation/devicetree/bindings/phy/ti,phy-j721e-wiz.yaml create mode 100644 drivers/phy/ti/phy-j721e-wiz.c
Signature · 7 lines
2.17.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH v4 1/14 dt-bindings: phy: Sierra: Add bindings for Sierra in TI's J721E
Add DT binding documentation for Sierra PHY IP used in TI's J721E SoC.
--- .../devicetree/bindings/phy/phy-cadence-sierra.txt | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)
Documentation/devicetree/bindings/phy/phy-cadence-sierra.txt +8 -5
@@ -2,21 +2,24 @@ Cadence Sierra PHY ----------------------- Required properties: -- compatible: cdns,sierra-phy-t0 -- clocks: Must contain an entry in clock-names. - See ../clocks/clock-bindings.txt for details. -- clock-names: Must be "phy_clk" +- compatible: Must be "cdns,sierra-phy-t0" for Sierra in Cadence platform + Must be "ti,sierra-phy-t0" for Sierra in TI's J721E SoC. - resets: Must contain an entry for each in reset-names. See ../reset/reset.txt for details. - reset-names: Must include "sierra_reset" and "sierra_apb". "sierra_reset" must control the reset line to the PHY. "sierra_apb" must control the reset line to the APB PHY - interface. + interface ("sierra_apb" is optional). - reg: register range for the PHY. - #address-cells: Must be 1 - #size-cells: Must be 0 Optional properties: +- clocks: Must contain an entry in clock-names. + See ../clocks/clock-bindings.txt for details. +- clock-names: Must contain "cmn_refclk_dig_div" and + "cmn_refclk1_dig_div" for configuring the frequency of + the clock to the lanes. "phy_clk" is deprecated. - cdns,autoconf: A boolean property whose presence indicates that the PHY registers will be configured by hardware. If not present, all sub-node optional properties must be
Signature · 1 line
2.17.1
PATCH v4 2/14 phy: cadence: Sierra: Make "phy_clk" and "sierra_apb" optional resources
In reply to Kishon Vijay Abraham ICertain platforms like TI J721E using Cadence Sierra Serdes doesn't provide explicit phy_clk and reset (APB reset) control. Make them optional here.
--- drivers/phy/cadence/phy-cadence-sierra.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/phy/cadence/phy-cadence-sierra.c +2 -2
@@ -193,7 +193,7 @@ static int cdns_sierra_phy_probe(struct platform_device *pdev)platform_set_drvdata (pdev, sp); - sp->clk =devm_clk_get (dev,"phy_clk" ); + sp->clk =devm_clk_get_optional (dev,"phy_clk" );if (IS_ERR (sp->clk)) {dev_err (dev,"failed to get clock phy_clk\n" );return PTR_ERR (sp->clk);
@@ -205,7 +205,7 @@ static int cdns_sierra_phy_probe(struct platform_device *pdev)return PTR_ERR (sp->phy_rst); } - sp->apb_rst =devm_reset_control_get (dev,"sierra_apb" ); + sp->apb_rst =devm_reset_control_get_optional (dev,"sierra_apb" );if (IS_ERR (sp->apb_rst)) {dev_err (dev,"failed to get apb reset\n" );return PTR_ERR (sp->apb_rst);
Signature · 1 line
2.17.1
PATCH v4 3/14 phy: cadence: Sierra: Use "regmap" for read and write to Sierra registers
In reply to Kishon Vijay Abraham IUse "regmap" for read and write to Sierra registers. This is in perparation for adding SERDES_16G support present in TI's J721E SoC.
--- drivers/phy/cadence/phy-cadence-sierra.c | 291 ++++++++++++++++++----- 1 file changed, 237 insertions(+), 54 deletions(-)
drivers/phy/cadence/phy-cadence-sierra.c +237 -54
@@ -22,49 +22,63 @@#include <dt-bindings/phy/phy.h> /* PHY register offsets */ -#define SIERRA_PHY_PLL_CFG (0xc00e << 2) -#define SIERRA_DET_STANDEC_A (0x4000 << 2) -#define SIERRA_DET_STANDEC_B (0x4001 << 2) -#define SIERRA_DET_STANDEC_C (0x4002 << 2) -#define SIERRA_DET_STANDEC_D (0x4003 << 2) -#define SIERRA_DET_STANDEC_E (0x4004 << 2) -#define SIERRA_PSM_LANECAL (0x4008 << 2) -#define SIERRA_PSM_DIAG (0x4015 << 2) -#define SIERRA_PSC_TX_A0 (0x4028 << 2) -#define SIERRA_PSC_TX_A1 (0x4029 << 2) -#define SIERRA_PSC_TX_A2 (0x402A << 2) -#define SIERRA_PSC_TX_A3 (0x402B << 2) -#define SIERRA_PSC_RX_A0 (0x4030 << 2) -#define SIERRA_PSC_RX_A1 (0x4031 << 2) -#define SIERRA_PSC_RX_A2 (0x4032 << 2) -#define SIERRA_PSC_RX_A3 (0x4033 << 2) -#define SIERRA_PLLCTRL_SUBRATE (0x403A << 2) -#define SIERRA_PLLCTRL_GEN_D (0x403E << 2) -#define SIERRA_DRVCTRL_ATTEN (0x406A << 2) -#define SIERRA_CLKPATHCTRL_TMR (0x4081 << 2) -#define SIERRA_RX_CREQ_FLTR_A_MODE1 (0x4087 << 2) -#define SIERRA_RX_CREQ_FLTR_A_MODE0 (0x4088 << 2) -#define SIERRA_CREQ_CCLKDET_MODE01 (0x408E << 2) -#define SIERRA_RX_CTLE_MAINTENANCE (0x4091 << 2) -#define SIERRA_CREQ_FSMCLK_SEL (0x4092 << 2) -#define SIERRA_CTLELUT_CTRL (0x4098 << 2) -#define SIERRA_DFE_ECMP_RATESEL (0x40C0 << 2) -#define SIERRA_DFE_SMP_RATESEL (0x40C1 << 2) -#define SIERRA_DEQ_VGATUNE_CTRL (0x40E1 << 2) -#define SIERRA_TMRVAL_MODE3 (0x416E << 2) -#define SIERRA_TMRVAL_MODE2 (0x416F << 2) -#define SIERRA_TMRVAL_MODE1 (0x4170 << 2) -#define SIERRA_TMRVAL_MODE0 (0x4171 << 2) -#define SIERRA_PICNT_MODE1 (0x4174 << 2) -#define SIERRA_CPI_OUTBUF_RATESEL (0x417C << 2) -#define SIERRA_LFPSFILT_NS (0x418A << 2) -#define SIERRA_LFPSFILT_RD (0x418B << 2) -#define SIERRA_LFPSFILT_MP (0x418C << 2) -#define SIERRA_SDFILT_H2L_A (0x4191 << 2) +#define SIERRA_COMMON_CDB_OFFSET 0x0 +#define SIERRA_MACRO_ID_REG 0x0 + +#define SIERRA_LANE_CDB_OFFSET (ln, block_offset, reg_offset) \ + ((0x4000 << (block_offset)) + \ + (((ln) << 9) << (reg_offset))) +#define SIERRA_DET_STANDEC_A 0x000 +#define SIERRA_DET_STANDEC_B 0x001 +#define SIERRA_DET_STANDEC_C 0x002 +#define SIERRA_DET_STANDEC_D 0x003 +#define SIERRA_DET_STANDEC_E 0x004 +#define SIERRA_PSM_LANECAL 0x008 +#define SIERRA_PSM_DIAG 0x015 +#define SIERRA_PSC_TX_A0 0x028 +#define SIERRA_PSC_TX_A1 0x029 +#define SIERRA_PSC_TX_A2 0x02A +#define SIERRA_PSC_TX_A3 0x02B +#define SIERRA_PSC_RX_A0 0x030 +#define SIERRA_PSC_RX_A1 0x031 +#define SIERRA_PSC_RX_A2 0x032 +#define SIERRA_PSC_RX_A3 0x033 +#define SIERRA_PLLCTRL_SUBRATE 0x03A +#define SIERRA_PLLCTRL_GEN_D 0x03E +#define SIERRA_DRVCTRL_ATTEN 0x06A +#define SIERRA_CLKPATHCTRL_TMR 0x081 +#define SIERRA_RX_CREQ_FLTR_A_MODE1 0x087 +#define SIERRA_RX_CREQ_FLTR_A_MODE0 0x088 +#define SIERRA_CREQ_CCLKDET_MODE01 0x08E +#define SIERRA_RX_CTLE_MAINTENANCE 0x091 +#define SIERRA_CREQ_FSMCLK_SEL 0x092 +#define SIERRA_CTLELUT_CTRL 0x098 +#define SIERRA_DFE_ECMP_RATESEL 0x0C0 +#define SIERRA_DFE_SMP_RATESEL 0x0C1 +#define SIERRA_DEQ_VGATUNE_CTRL 0x0E1 +#define SIERRA_TMRVAL_MODE3 0x16E +#define SIERRA_TMRVAL_MODE2 0x16F +#define SIERRA_TMRVAL_MODE1 0x170 +#define SIERRA_TMRVAL_MODE0 0x171 +#define SIERRA_PICNT_MODE1 0x174 +#define SIERRA_CPI_OUTBUF_RATESEL 0x17C +#define SIERRA_LFPSFILT_NS 0x18A +#define SIERRA_LFPSFILT_RD 0x18B +#define SIERRA_LFPSFILT_MP 0x18C +#define SIERRA_SDFILT_H2L_A 0x191 + +#define SIERRA_PHY_CONFIG_CTRL_OFFSET (block_offset) \ + (0xc000 << (block_offset)) +#define SIERRA_PHY_PLL_CFG 0xe#define SIERRA_MACRO_ID 0x00007364#define SIERRA_MAX_LANES 4 +static const struct reg_field macro_id_type = +REG_FIELD (SIERRA_MACRO_ID_REG ,0 ,15 ); +static const struct reg_field phy_pll_cfg_1 = +REG_FIELD (SIERRA_PHY_PLL_CFG ,1 ,1 ); +struct cdns_sierra_inst {struct phy *phy;u32 phy_type;
@@ -80,28 +94,93 @@ struct cdns_reg_pairs {struct cdns_sierra_data {u32 id_value; +u8 block_offset_shift; +u8 reg_offset_shift;u32 pcie_regs;u32 usb_regs;struct cdns_reg_pairs *pcie_vals;struct cdns_reg_pairs *usb_vals; }; -struct cdns_sierra_phy { +struct cdns_regmap_cdb_context {struct device *dev;void __iomem *base; +u8 reg_offset_shift; +}; + +struct cdns_sierra_phy { +struct device *dev; +struct regmap *regmap;struct cdns_sierra_data *init_data;struct cdns_sierra_inst phys[SIERRA_MAX_LANES ];struct reset_control *phy_rst;struct reset_control *apb_rst; +struct regmap *regmap_lane_cdb[SIERRA_MAX_LANES ]; +struct regmap *regmap_phy_config_ctrl; +struct regmap *regmap_common_cdb; +struct regmap_field *macro_id_type; +struct regmap_field *phy_pll_cfg_1;struct clk *clk;int nsubnodes;bool autoconf; }; +static int cdns_regmap_write (void *context,unsigned int reg,unsigned int val) +{ +struct cdns_regmap_cdb_context *ctx = context; +u32 offset = reg << ctx->reg_offset_shift; + +writew (val, ctx->base + offset); + +return 0 ; +} + +static int cdns_regmap_read (void *context,unsigned int reg,unsigned int *val) +{ +struct cdns_regmap_cdb_context *ctx = context; +u32 offset = reg << ctx->reg_offset_shift; + + *val =readw (ctx->base + offset); +return 0 ; +} + +#define SIERRA_LANE_CDB_REGMAP_CONF (n) \ +{ \ + .name = "sierra_lane" n "_cdb", \ + .reg_stride = 1, \ + .fast_io = true, \ + .reg_write = cdns_regmap_write, \ + .reg_read = cdns_regmap_read, \ +} + +static struct regmap_config cdns_sierra_lane_cdb_config[] = { +SIERRA_LANE_CDB_REGMAP_CONF ("0" ), +SIERRA_LANE_CDB_REGMAP_CONF ("1" ), +SIERRA_LANE_CDB_REGMAP_CONF ("2" ), +SIERRA_LANE_CDB_REGMAP_CONF ("3" ), +}; + +static struct regmap_config cdns_sierra_common_cdb_config = { + .name ="sierra_common_cdb" , + .reg_stride =1 , + .fast_io = true, + .reg_write = cdns_regmap_write, + .reg_read = cdns_regmap_read, +}; + +static struct regmap_config cdns_sierra_phy_config_ctrl_config = { + .name ="sierra_phy_config_ctrl" , + .reg_stride =1 , + .fast_io = true, + .reg_write = cdns_regmap_write, + .reg_read = cdns_regmap_read, +}; +static void cdns_sierra_phy_init (struct phy *gphy) {struct cdns_sierra_inst *ins =phy_get_drvdata (gphy);struct cdns_sierra_phy *phy =dev_get_drvdata (gphy->dev.parent); +struct regmap *regmap = phy->regmap;int i, j;struct cdns_reg_pairs *vals;u32 num_regs;
@@ -115,10 +194,12 @@ static void cdns_sierra_phy_init(struct phy *gphy) }else {return ; } -for (i =0 ; i < ins->num_lanes; i++) -for (j =0 ; j < num_regs ; j++) -writel (vals[j].val, phy->base + - vals[j].off + (i + ins->mlane) *0x800 ); +for (i =0 ; i < ins->num_lanes; i++) { +for (j =0 ; j < num_regs ; j++) { + regmap = phy->regmap_lane_cdb[i + ins->mlane]; +regmap_write (regmap, vals[j].off, vals[j].val); + } + } }static int cdns_sierra_phy_on (struct phy *gphy)
@@ -159,37 +240,136 @@ static int cdns_sierra_get_optional(struct cdns_sierra_inst *inst,static const struct of_device_id cdns_sierra_id_table[]; +static struct regmap *cdns_regmap_init (struct device *dev,void __iomem *base, +u32 block_offset,u8 reg_offset_shift, +const struct regmap_config *config) +{ +struct cdns_regmap_cdb_context *ctx; + + ctx =devm_kzalloc (dev,sizeof (*ctx),GFP_KERNEL ); +if (!ctx) +return ERR_PTR (-ENOMEM ); + + ctx->dev = dev; + ctx->base = base + block_offset; + ctx->reg_offset_shift = reg_offset_shift; + +return devm_regmap_init (dev,NULL , ctx, config); +} + +static int cdns_regfield_init (struct cdns_sierra_phy *sp) +{ +struct device *dev = sp->dev; +struct regmap_field *field; +struct regmap *regmap; + + regmap = sp->regmap_common_cdb; + field =devm_regmap_field_alloc (dev, regmap, macro_id_type); +if (IS_ERR (field)) { +dev_err (dev,"MACRO_ID_TYPE reg field init failed\n" ); +return PTR_ERR (field); + } + sp->macro_id_type = field; + + regmap = sp->regmap_phy_config_ctrl; + field =devm_regmap_field_alloc (dev, regmap, phy_pll_cfg_1); +if (IS_ERR (field)) { +dev_err (dev,"PHY_PLL_CFG_1 reg field init failed\n" ); +return PTR_ERR (field); + } + sp->phy_pll_cfg_1 = field; + +return 0 ; +} + +static int cdns_regmap_init_blocks (struct cdns_sierra_phy *sp, +void __iomem *base,u8 block_offset_shift, +u8 reg_offset_shift) +{ +struct device *dev = sp->dev; +struct regmap *regmap; +u32 block_offset; +int i; + +for (i =0 ; i <SIERRA_MAX_LANES ; i++) { + block_offset =SIERRA_LANE_CDB_OFFSET (i, block_offset_shift, + reg_offset_shift); + regmap =cdns_regmap_init (dev, base, block_offset, + reg_offset_shift, + &cdns_sierra_lane_cdb_config[i]); +if (IS_ERR (regmap)) { +dev_err (dev,"Failed to init lane CDB regmap\n" ); +return PTR_ERR (regmap); + } + sp->regmap_lane_cdb[i] = regmap; + } + + regmap =cdns_regmap_init (dev, base,SIERRA_COMMON_CDB_OFFSET , + reg_offset_shift, + &cdns_sierra_common_cdb_config); +if (IS_ERR (regmap)) { +dev_err (dev,"Failed to init common CDB regmap\n" ); +return PTR_ERR (regmap); + } + sp->regmap_common_cdb = regmap; + + block_offset =SIERRA_PHY_CONFIG_CTRL_OFFSET (block_offset_shift); + regmap =cdns_regmap_init (dev, base, block_offset, reg_offset_shift, + &cdns_sierra_phy_config_ctrl_config); +if (IS_ERR (regmap)) { +dev_err (dev,"Failed to init PHY config and control regmap\n" ); +return PTR_ERR (regmap); + } + sp->regmap_phy_config_ctrl = regmap; + +return 0 ; +} +static int cdns_sierra_phy_probe (struct platform_device *pdev) {struct cdns_sierra_phy *sp;struct phy_provider *phy_provider;struct device *dev = &pdev->dev;const struct of_device_id *match; +struct cdns_sierra_data *data; +unsigned int id_value;struct resource *res;int i, ret, node =0 ; +void __iomem *base;struct device_node *dn = dev->of_node, *child;if (of_get_child_count (dn) ==0 )return -ENODEV ; +/* Get init data for this PHY */ + match =of_match_device (cdns_sierra_id_table, dev); +if (!match) +return -EINVAL ; + + data = (struct cdns_sierra_data *)match->data; + sp =devm_kzalloc (dev,sizeof (*sp),GFP_KERNEL );if (!sp)return -ENOMEM ;dev_set_drvdata (dev, sp); sp->dev = dev; + sp->init_data = data; res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); - sp->base =devm_ioremap_resource (dev, res); -if (IS_ERR (sp->base)) { + base =devm_ioremap_resource (dev, res); +if (IS_ERR (base)) {dev_err (dev,"missing \"reg\"\n" ); -return PTR_ERR (sp->base); +return PTR_ERR (base); } -/* Get init data for this PHY */ - match =of_match_device (cdns_sierra_id_table, dev); -if (!match) -return -EINVAL ; - sp->init_data = (struct cdns_sierra_data *)match->data; + ret =cdns_regmap_init_blocks (sp, base, data->block_offset_shift, + data->reg_offset_shift); +if (ret) +return ret; + + ret =cdns_regfield_init (sp); +if (ret) +return ret;platform_set_drvdata (pdev, sp);
@@ -219,7 +399,8 @@ static int cdns_sierra_phy_probe(struct platform_device *pdev)reset_control_deassert (sp->apb_rst);/* Check that PHY is present */ -if (sp->init_data->id_value !=readl (sp->base)) { +regmap_field_read (sp->macro_id_type, &id_value); +if (sp->init_data->id_value != id_value) { ret = -EINVAL ; goto clk_disable; }
@@ -267,7 +448,7 @@ static int cdns_sierra_phy_probe(struct platform_device *pdev)/* If more than one subnode, configure the PHY as multilink */ if (!sp->autoconf && sp->nsubnodes >1 ) -writel (2 , sp->base +SIERRA_PHY_PLL_CFG ); +regmap_field_write (sp->phy_pll_cfg_1,0x1 );pm_runtime_enable (dev); phy_provider =devm_of_phy_provider_register (dev, of_phy_simple_xlate);
@@ -364,6 +545,8 @@ static struct cdns_reg_pairs cdns_pcie_regs[] = {static const struct cdns_sierra_data cdns_map_sierra = {SIERRA_MACRO_ID , +0x2 , +0x2 ,ARRAY_SIZE (cdns_pcie_regs),ARRAY_SIZE (cdns_usb_regs), cdns_pcie_regs,
Signature · 1 line
2.17.1
PATCH v4 4/14 phy: cadence: Sierra: Add support for SERDES_16G used in J721E SoC
In reply to Kishon Vijay Abraham ISERDES_16G in TI's J721E SoC uses Cadence Sierra PHY. Add support to use Cadence Sierra driver in J721E SoC.
--- drivers/phy/cadence/phy-cadence-sierra.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
drivers/phy/cadence/phy-cadence-sierra.c +14 -0
@@ -553,11 +553,25 @@ static const struct cdns_sierra_data cdns_map_sierra = { cdns_usb_regs }; +static const struct cdns_sierra_data cdns_ti_map_sierra = { +SIERRA_MACRO_ID , +0x0 , +0x1 , +ARRAY_SIZE (cdns_pcie_regs), +ARRAY_SIZE (cdns_usb_regs), + cdns_pcie_regs, + cdns_usb_regs +}; +static const struct of_device_id cdns_sierra_id_table[] = { { .compatible ="cdns,sierra-phy-t0" , .data = &cdns_map_sierra, }, + { + .compatible ="ti,sierra-phy-t0" , + .data = &cdns_ti_map_sierra, + }, {} };MODULE_DEVICE_TABLE (of, cdns_sierra_id_table);
Signature · 1 line
2.17.1
PATCH v4 5/14 phy: cadence: Sierra: Make cdns_sierra_phy_init() as phy_ops
In reply to Kishon Vijay Abraham IInstead of invoking cdns_sierra_phy_init() from probe, add it in phy_ops so that it's initialized when the PHY consumer invokes phy_init()
--- drivers/phy/cadence/phy-cadence-sierra.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-)
drivers/phy/cadence/phy-cadence-sierra.c +9 -6
@@ -176,7 +176,7 @@ static struct regmap_config cdns_sierra_phy_config_ctrl_config = { .reg_read = cdns_regmap_read, }; -static void cdns_sierra_phy_init (struct phy *gphy) +static int cdns_sierra_phy_init (struct phy *gphy) {struct cdns_sierra_inst *ins =phy_get_drvdata (gphy);struct cdns_sierra_phy *phy =dev_get_drvdata (gphy->dev.parent);
@@ -185,6 +185,10 @@ static void cdns_sierra_phy_init(struct phy *gphy)struct cdns_reg_pairs *vals;u32 num_regs; +/* Initialise the PHY registers, unless auto configured */ +if (phy->autoconf) +return 0 ; +if (ins->phy_type ==PHY_TYPE_PCIE ) { num_regs = phy->init_data->pcie_regs; vals = phy->init_data->pcie_vals;
@@ -192,7 +196,7 @@ static void cdns_sierra_phy_init(struct phy *gphy) num_regs = phy->init_data->usb_regs; vals = phy->init_data->usb_vals; }else { -return ; +return -EINVAL ; }for (i =0 ; i < ins->num_lanes; i++) {for (j =0 ; j < num_regs ; j++) {
@@ -200,6 +204,8 @@ static void cdns_sierra_phy_init(struct phy *gphy)regmap_write (regmap, vals[j].off, vals[j].val); } } + +return 0 ; }static int cdns_sierra_phy_on (struct phy *gphy)
@@ -218,6 +224,7 @@ static int cdns_sierra_phy_off(struct phy *gphy) }static const struct phy_ops ops = { + .init = cdns_sierra_phy_init, .power_on = cdns_sierra_phy_on, .power_off = cdns_sierra_phy_off, .owner =THIS_MODULE ,
@@ -438,10 +445,6 @@ static int cdns_sierra_phy_probe(struct platform_device *pdev) sp->phys[node].phy = gphy;phy_set_drvdata (gphy, &sp->phys[node]); -/* Initialise the PHY registers, unless auto configured */ -if (!sp->autoconf) -cdns_sierra_phy_init (gphy); - node++; } sp->nsubnodes = node;
Signature · 1 line
2.17.1
PATCH v4 6/14 phy: cadence: Sierra: Modify register macro names to be in sync with Sierra user guide
In reply to Kishon Vijay Abraham INo functional change. Modify register offset macro names to be in sync with Sierra user guide.
--- drivers/phy/cadence/phy-cadence-sierra.c | 167 ++++++++++++----------- 1 file changed, 84 insertions(+), 83 deletions(-)
drivers/phy/cadence/phy-cadence-sierra.c +84 -83
@@ -22,57 +22,58 @@#include <dt-bindings/phy/phy.h> /* PHY register offsets */ -#define SIERRA_COMMON_CDB_OFFSET 0x0 -#define SIERRA_MACRO_ID_REG 0x0 +#define SIERRA_COMMON_CDB_OFFSET 0x0 +#define SIERRA_MACRO_ID_REG 0x0#define SIERRA_LANE_CDB_OFFSET (ln, block_offset, reg_offset) \ ((0x4000 << (block_offset)) + \ (((ln) << 9) << (reg_offset))) -#define SIERRA_DET_STANDEC_A 0x000 -#define SIERRA_DET_STANDEC_B 0x001 -#define SIERRA_DET_STANDEC_C 0x002 -#define SIERRA_DET_STANDEC_D 0x003 -#define SIERRA_DET_STANDEC_E 0x004 -#define SIERRA_PSM_LANECAL 0x008 -#define SIERRA_PSM_DIAG 0x015 -#define SIERRA_PSC_TX_A0 0x028 -#define SIERRA_PSC_TX_A1 0x029 -#define SIERRA_PSC_TX_A2 0x02A -#define SIERRA_PSC_TX_A3 0x02B -#define SIERRA_PSC_RX_A0 0x030 -#define SIERRA_PSC_RX_A1 0x031 -#define SIERRA_PSC_RX_A2 0x032 -#define SIERRA_PSC_RX_A3 0x033 -#define SIERRA_PLLCTRL_SUBRATE 0x03A -#define SIERRA_PLLCTRL_GEN_D 0x03E -#define SIERRA_DRVCTRL_ATTEN 0x06A -#define SIERRA_CLKPATHCTRL_TMR 0x081 -#define SIERRA_RX_CREQ_FLTR_A_MODE1 0x087 -#define SIERRA_RX_CREQ_FLTR_A_MODE0 0x088 -#define SIERRA_CREQ_CCLKDET_MODE01 0x08E -#define SIERRA_RX_CTLE_MAINTENANCE 0x091 -#define SIERRA_CREQ_FSMCLK_SEL 0x092 -#define SIERRA_CTLELUT_CTRL 0x098 -#define SIERRA_DFE_ECMP_RATESEL 0x0C0 -#define SIERRA_DFE_SMP_RATESEL 0x0C1 -#define SIERRA_DEQ_VGATUNE_CTRL 0x0E1 -#define SIERRA_TMRVAL_MODE3 0x16E -#define SIERRA_TMRVAL_MODE2 0x16F -#define SIERRA_TMRVAL_MODE1 0x170 -#define SIERRA_TMRVAL_MODE0 0x171 -#define SIERRA_PICNT_MODE1 0x174 -#define SIERRA_CPI_OUTBUF_RATESEL 0x17C -#define SIERRA_LFPSFILT_NS 0x18A -#define SIERRA_LFPSFILT_RD 0x18B -#define SIERRA_LFPSFILT_MP 0x18C -#define SIERRA_SDFILT_H2L_A 0x191 + +#define SIERRA_DET_STANDEC_A_PREG 0x000 +#define SIERRA_DET_STANDEC_B_PREG 0x001 +#define SIERRA_DET_STANDEC_C_PREG 0x002 +#define SIERRA_DET_STANDEC_D_PREG 0x003 +#define SIERRA_DET_STANDEC_E_PREG 0x004 +#define SIERRA_PSM_LANECAL_PREG 0x008 +#define SIERRA_PSM_DIAG_PREG 0x015 +#define SIERRA_PSC_TX_A0_PREG 0x028 +#define SIERRA_PSC_TX_A1_PREG 0x029 +#define SIERRA_PSC_TX_A2_PREG 0x02A +#define SIERRA_PSC_TX_A3_PREG 0x02B +#define SIERRA_PSC_RX_A0_PREG 0x030 +#define SIERRA_PSC_RX_A1_PREG 0x031 +#define SIERRA_PSC_RX_A2_PREG 0x032 +#define SIERRA_PSC_RX_A3_PREG 0x033 +#define SIERRA_PLLCTRL_SUBRATE_PREG 0x03A +#define SIERRA_PLLCTRL_GEN_D_PREG 0x03E +#define SIERRA_DRVCTRL_ATTEN_PREG 0x06A +#define SIERRA_CLKPATHCTRL_TMR_PREG 0x081 +#define SIERRA_RX_CREQ_FLTR_A_MODE1_PREG 0x087 +#define SIERRA_RX_CREQ_FLTR_A_MODE0_PREG 0x088 +#define SIERRA_CREQ_CCLKDET_MODE01_PREG 0x08E +#define SIERRA_RX_CTLE_MAINTENANCE_PREG 0x091 +#define SIERRA_CREQ_FSMCLK_SEL_PREG 0x092 +#define SIERRA_CTLELUT_CTRL_PREG 0x098 +#define SIERRA_DFE_ECMP_RATESEL_PREG 0x0C0 +#define SIERRA_DFE_SMP_RATESEL_PREG 0x0C1 +#define SIERRA_DEQ_VGATUNE_CTRL_PREG 0x0E1 +#define SIERRA_TMRVAL_MODE3_PREG 0x16E +#define SIERRA_TMRVAL_MODE2_PREG 0x16F +#define SIERRA_TMRVAL_MODE1_PREG 0x170 +#define SIERRA_TMRVAL_MODE0_PREG 0x171 +#define SIERRA_PICNT_MODE1_PREG 0x174 +#define SIERRA_CPI_OUTBUF_RATESEL_PREG 0x17C +#define SIERRA_LFPSFILT_NS_PREG 0x18A +#define SIERRA_LFPSFILT_RD_PREG 0x18B +#define SIERRA_LFPSFILT_MP_PREG 0x18C +#define SIERRA_SDFILT_H2L_A_PREG 0x191#define SIERRA_PHY_CONFIG_CTRL_OFFSET (block_offset) \ (0xc000 << (block_offset)) -#define SIERRA_PHY_PLL_CFG 0xe +#define SIERRA_PHY_PLL_CFG 0xe -#define SIERRA_MACRO_ID 0x00007364 -#define SIERRA_MAX_LANES 4 +#define SIERRA_MACRO_ID 0x00007364 +#define SIERRA_MAX_LANES 4static const struct reg_field macro_id_type =REG_FIELD (SIERRA_MACRO_ID_REG ,0 ,15 );
@@ -496,42 +497,42 @@ static struct cdns_reg_pairs cdns_usb_regs[] = {* These values are specific to this specific hardware * configuration. */ - {0xFE0A, SIERRA_DET_STANDEC_A}, - {0x000F, SIERRA_DET_STANDEC_B}, - {0x55A5, SIERRA_DET_STANDEC_C}, - {0x69AD, SIERRA_DET_STANDEC_D}, - {0x0241, SIERRA_DET_STANDEC_E}, - {0x0110, SIERRA_PSM_LANECAL}, - {0xCF00, SIERRA_PSM_DIAG}, - {0x001F, SIERRA_PSC_TX_A0}, - {0x0007, SIERRA_PSC_TX_A1}, - {0x0003, SIERRA_PSC_TX_A2}, - {0x0003, SIERRA_PSC_TX_A3}, - {0x0FFF, SIERRA_PSC_RX_A0}, - {0x0003, SIERRA_PSC_RX_A1}, - {0x0003, SIERRA_PSC_RX_A2}, - {0x0001, SIERRA_PSC_RX_A3}, - {0x0001, SIERRA_PLLCTRL_SUBRATE}, - {0x0406, SIERRA_PLLCTRL_GEN_D}, - {0x0000, SIERRA_DRVCTRL_ATTEN}, - {0x823E, SIERRA_CLKPATHCTRL_TMR}, - {0x078F, SIERRA_RX_CREQ_FLTR_A_MODE1}, - {0x078F, SIERRA_RX_CREQ_FLTR_A_MODE0}, - {0x7B3C, SIERRA_CREQ_CCLKDET_MODE01}, - {0x023C, SIERRA_RX_CTLE_MAINTENANCE}, - {0x3232, SIERRA_CREQ_FSMCLK_SEL}, - {0x8452, SIERRA_CTLELUT_CTRL}, - {0x4121, SIERRA_DFE_ECMP_RATESEL}, - {0x4121, SIERRA_DFE_SMP_RATESEL}, - {0x9999, SIERRA_DEQ_VGATUNE_CTRL}, - {0x0330, SIERRA_TMRVAL_MODE0}, - {0x01FF, SIERRA_PICNT_MODE1}, - {0x0009, SIERRA_CPI_OUTBUF_RATESEL}, - {0x000F, SIERRA_LFPSFILT_NS}, - {0x0009, SIERRA_LFPSFILT_RD}, - {0x0001, SIERRA_LFPSFILT_MP}, - {0x8013, SIERRA_SDFILT_H2L_A}, - {0x0400, SIERRA_TMRVAL_MODE1}, + {0xFE0A, SIERRA_DET_STANDEC_A_PREG}, + {0x000F, SIERRA_DET_STANDEC_B_PREG}, + {0x55A5, SIERRA_DET_STANDEC_C_PREG}, + {0x69AD, SIERRA_DET_STANDEC_D_PREG}, + {0x0241, SIERRA_DET_STANDEC_E_PREG}, + {0x0110, SIERRA_PSM_LANECAL_PREG}, + {0xCF00, SIERRA_PSM_DIAG_PREG}, + {0x001F, SIERRA_PSC_TX_A0_PREG}, + {0x0007, SIERRA_PSC_TX_A1_PREG}, + {0x0003, SIERRA_PSC_TX_A2_PREG}, + {0x0003, SIERRA_PSC_TX_A3_PREG}, + {0x0FFF, SIERRA_PSC_RX_A0_PREG}, + {0x0003, SIERRA_PSC_RX_A1_PREG}, + {0x0003, SIERRA_PSC_RX_A2_PREG}, + {0x0001, SIERRA_PSC_RX_A3_PREG}, + {0x0001, SIERRA_PLLCTRL_SUBRATE_PREG}, + {0x0406, SIERRA_PLLCTRL_GEN_D_PREG}, + {0x0000, SIERRA_DRVCTRL_ATTEN_PREG}, + {0x823E, SIERRA_CLKPATHCTRL_TMR_PREG}, + {0x078F, SIERRA_RX_CREQ_FLTR_A_MODE1_PREG}, + {0x078F, SIERRA_RX_CREQ_FLTR_A_MODE0_PREG}, + {0x7B3C, SIERRA_CREQ_CCLKDET_MODE01_PREG}, + {0x023C, SIERRA_RX_CTLE_MAINTENANCE_PREG}, + {0x3232, SIERRA_CREQ_FSMCLK_SEL_PREG}, + {0x8452, SIERRA_CTLELUT_CTRL_PREG}, + {0x4121, SIERRA_DFE_ECMP_RATESEL_PREG}, + {0x4121, SIERRA_DFE_SMP_RATESEL_PREG}, + {0x9999, SIERRA_DEQ_VGATUNE_CTRL_PREG}, + {0x0330, SIERRA_TMRVAL_MODE0_PREG}, + {0x01FF, SIERRA_PICNT_MODE1_PREG}, + {0x0009, SIERRA_CPI_OUTBUF_RATESEL_PREG}, + {0x000F, SIERRA_LFPSFILT_NS_PREG}, + {0x0009, SIERRA_LFPSFILT_RD_PREG}, + {0x0001, SIERRA_LFPSFILT_MP_PREG}, + {0x8013, SIERRA_SDFILT_H2L_A_PREG}, + {0x0400, SIERRA_TMRVAL_MODE1_PREG}, }; static struct cdns_reg_pairs cdns_pcie_regs[] = {
@@ -540,10 +541,10 @@ static struct cdns_reg_pairs cdns_pcie_regs[] = {* These values are specific to this specific hardware * configuration. */ - {0x891f, SIERRA_DET_STANDEC_D}, - {0x0053, SIERRA_DET_STANDEC_E}, - {0x0400, SIERRA_TMRVAL_MODE2}, - {0x0200, SIERRA_TMRVAL_MODE3}, + {0x891f, SIERRA_DET_STANDEC_D_PREG}, + {0x0053, SIERRA_DET_STANDEC_E_PREG}, + {0x0400, SIERRA_TMRVAL_MODE2_PREG}, + {0x0200, SIERRA_TMRVAL_MODE3_PREG}, }; static const struct cdns_sierra_data cdns_map_sierra = {
Signature · 1 line
2.17.1
PATCH v4 7/14 phy: cadence: Sierra: Configure both lane cdb and common cdb registers for external SSC
In reply to Kishon Vijay Abraham IFrom: Anil Varughese <[email protected]>
The existing configuration done in Cadence Sierra driver is only for reference and is not used in any platforms. Remove them and configure both lane cdb and common cdb registers to be used with external SSC configuration. This is validated in TI J721E platform.
--- drivers/phy/cadence/phy-cadence-sierra.c | 350 ++++++++++++++++------- 1 file changed, 254 insertions(+), 96 deletions(-)
drivers/phy/cadence/phy-cadence-sierra.c +254 -96
@@ -22,58 +22,125 @@#include <dt-bindings/phy/phy.h> /* PHY register offsets */ -#define SIERRA_COMMON_CDB_OFFSET 0x0 -#define SIERRA_MACRO_ID_REG 0x0 +#define SIERRA_COMMON_CDB_OFFSET 0x0 +#define SIERRA_MACRO_ID_REG 0x0 +#define SIERRA_CMN_PLLLC_MODE_PREG 0x48 +#define SIERRA_CMN_PLLLC_LF_COEFF_MODE1_PREG 0x49 +#define SIERRA_CMN_PLLLC_LF_COEFF_MODE0_PREG 0x4A +#define SIERRA_CMN_PLLLC_LOCK_CNTSTART_PREG 0x4B +#define SIERRA_CMN_PLLLC_BWCAL_MODE1_PREG 0x4F +#define SIERRA_CMN_PLLLC_BWCAL_MODE0_PREG 0x50 +#define SIERRA_CMN_PLLLC_SS_TIME_STEPSIZE_MODE_PREG 0x62#define SIERRA_LANE_CDB_OFFSET (ln, block_offset, reg_offset) \ ((0x4000 << (block_offset)) + \ (((ln) << 9) << (reg_offset))) -#define SIERRA_DET_STANDEC_A_PREG 0x000 -#define SIERRA_DET_STANDEC_B_PREG 0x001 -#define SIERRA_DET_STANDEC_C_PREG 0x002 -#define SIERRA_DET_STANDEC_D_PREG 0x003 -#define SIERRA_DET_STANDEC_E_PREG 0x004 -#define SIERRA_PSM_LANECAL_PREG 0x008 -#define SIERRA_PSM_DIAG_PREG 0x015 -#define SIERRA_PSC_TX_A0_PREG 0x028 -#define SIERRA_PSC_TX_A1_PREG 0x029 -#define SIERRA_PSC_TX_A2_PREG 0x02A -#define SIERRA_PSC_TX_A3_PREG 0x02B -#define SIERRA_PSC_RX_A0_PREG 0x030 -#define SIERRA_PSC_RX_A1_PREG 0x031 -#define SIERRA_PSC_RX_A2_PREG 0x032 -#define SIERRA_PSC_RX_A3_PREG 0x033 -#define SIERRA_PLLCTRL_SUBRATE_PREG 0x03A -#define SIERRA_PLLCTRL_GEN_D_PREG 0x03E -#define SIERRA_DRVCTRL_ATTEN_PREG 0x06A -#define SIERRA_CLKPATHCTRL_TMR_PREG 0x081 -#define SIERRA_RX_CREQ_FLTR_A_MODE1_PREG 0x087 -#define SIERRA_RX_CREQ_FLTR_A_MODE0_PREG 0x088 -#define SIERRA_CREQ_CCLKDET_MODE01_PREG 0x08E -#define SIERRA_RX_CTLE_MAINTENANCE_PREG 0x091 -#define SIERRA_CREQ_FSMCLK_SEL_PREG 0x092 -#define SIERRA_CTLELUT_CTRL_PREG 0x098 -#define SIERRA_DFE_ECMP_RATESEL_PREG 0x0C0 -#define SIERRA_DFE_SMP_RATESEL_PREG 0x0C1 -#define SIERRA_DEQ_VGATUNE_CTRL_PREG 0x0E1 -#define SIERRA_TMRVAL_MODE3_PREG 0x16E -#define SIERRA_TMRVAL_MODE2_PREG 0x16F -#define SIERRA_TMRVAL_MODE1_PREG 0x170 -#define SIERRA_TMRVAL_MODE0_PREG 0x171 -#define SIERRA_PICNT_MODE1_PREG 0x174 -#define SIERRA_CPI_OUTBUF_RATESEL_PREG 0x17C -#define SIERRA_LFPSFILT_NS_PREG 0x18A -#define SIERRA_LFPSFILT_RD_PREG 0x18B -#define SIERRA_LFPSFILT_MP_PREG 0x18C -#define SIERRA_SDFILT_H2L_A_PREG 0x191 +#define SIERRA_DET_STANDEC_A_PREG 0x000 +#define SIERRA_DET_STANDEC_B_PREG 0x001 +#define SIERRA_DET_STANDEC_C_PREG 0x002 +#define SIERRA_DET_STANDEC_D_PREG 0x003 +#define SIERRA_DET_STANDEC_E_PREG 0x004 +#define SIERRA_PSM_LANECAL_DLY_A1_RESETS_PREG 0x008 +#define SIERRA_PSM_A0IN_TMR_PREG 0x009 +#define SIERRA_PSM_DIAG_PREG 0x015 +#define SIERRA_PSC_TX_A0_PREG 0x028 +#define SIERRA_PSC_TX_A1_PREG 0x029 +#define SIERRA_PSC_TX_A2_PREG 0x02A +#define SIERRA_PSC_TX_A3_PREG 0x02B +#define SIERRA_PSC_RX_A0_PREG 0x030 +#define SIERRA_PSC_RX_A1_PREG 0x031 +#define SIERRA_PSC_RX_A2_PREG 0x032 +#define SIERRA_PSC_RX_A3_PREG 0x033 +#define SIERRA_PLLCTRL_SUBRATE_PREG 0x03A +#define SIERRA_PLLCTRL_GEN_D_PREG 0x03E +#define SIERRA_PLLCTRL_CPGAIN_MODE_PREG 0x03F +#define SIERRA_CLKPATH_BIASTRIM_PREG 0x04B +#define SIERRA_DFE_BIASTRIM_PREG 0x04C +#define SIERRA_DRVCTRL_ATTEN_PREG 0x06A +#define SIERRA_CLKPATHCTRL_TMR_PREG 0x081 +#define SIERRA_RX_CREQ_FLTR_A_MODE3_PREG 0x085 +#define SIERRA_RX_CREQ_FLTR_A_MODE2_PREG 0x086 +#define SIERRA_RX_CREQ_FLTR_A_MODE1_PREG 0x087 +#define SIERRA_RX_CREQ_FLTR_A_MODE0_PREG 0x088 +#define SIERRA_CREQ_CCLKDET_MODE01_PREG 0x08E +#define SIERRA_RX_CTLE_MAINTENANCE_PREG 0x091 +#define SIERRA_CREQ_FSMCLK_SEL_PREG 0x092 +#define SIERRA_CREQ_EQ_CTRL_PREG 0x093 +#define SIERRA_CREQ_SPARE_PREG 0x096 +#define SIERRA_CREQ_EQ_OPEN_EYE_THRESH_PREG 0x097 +#define SIERRA_CTLELUT_CTRL_PREG 0x098 +#define SIERRA_DFE_ECMP_RATESEL_PREG 0x0C0 +#define SIERRA_DFE_SMP_RATESEL_PREG 0x0C1 +#define SIERRA_DEQ_PHALIGN_CTRL 0x0C4 +#define SIERRA_DEQ_CONCUR_CTRL1_PREG 0x0C8 +#define SIERRA_DEQ_CONCUR_CTRL2_PREG 0x0C9 +#define SIERRA_DEQ_EPIPWR_CTRL2_PREG 0x0CD +#define SIERRA_DEQ_FAST_MAINT_CYCLES_PREG 0x0CE +#define SIERRA_DEQ_ERRCMP_CTRL_PREG 0x0D0 +#define SIERRA_DEQ_OFFSET_CTRL_PREG 0x0D8 +#define SIERRA_DEQ_GAIN_CTRL_PREG 0x0E0 +#define SIERRA_DEQ_VGATUNE_CTRL_PREG 0x0E1 +#define SIERRA_DEQ_GLUT0 0x0E8 +#define SIERRA_DEQ_GLUT1 0x0E9 +#define SIERRA_DEQ_GLUT2 0x0EA +#define SIERRA_DEQ_GLUT3 0x0EB +#define SIERRA_DEQ_GLUT4 0x0EC +#define SIERRA_DEQ_GLUT5 0x0ED +#define SIERRA_DEQ_GLUT6 0x0EE +#define SIERRA_DEQ_GLUT7 0x0EF +#define SIERRA_DEQ_GLUT8 0x0F0 +#define SIERRA_DEQ_GLUT9 0x0F1 +#define SIERRA_DEQ_GLUT10 0x0F2 +#define SIERRA_DEQ_GLUT11 0x0F3 +#define SIERRA_DEQ_GLUT12 0x0F4 +#define SIERRA_DEQ_GLUT13 0x0F5 +#define SIERRA_DEQ_GLUT14 0x0F6 +#define SIERRA_DEQ_GLUT15 0x0F7 +#define SIERRA_DEQ_GLUT16 0x0F8 +#define SIERRA_DEQ_ALUT0 0x108 +#define SIERRA_DEQ_ALUT1 0x109 +#define SIERRA_DEQ_ALUT2 0x10A +#define SIERRA_DEQ_ALUT3 0x10B +#define SIERRA_DEQ_ALUT4 0x10C +#define SIERRA_DEQ_ALUT5 0x10D +#define SIERRA_DEQ_ALUT6 0x10E +#define SIERRA_DEQ_ALUT7 0x10F +#define SIERRA_DEQ_ALUT8 0x110 +#define SIERRA_DEQ_ALUT9 0x111 +#define SIERRA_DEQ_ALUT10 0x112 +#define SIERRA_DEQ_ALUT11 0x113 +#define SIERRA_DEQ_ALUT12 0x114 +#define SIERRA_DEQ_ALUT13 0x115 +#define SIERRA_DEQ_DFETAP_CTRL_PREG 0x128 +#define SIERRA_DFE_EN_1010_IGNORE_PREG 0x134 +#define SIERRA_DEQ_TAU_CTRL1_SLOW_MAINT_PREG 0x150 +#define SIERRA_DEQ_TAU_CTRL2_PREG 0x151 +#define SIERRA_DEQ_PICTRL_PREG 0x161 +#define SIERRA_CPICAL_TMRVAL_MODE1_PREG 0x170 +#define SIERRA_CPICAL_TMRVAL_MODE0_PREG 0x171 +#define SIERRA_CPICAL_PICNT_MODE1_PREG 0x174 +#define SIERRA_CPI_OUTBUF_RATESEL_PREG 0x17C +#define SIERRA_CPICAL_RES_STARTCODE_MODE23_PREG 0x183 +#define SIERRA_LFPSDET_SUPPORT_PREG 0x188 +#define SIERRA_LFPSFILT_NS_PREG 0x18A +#define SIERRA_LFPSFILT_RD_PREG 0x18B +#define SIERRA_LFPSFILT_MP_PREG 0x18C +#define SIERRA_SIGDET_SUPPORT_PREG 0x190 +#define SIERRA_SDFILT_H2L_A_PREG 0x191 +#define SIERRA_SDFILT_L2H_PREG 0x193 +#define SIERRA_RXBUFFER_CTLECTRL_PREG 0x19E +#define SIERRA_RXBUFFER_RCDFECTRL_PREG 0x19F +#define SIERRA_RXBUFFER_DFECTRL_PREG 0x1A0 +#define SIERRA_DEQ_TAU_CTRL1_FAST_MAINT_PREG 0x14F +#define SIERRA_DEQ_TAU_CTRL1_SLOW_MAINT_PREG 0x150#define SIERRA_PHY_CONFIG_CTRL_OFFSET (block_offset) \ (0xc000 << (block_offset)) -#define SIERRA_PHY_PLL_CFG 0xe +#define SIERRA_PHY_PLL_CFG 0xe -#define SIERRA_MACRO_ID 0x00007364 -#define SIERRA_MAX_LANES 4 +#define SIERRA_MACRO_ID 0x00007364 +#define SIERRA_MAX_LANES 4static const struct reg_field macro_id_type =REG_FIELD (SIERRA_MACRO_ID_REG ,0 ,15 );
@@ -97,10 +164,14 @@ struct cdns_sierra_data {u32 id_value;u8 block_offset_shift;u8 reg_offset_shift; -u32 pcie_regs; -u32 usb_regs; -struct cdns_reg_pairs *pcie_vals; -struct cdns_reg_pairs *usb_vals; +u32 pcie_cmn_regs; +u32 pcie_ln_regs; +u32 usb_cmn_regs; +u32 usb_ln_regs; +struct cdns_reg_pairs *pcie_cmn_vals; +struct cdns_reg_pairs *pcie_ln_vals; +struct cdns_reg_pairs *usb_cmn_vals; +struct cdns_reg_pairs *usb_ln_vals; };struct cdns_regmap_cdb_context {
@@ -183,26 +254,35 @@ static int cdns_sierra_phy_init(struct phy *gphy)struct cdns_sierra_phy *phy =dev_get_drvdata (gphy->dev.parent);struct regmap *regmap = phy->regmap;int i, j; -struct cdns_reg_pairs *vals; -u32 num_regs; +struct cdns_reg_pairs *cmn_vals, *ln_vals; +u32 num_cmn_regs, num_ln_regs;/* Initialise the PHY registers, unless auto configured */ if (phy->autoconf)return 0 ;if (ins->phy_type ==PHY_TYPE_PCIE ) { - num_regs = phy->init_data->pcie_regs; - vals = phy->init_data->pcie_vals; + num_cmn_regs = phy->init_data->pcie_cmn_regs; + num_ln_regs = phy->init_data->pcie_ln_regs; + cmn_vals = phy->init_data->pcie_cmn_vals; + ln_vals = phy->init_data->pcie_ln_vals; }else if (ins->phy_type ==PHY_TYPE_USB3 ) { - num_regs = phy->init_data->usb_regs; - vals = phy->init_data->usb_vals; + num_cmn_regs = phy->init_data->usb_cmn_regs; + num_ln_regs = phy->init_data->usb_ln_regs; + cmn_vals = phy->init_data->usb_cmn_vals; + ln_vals = phy->init_data->usb_ln_vals; }else {return -EINVAL ; } + + regmap = phy->regmap_common_cdb; +for (j =0 ; j < num_cmn_regs ; j++) +regmap_write (regmap, cmn_vals[j].off, cmn_vals[j].val); +for (i =0 ; i < ins->num_lanes; i++) { -for (j =0 ; j < num_regs ; j++) { +for (j =0 ; j < num_ln_regs ; j++) { regmap = phy->regmap_lane_cdb[i + ins->mlane]; -regmap_write (regmap, vals[j].off, vals[j].val); +regmap_write (regmap, ln_vals[j].off, ln_vals[j].val); } }
@@ -491,80 +571,158 @@ static int cdns_sierra_phy_remove(struct platform_device *pdev)return 0 ; } -static struct cdns_reg_pairs cdns_usb_regs[] = { -/* -* Write USB configuration parameters to the PHY. -* These values are specific to this specific hardware -* configuration. -*/ +/* refclk100MHz_32b_PCIe_cmn_pll_ext_ssc */ +static struct cdns_reg_pairs cdns_pcie_cmn_regs_ext_ssc[] = { + {0x2106 ,SIERRA_CMN_PLLLC_LF_COEFF_MODE1_PREG }, + {0x2106 ,SIERRA_CMN_PLLLC_LF_COEFF_MODE0_PREG }, + {0x8A06 ,SIERRA_CMN_PLLLC_BWCAL_MODE1_PREG }, + {0x8A06 ,SIERRA_CMN_PLLLC_BWCAL_MODE0_PREG }, + {0x1B1B ,SIERRA_CMN_PLLLC_SS_TIME_STEPSIZE_MODE_PREG } +}; + +/* refclk100MHz_32b_PCIe_ln_ext_ssc */ +static struct cdns_reg_pairs cdns_pcie_ln_regs_ext_ssc[] = { + {0x813E ,SIERRA_CLKPATHCTRL_TMR_PREG }, + {0x8047 ,SIERRA_RX_CREQ_FLTR_A_MODE3_PREG }, + {0x808F ,SIERRA_RX_CREQ_FLTR_A_MODE2_PREG }, + {0x808F ,SIERRA_RX_CREQ_FLTR_A_MODE1_PREG }, + {0x808F ,SIERRA_RX_CREQ_FLTR_A_MODE0_PREG }, + {0x033C ,SIERRA_RX_CTLE_MAINTENANCE_PREG }, + {0x44CC ,SIERRA_CREQ_EQ_OPEN_EYE_THRESH_PREG } +}; + +/* refclk100MHz_20b_USB_cmn_pll_ext_ssc */ +static struct cdns_reg_pairs cdns_usb_cmn_regs_ext_ssc[] = { + {0x2085 ,SIERRA_CMN_PLLLC_LF_COEFF_MODE1_PREG }, + {0x2085 ,SIERRA_CMN_PLLLC_LF_COEFF_MODE0_PREG }, + {0x0000 ,SIERRA_CMN_PLLLC_BWCAL_MODE0_PREG }, + {0x0000 ,SIERRA_CMN_PLLLC_SS_TIME_STEPSIZE_MODE_PREG } +}; + +/* refclk100MHz_20b_USB_ln_ext_ssc */ +static struct cdns_reg_pairs cdns_usb_ln_regs_ext_ssc[] = { {0xFE0A ,SIERRA_DET_STANDEC_A_PREG }, {0x000F ,SIERRA_DET_STANDEC_B_PREG }, - {0x55A5 ,SIERRA_DET_STANDEC_C_PREG }, - {0x69AD ,SIERRA_DET_STANDEC_D_PREG }, + {0x00A5 ,SIERRA_DET_STANDEC_C_PREG }, + {0x69ad ,SIERRA_DET_STANDEC_D_PREG }, {0x0241 ,SIERRA_DET_STANDEC_E_PREG }, - {0x0110 ,SIERRA_PSM_LANECAL_PREG }, + {0x0010 ,SIERRA_PSM_LANECAL_DLY_A1_RESETS_PREG }, + {0x0014 ,SIERRA_PSM_A0IN_TMR_PREG }, {0xCF00 ,SIERRA_PSM_DIAG_PREG }, {0x001F ,SIERRA_PSC_TX_A0_PREG }, {0x0007 ,SIERRA_PSC_TX_A1_PREG }, {0x0003 ,SIERRA_PSC_TX_A2_PREG }, {0x0003 ,SIERRA_PSC_TX_A3_PREG }, {0x0FFF ,SIERRA_PSC_RX_A0_PREG }, - {0x0003 ,SIERRA_PSC_RX_A1_PREG }, + {0x0619 ,SIERRA_PSC_RX_A1_PREG }, {0x0003 ,SIERRA_PSC_RX_A2_PREG }, {0x0001 ,SIERRA_PSC_RX_A3_PREG }, {0x0001 ,SIERRA_PLLCTRL_SUBRATE_PREG }, {0x0406 ,SIERRA_PLLCTRL_GEN_D_PREG }, + {0x5233 ,SIERRA_PLLCTRL_CPGAIN_MODE_PREG }, + {0x00CA ,SIERRA_CLKPATH_BIASTRIM_PREG }, + {0x2512 ,SIERRA_DFE_BIASTRIM_PREG }, {0x0000 ,SIERRA_DRVCTRL_ATTEN_PREG }, - {0x823E ,SIERRA_CLKPATHCTRL_TMR_PREG }, - {0x078F ,SIERRA_RX_CREQ_FLTR_A_MODE1_PREG }, - {0x078F ,SIERRA_RX_CREQ_FLTR_A_MODE0_PREG }, + {0x873E ,SIERRA_CLKPATHCTRL_TMR_PREG }, + {0x03CF ,SIERRA_RX_CREQ_FLTR_A_MODE1_PREG }, + {0x01CE ,SIERRA_RX_CREQ_FLTR_A_MODE0_PREG }, {0x7B3C ,SIERRA_CREQ_CCLKDET_MODE01_PREG }, - {0x023C ,SIERRA_RX_CTLE_MAINTENANCE_PREG }, + {0x033F ,SIERRA_RX_CTLE_MAINTENANCE_PREG }, {0x3232 ,SIERRA_CREQ_FSMCLK_SEL_PREG }, - {0x8452 ,SIERRA_CTLELUT_CTRL_PREG }, - {0x4121 ,SIERRA_DFE_ECMP_RATESEL_PREG }, - {0x4121 ,SIERRA_DFE_SMP_RATESEL_PREG }, - {0x9999 ,SIERRA_DEQ_VGATUNE_CTRL_PREG }, - {0x0330 ,SIERRA_TMRVAL_MODE0_PREG }, - {0x01FF ,SIERRA_PICNT_MODE1_PREG }, + {0x0000 ,SIERRA_CREQ_EQ_CTRL_PREG }, + {0x8000 ,SIERRA_CREQ_SPARE_PREG }, + {0xCC44 ,SIERRA_CREQ_EQ_OPEN_EYE_THRESH_PREG }, + {0x8453 ,SIERRA_CTLELUT_CTRL_PREG }, + {0x4110 ,SIERRA_DFE_ECMP_RATESEL_PREG }, + {0x4110 ,SIERRA_DFE_SMP_RATESEL_PREG }, + {0x0002 ,SIERRA_DEQ_PHALIGN_CTRL }, + {0x3200 ,SIERRA_DEQ_CONCUR_CTRL1_PREG }, + {0x5064 ,SIERRA_DEQ_CONCUR_CTRL2_PREG }, + {0x0030 ,SIERRA_DEQ_EPIPWR_CTRL2_PREG }, + {0x0048 ,SIERRA_DEQ_FAST_MAINT_CYCLES_PREG }, + {0x5A5A ,SIERRA_DEQ_ERRCMP_CTRL_PREG }, + {0x02F5 ,SIERRA_DEQ_OFFSET_CTRL_PREG }, + {0x02F5 ,SIERRA_DEQ_GAIN_CTRL_PREG }, + {0x9A8A ,SIERRA_DEQ_VGATUNE_CTRL_PREG }, + {0x0014 ,SIERRA_DEQ_GLUT0 }, + {0x0014 ,SIERRA_DEQ_GLUT1 }, + {0x0014 ,SIERRA_DEQ_GLUT2 }, + {0x0014 ,SIERRA_DEQ_GLUT3 }, + {0x0014 ,SIERRA_DEQ_GLUT4 }, + {0x0014 ,SIERRA_DEQ_GLUT5 }, + {0x0014 ,SIERRA_DEQ_GLUT6 }, + {0x0014 ,SIERRA_DEQ_GLUT7 }, + {0x0014 ,SIERRA_DEQ_GLUT8 }, + {0x0014 ,SIERRA_DEQ_GLUT9 }, + {0x0014 ,SIERRA_DEQ_GLUT10 }, + {0x0014 ,SIERRA_DEQ_GLUT11 }, + {0x0014 ,SIERRA_DEQ_GLUT12 }, + {0x0014 ,SIERRA_DEQ_GLUT13 }, + {0x0014 ,SIERRA_DEQ_GLUT14 }, + {0x0014 ,SIERRA_DEQ_GLUT15 }, + {0x0014 ,SIERRA_DEQ_GLUT16 }, + {0x0BAE ,SIERRA_DEQ_ALUT0 }, + {0x0AEB ,SIERRA_DEQ_ALUT1 }, + {0x0A28 ,SIERRA_DEQ_ALUT2 }, + {0x0965 ,SIERRA_DEQ_ALUT3 }, + {0x08A2 ,SIERRA_DEQ_ALUT4 }, + {0x07DF ,SIERRA_DEQ_ALUT5 }, + {0x071C ,SIERRA_DEQ_ALUT6 }, + {0x0659 ,SIERRA_DEQ_ALUT7 }, + {0x0596 ,SIERRA_DEQ_ALUT8 }, + {0x0514 ,SIERRA_DEQ_ALUT9 }, + {0x0492 ,SIERRA_DEQ_ALUT10 }, + {0x0410 ,SIERRA_DEQ_ALUT11 }, + {0x038E ,SIERRA_DEQ_ALUT12 }, + {0x030C ,SIERRA_DEQ_ALUT13 }, + {0x03F4 ,SIERRA_DEQ_DFETAP_CTRL_PREG }, + {0x0001 ,SIERRA_DFE_EN_1010_IGNORE_PREG }, + {0x3C01 ,SIERRA_DEQ_TAU_CTRL1_FAST_MAINT_PREG }, + {0x3C40 ,SIERRA_DEQ_TAU_CTRL1_SLOW_MAINT_PREG }, + {0x1C08 ,SIERRA_DEQ_TAU_CTRL2_PREG }, + {0x0033 ,SIERRA_DEQ_PICTRL_PREG }, + {0x0400 ,SIERRA_CPICAL_TMRVAL_MODE1_PREG }, + {0x0330 ,SIERRA_CPICAL_TMRVAL_MODE0_PREG }, + {0x01FF ,SIERRA_CPICAL_PICNT_MODE1_PREG }, {0x0009 ,SIERRA_CPI_OUTBUF_RATESEL_PREG }, + {0x3232 ,SIERRA_CPICAL_RES_STARTCODE_MODE23_PREG }, + {0x0005 ,SIERRA_LFPSDET_SUPPORT_PREG }, {0x000F ,SIERRA_LFPSFILT_NS_PREG }, {0x0009 ,SIERRA_LFPSFILT_RD_PREG }, {0x0001 ,SIERRA_LFPSFILT_MP_PREG }, {0x8013 ,SIERRA_SDFILT_H2L_A_PREG }, - {0x0400 ,SIERRA_TMRVAL_MODE1_PREG }, -}; - -static struct cdns_reg_pairs cdns_pcie_regs[] = { -/* -* Write PCIe configuration parameters to the PHY. -* These values are specific to this specific hardware -* configuration. -*/ - {0x891f ,SIERRA_DET_STANDEC_D_PREG }, - {0x0053 ,SIERRA_DET_STANDEC_E_PREG }, - {0x0400 ,SIERRA_TMRVAL_MODE2_PREG }, - {0x0200 ,SIERRA_TMRVAL_MODE3_PREG }, + {0x8009 ,SIERRA_SDFILT_L2H_PREG }, + {0x0024 ,SIERRA_RXBUFFER_CTLECTRL_PREG }, + {0x0020 ,SIERRA_RXBUFFER_RCDFECTRL_PREG }, + {0x4243 ,SIERRA_RXBUFFER_DFECTRL_PREG } };static const struct cdns_sierra_data cdns_map_sierra = {SIERRA_MACRO_ID ,0x2 ,0x2 , -ARRAY_SIZE (cdns_pcie_regs), -ARRAY_SIZE (cdns_usb_regs), - cdns_pcie_regs, - cdns_usb_regs +ARRAY_SIZE (cdns_pcie_cmn_regs_ext_ssc), +ARRAY_SIZE (cdns_pcie_ln_regs_ext_ssc), +ARRAY_SIZE (cdns_usb_cmn_regs_ext_ssc), +ARRAY_SIZE (cdns_usb_ln_regs_ext_ssc), + cdns_pcie_cmn_regs_ext_ssc, + cdns_pcie_ln_regs_ext_ssc, + cdns_usb_cmn_regs_ext_ssc, + cdns_usb_ln_regs_ext_ssc, };static const struct cdns_sierra_data cdns_ti_map_sierra = {SIERRA_MACRO_ID ,0x0 ,0x1 , -ARRAY_SIZE (cdns_pcie_regs), -ARRAY_SIZE (cdns_usb_regs), - cdns_pcie_regs, - cdns_usb_regs +ARRAY_SIZE (cdns_pcie_cmn_regs_ext_ssc), +ARRAY_SIZE (cdns_pcie_ln_regs_ext_ssc), +ARRAY_SIZE (cdns_usb_cmn_regs_ext_ssc), +ARRAY_SIZE (cdns_usb_ln_regs_ext_ssc), + cdns_pcie_cmn_regs_ext_ssc, + cdns_pcie_ln_regs_ext_ssc, + cdns_usb_cmn_regs_ext_ssc, + cdns_usb_ln_regs_ext_ssc, };static const struct of_device_id cdns_sierra_id_table[] = {
Signature · 1 line
2.17.1
PATCH v4 8/14 phy: cadence: Sierra: Get reset control "array" for each link
In reply to Kishon Vijay Abraham IA link may have multiple lanes each with a separate reset. Get reset control "array" in order to reset all the lanes associated with the link.
--- drivers/phy/cadence/phy-cadence-sierra.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/phy/cadence/phy-cadence-sierra.c +1 -1
@@ -499,7 +499,7 @@ static int cdns_sierra_phy_probe(struct platform_device *pdev)struct phy *gphy; sp->phys[node].lnk_rst = -of_reset_control_get_exclusive_by_index (child,0 ); +of_reset_control_array_get_exclusive (child);if (IS_ERR (sp->phys[node].lnk_rst)) { dev_err(dev, "failed to get reset %s\n",
Signature · 1 line
2.17.1
PATCH v4 9/14 phy: cadence: Sierra: Check for PLL lock during PHY power on
In reply to Kishon Vijay Abraham ICheck for PLL lock during PHY power on.
--- drivers/phy/cadence/phy-cadence-sierra.c | 33 +++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-)
drivers/phy/cadence/phy-cadence-sierra.c +32 -1
@@ -55,6 +55,7 @@#define SIERRA_PLLCTRL_SUBRATE_PREG 0x03A#define SIERRA_PLLCTRL_GEN_D_PREG 0x03E#define SIERRA_PLLCTRL_CPGAIN_MODE_PREG 0x03F +#define SIERRA_PLLCTRL_STATUS_PREG 0x044#define SIERRA_CLKPATH_BIASTRIM_PREG 0x04B#define SIERRA_DFE_BIASTRIM_PREG 0x04C#define SIERRA_DRVCTRL_ATTEN_PREG 0x06A
@@ -141,11 +142,14 @@#define SIERRA_MACRO_ID 0x00007364#define SIERRA_MAX_LANES 4 +#define PLL_LOCK_TIME 100000static const struct reg_field macro_id_type =REG_FIELD (SIERRA_MACRO_ID_REG ,0 ,15 );static const struct reg_field phy_pll_cfg_1 =REG_FIELD (SIERRA_PHY_PLL_CFG ,1 ,1 ); +static const struct reg_field pllctrl_lock = +REG_FIELD (SIERRA_PLLCTRL_STATUS_PREG ,0 ,0 );struct cdns_sierra_inst {struct phy *phy;
@@ -192,6 +196,7 @@ struct cdns_sierra_phy {struct regmap *regmap_common_cdb;struct regmap_field *macro_id_type;struct regmap_field *phy_pll_cfg_1; +struct regmap_field *pllctrl_lock[SIERRA_MAX_LANES ];struct clk *clk;int nsubnodes;bool autoconf;
@@ -291,10 +296,25 @@ static int cdns_sierra_phy_init(struct phy *gphy)static int cdns_sierra_phy_on (struct phy *gphy) { +struct cdns_sierra_phy *sp =dev_get_drvdata (gphy->dev.parent);struct cdns_sierra_inst *ins =phy_get_drvdata (gphy); +struct device *dev = sp->dev; +u32 val; +int ret;/* Take the PHY lane group out of reset */ -return reset_control_deassert (ins->lnk_rst); + ret =reset_control_deassert (ins->lnk_rst); +if (ret) { +dev_err (dev,"Failed to take the PHY lane out of reset\n" ); +return ret; + } + + ret =regmap_field_read_poll_timeout (sp->pllctrl_lock[ins->mlane], + val, val,1000 ,PLL_LOCK_TIME ); +if (ret <0 ) +dev_err (dev,"PLL lock of lane failed\n" ); + +return ret; }static int cdns_sierra_phy_off (struct phy *gphy)
@@ -350,6 +370,7 @@ static int cdns_regfield_init(struct cdns_sierra_phy *sp)struct device *dev = sp->dev;struct regmap_field *field;struct regmap *regmap; +int i; regmap = sp->regmap_common_cdb; field =devm_regmap_field_alloc (dev, regmap, macro_id_type);
@@ -367,6 +388,16 @@ static int cdns_regfield_init(struct cdns_sierra_phy *sp) } sp->phy_pll_cfg_1 = field; +for (i =0 ; i <SIERRA_MAX_LANES ; i++) { + regmap = sp->regmap_lane_cdb[i]; + field =devm_regmap_field_alloc (dev, regmap, pllctrl_lock); +if (IS_ERR (field)) { +dev_err (dev,"P%d_ENABLE reg field init failed\n" , i); +return PTR_ERR (field); + } + sp->pllctrl_lock[i] = field; + } +return 0 ; }
Signature · 1 line
2.17.1
PATCH v4 10/14 phy: cadence: Sierra: Change MAX_LANES of Sierra to 16
In reply to Kishon Vijay Abraham ISierra SERDES IP supports upto 16 lanes (though not all of it will be enabled in a platform). Allow Sierra driver to support a maximum of upto 16 lanes.
--- drivers/phy/cadence/phy-cadence-sierra.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-)
drivers/phy/cadence/phy-cadence-sierra.c +21 -1
@@ -141,7 +141,7 @@#define SIERRA_PHY_PLL_CFG 0xe#define SIERRA_MACRO_ID 0x00007364 -#define SIERRA_MAX_LANES 4 +#define SIERRA_MAX_LANES 16#define PLL_LOCK_TIME 100000 static const struct reg_field macro_id_type =
@@ -199,6 +199,7 @@ struct cdns_sierra_phy {struct regmap_field *pllctrl_lock[SIERRA_MAX_LANES ];struct clk *clk;int nsubnodes; +u32 num_lanes;bool autoconf; };
@@ -235,6 +236,18 @@ static struct regmap_config cdns_sierra_lane_cdb_config[] = {SIERRA_LANE_CDB_REGMAP_CONF ("1" ),SIERRA_LANE_CDB_REGMAP_CONF ("2" ),SIERRA_LANE_CDB_REGMAP_CONF ("3" ), +SIERRA_LANE_CDB_REGMAP_CONF ("4" ), +SIERRA_LANE_CDB_REGMAP_CONF ("5" ), +SIERRA_LANE_CDB_REGMAP_CONF ("6" ), +SIERRA_LANE_CDB_REGMAP_CONF ("7" ), +SIERRA_LANE_CDB_REGMAP_CONF ("8" ), +SIERRA_LANE_CDB_REGMAP_CONF ("9" ), +SIERRA_LANE_CDB_REGMAP_CONF ("10" ), +SIERRA_LANE_CDB_REGMAP_CONF ("11" ), +SIERRA_LANE_CDB_REGMAP_CONF ("12" ), +SIERRA_LANE_CDB_REGMAP_CONF ("13" ), +SIERRA_LANE_CDB_REGMAP_CONF ("14" ), + SIERRA_LANE_CDB_REGMAP_CONF("15"), }; static struct regmap_config cdns_sierra_common_cdb_config = {
@@ -548,6 +561,8 @@ static int cdns_sierra_phy_probe(struct platform_device *pdev) } } + sp->num_lanes += sp->phys[node].num_lanes; + gphy =devm_phy_create (dev, child, &ops);if (IS_ERR (gphy)) {
@@ -561,6 +576,11 @@ static int cdns_sierra_phy_probe(struct platform_device *pdev) } sp->nsubnodes = node; +if (sp->num_lanes >SIERRA_MAX_LANES ) { +dev_err (dev,"Invalid lane configuration\n" ); + goto put_child2; + } +/* If more than one subnode, configure the PHY as multilink */ if (!sp->autoconf && sp->nsubnodes >1 )regmap_field_write (sp->phy_pll_cfg_1,0x1 );
Signature · 1 line
2.17.1
PATCH v4 11/14 phy: cadence: Sierra: Set cmn_refclk_dig_div/cmn_refclk1_dig_div frequency to 25MHz
In reply to Kishon Vijay Abraham ISet cmn_refclk_dig_div/cmn_refclk1_dig_div frequency to 25MHz as specified in "Common Module Clock Configurations" of the Cadence Sierra 16FFC Multi-Protocol PHY PMA Specification. It is set to 25MHz since the only user of Cadence Sierra SERDES, TI J721E SoC provides input clock frequency of 100MHz. For other frequencies, cmn_refclk_dig_div/cmn_refclk1_dig_div should be configured based on the "Common Module Clock Configurations".
--- drivers/phy/cadence/phy-cadence-sierra.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)
drivers/phy/cadence/phy-cadence-sierra.c +21 -0
@@ -198,6 +198,8 @@ struct cdns_sierra_phy {struct regmap_field *phy_pll_cfg_1;struct regmap_field *pllctrl_lock[SIERRA_MAX_LANES ];struct clk *clk; +struct clk *cmn_refclk_dig_div; +struct clk *cmn_refclk1_dig_div;int nsubnodes;u32 num_lanes;bool autoconf;
@@ -279,6 +281,8 @@ static int cdns_sierra_phy_init(struct phy *gphy)if (phy->autoconf)return 0 ; +clk_set_rate (phy->cmn_refclk_dig_div,25000000 ); +clk_set_rate (phy->cmn_refclk1_dig_div,25000000 );if (ins->phy_type ==PHY_TYPE_PCIE ) { num_cmn_regs = phy->init_data->pcie_cmn_regs; num_ln_regs = phy->init_data->pcie_ln_regs;
@@ -468,6 +472,7 @@ static int cdns_sierra_phy_probe(struct platform_device *pdev)struct resource *res;int i, ret, node =0 ;void __iomem *base; +struct clk *clk;struct device_node *dn = dev->of_node, *child;if (of_get_child_count (dn) ==0 )
@@ -523,6 +528,22 @@ static int cdns_sierra_phy_probe(struct platform_device *pdev)return PTR_ERR (sp->apb_rst); } + clk =devm_clk_get_optional (dev,"cmn_refclk_dig_div" ); +if (IS_ERR (clk)) { +dev_err (dev,"cmn_refclk_dig_div clock not found\n" ); + ret =PTR_ERR (clk); +return ret; + } + sp->cmn_refclk_dig_div = clk; + + clk =devm_clk_get_optional (dev,"cmn_refclk1_dig_div" ); +if (IS_ERR (clk)) { +dev_err (dev,"cmn_refclk1_dig_div clock not found\n" ); + ret =PTR_ERR (clk); +return ret; + } + sp->cmn_refclk1_dig_div = clk; + ret =clk_prepare_enable (sp->clk);if (ret)return ret;
Signature · 1 line
2.17.1
PATCH v4 12/14 phy: cadence: Sierra: Use correct dev pointer in cdns_sierra_phy_remove()
In reply to Kishon Vijay Abraham Icommit 44d30d622821d3b ("phy: cadence: Add driver for Sierra PHY"), incorrectly used parent device pointer to get driver data. Fix it here.
--- drivers/phy/cadence/phy-cadence-sierra.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/phy/cadence/phy-cadence-sierra.c +1 -1
@@ -625,7 +625,7 @@ static int cdns_sierra_phy_probe(struct platform_device *pdev)static int cdns_sierra_phy_remove (struct platform_device *pdev) { -struct cdns_sierra_phy *phy =dev_get_drvdata (pdev->dev.parent); +struct cdns_sierra_phy *phy =platform_get_drvdata (pdev);int i;reset_control_assert (phy->phy_rst);
Signature · 1 line
2.17.1
PATCH v4 13/14 dt-bindings: phy: Document WIZ (SERDES wrapper) bindings
In reply to Kishon Vijay Abraham IAdd DT binding documentation for WIZ (SERDES wrapper). WIZ is *NOT* a PHY but a wrapper used to configure some of the input signals to the SERDES. It is used with both Sierra(16G) and Torrent(10G) serdes.
[[email protected]: Add separate compatible for Sierra(16G) and Torrent(10G)
SERDES]
--- .../bindings/phy/ti,phy-j721e-wiz.yaml | 204 ++++++++++++++++++ 1 file changed, 204 insertions(+) create mode 100644 Documentation/devicetree/bindings/phy/ti,phy-j721e-wiz.yaml
Documentation/devicetree/bindings/phy/ti,phy-j721e-wiz.yaml new file +204 -0
@@ -0,0 +1,204 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +# Copyright (C) 2019 Texas Instruments Incorporated - http://www.ti.com/ +%YAML 1.2 +--- +$id: "http://devicetree.org/schemas/phy/ti,phy-j721e-wiz.yaml#" +$schema: "http://devicetree.org/meta-schemas/core.yaml#" + +title: TI J721E WIZ (SERDES Wrapper) + +maintainers: + - Kishon Vijay Abraham I <[email protected]> + +properties: + compatible: + enum: + - ti,j721e-wiz-16g + - ti,j721e-wiz-10g + + power-domains: + maxItems: 1 + + clocks: + maxItems: 3 + description: clock-specifier to represent input to the WIZ + + clock-names: + items: + - const: fck + - const: core_ref_clk + - const: ext_ref_clk + + num-lanes: + minimum: 1 + maximum: 4 + + "#address-cells": + const: 1 + + "#size-cells": + const: 1 + + "#reset-cells": + const: 1 + + ranges: true + + assigned-clocks: + maxItems: 2 + + assigned-clock-parents: + maxItems: 2 + +patternProperties: + "^pll[0|1]-refclk$": + type: object + description: | + WIZ node should have subnodes for each of the PLLs present in + the SERDES. + properties: + clocks: + maxItems: 2 + description: Phandle to clock nodes representing the two inputs to PLL. + + "#clock-cells": + const: 0 + + assigned-clocks: + maxItems: 1 + + assigned-clock-parents: + maxItems: 1 + + required: + - clocks + - "#clock-cells" + - assigned-clocks + - assigned-clock-parents + + "^cmn-refclk1?-dig-div$": + type: object + description: | + WIZ node should have subnodes for each of the PMA common refclock + provided by the SERDES. + properties: + clocks: + maxItems: 1 + description: Phandle to the clock node representing the input to the + divider clock. + + "#clock-cells": + const: 0 + + required: + - clocks + - "#clock-cells" + + "^refclk-dig$": + type: object + description: | + WIZ node should have subnode for refclk_dig to select the reference + clock source for the reference clock used in the PHY and PMA digital + logic. + properties: + clocks: + maxItems: 4 + description: Phandle to four clock nodes representing the inputs to + refclk_dig + + "#clock-cells": + const: 0 + + assigned-clocks: + maxItems: 1 + + assigned-clock-parents: + maxItems: 1 + + required: + - clocks + - "#clock-cells" + - assigned-clocks + - assigned-clock-parents + + "^serdes@[0-9a-f]+$": + type: object + description: | + WIZ node should have '1' subnode for the SERDES. It could be either + Sierra SERDES or Torrent SERDES. Sierra SERDES should follow the + bindings specified in + Documentation/devicetree/bindings/phy/phy-cadence-sierra.txt + Torrent SERDES should follow the bindings specified in + Documentation/devicetree/bindings/phy/phy-cadence-dp.txt + +required: + - compatible + - power-domains + - clocks + - clock-names + - num-lanes + - "#address-cells" + - "#size-cells" + - "#reset-cells" + - ranges + +examples: + - | + #include <dt-bindings/soc/ti,sci_pm_domain.h> + + wiz@5000000 { + compatible = "ti,j721e-wiz-16g"; + #address-cells = <1>; + #size-cells = <1>; + power-domains = <&k3_pds 292 TI_SCI_PD_EXCLUSIVE>; + clocks = <&k3_clks 292 5>, <&k3_clks 292 11>, <&dummy_cmn_refclk>; + clock-names = "fck", "core_ref_clk", "ext_ref_clk"; + assigned-clocks = <&k3_clks 292 11>, <&k3_clks 292 0>; + assigned-clock-parents = <&k3_clks 292 15>, <&k3_clks 292 4>; + num-lanes = <2>; + #reset-cells = <1>; + ranges = <0x5000000 0x0 0x5000000 0x10000>; + + pll0-refclk { + clocks = <&k3_clks 293 13>, <&dummy_cmn_refclk>; + #clock-cells = <0>; + assigned-clocks = <&wiz1_pll0_refclk>; + assigned-clock-parents = <&k3_clks 293 13>; + }; + + pll1-refclk { + clocks = <&k3_clks 293 0>, <&dummy_cmn_refclk1>; + #clock-cells = <0>; + assigned-clocks = <&wiz1_pll1_refclk>; + assigned-clock-parents = <&k3_clks 293 0>; + }; + + cmn-refclk-dig-div { + clocks = <&wiz1_refclk_dig>; + #clock-cells = <0>; + }; + + cmn-refclk1-dig-div { + clocks = <&wiz1_pll1_refclk>; + #clock-cells = <0>; + }; + + refclk-dig { + clocks = <&k3_clks 292 11>, <&k3_clks 292 0>, <&dummy_cmn_refclk>, <&dummy_cmn_refclk1>; + #clock-cells = <0>; + assigned-clocks = <&wiz0_refclk_dig>; + assigned-clock-parents = <&k3_clks 292 11>; + }; + + serdes@5000000 { + compatible = "cdns,ti,sierra-phy-t0"; + reg-names = "serdes"; + reg = <0x5000000 0x10000>; + #address-cells = <1>; + #size-cells = <0>; + resets = <&serdes_wiz0 0>; + reset-names = "sierra_reset"; + clocks = <&wiz0_cmn_refclk_dig_div>, <&wiz0_cmn_refclk1_dig_div>; + clock-names = "cmn_refclk_dig_div", "cmn_refclk1_dig_div"; + }; + };
Signature · 1 line
2.17.1
Rob Herring
maintainerRe: [PATCH v4 13/14] dt-bindings: phy: Document WIZ (SERDES wrapper) bindings
Quoted 26 lines · Kishon Vijay Abraham I
Add DT binding documentation for WIZ (SERDES wrapper). WIZ is *NOT* a PHY but a wrapper used to configure some of the input signals to the SERDES. It is used with both Sierra(16G) and Torrent(10G) serdes.
Signed-off-by Kishon Vijay Abraham I <[email protected]>[[email protected]: Add separate compatible for Sierra(16G) and Torrent(10G)
SERDES]Signed-off-by Jyri Sarha <[email protected]>--- .../bindings/phy/ti,phy-j721e-wiz.yaml | 204 ++++++++++++++++++ 1 file changed, 204 insertions(+) create mode 100644 Documentation/devicetree/bindings/phy/ti,phy-j721e-wiz.yamlDocumentation/devicetree/bindings/phy/ti,phy-j721e-wiz.yaml new file +7
-0@@ -0,0 +1,204 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +# Copyright (C) 2019 Texas Instruments Incorporated - http://www.ti.com/ +%YAML 1.2 +--- +$id: "http://devicetree.org/schemas/phy/ti,phy-j721e-wiz.yaml#" +$schema: "http://devicetree.org/meta-schemas/core.yaml#" +
Documentation/devicetree/bindings/phy/ti,phy-j721e-wiz.yaml line 17
Quoted 10 lines
Documentation/devicetree/bindings/phy/ti,phy-j721e-wiz.yaml new file +10
-0+title: TI J721E WIZ (SERDES Wrapper) + +maintainers: + - Kishon Vijay Abraham I <[email protected]> + +properties: + compatible: + enum: + - ti,j721e-wiz-16g + - ti,j721e-wiz-10g
Tab size is 2 spaces.
Quoted 27 lines
Documentation/devicetree/bindings/phy/ti,phy-j721e-wiz.yaml new file +27
-0+ + power-domains: + maxItems: 1 + + clocks: + maxItems: 3 + description: clock-specifier to represent input to the WIZ + + clock-names: + items: + - const: fck + - const: core_ref_clk + - const: ext_ref_clk + + num-lanes: + minimum: 1 + maximum: 4 + + "#address-cells": + const: 1 + + "#size-cells": + const: 1 + + "#reset-cells": + const: 1 +
Documentation/devicetree/bindings/phy/ti,phy-j721e-wiz.yaml line 54
Quoted 10 lines
Documentation/devicetree/bindings/phy/ti,phy-j721e-wiz.yaml new file +10
-0+ ranges: true + + assigned-clocks: + maxItems: 2 + + assigned-clock-parents: + maxItems: 2 + +patternProperties: + "^pll[0|1]-refclk$":
Indentation
Documentation/devicetree/bindings/phy/ti,phy-j721e-wiz.yaml line 56
Quoted 2 lines
Documentation/devicetree/bindings/phy/ti,phy-j721e-wiz.yaml new file +2
-0+ type: object + description: |
Don't need the '|' unless there's formatting or multiple paragraphs.
Quoted 13 lines
Documentation/devicetree/bindings/phy/ti,phy-j721e-wiz.yaml new file +13
-0+ WIZ node should have subnodes for each of the PLLs present in + the SERDES. + properties: + clocks: + maxItems: 2 + description: Phandle to clock nodes representing the two inputs to PLL. + + "#clock-cells": + const: 0 + + assigned-clocks: + maxItems: 1 +
Documentation/devicetree/bindings/phy/ti,phy-j721e-wiz.yaml line 79
Quoted 10 lines
Documentation/devicetree/bindings/phy/ti,phy-j721e-wiz.yaml new file +10
-0+ assigned-clock-parents: + maxItems: 1 + + required: + - clocks + - "#clock-cells" + - assigned-clocks + - assigned-clock-parents + + "^cmn-refclk1?-dig-div$":
Indentation
Quoted 8 lines
Documentation/devicetree/bindings/phy/ti,phy-j721e-wiz.yaml new file +8
-0+ type: object + description: | + WIZ node should have subnodes for each of the PMA common refclock + provided by the SERDES. + properties: + clocks: + maxItems: 1 + description: Phandle to the clock node representing the input to the
Documentation/devicetree/bindings/phy/ti,phy-j721e-wiz.yaml line 97
Quoted 10 lines
Documentation/devicetree/bindings/phy/ti,phy-j721e-wiz.yaml new file +10
-0+ divider clock. + + "#clock-cells": + const: 0 + + required: + - clocks + - "#clock-cells" + + "^refclk-dig$":
Indentation
Quoted 27 lines
Documentation/devicetree/bindings/phy/ti,phy-j721e-wiz.yaml new file +27
-0+ type: object + description: | + WIZ node should have subnode for refclk_dig to select the reference + clock source for the reference clock used in the PHY and PMA digital + logic. + properties: + clocks: + maxItems: 4 + description: Phandle to four clock nodes representing the inputs to + refclk_dig + + "#clock-cells": + const: 0 + + assigned-clocks: + maxItems: 1 + + assigned-clock-parents: + maxItems: 1 + + required: + - clocks + - "#clock-cells" + - assigned-clocks + - assigned-clock-parents + + "^serdes@[0-9a-f]+$":
...
Quoted 83 lines
Documentation/devicetree/bindings/phy/ti,phy-j721e-wiz.yaml new file +80
-0+ type: object + description: | + WIZ node should have '1' subnode for the SERDES. It could be either + Sierra SERDES or Torrent SERDES. Sierra SERDES should follow the + bindings specified in + Documentation/devicetree/bindings/phy/phy-cadence-sierra.txt + Torrent SERDES should follow the bindings specified in + Documentation/devicetree/bindings/phy/phy-cadence-dp.txt + +required: + - compatible + - power-domains + - clocks + - clock-names + - num-lanes + - "#address-cells" + - "#size-cells" + - "#reset-cells" + - ranges + +examples: + - | + #include <dt-bindings/soc/ti,sci_pm_domain.h> + + wiz@5000000 { + compatible = "ti,j721e-wiz-16g"; + #address-cells = <1>; + #size-cells = <1>; + power-domains = <&k3_pds 292 TI_SCI_PD_EXCLUSIVE>; + clocks = <&k3_clks 292 5>, <&k3_clks 292 11>, <&dummy_cmn_refclk>; + clock-names = "fck", "core_ref_clk", "ext_ref_clk"; + assigned-clocks = <&k3_clks 292 11>, <&k3_clks 292 0>; + assigned-clock-parents = <&k3_clks 292 15>, <&k3_clks 292 4>; + num-lanes = <2>; + #reset-cells = <1>; + ranges = <0x5000000 0x0 0x5000000 0x10000>; + + pll0-refclk { + clocks = <&k3_clks 293 13>, <&dummy_cmn_refclk>; + #clock-cells = <0>; + assigned-clocks = <&wiz1_pll0_refclk>; + assigned-clock-parents = <&k3_clks 293 13>; + }; + + pll1-refclk { + clocks = <&k3_clks 293 0>, <&dummy_cmn_refclk1>; + #clock-cells = <0>; + assigned-clocks = <&wiz1_pll1_refclk>; + assigned-clock-parents = <&k3_clks 293 0>; + }; + + cmn-refclk-dig-div { + clocks = <&wiz1_refclk_dig>; + #clock-cells = <0>; + }; + + cmn-refclk1-dig-div { + clocks = <&wiz1_pll1_refclk>; + #clock-cells = <0>; + }; + + refclk-dig { + clocks = <&k3_clks 292 11>, <&k3_clks 292 0>, <&dummy_cmn_refclk>, <&dummy_cmn_refclk1>; + #clock-cells = <0>; + assigned-clocks = <&wiz0_refclk_dig>; + assigned-clock-parents = <&k3_clks 292 11>; + }; + + serdes@5000000 { + compatible = "cdns,ti,sierra-phy-t0"; + reg-names = "serdes"; + reg = <0x5000000 0x10000>; + #address-cells = <1>; + #size-cells = <0>; + resets = <&serdes_wiz0 0>; + reset-names = "sierra_reset"; + clocks = <&wiz0_cmn_refclk_dig_div>, <&wiz0_cmn_refclk1_dig_div>; + clock-names = "cmn_refclk_dig_div", "cmn_refclk1_dig_div"; + }; + };Signature · 1 line
2.17.1
PATCH v5 13/14 dt-bindings: phy: Document WIZ (SERDES wrapper) bindings
In reply to Kishon Vijay Abraham IAdd DT binding documentation for WIZ (SERDES wrapper). WIZ is *NOT* a PHY but a wrapper used to configure some of the input signals to the SERDES. It is used with both Sierra(16G) and Torrent(10G) serdes.
[[email protected]: Add separate compatible for Sierra(16G) and Torrent(10G)
SERDES]
---
Changes from v4:
*) Fixed the indentation as suggested by Rob v4
.../bindings/phy/ti,phy-j721e-wiz.yaml | 204 ++++++++++++++++++ 1 file changed, 204 insertions(+) create mode 100644 Documentation/devicetree/bindings/phy/ti,phy-j721e-wiz.yaml
Documentation/devicetree/bindings/phy/ti,phy-j721e-wiz.yaml new file +204 -0
@@ -0,0 +1,204 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +# Copyright (C) 2019 Texas Instruments Incorporated - http://www.ti.com/ +%YAML 1.2 +--- +$id: "http://devicetree.org/schemas/phy/ti,phy-j721e-wiz.yaml#" +$schema: "http://devicetree.org/meta-schemas/core.yaml#" + +title: TI J721E WIZ (SERDES Wrapper) + +maintainers: + - Kishon Vijay Abraham I <[email protected]> + +properties: + compatible: + enum: + - ti,j721e-wiz-16g + - ti,j721e-wiz-10g + + power-domains: + maxItems: 1 + + clocks: + maxItems: 3 + description: clock-specifier to represent input to the WIZ + + clock-names: + items: + - const: fck + - const: core_ref_clk + - const: ext_ref_clk + + num-lanes: + minimum: 1 + maximum: 4 + + "#address-cells": + const: 1 + + "#size-cells": + const: 1 + + "#reset-cells": + const: 1 + + ranges: true + + assigned-clocks: + maxItems: 2 + + assigned-clock-parents: + maxItems: 2 + +patternProperties: + "^pll[0|1]-refclk$": + type: object + description: | + WIZ node should have subnodes for each of the PLLs present in + the SERDES. + properties: + clocks: + maxItems: 2 + description: Phandle to clock nodes representing the two inputs to PLL. + + "#clock-cells": + const: 0 + + assigned-clocks: + maxItems: 1 + + assigned-clock-parents: + maxItems: 1 + + required: + - clocks + - "#clock-cells" + - assigned-clocks + - assigned-clock-parents + + "^cmn-refclk1?-dig-div$": + type: object + description: + WIZ node should have subnodes for each of the PMA common refclock + provided by the SERDES. + properties: + clocks: + maxItems: 1 + description: Phandle to the clock node representing the input to the + divider clock. + + "#clock-cells": + const: 0 + + required: + - clocks + - "#clock-cells" + + "^refclk-dig$": + type: object + description: | + WIZ node should have subnode for refclk_dig to select the reference + clock source for the reference clock used in the PHY and PMA digital + logic. + properties: + clocks: + maxItems: 4 + description: Phandle to four clock nodes representing the inputs to + refclk_dig + + "#clock-cells": + const: 0 + + assigned-clocks: + maxItems: 1 + + assigned-clock-parents: + maxItems: 1 + + required: + - clocks + - "#clock-cells" + - assigned-clocks + - assigned-clock-parents + + "^serdes@[0-9a-f]+$": + type: object + description: | + WIZ node should have '1' subnode for the SERDES. It could be either + Sierra SERDES or Torrent SERDES. Sierra SERDES should follow the + bindings specified in + Documentation/devicetree/bindings/phy/phy-cadence-sierra.txt + Torrent SERDES should follow the bindings specified in + Documentation/devicetree/bindings/phy/phy-cadence-dp.txt + +required: + - compatible + - power-domains + - clocks + - clock-names + - num-lanes + - "#address-cells" + - "#size-cells" + - "#reset-cells" + - ranges + +examples: + - | + #include <dt-bindings/soc/ti,sci_pm_domain.h> + + wiz@5000000 { + compatible = "ti,j721e-wiz-16g"; + #address-cells = <1>; + #size-cells = <1>; + power-domains = <&k3_pds 292 TI_SCI_PD_EXCLUSIVE>; + clocks = <&k3_clks 292 5>, <&k3_clks 292 11>, <&dummy_cmn_refclk>; + clock-names = "fck", "core_ref_clk", "ext_ref_clk"; + assigned-clocks = <&k3_clks 292 11>, <&k3_clks 292 0>; + assigned-clock-parents = <&k3_clks 292 15>, <&k3_clks 292 4>; + num-lanes = <2>; + #reset-cells = <1>; + ranges = <0x5000000 0x0 0x5000000 0x10000>; + + pll0-refclk { + clocks = <&k3_clks 293 13>, <&dummy_cmn_refclk>; + #clock-cells = <0>; + assigned-clocks = <&wiz1_pll0_refclk>; + assigned-clock-parents = <&k3_clks 293 13>; + }; + + pll1-refclk { + clocks = <&k3_clks 293 0>, <&dummy_cmn_refclk1>; + #clock-cells = <0>; + assigned-clocks = <&wiz1_pll1_refclk>; + assigned-clock-parents = <&k3_clks 293 0>; + }; + + cmn-refclk-dig-div { + clocks = <&wiz1_refclk_dig>; + #clock-cells = <0>; + }; + + cmn-refclk1-dig-div { + clocks = <&wiz1_pll1_refclk>; + #clock-cells = <0>; + }; + + refclk-dig { + clocks = <&k3_clks 292 11>, <&k3_clks 292 0>, <&dummy_cmn_refclk>, <&dummy_cmn_refclk1>; + #clock-cells = <0>; + assigned-clocks = <&wiz0_refclk_dig>; + assigned-clock-parents = <&k3_clks 292 11>; + }; + + serdes@5000000 { + compatible = "cdns,ti,sierra-phy-t0"; + reg-names = "serdes"; + reg = <0x5000000 0x10000>; + #address-cells = <1>; + #size-cells = <0>; + resets = <&serdes_wiz0 0>; + reset-names = "sierra_reset"; + clocks = <&wiz0_cmn_refclk_dig_div>, <&wiz0_cmn_refclk1_dig_div>; + clock-names = "cmn_refclk_dig_div", "cmn_refclk1_dig_div"; + }; + };
Signature · 1 line
2.17.1
Re: [PATCH v5 13/14] dt-bindings: phy: Document WIZ (SERDES wrapper) bindings
Quoted 7 lines · Kishon Vijay Abraham I
Add DT binding documentation for WIZ (SERDES wrapper). WIZ is *NOT* a PHY but a wrapper used to configure some of the input signals to the SERDES. It is used with both Sierra(16G) and Torrent(10G) serdes.
Signed-off-by Kishon Vijay Abraham I <[email protected]>[[email protected]: Add separate compatible for Sierra(16G) and Torrent(10G)
SERDES]
Quoted 9 lines
Signed-off-by Jyri Sarha <[email protected]>---
Changes from v4:
*) Fixed the indentation as suggested by Rob v4.../bindings/phy/ti,phy-j721e-wiz.yaml | 204 ++++++++++++++++++ 1 file changed, 204 insertions(+) create mode 100644 Documentation/devicetree/bindings/phy/ti,phy-j721e-wiz.yaml
Re: [PATCH v5 13/14] dt-bindings: phy: Document WIZ (SERDES wrapper) bindings
Quoted 13 lines · Rob Herring
Quoted 12 lines · Kishon Vijay Abraham I
Add DT binding documentation for WIZ (SERDES wrapper). WIZ is *NOT* a PHY but a wrapper used to configure some of the input signals to the SERDES. It is used with both Sierra(16G) and Torrent(10G) serdes.
Signed-off-by Kishon Vijay Abraham I <[email protected]>[[email protected]: Add separate compatible for Sierra(16G) and Torrent(10G)
SERDES]Signed-off-by Jyri Sarha <[email protected]>---
Changes from v4:
*) Fixed the indentation as suggested by Rob v4
Quoted 6 lines
Quoted 4 lines
.../bindings/phy/ti,phy-j721e-wiz.yaml | 204 ++++++++++++++++++ 1 file changed, 204 insertions(+) create mode 100644 Documentation/devicetree/bindings/phy/ti,phy-j721e-wiz.yamlReviewed-by Rob Herring <[email protected]>
Thank you Rob!
-Kishon
Re: [PATCH v5 13/14] dt-bindings: phy: Document WIZ (SERDES wrapper) bindings
In reply to Kishon Vijay Abraham IQuoted 173 lines · Kishon Vijay Abraham I
Add DT binding documentation for WIZ (SERDES wrapper). WIZ is *NOT* a PHY but a wrapper used to configure some of the input signals to the SERDES. It is used with both Sierra(16G) and Torrent(10G) serdes.
Signed-off-by Kishon Vijay Abraham I <[email protected]>[[email protected]: Add separate compatible for Sierra(16G) and Torrent(10G)
SERDES]Signed-off-by Jyri Sarha <[email protected]>---
Changes from v4:
*) Fixed the indentation as suggested by Rob v4.../bindings/phy/ti,phy-j721e-wiz.yaml | 204 ++++++++++++++++++ 1 file changed, 204 insertions(+) create mode 100644 Documentation/devicetree/bindings/phy/ti,phy-j721e-wiz.yamlDocumentation/devicetree/bindings/phy/ti,phy-j721e-wiz.yaml new file +150
-0@@ -0,0 +1,204 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +# Copyright (C) 2019 Texas Instruments Incorporated - http://www.ti.com/ +%YAML 1.2 +--- +$id: "http://devicetree.org/schemas/phy/ti,phy-j721e-wiz.yaml#" +$schema: "http://devicetree.org/meta-schemas/core.yaml#" + +title: TI J721E WIZ (SERDES Wrapper) + +maintainers: + - Kishon Vijay Abraham I <[email protected]> + +properties: + compatible: + enum: + - ti,j721e-wiz-16g + - ti,j721e-wiz-10g + + power-domains: + maxItems: 1 + + clocks: + maxItems: 3 + description: clock-specifier to represent input to the WIZ + + clock-names: + items: + - const: fck + - const: core_ref_clk + - const: ext_ref_clk + + num-lanes: + minimum: 1 + maximum: 4 + + "#address-cells": + const: 1 + + "#size-cells": + const: 1 + + "#reset-cells": + const: 1 + + ranges: true + + assigned-clocks: + maxItems: 2 + + assigned-clock-parents: + maxItems: 2 + +patternProperties: + "^pll[0|1]-refclk$": + type: object + description: | + WIZ node should have subnodes for each of the PLLs present in + the SERDES. + properties: + clocks: + maxItems: 2 + description: Phandle to clock nodes representing the two inputs to PLL. + + "#clock-cells": + const: 0 + + assigned-clocks: + maxItems: 1 + + assigned-clock-parents: + maxItems: 1 + + required: + - clocks + - "#clock-cells" + - assigned-clocks + - assigned-clock-parents + + "^cmn-refclk1?-dig-div$": + type: object + description: + WIZ node should have subnodes for each of the PMA common refclock + provided by the SERDES. + properties: + clocks: + maxItems: 1 + description: Phandle to the clock node representing the input to the + divider clock. + + "#clock-cells": + const: 0 + + required: + - clocks + - "#clock-cells" + + "^refclk-dig$": + type: object + description: | + WIZ node should have subnode for refclk_dig to select the reference + clock source for the reference clock used in the PHY and PMA digital + logic. + properties: + clocks: + maxItems: 4 + description: Phandle to four clock nodes representing the inputs to + refclk_dig + + "#clock-cells": + const: 0 + + assigned-clocks: + maxItems: 1 + + assigned-clock-parents: + maxItems: 1 + + required: + - clocks + - "#clock-cells" + - assigned-clocks + - assigned-clock-parents + + "^serdes@[0-9a-f]+$": + type: object + description: | + WIZ node should have '1' subnode for the SERDES. It could be either + Sierra SERDES or Torrent SERDES. Sierra SERDES should follow the + bindings specified in + Documentation/devicetree/bindings/phy/phy-cadence-sierra.txt + Torrent SERDES should follow the bindings specified in + Documentation/devicetree/bindings/phy/phy-cadence-dp.txt + +required: + - compatible + - power-domains + - clocks + - clock-names + - num-lanes + - "#address-cells" + - "#size-cells" + - "#reset-cells" + - ranges + +examples: + - | + #include <dt-bindings/soc/ti,sci_pm_domain.h> + + wiz@5000000 { + compatible = "ti,j721e-wiz-16g";
Documentation/devicetree/bindings/phy/ti,phy-j721e-wiz.yaml line 160
Quoted 10 lines
Documentation/devicetree/bindings/phy/ti,phy-j721e-wiz.yaml new file +10
-0+ #address-cells = <1>; + #size-cells = <1>; + power-domains = <&k3_pds 292 TI_SCI_PD_EXCLUSIVE>; + clocks = <&k3_clks 292 5>, <&k3_clks 292 11>, <&dummy_cmn_refclk>; + clock-names = "fck", "core_ref_clk", "ext_ref_clk"; + assigned-clocks = <&k3_clks 292 11>, <&k3_clks 292 0>; + assigned-clock-parents = <&k3_clks 292 15>, <&k3_clks 292 4>; + num-lanes = <2>; + #reset-cells = <1>; + ranges = <0x5000000 0x0 0x5000000 0x10000>;
This fails in linux-next:
Documentation/devicetree/bindings/phy/ti,phy-j721e-wiz.example.dts:30.16-59:
Warning (ranges_format): /example-0/wiz@50
00000:ranges: "ranges" property has invalid length (16 bytes) (parent #address-cells == 1, child #address-cells == 1, #
size-cells == 1)
Please fix.
Rob
Re: [PATCH v5 13/14] dt-bindings: phy: Document WIZ (SERDES wrapper) bindings
Hi Rob,
Quoted 187 lines · Rob Herring
Quoted 173 lines · Kishon Vijay Abraham I
Add DT binding documentation for WIZ (SERDES wrapper). WIZ is *NOT* a PHY but a wrapper used to configure some of the input signals to the SERDES. It is used with both Sierra(16G) and Torrent(10G) serdes.
Signed-off-by Kishon Vijay Abraham I <[email protected]>[[email protected]: Add separate compatible for Sierra(16G) and Torrent(10G)
SERDES]Signed-off-by Jyri Sarha <[email protected]>---
Changes from v4:
*) Fixed the indentation as suggested by Rob v4.../bindings/phy/ti,phy-j721e-wiz.yaml | 204 ++++++++++++++++++ 1 file changed, 204 insertions(+) create mode 100644 Documentation/devicetree/bindings/phy/ti,phy-j721e-wiz.yamlDocumentation/devicetree/bindings/phy/ti,phy-j721e-wiz.yaml new file +150
-0@@ -0,0 +1,204 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +# Copyright (C) 2019 Texas Instruments Incorporated - http://www.ti.com/ +%YAML 1.2 +--- +$id: "http://devicetree.org/schemas/phy/ti,phy-j721e-wiz.yaml#" +$schema: "http://devicetree.org/meta-schemas/core.yaml#" + +title: TI J721E WIZ (SERDES Wrapper) + +maintainers: + - Kishon Vijay Abraham I <[email protected]> + +properties: + compatible: + enum: + - ti,j721e-wiz-16g + - ti,j721e-wiz-10g + + power-domains: + maxItems: 1 + + clocks: + maxItems: 3 + description: clock-specifier to represent input to the WIZ + + clock-names: + items: + - const: fck + - const: core_ref_clk + - const: ext_ref_clk + + num-lanes: + minimum: 1 + maximum: 4 + + "#address-cells": + const: 1 + + "#size-cells": + const: 1 + + "#reset-cells": + const: 1 + + ranges: true + + assigned-clocks: + maxItems: 2 + + assigned-clock-parents: + maxItems: 2 + +patternProperties: + "^pll[0|1]-refclk$": + type: object + description: | + WIZ node should have subnodes for each of the PLLs present in + the SERDES. + properties: + clocks: + maxItems: 2 + description: Phandle to clock nodes representing the two inputs to PLL. + + "#clock-cells": + const: 0 + + assigned-clocks: + maxItems: 1 + + assigned-clock-parents: + maxItems: 1 + + required: + - clocks + - "#clock-cells" + - assigned-clocks + - assigned-clock-parents + + "^cmn-refclk1?-dig-div$": + type: object + description: + WIZ node should have subnodes for each of the PMA common refclock + provided by the SERDES. + properties: + clocks: + maxItems: 1 + description: Phandle to the clock node representing the input to the + divider clock. + + "#clock-cells": + const: 0 + + required: + - clocks + - "#clock-cells" + + "^refclk-dig$": + type: object + description: | + WIZ node should have subnode for refclk_dig to select the reference + clock source for the reference clock used in the PHY and PMA digital + logic. + properties: + clocks: + maxItems: 4 + description: Phandle to four clock nodes representing the inputs to + refclk_dig + + "#clock-cells": + const: 0 + + assigned-clocks: + maxItems: 1 + + assigned-clock-parents: + maxItems: 1 + + required: + - clocks + - "#clock-cells" + - assigned-clocks + - assigned-clock-parents + + "^serdes@[0-9a-f]+$": + type: object + description: | + WIZ node should have '1' subnode for the SERDES. It could be either + Sierra SERDES or Torrent SERDES. Sierra SERDES should follow the + bindings specified in + Documentation/devicetree/bindings/phy/phy-cadence-sierra.txt + Torrent SERDES should follow the bindings specified in + Documentation/devicetree/bindings/phy/phy-cadence-dp.txt + +required: + - compatible + - power-domains + - clocks + - clock-names + - num-lanes + - "#address-cells" + - "#size-cells" + - "#reset-cells" + - ranges + +examples: + - | + #include <dt-bindings/soc/ti,sci_pm_domain.h> + + wiz@5000000 { + compatible = "ti,j721e-wiz-16g";Documentation/devicetree/bindings/phy/ti,phy-j721e-wiz.yaml line 160
Quoted 10 lines
Documentation/devicetree/bindings/phy/ti,phy-j721e-wiz.yaml new file +10
-0+ #address-cells = <1>; + #size-cells = <1>; + power-domains = <&k3_pds 292 TI_SCI_PD_EXCLUSIVE>; + clocks = <&k3_clks 292 5>, <&k3_clks 292 11>, <&dummy_cmn_refclk>; + clock-names = "fck", "core_ref_clk", "ext_ref_clk"; + assigned-clocks = <&k3_clks 292 11>, <&k3_clks 292 0>; + assigned-clock-parents = <&k3_clks 292 15>, <&k3_clks 292 4>; + num-lanes = <2>; + #reset-cells = <1>; + ranges = <0x5000000 0x0 0x5000000 0x10000>;This fails in linux-next:
Quoted 7 lines
Documentation/devicetree/bindings/phy/ti,phy-j721e-wiz.example.dts:30.16-59:
Warning (ranges_format): /example-0/wiz@50
00000:ranges: "ranges" property has invalid length (16 bytes) (parent #address-cells == 1, child #address-cells == 1, #
size-cells == 1)Please fix.
Fixed and pushed.
Thanks
Kishon
Quoted 3 lines
Rob
PATCH v4 14/14 phy: ti: j721e-wiz: Add support for WIZ module present in TI J721E SoC
In reply to Kishon Vijay Abraham IAdd support for WIZ module present in TI's J721E SoC. WIZ is a SERDES wrapper used to configure some of the input signals to the SERDES. It is used with both Sierra(16G) and Torrent(10G) SERDES. This driver configures three clock selects (pll0, pll1, dig), two divider clocks and supports resets for each of the lanes.
--- drivers/phy/ti/Kconfig | 15 + drivers/phy/ti/Makefile | 1 + drivers/phy/ti/phy-j721e-wiz.c | 898 +++++++++++++++++++++++++++++++++ 3 files changed, 914 insertions(+) create mode 100644 drivers/phy/ti/phy-j721e-wiz.c
drivers/phy/ti/Kconfig +15 -0
@@ -33,6 +33,21 @@ config PHY_AM654_SERDES This option enables support for TI AM654 SerDes PHY used for PCIe. +config PHY_J721E_WIZ + tristate "TI J721E WIZ (SERDES Wrapper) support" + depends on OF && ARCH_K3 || COMPILE_TEST + depends on COMMON_CLK + select GENERIC_PHY + select MULTIPLEXER + select REGMAP_MMIO + select MUX_MMIO + help + This option enables support for WIZ module present in TI's J721E + SoC. WIZ is a serdes wrapper used to configure some of the input + signals to the SERDES (Sierra/Torrent). This driver configures + three clock selects (pll0, pll1, dig) and resets for each of the + lanes. + config OMAP_CONTROL_PHY tristate "OMAP CONTROL PHY Driver" depends on ARCH_OMAP2PLUS || COMPILE_TEST
drivers/phy/ti/Makefile +1 -0
@@ -8,3 +8,4 @@ obj-$(CONFIG_PHY_TUSB1210) += phy-tusb1210.o obj-$(CONFIG_TWL4030_USB) += phy-twl4030-usb.o obj-$(CONFIG_PHY_AM654_SERDES) += phy-am654-serdes.o obj-$(CONFIG_PHY_TI_GMII_SEL) += phy-gmii-sel.o +obj-$(CONFIG_PHY_J721E_WIZ) += phy-j721e-wiz.o
drivers/phy/ti/phy-j721e-wiz.c new file +898 -0
898 lines not on this page · raw message
Signature · 1 line
2.17.1
Quoted 3 lines · Kishon Vijay Abraham I
TI's J721E SoC uses Cadence Sierra SERDES for USB, PCIe and SGMII. TI has a wrapper named WIZ to control input signals to Sierra and Torrent SERDES.
Merged this series.
Thanks
Kishon
Quoted 61 lines
This patch series:
1) Add support to WIZ module present in TI's J721E SoC
2) Adapt Cadence Sierra PHY driver to be used for J721E SoCChanges from v3:
*) Fix Rob's comments on dt bindings-> Add properties to be added in WIZ child nodes to binding -> Use '-' rather than '_' in node namesChanges from v2:
*) Deprecate "phy_clk" binding
*) Fix Rob's comment on dt bindings-> Include BSD-2-Clause license identifier -> drop "oneOf" and "items" for compatible -> Fixed "num-lanes" to include only scalar keywords -> Change to 32-bit address space for child nodes*) Rename cmn_refclk/cmn_refclk1 to cmn_refclk_dig_div/
cmn_refclk1_dig_divChanges from v1:
*) Change the dt binding Documentation of WIZ wrapper to YAML format *) Fix an issue in Sierra while doimg rmmodThe series has also been pushed to
https://github.com/kishon/linux-wip.gitj7_serdes_v4Anil Varughese (1):
phy: cadence: Sierra: Configure both lane cdb and common cdb registers
for external SSCKishon Vijay Abraham I (13):
dt-bindings: phy: Sierra: Add bindings for Sierra in TI's J721E
phy: cadence: Sierra: Make "phy_clk" and "sierra_apb" optional
resources
phy: cadence: Sierra: Use "regmap" for read and write to Sierra
registers
phy: cadence: Sierra: Add support forSERDES_16Gused in J721E SoC
phy: cadence: Sierra: Makecdns_sierra_phy_init()asphy_ops
phy: cadence: Sierra: Modify register macro names to be in sync with
Sierra user guide
phy: cadence: Sierra: Get reset control "array" for each link
phy: cadence: Sierra: Check for PLL lock during PHY power on
phy: cadence: Sierra: ChangeMAX_LANESof Sierra to 16
phy: cadence: Sierra: Set cmn_refclk_dig_div/cmn_refclk1_dig_div
frequency to 25MHz
phy: cadence: Sierra: Use correct dev pointer in
cdns_sierra_phy_remove()
dt-bindings: phy: Document WIZ (SERDES wrapper) bindings
phy: ti: j721e-wiz: Add support for WIZ module present in TI J721E SoC.../bindings/phy/phy-cadence-sierra.txt | 13 +- .../bindings/phy/ti,phy-j721e-wiz.yaml | 204 ++++ drivers/phy/cadence/phy-cadence-sierra.c | 699 +++++++++++--- drivers/phy/ti/Kconfig | 15 + drivers/phy/ti/Makefile | 1 + drivers/phy/ti/phy-j721e-wiz.c | 898 ++++++++++++++++++ 6 files changed, 1691 insertions(+), 139 deletions(-) create mode 100644 Documentation/devicetree/bindings/phy/ti,phy-j721e-wiz.yaml create mode 100644 drivers/phy/ti/phy-j721e-wiz.c