Home | History | Annotate | Line # | Download | only in sunxi
sun5i_a13_ccu.c revision 1.3
      1  1.3  jmcneill /* $NetBSD: sun5i_a13_ccu.c,v 1.3 2017/08/27 17:53:31 jmcneill 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.3  jmcneill __KERNEL_RCSID(1, "$NetBSD: sun5i_a13_ccu.c,v 1.3 2017/08/27 17:53:31 jmcneill 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/sun5i_a13_ccu.h>
     42  1.1  jmcneill 
     43  1.1  jmcneill #define	PLL1_CFG_REG		0x000
     44  1.2  jmcneill #define	PLL2_CFG_REG		0x008
     45  1.1  jmcneill #define	PLL6_CFG_REG		0x028
     46  1.1  jmcneill #define	OSC24M_CFG_REG		0x050
     47  1.1  jmcneill #define	CPU_AHB_APB0_CFG_REG	0x054
     48  1.1  jmcneill #define	APB1_CLK_DIV_REG	0x058
     49  1.1  jmcneill #define	AHB_GATING_REG0		0x060
     50  1.1  jmcneill #define	AHB_GATING_REG1		0x064
     51  1.1  jmcneill #define	APB0_GATING_REG		0x068
     52  1.1  jmcneill #define	APB1_GATING_REG		0x06c
     53  1.3  jmcneill #define	SD0_SCLK_CFG_REG        0x088
     54  1.3  jmcneill #define	SD1_SCLK_CFG_REG        0x08c
     55  1.3  jmcneill #define	SD2_SCLK_CFG_REG        0x090
     56  1.1  jmcneill #define	USBPHY_CFG_REG		0x0cc
     57  1.1  jmcneill #define	BE_CFG_REG		0x104
     58  1.1  jmcneill #define	FE_CFG_REG		0x10c
     59  1.1  jmcneill #define	CSI_CFG_REG		0x134
     60  1.1  jmcneill #define	VE_CFG_REG		0x13c
     61  1.2  jmcneill #define	AUDIO_CODEC_SCLK_CFG_REG 0x140
     62  1.1  jmcneill #define	MALI_CLOCK_CFG_REG	0x154
     63  1.1  jmcneill #define	IEP_SCLK_CFG_REG	0x160
     64  1.1  jmcneill 
     65  1.1  jmcneill static int sun5i_a13_ccu_match(device_t, cfdata_t, void *);
     66  1.1  jmcneill static void sun5i_a13_ccu_attach(device_t, device_t, void *);
     67  1.1  jmcneill 
     68  1.1  jmcneill static const char * const compatible[] = {
     69  1.1  jmcneill 	"allwinner,sun5i-a13-ccu",
     70  1.1  jmcneill 	NULL
     71  1.1  jmcneill };
     72  1.1  jmcneill 
     73  1.1  jmcneill CFATTACH_DECL_NEW(sunxi_a13_ccu, sizeof(struct sunxi_ccu_softc),
     74  1.1  jmcneill 	sun5i_a13_ccu_match, sun5i_a13_ccu_attach, NULL, NULL);
     75  1.1  jmcneill 
     76  1.1  jmcneill static struct sunxi_ccu_reset sun5i_a13_ccu_resets[] = {
     77  1.1  jmcneill 	SUNXI_CCU_RESET(A13_RST_USB_PHY0, USBPHY_CFG_REG, 0),
     78  1.1  jmcneill 	SUNXI_CCU_RESET(A13_RST_USB_PHY1, USBPHY_CFG_REG, 1),
     79  1.1  jmcneill 
     80  1.1  jmcneill 	/* Missing: GPS */
     81  1.1  jmcneill 
     82  1.1  jmcneill 	SUNXI_CCU_RESET(A13_RST_DE_BE, BE_CFG_REG, 30),
     83  1.1  jmcneill 
     84  1.1  jmcneill 	SUNXI_CCU_RESET(A13_RST_DE_FE, FE_CFG_REG, 30),
     85  1.1  jmcneill 
     86  1.1  jmcneill 	/* Missing: TVE */
     87  1.1  jmcneill 
     88  1.1  jmcneill 	/* Missing: LCD */
     89  1.1  jmcneill 
     90  1.1  jmcneill 	SUNXI_CCU_RESET(A13_RST_CSI, CSI_CFG_REG, 30),
     91  1.1  jmcneill 
     92  1.1  jmcneill 	SUNXI_CCU_RESET(A13_RST_VE, VE_CFG_REG, 0),
     93  1.1  jmcneill 
     94  1.1  jmcneill 	SUNXI_CCU_RESET(A13_RST_GPU, MALI_CLOCK_CFG_REG, 30),
     95  1.1  jmcneill 
     96  1.1  jmcneill 	SUNXI_CCU_RESET(A13_RST_IEP, IEP_SCLK_CFG_REG, 30),
     97  1.1  jmcneill };
     98  1.1  jmcneill 
     99  1.1  jmcneill static const char *cpu_parents[] = { "losc", "osc24m", "pll_core", "pll_periph" };
    100  1.1  jmcneill static const char *axi_parents[] = { "cpu" };
    101  1.3  jmcneill static const char *ahb_parents[] = { "axi", "cpu", "pll_periph" };
    102  1.1  jmcneill static const char *apb0_parents[] = { "ahb" };
    103  1.3  jmcneill static const char *apb1_parents[] = { "osc24m", "pll_periph", "losc" };
    104  1.3  jmcneill static const char *mod_parents[] = { "osc24m", "pll_periph", "pll_ddr" };
    105  1.1  jmcneill 
    106  1.2  jmcneill static const struct sunxi_ccu_nkmp_tbl sun5i_a13_ac_dig_table[] = {
    107  1.2  jmcneill 	{ 24576000, 86, 0, 21, 3 },
    108  1.2  jmcneill 	{ 0 }
    109  1.2  jmcneill };
    110  1.2  jmcneill 
    111  1.1  jmcneill static struct sunxi_ccu_clk sun5i_a13_ccu_clks[] = {
    112  1.1  jmcneill 	SUNXI_CCU_GATE(A13_CLK_HOSC, "osc24m", "hosc",
    113  1.1  jmcneill 	    OSC24M_CFG_REG, 0),
    114  1.1  jmcneill 
    115  1.1  jmcneill 	SUNXI_CCU_NKMP(A13_CLK_PLL_CORE, "pll_core", "osc24m",
    116  1.1  jmcneill 	    PLL1_CFG_REG,		/* reg */
    117  1.1  jmcneill 	    __BITS(12,8),		/* n */
    118  1.1  jmcneill 	    __BITS(5,4), 		/* k */
    119  1.1  jmcneill 	    __BITS(1,0),		/* m */
    120  1.1  jmcneill 	    __BITS(17,16),		/* p */
    121  1.1  jmcneill 	    __BIT(31),			/* enable */
    122  1.1  jmcneill 	    SUNXI_CCU_NKMP_FACTOR_P_POW2 | SUNXI_CCU_NKMP_FACTOR_N_EXACT),
    123  1.1  jmcneill 
    124  1.2  jmcneill 	SUNXI_CCU_NKMP_TABLE(A13_CLK_PLL_AUDIO_BASE, "pll_audio", "osc24m",
    125  1.2  jmcneill 	    PLL2_CFG_REG,		/* reg */
    126  1.2  jmcneill 	    __BITS(14,8),		/* n */
    127  1.2  jmcneill 	    0,				/* k */
    128  1.2  jmcneill 	    __BITS(4,0),		/* m */
    129  1.2  jmcneill 	    __BITS(29,26),		/* p */
    130  1.2  jmcneill 	    __BIT(31),			/* enable */
    131  1.2  jmcneill 	    0,				/* lock */
    132  1.2  jmcneill 	    sun5i_a13_ac_dig_table,	/* table */
    133  1.2  jmcneill 	    0),
    134  1.2  jmcneill 
    135  1.1  jmcneill 	SUNXI_CCU_NKMP(A13_CLK_PERIPH, "pll_periph", "osc24m",
    136  1.1  jmcneill 	    PLL6_CFG_REG,		/* reg */
    137  1.1  jmcneill 	    __BITS(12,8),		/* n */
    138  1.1  jmcneill 	    __BITS(5,4), 		/* k */
    139  1.1  jmcneill 	    __BITS(1,0),		/* m */
    140  1.1  jmcneill 	    0,				/* p */
    141  1.1  jmcneill 	    __BIT(31),			/* enable */
    142  1.1  jmcneill 	    SUNXI_CCU_NKMP_DIVIDE_BY_TWO | SUNXI_CCU_NKMP_FACTOR_N_EXACT),
    143  1.1  jmcneill 
    144  1.1  jmcneill 	SUNXI_CCU_PREDIV_FIXED(A13_CLK_CPU, "cpu", cpu_parents,
    145  1.1  jmcneill 	    CPU_AHB_APB0_CFG_REG,	/* reg */
    146  1.1  jmcneill 	    0,				/* prediv */
    147  1.1  jmcneill 	    __BIT(3),			/* prediv_sel */
    148  1.1  jmcneill 	    6,				/* prediv_fixed */
    149  1.1  jmcneill 	    0,				/* div */
    150  1.1  jmcneill 	    __BITS(17,16),		/* sel */
    151  1.1  jmcneill 	    0),
    152  1.1  jmcneill 
    153  1.1  jmcneill 	SUNXI_CCU_DIV(A13_CLK_AXI, "axi", axi_parents,
    154  1.1  jmcneill 	    CPU_AHB_APB0_CFG_REG,	/* reg */
    155  1.1  jmcneill 	    __BITS(1,0),		/* div */
    156  1.1  jmcneill 	    0,				/* sel */
    157  1.1  jmcneill 	    0),
    158  1.1  jmcneill 
    159  1.1  jmcneill 	SUNXI_CCU_DIV(A13_CLK_AHB, "ahb", ahb_parents,
    160  1.1  jmcneill 	    CPU_AHB_APB0_CFG_REG,	/* reg */
    161  1.1  jmcneill 	    0,				/* div */
    162  1.1  jmcneill 	    __BITS(5,4),		/* sel */
    163  1.1  jmcneill 	    SUNXI_CCU_DIV_POWER_OF_TWO),
    164  1.1  jmcneill 
    165  1.1  jmcneill 	SUNXI_CCU_DIV(A13_CLK_APB0, "apb0", apb0_parents,
    166  1.1  jmcneill 	    CPU_AHB_APB0_CFG_REG,	/* reg */
    167  1.1  jmcneill 	    __BITS(9,8),		/* div */
    168  1.1  jmcneill 	    0,				/* sel */
    169  1.1  jmcneill 	    SUNXI_CCU_DIV_ZERO_IS_ONE | SUNXI_CCU_DIV_POWER_OF_TWO),
    170  1.1  jmcneill 
    171  1.1  jmcneill 	SUNXI_CCU_NM(A13_CLK_APB1, "apb1", apb1_parents,
    172  1.1  jmcneill 	    APB1_CLK_DIV_REG,		/* reg */
    173  1.1  jmcneill 	    __BITS(17,16),		/* n */
    174  1.1  jmcneill 	    __BITS(4,0),		/* m */
    175  1.1  jmcneill 	    __BITS(25,24),		/* sel */
    176  1.1  jmcneill 	    0,				/* enable */
    177  1.1  jmcneill 	    SUNXI_CCU_NM_POWER_OF_TWO),
    178  1.1  jmcneill 
    179  1.3  jmcneill 	SUNXI_CCU_NM(A13_CLK_MMC0, "mmc0", mod_parents,
    180  1.3  jmcneill 	    SD0_SCLK_CFG_REG,		/* reg */
    181  1.3  jmcneill 	    __BITS(17,16),		/* n */
    182  1.3  jmcneill 	    __BITS(3,0),		/* m */
    183  1.3  jmcneill 	    __BITS(25,24),		/* sel */
    184  1.3  jmcneill 	    __BIT(31),			/* enable */
    185  1.3  jmcneill 	    SUNXI_CCU_NM_POWER_OF_TWO),
    186  1.3  jmcneill 	SUNXI_CCU_NM(A13_CLK_MMC1, "mmc1", mod_parents,
    187  1.3  jmcneill 	    SD1_SCLK_CFG_REG,		/* reg */
    188  1.3  jmcneill 	    __BITS(17,16),		/* n */
    189  1.3  jmcneill 	    __BITS(3,0),		/* m */
    190  1.3  jmcneill 	    __BITS(25,24),		/* sel */
    191  1.3  jmcneill 	    __BIT(31),			/* enable */
    192  1.3  jmcneill 	    SUNXI_CCU_NM_POWER_OF_TWO),
    193  1.3  jmcneill 	SUNXI_CCU_NM(A13_CLK_MMC2, "mmc2", mod_parents,
    194  1.3  jmcneill 	    SD2_SCLK_CFG_REG,		/* reg */
    195  1.3  jmcneill 	    __BITS(17,16),		/* n */
    196  1.3  jmcneill 	    __BITS(3,0),		/* m */
    197  1.3  jmcneill 	    __BITS(25,24),		/* sel */
    198  1.3  jmcneill 	    __BIT(31),			/* enable */
    199  1.3  jmcneill 	    SUNXI_CCU_NM_POWER_OF_TWO),
    200  1.3  jmcneill 
    201  1.1  jmcneill 	/* AHB_GATING_REG0. Missing: SS, EMAC, TS, GPS */
    202  1.1  jmcneill 	SUNXI_CCU_GATE(A13_CLK_AHB_OTG, "ahb-otg", "ahb",
    203  1.1  jmcneill 	    AHB_GATING_REG0, 0),
    204  1.1  jmcneill 	SUNXI_CCU_GATE(A13_CLK_AHB_EHCI, "ahb-ehci", "ahb",
    205  1.1  jmcneill 	    AHB_GATING_REG0, 1),
    206  1.1  jmcneill 	SUNXI_CCU_GATE(A13_CLK_AHB_OHCI, "ahb-ohci", "ahb",
    207  1.1  jmcneill 	    AHB_GATING_REG0, 2),
    208  1.1  jmcneill 	SUNXI_CCU_GATE(A13_CLK_AHB_DMA, "ahb-dma", "ahb",
    209  1.1  jmcneill 	    AHB_GATING_REG0, 6),
    210  1.1  jmcneill 	SUNXI_CCU_GATE(A13_CLK_AHB_BIST, "ahb-bist", "ahb",
    211  1.1  jmcneill 	    AHB_GATING_REG0, 7),
    212  1.1  jmcneill 	SUNXI_CCU_GATE(A13_CLK_AHB_MMC0, "ahb-mmc0", "ahb",
    213  1.1  jmcneill 	    AHB_GATING_REG0, 8),
    214  1.1  jmcneill 	SUNXI_CCU_GATE(A13_CLK_AHB_MMC1, "ahb-mmc1", "ahb",
    215  1.1  jmcneill 	    AHB_GATING_REG0, 9),
    216  1.1  jmcneill 	SUNXI_CCU_GATE(A13_CLK_AHB_MMC2, "ahb-mmc2", "ahb",
    217  1.1  jmcneill 	    AHB_GATING_REG0, 10),
    218  1.1  jmcneill 	SUNXI_CCU_GATE(A13_CLK_AHB_NAND, "ahb-nand", "ahb",
    219  1.1  jmcneill 	    AHB_GATING_REG0, 13),
    220  1.1  jmcneill 	SUNXI_CCU_GATE(A13_CLK_AHB_SDRAM, "ahb-sdram", "ahb",
    221  1.1  jmcneill 	    AHB_GATING_REG0, 14),
    222  1.1  jmcneill 	SUNXI_CCU_GATE(A13_CLK_AHB_SPI0, "ahb-spi0", "ahb",
    223  1.1  jmcneill 	    AHB_GATING_REG0, 20),
    224  1.1  jmcneill 	SUNXI_CCU_GATE(A13_CLK_AHB_SPI1, "ahb-spi1", "ahb",
    225  1.1  jmcneill 	    AHB_GATING_REG0, 21),
    226  1.1  jmcneill 	SUNXI_CCU_GATE(A13_CLK_AHB_SPI2, "ahb-spi2", "ahb",
    227  1.1  jmcneill 	    AHB_GATING_REG0, 22),
    228  1.1  jmcneill 	SUNXI_CCU_GATE(A13_CLK_AHB_HSTIMER, "ahb-hstimer", "ahb",
    229  1.1  jmcneill 	    AHB_GATING_REG0, 28),
    230  1.1  jmcneill 
    231  1.1  jmcneill 	/* AHB_GATING_REG1. Missing: TVE, HDMI */
    232  1.1  jmcneill 	SUNXI_CCU_GATE(A13_CLK_AHB_VE, "ahb-ve", "ahb",
    233  1.1  jmcneill 	    AHB_GATING_REG1, 0),
    234  1.1  jmcneill 	SUNXI_CCU_GATE(A13_CLK_AHB_LCD, "ahb-lcd", "ahb",
    235  1.1  jmcneill 	    AHB_GATING_REG1, 4),
    236  1.1  jmcneill 	SUNXI_CCU_GATE(A13_CLK_AHB_CSI, "ahb-csi", "ahb",
    237  1.1  jmcneill 	    AHB_GATING_REG1, 8),
    238  1.1  jmcneill 	SUNXI_CCU_GATE(A13_CLK_AHB_DE_BE, "ahb-de_be", "ahb",
    239  1.1  jmcneill 	    AHB_GATING_REG1, 12),
    240  1.1  jmcneill 	SUNXI_CCU_GATE(A13_CLK_AHB_DE_FE, "ahb-de_fe", "ahb",
    241  1.1  jmcneill 	    AHB_GATING_REG1, 14),
    242  1.1  jmcneill 	SUNXI_CCU_GATE(A13_CLK_AHB_IEP, "ahb-iep", "ahb",
    243  1.1  jmcneill 	    AHB_GATING_REG1, 19),
    244  1.1  jmcneill 	SUNXI_CCU_GATE(A13_CLK_AHB_GPU, "ahb-gpu", "ahb",
    245  1.1  jmcneill 	    AHB_GATING_REG1, 20),
    246  1.1  jmcneill 
    247  1.1  jmcneill 	/* APB0_GATING_REG. Missing: SPDIF, I2S, KEYPAD */
    248  1.1  jmcneill 	SUNXI_CCU_GATE(A13_CLK_APB0_CODEC, "apb0-codec", "apb0",
    249  1.1  jmcneill 	    APB0_GATING_REG, 0),
    250  1.1  jmcneill 	SUNXI_CCU_GATE(A13_CLK_APB0_PIO, "apb0-pio", "apb0",
    251  1.1  jmcneill 	    APB0_GATING_REG, 5),
    252  1.1  jmcneill 	SUNXI_CCU_GATE(A13_CLK_APB0_IR, "apb0-ir", "apb0",
    253  1.1  jmcneill 	    APB0_GATING_REG, 6),
    254  1.1  jmcneill 
    255  1.1  jmcneill 	/* APB1_GATING_REG. Missing: UART0, UART2 */
    256  1.1  jmcneill 	SUNXI_CCU_GATE(A13_CLK_APB1_I2C0, "apb1-i2c0", "apb1",
    257  1.1  jmcneill 	    APB1_GATING_REG, 0),
    258  1.1  jmcneill 	SUNXI_CCU_GATE(A13_CLK_APB1_I2C1, "apb1-i2c1", "apb1",
    259  1.1  jmcneill 	    APB1_GATING_REG, 1),
    260  1.1  jmcneill 	SUNXI_CCU_GATE(A13_CLK_APB1_I2C2, "apb1-i2c2", "apb1",
    261  1.1  jmcneill 	    APB1_GATING_REG, 2),
    262  1.1  jmcneill 	SUNXI_CCU_GATE(A13_CLK_APB1_UART1, "apb1-uart1", "apb1",
    263  1.1  jmcneill 	    APB1_GATING_REG, 17),
    264  1.1  jmcneill 	SUNXI_CCU_GATE(A13_CLK_APB1_UART3, "apb1-uart3", "apb1",
    265  1.1  jmcneill 	    APB1_GATING_REG, 19),
    266  1.1  jmcneill 
    267  1.2  jmcneill 	/* AUDIO_CODEC_SCLK_CFG_REG */
    268  1.2  jmcneill 	SUNXI_CCU_GATE(A13_CLK_CODEC, "codec", "pll_audio",
    269  1.2  jmcneill 	    AUDIO_CODEC_SCLK_CFG_REG, 31),
    270  1.2  jmcneill 
    271  1.1  jmcneill 	/* USBPHY_CFG_REG */
    272  1.1  jmcneill 	SUNXI_CCU_GATE(A13_CLK_USB_OHCI, "usb-ohci", "osc24m",
    273  1.1  jmcneill 	    USBPHY_CFG_REG, 6),
    274  1.1  jmcneill 	SUNXI_CCU_GATE(A13_CLK_USB_PHY0, "usb-phy0", "osc24m",
    275  1.1  jmcneill 	    USBPHY_CFG_REG, 8),
    276  1.1  jmcneill 	SUNXI_CCU_GATE(A13_CLK_USB_PHY1, "usb-phy1", "osc24m",
    277  1.1  jmcneill 	    USBPHY_CFG_REG, 9),
    278  1.1  jmcneill };
    279  1.1  jmcneill 
    280  1.1  jmcneill static int
    281  1.1  jmcneill sun5i_a13_ccu_match(device_t parent, cfdata_t cf, void *aux)
    282  1.1  jmcneill {
    283  1.1  jmcneill 	struct fdt_attach_args * const faa = aux;
    284  1.1  jmcneill 
    285  1.1  jmcneill 	return of_match_compatible(faa->faa_phandle, compatible);
    286  1.1  jmcneill }
    287  1.1  jmcneill 
    288  1.1  jmcneill static void
    289  1.1  jmcneill sun5i_a13_ccu_attach(device_t parent, device_t self, void *aux)
    290  1.1  jmcneill {
    291  1.1  jmcneill 	struct sunxi_ccu_softc * const sc = device_private(self);
    292  1.1  jmcneill 	struct fdt_attach_args * const faa = aux;
    293  1.1  jmcneill 
    294  1.1  jmcneill 	sc->sc_dev = self;
    295  1.1  jmcneill 	sc->sc_phandle = faa->faa_phandle;
    296  1.1  jmcneill 	sc->sc_bst = faa->faa_bst;
    297  1.1  jmcneill 
    298  1.1  jmcneill 	sc->sc_resets = sun5i_a13_ccu_resets;
    299  1.1  jmcneill 	sc->sc_nresets = __arraycount(sun5i_a13_ccu_resets);
    300  1.1  jmcneill 
    301  1.1  jmcneill 	sc->sc_clks = sun5i_a13_ccu_clks;
    302  1.1  jmcneill 	sc->sc_nclks = __arraycount(sun5i_a13_ccu_clks);
    303  1.1  jmcneill 
    304  1.1  jmcneill 	if (sunxi_ccu_attach(sc) != 0)
    305  1.1  jmcneill 		return;
    306  1.1  jmcneill 
    307  1.1  jmcneill 	aprint_naive("\n");
    308  1.1  jmcneill 	aprint_normal(": A13 CCU\n");
    309  1.1  jmcneill 
    310  1.1  jmcneill 	sunxi_ccu_print(sc);
    311  1.1  jmcneill }
    312