Remove GPIO driver attach defer.
This commit is contained in:
parent
9684bbd4f4
commit
af6f2f7b13
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: imx6_gpio.c,v 1.3 2019/11/24 11:07:19 skrll Exp $ */
|
||||
/* $NetBSD: imx6_gpio.c,v 1.4 2019/11/27 07:26:08 hkenken Exp $ */
|
||||
/*-
|
||||
* Copyright (c) 2019 Genetec Corporation. All rights reserved.
|
||||
* Written by Hashimoto Kenichi for Genetec Corporation.
|
||||
@ -25,7 +25,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: imx6_gpio.c,v 1.3 2019/11/24 11:07:19 skrll Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: imx6_gpio.c,v 1.4 2019/11/27 07:26:08 hkenken Exp $");
|
||||
|
||||
#include "opt_fdt.h"
|
||||
#include "gpio.h"
|
||||
@ -123,8 +123,8 @@ imxgpio_attach(device_t parent, device_t self, void *aux)
|
||||
aprint_error_dev(self, "failed to decode interrupt\n");
|
||||
return;
|
||||
}
|
||||
sc->gpio_is = fdtbus_intr_establish(phandle, 0, IPL_HIGH,
|
||||
FDT_INTR_MPSAFE, pic_handle_intr, &sc->gpio_pic);
|
||||
sc->gpio_is = fdtbus_intr_establish(phandle, 0, IPL_HIGH, 0,
|
||||
pic_handle_intr, &sc->gpio_pic);
|
||||
if (sc->gpio_is == NULL) {
|
||||
aprint_error_dev(self, "couldn't establish interrupt on %s\n",
|
||||
intrstr);
|
||||
@ -136,8 +136,8 @@ imxgpio_attach(device_t parent, device_t self, void *aux)
|
||||
aprint_error_dev(self, "failed to decode interrupt\n");
|
||||
return;
|
||||
}
|
||||
sc->gpio_is_high = fdtbus_intr_establish(phandle, 1, IPL_HIGH,
|
||||
FDT_INTR_MPSAFE, pic_handle_intr, &sc->gpio_pic);
|
||||
sc->gpio_is_high = fdtbus_intr_establish(phandle, 1, IPL_HIGH, 0,
|
||||
pic_handle_intr, &sc->gpio_pic);
|
||||
if (sc->gpio_is_high == NULL) {
|
||||
aprint_error_dev(self, "couldn't establish interrupt on %s\n",
|
||||
intrstr);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: imxgpio.c,v 1.6 2019/07/24 12:33:18 hkenken Exp $ */
|
||||
/* $NetBSD: imxgpio.c,v 1.7 2019/11/27 07:26:08 hkenken Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2007 The NetBSD Foundation, Inc.
|
||||
@ -29,7 +29,7 @@
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: imxgpio.c,v 1.6 2019/07/24 12:33:18 hkenken Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: imxgpio.c,v 1.7 2019/11/27 07:26:08 hkenken Exp $");
|
||||
|
||||
#define _INTR_PRIVATE
|
||||
|
||||
@ -288,40 +288,37 @@ imxgpio_pin_ctl(void *arg, int pin, int flags)
|
||||
}
|
||||
|
||||
static void
|
||||
gpio_defer(device_t self)
|
||||
imxgpio_attach_ports(struct imxgpio_softc *gpio)
|
||||
{
|
||||
struct imxgpio_softc * const gpio = device_private(self);
|
||||
struct gpio_chipset_tag * const gp = &gpio->gpio_chipset;
|
||||
struct gpiobus_attach_args gba;
|
||||
gpio_pin_t *pins;
|
||||
uint32_t mask, dir, value;
|
||||
int pin;
|
||||
uint32_t dir;
|
||||
u_int pin;
|
||||
|
||||
gp->gp_cookie = gpio;
|
||||
gp->gp_pin_read = imxgpio_pin_read;
|
||||
gp->gp_pin_write = imxgpio_pin_write;
|
||||
gp->gp_pin_ctl = imxgpio_pin_ctl;
|
||||
|
||||
gba.gba_gc = gp;
|
||||
gba.gba_pins = gpio->gpio_pins;
|
||||
gba.gba_npins = __arraycount(gpio->gpio_pins);
|
||||
|
||||
dir = GPIO_READ(gpio, GPIO_DIR);
|
||||
value = GPIO_READ(gpio, GPIO_DR);
|
||||
for (pin = 0, mask = 1, pins = gpio->gpio_pins;
|
||||
pin < 32; pin++, mask <<= 1, pins++) {
|
||||
for (pin = 0; pin < __arraycount(gpio->gpio_pins); pin++) {
|
||||
uint32_t mask = __BIT(pin);
|
||||
gpio_pin_t *pins = &gpio->gpio_pins[pin];
|
||||
pins->pin_num = pin;
|
||||
if ((gpio->gpio_edge_mask | gpio->gpio_level_mask) & mask)
|
||||
pins->pin_caps = GPIO_PIN_INPUT;
|
||||
else
|
||||
pins->pin_caps = GPIO_PIN_INPUT|GPIO_PIN_OUTPUT;
|
||||
pins->pin_caps = GPIO_PIN_INPUT | GPIO_PIN_OUTPUT;
|
||||
pins->pin_flags =
|
||||
(dir & mask) ? GPIO_PIN_OUTPUT : GPIO_PIN_INPUT;
|
||||
pins->pin_state =
|
||||
(value & mask) ? GPIO_PIN_HIGH : GPIO_PIN_LOW;
|
||||
pins->pin_state = imxgpio_pin_read(gpio, pin);
|
||||
}
|
||||
|
||||
config_found_ia(self, "gpiobus", &gba, gpiobus_print);
|
||||
memset(&gba, 0, sizeof(gba));
|
||||
gba.gba_gc = gp;
|
||||
gba.gba_pins = gpio->gpio_pins;
|
||||
gba.gba_npins = __arraycount(gpio->gpio_pins);
|
||||
config_found_ia(gpio->gpio_dev, "gpiobus", &gba, gpiobus_print);
|
||||
}
|
||||
#endif /* NGPIO > 0 */
|
||||
|
||||
@ -351,7 +348,7 @@ imxgpio_attach_common(device_t self)
|
||||
imxgpio_handles[gpio->gpio_unit] = gpio;
|
||||
|
||||
#if NGPIO > 0
|
||||
config_interrupts(self, gpio_defer);
|
||||
imxgpio_attach_ports(gpio);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: spi.c,v 1.12 2019/08/13 16:37:15 tnn Exp $ */
|
||||
/* $NetBSD: spi.c,v 1.13 2019/11/27 07:26:08 hkenken Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2006 Urbana-Champaign Independent Media Center.
|
||||
@ -42,7 +42,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: spi.c,v 1.12 2019/08/13 16:37:15 tnn Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: spi.c,v 1.13 2019/11/27 07:26:08 hkenken Exp $");
|
||||
|
||||
#include "locators.h"
|
||||
|
||||
@ -239,6 +239,8 @@ spi_direct_attach_child_devices(device_t parent, struct spi_softc *sc,
|
||||
|
||||
memset(&sa, 0, sizeof sa);
|
||||
sa.sa_handle = &sc->sc_slaves[i];
|
||||
sa.sa_prop = child;
|
||||
sa.sa_cookie = cookie;
|
||||
if (ISSET(sa.sa_handle->sh_flags, SPIH_ATTACHED))
|
||||
continue;
|
||||
SET(sa.sa_handle->sh_flags, SPIH_ATTACHED);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: spivar.h,v 1.8 2019/08/13 16:37:15 tnn Exp $ */
|
||||
/* $NetBSD: spivar.h,v 1.9 2019/11/27 07:26:08 hkenken Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2006 Urbana-Champaign Independent Media Center.
|
||||
@ -87,6 +87,8 @@ struct spi_attach_args {
|
||||
ia_compat array */
|
||||
const char ** sa_compat; /* chip names */
|
||||
prop_dictionary_t sa_prop; /* dictionary for this device */
|
||||
|
||||
uintptr_t sa_cookie; /* OF node in openfirmware machines */
|
||||
};
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user