FreeBSD/sys/arm/freescale/imx/imx51_ccm.c
/*
 * Code from here down is temporary, in lieu of a SoC-independent clock API.
 */
Code from here down is temporary, in lieu of a SoC-independent clock API.
Code from here down is temporary in lieu of a SoC - independent clock API .
void
imx_ccm_usb_enable(device_t dev)
{
	uint32_t regval;
	regval = bus_read_4(ccm_softc->res[0], CCMC_CSCMR1);
	regval &= ~CSCMR1_USBOH3_CLK_SEL_MASK;
	regval |= 1 << CSCMR1_USBOH3_CLK_SEL_SHIFT;
	bus_write_4(ccm_softc->res[0], CCMC_CSCMR1, regval);
	regval = bus_read_4(ccm_softc->res[0], CCMC_CSCDR1);
	regval &= ~CSCDR1_USBOH3_CLK_PODF_MASK;
	regval &= ~CSCDR1_USBOH3_CLK_PRED_MASK;
	regval |= 4 << CSCDR1_USBOH3_CLK_PRED_SHIFT;
	regval |= 1 << CSCDR1_USBOH3_CLK_PODF_SHIFT;
	bus_write_4(ccm_softc->res[0], CCMC_CSCDR1, regval);
	imx51_clk_gating(CCGR_USBOH3_IPG_AHB_CLK, CCGR_CLK_MODE_ALWAYS);
	imx51_clk_gating(CCGR_USBOH3_60M_CLK, CCGR_CLK_MODE_ALWAYS);
}
void imx_ccm_usb_enable ( device_t dev ) { uint32_t regval ; regval = bus_read_4 ( ccm_softc -> res [ 0 ] , CCMC_CSCMR1 ) ; regval &= ~ CSCMR1_USBOH3_CLK_SEL_MASK ; regval |= 1 << CSCMR1_USBOH3_CLK_SEL_SHIFT ; bus_write_4 ( ccm_softc -> res [ 0 ] , CCMC_CSCMR1 , regval ) ; regval = bus_read_4 ( ccm_softc -> res [ 0 ] , CCMC_CSCDR1 ) ; regval &= ~ CSCDR1_USBOH3_CLK_PODF_MASK ; regval &= ~ CSCDR1_USBOH3_CLK_PRED_MASK ; regval |= 4 << CSCDR1_USBOH3_CLK_PRED_SHIFT ; regval |= 1 << CSCDR1_USBOH3_CLK_PODF_SHIFT ; bus_write_4 ( ccm_softc -> res [ 0 ] , CCMC_CSCDR1 , regval ) ; imx51_clk_gating ( CCGR_USBOH3_IPG_AHB_CLK , CCGR_CLK_MODE_ALWAYS ) ; imx51_clk_gating ( CCGR_USBOH3_60M_CLK , CCGR_CLK_MODE_ALWAYS ) ; }
Code from here down is temporary, in lieu of a SoC-independent clock API.
Code from here down is temporary in lieu of a SoC - independent clock API .
/*
	 * Select PLL2 as the source for the USB clock.
	 * The default is PLL3, but U-boot changes it to PLL2.
	 */ /*
	 * Set the USB clock pre-divider to div-by-5, post-divider to div-by-2.
	 */ /*
	 * The same two clocks gates are used on imx51 and imx53.
	 */