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