Skip to content

Commit 08ecfe6

Browse files
gugulotmichalsimek
authored andcommitted
phy: xilinx-xhdmiphy: Add support for selection of PLL/MMCM clock primitive
Cost optimized devices have limitation of MMCM availability. HDMIPHY IP is enabled with an option to select PLL or MMCM primitive for such resource constrained devices. Add support in the driver to use output clocks from the primitive type that IP is configured with. Signed-off-by: Rajesh Gugulothu <rajesh.gugulothu@amd.com> Reviewed-by: Vishal Sagar <vishal.sagar@amd.com> State: pending
1 parent c060cc9 commit 08ecfe6

File tree

3 files changed

+243
-191
lines changed

3 files changed

+243
-191
lines changed

‎drivers/phy/xilinx/xhdmiphy.c‎

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -642,6 +642,34 @@ static int xhdmiphy_parse_of(struct xhdmiphy_dev *priv)
642642
}
643643
xgtphycfg->tx_maxrate = val;
644644

645+
rc = of_property_read_u32(node, "xlnx,rx-clk-primitive", &val);
646+
if (rc < 0) {
647+
dev_err(priv->dev, "unable to parse %s property\n",
648+
"xlnx,rx-clk-primitive. Make MMCM as default value");
649+
val = XHDMIPHY_MMCM;
650+
}
651+
652+
if (val != XHDMIPHY_MMCM && val != XHDMIPHY_PLL) {
653+
dev_err(priv->dev, "dt xlnx,rx-clk-primitive %d is invalid\n",
654+
val);
655+
return -EINVAL;
656+
}
657+
xgtphycfg->rx_clk_primitive = val;
658+
659+
rc = of_property_read_u32(node, "xlnx,tx-clk-primitive", &val);
660+
if (rc < 0) {
661+
dev_err(priv->dev, "unable to parse %s property\n",
662+
"xlnx,tx-clk-primitive. make MMCM as default value");
663+
val = XHDMIPHY_MMCM;
664+
}
665+
666+
if (val != XHDMIPHY_MMCM && val != XHDMIPHY_PLL) {
667+
dev_err(priv->dev, "dt xlnx,tx-clk-primitive %d is invalid\n",
668+
val);
669+
return -EINVAL;
670+
}
671+
xgtphycfg->tx_clk_primitive = val;
672+
645673
rc = of_property_read_u32(node, "xlnx,use-gt-ch4-hdmi", &val);
646674
if (rc < 0) {
647675
dev_err(priv->dev, "unable to parse %s property\n",

‎drivers/phy/xilinx/xhdmiphy.h‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -669,6 +669,7 @@
669669
#define XHDMIPHY_MMCM4_DRP_FILTER_REG2 0x4f
670670
#define XHDMIPHY_MMCM4_PWR_REG 0x27
671671
#define XHDMIPHY_MMCM4_WRITE_VAL 0xffff
672+
#define XHDMIPHY_PLL_WRITE_VAL 0x4401
672673

673674
/* registers and masks of mmcme5 DRP */
674675
#define XHDMIPHY_MMCM5_DRP_CLKFBOUT_1_REG 0x0c
@@ -847,6 +848,11 @@ enum prbs_pat {
847848
XHDMIPHY_PRBSSEL_SQUARE_16UI = 0xA, /* square wave with 16 UI */
848849
};
849850

851+
enum clk_primitive {
852+
XHDMIPHY_MMCM = 0,
853+
XHDMIPHY_PLL = 1,
854+
};
855+
850856
enum xhdmiphy_mode {
851857
tmds_mode = 0,
852858
frl_mode = 1,
@@ -1018,6 +1024,8 @@ struct xhdmiphy_conf {
10181024
u8 gt_as_tx_tmdsclk; /* use 4th GT channel as tx TMDS clock */
10191025
u8 rx_maxrate;
10201026
u8 tx_maxrate;
1027+
u8 rx_clk_primitive;
1028+
u8 tx_clk_primitive;
10211029
};
10221030

10231031
struct xhdmiphy_dev {

0 commit comments

Comments
 (0)