Jagan Teki | 1d150b4 | 2018-12-22 21:32:49 +0530 | [diff] [blame^] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
| 2 | /* |
| 3 | * Copyright (C) 2018 Amarula Solutions. |
| 4 | * Author: Jagan Teki <jagan@amarulasolutions.com> |
| 5 | */ |
| 6 | |
| 7 | #include <common.h> |
| 8 | #include <clk-uclass.h> |
| 9 | #include <dm.h> |
| 10 | #include <errno.h> |
| 11 | #include <asm/arch/ccu.h> |
| 12 | #include <dt-bindings/clock/sun50i-a64-ccu.h> |
| 13 | |
| 14 | static const struct ccu_clk_gate a64_gates[] = { |
| 15 | [CLK_BUS_OTG] = GATE(0x060, BIT(23)), |
| 16 | [CLK_BUS_EHCI0] = GATE(0x060, BIT(24)), |
| 17 | [CLK_BUS_EHCI1] = GATE(0x060, BIT(25)), |
| 18 | [CLK_BUS_OHCI0] = GATE(0x060, BIT(28)), |
| 19 | [CLK_BUS_OHCI1] = GATE(0x060, BIT(29)), |
| 20 | |
| 21 | [CLK_USB_PHY0] = GATE(0x0cc, BIT(8)), |
| 22 | [CLK_USB_PHY1] = GATE(0x0cc, BIT(9)), |
| 23 | [CLK_USB_HSIC] = GATE(0x0cc, BIT(10)), |
| 24 | [CLK_USB_HSIC_12M] = GATE(0x0cc, BIT(11)), |
| 25 | [CLK_USB_OHCI0] = GATE(0x0cc, BIT(16)), |
| 26 | [CLK_USB_OHCI1] = GATE(0x0cc, BIT(17)), |
| 27 | }; |
| 28 | |
| 29 | static const struct ccu_desc a64_ccu_desc = { |
| 30 | .gates = a64_gates, |
| 31 | }; |
| 32 | |
| 33 | static const struct udevice_id a64_ccu_ids[] = { |
| 34 | { .compatible = "allwinner,sun50i-a64-ccu", |
| 35 | .data = (ulong)&a64_ccu_desc }, |
| 36 | { } |
| 37 | }; |
| 38 | |
| 39 | U_BOOT_DRIVER(clk_sun50i_a64) = { |
| 40 | .name = "sun50i_a64_ccu", |
| 41 | .id = UCLASS_CLK, |
| 42 | .of_match = a64_ccu_ids, |
| 43 | .priv_auto_alloc_size = sizeof(struct ccu_priv), |
| 44 | .ops = &sunxi_clk_ops, |
| 45 | .probe = sunxi_clk_probe, |
| 46 | }; |