summaryrefslogtreecommitdiff
path: root/sys/arch/armv7/imx/imxgpio.c
diff options
context:
space:
mode:
authorPatrick Wildt <patrick@cvs.openbsd.org>2018-03-30 19:26:39 +0000
committerPatrick Wildt <patrick@cvs.openbsd.org>2018-03-30 19:26:39 +0000
commitfa00a502706230d6e39968ebc6c9c480f98d2b42 (patch)
treebc5ee968c07577b91f257b2d5eb2bee76bad571d /sys/arch/armv7/imx/imxgpio.c
parent132953e95c50a02282f6db4dfca25cdfa4b034d3 (diff)
Cut down imxgpio(4) with a big axe. There were plenty of pieces that
were not needed anymore since we switched to the FDT-based GPIO code.
Diffstat (limited to 'sys/arch/armv7/imx/imxgpio.c')
-rw-r--r--sys/arch/armv7/imx/imxgpio.c127
1 files changed, 1 insertions, 126 deletions
diff --git a/sys/arch/armv7/imx/imxgpio.c b/sys/arch/armv7/imx/imxgpio.c
index 69a7a2021f9..ad16fbb1c7b 100644
--- a/sys/arch/armv7/imx/imxgpio.c
+++ b/sys/arch/armv7/imx/imxgpio.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: imxgpio.c,v 1.12 2017/06/22 11:34:51 tom Exp $ */
+/* $OpenBSD: imxgpio.c,v 1.13 2018/03/30 19:26:38 patrick Exp $ */
/*
* Copyright (c) 2007,2009 Dale Rahn <drahn@openbsd.org>
* Copyright (c) 2012-2013 Patrick Wildt <patrick@blueri.se>
@@ -29,9 +29,6 @@
#include <machine/fdt.h>
#include <machine/intr.h>
-#include <armv7/armv7/armv7var.h>
-#include <armv7/imx/imxgpiovar.h>
-
#include <dev/ofw/openfirm.h>
#include <dev/ofw/ofw_gpio.h>
#include <dev/ofw/fdt.h>
@@ -72,20 +69,9 @@ struct imxgpio_softc {
struct intrhand *sc_handlers[GPIO_NUM_PINS];
struct interrupt_controller sc_ic;
- unsigned int (*sc_get_bit)(struct imxgpio_softc *sc,
- unsigned int gpio);
- void (*sc_set_bit)(struct imxgpio_softc *sc,
- unsigned int gpio);
- void (*sc_clear_bit)(struct imxgpio_softc *sc,
- unsigned int gpio);
- void (*sc_set_dir)(struct imxgpio_softc *sc,
- unsigned int gpio, unsigned int dir);
struct gpio_controller sc_gc;
};
-#define GPIO_PIN_TO_INST(x) ((x) >> 5)
-#define GPIO_PIN_TO_OFFSET(x) ((x) & 0x1f)
-
int imxgpio_match(struct device *, void *, void *);
void imxgpio_attach(struct device *, struct device *, void *);
@@ -99,12 +85,6 @@ void *imxgpio_intr_establish(void *, int *, int, int (*)(void *),
void imxgpio_intr_disestablish(void *);
void imxgpio_recalc_ipl(struct imxgpio_softc *);
-unsigned int imxgpio_v6_get_bit(struct imxgpio_softc *, unsigned int);
-void imxgpio_v6_set_bit(struct imxgpio_softc *, unsigned int);
-void imxgpio_v6_clear_bit(struct imxgpio_softc *, unsigned int);
-void imxgpio_v6_set_dir(struct imxgpio_softc *, unsigned int, unsigned int);
-unsigned int imxgpio_v6_get_dir(struct imxgpio_softc *, unsigned int);
-
struct cfattach imxgpio_ca = {
sizeof (struct imxgpio_softc), imxgpio_match, imxgpio_attach
@@ -144,11 +124,6 @@ imxgpio_attach(struct device *parent, struct device *self, void *aux)
sc->sc_gc.gc_set_pin = imxgpio_set_pin;
gpio_controller_register(&sc->sc_gc);
- sc->sc_get_bit = imxgpio_v6_get_bit;
- sc->sc_set_bit = imxgpio_v6_set_bit;
- sc->sc_clear_bit = imxgpio_v6_clear_bit;
- sc->sc_set_dir = imxgpio_v6_set_dir;
-
sc->sc_ipl = IPL_NONE;
bus_space_write_4(sc->sc_iot, sc->sc_ioh, GPIO_IMR, 0);
bus_space_write_4(sc->sc_iot, sc->sc_ioh, GPIO_ISR, ~0);
@@ -220,106 +195,6 @@ imxgpio_set_pin(void *cookie, uint32_t *cells, int val)
bus_space_write_4(sc->sc_iot, sc->sc_ioh, GPIO_DR, reg);
}
-unsigned int
-imxgpio_get_bit(unsigned int gpio)
-{
- struct imxgpio_softc *sc = imxgpio_cd.cd_devs[GPIO_PIN_TO_INST(gpio)];
-
- return sc->sc_get_bit(sc, gpio);
-
-}
-
-void
-imxgpio_set_bit(unsigned int gpio)
-{
- struct imxgpio_softc *sc = imxgpio_cd.cd_devs[GPIO_PIN_TO_INST(gpio)];
-
- sc->sc_set_bit(sc, gpio);
-}
-
-void
-imxgpio_clear_bit(unsigned int gpio)
-{
- struct imxgpio_softc *sc = imxgpio_cd.cd_devs[GPIO_PIN_TO_INST(gpio)];
-
- sc->sc_clear_bit(sc, gpio);
-}
-void
-imxgpio_set_dir(unsigned int gpio, unsigned int dir)
-{
- struct imxgpio_softc *sc = imxgpio_cd.cd_devs[GPIO_PIN_TO_INST(gpio)];
-
- sc->sc_set_dir(sc, gpio, dir);
-}
-
-unsigned int
-imxgpio_v6_get_bit(struct imxgpio_softc *sc, unsigned int gpio)
-{
- u_int32_t val;
-
- val = bus_space_read_4(sc->sc_iot, sc->sc_ioh, GPIO_DR);
-
- return (val >> GPIO_PIN_TO_OFFSET(gpio)) & 0x1;
-}
-
-void
-imxgpio_v6_set_bit(struct imxgpio_softc *sc, unsigned int gpio)
-{
- u_int32_t val;
-
- val = bus_space_read_4(sc->sc_iot, sc->sc_ioh, GPIO_DR);
-
- bus_space_write_4(sc->sc_iot, sc->sc_ioh, GPIO_DR,
- val | (1 << GPIO_PIN_TO_OFFSET(gpio)));
-}
-
-void
-imxgpio_v6_clear_bit(struct imxgpio_softc *sc, unsigned int gpio)
-{
- u_int32_t val;
-
- val = bus_space_read_4(sc->sc_iot, sc->sc_ioh, GPIO_DR);
-
- bus_space_write_4(sc->sc_iot, sc->sc_ioh, GPIO_DR,
- val & ~(1 << GPIO_PIN_TO_OFFSET(gpio)));
-}
-
-void
-imxgpio_v6_set_dir(struct imxgpio_softc *sc, unsigned int gpio, unsigned int dir)
-{
- int s;
- u_int32_t val;
-
- s = splhigh();
-
- val = bus_space_read_4(sc->sc_iot, sc->sc_ioh, GPIO_GDIR);
- if (dir == IMXGPIO_DIR_OUT)
- val |= 1 << GPIO_PIN_TO_OFFSET(gpio);
- else
- val &= ~(1 << GPIO_PIN_TO_OFFSET(gpio));
- bus_space_write_4(sc->sc_iot, sc->sc_ioh, GPIO_GDIR, val);
-
- splx(s);
-}
-
-unsigned int
-imxgpio_v6_get_dir(struct imxgpio_softc *sc, unsigned int gpio)
-{
- int s;
- u_int32_t val;
-
- s = splhigh();
-
- val = bus_space_read_4(sc->sc_iot, sc->sc_ioh, GPIO_GDIR);
- if (val & (1 << GPIO_PIN_TO_OFFSET(gpio)))
- val = IMXGPIO_DIR_OUT;
- else
- val = IMXGPIO_DIR_IN;
-
- splx(s);
- return val;
-}
-
int
imxgpio_intr(void *cookie)
{