Commit graph

19 commits

Author SHA1 Message Date
Daniel Machon
7a503071e0 phy: sparx5-serdes: add skip_cmu_cfg check when configuring lanes
Add a check for skip_cmu_cfg when configuring the serdes lane.  All
individual serdeses are reset upon first configuration. Resetting the
serdes involves reconfiguring it with preset values. The serdesmode is
required to determine the clock-providing CMU, therefore make sure the
serdes is not reconfigured if the serdesmode is not set.

Signed-off-by: Daniel Machon <daniel.machon@microchip.com>
Link: https://lore.kernel.org/r/20230417180335.2787494-8-daniel.machon@microchip.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2023-05-08 17:13:01 +05:30
Daniel Machon
2db7289f59 phy: sparx5-serdes: remove power up of all CMUs
CMUs should not be powered up by default anymore, so remove responsible
code.

Signed-off-by: Daniel Machon <daniel.machon@microchip.com>
Link: https://lore.kernel.org/r/20230417180335.2787494-7-daniel.machon@microchip.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2023-05-08 17:13:01 +05:30
Daniel Machon
96bb166425 phy: sparx5-serdes: power on CMUs individually
Power on the CMU instance, that provides the clock for the serdes, given the
specified serdes mode and index. The CMU instance is looked up, using a
preset map of serdes mode and index to CMU index.

Signed-off-by: Daniel Machon <daniel.machon@microchip.com>
Link: https://lore.kernel.org/r/20230417180335.2787494-6-daniel.machon@microchip.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2023-05-08 17:13:01 +05:30
Daniel Machon
044f3a1a8d phy: sparx5-serdes: power down all CMUs by default
All CMUs are powered up initially. This uses needless power. This patch
makes sure all CMUs are powered down by default. This involves
configuring a number reference clock and power-down registers of the
CMU.

Individual CMUs are later powered up, when the serdes lanes are
configured.

Signed-off-by: Daniel Machon <daniel.machon@microchip.com>
Link: https://lore.kernel.org/r/20230417180335.2787494-5-daniel.machon@microchip.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2023-05-08 17:13:01 +05:30
Daniel Machon
238a583fe4 phy: sparx5-serdes: reorder CMU functions
Reorder CMU functions, as some of them are now required by the serdes
functions. No functional changes.

Signed-off-by: Daniel Machon <daniel.machon@microchip.com>
Link: https://lore.kernel.org/r/20230417180335.2787494-4-daniel.machon@microchip.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2023-05-08 17:13:01 +05:30
Daniel Machon
3d61a1f83e phy: sparx5-serdes: configure optimal quiet mode for serdes lanes
All the serdes lanes of the sparx5 will transition between normal mode
and quiet mode, depending on activity. Make sure that the quiet mode is
configured optimally for all lanes initially. Although not much, this
will save a small amount of power.

Signed-off-by: Daniel Machon <daniel.machon@microchip.com>
Link: https://lore.kernel.org/r/20230417180335.2787494-3-daniel.machon@microchip.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2023-05-08 17:13:01 +05:30
Daniel Machon
86c2cfb1ab phy: sparx5-serdes: add registers required for SD/CMU power down
Add registers required to configure serdeses and CMUs for initial power
down.

Signed-off-by: Daniel Machon <daniel.machon@microchip.com>
Link: https://lore.kernel.org/r/20230417180335.2787494-2-daniel.machon@microchip.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2023-05-08 17:13:00 +05:30
Linus Torvalds
33e591dee9 phy-for-6.1
- New support:
 	- Bjorn Andersson provided Qualcomm SC8280XP eDP & DP and USB3 UNI phy support
 	- Chris Morgan added Rockchip rk3568 inno dsidphy support
 	- Colin Foster converted ocelot-serdes phy binding to yaml
 	- Geert Uytterhoeven converted Renesas gen2-usb phy binding to yaml
 	- Horatiu Vultur added RGMII suport in lan966x driver
 	- Konrad Dybcio provided Qualcomm SM6375 usb snps-femto-v2 bindings
 	- Michael Riesch added support for rockchip rk356x csi-dphya
 	- Richard Acayan provided Qualcomm sdm670 usb2 bindings
 	- Vincent Shih provided new Sunplus USB2 PHY driver
 
   - Updates:
 	- Chunfeng Yun provided Mediatek hdmi, ufs, tphy and xsphy updates
 	  to use bitfield helpers.
 	- Dmitry Baryshkov & Johan Hovold continued with Qualcomm qmp phy
 	  driver split and cleanup. More patches are under review and
 	  expected that next cycle might see completion of this activity.
 	- Roger Quadros added support for TI wiz driver for j7200 10g
 	- Sandeep Maheswaram added support in Qualcomm femto phy driver to
 	  override params to help with tuning
 	- Siddharth Vadapalli added SGMII support in TI wiz driver
 	- Yuan Can did bunch of dev_err_probe simplification
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEE+vs47OPLdNbVcHzyfBQHDyUjg0cFAmNAI0YACgkQfBQHDyUj
 g0f1Og//T7iaDW6Psq8hOkQE756JwrIxjJRHuNxnVDOpdjN7XTrXYE46pFyjMrkx
 hVHd1QDQMLkLsGNPzt2QdJ7i3xwSJ/iPeskfqvWgEJdKUP+AtGTSkyOiyikadcy5
 rdaG0OrBhMiQNMvAnS3zmYL/tqZeOxvjisYsevlPDNQAINqF2AFl2ravbc3kLxnb
 5zAAWwv11oVYVONTqUfd4gW7KsU2de8wU6UY9jk1iJaWT1u9O8EmDEXbOHONhcTN
 tA52Yw1PJXsurbpgtJIgUec6IIqHM0iG2/VS5l4UJTtddzNYhihFFTtD6noSiDCM
 Wzijf/uFJDckDakzwYPf6XSw+Y9Md1JkNlQQ/I+DzL0TddJZvu10RNtmwZQVbhWN
 SvgGsPKsjMFf3av8N4/gjnYHcWdAOU7Rz0hd1k6KqkzbUrbWWUoExpW9yCFCjN7i
 rAQ+7wG4UwNkbaOz0ZOBtDzDUn2gE2mH366eZHZ25FhdRwzxMKW5O/uJF0oOcSf6
 o5ln1G7/5Ml0RT9OChj+vkiRP0/lOUrC40HyHaEmohPKGPkFcGUznEI6X3soqhlC
 xUNlY3FF1NeU5eHthnUXPOMySurK72VEVLTrVSCZzmFZPkN34UjdU/adKnzCO2+9
 un2EKfAtPlXEQKxqc13JtZ5AXmZZ3GIstdjXWWcgPthJ6h5FbIg=
 =N3+u
 -----END PGP SIGNATURE-----

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

