Home | History | Annotate | Line # | Download | only in tx
txcsbus.c revision 1.5.8.4
      1  1.5.8.4  nathanw /*	$NetBSD: txcsbus.c,v 1.5.8.4 2002/10/18 02:37:14 nathanw Exp $ */
      2  1.5.8.2  nathanw 
      3  1.5.8.2  nathanw /*-
      4  1.5.8.2  nathanw  * Copyright (c) 1999 The NetBSD Foundation, Inc.
      5  1.5.8.2  nathanw  * All rights reserved.
      6  1.5.8.2  nathanw  *
      7  1.5.8.2  nathanw  * This code is derived from software contributed to The NetBSD Foundation
      8  1.5.8.2  nathanw  * by UCHIYAMA Yasushi.
      9  1.5.8.2  nathanw  *
     10  1.5.8.2  nathanw  * Redistribution and use in source and binary forms, with or without
     11  1.5.8.2  nathanw  * modification, are permitted provided that the following conditions
     12  1.5.8.2  nathanw  * are met:
     13  1.5.8.2  nathanw  * 1. Redistributions of source code must retain the above copyright
     14  1.5.8.2  nathanw  *    notice, this list of conditions and the following disclaimer.
     15  1.5.8.2  nathanw  * 2. Redistributions in binary form must reproduce the above copyright
     16  1.5.8.2  nathanw  *    notice, this list of conditions and the following disclaimer in the
     17  1.5.8.2  nathanw  *    documentation and/or other materials provided with the distribution.
     18  1.5.8.2  nathanw  * 3. All advertising materials mentioning features or use of this software
     19  1.5.8.2  nathanw  *    must display the following acknowledgement:
     20  1.5.8.2  nathanw  *        This product includes software developed by the NetBSD
     21  1.5.8.2  nathanw  *        Foundation, Inc. and its contributors.
     22  1.5.8.2  nathanw  * 4. Neither the name of The NetBSD Foundation nor the names of its
     23  1.5.8.2  nathanw  *    contributors may be used to endorse or promote products derived
     24  1.5.8.2  nathanw  *    from this software without specific prior written permission.
     25  1.5.8.2  nathanw  *
     26  1.5.8.2  nathanw  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     27  1.5.8.2  nathanw  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     28  1.5.8.2  nathanw  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     29  1.5.8.2  nathanw  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     30  1.5.8.2  nathanw  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     31  1.5.8.2  nathanw  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     32  1.5.8.2  nathanw  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     33  1.5.8.2  nathanw  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     34  1.5.8.2  nathanw  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     35  1.5.8.2  nathanw  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     36  1.5.8.2  nathanw  * POSSIBILITY OF SUCH DAMAGE.
     37  1.5.8.2  nathanw  */
     38  1.5.8.2  nathanw 
     39  1.5.8.2  nathanw #include <sys/param.h>
     40  1.5.8.2  nathanw #include <sys/systm.h>
     41  1.5.8.2  nathanw #include <sys/device.h>
     42  1.5.8.2  nathanw 
     43  1.5.8.2  nathanw #include <machine/intr.h>
     44  1.5.8.2  nathanw #include <machine/bus.h>
     45  1.5.8.2  nathanw #include <machine/bus_space_hpcmips.h>
     46  1.5.8.2  nathanw 
     47  1.5.8.2  nathanw #include <machine/platid.h>
     48  1.5.8.2  nathanw #include <machine/platid_mask.h>
     49  1.5.8.2  nathanw 
     50  1.5.8.2  nathanw #include <hpcmips/tx/tx39var.h>
     51  1.5.8.2  nathanw #include <hpcmips/tx/txcsbusvar.h>
     52  1.5.8.2  nathanw #include <hpcmips/tx/tx39biuvar.h>
     53  1.5.8.2  nathanw #include <hpcmips/tx/tx39biureg.h>
     54  1.5.8.2  nathanw 
     55  1.5.8.2  nathanw #include "locators.h"
     56  1.5.8.2  nathanw 
     57  1.5.8.2  nathanw /* TX39 CS mapping. (nonconfigurationable) */
     58  1.5.8.2  nathanw const struct csmap {
     59  1.5.8.2  nathanw 	char	*cs_name;
     60  1.5.8.2  nathanw 	paddr_t	cs_addr;
     61  1.5.8.2  nathanw 	psize_t	cs_size;
     62  1.5.8.2  nathanw } __csmap[] = {
     63  1.5.8.2  nathanw 	[TX39_CS0]	= {"CS0(ROM)"	, TX39_SYSADDR_CS0	,
     64  1.5.8.2  nathanw 			   TX39_SYSADDR_CS_SIZE},
     65  1.5.8.2  nathanw 	[TX39_CS1]	= {"CS1"	, TX39_SYSADDR_CS1	,
     66  1.5.8.2  nathanw 			   TX39_SYSADDR_CS_SIZE},
     67  1.5.8.2  nathanw 	[TX39_CS2]	= {"CS2"	, TX39_SYSADDR_CS2	,
     68  1.5.8.2  nathanw 			   TX39_SYSADDR_CS_SIZE},
     69  1.5.8.2  nathanw 	[TX39_CS3]	= {"CS3"	, TX39_SYSADDR_CS3	,
     70  1.5.8.2  nathanw 			   TX39_SYSADDR_CS_SIZE},
     71  1.5.8.2  nathanw 	[TX39_MCS0]	= {"MCS0"	, TX39_SYSADDR_MCS0	,
     72  1.5.8.2  nathanw 			   TX39_SYSADDR_MCS_SIZE},
     73  1.5.8.2  nathanw 	[TX39_MCS1]	= {"MCS1"	, TX39_SYSADDR_MCS1	,
     74  1.5.8.2  nathanw 			   TX39_SYSADDR_MCS_SIZE},
     75  1.5.8.2  nathanw #ifdef TX391X
     76  1.5.8.2  nathanw 	[TX39_MCS2]	= {"MCS2"	, TX39_SYSADDR_MCS2	,
     77  1.5.8.2  nathanw 			   TX39_SYSADDR_MCS_SIZE},
     78  1.5.8.2  nathanw 	[TX39_MCS3]	= {"MCS3"	, TX39_SYSADDR_MCS3	,
     79  1.5.8.2  nathanw 			   TX39_SYSADDR_MCS_SIZE},
     80  1.5.8.2  nathanw #endif /* TX391X */
     81  1.5.8.2  nathanw 	[TX39_CARD1]	= {"CARD1(io/attr)", TX39_SYSADDR_CARD1	,
     82  1.5.8.2  nathanw 			   TX39_SYSADDR_CARD_SIZE},
     83  1.5.8.2  nathanw 	[TX39_CARD2]	= {"CARD2(io/attr)", TX39_SYSADDR_CARD2	,
     84  1.5.8.2  nathanw 			   TX39_SYSADDR_CARD_SIZE},
     85  1.5.8.2  nathanw 	[TX39_CARD1MEM]	= {"CARD1(mem)"	, TX39_SYSADDR_CARD1MEM	,
     86  1.5.8.2  nathanw 			   TX39_SYSADDR_CARD_SIZE},
     87  1.5.8.2  nathanw 	[TX39_CARD2MEM]	= {"CARD2(mem)"	, TX39_SYSADDR_CARD2MEM	,
     88  1.5.8.2  nathanw 			   TX39_SYSADDR_CARD_SIZE},
     89  1.5.8.2  nathanw };
     90  1.5.8.2  nathanw 
     91  1.5.8.2  nathanw int	txcsbus_match(struct device *, struct cfdata *, void *);
     92  1.5.8.2  nathanw void	txcsbus_attach(struct device *, struct device *, void *);
     93  1.5.8.2  nathanw int	txcsbus_print(void *, const char *);
     94  1.5.8.2  nathanw int	txcsbus_search(struct device *, struct cfdata *, void *);
     95  1.5.8.2  nathanw 
     96  1.5.8.2  nathanw struct txcsbus_softc {
     97  1.5.8.2  nathanw 	struct	device sc_dev;
     98  1.5.8.2  nathanw 	tx_chipset_tag_t sc_tc;
     99  1.5.8.2  nathanw 	/* chip select space tag */
    100  1.5.8.2  nathanw 	struct bus_space_tag_hpcmips *sc_cst[TX39_MAXCS];
    101  1.5.8.2  nathanw };
    102  1.5.8.2  nathanw 
    103  1.5.8.4  nathanw CFATTACH_DECL(txcsbus, sizeof(struct txcsbus_softc),
    104  1.5.8.4  nathanw     txcsbus_match, txcsbus_attach, NULL, NULL);
    105  1.5.8.2  nathanw 
    106  1.5.8.2  nathanw static bus_space_tag_t __txcsbus_alloc_cstag(struct txcsbus_softc *,
    107  1.5.8.2  nathanw     struct cs_handle *);
    108  1.5.8.2  nathanw 
    109  1.5.8.2  nathanw int
    110  1.5.8.2  nathanw txcsbus_match(struct device *parent, struct cfdata *cf, void *aux)
    111  1.5.8.2  nathanw {
    112  1.5.8.2  nathanw 	struct csbus_attach_args *cba = aux;
    113  1.5.8.2  nathanw 	platid_mask_t mask;
    114  1.5.8.2  nathanw 
    115  1.5.8.4  nathanw 	if (strcmp(cba->cba_busname, cf->cf_name))
    116  1.5.8.2  nathanw 		return (0);
    117  1.5.8.2  nathanw 
    118  1.5.8.2  nathanw 	if (cf->cf_loc[TXCSBUSIFCF_PLATFORM] == TXCSBUSIFCF_PLATFORM_DEFAULT)
    119  1.5.8.2  nathanw 		return (1);
    120  1.5.8.2  nathanw 
    121  1.5.8.2  nathanw 	mask = PLATID_DEREF(cf->cf_loc[TXCSBUSIFCF_PLATFORM]);
    122  1.5.8.2  nathanw 	if (platid_match(&platid, &mask))
    123  1.5.8.2  nathanw 		return (2);
    124  1.5.8.2  nathanw 
    125  1.5.8.2  nathanw 	return (0);
    126  1.5.8.2  nathanw }
    127  1.5.8.2  nathanw 
    128  1.5.8.2  nathanw void
    129  1.5.8.2  nathanw txcsbus_attach(struct device *parent, struct device *self, void *aux)
    130  1.5.8.2  nathanw {
    131  1.5.8.2  nathanw 	struct csbus_attach_args *cba = aux;
    132  1.5.8.2  nathanw 	struct txcsbus_softc *sc = (void*)self;
    133  1.5.8.2  nathanw 
    134  1.5.8.2  nathanw 	sc->sc_tc = cba->cba_tc;
    135  1.5.8.2  nathanw 	printf("\n");
    136  1.5.8.2  nathanw 
    137  1.5.8.2  nathanw 	/*
    138  1.5.8.2  nathanw 	 *	Attach external chip.
    139  1.5.8.2  nathanw 	 */
    140  1.5.8.2  nathanw 	config_search(txcsbus_search, self, txcsbus_print);
    141  1.5.8.2  nathanw }
    142  1.5.8.2  nathanw 
    143  1.5.8.2  nathanw int
    144  1.5.8.2  nathanw txcsbus_print(void *aux, const char *pnp)
    145  1.5.8.2  nathanw {
    146  1.5.8.2  nathanw #define PRINTIRQ(i) i, (i) / 32, (i) % 32
    147  1.5.8.2  nathanw 	struct cs_attach_args *ca = aux;
    148  1.5.8.2  nathanw 
    149  1.5.8.2  nathanw 	if (ca->ca_csreg.cs != TXCSBUSCF_REGCS_DEFAULT) {
    150  1.5.8.2  nathanw 		printf(" regcs %s %dbit %#x+%#x",
    151  1.5.8.2  nathanw 		    __csmap[ca->ca_csreg.cs].cs_name,
    152  1.5.8.2  nathanw 		    ca->ca_csreg.cswidth,
    153  1.5.8.2  nathanw 		    ca->ca_csreg.csbase,
    154  1.5.8.2  nathanw 		    ca->ca_csreg.cssize);
    155  1.5.8.2  nathanw 	}
    156  1.5.8.2  nathanw 
    157  1.5.8.2  nathanw 	if (ca->ca_csio.cs != TXCSBUSCF_IOCS_DEFAULT) {
    158  1.5.8.2  nathanw 		printf(" iocs %s %dbit %#x+%#x",
    159  1.5.8.2  nathanw 		    __csmap[ca->ca_csio.cs].cs_name,
    160  1.5.8.2  nathanw 		    ca->ca_csio.cswidth,
    161  1.5.8.2  nathanw 		    ca->ca_csio.csbase,
    162  1.5.8.2  nathanw 		    ca->ca_csio.cssize);
    163  1.5.8.2  nathanw 	}
    164  1.5.8.2  nathanw 
    165  1.5.8.2  nathanw 	if (ca->ca_csmem.cs != TXCSBUSCF_MEMCS_DEFAULT) {
    166  1.5.8.2  nathanw 		printf(" memcs %s %dbit %#x+%#x",
    167  1.5.8.2  nathanw 		    __csmap[ca->ca_csmem.cs].cs_name,
    168  1.5.8.2  nathanw 		    ca->ca_csmem.cswidth,
    169  1.5.8.2  nathanw 		    ca->ca_csmem.csbase,
    170  1.5.8.2  nathanw 		    ca->ca_csmem.cssize);
    171  1.5.8.2  nathanw 	}
    172  1.5.8.2  nathanw 
    173  1.5.8.2  nathanw 	if (ca->ca_irq1 != TXCSBUSCF_IRQ1_DEFAULT) {
    174  1.5.8.2  nathanw 		printf(" irq1 %d(%d:%d)", PRINTIRQ(ca->ca_irq1));
    175  1.5.8.2  nathanw 	}
    176  1.5.8.2  nathanw 
    177  1.5.8.2  nathanw 	if (ca->ca_irq2 != TXCSBUSCF_IRQ2_DEFAULT) {
    178  1.5.8.2  nathanw 		printf(" irq2 %d(%d:%d)", PRINTIRQ(ca->ca_irq2));
    179  1.5.8.2  nathanw 	}
    180  1.5.8.2  nathanw 
    181  1.5.8.2  nathanw 	if (ca->ca_irq3 != TXCSBUSCF_IRQ3_DEFAULT) {
    182  1.5.8.2  nathanw 		printf(" irq3 %d(%d:%d)", PRINTIRQ(ca->ca_irq3));
    183  1.5.8.2  nathanw 	}
    184  1.5.8.2  nathanw 
    185  1.5.8.2  nathanw 	return (UNCONF);
    186  1.5.8.2  nathanw }
    187  1.5.8.2  nathanw 
    188  1.5.8.2  nathanw int
    189  1.5.8.2  nathanw txcsbus_search(struct device *parent, struct cfdata *cf, void *aux)
    190  1.5.8.2  nathanw {
    191  1.5.8.2  nathanw 	struct txcsbus_softc *sc = (void*)parent;
    192  1.5.8.2  nathanw 	struct cs_attach_args ca;
    193  1.5.8.2  nathanw 
    194  1.5.8.2  nathanw 	ca.ca_tc		= sc->sc_tc;
    195  1.5.8.2  nathanw 
    196  1.5.8.2  nathanw 	ca.ca_csreg.cs		= cf->cf_loc[TXCSBUSCF_REGCS];
    197  1.5.8.2  nathanw 	ca.ca_csreg.csbase	= cf->cf_loc[TXCSBUSCF_REGCSBASE];
    198  1.5.8.2  nathanw 	ca.ca_csreg.cssize	= cf->cf_loc[TXCSBUSCF_REGCSSIZE];
    199  1.5.8.2  nathanw 	ca.ca_csreg.cswidth	= cf->cf_loc[TXCSBUSCF_REGCSWIDTH];
    200  1.5.8.2  nathanw 
    201  1.5.8.2  nathanw 	if (ca.ca_csreg.cs != TXCSBUSCF_REGCS_DEFAULT) {
    202  1.5.8.2  nathanw 		ca.ca_csreg.cstag = __txcsbus_alloc_cstag(sc, &ca.ca_csreg);
    203  1.5.8.2  nathanw 	}
    204  1.5.8.2  nathanw 
    205  1.5.8.2  nathanw 	ca.ca_csio.cs		= cf->cf_loc[TXCSBUSCF_IOCS];
    206  1.5.8.2  nathanw 	ca.ca_csio.csbase	= cf->cf_loc[TXCSBUSCF_IOCSBASE];
    207  1.5.8.2  nathanw 	ca.ca_csio.cssize	= cf->cf_loc[TXCSBUSCF_IOCSSIZE];
    208  1.5.8.2  nathanw 	ca.ca_csio.cswidth	= cf->cf_loc[TXCSBUSCF_IOCSWIDTH];
    209  1.5.8.2  nathanw 
    210  1.5.8.2  nathanw 	if (ca.ca_csio.cs != TXCSBUSCF_IOCS_DEFAULT) {
    211  1.5.8.2  nathanw 		ca.ca_csio.cstag = __txcsbus_alloc_cstag(sc, &ca.ca_csio);
    212  1.5.8.2  nathanw 	}
    213  1.5.8.2  nathanw 
    214  1.5.8.2  nathanw 	ca.ca_csmem.cs		= cf->cf_loc[TXCSBUSCF_MEMCS];
    215  1.5.8.2  nathanw 	ca.ca_csmem.csbase	= cf->cf_loc[TXCSBUSCF_MEMCSBASE];
    216  1.5.8.2  nathanw 	ca.ca_csmem.cssize	= cf->cf_loc[TXCSBUSCF_MEMCSSIZE];
    217  1.5.8.2  nathanw 	ca.ca_csmem.cswidth	= cf->cf_loc[TXCSBUSCF_MEMCSWIDTH];
    218  1.5.8.2  nathanw 
    219  1.5.8.2  nathanw 	if (ca.ca_csmem.cs != TXCSBUSCF_MEMCS_DEFAULT) {
    220  1.5.8.2  nathanw 		ca.ca_csmem.cstag = __txcsbus_alloc_cstag(sc, &ca.ca_csmem);
    221  1.5.8.2  nathanw 	}
    222  1.5.8.2  nathanw 
    223  1.5.8.2  nathanw 	ca.ca_irq1		= cf->cf_loc[TXCSBUSCF_IRQ1];
    224  1.5.8.2  nathanw 	ca.ca_irq2		= cf->cf_loc[TXCSBUSCF_IRQ2];
    225  1.5.8.2  nathanw 	ca.ca_irq3		= cf->cf_loc[TXCSBUSCF_IRQ3];
    226  1.5.8.2  nathanw 
    227  1.5.8.4  nathanw 	if (config_match(parent, cf, &ca)) {
    228  1.5.8.2  nathanw 		config_attach(parent, cf, &ca, txcsbus_print);
    229  1.5.8.2  nathanw 	}
    230  1.5.8.2  nathanw 
    231  1.5.8.2  nathanw 	return (0);
    232  1.5.8.2  nathanw }
    233  1.5.8.2  nathanw 
    234  1.5.8.2  nathanw bus_space_tag_t
    235  1.5.8.2  nathanw __txcsbus_alloc_cstag(struct txcsbus_softc *sc, struct cs_handle *csh)
    236  1.5.8.2  nathanw {
    237  1.5.8.2  nathanw 
    238  1.5.8.2  nathanw 	tx_chipset_tag_t tc = sc->sc_tc;
    239  1.5.8.2  nathanw 	int cs = csh->cs;
    240  1.5.8.2  nathanw 	int width = csh->cswidth;
    241  1.5.8.2  nathanw 	struct bus_space_tag_hpcmips *iot;
    242  1.5.8.2  nathanw 	txreg_t reg;
    243  1.5.8.2  nathanw 
    244  1.5.8.2  nathanw  	if (!TX39_ISCS(cs) && !TX39_ISMCS(cs) && !TX39_ISCARD(cs)) {
    245  1.5.8.4  nathanw 		panic("txcsbus_alloc_tag: bogus chip select %d", cs);
    246  1.5.8.2  nathanw 	}
    247  1.5.8.2  nathanw 
    248  1.5.8.2  nathanw 	/* Already setuped chip select */
    249  1.5.8.2  nathanw 	if (sc->sc_cst[cs]) {
    250  1.5.8.2  nathanw 		return (&sc->sc_cst[cs]->bst);
    251  1.5.8.2  nathanw 	}
    252  1.5.8.2  nathanw 
    253  1.5.8.2  nathanw 	iot = hpcmips_alloc_bus_space_tag();
    254  1.5.8.2  nathanw 	hpcmips_init_bus_space(iot, hpcmips_system_bus_space_hpcmips(),
    255  1.5.8.2  nathanw 	    __csmap[cs].cs_name, __csmap[cs].cs_addr, __csmap[cs].cs_size);
    256  1.5.8.2  nathanw 	sc->sc_cst[cs] = iot;
    257  1.5.8.2  nathanw 
    258  1.5.8.2  nathanw 	/* CS bus-width (configurationable) */
    259  1.5.8.2  nathanw 	switch (width) {
    260  1.5.8.2  nathanw 	default:
    261  1.5.8.4  nathanw 		panic("txcsbus_alloc_tag: bogus bus width %d", width);
    262  1.5.8.2  nathanw 
    263  1.5.8.2  nathanw 	case 32:
    264  1.5.8.2  nathanw 		if (TX39_ISCS(cs)) {
    265  1.5.8.2  nathanw 			reg = tx_conf_read(tc, TX39_MEMCONFIG0_REG);
    266  1.5.8.2  nathanw 			reg |= (1 << cs);
    267  1.5.8.2  nathanw 			tx_conf_write(tc, TX39_MEMCONFIG0_REG, reg);
    268  1.5.8.2  nathanw 		} else if(TX39_ISMCS(cs)) {
    269  1.5.8.2  nathanw #ifdef TX391X
    270  1.5.8.2  nathanw 			panic("txcsbus_alloc_tag: MCS is 16bit only");
    271  1.5.8.2  nathanw #endif /* TX391X */
    272  1.5.8.2  nathanw #ifdef TX392X
    273  1.5.8.2  nathanw 			reg = tx_conf_read(tc, TX39_MEMCONFIG1_REG);
    274  1.5.8.2  nathanw 			reg |= ((cs == TX39_MCS0) ?
    275  1.5.8.2  nathanw 			    TX39_MEMCONFIG1_MCS0_32 :
    276  1.5.8.2  nathanw 			    TX39_MEMCONFIG1_MCS1_32);
    277  1.5.8.2  nathanw 			tx_conf_write(tc, TX39_MEMCONFIG1_REG, reg);
    278  1.5.8.2  nathanw #endif /* TX392X */
    279  1.5.8.2  nathanw 		}
    280  1.5.8.2  nathanw 		break;
    281  1.5.8.2  nathanw 
    282  1.5.8.2  nathanw 	case 16:
    283  1.5.8.2  nathanw 		if (TX39_ISCS(cs)) {
    284  1.5.8.2  nathanw 			reg = tx_conf_read(tc, TX39_MEMCONFIG0_REG);
    285  1.5.8.2  nathanw 			reg &= ~(1 << cs);
    286  1.5.8.2  nathanw 			tx_conf_write(tc, TX39_MEMCONFIG0_REG, reg);
    287  1.5.8.2  nathanw 		} else if(TX39_ISMCS(cs)) {
    288  1.5.8.2  nathanw 			/* TX391X always 16bit port */
    289  1.5.8.2  nathanw #ifdef TX392X
    290  1.5.8.2  nathanw 			reg = tx_conf_read(tc, TX39_MEMCONFIG1_REG);
    291  1.5.8.2  nathanw 			reg &= ~((cs == TX39_MCS0) ?
    292  1.5.8.2  nathanw 			    TX39_MEMCONFIG1_MCS0_32 :
    293  1.5.8.2  nathanw 			    TX39_MEMCONFIG1_MCS1_32);
    294  1.5.8.2  nathanw 			tx_conf_write(tc, TX39_MEMCONFIG1_REG, reg);
    295  1.5.8.2  nathanw #endif /* TX392X */
    296  1.5.8.2  nathanw 		} else {
    297  1.5.8.2  nathanw 			/* CARD io/attr or mem */
    298  1.5.8.2  nathanw 			reg = tx_conf_read(tc, TX39_MEMCONFIG3_REG);
    299  1.5.8.2  nathanw 
    300  1.5.8.2  nathanw 			/* enable I/O access */
    301  1.5.8.2  nathanw 			reg |= (cs == TX39_CARD1) ?
    302  1.5.8.2  nathanw 			    TX39_MEMCONFIG3_CARD1IOEN :
    303  1.5.8.2  nathanw 			    TX39_MEMCONFIG3_CARD2IOEN;
    304  1.5.8.2  nathanw 			/* disable 8bit access */
    305  1.5.8.2  nathanw #ifdef TX392X
    306  1.5.8.2  nathanw 			reg &= ~((cs == TX39_CARD1) ?
    307  1.5.8.2  nathanw 			    TX39_MEMCONFIG3_CARD1_8SEL :
    308  1.5.8.2  nathanw 			    TX39_MEMCONFIG3_CARD2_8SEL);
    309  1.5.8.2  nathanw #endif /* TX392X */
    310  1.5.8.2  nathanw #ifdef TX391X
    311  1.5.8.2  nathanw 			reg &= ~TX39_MEMCONFIG3_PORT8SEL;
    312  1.5.8.2  nathanw #endif /* TX391X */
    313  1.5.8.2  nathanw 			tx_conf_write(tc, TX39_MEMCONFIG3_REG, reg);
    314  1.5.8.2  nathanw 		}
    315  1.5.8.2  nathanw 		break;
    316  1.5.8.2  nathanw 
    317  1.5.8.2  nathanw 	case 8:
    318  1.5.8.2  nathanw 		if (TX39_ISCARD(cs)) {
    319  1.5.8.2  nathanw 			reg = tx_conf_read(tc, TX39_MEMCONFIG3_REG);
    320  1.5.8.2  nathanw 
    321  1.5.8.2  nathanw 			/* enable I/O access */
    322  1.5.8.2  nathanw 			reg |= (cs == TX39_CARD1) ?
    323  1.5.8.2  nathanw 			    TX39_MEMCONFIG3_CARD1IOEN :
    324  1.5.8.2  nathanw 			    TX39_MEMCONFIG3_CARD2IOEN;
    325  1.5.8.2  nathanw 			/* disable 8bit access */
    326  1.5.8.2  nathanw #ifdef TX392X
    327  1.5.8.2  nathanw 			reg |= (cs == TX39_CARD1) ?
    328  1.5.8.2  nathanw 			    TX39_MEMCONFIG3_CARD1_8SEL :
    329  1.5.8.2  nathanw 			    TX39_MEMCONFIG3_CARD2_8SEL;
    330  1.5.8.2  nathanw #endif /* TX392X */
    331  1.5.8.2  nathanw #ifdef TX391X
    332  1.5.8.2  nathanw 			reg |= TX39_MEMCONFIG3_PORT8SEL;
    333  1.5.8.2  nathanw #endif /* TX391X */
    334  1.5.8.2  nathanw 			tx_conf_write(tc, TX39_MEMCONFIG3_REG, reg);
    335  1.5.8.2  nathanw 
    336  1.5.8.2  nathanw 		} else {
    337  1.5.8.2  nathanw 			panic("__txcsbus_alloc_cstag: CS%d 8bit mode is"
    338  1.5.8.2  nathanw 			    "not allowed", cs);
    339  1.5.8.2  nathanw 		}
    340  1.5.8.2  nathanw 	}
    341  1.5.8.2  nathanw 
    342  1.5.8.2  nathanw 	return (&iot->bst);
    343  1.5.8.2  nathanw }
    344