Commit c50151d43f78738d3d9fef4c4f4611e83178dc88

Authored by Patrick Delaunay
Committed by Marek Vasut
1 parent 1655f2da84

phy: usbphyc: Binding update of vdda supply

Move supply vdda1v1 and vdda1v8 in usbphyc node and
no more in port

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

Showing 4 changed files with 35 additions and 34 deletions Side-by-side Diff

arch/arm/dts/stm32mp157c-ed1.dts
... ... @@ -382,19 +382,11 @@
382 382 status = "okay";
383 383 };
384 384  
385   -&usbotg_hs {
386   - usb33d-supply = <&usb33>;
387   -};
388   -
389 385 &usbphyc_port0 {
390 386 phy-supply = <&vdd_usb>;
391   - vdda1v1-supply = <&reg11>;
392   - vdda1v8-supply = <&reg18>;
393 387 };
394 388  
395 389 &usbphyc_port1 {
396 390 phy-supply = <&vdd_usb>;
397   - vdda1v1-supply = <&reg11>;
398   - vdda1v8-supply = <&reg18>;
399 391 };
arch/arm/dts/stm32mp157c.dtsi
... ... @@ -836,6 +836,7 @@
836 836 g-np-tx-fifo-size = <32>;
837 837 g-tx-fifo-size = <128 128 64 64 64 64 32 32>;
838 838 dr_mode = "otg";
  839 + usb33d-supply = <&usb33>;
839 840 status = "disabled";
840 841 };
841 842  
... ... @@ -1161,6 +1162,8 @@
1161 1162 reg = <0x5a006000 0x1000>;
1162 1163 clocks = <&rcc USBPHY_K>;
1163 1164 resets = <&rcc USBPHY_R>;
  1165 + vdda1v1-supply = <&reg11>;
  1166 + vdda1v8-supply = <&reg18>;
