199767f8919635c4928607450d9e0abb932109ceToomas Soome/*
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Copyright (c) 2003 Hidetoshi Shimokawa
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Copyright (c) 1998-2002 Katsushi Kobayashi and Hidetoshi Shimokawa
199767f8919635c4928607450d9e0abb932109ceToomas Soome * All rights reserved.
199767f8919635c4928607450d9e0abb932109ceToomas Soome *
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Redistribution and use in source and binary forms, with or without
199767f8919635c4928607450d9e0abb932109ceToomas Soome * modification, are permitted provided that the following conditions
199767f8919635c4928607450d9e0abb932109ceToomas Soome * are met:
199767f8919635c4928607450d9e0abb932109ceToomas Soome * 1. Redistributions of source code must retain the above copyright
199767f8919635c4928607450d9e0abb932109ceToomas Soome * notice, this list of conditions and the following disclaimer.
199767f8919635c4928607450d9e0abb932109ceToomas Soome * 2. Redistributions in binary form must reproduce the above copyright
199767f8919635c4928607450d9e0abb932109ceToomas Soome * notice, this list of conditions and the following disclaimer in the
199767f8919635c4928607450d9e0abb932109ceToomas Soome * documentation and/or other materials provided with the distribution.
199767f8919635c4928607450d9e0abb932109ceToomas Soome * 3. All advertising materials mentioning features or use of this software
199767f8919635c4928607450d9e0abb932109ceToomas Soome * must display the acknowledgement as bellow:
199767f8919635c4928607450d9e0abb932109ceToomas Soome *
199767f8919635c4928607450d9e0abb932109ceToomas Soome * This product includes software developed by K. Kobayashi and H. Shimokawa
199767f8919635c4928607450d9e0abb932109ceToomas Soome *
199767f8919635c4928607450d9e0abb932109ceToomas Soome * 4. The name of the author may not be used to endorse or promote products
199767f8919635c4928607450d9e0abb932109ceToomas Soome * derived from this software without specific prior written permission.
199767f8919635c4928607450d9e0abb932109ceToomas Soome *
199767f8919635c4928607450d9e0abb932109ceToomas Soome * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
199767f8919635c4928607450d9e0abb932109ceToomas Soome * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
199767f8919635c4928607450d9e0abb932109ceToomas Soome * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
199767f8919635c4928607450d9e0abb932109ceToomas Soome * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
199767f8919635c4928607450d9e0abb932109ceToomas Soome * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
199767f8919635c4928607450d9e0abb932109ceToomas Soome * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
199767f8919635c4928607450d9e0abb932109ceToomas Soome * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
199767f8919635c4928607450d9e0abb932109ceToomas Soome * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
199767f8919635c4928607450d9e0abb932109ceToomas Soome * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
199767f8919635c4928607450d9e0abb932109ceToomas Soome * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
199767f8919635c4928607450d9e0abb932109ceToomas Soome * POSSIBILITY OF SUCH DAMAGE.
199767f8919635c4928607450d9e0abb932109ceToomas Soome *
199767f8919635c4928607450d9e0abb932109ceToomas Soome * $FreeBSD$
199767f8919635c4928607450d9e0abb932109ceToomas Soome *
199767f8919635c4928607450d9e0abb932109ceToomas Soome */
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome#include <stand.h>
199767f8919635c4928607450d9e0abb932109ceToomas Soome#include <btxv86.h>
199767f8919635c4928607450d9e0abb932109ceToomas Soome#include <bootstrap.h>
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome#include "fwohci.h"
199767f8919635c4928607450d9e0abb932109ceToomas Soome#include "fwohcireg.h"
199767f8919635c4928607450d9e0abb932109ceToomas Soome#include <dev/firewire/firewire_phy.h>
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soomestatic uint32_t fwphy_wrdata ( struct fwohci_softc *, uint32_t, uint32_t);
199767f8919635c4928607450d9e0abb932109ceToomas Soomestatic uint32_t fwphy_rddata ( struct fwohci_softc *, uint32_t);
199767f8919635c4928607450d9e0abb932109ceToomas Soomeint firewire_debug=0;
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome#if 0
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define device_printf(a, x, ...) printf("FW1394: " x, ## __VA_ARGS__)
199767f8919635c4928607450d9e0abb932109ceToomas Soome#else
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define device_printf(a, x, ...)
199767f8919635c4928607450d9e0abb932109ceToomas Soome#endif
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define device_t int
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define DELAY(x) delay(x)
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define MAX_SPEED 3
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define MAXREC(x) (2 << (x))
199767f8919635c4928607450d9e0abb932109ceToomas Soomechar *linkspeed[] = {
199767f8919635c4928607450d9e0abb932109ceToomas Soome "S100", "S200", "S400", "S800",
199767f8919635c4928607450d9e0abb932109ceToomas Soome "S1600", "S3200", "undef", "undef"
199767f8919635c4928607450d9e0abb932109ceToomas Soome};
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define FW_EUI64_BYTE(eui, x) \
199767f8919635c4928607450d9e0abb932109ceToomas Soome ((((x)<4)? \
199767f8919635c4928607450d9e0abb932109ceToomas Soome ((eui)->hi >> (8*(3-(x)))): \
199767f8919635c4928607450d9e0abb932109ceToomas Soome ((eui)->lo >> (8*(7-(x)))) \
199767f8919635c4928607450d9e0abb932109ceToomas Soome ) & 0xff)
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome/*
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Communication with PHY device
199767f8919635c4928607450d9e0abb932109ceToomas Soome */
199767f8919635c4928607450d9e0abb932109ceToomas Soomestatic uint32_t
199767f8919635c4928607450d9e0abb932109ceToomas Soomefwphy_wrdata( struct fwohci_softc *sc, uint32_t addr, uint32_t data)
199767f8919635c4928607450d9e0abb932109ceToomas Soome{
199767f8919635c4928607450d9e0abb932109ceToomas Soome uint32_t fun;
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome addr &= 0xf;
199767f8919635c4928607450d9e0abb932109ceToomas Soome data &= 0xff;
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome fun = (PHYDEV_WRCMD | (addr << PHYDEV_REGADDR) | (data << PHYDEV_WRDATA));
199767f8919635c4928607450d9e0abb932109ceToomas Soome OWRITE(sc, OHCI_PHYACCESS, fun);
199767f8919635c4928607450d9e0abb932109ceToomas Soome DELAY(100);
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome return(fwphy_rddata( sc, addr));
199767f8919635c4928607450d9e0abb932109ceToomas Soome}
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soomestatic uint32_t
199767f8919635c4928607450d9e0abb932109ceToomas Soomefwphy_rddata(struct fwohci_softc *sc, u_int addr)
199767f8919635c4928607450d9e0abb932109ceToomas Soome{
199767f8919635c4928607450d9e0abb932109ceToomas Soome uint32_t fun, stat;
199767f8919635c4928607450d9e0abb932109ceToomas Soome u_int i, retry = 0;
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome addr &= 0xf;
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define MAX_RETRY 100
199767f8919635c4928607450d9e0abb932109ceToomas Soomeagain:
199767f8919635c4928607450d9e0abb932109ceToomas Soome OWRITE(sc, FWOHCI_INTSTATCLR, OHCI_INT_REG_FAIL);
199767f8919635c4928607450d9e0abb932109ceToomas Soome fun = PHYDEV_RDCMD | (addr << PHYDEV_REGADDR);
199767f8919635c4928607450d9e0abb932109ceToomas Soome OWRITE(sc, OHCI_PHYACCESS, fun);
199767f8919635c4928607450d9e0abb932109ceToomas Soome for ( i = 0 ; i < MAX_RETRY ; i ++ ){
199767f8919635c4928607450d9e0abb932109ceToomas Soome fun = OREAD(sc, OHCI_PHYACCESS);
199767f8919635c4928607450d9e0abb932109ceToomas Soome if ((fun & PHYDEV_RDCMD) == 0 && (fun & PHYDEV_RDDONE) != 0)
199767f8919635c4928607450d9e0abb932109ceToomas Soome break;
199767f8919635c4928607450d9e0abb932109ceToomas Soome DELAY(100);
199767f8919635c4928607450d9e0abb932109ceToomas Soome }
199767f8919635c4928607450d9e0abb932109ceToomas Soome if(i >= MAX_RETRY) {
199767f8919635c4928607450d9e0abb932109ceToomas Soome if (firewire_debug)
199767f8919635c4928607450d9e0abb932109ceToomas Soome device_printf(sc->fc.dev, "phy read failed(1).\n");
199767f8919635c4928607450d9e0abb932109ceToomas Soome if (++retry < MAX_RETRY) {
199767f8919635c4928607450d9e0abb932109ceToomas Soome DELAY(100);
199767f8919635c4928607450d9e0abb932109ceToomas Soome goto again;
199767f8919635c4928607450d9e0abb932109ceToomas Soome }
199767f8919635c4928607450d9e0abb932109ceToomas Soome }
199767f8919635c4928607450d9e0abb932109ceToomas Soome /* Make sure that SCLK is started */
199767f8919635c4928607450d9e0abb932109ceToomas Soome stat = OREAD(sc, FWOHCI_INTSTAT);
199767f8919635c4928607450d9e0abb932109ceToomas Soome if ((stat & OHCI_INT_REG_FAIL) != 0 ||
199767f8919635c4928607450d9e0abb932109ceToomas Soome ((fun >> PHYDEV_REGADDR) & 0xf) != addr) {
199767f8919635c4928607450d9e0abb932109ceToomas Soome if (firewire_debug)
199767f8919635c4928607450d9e0abb932109ceToomas Soome device_printf(sc->fc.dev, "phy read failed(2).\n");
199767f8919635c4928607450d9e0abb932109ceToomas Soome if (++retry < MAX_RETRY) {
199767f8919635c4928607450d9e0abb932109ceToomas Soome DELAY(100);
199767f8919635c4928607450d9e0abb932109ceToomas Soome goto again;
199767f8919635c4928607450d9e0abb932109ceToomas Soome }
199767f8919635c4928607450d9e0abb932109ceToomas Soome }
199767f8919635c4928607450d9e0abb932109ceToomas Soome if (firewire_debug || retry >= MAX_RETRY)
199767f8919635c4928607450d9e0abb932109ceToomas Soome device_printf(sc->fc.dev,
199767f8919635c4928607450d9e0abb932109ceToomas Soome "fwphy_rddata: 0x%x loop=%d, retry=%d\n", addr, i, retry);
199767f8919635c4928607450d9e0abb932109ceToomas Soome#undef MAX_RETRY
199767f8919635c4928607450d9e0abb932109ceToomas Soome return((fun >> PHYDEV_RDDATA )& 0xff);
199767f8919635c4928607450d9e0abb932109ceToomas Soome}
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soomestatic int
199767f8919635c4928607450d9e0abb932109ceToomas Soomefwohci_probe_phy(struct fwohci_softc *sc, device_t dev)
199767f8919635c4928607450d9e0abb932109ceToomas Soome{
199767f8919635c4928607450d9e0abb932109ceToomas Soome uint32_t reg, reg2;
199767f8919635c4928607450d9e0abb932109ceToomas Soome int e1394a = 1;
199767f8919635c4928607450d9e0abb932109ceToomas Soome int nport, speed;
199767f8919635c4928607450d9e0abb932109ceToomas Soome/*
199767f8919635c4928607450d9e0abb932109ceToomas Soome * probe PHY parameters
199767f8919635c4928607450d9e0abb932109ceToomas Soome * 0. to prove PHY version, whether compliance of 1394a.
199767f8919635c4928607450d9e0abb932109ceToomas Soome * 1. to probe maximum speed supported by the PHY and
199767f8919635c4928607450d9e0abb932109ceToomas Soome * number of port supported by core-logic.
199767f8919635c4928607450d9e0abb932109ceToomas Soome * It is not actually available port on your PC .
199767f8919635c4928607450d9e0abb932109ceToomas Soome */
199767f8919635c4928607450d9e0abb932109ceToomas Soome OWRITE(sc, OHCI_HCCCTL, OHCI_HCC_LPS);
199767f8919635c4928607450d9e0abb932109ceToomas Soome DELAY(500);
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome reg = fwphy_rddata(sc, FW_PHY_SPD_REG);
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome if((reg >> 5) != 7 ){
199767f8919635c4928607450d9e0abb932109ceToomas Soome nport = reg & FW_PHY_NP;
199767f8919635c4928607450d9e0abb932109ceToomas Soome speed = reg & FW_PHY_SPD >> 6;
199767f8919635c4928607450d9e0abb932109ceToomas Soome if (speed > MAX_SPEED) {
199767f8919635c4928607450d9e0abb932109ceToomas Soome device_printf(dev, "invalid speed %d (fixed to %d).\n",
199767f8919635c4928607450d9e0abb932109ceToomas Soome speed, MAX_SPEED);
199767f8919635c4928607450d9e0abb932109ceToomas Soome speed = MAX_SPEED;
199767f8919635c4928607450d9e0abb932109ceToomas Soome }
199767f8919635c4928607450d9e0abb932109ceToomas Soome device_printf(dev,
199767f8919635c4928607450d9e0abb932109ceToomas Soome "Phy 1394 only %s, %d ports.\n",
199767f8919635c4928607450d9e0abb932109ceToomas Soome linkspeed[speed], nport);
199767f8919635c4928607450d9e0abb932109ceToomas Soome }else{
199767f8919635c4928607450d9e0abb932109ceToomas Soome reg2 = fwphy_rddata(sc, FW_PHY_ESPD_REG);
199767f8919635c4928607450d9e0abb932109ceToomas Soome nport = reg & FW_PHY_NP;
199767f8919635c4928607450d9e0abb932109ceToomas Soome speed = (reg2 & FW_PHY_ESPD) >> 5;
199767f8919635c4928607450d9e0abb932109ceToomas Soome if (speed > MAX_SPEED) {
199767f8919635c4928607450d9e0abb932109ceToomas Soome device_printf(dev, "invalid speed %d (fixed to %d).\n",
199767f8919635c4928607450d9e0abb932109ceToomas Soome speed, MAX_SPEED);
199767f8919635c4928607450d9e0abb932109ceToomas Soome speed = MAX_SPEED;
199767f8919635c4928607450d9e0abb932109ceToomas Soome }
199767f8919635c4928607450d9e0abb932109ceToomas Soome device_printf(dev,
199767f8919635c4928607450d9e0abb932109ceToomas Soome "Phy 1394a available %s, %d ports.\n",
199767f8919635c4928607450d9e0abb932109ceToomas Soome linkspeed[speed], nport);
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome /* check programPhyEnable */
199767f8919635c4928607450d9e0abb932109ceToomas Soome reg2 = fwphy_rddata(sc, 5);
199767f8919635c4928607450d9e0abb932109ceToomas Soome#if 0
199767f8919635c4928607450d9e0abb932109ceToomas Soome if (e1394a && (OREAD(sc, OHCI_HCCCTL) & OHCI_HCC_PRPHY)) {
199767f8919635c4928607450d9e0abb932109ceToomas Soome#else /* XXX force to enable 1394a */
199767f8919635c4928607450d9e0abb932109ceToomas Soome if (e1394a) {
199767f8919635c4928607450d9e0abb932109ceToomas Soome#endif
199767f8919635c4928607450d9e0abb932109ceToomas Soome if (firewire_debug)
199767f8919635c4928607450d9e0abb932109ceToomas Soome device_printf(dev,
199767f8919635c4928607450d9e0abb932109ceToomas Soome "Enable 1394a Enhancements\n");
199767f8919635c4928607450d9e0abb932109ceToomas Soome /* enable EAA EMC */
199767f8919635c4928607450d9e0abb932109ceToomas Soome reg2 |= 0x03;
199767f8919635c4928607450d9e0abb932109ceToomas Soome /* set aPhyEnhanceEnable */
199767f8919635c4928607450d9e0abb932109ceToomas Soome OWRITE(sc, OHCI_HCCCTL, OHCI_HCC_PHYEN);
199767f8919635c4928607450d9e0abb932109ceToomas Soome OWRITE(sc, OHCI_HCCCTLCLR, OHCI_HCC_PRPHY);
199767f8919635c4928607450d9e0abb932109ceToomas Soome } else {
199767f8919635c4928607450d9e0abb932109ceToomas Soome /* for safe */
199767f8919635c4928607450d9e0abb932109ceToomas Soome reg2 &= ~0x83;
199767f8919635c4928607450d9e0abb932109ceToomas Soome }
199767f8919635c4928607450d9e0abb932109ceToomas Soome reg2 = fwphy_wrdata(sc, 5, reg2);
199767f8919635c4928607450d9e0abb932109ceToomas Soome }
199767f8919635c4928607450d9e0abb932109ceToomas Soome sc->speed = speed;
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome reg = fwphy_rddata(sc, FW_PHY_SPD_REG);
199767f8919635c4928607450d9e0abb932109ceToomas Soome if((reg >> 5) == 7 ){
199767f8919635c4928607450d9e0abb932109ceToomas Soome reg = fwphy_rddata(sc, 4);
199767f8919635c4928607450d9e0abb932109ceToomas Soome reg |= 1 << 6;
199767f8919635c4928607450d9e0abb932109ceToomas Soome fwphy_wrdata(sc, 4, reg);
199767f8919635c4928607450d9e0abb932109ceToomas Soome reg = fwphy_rddata(sc, 4);
199767f8919635c4928607450d9e0abb932109ceToomas Soome }
199767f8919635c4928607450d9e0abb932109ceToomas Soome return 0;
199767f8919635c4928607450d9e0abb932109ceToomas Soome}
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soomevoid
199767f8919635c4928607450d9e0abb932109ceToomas Soomefwohci_reset(struct fwohci_softc *sc, device_t dev)
199767f8919635c4928607450d9e0abb932109ceToomas Soome{
199767f8919635c4928607450d9e0abb932109ceToomas Soome int i, max_rec, speed;
199767f8919635c4928607450d9e0abb932109ceToomas Soome uint32_t reg, reg2;
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome /* Disable interrupts */
199767f8919635c4928607450d9e0abb932109ceToomas Soome OWRITE(sc, FWOHCI_INTMASKCLR, ~0);
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome /* FLUSH FIFO and reset Transmitter/Reciever */
199767f8919635c4928607450d9e0abb932109ceToomas Soome OWRITE(sc, OHCI_HCCCTL, OHCI_HCC_RESET);
199767f8919635c4928607450d9e0abb932109ceToomas Soome if (firewire_debug)
199767f8919635c4928607450d9e0abb932109ceToomas Soome device_printf(dev, "resetting OHCI...");
199767f8919635c4928607450d9e0abb932109ceToomas Soome i = 0;
199767f8919635c4928607450d9e0abb932109ceToomas Soome while(OREAD(sc, OHCI_HCCCTL) & OHCI_HCC_RESET) {
199767f8919635c4928607450d9e0abb932109ceToomas Soome if (i++ > 100) break;
199767f8919635c4928607450d9e0abb932109ceToomas Soome DELAY(1000);
199767f8919635c4928607450d9e0abb932109ceToomas Soome }
199767f8919635c4928607450d9e0abb932109ceToomas Soome if (firewire_debug)
199767f8919635c4928607450d9e0abb932109ceToomas Soome printf("done (loop=%d)\n", i);
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome /* Probe phy */
199767f8919635c4928607450d9e0abb932109ceToomas Soome fwohci_probe_phy(sc, dev);
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome /* Probe link */
199767f8919635c4928607450d9e0abb932109ceToomas Soome reg = OREAD(sc, OHCI_BUS_OPT);
199767f8919635c4928607450d9e0abb932109ceToomas Soome reg2 = reg | OHCI_BUSFNC;
199767f8919635c4928607450d9e0abb932109ceToomas Soome max_rec = (reg & 0x0000f000) >> 12;
199767f8919635c4928607450d9e0abb932109ceToomas Soome speed = (reg & 0x00000007);
199767f8919635c4928607450d9e0abb932109ceToomas Soome device_printf(dev, "Link %s, max_rec %d bytes.\n",
199767f8919635c4928607450d9e0abb932109ceToomas Soome linkspeed[speed], MAXREC(max_rec));
199767f8919635c4928607450d9e0abb932109ceToomas Soome /* XXX fix max_rec */
199767f8919635c4928607450d9e0abb932109ceToomas Soome sc->maxrec = sc->speed + 8;
199767f8919635c4928607450d9e0abb932109ceToomas Soome if (max_rec != sc->maxrec) {
199767f8919635c4928607450d9e0abb932109ceToomas Soome reg2 = (reg2 & 0xffff0fff) | (sc->maxrec << 12);
199767f8919635c4928607450d9e0abb932109ceToomas Soome device_printf(dev, "max_rec %d -> %d\n",
199767f8919635c4928607450d9e0abb932109ceToomas Soome MAXREC(max_rec), MAXREC(sc->maxrec));
199767f8919635c4928607450d9e0abb932109ceToomas Soome }
199767f8919635c4928607450d9e0abb932109ceToomas Soome if (firewire_debug)
199767f8919635c4928607450d9e0abb932109ceToomas Soome device_printf(dev, "BUS_OPT 0x%x -> 0x%x\n", reg, reg2);
199767f8919635c4928607450d9e0abb932109ceToomas Soome OWRITE(sc, OHCI_BUS_OPT, reg2);
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome /* Initialize registers */
199767f8919635c4928607450d9e0abb932109ceToomas Soome OWRITE(sc, OHCI_CROMHDR, sc->config_rom[0]);
199767f8919635c4928607450d9e0abb932109ceToomas Soome OWRITE(sc, OHCI_CROMPTR, VTOP(sc->config_rom));
199767f8919635c4928607450d9e0abb932109ceToomas Soome#if 0
199767f8919635c4928607450d9e0abb932109ceToomas Soome OWRITE(sc, OHCI_SID_BUF, sc->sid_dma.bus_addr);
199767f8919635c4928607450d9e0abb932109ceToomas Soome#endif
199767f8919635c4928607450d9e0abb932109ceToomas Soome OWRITE(sc, OHCI_HCCCTLCLR, OHCI_HCC_BIGEND);
199767f8919635c4928607450d9e0abb932109ceToomas Soome OWRITE(sc, OHCI_HCCCTL, OHCI_HCC_POSTWR);
199767f8919635c4928607450d9e0abb932109ceToomas Soome#if 0
199767f8919635c4928607450d9e0abb932109ceToomas Soome OWRITE(sc, OHCI_LNKCTL, OHCI_CNTL_SID);
199767f8919635c4928607450d9e0abb932109ceToomas Soome#endif
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome /* Enable link */
199767f8919635c4928607450d9e0abb932109ceToomas Soome OWRITE(sc, OHCI_HCCCTL, OHCI_HCC_LINKEN);
199767f8919635c4928607450d9e0abb932109ceToomas Soome}
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soomeint
199767f8919635c4928607450d9e0abb932109ceToomas Soomefwohci_init(struct fwohci_softc *sc, device_t dev)
199767f8919635c4928607450d9e0abb932109ceToomas Soome{
199767f8919635c4928607450d9e0abb932109ceToomas Soome int i, mver;
199767f8919635c4928607450d9e0abb932109ceToomas Soome uint32_t reg;
199767f8919635c4928607450d9e0abb932109ceToomas Soome uint8_t ui[8];
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome/* OHCI version */
199767f8919635c4928607450d9e0abb932109ceToomas Soome reg = OREAD(sc, OHCI_VERSION);
199767f8919635c4928607450d9e0abb932109ceToomas Soome mver = (reg >> 16) & 0xff;
199767f8919635c4928607450d9e0abb932109ceToomas Soome device_printf(dev, "OHCI version %x.%x (ROM=%d)\n",
199767f8919635c4928607450d9e0abb932109ceToomas Soome mver, reg & 0xff, (reg>>24) & 1);
199767f8919635c4928607450d9e0abb932109ceToomas Soome if (mver < 1 || mver > 9) {
199767f8919635c4928607450d9e0abb932109ceToomas Soome device_printf(dev, "invalid OHCI version\n");
199767f8919635c4928607450d9e0abb932109ceToomas Soome return (ENXIO);
199767f8919635c4928607450d9e0abb932109ceToomas Soome }
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome/* Available Isochronous DMA channel probe */
199767f8919635c4928607450d9e0abb932109ceToomas Soome OWRITE(sc, OHCI_IT_MASK, 0xffffffff);
199767f8919635c4928607450d9e0abb932109ceToomas Soome OWRITE(sc, OHCI_IR_MASK, 0xffffffff);
199767f8919635c4928607450d9e0abb932109ceToomas Soome reg = OREAD(sc, OHCI_IT_MASK) & OREAD(sc, OHCI_IR_MASK);
199767f8919635c4928607450d9e0abb932109ceToomas Soome OWRITE(sc, OHCI_IT_MASKCLR, 0xffffffff);
199767f8919635c4928607450d9e0abb932109ceToomas Soome OWRITE(sc, OHCI_IR_MASKCLR, 0xffffffff);
199767f8919635c4928607450d9e0abb932109ceToomas Soome for (i = 0; i < 0x20; i++)
199767f8919635c4928607450d9e0abb932109ceToomas Soome if ((reg & (1 << i)) == 0)
199767f8919635c4928607450d9e0abb932109ceToomas Soome break;
199767f8919635c4928607450d9e0abb932109ceToomas Soome device_printf(dev, "No. of Isochronous channels is %d.\n", i);
199767f8919635c4928607450d9e0abb932109ceToomas Soome if (i == 0)
199767f8919635c4928607450d9e0abb932109ceToomas Soome return (ENXIO);
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome#if 0
199767f8919635c4928607450d9e0abb932109ceToomas Soome/* SID recieve buffer must align 2^11 */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define OHCI_SIDSIZE (1 << 11)
199767f8919635c4928607450d9e0abb932109ceToomas Soome sc->sid_buf = fwdma_malloc(&sc->fc, OHCI_SIDSIZE, OHCI_SIDSIZE,
199767f8919635c4928607450d9e0abb932109ceToomas Soome &sc->sid_dma, BUS_DMA_WAITOK);
199767f8919635c4928607450d9e0abb932109ceToomas Soome if (sc->sid_buf == NULL) {
199767f8919635c4928607450d9e0abb932109ceToomas Soome device_printf(dev, "sid_buf alloc failed.");
199767f8919635c4928607450d9e0abb932109ceToomas Soome return ENOMEM;
199767f8919635c4928607450d9e0abb932109ceToomas Soome }
199767f8919635c4928607450d9e0abb932109ceToomas Soome#endif
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome sc->eui.hi = OREAD(sc, FWOHCIGUID_H);
199767f8919635c4928607450d9e0abb932109ceToomas Soome sc->eui.lo = OREAD(sc, FWOHCIGUID_L);
199767f8919635c4928607450d9e0abb932109ceToomas Soome for( i = 0 ; i < 8 ; i ++)
199767f8919635c4928607450d9e0abb932109ceToomas Soome ui[i] = FW_EUI64_BYTE(&sc->eui,i);
199767f8919635c4928607450d9e0abb932109ceToomas Soome device_printf(dev, "EUI64 %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x\n",
199767f8919635c4928607450d9e0abb932109ceToomas Soome ui[0], ui[1], ui[2], ui[3], ui[4], ui[5], ui[6], ui[7]);
199767f8919635c4928607450d9e0abb932109ceToomas Soome fwohci_reset(sc, dev);
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome return 0;
199767f8919635c4928607450d9e0abb932109ceToomas Soome}
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soomevoid
199767f8919635c4928607450d9e0abb932109ceToomas Soomefwohci_ibr(struct fwohci_softc *sc)
199767f8919635c4928607450d9e0abb932109ceToomas Soome{
199767f8919635c4928607450d9e0abb932109ceToomas Soome uint32_t fun;
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome device_printf(sc->dev, "Initiate bus reset\n");
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome /*
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Make sure our cached values from the config rom are
199767f8919635c4928607450d9e0abb932109ceToomas Soome * initialised.
199767f8919635c4928607450d9e0abb932109ceToomas Soome */
199767f8919635c4928607450d9e0abb932109ceToomas Soome OWRITE(sc, OHCI_CROMHDR, ntohl(sc->config_rom[0]));
199767f8919635c4928607450d9e0abb932109ceToomas Soome OWRITE(sc, OHCI_BUS_OPT, ntohl(sc->config_rom[2]));
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome /*
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Set root hold-off bit so that non cyclemaster capable node
199767f8919635c4928607450d9e0abb932109ceToomas Soome * shouldn't became the root node.
199767f8919635c4928607450d9e0abb932109ceToomas Soome */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#if 1
199767f8919635c4928607450d9e0abb932109ceToomas Soome fun = fwphy_rddata(sc, FW_PHY_IBR_REG);
199767f8919635c4928607450d9e0abb932109ceToomas Soome fun |= FW_PHY_IBR;
199767f8919635c4928607450d9e0abb932109ceToomas Soome fun = fwphy_wrdata(sc, FW_PHY_IBR_REG, fun);
199767f8919635c4928607450d9e0abb932109ceToomas Soome#else /* Short bus reset */
199767f8919635c4928607450d9e0abb932109ceToomas Soome fun = fwphy_rddata(sc, FW_PHY_ISBR_REG);
199767f8919635c4928607450d9e0abb932109ceToomas Soome fun |= FW_PHY_ISBR;
199767f8919635c4928607450d9e0abb932109ceToomas Soome fun = fwphy_wrdata(sc, FW_PHY_ISBR_REG, fun);
199767f8919635c4928607450d9e0abb932109ceToomas Soome#endif
199767f8919635c4928607450d9e0abb932109ceToomas Soome}
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soomevoid
199767f8919635c4928607450d9e0abb932109ceToomas Soomefwohci_sid(struct fwohci_softc *sc)
199767f8919635c4928607450d9e0abb932109ceToomas Soome{
199767f8919635c4928607450d9e0abb932109ceToomas Soome uint32_t node_id;
199767f8919635c4928607450d9e0abb932109ceToomas Soome int plen;
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome node_id = OREAD(sc, FWOHCI_NODEID);
199767f8919635c4928607450d9e0abb932109ceToomas Soome if (!(node_id & OHCI_NODE_VALID)) {
199767f8919635c4928607450d9e0abb932109ceToomas Soome#if 0
199767f8919635c4928607450d9e0abb932109ceToomas Soome printf("Bus reset failure\n");
199767f8919635c4928607450d9e0abb932109ceToomas Soome#endif
199767f8919635c4928607450d9e0abb932109ceToomas Soome return;
199767f8919635c4928607450d9e0abb932109ceToomas Soome }
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome /* Enable bus reset interrupt */
199767f8919635c4928607450d9e0abb932109ceToomas Soome OWRITE(sc, FWOHCI_INTMASK, OHCI_INT_PHY_BUS_R);
199767f8919635c4928607450d9e0abb932109ceToomas Soome /* Allow async. request to us */
199767f8919635c4928607450d9e0abb932109ceToomas Soome OWRITE(sc, OHCI_AREQHI, 1 << 31);
199767f8919635c4928607450d9e0abb932109ceToomas Soome /* XXX insecure ?? */
199767f8919635c4928607450d9e0abb932109ceToomas Soome OWRITE(sc, OHCI_PREQHI, 0x7fffffff);
199767f8919635c4928607450d9e0abb932109ceToomas Soome OWRITE(sc, OHCI_PREQLO, 0xffffffff);
199767f8919635c4928607450d9e0abb932109ceToomas Soome OWRITE(sc, OHCI_PREQUPPER, 0x10000);
199767f8919635c4928607450d9e0abb932109ceToomas Soome /* Set ATRetries register */
199767f8919635c4928607450d9e0abb932109ceToomas Soome OWRITE(sc, OHCI_ATRETRY, 1<<(13+16) | 0xfff);
199767f8919635c4928607450d9e0abb932109ceToomas Soome/*
199767f8919635c4928607450d9e0abb932109ceToomas Soome** Checking whether the node is root or not. If root, turn on
199767f8919635c4928607450d9e0abb932109ceToomas Soome** cycle master.
199767f8919635c4928607450d9e0abb932109ceToomas Soome*/
199767f8919635c4928607450d9e0abb932109ceToomas Soome plen = OREAD(sc, OHCI_SID_CNT);
199767f8919635c4928607450d9e0abb932109ceToomas Soome device_printf(fc->dev, "node_id=0x%08x, gen=%d, ",
199767f8919635c4928607450d9e0abb932109ceToomas Soome node_id, (plen >> 16) & 0xff);
199767f8919635c4928607450d9e0abb932109ceToomas Soome if (node_id & OHCI_NODE_ROOT) {
199767f8919635c4928607450d9e0abb932109ceToomas Soome device_printf(sc->dev, "CYCLEMASTER mode\n");
199767f8919635c4928607450d9e0abb932109ceToomas Soome OWRITE(sc, OHCI_LNKCTL,
199767f8919635c4928607450d9e0abb932109ceToomas Soome OHCI_CNTL_CYCMTR | OHCI_CNTL_CYCTIMER);
199767f8919635c4928607450d9e0abb932109ceToomas Soome } else {
199767f8919635c4928607450d9e0abb932109ceToomas Soome device_printf(sc->dev, "non CYCLEMASTER mode\n");
199767f8919635c4928607450d9e0abb932109ceToomas Soome OWRITE(sc, OHCI_LNKCTLCLR, OHCI_CNTL_CYCMTR);
199767f8919635c4928607450d9e0abb932109ceToomas Soome OWRITE(sc, OHCI_LNKCTL, OHCI_CNTL_CYCTIMER);
199767f8919635c4928607450d9e0abb932109ceToomas Soome }
199767f8919635c4928607450d9e0abb932109ceToomas Soome if (plen & OHCI_SID_ERR) {
199767f8919635c4928607450d9e0abb932109ceToomas Soome device_printf(fc->dev, "SID Error\n");
199767f8919635c4928607450d9e0abb932109ceToomas Soome return;
199767f8919635c4928607450d9e0abb932109ceToomas Soome }
199767f8919635c4928607450d9e0abb932109ceToomas Soome device_printf(sc->dev, "bus reset phase done\n");
199767f8919635c4928607450d9e0abb932109ceToomas Soome sc->state = FWOHCI_STATE_NORMAL;
199767f8919635c4928607450d9e0abb932109ceToomas Soome}
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soomestatic void
199767f8919635c4928607450d9e0abb932109ceToomas Soomefwohci_intr_body(struct fwohci_softc *sc, uint32_t stat, int count)
199767f8919635c4928607450d9e0abb932109ceToomas Soome{
199767f8919635c4928607450d9e0abb932109ceToomas Soome#undef OHCI_DEBUG
199767f8919635c4928607450d9e0abb932109ceToomas Soome#ifdef OHCI_DEBUG
199767f8919635c4928607450d9e0abb932109ceToomas Soome#if 0
199767f8919635c4928607450d9e0abb932109ceToomas Soome if(stat & OREAD(sc, FWOHCI_INTMASK))
199767f8919635c4928607450d9e0abb932109ceToomas Soome#else
199767f8919635c4928607450d9e0abb932109ceToomas Soome if (1)
199767f8919635c4928607450d9e0abb932109ceToomas Soome#endif
199767f8919635c4928607450d9e0abb932109ceToomas Soome device_printf(fc->dev, "INTERRUPT < %s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s> 0x%08x, 0x%08x\n",
199767f8919635c4928607450d9e0abb932109ceToomas Soome stat & OHCI_INT_EN ? "DMA_EN ":"",
199767f8919635c4928607450d9e0abb932109ceToomas Soome stat & OHCI_INT_PHY_REG ? "PHY_REG ":"",
199767f8919635c4928607450d9e0abb932109ceToomas Soome stat & OHCI_INT_CYC_LONG ? "CYC_LONG ":"",
199767f8919635c4928607450d9e0abb932109ceToomas Soome stat & OHCI_INT_ERR ? "INT_ERR ":"",
199767f8919635c4928607450d9e0abb932109ceToomas Soome stat & OHCI_INT_CYC_ERR ? "CYC_ERR ":"",
199767f8919635c4928607450d9e0abb932109ceToomas Soome stat & OHCI_INT_CYC_LOST ? "CYC_LOST ":"",
199767f8919635c4928607450d9e0abb932109ceToomas Soome stat & OHCI_INT_CYC_64SECOND ? "CYC_64SECOND ":"",
199767f8919635c4928607450d9e0abb932109ceToomas Soome stat & OHCI_INT_CYC_START ? "CYC_START ":"",
199767f8919635c4928607450d9e0abb932109ceToomas Soome stat & OHCI_INT_PHY_INT ? "PHY_INT ":"",
199767f8919635c4928607450d9e0abb932109ceToomas Soome stat & OHCI_INT_PHY_BUS_R ? "BUS_RESET ":"",
199767f8919635c4928607450d9e0abb932109ceToomas Soome stat & OHCI_INT_PHY_SID ? "SID ":"",
199767f8919635c4928607450d9e0abb932109ceToomas Soome stat & OHCI_INT_LR_ERR ? "DMA_LR_ERR ":"",
199767f8919635c4928607450d9e0abb932109ceToomas Soome stat & OHCI_INT_PW_ERR ? "DMA_PW_ERR ":"",
199767f8919635c4928607450d9e0abb932109ceToomas Soome stat & OHCI_INT_DMA_IR ? "DMA_IR ":"",
199767f8919635c4928607450d9e0abb932109ceToomas Soome stat & OHCI_INT_DMA_IT ? "DMA_IT " :"",
199767f8919635c4928607450d9e0abb932109ceToomas Soome stat & OHCI_INT_DMA_PRRS ? "DMA_PRRS " :"",
199767f8919635c4928607450d9e0abb932109ceToomas Soome stat & OHCI_INT_DMA_PRRQ ? "DMA_PRRQ " :"",
199767f8919635c4928607450d9e0abb932109ceToomas Soome stat & OHCI_INT_DMA_ARRS ? "DMA_ARRS " :"",
199767f8919635c4928607450d9e0abb932109ceToomas Soome stat & OHCI_INT_DMA_ARRQ ? "DMA_ARRQ " :"",
199767f8919635c4928607450d9e0abb932109ceToomas Soome stat & OHCI_INT_DMA_ATRS ? "DMA_ATRS " :"",
199767f8919635c4928607450d9e0abb932109ceToomas Soome stat & OHCI_INT_DMA_ATRQ ? "DMA_ATRQ " :"",
199767f8919635c4928607450d9e0abb932109ceToomas Soome stat, OREAD(sc, FWOHCI_INTMASK)
199767f8919635c4928607450d9e0abb932109ceToomas Soome );
199767f8919635c4928607450d9e0abb932109ceToomas Soome#endif
199767f8919635c4928607450d9e0abb932109ceToomas Soome/* Bus reset */
199767f8919635c4928607450d9e0abb932109ceToomas Soome if(stat & OHCI_INT_PHY_BUS_R ){
199767f8919635c4928607450d9e0abb932109ceToomas Soome device_printf(fc->dev, "BUS reset\n");
199767f8919635c4928607450d9e0abb932109ceToomas Soome if (sc->state == FWOHCI_STATE_BUSRESET)
199767f8919635c4928607450d9e0abb932109ceToomas Soome goto busresetout;
199767f8919635c4928607450d9e0abb932109ceToomas Soome sc->state = FWOHCI_STATE_BUSRESET;
199767f8919635c4928607450d9e0abb932109ceToomas Soome /* Disable bus reset interrupt until sid recv. */
199767f8919635c4928607450d9e0abb932109ceToomas Soome OWRITE(sc, FWOHCI_INTMASKCLR, OHCI_INT_PHY_BUS_R);
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome OWRITE(sc, FWOHCI_INTMASKCLR, OHCI_INT_CYC_LOST);
199767f8919635c4928607450d9e0abb932109ceToomas Soome OWRITE(sc, OHCI_LNKCTLCLR, OHCI_CNTL_CYCSRC);
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome OWRITE(sc, OHCI_CROMHDR, ntohl(sc->config_rom[0]));
199767f8919635c4928607450d9e0abb932109ceToomas Soome OWRITE(sc, OHCI_BUS_OPT, ntohl(sc->config_rom[2]));
199767f8919635c4928607450d9e0abb932109ceToomas Soome } else if (sc->state == FWOHCI_STATE_BUSRESET) {
199767f8919635c4928607450d9e0abb932109ceToomas Soome fwohci_sid(sc);
199767f8919635c4928607450d9e0abb932109ceToomas Soome }
199767f8919635c4928607450d9e0abb932109ceToomas Soomebusresetout:
199767f8919635c4928607450d9e0abb932109ceToomas Soome return;
199767f8919635c4928607450d9e0abb932109ceToomas Soome}
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soomestatic uint32_t
199767f8919635c4928607450d9e0abb932109ceToomas Soomefwochi_check_stat(struct fwohci_softc *sc)
199767f8919635c4928607450d9e0abb932109ceToomas Soome{
199767f8919635c4928607450d9e0abb932109ceToomas Soome uint32_t stat;
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome stat = OREAD(sc, FWOHCI_INTSTAT);
199767f8919635c4928607450d9e0abb932109ceToomas Soome if (stat == 0xffffffff) {
199767f8919635c4928607450d9e0abb932109ceToomas Soome device_printf(sc->fc.dev,
199767f8919635c4928607450d9e0abb932109ceToomas Soome "device physically ejected?\n");
199767f8919635c4928607450d9e0abb932109ceToomas Soome return(stat);
199767f8919635c4928607450d9e0abb932109ceToomas Soome }
199767f8919635c4928607450d9e0abb932109ceToomas Soome if (stat)
199767f8919635c4928607450d9e0abb932109ceToomas Soome OWRITE(sc, FWOHCI_INTSTATCLR, stat);
199767f8919635c4928607450d9e0abb932109ceToomas Soome return(stat);
199767f8919635c4928607450d9e0abb932109ceToomas Soome}
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soomevoid
199767f8919635c4928607450d9e0abb932109ceToomas Soomefwohci_poll(struct fwohci_softc *sc)
199767f8919635c4928607450d9e0abb932109ceToomas Soome{
199767f8919635c4928607450d9e0abb932109ceToomas Soome uint32_t stat;
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome stat = fwochi_check_stat(sc);
199767f8919635c4928607450d9e0abb932109ceToomas Soome if (stat != 0xffffffff)
199767f8919635c4928607450d9e0abb932109ceToomas Soome fwohci_intr_body(sc, stat, 1);
199767f8919635c4928607450d9e0abb932109ceToomas Soome}