ARM: sunxi: Allow specifying module in prcm apb0 init function
authorChen-Yu Tsai <wens@csie.org>
Wed, 22 Oct 2014 08:47:46 +0000 (16:47 +0800)
committerHans de Goede <hdegoede@redhat.com>
Fri, 24 Oct 2014 07:35:39 +0000 (09:35 +0200)
The prcm apb0 controls multiple modules. Allow specifying which
modules to enable clocks and de-assert resets so the function
can be reused.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Acked-by: Ian Campbell <ijc@hellion.org.uk>
arch/arm/cpu/armv7/sunxi/prcm.c
arch/arm/include/asm/arch-sunxi/prcm.h

index 7b3ee893026b4c780cd81f88dda8fb7aef5e0395..19b4938dc9742c0ed453529838821bc17eb8747c 100644 (file)
 #include <asm/arch/prcm.h>
 #include <asm/arch/sys_proto.h>
 
-void prcm_init_apb0(void)
+/* APB0 clock gate and reset bit offsets are the same. */
+void prcm_apb0_enable(u32 flags)
 {
        struct sunxi_prcm_reg *prcm =
                (struct sunxi_prcm_reg *)SUNXI_PRCM_BASE;
 
-       setbits_le32(&prcm->apb0_gate, PRCM_APB0_GATE_P2WI |
-                                      PRCM_APB0_GATE_PIO);
-       setbits_le32(&prcm->apb0_reset, PRCM_APB0_RESET_P2WI |
-                                       PRCM_APB0_RESET_PIO);
+       /* open the clock for module */
+       setbits_le32(&prcm->apb0_gate, flags);
+
+       /* deassert reset for module */
+       setbits_le32(&prcm->apb0_reset, flags);
 }
index 1b40f094f51782adc5e16f1f1c68ec30e93d1dbf..3d3bfa6cd1b0ccabf23ed0885123e739b9302199 100644 (file)
@@ -233,6 +233,6 @@ struct sunxi_prcm_reg {
        u32 dram_tst;           /* 0x190 */
 };
 
-void prcm_init_apb0(void);
+void prcm_apb0_enable(u32 flags);
 #endif /* __ASSEMBLY__ */
 #endif /* _PRCM_H */