Deleted Added
full compact
musb_otg_atmelarm.c (227849) musb_otg_atmelarm.c (228483)
1/*-
2 * Copyright (c) 2008 Hans Petter Selasky. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.

--- 10 unchanged lines hidden (view full) ---

19 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23 * SUCH DAMAGE.
24 */
25
26#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2008 Hans Petter Selasky. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.

--- 10 unchanged lines hidden (view full) ---

19 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23 * SUCH DAMAGE.
24 */
25
26#include <sys/cdefs.h>
27__FBSDID("$FreeBSD: head/sys/dev/usb/controller/musb_otg_atmelarm.c 227849 2011-11-22 21:56:55Z hselasky $");
27__FBSDID("$FreeBSD: head/sys/dev/usb/controller/musb_otg_atmelarm.c 228483 2011-12-14 00:28:54Z hselasky $");
28
29#include <sys/stdint.h>
30#include <sys/stddef.h>
31#include <sys/param.h>
32#include <sys/queue.h>
33#include <sys/types.h>
34#include <sys/systm.h>
35#include <sys/kernel.h>

--- 21 unchanged lines hidden (view full) ---

57#include <dev/usb/usb_bus.h>
58#include <dev/usb/controller/musb_otg.h>
59
60#include <sys/rman.h>
61
62static device_probe_t musbotg_probe;
63static device_attach_t musbotg_attach;
64static device_detach_t musbotg_detach;
28
29#include <sys/stdint.h>
30#include <sys/stddef.h>
31#include <sys/param.h>
32#include <sys/queue.h>
33#include <sys/types.h>
34#include <sys/systm.h>
35#include <sys/kernel.h>

--- 21 unchanged lines hidden (view full) ---

57#include <dev/usb/usb_bus.h>
58#include <dev/usb/controller/musb_otg.h>
59
60#include <sys/rman.h>
61
62static device_probe_t musbotg_probe;
63static device_attach_t musbotg_attach;
64static device_detach_t musbotg_detach;
65static device_shutdown_t musbotg_shutdown;
66
67struct musbotg_super_softc {
68 struct musbotg_softc sc_otg; /* must be first */
69};
70
71static void
72musbotg_vbus_poll(struct musbotg_super_softc *sc)
73{

--- 139 unchanged lines hidden (view full) ---

213 sc->sc_otg.sc_io_res);
214 sc->sc_otg.sc_io_res = NULL;
215 }
216 usb_bus_mem_free_all(&sc->sc_otg.sc_bus, NULL);
217
218 return (0);
219}
220
65
66struct musbotg_super_softc {
67 struct musbotg_softc sc_otg; /* must be first */
68};
69
70static void
71musbotg_vbus_poll(struct musbotg_super_softc *sc)
72{

--- 139 unchanged lines hidden (view full) ---

212 sc->sc_otg.sc_io_res);
213 sc->sc_otg.sc_io_res = NULL;
214 }
215 usb_bus_mem_free_all(&sc->sc_otg.sc_bus, NULL);
216
217 return (0);
218}
219
221static int
222musbotg_shutdown(device_t dev)
223{
224 struct musbotg_super_softc *sc = device_get_softc(dev);
225 int err;
226
227 err = bus_generic_shutdown(dev);
228 if (err)
229 return (err);
230
231 musbotg_uninit(&sc->sc_otg);
232
233 return (0);
234}
235
236static device_method_t musbotg_methods[] = {
237 /* Device interface */
238 DEVMETHOD(device_probe, musbotg_probe),
239 DEVMETHOD(device_attach, musbotg_attach),
240 DEVMETHOD(device_detach, musbotg_detach),
220static device_method_t musbotg_methods[] = {
221 /* Device interface */
222 DEVMETHOD(device_probe, musbotg_probe),
223 DEVMETHOD(device_attach, musbotg_attach),
224 DEVMETHOD(device_detach, musbotg_detach),
241 DEVMETHOD(device_shutdown, musbotg_shutdown),
225 DEVMETHOD(device_suspend, bus_generic_suspend),
226 DEVMETHOD(device_resume, bus_generic_resume),
227 DEVMETHOD(device_shutdown, bus_generic_shutdown),
242
243 DEVMETHOD_END
244};
245
246static driver_t musbotg_driver = {
228
229 DEVMETHOD_END
230};
231
232static driver_t musbotg_driver = {
247 "musbotg",
248 musbotg_methods,
249 sizeof(struct musbotg_super_softc),
233 .name = "musbotg",
234 .methods = musbotg_methods,
235 .size = sizeof(struct musbotg_super_softc),
250};
251
252static devclass_t musbotg_devclass;
253
254DRIVER_MODULE(musbotg, atmelarm, musbotg_driver, musbotg_devclass, 0, 0);
255MODULE_DEPEND(musbotg, usb, 1, 1, 1);
236};
237
238static devclass_t musbotg_devclass;
239
240DRIVER_MODULE(musbotg, atmelarm, musbotg_driver, musbotg_devclass, 0, 0);
241MODULE_DEPEND(musbotg, usb, 1, 1, 1);