Commit Graph

2439 Commits

Author SHA1 Message Date
Su Hui
09aa95c0e7 phy: sunplus: return negative error code in sp_usb_phy_probe
[ Upstream commit 2a9c713825 ]

devm_phy_create() return negative error code, 'ret' should be
'PTR_ERR(phy)' rather than '-PTR_ERR(phy)'.

Fixes: 99d9ccd973 ("phy: usb: Add USB2.0 phy driver for Sunplus SP7021")
Signed-off-by: Su Hui <suhui@nfschina.com>
Link: https://lore.kernel.org/r/20231120091046.163781-1-suhui@nfschina.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-01-10 17:16:57 +01:00
Michael Walle
c7573ba355 phy: mediatek: mipi: mt8183: fix minimal supported frequency
[ Upstream commit 06f76e464a ]

The lowest supported clock frequency of the PHY is 125MHz (see also
mtk_mipi_tx_pll_enable()), but the clamping in .round_rate() has the
wrong minimal value, which will make the .enable() op return -EINVAL on
low frequencies. Fix the minimal clamping value.

Fixes: efda51a58b ("drm/mediatek: add mipi_tx driver for mt8183")
Signed-off-by: Michael Walle <mwalle@kernel.org>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Link: https://lore.kernel.org/r/20231123110202.2025585-1-mwalle@kernel.org
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-01-10 17:16:57 +01:00
Andrew Davis
a7ccc9d900 phy: ti: gmii-sel: Fix register offset when parent is not a syscon node
[ Upstream commit 0f40d5099c ]

When the node for this phy selector is a child node of a syscon node then the
property 'reg' is used as an offset into the parent regmap. When the node
is standalone and gets its own regmap this offset is pre-applied. So we need
to track which method was used to get the regmap and not apply the offset
in the standalone case.

Fixes: 1fdfa7cccd ("phy: ti: gmii-sel: Allow parent to not be syscon node")
Signed-off-by: Andrew Davis <afd@ti.com>
Reviewed-by: Roger Quadros <rogerq@kernel.org>
Link: https://lore.kernel.org/r/20231025143302.1265633-1-afd@ti.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-01-10 17:16:56 +01:00
Xu Yang
5a913c7fc9 LF-10993-5 phy: freescale: imx8mq-usb: add tca function driver for imx95
TCA is a Type-C assist block in i.MX95 USB3 phy. The TCA block consists
of two functional blocks (XBar assist and VBus assist) and one system
access interface using APB.

The primary functionality of XBar assist is:
 - switching lane for flip
 - moving unused lanes into lower power states.

This driver will mainly focus on the lane switching functionality.

Note: this version will not put SS lane into USB safe state since the host
controller cannot be reset when SS lane is in USB safe state.

Signed-off-by: Xu Yang <xu.yang_2@nxp.com>
Reviewed-by: Jun Li <jun.li@nxp.com>
2023-12-27 18:31:54 +08:00
Xu Yang
498769d6d5 LF-10993-4 phy: freescale: imx8mq-usb: add "fsl,imx95-usb-phy" compatible
Add "fsl,imx95-usb-phy" compatible for better distinction.

Signed-off-by: Xu Yang <xu.yang_2@nxp.com>
Reviewed-by: Jun Li <jun.li@nxp.com>
2023-12-27 18:31:53 +08:00
Guoniu.zhou
864ec9e1a6 LF-10821-01: phy: phy-fsl-imx9-dphy-rx: don't print message when error number is -EPROBE_DEFER
Check the return value and don't print error message when return
error is -EPROBE_DEFER to avoid confusion.

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
2023-12-13 18:34:11 +08:00
Johan Hovold
7e2cde1813 Revert "phy: realtek: usb: Add driver for the Realtek SoC USB 2.0 PHY"
commit 7a784bcdd7 upstream.

This reverts commit 134e6d25f6.

The recently added Realtek PHY drivers depend on the new port status
notification mechanism which was built on the deprecated USB PHY
implementation and devicetree binding.

Specifically, using these PHYs would require describing the very same
PHY using both the generic "phy" property and the deprecated "usb-phy"
property which is clearly wrong.

We should not be building new functionality on top of the legacy USB PHY
implementation even if it is currently stuck in some kind of
transitional limbo.

Revert the new Realtek PHY drivers for now so that the port status
notification interface can be reverted and replaced.

Fixes: 134e6d25f6 ("phy: realtek: usb: Add driver for the Realtek SoC USB 2.0 PHY")
Cc: stable@vger.kernel.org      # 6.6
Cc: Stanley Chang <stanley_chang@realtek.com>
Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
Link: https://lore.kernel.org/r/20231106110654.31090-3-johan+linaro@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-12-03 07:33:08 +01:00
Johan Hovold
e27877990e Revert "phy: realtek: usb: Add driver for the Realtek SoC USB 3.0 PHY"
commit 258ea41c92 upstream.

This reverts commit adda6e82a7.

The recently added Realtek PHY drivers depend on the new port status
notification mechanism which was built on the deprecated USB PHY
implementation and devicetree binding.

Specifically, using these PHYs would require describing the very same
PHY using both the generic "phy" property and the deprecated "usb-phy"
property which is clearly wrong.

We should not be building new functionality on top of the legacy USB PHY
implementation even if it is currently stuck in some kind of
transitional limbo.

Revert the new Realtek PHY drivers for now so that the port status
notification interface can be reverted and replaced.

Fixes: adda6e82a7 ("phy: realtek: usb: Add driver for the Realtek SoC USB 3.0 PHY")
Cc: stable@vger.kernel.org	# 6.6
Cc: Stanley Chang <stanley_chang@realtek.com>
Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
Link: https://lore.kernel.org/r/20231106110654.31090-2-johan+linaro@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-12-03 07:33:08 +01:00
Jason Liu
f75d905095 Merge tag 'v6.6.3' into lf-6.6.y
This is the 6.6.3 stable release

* tag 'v6.6.3': (526 commits)
  Linux 6.6.3
  drm/amd/display: Change the DMCUB mailbox memory location from FB to inbox
  drm/amd/display: Clear dpcd_sink_ext_caps if not set
  ...

Signed-off-by: Jason Liu <jason.hui.liu@nxp.com>

 Conflicts:
	arch/arm64/boot/dts/freescale/fsl-ls208xa.dtsi
	drivers/usb/dwc3/core.c
2023-11-30 09:41:12 -06:00
Konrad Dybcio
77f1450464 phy: qualcomm: phy-qcom-eusb2-repeater: Zero out untouched tuning regs
[ Upstream commit 99a517a582 ]

The vendor kernel zeroes out all tuning data outside the init sequence
as part of initialization. Follow suit to avoid UB.

Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org>
Link: https://lore.kernel.org/r/20230830-topic-eusb2_override-v2-3-7d8c893d93f6@linaro.org
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-11-28 17:19:45 +00:00
Konrad Dybcio
36cc3bd886 phy: qualcomm: phy-qcom-eusb2-repeater: Use regmap_fields
[ Upstream commit 4ba2e52718 ]

Switch to regmap_fields, so that the values written into registers are
sanitized by their explicit sizes and the different registers are
structured in an iterable object to make external changes to the init
sequence simpler.

Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org>
Link: https://lore.kernel.org/r/20230830-topic-eusb2_override-v2-2-7d8c893d93f6@linaro.org
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-11-28 17:19:45 +00:00
Dong Aisheng
88d03946db Merge branch 'phy/next' into next
* phy/next: (39 commits)
  LF-10587-06: phy: freescale: add MIPI DPHY Rx driver for iMX9 family
  LF-10619-2: phy: imx8mp-lvds: Support LVDS PHY for i.MX95
  LF-10619-1: dt-bindings: phy: fsl,imx8mp-lvds-phy: Add i.MX95 LVDS phy binding support
  LF-8513-9 phy: freescale: imx8q-pcie: Add i.MX8Q PCIe PHY driver
  LF-8513-8 dt-bindings: phy: phy-imx8-pcie: Add binding for different usecases of i.MX8QM PCIe PHYs
  ...
2023-11-22 17:04:55 +08:00
Dong Aisheng
9d90fd5857 Merge branch 'net/next' into next
* net/next: (344 commits)
  LF-10639-5 net: enetc: Add xpcs support and set 10G support bits
  LF-10639-4 net: pcs: xpcs: add mx95 serdes support
  LF-10640-6 ptp: add NETC PTP driver support for i.MX95
  LF-10639-3 net: phy: aquantia: enable LEDs to show the link state
  LF-10639-1 enetc: mdio: add regulator support for both imdio and emdio bus
  ...
2023-11-22 17:04:52 +08:00
Dong Aisheng
d0e3e968af Merge branch 'display/next' into next
* display/next: (640 commits)
  LF-10583-2: drm: bridge: imx: Add i.MX95 LVDS Display Bridge(LDB) driver
  LF-10583-1: dt-bindings: display: bridge: Add i.MX95 LVDS display bridge binding
  LF-10620: drm: bridge: it6263: add support for DRM_BRIDGE_ATTACH_NO_CONNECTOR
  LF-10617-2 drm/panel: Add Raydium RM692C9 MIPI DSI panel support
  LF-10617-1 dt-bindings: display: panel: Add Raydium RM692C9
  ...
2023-11-22 17:04:46 +08:00
Guoniu.zhou
b542856875 LF-10587-06: phy: freescale: add MIPI DPHY Rx driver for iMX9 family
Add MIPI DPHY Rx driver for iMX9 family.

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
2023-11-22 13:58:39 +08:00
Sandor Yu
a2e88a7666 LF-10619-2: phy: imx8mp-lvds: Support LVDS PHY for i.MX95
Support LVDS PHY0 and PHY1 for i.MX95.

Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
Reviewed-by: Liu Ying <victor.liu@nxp.com>
2023-11-21 14:06:35 +08:00
Ioana Ciornei
5b79e3e88b phy: lynx-10g: fix bugs in 'fsl,ls1088a-serdes1' and mark it as tested
Fix the following bugs in the 'fsl,ls1088a-serdes1':
- Remove the LANE_MODE_2500BASEX mode since this is not listed in the
SoC RM as a support mode.
- Mark the XFI protocol converter as being available on lanes #2 and #3.
- Remove a forgotten 'return' statement from the
ls1088a_serdes1_get_pcvt_offset() function.

