Re: [PATCH v6 1/6] phy: realtek: usb2: introduce vstatus/new_reg_req variables to driver data
From: Manivannan Sadhasivam
Date: Wed Aug 12 2026 - 10:55:54 EST
On Wed, May 20, 2026 at 10:57:23PM +0500, Rustam Adilov wrote:
> In RTL9607C SoC, the vstatus register is located at a certain offset from
> the base and so introduce the vstatus_offset to handle it.
>
> Busy bit of the vstatus and new_reg_req bit are also different and so
> introduce these variables to the driver data as well.
>
> Add these variables to the pre-existing phy cfg structs for RTD SoCs and
> assign them the default values.
>
> Co-developed-by: Michael Zavertkin <misha.zavertkin@xxxxxxx>
> Signed-off-by: Michael Zavertkin <misha.zavertkin@xxxxxxx>
> Signed-off-by: Rustam Adilov <adilov@xxxxxxxxxxx>
> ---
> drivers/phy/realtek/phy-rtk-usb2.c | 68 +++++++++++++++++++++++-------
> 1 file changed, 53 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/phy/realtek/phy-rtk-usb2.c b/drivers/phy/realtek/phy-rtk-usb2.c
> index 248550ef98ca..bd9ee895b9f9 100644
> --- a/drivers/phy/realtek/phy-rtk-usb2.c
> +++ b/drivers/phy/realtek/phy-rtk-usb2.c
> @@ -64,6 +64,9 @@ struct phy_reg {
> void __iomem *reg_wrap_vstatus;
> void __iomem *reg_gusb2phyacc0;
> int vstatus_index;
> + int vstatus_offset;
> + u32 vstatus_busy;
> + u32 new_reg_req;
> };
>
> struct phy_data {
> @@ -96,6 +99,9 @@ struct phy_cfg {
> bool do_toggle_driving;
> bool use_default_parameter;
> bool is_double_sensitivity_mode;
> + int vstatus_offset;
> + u32 vstatus_busy;
> + u32 new_reg_req;
I don't like the fact the fields are getting duplicated in two structs. In the
next patch also, you are adding the duplicate read/write callbacks. So I'd
suggest coming up with a per-SoC const struct and passing that pointer in
'phy_cfg' through drvdata and copying it to 'phy_reg':
struct phy_reg_desc {
int vstatus_offset;
...
};
static const struct phy_reg_desc phy_reg_desc_rtd1295 = {
.vstatus_offset = 0,
...
};
...
struct phy_reg {
...
const struct phy_reg_desc *desc;
};
struct phy_cfg {
...
const struct phy_reg_desc *reg_desc;
};
...
static const struct phy_cfg rtd1295_phy_cfg = {
...
.reg_desc = &phy_reg_desc_rtd1295,
};
...
phy_parameter->phy_reg.desc = phy_cfg->reg_desc;
- Mani
--
மணிவண்ணன் சதாசிவம்