Pull phy updates from Vinod Koul:
 "This contains bunch of new device support and one new Sunplus driver
  along with updates which include another big round of qmp phy
  conversion.

  New support:
   - Qualcomm SC8280XP eDP & DP and USB3 UNI phy (Bjorn Andersson)
   - Rockchip rk3568 inno dsidphy (Chris Morgan)
   - ocelot-serdes phy yaml binding (Colin Foster)
   - Renesas gen2-usb phy yaml binding (Geert Uytterhoeven)
   - RGMII suport in lan966x driver (Horatiu Vultur)
   - Qualcomm SM6375 usb snps-femto-v2 bindings (Konrad Dybcio)
   - Rockchip rk356x csi-dphya (Michael Riesch)
   - Qualcomm sdm670 usb2 bindings (Richard Acayan)
   - Sunplus USB2 PHY (Vincent Shih)

  Updates:
   - Mediatek hdmi, ufs, tphy and xsphy updates to use bitfield helpers
     (Chunfeng Yun)
   - Continued Qualcomm qmp phy driver split and cleanup. More patches
     are under review and expected that next cycle might see completion
     of this activity (Dmitry Baryshkov & Johan Hovold)
   - TI wiz driver support for j7200 10g (Roger Quadros)
   - Qualcomm femto phy driver support for override params to help with
     tuning (Sandeep Maheswaram)
   - SGMII support in TI wiz driver (Siddharth Vadapalli)
   - dev_err_probe simplification (Yuan Can)"

* tag 'phy-for-6.1' of git://git.kernel.org/pub/scm/linux/kernel/git/phy/linux-phy: (170 commits)
  phy: phy-mtk-dp: make array driving_params static const
  dt-bindings: phy: qcom,qusb2: document sdm670 compatible
  phy: qcom-qmp-pcie: fix resource mapping for SDM845 QHP PHY
  phy: rockchip-snps-pcie3: only look for rockchip,pipe-grf on rk3588
  phy: tegra: xusb: Enable usb role switch attribute
  phy: mediatek: fix build warning of FIELD_PREP()
  phy: qcom-qmp-usb: Use dev_err_probe() to simplify code
  phy: qcom-qmp-ufs: Use dev_err_probe() to simplify code
  phy: qcom-qmp-pcie-msm8996: Use dev_err_probe() to simplify code
  phy: qcom-qmp-combo: Use dev_err_probe() to simplify code
  phy: qualcomm: call clk_disable_unprepare in the error handling
  phy: intel: Use dev_err_probe() to simplify code
  phy: tegra: xusb: Use dev_err_probe() to simplify code
  phy: qcom-snps: Use dev_err_probe() to simplify code
  phy: qcom-qusb2: Use dev_err_probe() to simplify code
  phy: qcom-qmp-pcie: Use dev_err_probe() to simplify code
  phy: ti: phy-j721e-wiz: fix reference leaks in wiz_probe()
  phy: mediatek: mipi: remove register access helpers
  phy: mediatek: mipi: mt8183: use common helper to access registers
  phy: mediatek: mipi: mt8183: use GENMASK to generate bits mask
  ...
