1261071Sjasone/*-
2261071Sjasone * Copyright (c) 2014 Ian Lepore <ian@freebsd.org>
3261071Sjasone * All rights reserved.
4261071Sjasone *
5261071Sjasone * Redistribution and use in source and binary forms, with or without
6261071Sjasone * modification, are permitted provided that the following conditions
7261071Sjasone * are met:
8261071Sjasone * 1. Redistributions of source code must retain the above copyright
9261071Sjasone *    notice, this list of conditions and the following disclaimer.
10261071Sjasone * 2. Redistributions in binary form must reproduce the above copyright
11261071Sjasone *    notice, this list of conditions and the following disclaimer in the
12261071Sjasone *    documentation and/or other materials provided with the distribution.
13261071Sjasone *
14261071Sjasone * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15261071Sjasone * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16261071Sjasone * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17261071Sjasone * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18261071Sjasone * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19261071Sjasone * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20261071Sjasone * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21261071Sjasone * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22261071Sjasone * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23261071Sjasone * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24261071Sjasone * SUCH DAMAGE.
25261071Sjasone */
26286866Sjasone
27286866Sjasone#ifndef	IMX_CCMVAR_H
28286866Sjasone#define	IMX_CCMVAR_H
29261071Sjasone
30261071Sjasone/*
31261071Sjasone * We need a clock management system that works across unrelated SoCs and
32261071Sjasone * devices.  For now, to keep imx development moving, define some barebones
33261071Sjasone * functionality that can be shared within the imx family by having each SoC
34261071Sjasone * implement functions with a common name.
35261071Sjasone *
36261071Sjasone * The usb enable functions are best-effort.  They turn on the usb otg, host,
37261071Sjasone * and phy clocks in a SoC-specific manner, but it may take a lot more than that
38261071Sjasone * to make usb work on a given board.  In particular, it can require specific
39261071Sjasone * pinmux setup of gpio pins connected to external phy parts, voltage regulators
40261071Sjasone * and overcurrent detectors, and so on.  On such boards, u-boot or other early
41261071Sjasone * board setup code has to handle those things.
42286866Sjasone */
43261071Sjasone
44261071Sjasoneuint32_t imx_ccm_ecspi_hz(void);
45261071Sjasoneuint32_t imx_ccm_ipg_hz(void);
46261071Sjasoneuint32_t imx_ccm_perclk_hz(void);
47261071Sjasoneuint32_t imx_ccm_sdhci_hz(void);
48261071Sjasoneuint32_t imx_ccm_uart_hz(void);
49261071Sjasoneuint32_t imx_ccm_ahb_hz(void);
50286866Sjasoneuint32_t imx_ccm_ipu_hz(void);
51261071Sjasone
52261071Sjasonevoid imx_ccm_usb_enable(device_t _usbdev);
53261071Sjasonevoid imx_ccm_usbphy_enable(device_t _phydev);
54261071Sjasonevoid imx_ccm_ssi_configure(device_t _ssidev);
55286866Sjasoneint imx_ccm_pll_video_enable(void);
56286866Sjasonevoid imx_ccm_hdmi_enable(void);
57286866Sjasonevoid imx_ccm_ipu_enable(int ipu);
58286866Sjasoneint  imx6_ccm_sata_enable(void);
59286866Sjasone
60286866Sjasone/* Routines to get and set the arm clock root divisor register. */
61286866Sjasoneuint32_t imx_ccm_get_cacrr(void);
62286866Sjasonevoid     imx_ccm_set_cacrr(uint32_t _divisor);
63286866Sjasone
64286866Sjasone#endif
65261071Sjasone