1164 1167 status = "disabled";
1165 1168  
1166 1169 usbphyc_port0: usb-phy@0 {
doc/device-tree-bindings/phy/phy-stm32-usbphyc.txt
... ... @@ -23,6 +23,8 @@
23 23 - compatible: must be "st,stm32mp1-usbphyc"
24 24 - reg: address and length of the usb phy control register set
25 25 - clocks: phandle + clock specifier for the PLL phy clock
  26 +- vdda1v1-supply: phandle to the regulator providing 1V1 power to the PHY
  27 +- vdda1v8-supply: phandle to the regulator providing 1V8 power to the PHY
26 28 - #address-cells: number of address cells for phys sub-nodes, must be <1>
27 29 - #size-cells: number of size cells for phys sub-nodes, must be <0>
28 30  
... ... @@ -40,8 +42,6 @@
40 42 - reg: phy port index
41 43 - phy-supply: phandle to the regulator providing 3V3 power to the PHY,
42 44 see phy-bindings.txt in the same directory.
43   -- vdda1v1-supply: phandle to the regulator providing 1V1 power to the PHY
44   -- vdda1v8-supply: phandle to the regulator providing 1V8 power to the PHY
45 45 - #phy-cells: see phy-bindings.txt in the same directory, must be <0> for PHY
46 46 port#1 and must be <1> for PHY port#2, to select USB controller
47 47  
drivers/phy/phy-stm32-usbphyc.c
... ... @@ -51,10 +51,10 @@
51 51 struct stm32_usbphyc {
52 52 fdt_addr_t base;
53 53 struct clk clk;
  54 + struct udevice *vdda1v1;
  55 + struct udevice *vdda1v8;
54 56 struct stm32_usbphyc_phy {
55 57 struct udevice *vdd;
56   - struct udevice *vdda1v1;
57   - struct udevice *vdda1v8;
58 58 bool init;
59 59 bool powered;
60 60 } phys[MAX_PHYS];
61 61  
62 62  
... ... @@ -212,19 +212,20 @@
212 212 int ret;
213 213  
214 214 pr_debug("%s phy ID = %lu\n", __func__, phy->id);
215   - if (usbphyc_phy->vdda1v1) {
216   - ret = regulator_set_enable(usbphyc_phy->vdda1v1, true);
  215 + if (usbphyc->vdda1v1) {
  216 + ret = regulator_set_enable(usbphyc->vdda1v1, true);
217 217 if (ret)
218 218 return ret;
219 219 }
220 220  
221   - if (usbphyc_phy->vdda1v8) {
222   - ret = regulator_set_enable(usbphyc_phy->vdda1v8, true);
  221 + if (usbphyc->vdda1v8) {
  222 + ret = regulator_set_enable(usbphyc->vdda1v8, true);
223 223 if (ret)
224 224 return ret;
225 225 }
226   - if (usbphyc_phy->vdd) {
227   - ret = regulator_set_enable(usbphyc_phy->vdd, true);
  226 +
  227 + if (usbphyc->vdd) {
  228 + ret = regulator_set_enable(usbphyc->vdd, true);
228 229 if (ret)
229 230 return ret;
230 231 }
231 232  
232 233  
... ... @@ -246,20 +247,20 @@
246 247 if (stm32_usbphyc_is_powered(usbphyc))
247 248 return 0;
248 249  
249   - if (usbphyc_phy->vdda1v1) {
250   - ret = regulator_set_enable(usbphyc_phy->vdda1v1, false);
  250 + if (usbphyc->vdda1v1) {
  251 + ret = regulator_set_enable(usbphyc->vdda1v1, false);
251 252 if (ret)
252 253 return ret;
253 254 }
254 255  
255   - if (usbphyc_phy->vdda1v8) {
256   - ret = regulator_set_enable(usbphyc_phy->vdda1v8, false);
  256 + if (usbphyc->vdda1v8) {
  257 + ret = regulator_set_enable(usbphyc->vdda1v8, false);
257 258 if (ret)
258 259 return ret;
259 260 }
260 261  
261   - if (usbphyc_phy->vdd) {
262   - ret = regulator_set_enable(usbphyc_phy->vdd, false);
  262 + if (usbphyc->vdd) {
  263 + ret = regulator_set_enable(usbphyc->vdd, false);
263 264 if (ret)
264 265 return ret;
265 266 }
... ... @@ -351,6 +352,21 @@
351 352 reset_deassert(&reset);
352 353 }
353 354  
  355 + /* get usbphyc regulator */
  356 + ret = device_get_supply_regulator(dev, "vdda1v1-supply",
  357 + &usbphyc->vdda1v1);
  358 + if (ret) {
  359 + dev_err(dev, "Can't get vdda1v1-supply regulator\n");
  360 + return ret;
  361 + }
  362 +
  363 + ret = device_get_supply_regulator(dev, "vdda1v8-supply",
  364 + &usbphyc->vdda1v8);
  365 + if (ret) {
  366 + dev_err(dev, "Can't get vdda1v8-supply regulator\n");
  367 + return ret;
  368 + }
  369 +
354 370 /*
355 371 * parse all PHY subnodes in order to populate regulator associated
356 372 * to each PHY port
... ... @@ -363,16 +379,6 @@
363 379 usbphyc_phy->powered = false;
364 380 ret = stm32_usbphyc_get_regulator(dev, node, "phy-supply",
365 381 &usbphyc_phy->vdd);
366   - if (ret)
367   - return ret;
368   -
369   - ret = stm32_usbphyc_get_regulator(dev, node, "vdda1v1-supply",
370   - &usbphyc_phy->vdda1v1);
371   - if (ret)
372   - return ret;
373   -
374   - ret = stm32_usbphyc_get_regulator(dev, node, "vdda1v8-supply",
375   - &usbphyc_phy->vdda1v8);
376 382 if (ret)
377 383 return ret;
378 384