Home | History | Annotate | Line # | Download | only in sunxi
sun4i_a10_ccu.c revision 1.6.2.2
      1  1.6.2.2  pgoyette /* $NetBSD: sun4i_a10_ccu.c,v 1.6.2.2 2018/04/07 04:12:12 pgoyette Exp $ */
      2      1.1  jmcneill 
      3      1.1  jmcneill /*-
      4      1.1  jmcneill  * Copyright (c) 2017 Jared McNeill <jmcneill (at) invisible.ca>
      5      1.1  jmcneill  * All rights reserved.
      6      1.1  jmcneill  *
      7      1.1  jmcneill  * Redistribution and use in source and binary forms, with or without
      8      1.1  jmcneill  * modification, are permitted provided that the following conditions
      9      1.1  jmcneill  * are met:
     10      1.1  jmcneill  * 1. Redistributions of source code must retain the above copyright
     11      1.1  jmcneill  *    notice, this list of conditions and the following disclaimer.
     12      1.1  jmcneill  * 2. Redistributions in binary form must reproduce the above copyright
     13      1.1  jmcneill  *    notice, this list of conditions and the following disclaimer in the
     14      1.1  jmcneill  *    documentation and/or other materials provided with the distribution.
     15      1.1  jmcneill  *
     16      1.1  jmcneill  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     17      1.1  jmcneill  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     18      1.1  jmcneill  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     19      1.1  jmcneill  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     20      1.1  jmcneill  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
     21      1.1  jmcneill  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
     22      1.1  jmcneill  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
     23      1.1  jmcneill  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
     24      1.1  jmcneill  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     25      1.1  jmcneill  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     26      1.1  jmcneill  * SUCH DAMAGE.
     27      1.1  jmcneill  */
     28      1.1  jmcneill 
     29      1.1  jmcneill #include <sys/cdefs.h>
     30      1.1  jmcneill 
     31  1.6.2.2  pgoyette __KERNEL_RCSID(1, "$NetBSD: sun4i_a10_ccu.c,v 1.6.2.2 2018/04/07 04:12:12 pgoyette Exp $");
     32      1.1  jmcneill 
     33      1.1  jmcneill #include <sys/param.h>
     34      1.1  jmcneill #include <sys/bus.h>
     35      1.1  jmcneill #include <sys/device.h>
     36      1.1  jmcneill #include <sys/systm.h>
     37      1.1  jmcneill 
     38      1.1  jmcneill #include <dev/fdt/fdtvar.h>
     39      1.1  jmcneill 
     40      1.1  jmcneill #include <arm/sunxi/sunxi_ccu.h>
     41      1.1  jmcneill #include <arm/sunxi/sun4i_a10_ccu.h>
     42      1.1  jmcneill #include <arm/sunxi/sun7i_a20_ccu.h>
     43      1.1  jmcneill 
     44      1.1  jmcneill #define	PLL1_CFG_REG		0x000
     45      1.1  jmcneill #define	PLL2_CFG_REG		0x008
     46  1.6.2.1  pgoyette #define	PLL3_CFG_REG		0x010
     47  1.6.2.1  pgoyette #define	PLL5_CFG_REG		0x020
     48      1.1  jmcneill #define	PLL6_CFG_REG		0x028
     49  1.6.2.1  pgoyette #define	PLL7_CFG_REG		0x030
     50      1.1  jmcneill #define	OSC24M_CFG_REG		0x050
     51      1.1  jmcneill #define	CPU_AHB_APB0_CFG_REG	0x054
     52      1.1  jmcneill #define	APB1_CLK_DIV_REG	0x058
     53      1.1  jmcneill #define	AHB_GATING_REG0		0x060
     54      1.1  jmcneill #define	AHB_GATING_REG1		0x064
     55      1.1  jmcneill #define	APB0_GATING_REG		0x068
     56      1.1  jmcneill #define	APB1_GATING_REG		0x06c
     57      1.5  jmcneill #define	NAND_SCLK_CFG_REG	0x080
     58      1.1  jmcneill #define	SD0_SCLK_CFG_REG        0x088
     59      1.1  jmcneill #define	SD1_SCLK_CFG_REG        0x08c
     60      1.1  jmcneill #define	SD2_SCLK_CFG_REG        0x090
     61      1.1  jmcneill #define	SD3_SCLK_CFG_REG	0x094
     62      1.3  jmcneill #define	SATA_CFG_REG		0x0c8
     63      1.1  jmcneill #define	USBPHY_CFG_REG		0x0cc
     64  1.6.2.1  pgoyette #define	DRAM_GATING_REG		0x100
     65  1.6.2.1  pgoyette #define	BE0_CFG_REG		0x104
     66  1.6.2.1  pgoyette #define	BE1_CFG_REG		0x108
     67  1.6.2.1  pgoyette #define	FE0_CFG_REG		0x10c
     68  1.6.2.1  pgoyette #define	FE1_CFG_REG		0x110
     69  1.6.2.1  pgoyette #define	MP_CFG_REG		0x114
     70  1.6.2.1  pgoyette #define	LCD0CH0_CFG_REG		0x118
     71  1.6.2.1  pgoyette #define	LCD1CH0_CFG_REG		0x11c
     72  1.6.2.1  pgoyette #define LCD0CH1_CFG_REG		0x12c
     73  1.6.2.1  pgoyette #define LCD1CH1_CFG_REG		0x130
     74      1.1  jmcneill #define	CSI_CFG_REG		0x134
     75      1.1  jmcneill #define	VE_CFG_REG		0x13c
     76      1.1  jmcneill #define	AUDIO_CODEC_SCLK_CFG_REG 0x140
     77  1.6.2.2  pgoyette #define	LVDS_CFG_REG 		0x14c
     78  1.6.2.1  pgoyette #define	HDMI_CLOCK_CFG_REG	0x150
     79      1.1  jmcneill #define	MALI_CLOCK_CFG_REG	0x154
     80      1.1  jmcneill #define	IEP_SCLK_CFG_REG	0x160
     81      1.1  jmcneill 
     82      1.1  jmcneill static int sun4i_a10_ccu_match(device_t, cfdata_t, void *);
     83      1.1  jmcneill static void sun4i_a10_ccu_attach(device_t, device_t, void *);
     84      1.1  jmcneill 
     85      1.1  jmcneill enum sun4i_a10_ccu_type {
     86      1.1  jmcneill 	CCU_A10 = 1,
     87      1.1  jmcneill 	CCU_A20,
     88      1.1  jmcneill };
     89      1.1  jmcneill 
     90      1.1  jmcneill static const struct of_compat_data compat_data[] = {
     91      1.1  jmcneill 	{ "allwinner,sun4i-a10-ccu",	CCU_A10 },
     92      1.1  jmcneill 	{ "allwinner,sun7i-a20-ccu",	CCU_A20 },
     93      1.1  jmcneill 	{ NULL }
     94      1.1  jmcneill };
     95      1.1  jmcneill 
     96      1.1  jmcneill CFATTACH_DECL_NEW(sunxi_a10_ccu, sizeof(struct sunxi_ccu_softc),
     97      1.1  jmcneill 	sun4i_a10_ccu_match, sun4i_a10_ccu_attach, NULL, NULL);
     98      1.1  jmcneill 
     99      1.1  jmcneill static struct sunxi_ccu_reset sun4i_a10_ccu_resets[] = {
    100      1.1  jmcneill 	SUNXI_CCU_RESET(A10_RST_USB_PHY0, USBPHY_CFG_REG, 0),
    101      1.1  jmcneill 	SUNXI_CCU_RESET(A10_RST_USB_PHY1, USBPHY_CFG_REG, 1),
    102      1.1  jmcneill 	SUNXI_CCU_RESET(A10_RST_USB_PHY2, USBPHY_CFG_REG, 2),
    103  1.6.2.1  pgoyette 	SUNXI_CCU_RESET(A10_RST_DE_BE0, BE0_CFG_REG, 30),
    104  1.6.2.1  pgoyette 	SUNXI_CCU_RESET(A10_RST_DE_BE1, BE1_CFG_REG, 30),
    105  1.6.2.1  pgoyette 	SUNXI_CCU_RESET(A10_RST_DE_FE0, FE0_CFG_REG, 30),
    106  1.6.2.1  pgoyette 	SUNXI_CCU_RESET(A10_RST_DE_FE1, FE1_CFG_REG, 30),
    107  1.6.2.1  pgoyette 	SUNXI_CCU_RESET(A10_RST_DE_MP, MP_CFG_REG, 30),
    108  1.6.2.1  pgoyette 	SUNXI_CCU_RESET(A10_RST_TCON0, LCD0CH0_CFG_REG, 30),
    109  1.6.2.1  pgoyette 	SUNXI_CCU_RESET(A10_RST_TCON1, LCD1CH0_CFG_REG, 30),
    110  1.6.2.2  pgoyette 	SUNXI_CCU_RESET(A10_RST_LVDS, LVDS_CFG_REG, 0),
    111      1.1  jmcneill };
    112      1.1  jmcneill 
    113      1.1  jmcneill static const char *cpu_parents[] = { "losc", "osc24m", "pll_core", "pll_periph" };
    114      1.1  jmcneill static const char *axi_parents[] = { "cpu" };
    115      1.1  jmcneill static const char *ahb_parents[] = { "axi", "pll_periph", "pll_periph_base" };
    116      1.1  jmcneill static const char *apb0_parents[] = { "ahb" };
    117      1.1  jmcneill static const char *apb1_parents[] = { "osc24m", "pll_periph", "losc" };
    118  1.6.2.1  pgoyette static const char *mod_parents[] = { "osc24m", "pll_periph", "pll_ddr_other" };
    119      1.3  jmcneill static const char *sata_parents[] = { "pll6_periph_sata", "external" };
    120  1.6.2.1  pgoyette static const char *de_parents[] = { "pll_video0", "pll_video1", "pll_ddr_other" };
    121  1.6.2.2  pgoyette static const char *lcd_parents[] = { "pll_video0", "pll_video1", "pll_video0x2", "pll_video1x2" };
    122      1.1  jmcneill 
    123      1.4  jmcneill static const struct sunxi_ccu_nkmp_tbl sun4i_a10_pll1_table[] = {
    124      1.4  jmcneill 	{ 1008000000, 21, 1, 0, 0 },
    125      1.4  jmcneill 	{  960000000, 20, 1, 0, 0 },
    126      1.4  jmcneill 	{  912000000, 19, 1, 0, 0 },
    127      1.4  jmcneill 	{  864000000, 18, 1, 0, 0 },
    128      1.4  jmcneill 	{  720000000, 30, 0, 0, 0 },
    129      1.6  jmcneill 	{  624000000, 26, 0, 0, 0 },
    130      1.4  jmcneill 	{  528000000, 22, 0, 0, 0 },
    131      1.4  jmcneill 	{  312000000, 13, 0, 0, 0 },
    132      1.4  jmcneill 	{  144000000, 12, 0, 0, 1 },
    133      1.4  jmcneill 	{          0 }
    134      1.4  jmcneill };
    135      1.4  jmcneill 
    136      1.1  jmcneill static const struct sunxi_ccu_nkmp_tbl sun4i_a10_ac_dig_table[] = {
    137  1.6.2.2  pgoyette 	{ 24576000, 86, 0, 21, 4 },
    138      1.1  jmcneill 	{ 0 }
    139      1.1  jmcneill };
    140      1.1  jmcneill 
    141  1.6.2.2  pgoyette /*
    142  1.6.2.2  pgoyette  * some special cases
    143  1.6.2.2  pgoyette  * hardcode lcd0 (tcon0) to pll3 and lcd1 (tcon1) to pll7.
    144  1.6.2.2  pgoyette  * compute pll rate based on desired pixel clock
    145  1.6.2.2  pgoyette  */
    146  1.6.2.2  pgoyette 
    147  1.6.2.2  pgoyette static int sun4i_a10_ccu_lcd0ch0_set_rate(struct sunxi_ccu_softc *,
    148  1.6.2.2  pgoyette     struct sunxi_ccu_clk *, u_int);
    149  1.6.2.2  pgoyette static int sun4i_a10_ccu_lcd1ch0_set_rate(struct sunxi_ccu_softc *,
    150  1.6.2.2  pgoyette     struct sunxi_ccu_clk *, u_int);
    151  1.6.2.2  pgoyette static u_int sun4i_a10_ccu_lcd0ch0_round_rate(struct sunxi_ccu_softc *,
    152  1.6.2.2  pgoyette     struct sunxi_ccu_clk *, u_int);
    153  1.6.2.2  pgoyette static u_int sun4i_a10_ccu_lcd1ch0_round_rate(struct sunxi_ccu_softc *,
    154  1.6.2.2  pgoyette     struct sunxi_ccu_clk *, u_int);
    155  1.6.2.2  pgoyette static int sun4i_a10_ccu_lcd0ch1_set_rate(struct sunxi_ccu_softc *,
    156  1.6.2.2  pgoyette     struct sunxi_ccu_clk *, u_int);
    157  1.6.2.2  pgoyette static int sun4i_a10_ccu_lcd1ch1_set_rate(struct sunxi_ccu_softc *,
    158  1.6.2.2  pgoyette     struct sunxi_ccu_clk *, u_int);
    159  1.6.2.2  pgoyette 
    160      1.1  jmcneill static struct sunxi_ccu_clk sun4i_a10_ccu_clks[] = {
    161      1.1  jmcneill 	SUNXI_CCU_GATE(A10_CLK_HOSC, "osc24m", "hosc",
    162      1.1  jmcneill 	    OSC24M_CFG_REG, 0),
    163      1.1  jmcneill 
    164      1.4  jmcneill 	SUNXI_CCU_NKMP_TABLE(A10_CLK_PLL_CORE, "pll_core", "osc24m",
    165      1.1  jmcneill 	    PLL1_CFG_REG,		/* reg */
    166      1.1  jmcneill 	    __BITS(12,8),		/* n */
    167      1.1  jmcneill 	    __BITS(5,4), 		/* k */
    168      1.1  jmcneill 	    __BITS(1,0),		/* m */
    169      1.1  jmcneill 	    __BITS(17,16),		/* p */
    170      1.1  jmcneill 	    __BIT(31),			/* enable */
    171      1.4  jmcneill 	    0,				/* lock */
    172      1.4  jmcneill 	    sun4i_a10_pll1_table,	/* table */
    173      1.1  jmcneill 	    SUNXI_CCU_NKMP_FACTOR_P_POW2 | SUNXI_CCU_NKMP_FACTOR_N_EXACT |
    174      1.4  jmcneill 	    SUNXI_CCU_NKMP_FACTOR_N_ZERO_IS_ONE | SUNXI_CCU_NKMP_SCALE_CLOCK),
    175      1.1  jmcneill 
    176      1.1  jmcneill 	SUNXI_CCU_NKMP_TABLE(A10_CLK_PLL_AUDIO_BASE, "pll_audio", "osc24m",
    177      1.1  jmcneill 	    PLL2_CFG_REG,		/* reg */
    178      1.1  jmcneill 	    __BITS(14,8),		/* n */
    179      1.1  jmcneill 	    0,				/* k */
    180      1.1  jmcneill 	    __BITS(4,0),		/* m */
    181      1.1  jmcneill 	    __BITS(29,26),		/* p */
    182      1.1  jmcneill 	    __BIT(31),			/* enable */
    183      1.1  jmcneill 	    0,				/* lock */
    184      1.1  jmcneill 	    sun4i_a10_ac_dig_table,	/* table */
    185      1.1  jmcneill 	    0),
    186      1.1  jmcneill 
    187      1.1  jmcneill 	SUNXI_CCU_NKMP(A10_CLK_PLL_PERIPH_BASE, "pll_periph_base", "osc24m",
    188      1.1  jmcneill 	    PLL6_CFG_REG,		/* reg */
    189      1.1  jmcneill 	    __BITS(12,8),		/* n */
    190      1.1  jmcneill 	    __BITS(5,4), 		/* k */
    191      1.1  jmcneill 	    0,				/* m */
    192      1.1  jmcneill 	    0,				/* p */
    193      1.1  jmcneill 	    __BIT(31),			/* enable */
    194      1.1  jmcneill 	    SUNXI_CCU_NKMP_FACTOR_N_EXACT),
    195      1.1  jmcneill 
    196      1.1  jmcneill 	SUNXI_CCU_FIXED_FACTOR(A10_CLK_PLL_PERIPH, "pll_periph", "pll_periph_base",
    197      1.1  jmcneill 	    2, 1),
    198      1.1  jmcneill 
    199      1.1  jmcneill 	SUNXI_CCU_NKMP(A10_CLK_PLL_PERIPH_SATA, "pll_periph_sata", "pll_periph_base",
    200      1.1  jmcneill 	    PLL6_CFG_REG,		/* reg */
    201      1.1  jmcneill 	    0,				/* n */
    202      1.1  jmcneill 	    0,				/* k */
    203      1.1  jmcneill 	    __BITS(1,0),		/* m */
    204      1.1  jmcneill 	    0,				/* p */
    205      1.1  jmcneill 	    __BIT(14),			/* enable */
    206      1.1  jmcneill 	    0),
    207      1.1  jmcneill 
    208      1.3  jmcneill 	SUNXI_CCU_DIV_GATE(A10_CLK_SATA, "sata", sata_parents,
    209      1.3  jmcneill 	    SATA_CFG_REG,		/* reg */
    210      1.3  jmcneill 	    0,				/* div */
    211      1.3  jmcneill 	    __BIT(24),			/* sel */
    212      1.3  jmcneill 	    __BIT(31),			/* enable */
    213      1.3  jmcneill 	    0),
    214      1.3  jmcneill 
    215  1.6.2.1  pgoyette 	SUNXI_CCU_NKMP(A10_CLK_PLL_DDR_BASE, "pll_ddr_other", "osc24m",
    216  1.6.2.1  pgoyette 	    PLL5_CFG_REG,		/* reg */
    217  1.6.2.1  pgoyette 	    __BITS(12, 8),		/* n */
    218  1.6.2.1  pgoyette 	    __BITS(5,4),		/* k */
    219  1.6.2.1  pgoyette 	    0,				/* m */
    220  1.6.2.1  pgoyette 	    __BITS(17,16),		/* p */
    221  1.6.2.1  pgoyette 	    __BIT(31),			/* enable */
    222  1.6.2.1  pgoyette 	    SUNXI_CCU_NKMP_FACTOR_N_EXACT | SUNXI_CCU_NKMP_FACTOR_P_POW2),
    223  1.6.2.1  pgoyette 
    224  1.6.2.1  pgoyette 	SUNXI_CCU_NKMP(A10_CLK_PLL_DDR, "pll_ddr", "osc24m",
    225  1.6.2.1  pgoyette 	    PLL5_CFG_REG,		/* reg */
    226  1.6.2.1  pgoyette 	    __BITS(12, 8),		/* n */
    227  1.6.2.1  pgoyette 	    __BITS(5,4),		/* k */
    228  1.6.2.1  pgoyette 	    __BITS(1,0),		/* m */
    229  1.6.2.1  pgoyette 	    0,				/* p */
    230  1.6.2.1  pgoyette 	    __BIT(31),			/* enable */
    231  1.6.2.1  pgoyette 	    SUNXI_CCU_NKMP_FACTOR_N_EXACT),
    232  1.6.2.1  pgoyette 
    233      1.1  jmcneill 	SUNXI_CCU_DIV(A10_CLK_CPU, "cpu", cpu_parents,
    234      1.1  jmcneill 	    CPU_AHB_APB0_CFG_REG,	/* reg */
    235      1.1  jmcneill 	    0,				/* div */
    236      1.1  jmcneill 	    __BITS(17,16),		/* sel */
    237      1.4  jmcneill 	    SUNXI_CCU_DIV_SET_RATE_PARENT),
    238      1.1  jmcneill 
    239      1.1  jmcneill 	SUNXI_CCU_DIV(A10_CLK_AXI, "axi", axi_parents,
    240      1.1  jmcneill 	    CPU_AHB_APB0_CFG_REG,	/* reg */
    241      1.1  jmcneill 	    __BITS(1,0),		/* div */
    242      1.1  jmcneill 	    0,				/* sel */
    243      1.1  jmcneill 	    0),
    244      1.1  jmcneill 
    245      1.1  jmcneill 	SUNXI_CCU_DIV(A10_CLK_AHB, "ahb", ahb_parents,
    246      1.1  jmcneill 	    CPU_AHB_APB0_CFG_REG,	/* reg */
    247      1.1  jmcneill 	    __BITS(5,4),		/* div */
    248      1.1  jmcneill 	    __BITS(7,6),		/* sel */
    249      1.1  jmcneill 	    SUNXI_CCU_DIV_POWER_OF_TWO),
    250      1.1  jmcneill 
    251      1.1  jmcneill 	SUNXI_CCU_DIV(A10_CLK_APB0, "apb0", apb0_parents,
    252      1.1  jmcneill 	    CPU_AHB_APB0_CFG_REG,	/* reg */
    253      1.1  jmcneill 	    __BITS(9,8),		/* div */
    254      1.1  jmcneill 	    0,				/* sel */
    255      1.1  jmcneill 	    SUNXI_CCU_DIV_ZERO_IS_ONE | SUNXI_CCU_DIV_POWER_OF_TWO),
    256      1.1  jmcneill 
    257      1.1  jmcneill 	SUNXI_CCU_NM(A10_CLK_APB1, "apb1", apb1_parents,
    258      1.1  jmcneill 	    APB1_CLK_DIV_REG,		/* reg */
    259      1.1  jmcneill 	    __BITS(17,16),		/* n */
    260      1.1  jmcneill 	    __BITS(4,0),		/* m */
    261      1.1  jmcneill 	    __BITS(25,24),		/* sel */
    262      1.1  jmcneill 	    0,				/* enable */
    263      1.1  jmcneill 	    SUNXI_CCU_NM_POWER_OF_TWO),
    264      1.1  jmcneill 
    265      1.5  jmcneill 	SUNXI_CCU_NM(A10_CLK_NAND, "nand", mod_parents,
    266      1.5  jmcneill 	    NAND_SCLK_CFG_REG,		/* reg */
    267      1.5  jmcneill 	    __BITS(17,16),		/* n */
    268      1.5  jmcneill 	    __BITS(3,0),		/* m */
    269      1.5  jmcneill 	    __BITS(25,24),		/* sel */
    270      1.5  jmcneill 	    __BIT(31),			/* enable */
    271      1.5  jmcneill 	    SUNXI_CCU_NM_POWER_OF_TWO),
    272      1.5  jmcneill 
    273      1.1  jmcneill 	SUNXI_CCU_NM(A10_CLK_MMC0, "mmc0", mod_parents,
    274      1.1  jmcneill 	    SD0_SCLK_CFG_REG,		/* reg */
    275      1.1  jmcneill 	    __BITS(17,16),		/* n */
    276      1.1  jmcneill 	    __BITS(3,0),		/* m */
    277      1.1  jmcneill 	    __BITS(25,24),		/* sel */
    278      1.1  jmcneill 	    __BIT(31),			/* enable */
    279      1.1  jmcneill 	    SUNXI_CCU_NM_POWER_OF_TWO),
    280      1.2  jmcneill 	SUNXI_CCU_PHASE(A10_CLK_MMC0_SAMPLE, "mmc0_sample", "mmc0",
    281      1.2  jmcneill 	    SD0_SCLK_CFG_REG, __BITS(22,20)),
    282      1.2  jmcneill 	SUNXI_CCU_PHASE(A10_CLK_MMC0_OUTPUT, "mmc0_output", "mmc0",
    283      1.2  jmcneill 	    SD0_SCLK_CFG_REG, __BITS(10,8)),
    284      1.1  jmcneill 	SUNXI_CCU_NM(A10_CLK_MMC1, "mmc1", mod_parents,
    285      1.1  jmcneill 	    SD1_SCLK_CFG_REG,		/* reg */
    286      1.1  jmcneill 	    __BITS(17,16),		/* n */
    287      1.1  jmcneill 	    __BITS(3,0),		/* m */
    288      1.1  jmcneill 	    __BITS(25,24),		/* sel */
    289      1.1  jmcneill 	    __BIT(31),			/* enable */
    290      1.1  jmcneill 	    SUNXI_CCU_NM_POWER_OF_TWO),
    291      1.2  jmcneill 	SUNXI_CCU_PHASE(A10_CLK_MMC1_SAMPLE, "mmc1_sample", "mmc1",
    292      1.2  jmcneill 	    SD1_SCLK_CFG_REG, __BITS(22,20)),
    293      1.2  jmcneill 	SUNXI_CCU_PHASE(A10_CLK_MMC1_OUTPUT, "mmc1_output", "mmc1",
    294      1.2  jmcneill 	    SD1_SCLK_CFG_REG, __BITS(10,8)),
    295      1.1  jmcneill 	SUNXI_CCU_NM(A10_CLK_MMC2, "mmc2", mod_parents,
    296      1.1  jmcneill 	    SD2_SCLK_CFG_REG,		/* reg */
    297      1.1  jmcneill 	    __BITS(17,16),		/* n */
    298      1.1  jmcneill 	    __BITS(3,0),		/* m */
    299      1.1  jmcneill 	    __BITS(25,24),		/* sel */
    300      1.1  jmcneill 	    __BIT(31),			/* enable */
    301      1.1  jmcneill 	    SUNXI_CCU_NM_POWER_OF_TWO),
    302      1.2  jmcneill 	SUNXI_CCU_PHASE(A10_CLK_MMC2_SAMPLE, "mmc2_sample", "mmc2",
    303      1.2  jmcneill 	    SD2_SCLK_CFG_REG, __BITS(22,20)),
    304      1.2  jmcneill 	SUNXI_CCU_PHASE(A10_CLK_MMC2_OUTPUT, "mmc2_output", "mmc2",
    305      1.2  jmcneill 	    SD2_SCLK_CFG_REG, __BITS(10,8)),
    306      1.1  jmcneill 	SUNXI_CCU_NM(A10_CLK_MMC3, "mmc3", mod_parents,
    307      1.1  jmcneill 	    SD3_SCLK_CFG_REG,		/* reg */
    308      1.1  jmcneill 	    __BITS(17,16),		/* n */
    309      1.1  jmcneill 	    __BITS(3,0),		/* m */
    310      1.1  jmcneill 	    __BITS(25,24),		/* sel */
    311      1.1  jmcneill 	    __BIT(31),			/* enable */
    312      1.1  jmcneill 	    SUNXI_CCU_NM_POWER_OF_TWO),
    313      1.2  jmcneill 	SUNXI_CCU_PHASE(A10_CLK_MMC3_SAMPLE, "mmc3_sample", "mmc3",
    314      1.2  jmcneill 	    SD3_SCLK_CFG_REG, __BITS(22,20)),
    315      1.2  jmcneill 	SUNXI_CCU_PHASE(A10_CLK_MMC3_OUTPUT, "mmc3_output", "mmc3",
    316      1.2  jmcneill 	    SD3_SCLK_CFG_REG, __BITS(10,8)),
    317      1.1  jmcneill 
    318  1.6.2.1  pgoyette 	SUNXI_CCU_FRACTIONAL(A10_CLK_PLL_VIDEO0, "pll_video0", "osc24m",
    319  1.6.2.1  pgoyette 	    PLL3_CFG_REG,		/* reg */
    320  1.6.2.1  pgoyette 	    __BITS(7,0),		/* m */
    321  1.6.2.1  pgoyette 	    9,				/* m_min */
    322  1.6.2.1  pgoyette 	    127,			/* m_max */
    323  1.6.2.2  pgoyette 	    __BIT(15),			/* div_en */
    324  1.6.2.1  pgoyette 	    __BIT(14),			/* frac_sel */
    325  1.6.2.1  pgoyette 	    270000000, 297000000,	/* frac values */
    326  1.6.2.1  pgoyette 	    8,				/* prediv */
    327  1.6.2.1  pgoyette 	    __BIT(31)			/* enable */
    328  1.6.2.1  pgoyette 	    ),
    329  1.6.2.1  pgoyette 	SUNXI_CCU_FRACTIONAL(A10_CLK_PLL_VIDEO1, "pll_video1", "osc24m",
    330  1.6.2.1  pgoyette 	    PLL7_CFG_REG,		/* reg */
    331  1.6.2.1  pgoyette 	    __BITS(7,0),		/* m */
    332  1.6.2.1  pgoyette 	    9,				/* m_min */
    333  1.6.2.1  pgoyette 	    127,			/* m_max */
    334  1.6.2.2  pgoyette 	    __BIT(15),			/* div_en */
    335  1.6.2.1  pgoyette 	    __BIT(14),			/* frac_sel */
    336  1.6.2.1  pgoyette 	    270000000, 297000000,	/* frac values */
    337  1.6.2.1  pgoyette 	    8,				/* prediv */
    338  1.6.2.1  pgoyette 	    __BIT(31)			/* enable */
    339  1.6.2.1  pgoyette 	    ),
    340  1.6.2.1  pgoyette 	SUNXI_CCU_FIXED_FACTOR(A10_CLK_PLL_VIDEO0_2X,
    341  1.6.2.1  pgoyette 	    "pll_video0x2", "pll_video0",
    342  1.6.2.1  pgoyette 	    1, 2),
    343  1.6.2.1  pgoyette 	SUNXI_CCU_FIXED_FACTOR(A10_CLK_PLL_VIDEO1_2X,
    344  1.6.2.1  pgoyette 	    "pll_video1x2", "pll_video1",
    345  1.6.2.1  pgoyette 	    1, 2),
    346  1.6.2.1  pgoyette 
    347  1.6.2.1  pgoyette 	SUNXI_CCU_DIV_GATE(A10_CLK_DE_BE0, "debe0-mod", de_parents,
    348  1.6.2.1  pgoyette 	    BE0_CFG_REG,		/* reg */
    349  1.6.2.1  pgoyette 	    __BITS(3,0),		/* div */
    350  1.6.2.1  pgoyette 	    __BITS(25,24),		/* sel */
    351  1.6.2.1  pgoyette 	    __BIT(31),			/* enable */
    352  1.6.2.1  pgoyette 	    0				/* flags */
    353  1.6.2.1  pgoyette 	    ),
    354  1.6.2.1  pgoyette 	SUNXI_CCU_DIV_GATE(A10_CLK_DE_BE1, "debe1-mod", de_parents,
    355  1.6.2.1  pgoyette 	    BE1_CFG_REG,		/* reg */
    356  1.6.2.1  pgoyette 	    __BITS(3,0),		/* div */
    357  1.6.2.1  pgoyette 	    __BITS(25,24),		/* sel */
    358  1.6.2.1  pgoyette 	    __BIT(31),			/* enable */
    359  1.6.2.1  pgoyette 	    0				/* flags */
    360  1.6.2.1  pgoyette 	    ),
    361  1.6.2.1  pgoyette 	SUNXI_CCU_DIV_GATE(A10_CLK_DE_FE0, "defe0-mod", de_parents,
    362  1.6.2.1  pgoyette 	    FE0_CFG_REG,		/* reg */
    363  1.6.2.1  pgoyette 	    __BITS(3,0),		/* div */
    364  1.6.2.1  pgoyette 	    __BITS(25,24),		/* sel */
    365  1.6.2.1  pgoyette 	    __BIT(31),			/* enable */
    366  1.6.2.1  pgoyette 	    0				/* flags */
    367  1.6.2.1  pgoyette 	    ),
    368  1.6.2.1  pgoyette 	SUNXI_CCU_DIV_GATE(A10_CLK_DE_FE1, "defe1-mod", de_parents,
    369  1.6.2.1  pgoyette 	    FE1_CFG_REG,		/* reg */
    370  1.6.2.1  pgoyette 	    __BITS(3,0),		/* div */
    371  1.6.2.1  pgoyette 	    __BITS(25,24),		/* sel */
    372  1.6.2.1  pgoyette 	    __BIT(31),			/* enable */
    373  1.6.2.1  pgoyette 	    0				/* flags */
    374  1.6.2.1  pgoyette 	    ),
    375  1.6.2.2  pgoyette 	[A10_CLK_TCON0_CH0] = {
    376  1.6.2.2  pgoyette 	    .type = SUNXI_CCU_DIV,
    377  1.6.2.2  pgoyette 	    .base.name = "tcon0-ch0",
    378  1.6.2.2  pgoyette 	    .u.div.reg = LCD0CH0_CFG_REG,
    379  1.6.2.2  pgoyette 	    .u.div.parents = lcd_parents,
    380  1.6.2.2  pgoyette 	    .u.div.nparents = __arraycount(lcd_parents),
    381  1.6.2.2  pgoyette 	    .u.div.div = 0,
    382  1.6.2.2  pgoyette 	    .u.div.sel = __BITS(25,24),
    383  1.6.2.2  pgoyette 	    .u.div.enable = __BIT(31),
    384  1.6.2.2  pgoyette 	    .u.div.flags = 0,
    385  1.6.2.2  pgoyette 	    .enable = sunxi_ccu_div_enable,
    386  1.6.2.2  pgoyette 	    .get_rate = sunxi_ccu_div_get_rate,
    387  1.6.2.2  pgoyette 	    .set_rate = sun4i_a10_ccu_lcd0ch0_set_rate,
    388  1.6.2.2  pgoyette 	    .round_rate = sun4i_a10_ccu_lcd0ch0_round_rate,
    389  1.6.2.2  pgoyette 	    .set_parent = sunxi_ccu_div_set_parent,
    390  1.6.2.2  pgoyette 	    .get_parent = sunxi_ccu_div_get_parent,
    391  1.6.2.2  pgoyette 	    },
    392  1.6.2.2  pgoyette 	[A10_CLK_TCON1_CH0] = {
    393  1.6.2.2  pgoyette 	    .type = SUNXI_CCU_DIV,
    394  1.6.2.2  pgoyette 	    .base.name = "tcon1-ch0",
    395  1.6.2.2  pgoyette 	    .u.div.reg = LCD1CH0_CFG_REG,
    396  1.6.2.2  pgoyette 	    .u.div.parents = lcd_parents,
    397  1.6.2.2  pgoyette 	    .u.div.nparents = __arraycount(lcd_parents),
    398  1.6.2.2  pgoyette 	    .u.div.div = 0,
    399  1.6.2.2  pgoyette 	    .u.div.sel = __BITS(25,24),
    400  1.6.2.2  pgoyette 	    .u.div.enable = __BIT(31),
    401  1.6.2.2  pgoyette 	    .u.div.flags = 0,
    402  1.6.2.2  pgoyette 	    .enable = sunxi_ccu_div_enable,
    403  1.6.2.2  pgoyette 	    .get_rate = sunxi_ccu_div_get_rate,
    404  1.6.2.2  pgoyette 	    .set_rate = sun4i_a10_ccu_lcd1ch0_set_rate,
    405  1.6.2.2  pgoyette 	    .round_rate = sun4i_a10_ccu_lcd1ch0_round_rate,
    406  1.6.2.2  pgoyette 	    .set_parent = sunxi_ccu_div_set_parent,
    407  1.6.2.2  pgoyette 	    .get_parent = sunxi_ccu_div_get_parent,
    408  1.6.2.2  pgoyette 	    },
    409  1.6.2.2  pgoyette 	[A10_CLK_TCON0_CH1] = {
    410  1.6.2.2  pgoyette 	    .type = SUNXI_CCU_DIV,
    411  1.6.2.2  pgoyette 	    .base.name = "tcon0-ch1",
    412  1.6.2.2  pgoyette 	    .u.div.reg = LCD0CH1_CFG_REG,
    413  1.6.2.2  pgoyette 	    .u.div.parents = lcd_parents,
    414  1.6.2.2  pgoyette 	    .u.div.nparents = __arraycount(lcd_parents),
    415  1.6.2.2  pgoyette 	    .u.div.div = __BITS(3,0),
    416  1.6.2.2  pgoyette 	    .u.div.sel = __BITS(25,24),
    417  1.6.2.2  pgoyette 	    .u.div.enable = __BIT(15) | __BIT(31),
    418  1.6.2.2  pgoyette 	    .u.div.flags = 0,
    419  1.6.2.2  pgoyette 	    .enable = sunxi_ccu_div_enable,
    420  1.6.2.2  pgoyette 	    .get_rate = sunxi_ccu_div_get_rate,
    421  1.6.2.2  pgoyette 	    .set_rate = sun4i_a10_ccu_lcd0ch1_set_rate,
    422  1.6.2.2  pgoyette 	    .set_parent = sunxi_ccu_div_set_parent,
    423  1.6.2.2  pgoyette 	    .get_parent = sunxi_ccu_div_get_parent,
    424  1.6.2.2  pgoyette 	    },
    425  1.6.2.2  pgoyette 	[A10_CLK_TCON1_CH1] = {
    426  1.6.2.2  pgoyette 	    .type = SUNXI_CCU_DIV,
    427  1.6.2.2  pgoyette 	    .base.name = "tcon1-ch1",
    428  1.6.2.2  pgoyette 	    .u.div.reg = LCD1CH1_CFG_REG,
    429  1.6.2.2  pgoyette 	    .u.div.parents = lcd_parents,
    430  1.6.2.2  pgoyette 	    .u.div.nparents = __arraycount(lcd_parents),
    431  1.6.2.2  pgoyette 	    .u.div.div = __BITS(3,0),
    432  1.6.2.2  pgoyette 	    .u.div.sel = __BITS(25,24),
    433  1.6.2.2  pgoyette 	    .u.div.enable = __BIT(15) | __BIT(31),
    434  1.6.2.2  pgoyette 	    .u.div.flags = 0,
    435  1.6.2.2  pgoyette 	    .enable = sunxi_ccu_div_enable,
    436  1.6.2.2  pgoyette 	    .get_rate = sunxi_ccu_div_get_rate,
    437  1.6.2.2  pgoyette 	    .set_rate = sun4i_a10_ccu_lcd1ch1_set_rate,
    438  1.6.2.2  pgoyette 	    .set_parent = sunxi_ccu_div_set_parent,
    439  1.6.2.2  pgoyette 	    .get_parent = sunxi_ccu_div_get_parent,
    440  1.6.2.2  pgoyette 	    },
    441  1.6.2.2  pgoyette 	SUNXI_CCU_DIV_GATE(A10_CLK_HDMI, "hdmi-mod", lcd_parents,
    442  1.6.2.1  pgoyette 	    HDMI_CLOCK_CFG_REG,		/* reg */
    443  1.6.2.1  pgoyette 	    __BITS(3,0),		/* div */
    444  1.6.2.1  pgoyette 	    __BITS(25,24),		/* sel */
    445  1.6.2.1  pgoyette 	    __BIT(31),			/* enable */
    446  1.6.2.1  pgoyette 	    0				/* flags */
    447  1.6.2.1  pgoyette 	    ),
    448  1.6.2.1  pgoyette 
    449      1.1  jmcneill 	/* AHB_GATING_REG0 */
    450      1.1  jmcneill 	SUNXI_CCU_GATE(A10_CLK_AHB_OTG, "ahb-otg", "ahb",
    451      1.1  jmcneill 	    AHB_GATING_REG0, 0),
    452      1.1  jmcneill 	SUNXI_CCU_GATE(A10_CLK_AHB_EHCI0, "ahb-ehci0", "ahb",
    453      1.1  jmcneill 	    AHB_GATING_REG0, 1),
    454      1.1  jmcneill 	SUNXI_CCU_GATE(A10_CLK_AHB_OHCI0, "ahb-ohci0", "ahb",
    455      1.1  jmcneill 	    AHB_GATING_REG0, 2),
    456      1.1  jmcneill 	SUNXI_CCU_GATE(A10_CLK_AHB_EHCI1, "ahb-ehci1", "ahb",
    457      1.1  jmcneill 	    AHB_GATING_REG0, 3),
    458      1.1  jmcneill 	SUNXI_CCU_GATE(A10_CLK_AHB_OHCI1, "ahb-ohci1", "ahb",
    459      1.1  jmcneill 	    AHB_GATING_REG0, 4),
    460      1.1  jmcneill 	SUNXI_CCU_GATE(A10_CLK_AHB_SS, "ahb-ss", "ahb",
    461      1.1  jmcneill 	    AHB_GATING_REG0, 5),
    462      1.1  jmcneill 	SUNXI_CCU_GATE(A10_CLK_AHB_DMA, "ahb-dma", "ahb",
    463      1.1  jmcneill 	    AHB_GATING_REG0, 6),
    464      1.1  jmcneill 	SUNXI_CCU_GATE(A10_CLK_AHB_BIST, "ahb-bist", "ahb",
    465      1.1  jmcneill 	    AHB_GATING_REG0, 7),
    466      1.1  jmcneill 	SUNXI_CCU_GATE(A10_CLK_AHB_MMC0, "ahb-mmc0", "ahb",
    467      1.1  jmcneill 	    AHB_GATING_REG0, 8),
    468      1.1  jmcneill 	SUNXI_CCU_GATE(A10_CLK_AHB_MMC1, "ahb-mmc1", "ahb",
    469      1.1  jmcneill 	    AHB_GATING_REG0, 9),
    470      1.1  jmcneill 	SUNXI_CCU_GATE(A10_CLK_AHB_MMC2, "ahb-mmc2", "ahb",
    471      1.1  jmcneill 	    AHB_GATING_REG0, 10),
    472      1.1  jmcneill 	SUNXI_CCU_GATE(A10_CLK_AHB_MMC3, "ahb-mmc3", "ahb",
    473      1.1  jmcneill 	    AHB_GATING_REG0, 11),
    474      1.1  jmcneill 	SUNXI_CCU_GATE(A10_CLK_AHB_MS, "ahb-ms", "ahb",
    475      1.1  jmcneill 	    AHB_GATING_REG0, 12),
    476      1.1  jmcneill 	SUNXI_CCU_GATE(A10_CLK_AHB_NAND, "ahb-nand", "ahb",
    477      1.1  jmcneill 	    AHB_GATING_REG0, 13),
    478      1.1  jmcneill 	SUNXI_CCU_GATE(A10_CLK_AHB_SDRAM, "ahb-sdram", "ahb",
    479      1.1  jmcneill 	    AHB_GATING_REG0, 14),
    480      1.1  jmcneill 	SUNXI_CCU_GATE(A10_CLK_AHB_ACE, "ahb-ace", "ahb",
    481      1.1  jmcneill 	    AHB_GATING_REG0, 16),
    482      1.1  jmcneill 	SUNXI_CCU_GATE(A10_CLK_AHB_EMAC, "ahb-emac", "ahb",
    483      1.1  jmcneill 	    AHB_GATING_REG0, 17),
    484      1.1  jmcneill 	SUNXI_CCU_GATE(A10_CLK_AHB_TS, "ahb-ts", "ahb",
    485      1.1  jmcneill 	    AHB_GATING_REG0, 18),
    486      1.1  jmcneill 	SUNXI_CCU_GATE(A10_CLK_AHB_SPI0, "ahb-spi0", "ahb",
    487      1.1  jmcneill 	    AHB_GATING_REG0, 20),
    488      1.1  jmcneill 	SUNXI_CCU_GATE(A10_CLK_AHB_SPI1, "ahb-spi1", "ahb",
    489      1.1  jmcneill 	    AHB_GATING_REG0, 21),
    490      1.1  jmcneill 	SUNXI_CCU_GATE(A10_CLK_AHB_SPI2, "ahb-spi2", "ahb",
    491      1.1  jmcneill 	    AHB_GATING_REG0, 22),
    492      1.1  jmcneill 	SUNXI_CCU_GATE(A10_CLK_AHB_SPI3, "ahb-spi3", "ahb",
    493      1.1  jmcneill 	    AHB_GATING_REG0, 23),
    494      1.1  jmcneill 	SUNXI_CCU_GATE(A10_CLK_AHB_SATA, "ahb-sata", "ahb",
    495      1.1  jmcneill 	    AHB_GATING_REG0, 25),
    496      1.1  jmcneill 	SUNXI_CCU_GATE(A10_CLK_AHB_HSTIMER, "ahb-hstimer", "ahb",
    497      1.1  jmcneill 	    AHB_GATING_REG0, 28),
    498      1.1  jmcneill 
    499      1.1  jmcneill 	/* AHB_GATING_REG1. Missing: TVE, HDMI */
    500      1.1  jmcneill 	SUNXI_CCU_GATE(A10_CLK_AHB_VE, "ahb-ve", "ahb",
    501      1.1  jmcneill 	    AHB_GATING_REG1, 0),
    502      1.1  jmcneill 	SUNXI_CCU_GATE(A10_CLK_AHB_TVD, "ahb-tvd", "ahb",
    503      1.1  jmcneill 	    AHB_GATING_REG1, 1),
    504      1.1  jmcneill 	SUNXI_CCU_GATE(A10_CLK_AHB_TVE0, "ahb-tve0", "ahb",
    505      1.1  jmcneill 	    AHB_GATING_REG1, 2),
    506      1.1  jmcneill 	SUNXI_CCU_GATE(A10_CLK_AHB_TVE1, "ahb-tve1", "ahb",
    507      1.1  jmcneill 	    AHB_GATING_REG1, 3),
    508      1.1  jmcneill 	SUNXI_CCU_GATE(A10_CLK_AHB_LCD0, "ahb-lcd0", "ahb",
    509      1.1  jmcneill 	    AHB_GATING_REG1, 4),
    510      1.1  jmcneill 	SUNXI_CCU_GATE(A10_CLK_AHB_LCD1, "ahb-lcd1", "ahb",
    511      1.1  jmcneill 	    AHB_GATING_REG1, 5),
    512      1.1  jmcneill 	SUNXI_CCU_GATE(A10_CLK_AHB_CSI0, "ahb-csi0", "ahb",
    513      1.1  jmcneill 	    AHB_GATING_REG1, 8),
    514      1.1  jmcneill 	SUNXI_CCU_GATE(A10_CLK_AHB_CSI1, "ahb-csi1", "ahb",
    515      1.1  jmcneill 	    AHB_GATING_REG1, 9),
    516      1.1  jmcneill 	SUNXI_CCU_GATE(A10_CLK_AHB_HDMI1, "ahb-hdmi1", "ahb",
    517      1.1  jmcneill 	    AHB_GATING_REG1, 10),
    518      1.1  jmcneill 	SUNXI_CCU_GATE(A10_CLK_AHB_HDMI0, "ahb-hdmi0", "ahb",
    519      1.1  jmcneill 	    AHB_GATING_REG1, 11),
    520      1.1  jmcneill 	SUNXI_CCU_GATE(A10_CLK_AHB_DE_BE0, "ahb-de_be0", "ahb",
    521      1.1  jmcneill 	    AHB_GATING_REG1, 12),
    522      1.1  jmcneill 	SUNXI_CCU_GATE(A10_CLK_AHB_DE_BE1, "ahb-de_be1", "ahb",
    523      1.1  jmcneill 	    AHB_GATING_REG1, 13),
    524      1.1  jmcneill 	SUNXI_CCU_GATE(A10_CLK_AHB_DE_FE0, "ahb-de_fe0", "ahb",
    525      1.1  jmcneill 	    AHB_GATING_REG1, 14),
    526      1.1  jmcneill 	SUNXI_CCU_GATE(A10_CLK_AHB_DE_FE1, "ahb-de_fe1", "ahb",
    527      1.1  jmcneill 	    AHB_GATING_REG1, 15),
    528      1.1  jmcneill 	SUNXI_CCU_GATE(A10_CLK_AHB_GMAC, "ahb-gmac", "ahb",
    529      1.1  jmcneill 	    AHB_GATING_REG1, 17),
    530      1.1  jmcneill 	SUNXI_CCU_GATE(A10_CLK_AHB_MP, "ahb-mp", "ahb",
    531      1.1  jmcneill 	    AHB_GATING_REG1, 18),
    532      1.1  jmcneill 	SUNXI_CCU_GATE(A10_CLK_AHB_GPU, "ahb-gpu", "ahb",
    533      1.1  jmcneill 	    AHB_GATING_REG1, 20),
    534      1.1  jmcneill 
    535      1.1  jmcneill 	/* APB0_GATING_REG */
    536      1.1  jmcneill 	SUNXI_CCU_GATE(A10_CLK_APB0_CODEC, "apb0-codec", "apb0",
    537      1.1  jmcneill 	    APB0_GATING_REG, 0),
    538      1.1  jmcneill 	SUNXI_CCU_GATE(A10_CLK_APB0_SPDIF, "apb0-spdif", "apb0",
    539      1.1  jmcneill 	    APB0_GATING_REG, 1),
    540      1.1  jmcneill 	SUNXI_CCU_GATE(A10_CLK_APB0_AC97, "apb0-ac97", "apb0",
    541      1.1  jmcneill 	    APB0_GATING_REG, 2),
    542      1.1  jmcneill 	SUNXI_CCU_GATE(A10_CLK_APB0_I2S0, "apb0-i2s0", "apb0",
    543      1.1  jmcneill 	    APB0_GATING_REG, 3),
    544      1.1  jmcneill 	SUNXI_CCU_GATE(A10_CLK_APB0_I2S1, "apb0-i2s1", "apb0",
    545      1.1  jmcneill 	    APB0_GATING_REG, 4),
    546      1.1  jmcneill 	SUNXI_CCU_GATE(A10_CLK_APB0_PIO, "apb0-pio", "apb0",
    547      1.1  jmcneill 	    APB0_GATING_REG, 5),
    548      1.1  jmcneill 	SUNXI_CCU_GATE(A10_CLK_APB0_IR0, "apb0-ir0", "apb0",
    549      1.1  jmcneill 	    APB0_GATING_REG, 6),
    550      1.1  jmcneill 	SUNXI_CCU_GATE(A10_CLK_APB0_IR1, "apb0-ir1", "apb0",
    551      1.1  jmcneill 	    APB0_GATING_REG, 7),
    552      1.1  jmcneill 	SUNXI_CCU_GATE(A10_CLK_APB0_I2S2, "apb0-i2s2", "apb0",
    553      1.1  jmcneill 	    APB0_GATING_REG, 8),
    554      1.1  jmcneill 	SUNXI_CCU_GATE(A10_CLK_APB0_KEYPAD, "apb0-keypad", "apb0",
    555      1.1  jmcneill 	    APB0_GATING_REG, 10),
    556      1.1  jmcneill 
    557      1.1  jmcneill 	/* APB1_GATING_REG */
    558      1.1  jmcneill 	SUNXI_CCU_GATE(A10_CLK_APB1_I2C0, "apb1-i2c0", "apb1",
    559      1.1  jmcneill 	    APB1_GATING_REG, 0),
    560      1.1  jmcneill 	SUNXI_CCU_GATE(A10_CLK_APB1_I2C1, "apb1-i2c1", "apb1",
    561      1.1  jmcneill 	    APB1_GATING_REG, 1),
    562      1.1  jmcneill 	SUNXI_CCU_GATE(A10_CLK_APB1_I2C2, "apb1-i2c2", "apb1",
    563      1.1  jmcneill 	    APB1_GATING_REG, 2),
    564      1.1  jmcneill 	SUNXI_CCU_GATE(A10_CLK_APB1_I2C3, "apb1-i2c3", "apb1",
    565      1.1  jmcneill 	    APB1_GATING_REG, 3),
    566      1.1  jmcneill 	SUNXI_CCU_GATE(A10_CLK_APB1_CAN, "apb1-can", "apb1",
    567      1.1  jmcneill 	    APB1_GATING_REG, 4),
    568      1.1  jmcneill 	SUNXI_CCU_GATE(A10_CLK_APB1_SCR, "apb1-scr", "apb1",
    569      1.1  jmcneill 	    APB1_GATING_REG, 5),
    570      1.1  jmcneill 	SUNXI_CCU_GATE(A10_CLK_APB1_PS20, "apb1-ps20", "apb1",
    571      1.1  jmcneill 	    APB1_GATING_REG, 6),
    572      1.1  jmcneill 	SUNXI_CCU_GATE(A10_CLK_APB1_PS21, "apb1-ps21", "apb1",
    573      1.1  jmcneill 	    APB1_GATING_REG, 7),
    574      1.1  jmcneill 	SUNXI_CCU_GATE(A10_CLK_APB1_I2C4, "apb1-i2c4", "apb1",
    575      1.1  jmcneill 	    APB1_GATING_REG, 15),
    576      1.1  jmcneill 	SUNXI_CCU_GATE(A10_CLK_APB1_UART0, "apb1-uart0", "apb1",
    577      1.1  jmcneill 	    APB1_GATING_REG, 16),
    578      1.1  jmcneill 	SUNXI_CCU_GATE(A10_CLK_APB1_UART1, "apb1-uart1", "apb1",
    579      1.1  jmcneill 	    APB1_GATING_REG, 17),
    580      1.1  jmcneill 	SUNXI_CCU_GATE(A10_CLK_APB1_UART2, "apb1-uart2", "apb1",
    581      1.1  jmcneill 	    APB1_GATING_REG, 18),
    582      1.1  jmcneill 	SUNXI_CCU_GATE(A10_CLK_APB1_UART3, "apb1-uart3", "apb1",
    583      1.1  jmcneill 	    APB1_GATING_REG, 19),
    584      1.1  jmcneill 	SUNXI_CCU_GATE(A10_CLK_APB1_UART4, "apb1-uart4", "apb1",
    585      1.1  jmcneill 	    APB1_GATING_REG, 20),
    586      1.1  jmcneill 	SUNXI_CCU_GATE(A10_CLK_APB1_UART5, "apb1-uart5", "apb1",
    587      1.1  jmcneill 	    APB1_GATING_REG, 21),
    588      1.1  jmcneill 	SUNXI_CCU_GATE(A10_CLK_APB1_UART6, "apb1-uart6", "apb1",
    589      1.1  jmcneill 	    APB1_GATING_REG, 22),
    590      1.1  jmcneill 	SUNXI_CCU_GATE(A10_CLK_APB1_UART7, "apb1-uart7", "apb1",
    591      1.1  jmcneill 	    APB1_GATING_REG, 23),
    592      1.1  jmcneill 
    593  1.6.2.1  pgoyette 	/* DRAM GATING */
    594  1.6.2.1  pgoyette 	SUNXI_CCU_GATE(A10_CLK_DRAM_DE_BE0, "dram-de-be0", "pll_ddr_other",
    595  1.6.2.1  pgoyette 	    DRAM_GATING_REG, 26),
    596  1.6.2.1  pgoyette 	SUNXI_CCU_GATE(A10_CLK_DRAM_DE_BE1, "dram-de-be1", "pll_ddr_other",
    597  1.6.2.1  pgoyette 	    DRAM_GATING_REG, 27),
    598  1.6.2.1  pgoyette 	SUNXI_CCU_GATE(A10_CLK_DRAM_DE_FE0, "dram-de-fe0", "pll_ddr_other",
    599  1.6.2.1  pgoyette 	    DRAM_GATING_REG, 25),
    600  1.6.2.1  pgoyette 	SUNXI_CCU_GATE(A10_CLK_DRAM_DE_FE1, "dram-de-fe1", "pll_ddr_other",
    601  1.6.2.1  pgoyette 	    DRAM_GATING_REG, 24),
    602  1.6.2.1  pgoyette 
    603      1.1  jmcneill 	/* AUDIO_CODEC_SCLK_CFG_REG */
    604      1.1  jmcneill 	SUNXI_CCU_GATE(A10_CLK_CODEC, "codec", "pll_audio",
    605      1.1  jmcneill 	    AUDIO_CODEC_SCLK_CFG_REG, 31),
    606      1.1  jmcneill 
    607      1.1  jmcneill 	/* USBPHY_CFG_REG */
    608      1.1  jmcneill 	SUNXI_CCU_GATE(A10_CLK_USB_OHCI0, "usb-ohci0", "osc24m",
    609      1.1  jmcneill 	    USBPHY_CFG_REG, 6),
    610      1.1  jmcneill 	SUNXI_CCU_GATE(A10_CLK_USB_OHCI1, "usb-ohci1", "osc24m",
    611      1.1  jmcneill 	    USBPHY_CFG_REG, 7),
    612      1.1  jmcneill 	SUNXI_CCU_GATE(A10_CLK_USB_PHY, "usb-phy", "osc24m",
    613      1.1  jmcneill 	    USBPHY_CFG_REG, 8),
    614      1.1  jmcneill };
    615      1.1  jmcneill 
    616  1.6.2.2  pgoyette /*
    617  1.6.2.2  pgoyette  * some special cases
    618  1.6.2.2  pgoyette  * hardcode lcd0 (tcon0) to pll3 and lcd1 (tcon1) to pll7.
    619  1.6.2.2  pgoyette  * compute pll rate based on desired pixel clock
    620  1.6.2.2  pgoyette  */
    621  1.6.2.2  pgoyette 
    622  1.6.2.2  pgoyette static int
    623  1.6.2.2  pgoyette sun4i_a10_ccu_lcd0ch0_set_rate(struct sunxi_ccu_softc *sc,
    624  1.6.2.2  pgoyette     struct sunxi_ccu_clk * clk, u_int rate)
    625  1.6.2.2  pgoyette {
    626  1.6.2.2  pgoyette 	int error;
    627  1.6.2.2  pgoyette 	error = sunxi_ccu_lcdxch0_set_rate(sc, clk,
    628  1.6.2.2  pgoyette 	    &sun4i_a10_ccu_clks[A10_CLK_PLL_VIDEO0],
    629  1.6.2.2  pgoyette 	    &sun4i_a10_ccu_clks[A10_CLK_PLL_VIDEO0_2X],
    630  1.6.2.2  pgoyette 	    rate);
    631  1.6.2.2  pgoyette 	return error;
    632  1.6.2.2  pgoyette }
    633  1.6.2.2  pgoyette 
    634  1.6.2.2  pgoyette static int
    635  1.6.2.2  pgoyette sun4i_a10_ccu_lcd1ch0_set_rate(struct sunxi_ccu_softc *sc,
    636  1.6.2.2  pgoyette     struct sunxi_ccu_clk * clk, u_int rate)
    637  1.6.2.2  pgoyette {
    638  1.6.2.2  pgoyette 	return sunxi_ccu_lcdxch0_set_rate(sc, clk,
    639  1.6.2.2  pgoyette 	    &sun4i_a10_ccu_clks[A10_CLK_PLL_VIDEO1],
    640  1.6.2.2  pgoyette 	    &sun4i_a10_ccu_clks[A10_CLK_PLL_VIDEO1_2X],
    641  1.6.2.2  pgoyette 	    rate);
    642  1.6.2.2  pgoyette }
    643  1.6.2.2  pgoyette 
    644  1.6.2.2  pgoyette static u_int
    645  1.6.2.2  pgoyette sun4i_a10_ccu_lcd0ch0_round_rate(struct sunxi_ccu_softc *sc,
    646  1.6.2.2  pgoyette     struct sunxi_ccu_clk * clk, u_int rate)
    647  1.6.2.2  pgoyette {
    648  1.6.2.2  pgoyette 	return sunxi_ccu_lcdxch0_round_rate(sc, clk,
    649  1.6.2.2  pgoyette 	    &sun4i_a10_ccu_clks[A10_CLK_PLL_VIDEO0],
    650  1.6.2.2  pgoyette 	    &sun4i_a10_ccu_clks[A10_CLK_PLL_VIDEO0_2X],
    651  1.6.2.2  pgoyette 	    rate);
    652  1.6.2.2  pgoyette }
    653  1.6.2.2  pgoyette 
    654  1.6.2.2  pgoyette static u_int
    655  1.6.2.2  pgoyette sun4i_a10_ccu_lcd1ch0_round_rate(struct sunxi_ccu_softc *sc,
    656  1.6.2.2  pgoyette     struct sunxi_ccu_clk * clk, u_int rate)
    657  1.6.2.2  pgoyette {
    658  1.6.2.2  pgoyette 	return sunxi_ccu_lcdxch0_round_rate(sc, clk,
    659  1.6.2.2  pgoyette 	    &sun4i_a10_ccu_clks[A10_CLK_PLL_VIDEO1],
    660  1.6.2.2  pgoyette 	    &sun4i_a10_ccu_clks[A10_CLK_PLL_VIDEO1_2X],
    661  1.6.2.2  pgoyette 	    rate);
    662  1.6.2.2  pgoyette }
    663  1.6.2.2  pgoyette 
    664  1.6.2.2  pgoyette static int
    665  1.6.2.2  pgoyette sun4i_a10_ccu_lcd0ch1_set_rate(struct sunxi_ccu_softc *sc,
    666  1.6.2.2  pgoyette     struct sunxi_ccu_clk * clk, u_int rate)
    667  1.6.2.2  pgoyette {
    668  1.6.2.2  pgoyette 	return sunxi_ccu_lcdxch1_set_rate(sc, clk,
    669  1.6.2.2  pgoyette 	    &sun4i_a10_ccu_clks[A10_CLK_PLL_VIDEO0],
    670  1.6.2.2  pgoyette 	    &sun4i_a10_ccu_clks[A10_CLK_PLL_VIDEO0_2X],
    671  1.6.2.2  pgoyette 	    rate);
    672  1.6.2.2  pgoyette }
    673  1.6.2.2  pgoyette 
    674  1.6.2.2  pgoyette static int
    675  1.6.2.2  pgoyette sun4i_a10_ccu_lcd1ch1_set_rate(struct sunxi_ccu_softc *sc,
    676  1.6.2.2  pgoyette     struct sunxi_ccu_clk * clk, u_int rate)
    677  1.6.2.2  pgoyette {
    678  1.6.2.2  pgoyette 	return sunxi_ccu_lcdxch1_set_rate(sc, clk,
    679  1.6.2.2  pgoyette 	    &sun4i_a10_ccu_clks[A10_CLK_PLL_VIDEO1],
    680  1.6.2.2  pgoyette 	    &sun4i_a10_ccu_clks[A10_CLK_PLL_VIDEO1_2X],
    681  1.6.2.2  pgoyette 	    rate);
    682  1.6.2.2  pgoyette }
    683  1.6.2.2  pgoyette 
    684  1.6.2.2  pgoyette #if 0
    685  1.6.2.2  pgoyette static int
    686  1.6.2.2  pgoyette sun4i_a10_ccu_lcdxch0_set_rate(struct sunxi_ccu_softc *sc,
    687  1.6.2.2  pgoyette     struct sunxi_ccu_clk * clk, u_int rate, int unit)
    688  1.6.2.2  pgoyette {
    689  1.6.2.2  pgoyette 	int parent_index;
    690  1.6.2.2  pgoyette 	struct clk *clkp;
    691  1.6.2.2  pgoyette 	int error;
    692  1.6.2.2  pgoyette 
    693  1.6.2.2  pgoyette 	parent_index = (unit == 0) ? A10_CLK_PLL_VIDEO0 : A10_CLK_PLL_VIDEO1;
    694  1.6.2.2  pgoyette 	clkp = &sun4i_a10_ccu_clks[parent_index].base;
    695  1.6.2.2  pgoyette 	error = clk_set_rate(clkp, rate);
    696  1.6.2.2  pgoyette 	if (error) {
    697  1.6.2.2  pgoyette 		error = clk_set_rate(clkp, rate / 2);
    698  1.6.2.2  pgoyette 		if (error != 0)
    699  1.6.2.2  pgoyette 			return error;
    700  1.6.2.2  pgoyette 		parent_index =
    701  1.6.2.2  pgoyette 		    (unit == 0) ? A10_CLK_PLL_VIDEO0_2X : A10_CLK_PLL_VIDEO1_2X;
    702  1.6.2.2  pgoyette 		clkp = &sun4i_a10_ccu_clks[parent_index].base;
    703  1.6.2.2  pgoyette 	}
    704  1.6.2.2  pgoyette 	error = clk_set_parent(&clk->base, clkp);
    705  1.6.2.2  pgoyette 	KASSERT(error == 0);
    706  1.6.2.2  pgoyette 	return error;
    707  1.6.2.2  pgoyette }
    708  1.6.2.2  pgoyette 
    709  1.6.2.2  pgoyette static u_int
    710  1.6.2.2  pgoyette sun4i_a10_ccu_lcdxch0_round_rate(struct sunxi_ccu_softc *sc,
    711  1.6.2.2  pgoyette     struct sunxi_ccu_clk * clk, u_int try_rate, int unit)
    712  1.6.2.2  pgoyette {
    713  1.6.2.2  pgoyette 	int parent_index;
    714  1.6.2.2  pgoyette 	struct clk *clkp;
    715  1.6.2.2  pgoyette 	int diff, diff_x2;
    716  1.6.2.2  pgoyette 	int rate, rate_x2;
    717  1.6.2.2  pgoyette 
    718  1.6.2.2  pgoyette 	parent_index = (unit == 0) ? A10_CLK_PLL_VIDEO0 : A10_CLK_PLL_VIDEO1;
    719  1.6.2.2  pgoyette 	clkp = &sun4i_a10_ccu_clks[parent_index].base;
    720  1.6.2.2  pgoyette 	rate = clk_round_rate(clkp, try_rate);
    721  1.6.2.2  pgoyette 	diff = abs(try_rate - rate);
    722  1.6.2.2  pgoyette 
    723  1.6.2.2  pgoyette 	rate_x2 = (clk_round_rate(clkp, try_rate / 2) * 2);
    724  1.6.2.2  pgoyette 	diff_x2 = abs(try_rate - rate_x2);
    725  1.6.2.2  pgoyette 
    726  1.6.2.2  pgoyette 	if (diff_x2 < diff)
    727  1.6.2.2  pgoyette 		return rate_x2;
    728  1.6.2.2  pgoyette 	return rate;
    729  1.6.2.2  pgoyette }
    730  1.6.2.2  pgoyette 
    731  1.6.2.2  pgoyette static void
    732  1.6.2.2  pgoyette sun4i_a10_tcon_calc_pll(int f_ref, int f_out, int *pm, int *pn, int *pd)
    733  1.6.2.2  pgoyette {
    734  1.6.2.2  pgoyette 	int best = INT_MAX;
    735  1.6.2.2  pgoyette 	for (int d = 1; d <= 2 && best != 0; d++) {
    736  1.6.2.2  pgoyette 		for (int m = 1; m <= 16 && best != 0; m++) {
    737  1.6.2.2  pgoyette 			for (int n = 9; n <= 127 && best != 0; n++) {
    738  1.6.2.2  pgoyette 				int f_cur = (n * f_ref * d) / m;
    739  1.6.2.2  pgoyette 				int diff = abs(f_out - f_cur);
    740  1.6.2.2  pgoyette 				if (diff < best) {
    741  1.6.2.2  pgoyette 					best = diff;
    742  1.6.2.2  pgoyette 					*pm = m;
    743  1.6.2.2  pgoyette 					*pn = n;
    744  1.6.2.2  pgoyette 					*pd = d;
    745  1.6.2.2  pgoyette 					if (diff == 0)
    746  1.6.2.2  pgoyette 						return;
    747  1.6.2.2  pgoyette 				}
    748  1.6.2.2  pgoyette 			}
    749  1.6.2.2  pgoyette 		}
    750  1.6.2.2  pgoyette 	}
    751  1.6.2.2  pgoyette }
    752  1.6.2.2  pgoyette 
    753  1.6.2.2  pgoyette static int
    754  1.6.2.2  pgoyette sun4i_a10_ccu_lcdxch1_set_rate(struct sunxi_ccu_softc *sc,
    755  1.6.2.2  pgoyette     struct sunxi_ccu_clk *clk, u_int rate, int unit)
    756  1.6.2.2  pgoyette {
    757  1.6.2.2  pgoyette 	int parent_index;
    758  1.6.2.2  pgoyette 	struct clk *clkp, *pllclk;
    759  1.6.2.2  pgoyette 	int error;
    760  1.6.2.2  pgoyette         int n = 0, m = 0, d = 0;
    761  1.6.2.2  pgoyette 
    762  1.6.2.2  pgoyette 	parent_index = (unit == 0) ? A10_CLK_PLL_VIDEO0 : A10_CLK_PLL_VIDEO1;
    763  1.6.2.2  pgoyette 	clkp = &sun4i_a10_ccu_clks[parent_index].base;
    764  1.6.2.2  pgoyette 	pllclk = clkp;
    765  1.6.2.2  pgoyette 
    766  1.6.2.2  pgoyette         sun4i_a10_tcon_calc_pll(3000000, rate, &m, &n, &d);
    767  1.6.2.2  pgoyette 
    768  1.6.2.2  pgoyette         if (n == 0 || m == 0 || d == 0)
    769  1.6.2.2  pgoyette 		return ERANGE;
    770  1.6.2.2  pgoyette 
    771  1.6.2.2  pgoyette         if (d == 2) {
    772  1.6.2.2  pgoyette 		parent_index =
    773  1.6.2.2  pgoyette 		    (unit == 0) ? A10_CLK_PLL_VIDEO0_2X : A10_CLK_PLL_VIDEO1_2X;
    774  1.6.2.2  pgoyette 		clkp = &sun4i_a10_ccu_clks[parent_index].base;
    775  1.6.2.2  pgoyette         }
    776  1.6.2.2  pgoyette 
    777  1.6.2.2  pgoyette 	error = clk_set_rate(pllclk, 3000000 * n);
    778  1.6.2.2  pgoyette 	KASSERT(error == 0);
    779  1.6.2.2  pgoyette 	error = clk_set_parent(&clk->base, clkp);
    780  1.6.2.2  pgoyette 	KASSERT(error == 0);
    781  1.6.2.2  pgoyette 	error = sunxi_ccu_div_set_rate(sc, clk, rate);
    782  1.6.2.2  pgoyette 	KASSERT(error == 0);
    783  1.6.2.2  pgoyette 	return error;
    784  1.6.2.2  pgoyette }
    785  1.6.2.2  pgoyette #endif
    786  1.6.2.2  pgoyette 
    787      1.1  jmcneill static int
    788      1.1  jmcneill sun4i_a10_ccu_match(device_t parent, cfdata_t cf, void *aux)
    789      1.1  jmcneill {
    790      1.1  jmcneill 	struct fdt_attach_args * const faa = aux;
    791      1.1  jmcneill 
    792      1.1  jmcneill 	return of_match_compat_data(faa->faa_phandle, compat_data);
    793      1.1  jmcneill }
    794      1.1  jmcneill 
    795  1.6.2.2  pgoyette static struct sunxi_ccu_softc *sc0;
    796      1.1  jmcneill static void
    797      1.1  jmcneill sun4i_a10_ccu_attach(device_t parent, device_t self, void *aux)
    798      1.1  jmcneill {
    799      1.1  jmcneill 	struct sunxi_ccu_softc * const sc = device_private(self);
    800      1.1  jmcneill 	struct fdt_attach_args * const faa = aux;
    801      1.1  jmcneill 	enum sun4i_a10_ccu_type type;
    802  1.6.2.2  pgoyette 	struct clk *clk, *clkp;
    803  1.6.2.2  pgoyette 	int error;
    804      1.1  jmcneill 
    805      1.1  jmcneill 	sc->sc_dev = self;
    806      1.1  jmcneill 	sc->sc_phandle = faa->faa_phandle;
    807      1.1  jmcneill 	sc->sc_bst = faa->faa_bst;
    808      1.1  jmcneill 
    809      1.1  jmcneill 	sc->sc_resets = sun4i_a10_ccu_resets;
    810      1.1  jmcneill 	sc->sc_nresets = __arraycount(sun4i_a10_ccu_resets);
    811      1.1  jmcneill 
    812      1.1  jmcneill 	sc->sc_clks = sun4i_a10_ccu_clks;
    813      1.1  jmcneill 	sc->sc_nclks = __arraycount(sun4i_a10_ccu_clks);
    814      1.1  jmcneill 
    815      1.1  jmcneill 	if (sunxi_ccu_attach(sc) != 0)
    816      1.1  jmcneill 		return;
    817      1.1  jmcneill 
    818      1.1  jmcneill 	aprint_naive("\n");
    819      1.1  jmcneill 
    820      1.1  jmcneill 	type = of_search_compatible(faa->faa_phandle, compat_data)->data;
    821      1.1  jmcneill 
    822      1.1  jmcneill 	switch (type) {
    823      1.1  jmcneill 	case CCU_A10:
    824      1.1  jmcneill 		aprint_normal(": A10 CCU\n");
    825      1.1  jmcneill 		break;
    826      1.1  jmcneill 	case CCU_A20:
    827      1.1  jmcneill 		aprint_normal(": A20 CCU\n");
    828      1.1  jmcneill 		break;
    829      1.1  jmcneill 	}
    830  1.6.2.2  pgoyette 	/* hardcode debe clocks parent to PLL5 */
    831  1.6.2.2  pgoyette 	clkp = &sun4i_a10_ccu_clks[A10_CLK_PLL_DDR_BASE].base;
    832  1.6.2.2  pgoyette 	clk =  &sun4i_a10_ccu_clks[A10_CLK_DE_BE0].base;
    833  1.6.2.2  pgoyette 	error = clk_set_parent(clk, clkp);
    834  1.6.2.2  pgoyette 	KASSERT(error == 0);
    835  1.6.2.2  pgoyette 	clk =  &sun4i_a10_ccu_clks[A10_CLK_DE_BE1].base;
    836  1.6.2.2  pgoyette 	error = clk_set_parent(clk, clkp);
    837  1.6.2.2  pgoyette 	KASSERT(error == 0);
    838      1.1  jmcneill 
    839  1.6.2.2  pgoyette 	(void)error;
    840      1.1  jmcneill 	sunxi_ccu_print(sc);
    841  1.6.2.2  pgoyette 	sc0 = sc;
    842  1.6.2.2  pgoyette }
    843  1.6.2.2  pgoyette 
    844  1.6.2.2  pgoyette void sun4i_ccu_print(void);
    845  1.6.2.2  pgoyette void
    846  1.6.2.2  pgoyette sun4i_ccu_print(void)
    847  1.6.2.2  pgoyette {
    848  1.6.2.2  pgoyette 	sunxi_ccu_print(sc0);
    849      1.1  jmcneill }
    850