From: Dominique Martinet <dominique.martinet@atmark-techno.com>
To: Adam Ford <aford173@gmail.com>
Cc: linux-phy@lists.infradead.org, linux-imx@nxp.com,
festevam@gmail.com, frieder.schrempf@kontron.de,
aford@beaconembedded.com, Sandor.yu@nxp.com,
"Marco Felsch" <m.felsch@pengutronix.de>,
"Vinod Koul" <vkoul@kernel.org>,
"Kishon Vijay Abraham I" <kishon@kernel.org>,
"Lucas Stach" <l.stach@pengutronix.de>,
"Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH V7 2/5] phy: freescale: fsl-samsung-hdmi: Simplify REG21_PMS_S_MASK lookup
Date: Wed, 11 Sep 2024 14:23:12 +0900 [thread overview]
Message-ID: <ZuEpQLcDQ8pgMTUB@atmark-techno.com> (raw)
In-Reply-To: <20240911012838.944630-3-aford173@gmail.com>
Adam Ford wrote on Tue, Sep 10, 2024 at 08:28:08PM -0500:
> The value of 'S' is writen to two places, PHY_REG3[7:4] and
> PHY_REG21[3:0]. There is a lookup table which contains
> the value of PHY_REG3. Rather than using a switch statement
> based on the pixel clock to search for the value of 'S' again,
> just shift the contents of PHY_REG3[7:4] >> 4 and place the value
> in PHY_REG21[3:0]. Doing this can eliminate an entire function.
>
> Signed-off-by: Adam Ford <aford173@gmail.com>
> Reviewed-by: Marco Felsch <m.felsch@pengutronix.de>
> Reviewed-by: Frieder Schrempf <frieder.schrempf@kontron.de>
> Tested-by: Frieder Schrempf <frieder.schrempf@kontron.de>
Reviewed-by: Dominique Martinet <dominique.martinet@atmark-techno.com>
Tested-by: Dominique Martinet <dominique.martinet@atmark-techno.com>
> ---
> drivers/phy/freescale/phy-fsl-samsung-hdmi.c | 39 ++------------------
> 1 file changed, 4 insertions(+), 35 deletions(-)
>
> diff --git a/drivers/phy/freescale/phy-fsl-samsung-hdmi.c b/drivers/phy/freescale/phy-fsl-samsung-hdmi.c
> index acea7008aefc..4f6874226f9a 100644
> --- a/drivers/phy/freescale/phy-fsl-samsung-hdmi.c
> +++ b/drivers/phy/freescale/phy-fsl-samsung-hdmi.c
> @@ -364,40 +364,6 @@ to_fsl_samsung_hdmi_phy(struct clk_hw *hw)
> return container_of(hw, struct fsl_samsung_hdmi_phy, hw);
> }
>
> -static void
> -fsl_samsung_hdmi_phy_configure_pixclk(struct fsl_samsung_hdmi_phy *phy,
> - const struct phy_config *cfg)
> -{
> - u8 div = 0x1;
> -
> - switch (cfg->pixclk) {
> - case 22250000 ... 33750000:
> - div = 0xf;
> - break;
> - case 35000000 ... 40000000:
> - div = 0xb;
> - break;
> - case 43200000 ... 47500000:
> - div = 0x9;
> - break;
> - case 50349650 ... 63500000:
> - div = 0x7;
> - break;
> - case 67500000 ... 90000000:
> - div = 0x5;
> - break;
> - case 94000000 ... 148500000:
> - div = 0x3;
> - break;
> - case 154000000 ... 297000000:
> - div = 0x1;
> - break;
> - }
> -
> - writeb(REG21_SEL_TX_CK_INV | FIELD_PREP(REG21_PMS_S_MASK, div),
> - phy->regs + PHY_REG(21));
> -}
> -
> static void
> fsl_samsung_hdmi_phy_configure_pll_lock_det(struct fsl_samsung_hdmi_phy *phy,
> const struct phy_config *cfg)
> @@ -466,7 +432,10 @@ static int fsl_samsung_hdmi_phy_configure(struct fsl_samsung_hdmi_phy *phy,
> for (i = 0; i < PHY_PLL_DIV_REGS_NUM; i++)
> writeb(cfg->pll_div_regs[i], phy->regs + PHY_REG(2) + i * 4);
>
> - fsl_samsung_hdmi_phy_configure_pixclk(phy, cfg);
> + /* High nibble of pll_div_regs[1] contains S which also gets written to REG21 */
> + writeb(REG21_SEL_TX_CK_INV | FIELD_PREP(REG21_PMS_S_MASK,
> + cfg->pll_div_regs[1] >> 4), phy->regs + PHY_REG(21));
> +
> fsl_samsung_hdmi_phy_configure_pll_lock_det(phy, cfg);
>
> writeb(REG33_FIX_DA | REG33_MODE_SET_DONE, phy->regs + PHY_REG(33));
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
WARNING: multiple messages have this Message-ID (diff)
From: Dominique Martinet <dominique.martinet@atmark-techno.com>
To: Adam Ford <aford173@gmail.com>
Cc: linux-phy@lists.infradead.org, linux-imx@nxp.com,
festevam@gmail.com, frieder.schrempf@kontron.de,
aford@beaconembedded.com, Sandor.yu@nxp.com,
"Marco Felsch" <m.felsch@pengutronix.de>,
"Vinod Koul" <vkoul@kernel.org>,
"Kishon Vijay Abraham I" <kishon@kernel.org>,
"Lucas Stach" <l.stach@pengutronix.de>,
"Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH V7 2/5] phy: freescale: fsl-samsung-hdmi: Simplify REG21_PMS_S_MASK lookup
Date: Wed, 11 Sep 2024 14:23:12 +0900 [thread overview]
Message-ID: <ZuEpQLcDQ8pgMTUB@atmark-techno.com> (raw)
In-Reply-To: <20240911012838.944630-3-aford173@gmail.com>
Adam Ford wrote on Tue, Sep 10, 2024 at 08:28:08PM -0500:
> The value of 'S' is writen to two places, PHY_REG3[7:4] and
> PHY_REG21[3:0]. There is a lookup table which contains
> the value of PHY_REG3. Rather than using a switch statement
> based on the pixel clock to search for the value of 'S' again,
> just shift the contents of PHY_REG3[7:4] >> 4 and place the value
> in PHY_REG21[3:0]. Doing this can eliminate an entire function.
>
> Signed-off-by: Adam Ford <aford173@gmail.com>
> Reviewed-by: Marco Felsch <m.felsch@pengutronix.de>
> Reviewed-by: Frieder Schrempf <frieder.schrempf@kontron.de>
> Tested-by: Frieder Schrempf <frieder.schrempf@kontron.de>
Reviewed-by: Dominique Martinet <dominique.martinet@atmark-techno.com>
Tested-by: Dominique Martinet <dominique.martinet@atmark-techno.com>
> ---
> drivers/phy/freescale/phy-fsl-samsung-hdmi.c | 39 ++------------------
> 1 file changed, 4 insertions(+), 35 deletions(-)
>
> diff --git a/drivers/phy/freescale/phy-fsl-samsung-hdmi.c b/drivers/phy/freescale/phy-fsl-samsung-hdmi.c
> index acea7008aefc..4f6874226f9a 100644
> --- a/drivers/phy/freescale/phy-fsl-samsung-hdmi.c
> +++ b/drivers/phy/freescale/phy-fsl-samsung-hdmi.c
> @@ -364,40 +364,6 @@ to_fsl_samsung_hdmi_phy(struct clk_hw *hw)
> return container_of(hw, struct fsl_samsung_hdmi_phy, hw);
> }
>
> -static void
> -fsl_samsung_hdmi_phy_configure_pixclk(struct fsl_samsung_hdmi_phy *phy,
> - const struct phy_config *cfg)
> -{
> - u8 div = 0x1;
> -
> - switch (cfg->pixclk) {
> - case 22250000 ... 33750000:
> - div = 0xf;
> - break;
> - case 35000000 ... 40000000:
> - div = 0xb;
> - break;
> - case 43200000 ... 47500000:
> - div = 0x9;
> - break;
> - case 50349650 ... 63500000:
> - div = 0x7;
> - break;
> - case 67500000 ... 90000000:
> - div = 0x5;
> - break;
> - case 94000000 ... 148500000:
> - div = 0x3;
> - break;
> - case 154000000 ... 297000000:
> - div = 0x1;
> - break;
> - }
> -
> - writeb(REG21_SEL_TX_CK_INV | FIELD_PREP(REG21_PMS_S_MASK, div),
> - phy->regs + PHY_REG(21));
> -}
> -
> static void
> fsl_samsung_hdmi_phy_configure_pll_lock_det(struct fsl_samsung_hdmi_phy *phy,
> const struct phy_config *cfg)
> @@ -466,7 +432,10 @@ static int fsl_samsung_hdmi_phy_configure(struct fsl_samsung_hdmi_phy *phy,
> for (i = 0; i < PHY_PLL_DIV_REGS_NUM; i++)
> writeb(cfg->pll_div_regs[i], phy->regs + PHY_REG(2) + i * 4);
>
> - fsl_samsung_hdmi_phy_configure_pixclk(phy, cfg);
> + /* High nibble of pll_div_regs[1] contains S which also gets written to REG21 */
> + writeb(REG21_SEL_TX_CK_INV | FIELD_PREP(REG21_PMS_S_MASK,
> + cfg->pll_div_regs[1] >> 4), phy->regs + PHY_REG(21));
> +
> fsl_samsung_hdmi_phy_configure_pll_lock_det(phy, cfg);
>
> writeb(REG33_FIX_DA | REG33_MODE_SET_DONE, phy->regs + PHY_REG(33));
next prev parent reply other threads:[~2024-09-11 5:23 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-11 1:28 [PATCH V7 0/5] phy: freescale: fsl-samsung-hdmi: Expand phy clock options Adam Ford
2024-09-11 1:28 ` Adam Ford
2024-09-11 1:28 ` [PATCH V7 1/5] phy: freescale: fsl-samsung-hdmi: Replace register defines with macro Adam Ford
2024-09-11 1:28 ` Adam Ford
2024-09-11 5:12 ` Dominique Martinet
2024-09-11 5:12 ` Dominique Martinet
2024-09-11 1:28 ` [PATCH V7 2/5] phy: freescale: fsl-samsung-hdmi: Simplify REG21_PMS_S_MASK lookup Adam Ford
2024-09-11 1:28 ` Adam Ford
2024-09-11 5:23 ` Dominique Martinet [this message]
2024-09-11 5:23 ` Dominique Martinet
2024-09-11 1:28 ` [PATCH V7 3/5] xphy: freescale: fsl-samsung-hdmi: Support dynamic integer Adam Ford
2024-09-11 1:28 ` Adam Ford
2024-09-11 5:26 ` Dominique Martinet
2024-09-11 5:26 ` Dominique Martinet
2024-09-11 7:01 ` Frieder Schrempf
2024-09-11 7:01 ` Frieder Schrempf
2024-09-11 1:28 ` [PATCH V7 4/5] phy: freescale: fsl-samsung-hdmi: Use closest divider Adam Ford
2024-09-11 1:28 ` Adam Ford
2024-09-11 5:27 ` Dominique Martinet
2024-09-11 5:27 ` Dominique Martinet
2024-09-11 7:07 ` Frieder Schrempf
2024-09-11 7:07 ` Frieder Schrempf
2024-09-11 1:28 ` [PATCH V7 5/5] phy: freescale: fsl-samsung-hdmi: Remove unnecessary LUT entries Adam Ford
2024-09-11 1:28 ` Adam Ford
2024-09-11 5:47 ` Dominique Martinet
2024-09-11 5:47 ` Dominique Martinet
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=ZuEpQLcDQ8pgMTUB@atmark-techno.com \
--to=dominique.martinet@atmark-techno.com \
--cc=Sandor.yu@nxp.com \
--cc=aford173@gmail.com \
--cc=aford@beaconembedded.com \
--cc=festevam@gmail.com \
--cc=frieder.schrempf@kontron.de \
--cc=kishon@kernel.org \
--cc=l.stach@pengutronix.de \
--cc=linux-imx@nxp.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-phy@lists.infradead.org \
--cc=m.felsch@pengutronix.de \
--cc=u.kleine-koenig@pengutronix.de \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.