Home | History | Annotate | Line # | Download | only in gumstix
gxio.c revision 1.27.8.1
      1  1.27.8.1   thorpej /*	$NetBSD: gxio.c,v 1.27.8.1 2021/08/04 16:59:13 thorpej Exp $ */
      2       1.1  kiyohara /*
      3       1.3  kiyohara  * Copyright (C) 2005, 2006, 2007 WIDE Project and SOUM Corporation.
      4       1.1  kiyohara  * All rights reserved.
      5       1.1  kiyohara  *
      6       1.1  kiyohara  * Written by Takashi Kiyohara and Susumu Miki for WIDE Project and SOUM
      7       1.1  kiyohara  * Corporation.
      8       1.1  kiyohara  *
      9       1.1  kiyohara  * Redistribution and use in source and binary forms, with or without
     10       1.1  kiyohara  * modification, are permitted provided that the following conditions
     11       1.1  kiyohara  * are met:
     12       1.1  kiyohara  * 1. Redistributions of source code must retain the above copyright
     13       1.1  kiyohara  *    notice, this list of conditions and the following disclaimer.
     14       1.1  kiyohara  * 2. Redistributions in binary form must reproduce the above copyright
     15       1.1  kiyohara  *    notice, this list of conditions and the following disclaimer in the
     16       1.1  kiyohara  *    documentation and/or other materials provided with the distribution.
     17       1.1  kiyohara  * 3. Neither the name of the project nor the name of SOUM Corporation
     18       1.1  kiyohara  *    may be used to endorse or promote products derived from this software
     19       1.1  kiyohara  *    without specific prior written permission.
     20       1.1  kiyohara  *
     21       1.1  kiyohara  * THIS SOFTWARE IS PROVIDED BY THE PROJECT and SOUM CORPORATION ``AS IS''
     22       1.1  kiyohara  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     23       1.1  kiyohara  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     24       1.1  kiyohara  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT AND SOUM CORPORATION
     25       1.1  kiyohara  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     26       1.1  kiyohara  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     27       1.1  kiyohara  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     28       1.1  kiyohara  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     29       1.1  kiyohara  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     30       1.1  kiyohara  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     31       1.1  kiyohara  * POSSIBILITY OF SUCH DAMAGE.
     32       1.1  kiyohara  */
     33       1.1  kiyohara #include <sys/cdefs.h>
     34  1.27.8.1   thorpej __KERNEL_RCSID(0, "$NetBSD: gxio.c,v 1.27.8.1 2021/08/04 16:59:13 thorpej Exp $");
     35       1.3  kiyohara 
     36      1.15  kiyohara #include "opt_cputypes.h"
     37      1.15  kiyohara #include "opt_gumstix.h"
     38       1.3  kiyohara #include "opt_gxio.h"
     39      1.17  kiyohara #if defined(OVERO)
     40      1.17  kiyohara #include "opt_omap.h"
     41      1.17  kiyohara #endif
     42       1.1  kiyohara 
     43       1.1  kiyohara #include <sys/param.h>
     44       1.1  kiyohara #include <sys/device.h>
     45       1.1  kiyohara #include <sys/errno.h>
     46      1.10  kiyohara #include <sys/kernel.h>
     47       1.1  kiyohara 
     48       1.1  kiyohara #include <sys/systm.h>
     49       1.1  kiyohara 
     50       1.1  kiyohara #include <machine/bootconfig.h>
     51       1.1  kiyohara 
     52      1.16  kiyohara #include <arm/omap/omap2_gpmcreg.h>
     53      1.21  kiyohara #if defined(OMAP2)
     54      1.15  kiyohara #include <arm/omap/omap2_reg.h>
     55      1.17  kiyohara #if defined(OMAP3530)
     56      1.16  kiyohara #include <arm/omap/omap2_intr.h>
     57      1.17  kiyohara #endif
     58      1.21  kiyohara #endif
     59      1.15  kiyohara #include <arm/omap/omap_var.h>
     60      1.21  kiyohara #include <arm/omap/ti_iicreg.h>
     61      1.23  kiyohara #include <arm/omap/tifbvar.h>
     62      1.21  kiyohara #if defined(CPU_XSCALE)
     63       1.1  kiyohara #include <arm/xscale/pxa2x0cpu.h>
     64      1.15  kiyohara #endif
     65       1.1  kiyohara #include <arm/xscale/pxa2x0reg.h>
     66       1.1  kiyohara #include <arm/xscale/pxa2x0var.h>
     67       1.1  kiyohara #include <arm/xscale/pxa2x0_gpio.h>
     68      1.16  kiyohara #include <evbarm/gumstix/gumstixreg.h>
     69       1.1  kiyohara #include <evbarm/gumstix/gumstixvar.h>
     70       1.1  kiyohara 
     71      1.16  kiyohara #include "ioconf.h"
     72       1.1  kiyohara #include "locators.h"
     73       1.1  kiyohara 
     74       1.1  kiyohara 
     75       1.3  kiyohara struct gxioconf {
     76       1.3  kiyohara 	const char *name;
     77       1.4  kiyohara 	void (*config)(void);
     78       1.3  kiyohara };
     79       1.3  kiyohara 
     80      1.16  kiyohara #if defined(GUMSTIX)
     81      1.10  kiyohara static int gxiomatch(device_t, cfdata_t, void *);
     82       1.8  kiyohara static void gxioattach(device_t, device_t, void *);
     83      1.10  kiyohara static int gxiosearch(device_t, cfdata_t, const int *, void *);
     84       1.1  kiyohara static int gxioprint(void *, const char *);
     85      1.16  kiyohara 
     86      1.16  kiyohara CFATTACH_DECL_NEW(gxio, sizeof(struct gxio_softc),
     87      1.16  kiyohara     gxiomatch, gxioattach, NULL, NULL);
     88      1.15  kiyohara #endif
     89       1.1  kiyohara 
     90      1.21  kiyohara void gxio_config(void);
     91      1.25  christos void gxio_config_expansion(const char *);
     92      1.16  kiyohara #if defined(GUMSTIX)
     93       1.6  kiyohara static void basix_config(void);
     94       1.4  kiyohara static void cfstix_config(void);
     95       1.4  kiyohara static void etherstix_config(void);
     96       1.4  kiyohara static void netcf_config(void);
     97      1.14  kiyohara static void netcf_vx_config(void);
     98       1.4  kiyohara static void netduommc_config(void);
     99       1.4  kiyohara static void netduo_config(void);
    100      1.10  kiyohara static void netmicrosd_config(void);
    101      1.10  kiyohara static void netwifimicrosd_config(void);
    102       1.4  kiyohara static void netmmc_config(void);
    103      1.10  kiyohara static void wifistix_config(void);
    104       1.4  kiyohara static void wifistix_cf_config(void);
    105      1.16  kiyohara #elif defined(OVERO)
    106      1.16  kiyohara static void eth0_config(void);
    107      1.16  kiyohara static void eth1_config(void);
    108      1.21  kiyohara static void dvi_config(void);
    109      1.21  kiyohara static void lcd_config(char);
    110      1.21  kiyohara static void header_40pin_config(int);
    111      1.21  kiyohara 
    112      1.16  kiyohara static void chestnut_config(void);
    113      1.21  kiyohara static void gallop_config(void);
    114      1.21  kiyohara static void summit_config(void);
    115      1.16  kiyohara static void tobi_config(void);
    116      1.16  kiyohara static void tobiduo_config(void);
    117      1.21  kiyohara #elif defined(DUOVERO)
    118      1.21  kiyohara static void ehci_config(void);
    119      1.21  kiyohara 
    120      1.21  kiyohara static void parlor_config(void);
    121      1.21  kiyohara #elif defined(PEPPER)
    122      1.21  kiyohara static void lcd_config(void);
    123      1.21  kiyohara static void pepper43_config(void);
    124      1.21  kiyohara 
    125      1.21  kiyohara static void pepper_config(void);
    126      1.21  kiyohara static void c_config(void);
    127      1.21  kiyohara static void dvi_config(void);
    128      1.21  kiyohara static void r_config(void);
    129      1.21  kiyohara #endif
    130      1.21  kiyohara #if defined(OVERO) || defined(DUOVERO)
    131      1.21  kiyohara struct omap_mux_conf;
    132      1.21  kiyohara static void smsh_config(struct omap_mux_conf *, int, int);
    133      1.21  kiyohara #endif
    134      1.21  kiyohara #if defined(OVERO) || defined(DUOVERO) || defined(PEPPER)
    135      1.21  kiyohara static void __udelay(unsigned int);
    136      1.21  kiyohara #endif
    137      1.21  kiyohara #if defined(PEPPER)
    138      1.21  kiyohara static int read_i2c_device(const vaddr_t, uint16_t, uint8_t, int, uint8_t *);
    139      1.15  kiyohara #endif
    140       1.1  kiyohara 
    141      1.10  kiyohara #if defined(CPU_XSCALE_PXA250)
    142      1.21  kiyohara 
    143      1.10  kiyohara static struct pxa2x0_gpioconf pxa255dep_gpioconf[] = {
    144       1.3  kiyohara 	/* Bluetooth module configuration */
    145       1.3  kiyohara 	{  7, GPIO_OUT | GPIO_SET },	/* power on */
    146       1.3  kiyohara 	{ 12, GPIO_ALT_FN_1_OUT },	/* 32kHz out. required by SingleStone */
    147       1.3  kiyohara 
    148       1.3  kiyohara 	/* AC97 configuration */
    149      1.10  kiyohara 	{ 29, GPIO_ALT_FN_1_IN },	/* SDATA_IN0 */
    150      1.10  kiyohara 
    151      1.10  kiyohara 	/* FFUART configuration */
    152      1.10  kiyohara 	{ 35, GPIO_ALT_FN_1_IN },	/* CTS */
    153      1.10  kiyohara 	{ 41, GPIO_ALT_FN_2_OUT },	/* RTS */
    154       1.3  kiyohara 
    155       1.3  kiyohara #ifndef GXIO_BLUETOOTH_ON_HWUART
    156       1.3  kiyohara 	/* BTUART configuration */
    157      1.10  kiyohara 	{ 44, GPIO_ALT_FN_1_IN },	/* BTCTS */
    158      1.10  kiyohara 	{ 45, GPIO_ALT_FN_2_OUT },	/* BTRTS */
    159       1.3  kiyohara #else
    160       1.3  kiyohara 	/* HWUART configuration */
    161       1.3  kiyohara 	{ 42, GPIO_ALT_FN_3_IN },	/* HWRXD */
    162       1.3  kiyohara 	{ 43, GPIO_ALT_FN_3_OUT },	/* HWTXD */
    163      1.10  kiyohara 	{ 44, GPIO_ALT_FN_3_IN },	/* HWCTS */
    164      1.10  kiyohara 	{ 45, GPIO_ALT_FN_3_OUT },	/* HWRTS */
    165       1.3  kiyohara #endif
    166       1.3  kiyohara 
    167       1.3  kiyohara #ifndef GXIO_BLUETOOTH_ON_HWUART
    168       1.3  kiyohara 	/* HWUART configuration */
    169       1.3  kiyohara 	{ 48, GPIO_ALT_FN_1_OUT },	/* HWTXD */
    170       1.3  kiyohara 	{ 49, GPIO_ALT_FN_1_IN },	/* HWRXD */
    171       1.3  kiyohara 	{ 50, GPIO_ALT_FN_1_IN },	/* HWCTS */
    172       1.3  kiyohara 	{ 51, GPIO_ALT_FN_1_OUT },	/* HWRTS */
    173       1.3  kiyohara #endif
    174       1.3  kiyohara 
    175       1.3  kiyohara 	{ -1 }
    176       1.1  kiyohara };
    177      1.10  kiyohara #endif
    178      1.10  kiyohara #if defined(CPU_XSCALE_PXA270)
    179      1.10  kiyohara static struct pxa2x0_gpioconf verdexdep_gpioconf[] = {
    180      1.10  kiyohara 	/* Bluetooth module configuration */
    181      1.10  kiyohara 	{   9, GPIO_ALT_FN_3_OUT },	/* CHOUT<0> */
    182      1.13  kiyohara 	{  12, GPIO_OUT | GPIO_SET },
    183      1.10  kiyohara 
    184      1.12  kiyohara 	/* LCD configuration */
    185      1.12  kiyohara 	{  17, GPIO_IN },		/* backlight on */
    186      1.12  kiyohara 
    187      1.10  kiyohara 	/* FFUART configuration */
    188      1.10  kiyohara 	{  34, GPIO_ALT_FN_1_IN },	/* FFRXD */
    189      1.10  kiyohara 	{  39, GPIO_ALT_FN_2_OUT },	/* FFTXD */
    190      1.10  kiyohara 
    191      1.10  kiyohara 	/* BTUART configuration */
    192      1.10  kiyohara 	{  42, GPIO_ALT_FN_1_IN },	/* BTRXD */
    193      1.10  kiyohara 	{  43, GPIO_ALT_FN_2_OUT },	/* BTTXD */
    194      1.10  kiyohara 	{  44, GPIO_ALT_FN_1_IN },	/* BTCTS */
    195      1.10  kiyohara 	{  45, GPIO_ALT_FN_2_OUT },	/* BTRTS */
    196      1.10  kiyohara 
    197      1.10  kiyohara 	/* AC97 configuration */
    198      1.10  kiyohara 	{  29, GPIO_ALT_FN_1_IN },	/* SDATA_IN0 */
    199      1.10  kiyohara 
    200      1.10  kiyohara 	{ -1 }
    201      1.10  kiyohara };
    202      1.21  kiyohara 
    203      1.21  kiyohara #elif defined(OMAP2)
    204      1.21  kiyohara 
    205      1.21  kiyohara struct omap_mux_conf {
    206      1.21  kiyohara 	int offset;
    207      1.21  kiyohara 	uint32_t value;
    208      1.21  kiyohara /* OMAP3/4 register values */
    209      1.21  kiyohara #define WAKEUPEVENT		(1 << 15)
    210      1.21  kiyohara #define WAKEUPENABLE		(1 << 14)
    211      1.21  kiyohara #define OFFMODEPULLTYPESELECT	(1 << 13)
    212      1.21  kiyohara #define OFFMODEPULLUDENABLE	(1 << 12)
    213      1.21  kiyohara #define OFFMODEOUTVALUE		(1 << 11)
    214      1.21  kiyohara #define OFFMODEOUTENABLE	(1 << 10)
    215      1.21  kiyohara #define OFFMODEENABLE		(1 << 9)
    216      1.21  kiyohara #define INPUTENABLE		(1 << 8)
    217      1.21  kiyohara #define PULLTYPESELECT		(1 << 4)
    218      1.21  kiyohara #define PULLUDENABLE		(1 << 3)
    219      1.21  kiyohara #define MUXMODE(n)		((n) & 0x7)
    220      1.21  kiyohara 
    221      1.21  kiyohara /* Sitara AM3xxx register values */
    222      1.21  kiyohara #define SLEWCTRL		(1 << 6)
    223      1.21  kiyohara #define RXACTIVE		(1 << 5)
    224      1.21  kiyohara #define PUTYPESEL		(1 << 4)
    225      1.21  kiyohara #define PUDEN			(1 << 3)
    226      1.21  kiyohara #define MMODE(n)		((n) & 0x7)
    227      1.21  kiyohara };
    228      1.21  kiyohara struct omap_gpio_conf {
    229      1.21  kiyohara 	int pin;
    230      1.21  kiyohara 	enum {
    231      1.21  kiyohara 		conf_input = -1,
    232      1.21  kiyohara 		conf_output_0,
    233      1.21  kiyohara 		conf_output_1,
    234      1.21  kiyohara 	} conf;
    235      1.21  kiyohara };
    236      1.21  kiyohara 
    237      1.21  kiyohara static void gxio_omap_mux_config(const struct omap_mux_conf []);
    238      1.21  kiyohara static int gxio_omap_mux_config_address(const char *, unsigned long,
    239      1.21  kiyohara 					const struct omap_mux_conf[],
    240      1.21  kiyohara 					const struct omap_mux_conf[]);
    241      1.21  kiyohara static void gxio_omap_gpio_config(const struct omap_gpio_conf[]);
    242      1.21  kiyohara void gxio_omap_gpio_write(int, int);
    243      1.21  kiyohara 
    244      1.26       ryo #if defined(OVERO)
    245      1.21  kiyohara static const struct omap_mux_conf overo_mux_i2c3_conf[] = {
    246      1.21  kiyohara 	{ 0x1c2, MUXMODE(0) | INPUTENABLE },		/* i2c3_scl */
    247      1.21  kiyohara 	{ 0x1c4, MUXMODE(0) | INPUTENABLE },		/* i2c3_sda */
    248      1.21  kiyohara 	{ -1 }
    249      1.21  kiyohara };
    250      1.26       ryo #endif
    251      1.26       ryo #if defined(OVERO)
    252      1.21  kiyohara static const struct omap_mux_conf overo_mux_mmchs2_conf[] = {
    253      1.21  kiyohara 	{ 0x158,					/* mmc2_clk */
    254      1.21  kiyohara 	  MUXMODE(0) | PULLUDENABLE | PULLTYPESELECT | INPUTENABLE },
    255      1.21  kiyohara 	{ 0x15a,					/* mmc2_cmd */
    256      1.21  kiyohara 	  MUXMODE(0) | PULLUDENABLE | PULLTYPESELECT | INPUTENABLE },
    257      1.21  kiyohara 	{ 0x15c,					/* mmc2_dat0 */
    258      1.21  kiyohara 	  MUXMODE(0) | PULLUDENABLE | PULLTYPESELECT | INPUTENABLE },
    259      1.21  kiyohara 	{ 0x15e,					/* mmc2_dat1 */
    260      1.21  kiyohara 	  MUXMODE(0) | PULLUDENABLE | PULLTYPESELECT | INPUTENABLE },
    261      1.21  kiyohara 	{ 0x160,					/* mmc2_dat2 */
    262      1.21  kiyohara 	  MUXMODE(0) | PULLUDENABLE | PULLTYPESELECT | INPUTENABLE },
    263      1.21  kiyohara 	{ 0x162,					/* mmc2_dat3 */
    264      1.21  kiyohara 	  MUXMODE(0) | PULLUDENABLE | PULLTYPESELECT | INPUTENABLE },
    265      1.21  kiyohara 	{ -1 }
    266      1.21  kiyohara };
    267      1.26       ryo #endif
    268      1.24  christos #if defined(OVERO)
    269      1.21  kiyohara static const struct omap_mux_conf overo_mux_wireless_conf[] = {
    270      1.21  kiyohara 	{ 0x0b4, MUXMODE(4) },				/* gpio_54:BT_nPOWERON*/
    271      1.21  kiyohara 	{ 0x0bc, MUXMODE(4) | INPUTENABLE },		/* gpio_58: WIFI_IRQ */
    272      1.21  kiyohara 	{ 0x19c, MUXMODE(4) },				/* gpio_164:BT_nRESET */
    273      1.21  kiyohara 	{ 0x5e0, MUXMODE(4) },				/* gpio_16: W2W_nRESET*/
    274      1.21  kiyohara 	{ -1 }
    275      1.21  kiyohara };
    276      1.21  kiyohara 
    277      1.24  christos #elif defined(DUOVERO)
    278      1.21  kiyohara static const struct omap_mux_conf duovero_mux_led_conf[] = {
    279      1.21  kiyohara 	{ 0x116, MUXMODE(3) },				/* GPIO 122 */
    280      1.21  kiyohara 	{ -1 }
    281      1.21  kiyohara };
    282      1.21  kiyohara static const struct omap_mux_conf duovero_mux_button_conf[] = {
    283      1.21  kiyohara 	{ 0x114,					/* GPIO 121 */
    284      1.21  kiyohara 	  MUXMODE(3) | PULLUDENABLE | PULLTYPESELECT | INPUTENABLE },
    285      1.21  kiyohara 	{ -1 }
    286      1.21  kiyohara };
    287      1.21  kiyohara 
    288      1.24  christos #elif defined(PEPPER)
    289      1.21  kiyohara static const struct omap_mux_conf pepper_mux_led_conf[] = {
    290      1.21  kiyohara 	{ 0x850, MMODE(7) | PUDEN },			/* GPIO 52: Blue */
    291      1.21  kiyohara 	{ 0x854, MMODE(7) | PUDEN },			/* GPIO 53: Red */
    292      1.21  kiyohara 	{ -1 }
    293      1.21  kiyohara };
    294      1.21  kiyohara static const struct omap_mux_conf pepper_mux_button_conf[] = {
    295      1.21  kiyohara 	{ 0x858, MMODE(7) | PUTYPESEL | RXACTIVE },	/* GPIO 54 */
    296      1.21  kiyohara 	{ -1 }
    297      1.21  kiyohara };
    298      1.21  kiyohara static const struct omap_mux_conf pepper_mux_mmchs3_conf[] = {
    299      1.21  kiyohara 	{ 0x844, MMODE(3) | PUTYPESEL | RXACTIVE },	/* MMC2_DAT0 */
    300      1.21  kiyohara 	{ 0x848, MMODE(3) | PUTYPESEL | RXACTIVE },	/* MMC2_DAT1 */
    301      1.21  kiyohara 	{ 0x84c, MMODE(3) | PUTYPESEL | RXACTIVE },	/* MMC2_DAT2 */
    302      1.21  kiyohara 	{ 0x878, MMODE(3) | PUTYPESEL | RXACTIVE },	/* MMC2_DAT3 */
    303      1.21  kiyohara 	{ 0x888, MMODE(3) | PUTYPESEL | RXACTIVE },	/* MMC2_CMD */
    304      1.21  kiyohara 	{ 0x88c, MMODE(3) | PUTYPESEL | RXACTIVE },	/* MMC2_CLK */
    305      1.21  kiyohara 	{ -1 }
    306      1.21  kiyohara };
    307      1.21  kiyohara static const struct omap_mux_conf pepper_mux_audio_codec_conf[] = {
    308      1.21  kiyohara 	{ 0x840, MMODE(7) | PUDEN },			/* GPIO 48: #Reset */
    309      1.21  kiyohara 	{ -1 }
    310      1.21  kiyohara };
    311      1.24  christos #endif
    312      1.21  kiyohara 
    313      1.10  kiyohara #endif
    314       1.1  kiyohara 
    315      1.21  kiyohara static const struct gxioconf gxioconflist[] = {
    316      1.16  kiyohara #if defined(GUMSTIX)
    317       1.6  kiyohara 	{ "basix",		basix_config },
    318       1.1  kiyohara 	{ "cfstix",		cfstix_config },
    319       1.1  kiyohara 	{ "etherstix",		etherstix_config },
    320       1.1  kiyohara 	{ "netcf",		netcf_config },
    321      1.14  kiyohara 	{ "netcf-vx",		netcf_vx_config },
    322       1.3  kiyohara 	{ "netduo-mmc",		netduommc_config },
    323       1.1  kiyohara 	{ "netduo",		netduo_config },
    324      1.10  kiyohara 	{ "netmicrosd",		netmicrosd_config },
    325      1.10  kiyohara 	{ "netmicrosd-vx",	netmicrosd_config },
    326      1.10  kiyohara 	{ "netwifimicrosd",	netwifimicrosd_config },
    327       1.1  kiyohara 	{ "netmmc",		netmmc_config },
    328      1.10  kiyohara 	{ "netpro-vx",		netwifimicrosd_config },
    329       1.4  kiyohara 	{ "wifistix-cf",	wifistix_cf_config },
    330      1.10  kiyohara 	{ "wifistix",		wifistix_config },
    331      1.16  kiyohara #elif defined(OVERO)
    332      1.16  kiyohara 	{ "chestnut43",		chestnut_config },
    333      1.21  kiyohara 	{ "gallop43",		gallop_config },
    334      1.21  kiyohara 	{ "summit",		summit_config },
    335      1.16  kiyohara 	{ "tobi",		tobi_config },
    336      1.16  kiyohara 	{ "tobi-duo",		tobiduo_config },
    337      1.21  kiyohara #elif defined(DUOVERO)
    338      1.21  kiyohara 	{ "parlor",		parlor_config },
    339      1.21  kiyohara #elif defined(PEPPER)
    340      1.21  kiyohara 	{ "43c",		c_config },
    341      1.21  kiyohara 	{ "43r",		r_config },
    342      1.21  kiyohara 	{ "dvi",		dvi_config },
    343      1.15  kiyohara #endif
    344       1.1  kiyohara 	{ NULL }
    345       1.1  kiyohara };
    346       1.1  kiyohara 
    347      1.10  kiyohara int gxpcic_gpio_reset;
    348      1.10  kiyohara struct gxpcic_slot_irqs gxpcic_slot_irqs[2] = { { 0, -1, -1 }, { 0, -1, -1 } };
    349      1.10  kiyohara 
    350       1.1  kiyohara 
    351      1.16  kiyohara #if defined(GUMSTIX)
    352       1.1  kiyohara /* ARGSUSED */
    353       1.1  kiyohara static int
    354      1.10  kiyohara gxiomatch(device_t parent, cfdata_t match, void *aux)
    355       1.1  kiyohara {
    356      1.16  kiyohara 
    357      1.10  kiyohara 	struct pxaip_attach_args *pxa = aux;
    358       1.1  kiyohara 	bus_space_tag_t iot = &pxa2x0_bs_tag;
    359       1.1  kiyohara 	bus_space_handle_t ioh;
    360       1.1  kiyohara 
    361      1.10  kiyohara 	if (strcmp(pxa->pxa_name, match->cf_name) != 0 ||
    362      1.10  kiyohara 	    pxa->pxa_addr != PXAIPCF_ADDR_DEFAULT)
    363      1.10  kiyohara 		 return 0;
    364      1.10  kiyohara 
    365       1.1  kiyohara 	if (bus_space_map(iot,
    366       1.1  kiyohara 	    PXA2X0_MEMCTL_BASE, PXA2X0_MEMCTL_SIZE, 0, &ioh))
    367      1.16  kiyohara 		return 0;
    368       1.1  kiyohara 	bus_space_unmap(iot, ioh, PXA2X0_MEMCTL_SIZE);
    369       1.1  kiyohara 
    370       1.1  kiyohara 	/* nothing */
    371      1.16  kiyohara 	return 1;
    372       1.1  kiyohara }
    373       1.1  kiyohara 
    374       1.1  kiyohara /* ARGSUSED */
    375       1.1  kiyohara static void
    376       1.8  kiyohara gxioattach(device_t parent, device_t self, void *aux)
    377       1.1  kiyohara {
    378       1.3  kiyohara 	struct gxio_softc *sc = device_private(self);
    379       1.1  kiyohara 
    380       1.3  kiyohara 	aprint_normal("\n");
    381       1.3  kiyohara 	aprint_naive("\n");
    382       1.1  kiyohara 
    383       1.8  kiyohara 	sc->sc_dev = self;
    384       1.1  kiyohara 	sc->sc_iot = &pxa2x0_bs_tag;
    385       1.1  kiyohara 
    386       1.1  kiyohara 	if (bus_space_map(sc->sc_iot,
    387       1.1  kiyohara 	    PXA2X0_MEMCTL_BASE, PXA2X0_MEMCTL_SIZE, 0, &sc->sc_ioh))
    388       1.1  kiyohara 		return;
    389       1.1  kiyohara 
    390       1.1  kiyohara 	/*
    391      1.16  kiyohara 	 *  Attach each gumstix(busheader)/overo expansion board devices.
    392       1.1  kiyohara 	 */
    393      1.27   thorpej 	config_search(self, NULL,
    394  1.27.8.1   thorpej 	    CFARGS(.search = gxiosearch));
    395       1.1  kiyohara }
    396       1.1  kiyohara 
    397       1.1  kiyohara /* ARGSUSED */
    398       1.1  kiyohara static int
    399      1.10  kiyohara gxiosearch(device_t parent, cfdata_t cf, const int *ldesc, void *aux)
    400       1.1  kiyohara {
    401       1.3  kiyohara 	struct gxio_softc *sc = device_private(parent);
    402       1.1  kiyohara 	struct gxio_attach_args gxa;
    403       1.1  kiyohara 
    404       1.1  kiyohara 	gxa.gxa_sc = sc;
    405       1.1  kiyohara 	gxa.gxa_iot = sc->sc_iot;
    406       1.1  kiyohara 	gxa.gxa_addr = cf->cf_loc[GXIOCF_ADDR];
    407       1.1  kiyohara 	gxa.gxa_gpirq = cf->cf_loc[GXIOCF_GPIRQ];
    408       1.1  kiyohara 
    409      1.27   thorpej 	if (config_probe(parent, cf, &gxa))
    410  1.27.8.1   thorpej 		config_attach(parent, cf, &gxa, gxioprint, CFARGS_NONE);
    411       1.1  kiyohara 
    412      1.16  kiyohara 	return 0;
    413       1.1  kiyohara }
    414       1.1  kiyohara 
    415       1.1  kiyohara /* ARGSUSED */
    416       1.1  kiyohara static int
    417       1.1  kiyohara gxioprint(void *aux, const char *name)
    418       1.1  kiyohara {
    419       1.1  kiyohara 	struct gxio_attach_args *gxa = (struct gxio_attach_args *)aux;
    420       1.1  kiyohara 
    421       1.1  kiyohara 	if (gxa->gxa_addr != GXIOCF_ADDR_DEFAULT)
    422       1.1  kiyohara 		printf(" addr 0x%lx", gxa->gxa_addr);
    423       1.1  kiyohara 	if (gxa->gxa_gpirq > 0)
    424       1.1  kiyohara 		printf(" gpirq %d", gxa->gxa_gpirq);
    425      1.16  kiyohara 	return UNCONF;
    426       1.1  kiyohara }
    427      1.15  kiyohara #endif
    428       1.1  kiyohara 
    429       1.1  kiyohara 
    430      1.21  kiyohara #if defined(GUMSTIX)
    431       1.1  kiyohara /*
    432       1.3  kiyohara  * configure for GPIO pin and expansion boards.
    433       1.1  kiyohara  */
    434       1.1  kiyohara void
    435      1.21  kiyohara gxio_config(void)
    436       1.3  kiyohara {
    437      1.10  kiyohara #if defined(CPU_XSCALE_PXA250)
    438       1.5  kiyohara 	struct pxa2x0_gpioconf *gumstix_gpioconf[] = {
    439       1.5  kiyohara 		pxa25x_com_ffuart_gpioconf,
    440       1.5  kiyohara 		pxa25x_com_stuart_gpioconf,
    441       1.5  kiyohara #ifndef GXIO_BLUETOOTH_ON_HWUART
    442       1.5  kiyohara 		pxa25x_com_btuart_gpioconf,
    443       1.5  kiyohara #endif
    444       1.5  kiyohara 		pxa25x_com_hwuart_gpioconf,
    445       1.5  kiyohara 		pxa25x_i2c_gpioconf,
    446       1.5  kiyohara 		pxa25x_pxaacu_gpioconf,
    447      1.10  kiyohara 		pxa255dep_gpioconf,
    448      1.10  kiyohara 		NULL
    449      1.10  kiyohara 	};
    450      1.10  kiyohara #endif
    451      1.10  kiyohara #if defined(CPU_XSCALE_PXA270)
    452      1.10  kiyohara 	struct pxa2x0_gpioconf *verdex_gpioconf[] = {
    453      1.10  kiyohara 		pxa27x_com_ffuart_gpioconf,
    454      1.10  kiyohara 		pxa27x_com_stuart_gpioconf,
    455      1.10  kiyohara 		pxa27x_com_btuart_gpioconf,
    456      1.10  kiyohara 		pxa27x_i2c_gpioconf,
    457      1.10  kiyohara 		pxa27x_pxaacu_gpioconf,
    458      1.10  kiyohara 		pxa27x_pxamci_gpioconf,
    459      1.10  kiyohara 		pxa27x_ohci_gpioconf,
    460      1.10  kiyohara 		verdexdep_gpioconf,
    461       1.5  kiyohara 		NULL
    462       1.5  kiyohara 	};
    463      1.10  kiyohara #endif
    464       1.3  kiyohara 
    465       1.3  kiyohara 	/* XXX: turn off for power of bluetooth module */
    466      1.13  kiyohara #if defined(CPU_XSCALE_PXA250)
    467       1.3  kiyohara 	pxa2x0_gpio_set_function(7, GPIO_OUT | GPIO_CLR);
    468      1.13  kiyohara #elif defined(CPU_XSCALE_PXA270)
    469      1.13  kiyohara 	pxa2x0_gpio_set_function(12, GPIO_OUT | GPIO_CLR);
    470      1.13  kiyohara #endif
    471       1.3  kiyohara 	delay(100);
    472       1.3  kiyohara 
    473      1.10  kiyohara #if defined(CPU_XSCALE_PXA270) && defined(CPU_XSCALE_PXA250)
    474      1.10  kiyohara 	pxa2x0_gpio_config(
    475      1.10  kiyohara 	    (CPU_IS_PXA250) ? gumstix_gpioconf : verdex_gpioconf);
    476      1.15  kiyohara #elif defined(CPU_XSCALE_PXA270) || defined(CPU_XSCALE_PXA250)
    477      1.10  kiyohara #if defined(CPU_XSCALE_PXA270)
    478      1.10  kiyohara 	pxa2x0_gpio_config(verdex_gpioconf);
    479      1.10  kiyohara #else
    480       1.5  kiyohara 	pxa2x0_gpio_config(gumstix_gpioconf);
    481      1.10  kiyohara #endif
    482      1.10  kiyohara #endif
    483       1.3  kiyohara }
    484      1.21  kiyohara #elif defined(OVERO) || defined(DUOVERO) || defined(PEPPER)
    485      1.21  kiyohara static void
    486      1.21  kiyohara gxio_omap_mux_config(const struct omap_mux_conf mux_conf[])
    487      1.21  kiyohara {
    488      1.21  kiyohara #if defined(OVERO)
    489      1.21  kiyohara 	const vaddr_t ctrlmod_base = OVERO_L4_CORE_VBASE + 0x2000;
    490      1.21  kiyohara #elif defined(DUOVERO)
    491      1.21  kiyohara 	const vaddr_t ctrlmod_base = DUOVERO_L4_CM_VBASE;
    492      1.21  kiyohara #elif defined(PEPPER)
    493      1.21  kiyohara 	const vaddr_t ctrlmod_base = PEPPER_PRCM_VBASE + 0x10000;
    494      1.21  kiyohara #endif
    495      1.21  kiyohara 	int i;
    496      1.21  kiyohara 
    497      1.21  kiyohara 	for (i = 0; mux_conf[i].offset != -1; i++)
    498      1.21  kiyohara #if !defined(TI_AM335X)
    499      1.21  kiyohara 		ioreg16_write(ctrlmod_base + mux_conf[i].offset,
    500      1.21  kiyohara 		    mux_conf[i].value);
    501      1.21  kiyohara #else
    502      1.21  kiyohara 		ioreg_write(ctrlmod_base + mux_conf[i].offset,
    503      1.21  kiyohara 		    mux_conf[i].value);
    504      1.21  kiyohara #endif
    505      1.21  kiyohara }
    506      1.21  kiyohara 
    507      1.21  kiyohara static int
    508      1.21  kiyohara gxio_omap_mux_config_address(const char *name, unsigned long address,
    509      1.21  kiyohara 			     const struct omap_mux_conf mux_conf[],
    510      1.21  kiyohara 			     const struct omap_mux_conf not_mux_conf[])
    511      1.21  kiyohara {
    512      1.21  kiyohara 	extern struct cfdata cfdata[];
    513      1.21  kiyohara 	cfdata_t cf = &cfdata[0];
    514      1.21  kiyohara 
    515      1.21  kiyohara 	while (cf->cf_name != NULL) {
    516      1.21  kiyohara 		if (strcmp(name, cf->cf_name) == 0 &&
    517      1.21  kiyohara 		    address == cf->cf_loc[OBIOCF_ADDR]) {
    518      1.21  kiyohara 			gxio_omap_mux_config(mux_conf);
    519      1.21  kiyohara 			return 0;
    520      1.21  kiyohara 		}
    521      1.21  kiyohara 		cf++;
    522      1.21  kiyohara 	}
    523      1.21  kiyohara 
    524      1.21  kiyohara 	if (not_mux_conf == NULL)
    525      1.21  kiyohara 		return -1;
    526      1.21  kiyohara 
    527      1.21  kiyohara 	gxio_omap_mux_config(not_mux_conf);
    528      1.21  kiyohara 	return 0;
    529      1.21  kiyohara }
    530      1.21  kiyohara 
    531      1.21  kiyohara #if defined(OVERO)
    532      1.21  kiyohara #define gpio_reg_read		ioreg_read
    533      1.21  kiyohara #define gpio_reg_write		ioreg_write
    534      1.21  kiyohara #elif defined(DUOVERO) || defined(PEPPER)
    535      1.21  kiyohara #define gpio_reg_read(a)	ioreg_read((a) + GPIO_SIZE2)
    536      1.21  kiyohara #define gpio_reg_write(a, v)	ioreg_write((a) + GPIO_SIZE2, (v))
    537      1.21  kiyohara #endif
    538      1.21  kiyohara 
    539      1.21  kiyohara static const vaddr_t gpio_bases[] = {
    540      1.21  kiyohara #if defined(OVERO)
    541      1.21  kiyohara #define OVERO_GPIO_VBASE(n) ((n) == 1 ? BASE(WAKEUP, n) : BASE(PERIPHERAL, n))
    542      1.21  kiyohara #define GPIO(n)		GPIO ## n ## _BASE_3530
    543      1.21  kiyohara #define BASE(a, n) \
    544      1.21  kiyohara 	(OVERO_L4_ ## a ## _VBASE + (GPIO(n) - OMAP3530_L4_ ## a ## _BASE))
    545      1.21  kiyohara 
    546      1.21  kiyohara 	GPIO1_BASE_3530,
    547      1.21  kiyohara 	GPIO2_BASE_3530,
    548      1.21  kiyohara 	GPIO3_BASE_3530,
    549      1.21  kiyohara 	GPIO4_BASE_3530,
    550      1.21  kiyohara 	GPIO5_BASE_3530,
    551      1.21  kiyohara 	GPIO6_BASE_3530,
    552      1.21  kiyohara 
    553      1.21  kiyohara #elif defined(DUOVERO)
    554      1.21  kiyohara #define DUOVERO_GPIO_VBASE(n) ((n) == 1 ? BASE(WAKEUP, n) : BASE(PERIPHERAL, n))
    555      1.21  kiyohara #define GPIO(n)		GPIO ## n ## _BASE_4430
    556      1.21  kiyohara #define BASE(a, n) \
    557      1.21  kiyohara 	(DUOVERO_L4_ ## a ## _VBASE + (GPIO(n) - OMAP4430_L4_ ## a ## _BASE))
    558      1.21  kiyohara 
    559      1.21  kiyohara 	DUOVERO_GPIO_VBASE(1),
    560      1.21  kiyohara 	DUOVERO_GPIO_VBASE(2),
    561      1.21  kiyohara 	DUOVERO_GPIO_VBASE(3),
    562      1.21  kiyohara 	DUOVERO_GPIO_VBASE(4),
    563      1.21  kiyohara 	DUOVERO_GPIO_VBASE(5),
    564      1.21  kiyohara 
    565      1.21  kiyohara #elif defined(PEPPER)
    566      1.21  kiyohara #define PEPPER_GPIO_VBASE(n) ((n) == 0 ? WAKEUP(n) : PERIPHERAL(n))
    567      1.21  kiyohara #define GPIO(n)		GPIO ## n ## _BASE_TI_AM335X
    568      1.21  kiyohara #define WAKEUP(n)	(PEPPER_PRCM_VBASE + (GPIO(n) - OMAP2_CM_BASE))
    569      1.21  kiyohara #define PERIPHERAL(n) \
    570      1.21  kiyohara 	(PEPPER_L4_PERIPHERAL_VBASE + (GPIO(n) - TI_AM335X_L4_PERIPHERAL_BASE))
    571      1.21  kiyohara 
    572      1.21  kiyohara 	PEPPER_GPIO_VBASE(0),
    573      1.21  kiyohara 	PEPPER_GPIO_VBASE(1),
    574      1.21  kiyohara 	PEPPER_GPIO_VBASE(2),
    575      1.21  kiyohara 	PEPPER_GPIO_VBASE(3),
    576      1.21  kiyohara #endif
    577      1.21  kiyohara };
    578      1.21  kiyohara 
    579      1.21  kiyohara static void
    580      1.21  kiyohara gxio_omap_gpio_config(const struct omap_gpio_conf gpio_conf[])
    581      1.21  kiyohara {
    582      1.21  kiyohara 	vaddr_t gpio_base;
    583      1.21  kiyohara 	int mask, i;
    584      1.21  kiyohara 
    585      1.21  kiyohara 	for (i = 0; gpio_conf[i].pin != -1; i++) {
    586      1.21  kiyohara 		gpio_base = gpio_bases[gpio_conf[i].pin / 32];
    587      1.21  kiyohara 		mask = 1 << (gpio_conf[i].pin % 32);
    588      1.21  kiyohara 		switch (gpio_conf[i].conf) {
    589      1.21  kiyohara 		case conf_input:
    590      1.21  kiyohara 			ioreg_write(gpio_base + GPIO_OE,
    591      1.21  kiyohara 			    ioreg_read(gpio_base + GPIO_OE) | mask);
    592      1.21  kiyohara 			break;
    593      1.21  kiyohara 		case conf_output_0:
    594      1.21  kiyohara 			ioreg_write(gpio_base + GPIO_OE,
    595      1.21  kiyohara 			    ioreg_read(gpio_base + GPIO_OE) | ~mask);
    596      1.21  kiyohara #if 0
    597      1.21  kiyohara 			ioreg_write(gpio_base + GPIO_CLEARDATAOUT, mask);
    598      1.21  kiyohara #else
    599      1.21  kiyohara 			ioreg_write(gpio_base + GPIO_DATAOUT,
    600      1.21  kiyohara 			    ioreg_read(gpio_base + GPIO_DATAOUT) & ~mask);
    601      1.21  kiyohara #endif
    602      1.21  kiyohara 			break;
    603      1.21  kiyohara 		case conf_output_1:
    604      1.21  kiyohara 			ioreg_write(gpio_base + GPIO_OE,
    605      1.21  kiyohara 			    ioreg_read(gpio_base + GPIO_OE) | ~mask);
    606      1.21  kiyohara #if 0
    607      1.21  kiyohara 			ioreg_write(gpio_base + GPIO_SETDATAOUT, mask);
    608      1.21  kiyohara #else
    609      1.21  kiyohara 			ioreg_write(gpio_base + GPIO_DATAOUT,
    610      1.21  kiyohara 			    ioreg_read(gpio_base + GPIO_DATAOUT) | mask);
    611      1.21  kiyohara #endif
    612      1.21  kiyohara 			break;
    613      1.21  kiyohara 		}
    614      1.21  kiyohara 	}
    615      1.21  kiyohara }
    616      1.21  kiyohara 
    617      1.21  kiyohara void
    618      1.21  kiyohara gxio_omap_gpio_write(int pin, int val)
    619      1.21  kiyohara {
    620      1.21  kiyohara 	vaddr_t gpio_base;
    621      1.21  kiyohara 	int mask;
    622      1.21  kiyohara 
    623      1.21  kiyohara 	KASSERT(pin / 32 < __arraycount(gpio_bases));
    624      1.21  kiyohara 
    625      1.21  kiyohara 	gpio_base = gpio_bases[pin / 32];
    626      1.21  kiyohara 	mask = 1 << (pin % 32);
    627      1.21  kiyohara 	if (val == 0)
    628      1.21  kiyohara 		ioreg_write(gpio_base + GPIO_CLEARDATAOUT, mask);
    629      1.21  kiyohara 	else
    630      1.21  kiyohara 		ioreg_write(gpio_base + GPIO_SETDATAOUT, mask);
    631      1.21  kiyohara }
    632      1.21  kiyohara 
    633      1.21  kiyohara /*
    634      1.21  kiyohara  * configure for MUX, GPIO.
    635      1.21  kiyohara  */
    636      1.21  kiyohara void
    637      1.21  kiyohara gxio_config(void)
    638      1.21  kiyohara {
    639      1.21  kiyohara 	const struct omap_mux_conf *mux_conf[] = {
    640      1.21  kiyohara #if defined(OVERO)
    641      1.21  kiyohara 		overo_mux_i2c3_conf,
    642      1.21  kiyohara 		overo_mux_mmchs2_conf,
    643      1.21  kiyohara 		overo_mux_wireless_conf,
    644      1.21  kiyohara #elif defined(DUOVERO)
    645      1.21  kiyohara 		duovero_mux_led_conf,
    646      1.21  kiyohara 		duovero_mux_button_conf,
    647      1.21  kiyohara #elif defined(PEPPER)
    648      1.21  kiyohara 		pepper_mux_led_conf,
    649      1.21  kiyohara 		pepper_mux_button_conf,
    650      1.21  kiyohara 		pepper_mux_mmchs3_conf,
    651      1.21  kiyohara 		pepper_mux_audio_codec_conf,
    652      1.21  kiyohara #endif
    653      1.21  kiyohara 	};
    654      1.21  kiyohara 	const struct omap_gpio_conf gpio_conf[] = {
    655      1.21  kiyohara #if defined(OVERO)
    656      1.21  kiyohara 		{  16, conf_output_0 },		/* Wireless: #Reset */
    657      1.21  kiyohara #elif defined(PEPPER)
    658      1.21  kiyohara 		{  48, conf_output_0 },		/* Audio Codec: #Reset */
    659      1.21  kiyohara #endif
    660      1.21  kiyohara 		{ -1 }
    661      1.21  kiyohara 	};
    662      1.21  kiyohara 	int i;
    663      1.21  kiyohara 
    664      1.21  kiyohara 	for (i = 0; i < __arraycount(mux_conf); i++)
    665      1.21  kiyohara 		gxio_omap_mux_config(mux_conf[i]);
    666      1.21  kiyohara 	gxio_omap_gpio_config(gpio_conf);
    667      1.21  kiyohara }
    668      1.21  kiyohara #endif
    669       1.3  kiyohara 
    670      1.25  christos static int
    671      1.25  christos gxio_find_default_expansion(void)
    672       1.4  kiyohara {
    673      1.25  christos #ifdef GXIO_DEFAULT_EXPANSION
    674      1.25  christos 	int i;
    675       1.4  kiyohara 
    676      1.25  christos 	/* Find out the default expansion */
    677      1.21  kiyohara 	for (i = 0; gxioconflist[i].name != NULL; i++)
    678      1.21  kiyohara 		if (strncasecmp(gxioconflist[i].name, GXIO_DEFAULT_EXPANSION,
    679      1.25  christos 		    strlen(gxioconflist[i].name) + 1) == 0)
    680      1.21  kiyohara 			break;
    681      1.25  christos 	return gxioconflist[i].name == NULL ? -1 : i;
    682      1.21  kiyohara #else
    683      1.25  christos 	return -1;
    684      1.21  kiyohara #endif
    685      1.25  christos }
    686      1.25  christos 
    687      1.25  christos void
    688      1.25  christos gxio_config_expansion(const char *expansion)
    689      1.25  christos {
    690      1.25  christos 	int i, d;
    691      1.25  christos 
    692      1.25  christos 	d = gxio_find_default_expansion();
    693      1.25  christos 
    694      1.25  christos 	/* Print information about expansions */
    695      1.21  kiyohara 	printf("supported expansions:\n");
    696      1.21  kiyohara 	for (i = 0; gxioconflist[i].name != NULL; i++)
    697      1.25  christos 		printf("  %s%s\n", gxioconflist[i].name,
    698      1.21  kiyohara 		    i == d ? " (DEFAULT)" : "");
    699      1.21  kiyohara 
    700      1.25  christos 
    701      1.25  christos 	if (expansion == NULL) {
    702      1.25  christos 		printf("not specified 'expansion=' in the boot args.\n");
    703      1.25  christos 		i = -1;
    704      1.25  christos 	} else {
    705      1.25  christos 		for (i = 0; gxioconflist[i].name != NULL; i++)
    706      1.25  christos 			if (strncasecmp(gxioconflist[i].name, expansion,
    707      1.25  christos 			    strlen(gxioconflist[i].name) + 1) == 0)
    708      1.25  christos 				break;
    709      1.25  christos 		if (gxioconflist[i].name == NULL) {
    710      1.25  christos 			printf("unknown expansion specified: %s\n", expansion);
    711      1.25  christos 			i = -1;
    712      1.25  christos 		}
    713       1.6  kiyohara 	}
    714       1.4  kiyohara 
    715      1.25  christos 	/* Do some magic stuff for PEPPER */
    716      1.21  kiyohara #if defined(PEPPER)
    717      1.25  christos 	if (i < 0) {
    718      1.21  kiyohara 		struct pepper_board_id {
    719      1.21  kiyohara 			unsigned int device_vendor;
    720      1.21  kiyohara #define GUMSTIX_PEPPER          0x30000200	/* 1st gen */
    721      1.21  kiyohara #define GUMSTIX_PEPPER_DVI      0x31000200	/* DVI and newer */
    722      1.21  kiyohara 			unsigned char revision;
    723      1.21  kiyohara 			unsigned char content;
    724      1.21  kiyohara 			char fab_revision[8];
    725      1.21  kiyohara 			char env_var[16];
    726      1.21  kiyohara 			char env_setting[64];
    727      1.21  kiyohara 		} id;
    728      1.21  kiyohara 		const vaddr_t i2c_base = PEPPER_PRCM_VBASE + 0xb000;
    729      1.21  kiyohara 		const uint8_t eeprom = 0x50;
    730      1.21  kiyohara 		const uint8_t len = sizeof(id);
    731      1.21  kiyohara 		int rv;
    732      1.21  kiyohara 
    733      1.21  kiyohara 		rv = read_i2c_device(i2c_base, eeprom, 0x00, len, (void *)&id);
    734      1.21  kiyohara 		if (rv == 0)
    735      1.21  kiyohara 			if (id.device_vendor == GUMSTIX_PEPPER) {
    736      1.21  kiyohara 				printf("configure auto detected expansion"
    737      1.21  kiyohara 				    " (pepper)\n");
    738      1.21  kiyohara 				pepper_config();
    739      1.21  kiyohara 				return;
    740      1.21  kiyohara 			}
    741      1.21  kiyohara 	}
    742      1.21  kiyohara #endif
    743       1.1  kiyohara 
    744      1.25  christos 	/*
    745      1.25  christos 	 * Now proceed to configure the default expansion if one was
    746      1.25  christos 	 * specified (and found) or return.
    747      1.25  christos 	 */
    748      1.25  christos 	const char *toconfigure;
    749      1.25  christos 	if (i < 0) {
    750      1.25  christos #ifdef GXIO_DEFAULT_EXPANSION
    751      1.25  christos 		if (d == -1) {
    752      1.25  christos 			printf("default expansion (%s) not found\n",
    753      1.25  christos 			    GXIO_DEFAULT_EXPANSION);
    754      1.25  christos 			return;
    755      1.25  christos 		}
    756      1.25  christos 		expansion = GXIO_DEFAULT_EXPANSION;
    757      1.25  christos 		i = d;
    758      1.25  christos 		toconfigure = "default";
    759      1.25  christos #else
    760      1.25  christos 		return;
    761      1.25  christos #endif
    762      1.25  christos 	} else
    763      1.25  christos 		toconfigure = "specified";
    764      1.25  christos 
    765      1.25  christos 	printf("configure %s expansion (%s)\n", toconfigure, expansion);
    766      1.25  christos 	gxioconflist[i].config();
    767       1.3  kiyohara }
    768       1.1  kiyohara 
    769       1.1  kiyohara 
    770      1.16  kiyohara #if defined(GUMSTIX)
    771      1.16  kiyohara 
    772       1.1  kiyohara static void
    773       1.9    cegger basix_config(void)
    774       1.6  kiyohara {
    775       1.6  kiyohara 
    776       1.6  kiyohara 	pxa2x0_gpio_set_function(8, GPIO_ALT_FN_1_OUT);		/* MMCCS0 */
    777       1.6  kiyohara 	pxa2x0_gpio_set_function(53, GPIO_ALT_FN_1_OUT);	/* MMCCLK */
    778       1.6  kiyohara #if 0
    779       1.6  kiyohara 	/* this configuration set by gxmci.c::pxamci_attach() */
    780       1.6  kiyohara 	pxa2x0_gpio_set_function(11, GPIO_IN);			/* nSD_DETECT */
    781       1.6  kiyohara 	pxa2x0_gpio_set_function(22, GPIO_IN);			/* nSD_WP */
    782       1.6  kiyohara #endif
    783       1.6  kiyohara }
    784       1.6  kiyohara 
    785       1.6  kiyohara static void
    786       1.9    cegger cfstix_config(void)
    787       1.1  kiyohara {
    788       1.1  kiyohara 	u_int gpio, npoe_fn;
    789      1.10  kiyohara #if defined(CPU_XSCALE_PXA270) && defined(CPU_XSCALE_PXA250)
    790      1.10  kiyohara 	int bvd = (CPU_IS_PXA250) ? 4 : 111;
    791      1.10  kiyohara #else
    792      1.10  kiyohara #if defined(CPU_XSCALE_PXA270)
    793      1.10  kiyohara 	const int bvd = 111;
    794      1.10  kiyohara #else
    795      1.10  kiyohara 	const int bvd = 4;
    796      1.10  kiyohara #endif
    797      1.10  kiyohara #endif
    798      1.10  kiyohara 
    799      1.10  kiyohara 	if (CPU_IS_PXA250) {
    800      1.10  kiyohara 		gxpcic_slot_irqs[0].valid = 1;
    801      1.10  kiyohara 		gxpcic_slot_irqs[0].cd = 11;
    802      1.10  kiyohara 		gxpcic_slot_irqs[0].prdy = 26;
    803      1.10  kiyohara 		gxpcic_gpio_reset = 8;
    804      1.10  kiyohara 	} else {
    805      1.10  kiyohara 		gxpcic_slot_irqs[0].valid = 1;
    806      1.10  kiyohara 		gxpcic_slot_irqs[0].cd = 104;
    807      1.10  kiyohara 		gxpcic_slot_irqs[0].prdy = 96;
    808      1.10  kiyohara 		gxpcic_gpio_reset = 97;
    809      1.10  kiyohara 	}
    810       1.1  kiyohara 
    811       1.4  kiyohara #if 1
    812      1.10  kiyohara 	/* PCD/PRDY set by pxa2x0_pcic.c::pxapcic_attach_common() */
    813       1.4  kiyohara #else
    814       1.4  kiyohara 	pxa2x0_gpio_set_function(11, GPIO_IN);		/* PCD1 */
    815       1.4  kiyohara 	pxa2x0_gpio_set_function(26, GPIO_IN);		/* PRDY1/~IRQ1 */
    816       1.4  kiyohara #endif
    817      1.10  kiyohara 	pxa2x0_gpio_set_function(bvd, GPIO_IN); 	/* BVD1/~STSCHG1 */
    818       1.1  kiyohara 
    819       1.1  kiyohara 	for (gpio = 48, npoe_fn = 0; gpio <= 53 ; gpio++)
    820       1.1  kiyohara 		npoe_fn |= pxa2x0_gpio_get_function(gpio);
    821       1.1  kiyohara 	npoe_fn &= GPIO_SET;
    822       1.1  kiyohara 
    823       1.1  kiyohara 	pxa2x0_gpio_set_function(48, GPIO_ALT_FN_2_OUT | npoe_fn); /* nPOE */
    824       1.1  kiyohara 	pxa2x0_gpio_set_function(49, GPIO_ALT_FN_2_OUT);	/* nPWE */
    825       1.1  kiyohara 	pxa2x0_gpio_set_function(50, GPIO_ALT_FN_2_OUT);	/* nPIOR */
    826       1.1  kiyohara 	pxa2x0_gpio_set_function(51, GPIO_ALT_FN_2_OUT);	/* nPIOW */
    827      1.10  kiyohara 	if (CPU_IS_PXA250) {
    828      1.10  kiyohara 		pxa2x0_gpio_set_function(52, GPIO_ALT_FN_2_OUT); /* nPCE1 */
    829      1.10  kiyohara 		pxa2x0_gpio_set_function(53, GPIO_ALT_FN_2_OUT); /* nPCE2 */
    830      1.10  kiyohara 		pxa2x0_gpio_set_function(54, GPIO_ALT_FN_2_OUT); /* pSKTSEL */
    831      1.10  kiyohara 	} else {
    832      1.10  kiyohara 		pxa2x0_gpio_set_function(102, GPIO_ALT_FN_1_OUT); /* nPCE1 */
    833      1.10  kiyohara 		pxa2x0_gpio_set_function(105, GPIO_ALT_FN_1_OUT); /* nPCE2 */
    834      1.10  kiyohara 		pxa2x0_gpio_set_function(79, GPIO_ALT_FN_1_OUT);  /* pSKTSEL */
    835      1.10  kiyohara 	}
    836       1.1  kiyohara 	pxa2x0_gpio_set_function(55, GPIO_ALT_FN_2_OUT);	/* nPREG */
    837       1.1  kiyohara 	pxa2x0_gpio_set_function(56, GPIO_ALT_FN_1_IN);		/* nPWAIT */
    838       1.1  kiyohara 	pxa2x0_gpio_set_function(57, GPIO_ALT_FN_1_IN);		/* nIOIS16 */
    839       1.1  kiyohara }
    840       1.1  kiyohara 
    841       1.1  kiyohara static void
    842       1.9    cegger etherstix_config(void)
    843       1.1  kiyohara {
    844      1.10  kiyohara 	extern struct cfdata cfdata[];
    845      1.10  kiyohara #if defined(CPU_XSCALE_PXA270) && defined(CPU_XSCALE_PXA250)
    846      1.10  kiyohara 	int rst = (CPU_IS_PXA250) ? 80 : 32;
    847      1.10  kiyohara 	int irq = (CPU_IS_PXA250) ? 36 : 99;
    848      1.10  kiyohara #else
    849      1.10  kiyohara #if defined(CPU_XSCALE_PXA270)
    850      1.10  kiyohara 	const int rst = 32, irq = 99;
    851      1.10  kiyohara #else
    852      1.10  kiyohara 	const int rst = 80, irq = 36;
    853      1.10  kiyohara #endif
    854      1.10  kiyohara #endif
    855      1.10  kiyohara 	int i;
    856       1.1  kiyohara 
    857       1.1  kiyohara 	pxa2x0_gpio_set_function(49, GPIO_ALT_FN_2_OUT);	/* nPWE */
    858       1.1  kiyohara 	pxa2x0_gpio_set_function(15, GPIO_ALT_FN_2_OUT);	/* nCS 1 */
    859      1.10  kiyohara 	pxa2x0_gpio_set_function(rst, GPIO_OUT | GPIO_SET);	/* RESET 1 */
    860       1.1  kiyohara 	delay(1);
    861      1.10  kiyohara 	pxa2x0_gpio_set_function(rst, GPIO_OUT | GPIO_CLR);
    862       1.1  kiyohara 	delay(50000);
    863      1.10  kiyohara 
    864      1.10  kiyohara 	for (i = 0; cfdata[i].cf_name != NULL; i++)
    865      1.10  kiyohara 		if (strcmp(cfdata[i].cf_name, "sm") == 0 &&
    866      1.10  kiyohara 		    strcmp(cfdata[i].cf_atname, "sm_gxio") == 0 &&
    867      1.10  kiyohara 		    cfdata[i].cf_loc[GXIOCF_ADDR] == 0x04000300 &&
    868      1.10  kiyohara 		    cfdata[i].cf_loc[GXIOCF_GPIRQ] == GXIOCF_GPIRQ_DEFAULT)
    869      1.10  kiyohara 			cfdata[i].cf_loc[GXIOCF_GPIRQ] = irq;
    870       1.1  kiyohara }
    871       1.1  kiyohara 
    872       1.1  kiyohara static void
    873       1.9    cegger netcf_config(void)
    874       1.1  kiyohara {
    875       1.1  kiyohara 
    876       1.4  kiyohara 	etherstix_config();
    877       1.4  kiyohara 	cfstix_config();
    878      1.14  kiyohara }
    879      1.14  kiyohara 
    880      1.14  kiyohara static void
    881      1.14  kiyohara netcf_vx_config(void)
    882      1.14  kiyohara {
    883      1.14  kiyohara 
    884      1.14  kiyohara 	/*
    885      1.14  kiyohara 	 * XXXX: More power is necessary for NIC and USB???
    886      1.14  kiyohara 	 * (no document.  from Linux)
    887      1.14  kiyohara 	 */
    888      1.14  kiyohara 
    889      1.14  kiyohara 	pxa2x0_gpio_set_function(27, GPIO_IN);
    890      1.14  kiyohara 	pxa2x0_gpio_set_function(107, GPIO_OUT | GPIO_CLR);
    891      1.14  kiyohara 	pxa2x0_gpio_set_function(118, GPIO_ALT_FN_1_IN | GPIO_CLR);
    892      1.14  kiyohara 
    893      1.14  kiyohara 	etherstix_config();
    894      1.14  kiyohara 	cfstix_config();
    895      1.10  kiyohara 	if (CPU_IS_PXA270) {
    896      1.10  kiyohara 		/* Overwrite */
    897      1.10  kiyohara 		gxpcic_slot_irqs[0].cd = 104;
    898      1.10  kiyohara 		gxpcic_slot_irqs[0].prdy = 109;
    899      1.10  kiyohara 		gxpcic_gpio_reset = 110;
    900      1.10  kiyohara 	};
    901       1.1  kiyohara }
    902       1.1  kiyohara 
    903       1.1  kiyohara static void
    904       1.9    cegger netduommc_config(void)
    905       1.3  kiyohara {
    906       1.3  kiyohara 
    907       1.4  kiyohara 	netduo_config();
    908       1.6  kiyohara 	basix_config();
    909       1.3  kiyohara }
    910       1.3  kiyohara 
    911       1.3  kiyohara static void
    912       1.9    cegger netduo_config(void)
    913       1.1  kiyohara {
    914       1.1  kiyohara 
    915       1.4  kiyohara 	etherstix_config();
    916       1.1  kiyohara 
    917       1.1  kiyohara 	pxa2x0_gpio_set_function(78, GPIO_ALT_FN_2_OUT);	/* nCS 2 */
    918       1.1  kiyohara 	pxa2x0_gpio_set_function(52, GPIO_OUT | GPIO_SET);	/* RESET 2 */
    919       1.1  kiyohara 	delay(1);
    920       1.1  kiyohara 	pxa2x0_gpio_set_function(52, GPIO_OUT | GPIO_CLR);
    921       1.1  kiyohara 	delay(50000);
    922       1.1  kiyohara }
    923       1.1  kiyohara 
    924       1.1  kiyohara static void
    925      1.10  kiyohara netmicrosd_config(void)
    926      1.10  kiyohara {
    927      1.10  kiyohara 
    928      1.10  kiyohara 	/* MicroSD(mci) always configure on PXA270 */
    929      1.10  kiyohara 
    930      1.10  kiyohara 	pxa2x0_gpio_set_function(49, GPIO_ALT_FN_2_OUT);	/* nPWE */
    931      1.10  kiyohara 	pxa2x0_gpio_set_function(15, GPIO_ALT_FN_2_OUT);	/* nCS 1 */
    932      1.10  kiyohara 	pxa2x0_gpio_set_function(107, GPIO_OUT | GPIO_CLR);	/* RESET 1 */
    933      1.10  kiyohara 	delay(hz / 2);
    934      1.10  kiyohara 	pxa2x0_gpio_set_function(107, GPIO_OUT | GPIO_SET);
    935      1.10  kiyohara 	delay(50000);
    936      1.10  kiyohara }
    937      1.10  kiyohara 
    938      1.10  kiyohara static void
    939      1.10  kiyohara netwifimicrosd_config(void)
    940      1.10  kiyohara {
    941      1.10  kiyohara 
    942      1.10  kiyohara 	netmicrosd_config();
    943      1.10  kiyohara 
    944      1.10  kiyohara 	cfstix_config();
    945      1.10  kiyohara 	/* However use pxamci. */
    946      1.10  kiyohara 	pxa2x0_gpio_set_function(111, GPIO_CLR | GPIO_ALT_FN_1_IN);
    947      1.12  kiyohara 	/* Power to Marvell 88W8385 */
    948      1.10  kiyohara 	pxa2x0_gpio_set_function(80, GPIO_OUT | GPIO_SET);
    949      1.10  kiyohara }
    950      1.10  kiyohara 
    951      1.10  kiyohara static void
    952       1.9    cegger netmmc_config(void)
    953       1.1  kiyohara {
    954       1.1  kiyohara 
    955       1.4  kiyohara 	etherstix_config();
    956       1.6  kiyohara 	basix_config();
    957       1.1  kiyohara }
    958       1.4  kiyohara 
    959       1.4  kiyohara static void
    960      1.10  kiyohara wifistix_config(void)
    961      1.10  kiyohara {
    962      1.10  kiyohara 
    963      1.10  kiyohara 	cfstix_config();
    964      1.10  kiyohara 
    965      1.12  kiyohara 	/* Power to Marvell 88W8385 */
    966      1.10  kiyohara 	pxa2x0_gpio_set_function(80, GPIO_OUT | GPIO_SET);
    967      1.10  kiyohara }
    968      1.10  kiyohara 
    969      1.10  kiyohara static void
    970       1.9    cegger wifistix_cf_config(void)
    971       1.4  kiyohara {
    972       1.4  kiyohara 
    973      1.10  kiyohara 	gxpcic_slot_irqs[1].valid = 1;
    974      1.10  kiyohara 	gxpcic_slot_irqs[1].cd = 36;
    975      1.10  kiyohara 	gxpcic_slot_irqs[1].prdy = 27;
    976      1.10  kiyohara 
    977       1.4  kiyohara #if 1
    978       1.6  kiyohara 	/* this configuration set by pxa2x0_pcic.c::pxapcic_attach_common() */
    979       1.4  kiyohara #else
    980       1.4  kiyohara 	pxa2x0_gpio_set_function(36, GPIO_IN);		/* PCD2 */
    981       1.4  kiyohara 	pxa2x0_gpio_set_function(27, GPIO_IN);		/* PRDY2/~IRQ2 */
    982       1.4  kiyohara #endif
    983       1.4  kiyohara 	pxa2x0_gpio_set_function(18, GPIO_IN); 		/* BVD2/~STSCHG2 */
    984       1.4  kiyohara 
    985       1.4  kiyohara 	cfstix_config();
    986      1.10  kiyohara 
    987      1.12  kiyohara 	/* Power to Marvell 88W8385 */
    988      1.10  kiyohara 	pxa2x0_gpio_set_function(80, GPIO_OUT | GPIO_SET);
    989       1.4  kiyohara }
    990      1.16  kiyohara 
    991      1.16  kiyohara #elif defined(OVERO)
    992      1.16  kiyohara 
    993      1.16  kiyohara static void
    994      1.16  kiyohara eth0_config(void)
    995      1.16  kiyohara {
    996      1.16  kiyohara 	/*
    997      1.16  kiyohara 	 * ETH0 connects via CS5.  It use GPIO 176 for IRQ.
    998      1.20  kiyohara 	 * Also GPIO 64 is NRESET.
    999      1.16  kiyohara 	 */
   1000      1.16  kiyohara 
   1001      1.21  kiyohara 	smsh_config(NULL, 176, 64);
   1002      1.21  kiyohara }
   1003      1.16  kiyohara 
   1004      1.21  kiyohara static void
   1005      1.21  kiyohara eth1_config(void)
   1006      1.21  kiyohara {
   1007      1.21  kiyohara 	struct omap_mux_conf eth1_mux_conf[] = {
   1008      1.21  kiyohara 		{ 0x0d2, MUXMODE(4) | INPUTENABLE },
   1009      1.21  kiyohara 		{ -1 }
   1010      1.21  kiyohara 	};
   1011      1.16  kiyohara 
   1012      1.16  kiyohara 	/*
   1013      1.21  kiyohara 	 * ETH1 connects via CS4.  It use GPIO 65 for IRQ.
   1014      1.16  kiyohara 	 */
   1015      1.21  kiyohara 
   1016      1.21  kiyohara 	smsh_config(eth1_mux_conf, 65, 64);
   1017      1.16  kiyohara }
   1018      1.16  kiyohara 
   1019      1.16  kiyohara static void
   1020      1.21  kiyohara dvi_config(void)
   1021      1.21  kiyohara {
   1022      1.21  kiyohara 	static const struct omap_mux_conf overo_mux_dvi_conf[] = {
   1023      1.21  kiyohara 		{ 0x0d4, MUXMODE(0) },				/* dss_pclk */
   1024      1.21  kiyohara 		{ 0x0d6, MUXMODE(0) },				/* dss_pclk */
   1025      1.21  kiyohara 		{ 0x0d8, MUXMODE(0) },				/* dss_pclk */
   1026      1.21  kiyohara 		{ 0x0da, MUXMODE(0) },				/* dss_pclk */
   1027      1.21  kiyohara 		{ 0x0dc, MUXMODE(0) },				/* dss_pclk */
   1028      1.21  kiyohara 		{ 0x0de, MUXMODE(0) },				/* dss_pclk */
   1029      1.21  kiyohara 		{ 0x0e0, MUXMODE(0) },				/* dss_pclk */
   1030      1.21  kiyohara 		{ 0x0e2, MUXMODE(0) },				/* dss_pclk */
   1031      1.21  kiyohara 		{ 0x0e4, MUXMODE(0) },				/* dss_pclk */
   1032      1.21  kiyohara 		{ 0x0e6, MUXMODE(0) },				/* dss_pclk */
   1033      1.21  kiyohara 		{ 0x0e8, MUXMODE(0) },				/* dss_pclk */
   1034      1.21  kiyohara 		{ 0x0ea, MUXMODE(0) },				/* dss_pclk */
   1035      1.21  kiyohara 		{ 0x0ec, MUXMODE(0) },				/* dss_pclk */
   1036      1.21  kiyohara 		{ 0x0ee, MUXMODE(0) },				/* dss_pclk */
   1037      1.21  kiyohara 		{ 0x0f0, MUXMODE(0) },				/* dss_pclk */
   1038      1.21  kiyohara 		{ 0x0f2, MUXMODE(0) },				/* dss_pclk */
   1039      1.21  kiyohara 		{ 0x0f4, MUXMODE(0) },				/* dss_pclk */
   1040      1.21  kiyohara 		{ 0x0f6, MUXMODE(0) },				/* dss_pclk */
   1041      1.21  kiyohara 		{ 0x0f8, MUXMODE(0) },				/* dss_pclk */
   1042      1.21  kiyohara 		{ 0x0fa, MUXMODE(0) },				/* dss_pclk */
   1043      1.21  kiyohara 		{ 0x0fc, MUXMODE(0) },				/* dss_pclk */
   1044      1.21  kiyohara 		{ 0x0fe, MUXMODE(0) },				/* dss_pclk */
   1045      1.21  kiyohara 		{ 0x100, MUXMODE(0) },				/* dss_pclk */
   1046      1.21  kiyohara 		{ 0x102, MUXMODE(0) },				/* dss_pclk */
   1047      1.21  kiyohara 		{ 0x104, MUXMODE(0) },				/* dss_pclk */
   1048      1.21  kiyohara 		{ 0x106, MUXMODE(0) },				/* dss_pclk */
   1049      1.21  kiyohara 		{ 0x108, MUXMODE(0) },				/* dss_pclk */
   1050      1.21  kiyohara 		{ 0x10a, MUXMODE(0) },				/* dss_pclk */
   1051      1.21  kiyohara 		{ -1 }
   1052      1.21  kiyohara 	};
   1053      1.21  kiyohara 
   1054      1.21  kiyohara 	gxio_omap_mux_config(overo_mux_dvi_conf);
   1055      1.21  kiyohara }
   1056      1.21  kiyohara 
   1057      1.21  kiyohara static void
   1058      1.21  kiyohara lcd_config(char type)
   1059      1.16  kiyohara {
   1060      1.21  kiyohara 	static const struct omap_mux_conf overo_mux_mcspi1_conf[] = {
   1061      1.21  kiyohara 		{ 0x1c8, MUXMODE(0) | INPUTENABLE },		/* mcspi1_clk */
   1062      1.21  kiyohara 		{ 0x1ca, MUXMODE(0) | INPUTENABLE },		/* mcspi1_simo*/
   1063      1.21  kiyohara 		{ 0x1cc, MUXMODE(0) | INPUTENABLE },		/* mcspi1_somi*/
   1064      1.21  kiyohara 		{ 0x1ce, MUXMODE(0) | INPUTENABLE },		/* mcspi1_cs0 */
   1065      1.21  kiyohara 		{ 0x1d0, MUXMODE(0) | INPUTENABLE },		/* mcspi1_cs1 */
   1066      1.21  kiyohara 		{ -1 }
   1067      1.21  kiyohara 	};
   1068      1.21  kiyohara 	static const struct omap_mux_conf overo_mux_ads7846_conf[] = {
   1069      1.21  kiyohara 		{ 0x138,			/* gpio_114: NPENIRQ */
   1070      1.21  kiyohara 		  MUXMODE(4) | PULLUDENABLE | INPUTENABLE },
   1071      1.21  kiyohara 		{ -1 }
   1072      1.21  kiyohara 	};
   1073      1.21  kiyohara 	static const struct omap_mux_conf overo_mux_lcd_conf[] = {
   1074      1.21  kiyohara 		{ 0x174, MUXMODE(4) },		/* gpio_144: DISPLAY_EN */
   1075      1.21  kiyohara 		{ 0x176, MUXMODE(4) },		/* gpio_145: Brightness */
   1076      1.21  kiyohara 		{ -1 }
   1077      1.21  kiyohara 	};
   1078      1.16  kiyohara 
   1079      1.21  kiyohara 	static const struct omap_gpio_conf overo_gpio_lcd_conf[] = {
   1080      1.21  kiyohara 		{ 144, conf_output_0 },		/* DISPLAY_EN */
   1081      1.21  kiyohara 		{ 145, conf_output_0 },		/* Brightness */
   1082      1.21  kiyohara 		{ -1 }
   1083      1.21  kiyohara 	};
   1084      1.16  kiyohara 
   1085      1.21  kiyohara 	dvi_config();
   1086      1.21  kiyohara 	if (type != 'C') {
   1087      1.21  kiyohara 		gxio_omap_mux_config(overo_mux_mcspi1_conf);
   1088      1.21  kiyohara 		gxio_omap_mux_config(overo_mux_ads7846_conf);
   1089      1.16  kiyohara 	}
   1090      1.21  kiyohara 	gxio_omap_mux_config(overo_mux_lcd_conf);
   1091      1.16  kiyohara 
   1092      1.21  kiyohara 	gxio_omap_gpio_config(overo_gpio_lcd_conf);
   1093      1.21  kiyohara }
   1094      1.16  kiyohara 
   1095      1.21  kiyohara enum {
   1096      1.21  kiyohara 	uart1_if_exists = 0,
   1097      1.21  kiyohara 	force_uart1
   1098      1.21  kiyohara };
   1099      1.21  kiyohara static void
   1100      1.21  kiyohara header_40pin_config(int uart1)
   1101      1.21  kiyohara {
   1102      1.21  kiyohara 	static const struct omap_mux_conf overo_mux_40pin_header_conf[] = {
   1103      1.21  kiyohara 		/*
   1104      1.21  kiyohara 		 *  1: GND
   1105      1.21  kiyohara 		 *  2: VCC_3.3
   1106      1.21  kiyohara 		 *  3: GPIO171_SPI1_CLK
   1107      1.21  kiyohara 		 *  4: GPIO114_SPI1_NIRQ
   1108      1.21  kiyohara 		 *  5: GPIO172_SPI1_MOSI
   1109      1.21  kiyohara 		 *  6: GPIO174_SPI1_CS0
   1110      1.21  kiyohara 		 *  7: GPIO173_SPI1_MISO
   1111      1.21  kiyohara 		 *  8: GPIO175_SPI1_CS1
   1112      1.21  kiyohara 		 *  9: GPIO151_RXD1
   1113      1.21  kiyohara 		 * 10: GPIO148_TXD1
   1114      1.21  kiyohara 		 * 11: SYS_EN
   1115      1.21  kiyohara 		 * 12: VBACKUP
   1116      1.21  kiyohara 		 * 13: GPIO0_WAKEUP
   1117      1.21  kiyohara 		 * 14: POWERON
   1118      1.21  kiyohara 		 * 15: GND
   1119      1.21  kiyohara 		 * 16: VCC_1.8
   1120      1.21  kiyohara 		 * 17: GPIO128_GPS_PPS
   1121      1.21  kiyohara 		 * 18: GPIO127_TS_IRQ
   1122      1.21  kiyohara 		 * 19: GPIO170_HDQ_1WIRE
   1123      1.21  kiyohara 		 * 20: GPIO163_IR_CTS3
   1124      1.21  kiyohara 		 * 21: GPIO165_IR_RXD3	(console)
   1125      1.21  kiyohara 		 * 22: GPIO166_IR_TXD3	(console)
   1126      1.21  kiyohara 		 * 23: GPIO184_SCL3	(system eeprom)
   1127      1.21  kiyohara 		 * 24: GPIO185_SDA3	(system eeprom)
   1128      1.21  kiyohara 		 * 25: GND
   1129      1.21  kiyohara 		 * 26: VCC_1.8
   1130      1.21  kiyohara 		 * 27: GPIO146_PWM11
   1131      1.21  kiyohara 		 * 28: GPIO145_PWM10
   1132      1.21  kiyohara 		 * 29: GPIO147_PWM8
   1133      1.21  kiyohara 		 * 30: GPIO144_PWM9
   1134      1.21  kiyohara 		 * 31: PWM0 (TPS65950)
   1135      1.21  kiyohara 		 * 32: PWM1 (TPS65950)
   1136      1.21  kiyohara 		 * 33: ADCIN7 (TPS65950)
   1137      1.21  kiyohara 		 * 34: ADCIN2 (TPS65950)
   1138      1.21  kiyohara 		 * 35: ADCIN6 (TPS65950)
   1139      1.21  kiyohara 		 * 36: ADCIN5 (TPS65950)
   1140      1.21  kiyohara 		 * 37: AGND (TPS65950)
   1141      1.21  kiyohara 		 * 38: ADCIN3 (TPS65950)
   1142      1.21  kiyohara 		 * 39: ADCIN4 (TPS65950)
   1143      1.21  kiyohara 		 * 40: VIN (TPS65950)
   1144      1.21  kiyohara 		 */
   1145      1.21  kiyohara 
   1146      1.21  kiyohara 		{ 0x152, MUXMODE(4) | INPUTENABLE },		/* gpio_127 */
   1147      1.21  kiyohara 		{ 0x154, MUXMODE(4) | INPUTENABLE },		/* gpio_128 */
   1148      1.21  kiyohara 		{ 0x174, MUXMODE(4) | INPUTENABLE },		/* gpio_144 */
   1149      1.21  kiyohara 		{ 0x176, MUXMODE(4) | INPUTENABLE },		/* gpio_145 */
   1150      1.21  kiyohara 		{ 0x178, MUXMODE(4) | INPUTENABLE },		/* gpio_146 */
   1151      1.21  kiyohara 		{ 0x17a, MUXMODE(4) | INPUTENABLE },		/* gpio_147 */
   1152      1.21  kiyohara 		{ 0x19a, MUXMODE(4) | INPUTENABLE },		/* gpio_163 */
   1153      1.21  kiyohara 		{ -1 }
   1154      1.21  kiyohara 	};
   1155      1.21  kiyohara 	static const struct omap_mux_conf overo_mux_uart1_conf[] = {
   1156      1.21  kiyohara 		{ 0x17c, MUXMODE(0) },				/* uart1_tx */
   1157      1.21  kiyohara 		{ 0x182, MUXMODE(0) | INPUTENABLE },		/* uart1_rx */
   1158      1.21  kiyohara 		{ -1 }
   1159      1.21  kiyohara 	};
   1160      1.21  kiyohara 	static const struct omap_mux_conf overo_mux_no_uart1_conf[] = {
   1161      1.21  kiyohara 		{ 0x17c, MUXMODE(4) | INPUTENABLE },		/* gpio_148 */
   1162      1.21  kiyohara 		{ 0x182, MUXMODE(4) | INPUTENABLE },		/* gpio_151 */
   1163      1.21  kiyohara 		{ -1 }
   1164      1.21  kiyohara 	};
   1165      1.21  kiyohara 	static const struct omap_mux_conf overo_mux_hdq_conf[] = {
   1166      1.21  kiyohara #if 0
   1167      1.21  kiyohara 		{ 0x1c4, MUXMODE(0) | ??? | INPUTENABLE },	/* hdq_sio */
   1168      1.21  kiyohara #endif
   1169      1.21  kiyohara 		{ -1 }
   1170      1.21  kiyohara 	};
   1171      1.21  kiyohara 	static const struct omap_mux_conf overo_mux_no_hdq_conf[] = {
   1172      1.21  kiyohara 		{ 0x1c4, MUXMODE(4) | INPUTENABLE },		/* gpio_170 */
   1173      1.21  kiyohara 		{ -1 }
   1174      1.21  kiyohara 	};
   1175      1.21  kiyohara 
   1176      1.21  kiyohara 	gxio_omap_mux_config(overo_mux_40pin_header_conf);
   1177      1.21  kiyohara 	if (uart1 == force_uart1)
   1178      1.21  kiyohara 		gxio_omap_mux_config(overo_mux_uart1_conf);
   1179      1.21  kiyohara 	else
   1180      1.21  kiyohara 		gxio_omap_mux_config_address("com", 0x4806a000,
   1181      1.21  kiyohara 		    overo_mux_uart1_conf, overo_mux_no_uart1_conf);
   1182      1.21  kiyohara 	gxio_omap_mux_config_address("hdq", 0x480b2000,
   1183      1.21  kiyohara 	    overo_mux_hdq_conf, overo_mux_no_hdq_conf);
   1184      1.16  kiyohara }
   1185      1.16  kiyohara 
   1186      1.16  kiyohara static void
   1187      1.16  kiyohara chestnut_config(void)
   1188      1.16  kiyohara {
   1189      1.21  kiyohara 	static const struct omap_mux_conf chestnut_mux_conf[] = {
   1190      1.21  kiyohara 		{ 0x5ec, MUXMODE(4) },			/* gpio_22: LED (Blue)*/
   1191      1.21  kiyohara 		{ 0x5ee, MUXMODE(4) | INPUTENABLE },	/* gpio_23: Button */
   1192      1.21  kiyohara 		{ 0x5dc, MUXMODE(4) | INPUTENABLE },	/* gpio_14: Button */
   1193      1.21  kiyohara 		{ -1 }
   1194      1.21  kiyohara 	};
   1195      1.16  kiyohara 
   1196      1.16  kiyohara 	eth0_config();
   1197      1.21  kiyohara 	lcd_config('R');
   1198      1.21  kiyohara 
   1199      1.21  kiyohara 	header_40pin_config(uart1_if_exists);
   1200      1.21  kiyohara 	gxio_omap_mux_config(chestnut_mux_conf);
   1201      1.21  kiyohara }
   1202      1.21  kiyohara 
   1203      1.21  kiyohara static void
   1204      1.21  kiyohara gallop_config(void)
   1205      1.21  kiyohara {
   1206      1.21  kiyohara 	static const struct omap_mux_conf gallop43_mux_conf[] = {
   1207      1.21  kiyohara 		{ 0x5ec, MUXMODE(4) },			/* gpio_22: LED (Blue)*/
   1208      1.21  kiyohara 		{ 0x5ee, MUXMODE(4) | INPUTENABLE },	/* gpio_23: Button */
   1209      1.21  kiyohara 		{ 0x5dc, MUXMODE(4) | INPUTENABLE },	/* gpio_14: Button */
   1210      1.21  kiyohara 		{ -1 }
   1211      1.21  kiyohara 	};
   1212      1.21  kiyohara 
   1213      1.21  kiyohara 	lcd_config('R');
   1214      1.21  kiyohara 
   1215      1.21  kiyohara 	header_40pin_config(force_uart1);
   1216      1.21  kiyohara 	gxio_omap_mux_config(gallop43_mux_conf);
   1217      1.21  kiyohara }
   1218      1.21  kiyohara 
   1219      1.21  kiyohara static void
   1220      1.21  kiyohara summit_config(void)
   1221      1.21  kiyohara {
   1222      1.21  kiyohara 
   1223      1.21  kiyohara 	dvi_config();
   1224      1.21  kiyohara 
   1225      1.21  kiyohara 	header_40pin_config(uart1_if_exists);
   1226      1.16  kiyohara }
   1227      1.16  kiyohara 
   1228      1.16  kiyohara static void
   1229      1.16  kiyohara tobi_config(void)
   1230      1.16  kiyohara {
   1231      1.16  kiyohara 
   1232      1.16  kiyohara 	eth0_config();
   1233      1.21  kiyohara 	dvi_config();
   1234      1.21  kiyohara 
   1235      1.21  kiyohara 	header_40pin_config(uart1_if_exists);
   1236      1.16  kiyohara }
   1237      1.16  kiyohara 
   1238      1.16  kiyohara static void
   1239      1.16  kiyohara tobiduo_config(void)
   1240      1.16  kiyohara {
   1241      1.16  kiyohara 
   1242      1.16  kiyohara 	eth0_config();
   1243      1.16  kiyohara 	eth1_config();
   1244      1.16  kiyohara }
   1245      1.21  kiyohara 
   1246      1.21  kiyohara #elif defined(DUOVERO)
   1247      1.21  kiyohara 
   1248      1.21  kiyohara static void
   1249      1.21  kiyohara ehci_config(void)
   1250      1.21  kiyohara {
   1251      1.21  kiyohara 	uint32_t val;
   1252      1.21  kiyohara 
   1253      1.21  kiyohara #define SCRM_ALTCLKSRC		0xa110
   1254      1.21  kiyohara #define   ALTCLKSRC_ENABLE_EXT		(1 << 3)
   1255      1.21  kiyohara #define   ALTCLKSRC_ENABLE_INT		(1 << 2)
   1256      1.21  kiyohara #define   ALTCLKSRC_MODE_MASK		(3 << 0)
   1257      1.21  kiyohara #define   ALTCLKSRC_MODE_POWERDOWN	(0 << 0)
   1258      1.21  kiyohara #define   ALTCLKSRC_MODE_ACTIVE		(1 << 0)
   1259      1.21  kiyohara #define   ALTCLKSRC_MODE_BYPASS		(2 << 0)
   1260      1.21  kiyohara #define SCRM_AUXCLK3		0xa31c
   1261      1.21  kiyohara #define   AUXCLK3_CLKDIV(n)		(((n) - 1) << 16)
   1262      1.21  kiyohara #define   AUXCLK3_CLKDIV_MASK		(0xf << 16)
   1263      1.21  kiyohara #define   AUXCLK3_ENABLE		(1 << 8)
   1264      1.21  kiyohara #define   AUXCLK3_SRCSELECT_MASK	(3 << 1)
   1265      1.21  kiyohara #define   AUXCLK3_SRCSELECT_SYSCLK	(0 << 1)
   1266      1.21  kiyohara #define   AUXCLK3_SRCSELECT_CORE	(1 << 1)
   1267      1.21  kiyohara #define   AUXCLK3_SRCSELECT_PERDPLL	(2 << 1)
   1268      1.21  kiyohara #define   AUXCLK3_SRCSELECT_ALTCLK	(3 << 1)
   1269      1.21  kiyohara #define   AUXCLK3_POLARITY_LOW		(0 << 0)
   1270      1.21  kiyohara #define   AUXCLK3_POLARITY_HIGH		(1 << 0)
   1271      1.21  kiyohara 
   1272      1.21  kiyohara 	/* Use the 1/2 auxiliary clock #3 of system clock. */
   1273      1.21  kiyohara 	val = ioreg_read(DUOVERO_L4_WAKEUP_VBASE + SCRM_AUXCLK3);
   1274      1.21  kiyohara 	val &= ~(AUXCLK3_CLKDIV_MASK | AUXCLK3_SRCSELECT_MASK);
   1275      1.21  kiyohara 	val |= (AUXCLK3_CLKDIV(2) | AUXCLK3_ENABLE | AUXCLK3_SRCSELECT_SYSCLK);
   1276      1.21  kiyohara 	ioreg_write(DUOVERO_L4_WAKEUP_VBASE + SCRM_AUXCLK3, val);
   1277      1.21  kiyohara 
   1278      1.21  kiyohara 	val = ioreg_read(DUOVERO_L4_WAKEUP_VBASE + SCRM_ALTCLKSRC);
   1279      1.21  kiyohara 	val &= ~ALTCLKSRC_MODE_MASK;
   1280      1.21  kiyohara 	val |= ALTCLKSRC_MODE_ACTIVE;
   1281      1.21  kiyohara 	val |= (ALTCLKSRC_ENABLE_EXT | ALTCLKSRC_ENABLE_INT);
   1282      1.21  kiyohara 	ioreg_write(DUOVERO_L4_WAKEUP_VBASE + SCRM_ALTCLKSRC, val);
   1283      1.21  kiyohara }
   1284      1.21  kiyohara 
   1285      1.21  kiyohara static void
   1286      1.21  kiyohara parlor_config(void)
   1287      1.21  kiyohara {
   1288      1.21  kiyohara #if 0
   1289      1.21  kiyohara 	static const struct omap_mux_conf parlor_mux_40pin_header_conf[] = {
   1290      1.21  kiyohara 		/*
   1291      1.21  kiyohara 		 *  1: GND
   1292      1.21  kiyohara 		 *  2: GND
   1293      1.21  kiyohara 		 *  3: MCSPI1_CLK or GPIO 134
   1294      1.21  kiyohara 		 *  4: MCSPI1_CS0 or GPIO 137
   1295      1.21  kiyohara 		 *  5: MCSPI1_SIMO or GPIO 136
   1296      1.21  kiyohara 		 *  6: MCSPI1_CS1 or GPIO 138
   1297      1.21  kiyohara 		 *  7: MCSPI1_SOMI or GPIO 135
   1298      1.21  kiyohara 		 *  8: MCSPI1_CS2 or GPIO 139
   1299      1.21  kiyohara 		 *  9: HDQ_SIO or GPIO 127
   1300      1.21  kiyohara 		 * 10: MCSPI1_CS3 or GPIO 140
   1301      1.21  kiyohara 		 * 11: SDMMC3_CMD or GPIO ???
   1302      1.21  kiyohara 		 * 12: I2C2_SCL or GPIO 128
   1303      1.21  kiyohara 		 * 13: SDMMC3_CLK or GPIO ???
   1304      1.21  kiyohara 		 * 14: I2C2_SDA or GPIO 129
   1305      1.21  kiyohara 		 * 15: UART2_TX or SDMMC3_DAT1 or GPIO 126
   1306      1.21  kiyohara 		 * 16: PMIC_PWM2 (TWL6030)
   1307      1.21  kiyohara 		 * 17: UART2_RX or SDMMC3_DAT0 or GPIO 125
   1308      1.21  kiyohara 		 * 18: PMIC_PWM1 (TWL6030)
   1309      1.21  kiyohara 		 * 19: BSP2_CLKX or GPIO 110
   1310      1.21  kiyohara 		 * 20: BSP2_FSX or GPIO 113
   1311      1.21  kiyohara 		 * 21: BSP2_DX or GPIO 112
   1312      1.21  kiyohara 		 * 22: BSP2_DR or GPIO 111
   1313      1.21  kiyohara 		 * 23: BSP2_CLKS or GPIO 118
   1314      1.21  kiyohara 		 * 24: FREF1
   1315      1.21  kiyohara 		 * 25: MCSPI4_SOMI or GPIO 153
   1316      1.21  kiyohara 		 * 26: PMIC_NRESWARN
   1317      1.21  kiyohara 		 * 27: MCSPI4_SIMO or GPIO 152
   1318      1.21  kiyohara 		 * 28: SYSEN
   1319      1.21  kiyohara 		 * 29: MCSPI4_CLK or GPIO 151
   1320      1.21  kiyohara 		 * 30: PWRON
   1321      1.21  kiyohara 		 * 31: MCSPI4_CS0 or GPIO 154
   1322      1.21  kiyohara 		 * 32: REGEN1
   1323      1.21  kiyohara 		 * 33: ADCIN3 (TWL6030)
   1324      1.21  kiyohara 		 * 34: VCC_1.0
   1325      1.21  kiyohara 		 * 35: ADCIN4_VREF (TWL6030)
   1326      1.21  kiyohara 		 * 36: VDD_VAUX2
   1327      1.21  kiyohara 		 * 37: ADCIN4 (TWL6030)
   1328      1.21  kiyohara 		 * 38: VCC_3.3
   1329      1.21  kiyohara 		 * 39: ADCIN5 (TWL6030)
   1330      1.21  kiyohara 		 * 40: V_BATT_5
   1331      1.21  kiyohara 		 */
   1332      1.21  kiyohara 		{ -1 }
   1333      1.21  kiyohara 	};
   1334      1.21  kiyohara #endif
   1335      1.21  kiyohara 	static const struct omap_mux_conf parlor_mux_mcspi1_conf[] = {
   1336      1.21  kiyohara #if 0
   1337      1.21  kiyohara 		{ 0x132,			/*  3: MCSPI1_CLK */
   1338      1.21  kiyohara 		  MUXMODE(0) | ??? },
   1339      1.21  kiyohara 		{ 0x138,			/*  4: MCSPI1_CS0 */
   1340      1.21  kiyohara 		  MUXMODE(0) | ??? },
   1341      1.21  kiyohara 		{ 0x136,			/*  5: MCSPI1_SIMO */
   1342      1.21  kiyohara 		  MUXMODE(0) | ??? },
   1343      1.21  kiyohara 		{ 0x13a,			/*  6: MCSPI1_CS1 */
   1344      1.21  kiyohara 		  MUXMODE(0) | ??? },
   1345      1.21  kiyohara 		{ 0x134,			/*  7: MCSPI1_SOMI */
   1346      1.21  kiyohara 		  MUXMODE(0) | ??? | INPUTENABLE },
   1347      1.21  kiyohara 		{ 0x13c,			/*  8: MCSPI1_CS2 */
   1348      1.21  kiyohara 		  MUXMODE(0) | ??? },
   1349      1.21  kiyohara 		{ 0x13e,			/* 10: MCSPI1_CS3 */
   1350      1.21  kiyohara 		  MUXMODE(0) | ??? },
   1351      1.21  kiyohara #endif
   1352      1.21  kiyohara 		{ -1 }
   1353      1.21  kiyohara 	};
   1354      1.21  kiyohara 	static const struct omap_mux_conf parlor_mux_no_mcspi1_conf[] = {
   1355      1.21  kiyohara 		{ 0x132,			/*  3: GPIO 134 */
   1356      1.21  kiyohara 		  MUXMODE(3) | PULLUDENABLE | PULLTYPESELECT | INPUTENABLE },
   1357      1.21  kiyohara 		{ 0x138,			/*  4: GPIO 137 */
   1358      1.21  kiyohara 		  MUXMODE(3) | PULLUDENABLE | PULLTYPESELECT | INPUTENABLE },
   1359      1.21  kiyohara 		{ 0x136,			/*  5: GPIO 136 */
   1360      1.21  kiyohara 		  MUXMODE(3) | PULLUDENABLE | PULLTYPESELECT | INPUTENABLE },
   1361      1.21  kiyohara 		{ 0x13a,			/*  6: GPIO 138 */
   1362      1.21  kiyohara 		  MUXMODE(3) | PULLUDENABLE | PULLTYPESELECT | INPUTENABLE },
   1363      1.21  kiyohara 		{ 0x134,			/*  7: GPIO 135 */
   1364      1.21  kiyohara 		  MUXMODE(3) | PULLUDENABLE | PULLTYPESELECT | INPUTENABLE },
   1365      1.21  kiyohara 		{ 0x13c,			/*  8: GPIO 139 */
   1366      1.21  kiyohara 		  MUXMODE(3) | PULLUDENABLE | PULLTYPESELECT | INPUTENABLE },
   1367      1.21  kiyohara 		{ 0x13e,			/* 10: GPIO 140 */
   1368      1.21  kiyohara 		  MUXMODE(3) | PULLUDENABLE | PULLTYPESELECT | INPUTENABLE },
   1369      1.21  kiyohara 		{ -1 }
   1370      1.21  kiyohara 	};
   1371      1.21  kiyohara 	static const struct omap_mux_conf parlor_mux_hdq_conf[] = {
   1372      1.21  kiyohara #if 0
   1373      1.21  kiyohara 		{ 0x120,			/*  9: HDQ_SIO */
   1374      1.21  kiyohara 		  MUXMODE(0) | ??? | INPUTENABLE },
   1375      1.21  kiyohara #endif
   1376      1.21  kiyohara 		{ -1 }
   1377      1.21  kiyohara 	};
   1378      1.21  kiyohara 	static const struct omap_mux_conf parlor_mux_no_hdq_conf[] = {
   1379      1.21  kiyohara 		{ 0x120,			/*  9: GPIO_127 */
   1380      1.21  kiyohara 		  MUXMODE(3) | PULLUDENABLE | PULLTYPESELECT | INPUTENABLE },
   1381      1.21  kiyohara 		{ -1 }
   1382      1.21  kiyohara 	};
   1383      1.21  kiyohara 	static const struct omap_mux_conf parlor_mux_i2c2_conf[] = {
   1384      1.21  kiyohara 		{ 0x126,			/* 12: I2C2_SCL */
   1385      1.21  kiyohara 		  MUXMODE(0) | PULLUDENABLE | PULLTYPESELECT | INPUTENABLE },
   1386      1.21  kiyohara 		{ 0x128,			/* 14: I2C2_SDA */
   1387      1.21  kiyohara 		  MUXMODE(0) | PULLUDENABLE | PULLTYPESELECT | INPUTENABLE },
   1388      1.21  kiyohara 		{ -1 }
   1389      1.21  kiyohara 	};
   1390      1.21  kiyohara 	static const struct omap_mux_conf parlor_mux_no_i2c2_conf[] = {
   1391      1.21  kiyohara 		{ 0x126,			/* 12: GPIO 128 */
   1392      1.21  kiyohara 		  MUXMODE(3) | PULLUDENABLE | PULLTYPESELECT | INPUTENABLE },
   1393      1.21  kiyohara 		{ 0x128,			/* 14: GPIO 129 */
   1394      1.21  kiyohara 		  MUXMODE(3) | PULLUDENABLE | PULLTYPESELECT | INPUTENABLE },
   1395      1.21  kiyohara 		{ -1 }
   1396      1.21  kiyohara 	};
   1397      1.21  kiyohara 	static const struct omap_mux_conf parlor_mux_sdmmc3_conf[] = {
   1398      1.21  kiyohara #if 0
   1399      1.21  kiyohara 11	SDMMC3_CMD	  DuoVero J2 A15 <- omap pin AG10
   1400      1.21  kiyohara 		  MUXMODE(1) | PULLUDENABLE | PULLTYPESELECT | INPUTENABLE },
   1401      1.21  kiyohara 13	SDMMC3_CLK	  DuoVero J2 A16 <- omap pin AE9
   1402      1.21  kiyohara 		  MUXMODE(1) | PULLUDENABLE | PULLTYPESELECT | INPUTENABLE },
   1403      1.21  kiyohara #endif
   1404      1.21  kiyohara 		{ 0x11c,			/* 17: SDMMC3_DAT0 */
   1405      1.21  kiyohara 		  MUXMODE(1) | PULLUDENABLE | PULLTYPESELECT | INPUTENABLE },
   1406      1.21  kiyohara 		{ 0x11e,			/* 15: SDMMC3_DAT1 */
   1407      1.21  kiyohara 		  MUXMODE(1) | PULLUDENABLE | PULLTYPESELECT | INPUTENABLE },
   1408      1.21  kiyohara 		{ -1 }
   1409      1.21  kiyohara 	};
   1410      1.21  kiyohara 	static const struct omap_mux_conf parlor_mux_uart2_conf[] = {
   1411      1.21  kiyohara 		{ 0x11c,			/* 17: UART2_RX */
   1412      1.21  kiyohara 		  MUXMODE(0) | PULLUDENABLE | PULLTYPESELECT | INPUTENABLE },
   1413      1.21  kiyohara 		{ 0x11e,
   1414      1.21  kiyohara 		  MUXMODE(0) | PULLUDENABLE },	/* 15: UART2_TX */
   1415      1.21  kiyohara 		{ -1 }
   1416      1.21  kiyohara 	};
   1417      1.21  kiyohara 	static const struct omap_mux_conf parlor_mux_no_uart2_conf[] = {
   1418      1.21  kiyohara 		{ 0x11c,			/* 17: GPIO 125 */
   1419      1.21  kiyohara 		  MUXMODE(3) | PULLUDENABLE | PULLTYPESELECT | INPUTENABLE },
   1420      1.21  kiyohara 		{ 0x11e,			/* 15: GPIO 126 */
   1421      1.21  kiyohara 		  MUXMODE(3) | PULLUDENABLE | PULLTYPESELECT | INPUTENABLE },
   1422      1.21  kiyohara 		{ -1 }
   1423      1.21  kiyohara 	};
   1424      1.21  kiyohara 	static const struct omap_mux_conf parlor_mux_bsp2_conf[] = {
   1425      1.21  kiyohara 		{ 0x0f6,			/* 19: BSP2_CLKX */
   1426      1.21  kiyohara 		  MUXMODE(0) | INPUTENABLE },
   1427      1.21  kiyohara 		{ 0x0fc,			/* 20: BSP2_FSX */
   1428      1.21  kiyohara 		  MUXMODE(0) | INPUTENABLE },
   1429      1.21  kiyohara 		{ 0x0fa,			/* 21: BSP2_DX */
   1430      1.21  kiyohara 		  MUXMODE(0) | PULLUDENABLE },
   1431      1.21  kiyohara 		{ 0x0f8,			/* 22: BSP2_DR */
   1432      1.21  kiyohara 		  MUXMODE(0) | PULLUDENABLE | INPUTENABLE },
   1433      1.21  kiyohara 		{ 0x10e,			/* 23: BSP2_CLKS */
   1434      1.21  kiyohara 		  MUXMODE(0) | PULLUDENABLE | INPUTENABLE },
   1435      1.21  kiyohara 		{ -1 }
   1436      1.21  kiyohara 	};
   1437      1.21  kiyohara 	static const struct omap_mux_conf parlor_mux_no_bsp2_conf[] = {
   1438      1.21  kiyohara 		{ 0x0f6,			/* 19: GPIO 110 */
   1439      1.21  kiyohara 		  MUXMODE(3) | PULLUDENABLE | PULLTYPESELECT | INPUTENABLE },
   1440      1.21  kiyohara 		{ 0x0fc,			/* 20: GPIO 113 */
   1441      1.21  kiyohara 		  MUXMODE(3) | PULLUDENABLE | PULLTYPESELECT | INPUTENABLE },
   1442      1.21  kiyohara 		{ 0x0fa,			/* 21: GPIO 112 */
   1443      1.21  kiyohara 		  MUXMODE(3) | PULLUDENABLE | PULLTYPESELECT | INPUTENABLE },
   1444      1.21  kiyohara 		{ 0x0f8,			/* 22: GPIO 111 */
   1445      1.21  kiyohara 		  MUXMODE(3) | PULLUDENABLE | PULLTYPESELECT | INPUTENABLE },
   1446      1.21  kiyohara 		{ 0x10e,			/* 23: GPIO 118 */
   1447      1.21  kiyohara 		  MUXMODE(3) | PULLUDENABLE | PULLTYPESELECT | INPUTENABLE },
   1448      1.21  kiyohara 		{ -1 }
   1449      1.21  kiyohara 	};
   1450      1.21  kiyohara 	static const struct omap_mux_conf parlor_mux_mcspi4_conf[] = {
   1451      1.21  kiyohara #if 0
   1452      1.21  kiyohara 		{ 0x158,			/* 25: MCSPI4_SOMI */
   1453      1.21  kiyohara 		  MUXMODE(0) | ??? | INPUTENABLE },
   1454      1.21  kiyohara 		{ 0x156,			/* 27: MCSPI4_SIMO */
   1455      1.21  kiyohara 		  MUXMODE(0) | ??? },
   1456      1.21  kiyohara 		{ 0x154,			/* 29: MCSPI4_CLK */
   1457      1.21  kiyohara 		  MUXMODE(0) | ??? },
   1458      1.21  kiyohara 		{ 0x15a,			/* 31: MCSPI4_CS0 */
   1459      1.21  kiyohara 		  MUXMODE(0) | ??? },
   1460      1.21  kiyohara #endif
   1461      1.21  kiyohara 		{ -1 }
   1462      1.21  kiyohara 	};
   1463      1.21  kiyohara 	static const struct omap_mux_conf parlor_mux_no_mcspi4_conf[] = {
   1464      1.21  kiyohara 		{ 0x158,			/* 25: GPIO 153 */
   1465      1.21  kiyohara 		  MUXMODE(3) | PULLUDENABLE | PULLTYPESELECT | INPUTENABLE },
   1466      1.21  kiyohara 		{ 0x156,			/* 27: GPIO 152 */
   1467      1.21  kiyohara 		  MUXMODE(3) | PULLUDENABLE | PULLTYPESELECT | INPUTENABLE },
   1468      1.21  kiyohara 		{ 0x154,			/* 29: GPIO 151 */
   1469      1.21  kiyohara 		  MUXMODE(3) | PULLUDENABLE | PULLTYPESELECT | INPUTENABLE },
   1470      1.21  kiyohara 		{ 0x15a,			/* 31: GPIO 154 */
   1471      1.21  kiyohara 		  MUXMODE(3) | PULLUDENABLE | PULLTYPESELECT | INPUTENABLE },
   1472      1.21  kiyohara 		{ -1 }
   1473      1.21  kiyohara 	};
   1474      1.21  kiyohara 
   1475      1.21  kiyohara 	/*
   1476      1.21  kiyohara 	 * ETH0 connects via CS5.  It use GPIO 44 for IRQ.
   1477      1.21  kiyohara 	 * Also GPIO 45 is NRESET.
   1478      1.21  kiyohara 	 */
   1479      1.21  kiyohara 	smsh_config(NULL, 44, 45);
   1480      1.21  kiyohara 
   1481      1.21  kiyohara 	ehci_config();
   1482      1.21  kiyohara 
   1483      1.21  kiyohara 	gxio_omap_mux_config_address("mcspi", 0x48098000,
   1484      1.21  kiyohara 	    parlor_mux_mcspi1_conf, parlor_mux_no_mcspi1_conf);
   1485      1.21  kiyohara 	gxio_omap_mux_config_address("hdq", 0x480b2000,
   1486      1.21  kiyohara 	    parlor_mux_hdq_conf, parlor_mux_no_hdq_conf);
   1487      1.21  kiyohara 	gxio_omap_mux_config_address("tiiic", 0x48072000,
   1488      1.21  kiyohara 	    parlor_mux_i2c2_conf, parlor_mux_no_i2c2_conf);
   1489      1.21  kiyohara 	if (gxio_omap_mux_config_address("sdhc", 0x480ad000,
   1490      1.21  kiyohara 				parlor_mux_sdmmc3_conf, NULL) != 0)
   1491      1.21  kiyohara 		gxio_omap_mux_config_address("com", 0x4806c000,
   1492      1.21  kiyohara 		    parlor_mux_uart2_conf, parlor_mux_no_uart2_conf);
   1493      1.21  kiyohara 	gxio_omap_mux_config_address("mcbsp", 0x49024000,
   1494      1.21  kiyohara 	    parlor_mux_bsp2_conf, parlor_mux_no_bsp2_conf);
   1495      1.21  kiyohara 	gxio_omap_mux_config_address("mcspi", 0x480ba000,
   1496      1.21  kiyohara 	    parlor_mux_mcspi4_conf, parlor_mux_no_mcspi4_conf);
   1497      1.21  kiyohara }
   1498      1.21  kiyohara 
   1499      1.21  kiyohara #elif defined(PEPPER)
   1500      1.21  kiyohara 
   1501      1.21  kiyohara static void
   1502      1.21  kiyohara lcd_config(void)
   1503      1.21  kiyohara {
   1504      1.21  kiyohara 	static const struct tifb_panel_info panel_lcd = {
   1505      1.21  kiyohara 		.panel_tft = 1,
   1506      1.21  kiyohara 		.panel_mono = false,
   1507      1.21  kiyohara 		.panel_bpp = 24,
   1508      1.21  kiyohara 
   1509      1.21  kiyohara 		.panel_pxl_clk = 18400000,
   1510      1.21  kiyohara 		.panel_width = 480,
   1511      1.21  kiyohara 		.panel_height = 272,
   1512      1.21  kiyohara 		.panel_hfp = 8,
   1513      1.21  kiyohara 		.panel_hbp = 4,
   1514      1.21  kiyohara 		.panel_hsw = 41,
   1515      1.21  kiyohara 		.panel_vfp = 4,
   1516      1.21  kiyohara 		.panel_vbp = 2,
   1517      1.21  kiyohara 		.panel_vsw = 10,
   1518      1.21  kiyohara 		.panel_invert_hsync = 0,
   1519      1.21  kiyohara 		.panel_invert_vsync = 0,
   1520      1.21  kiyohara 
   1521      1.21  kiyohara 		.panel_ac_bias = 255,
   1522      1.21  kiyohara 		.panel_ac_bias_intrpt = 0,
   1523      1.21  kiyohara 		.panel_dma_burst_sz = 16,
   1524      1.21  kiyohara 		.panel_fdd = 0x80,
   1525      1.21  kiyohara 		.panel_sync_edge = 0,
   1526      1.21  kiyohara 		.panel_sync_ctrl = 1,
   1527      1.21  kiyohara 		.panel_tft_alt_mode = 0,
   1528      1.21  kiyohara 		.panel_invert_pxl_clk = 0,
   1529      1.21  kiyohara 	};
   1530      1.21  kiyohara 	static const struct omap_mux_conf pepper_mux_lcd_conf[] = {
   1531      1.21  kiyohara 		/*
   1532      1.21  kiyohara 		 * LCD_DATA[0-23] configures in tifb.c
   1533      1.21  kiyohara 		 */
   1534      1.21  kiyohara 
   1535      1.21  kiyohara 		{ 0x8e0, MMODE(0) | PUDEN },		/* LCD_VSYNC */
   1536      1.21  kiyohara 		{ 0x8e4, MMODE(0) | PUDEN },		/* LCD_HSYNC */
   1537      1.21  kiyohara 		{ 0x8e8, MMODE(0) | PUDEN },		/* LCD_PCLK */
   1538      1.21  kiyohara 		{ 0x8ec, MMODE(0) | PUDEN },		/* LCD_AC_BIAS_EN */
   1539      1.21  kiyohara 
   1540      1.21  kiyohara 		{ 0x86c, MMODE(7) | PUTYPESEL },	/* GPIO 59: Enable */
   1541      1.21  kiyohara 		{ -1 }
   1542      1.21  kiyohara 	};
   1543      1.21  kiyohara 
   1544      1.21  kiyohara 	if (gxio_omap_mux_config_address("tifb", 0x4830e000,
   1545      1.21  kiyohara 					pepper_mux_lcd_conf, NULL) == 0) {
   1546      1.21  kiyohara 		extern const struct tifb_panel_info *tifb_panel_info;
   1547      1.21  kiyohara 		extern bool use_tps65217_wled;
   1548      1.21  kiyohara 
   1549      1.21  kiyohara 		tifb_panel_info = &panel_lcd;
   1550      1.21  kiyohara 		use_tps65217_wled = true;
   1551      1.21  kiyohara 	}
   1552      1.21  kiyohara }
   1553      1.21  kiyohara 
   1554      1.21  kiyohara static void
   1555      1.21  kiyohara pepper43_config(void)
   1556      1.21  kiyohara {
   1557      1.21  kiyohara 	static const struct omap_mux_conf pepper43_mux_wilink8_conf[] = {
   1558      1.21  kiyohara 		/* TI WiLink 8 */
   1559      1.21  kiyohara 		{ 0x800, MMODE(7) | PUTYPESEL },	/* GPIO 32: Bluetooth */
   1560      1.21  kiyohara 		{ 0x804, MMODE(7) | PUDEN | RXACTIVE },	/* GPIO 33: irq   */
   1561      1.21  kiyohara 		{ 0x860, MMODE(7) | PUTYPESEL },	/* GPIO 56: WiFi  */
   1562      1.21  kiyohara 		{ -1 }
   1563      1.21  kiyohara 	};
   1564      1.21  kiyohara 	static const struct omap_mux_conf pepper43_mux_i2c1_conf[] = {
   1565      1.21  kiyohara 		{ 0x968, MMODE(3) | PUTYPESEL | RXACTIVE },	/* I2C1_SDA */
   1566      1.21  kiyohara 		{ 0x96c, MMODE(3) | PUTYPESEL | RXACTIVE },	/* I2C1_SCL */
   1567      1.21  kiyohara 		{ -1 }
   1568      1.21  kiyohara 	};
   1569      1.21  kiyohara 	static const struct omap_mux_conf pepper43_mpu9150_conf[] = {
   1570      1.21  kiyohara 		/* MPU9150 at I2C1 */
   1571      1.21  kiyohara 		{ 0x808, MMODE(7) | PUDEN | RXACTIVE },	/* GPIO 34: IRQ */
   1572      1.21  kiyohara 		{ 0x898, MMODE(7) | PUDEN | RXACTIVE },	/* GPIO 68 */
   1573      1.21  kiyohara 		{ 0x870, MMODE(7) | PUDEN | RXACTIVE },	/* GPIO 30 */
   1574      1.21  kiyohara 		{ -1 }
   1575      1.21  kiyohara 	};
   1576      1.21  kiyohara 	static const struct omap_mux_conf pepper43_mux_20pin_header_conf[] = {
   1577      1.21  kiyohara 		{ 0x85c, MMODE(7) | PUDEN | RXACTIVE },	/*  1: GPIO 55 */
   1578      1.21  kiyohara 		{ 0x80c, MMODE(7) | PUDEN | RXACTIVE },	/*  2: GPIO 35 */
   1579      1.21  kiyohara 		{ 0x810, MMODE(7) | PUDEN | RXACTIVE },	/*  3: GPIO 36 */
   1580      1.21  kiyohara 		{ 0x814, MMODE(7) | PUDEN | RXACTIVE },	/*  4: GPIO 37 */
   1581      1.21  kiyohara 		{ 0x818, MMODE(7) | PUDEN | RXACTIVE },	/*  5: GPIO 38 */
   1582      1.21  kiyohara 		{ 0x81c, MMODE(7) | PUDEN | RXACTIVE },	/*  6: GPIO 39 */
   1583      1.21  kiyohara 		{ 0x87c, MMODE(7) | PUDEN | RXACTIVE },	/*  7: GPIO 61 */
   1584      1.21  kiyohara 		{ 0x880, MMODE(7) | PUDEN | RXACTIVE },	/*  8: GPIO 62 */
   1585      1.21  kiyohara 		{ 0x884, MMODE(7) | PUDEN | RXACTIVE },	/*  9: GPIO 63 */
   1586      1.21  kiyohara 		{ 0x9e4, MMODE(7) | PUDEN | RXACTIVE },	/* 10: GPIO 103 */
   1587      1.21  kiyohara 		{ 0x9e8, MMODE(7) | PUDEN | RXACTIVE },	/* 11: GPIO 104 */
   1588      1.21  kiyohara 		{ 0x9b0, MMODE(7) | PUDEN | RXACTIVE },	/* 12: GPIO 19 */
   1589      1.21  kiyohara #if 0	/* UART3 or GPIO */
   1590      1.21  kiyohara 		{ 0x964, MMODE(7) | PUDEN | RXACTIVE },	/* 13: GPIO 7 */
   1591      1.21  kiyohara 		{ 0x960, MMODE(7) | PUDEN | RXACTIVE },	/* 14: GPIO 6 */
   1592      1.21  kiyohara #endif
   1593      1.21  kiyohara #if 0	/* UART2 or GPIO */
   1594      1.21  kiyohara 		{ 0x910, MMODE(7) | PUDEN | RXACTIVE },	/* 15: GPIO 98 */
   1595      1.21  kiyohara 		{ 0x90c, MMODE(7) | PUDEN | RXACTIVE },	/* 16: GPIO 97 */
   1596      1.21  kiyohara #endif
   1597      1.21  kiyohara 							/* 17: VCC 5v */
   1598      1.21  kiyohara 							/* 18: VCC 3.3v */
   1599      1.21  kiyohara 							/* 19: GND */
   1600      1.21  kiyohara 							/* 20: GND */
   1601      1.21  kiyohara 		{ -1 }
   1602      1.21  kiyohara 	};
   1603      1.21  kiyohara 	static const struct omap_mux_conf pepper43_mux_uart2_conf[] = {
   1604      1.21  kiyohara 		{ 0x90c, MMODE(6) | PUTYPESEL | RXACTIVE },	/* UART2_RXD */
   1605      1.21  kiyohara 		{ 0x910, MMODE(6) | PUDEN },			/* UART2_TXD */
   1606      1.21  kiyohara 		{ -1 }
   1607      1.21  kiyohara 	};
   1608      1.21  kiyohara 	static const struct omap_mux_conf pepper43_mux_no_uart2_conf[] = {
   1609      1.21  kiyohara 		{ 0x90c, MMODE(7) | PUDEN | RXACTIVE },		/* GPIO 97 */
   1610      1.21  kiyohara 		{ 0x910, MMODE(7) | PUDEN | RXACTIVE },		/* GPIO 98 */
   1611      1.21  kiyohara 		{ -1 }
   1612      1.21  kiyohara 	};
   1613      1.21  kiyohara 	static const struct omap_mux_conf pepper43_mux_uart3_conf[] = {
   1614      1.21  kiyohara 		{ 0x960, MMODE(1) | PUTYPESEL | RXACTIVE },	/* UART3_RXD */
   1615      1.21  kiyohara 		{ 0x964, MMODE(1) | PUDEN },			/* UART3_TXD */
   1616      1.21  kiyohara 		{ -1 }
   1617      1.21  kiyohara 	};
   1618      1.21  kiyohara 	static const struct omap_mux_conf pepper43_mux_no_uart3_conf[] = {
   1619      1.21  kiyohara 		{ 0x960, MMODE(7) | PUDEN | RXACTIVE },		/* GPIO 6 */
   1620      1.21  kiyohara 		{ 0x964, MMODE(7) | PUDEN | RXACTIVE },		/* GPIO 7 */
   1621      1.21  kiyohara 		{ -1 }
   1622      1.21  kiyohara 	};
   1623      1.21  kiyohara 
   1624      1.21  kiyohara 	static const struct omap_mux_conf *pepper43_mux_conf[] = {
   1625      1.21  kiyohara 		pepper43_mux_wilink8_conf,
   1626      1.21  kiyohara 		pepper43_mux_i2c1_conf,
   1627      1.21  kiyohara 		pepper43_mpu9150_conf,
   1628      1.21  kiyohara 		pepper43_mux_20pin_header_conf,
   1629      1.21  kiyohara 	};
   1630      1.21  kiyohara 
   1631      1.21  kiyohara 	static const struct omap_gpio_conf pepper43_gpio_wl18xx_conf[] = {
   1632      1.21  kiyohara 		{  32, conf_output_0 },		/* #Reset: Bluetooth */
   1633      1.21  kiyohara 		{  56, conf_output_0 },		/* #Reset: WiFi */
   1634      1.21  kiyohara 		{ -1 }
   1635      1.21  kiyohara 	};
   1636      1.21  kiyohara 	int i;
   1637      1.21  kiyohara 
   1638      1.21  kiyohara 	lcd_config();
   1639      1.21  kiyohara 
   1640      1.21  kiyohara 	for (i = 0; i < __arraycount(pepper43_mux_conf); i++)
   1641      1.21  kiyohara 		gxio_omap_mux_config(pepper43_mux_conf[i]);
   1642      1.21  kiyohara 	gxio_omap_gpio_config(pepper43_gpio_wl18xx_conf);
   1643      1.21  kiyohara 
   1644      1.21  kiyohara #if 0
   1645      1.21  kiyohara 	ioreg_write(gpio1_base + GPIO_SIZE2 + GPIO_OE,	/* GPIO 52 (Blue) */
   1646      1.21  kiyohara 	    ioreg_read(gpio1_base + GPIO_SIZE2 + GPIO_OE) & ~(1 << 20));
   1647      1.21  kiyohara 	ioreg_write(gpio1_base + GPIO_SIZE2 + GPIO_DATAOUT,
   1648      1.21  kiyohara 	    ioreg_read(gpio1_base + GPIO_SIZE2 + GPIO_DATAOUT) | (1 << 20));
   1649      1.21  kiyohara 	ioreg_write(gpio1_base + GPIO_SIZE2 + GPIO_OE,	/* GPIO 53 (Red) */
   1650      1.21  kiyohara 	    ioreg_read(gpio1_base + GPIO_SIZE2 + GPIO_OE) & ~(1 << 21));
   1651      1.21  kiyohara 	ioreg_write(gpio1_base + GPIO_SIZE2 + GPIO_DATAOUT,
   1652      1.21  kiyohara 	    ioreg_read(gpio1_base + GPIO_SIZE2 + GPIO_DATAOUT) | (1 << 21));
   1653      1.21  kiyohara #endif
   1654      1.21  kiyohara 
   1655      1.21  kiyohara 	gxio_omap_mux_config_address("com", 0x48024000,
   1656      1.21  kiyohara 	    pepper43_mux_uart2_conf, pepper43_mux_no_uart2_conf);
   1657      1.21  kiyohara 	gxio_omap_mux_config_address("com", 0x481a6000,
   1658      1.21  kiyohara 	    pepper43_mux_uart3_conf, pepper43_mux_no_uart3_conf);
   1659      1.21  kiyohara }
   1660      1.21  kiyohara 
   1661      1.21  kiyohara static void
   1662      1.21  kiyohara pepper_config(void)
   1663      1.21  kiyohara {
   1664      1.21  kiyohara 	static const struct omap_mux_conf pepper_mux_button2_conf[] = {
   1665      1.21  kiyohara 		{ 0x85c, MMODE(7) | PUTYPESEL | RXACTIVE },	/* GPIO 55 */
   1666      1.21  kiyohara 		{ -1 }
   1667      1.21  kiyohara 	};
   1668      1.21  kiyohara 	static const struct omap_mux_conf pepper_mux_i2c1_conf[] = {
   1669      1.21  kiyohara 		{ 0x90c, MMODE(3) | PUTYPESEL | RXACTIVE },	/* I2C1_SDA */
   1670      1.21  kiyohara 		{ 0x910, MMODE(3) | PUTYPESEL | RXACTIVE },	/* I2C1_SCL */
   1671      1.21  kiyohara 		{ -1 }
   1672      1.21  kiyohara 	};
   1673      1.21  kiyohara 	static const struct omap_mux_conf pepper_mux_wi2wi_conf[] = {
   1674      1.21  kiyohara 		{ 0x9b4, MMODE(3) | PUDEN },			/* CLKOUT2 */
   1675      1.21  kiyohara 		/* Wi2Wi */
   1676      1.21  kiyohara 		{ 0x860, MMODE(7) | PUTYPESEL },	/* GPIO 56: nReset */
   1677      1.21  kiyohara 		{ 0x870, MMODE(7) | PUTYPESEL },	/* GPIO 30: nPower */
   1678      1.21  kiyohara 		{ -1 }
   1679      1.21  kiyohara 	};
   1680      1.21  kiyohara 	static const struct omap_mux_conf pepper_mux_uart1_conf[] = {
   1681      1.21  kiyohara 		{ 0x978, MMODE(0) | PUTYPESEL | RXACTIVE },	/* UART1_CTSn */
   1682      1.21  kiyohara 		{ 0x97c, MMODE(0) },				/* UART1_RTSn */
   1683      1.21  kiyohara 		{ 0x980, MMODE(0) | PUTYPESEL | RXACTIVE },	/* UART1_RXD */
   1684      1.21  kiyohara 		{ 0x984, MMODE(0) },				/* UART1_TXD */
   1685      1.21  kiyohara 		{ -1 }
   1686      1.21  kiyohara 	};
   1687      1.21  kiyohara 	static const struct omap_mux_conf pepper_mux_no_uart1_conf[] = {
   1688      1.21  kiyohara 		{ 0x978, MMODE(7) | PUDEN | RXACTIVE },		/* GPIO 12 */
   1689      1.21  kiyohara 		{ 0x97c, MMODE(7) | PUDEN | RXACTIVE },		/* GPIO 13 */
   1690      1.21  kiyohara 		{ 0x980, MMODE(7) | PUDEN | RXACTIVE },		/* GPIO 14 */
   1691      1.21  kiyohara 		{ 0x984, MMODE(7) | PUDEN | RXACTIVE },		/* GPIO 15 */
   1692      1.21  kiyohara 		{ -1 }
   1693      1.21  kiyohara 	};
   1694      1.21  kiyohara 	static const struct omap_mux_conf *pepper_mux_conf[] = {
   1695      1.21  kiyohara 		pepper_mux_button2_conf,
   1696      1.21  kiyohara 		pepper_mux_i2c1_conf,
   1697      1.21  kiyohara 		pepper_mux_wi2wi_conf,
   1698      1.21  kiyohara 	};
   1699      1.21  kiyohara 
   1700      1.21  kiyohara 	int i;
   1701      1.21  kiyohara 
   1702      1.21  kiyohara 	lcd_config();
   1703      1.21  kiyohara 
   1704      1.21  kiyohara 	for (i = 0; i < __arraycount(pepper_mux_conf); i++)
   1705      1.21  kiyohara 		gxio_omap_mux_config(pepper_mux_conf[i]);
   1706      1.21  kiyohara 	gxio_omap_mux_config_address("com", 0x48022000,
   1707      1.21  kiyohara 	    pepper_mux_uart1_conf, pepper_mux_no_uart1_conf);
   1708      1.21  kiyohara }
   1709      1.21  kiyohara 
   1710      1.21  kiyohara static void
   1711      1.21  kiyohara c_config(void)
   1712      1.21  kiyohara {
   1713      1.21  kiyohara 	static const struct omap_mux_conf pepper43c_mux_ft5306_conf[] = {
   1714      1.21  kiyohara 		/* FT5306 at I2C2 */
   1715      1.21  kiyohara 		{ 0x9b4, MMODE(7) | PUDEN | RXACTIVE },		/* GPIO 20 */
   1716      1.21  kiyohara 		{ 0x95c, MMODE(7) | PUDEN },			/* GPIO 5 */
   1717      1.21  kiyohara 		{ -1 }
   1718      1.21  kiyohara 	};
   1719      1.21  kiyohara 	static const struct omap_mux_conf pepper43c_mux_i2c2_conf[] = {
   1720      1.21  kiyohara 		{ 0x950, MMODE(2) | PUTYPESEL | RXACTIVE },	/* I2C2_SDA */
   1721      1.21  kiyohara 		{ 0x954, MMODE(2) | PUTYPESEL | RXACTIVE },	/* I2C2_SCL */
   1722      1.21  kiyohara 		{ -1 }
   1723      1.21  kiyohara 	};
   1724      1.21  kiyohara 	static const struct omap_mux_conf *pepper43c_mux_conf[] = {
   1725      1.21  kiyohara 		pepper43c_mux_ft5306_conf,
   1726      1.21  kiyohara 		pepper43c_mux_i2c2_conf,
   1727      1.21  kiyohara 	};
   1728      1.21  kiyohara 
   1729      1.21  kiyohara 	static const struct omap_gpio_conf pepper43c_gpio_ft5306_conf[] = {
   1730      1.21  kiyohara 		{   5, conf_output_0 },		/* #Reset */
   1731      1.21  kiyohara 		{ -1 }
   1732      1.21  kiyohara 	};
   1733      1.21  kiyohara 	int i;
   1734      1.21  kiyohara 
   1735      1.21  kiyohara 	pepper43_config();
   1736      1.21  kiyohara 
   1737      1.21  kiyohara 	for (i = 0; i < __arraycount(pepper43c_mux_conf); i++)
   1738      1.21  kiyohara 		gxio_omap_mux_config(pepper43c_mux_conf[i]);
   1739      1.21  kiyohara 	gxio_omap_gpio_config(pepper43c_gpio_ft5306_conf);
   1740      1.21  kiyohara }
   1741      1.21  kiyohara 
   1742      1.21  kiyohara static void
   1743      1.21  kiyohara dvi_config(void)
   1744      1.21  kiyohara {
   1745      1.21  kiyohara 	/* XXXX: hmm... mismatch found in Linux's dts and pubs.gumstix.org... */
   1746      1.21  kiyohara 
   1747      1.21  kiyohara 	extern struct cfdata cfdata[];
   1748      1.21  kiyohara 	extern const struct tifb_panel_info *tifb_panel_info;
   1749      1.21  kiyohara 
   1750      1.21  kiyohara 	static const struct tifb_panel_info panel_dvi = {
   1751      1.21  kiyohara 		.panel_tft = 1,
   1752      1.21  kiyohara 		.panel_mono = false,
   1753      1.21  kiyohara 		.panel_bpp = 16,
   1754      1.21  kiyohara 
   1755      1.21  kiyohara 		.panel_pxl_clk = 63500000,
   1756      1.21  kiyohara 		.panel_width = 1024,
   1757      1.21  kiyohara 		.panel_height = 768,
   1758      1.21  kiyohara 		.panel_hfp = 8,
   1759      1.21  kiyohara 		.panel_hbp = 4,
   1760      1.21  kiyohara 		.panel_hsw = 41,
   1761      1.21  kiyohara 		.panel_vfp = 4,
   1762      1.21  kiyohara 		.panel_vbp = 2,
   1763      1.21  kiyohara 		.panel_vsw = 10,
   1764      1.21  kiyohara 		.panel_invert_hsync = 0,
   1765      1.21  kiyohara 		.panel_invert_vsync = 0,
   1766      1.21  kiyohara 
   1767      1.21  kiyohara 		.panel_ac_bias = 255,
   1768      1.21  kiyohara 		.panel_ac_bias_intrpt = 0,
   1769      1.21  kiyohara 		.panel_dma_burst_sz = 16,
   1770      1.21  kiyohara 		.panel_fdd = 0x80,
   1771      1.21  kiyohara 		.panel_sync_edge = 0,
   1772      1.21  kiyohara 		.panel_sync_ctrl = 1,
   1773      1.21  kiyohara 		.panel_invert_pxl_clk = 0,
   1774      1.21  kiyohara 	};
   1775      1.21  kiyohara 	cfdata_t cf = &cfdata[0];
   1776      1.21  kiyohara 
   1777      1.21  kiyohara 	/* Disable wireless module. */
   1778      1.21  kiyohara 	while (cf->cf_name != NULL) {
   1779      1.21  kiyohara 		if (strcmp(cf->cf_name, "sdhc") == 0 &&
   1780      1.21  kiyohara 		    strcmp(cf->cf_atname, "mainbus") == 0 &&
   1781      1.21  kiyohara 		    cf->cf_loc[MAINBUSCF_BASE] == 0x47810000) {
   1782      1.21  kiyohara 			if (cf->cf_fstate == FSTATE_NOTFOUND)
   1783      1.21  kiyohara 				cf->cf_fstate = FSTATE_DNOTFOUND;
   1784      1.21  kiyohara 			else if (cf->cf_fstate == FSTATE_STAR)
   1785      1.21  kiyohara 				cf->cf_fstate = FSTATE_DSTAR;
   1786      1.21  kiyohara 		}
   1787      1.21  kiyohara 		cf++;
   1788      1.21  kiyohara 	}
   1789      1.21  kiyohara 
   1790      1.21  kiyohara 	tifb_panel_info = &panel_dvi;
   1791      1.21  kiyohara }
   1792      1.21  kiyohara 
   1793      1.21  kiyohara static void
   1794      1.21  kiyohara r_config(void)
   1795      1.21  kiyohara {
   1796      1.21  kiyohara 	static const struct omap_mux_conf pepper43r_mux_ads7846_conf[] = {
   1797      1.21  kiyohara 		/* ADS7846 at McSPI0 */
   1798      1.21  kiyohara 		{ 0x9b4, MMODE(7) | PUDEN | RXACTIVE },	/* GPIO 20: IRQ */
   1799      1.21  kiyohara 		{ -1 }
   1800      1.21  kiyohara 	};
   1801      1.21  kiyohara 	static const struct omap_mux_conf pepper43r_mux_spi0_conf[] = {
   1802      1.21  kiyohara 		{ 0x950, MMODE(0) | PUTYPESEL | RXACTIVE },	/* SPI0_SCLK */
   1803      1.21  kiyohara 		{ 0x954, MMODE(0) | PUTYPESEL | RXACTIVE },	/* SPI0_D0 */
   1804      1.21  kiyohara 		{ 0x958, MMODE(0) | PUTYPESEL | RXACTIVE },	/* SPI0_D1 */
   1805      1.21  kiyohara 		{ 0x95c, MMODE(0) | PUTYPESEL | RXACTIVE },	/* SPI0_CS0 */
   1806      1.21  kiyohara 		{ -1 }
   1807      1.21  kiyohara 	};
   1808      1.21  kiyohara 	static const struct omap_mux_conf *pepper43r_mux_conf[] = {
   1809      1.21  kiyohara 		pepper43r_mux_ads7846_conf,
   1810      1.21  kiyohara 		pepper43r_mux_spi0_conf,
   1811      1.21  kiyohara 	};
   1812      1.21  kiyohara 	int i;
   1813      1.21  kiyohara 
   1814      1.21  kiyohara 	pepper43_config();
   1815      1.21  kiyohara 
   1816      1.21  kiyohara 	for (i = 0; i < __arraycount(pepper43r_mux_conf); i++)
   1817      1.21  kiyohara 		gxio_omap_mux_config(pepper43r_mux_conf[i]);
   1818      1.21  kiyohara }
   1819      1.21  kiyohara 
   1820      1.21  kiyohara #endif
   1821      1.21  kiyohara 
   1822      1.21  kiyohara #if defined(OVERO) || defined(DUOVERO)
   1823      1.21  kiyohara static void
   1824      1.21  kiyohara smsh_config(struct omap_mux_conf *smsh_mux_conf, int intr, int nreset)
   1825      1.21  kiyohara {
   1826      1.21  kiyohara 	struct omap_gpio_conf smsh_gpio_conf[] = {
   1827      1.21  kiyohara 		{ intr,		conf_input },
   1828      1.21  kiyohara 		{ nreset,	conf_output_0 },
   1829      1.21  kiyohara 		{ -1 }
   1830      1.21  kiyohara 	};
   1831      1.21  kiyohara 
   1832      1.21  kiyohara 	/*
   1833      1.21  kiyohara 	 * Basically use current settings by U-Boot.
   1834      1.21  kiyohara 	 * However remap physical address to configured address.
   1835      1.21  kiyohara 	 */
   1836      1.21  kiyohara 
   1837      1.21  kiyohara 	if (smsh_mux_conf != NULL)
   1838      1.21  kiyohara 		gxio_omap_mux_config(smsh_mux_conf);
   1839      1.21  kiyohara 	gxio_omap_gpio_config(smsh_gpio_conf);
   1840      1.21  kiyohara 	__udelay(100000);
   1841      1.21  kiyohara 	gxio_omap_gpio_write(nreset, 1);
   1842      1.21  kiyohara }
   1843      1.21  kiyohara #endif
   1844      1.21  kiyohara 
   1845      1.21  kiyohara #if defined(OVERO) || defined(DUOVERO) || defined(PEPPER)
   1846      1.21  kiyohara /*
   1847      1.21  kiyohara  * The delay for configuration time.
   1848      1.21  kiyohara  * This function use initialized timer by U-Boot.
   1849      1.21  kiyohara  */
   1850      1.21  kiyohara static void
   1851      1.21  kiyohara __udelay(unsigned int usec)
   1852      1.21  kiyohara {
   1853      1.21  kiyohara #if defined(OVERO) || defined(DUOVERO)
   1854      1.21  kiyohara #define V_SCLK			(26000000 >> 1)
   1855      1.21  kiyohara #define TCRR			0x28
   1856      1.21  kiyohara #elif defined(PEPPER)
   1857      1.21  kiyohara #define V_SCLK			24000000
   1858      1.21  kiyohara #define TCRR			0x3c
   1859      1.21  kiyohara #endif
   1860      1.21  kiyohara #define SYS_PTV			2
   1861      1.21  kiyohara #define TIMER_CLOCK		(V_SCLK / (2 << SYS_PTV))
   1862      1.21  kiyohara 
   1863      1.21  kiyohara 	const vaddr_t timer_base =
   1864      1.21  kiyohara #if defined(OVERO)
   1865      1.21  kiyohara 	    OVERO_L4_PERIPHERAL_VBASE + 0x32000;
   1866      1.21  kiyohara #elif defined(DUOVERO)
   1867      1.21  kiyohara 	    DUOVERO_L4_PERIPHERAL_VBASE + 0x32000;
   1868      1.21  kiyohara #elif defined(PEPPER)
   1869      1.21  kiyohara 	    PEPPER_L4_PERIPHERAL_VBASE + 0x40000;
   1870      1.21  kiyohara #endif
   1871      1.21  kiyohara 	long timo = usec * (TIMER_CLOCK / 1000) / 1000;
   1872      1.21  kiyohara 	uint32_t now, last;
   1873      1.21  kiyohara 
   1874      1.21  kiyohara 	last = ioreg_read(timer_base + TCRR);
   1875      1.21  kiyohara 	while (timo > 0) {
   1876      1.21  kiyohara 		now = ioreg_read(timer_base + TCRR);
   1877      1.21  kiyohara 		if (last > now)
   1878      1.21  kiyohara 			timo -= __BITS(0, 31) - last + now + 1;
   1879      1.21  kiyohara 		else
   1880      1.21  kiyohara 			timo -= now - last;
   1881      1.21  kiyohara 		last = now;
   1882      1.21  kiyohara 	}
   1883      1.21  kiyohara }
   1884      1.21  kiyohara #endif
   1885      1.21  kiyohara 
   1886      1.21  kiyohara #if defined(PEPPER)
   1887      1.21  kiyohara static int
   1888      1.21  kiyohara read_i2c_device(const vaddr_t i2c_base, uint16_t sa, uint8_t addr, int len,
   1889      1.21  kiyohara 		uint8_t *buf)
   1890      1.21  kiyohara {
   1891      1.21  kiyohara 	uint16_t v;
   1892      1.21  kiyohara 	int aok = 0, cnt = 0;
   1893      1.21  kiyohara 
   1894      1.21  kiyohara 	ioreg16_write(i2c_base + OMAP2_I2C_IRQSTATUS, 0xffff);
   1895      1.21  kiyohara 	v = ioreg16_read(i2c_base + OMAP2_I2C_IRQSTATUS_RAW);
   1896      1.21  kiyohara 	while (v & I2C_IRQSTATUS_BB) {
   1897      1.21  kiyohara 		ioreg16_write(i2c_base + OMAP2_I2C_IRQSTATUS, v);
   1898      1.21  kiyohara 		__udelay(20);
   1899      1.21  kiyohara 		v = ioreg16_read(i2c_base + OMAP2_I2C_IRQSTATUS_RAW);
   1900      1.21  kiyohara 	}
   1901      1.21  kiyohara 	ioreg16_write(i2c_base + OMAP2_I2C_IRQSTATUS, 0xffff);
   1902      1.21  kiyohara 
   1903      1.21  kiyohara 	ioreg16_write(i2c_base + OMAP2_I2C_SA, sa);
   1904      1.21  kiyohara 	ioreg16_write(i2c_base + OMAP2_I2C_CNT, sizeof(addr));
   1905      1.21  kiyohara 	ioreg16_write(i2c_base + OMAP2_I2C_CON,
   1906      1.21  kiyohara 	    I2C_CON_EN | I2C_CON_MST | I2C_CON_TRX | I2C_CON_STP | I2C_CON_STT);
   1907      1.21  kiyohara 	while (1 /*CONSTCOND*/) {
   1908      1.21  kiyohara 		__udelay(20);
   1909      1.21  kiyohara 		v = ioreg16_read(i2c_base + OMAP2_I2C_IRQSTATUS_RAW);
   1910      1.21  kiyohara 		if ((v & I2C_IRQSTATUS_XRDY) && aok == 0) {
   1911      1.21  kiyohara 			aok = 1;
   1912      1.21  kiyohara 			ioreg16_write(i2c_base + OMAP2_I2C_DATA, addr);
   1913      1.21  kiyohara 			ioreg16_write(i2c_base + OMAP2_I2C_IRQSTATUS,
   1914      1.21  kiyohara 			    I2C_IRQSTATUS_XRDY);
   1915      1.21  kiyohara 		}
   1916      1.21  kiyohara 		if (v & I2C_IRQSTATUS_ARDY) {
   1917      1.21  kiyohara 			ioreg16_write(i2c_base + OMAP2_I2C_IRQSTATUS,
   1918      1.21  kiyohara 			    I2C_IRQSTATUS_ARDY);
   1919      1.21  kiyohara 			break;
   1920      1.21  kiyohara 		}
   1921      1.21  kiyohara 	}
   1922      1.21  kiyohara 
   1923      1.21  kiyohara 	ioreg16_write(i2c_base + OMAP2_I2C_SA, sa);
   1924      1.21  kiyohara 	ioreg16_write(i2c_base + OMAP2_I2C_CNT, len);
   1925      1.21  kiyohara 	ioreg16_write(i2c_base + OMAP2_I2C_CON,
   1926      1.21  kiyohara 	    I2C_CON_EN | I2C_CON_MST | I2C_CON_STP | I2C_CON_STT);
   1927      1.21  kiyohara 	while (1 /*CONSTCOND*/) {
   1928      1.21  kiyohara 		v = ioreg16_read(i2c_base + OMAP2_I2C_IRQSTATUS_RAW);
   1929      1.21  kiyohara 		if (v & I2C_IRQSTATUS_RRDY &&
   1930      1.21  kiyohara 		    cnt < len) {
   1931      1.21  kiyohara 			buf[cnt++] = ioreg16_read(i2c_base + OMAP2_I2C_DATA);
   1932      1.21  kiyohara 			ioreg16_write(i2c_base + OMAP2_I2C_IRQSTATUS,
   1933      1.21  kiyohara 			    I2C_IRQSTATUS_RRDY);
   1934      1.21  kiyohara 		}
   1935      1.21  kiyohara 		if (v & I2C_IRQSTATUS_ARDY) {
   1936      1.21  kiyohara 			ioreg16_write(i2c_base + OMAP2_I2C_IRQSTATUS,
   1937      1.21  kiyohara 			    I2C_IRQSTATUS_ARDY);
   1938      1.21  kiyohara 			break;
   1939      1.21  kiyohara 		}
   1940      1.21  kiyohara 	}
   1941      1.21  kiyohara 	ioreg16_write(i2c_base + OMAP2_I2C_IRQSTATUS, 0xffff);
   1942      1.21  kiyohara 	return 0;
   1943      1.21  kiyohara }
   1944      1.15  kiyohara #endif
   1945