2022-10-07 16:03:01 -07:00
Horatiu Vultur
b013110733 phy: Add RGMII support on lan966x
The serdes driver contains also a mux to decide which interface type to
use. Currently the driver supports GMII/SGMII/QSGMII and partially RGMII.
As it doesn't support all the other RGMII interfaces like
RGMII_TXID/RXID/ID and it could run only at 1G.
Therefore extend this for all the other speeds(10/100) and also allow
the other interfaces.

Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>
Link: https://lore.kernel.org/r/20220901121455.245103-1-horatiu.vultur@microchip.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2022-09-13 19:14:53 +05:30
Maxime Chevallier
215da896df phy: lan966x: add support for QUSGMII
Makes so that the serdes driver also takes QUSGMII in consideration.
It's configured exactly as QSGMII as far as the serdes driver is
concerned.

Signed-off-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2022-08-31 12:54:48 +01:00
Horatiu Vultur
9d031a51b3 phy: lan966x: Remove set_speed function
Remove the set_speed function and allow the driver to figure out the
speed at which needs to configure the serdes based on the interface type.

Fixes: 305524902a ("phy: Add lan966x ethernet serdes PHY driver")
Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>
Link: https://lore.kernel.org/r/20211211214717.1284306-1-horatiu.vultur@microchip.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2021-12-14 14:24:48 +05:30
Horatiu Vultur
17dcc120fb phy: lan966x: Extend lan966x to support multiple phy interfaces.
Currently the driver is supporting only the interfaces QSGMII, SGMII,
RGMII and GMII. This patch extend the supported interfaces with
1000BASE-X and 2500BASE-X.

Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>
Acked-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Link: https://lore.kernel.org/r/20211130101015.164916-1-horatiu.vultur@microchip.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2021-12-02 09:49:23 +05:30
Horatiu Vultur
305524902a phy: Add lan966x ethernet serdes PHY driver
Add the Microchip lan966x ethernet serdes PHY driver for interfaces
available in the lan966x SoC.

Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>
Link: https://lore.kernel.org/r/20211116100818.1615762-4-horatiu.vultur@microchip.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2021-11-23 13:09:08 +05:30
Yang Yingliang
b4dc97ab0a phy: Sparx5 Eth SerDes: Fix return value check in sparx5_serdes_probe()
In case of error, the function devm_ioremap() returns NULL
pointer not ERR_PTR(). The IS_ERR() test in the return value
check should be replaced with NULL test.

Fixes: 2ff8a1eeb5 ("phy: Add Sparx5 ethernet serdes PHY driver")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Link: https://lore.kernel.org/r/20210909072149.2934047-1-yangyingliang@huawei.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2021-10-26 16:36:23 +05:30
Yang Yingliang
d1ce245fe4 phy: Sparx5 Eth SerDes: check return value after calling platform_get_resource()
It will cause null-ptr-deref if platform_get_resource() returns NULL,
we need check the return value.

Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Link: https://lore.kernel.org/r/20210603051014.2674744-1-yangyingliang@huawei.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2021-06-03 11:18:19 +05:30
kernel test robot
cbc336c09b phy: fix resource_size.cocci warnings
drivers/phy/microchip/sparx5_serdes.c:2440:54-57: ERROR: Missing resource_size with iores

 Use resource_size function on resource object
 instead of explicit computation.

Generated by: scripts/coccinelle/api/resource_size.cocci

Fixes: 2ff8a1eeb5 ("phy: Add Sparx5 ethernet serdes PHY driver")
CC: Steen Hegelund <steen.hegelund@microchip.com>
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: kernel test robot <lkp@intel.com>
Link: https://lore.kernel.org/r/20210318232844.GA65886@63b0c5462fda
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2021-04-06 10:39:20 +05:30
Steen Hegelund
8595ffb52f phy: Sparx5 Eth SerDes: Use direct register operations
Use direct register operations instead of a table of register
information to lower the stack usage.

Signed-off-by: Steen Hegelund <steen.hegelund@microchip.com>
Reported-by: kernel test robot <lkp@intel.com>
Link: https://lore.kernel.org/r/20210329141309.612459-2-steen.hegelund@microchip.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2021-04-06 10:37:57 +05:30
Geert Uytterhoeven
a113ef0a5e phy: microchip: PHY_SPARX5_SERDES should depend on ARCH_SPARX5
The Microchip Sparx5 SerDes PHY is present only Microchip Sparx5 SoCs.
Hence add a dependency on ARCH_SPARX5, to prevent asking the user about
this driver when configuring a kernel without support for Sparx5 SoCs.

Fixes: 2ff8a1eeb5 ("phy: Add Sparx5 ethernet serdes PHY driver")
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/r/20210331081937.367408-1-geert+renesas@glider.be
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2021-03-31 16:46:41 +05:30
Steen Hegelund
2ff8a1eeb5 phy: Add Sparx5 ethernet serdes PHY driver
Add the Microchip Sparx5 ethernet serdes PHY driver for the 6G, 10G and 25G
interfaces available in the Sparx5 SoC.

Signed-off-by: Bjarni Jonasson <bjarni.jonasson@microchip.com>
Signed-off-by: Steen Hegelund <steen.hegelund@microchip.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Link: https://lore.kernel.org/r/20210218161451.3489955-4-steen.hegelund@microchip.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2021-03-17 12:13:19 +05:30