Changeset 601fa93 in mainline
- Timestamp:
- 2012-10-11T13:32:53Z (12 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 7290ca0
- Parents:
- 639d9dd5
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/infrastructure/rootamdm37x/rootamdm37x.c
r639d9dd5 r601fa93 47 47 #include "usbtll.h" 48 48 #include "core_cm.h" 49 #include "clock_control_cm.h" 49 50 #include "usbhost_cm.h" 50 51 … … 121 122 static int usb_clocks(bool on) 122 123 { 123 usbhost_cm_regs_t *usb_host_cm = NULL; 124 core_cm_regs_t *l4_core_cm = NULL; 125 126 int ret = pio_enable((void*)USBHOST_CM_BASE_ADDRESS, USBHOST_CM_SIZE, 127 (void**)&usb_host_cm); 128 if (ret != EOK) 129 return ret; 130 131 ret = pio_enable((void*)CORE_CM_BASE_ADDRESS, CORE_CM_SIZE, 132 (void**)&l4_core_cm); 133 if (ret != EOK) 134 return ret; 124 static usbhost_cm_regs_t *usb_host_cm = NULL; 125 static core_cm_regs_t *l4_core_cm = NULL; 126 static clock_control_cm_regs_t *clock_control_cm = NULL; 127 128 if (!usb_host_cm) { 129 const int ret = pio_enable((void*)USBHOST_CM_BASE_ADDRESS, 130 USBHOST_CM_SIZE, (void**)&usb_host_cm); 131 if (ret != EOK) 132 return ret; 133 } 134 135 if (!l4_core_cm) { 136 const int ret = pio_enable((void*)CORE_CM_BASE_ADDRESS, 137 CORE_CM_SIZE, (void**)&l4_core_cm); 138 if (ret != EOK) 139 return ret; 140 } 141 142 if (!clock_control_cm) { 143 const int ret = pio_enable((void*)CLOCK_CONTROL_CM_BASE_ADDRESS, 144 CLOCK_CONTROL_CM_SIZE, (void**)&clock_control_cm); 145 if (ret != EOK) 146 return ret; 147 } 135 148 136 149 assert(l4_core_cm); 137 150 assert(usb_host_cm); 151 assert(clock_control_cm); 152 153 /* Always set DPLL5 to automatic */ 154 uint32_t reg = clock_control_cm->autoidle2_pll 155 reg &= ~(CLOCK_CONTROL_CM_AUTOIDLE2_PLL_AUTO_PERIPH2_DPLL_MASK << 156 CLOCK_CONTROL_CM_AUTOIDLE2_PLL_AUTO_PERIPH2_DPLL_SHIFT); 157 reg |= (CLOCK_CONTROL_CM_AUTOIDLE2_PLL_AUTO_PERIPH2_DPLL_AUTOMATIC << 158 CLOCK_CONTROL_CM_AUTOIDLE2_PLL_AUTO_PERIPH2_DPLL_SHIFT); 159 clock_control_cm->autoidle2_pll = reg; 160 138 161 if (on) { 162 /* Enable interface and function clock for USB TLL */ 139 163 l4_core_cm->iclken3 |= CORE_CM_ICLKEN3_EN_USBTLL_FLAG; 140 164 l4_core_cm->fclken3 |= CORE_CM_FCLKEN3_EN_USBTLL_FLAG; 165 166 /* Enable interface and function clock for USB hosts */ 141 167 usb_host_cm->iclken |= USBHOST_CM_ICLKEN_EN_USBHOST; 142 168 usb_host_cm->fclken |= USBHOST_CM_FCLKEN_EN_USBHOST1_FLAG; 143 169 usb_host_cm->fclken |= USBHOST_CM_FCLKEN_EN_USBHOST2_FLAG; 144 170 } else { 171 /* Disable interface and function clock for USB hosts */ 145 172 usb_host_cm->fclken &= ~USBHOST_CM_FCLKEN_EN_USBHOST2_FLAG; 146 173 usb_host_cm->fclken &= ~USBHOST_CM_FCLKEN_EN_USBHOST1_FLAG; 147 174 usb_host_cm->iclken &= ~USBHOST_CM_ICLKEN_EN_USBHOST; 175 176 /* Disable interface and function clock for USB TLL */ 148 177 l4_core_cm->fclken3 &= ~CORE_CM_FCLKEN3_EN_USBTLL_FLAG; 149 178 l4_core_cm->iclken3 &= ~CORE_CM_ICLKEN3_EN_USBTLL_FLAG; 150 179 } 151 180 152 //TODO Unmap those registers. 153 154 return ret; 181 return EOK; 155 182 } 156 183 … … 263 290 /* Add match id */ 264 291 if (ddf_fun_add_match_id(fnode, str_match_id, 100) != EOK) { 265 // TODO This will try to free our data!266 292 ddf_fun_destroy(fnode); 267 293 return false; … … 275 301 if (ddf_fun_bind(fnode) != EOK) { 276 302 ddf_msg(LVL_ERROR, "Failed binding function %s.", name); 303 // TODO This will try to free our data! 277 304 ddf_fun_destroy(fnode); 278 305 return false;
Note:
See TracChangeset
for help on using the changeset viewer.