cfi_pci_xlp.c revision 285830
1/*- 2 * Copyright (c) 2003-2012 Broadcom Corporation 3 * All Rights Reserved 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 9 * 1. Redistributions of source code must retain the above copyright 10 * notice, this list of conditions and the following disclaimer. 11 * 2. Redistributions in binary form must reproduce the above copyright 12 * notice, this list of conditions and the following disclaimer in 13 * the documentation and/or other materials provided with the 14 * distribution. 15 * 16 * THIS SOFTWARE IS PROVIDED BY BROADCOM ``AS IS'' AND ANY EXPRESS OR 17 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 * ARE DISCLAIMED. IN NO EVENT SHALL BROADCOM OR CONTRIBUTORS BE LIABLE 20 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 23 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 24 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 25 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 26 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 */ 28 29#include <sys/cdefs.h> 30__FBSDID("$FreeBSD: releng/10.2/sys/mips/nlm/dev/cfi_pci_xlp.c 233556 2012-03-27 15:16:38Z jchandra $"); 31 32#include <sys/param.h> 33#include <sys/systm.h> 34#include <sys/bus.h> 35#include <sys/conf.h> 36#include <sys/kernel.h> 37#include <sys/module.h> 38#include <machine/bus.h> 39#include <sys/rman.h> 40#include <machine/resource.h> 41 42#include <dev/pci/pcivar.h> 43 44#include <dev/cfi/cfi_var.h> 45 46#include <mips/nlm/hal/haldefs.h> 47#include <mips/nlm/hal/iomap.h> 48 49static int cfi_xlp_probe(device_t dev); 50 51static device_method_t cfi_xlp_methods[] = { 52 /* Device interface */ 53 DEVMETHOD(device_probe, cfi_xlp_probe), 54 DEVMETHOD(device_attach, cfi_attach), 55 DEVMETHOD(device_detach, cfi_detach), 56 DEVMETHOD_END 57}; 58 59static driver_t cfi_xlp_driver = { 60 cfi_driver_name, 61 cfi_xlp_methods, 62 sizeof(struct cfi_softc), 63}; 64 65static int 66cfi_xlp_probe(device_t dev) 67{ 68 69 if (pci_get_vendor(dev) != PCI_VENDOR_NETLOGIC || 70 pci_get_device(dev) != PCI_DEVICE_ID_NLM_NOR) 71 return (ENXIO); 72 73 device_set_desc(dev, "Netlogic XLP NOR Bus"); 74 return (cfi_probe(dev)); 75} 76 77DRIVER_MODULE(cfi_xlp, pci, cfi_xlp_driver, cfi_devclass, 0, 0); 78