From: "Heiko Stübner" <heiko@sntech.de>
To: Vinod Koul <vkoul@kernel.org>
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: Wed, 19 Feb 2025 23:51:14 +0100 [thread overview]
Message-ID: <2030933.8hb0ThOEGa@diego> (raw)
In-Reply-To: <Z68zdiIl75k2Vv9i@vaman>
Hi Vinod,
thanks for the review.
I've dropped all the parts that would've just gotten a "ok, changed" ;-)
Am Freitag, 14. Februar 2025, 13:13:42 MEZ schrieb Vinod Koul:
> On 13-02-25, 22:05, Heiko Stuebner wrote:
> > + { 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
sadly not.
The table itself came from the vendor-kernel, and I would assume there
it came from some super-secret additional documentation Rockchip
got with the IP documentation.
It is sadly not part of the RK3588 manual.
> > +
> > +static void samsung_mipi_dcphy_bias_block_enable(struct samsung_mipi_dcphy *samsung)
> > +{
> > + u32 bias_con2 = 0x3223;
>
> magic value?
Converted over to some more meaningful constants.
Did the same to bias_con0+1 below that one too.
> > +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?
It might make sense to mimic the lane_enable way of doing things, even if
just for things looking the same in both functions.
I guess disabling lanes does not really care about minimal speed differences
a switch/case would cause :-)
>
> > +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
Nope ... the value is defined as bits [15:0] and both being pll lock and
stabilization timing control registers. Sadly yet again, their usage detail
is not documented, the manual even does not supply a unit for the
register value :-(
Heiko
WARNING: multiple messages have this Message-ID (diff)
From: "Heiko Stübner" <heiko@sntech.de>
To: Vinod Koul <vkoul@kernel.org>
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: Wed, 19 Feb 2025 23:51:14 +0100 [thread overview]
Message-ID: <2030933.8hb0ThOEGa@diego> (raw)
In-Reply-To: <Z68zdiIl75k2Vv9i@vaman>
Hi Vinod,
thanks for the review.
I've dropped all the parts that would've just gotten a "ok, changed" ;-)
Am Freitag, 14. Februar 2025, 13:13:42 MEZ schrieb Vinod Koul:
> On 13-02-25, 22:05, Heiko Stuebner wrote:
> > + { 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
sadly not.
The table itself came from the vendor-kernel, and I would assume there
it came from some super-secret additional documentation Rockchip
got with the IP documentation.
It is sadly not part of the RK3588 manual.
> > +
> > +static void samsung_mipi_dcphy_bias_block_enable(struct samsung_mipi_dcphy *samsung)
> > +{
> > + u32 bias_con2 = 0x3223;
>
> magic value?
Converted over to some more meaningful constants.
Did the same to bias_con0+1 below that one too.
> > +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?
It might make sense to mimic the lane_enable way of doing things, even if
just for things looking the same in both functions.
I guess disabling lanes does not really care about minimal speed differences
a switch/case would cause :-)
>
> > +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
Nope ... the value is defined as bits [15:0] and both being pll lock and
stabilization timing control registers. Sadly yet again, their usage detail
is not documented, the manual even does not supply a unit for the
register value :-(
Heiko
--
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: "Heiko Stübner" <heiko@sntech.de>
To: Vinod Koul <vkoul@kernel.org>
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: Wed, 19 Feb 2025 23:51:14 +0100 [thread overview]
Message-ID: <2030933.8hb0ThOEGa@diego> (raw)
In-Reply-To: <Z68zdiIl75k2Vv9i@vaman>
Hi Vinod,
thanks for the review.
I've dropped all the parts that would've just gotten a "ok, changed" ;-)
Am Freitag, 14. Februar 2025, 13:13:42 MEZ schrieb Vinod Koul:
> On 13-02-25, 22:05, Heiko Stuebner wrote:
> > + { 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
sadly not.
The table itself came from the vendor-kernel, and I would assume there
it came from some super-secret additional documentation Rockchip
got with the IP documentation.
It is sadly not part of the RK3588 manual.
> > +
> > +static void samsung_mipi_dcphy_bias_block_enable(struct samsung_mipi_dcphy *samsung)
> > +{
> > + u32 bias_con2 = 0x3223;
>
> magic value?
Converted over to some more meaningful constants.
Did the same to bias_con0+1 below that one too.
> > +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?
It might make sense to mimic the lane_enable way of doing things, even if
just for things looking the same in both functions.
I guess disabling lanes does not really care about minimal speed differences
a switch/case would cause :-)
>
> > +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
Nope ... the value is defined as bits [15:0] and both being pll lock and
stabilization timing control registers. Sadly yet again, their usage detail
is not documented, the manual even does not supply a unit for the
register value :-(
Heiko
_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip
next prev parent reply other threads:[~2025-02-19 22:53 UTC|newest]
Thread overview: 21+ 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 ` Heiko Stuebner
2025-02-13 21:05 ` 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 ` Heiko Stuebner
2025-02-13 21:05 ` Heiko Stuebner
2025-02-13 21:05 ` [PATCH v6 2/2] phy: rockchip: Add Samsung MIPI D-/C-PHY driver Heiko Stuebner
2025-02-13 21:05 ` Heiko Stuebner
2025-02-13 21:05 ` Heiko Stuebner
2025-02-14 12:13 ` Vinod Koul
2025-02-14 12:13 ` Vinod Koul
2025-02-14 12:13 ` Vinod Koul
2025-02-19 22:51 ` Heiko Stübner [this message]
2025-02-19 22:51 ` Heiko Stübner
2025-02-19 22:51 ` Heiko Stübner
2025-03-12 15:51 ` Vinod Koul
2025-03-12 15:51 ` Vinod Koul
2025-03-12 15:51 ` Vinod Koul
2025-02-13 21:09 ` [PATCH v6 0/2] MIPI DSI phy for rk3588 Heiko Stübner
2025-02-13 21:09 ` Heiko Stübner
2025-02-13 21:09 ` 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=2030933.8hb0ThOEGa@diego \
--to=heiko@sntech.de \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dse@thaumatec.com \
--cc=heiko.stuebner@cherry.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 \
--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.