This driver was tested on the LS1088ARDB board with the following
protocols: 10GBASER, 1000BASE-X/SGMII and QSGMII. As such, mark the SoC
as tested.

Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
2023-11-07 13:40:18 +02:00
Ioana Ciornei
5b4cecd361 phy: lynx-10g: remove the 'not tested' comment from 'fsl,ls2088a-serdes1'
The 'fsl,ls2088a-serdes1' compatible handling was tested in a copper
backplane scenario. Remove the comment saying otherwise.

Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
2023-11-07 13:39:38 +02:00
Vladimir Oltean
6b903780d4 phy: lynx-10g: stop on lynx_pccr_read() in lynx_10g_backup_pccr_val()
lynx_pccr_read() may return -EOPNOTSUPP if the representation of the SoC
integration that is hardcoded in the driver - priv->info->get_pccr() -
does not expect there to exist a PCCR register for a given lane and
SerDes protocol.

In lynx_10g_backup_pccr_val(), we are ignoring that negative error code
on good faith, which means that the way in which the hardware is
configured at probe time will never take us by surprise.

Given the fact that we issue no hardware reset to the SerDes on probe,
it can happen that someone has messed with the lane configuration in an
invalid way during a prior boot stage (e.g. PBL), forcing a protocol
selection in LNaPSSR0_TYPE for which we have no actual protocol converter.
What would happen in that case is that we would happily ignore the
-EOPNOTSUPP from lynx_pccr_read() and proceed to save an uninitialized
"u32 val" as lane->default_pccr, and continue on, thinking this lane is
OK to be used.

What we should probably do instead is to mark the lane as having an
unknown protocol, because we don't expect it to be configured that way,
and produce a warning.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
2023-11-03 14:48:34 +02:00
Vladimir Oltean
9d9c26bf12 net: phy: lynx-10g: implement phy_exit() operation
The blamed commit introduced a phy_exit() call which was missing before,
to lynx_pcs_destroy(). The role of phy_exit() is to bring the
phy->init_count from the phy core back to 0, so that a subsequent
phy_init() call gets propagated to the driver again.

What was happening is that when the dpaa2-mac driver had -EPROBE_DEFER
and it called phy_init() a second time, that didn't get propagated to
the driver, since the phy->init_count would just get bumped to 2.
That is no longer the case - we call phy_init() each time, but the Lynx
hardware is not prepared to power down a powered down lane. Instead, the
driver just hangs in the loop that expects the power down operation to
finalize.

Fix that by implementing phy_exit() as the operation which powers the
lane back up - essentially the expected operation when it is not managed
by a consumer, but operating as standalone.

Fixes: 7a560782c9 ("net: pcs: lynx: incorporate SerDes PHY handling from dpaa2-mac")
Debugged-by: Ioana Ciornei <ioana.ciornei@nxp.com>
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
2023-11-02 19:07:39 +02:00
Vladimir Oltean
5a3aa23002 net: phy: lynx-28g: implement phy_exit() operation
The blamed commit introduced a phy_exit() call which was missing before,
to lynx_pcs_destroy(). The role of phy_exit() is to bring the
phy->init_count from the phy core back to 0, so that a subsequent
phy_init() call gets propagated to the driver again.

What was happening is that when the dpaa2-mac driver had -EPROBE_DEFER
and it called phy_init() a second time, that didn't get propagated to
the driver, since the phy->init_count would just get bumped to 2.
That is no longer the case - we call phy_init() each time, but the Lynx
hardware is not prepared to power down a powered down lane. Instead, the
driver just hangs in the loop that expects the power down operation to
finalize.

Fix that by implementing phy_exit() as the operation which powers the
lane back up - essentially the expected operation when it is not managed
by a consumer, but operating as standalone.

Fixes: 7a560782c9 ("net: pcs: lynx: incorporate SerDes PHY handling from dpaa2-mac")
Debugged-by: Ioana Ciornei <ioana.ciornei@nxp.com>
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
2023-11-02 19:07:39 +02:00
Vladimir Oltean
0cd4263823 phy: lynx-10g: new driver
Introduce a driver for the networking lanes of the Lynx 10G block,
present on the majority of Layerscape and QorIQ (Freescale/NXP) SoCs.

Co-developed-by: Ioana Ciornei <ioana.ciornei@nxp.com>
Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
2023-10-30 17:16:59 +08:00
Vladimir Oltean
9c2a69be0a phy: lynx-28g: add support for multi-lane 40GBase-KR4
This is handled just like 10GBase-KR, except there is a single PCS for
all 4 lanes.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
2023-10-30 17:16:59 +08:00
Vladimir Oltean
9f2f202d5f phy: lynx-28g: report the current protocol converter's MDEV_PORT through phy_get_status()
Allow consumers of the SerDes lane to figure out the PCS and AN/LT block
address without hardcoding it in the device tree or in the driver code,
which is what they do currently.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
2023-10-30 17:16:59 +08:00
Vladimir Oltean
c2b7e8b852 phy: lynx-28g: set up equalization for 25G according to AN12950
Application note AN12950 recommends certain default SerDes lane values
to be changed for 25G Ethernet. The workaround is implemented in the
Pre-Boot Loader (PBL).

However, the SerDes driver overwrites what the PBL does. So it needs to
be aware of those special values too.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
2023-10-30 17:16:58 +08:00
Vladimir Oltean
cde2aed878 phy: lynx-28g: add algorithm for IEEE 802.3 C72 (10GBase-KR) link training
Provide an implementation for the new phy_configure_opts_xgkr API for
the 28G Lynx SerDes from NXP LX2160A. The core logic of the algorithm is
also usable with the 10G Lynx SerDes for earlier QorIQ/Layerscape SoCs,
but a driver does not exist for that yet. Nonetheless, it is in progress,
so structure the link training algorithm as library code, shareable by
the two SerDes drivers when the time comes.

Loosely based on previous work by Florinel Iordache.

Co-developed-by: Florinel Iordache <florinel.iordache@nxp.com>
Signed-off-by: Florinel Iordache <florinel.iordache@nxp.com>
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
2023-10-30 17:16:58 +08:00
Vladimir Oltean
e25638455e phy: lynx-28g: add support for backplane modes through PHY_MODE_ETHERNET_LINKMODE
The Lynx 28G SerDes lanes allow the tuning of their signal equalization
parameters as required by the IEEE 802.3 clauses for copper backplanes.

These modes are selected when there is a backplane AN/LT block in charge,
and it uses phy_set_mode_ext(PHY_MODE_ETHERNET_LINKMODE).

Only the single-lane link modes (1000Base-KX, 10GBase-KR, 25GBase-KR)
are supported here (40GBase-KR, 100GBase-KR - not yet). And only the
initial configuration for these link modes is present, not the dynamic
equalization changes. That will come as a separate change.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
2023-10-30 17:16:58 +08:00
Vladimir Oltean
7e5b21edf5 phy: lynx-28g: refactor the CDR lock check from the work to a function
The future XGKR algorithm implementation will want to perform an
expedited CDR lock check. Rename the work item, and move the core logic
to a dedicated function that can be reused.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
2023-10-30 17:16:58 +08:00
Vladimir Oltean
5af6084c03 phy: lynx-28g: convert iowrite32() calls with magic values to macros
The driver will need to become more careful with the values it writes to
the TX and RX equalization registers. As a preliminary step, convert the
magic numbers to macros defining the register field meanings.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
2023-10-30 17:16:58 +08:00
Vladimir Oltean
11ff9ba547 phy: lynx-28g: distinguish between 10GBASE-R and USXGMII
The driver does not handle well protocol switching to or from USXGMII,
because it conflates it with 10GBase-R.

In the expected USXGMII use case, that isn't a problem, because SerDes
protocol switching performed by the lynx-28g driver is not necessary,
because USXGMII natively supports multiple speeds, as opposed to SFP
modules using 1000Base-X or 10GBase-R which require switching between
the 2.

That being said, let's be explicit, and in case someone requests a
protocol change which involves USXGMII, let's do the right thing.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
2023-10-30 17:16:58 +08:00
Vladimir Oltean
71fb60f3d9 phy: lynx-28g: refactor lane->interface to lane->mode
In preparation for PHY_MODE_ETHTOOL support in the lynx-28g phy driver,
we need a unified internal data type for the lane operating modes.
That can be neither phy_interface_t nor ethtool_link_mode_bit_indices.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
2023-10-30 17:16:58 +08:00
Vladimir Oltean
17b731c840 phy: lynx-28g: replace LYNX_28G_SGMIIaCR1_SGPCS_DIS with 0
Now that lynx_28g_lane_rmw() no longer forces a macro name concatenation
inside its arguments, we no longer need to create macros with the "_DIS"
name in them which hold the value of 0. Sometimes there are actual
register fields which are named "DIS", and this becomes confusing,
because it isn't the case here.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
2023-10-30 17:16:58 +08:00
Vladimir Oltean
7619b7c749 phy: lynx-28g: restructure protocol configuration register accesses
Eliminate the need to calculate a lane_offset manually, and generate
some macros which access the protocol converter corresponding to the
correct lane in the PCC* registers.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
2023-10-30 17:16:58 +08:00
Vladimir Oltean
e79b74e946 phy: lynx-28g: add debugging print in CDR lock workaround
Give users a quick way to know that the lane receiver is being reset in
the background.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
2023-10-30 17:16:58 +08:00
Vladimir Oltean
43e5ee330f phy: lynx-28g: implement phy_get_status() for CDR lock
The MTIP backplane AN/LT block needs this extra information from the
SerDes PHY as another source of "link up" information.

Namely, at 25Gbps, the PCS does not have a MDIO_CTRL1_LPOWER bit
implemented in its MDIO_MMD_PCS:MDIO_CTRL1 register, so a phy_suspend()
procedure will not power down the link, and will not cause a link drop
event on the link partner.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
2023-10-30 17:16:58 +08:00
Vladimir Oltean
375b57c1a9 phy: lynx-28g: truly power the lanes up or down
The current procedure for power_off() and power_on() is the same as the
one used for major lane reconfiguration, aka halting. But one can
observe that a halted lane does not cause, for example, the CDR of the
link partner to lose lock.

Implement the procedure mentioned in the block guide for powering down
a lane, and then back on.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
2023-10-30 17:16:58 +08:00
Vladimir Oltean
8b4638742d phy: lynx-28g: don't concatenate macros for lynx_28g_lane_rmw() args "val" and "mask"
The fact that lynx_28g_lane_rmw() prepends "val" with LYNX_28G_${reg}_
means that we can't specify numerical values or other expressions for
this argument.

