From: Vinod Koul <vkoul@kernel.org>
To: Heiko Stuebner <heiko@sntech.de>
Cc: kishon@kernel.org, robh@kernel.org, krzk+dt@kernel.org,
conor+dt@kernel.org, quentin.schulz@cherry.de,
sebastian.reichel@collabora.com, linux-phy@lists.infradead.org,
devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org,
dse@thaumatec.com, Heiko Stuebner <heiko.stuebner@cherry.de>
Subject: Re: [PATCH v6 2/2] phy: rockchip: Add Samsung MIPI D-/C-PHY driver
Date: Fri, 14 Feb 2025 17:43:42 +0530 [thread overview]
Message-ID: <Z68zdiIl75k2Vv9i@vaman> (raw)
In-Reply-To: <20250213210554.1645755-3-heiko@sntech.de>
On 13-02-25, 22:05, Heiko Stuebner wrote:
> From: Heiko Stuebner <heiko.stuebner@cherry.de>
> +#define PLL_CON0 0x0100
> +#define PLL_EN BIT(12)
> +#define S_MASK GENMASK(10, 8)
> +#define S(x) FIELD_PREP(S_MASK, x)
> +#define P_MASK GENMASK(5, 0)
> +#define P(x) FIELD_PREP(P_MASK, x)
> +#define PLL_CON1 0x0104
> +#define PLL_CON2 0x0108
> +#define M_MASK GENMASK(9, 0)
> +#define M(x) FIELD_PREP(M_MASK, x)
> +#define PLL_CON3 0x010c
lower case, nice.
...
> +#define COMBO_MD0_GNR_CON0 0x0400
> +#define COMBO_MD0_GNR_CON1 0x0404
> +#define COMBO_MD0_ANA_CON0 0x0408
> +#define COMBO_MD0_ANA_CON1 0x040C
upper one!
> +#define COMBO_MD0_ANA_CON2 0x0410
> +
> +#define COMBO_MD0_TIME_CON0 0x0430
> +#define COMBO_MD0_TIME_CON1 0x0434
> +#define COMBO_MD0_TIME_CON2 0x0438
> +#define COMBO_MD0_TIME_CON3 0x043C
and few more, lets be lower case everywhere please?
> + { 200, 7, 1, 0, 33, 9, 0, 26, 5, 0, 11},
> + { 190, 7, 1, 0, 32, 9, 0, 25, 5, 0, 11},
> + { 180, 6, 1, 0, 32, 8, 0, 25, 5, 0, 10},
> + { 170, 6, 0, 0, 32, 8, 0, 25, 5, 0, 10},
> + { 160, 5, 0, 0, 31, 8, 0, 24, 4, 0, 9},
> + { 150, 5, 0, 0, 31, 8, 0, 24, 5, 0, 9},
> + { 140, 5, 0, 0, 31, 8, 0, 24, 5, 0, 8},
> + { 130, 4, 0, 0, 30, 6, 0, 23, 3, 0, 8},
> + { 120, 4, 0, 0, 30, 6, 0, 23, 3, 0, 7},
> + { 110, 3, 0, 0, 30, 6, 0, 23, 3, 0, 7},
> + { 100, 3, 0, 0, 29, 5, 0, 22, 2, 0, 6},
> + { 90, 3, 0, 0, 29, 5, 0, 22, 2, 0, 6},
> + { 80, 2, 0, 0, 28, 5, 0, 22, 2, 0, 5},
> +};
any word on where this table came from, maybe worth documenting that
part
> +
> +static void samsung_mipi_dcphy_bias_block_enable(struct samsung_mipi_dcphy *samsung)
> +{
> + u32 bias_con2 = 0x3223;
magic value?
> +static void samsung_mipi_dphy_lane_disable(struct samsung_mipi_dcphy *samsung)
> +{
> + regmap_update_bits(samsung->regmap, DPHY_MC_GNR_CON0, PHY_ENABLE, 0);
> + regmap_update_bits(samsung->regmap, COMBO_MD0_GNR_CON0, PHY_ENABLE, 0);
> + regmap_update_bits(samsung->regmap, COMBO_MD1_GNR_CON0, PHY_ENABLE, 0);
> + regmap_update_bits(samsung->regmap, COMBO_MD2_GNR_CON0, PHY_ENABLE, 0);
> + regmap_update_bits(samsung->regmap, DPHY_MD3_GNR_CON0, PHY_ENABLE, 0);
Is writing to a register (mmio) faster than a switch case for checking
lane count and disabling specific lanes?
> +static void samsung_mipi_dcphy_pll_configure(struct samsung_mipi_dcphy *samsung)
> +{
> + regmap_update_bits(samsung->regmap, PLL_CON0, S_MASK | P_MASK,
> + S(samsung->pll.scaler) | P(samsung->pll.prediv));
> +
> + if (samsung->pll.dsm < 0) {
> + u16 dsm_tmp;
> +
> + /* Using opposite number subtraction to find complement */
> + dsm_tmp = abs(samsung->pll.dsm);
> + dsm_tmp = dsm_tmp - 1;
> + dsm_tmp ^= 0xffff;
> + regmap_write(samsung->regmap, PLL_CON1, dsm_tmp);
> + } else {
> + regmap_write(samsung->regmap, PLL_CON1, samsung->pll.dsm);
> + }
> +
> + regmap_update_bits(samsung->regmap, PLL_CON2,
> + M_MASK, M(samsung->pll.fbdiv));
> +
> + if (samsung->pll.ssc_en) {
> + regmap_write(samsung->regmap, PLL_CON3,
> + MRR(samsung->pll.mrr) | MFR(samsung->pll.mfr));
> + regmap_update_bits(samsung->regmap, PLL_CON4, SSCG_EN, SSCG_EN);
> + }
> +
> + regmap_write(samsung->regmap, PLL_CON5, RESET_N_SEL | PLL_ENABLE_SEL);
> + regmap_write(samsung->regmap, PLL_CON7, PLL_LOCK_CNT(0xf000));
> + regmap_write(samsung->regmap, PLL_CON8, PLL_STB_CNT(0xf000));
I guess you are writing to upper nibble, maybe define that, if we can
> +static __maybe_unused int samsung_mipi_dcphy_runtime_resume(struct device *dev)
> +{
> + struct samsung_mipi_dcphy *samsung = dev_get_drvdata(dev);
> + int ret;
> +
> + ret = clk_prepare_enable(samsung->pclk);
> + if (ret) {
> + dev_err(samsung->dev, "Failed to enable pclk, %d\n", ret);
> + return ret;
> + }
> +
> + clk_prepare_enable(samsung->ref_clk);
> + if (ret) {
> + dev_err(samsung->dev, "Failed to enable reference clock, %d\n", ret);
No rollback of pclk here?
--
~Vinod
next prev parent reply other threads:[~2025-02-14 12:15 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-13 21:05 [PATCH v6 0/2] MIPI DSI phy for rk3588 Heiko Stuebner
2025-02-13 21:05 ` [PATCH v6 1/2] dt-bindings: phy: Add Rockchip MIPI C-/D-PHY schema Heiko Stuebner
2025-02-13 21:05 ` [PATCH v6 2/2] phy: rockchip: Add Samsung MIPI D-/C-PHY driver Heiko Stuebner
2025-02-14 12:13 ` Vinod Koul [this message]
2025-02-19 22:51 ` Heiko Stübner
2025-03-12 15:51 ` Vinod Koul
2025-02-13 21:09 ` [PATCH v6 0/2] MIPI DSI phy for rk3588 Heiko Stübner
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=Z68zdiIl75k2Vv9i@vaman \
--to=vkoul@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dse@thaumatec.com \
--cc=heiko.stuebner@cherry.de \
--cc=heiko@sntech.de \
--cc=kishon@kernel.org \
--cc=krzk+dt@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-phy@lists.infradead.org \
--cc=linux-rockchip@lists.infradead.org \
--cc=quentin.schulz@cherry.de \
--cc=robh@kernel.org \
--cc=sebastian.reichel@collabora.com \
/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;
as well as URLs for NNTP newsgroup(s).