From: Kishon Vijay Abraham I <kishon@ti.com>
To: Swapnil Jakhade <sjakhade@cadence.com>, <vkoul@kernel.org>,
<p.zabel@pengutronix.de>, <linux-phy@lists.infradead.org>,
<linux-kernel@vger.kernel.org>
Cc: <mparab@cadence.com>, <lokeshvutla@ti.com>
Subject: Re: [PATCH 14/14] phy: cadence-torrent: Check PIPE mode PHY status to be ready for operation
Date: Thu, 13 May 2021 13:25:49 +0530 [thread overview]
Message-ID: <1527d8b6-6976-e37e-746f-88ea0f8f7688@ti.com> (raw)
In-Reply-To: <1617946456-27773-15-git-send-email-sjakhade@cadence.com>
Hi Swapnil,
On 09/04/21 11:04 am, Swapnil Jakhade wrote:
> PIPE PHY status is used to communicate the completion of several PHY
> functions. Check if PHY is ready for operation while configured for
> PIPE mode during startup.
>
> Signed-off-by: Swapnil Jakhade <sjakhade@cadence.com>
> ---
> drivers/phy/cadence/phy-cadence-torrent.c | 60 +++++++++++++++++++++++
> 1 file changed, 60 insertions(+)
>
> diff --git a/drivers/phy/cadence/phy-cadence-torrent.c b/drivers/phy/cadence/phy-cadence-torrent.c
> index 39145e56e061..42a1bdfd18d5 100644
> --- a/drivers/phy/cadence/phy-cadence-torrent.c
> +++ b/drivers/phy/cadence/phy-cadence-torrent.c
> @@ -51,6 +51,10 @@
> #define TORRENT_PHY_PCS_COMMON_OFFSET(block_offset) \
> (0xC000 << (block_offset))
>
> +#define TORRENT_PHY_PCS_LANE_CDB_OFFSET(ln, block_offset, reg_offset) \
> + ((0xD000 << (block_offset)) + \
> + (((ln) << 9) << (reg_offset)))
> +
> #define TORRENT_PHY_PMA_COMMON_OFFSET(block_offset) \
> (0xE000 << (block_offset))
>
> @@ -218,6 +222,9 @@
> #define PHY_PIPE_USB3_GEN2_POST_CFG0 0x0022U
> #define PHY_PIPE_USB3_GEN2_POST_CFG1 0x0023U
>
> +/* PHY PCS lane registers */
> +#define PHY_PCS_ISO_LINK_CTRL 0x000BU
> +
> /* PHY PMA common registers */
> #define PHY_PMA_CMN_CTRL1 0x0000U
> #define PHY_PMA_CMN_CTRL2 0x0001U
> @@ -242,6 +249,9 @@ static const struct reg_field phy_pma_pll_raw_ctrl =
> static const struct reg_field phy_reset_ctrl =
> REG_FIELD(PHY_RESET, 8, 8);
>
> +static const struct reg_field phy_pcs_iso_link_ctrl_1 =
> + REG_FIELD(PHY_PCS_ISO_LINK_CTRL, 1, 1);
> +
> static const struct reg_field phy_pipe_cmn_ctrl1_0 = REG_FIELD(PHY_PIPE_CMN_CTRL1, 0, 0);
>
> #define REFCLK_OUT_NUM_CMN_CONFIG 5
> @@ -316,12 +326,14 @@ struct cdns_torrent_phy {
> struct regmap *regmap_phy_pma_common_cdb;
> struct regmap *regmap_tx_lane_cdb[MAX_NUM_LANES];
> struct regmap *regmap_rx_lane_cdb[MAX_NUM_LANES];
> + struct regmap *regmap_phy_pcs_lane_cdb[MAX_NUM_LANES];
> struct regmap *regmap_dptx_phy_reg;
> struct regmap_field *phy_pll_cfg;
> struct regmap_field *phy_pma_cmn_ctrl_1;
> struct regmap_field *phy_pma_cmn_ctrl_2;
> struct regmap_field *phy_pma_pll_raw_ctrl;
> struct regmap_field *phy_reset_ctrl;
> + struct regmap_field *phy_pcs_iso_link_ctrl_1[MAX_NUM_LANES];
> struct clk *clks[CDNS_TORRENT_REFCLK_DRIVER + 1];
> struct clk_onecell_data clk_data;
> };
> @@ -456,6 +468,22 @@ static const struct regmap_config cdns_torrent_common_cdb_config = {
> .reg_read = cdns_regmap_read,
> };
>
> +#define TORRENT_PHY_PCS_LANE_CDB_REGMAP_CONF(n) \
> +{ \
> + .name = "torrent_phy_pcs_lane" n "_cdb", \
> + .reg_stride = 1, \
> + .fast_io = true, \
> + .reg_write = cdns_regmap_write, \
> + .reg_read = cdns_regmap_read, \
> +}
> +
> +static const struct regmap_config cdns_torrent_phy_pcs_lane_cdb_config[] = {
> + TORRENT_PHY_PCS_LANE_CDB_REGMAP_CONF("0"),
> + TORRENT_PHY_PCS_LANE_CDB_REGMAP_CONF("1"),
> + TORRENT_PHY_PCS_LANE_CDB_REGMAP_CONF("2"),
> + TORRENT_PHY_PCS_LANE_CDB_REGMAP_CONF("3"),
> +};
> +
> static const struct regmap_config cdns_torrent_phy_pcs_cmn_cdb_config = {
> .name = "torrent_phy_pcs_cmn_cdb",
> .reg_stride = 1,
> @@ -1546,6 +1574,16 @@ static int cdns_torrent_phy_on(struct phy *phy)
> return ret;
> }
>
> + if (inst->phy_type == TYPE_PCIE || inst->phy_type == TYPE_USB) {
> + ret = regmap_field_read_poll_timeout(cdns_phy->phy_pcs_iso_link_ctrl_1[inst->mlane],
> + read_val, !read_val, 1000,
> + PLL_LOCK_TIMEOUT);
> + if (ret == -ETIMEDOUT) {
> + dev_err(cdns_phy->dev, "Timeout waiting for PHY status ready\n");
> + return ret;
> + }
> + }
> +
> mdelay(10);
With the above polling, this mdelay() shouldn't be required.
Thanks
Kishon
prev parent reply other threads:[~2021-05-13 7:56 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-09 5:34 [PATCH 00/14] PHY: Add multilink DP support in Cadence Torrent PHY driver Swapnil Jakhade
2021-04-09 5:34 ` [PATCH 01/14] phy: cadence-torrent: Remove use of CamelCase to fix checkpatch CHECK message Swapnil Jakhade
2021-05-13 6:35 ` Kishon Vijay Abraham I
2021-04-09 5:34 ` [PATCH 02/14] phy: cadence-torrent: Reorder few functions to remove function declarations Swapnil Jakhade
2021-05-13 6:37 ` Kishon Vijay Abraham I
2021-04-09 5:34 ` [PATCH 03/14] phy: cadence-torrent: Add enum to support different input reference clocks Swapnil Jakhade
2021-05-13 6:43 ` Kishon Vijay Abraham I
2021-04-09 5:34 ` [PATCH 04/14] phy: cadence-torrent: Select register configuration based on PHY reference clock Swapnil Jakhade
2021-05-13 6:48 ` Kishon Vijay Abraham I
2021-04-09 5:34 ` [PATCH 05/14] phy: cadence-torrent: Add PHY registers for DP in array format Swapnil Jakhade
2021-05-13 6:52 ` Kishon Vijay Abraham I
2021-04-09 5:34 ` [PATCH 06/14] phy: cadence-torrent: Reorder functions to avoid function declarations Swapnil Jakhade
2021-04-09 5:34 ` [PATCH 07/14] " Swapnil Jakhade
2021-04-09 5:34 ` [PATCH 08/14] phy: cadence-torrent: Add PHY configuration for DP with 100MHz ref clock Swapnil Jakhade
2021-05-13 6:59 ` Kishon Vijay Abraham I
2021-04-09 5:34 ` [PATCH 09/14] phy: cadence-torrent: Add separate functions for reusable code Swapnil Jakhade
2021-05-13 7:00 ` Kishon Vijay Abraham I
2021-04-09 5:34 ` [PATCH 10/14] phy: cadence-torrent: Add function to get PLL to be configured for DP Swapnil Jakhade
2021-05-13 7:12 ` Kishon Vijay Abraham I
2021-04-09 5:34 ` [PATCH 11/14] phy: cadence-torrent: Add multilink DP support Swapnil Jakhade
2021-05-13 7:44 ` Kishon Vijay Abraham I
2021-04-09 5:34 ` [PATCH 12/14] phy: cadence-torrent: Add PCIe + DP multilink configuration Swapnil Jakhade
2021-05-13 7:47 ` Kishon Vijay Abraham I
2021-04-09 5:34 ` [PATCH 13/14] phy: cadence-torrent: Add debug information for PHY configuration Swapnil Jakhade
2021-05-13 7:54 ` Kishon Vijay Abraham I
2021-04-09 5:34 ` [PATCH 14/14] phy: cadence-torrent: Check PIPE mode PHY status to be ready for operation Swapnil Jakhade
2021-05-13 7:55 ` Kishon Vijay Abraham I [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1527d8b6-6976-e37e-746f-88ea0f8f7688@ti.com \
--to=kishon@ti.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-phy@lists.infradead.org \
--cc=lokeshvutla@ti.com \
--cc=mparab@cadence.com \
--cc=p.zabel@pengutronix.de \
--cc=sjakhade@cadence.com \
--cc=vkoul@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®