1188087Ssam/*-
2249072Sbrooks * Copyright (c) 2012 SRI International
3188089Ssam * Copyright (c) 2009 Roelof Jonkman, Carlson Wireless Inc.
4188087Ssam * Copyright (c) 2009 Sam Leffler, Errno Consulting
5188087Ssam * All rights reserved.
6188087Ssam *
7255207Sbrooks * Portions of this software were developed by SRI International and the
8255207Sbrooks * University of Cambridge Computer Laboratory under DARPA/AFRL contract
9255207Sbrooks * (FA8750-10-C-0237) ("CTSRD"), as part of the DARPA CRASH research
10255207Sbrooks * programme.
11255207Sbrooks *
12188087Ssam * Redistribution and use in source and binary forms, with or without
13188087Ssam * modification, are permitted provided that the following conditions
14188087Ssam * are met:
15188087Ssam * 1. Redistributions of source code must retain the above copyright
16188087Ssam *    notice, this list of conditions and the following disclaimer.
17188087Ssam * 2. Redistributions in binary form must reproduce the above copyright
18188087Ssam *    notice, this list of conditions and the following disclaimer in the
19188087Ssam *    documentation and/or other materials provided with the distribution.
20188087Ssam *
21188087Ssam * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
22188087Ssam * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
23188087Ssam * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
24188087Ssam * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
25188087Ssam * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
26188087Ssam * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27188087Ssam * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28188087Ssam * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29188087Ssam * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
30188087Ssam * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31188087Ssam */
32188087Ssam
33188087Ssam#include <sys/cdefs.h>
34188087Ssam__FBSDID("$FreeBSD$");
35188087Ssam
36188087Ssam#include <sys/param.h>
37188087Ssam#include <sys/systm.h>
38188087Ssam#include <sys/bus.h>
39188087Ssam#include <sys/conf.h>
40188087Ssam#include <sys/kernel.h>
41188087Ssam#include <sys/malloc.h>
42188087Ssam#include <sys/module.h>
43188087Ssam#include <sys/rman.h>
44188087Ssam#include <sys/sysctl.h>
45188087Ssam
46188087Ssam#include <machine/bus.h>
47188087Ssam
48188087Ssam#include <dev/cfi/cfi_var.h>
49188087Ssam
50188087Ssamstatic int
51249072Sbrookscfi_nexus_probe(device_t dev)
52188087Ssam{
53256900Snwhitehorn	return (BUS_PROBE_NOWILDCARD);
54256900Snwhitehorn}
55249072Sbrooks
56256900Snwhitehornstatic int
57256900Snwhitehorncfi_nexus_attach(device_t dev)
58256900Snwhitehorn{
59256900Snwhitehorn	int error;
60256900Snwhitehorn
61256900Snwhitehorn	error = cfi_probe(dev);
62256900Snwhitehorn	if (error != 0)
63256900Snwhitehorn		return (error);
64256900Snwhitehorn
65256900Snwhitehorn	return cfi_attach(dev);
66188087Ssam}
67188087Ssam
68249072Sbrooksstatic device_method_t cfi_nexus_methods[] = {
69188087Ssam	/* device interface */
70249072Sbrooks	DEVMETHOD(device_probe,		cfi_nexus_probe),
71256900Snwhitehorn	DEVMETHOD(device_attach,	cfi_nexus_attach),
72188087Ssam	DEVMETHOD(device_detach,	cfi_detach),
73188087Ssam
74249072Sbrooks	{0, 0}
75188087Ssam};
76188087Ssam
77249072Sbrooksstatic driver_t cfi_nexus_driver = {
78188087Ssam	cfi_driver_name,
79249072Sbrooks	cfi_nexus_methods,
80188087Ssam	sizeof(struct cfi_softc),
81188087Ssam};
82249072SbrooksDRIVER_MODULE(cfi, nexus, cfi_nexus_driver, cfi_devclass, 0, 0);
83