FreeBSD/Linux Kernel Cross Reference
sys/arm/ti/ti_scm.h
1 /*
2 * Copyright (c) 2010
3 * Ben Gray <ben.r.gray@gmail.com>.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * 3. All advertising materials mentioning features or use of this software
15 * must display the following acknowledgement:
16 * This product includes software developed by Ben Gray.
17 * 4. The name of the company nor the name of the author may be used to
18 * endorse or promote products derived from this software without specific
19 * prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY BEN GRAY ``AS IS'' AND ANY EXPRESS OR
22 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
23 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
24 * IN NO EVENT SHALL BEN GRAY BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
27 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
29 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
30 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 *
32 * $FreeBSD: releng/10.0/sys/arm/ti/ti_scm.h 239281 2012-08-15 06:31:32Z gonzo $
33 */
34
35
36 /**
37 * Functions to configure the PIN multiplexing on the chip.
38 *
39 * This is different from the GPIO module in that it is used to configure the
40 * pins between modules not just GPIO input output.
41 *
42 */
43 #ifndef _TI_SCM_H_
44 #define _TI_SCM_H_
45
46 struct ti_scm_padconf {
47 uint16_t reg_off;
48 uint16_t gpio_pin;
49 uint16_t gpio_mode;
50 const char *ballname;
51 const char *muxmodes[8];
52 };
53
54 struct ti_scm_padstate {
55 const char *state;
56 uint16_t reg;
57 };
58
59 struct ti_scm_device {
60 uint16_t padconf_muxmode_mask;
61 uint16_t padconf_sate_mask;
62 struct ti_scm_padstate *padstate;
63 struct ti_scm_padconf *padconf;
64 };
65
66 struct ti_scm_softc {
67 device_t sc_dev;
68 struct resource * sc_res[4];
69 bus_space_tag_t sc_bst;
70 bus_space_handle_t sc_bsh;
71 };
72
73 int ti_scm_padconf_set(const char *padname, const char *muxmode,
74 unsigned int state);
75 int ti_scm_padconf_get(const char *padname, const char **muxmode,
76 unsigned int *state);
77 int ti_scm_padconf_set_gpiomode(uint32_t gpio, unsigned int state);
78 int ti_scm_padconf_get_gpiomode(uint32_t gpio, unsigned int *state);
79 int ti_scm_padconf_set_gpioflags(uint32_t gpio, uint32_t flags);
80 void ti_scm_padconf_get_gpioflags(uint32_t gpio, uint32_t *flags);
81 int ti_scm_reg_read_4(uint32_t reg, uint32_t *val);
82 int ti_scm_reg_write_4(uint32_t reg, uint32_t val);
83
84 #endif /* _TI_SCM_H_ */
Cache object: 7fe0356c03545ad0378a8419718635d2
|