Deleted Added
full compact
a10_gpio.c (274670) a10_gpio.c (277968)
1/*-
2 * Copyright (c) 2013 Ganbold Tsagaankhuu <ganbold@freebsd.org>
3 * Copyright (c) 2012 Oleksandr Tymoshenko <gonzo@freebsd.org>
4 * Copyright (c) 2012 Luiz Otavio O Souza.
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

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

22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE.
27 *
28 */
29#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2013 Ganbold Tsagaankhuu <ganbold@freebsd.org>
3 * Copyright (c) 2012 Oleksandr Tymoshenko <gonzo@freebsd.org>
4 * Copyright (c) 2012 Luiz Otavio O Souza.
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

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

22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE.
27 *
28 */
29#include <sys/cdefs.h>
30__FBSDID("$FreeBSD: head/sys/arm/allwinner/a10_gpio.c 274670 2014-11-18 17:22:08Z loos $");
30__FBSDID("$FreeBSD: head/sys/arm/allwinner/a10_gpio.c 277968 2015-01-31 12:17:07Z loos $");
31
32#include <sys/param.h>
33#include <sys/systm.h>
34#include <sys/bus.h>
35
36#include <sys/kernel.h>
37#include <sys/module.h>
38#include <sys/rman.h>

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

422
423 mtx_init(&sc->sc_mtx, "a10 gpio", "gpio", MTX_DEF);
424
425 rid = 0;
426 sc->sc_mem_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid,
427 RF_ACTIVE);
428 if (!sc->sc_mem_res) {
429 device_printf(dev, "cannot allocate memory window\n");
31
32#include <sys/param.h>
33#include <sys/systm.h>
34#include <sys/bus.h>
35
36#include <sys/kernel.h>
37#include <sys/module.h>
38#include <sys/rman.h>

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

422
423 mtx_init(&sc->sc_mtx, "a10 gpio", "gpio", MTX_DEF);
424
425 rid = 0;
426 sc->sc_mem_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid,
427 RF_ACTIVE);
428 if (!sc->sc_mem_res) {
429 device_printf(dev, "cannot allocate memory window\n");
430 return (ENXIO);
430 goto fail;
431 }
432
433 sc->sc_bst = rman_get_bustag(sc->sc_mem_res);
434 sc->sc_bsh = rman_get_bushandle(sc->sc_mem_res);
435
436 rid = 0;
437 sc->sc_irq_res = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid,
438 RF_ACTIVE);
439 if (!sc->sc_irq_res) {
431 }
432
433 sc->sc_bst = rman_get_bustag(sc->sc_mem_res);
434 sc->sc_bsh = rman_get_bushandle(sc->sc_mem_res);
435
436 rid = 0;
437 sc->sc_irq_res = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid,
438 RF_ACTIVE);
439 if (!sc->sc_irq_res) {
440 bus_release_resource(dev, SYS_RES_MEMORY, 0, sc->sc_mem_res);
441 device_printf(dev, "cannot allocate interrupt\n");
440 device_printf(dev, "cannot allocate interrupt\n");
442 return (ENXIO);
441 goto fail;
443 }
444
445 /* Find our node. */
446 gpio = ofw_bus_get_node(sc->sc_dev);
447
448 if (!OF_hasprop(gpio, "gpio-controller"))
449 /* Node is not a GPIO controller. */
450 goto fail;

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

467
468 return (bus_generic_attach(dev));
469
470fail:
471 if (sc->sc_irq_res)
472 bus_release_resource(dev, SYS_RES_IRQ, 0, sc->sc_irq_res);
473 if (sc->sc_mem_res)
474 bus_release_resource(dev, SYS_RES_MEMORY, 0, sc->sc_mem_res);
442 }
443
444 /* Find our node. */
445 gpio = ofw_bus_get_node(sc->sc_dev);
446
447 if (!OF_hasprop(gpio, "gpio-controller"))
448 /* Node is not a GPIO controller. */
449 goto fail;

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

466
467 return (bus_generic_attach(dev));
468
469fail:
470 if (sc->sc_irq_res)
471 bus_release_resource(dev, SYS_RES_IRQ, 0, sc->sc_irq_res);
472 if (sc->sc_mem_res)
473 bus_release_resource(dev, SYS_RES_MEMORY, 0, sc->sc_mem_res);
474 mtx_destroy(&sc->sc_mtx);
475
475 return (ENXIO);
476}
477
478static int
479a10_gpio_detach(device_t dev)
480{
481
482 return (EBUSY);

--- 46 unchanged lines hidden ---
476 return (ENXIO);
477}
478
479static int
480a10_gpio_detach(device_t dev)
481{
482
483 return (EBUSY);

--- 46 unchanged lines hidden ---