1102714Sphk/*- 2102714Sphk * Copyright (c) 2002 Poul-Henning Kamp. All rights reserved. 3102714Sphk * 4102714Sphk * Redistribution and use in source and binary forms, with or without 5102714Sphk * modification, are permitted provided that the following conditions 6102714Sphk * are met: 7102714Sphk * 1. Redistributions of source code must retain the above copyright 8102714Sphk * notice unmodified, this list of conditions, and the following 9102714Sphk * disclaimer. 10102714Sphk * 2. Redistributions in binary form must reproduce the above copyright 11102714Sphk * notice, this list of conditions and the following disclaimer in the 12102714Sphk * documentation and/or other materials provided with the distribution. 13102714Sphk * 14102714Sphk * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 15102714Sphk * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 16102714Sphk * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 17102714Sphk * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 18102714Sphk * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 19102714Sphk * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 20102714Sphk * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 21102714Sphk * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22102714Sphk * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 23102714Sphk * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24102714Sphk * 25102714Sphk */ 26102714Sphk 27119418Sobrien#include <sys/cdefs.h> 28119418Sobrien__FBSDID("$FreeBSD$"); 29119418Sobrien 30102714Sphk#include <sys/param.h> 31102714Sphk#include <sys/systm.h> 32102714Sphk#include <sys/kernel.h> 33129879Sphk#include <sys/module.h> 34102714Sphk#include <sys/bus.h> 35102714Sphk#include <sys/conf.h> 36102714Sphk#include <sys/malloc.h> 37263109Srstone#include <sys/sysctl.h> 38102714Sphk 39102714Sphk#include <machine/bus.h> 40102714Sphk#include <machine/resource.h> 41102714Sphk#include <sys/rman.h> 42102714Sphk 43102714Sphk#include <dev/pccard/pccardvar.h> 44102714Sphk 45160030Sobrien#include <dev/puc/puc_cfg.h> 46158124Smarcel#include <dev/puc/puc_bfe.h> 47102714Sphk 48158124Smarcel/* http://www.argosy.com.tw/product/sp320.htm */ 49158124Smarcelconst struct puc_cfg puc_pccard_rscom = { 50158124Smarcel 0, 0, 0, 0, 51102897Sphk "ARGOSY SP320 Dual port serial PCMCIA", 52158124Smarcel DEFAULT_RCLK, 53158124Smarcel PUC_PORT_2S, 0, 1, 0, 54102714Sphk}; 55102714Sphk 56102714Sphkstatic int 57102714Sphkpuc_pccard_probe(device_t dev) 58102714Sphk{ 59121604Simp const char *vendor, *product; 60102714Sphk int error; 61102714Sphk 62102714Sphk error = pccard_get_vendor_str(dev, &vendor); 63102714Sphk if (error) 64102714Sphk return(error); 65102714Sphk error = pccard_get_product_str(dev, &product); 66102714Sphk if (error) 67102714Sphk return(error); 68158124Smarcel if (!strcmp(vendor, "PCMCIA") && !strcmp(product, "RS-COM 2P")) 69158124Smarcel return (puc_bfe_probe(dev, &puc_pccard_rscom)); 70102714Sphk 71102714Sphk return (ENXIO); 72102714Sphk} 73102714Sphk 74102714Sphkstatic device_method_t puc_pccard_methods[] = { 75102714Sphk /* Device interface */ 76102714Sphk DEVMETHOD(device_probe, puc_pccard_probe), 77158124Smarcel DEVMETHOD(device_attach, puc_bfe_attach), 78158124Smarcel DEVMETHOD(device_detach, puc_bfe_detach), 79102714Sphk 80158124Smarcel DEVMETHOD(bus_alloc_resource, puc_bus_alloc_resource), 81158124Smarcel DEVMETHOD(bus_release_resource, puc_bus_release_resource), 82158124Smarcel DEVMETHOD(bus_get_resource, puc_bus_get_resource), 83158124Smarcel DEVMETHOD(bus_read_ivar, puc_bus_read_ivar), 84158124Smarcel DEVMETHOD(bus_setup_intr, puc_bus_setup_intr), 85158124Smarcel DEVMETHOD(bus_teardown_intr, puc_bus_teardown_intr), 86223091Sjhb DEVMETHOD(bus_print_child, puc_bus_print_child), 87223091Sjhb DEVMETHOD(bus_child_pnpinfo_str, puc_bus_child_pnpinfo_str), 88223091Sjhb DEVMETHOD(bus_child_location_str, puc_bus_child_location_str), 89227843Smarius 90227843Smarius DEVMETHOD_END 91102714Sphk}; 92102714Sphk 93102714Sphkstatic driver_t puc_pccard_driver = { 94158124Smarcel puc_driver_name, 95102714Sphk puc_pccard_methods, 96102714Sphk sizeof(struct puc_softc), 97102714Sphk}; 98102714Sphk 99102714SphkDRIVER_MODULE(puc, pccard, puc_pccard_driver, puc_devclass, 0, 0); 100