Re: [PATCH v6 3/9] phy: rockchip-samsung-dcphy: Unwind power-on on PLL lock failure

From: Michael Riesch

Date: Tue Nov 17 2026 - 03:17:07 EST


Hi Jason,

On 11/17/26 07:41, 楊智成 wrote:
> Hi Michael,
>
> On 11/16/26 11:00, Michael Riesch wrote:
>> Still what we discussed makes sense, so let us do some refactoring in a
>> later series.
>
> As discussed, I plan to add the tx_ prefix to the PLL helpers in 6/9.

Oh, seems I missed that. OK, carry on :-)

> I also noticed that struct samsung_mipi_phy holds phy and lanes, which
> TX and RX both use, but also the RX-only hs* fields added in 8/9, while
> the TX-only PLL state stays in struct samsung_mipi_dcphy.
>
> I am thinking about the following:
>
> 1) One struct per direction:
>
> struct samsung_mipi_phy_tx {
> struct phy *phy;
> unsigned int lanes;
> struct reset_control *m_phy_rst;
> bool legacy_mismatch;
> struct { ... } pll;
> };
>
> struct samsung_mipi_phy_rx {
> struct phy *phy;
> unsigned int lanes;
> struct reset_control *s_phy_rst;
> unsigned long long hs_clk_rate;
> u16 hsfreq_cfg;
> };
>
> 2) Keep only phy and lanes in struct samsung_mipi_phy, and move the hs*
> fields to struct samsung_mipi_dcphy, next to the PLL state:
>
> struct samsung_mipi_dcphy {
> ...
> struct samsung_mipi_phy tx;
> struct samsung_mipi_phy rx;
> ...
> struct { ... } pll;
> unsigned long long rx_hs_clk_rate;
> u16 rx_hsfreq_cfg;
> };
>
> Option 1 changes 6/9 to 8/9, option 2 only 8/9. Which one would be more
> convenient for your future work?

Thank you for asking. Option 1 seems a tad cleaner to me.

Please note that there could be a variation of option 1, something like

struct samsung_mipi_dcphy {
...
struct samsung_mipi_phy tx;
struct samsung_mipi_phy rx;
....
};

where

struct samsung_mipi_phy {
struct phy *phy;
unsigned int lanes;
struct reset_control *phy_rst;
union {
struct {
unsigned long long hs_clk_rate;
u16 hsfreq_cfg;
} rx_stuff;
struct {
bool legacy_mismatch;
struct { ... } pll;
} tx_stuff;
};
};

Maybe this is an acceptable approach for you?

Best regards,
Michael