Lines Matching +full:non +full:- +full:inverted

1 /*-
67 sdhci_handle_card_present(gpio->slot, sdhci_fdt_gpio_get_present(gpio)); in cd_intr()
80 dev = gpio->dev; in cd_setup()
83 * If the device is flagged as non-removable, set that slot option, and in cd_setup()
86 if (OF_hasprop(node, "non-removable")) { in cd_setup()
87 gpio->slot->opt |= SDHCI_NON_REMOVABLE; in cd_setup()
88 gpio->cd_disabled = true; in cd_setup()
90 device_printf(dev, "Non-removable media\n"); in cd_setup()
95 * If there is no cd-gpios property, then presumably the hardware in cd_setup()
102 if (gpio_pin_get_by_ofw_property(dev, node, "cd-gpios", &gpio->cd_pin)) in cd_setup()
105 if (gpio_pin_getcaps(gpio->cd_pin, &pincaps) != 0 || in cd_setup()
107 device_printf(dev, "Cannot read card-detect gpio pin; " in cd_setup()
108 "setting card-always-present flag.\n"); in cd_setup()
109 gpio->cd_disabled = true; in cd_setup()
113 if (OF_hasprop(node, "cd-inverted")) in cd_setup()
114 gpio->cd_inverted = true; in cd_setup()
131 if ((gpio->cd_ires = gpio_alloc_intr_resource(dev, &gpio->cd_irid, in cd_setup()
132 RF_ACTIVE, gpio->cd_pin, GPIO_INTR_EDGE_BOTH)) == NULL) { in cd_setup()
139 if (bus_setup_intr(dev, gpio->cd_ires, INTR_TYPE_BIO | INTR_MPSAFE, in cd_setup()
140 NULL, cd_intr, gpio, &gpio->cd_ihandler) != 0) { in cd_setup()
141 device_printf(dev, "Unable to setup card-detect irq handler\n"); in cd_setup()
142 gpio->cd_ihandler = NULL; in cd_setup()
152 if (gpio->cd_ihandler == NULL) { in cd_setup()
154 gpio->slot->quirks |= SDHCI_QUIRK_POLL_CARD_PRESENT; in cd_setup()
162 device_get_nameunit(gpio->cd_pin->dev), gpio->cd_pin->pin, in cd_setup()
175 dev = gpio->dev; in wp_setup()
177 if (OF_hasprop(node, "wp-disable")) { in wp_setup()
178 gpio->wp_disabled = true; in wp_setup()
184 if (gpio_pin_get_by_ofw_property(dev, node, "wp-gpios", &gpio->wp_pin)) in wp_setup()
187 if (OF_hasprop(node, "wp-inverted")) in wp_setup()
188 gpio->wp_inverted = true; in wp_setup()
192 device_get_nameunit(gpio->wp_pin->dev), gpio->wp_pin->pin); in wp_setup()
202 gpio->dev = dev; in sdhci_fdt_gpio_setup()
203 gpio->slot = slot; in sdhci_fdt_gpio_setup()
220 if (gpio->cd_ihandler != NULL) in sdhci_fdt_gpio_teardown()
221 bus_teardown_intr(gpio->dev, gpio->cd_ires, gpio->cd_ihandler); in sdhci_fdt_gpio_teardown()
222 if (gpio->wp_pin != NULL) in sdhci_fdt_gpio_teardown()
223 gpio_pin_release(gpio->wp_pin); in sdhci_fdt_gpio_teardown()
224 if (gpio->cd_pin != NULL) in sdhci_fdt_gpio_teardown()
225 gpio_pin_release(gpio->cd_pin); in sdhci_fdt_gpio_teardown()
226 if (gpio->cd_ires != NULL) in sdhci_fdt_gpio_teardown()
227 bus_release_resource(gpio->dev, SYS_RES_IRQ, 0, gpio->cd_ires); in sdhci_fdt_gpio_teardown()
237 if (gpio->cd_disabled) in sdhci_fdt_gpio_get_present()
240 if (gpio->cd_pin == NULL) in sdhci_fdt_gpio_get_present()
241 return (sdhci_generic_get_card_present(gpio->slot->bus, in sdhci_fdt_gpio_get_present()
242 gpio->slot)); in sdhci_fdt_gpio_get_present()
244 gpio_pin_is_active(gpio->cd_pin, &pinstate); in sdhci_fdt_gpio_get_present()
246 return (pinstate ^ gpio->cd_inverted); in sdhci_fdt_gpio_get_present()
254 if (gpio->wp_disabled) in sdhci_fdt_gpio_get_readonly()
257 if (gpio->wp_pin == NULL) in sdhci_fdt_gpio_get_readonly()
258 return (sdhci_generic_get_ro(gpio->slot->bus, gpio->slot->dev)); in sdhci_fdt_gpio_get_readonly()
260 gpio_pin_is_active(gpio->wp_pin, &pinstate); in sdhci_fdt_gpio_get_readonly()
262 return (pinstate ^ gpio->wp_inverted); in sdhci_fdt_gpio_get_readonly()