ARM: rockchip: cru.h add rk3288 soft reset support
author黄涛 <huangtao@rock-chips.com>
Mon, 31 Mar 2014 10:06:10 +0000 (18:06 +0800)
committer黄涛 <huangtao@rock-chips.com>
Mon, 31 Mar 2014 10:06:10 +0000 (18:06 +0800)
include/linux/rockchip/cru.h

index 1e25fcbd0f4b70f968c5bb471b4ece95f9ac15e9..e5d355b7e06c5801c3b7401f26689f0dd35862a0 100755 (executable)
@@ -2,6 +2,7 @@
 #define __MACH_ROCKCHIP_CRU_H
 
 #include <dt-bindings/clock/rockchip,rk3188.h>
+#include <linux/rockchip/iomap.h>
 
 
 /*******************CRU BITS*******************************/
@@ -115,4 +116,218 @@ enum rk3288_cru_clk_gate {
 #define RK3288_CRU_SOFTRSTS_CON_CNT    (12)
 #define RK3288_CRU_SOFTRSTS_CON(i)     (RK3288_CRU_SOFTRST_CON + ((i) * 4))
 
+enum rk3288_cru_soft_reset {
+       RK3288_SOFT_RST_CORE0,
+       RK3288_SOFT_RST_CORE1,
+       RK3288_SOFT_RST_CORE2,
+       RK3288_SOFT_RST_CORE3,
+       RK3288_SOFT_RST_CORE0_PO,
+       RK3288_SOFT_RST_CORE1_PO,
+       RK3288_SOFT_RST_CORE2_PO,
+       RK3288_SOFT_RST_CORE3_PO,
+       RK3288_SOFT_RST_PD_CORE_STR_SYS_A,
+       RK3288_SOFT_RST_PD_BUS_STR_SYS_A,
+       RK3288_SOFT_RST_L2C,
+       RK3288_SOFT_RST_TOPDBG,
+       RK3288_SOFT_RST_CORE0_DBG,
+       RK3288_SOFT_RST_CORE1_DBG,
+       RK3288_SOFT_RST_CORE2_DBG,
+       RK3288_SOFT_RST_CORE3_DBG,
+
+       RK3288_SOFT_RST_PD_BUS_AHB_ARBITOR,
+       RK3288_SOFT_RST_EFUSE_256BIT_P,
+       RK3288_SOFT_RST_DMA1,
+       RK3288_SOFT_RST_INTMEM,
+       RK3288_SOFT_RST_ROM,
+       RK3288_SOFT_RST_SPDIF_8CH,
+       RK3288_SOFT_RST_TIMER_P,
+       RK3288_SOFT_RST_I2S,
+       RK3288_SOFT_RST_SPDIF,
+       RK3288_SOFT_RST_TIMER0,
+       RK3288_SOFT_RST_TIMER1,
+       RK3288_SOFT_RST_TIMER2,
+       RK3288_SOFT_RST_TIMER3,
+       RK3288_SOFT_RST_TIMER4,
+       RK3288_SOFT_RST_TIMER5,
+       RK3288_SOFT_RST_EFUSE_P,
+
+       RK3288_SOFT_RST_GPIO0,
+       RK3288_SOFT_RST_GPIO1,
+       RK3288_SOFT_RST_GPIO2,
+       RK3288_SOFT_RST_GPIO3,
+       RK3288_SOFT_RST_GPIO4,
+       RK3288_SOFT_RST_GPIO5,
+       RK3288_SOFT_RST_GPIO6,
+       RK3288_SOFT_RST_GPIO7,
+       RK3288_SOFT_RST_GPIO8,
+       RK3288_SOFT_RST_2RES9,
+       RK3288_SOFT_RST_I2C0,
+       RK3288_SOFT_RST_I2C1,
+       RK3288_SOFT_RST_I2C2,
+       RK3288_SOFT_RST_I2C3,
+       RK3288_SOFT_RST_I2C4,
+       RK3288_SOFT_RST_I2C5,
+
+       RK3288_SOFT_RST_DW_PWM,
+       RK3288_SOFT_RST_MMC_PERI,
+       RK3288_SOFT_RST_PERIPH_MMU,
+       RK3288_SOFT_RST_DAP,
+       RK3288_SOFT_RST_DAP_SYS,
+       RK3288_SOFT_RST_TPIU_AT,
+       RK3288_SOFT_RST_PMU_P,
+       RK3288_SOFT_RST_GRF,
+       RK3288_SOFT_RST_PMU,
+       RK3288_SOFT_RST_PERIPHSYS_A,
+       RK3288_SOFT_RST_PERIPHSYS_H,
+       RK3288_SOFT_RST_PERIPHSYS_P,
+       RK3288_SOFT_RST_PERIPH_NIU,
+       RK3288_SOFT_RST_PD_PERI_AHB_ARBITOR,
+       RK3288_SOFT_RST_EMEM_PERI,
+       RK3288_SOFT_RST_USB_PERI,
+
+       RK3288_SOFT_RST_DMA2,
+       RK3288_SOFT_RST_4RES1,
+       RK3288_SOFT_RST_MAC,
+       RK3288_SOFT_RST_GPS,
+       RK3288_SOFT_RST_4RES4,
+       RK3288_SOFT_RST_RK_PWM,
+       RK3288_SOFT_RST_4RES6,
+       RK3288_SOFT_RST_CCP,
+       RK3288_SOFT_RST_USB_HOST0,
+       RK3288_SOFT_RST_HSIC,
+       RK3288_SOFT_RST_HSIC_AUX,
+       RK3288_SOFT_RST_HSICPHY,
+       RK3288_SOFT_RST_HSADC,
+       RK3288_SOFT_RST_NANDC0,
+       RK3288_SOFT_RST_NANDC1,
+       RK3288_SOFT_RST_4RES15,
+
+       RK3288_SOFT_RST_TZPC,
+       RK3288_SOFT_RST_5RES1,
+       RK3288_SOFT_RST_5RES2,
+       RK3288_SOFT_RST_SPI0,
+       RK3288_SOFT_RST_SPI1,
+       RK3288_SOFT_RST_SPI2,
+       RK3288_SOFT_RST_5RES6,
+       RK3288_SOFT_RST_SARADC,
+       RK3288_SOFT_RST_PD_ALIVE_NIU_P,
+       RK3288_SOFT_RST_PD_PMU_INTMEM_P,
+       RK3288_SOFT_RST_PD_PMU_NIU_P,
+       RK3288_SOFT_RST_SECURITY_GRF_P,
+       RK3288_SOFT_RST_5RES12,
+       RK3288_SOFT_RST_5RES13,
+       RK3288_SOFT_RST_5RES14,
+       RK3288_SOFT_RST_5RES15,
+
+       RK3288_SOFT_RST_VIO_ARBI_H,
+       RK3288_SOFT_RST_RGA_NIU_A,
+       RK3288_SOFT_RST_VIO0_NIU_A,
+       RK3288_SOFT_RST_VIO_NIU_H,
+       RK3288_SOFT_RST_LCDC0_A,
+       RK3288_SOFT_RST_LCDC0_H,
+       RK3288_SOFT_RST_LCDC0_D,
+       RK3288_SOFT_RST_VIO1_NIU_A,
+       RK3288_SOFT_RST_VIP,
+       RK3288_SOFT_RST_RGA_CORE,
+       RK3288_SOFT_RST_IEP_A,
+       RK3288_SOFT_RST_IEP_H,
+       RK3288_SOFT_RST_RGA_A,
+       RK3288_SOFT_RST_RGA_H,
+       RK3288_SOFT_RST_ISP,
+       RK3288_SOFT_RST_EDP,
+
+       RK3288_SOFT_RST_VCODEC_A,
+       RK3288_SOFT_RST_VCODEC_H,
+       RK3288_SOFT_RST_VIO_H2P_H,
+       RK3288_SOFT_RST_MIPIDSI0_P,
+       RK3288_SOFT_RST_MIPIDSI1_P,
+       RK3288_SOFT_RST_MIPICSI_P,
+       RK3288_SOFT_RST_LVDS_PHY_P,
+       RK3288_SOFT_RST_LVDS_CON,
+       RK3288_SOFT_RST_GPU,
+       RK3288_SOFT_RST_HDMI,
+       RK3288_SOFT_RST_7RES10,
+       RK3288_SOFT_RST_7RES11,
+       RK3288_SOFT_RST_CORE_PVTM,
+       RK3288_SOFT_RST_GPU_PVTM,
+       RK3288_SOFT_RST_7RES14,
+       RK3288_SOFT_RST_7RES15,
+
+       RK3288_SOFT_RST_MMC0,
+       RK3288_SOFT_RST_SDIO0,
+       RK3288_SOFT_RST_SDIO1,
+       RK3288_SOFT_RST_EMMC,
+       RK3288_SOFT_RST_USBOTG_H,
+       RK3288_SOFT_RST_USBOTGPHY,
+       RK3288_SOFT_RST_USBOTGC,
+       RK3288_SOFT_RST_USBHOST0_H,
+       RK3288_SOFT_RST_USBHOST0PHY,
+       RK3288_SOFT_RST_USBHOST0C,
+       RK3288_SOFT_RST_USBHOST1_H,
+       RK3288_SOFT_RST_USBHOST1PHY,
+       RK3288_SOFT_RST_USBHOST1C,
+       RK3288_SOFT_RST_USB_ADP,
+       RK3288_SOFT_RST_ACC_EFUSE,
+       RK3288_SOFT_RST_8RES15,
+
+       RK3288_SOFT_RST_CORESIGHT,
+       RK3288_SOFT_RST_PD_CORE_AHB_NOC,
+       RK3288_SOFT_RST_PD_CORE_APB_NOC,
+       RK3288_SOFT_RST_PD_CORE_MP_AXI,
+       RK3288_SOFT_RST_GIC,
+       RK3288_SOFT_RST_LCDCPWM0,
+       RK3288_SOFT_RST_LCDCPWM1,
+       RK3288_SOFT_RST_VIO0_H2P_BRG,
+       RK3288_SOFT_RST_VIO1_H2P_BRG,
+       RK3288_SOFT_RST_RGA_H2P_BRG,
+       RK3288_SOFT_RST_HEVC,
+       RK3288_SOFT_RST_9RES11,
+       RK3288_SOFT_RST_9RES12,
+       RK3288_SOFT_RST_9RES13,
+       RK3288_SOFT_RST_9RES14,
+       RK3288_SOFT_RST_TSADC_P,
+
+       RK3288_SOFT_RST_DDRPHY0,
+       RK3288_SOFT_RST_DDRPHY0_P,
+       RK3288_SOFT_RST_DDRCTRL0,
+       RK3288_SOFT_RST_DDRCTRL0_P,
+       RK3288_SOFT_RST_DDRPHY0_CTL,
+       RK3288_SOFT_RST_DDRPHY1,
+       RK3288_SOFT_RST_DDRPHY1_P,
+       RK3288_SOFT_RST_DDRCTRL1,
+       RK3288_SOFT_RST_DDRCTRL1_P,
+       RK3288_SOFT_RST_DDRPHY1_CTL,
+       RK3288_SOFT_RST_DDRMSCH0,
+       RK3288_SOFT_RST_DDRMSCH1,
+       RK3288_SOFT_RST_10RES12,
+       RK3288_SOFT_RST_10RES13,
+       RK3288_SOFT_RST_CRYPTO,
+       RK3288_SOFT_RST_C2C_HOST,
+
+       RK3288_SOFT_RST_LCDC1_A,
+       RK3288_SOFT_RST_LCDC1_H,
+       RK3288_SOFT_RST_LCDC1_D,
+       RK3288_SOFT_RST_UART0,
+       RK3288_SOFT_RST_UART1,
+       RK3288_SOFT_RST_UART2,
+       RK3288_SOFT_RST_UART3,
+       RK3288_SOFT_RST_UART4,
+       RK3288_SOFT_RST_11RES8,
+       RK3288_SOFT_RST_11RES9,
+       RK3288_SOFT_RST_SIMC,
+       RK3288_SOFT_RST_PS2C,
+       RK3288_SOFT_RST_TSP,
+       RK3288_SOFT_RST_TSP_CLKIN0,
+       RK3288_SOFT_RST_TSP_CLKIN1,
+       RK3288_SOFT_RST_TSP_27M,
+};
+
+static inline void rk3288_cru_set_soft_reset(enum rk3288_cru_soft_reset idx, bool on)
+{
+       void __iomem *reg = RK_CRU_VIRT + RK3288_CRU_SOFTRSTS_CON(idx >> 4);
+       u32 val = on ? 0x10001U << (idx & 0xf) : 0x10000U << (idx & 0xf);
+       writel_relaxed(val, reg);
+       dsb();
+}
+
 #endif