Add driver for ScanLogic SL811HS/T USB Host Controller.
XXX It's experimental code yet. For x68k: USB part of Nereid USB/Ethernet/memory board For ISA: ISA USB Host board from Morphy planning
This commit is contained in:
parent
1c708a4b08
commit
dd0e0396bc
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: files.x68k,v 1.46 2002/04/22 09:41:21 augustss Exp $
|
||||
# $NetBSD: files.x68k,v 1.47 2002/08/11 13:17:52 isaki Exp $
|
||||
#
|
||||
# new style config file for x68k architecture
|
||||
#
|
||||
|
@ -181,6 +181,10 @@ file arch/x68k/dev/pow.c pow needs-count
|
|||
attach ne at intio with ne_intio: rtl80x9
|
||||
file arch/x68k/dev/if_ne_intio.c ne_intio
|
||||
|
||||
# Nereid USB
|
||||
attach slhci at intio with slhci_intio
|
||||
file arch/x68k/dev/slhci_intio.c slhci_intio
|
||||
|
||||
# memory disk
|
||||
file dev/md_root.c memory_disk_hooks
|
||||
major {md = 8}
|
||||
|
@ -205,3 +209,6 @@ file arch/m68k/m68k/linux_trap.c compat_linux
|
|||
|
||||
# OSS audio driver compatibility
|
||||
include "compat/ossaudio/files.ossaudio"
|
||||
|
||||
# USB support
|
||||
include "dev/usb/files.usb"
|
||||
|
|
|
@ -0,0 +1,206 @@
|
|||
/* $NetBSD: slhci_intio.c,v 1.1 2002/08/11 13:17:52 isaki Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2001 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by Tetsuya Isaki.
|
||||
*
|
||||
* 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.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the NetBSD
|
||||
* Foundation, Inc. and its contributors.
|
||||
* 4. Neither the name of The NetBSD Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
* ``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 THE FOUNDATION 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* USB part of Nereid Ethernet/USB/Memory board
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/device.h>
|
||||
|
||||
#include <machine/bus.h>
|
||||
#include <machine/cpu.h>
|
||||
|
||||
#include <dev/usb/usb.h>
|
||||
#include <dev/usb/usbdi.h>
|
||||
#include <dev/usb/usbdivar.h>
|
||||
|
||||
#include <dev/ic/sl811hsreg.h>
|
||||
#include <dev/ic/sl811hsvar.h>
|
||||
|
||||
#include <arch/x68k/dev/intiovar.h>
|
||||
|
||||
#include <arch/x68k/dev/slhci_intio_var.h>
|
||||
|
||||
static int slhci_intio_match(struct device *, struct cfdata *, void *);
|
||||
static void slhci_intio_attach(struct device *, struct device *, void *);
|
||||
static void slhci_intio_enable_power(void *, int);
|
||||
static void slhci_intio_enable_intr(void *, int);
|
||||
static int slhci_intio_intr(void *);
|
||||
|
||||
struct cfattach slhci_intio_ca = {
|
||||
sizeof(struct slhci_intio_softc), slhci_intio_match, slhci_intio_attach
|
||||
};
|
||||
|
||||
static int
|
||||
slhci_intio_match(struct device *parent, struct cfdata *cf, void *aux)
|
||||
{
|
||||
struct intio_attach_args *ia = aux;
|
||||
bus_space_tag_t iot = ia->ia_bst;
|
||||
bus_space_handle_t ioh;
|
||||
bus_space_handle_t nch;
|
||||
int nc_addr;
|
||||
int nc_size;
|
||||
|
||||
if (ia->ia_addr == INTIOCF_ADDR_DEFAULT)
|
||||
ia->ia_addr = SLHCI_INTIO_ADDR1;
|
||||
if (ia->ia_intr == INTIOCF_INTR_DEFAULT)
|
||||
ia->ia_intr = SLHCI_INTIO_INTR1;
|
||||
|
||||
/* fixed parameters */
|
||||
if ( !(ia->ia_addr == SLHCI_INTIO_ADDR1 &&
|
||||
ia->ia_intr == SLHCI_INTIO_INTR1 ) &&
|
||||
!(ia->ia_addr == SLHCI_INTIO_ADDR2 &&
|
||||
ia->ia_intr == SLHCI_INTIO_INTR2 ) )
|
||||
return 0;
|
||||
|
||||
/* Whether the control port is accessible or not */
|
||||
nc_addr = ia->ia_addr + NEREID_ADDR_OFFSET;
|
||||
nc_size = 0x02;
|
||||
if (badbaddr((caddr_t)INTIO_ADDR(nc_addr)))
|
||||
return 0;
|
||||
|
||||
/* Map two I/O spaces */
|
||||
ia->ia_size = SL11_PORTSIZE * 2;
|
||||
if (bus_space_map(iot, ia->ia_addr, ia->ia_size,
|
||||
BUS_SPACE_MAP_SHIFTED, &ioh))
|
||||
return 0;
|
||||
|
||||
if (bus_space_map(iot, nc_addr, nc_size,
|
||||
BUS_SPACE_MAP_SHIFTED, &nch))
|
||||
return 0;
|
||||
|
||||
bus_space_unmap(iot, ioh, ia->ia_size);
|
||||
bus_space_unmap(iot, nch, nc_size);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void
|
||||
slhci_intio_attach(struct device *parent, struct device *self, void *aux)
|
||||
{
|
||||
struct slhci_intio_softc *sc = (struct slhci_intio_softc *)self;
|
||||
struct intio_attach_args *ia = aux;
|
||||
bus_space_tag_t iot = ia->ia_bst;
|
||||
bus_space_handle_t ioh;
|
||||
int nc_addr;
|
||||
int nc_size;
|
||||
|
||||
printf(": Nereid USB\n");
|
||||
|
||||
/* Map I/O space */
|
||||
if (bus_space_map(iot, ia->ia_addr, SL11_PORTSIZE * 2,
|
||||
BUS_SPACE_MAP_SHIFTED, &ioh)) {
|
||||
printf("%s: can't map I/O space\n",
|
||||
sc->sc_sc.sc_bus.bdev.dv_xname);
|
||||
return;
|
||||
}
|
||||
|
||||
nc_addr = ia->ia_addr + NEREID_ADDR_OFFSET;
|
||||
nc_size = 0x02;
|
||||
if (bus_space_map(iot, nc_addr, nc_size,
|
||||
BUS_SPACE_MAP_SHIFTED, &sc->sc_nch)) {
|
||||
printf("%s: can't map I/O control space\n",
|
||||
sc->sc_sc.sc_bus.bdev.dv_xname);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Initialize sc */
|
||||
sc->sc_sc.sc_iot = iot;
|
||||
sc->sc_sc.sc_ioh = ioh;
|
||||
sc->sc_sc.sc_dmat = ia->ia_dmat;
|
||||
sc->sc_sc.sc_enable_power = slhci_intio_enable_power;
|
||||
sc->sc_sc.sc_enable_intr = slhci_intio_enable_intr;
|
||||
sc->sc_sc.sc_arg = sc;
|
||||
|
||||
/* Establish the interrupt handler */
|
||||
if (intio_intr_establish(ia->ia_intr, "slhci", slhci_intio_intr, sc)) {
|
||||
printf("%s: can't establish interrupt\n",
|
||||
sc->sc_sc.sc_bus.bdev.dv_xname);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Reset controller */
|
||||
bus_space_write_1(iot, sc->sc_nch, NEREID_CTRL, NEREID_CTRL_RESET);
|
||||
delay(40000);
|
||||
|
||||
/* Attach SL811HS/T */
|
||||
if (slhci_attach(&sc->sc_sc, self))
|
||||
return;
|
||||
}
|
||||
|
||||
static void
|
||||
slhci_intio_enable_power(void *arg, int mode)
|
||||
{
|
||||
struct slhci_intio_softc *sc = arg;
|
||||
bus_space_tag_t iot = sc->sc_sc.sc_iot;
|
||||
u_int8_t r;
|
||||
|
||||
r = bus_space_read_1(iot, sc->sc_nch, NEREID_CTRL);
|
||||
if (mode == POWER_ON)
|
||||
bus_space_write_1(iot, sc->sc_nch, NEREID_CTRL,
|
||||
r | NEREID_CTRL_POWER);
|
||||
else
|
||||
bus_space_write_1(iot, sc->sc_nch, NEREID_CTRL,
|
||||
r & ~NEREID_CTRL_POWER);
|
||||
}
|
||||
|
||||
static void
|
||||
slhci_intio_enable_intr(void *arg, int mode)
|
||||
{
|
||||
struct slhci_intio_softc *sc = arg;
|
||||
bus_space_tag_t iot = sc->sc_sc.sc_iot;
|
||||
u_int8_t r;
|
||||
|
||||
r = bus_space_read_1(iot, sc->sc_nch, NEREID_CTRL);
|
||||
if (mode == INTR_ON)
|
||||
bus_space_write_1(iot, sc->sc_nch, NEREID_CTRL,
|
||||
r | NEREID_CTRL_INTR);
|
||||
else
|
||||
bus_space_write_1(iot, sc->sc_nch, NEREID_CTRL,
|
||||
r & ~NEREID_CTRL_INTR);
|
||||
}
|
||||
|
||||
static int
|
||||
slhci_intio_intr(void *arg)
|
||||
{
|
||||
struct slhci_intio_softc *sc = arg;
|
||||
|
||||
return slhci_intr(&sc->sc_sc);
|
||||
}
|
|
@ -0,0 +1,59 @@
|
|||
/* $NetBSD: slhci_intio_var.h,v 1.1 2002/08/11 13:17:52 isaki Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2001 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by Tetsuya Isaki.
|
||||
*
|
||||
* 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.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the NetBSD
|
||||
* Foundation, Inc. and its contributors.
|
||||
* 4. Neither the name of The NetBSD Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
* ``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 THE FOUNDATION 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* USB part of Nereid Ethernet/USB/Memory board
|
||||
*/
|
||||
|
||||
#define SLHCI_INTIO_ADDR1 (0xece380)
|
||||
#define SLHCI_INTIO_ADDR2 (0xeceb80)
|
||||
#define SLHCI_INTIO_INTR1 (0xfb)
|
||||
#define SLHCI_INTIO_INTR2 (0xfa)
|
||||
|
||||
#define NEREID_ADDR_OFFSET (0xece3f0 - 0xece380) /* Nereid control port */
|
||||
#define NEREID_CTRL (0)
|
||||
#define NEREID_CTRL_RESET (0x01)
|
||||
#define NEREID_CTRL_POWER (0x02)
|
||||
#define NEREID_CTRL_INTR (0x04)
|
||||
#define NEREID_CTRL_DIPSW (0x08)
|
||||
|
||||
struct slhci_intio_softc {
|
||||
struct slhci_softc sc_sc;
|
||||
|
||||
bus_space_handle_t sc_nch; /* Nereid control port handle */
|
||||
};
|
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: files,v 1.544 2002/08/11 12:09:44 drochner Exp $
|
||||
# $NetBSD: files,v 1.545 2002/08/11 13:17:55 isaki Exp $
|
||||
|
||||
# @(#)files.newconf 7.5 (Berkeley) 5/10/93
|
||||
|
||||
|
@ -820,6 +820,11 @@ file dev/usb/ohci.c ohci needs-flag
|
|||
device ehci: usbus
|
||||
file dev/usb/ehci.c ehci needs-flag
|
||||
|
||||
# SL811HS/T USB controller
|
||||
defflag opt_slhci.h SLHCI_DEBUG
|
||||
device slhci: usbus
|
||||
file dev/ic/sl811hs.c slhci needs-flag
|
||||
|
||||
# radio devices, attaches to radio hardware driver
|
||||
device radio
|
||||
attach radio at radiodev
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: DEVNAMES,v 1.118 2002/07/22 01:24:41 ichiro Exp $
|
||||
# $NetBSD: DEVNAMES,v 1.119 2002/08/11 13:17:53 isaki Exp $
|
||||
#
|
||||
# This file contains all used device names and defined attributes in
|
||||
# alphabetical order. New devices added to the system somewhere should first
|
||||
|
@ -1017,6 +1017,7 @@ siotty luna68k
|
|||
sip MI
|
||||
skbd hpcmips
|
||||
skbdif hpcmips
|
||||
slhci MI
|
||||
sm MI
|
||||
smap playstation2
|
||||
smc93cx6 MI Attribute
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,124 @@
|
|||
/* $NetBSD: sl811hsreg.h,v 1.1 2002/08/11 13:17:53 isaki Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2001 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by Tetsuya Isaki.
|
||||
*
|
||||
* 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.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the NetBSD
|
||||
* Foundation, Inc. and its contributors.
|
||||
* 4. Neither the name of The NetBSD Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
* ``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 THE FOUNDATION 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* ScanLogic SL811HS/T USB Host Controller
|
||||
*/
|
||||
|
||||
#define SL11_IDX_ADDR (0x00)
|
||||
#define SL11_IDX_DATA (0x01)
|
||||
#define SL11_PORTSIZE (0x02)
|
||||
|
||||
#define SL11_E0BASE (0x00) /* Base of Control0 */
|
||||
#define SL11_E0CTRL (0x00) /* Host Control Register */
|
||||
#define SL11_E0ADDR (0x01) /* Host Base Address */
|
||||
#define SL11_E0LEN (0x02) /* Host Base Length */
|
||||
#define SL11_E0STAT (0x03) /* USB Status (Read) */
|
||||
#define SL11_E0PID SL11_E0STAT /* Host PID, Device Endpoint (Write) */
|
||||
#define SL11_E0CONT (0x04) /* Transfer Count (Read) */
|
||||
#define SL11_E0DEV SL11_E0CONT /* Host Device Address (Write) */
|
||||
|
||||
#define SL11_E1BASE (0x08) /* Base of Control1 */
|
||||
#define SL11_E1CTRL (SL11_E1BASE + SL11_E0CTRL)
|
||||
#define SL11_E1ADDR (SL11_E1BASE + SL11_E0ADDR)
|
||||
#define SL11_E1LEN (SL11_E1BASE + SL11_E0LEN)
|
||||
#define SL11_E1STAT (SL11_E1BASE + SL11_E0STAT)
|
||||
#define SL11_E1PID (SL11_E1BASE + SL11_E0PID)
|
||||
#define SL11_E1CONT (SL11_E1BASE + SL11_E0CONT)
|
||||
#define SL11_E1DEV (SL11_E1BASE + SL11_E0DEV)
|
||||
|
||||
#define SL11_CTRL (0x05) /* Control Register1 */
|
||||
#define SL11_IER (0x06) /* Interrupt Enable Register */
|
||||
#define SL11_ISR (0x0d) /* Interrupt Status Register */
|
||||
#define SL11_DATA (0x0e) /* SOF Counter Low (Write) */
|
||||
#define SL11_REV SL11_DATA /* HW Revision Register (Read) */
|
||||
#define SL811_CSOF (0x0f) /* SOF Counter High(R), Control2(W) */
|
||||
#define SL11_MEM (0x10) /* Memory Buffer (0x10 - 0xff) */
|
||||
|
||||
#define SL11_EPCTRL_ARM (0x01)
|
||||
#define SL11_EPCTRL_ENABLE (0x02)
|
||||
#define SL11_EPCTRL_DIRECTION (0x04)
|
||||
#define SL11_EPCTRL_ISO (0x10)
|
||||
#define SL11_EPCTRL_SOF (0x20)
|
||||
#define SL11_EPCTRL_DATATOGGLE (0x40)
|
||||
#define SL11_EPCTRL_PREAMBLE (0x80)
|
||||
|
||||
#define SL11_EPPID_PIDMASK (0xf0)
|
||||
#define SL11_EPPID_EPMASK (0x0f)
|
||||
|
||||
#define SL11_EPSTAT_ACK (0x01)
|
||||
#define SL11_EPSTAT_ERROR (0x02)
|
||||
#define SL11_EPSTAT_TIMEOUT (0x04)
|
||||
#define SL11_EPSTAT_SEQUENCE (0x08)
|
||||
#define SL11_EPSTAT_SETUP (0x10)
|
||||
#define SL11_EPSTAT_OVERFLOW (0x20)
|
||||
#define SL11_EPSTAT_NAK (0x40)
|
||||
#define SL11_EPSTAT_STALL (0x80)
|
||||
|
||||
#define SL11_CTRL_ENABLESOF (0x01)
|
||||
#define SL11_CTRL_EOF2 (0x04)
|
||||
#define SL11_CTRL_RESETENGINE (0x08)
|
||||
#define SL11_CTRL_JKSTATE (0x10)
|
||||
#define SL11_CTRL_LOWSPEED (0x20)
|
||||
#define SL11_CTRL_SUSPEND (0x40)
|
||||
|
||||
#define SL11_IER_USBA (0x01) /* USB-A done */
|
||||
#define SL11_IER_USBB (0x02) /* USB-B done */
|
||||
#define SL11_IER_BABBLE (0x04) /* Babble detection */
|
||||
#define SL11_IER_SOFTIMER (0x10) /* 1ms SOF timer */
|
||||
#define SL11_IER_INSERT (0x20) /* Slave Insert/Remove detection */
|
||||
#define SL11_IER_RESET (0x40) /* USB Reset/Resume */
|
||||
|
||||
#define SL11_ISR_USBA (0x01) /* USB-A done */
|
||||
#define SL11_ISR_USBB (0x02) /* USB-B done */
|
||||
#define SL11_ISR_BABBLE (0x04) /* Babble detection */
|
||||
#define SL11_ISR_SOFTIMER (0x10) /* 1ms SOF timer */
|
||||
#define SL11_ISR_INSERT (0x20) /* Slave Insert/Remove detection */
|
||||
#define SL11_ISR_RESET (0x40) /* USB Reset/Resume */
|
||||
#define SL11_ISR_DATA (0x80) /* Value of the Data+ pin */
|
||||
|
||||
#define SL11_REV_USBA (0x01) /* USB-A */
|
||||
#define SL11_REV_USBB (0x02) /* USB-B */
|
||||
#define SL11_REV_REVMASK (0xf0) /* HW Revision */
|
||||
#define SL11_REV_REVSL11H (0x00) /* HW is SL11H */
|
||||
#define SL11_REV_REVSL811HS (0x10) /* HW is SL811HS */
|
||||
|
||||
#define SL811_CSOF_SOFMASK (0x3f) /* SOF High Counter */
|
||||
#define SL811_CSOF_POLARITY (0x40) /* Change polarity */
|
||||
#define SL811_CSOF_MASTER (0x80) /* Master/Slave selection */
|
||||
|
|
@ -0,0 +1,102 @@
|
|||
/* $NetBSD: sl811hsvar.h,v 1.1 2002/08/11 13:17:54 isaki Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2001 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by Tetsuya Isaki.
|
||||
*
|
||||
* 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.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the NetBSD
|
||||
* Foundation, Inc. and its contributors.
|
||||
* 4. Neither the name of The NetBSD Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
* ``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 THE FOUNDATION 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* ScanLogic SL811HS/T USB Host Controller
|
||||
*/
|
||||
|
||||
#define MS_TO_TICKS(ms) ((ms) * hz / 1000)
|
||||
#define delay_ms(X) \
|
||||
ltsleep(&slhci_dummy, PZERO | PCATCH, "slhci", MS_TO_TICKS(X), NULL)
|
||||
|
||||
#define SL11_PID_OUT (0x1)
|
||||
#define SL11_PID_IN (0x9)
|
||||
#define SL11_PID_SOF (0x5)
|
||||
#define SL11_PID_SETUP (0xd)
|
||||
|
||||
struct slhci_xfer {
|
||||
usbd_xfer_handle sx_xfer;
|
||||
usb_callout_t sx_callout_t;
|
||||
};
|
||||
|
||||
struct slhci_softc {
|
||||
struct usbd_bus sc_bus;
|
||||
bus_space_tag_t sc_iot;
|
||||
bus_space_handle_t sc_ioh;
|
||||
bus_dma_tag_t sc_dmat;
|
||||
|
||||
void (*sc_enable_power)(void *, int);
|
||||
void (*sc_enable_intr)(void *, int);
|
||||
void *sc_arg;
|
||||
int sc_powerstat;
|
||||
#define POWER_ON (1)
|
||||
#define POWER_OFF (0)
|
||||
#define INTR_ON (1)
|
||||
#define INTR_OFF (0)
|
||||
|
||||
device_ptr_t sc_child;
|
||||
|
||||
struct device *sc_parent; /* parent device */
|
||||
int sc_sltype; /* revision */
|
||||
#define SLTYPE_SL11H (0x00)
|
||||
#define SLTYPE_SL811HS (0x01)
|
||||
#define SLTYPE_SL811HS_R12 SLTYPE_SL811HS
|
||||
#define SLTYPE_SL811HS_R14 (0x02)
|
||||
|
||||
u_int8_t sc_addr; /* device address of root hub */
|
||||
u_int8_t sc_conf;
|
||||
SIMPLEQ_HEAD(, usbd_xfer) sc_free_xfers;
|
||||
|
||||
/* Information for the root hub interrupt pipe */
|
||||
int sc_interval;
|
||||
usbd_xfer_handle sc_intr_xfer;
|
||||
usb_callout_t sc_poll_handle;
|
||||
|
||||
int sc_flags;
|
||||
#define SLF_RESET (0x01)
|
||||
#define SLF_INSERT (0x02)
|
||||
|
||||
/* Root HUB specific members */
|
||||
int sc_fullspeed;
|
||||
int sc_connect; /* XXX */
|
||||
int sc_change;
|
||||
};
|
||||
|
||||
int sl811hs_find(struct slhci_softc *);
|
||||
int slhci_attach(struct slhci_softc *, struct device *);
|
||||
int slhci_intr(void *);
|
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: files.isa,v 1.125 2002/07/17 21:10:30 drochner Exp $
|
||||
# $NetBSD: files.isa,v 1.126 2002/08/11 13:17:54 isaki Exp $
|
||||
#
|
||||
# Config file and device description for machine-independent ISA code.
|
||||
# Included by ports that need it. Requires that the SCSI files be
|
||||
|
@ -477,6 +477,10 @@ device nsclpcsio: sysmon_envsys
|
|||
attach nsclpcsio at isa with nsclpcsio_isa
|
||||
file dev/isa/nsclpcsio_isa.c nsclpcsio_isa
|
||||
|
||||
# USB Controller
|
||||
attach slhci at isa with slhci_isa
|
||||
file dev/isa/slhci_isa.c slhci_isa
|
||||
|
||||
#
|
||||
# ISA Plug 'n Play autoconfiguration glue.
|
||||
# THIS MUST COME AFTER ALL MI ISA DEVICES ARE DEFINED. This is because
|
||||
|
|
|
@ -0,0 +1,131 @@
|
|||
/* $NetBSD: slhci_isa.c,v 1.1 2002/08/11 13:17:54 isaki Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2001 Kiyoshi Ikehara. 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.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by Kiyoshi Ikehara.
|
||||
* 4. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 THE AUTHOR 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* ISA-USB host board
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: slhci_isa.c,v 1.1 2002/08/11 13:17:54 isaki Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/device.h>
|
||||
|
||||
#include <machine/bus.h>
|
||||
#include <machine/cpu.h>
|
||||
|
||||
#include <dev/usb/usb.h>
|
||||
#include <dev/usb/usbdi.h>
|
||||
#include <dev/usb/usbdivar.h>
|
||||
|
||||
#include <dev/ic/sl811hsreg.h>
|
||||
#include <dev/ic/sl811hsvar.h>
|
||||
|
||||
#include <dev/isa/isavar.h>
|
||||
|
||||
struct slhci_isa_softc {
|
||||
struct slhci_softc sc;
|
||||
isa_chipset_tag_t sc_ic;
|
||||
void *sc_ih;
|
||||
};
|
||||
|
||||
static int slhci_isa_match(struct device *, struct cfdata *, void *);
|
||||
static void slhci_isa_attach(struct device *, struct device *, void *);
|
||||
|
||||
struct cfattach slhci_isa_ca = {
|
||||
sizeof(struct slhci_isa_softc), slhci_isa_match, slhci_isa_attach
|
||||
};
|
||||
|
||||
static int
|
||||
slhci_isa_match(struct device *parent, struct cfdata *cf, void *aux)
|
||||
{
|
||||
struct slhci_softc sc;
|
||||
struct isa_attach_args *ia = aux;
|
||||
bus_space_tag_t iot = ia->ia_iot;
|
||||
bus_space_handle_t ioh;
|
||||
int result = 0;
|
||||
|
||||
if (bus_space_map(iot, ia->ia_io[0].ir_addr, SL11_PORTSIZE, 0, &ioh))
|
||||
goto out;
|
||||
|
||||
memset(&sc, 0, sizeof(sc));
|
||||
sc.sc_iot = iot;
|
||||
sc.sc_ioh = ioh;
|
||||
if (sl811hs_find(&sc) >= 0)
|
||||
result = 1;
|
||||
|
||||
bus_space_unmap(iot, ioh, SL11_PORTSIZE);
|
||||
|
||||
out:
|
||||
return (result);
|
||||
}
|
||||
|
||||
static void
|
||||
slhci_isa_attach(struct device *parent, struct device *self, void *aux)
|
||||
{
|
||||
struct slhci_isa_softc *isc = (struct slhci_isa_softc *)self;
|
||||
struct slhci_softc *sc = &isc->sc;
|
||||
struct isa_attach_args *ia = aux;
|
||||
bus_space_tag_t iot = ia->ia_iot;
|
||||
bus_space_handle_t ioh;
|
||||
|
||||
printf("\n");
|
||||
|
||||
/* Map I/O space */
|
||||
if (bus_space_map(iot, ia->ia_io[0].ir_addr, SL11_PORTSIZE, 0, &ioh)) {
|
||||
printf("%s: can't map I/O space\n",
|
||||
sc->sc_bus.bdev.dv_xname);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Initialize sc */
|
||||
sc->sc_iot = iot;
|
||||
sc->sc_ioh = ioh;
|
||||
sc->sc_dmat = ia->ia_dmat;
|
||||
sc->sc_enable_power = NULL;
|
||||
sc->sc_enable_intr = NULL;
|
||||
sc->sc_arg = isc;
|
||||
|
||||
/* Establish the interrupt handler */
|
||||
isc->sc_ih = isa_intr_establish(ia->ia_ic, ia->ia_irq[0].ir_irq,
|
||||
IST_EDGE, IPL_USB, slhci_intr, sc);
|
||||
if (isc->sc_ih == NULL) {
|
||||
printf("%s: can't establish interrupt\n",
|
||||
sc->sc_bus.bdev.dv_xname);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Attach SL811HS/T */
|
||||
if (slhci_attach(sc, self))
|
||||
return;
|
||||
}
|
Loading…
Reference in New Issue