2 * (C) Copyright 2007-2012
3 * Allwinner Technology Co., Ltd. <www.allwinnertech.com>
4 * Tom Cubie <tangliang@allwinnertech.com>
6 * (C) Copyright 2013 Luke Kenneth Casson Leighton <lkcl@lkcl.net>
8 * SPDX-License-Identifier: GPL-2.0+
13 #include <asm/arch/clock.h>
14 #include <asm/arch/gpio.h>
15 #include <asm/arch/prcm.h>
16 #include <asm/arch/gtbus.h>
17 #include <asm/arch/sys_proto.h>
19 __weak void clock_init_sec(void)
23 __weak void gtbus_init(void)
29 #ifdef CONFIG_SPL_BUILD
39 /* These functions are shared between various SoCs so put them here. */
40 #if defined CONFIG_SUNXI_GEN_SUN6I && !defined CONFIG_MACH_SUN9I
41 int clock_twi_onoff(int port, int state)
43 struct sunxi_ccm_reg *const ccm =
44 (struct sunxi_ccm_reg *)SUNXI_CCM_BASE;
49 PRCM_APB0_GATE_PIO | PRCM_APB0_GATE_I2C);
52 PRCM_APB0_GATE_PIO | PRCM_APB0_GATE_I2C);
56 /* set the apb clock gate and reset for twi */
58 setbits_le32(&ccm->apb2_gate,
59 CLK_GATE_OPEN << (APB2_GATE_TWI_SHIFT + port));
60 setbits_le32(&ccm->apb2_reset_cfg,
61 1 << (APB2_RESET_TWI_SHIFT + port));
63 clrbits_le32(&ccm->apb2_reset_cfg,
64 1 << (APB2_RESET_TWI_SHIFT + port));
65 clrbits_le32(&ccm->apb2_gate,
66 CLK_GATE_OPEN << (APB2_GATE_TWI_SHIFT + port));