Refactor the code to fully spell out the string concatenation. This has
the added readability benefit that searching these arguments gets us
directly to their definition in the code.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
2023-10-30 17:16:57 +08:00
Vladimir Oltean
0f3dcdb103 phy: introduce phy_get_status() and use it to report CDR lock
Some modules, like the MTIP AN/LT block used as a copper backplane PHY
driver, need this extra information from the SerDes PHY as another
source of "link up" information.

Namely, the 25GBase-R PCS does not have a MDIO_CTRL1_LPOWER bit
implemented in its MDIO_MMD_PCS:MDIO_CTRL1 register. That bit is
typically set from phy_suspend() or phylink_pcs_disable() implementations,
and that is supposed to cause a link drop event on the link partner.
But here it does not happen.

By implementing the networking phylink_pcs_disable() as phy_power_off(),
we are able to actually power down the lane in a way that is visible to
the remote end. Where it is visible is the CDR lock, so we introduce
PHY_STATUS_TYPE_CDR_LOCK as an extra link indication, we are able to
detect that condition and signal it to upper layers of the network
stack.

A more high-level and generic phy_get_status() operation was chosen
instead of the more specific phy_get_cdr_lock() alternative, because I
saw this as being more in the spirit of the generic PHY API.
Also, phy_get_status() is more extensible and reusable for other
purposes as well.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
2023-10-30 17:16:57 +08:00
Ioana Ciornei
de02207736 phy: lynx-28g: add support for 25GBASER
Add support for 25GBASE-R in the Lynx 28G SerDes PHY driver.
This mainly means being able to determine if a PLL is able to support
the new interface type, to determine at probe time if a lane is
configured from the Reset Configuration Word (RCW) with this interface
type and to be able to reconfigure a lane.

Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
2023-10-30 17:16:55 +08:00
Ioana Ciornei
81e734ff40 phy: lynx-28g: configure more equalization params for 10GBASER
We discovered that not all the equalization parameters for a lane were
configured upon an interface change. Configure the extra 2 registers
with the appropriate values for 10GBASE-R.

This was revealed when we added support for the 10G <-> 25G dynamic
configuration of the SerDes lane. These two interface types have
different values for the RCCR0 and TTLCR0 registers, whereas the 10G and
1G share the same values.

Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
2023-10-30 17:16:54 +08:00
Ioana Ciornei
aa490c6388 phy: add PHY driver for Inphi IN112525 Retimer
This patch adds support for the Inphi IN112525 S03 retimer.  We model
the retimer as a generic PHY device, as opposed to a networking PHY
(struct phy_device), because this does not support any kind of
autonegotiation.

What this current version of the driver does is to support both
10GBASE-R and 25GBASE-R independently on its two channels.

This means that even though the PHY driver will configure at probe time
all the associated retimer lanes to function at 25G, any consumer driver
(for example the dpaa2-eth) can afterwards request reconfiguration to
another interface type if needed.

This request to reconfigure the retimer PHY can be done using the
.set_mode() callback. The operation is per channel (aka per SerDes lane)
and is not disruptive to the other retimer channel.

How this is achieved is by putting the lanes associates with a channel
in reset, recofiguring only the settings which differ between the two
configurations that we support and then getting the lanes out of reset.

Co-developed-by: Florin Chiculita <florinlaurentiu.chiculita@nxp.com>
Signed-off-by: Florin Chiculita <florinlaurentiu.chiculita@nxp.com>
Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
2023-10-30 17:16:54 +08:00
Richard Zhu
319962baf4 LF-8513-9 phy: freescale: imx8q-pcie: Add i.MX8Q PCIe PHY driver
i.MX8QM HSIO(High Speed IO) module has three instances of single lane
SERDES PHY and an instance of two lanes PCIe GEN3 controller, an
instance of single lane PCIe GEN3 controller, as well as an instance
of SATA 3.0 controller.

And HSIO module can be configured as the following different usecases.
1 - A two lanes PCIea and a single lane SATA.
2 - A single lane PCIea, a single lane PCIeb and a single lane SATA.
3 - A two lanes PCIea, a single lane PCIeb.

Add the i.MX8Q PCIe PHY driver to support the different usecases.
- In PCIe mode, toggle APB_PCLK of PHY to make sure the CORE_RST bit is
  cleared.
- Add the runtime PM support, thus the PCIe PHY PD can be turned off
  when PCIe probe is failed.
- The APB_PCLK is required only when PHY is configured as PCIE mode.

Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
Reviewed-by: Frank Li <frank.li@nxp.com>
2023-10-30 16:05:47 +08:00
Richard Zhu
663460ac65 LF-8215 phy: freescale: imx8m-pcie: Fix i.MX8MP EVK EP RC link speed is only Gen1
Fine tune the PHY parameters, let the PCIe link up to Gen3 between two
i.MX865 EVK boards in the i.MX EP RC validation system.

Since this fine tuned is only specified for i.MX865 EVK boards. Add the
command parameter to specify it when do the EP RC tests between two
i.MX8MP EVK boards.

Add the "pcie_phy_tuned=yes" into kernel command line to enable the PHY
fine-tune.

NOTE: The cross TX/RX differential connection described below, is used
to connect the two PCIe ports of these two EVK boards.

+-----------+                +------------+
|   PCIe TX |<-------------->|PCIe RX     |
|           |                |            |
|EVK Board  |                |EVK Board   |
|           |                |            |
|   PCIe RX |<-------------->|PCIe TX     |
+-----------+                +------------+

Please pay attention to the HW connection, and keep it as solid and
short as possible in the EP/RC validation system.

Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
Reviewed-by: Frank Li <frank.li@nxp.com>
2023-10-30 16:05:46 +08:00
Li Jun
882c3d88ca LF-7890-3 phy: freescale: imx8mq-usb: set usb phy to be wakeup capable
USB remote wakeup need its PHY power domain to be active, so set
PHY to be wakeup capable.

Reviewed-by: Xu Yang <xu.yang_2@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
2023-10-30 16:05:46 +08:00
Liu Ying
dc2f185a38 LF-6263-2 phy: freescale: phy-fsl-imx8mp-lvds: Add i.MX93 LVDS phy support
i.MX93 LVDS phy is similar to i.MX8mp LVDS phy.
They have the below difference from the register perspective:
1) i.MX93 LVDS phy supports one LVDS channel, while i.MX8mp LVDS phy
   supports two.
2) i.MX93 LVDS phy control register bit 1 is defined as
   'enable/disable LVDS', while the register bit of i.MX8mp LVDS phy
   is defined as 'ch1_enable'.

Cc: Sandor Yu <Sandor.yu@nxp.com>
Reviewed-by: Sandor Yu <Sandor.yu@nxp.com>
Signed-off-by: Liu Ying <victor.liu@nxp.com>
2023-10-30 16:05:46 +08:00
Liu Ying
8cd72fbbaf LF-6250-2 phy: freescale: Add i.MX93 Synopsys DesignWare MIPI DPHY support
This patch adds i.MX93 Synopsys DesignWare MIPI DPHY driver support.

Cc: Sandor Yu <Sandor.yu@nxp.com>
Reviewed-by: Sandor Yu <Sandor.yu@nxp.com>
Signed-off-by: Liu Ying <victor.liu@nxp.com>
2023-10-30 16:05:46 +08:00
Sandor Yu
cbfe1a744d LF-6082-2: phy: samsung_hdmi: Add suspend/resume function
Add suspend/resume function.
Recover phy configuration in device resume function.

Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
2023-10-30 16:05:46 +08:00
Sandor Yu
70b4be272e LF-6082-1: phy: samsung_hdmi: replace pclk_rate with struct phy_config
Replace pclk_rate with struct phy_config

Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
2023-10-30 16:05:46 +08:00
Peng Fan
4c59ffc1ee LF-6937-19 phy: samsung_hdmi: make clk/reset optional
With hdmi blk ctrl enabled, clk/reset is handled by blk-ctrl driver,
no need clk/reset here.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
2023-10-30 16:05:46 +08:00
Sandor Yu
bbde3cc56a LF-5490: phy: samsung_hdmi: return current pixel clock rate
Samsung hdmi phy couldn't recalculate the rate by querying hardware.
return the clock rate that setting in set_rate function.

Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
Reviewed-by: Robby Cai <Robby.Cai@nxp.com>
2023-10-30 16:05:46 +08:00
Li Jun
2b77ae8c02 MLK-25653 phy: freescale: imx8mq-usb: fix BC 1.2 detection timing
Following CDP timing requirements defined by USB BC 1.2 specification
and section 3.2.4 Detection Timing CDP.

During Primary Detection iMX device should turn on VDP_SRC and IDM_SINK
for a minimum of 40ms (TVDPSRC_ON). After a time of TVDPSRC_ON,
iMX device is allowed to check the status of the D- line. Current
implementation is waiting between 1ms and 2ms, and certain BC 1.2
complaint USB HUBs cannot be detected. Increase delay to 40ms allowing
enough time for primary detection.

During secondary detection the i.MX is required to disable VDP_SRC and
IDM_SNK, and enable VDM_SRC and IDP_SINK for at least 40ms (TVDMSRC_ON).

This an equivalent patch of BC1.2 fix on USB2 PHY: commit c6d580d96f
("usb: chipidea: imx: Fix Battery Charger 1.2 CDP detection")

Reviewed-by: Xu Yang <xu.yang_2@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
2023-10-30 16:05:46 +08:00
Li Jun
d5b0b6c808 LF-4259-2 phy: freescale: imx8mq-usb: add debugfs to access control register
The CR port is a simple 16-bit data/address parallel port that is
provided for on-chip access to the control registers inside the
USB 3.0 femtoPHY. While access to these registers is not required
for normal PHY operation, this interface enables you to access
some of the PHY’s diagnostic features during normal operation or
to override some basic PHY control signals.

3 debugfs files are created to read and write control registers,
all use hexadecimal format:
ctrl_reg_base: the register offset to write, or the start offset
               to read.
ctrl_reg_count: how many continuous registers to be read.
ctrl_reg_value: read to show the continuous registers value from
                the offset in ctrl_reg_base, to ctrl_reg_base
                + ctrl_reg_count - 1, one line for one register.
                when write, override the register at ctrl_reg_base,
                one time can only change one 16bits register.

