1 /* 2 * IMX6 Clock Control Module 3 * 4 * Copyright (C) 2012 NICTA 5 * Updated by Jean-Christophe Dubois <jcd@tribudubois.net> 6 * 7 * This work is licensed under the terms of the GNU GPL, version 2 or later. 8 * See the COPYING file in the top-level directory. 9 */ 10 11 #ifndef IMX6_CCM_H 12 #define IMX6_CCM_H 13 14 #include "hw/misc/imx_ccm.h" 15 #include "qemu/bitops.h" 16 #include "qom/object.h" 17 18 #define CCM_CCR 0 19 #define CCM_CCDR 1 20 #define CCM_CSR 2 21 #define CCM_CCSR 3 22 #define CCM_CACRR 4 23 #define CCM_CBCDR 5 24 #define CCM_CBCMR 6 25 #define CCM_CSCMR1 7 26 #define CCM_CSCMR2 8 27 #define CCM_CSCDR1 9 28 #define CCM_CS1CDR 10 29 #define CCM_CS2CDR 11 30 #define CCM_CDCDR 12 31 #define CCM_CHSCCDR 13 32 #define CCM_CSCDR2 14 33 #define CCM_CSCDR3 15 34 #define CCM_CDHIPR 18 35 #define CCM_CTOR 20 36 #define CCM_CLPCR 21 37 #define CCM_CISR 22 38 #define CCM_CIMR 23 39 #define CCM_CCOSR 24 40 #define CCM_CGPR 25 41 #define CCM_CCGR0 26 42 #define CCM_CCGR1 27 43 #define CCM_CCGR2 28 44 #define CCM_CCGR3 29 45 #define CCM_CCGR4 30 46 #define CCM_CCGR5 31 47 #define CCM_CCGR6 32 48 #define CCM_CMEOR 34 49 #define CCM_MAX 35 50 51 #define CCM_ANALOG_PLL_ARM 0 52 #define CCM_ANALOG_PLL_ARM_SET 1 53 #define CCM_ANALOG_PLL_ARM_CLR 2 54 #define CCM_ANALOG_PLL_ARM_TOG 3 55 #define CCM_ANALOG_PLL_USB1 4 56 #define CCM_ANALOG_PLL_USB1_SET 5 57 #define CCM_ANALOG_PLL_USB1_CLR 6 58 #define CCM_ANALOG_PLL_USB1_TOG 7 59 #define CCM_ANALOG_PLL_USB2 8 60 #define CCM_ANALOG_PLL_USB2_SET 9 61 #define CCM_ANALOG_PLL_USB2_CLR 10 62 #define CCM_ANALOG_PLL_USB2_TOG 11 63 #define CCM_ANALOG_PLL_SYS 12 64 #define CCM_ANALOG_PLL_SYS_SET 13 65 #define CCM_ANALOG_PLL_SYS_CLR 14 66 #define CCM_ANALOG_PLL_SYS_TOG 15 67 #define CCM_ANALOG_PLL_SYS_SS 16 68 #define CCM_ANALOG_PLL_SYS_NUM 20 69 #define CCM_ANALOG_PLL_SYS_DENOM 24 70 #define CCM_ANALOG_PLL_AUDIO 28 71 #define CCM_ANALOG_PLL_AUDIO_SET 29 72 #define CCM_ANALOG_PLL_AUDIO_CLR 30 73 #define CCM_ANALOG_PLL_AUDIO_TOG 31 74 #define CCM_ANALOG_PLL_AUDIO_NUM 32 75 #define CCM_ANALOG_PLL_AUDIO_DENOM 36 76 #define CCM_ANALOG_PLL_VIDEO 40 77 #define CCM_ANALOG_PLL_VIDEO_SET 41 78 #define CCM_ANALOG_PLL_VIDEO_CLR 42 79 #define CCM_ANALOG_PLL_VIDEO_TOG 44 80 #define CCM_ANALOG_PLL_VIDEO_NUM 46 81 #define CCM_ANALOG_PLL_VIDEO_DENOM 48 82 #define CCM_ANALOG_PLL_MLB 52 83 #define CCM_ANALOG_PLL_MLB_SET 53 84 #define CCM_ANALOG_PLL_MLB_CLR 54 85 #define CCM_ANALOG_PLL_MLB_TOG 55 86 #define CCM_ANALOG_PLL_ENET 56 87 #define CCM_ANALOG_PLL_ENET_SET 57 88 #define CCM_ANALOG_PLL_ENET_CLR 58 89 #define CCM_ANALOG_PLL_ENET_TOG 59 90 #define CCM_ANALOG_PFD_480 60 91 #define CCM_ANALOG_PFD_480_SET 61 92 #define CCM_ANALOG_PFD_480_CLR 62 93 #define CCM_ANALOG_PFD_480_TOG 63 94 #define CCM_ANALOG_PFD_528 64 95 #define CCM_ANALOG_PFD_528_SET 65 96 #define CCM_ANALOG_PFD_528_CLR 66 97 #define CCM_ANALOG_PFD_528_TOG 67 98 99 /* PMU registers */ 100 #define PMU_REG_1P1 68 101 #define PMU_REG_3P0 72 102 #define PMU_REG_2P5 76 103 #define PMU_REG_CORE 80 104 105 #define CCM_ANALOG_MISC0 84 106 #define PMU_MISC0 84 107 #define CCM_ANALOG_MISC0_SET 85 108 #define CCM_ANALOG_MISC0_CLR 86 109 #define CCM_ANALOG_MISC0_TOG 87 110 111 #define PMU_MISC1 88 112 #define PMU_MISC1_SET 89 113 #define PMU_MISC1_CLR 90 114 #define PMU_MISC1_TOG 91 115 116 #define CCM_ANALOG_MISC2 92 117 #define PMU_MISC2 92 118 #define CCM_ANALOG_MISC2_SET 93 119 #define CCM_ANALOG_MISC2_CLR 94 120 #define CCM_ANALOG_MISC2_TOG 95 121 122 #define USB_ANALOG_USB1_VBUS_DETECT 104 123 #define USB_ANALOG_USB1_VBUS_DETECT_SET 105 124 #define USB_ANALOG_USB1_VBUS_DETECT_CLR 106 125 #define USB_ANALOG_USB1_VBUS_DETECT_TOG 107 126 #define USB_ANALOG_USB1_CHRG_DETECT 108 127 #define USB_ANALOG_USB1_CHRG_DETECT_SET 109 128 #define USB_ANALOG_USB1_CHRG_DETECT_CLR 110 129 #define USB_ANALOG_USB1_CHRG_DETECT_TOG 111 130 #define USB_ANALOG_USB1_VBUS_DETECT_STAT 112 131 #define USB_ANALOG_USB1_CHRG_DETECT_STAT 116 132 #define USB_ANALOG_USB1_MISC 124 133 #define USB_ANALOG_USB1_MISC_SET 125 134 #define USB_ANALOG_USB1_MISC_CLR 126 135 #define USB_ANALOG_USB1_MISC_TOG 127 136 #define USB_ANALOG_USB2_VBUS_DETECT 128 137 #define USB_ANALOG_USB2_VBUS_DETECT_SET 129 138 #define USB_ANALOG_USB2_VBUS_DETECT_CLR 130 139 #define USB_ANALOG_USB2_VBUS_DETECT_TOG 131 140 #define USB_ANALOG_USB2_CHRG_DETECT 132 141 #define USB_ANALOG_USB2_CHRG_DETECT_SET 133 142 #define USB_ANALOG_USB2_CHRG_DETECT_CLR 134 143 #define USB_ANALOG_USB2_CHRG_DETECT_TOG 135 144 #define USB_ANALOG_USB2_VBUS_DETECT_STAT 136 145 #define USB_ANALOG_USB2_CHRG_DETECT_STAT 140 146 #define USB_ANALOG_USB2_MISC 148 147 #define USB_ANALOG_USB2_MISC_SET 149 148 #define USB_ANALOG_USB2_MISC_CLR 150 149 #define USB_ANALOG_USB2_MISC_TOG 151 150 #define USB_ANALOG_DIGPROG 152 151 #define CCM_ANALOG_MAX 153 152 153 /* CCM_CBCMR */ 154 #define PRE_PERIPH_CLK_SEL_SHIFT (18) 155 #define PRE_PERIPH_CLK_SEL_LENGTH (2) 156 157 /* CCM_CBCDR */ 158 #define AHB_PODF_SHIFT (10) 159 #define AHB_PODF_LENGTH (3) 160 #define IPG_PODF_SHIFT (8) 161 #define IPG_PODF_LENGTH (2) 162 163 /* CCM_CSCMR1 */ 164 #define PERCLK_PODF_SHIFT (0) 165 #define PERCLK_PODF_LENGTH (6) 166 167 /* CCM_ANALOG_PFD_528 */ 168 #define PFD0_FRAC_SHIFT (0) 169 #define PFD0_FRAC_LENGTH (6) 170 #define PFD2_FRAC_SHIFT (16) 171 #define PFD2_FRAC_LENGTH (6) 172 173 /* CCM_ANALOG_PLL_SYS */ 174 #define DIV_SELECT_SHIFT (0) 175 #define DIV_SELECT_LENGTH (1) 176 177 #define CCM_ANALOG_PLL_LOCK (1 << 31); 178 179 #define EXTRACT(value, name) extract32(value, name##_SHIFT, name##_LENGTH) 180 181 #define TYPE_IMX6_CCM "imx6.ccm" 182 OBJECT_DECLARE_SIMPLE_TYPE(IMX6CCMState, IMX6_CCM) 183 184 struct IMX6CCMState { 185 /* <private> */ 186 IMXCCMState parent_obj; 187 188 /* <public> */ 189 MemoryRegion container; 190 MemoryRegion ioccm; 191 MemoryRegion ioanalog; 192 193 uint32_t ccm[CCM_MAX]; 194 uint32_t analog[CCM_ANALOG_MAX]; 195 196 }; 197 198 #endif /* IMX6_CCM_H */ 199