ti_prcm.h revision 278079
154359Sroberto/*
2132451Sroberto * Copyright (c) 2010
354359Sroberto *	Ben Gray <ben.r.gray@gmail.com>.
454359Sroberto * All rights reserved.
5106163Sroberto *
6106163Sroberto * Redistribution and use in source and binary forms, with or without
7106163Sroberto * modification, are permitted provided that the following conditions
8106163Sroberto * are met:
9106163Sroberto * 1. Redistributions of source code must retain the above copyright
10106163Sroberto *    notice, this list of conditions and the following disclaimer.
11106163Sroberto * 2. Redistributions in binary form must reproduce the above copyright
12106163Sroberto *    notice, this list of conditions and the following disclaimer in the
13106163Sroberto *    documentation and/or other materials provided with the distribution.
14106163Sroberto * 3. All advertising materials mentioning features or use of this software
15106163Sroberto *    must display the following acknowledgement:
16106163Sroberto *	This product includes software developed by Ben Gray.
17106163Sroberto * 4. The name of the company nor the name of the author may be used to
18106163Sroberto *    endorse or promote products derived from this software without specific
19106163Sroberto *    prior written permission.
20106163Sroberto *
21106163Sroberto * THIS SOFTWARE IS PROVIDED BY BEN GRAY ``AS IS'' AND ANY EXPRESS OR
22106163Sroberto * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
23106163Sroberto * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
24106163Sroberto * IN NO EVENT SHALL BEN GRAY BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25106163Sroberto * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26106163Sroberto * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
27106163Sroberto * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28106163Sroberto * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
29106163Sroberto * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
30106163Sroberto * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31106163Sroberto *
32106163Sroberto * $FreeBSD: stable/10/sys/arm/ti/ti_prcm.h 278079 2015-02-02 12:48:13Z loos $
33106163Sroberto */
34106163Sroberto
35106163Sroberto
36106163Sroberto/*
37106163Sroberto * Texas Instruments - OMAP3xxx series processors
38106163Sroberto *
39106163Sroberto * Reference:
40106163Sroberto *  OMAP35x Applications Processor
41106163Sroberto *   Technical Reference Manual
42106163Sroberto *  (omap35xx_techref.pdf)
43106163Sroberto */
44106163Sroberto#ifndef _TI_PRCM_H_
45106163Sroberto#define _TI_PRCM_H_
46106163Sroberto
47106163Srobertotypedef enum {
48106163Sroberto
49106163Sroberto	/* System clocks, typically you can only call ti_prcm_clk_get_source_freq()
50106163Sroberto	 * on these clocks as they are enabled by default.
51106163Sroberto	 */
52106163Sroberto	SYS_CLK = 1,
53106163Sroberto
54106163Sroberto	/* The MPU (ARM) core clock */
55106163Sroberto	MPU_CLK = 20,
56106163Sroberto
57106163Sroberto	/* MMC modules */
58106163Sroberto	MMC0_CLK = 100,
59106163Sroberto	MMC1_CLK,
60106163Sroberto	MMC2_CLK,
61106163Sroberto	MMC3_CLK,
62106163Sroberto	MMC4_CLK,
63106163Sroberto	MMC5_CLK,
64106163Sroberto
65106163Sroberto	/* I2C modules */
66106163Sroberto	I2C0_CLK = 200,
67106163Sroberto	I2C1_CLK,
68106163Sroberto	I2C2_CLK,
69106163Sroberto	I2C3_CLK,
70106163Sroberto	I2C4_CLK,
71106163Sroberto
72106163Sroberto	/* USB module(s) */
73106163Sroberto	USBTLL_CLK = 300,
74106163Sroberto	USBHSHOST_CLK,
75106163Sroberto	USBFSHOST_CLK,
76106163Sroberto	USBP1_PHY_CLK,
77106163Sroberto	USBP2_PHY_CLK,
78106163Sroberto	USBP1_UTMI_CLK,
79106163Sroberto	USBP2_UTMI_CLK,
80106163Sroberto	USBP1_HSIC_CLK,
81106163Sroberto	USBP2_HSIC_CLK,
82106163Sroberto
83132451Sroberto	/* UART modules */
84106163Sroberto	UART0_CLK = 400,
85106163Sroberto	UART1_CLK,
86106163Sroberto	UART2_CLK,
87106163Sroberto	UART3_CLK,
88106163Sroberto	UART4_CLK,
89106163Sroberto	UART5_CLK,
90106163Sroberto	UART6_CLK,
91106163Sroberto	UART7_CLK,
92106163Sroberto	UART8_CLK,
93106163Sroberto
94106163Sroberto	/* General purpose timer modules */
95106163Sroberto	GPTIMER1_CLK = 500,
96106163Sroberto	GPTIMER2_CLK,
97106163Sroberto	GPTIMER3_CLK,
98106163Sroberto	GPTIMER4_CLK,
99106163Sroberto	GPTIMER5_CLK,
100106163Sroberto	GPTIMER6_CLK,
101106163Sroberto	GPTIMER7_CLK,
10254359Sroberto	GPTIMER8_CLK,
10354359Sroberto	GPTIMER9_CLK,
10454359Sroberto	GPTIMER10_CLK,
10554359Sroberto	GPTIMER11_CLK,
10654359Sroberto	GPTIMER12_CLK,
10754359Sroberto
10854359Sroberto	/* McBSP module(s) */
10954359Sroberto	MCBSP1_CLK = 600,
11054359Sroberto	MCBSP2_CLK,
11154359Sroberto	MCBSP3_CLK,
11254359Sroberto	MCBSP4_CLK,
11354359Sroberto	MCBSP5_CLK,
11454359Sroberto
11554359Sroberto	/* General purpose I/O modules */
11654359Sroberto	GPIO0_CLK = 700,
11754359Sroberto	GPIO1_CLK,
11854359Sroberto	GPIO2_CLK,
11954359Sroberto	GPIO3_CLK,
12054359Sroberto	GPIO4_CLK,
12154359Sroberto	GPIO5_CLK,
12254359Sroberto	GPIO6_CLK,
12354359Sroberto
12454359Sroberto	/* sDMA module */
12554359Sroberto	SDMA_CLK = 800,
12654359Sroberto
12754359Sroberto	/* DMTimer modules */
12854359Sroberto	DMTIMER0_CLK = 900,
12954359Sroberto	DMTIMER1_CLK,
13054359Sroberto	DMTIMER2_CLK,
13154359Sroberto	DMTIMER3_CLK,
13254359Sroberto	DMTIMER4_CLK,
13354359Sroberto	DMTIMER5_CLK,
13454359Sroberto	DMTIMER6_CLK,
13554359Sroberto	DMTIMER7_CLK,
13654359Sroberto
13754359Sroberto	/* CPSW modules */
13854359Sroberto	CPSW_CLK = 1000,
13954359Sroberto
14054359Sroberto	/* Mentor USB modules */
14154359Sroberto	MUSB0_CLK = 1100,
14254359Sroberto
14354359Sroberto	/* EDMA module */
14454359Sroberto	EDMA_TPCC_CLK = 1200,
14554359Sroberto	EDMA_TPTC0_CLK,
14654359Sroberto	EDMA_TPTC1_CLK,
14754359Sroberto	EDMA_TPTC2_CLK,
14854359Sroberto
14954359Sroberto	/* LCD controller module */
15054359Sroberto	LCDC_CLK = 1300,
15154359Sroberto
15254359Sroberto	/* PWM modules */
15354359Sroberto	PWMSS0_CLK = 1400,
15454359Sroberto	PWMSS1_CLK,
15554359Sroberto	PWMSS2_CLK,
15654359Sroberto
15754359Sroberto	/* Mailbox modules */
15854359Sroberto	MAILBOX0_CLK = 1500,
15954359Sroberto
16054359Sroberto	/* Spinlock modules */
16154359Sroberto	SPINLOCK0_CLK = 1600,
16254359Sroberto
16354359Sroberto	PRUSS_CLK = 1700,
16454359Sroberto
16554359Sroberto	TSC_ADC_CLK = 1800,
16654359Sroberto
16754359Sroberto	/* RTC module */
16854359Sroberto	RTC_CLK = 1900,
16954359Sroberto
17054359Sroberto	INVALID_CLK_IDENT
17154359Sroberto
17254359Sroberto} clk_ident_t;
17354359Sroberto
17454359Sroberto/*
17554359Sroberto *
17654359Sroberto */
17754359Srobertotypedef enum {
17854359Sroberto	SYSCLK_CLK,   /* System clock */
17954359Sroberto	EXT_CLK,
18054359Sroberto
18154359Sroberto	F32KHZ_CLK,   /* 32KHz clock */
18254359Sroberto	F48MHZ_CLK,   /* 48MHz clock */
18354359Sroberto	F64MHZ_CLK,   /* 64MHz clock */
18454359Sroberto	F96MHZ_CLK,   /* 96MHz clock */
18554359Sroberto
18654359Sroberto} clk_src_t;
18754359Sroberto
18854359Srobertostruct ti_clock_dev {
18954359Sroberto	/* The profile of the timer */
19054359Sroberto	clk_ident_t  id;
19154359Sroberto
19254359Sroberto	/* A bunch of callbacks associated with the clock device */
19354359Sroberto	int (*clk_activate)(struct ti_clock_dev *clkdev);
19454359Sroberto	int (*clk_deactivate)(struct ti_clock_dev *clkdev);
19554359Sroberto	int (*clk_set_source)(struct ti_clock_dev *clkdev,
19654359Sroberto	    clk_src_t clksrc);
19754359Sroberto	int (*clk_accessible)(struct ti_clock_dev *clkdev);
19854359Sroberto	int (*clk_get_source_freq)(struct ti_clock_dev *clkdev,
19954359Sroberto	    unsigned int *freq);
20054359Sroberto};
20154359Sroberto
20254359Srobertoint ti_prcm_clk_valid(clk_ident_t clk);
20354359Srobertoint ti_prcm_clk_enable(clk_ident_t clk);
20454359Srobertoint ti_prcm_clk_disable(clk_ident_t clk);
20554359Srobertoint ti_prcm_clk_accessible(clk_ident_t clk);
20654359Srobertoint ti_prcm_clk_disable_autoidle(clk_ident_t clk);
20754359Srobertoint ti_prcm_clk_set_source(clk_ident_t clk, clk_src_t clksrc);
20854359Srobertoint ti_prcm_clk_get_source_freq(clk_ident_t clk, unsigned int *freq);
20954359Srobertovoid ti_prcm_reset(void);
21054359Sroberto
21154359Sroberto#endif   /* _TI_PRCM_H_ */
21254359Sroberto