mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Joey Lu <a0987203069@gmail.com>
To: Vinod Koul <vkoul@kernel.org>
Cc: Neil Armstrong <neil.armstrong@linaro.org>,
	Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>, Arnd Bergmann <arnd@arndb.de>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Jacky Huang <ychuang3@nuvoton.com>,
	Shan-Chun Hung <schung@nuvoton.com>,
	Hui-Ping Chen <hpchen0nvt@gmail.com>, Joey Lu <yclu4@nuvoton.com>,
	linux-phy@lists.infradead.org, devicetree@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v6 3/3] phy: nuvoton: phy-ma35d1-usb2: extend to dual-port with OTG support
Date: Tue, 6 Oct 2026 09:37:13 +0800	[thread overview]
Message-ID: <ab91b558-e7e6-4758-b4e3-66e5db75b790@gmail.com> (raw)
In-Reply-To: <asN29Gi71MIA-2fq@parshuram>


Vinod Koul 於 2026/10/5 下午 06:07 寫道:
> On 29-09-26, 10:08, Joey Lu wrote:
>> PHY0 and PHY1 use the same power-on/reset sequence in USBPMISCR, with
>> PHY1 control bits shifted 16 positions relative to PHY0.  A separate
>> driver for PHY1 would duplicate this logic, so the existing driver is
>> extended to manage both ports.
>>
>> The original driver polled only DEVCKSTB after releasing PHY0 from
>> reset.  When USB0 operates in host mode (USB ID pin floating or tied
>> high) only HSTCKSTB and CK12MSTB assert; DEVCKSTB never sets.  Polling
>> exclusively for DEVCKSTB in host mode causes a 1 ms timeout on every
>> phy_init() call from the EHCI driver.  The init callback is changed to
>> accept either host-mode or device-mode clock stability, whichever
>> asserts first.
>>
>> The power_on and power_off callbacks are replaced by a single init
>> callback that handles PHY reset and clock-stable polling, because
>> there is no PHY-specific clock gate on MA35D1; the PHY analog block
>> derives its reference from the HXT crystal.
>>
>> A read-only USB role switch is registered for PHY0 to expose the USB0
>> role to userspace via the standard role-switch sysfs interface.  The
>> .set callback returns -EOPNOTSUPP because the hardware mux is fully
>> automatic with no software override path.  When CONFIG_USB_ROLE_SWITCH
>> is not enabled, the registration returns -ENODEV and the driver skips
>> the role switch gracefully without failing probe.
>>
>> Two new optional device-tree properties are implemented:
>>    - nuvoton,rcalcode: writes per-port 4-bit resistor calibration trim
>>      codes to the RCALCODE field in USBPMISCR.
>>    - nuvoton,oc-active-high: sets the UHOVRCURH bit in MISCFCR0 to treat
>>      the over-current detect input as active-high.
>>
>> Signed-off-by: Joey Lu <a0987203069@gmail.com>
>> ---
>>   drivers/phy/nuvoton/phy-ma35d1-usb2.c | 286 +++++++++++++++++++-------
>>   1 file changed, 211 insertions(+), 75 deletions(-)
>>
>> diff --git a/drivers/phy/nuvoton/phy-ma35d1-usb2.c b/drivers/phy/nuvoton/phy-ma35d1-usb2.c
>> index 9a459b700ed4..547c7d55d8ff 100644
>> --- a/drivers/phy/nuvoton/phy-ma35d1-usb2.c
>> +++ b/drivers/phy/nuvoton/phy-ma35d1-usb2.c
>> @@ -1,11 +1,16 @@
>>   // SPDX-License-Identifier: GPL-2.0
>>   /*
>> - * Copyright (C) 2024 Nuvoton Technology Corp.
>> + * Nuvoton MA35D1 USB 2.0 PHY driver
>> + *
>> + * Supports PHY0 (USB0 OTG port, shared between DWC2 gadget and EHCI0/OHCI0)
>> + * and PHY1 (USB1 host-only port, used by EHCI1/OHCI1). The hardware mux on
>> + * PHY0 switches automatically via the USB ID pin.
>> + *
>> + * Copyright (C) 2026 Nuvoton Technology Corp.
> Not correct, this should be updated to 2024-2026, you dont drop the
> copyright notices, you update them!
Agreed, will fix in v7 to preserve the original 2024 date and reflect 
this series' changes.
>>    */
>>   #include <linux/bitfield.h>
>>   #include <linux/clk.h>
>>   #include <linux/delay.h>
>> -#include <linux/io.h>
> why is this dropped?
This driver never did direct MMIO access (no readl()/writel()/ioremap()/
__iomem), even before this series - all register access goes through
regmap via syscon_regmap_lookup_by_phandle(). So linux/io.h was an
unused include already, and it's dropped here as part of the broader
rewrite touching this include block. Happy to keep it if you'd prefer
not to bundle unrelated include cleanup into this series.

Thanks for the review.

BR,
Joey

  reply	other threads:[~2026-10-06  1:37 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-29  2:08 [PATCH v6 0/3] phy: nuvoton: extend MA35D1 USB2 PHY driver for dual-port " Joey Lu
2026-09-29  2:08 ` [PATCH v6 1/3] dt-bindings: phy: nuvoton,ma35d1-usb2-phy: extend for dual-port and OTG Joey Lu
2026-09-29  2:08 ` [PATCH v6 2/3] arm64: dts: nuvoton: ma35d1: add USB controllers and dual-port PHY node Joey Lu
2026-10-01  8:48   ` Jacky Huang
2026-09-29  2:08 ` [PATCH v6 3/3] phy: nuvoton: phy-ma35d1-usb2: extend to dual-port with OTG support Joey Lu
2026-10-05 10:07   ` Vinod Koul
2026-10-06  1:37     ` Joey Lu [this message]
2026-10-06  8:37       ` Vinod Koul
2026-10-06 10:22         ` Joey Lu
2026-10-06 10:39           ` Vinod Koul
2026-10-06 10:43             ` Joey Lu

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=ab91b558-e7e6-4758-b4e3-66e5db75b790@gmail.com \
    --to=a0987203069@gmail.com \
    --cc=arnd@arndb.de \
    --cc=catalin.marinas@arm.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=hpchen0nvt@gmail.com \
    --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=neil.armstrong@linaro.org \
    --cc=robh@kernel.org \
    --cc=schung@nuvoton.com \
    --cc=vkoul@kernel.org \
    --cc=ychuang3@nuvoton.com \
    --cc=yclu4@nuvoton.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

all inboxes | Powered by JetHome®