Reviewed-by: Haibo Chen <haibo.chen@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
2023-10-30 16:05:45 +08:00
Sandor Yu
e5377fd9a6 MLK-25216: phy: imx hdmi: fine tune phy to pass HDMI CTS
Fine tune hdmi phy to pass HDMI electrical CTS.

Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
2023-10-30 16:05:45 +08:00
Liu Ying
f33bd69512 MLK-23942-5 phy: phy-mixel-lvds-combo: Add runtime PM support
This patch adds runtime PM support for the Mixel LVDS combo PHY driver.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
Reviewed-by: Sandor Yu <Sandor.yu@nxp.com>
2023-10-30 16:05:45 +08:00
Liu Ying
746f689ada MLK-23942-4 phy: phy-mixel-lvds: Add runtime PM support
This patch adds runtime PM support for the Mixel LVDS PHY driver.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
Reviewed-by: Sandor Yu <Sandor.yu@nxp.com>
2023-10-30 16:05:45 +08:00
Liu Ying
2b33de37ba MLK-23942-3 phy: freescale: phy-fsl-imx8mp-lvds: Add runtime PM support
This patch adds runtime PM support for the i.MX8mp LVDS PHY driver.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
Reviewed-by: Sandor Yu <Sandor.yu@nxp.com>
2023-10-30 16:05:45 +08:00
Li Jun
734d5e9cd8 LF-2345-21 phy: freescale: imx8mq-usb: add usb charger detect support
imx8mq and imx8mp USB PHY have battery charging detection function,
do it when set phy mode for device mode as this should be done before
host start enumeration. Link the detection result to power supply
(e.g. typec port manager).

Reviewed-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
2023-10-30 16:05:45 +08:00
Li Jun
302335eac3 LF-2345-20 phy: freescale: imx8mq-usb: enable RxTermination_override_sel
This is to resolve the problem of wakeup system by USB3 device
insertion if hsiomix on, in that case, the USB3 device detects
rx term on so doesn't donwgrade to USB2, so DP/DM wakeup can't
happen, with this override bit we can force the rx term off when
enters system suspend, and disable the override after system resume.

Reviewed-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
2023-10-30 16:05:45 +08:00
Peter Chen
fb9c5c2f84 MLK-19442-2 phy: phy-fsl-imx8mq-usb: change ssc_range value
According to IC engineer suggestion, set ssc_range as -4003 ppm
will have more tolerence for EMI, and suitable for more boards.
Besides, one customer board needs to set this value to pass TX
SSC test.

Signed-off-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
(cherry picked from commit a48a65a401)
2023-10-30 16:05:45 +08:00
Sandor Yu
13d163f8e1 MLK-24397 phy: samsung hdmi: support more clock rate
support pixel clock rate 135.58/137.52/162/154MHz.

Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
(cherry picked from commit 4bb00e2a66)
2023-10-30 16:05:45 +08:00
Sandor Yu
96e1bbf7bd LF-1362: phy: freescale: Add samsung hdmi phy driver
Add samsung hdmi phy driver.
hdmi phy driver registers phy clock named with "hdmi_pclk",
and it should be referred by display controller.

Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
Reviewed-by: Liu Ying <victor.liu@nxp.com>
2023-10-30 16:05:45 +08:00
Liu Ying
dddca6820e MLK-23616-3 phy: fsl-imx8mp-lvds: Enable/disable APB clock when necessary
The phy registers are accessible after APB clock is enabled,
otherwise, the system may hang.  We see the system hang issue
at the driver resume stage due to the disabled APB clock.
This patch fixes this issue by enabling/disabling the clock
when necessary.

Reviewed-by: Sandor Yu <Sandor.yu@nxp.com>
Signed-off-by: Liu Ying <victor.liu@nxp.com>
2023-10-30 16:05:44 +08:00
Liu Ying
8016cc2960 MLK-23252-6 phy: freescale: Add i.MX8mp LVDS PHY support
The i.MX8mp LVDS PHY IP contains two PHYs, each of which
supports a four data lane LVDS channel.
This patch adds i.MX8mp LVDS PHY driver support.

Reviewed-by: Sandor Yu <Sandor.yu@nxp.com>
Signed-off-by: Liu Ying <victor.liu@nxp.com>
2023-10-30 16:05:44 +08:00
Liu Ying
4722e7db27 phy: mixel-lvds-combo: Configure CO divider to meet fvco range requirement
As the below diagram shows, to achieve a particular serial clock rate,
we should choose an appropriate CO divider value(1/2/4/8) so that PLL
VCO frequency(fvco) is in specified range(640MHz ~ 1500MHz).

 ---------  640MHz ~ 1500MHz   ------------      --------------
| PLL VCO | ----------------> | CO divider | -> | serial clock |
 ---------                     ------------      --------------
                               1/2/4/8 div      7 * phy_clk_rate

This patch configures CO divider to be appropriate value to meet the fvco
range requirement.  This may address display flicker issue seen on some
SoC samples.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2023-10-30 16:05:44 +08:00
Liu Ying
220f1fbcb0 phy: Add Mixel LVDS combo PHY support
This patch adds Mixel LVDS combo PHY support(MIPI DSI and LVDS combo).
This LVDS PHY supports one LVDS channel in single mode and two channels in
dual mode.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2023-10-30 16:05:44 +08:00
Liu Ying
670cffa0af phy: Add Mixel LVDS PHY support
This patch adds Mixel LVDS PHY support.
This PHY supports two LVDS channels.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2023-10-30 16:05:44 +08:00
Liu Ying
5aac8d2f67 MLK-25550-2 phy: freescale: phy-fsl-imx8-mipi-dphy: Add i.MX8ulp MIPI DPHY support
This patch adds i.MX8ulp MIPI DPHY support.
Some PHY register offsets are different from those in previous i.MX8
series of SoCs, which is handled by adding dedicated device data.

For i.MX8ulp, register reg_rxhs_settle is replaced by register
reg_m_prg_rxhs_settle, and register reg_mc_prg_rxhs_settle is newly
introduced.

Cc: Sandor Yu <Sandor.yu@nxp.com>
Cc: Robert Chiras <robert.chiras@nxp.com>
Reviewed-by: Sandor Yu <Sandor.yu@nxp.com>
Signed-off-by: Liu Ying <victor.liu@nxp.com>
2023-10-30 15:37:45 +08:00
Robert Chiras
2aa068e1f7 LF-1373-6: phy: imx8-mipi-dphy: Add support for 8QM and 8QXP
Add compatibles for i.MX8QM and i.MX8QXP.

Signed-off-by: Robert Chiras <robert.chiras@nxp.com>
2023-10-30 15:37:45 +08:00
Liu Ying
a42aa88f58 Revert "phy: freescale: phy-fsl-imx8-mipi-dphy: Add i.MX8qxp LVDS PHY mode support"
Downstream has a separate i.MX8qxp LVDS PHY driver, so we don't use
the combo PHY driver for now.

This reverts commit 3fbae28488.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2023-10-30 15:37:45 +08:00
Linus Torvalds
fe3cfe869d phy fixes for 6.6
- Driver fixes for
    - mapphone-mdm6600 runtime pm & pinctrl handling fixes
    - Qualcomm qmp usb pcs register fixes, qmp pcie register size warning
      fix, m31 fixes for wrong pointer in PTR_ERR and dropping wrong vreg
      check, qmp combo fix for 8550 power config register
    - realtek usb fix for debugfs_create_dir() and kconfig dependency
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEE+vs47OPLdNbVcHzyfBQHDyUjg0cFAmU1VYIACgkQfBQHDyUj
 g0fhAw/+I2F51l+SJ5Y2UKnr4BE2aaVjd1CisnoGKFZ2QCMt76mWHRaZZ1YEYAYR
 NK77rBuR80LXUj9mMoHVdIWleH/tlvDJ8LFpA9H+fvDoKkjjK4g66fCG9GU0V3qv
 oWerSiwaAVGb/yLokJ4KwEaumcMukCsGf6P3SWk/XeFwaxySixcD4nwFzpAalX0z
 ZXot62Xq1cLEriH6yJslU3iySWGfpAL12ygYOFVuaW02tUEmIH+zM7L4jNDgldHD
 gr45T8wbh5M2r8uE9x7thMafk7mcKEjiyV5Er2SLgTwh9fRXa3gOw1I+NHcGM8sM
 YnIXlB+hDZ4SuJKWDxsQn+Y3N/+byvHrYMiKvuN32ysZRA8aIvkqdUMPJyZBYk3j
 ecp4TH8YJ3iEVVDbUsv5v/uBH/drlBdJNLEdc71RiJfppsxI+97okdOGXQBT04Lu
 alifV/ehLaZamJrVzpD1wFlYaZnAc0DnwqxZlepOMghzfiA7qQgV70wlMAkL81DX
 R4da2kgmVWlXcjEmOfDUSFsEaLHiZ9ArZabru0kdq1TYOt8/oVnl9t9T/qqB6qs3
 JioLTLXUry5hFpaGjuGTJeRhkJRnOjSAYuCLiyJGd0tcgA05dHXNHOwIIrJTVi4K
 ksz/x2G+lwQP8EnKpctEkY4v5KKGmJPspymzHTXsAcUFdZr7F4w=
 =ugiS
 -----END PGP SIGNATURE-----

Merge tag 'phy-fixes-6.6' of git://git.kernel.org/pub/scm/linux/kernel/git/phy/linux-phy

Pull phy fixes from Vinod Koul:

 - mapphone-mdm6600 runtime pm & pinctrl handling fixes

 - Qualcomm qmp usb pcs register fixes, qmp pcie register size warning
   fix, m31 fixes for wrong pointer in PTR_ERR and dropping wrong vreg
   check, qmp combo fix for 8550 power config register

 - realtek usb fix for debugfs_create_dir() and kconfig dependency

* tag 'phy-fixes-6.6' of git://git.kernel.org/pub/scm/linux/kernel/git/phy/linux-phy:
  phy: realtek: Realtek PHYs should depend on ARCH_REALTEK
  phy: qualcomm: Fix typos in comments
  phy: qcom-qmp-combo: initialize PCS_USB registers
  phy: qcom-qmp-combo: Square out 8550 POWER_STATE_CONFIG1
  phy: qcom: m31: Remove unwanted qphy->vreg is NULL check
  phy: realtek: usb: Drop unnecessary error check for debugfs_create_dir()
  phy: qcom: phy-qcom-m31: change m31_ipq5332_regs to static
  phy: qcom: phy-qcom-m31: fix wrong pointer pass to PTR_ERR()
  dt-bindings: phy: qcom,ipq8074-qmp-pcie: fix warning regarding reg size
  phy: qcom-qmp-usb: split PCS_USB init table for sc8280xp and sa8775p
  phy: qcom-qmp-usb: initialize PCS_USB registers
  phy: mapphone-mdm6600: Fix pinctrl_pm handling for sleep pins
  phy: mapphone-mdm6600: Fix runtime PM for remove
  phy: mapphone-mdm6600: Fix runtime disable on probe
