/*
* Copyright (c) 1998 and 1999
* HAYAKAWA Koichi. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY HAYAKAWA KOICHI ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL TAKESHI OHASHI OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
/*
* CardBus specific routines for 3Com 3C575-family CardBus ethernet adapter
*/
/* CardBus function status space. 575B requests it. */
bus_space_tag_t sc_funct;
bus_space_handle_t sc_funch;
bus_size_t sc_funcsize;
bus_size_t sc_mapsize; /* the size of mapped bus space region */
pcitag_t sc_tag;
pcireg_t sc_csr;
int sc_bar_reg; /* which BAR to use */
pcireg_t sc_bar_val; /* value of the BAR */
int sc_bar_reg1; /* which BAR to use */
pcireg_t sc_bar_val1; /* value of the BAR */
/* Program the BAR */
Cardbus_conf_write(ct, csc->sc_tag, csc->sc_bar_reg, csc->sc_bar_val);
/* Make sure the right access type is on the CardBus bridge. */
if (csc->sc_cardtype == EX_CB_CYCLONE) {
/* Program the BAR */
Cardbus_conf_write(ct, csc->sc_tag,
csc->sc_bar_reg1, csc->sc_bar_val1);
/*
* Make sure CardBus brigde can access memory space. Usually
* memory access is enabled by BIOS, but some BIOSes do not
* enable it.
*/
}
/* Enable the appropriate bits in the CARDBUS CSR. */
reg = Cardbus_conf_read(ct, csc->sc_tag, PCI_COMMAND_STATUS_REG);
reg |= csc->sc_csr;
Cardbus_conf_write(ct, csc->sc_tag, PCI_COMMAND_STATUS_REG, reg);
/*
* set latency timer
*/
reg = Cardbus_conf_read(ct, csc->sc_tag, PCI_BHLC_REG);
if (PCI_LATTIMER(reg) < 0x20) {
/* at least the value of latency timer should 0x20. */
DPRINTF(("if_ex_cardbus: lattimer 0x%x -> 0x20\n",
PCI_LATTIMER(reg)));
reg &= ~(PCI_LATTIMER_MASK << PCI_LATTIMER_SHIFT);
reg |= (0x20 << PCI_LATTIMER_SHIFT);
Cardbus_conf_write(ct, csc->sc_tag, PCI_BHLC_REG, reg);
}
}