Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

phy: renesas: rcar-gen3-usb2: Allow SoC-specific OBINT bits via phy_data

Update the PHY driver to support SoC-specific OBINT enable bits by
introducing the `obint_enable_bits` field in the `rcar_gen3_phy_drv_data`
structure. This allows each SoC to specify bits required.

Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Link: https://lore.kernel.org/r/20250808215209.3692744-4-prabhakar.mahadev-lad.rj@bp.renesas.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>

authored by

Lad Prabhakar and committed by
Vinod Koul
4b7aa47e f75806d2

+14 -13
+14 -13
drivers/phy/renesas/phy-rcar-gen3-usb2.c
··· 71 71 /* OBINTSTA and OBINTEN */ 72 72 #define USB2_OBINT_SESSVLDCHG BIT(12) 73 73 #define USB2_OBINT_IDDIGCHG BIT(11) 74 - #define USB2_OBINT_BITS (USB2_OBINT_SESSVLDCHG | \ 75 - USB2_OBINT_IDDIGCHG) 74 + #define USB2_OBINT_IDCHG_EN BIT(0) /* RZ/G2L specific */ 76 75 77 76 /* VBCTRL */ 78 77 #define USB2_VBCTRL_OCCLREN BIT(16) ··· 92 93 #define USB2_ADPCTRL_DRVVBUS BIT(4) 93 94 94 95 /* RZ/G2L specific */ 95 - #define USB2_OBINT_IDCHG_EN BIT(0) 96 96 #define USB2_LINECTRL1_USB2_IDMON BIT(0) 97 97 98 98 #define NUM_OF_PHYS 4 ··· 128 130 struct work_struct work; 129 131 spinlock_t lock; /* protects access to hardware and driver data structure. */ 130 132 enum usb_dr_mode dr_mode; 131 - u32 obint_enable_bits; 132 133 bool extcon_host; 133 134 bool is_otg_channel; 134 135 bool uses_otg_pins; ··· 138 141 bool no_adp_ctrl; 139 142 bool init_bus; 140 143 bool utmi_ctrl; 144 + u32 obint_enable_bits; 141 145 }; 142 146 143 147 /* ··· 223 225 u32 val = readl(usb2_base + USB2_OBINTEN); 224 226 225 227 if (ch->uses_otg_pins && enable) 226 - val |= ch->obint_enable_bits; 228 + val |= ch->phy_data->obint_enable_bits; 227 229 else 228 - val &= ~ch->obint_enable_bits; 230 + val &= ~ch->phy_data->obint_enable_bits; 229 231 writel(val, usb2_base + USB2_OBINTEN); 230 232 } 231 233 ··· 428 430 mdelay(20); 429 431 430 432 writel(0xffffffff, usb2_base + USB2_OBINTSTA); 431 - writel(ch->obint_enable_bits, usb2_base + USB2_OBINTEN); 433 + writel(ch->phy_data->obint_enable_bits, usb2_base + USB2_OBINTEN); 432 434 433 435 rcar_gen3_device_recognition(ch); 434 436 } ··· 448 450 449 451 scoped_guard(spinlock, &ch->lock) { 450 452 status = readl(usb2_base + USB2_OBINTSTA); 451 - if (status & ch->obint_enable_bits) { 453 + if (status & ch->phy_data->obint_enable_bits) { 452 454 dev_vdbg(dev, "%s: %08x\n", __func__, status); 453 - writel(ch->obint_enable_bits, usb2_base + USB2_OBINTSTA); 455 + writel(ch->phy_data->obint_enable_bits, usb2_base + USB2_OBINTSTA); 454 456 rcar_gen3_device_recognition(ch); 455 457 ret = IRQ_HANDLED; 456 458 } ··· 589 591 static const struct rcar_gen3_phy_drv_data rcar_gen3_phy_usb2_data = { 590 592 .phy_usb2_ops = &rcar_gen3_phy_usb2_ops, 591 593 .no_adp_ctrl = false, 594 + .obint_enable_bits = USB2_OBINT_SESSVLDCHG | 595 + USB2_OBINT_IDDIGCHG, 592 596 }; 593 597 594 598 static const struct rcar_gen3_phy_drv_data rz_g1c_phy_usb2_data = { 595 599 .phy_usb2_ops = &rz_g1c_phy_usb2_ops, 596 600 .no_adp_ctrl = false, 601 + .obint_enable_bits = USB2_OBINT_SESSVLDCHG | 602 + USB2_OBINT_IDDIGCHG, 597 603 }; 598 604 599 605 static const struct rcar_gen3_phy_drv_data rz_g2l_phy_usb2_data = { 600 606 .phy_usb2_ops = &rcar_gen3_phy_usb2_ops, 601 607 .no_adp_ctrl = true, 608 + .obint_enable_bits = USB2_OBINT_IDCHG_EN, 602 609 }; 603 610 604 611 static const struct rcar_gen3_phy_drv_data rz_g3s_phy_usb2_data = { 605 612 .phy_usb2_ops = &rcar_gen3_phy_usb2_ops, 606 613 .no_adp_ctrl = true, 607 614 .init_bus = true, 615 + .obint_enable_bits = USB2_OBINT_IDCHG_EN, 608 616 }; 609 617 610 618 static const struct rcar_gen3_phy_drv_data rz_v2h_phy_usb2_data = { 611 619 .phy_usb2_ops = &rcar_gen3_phy_usb2_ops, 612 620 .no_adp_ctrl = true, 613 621 .utmi_ctrl = true, 622 + .obint_enable_bits = USB2_OBINT_IDCHG_EN, 614 623 }; 615 624 616 625 static const struct of_device_id rcar_gen3_phy_usb2_match_table[] = { ··· 752 747 if (IS_ERR(channel->base)) 753 748 return PTR_ERR(channel->base); 754 749 755 - channel->obint_enable_bits = USB2_OBINT_BITS; 756 750 channel->dr_mode = rcar_gen3_get_dr_mode(dev->of_node); 757 751 if (channel->dr_mode != USB_DR_MODE_UNKNOWN) { 758 752 channel->is_otg_channel = true; ··· 789 785 if (ret) 790 786 goto error; 791 787 } 792 - 793 - if (channel->phy_data->no_adp_ctrl) 794 - channel->obint_enable_bits = USB2_OBINT_IDCHG_EN; 795 788 796 789 spin_lock_init(&channel->lock); 797 790 for (i = 0; i < NUM_OF_PHYS; i++) {