2023-10-22 07:11:10 -10:00
Vladimir Oltean
139ad11431 phy: lynx-28g: serialize concurrent phy_set_mode_ext() calls to shared registers
The protocol converter configuration registers PCC8, PCCC, PCCD
(implemented by the driver), as well as others, control protocol
converters from multiple lanes (each represented as a different
struct phy). So, if there are simultaneous calls to phy_set_mode_ext()
to lanes sharing the same PCC register (either for the "old" or for the
"new" protocol), corruption of the values programmed to hardware is
possible, because lynx_28g_rmw() has no locking.

Add a spinlock in the struct lynx_28g_priv shared by all lanes, and take
the global spinlock from the phy_ops :: set_mode() implementation. There
are no other callers which modify PCC registers.

Fixes: 8f73b37cf3 ("phy: add support for the Layerscape SerDes 28G")
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2023-10-06 10:59:52 +01:00
Vladimir Oltean
0ac87fe54a phy: lynx-28g: lock PHY while performing CDR lock workaround
lynx_28g_cdr_lock_check() runs once per second in a workqueue to reset
the lane receiver if the CDR has not locked onto bit transitions in the
RX stream. But the PHY consumer may do stuff with the PHY simultaneously,
and that isn't okay. Block concurrent generic PHY calls by holding the
PHY mutex from this workqueue.

Fixes: 8f73b37cf3 ("phy: add support for the Layerscape SerDes 28G")
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2023-10-06 10:59:52 +01:00
Ioana Ciornei
f200bab375 phy: lynx-28g: cancel the CDR check work item on the remove path
The blamed commit added the CDR check work item but didn't cancel it on
the remove path. Fix this by adding a remove function which takes care
of it.

Fixes: 8f73b37cf3 ("phy: add support for the Layerscape SerDes 28G")
Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2023-10-06 10:59:52 +01:00
Geert Uytterhoeven
089667aaaa phy: realtek: Realtek PHYs should depend on ARCH_REALTEK
The Realtek SoC USB2 and USB3 PHY Transceivers are only present on
Realtek Digital Home Center (DHC) RTD series SoCs.  Hence add a
dependency on ARCH_REALTEK, to prevent asking the user about these
drivers when configuring a kernel without Realtek SoC support.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/r/2892527cac9af6fa8f5e7b8daeffd7d4351fde68.1692113167.git.geert+renesas@glider.be
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2023-09-29 21:47:37 +05:30
Bo Liu
11395c32f9 phy: qualcomm: Fix typos in comments
Fix typo in the description of the 'succesfully'.

Signed-off-by: Bo Liu <liubo03@inspur.com>
Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org>
Link: https://lore.kernel.org/r/20230912114646.8452-1-liubo03@inspur.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2023-09-21 16:24:00 +02:00
Konrad Dybcio
76d20290d0 phy: qcom-qmp-combo: initialize PCS_USB registers
Currently, PCS_USB registers that have their initialization data in a
pcs_usb_tbl table are never initialized. Fix that.

Fixes: fc64623637 ("phy: qcom-qmp-combo,usb: add support for separate PCS_USB region")
Reported-by: Adrien Thierry <athierry@redhat.com>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org>
Link: https://lore.kernel.org/r/20230829-topic-8550_usbphy-v3-2-34ec434194c5@linaro.org
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2023-09-21 16:23:13 +02:00
Konrad Dybcio
112c23705c phy: qcom-qmp-combo: Square out 8550 POWER_STATE_CONFIG1
There are two instances of the POWER_STATE_CONFIG1 register: one in
the PCS space and another one in PCS_USB.

The downstream init sequence pokes the latter one while we've been poking
the former one (and misnamed it as the latter one, impostor!). Fix that
up to avoid UB.

Fixes: 49742e9eda ("phy: qcom-qmp-combo: Add support for SM8550")
Reviewed-by: Abel Vesa <abel.vesa@linaro.org>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org>
Link: https://lore.kernel.org/r/20230829-topic-8550_usbphy-v3-1-34ec434194c5@linaro.org
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2023-09-21 16:23:13 +02:00
Varadarajan Narayanan
ecec1de5c5 phy: qcom: m31: Remove unwanted qphy->vreg is NULL check
Fix the following Smatch complaint:
	drivers/phy/qualcomm/phy-qcom-m31.c:175 m31usb_phy_init()
	warn: variable dereferenced before check 'qphy->vreg' (see line 167)

drivers/phy/qualcomm/phy-qcom-m31.c
   166
   167		ret = regulator_enable(qphy->vreg);
                                       ^^^^^^^^^^
