diff mbox series

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

Message ID 1505230257-5291-2-git-send-email-philipp.tomsich@theobroma-systems.com
State Accepted
Delegated to: Philipp Tomsich
Headers show
Series rockchip: rk3399-puma: migrate from 'rockchip, vbus-gpio' to a fixed regulator | expand

Commit Message

Philipp Tomsich Sept. 12, 2017, 3:30 p.m. UTC
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(+)

Comments

Simon Glass Sept. 13, 2017, 4:26 a.m. UTC | #1
On 12 September 2017 at 09:30, 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>
Philipp Tomsich Sept. 13, 2017, 10:29 a.m. UTC | #2
> 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>
> Reviewed-by: Simon Glass <sjg@chromium.org>
> ---
> 
>  drivers/clk/rockchip/clk_rk3399.c | 15 +++++++++++++++
>  1 file changed, 15 insertions(+)
> 

Applied to u-boot-rockchip, thanks!
diff mbox series

Patch

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)