Home | History | Annotate | Line # | Download | only in gumstix
gxio.c revision 1.16
      1 /*	$NetBSD: gxio.c,v 1.16 2010/08/28 04:39:42 kiyohara Exp $ */
      2 /*
      3  * Copyright (C) 2005, 2006, 2007 WIDE Project and SOUM Corporation.
      4  * All rights reserved.
      5  *
      6  * Written by Takashi Kiyohara and Susumu Miki for WIDE Project and SOUM
      7  * Corporation.
      8  *
      9  * Redistribution and use in source and binary forms, with or without
     10  * modification, are permitted provided that the following conditions
     11  * are met:
     12  * 1. Redistributions of source code must retain the above copyright
     13  *    notice, this list of conditions and the following disclaimer.
     14  * 2. Redistributions in binary form must reproduce the above copyright
     15  *    notice, this list of conditions and the following disclaimer in the
     16  *    documentation and/or other materials provided with the distribution.
     17  * 3. Neither the name of the project nor the name of SOUM Corporation
     18  *    may be used to endorse or promote products derived from this software
     19  *    without specific prior written permission.
     20  *
     21  * THIS SOFTWARE IS PROVIDED BY THE PROJECT and SOUM CORPORATION ``AS IS''
     22  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     23  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     24  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT AND SOUM CORPORATION
     25  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     26  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     27  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     28  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     29  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     30  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     31  * POSSIBILITY OF SUCH DAMAGE.
     32  */
     33 #include <sys/cdefs.h>
     34 __KERNEL_RCSID(0, "$NetBSD: gxio.c,v 1.16 2010/08/28 04:39:42 kiyohara Exp $");
     35 
     36 #include "opt_cputypes.h"
     37 #include "opt_gumstix.h"
     38 #include "opt_gxio.h"
     39 
     40 #include <sys/param.h>
     41 #include <sys/device.h>
     42 #include <sys/errno.h>
     43 #include <sys/kernel.h>
     44 
     45 #include <sys/systm.h>
     46 
     47 #include <machine/bootconfig.h>
     48 
     49 #include <arm/omap/omap2_gpmcreg.h>
     50 #include <arm/omap/omap2_reg.h>
     51 #include <arm/omap/omap2_intr.h>
     52 #include <arm/omap/omap_var.h>
     53 #if defined(CPU_XSCALE_PXA270) || defined(CPU_XSCALE_PXA250)
     54 #include <arm/xscale/pxa2x0cpu.h>
     55 #endif
     56 #include <arm/xscale/pxa2x0reg.h>
     57 #include <arm/xscale/pxa2x0var.h>
     58 #include <arm/xscale/pxa2x0_gpio.h>
     59 #include <evbarm/gumstix/gumstixreg.h>
     60 #include <evbarm/gumstix/gumstixvar.h>
     61 
     62 #include "ioconf.h"
     63 #include "locators.h"
     64 
     65 
     66 struct gxioconf {
     67 	const char *name;
     68 	void (*config)(void);
     69 };
     70 
     71 #if defined(GUMSTIX)
     72 static int gxiomatch(device_t, cfdata_t, void *);
     73 static void gxioattach(device_t, device_t, void *);
     74 static int gxiosearch(device_t, cfdata_t, const int *, void *);
     75 static int gxioprint(void *, const char *);
     76 
     77 CFATTACH_DECL_NEW(gxio, sizeof(struct gxio_softc),
     78     gxiomatch, gxioattach, NULL, NULL);
     79 #endif
     80 
     81 void gxio_config_pin(void);
     82 void gxio_config_expansion(char *);
     83 static void gxio_config_gpio(const struct gxioconf *, char *);
     84 #if defined(GUMSTIX)
     85 static void basix_config(void);
     86 static void cfstix_config(void);
     87 static void etherstix_config(void);
     88 static void netcf_config(void);
     89 static void netcf_vx_config(void);
     90 static void netduommc_config(void);
     91 static void netduo_config(void);
     92 static void netmicrosd_config(void);
     93 static void netwifimicrosd_config(void);
     94 static void netmmc_config(void);
     95 static void wifistix_config(void);
     96 static void wifistix_cf_config(void);
     97 #elif defined(OVERO)
     98 static void eth0_config(void);
     99 static void eth1_config(void);
    100 static void chestnut_config(void);
    101 static void tobi_config(void);
    102 static void tobiduo_config(void);
    103 #endif
    104 
    105 #if defined(CPU_XSCALE_PXA250)
    106 static struct pxa2x0_gpioconf pxa255dep_gpioconf[] = {
    107 	/* Bluetooth module configuration */
    108 	{  7, GPIO_OUT | GPIO_SET },	/* power on */
    109 	{ 12, GPIO_ALT_FN_1_OUT },	/* 32kHz out. required by SingleStone */
    110 
    111 	/* AC97 configuration */
    112 	{ 29, GPIO_ALT_FN_1_IN },	/* SDATA_IN0 */
    113 
    114 	/* FFUART configuration */
    115 	{ 35, GPIO_ALT_FN_1_IN },	/* CTS */
    116 	{ 41, GPIO_ALT_FN_2_OUT },	/* RTS */
    117 
    118 #ifndef GXIO_BLUETOOTH_ON_HWUART
    119 	/* BTUART configuration */
    120 	{ 44, GPIO_ALT_FN_1_IN },	/* BTCTS */
    121 	{ 45, GPIO_ALT_FN_2_OUT },	/* BTRTS */
    122 #else
    123 	/* HWUART configuration */
    124 	{ 42, GPIO_ALT_FN_3_IN },	/* HWRXD */
    125 	{ 43, GPIO_ALT_FN_3_OUT },	/* HWTXD */
    126 	{ 44, GPIO_ALT_FN_3_IN },	/* HWCTS */
    127 	{ 45, GPIO_ALT_FN_3_OUT },	/* HWRTS */
    128 #endif
    129 
    130 #ifndef GXIO_BLUETOOTH_ON_HWUART
    131 	/* HWUART configuration */
    132 	{ 48, GPIO_ALT_FN_1_OUT },	/* HWTXD */
    133 	{ 49, GPIO_ALT_FN_1_IN },	/* HWRXD */
    134 	{ 50, GPIO_ALT_FN_1_IN },	/* HWCTS */
    135 	{ 51, GPIO_ALT_FN_1_OUT },	/* HWRTS */
    136 #endif
    137 
    138 	{ -1 }
    139 };
    140 #endif
    141 #if defined(CPU_XSCALE_PXA270)
    142 static struct pxa2x0_gpioconf verdexdep_gpioconf[] = {
    143 	/* Bluetooth module configuration */
    144 	{   9, GPIO_ALT_FN_3_OUT },	/* CHOUT<0> */
    145 	{  12, GPIO_OUT | GPIO_SET },
    146 
    147 	/* LCD configuration */
    148 	{  17, GPIO_IN },		/* backlight on */
    149 
    150 	/* FFUART configuration */
    151 	{  34, GPIO_ALT_FN_1_IN },	/* FFRXD */
    152 	{  39, GPIO_ALT_FN_2_OUT },	/* FFTXD */
    153 
    154 	/* BTUART configuration */
    155 	{  42, GPIO_ALT_FN_1_IN },	/* BTRXD */
    156 	{  43, GPIO_ALT_FN_2_OUT },	/* BTTXD */
    157 	{  44, GPIO_ALT_FN_1_IN },	/* BTCTS */
    158 	{  45, GPIO_ALT_FN_2_OUT },	/* BTRTS */
    159 
    160 	/* AC97 configuration */
    161 	{  29, GPIO_ALT_FN_1_IN },	/* SDATA_IN0 */
    162 
    163 	{ -1 }
    164 };
    165 #endif
    166 
    167 static const struct gxioconf busheader_conf[] = {
    168 #if defined(GUMSTIX)
    169 	{ "basix",		basix_config },
    170 	{ "cfstix",		cfstix_config },
    171 	{ "etherstix",		etherstix_config },
    172 	{ "netcf",		netcf_config },
    173 	{ "netcf-vx",		netcf_vx_config },
    174 	{ "netduo-mmc",		netduommc_config },
    175 	{ "netduo",		netduo_config },
    176 	{ "netmicrosd",		netmicrosd_config },
    177 	{ "netmicrosd-vx",	netmicrosd_config },
    178 	{ "netwifimicrosd",	netwifimicrosd_config },
    179 	{ "netmmc",		netmmc_config },
    180 	{ "netpro-vx",		netwifimicrosd_config },
    181 	{ "wifistix-cf",	wifistix_cf_config },
    182 	{ "wifistix",		wifistix_config },
    183 #elif defined(OVERO)
    184 	{ "chestnut43",		chestnut_config },
    185 	{ "tobi",		tobi_config },
    186 	{ "tobi-duo",		tobiduo_config },
    187 #endif
    188 	{ NULL }
    189 };
    190 
    191 int gxpcic_gpio_reset;
    192 struct gxpcic_slot_irqs gxpcic_slot_irqs[2] = { { 0, -1, -1 }, { 0, -1, -1 } };
    193 
    194 
    195 #if defined(GUMSTIX)
    196 /* ARGSUSED */
    197 static int
    198 gxiomatch(device_t parent, cfdata_t match, void *aux)
    199 {
    200 
    201 	struct pxaip_attach_args *pxa = aux;
    202 	bus_space_tag_t iot = &pxa2x0_bs_tag;
    203 	bus_space_handle_t ioh;
    204 
    205 	if (strcmp(pxa->pxa_name, match->cf_name) != 0 ||
    206 	    pxa->pxa_addr != PXAIPCF_ADDR_DEFAULT)
    207 		 return 0;
    208 
    209 	if (bus_space_map(iot,
    210 	    PXA2X0_MEMCTL_BASE, PXA2X0_MEMCTL_SIZE, 0, &ioh))
    211 		return 0;
    212 	bus_space_unmap(iot, ioh, PXA2X0_MEMCTL_SIZE);
    213 
    214 	/* nothing */
    215 	return 1;
    216 }
    217 
    218 /* ARGSUSED */
    219 static void
    220 gxioattach(device_t parent, device_t self, void *aux)
    221 {
    222 	struct gxio_softc *sc = device_private(self);
    223 
    224 	aprint_normal("\n");
    225 	aprint_naive("\n");
    226 
    227 	sc->sc_dev = self;
    228 	sc->sc_iot = &pxa2x0_bs_tag;
    229 
    230 	if (bus_space_map(sc->sc_iot,
    231 	    PXA2X0_MEMCTL_BASE, PXA2X0_MEMCTL_SIZE, 0, &sc->sc_ioh))
    232 		return;
    233 
    234 	/*
    235 	 *  Attach each gumstix(busheader)/overo expansion board devices.
    236 	 */
    237 	config_search_ia(gxiosearch, self, "gxio", NULL);
    238 }
    239 
    240 /* ARGSUSED */
    241 static int
    242 gxiosearch(device_t parent, cfdata_t cf, const int *ldesc, void *aux)
    243 {
    244 	struct gxio_softc *sc = device_private(parent);
    245 	struct gxio_attach_args gxa;
    246 
    247 	gxa.gxa_sc = sc;
    248 	gxa.gxa_iot = sc->sc_iot;
    249 	gxa.gxa_addr = cf->cf_loc[GXIOCF_ADDR];
    250 	gxa.gxa_gpirq = cf->cf_loc[GXIOCF_GPIRQ];
    251 
    252 	if (config_match(parent, cf, &gxa))
    253 		config_attach(parent, cf, &gxa, gxioprint);
    254 
    255 	return 0;
    256 }
    257 
    258 /* ARGSUSED */
    259 static int
    260 gxioprint(void *aux, const char *name)
    261 {
    262 	struct gxio_attach_args *gxa = (struct gxio_attach_args *)aux;
    263 
    264 	if (gxa->gxa_addr != GXIOCF_ADDR_DEFAULT)
    265 		printf(" addr 0x%lx", gxa->gxa_addr);
    266 	if (gxa->gxa_gpirq > 0)
    267 		printf(" gpirq %d", gxa->gxa_gpirq);
    268 	return UNCONF;
    269 }
    270 #endif
    271 
    272 
    273 /*
    274  * configure for GPIO pin and expansion boards.
    275  */
    276 void
    277 gxio_config_pin(void)
    278 {
    279 #if defined(CPU_XSCALE_PXA250)
    280 	struct pxa2x0_gpioconf *gumstix_gpioconf[] = {
    281 		pxa25x_com_ffuart_gpioconf,
    282 		pxa25x_com_stuart_gpioconf,
    283 #ifndef GXIO_BLUETOOTH_ON_HWUART
    284 		pxa25x_com_btuart_gpioconf,
    285 #endif
    286 		pxa25x_com_hwuart_gpioconf,
    287 		pxa25x_i2c_gpioconf,
    288 		pxa25x_pxaacu_gpioconf,
    289 		pxa255dep_gpioconf,
    290 		NULL
    291 	};
    292 #endif
    293 #if defined(CPU_XSCALE_PXA270)
    294 	struct pxa2x0_gpioconf *verdex_gpioconf[] = {
    295 		pxa27x_com_ffuart_gpioconf,
    296 		pxa27x_com_stuart_gpioconf,
    297 		pxa27x_com_btuart_gpioconf,
    298 		pxa27x_i2c_gpioconf,
    299 		pxa27x_pxaacu_gpioconf,
    300 		pxa27x_pxamci_gpioconf,
    301 		pxa27x_ohci_gpioconf,
    302 		verdexdep_gpioconf,
    303 		NULL
    304 	};
    305 #endif
    306 
    307 	/* XXX: turn off for power of bluetooth module */
    308 #if defined(CPU_XSCALE_PXA250)
    309 	pxa2x0_gpio_set_function(7, GPIO_OUT | GPIO_CLR);
    310 #elif defined(CPU_XSCALE_PXA270)
    311 	pxa2x0_gpio_set_function(12, GPIO_OUT | GPIO_CLR);
    312 #endif
    313 #if !defined(OVERO)	/* XXXXX */
    314 	delay(100);
    315 #endif
    316 
    317 #if defined(CPU_XSCALE_PXA270) && defined(CPU_XSCALE_PXA250)
    318 	pxa2x0_gpio_config(
    319 	    (CPU_IS_PXA250) ? gumstix_gpioconf : verdex_gpioconf);
    320 #elif defined(CPU_XSCALE_PXA270) || defined(CPU_XSCALE_PXA250)
    321 #if defined(CPU_XSCALE_PXA270)
    322 	pxa2x0_gpio_config(verdex_gpioconf);
    323 #else
    324 	pxa2x0_gpio_config(gumstix_gpioconf);
    325 #endif
    326 #endif
    327 }
    328 
    329 void
    330 gxio_config_expansion(char *expansion)
    331 {
    332 
    333 	if (expansion == NULL) {
    334 		printf("not specified 'expansion=' in the boot args.\n");
    335 #ifdef GXIO_DEFAULT_EXPANSION
    336 		printf("configure default expansion (%s)\n",
    337 		    GXIO_DEFAULT_EXPANSION);
    338 		expansion = __UNCONST(GXIO_DEFAULT_EXPANSION);
    339 #else
    340 		return;
    341 #endif
    342 	}
    343 	gxio_config_gpio(busheader_conf, expansion);
    344 }
    345 
    346 static void
    347 gxio_config_gpio(const struct gxioconf *gxioconflist, char *expansion)
    348 {
    349 	int i, rv;
    350 
    351 	for (i = 0; i < strlen(expansion); i++)
    352 		expansion[i] = tolower(expansion[i]);
    353 	for (i = 0; gxioconflist[i].name != NULL; i++) {
    354 		rv = strncmp(expansion, gxioconflist[i].name,
    355 		    strlen(gxioconflist[i].name) + 1);
    356 		if (rv == 0) {
    357 			gxioconflist[i].config();
    358 			break;
    359 		}
    360 	}
    361 }
    362 
    363 
    364 #if defined(GUMSTIX)
    365 
    366 static void
    367 basix_config(void)
    368 {
    369 
    370 	pxa2x0_gpio_set_function(8, GPIO_ALT_FN_1_OUT);		/* MMCCS0 */
    371 	pxa2x0_gpio_set_function(53, GPIO_ALT_FN_1_OUT);	/* MMCCLK */
    372 #if 0
    373 	/* this configuration set by gxmci.c::pxamci_attach() */
    374 	pxa2x0_gpio_set_function(11, GPIO_IN);			/* nSD_DETECT */
    375 	pxa2x0_gpio_set_function(22, GPIO_IN);			/* nSD_WP */
    376 #endif
    377 }
    378 
    379 static void
    380 cfstix_config(void)
    381 {
    382 	u_int gpio, npoe_fn;
    383 #if defined(CPU_XSCALE_PXA270) && defined(CPU_XSCALE_PXA250)
    384 	int bvd = (CPU_IS_PXA250) ? 4 : 111;
    385 #else
    386 #if defined(CPU_XSCALE_PXA270)
    387 	const int bvd = 111;
    388 #else
    389 	const int bvd = 4;
    390 #endif
    391 #endif
    392 
    393 	if (CPU_IS_PXA250) {
    394 		gxpcic_slot_irqs[0].valid = 1;
    395 		gxpcic_slot_irqs[0].cd = 11;
    396 		gxpcic_slot_irqs[0].prdy = 26;
    397 		gxpcic_gpio_reset = 8;
    398 	} else {
    399 		gxpcic_slot_irqs[0].valid = 1;
    400 		gxpcic_slot_irqs[0].cd = 104;
    401 		gxpcic_slot_irqs[0].prdy = 96;
    402 		gxpcic_gpio_reset = 97;
    403 	}
    404 
    405 #if 1
    406 	/* PCD/PRDY set by pxa2x0_pcic.c::pxapcic_attach_common() */
    407 #else
    408 	pxa2x0_gpio_set_function(11, GPIO_IN);		/* PCD1 */
    409 	pxa2x0_gpio_set_function(26, GPIO_IN);		/* PRDY1/~IRQ1 */
    410 #endif
    411 	pxa2x0_gpio_set_function(bvd, GPIO_IN); 	/* BVD1/~STSCHG1 */
    412 
    413 	for (gpio = 48, npoe_fn = 0; gpio <= 53 ; gpio++)
    414 		npoe_fn |= pxa2x0_gpio_get_function(gpio);
    415 	npoe_fn &= GPIO_SET;
    416 
    417 	pxa2x0_gpio_set_function(48, GPIO_ALT_FN_2_OUT | npoe_fn); /* nPOE */
    418 	pxa2x0_gpio_set_function(49, GPIO_ALT_FN_2_OUT);	/* nPWE */
    419 	pxa2x0_gpio_set_function(50, GPIO_ALT_FN_2_OUT);	/* nPIOR */
    420 	pxa2x0_gpio_set_function(51, GPIO_ALT_FN_2_OUT);	/* nPIOW */
    421 	if (CPU_IS_PXA250) {
    422 		pxa2x0_gpio_set_function(52, GPIO_ALT_FN_2_OUT); /* nPCE1 */
    423 		pxa2x0_gpio_set_function(53, GPIO_ALT_FN_2_OUT); /* nPCE2 */
    424 		pxa2x0_gpio_set_function(54, GPIO_ALT_FN_2_OUT); /* pSKTSEL */
    425 	} else {
    426 		pxa2x0_gpio_set_function(102, GPIO_ALT_FN_1_OUT); /* nPCE1 */
    427 		pxa2x0_gpio_set_function(105, GPIO_ALT_FN_1_OUT); /* nPCE2 */
    428 		pxa2x0_gpio_set_function(79, GPIO_ALT_FN_1_OUT);  /* pSKTSEL */
    429 	}
    430 	pxa2x0_gpio_set_function(55, GPIO_ALT_FN_2_OUT);	/* nPREG */
    431 	pxa2x0_gpio_set_function(56, GPIO_ALT_FN_1_IN);		/* nPWAIT */
    432 	pxa2x0_gpio_set_function(57, GPIO_ALT_FN_1_IN);		/* nIOIS16 */
    433 }
    434 
    435 static void
    436 etherstix_config(void)
    437 {
    438 	extern struct cfdata cfdata[];
    439 #if defined(CPU_XSCALE_PXA270) && defined(CPU_XSCALE_PXA250)
    440 	int rst = (CPU_IS_PXA250) ? 80 : 32;
    441 	int irq = (CPU_IS_PXA250) ? 36 : 99;
    442 #else
    443 #if defined(CPU_XSCALE_PXA270)
    444 	const int rst = 32, irq = 99;
    445 #else
    446 	const int rst = 80, irq = 36;
    447 #endif
    448 #endif
    449 	int i;
    450 
    451 	pxa2x0_gpio_set_function(49, GPIO_ALT_FN_2_OUT);	/* nPWE */
    452 	pxa2x0_gpio_set_function(15, GPIO_ALT_FN_2_OUT);	/* nCS 1 */
    453 	pxa2x0_gpio_set_function(rst, GPIO_OUT | GPIO_SET);	/* RESET 1 */
    454 	delay(1);
    455 	pxa2x0_gpio_set_function(rst, GPIO_OUT | GPIO_CLR);
    456 	delay(50000);
    457 
    458 	for (i = 0; cfdata[i].cf_name != NULL; i++)
    459 		if (strcmp(cfdata[i].cf_name, "sm") == 0 &&
    460 		    strcmp(cfdata[i].cf_atname, "sm_gxio") == 0 &&
    461 		    cfdata[i].cf_loc[GXIOCF_ADDR] == 0x04000300 &&
    462 		    cfdata[i].cf_loc[GXIOCF_GPIRQ] == GXIOCF_GPIRQ_DEFAULT)
    463 			cfdata[i].cf_loc[GXIOCF_GPIRQ] = irq;
    464 }
    465 
    466 static void
    467 netcf_config(void)
    468 {
    469 
    470 	etherstix_config();
    471 	cfstix_config();
    472 }
    473 
    474 static void
    475 netcf_vx_config(void)
    476 {
    477 
    478 	/*
    479 	 * XXXX: More power is necessary for NIC and USB???
    480 	 * (no document.  from Linux)
    481 	 */
    482 
    483 	pxa2x0_gpio_set_function(27, GPIO_IN);
    484 	pxa2x0_gpio_set_function(107, GPIO_OUT | GPIO_CLR);
    485 	pxa2x0_gpio_set_function(118, GPIO_ALT_FN_1_IN | GPIO_CLR);
    486 
    487 	etherstix_config();
    488 	cfstix_config();
    489 	if (CPU_IS_PXA270) {
    490 		/* Overwrite */
    491 		gxpcic_slot_irqs[0].cd = 104;
    492 		gxpcic_slot_irqs[0].prdy = 109;
    493 		gxpcic_gpio_reset = 110;
    494 	};
    495 }
    496 
    497 static void
    498 netduommc_config(void)
    499 {
    500 
    501 	netduo_config();
    502 	basix_config();
    503 }
    504 
    505 static void
    506 netduo_config(void)
    507 {
    508 
    509 	etherstix_config();
    510 
    511 	pxa2x0_gpio_set_function(78, GPIO_ALT_FN_2_OUT);	/* nCS 2 */
    512 	pxa2x0_gpio_set_function(52, GPIO_OUT | GPIO_SET);	/* RESET 2 */
    513 	delay(1);
    514 	pxa2x0_gpio_set_function(52, GPIO_OUT | GPIO_CLR);
    515 	delay(50000);
    516 }
    517 
    518 static void
    519 netmicrosd_config(void)
    520 {
    521 
    522 	/* MicroSD(mci) always configure on PXA270 */
    523 
    524 	pxa2x0_gpio_set_function(49, GPIO_ALT_FN_2_OUT);	/* nPWE */
    525 	pxa2x0_gpio_set_function(15, GPIO_ALT_FN_2_OUT);	/* nCS 1 */
    526 	pxa2x0_gpio_set_function(107, GPIO_OUT | GPIO_CLR);	/* RESET 1 */
    527 	delay(hz / 2);
    528 	pxa2x0_gpio_set_function(107, GPIO_OUT | GPIO_SET);
    529 	delay(50000);
    530 }
    531 
    532 static void
    533 netwifimicrosd_config(void)
    534 {
    535 
    536 	netmicrosd_config();
    537 
    538 	cfstix_config();
    539 	/* However use pxamci. */
    540 	pxa2x0_gpio_set_function(111, GPIO_CLR | GPIO_ALT_FN_1_IN);
    541 	/* Power to Marvell 88W8385 */
    542 	pxa2x0_gpio_set_function(80, GPIO_OUT | GPIO_SET);
    543 }
    544 
    545 static void
    546 netmmc_config(void)
    547 {
    548 
    549 	etherstix_config();
    550 	basix_config();
    551 }
    552 
    553 static void
    554 wifistix_config(void)
    555 {
    556 
    557 	cfstix_config();
    558 
    559 	/* Power to Marvell 88W8385 */
    560 	pxa2x0_gpio_set_function(80, GPIO_OUT | GPIO_SET);
    561 }
    562 
    563 static void
    564 wifistix_cf_config(void)
    565 {
    566 
    567 	gxpcic_slot_irqs[1].valid = 1;
    568 	gxpcic_slot_irqs[1].cd = 36;
    569 	gxpcic_slot_irqs[1].prdy = 27;
    570 
    571 #if 1
    572 	/* this configuration set by pxa2x0_pcic.c::pxapcic_attach_common() */
    573 #else
    574 	pxa2x0_gpio_set_function(36, GPIO_IN);		/* PCD2 */
    575 	pxa2x0_gpio_set_function(27, GPIO_IN);		/* PRDY2/~IRQ2 */
    576 #endif
    577 	pxa2x0_gpio_set_function(18, GPIO_IN); 		/* BVD2/~STSCHG2 */
    578 
    579 	cfstix_config();
    580 
    581 	/* Power to Marvell 88W8385 */
    582 	pxa2x0_gpio_set_function(80, GPIO_OUT | GPIO_SET);
    583 }
    584 
    585 #elif defined(OVERO)
    586 
    587 static void
    588 eth0_config(void)
    589 {
    590 	extern struct cfdata cfdata[];
    591 	cfdata_t cf = &cfdata[0];
    592 
    593 	/*
    594 	 * ETH0 connects via CS5.  It use GPIO 176 for IRQ.
    595 	 */
    596 
    597 	while (cf->cf_name != NULL) {
    598 		if (strcmp(cf->cf_name, "smsh") == 0 &&
    599 		    cf->cf_loc[GPMCCF_INTR] == PIC_MAXSOURCES + 176)
    600 			break;
    601 		cf++;
    602 	}
    603 	if (cf->cf_name == NULL ||
    604 	    cf->cf_loc[GPMCCF_ADDR] == GPMCCF_ADDR_DEFAULT)
    605 		return;
    606 
    607 	ioreg_write(OVERO_GPMC_VBASE + GPMC_CONFIG7_5,
    608 	    GPMC_CONFIG7_CSVALID |
    609 	    GPMC_CONFIG7(GPMC_CONFIG7_MASK_16M, cf->cf_loc[GPMCCF_ADDR]));
    610 
    611 	/*
    612 	 * Maybe need NRESET and delay(9).
    613 	 * However delay(9) needs to attach mputmr.
    614 	 */
    615 }
    616 
    617 static void
    618 eth1_config(void)
    619 {
    620 	extern struct cfdata cfdata[];
    621 	cfdata_t cf = &cfdata[0];
    622 
    623 	/*
    624 	 * ETH1 connects via CS4.  It use GPIO 65 for IRQ.
    625 	 */
    626 
    627 	while (cf->cf_name != NULL) {
    628 		if (strcmp(cf->cf_name, "smsh") == 0 &&
    629 		    cf->cf_loc[GPMCCF_INTR] == PIC_MAXSOURCES + 65)
    630 			break;
    631 		cf++;
    632 	}
    633 	if (cf->cf_name == NULL ||
    634 	    cf->cf_loc[GPMCCF_ADDR] == GPMCCF_ADDR_DEFAULT)
    635 		return;
    636 
    637 	ioreg_write(OVERO_GPMC_VBASE + GPMC_CONFIG7_4,
    638 	    GPMC_CONFIG7_CSVALID |
    639 	    GPMC_CONFIG7(GPMC_CONFIG7_MASK_16M, cf->cf_loc[GPMCCF_ADDR]));
    640 
    641 	/* ETH1 is sure to be reset with ETH0. */
    642 }
    643 
    644 static void
    645 chestnut_config(void)
    646 {
    647 
    648 	eth0_config();
    649 }
    650 
    651 static void
    652 tobi_config(void)
    653 {
    654 
    655 	eth0_config();
    656 }
    657 
    658 static void
    659 tobiduo_config(void)
    660 {
    661 
    662 	eth0_config();
    663 	eth1_config();
    664 }
    665 #endif
    666