xref: /freebsd/sys/arm/freescale/imx/imx_ccmvar.h (revision 95ee2897e98f5d444f26ed2334cc7c439f9c16c6)
1a7fa939bSIan Lepore /*-
2a7fa939bSIan Lepore  * Copyright (c) 2014 Ian Lepore <ian@freebsd.org>
3a7fa939bSIan Lepore  * All rights reserved.
4a7fa939bSIan Lepore  *
5a7fa939bSIan Lepore  * Redistribution and use in source and binary forms, with or without
6a7fa939bSIan Lepore  * modification, are permitted provided that the following conditions
7a7fa939bSIan Lepore  * are met:
8a7fa939bSIan Lepore  * 1. Redistributions of source code must retain the above copyright
9a7fa939bSIan Lepore  *    notice, this list of conditions and the following disclaimer.
10a7fa939bSIan Lepore  * 2. Redistributions in binary form must reproduce the above copyright
11a7fa939bSIan Lepore  *    notice, this list of conditions and the following disclaimer in the
12a7fa939bSIan Lepore  *    documentation and/or other materials provided with the distribution.
13a7fa939bSIan Lepore  *
14a7fa939bSIan Lepore  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15a7fa939bSIan Lepore  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16a7fa939bSIan Lepore  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17a7fa939bSIan Lepore  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18a7fa939bSIan Lepore  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19a7fa939bSIan Lepore  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20a7fa939bSIan Lepore  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21a7fa939bSIan Lepore  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22a7fa939bSIan Lepore  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23a7fa939bSIan Lepore  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24a7fa939bSIan Lepore  * SUCH DAMAGE.
25a7fa939bSIan Lepore  */
26a7fa939bSIan Lepore 
27a7fa939bSIan Lepore #ifndef	IMX_CCMVAR_H
28a7fa939bSIan Lepore #define	IMX_CCMVAR_H
29a7fa939bSIan Lepore 
30a7fa939bSIan Lepore /*
31a7fa939bSIan Lepore  * We need a clock management system that works across unrelated SoCs and
32a7fa939bSIan Lepore  * devices.  For now, to keep imx development moving, define some barebones
33a7fa939bSIan Lepore  * functionality that can be shared within the imx family by having each SoC
34a7fa939bSIan Lepore  * implement functions with a common name.
35a7fa939bSIan Lepore  *
36a7fa939bSIan Lepore  * The usb enable functions are best-effort.  They turn on the usb otg, host,
37a7fa939bSIan Lepore  * and phy clocks in a SoC-specific manner, but it may take a lot more than that
38a7fa939bSIan Lepore  * to make usb work on a given board.  In particular, it can require specific
39a7fa939bSIan Lepore  * pinmux setup of gpio pins connected to external phy parts, voltage regulators
40a7fa939bSIan Lepore  * and overcurrent detectors, and so on.  On such boards, u-boot or other early
41a7fa939bSIan Lepore  * board setup code has to handle those things.
42a7fa939bSIan Lepore  */
43a7fa939bSIan Lepore 
44a0fd2339SIan Lepore uint32_t imx_ccm_ecspi_hz(void);
45a7fa939bSIan Lepore uint32_t imx_ccm_ipg_hz(void);
46a7fa939bSIan Lepore uint32_t imx_ccm_perclk_hz(void);
47a7fa939bSIan Lepore uint32_t imx_ccm_sdhci_hz(void);
48a7fa939bSIan Lepore uint32_t imx_ccm_uart_hz(void);
49f14514a3SIan Lepore uint32_t imx_ccm_ahb_hz(void);
50*da21a623SOleksandr Tymoshenko uint32_t imx_ccm_ipu_hz(void);
51a7fa939bSIan Lepore 
52a7fa939bSIan Lepore void imx_ccm_usb_enable(device_t _usbdev);
53a7fa939bSIan Lepore void imx_ccm_usbphy_enable(device_t _phydev);
54f0583578SRuslan Bukin void imx_ccm_ssi_configure(device_t _ssidev);
55*da21a623SOleksandr Tymoshenko int imx_ccm_pll_video_enable(void);
56c0f3a6c2SOleksandr Tymoshenko void imx_ccm_hdmi_enable(void);
57c0f3a6c2SOleksandr Tymoshenko void imx_ccm_ipu_enable(int ipu);
58854519fdSIan Lepore int  imx6_ccm_sata_enable(void);
59a7fa939bSIan Lepore 
60955691feSIan Lepore /* Routines to get and set the arm clock root divisor register. */
61955691feSIan Lepore uint32_t imx_ccm_get_cacrr(void);
62955691feSIan Lepore void     imx_ccm_set_cacrr(uint32_t _divisor);
63955691feSIan Lepore 
64a7fa939bSIan Lepore #endif
65