phy-zynqmp: Postpone getting clock rate until actually needed
authorMike Looijmans <mike.looijmans@topic.nl>
Mon, 28 Apr 2025 06:35:47 +0000 (08:35 +0200)
committerVinod Koul <vkoul@kernel.org>
Wed, 14 May 2025 08:48:01 +0000 (09:48 +0100)
commit065d5885f6180c534b7b176847b3e008f4e11850
treef790d7069c8ff8d781e5686d5f02409f5c2e07a1
parent1b1e949924fb59e98d9401681b139e92e75686ac
phy-zynqmp: Postpone getting clock rate until actually needed

At probe time the driver would display the following error and abort:
  xilinx-psgtr fd400000.phy: Invalid rate 0 for reference clock 0

At probe time, the associated GTR driver (e.g. SATA or PCIe) hasn't
initialized the clock yet, so clk_get_rate() likely returns 0 if the clock
is programmable. So this driver only works if the clock is fixed.

The PHY driver doesn't need to know the clock frequency at probe yet, so
wait until the associated driver initializes the lane before requesting the
clock rate setting.

In addition to allowing the driver to be used with programmable clocks,
this also reduces the driver's runtime memory footprint by removing an
array of pointers from struct xpsgtr_phy.

Signed-off-by: Mike Looijmans <mike.looijmans@topic.nl>
Acked-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/20250428063648.22034-1-mike.looijmans@topic.nl
Signed-off-by: Vinod Koul <vkoul@kernel.org>
drivers/phy/xilinx/phy-zynqmp.c