Back to home page

LXR

 
 

    


File indexing completed on 2025-05-11 08:23:42

0001 /*
0002  * Copyright (c) 2010
0003  *  Ben Gray <ben.r.gray@gmail.com>.
0004  * All rights reserved.
0005  *
0006  * Redistribution and use in source and binary forms, with or without
0007  * modification, are permitted provided that the following conditions
0008  * are met:
0009  * 1. Redistributions of source code must retain the above copyright
0010  *    notice, this list of conditions and the following disclaimer.
0011  * 2. Redistributions in binary form must reproduce the above copyright
0012  *    notice, this list of conditions and the following disclaimer in the
0013  *    documentation and/or other materials provided with the distribution.
0014  * 3. All advertising materials mentioning features or use of this software
0015  *    must display the following acknowledgement:
0016  *  This product includes software developed by Ben Gray.
0017  * 4. The name of the company nor the name of the author may be used to
0018  *    endorse or promote products derived from this software without specific
0019  *    prior written permission.
0020  *
0021  * THIS SOFTWARE IS PROVIDED BY BEN GRAY ``AS IS'' AND ANY EXPRESS OR
0022  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
0023  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
0024  * IN NO EVENT SHALL BEN GRAY BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
0025  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
0026  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
0027  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
0028  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
0029  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
0030  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
0031  *
0032  * $FreeBSD$
0033  */
0034 
0035 
0036 /**
0037  *  Functions to configure the PIN multiplexing on the chip.
0038  *
0039  *  This is different from the GPIO module in that it is used to configure the
0040  *  pins between modules not just GPIO input output.
0041  *
0042  */
0043 #ifndef _TI_PINMUX_H_
0044 #define _TI_PINMUX_H_
0045 #ifdef __rtems__
0046 #include <ofw/ofw.h>
0047 #endif /* __rtems__ */
0048 
0049 struct ti_pinmux_padconf {
0050     uint16_t    reg_off;
0051     uint16_t    gpio_pin;
0052     uint16_t    gpio_mode;
0053     const char  *ballname;
0054     const char  *muxmodes[8];
0055 };
0056 
0057 struct ti_pinmux_padstate {
0058     const char  *state;
0059     uint16_t    reg;
0060 };
0061 
0062 struct ti_pinmux_device {
0063     uint16_t        padconf_muxmode_mask;
0064     uint16_t        padconf_sate_mask;
0065     const struct ti_pinmux_padstate *padstate;
0066     const struct ti_pinmux_padconf  *padconf;
0067 };
0068 
0069 #ifndef __rtems__
0070 struct ti_pinmux_softc {
0071     device_t        sc_dev;
0072     struct resource *   sc_res[4];
0073     bus_space_tag_t     sc_bst;
0074     bus_space_handle_t  sc_bsh;
0075 };
0076 #else /* __rtems__ */
0077 void beagle_pinmux_init(phandle_t node);
0078 #endif /* __rtems__ */
0079 
0080 int ti_pinmux_padconf_set(const char *padname, const char *muxmode, 
0081     unsigned int state);
0082 int ti_pinmux_padconf_get(const char *padname, const char **muxmode,
0083     unsigned int *state);
0084 int ti_pinmux_padconf_set_gpiomode(uint32_t gpio, unsigned int state);
0085 int ti_pinmux_padconf_get_gpiomode(uint32_t gpio, unsigned int *state);
0086 
0087 #endif /* _TI_SCM_H_ */