1239281Sgonzo/* 2239281Sgonzo * Copyright (c) 2010 3239281Sgonzo * Ben Gray <ben.r.gray@gmail.com>. 4239281Sgonzo * All rights reserved. 5239281Sgonzo * 6239281Sgonzo * Redistribution and use in source and binary forms, with or without 7239281Sgonzo * modification, are permitted provided that the following conditions 8239281Sgonzo * are met: 9239281Sgonzo * 1. Redistributions of source code must retain the above copyright 10239281Sgonzo * notice, this list of conditions and the following disclaimer. 11239281Sgonzo * 2. Redistributions in binary form must reproduce the above copyright 12239281Sgonzo * notice, this list of conditions and the following disclaimer in the 13239281Sgonzo * documentation and/or other materials provided with the distribution. 14239281Sgonzo * 3. All advertising materials mentioning features or use of this software 15239281Sgonzo * must display the following acknowledgement: 16239281Sgonzo * This product includes software developed by Ben Gray. 17239281Sgonzo * 4. The name of the company nor the name of the author may be used to 18239281Sgonzo * endorse or promote products derived from this software without specific 19239281Sgonzo * prior written permission. 20239281Sgonzo * 21239281Sgonzo * THIS SOFTWARE IS PROVIDED BY BEN GRAY ``AS IS'' AND ANY EXPRESS OR 22239281Sgonzo * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 23239281Sgonzo * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 24239281Sgonzo * IN NO EVENT SHALL BEN GRAY BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 25239281Sgonzo * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 26239281Sgonzo * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 27239281Sgonzo * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 28239281Sgonzo * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 29239281Sgonzo * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 30239281Sgonzo * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31239281Sgonzo * 32239281Sgonzo * $FreeBSD: releng/10.3/sys/arm/ti/ti_scm.h 279467 2015-03-01 01:08:14Z dim $ 33239281Sgonzo */ 34239281Sgonzo 35239281Sgonzo 36239281Sgonzo/** 37239281Sgonzo * Functions to configure the PIN multiplexing on the chip. 38239281Sgonzo * 39239281Sgonzo * This is different from the GPIO module in that it is used to configure the 40239281Sgonzo * pins between modules not just GPIO input output. 41239281Sgonzo * 42239281Sgonzo */ 43239281Sgonzo#ifndef _TI_SCM_H_ 44239281Sgonzo#define _TI_SCM_H_ 45239281Sgonzo 46239281Sgonzostruct ti_scm_padconf { 47239281Sgonzo uint16_t reg_off; 48239281Sgonzo uint16_t gpio_pin; 49239281Sgonzo uint16_t gpio_mode; 50239281Sgonzo const char *ballname; 51239281Sgonzo const char *muxmodes[8]; 52239281Sgonzo}; 53239281Sgonzo 54239281Sgonzostruct ti_scm_padstate { 55239281Sgonzo const char *state; 56239281Sgonzo uint16_t reg; 57239281Sgonzo}; 58239281Sgonzo 59239281Sgonzostruct ti_scm_device { 60239281Sgonzo uint16_t padconf_muxmode_mask; 61239281Sgonzo uint16_t padconf_sate_mask; 62279467Sdim const struct ti_scm_padstate *padstate; 63279467Sdim const struct ti_scm_padconf *padconf; 64239281Sgonzo}; 65239281Sgonzo 66239281Sgonzostruct ti_scm_softc { 67239281Sgonzo device_t sc_dev; 68239281Sgonzo struct resource * sc_res[4]; 69239281Sgonzo bus_space_tag_t sc_bst; 70239281Sgonzo bus_space_handle_t sc_bsh; 71239281Sgonzo}; 72239281Sgonzo 73239281Sgonzoint ti_scm_padconf_set(const char *padname, const char *muxmode, 74239281Sgonzo unsigned int state); 75239281Sgonzoint ti_scm_padconf_get(const char *padname, const char **muxmode, 76239281Sgonzo unsigned int *state); 77239281Sgonzoint ti_scm_padconf_set_gpiomode(uint32_t gpio, unsigned int state); 78239281Sgonzoint ti_scm_padconf_get_gpiomode(uint32_t gpio, unsigned int *state); 79239281Sgonzoint ti_scm_padconf_set_gpioflags(uint32_t gpio, uint32_t flags); 80239281Sgonzovoid ti_scm_padconf_get_gpioflags(uint32_t gpio, uint32_t *flags); 81239281Sgonzoint ti_scm_reg_read_4(uint32_t reg, uint32_t *val); 82239281Sgonzoint ti_scm_reg_write_4(uint32_t reg, uint32_t val); 83239281Sgonzo 84239281Sgonzo#endif /* _TI_SCM_H_ */ 85