Unchecked dereference

   168		if (ret) {
   169			dev_err(&phy->dev, "failed to enable regulator, %d\n", ret);
   170			return ret;
   171		}
   172
   173		ret = clk_prepare_enable(qphy->clk);
   174		if (ret) {
   175			if (qphy->vreg)
                            ^^^^^^^^^^
Checked too late

   176				regulator_disable(qphy->vreg);
   177			dev_err(&phy->dev, "failed to enable cfg ahb clock, %d\n", ret);

Since the phy will not get registered if qphy->vreg is NULL,
this check is not needed.

Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Closes: https://lore.kernel.org/linux-phy/cbd26132-c624-44b7-a073-73222b287338@moroto.mountain/T/#u
Fixes: 08e49af507 ("phy: qcom: Introduce M31 USB PHY driver")
Signed-off-by: Varadarajan Narayanan <quic_varada@quicinc.com>
Link: https://lore.kernel.org/r/1694069452-3794-1-git-send-email-quic_varada@quicinc.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2023-09-21 16:18:22 +02:00
Jinjie Ruan
6ee8a9a772 phy: realtek: usb: Drop unnecessary error check for debugfs_create_dir()
Both debugfs_create_dir() and debugfs_create_file() return ERR_PTR
and never return NULL.

As Greg suggested, this patch removes the error checking for
debugfs_create_dir in phy-rtk-usb2.c and phy-rtk-usb3.c. This is because
the DebugFS kernel API is developed in a way that the caller can safely
ignore the errors that occur during the creation of DebugFS nodes. The
debugfs APIs have a IS_ERR() judge in start_creating() which can handle it
gracefully. So these checks are unnecessary.

Fixes: 134e6d25f6 ("phy: realtek: usb: Add driver for the Realtek SoC USB 2.0 PHY")
Fixes: adda6e82a7 ("phy: realtek: usb: Add driver for the Realtek SoC USB 3.0 PHY")
Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Link: https://lore.kernel.org/r/20230901075231.1368947-1-ruanjinjie@huawei.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2023-09-21 16:14:22 +02:00
Yang Yingliang
426e05ce12 phy: qcom: phy-qcom-m31: change m31_ipq5332_regs to static
m31_ipq5332_regs is only used in phy-qcom-m31.c now, change
it to static.

Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Reviewed-by: Varadarajan Narayanan <quic_varada@quicinc.com>
Link: https://lore.kernel.org/r/20230824092356.1154839-1-yangyingliang@huawei.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2023-09-21 16:05:30 +02:00
Yang Yingliang
5f7cd740a6 phy: qcom: phy-qcom-m31: fix wrong pointer pass to PTR_ERR()
It should be 'qphy->vreg' passed to PTR_ERR() when devm_regulator_get() fails.

Fixes: 08e49af507 ("phy: qcom: Introduce M31 USB PHY driver")
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Reviewed-by: Varadarajan Narayanan <quic_varada@quicinc.com>
Link: https://lore.kernel.org/r/20230824091345.1072650-1-yangyingliang@huawei.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2023-09-21 16:04:59 +02:00
Adrien Thierry
c599dc5cca phy: qcom-qmp-usb: split PCS_USB init table for sc8280xp and sa8775p
For sc8280xp and sa8775p, PCS and PCS_USB initialization data is
described in the same table, thus the pcs_usb offset is not being
applied during initialization of PCS_USB registers. Fix this by adding
the appropriate pcs_usb_tbl tables.

Fixes: 8bd2d6e11c ("phy: qcom-qmp: Add SA8775P USB3 UNI phy")
Fixes: c0c7769cda ("phy: qcom-qmp: Add SC8280XP USB3 UNI phy")
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Signed-off-by: Adrien Thierry <athierry@redhat.com>
Link: https://lore.kernel.org/r/20230828152353.16529-3-athierry@redhat.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2023-09-21 15:47:26 +02:00
Adrien Thierry
2d3465a75c phy: qcom-qmp-usb: initialize PCS_USB registers
Currently, PCS_USB registers that have their initialization data in a
pcs_usb_tbl table are never initialized. Fix that.

Fixes: fc64623637 ("phy: qcom-qmp-combo,usb: add support for separate PCS_USB region")
Signed-off-by: Adrien Thierry <athierry@redhat.com>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Link: https://lore.kernel.org/r/20230828152353.16529-2-athierry@redhat.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2023-09-21 15:47:26 +02:00
Tony Lindgren
3b384cc74b phy: mapphone-mdm6600: Fix pinctrl_pm handling for sleep pins
Looks like the driver sleep pins configuration is unusable. Adding the
sleep pins causes the usb phy to not respond. We need to use the default
pins in probe, and only set sleep pins at phy_mdm6600_device_power_off().

As the modem can also be booted to a serial port mode for firmware
flashing, let's make the pin changes limited to probe and remove. For
probe, we get the default pins automatically. We only need to set the
sleep pins in phy_mdm6600_device_power_off() to prevent the modem from
waking up because the gpio line glitches.

If it turns out that we need a separate state for phy_mdm6600_power_on()
and phy_mdm6600_power_off(), we can use the pinctrl idle state.

Cc: Ivaylo Dimitrov <ivo.g.dimitrov.75@gmail.com>
Cc: Merlijn Wajer <merlijn@wizzup.org>
Cc: Pavel Machek <pavel@ucw.cz>
Cc: Sebastian Reichel <sre@kernel.org>
Fixes: 2ad2af0816 ("phy: mapphone-mdm6600: Improve phy related runtime PM calls")
Signed-off-by: Tony Lindgren <tony@atomide.com>
Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Link: https://lore.kernel.org/r/20230913060433.48373-3-tony@atomide.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2023-09-14 17:05:27 +05:30
Tony Lindgren
b99e0ba963 phy: mapphone-mdm6600: Fix runtime PM for remove
Otherwise we will get an underflow on remove.

Cc: Ivaylo Dimitrov <ivo.g.dimitrov.75@gmail.com>
Cc: Merlijn Wajer <merlijn@wizzup.org>
Cc: Pavel Machek <pavel@ucw.cz>
Cc: Sebastian Reichel <sre@kernel.org>
Fixes: f7f50b2a7b ("phy: mapphone-mdm6600: Add runtime PM support for n_gsm on USB suspend")
Signed-off-by: Tony Lindgren <tony@atomide.com>
Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Link: https://lore.kernel.org/r/20230913060433.48373-2-tony@atomide.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2023-09-14 17:05:27 +05:30
Tony Lindgren
719606154c phy: mapphone-mdm6600: Fix runtime disable on probe
Commit d644e0d798 ("phy: mapphone-mdm6600: Fix PM error handling in
phy_mdm6600_probe") caused a regression where we now unconditionally
disable runtime PM at the end of the probe while it is only needed on
errors.

Cc: Ivaylo Dimitrov <ivo.g.dimitrov.75@gmail.com>
Cc: Merlijn Wajer <merlijn@wizzup.org>
Cc: Miaoqian Lin <linmq006@gmail.com>
Cc: Pavel Machek <pavel@ucw.cz>
Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Fixes: d644e0d798 ("phy: mapphone-mdm6600: Fix PM error handling in phy_mdm6600_probe")
Signed-off-by: Tony Lindgren <tony@atomide.com>
Link: https://lore.kernel.org/r/20230913060433.48373-1-tony@atomide.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2023-09-14 17:05:27 +05:30
Linus Torvalds
db906f0ca6 phy-for-6.6
- New Support
   - Starfive dphy rx, JH7110 usb and pcie support
   - Rockchip rv1126 inno-dsi phy, rk3588 usb and pcie support
   - Qualcomm sa8775p PCIe support, M31 USB PHY driver
   - Samsung Exynos850 usb support
 
 - Updates
   - Mediatek dsi driver clock  updates
   - Qualcomm sm8150 combo phy with reworking of qmp pcie driver
   - Xilinx zynqmp runtime PM support
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEE+vs47OPLdNbVcHzyfBQHDyUjg0cFAmT0wcIACgkQfBQHDyUj
 g0c8VxAAymIO5fySiW3VF+7yZ+RBClMJPtq+Q1vWgCbz7L7MUN9cRIzBkV59ix5C
 bRJy6a+2IJZZ7mEP535asaEMxt08ypWft1z46eu2mueWhJbWg4GQKzO1hokkzvO3
 QvLb5oZd5YhWepyeDrQX5KjlUJoAMjdj00PB+XG5oRdMr5tjBzAUBrQMBSyUNBTs
 2Yg/HRFREP8cCx7baQ/PCT93bejmHiImIGxesl/1zznYRjzCW8h63eCILvnX4I29
 t6jsn33FfFUEggMGFcNPjTWuhDdNcrfqkRq7FhAOKPWIBOThAzjMNDYpoQOEV2K0
 FDidINQQ2oHL8yPTa8oW7wkaH6ntSM8c7Qac/xlKzuzww2mix74w6n/661gQIebW
 Z6RHjcaDPBGK9mgHqbdcdFGuDmEgsX/AenLxpBgkOeWO+vNGnOUEJELrFr4p0iIt
 UpKloDfP/gS06ay56Cbk4A+RJ2eIBl9t74TC/oGk2+fueuZdnCSZIzxkA/6L78AQ
 dwPx0QwORQU5K1zou6l3eb8mD05I5FK8uSaiIoTMvTg7IyvVAtla5+vBoEjZEqw2
 o50qry4+VUE7KqH8fPPvL0SQ6yaPQ55QHP6k8nkyhGS1YtbJUqhaT/UZEJiyQiHj
 0evPeunWeOG2lC8E59XXyipE6wsQuG2zdFN0JEIJqAuLqzXm/XA=
 =3Wtl
 -----END PGP SIGNATURE-----

Merge tag 'phy-for-6.6' of git://git.kernel.org/pub/scm/linux/kernel/git/phy/linux-phy

Pull phy updates from Vinod Koul:
 "As usual a couple of new drivers, a bunch of new device support and
  few updates to existing drivers

  New Support:
   - Starfive dphy rx, JH7110 usb and pcie support
   - Rockchip rv1126 inno-dsi phy, rk3588 usb and pcie support
   - Qualcomm sa8775p PCIe support, M31 USB PHY driver
   - Samsung Exynos850 usb support

  Updates:
   - Mediatek dsi driver clock updates
   - Qualcomm sm8150 combo phy with reworking of qmp pcie driver
   - Xilinx zynqmp runtime PM support"

* tag 'phy-for-6.6' of git://git.kernel.org/pub/scm/linux/kernel/git/phy/linux-phy: (83 commits)
  phy: exynos5-usbdrd: Add Exynos850 support
  phy: exynos5-usbdrd: Add 26MHz ref clk support
  phy: exynos5-usbdrd: Make it possible to pass custom phy ops
  dt-bindings: phy: samsung,usb3-drd-phy: Add Exynos850 support
  phy: qcom-qmp-combo: fix clock probing
  phy: qcom-qmp-pcie: support SM8150 PCIe QMP PHYs
  phy: qcom-qmp-pcie: populate offsets configuration
  phy: qcom-qmp-pcie: simplify clock handling
  phy: qcom-qmp-pcie: keep offset tables sorted
  phy: qcom-qmp-pcie: drop ln_shrd from v5_20 config
  dt-bindings: phy: qcom,qmp-pcie: describe SM8150 PCIe PHYs
  dt-bindings: phy: migrate QMP PCIe PHY bindings to qcom,sc8280xp-qmp-pcie-phy.yaml
  phy: fsl-imx8mq-usb: add dev_err_probe if getting vbus failed
  phy: qcom: Introduce M31 USB PHY driver
  dt-bindings: phy: qcom,m31: Document qcom,m31 USB phy
  phy: rockchip: inno-dsidphy: Add rv1126 support
  dt-bindings: phy: rockchip-inno-dsidphy: Document rv1126
  dt-bindings: phy: mediatek,tphy: allow simple nodename pattern
  phy: amlogic: meson-g12a-usb2: fix Wvoid-pointer-to-enum-cast warning
  phy: marvell pxa-usb: fix Wvoid-pointer-to-enum-cast warning
  ...
2023-09-03 10:38:02 -07:00
Linus Torvalds
51e7accbe8 USB / Thunderbolt / PHY driver update for 6.6-rc1
Here is the big set of USB, Thunderbolt, and PHY driver updates for
 6.6-rc1.  Included in here are:
   - PHY driver additions and cleanups
   - Thunderbolt minor additions and fixes
   - USB MIDI 2 gadget support added
   - dwc3 driver updates and additions
   - Removal of some old USB wireless code that was missed when that
     codebase was originally removed a few years ago, cleaning up some
     core USB code paths
   - USB core potential use-after-free fixes that syzbot from different
     people/groups keeps tripping over
   - typec updates and additions
   - gadget fixes and cleanups
   - loads of smaller USB core and driver cleanups all over the place
 
 Full details are in the shortlog.  All of these have been in linux-next
 for a while with no reported problems.
 
 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 -----BEGIN PGP SIGNATURE-----
 
 iG0EABECAC0WIQT0tgzFv3jCIUoxPcsxR9QN2y37KQUCZPIAOQ8cZ3JlZ0Brcm9h
 aC5jb20ACgkQMUfUDdst+yn80gCgybzMp0YnSildFetSC8lUJTnzjQcAn3KWzb75
 Zt72jxGl4ZOXHEpozG4O
 =FLrK
 -----END PGP SIGNATURE-----

Merge tag 'usb-6.6-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb

Pull USB / Thunderbolt / PHY driver updates from Greg KH:
 "Here is the big set of USB, Thunderbolt, and PHY driver updates for
  6.6-rc1. Included in here are:

   - PHY driver additions and cleanups

   - Thunderbolt minor additions and fixes

   - USB MIDI 2 gadget support added

   - dwc3 driver updates and additions

   - Removal of some old USB wireless code that was missed when that
     codebase was originally removed a few years ago, cleaning up some
     core USB code paths

   - USB core potential use-after-free fixes that syzbot from different
     people/groups keeps tripping over

   - typec updates and additions

   - gadget fixes and cleanups

   - loads of smaller USB core and driver cleanups all over the place

  Full details are in the shortlog. All of these have been in linux-next
  for a while with no reported problems"

* tag 'usb-6.6-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: (154 commits)
  platform/chrome: cros_ec_typec: Configure Retimer cable type
  tcpm: Avoid soft reset when partner does not support get_status
  usb: typec: tcpm: reset counter when enter into unattached state after try role
  usb: typec: tcpm: set initial svdm version based on pd revision
  USB: serial: option: add FOXCONN T99W368/T99W373 product
  USB: serial: option: add Quectel EM05G variant (0x030e)
  usb: dwc2: add pci_device_id driver_data parse support
  usb: gadget: remove max support speed info in bind operation
  usb: gadget: composite: cleanup function config_ep_by_speed_and_alt()
  usb: gadget: config: remove max speed check in usb_assign_descriptors()
  usb: gadget: unconditionally allocate hs/ss descriptor in bind operation
  usb: gadget: f_uvc: change endpoint allocation in uvc_function_bind()
  usb: gadget: add a inline function gether_bitrate()
  usb: gadget: use working speed to calcaulate network bitrate and qlen
  dt-bindings: usb: samsung,exynos-dwc3: Add Exynos850 support
  usb: dwc3: exynos: Add support for Exynos850 variant
  usb: gadget: udc-xilinx: fix incorrect type in assignment warning
  usb: gadget: udc-xilinx: fix cast from restricted __le16 warning
  usb: gadget: udc-xilinx: fix restricted __le16 degrades to integer warning
  USB: dwc2: hande irq on dead controller correctly
  ...
2023-09-01 09:23:34 -07:00
Linus Torvalds
f8fd5c2483 This pull request is full of clk driver changes. In fact, there aren't any
changes to the clk framework this time around. That's probably because everyone
 was on vacation (yours truly included). We did lose a couple clk drivers this
 time around because nobody was using those devices. That skews the diffstat a
 bit, but either way, nothing looks out of the ordinary here. The usual suspects
 are chugging along adding support for more SoCs and fixing bugs.
 
 If I had to choose, I'd say the theme for the past few months has been
 "polish". There's quite a few patches that migrate to
 devm_platform_ioremap_resource() in here. And there's more than a handful of
 patches that move the NR_CLKS define from the DT binding header to the driver.
 There's even patches that migrate drivers to use clk_parent_data and clk_hw to
 describe clk tree topology. It seems that the spring (summer?) cleaning bug got
 some folks, or the semiconductor shortage finally hit the software side.
 
 New Drivers:
  - StarFive JH7110 SoC clock drivers
  - Qualcomm IPQ5018 Global Clock Controller driver
  - Versa3 clk generator to support 48KHz playback/record with audio codec on
    RZ/G2L SMARC EVK
 
 Removed Drivers:
  - Remove non-OF mmp clk drivers
  - Remove OXNAS clk driver
 
 Updates:
  - Add __counted_by to struct clk_hw_onecell_data and struct spmi_pmic_div_clk_cc
  - Move defines for numbers of clks (NR_CLKS) from DT headers to drivers
  - Introduce kstrdup_and_replace() and use it
  - Add PLL rates for Rockchip rk3568
  - Add the display clock tree for Rockchip rv1126
  - Add Audio Clock Generator (ADG) clocks on Renesas R-Car Gen3 and RZ/G2 SoCs
  - Convert sun9i-mmc clock to use devm_platform_get_and_ioremap_resource()
  - Fix function name in a comment in ccu_mmc_timing.c
  - Parameter name correction for ccu_nkm_round_rate()
  - Implement CLK_SET_RATE_PARENT for Allwinner NKM clocks, i.e. consider alternative
    parent rates when determining clock rates
  - Set CLK_SET_RATE_PARENT for Allwinner A64 pll-mipi
  - Support finding closest (as opposed to closest but not higher) clock rate
    for NM, NKM, mux and div type clocks, as use it for Allwinner A64 pll-video0
  - Prefer current parent rate if able to generate ideal clock rate for Allwinner NKM clocks
  - Clean up Qualcomm SMD RPM driver, with interconnect bus clocks moved out to
    the interconnect drivers
  - Fix various PM runtime bugs across many Qualcomm clk drivers
  - Migrate Qualcomm MDM9615 is to parent_hw and parent_data
  - Add network related resets on Qualcomm IPQ4019
  - Add a couple missing USB related clocks to Qualcomm IPQ9574
  - Add missing gpll0_sleep_clk_src to Qualcomm MSM8917 global clock controller
  - In the Qualcomm QDU1000 global clock controller, GDSCs, clkrefs, and GPLL1 are
    added, while PCIe pipe clock, SDCC rcg ops are corrected
  - Add missing GDSCs to and correct GDSCs for the SC8280XP global clock controller driver
  - Support retention for the Qualcomm SC8280XP display clock controller GDSCs.
  - Qualcommm's SDCC apps_clk_src is marked with CLK_OPS_PARENT_ENABLE to fix
    issues with missing parent clocks across sc7180, sm7150, sm6350 and sm8250,
    while sm8450 is corrected to use floor ops
  - Correct Qualcomm SM6350 GPU clock controller's clock supplies
  - Drop unwanted clocks from the Qualcomm IPQ5332 GCC driver
  - Add missing OXILICX GDSC to Qualcomm MSM8226 GCC
  - Change the delay in the Qualcomm reset controller to fsleep() for correctness
  - Extend the Qualcomm SM83550 Video clock controller to support SC8280XP
  - Add graphics clock support on Renesas RZ/G2M, RZ/G2N, RZ/G2E, and R-Car H3,
    M3-W, and M3-N SoCs
  - Add Clocked Serial Interface (CSI) clocks on Renesas RZ/V2M
  - Add PWM (MTU3) clock and reset on Renesas RZ/G2UL and RZ/Five
  - Add the PDM IPC clock for i.MX93
  - Add 519.75MHz frequency support for i.MX9 PLL
  - Simplify the .determine_rate() implementation for i.MX GPR mux
  - Make the i.MX8QXP LPCG clock use devm_platform_ioremap_resource()
  - Add the audio mux clock to i.MX8
  - Fix the SPLL2 MULT range for PLLv4
  - Update the SPLL2 type in i.MX8ULP
  - Fix the SAI4 clock on i.MX8MP
  - Add silicon revision print for i.MX25 on clocks init
  - Drop the return value from __mx25_clocks_init()
  - Fix the clock pauses on no-op set_rate for i.MX8M composite clock
  - Drop restrictions for i.MX PLL14xx and fix its max prediv value
  - Drop the 393216000 and 361267200 from i.MX PLL14xx rate table to allow
    glitch free switching
 -----BEGIN PGP SIGNATURE-----
 
 iQJFBAABCAAvFiEE9L57QeeUxqYDyoaDrQKIl8bklSUFAmTv2wkRHHNib3lkQGtl
 cm5lbC5vcmcACgkQrQKIl8bklSW1LRAAuHR2HoyB4bRHmCa1bfOfYYDfSWsBWEav
 tWIfBl86Nl/Je50Gk2NJ9vqU5OPqRZ57TIniijHHoX5n7/kYcr8KVmlomY07hUeg
 CzWyothkxg4k7+rQwVAWvmlR2YAVwzHDKcwq7gkMZOnW/y26LXip99cjopu2CJLx
 zVwTgvWollmd4KVlicnAlx4zUjgNkWR24iA4Lcf5ir+Dr6FYNjxLI+akBA8EPxxi
 wLixZbScgBSgpGn6KVgoFhclCToPS0gt5m6HfQxJ/svOCU54l+jRKpzkNZGWvyu4
 A8t3CRrwL2iS/mfCGk2yRlaKySoLLpjlpW1AI7fHTWbG2P6p8ZphtN7jOeeAEsbq
 TNpzWEjtY6B/lfRzxxINXkrtLaqmlnFY/P5np5fDrf/61gRFxLFQemyRdY/xCSJf
 Kwq8ja1mrSGWoDGG9XhDqTf9Yek9LRObNzlDrEmn/i/qLTcxhOIz58pzHg4iAlx5
 9HDtnJ8hKg4uE1TtT12Bmasb1+WzG7GYYESNfKWZhCvbRqEUzcDOHk7xpwYa1ffx
 yZIgMs7Sb/exNW8LMPYmgnyj/f9eo5IdjiQvune+Zy5NrdzfyN6Sf/LSibrqCF2z
 X5aFHqQrR8+PifD+se+g5HPa0ezSmBIhXzYUTOC6f+nywlrJjhwDXPDYI6Lcd//p
 r4mpOmJS+G4=
 =h2Jz
 -----END PGP SIGNATURE-----

Merge tag 'clk-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/clk/linux

Pull clk subsystem updates from Stephen Boyd:
 "This pull request is full of clk driver changes. In fact, there aren't
  any changes to the clk framework this time around. That's probably
  because everyone was on vacation (yours truly included). We did lose a
  couple clk drivers this time around because nobody was using those
  devices. That skews the diffstat a bit, but either way, nothing looks
  out of the ordinary here. The usual suspects are chugging along adding
  support for more SoCs and fixing bugs.

  If I had to choose, I'd say the theme for the past few months has been
  "polish". There's quite a few patches that migrate to
  devm_platform_ioremap_resource() in here. And there's more than a
  handful of patches that move the NR_CLKS define from the DT binding
  header to the driver. There's even patches that migrate drivers to use
  clk_parent_data and clk_hw to describe clk tree topology. It seems
  that the spring (summer?) cleaning bug got some folks, or the
  semiconductor shortage finally hit the software side.

  New Drivers:
   - StarFive JH7110 SoC clock drivers
   - Qualcomm IPQ5018 Global Clock Controller driver
   - Versa3 clk generator to support 48KHz playback/record with audio
     codec on RZ/G2L SMARC EVK

  Removed Drivers:
   - Remove non-OF mmp clk drivers
   - Remove OXNAS clk driver

  Updates:
   - Add __counted_by to struct clk_hw_onecell_data and struct
     spmi_pmic_div_clk_cc
   - Move defines for numbers of clks (NR_CLKS) from DT headers to
     drivers
   - Introduce kstrdup_and_replace() and use it
   - Add PLL rates for Rockchip rk3568
   - Add the display clock tree for Rockchip rv1126
   - Add Audio Clock Generator (ADG) clocks on Renesas R-Car Gen3 and
     RZ/G2 SoCs
   - Convert sun9i-mmc clock to use
     devm_platform_get_and_ioremap_resource()
   - Fix function name in a comment in ccu_mmc_timing.c
   - Parameter name correction for ccu_nkm_round_rate()
   - Implement CLK_SET_RATE_PARENT for Allwinner NKM clocks, i.e.
     consider alternative parent rates when determining clock rates
   - Set CLK_SET_RATE_PARENT for Allwinner A64 pll-mipi
   - Support finding closest (as opposed to closest but not higher)
     clock rate for NM, NKM, mux and div type clocks, as use it for
     Allwinner A64 pll-video0
   - Prefer current parent rate if able to generate ideal clock rate for
     Allwinner NKM clocks
   - Clean up Qualcomm SMD RPM driver, with interconnect bus clocks
     moved out to the interconnect drivers
   - Fix various PM runtime bugs across many Qualcomm clk drivers
   - Migrate Qualcomm MDM9615 is to parent_hw and parent_data
   - Add network related resets on Qualcomm IPQ4019
   - Add a couple missing USB related clocks to Qualcomm IPQ9574
   - Add missing gpll0_sleep_clk_src to Qualcomm MSM8917 global clock
     controller
   - In the Qualcomm QDU1000 global clock controller, GDSCs, clkrefs,
     and GPLL1 are added, while PCIe pipe clock, SDCC rcg ops are
     corrected
   - Add missing GDSCs to and correct GDSCs for the SC8280XP global
     clock controller driver
   - Support retention for the Qualcomm SC8280XP display clock
     controller GDSCs.
   - Qualcommm's SDCC apps_clk_src is marked with CLK_OPS_PARENT_ENABLE
     to fix issues with missing parent clocks across sc7180, sm7150,
     sm6350 and sm8250, while sm8450 is corrected to use floor ops
   - Correct Qualcomm SM6350 GPU clock controller's clock supplies
   - Drop unwanted clocks from the Qualcomm IPQ5332 GCC driver
   - Add missing OXILICX GDSC to Qualcomm MSM8226 GCC
   - Change the delay in the Qualcomm reset controller to fsleep() for
     correctness
   - Extend the Qualcomm SM83550 Video clock controller to support
     SC8280XP
   - Add graphics clock support on Renesas RZ/G2M, RZ/G2N, RZ/G2E, and
     R-Car H3, M3-W, and M3-N SoCs
   - Add Clocked Serial Interface (CSI) clocks on Renesas RZ/V2M
   - Add PWM (MTU3) clock and reset on Renesas RZ/G2UL and RZ/Five
   - Add the PDM IPC clock for i.MX93
   - Add 519.75MHz frequency support for i.MX9 PLL
   - Simplify the .determine_rate() implementation for i.MX GPR mux
   - Make the i.MX8QXP LPCG clock use devm_platform_ioremap_resource()
   - Add the audio mux clock to i.MX8
   - Fix the SPLL2 MULT range for PLLv4
   - Update the SPLL2 type in i.MX8ULP
   - Fix the SAI4 clock on i.MX8MP
   - Add silicon revision print for i.MX25 on clocks init
   - Drop the return value from __mx25_clocks_init()
   - Fix the clock pauses on no-op set_rate for i.MX8M composite clock
   - Drop restrictions for i.MX PLL14xx and fix its max prediv value
   - Drop the 393216000 and 361267200 from i.MX PLL14xx rate table to
     allow glitch free switching"

* tag 'clk-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/clk/linux: (207 commits)
  clk: qcom: Fix SM_GPUCC_8450 dependencies
  clk: lmk04832: Support using PLL1_LD as SPI readback pin
  clk: lmk04832: Don't disable vco clock on probe fail
  clk: lmk04832: Set missing parent_names for output clocks
  clk: mvebu: Convert to devm_platform_ioremap_resource()
  clk: nuvoton: Convert to devm_platform_ioremap_resource()
  clk: socfpga: agilex: Convert to devm_platform_ioremap_resource()
  clk: ti: Use devm_platform_get_and_ioremap_resource()
  clk: mediatek: Convert to devm_platform_ioremap_resource()
  clk: hsdk-pll: Convert to devm_platform_ioremap_resource()
  clk: gemini: Convert to devm_platform_ioremap_resource()
  clk: fsl-sai: Convert to devm_platform_ioremap_resource()
  clk: bm1880: Convert to devm_platform_ioremap_resource()
  clk: axm5516: Convert to devm_platform_ioremap_resource()
  clk: actions: Convert to devm_platform_ioremap_resource()
  clk: cdce925: Remove redundant of_match_ptr()
  clk: pxa910: Move number of clocks to driver source
  clk: pxa1928: Move number of clocks to driver source
  clk: pxa168: Move number of clocks to driver source
  clk: mmp2: Move number of clocks to driver source
  ...
2023-08-30 19:53:39 -07:00
Kees Cook
f316cdff8d clk: Annotate struct clk_hw_onecell_data with __counted_by
Prepare for the coming implementation by GCC and Clang of the __counted_by
attribute. Flexible array members annotated with __counted_by can have
their accesses bounds-checked at run-time checking via CONFIG_UBSAN_BOUNDS
(for array indexing) and CONFIG_FORTIFY_SOURCE (for strcpy/memcpy-family
functions).

As found with Coccinelle[1], add __counted_by for struct clk_hw_onecell_data.
Additionally, since the element count member must be set before accessing
the annotated flexible array member, move its initialization earlier.

[1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci

Cc: Michael Turquette <mturquette@baylibre.com>
Cc: Stephen Boyd <sboyd@kernel.org>
Cc: Joel Stanley <joel@jms.id.au>
Cc: Andrew Jeffery <andrew@aj.id.au>
Cc: Taichi Sugaya <sugaya.taichi@socionext.com>
Cc: Takao Orito <orito.takao@socionext.com>
Cc: Qin Jian <qinjian@cqplus1.com>
Cc: Andrew Lunn <andrew@lunn.ch>
Cc: Gregory Clement <gregory.clement@bootlin.com>
Cc: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Cc: Andy Gross <agross@kernel.org>
Cc: Bjorn Andersson <andersson@kernel.org>
Cc: Konrad Dybcio <konrad.dybcio@linaro.org>
Cc: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Cc: Matthias Brugger <matthias.bgg@gmail.com>
Cc: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Cc: Maxime Ripard <mripard@kernel.org>
Cc: Chen-Yu Tsai <wens@csie.org>
Cc: Jernej Skrabec <jernej.skrabec@gmail.com>
Cc: David Airlie <airlied@gmail.com>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: Samuel Holland <samuel@sholland.org>
Cc: Vinod Koul <vkoul@kernel.org>
Cc: Kishon Vijay Abraham I <kishon@kernel.org>
Cc: linux-clk@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-aspeed@lists.ozlabs.org
Cc: linux-arm-msm@vger.kernel.org
Cc: linux-mediatek@lists.infradead.org
Cc: dri-devel@lists.freedesktop.org
Cc: linux-sunxi@lists.linux.dev
Cc: linux-phy@lists.infradead.org
Signed-off-by: Kees Cook <keescook@chromium.org>
Link: https://lore.kernel.org/r/20230817203019.never.795-kees@kernel.org
Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
2023-08-22 13:51:26 -07:00
Sam Protsenko
691525074d phy: exynos5-usbdrd: Add Exynos850 support
Implement Exynos850 USB 2.0 DRD PHY controller support. Exynos850 has
quite a different PHY controller than Exynos5 compatible controllers,
but it's still possible to implement it on top of existing
exynos5-usbdrd driver infrastructure.

Only UTMI+ (USB 2.0) PHY interface is implemented, as Exynos850 doesn't
support USB 3.0.

Only two clocks are used for this controller:
  - phy: bus clock, used for PHY registers access
  - ref: PHY reference clock (OSCCLK)

Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20230819031731.22618-7-semen.protsenko@linaro.org
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2023-08-22 19:41:15 +05:30
Sam Protsenko
255ec3879d phy: exynos5-usbdrd: Add 26MHz ref clk support
Modern Exynos chips (like Exynos850) might have 26 MHz OSCCLK external
clock, which is also used as a PHY reference clock. For some USB PHY
controllers (e.g USB DRD PHY block on Exynos850) there is no need to set
the refclk frequency at all (and corresponding bits in CLKRSTCTRL[7:5]
are marked RESERVED), so that value won't be set in the driver. But
even in that case, 26 MHz support still has to be added, otherwise
exynos5_rate_to_clk() fails, which leads in turn to probe error.

Add the correct value for 26MHz refclk to make it possible to add
support for new Exynos USB DRD PHY controllers.

Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20230819031731.22618-6-semen.protsenko@linaro.org
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2023-08-22 19:41:15 +05:30
Sam Protsenko
6b34ec66e7 phy: exynos5-usbdrd: Make it possible to pass custom phy ops
Provide a way to use different PHY ops for different chips. Right now
all chips are using exynos5_usbdrd_phy_ops, but it won't always be the
case. For example, Exynos850 has very different USB PHY block, so there
will be another PHY ops implementation for that chip.

No functional change.

Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20230819031731.22618-5-semen.protsenko@linaro.org
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2023-08-22 19:41:15 +05:30
Dmitry Baryshkov
b83eb8ba2a phy: qcom-qmp-combo: fix clock probing
During rebase of qcom-qmp-combo series a call to devm_clk_bulk_get_all()
got moved by git from qmp_combo_parse_dt_legacy() to
phy_dp_clks_register(). This doesn't have any serious effect, since the
clocks will be set in both legacy and non-legacy paths. However let's
move it back to place anyway, to prevent the driver from fetching clocks
twice.

Fixes: 28e265bf84 ("phy: qcom-qmp-combo: simplify clock handling")
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Link: https://lore.kernel.org/r/20230820235813.562284-1-dmitry.baryshkov@linaro.org
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2023-08-22 19:35:13 +05:30
Dmitry Baryshkov
4807ff70e2 phy: qcom-qmp-pcie: support SM8150 PCIe QMP PHYs
Reuse sm8250 configuration to add support for both single lane and dual
lane PCIe PHYs on the Qualcomm SM8150 platform.

Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Link: https://lore.kernel.org/r/20230820142035.89903-8-dmitry.baryshkov@linaro.org
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2023-08-22 19:33:37 +05:30
Dmitry Baryshkov
bf46fa1daf phy: qcom-qmp-pcie: populate offsets configuration
Populate offsets configuration for the rest of UFS PHYs to make it
possible to switch them to the new (single-node) bindings style.

Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Link: https://lore.kernel.org/r/20230820142035.89903-7-dmitry.baryshkov@linaro.org
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2023-08-22 19:33:37 +05:30
Dmitry Baryshkov
067832dc03 phy: qcom-qmp-pcie: simplify clock handling
For some of existing PHYs for new binding we are going to change refgen
to more correct "rchng". Rather than introducing additional code
to handle legacy vs current bindings (and clock names), use
devm_clk_bulk_get_optional().

Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org>
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Link: https://lore.kernel.org/r/20230820142035.89903-6-dmitry.baryshkov@linaro.org
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2023-08-22 19:33:37 +05:30
Dmitry Baryshkov
86f703762a phy: qcom-qmp-pcie: keep offset tables sorted
In order to simplify adding new PHY configurations, keep register
offset structs sorted by the version.

Fixes: a05b6d5135 ("phy: qcom-qmp-pcie: add support for sa8775p")
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Link: https://lore.kernel.org/r/20230820142035.89903-5-dmitry.baryshkov@linaro.org
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2023-08-22 19:33:37 +05:30
Dmitry Baryshkov
cfe0d20381 phy: qcom-qmp-pcie: drop ln_shrd from v5_20 config
There is no shared lane config for v5.20 PHYs, it is only present on
SM8550 gen4x2.

Fixes: a05b6d5135 ("phy: qcom-qmp-pcie: add support for sa8775p")
Cc: Mrinmay Sarkar <quic_msarkar@quicinc.com>
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Link: https://lore.kernel.org/r/20230820142035.89903-4-dmitry.baryshkov@linaro.org
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2023-08-22 19:33:37 +05:30
Alexander Stein
9f266c1c73 phy: fsl-imx8mq-usb: add dev_err_probe if getting vbus failed
This adds an error message if getting vbus failed for some reason,
-EPROBE_DEFER is handled appropriately as well and adds a nice
information to debugfs.

Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com>
Link: https://lore.kernel.org/r/20230816080256.611380-1-alexander.stein@ew.tq-group.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2023-08-22 19:28:11 +05:30