/*-1* SPDX-License-Identifier: BSD-3-Clause2*3* Copyright (c) 2007, Juniper Networks, Inc.4* All rights reserved.5*6* Redistribution and use in source and binary forms, with or without7* modification, are permitted provided that the following conditions8* are met:9* 1. Redistributions of source code must retain the above copyright10* notice, this list of conditions and the following disclaimer.11* 2. Redistributions in binary form must reproduce the above copyright12* notice, this list of conditions and the following disclaimer in the13* documentation and/or other materials provided with the distribution.14* 3. Neither the name of the author nor the names of any co-contributors15* may be used to endorse or promote products derived from this software16* without specific prior written permission.17*18* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR19* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES20* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.21* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,22* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,23* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;24* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED25* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,26* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY27* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF28* SUCH DAMAGE.29*/3031#include <sys/param.h>32#include <sys/systm.h>33#include <sys/bus.h>34#include <sys/conf.h>35#include <sys/kernel.h>36#include <sys/module.h>3738#include <machine/bus.h>3940#include <dev/cfi/cfi_var.h>41#include <dev/ofw/ofw_bus.h>42#include <dev/ofw/ofw_bus_subr.h>4344static int cfi_fdt_probe(device_t);4546static device_method_t cfi_fdt_methods[] = {47/* device interface */48DEVMETHOD(device_probe, cfi_fdt_probe),49DEVMETHOD(device_attach, cfi_attach),50DEVMETHOD(device_detach, cfi_detach),5152DEVMETHOD_END53};5455static driver_t cfi_fdt_driver = {56cfi_driver_name,57cfi_fdt_methods,58sizeof(struct cfi_softc),59};6061DRIVER_MODULE (cfi, lbc, cfi_fdt_driver, 0, 0);62DRIVER_MODULE (cfi, simplebus, cfi_fdt_driver, 0, 0);6364static int65cfi_fdt_probe(device_t dev)66{6768if (!ofw_bus_status_okay(dev))69return (ENXIO);7071if (!ofw_bus_is_compatible(dev, "cfi-flash"))72return (ENXIO);7374return (cfi_probe(dev));75}767778