1233556Sjchandra/*-
2233556Sjchandra * Copyright (c) 2003-2012 Broadcom Corporation
3233556Sjchandra * All Rights Reserved
4233556Sjchandra *
5233556Sjchandra * Redistribution and use in source and binary forms, with or without
6233556Sjchandra * modification, are permitted provided that the following conditions
7233556Sjchandra * are met:
8233556Sjchandra *
9233556Sjchandra * 1. Redistributions of source code must retain the above copyright
10233556Sjchandra *    notice, this list of conditions and the following disclaimer.
11233556Sjchandra * 2. Redistributions in binary form must reproduce the above copyright
12233556Sjchandra *    notice, this list of conditions and the following disclaimer in
13233556Sjchandra *    the documentation and/or other materials provided with the
14233556Sjchandra *    distribution.
15233556Sjchandra *
16233556Sjchandra * THIS SOFTWARE IS PROVIDED BY BROADCOM ``AS IS'' AND ANY EXPRESS OR
17233556Sjchandra * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18233556Sjchandra * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19233556Sjchandra * ARE DISCLAIMED. IN NO EVENT SHALL BROADCOM OR CONTRIBUTORS BE LIABLE
20233556Sjchandra * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21233556Sjchandra * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22233556Sjchandra * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
23233556Sjchandra * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
24233556Sjchandra * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
25233556Sjchandra * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
26233556Sjchandra * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27233556Sjchandra */
28233556Sjchandra
29233556Sjchandra#include <sys/cdefs.h>
30233556Sjchandra__FBSDID("$FreeBSD: releng/10.2/sys/mips/nlm/dev/cfi_pci_xlp.c 233556 2012-03-27 15:16:38Z jchandra $");
31233556Sjchandra
32233556Sjchandra#include <sys/param.h>
33233556Sjchandra#include <sys/systm.h>
34233556Sjchandra#include <sys/bus.h>
35233556Sjchandra#include <sys/conf.h>
36233556Sjchandra#include <sys/kernel.h>
37233556Sjchandra#include <sys/module.h>
38233556Sjchandra#include <machine/bus.h>
39233556Sjchandra#include <sys/rman.h>
40233556Sjchandra#include <machine/resource.h>
41233556Sjchandra
42233556Sjchandra#include <dev/pci/pcivar.h>
43233556Sjchandra
44233556Sjchandra#include <dev/cfi/cfi_var.h>
45233556Sjchandra
46233556Sjchandra#include <mips/nlm/hal/haldefs.h>
47233556Sjchandra#include <mips/nlm/hal/iomap.h>
48233556Sjchandra
49233556Sjchandrastatic int cfi_xlp_probe(device_t dev);
50233556Sjchandra
51233556Sjchandrastatic device_method_t cfi_xlp_methods[] = {
52233556Sjchandra	/* Device interface */
53233556Sjchandra	DEVMETHOD(device_probe,		cfi_xlp_probe),
54233556Sjchandra	DEVMETHOD(device_attach,	cfi_attach),
55233556Sjchandra	DEVMETHOD(device_detach,	cfi_detach),
56233556Sjchandra	DEVMETHOD_END
57233556Sjchandra};
58233556Sjchandra
59233556Sjchandrastatic driver_t cfi_xlp_driver = {
60233556Sjchandra	cfi_driver_name,
61233556Sjchandra	cfi_xlp_methods,
62233556Sjchandra	sizeof(struct cfi_softc),
63233556Sjchandra};
64233556Sjchandra
65233556Sjchandrastatic int
66233556Sjchandracfi_xlp_probe(device_t dev)
67233556Sjchandra{
68233556Sjchandra
69233556Sjchandra	if (pci_get_vendor(dev) != PCI_VENDOR_NETLOGIC ||
70233556Sjchandra	    pci_get_device(dev) != PCI_DEVICE_ID_NLM_NOR)
71233556Sjchandra		return (ENXIO);
72233556Sjchandra
73233556Sjchandra	device_set_desc(dev, "Netlogic XLP NOR Bus");
74233556Sjchandra	return (cfi_probe(dev));
75233556Sjchandra}
76233556Sjchandra
77233556SjchandraDRIVER_MODULE(cfi_xlp, pci, cfi_xlp_driver, cfi_devclass, 0, 0);
78