Example #1
0
static void
rk30_gpio_set_pud(struct rk30_gpio_softc *sc, uint32_t pin, uint32_t state)
{
	uint32_t pud;

	/* Must be called with lock held. */
	RK30_GPIO_LOCK_ASSERT(sc);
	switch (state) {
	case GPIO_PIN_PULLUP:
		pud = RK30_GPIO_PULLUP;
		break;
	case GPIO_PIN_PULLDOWN:
		pud = RK30_GPIO_PULLDOWN;
		break;
	default:
		pud = RK30_GPIO_NONE;
	}
	/*
	 * The pull up/down registers for GPIO0A and half of GPIO0B
	 * (the first 12 pins on bank 0) are at a different location.
	 */
	if (sc->sc_bank == 0 && pin < 12)
		rk30_pmu_gpio_pud(pin, pud);
	else
		rk30_grf_gpio_pud(sc->sc_bank, pin, pud);
}
Example #2
0
static void
rk30_gpio_set_pud(struct rk30_gpio_softc *sc, uint32_t pin, uint32_t state)
{
	uint32_t bank;

	bank = pin / 32;

	/* Must be called with lock held. */
	RK30_GPIO_LOCK_ASSERT(sc);

	if (bank == 0 && pin < 12)
		rk30_pmu_gpio_pud(pin, state);
	else
		rk30_grf_gpio_pud(bank, pin, state);
}