Deleted Added
full compact
ehci_mv.c (227849) ehci_mv.c (228483)
1/*-
2 * Copyright (C) 2008 MARVELL INTERNATIONAL LTD.
3 * All rights reserved.
4 *
5 * Developed by Semihalf.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

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

29 * SUCH DAMAGE.
30 */
31
32/*
33 * FDT attachment driver for the USB Enhanced Host Controller.
34 */
35
36#include <sys/cdefs.h>
1/*-
2 * Copyright (C) 2008 MARVELL INTERNATIONAL LTD.
3 * All rights reserved.
4 *
5 * Developed by Semihalf.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

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

29 * SUCH DAMAGE.
30 */
31
32/*
33 * FDT attachment driver for the USB Enhanced Host Controller.
34 */
35
36#include <sys/cdefs.h>
37__FBSDID("$FreeBSD: head/sys/dev/usb/controller/ehci_mv.c 227849 2011-11-22 21:56:55Z hselasky $");
37__FBSDID("$FreeBSD: head/sys/dev/usb/controller/ehci_mv.c 228483 2011-12-14 00:28:54Z hselasky $");
38
39#include "opt_bus.h"
40
41#include <sys/stdint.h>
42#include <sys/stddef.h>
43#include <sys/param.h>
44#include <sys/queue.h>
45#include <sys/types.h>

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

76#include <arm/mv/mvreg.h>
77#include <arm/mv/mvvar.h>
78
79#define EHCI_VENDORID_MRVL 0x1286
80#define EHCI_HC_DEVSTR "Marvell Integrated USB 2.0 controller"
81
82static device_attach_t mv_ehci_attach;
83static device_detach_t mv_ehci_detach;
38
39#include "opt_bus.h"
40
41#include <sys/stdint.h>
42#include <sys/stddef.h>
43#include <sys/param.h>
44#include <sys/queue.h>
45#include <sys/types.h>

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

76#include <arm/mv/mvreg.h>
77#include <arm/mv/mvvar.h>
78
79#define EHCI_VENDORID_MRVL 0x1286
80#define EHCI_HC_DEVSTR "Marvell Integrated USB 2.0 controller"
81
82static device_attach_t mv_ehci_attach;
83static device_detach_t mv_ehci_detach;
84static device_shutdown_t mv_ehci_shutdown;
85static device_suspend_t mv_ehci_suspend;
86static device_resume_t mv_ehci_resume;
87
88static int err_intr(void *arg);
89
90static struct resource *irq_err;
91static void *ih_err;
92
93/* EHCI HC regs start at this offset within USB range */
94#define MV_USB_HOST_OFST 0x0100
95
96#define USB_BRIDGE_INTR_CAUSE 0x210
97#define USB_BRIDGE_INTR_MASK 0x214
98#define USB_BRIDGE_ERR_ADDR 0x21C
99
100#define MV_USB_ADDR_DECODE_ERR (1 << 0)
101#define MV_USB_HOST_UNDERFLOW (1 << 1)
102#define MV_USB_HOST_OVERFLOW (1 << 2)
103#define MV_USB_DEVICE_UNDERFLOW (1 << 3)
104
105static int
84
85static int err_intr(void *arg);
86
87static struct resource *irq_err;
88static void *ih_err;
89
90/* EHCI HC regs start at this offset within USB range */
91#define MV_USB_HOST_OFST 0x0100
92
93#define USB_BRIDGE_INTR_CAUSE 0x210
94#define USB_BRIDGE_INTR_MASK 0x214
95#define USB_BRIDGE_ERR_ADDR 0x21C
96
97#define MV_USB_ADDR_DECODE_ERR (1 << 0)
98#define MV_USB_HOST_UNDERFLOW (1 << 1)
99#define MV_USB_HOST_OVERFLOW (1 << 2)
100#define MV_USB_DEVICE_UNDERFLOW (1 << 3)
101
102static int
106mv_ehci_suspend(device_t self)
107{
108 ehci_softc_t *sc = device_get_softc(self);
109 int err;
110
111 err = bus_generic_suspend(self);
112 if (err)
113 return (err);
114 ehci_suspend(sc);
115 return (0);
116}
117
118static int
119mv_ehci_resume(device_t self)
120{
121 ehci_softc_t *sc = device_get_softc(self);
122
123 ehci_resume(sc);
124
125 bus_generic_resume(self);
126
127 return (0);
128}
129
130static int
131mv_ehci_shutdown(device_t self)
132{
133 ehci_softc_t *sc = device_get_softc(self);
134 int err;
135
136 err = bus_generic_shutdown(self);
137 if (err)
138 return (err);
139 ehci_shutdown(sc);
140
141 return (0);
142}
143
144static int
145mv_ehci_probe(device_t self)
146{
147
148 if (!ofw_bus_is_compatible(self, "mrvl,usb-ehci"))
149 return (ENXIO);
150
151 device_set_desc(self, EHCI_HC_DEVSTR);
152

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

367 return (FILTER_HANDLED);
368}
369
370static device_method_t ehci_methods[] = {
371 /* Device interface */
372 DEVMETHOD(device_probe, mv_ehci_probe),
373 DEVMETHOD(device_attach, mv_ehci_attach),
374 DEVMETHOD(device_detach, mv_ehci_detach),
103mv_ehci_probe(device_t self)
104{
105
106 if (!ofw_bus_is_compatible(self, "mrvl,usb-ehci"))
107 return (ENXIO);
108
109 device_set_desc(self, EHCI_HC_DEVSTR);
110

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

325 return (FILTER_HANDLED);
326}
327
328static device_method_t ehci_methods[] = {
329 /* Device interface */
330 DEVMETHOD(device_probe, mv_ehci_probe),
331 DEVMETHOD(device_attach, mv_ehci_attach),
332 DEVMETHOD(device_detach, mv_ehci_detach),
375 DEVMETHOD(device_suspend, mv_ehci_suspend),
376 DEVMETHOD(device_resume, mv_ehci_resume),
377 DEVMETHOD(device_shutdown, mv_ehci_shutdown),
333 DEVMETHOD(device_suspend, bus_generic_suspend),
334 DEVMETHOD(device_resume, bus_generic_resume),
335 DEVMETHOD(device_shutdown, bus_generic_shutdown),
378
379 DEVMETHOD_END
380};
381
382static driver_t ehci_driver = {
383 "ehci",
384 ehci_methods,
385 sizeof(ehci_softc_t),
386};
387
388static devclass_t ehci_devclass;
389
390DRIVER_MODULE(ehci, simplebus, ehci_driver, ehci_devclass, 0, 0);
391MODULE_DEPEND(ehci, usb, 1, 1, 1);
336
337 DEVMETHOD_END
338};
339
340static driver_t ehci_driver = {
341 "ehci",
342 ehci_methods,
343 sizeof(ehci_softc_t),
344};
345
346static devclass_t ehci_devclass;
347
348DRIVER_MODULE(ehci, simplebus, ehci_driver, ehci_devclass, 0, 0);
349MODULE_DEPEND(ehci, usb, 1, 1, 1);