]> CyberLeo.Net >> Repos - FreeBSD/releng/10.0.git/blob - sys/mips/nlm/dev/cfi_pci_xlp.c
- Copy stable/10 (r259064) to releng/10.0 as part of the
[FreeBSD/releng/10.0.git] / sys / mips / nlm / dev / cfi_pci_xlp.c
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$");
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
49 static int cfi_xlp_probe(device_t dev);
50
51 static 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
59 static driver_t cfi_xlp_driver = {
60         cfi_driver_name,
61         cfi_xlp_methods,
62         sizeof(struct cfi_softc),
63 };
64
65 static int
66 cfi_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
77 DRIVER_MODULE(cfi_xlp, pci, cfi_xlp_driver, cfi_devclass, 0, 0);