[U-Boot] [PATCH 1/2] rockchip: clk: rk3399: add clk_enable function and support USB HOST0/1

The generic ehci-driver (ehci-generic.c) will try to enable the clocks listed in the DTSI. If this fails (e.g. due to clk_enable not being implemented in a driver and -ENOSYS being returned by the clk-uclass), the driver will bail our and print an error message.
This implements a minimal clk_enable for the RK3399 and supports the clocks mandatory for the EHCI controllers; as these are enabled by default we simply return success.
Signed-off-by: Philipp Tomsich philipp.tomsich@theobroma-systems.com ---
drivers/clk/rockchip/clk_rk3399.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
diff --git a/drivers/clk/rockchip/clk_rk3399.c b/drivers/clk/rockchip/clk_rk3399.c index 04f0b3f..a2a1607 100644 --- a/drivers/clk/rockchip/clk_rk3399.c +++ b/drivers/clk/rockchip/clk_rk3399.c @@ -950,9 +950,24 @@ static ulong rk3399_clk_set_rate(struct clk *clk, ulong rate) return ret; }
+static int rk3399_clk_enable(struct clk *clk) +{ + switch (clk->id) { + case HCLK_HOST0: + case HCLK_HOST0_ARB: + case HCLK_HOST1: + case HCLK_HOST1_ARB: + return 0; + } + + debug("%s: unsupported clk %ld\n", __func__, clk->id); + return -ENOENT; +} + static struct clk_ops rk3399_clk_ops = { .get_rate = rk3399_clk_get_rate, .set_rate = rk3399_clk_set_rate, + .enable = rk3399_clk_enable, };
static int rk3399_clk_probe(struct udevice *dev)

On the RK3399-Q7, we need to turn on the on-module USB hub before using the USB host interfaces (only the OTG interface is directly connected to the edge connector). This drops the deprecated 'rockchip,vbus-gpio' property and uses a fixed regulator to turn on the USB hub.
References: 26a8b80 "usb: host: xhci-rockchip: use fixed regulator to control vbus" Signed-off-by: Philipp Tomsich philipp.tomsich@theobroma-systems.com ---
arch/arm/dts/rk3399-puma.dtsi | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/arch/arm/dts/rk3399-puma.dtsi b/arch/arm/dts/rk3399-puma.dtsi index 85e00ec..3899b2a 100644 --- a/arch/arm/dts/rk3399-puma.dtsi +++ b/arch/arm/dts/rk3399-puma.dtsi @@ -108,6 +108,17 @@ regulator-max-microvolt = <1800000>; };
+ usbhub_enable: usbhub_enable { + compatible = "regulator-fixed"; + regulator-name = "usbhub_enable"; + enable-active-low; + gpio = <&gpio4 3 GPIO_ACTIVE_HIGH>; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + }; + vccadc_ref: vccadc-ref { compatible = "regulator-fixed"; regulator-name = "vcc1v8_sys"; @@ -533,7 +544,6 @@ };
&dwc3_typec1 { - rockchip,vbus-gpio = <&gpio4 3 GPIO_ACTIVE_LOW>; status = "okay"; };

On 11 September 2017 at 09:29, Philipp Tomsich philipp.tomsich@theobroma-systems.com wrote:
On the RK3399-Q7, we need to turn on the on-module USB hub before using the USB host interfaces (only the OTG interface is directly connected to the edge connector). This drops the deprecated 'rockchip,vbus-gpio' property and uses a fixed regulator to turn on the USB hub.
References: 26a8b80 "usb: host: xhci-rockchip: use fixed regulator to control vbus" Signed-off-by: Philipp Tomsich philipp.tomsich@theobroma-systems.com
arch/arm/dts/rk3399-puma.dtsi | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
Reviewed-by: Simon Glass sjg@chromium.org

On 11 September 2017 at 09:29, Philipp Tomsich philipp.tomsich@theobroma-systems.com wrote:
The generic ehci-driver (ehci-generic.c) will try to enable the clocks listed in the DTSI. If this fails (e.g. due to clk_enable not being implemented in a driver and -ENOSYS being returned by the clk-uclass), the driver will bail our and print an error message.
This implements a minimal clk_enable for the RK3399 and supports the clocks mandatory for the EHCI controllers; as these are enabled by default we simply return success.
Signed-off-by: Philipp Tomsich philipp.tomsich@theobroma-systems.com
drivers/clk/rockchip/clk_rk3399.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
Reviewed-by: Simon Glass sjg@chromium.org
participants (2)
-
Philipp Tomsich
-
Simon Glass