Lines Matching +full:hsic +full:- +full:state

1 /*-
2 * SPDX-License-Identifier: BSD-3-Clause
61 * - There is a top level omap_prcm module that defines all OMAP SoC drivers
65 * configuring the clock - this file is the 'donkey' for OMAP44xx devices.
67 * - The key bit in this file is the omap_clk_devmap array, it's
71 * - In essence you just need to define some callbacks for each of the
74 * - The other thing that is worth noting is that when the omap_prcm device
166 {"ti,omap4-cm1", (uintptr_t)CM1_INSTANCE},
167 {"ti,omap4-cm2", (uintptr_t)CM2_INSTANCE},
168 {"ti,omap4-prm", (uintptr_t)PRM_INSTANCE},
200 * omap_clk_devmap - Array of clock devices available on OMAP4xxx devices
328 * omap4_clk_details - Stores details for all the different clocks supported
366 OMAP4_GENERIC_CLOCK_DETAILS(TIMER1_CLK, -1, PRM_INSTANCE,
368 OMAP4_GENERIC_CLOCK_DETAILS(TIMER2_CLK, -1, CM2_INSTANCE,
370 OMAP4_GENERIC_CLOCK_DETAILS(TIMER3_CLK, -1, CM2_INSTANCE,
372 OMAP4_GENERIC_CLOCK_DETAILS(TIMER4_CLK, -1, CM2_INSTANCE,
374 OMAP4_GENERIC_CLOCK_DETAILS(TIMER5_CLK, -1, CM1_INSTANCE,
376 OMAP4_GENERIC_CLOCK_DETAILS(TIMER6_CLK, -1, CM1_INSTANCE,
378 OMAP4_GENERIC_CLOCK_DETAILS(TIMER7_CLK, -1, CM1_INSTANCE,
380 OMAP4_GENERIC_CLOCK_DETAILS(TIMER8_CLK, -1, CM1_INSTANCE,
382 OMAP4_GENERIC_CLOCK_DETAILS(TIMER9_CLK, -1, CM2_INSTANCE,
384 OMAP4_GENERIC_CLOCK_DETAILS(TIMER10_CLK, -1, CM2_INSTANCE,
386 OMAP4_GENERIC_CLOCK_DETAILS(TIMER11_CLK, -1, CM2_INSTANCE,
390 OMAP4_GENERIC_CLOCK_DETAILS(MMC1_CLK, -1, CM2_INSTANCE,
392 OMAP4_GENERIC_CLOCK_DETAILS(MMC2_CLK, -1, CM2_INSTANCE,
402 OMAP4_GENERIC_CLOCK_DETAILS(GPIO1_CLK, -1, PRM_INSTANCE,
404 OMAP4_GENERIC_CLOCK_DETAILS(GPIO2_CLK, -1, CM2_INSTANCE,
406 OMAP4_GENERIC_CLOCK_DETAILS(GPIO3_CLK, -1, CM2_INSTANCE,
408 OMAP4_GENERIC_CLOCK_DETAILS(GPIO4_CLK, -1, CM2_INSTANCE,
410 OMAP4_GENERIC_CLOCK_DETAILS(GPIO5_CLK, -1, CM2_INSTANCE,
412 OMAP4_GENERIC_CLOCK_DETAILS(GPIO6_CLK, -1, CM2_INSTANCE,
416 OMAP4_GENERIC_CLOCK_DETAILS(SDMA_CLK, -1, CM2_INSTANCE,
420 OMAP4_GENERIC_CLOCK_DETAILS(I2C1_CLK, -1, CM2_INSTANCE,
422 OMAP4_GENERIC_CLOCK_DETAILS(I2C2_CLK, -1, CM2_INSTANCE,
424 OMAP4_GENERIC_CLOCK_DETAILS(I2C3_CLK, -1, CM2_INSTANCE,
426 OMAP4_GENERIC_CLOCK_DETAILS(I2C4_CLK, -1, CM2_INSTANCE,
433 * MAX_MODULE_ENABLE_WAIT - the number of loops to wait for the module to come
440 * ARRAY_SIZE - Macro to return the number of elements in a static const array.
446 * omap4_clk_details - writes a 32-bit value to one of the timer registers
460 for (walker = g_omap4_clk_details; walker->id != INVALID_CLK_IDENT; walker++) { in omap4_clk_details()
461 if (id == walker->id) in omap4_clk_details()
482 if (sc->sc_instance == module_instance) in omap4_prcm_get_instance_softc()
490 * omap4_clk_generic_activate - checks if a module is accessible
511 clk_details = omap4_clk_details(clkdev->id); in omap4_clk_generic_activate()
516 sc = omap4_prcm_get_instance_softc(clk_details->instance); in omap4_clk_generic_activate()
520 clk_mem_res = sc->sc_res; in omap4_clk_generic_activate()
526 * generic - the have at least two fielda called MODULEMODE and IDLEST. in omap4_clk_generic_activate()
528 clksel = bus_read_4(clk_mem_res, clk_details->clksel_reg); in omap4_clk_generic_activate()
530 clksel |= clk_details->enable_mode; in omap4_clk_generic_activate()
531 bus_write_4(clk_mem_res, clk_details->clksel_reg, clksel); in omap4_clk_generic_activate()
539 clksel = bus_read_4(clk_mem_res, clk_details->clksel_reg); in omap4_clk_generic_activate()
545 /* Check the enabled state */ in omap4_clk_generic_activate()
547 printf("Error: failed to enable module with clock %d\n", clkdev->id); in omap4_clk_generic_activate()
548 printf("Error: 0x%08x => 0x%08x\n", clk_details->clksel_reg, clksel); in omap4_clk_generic_activate()
556 * omap4_clk_generic_deactivate - checks if a module is accessible
577 clk_details = omap4_clk_details(clkdev->id); in omap4_clk_generic_deactivate()
582 sc = omap4_prcm_get_instance_softc(clk_details->instance); in omap4_clk_generic_deactivate()
586 clk_mem_res = sc->sc_res; in omap4_clk_generic_deactivate()
592 * generic - the have at least two fielda called MODULEMODE and IDLEST. in omap4_clk_generic_deactivate()
594 clksel = bus_read_4(clk_mem_res, clk_details->clksel_reg); in omap4_clk_generic_deactivate()
597 bus_write_4(clk_mem_res, clk_details->clksel_reg, clksel); in omap4_clk_generic_deactivate()
603 * omap4_clk_generic_set_source - checks if a module is accessible
625 * omap4_clk_generic_accessible - checks if a module is accessible
646 clk_details = omap4_clk_details(clkdev->id); in omap4_clk_generic_accessible()
651 sc = omap4_prcm_get_instance_softc(clk_details->instance); in omap4_clk_generic_accessible()
655 clk_mem_res = sc->sc_res; in omap4_clk_generic_accessible()
660 clksel = bus_read_4(clk_mem_res, clk_details->clksel_reg); in omap4_clk_generic_accessible()
662 /* Check the enabled state */ in omap4_clk_generic_accessible()
670 * omap4_clk_generic_get_source_freq - checks if a module is accessible
688 struct omap4_clk_details* clk_details = omap4_clk_details(clkdev->id); in omap4_clk_generic_get_source_freq()
695 *freq = (unsigned int)clk_details->src_freq; in omap4_clk_generic_get_source_freq()
701 * omap4_clk_gptimer_set_source - checks if a module is accessible
722 clk_details = omap4_clk_details(clkdev->id); in omap4_clk_gptimer_set_source()
727 sc = omap4_prcm_get_instance_softc(clk_details->instance); in omap4_clk_gptimer_set_source()
731 clk_mem_res = sc->sc_res; in omap4_clk_gptimer_set_source()
742 * omap4_clk_gptimer_get_source_freq - checks if a module is accessible
766 clk_details = omap4_clk_details(clkdev->id); in omap4_clk_gptimer_get_source_freq()
771 sc = omap4_prcm_get_instance_softc(clk_details->instance); in omap4_clk_gptimer_get_source_freq()
775 clk_mem_res = sc->sc_res; in omap4_clk_gptimer_get_source_freq()
781 clksel = bus_read_4(clk_mem_res, clk_details->clksel_reg); in omap4_clk_gptimer_get_source_freq()
795 * omap4_clk_hsmmc_set_source - sets the source clock (freq)
815 clk_details = omap4_clk_details(clkdev->id); in omap4_clk_hsmmc_set_source()
820 sc = omap4_prcm_get_instance_softc(clk_details->instance); in omap4_clk_hsmmc_set_source()
824 clk_mem_res = sc->sc_res; in omap4_clk_hsmmc_set_source()
830 if ((clkdev->id == MMC3_CLK) || (clkdev->id == MMC4_CLK) || in omap4_clk_hsmmc_set_source()
831 (clkdev->id == MMC5_CLK)) { in omap4_clk_hsmmc_set_source()
837 clksel = bus_read_4(clk_mem_res, clk_details->clksel_reg); in omap4_clk_hsmmc_set_source()
847 bus_write_4(clk_mem_res, clk_details->clksel_reg, clksel); in omap4_clk_hsmmc_set_source()
853 * omap4_clk_hsmmc_get_source_freq - checks if a module is accessible
875 clk_details = omap4_clk_details(clkdev->id); in omap4_clk_hsmmc_get_source_freq()
880 sc = omap4_prcm_get_instance_softc(clk_details->instance); in omap4_clk_hsmmc_get_source_freq()
884 clk_mem_res = sc->sc_res; in omap4_clk_hsmmc_get_source_freq()
889 switch (clkdev->id) { in omap4_clk_hsmmc_get_source_freq()
893 clksel = bus_read_4(clk_mem_res, clk_details->clksel_reg); in omap4_clk_hsmmc_get_source_freq()
916 * omap4_clk_get_sysclk_freq - gets the sysclk frequency
919 * Read the clocking information from the power-control/boot-strap registers,
938 clksel = bus_read_4(sc->sc_res, CM_SYS_CLKSEL_OFFSET); in omap4_clk_get_sysclk_freq()
972 * omap4_clk_get_arm_fclk_freq - gets the MPU clock frequency
999 clksel = bus_read_4(sc->sc_res, CM_CLKSEL_DPLL_MPU); in omap4_clk_get_arm_fclk_freq()
1018 * omap4_clk_hsusbhost_activate - activates the USB clocks for the given module
1078 switch (clkdev->id) { in omap4_clk_hsusbhost_activate()
1081 * - INIT_L4_ICLK (will be enabled by bootloader) in omap4_clk_hsusbhost_activate()
1082 * - TLL_CH0_FCLK in omap4_clk_hsusbhost_activate()
1083 * - TLL_CH1_FCLK in omap4_clk_hsusbhost_activate()
1087 clk_mem_res = sc->sc_res; in omap4_clk_hsusbhost_activate()
1097 clksel |= (0x1 << 8); /* USB-HOST optional clock: USB_CH0_CLK */ in omap4_clk_hsusbhost_activate()
1098 clksel |= (0x1 << 9); /* USB-HOST optional clock: USB_CH1_CLK */ in omap4_clk_hsusbhost_activate()
1109 * - INIT_L4_ICLK (will be enabled by bootloader) in omap4_clk_hsusbhost_activate()
1110 * - INIT_L3_ICLK (will be enabled by bootloader) in omap4_clk_hsusbhost_activate()
1111 * - INIT_48MC_FCLK in omap4_clk_hsusbhost_activate()
1112 * - UTMI_ROOT_GFCLK (UTMI only, create a new clock for that ?) in omap4_clk_hsusbhost_activate()
1113 * - UTMI_P1_FCLK (UTMI only, create a new clock for that ?) in omap4_clk_hsusbhost_activate()
1114 * - UTMI_P2_FCLK (UTMI only, create a new clock for that ?) in omap4_clk_hsusbhost_activate()
1115 * - HSIC_P1_60 (HSIC only, create a new clock for that ?) in omap4_clk_hsusbhost_activate()
1116 * - HSIC_P1_480 (HSIC only, create a new clock for that ?) in omap4_clk_hsusbhost_activate()
1117 * - HSIC_P2_60 (HSIC only, create a new clock for that ?) in omap4_clk_hsusbhost_activate()
1118 * - HSIC_P2_480 (HSIC only, create a new clock for that ?) in omap4_clk_hsusbhost_activate()
1122 clk_mem_res = sc->sc_res; in omap4_clk_hsusbhost_activate()
1126 if (clkdev->id == USBHSHOST_CLK) { in omap4_clk_hsusbhost_activate()
1130 clksel |= (0x1 << 15); /* USB-HOST clock control: FUNC48MCLK */ in omap4_clk_hsusbhost_activate()
1133 else if (clkdev->id == USBP1_UTMI_CLK) in omap4_clk_hsusbhost_activate()
1135 else if (clkdev->id == USBP2_UTMI_CLK) in omap4_clk_hsusbhost_activate()
1138 else if (clkdev->id == USBP1_HSIC_CLK) in omap4_clk_hsusbhost_activate()
1140 else if (clkdev->id == USBP2_HSIC_CLK) in omap4_clk_hsusbhost_activate()
1158 /* Check the enabled state */ in omap4_clk_hsusbhost_activate()
1160 printf("Error: HERE failed to enable module with clock %d\n", clkdev->id); in omap4_clk_hsusbhost_activate()
1169 * omap4_clk_generic_deactivate - checks if a module is accessible
1193 switch (clkdev->id) { in omap4_clk_hsusbhost_deactivate()
1196 clk_mem_res = sc->sc_res; in omap4_clk_hsusbhost_deactivate()
1212 * - INIT_L4_ICLK (will be enabled by bootloader) in omap4_clk_hsusbhost_deactivate()
1213 * - INIT_L3_ICLK (will be enabled by bootloader) in omap4_clk_hsusbhost_deactivate()
1214 * - INIT_48MC_FCLK in omap4_clk_hsusbhost_deactivate()
1215 * - UTMI_ROOT_GFCLK (UTMI only, create a new clock for that ?) in omap4_clk_hsusbhost_deactivate()
1216 * - UTMI_P1_FCLK (UTMI only, create a new clock for that ?) in omap4_clk_hsusbhost_deactivate()
1217 * - UTMI_P2_FCLK (UTMI only, create a new clock for that ?) in omap4_clk_hsusbhost_deactivate()
1218 * - HSIC_P1_60 (HSIC only, create a new clock for that ?) in omap4_clk_hsusbhost_deactivate()
1219 * - HSIC_P1_480 (HSIC only, create a new clock for that ?) in omap4_clk_hsusbhost_deactivate()
1220 * - HSIC_P2_60 (HSIC only, create a new clock for that ?) in omap4_clk_hsusbhost_deactivate()
1221 * - HSIC_P2_480 (HSIC only, create a new clock for that ?) in omap4_clk_hsusbhost_deactivate()
1225 clk_mem_res = sc->sc_res; in omap4_clk_hsusbhost_deactivate()
1230 if (clkdev->id == USBHSHOST_CLK) { in omap4_clk_hsusbhost_deactivate()
1234 clksel &= ~(0x1 << 15); /* USB-HOST clock control: FUNC48MCLK */ in omap4_clk_hsusbhost_deactivate()
1237 else if (clkdev->id == USBP1_UTMI_CLK) in omap4_clk_hsusbhost_deactivate()
1239 else if (clkdev->id == USBP2_UTMI_CLK) in omap4_clk_hsusbhost_deactivate()
1242 else if (clkdev->id == USBP1_HSIC_CLK) in omap4_clk_hsusbhost_deactivate()
1244 else if (clkdev->id == USBP2_HSIC_CLK) in omap4_clk_hsusbhost_deactivate()
1259 * omap4_clk_hsusbhost_accessible - checks if a module is accessible
1284 if (clkdev->id == USBTLL_CLK) { in omap4_clk_hsusbhost_accessible()
1286 clk_mem_res = sc->sc_res; in omap4_clk_hsusbhost_accessible()
1289 else if (clkdev->id == USBHSHOST_CLK) { in omap4_clk_hsusbhost_accessible()
1291 clk_mem_res = sc->sc_res; in omap4_clk_hsusbhost_accessible()
1300 /* Check the enabled state */ in omap4_clk_hsusbhost_accessible()
1308 * omap4_clk_hsusbhost_set_source - sets the source clocks
1335 if (clkdev->id == USBP1_PHY_CLK) in omap4_clk_hsusbhost_set_source()
1337 else if (clkdev->id != USBP2_PHY_CLK) in omap4_clk_hsusbhost_set_source()
1343 clk_mem_res = sc->sc_res; in omap4_clk_hsusbhost_set_source()
1370 bus_write_4(sc->sc_res, PRM_RSTCTRL, in omap4_prcm_reset()
1371 bus_read_4(sc->sc_res, PRM_RSTCTRL) | PRM_RSTCTRL_RESET); in omap4_prcm_reset()
1372 bus_read_4(sc->sc_res, PRM_RSTCTRL); in omap4_prcm_reset()
1376 * omap4_prcm_probe - probe function for the driver
1396 if ((int)ocd->ocd_data == 0) in omap4_prcm_probe()
1399 switch ((int)ocd->ocd_data) { in omap4_prcm_probe()
1410 device_printf(dev, "unknown instance type: %d\n", (int)ocd->ocd_data); in omap4_prcm_probe()
1418 * omap_prcm_attach - attach function for the driver
1441 sc->sc_instance = (int)ocd->ocd_data; in omap4_prcm_attach()
1443 sc->sc_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &sc->sc_rid, in omap4_prcm_attach()
1445 if (sc->sc_res == NULL) { in omap4_prcm_attach()
1461 if (sc->attach_done || in omap4_prcm_new_pass()
1466 sc->attach_done = 1; in omap4_prcm_new_pass()