void lcd_attach( device_t parent, device_t self, void *aux ) { struct imx51_ipuv3_softc *sc = device_private(self); struct axi_attach_args *axia = aux; bus_space_tag_t iot = axia->aa_iot; sc->dev = self; /* XXX move this to imx51_ipuv3.c */ { bus_space_handle_t mipi_ioh; uint32_t reg; if (bus_space_map(iot, 0x83fdc000, 0x1000, 0, &mipi_ioh)) aprint_error_dev(self, "can't map MIPI HSC"); else { bus_space_write_4(iot, mipi_ioh, 0x000, 0xf00); reg = bus_space_read_4(iot, mipi_ioh, 0x800); bus_space_write_4(iot, mipi_ioh, 0x800, reg | 0x0ff); reg = bus_space_read_4(iot, mipi_ioh, 0x800); bus_space_write_4(iot, mipi_ioh, 0x800, reg | 0x10000); } } /* LCD power on */ gpio_set_direction(GPIO_NO(4, 9), GPIO_DIR_OUT); gpio_set_direction(GPIO_NO(4, 10), GPIO_DIR_OUT); gpio_set_direction(GPIO_NO(3, 3), GPIO_DIR_OUT); gpio_data_write(GPIO_NO(3, 3), 1); gpio_data_write(GPIO_NO(4, 9), 1); delay(180 * 1000); gpio_data_write(GPIO_NO(4, 10), 1); gpio_set_direction(GPIO_NO(2, 13), GPIO_DIR_OUT); gpio_data_write(GPIO_NO(2, 13), 1); imx51_ipuv3_attach_sub(sc, aux, &sharp_panel); #if NWSDISPLAY == 0 struct imx51_ipuv3_screen *screen; int error; error = imx51_ipuv3_new_screen(sc, &screen); #ifdef LCD_DEBUG draw_test_pattern(sc, screen); #endif if (error == 0) { sc->active = screen; imx51_ipuv3_start_dma(sc, screen); } #endif }
static void sdhc_set_gpio_cd(struct sdhc_axi_softc *sc, const char *name) { prop_dictionary_t dict; const char *pin_data; int grp, pin; dict = device_properties(sc->sc_sdhc.sc_dev); if (!prop_dictionary_get_cstring_nocopy(dict, name, &pin_data)) return; /* * "!1,6" -> gpio_cd = GPIO_NO(1,6), gpio_cd_low_active = 1 * "3,31" -> gpio_cd = GPIO_NO(3,31), gpio_cd_low_active = 0 * "!" -> always not detected * none -> always detected */ if (*pin_data == '!') { sc->sc_gpio_cd_low_active = 1; pin_data++; } else sc->sc_gpio_cd_low_active = 0; sc->sc_gpio_cd = -1; if (*pin_data == '\0') return; for (grp = 0; (*pin_data >= '0') && (*pin_data <= '9'); pin_data++) grp = grp * 10 + *pin_data - '0'; KASSERT(*pin_data == ','); pin_data++; for (pin = 0; (*pin_data >= '0') && (*pin_data <= '9'); pin_data++) pin = pin * 10 + *pin_data - '0'; KASSERT(*pin_data == '\0'); sc->sc_gpio_cd = GPIO_NO(grp, pin); #if NIMXGPIO > 0 gpio_set_direction(sc->sc_gpio_cd, GPIO_DIR_IN); #endif }
void lcd_attach( device_t parent, device_t self, void *aux ) { struct imx51_ipuv3_softc *sc = device_private(self); struct axi_attach_args *axia = aux; bus_space_tag_t iot = axia->aa_iot; sc->dev = self; #if defined(IMXIPUCONSOLE) netwalker_lcd_console = 1; #endif #if (NWSDISPLAY > 0) netwalker_cnattach(); #endif /* XXX move this to imx51_ipuv3.c */ { bus_space_handle_t mipi_ioh; uint32_t reg; if (bus_space_map(iot, 0x83fdc000, 0x1000, 0, &mipi_ioh)) aprint_error_dev(self, "can't map MIPI HSC"); else { bus_space_write_4(iot, mipi_ioh, 0x000, 0xf00); reg = bus_space_read_4(iot, mipi_ioh, 0x800); bus_space_write_4(iot, mipi_ioh, 0x800, reg | 0x0ff); reg = bus_space_read_4(iot, mipi_ioh, 0x800); bus_space_write_4(iot, mipi_ioh, 0x800, reg | 0x10000); } } /* LCD power on */ gpio_set_direction(GPIO_NO(4, 9), GPIO_DIR_OUT); gpio_set_direction(GPIO_NO(4, 10), GPIO_DIR_OUT); gpio_set_direction(GPIO_NO(3, 3), GPIO_DIR_OUT); gpio_data_write(GPIO_NO(3, 3), 1); gpio_data_write(GPIO_NO(4, 9), 1); delay(180 * 1000); gpio_data_write(GPIO_NO(4, 10), 1); gpio_set_direction(GPIO_NO(2, 13), GPIO_DIR_OUT); gpio_data_write(GPIO_NO(2, 13), 1); imx51_ipuv3_attach_sub(sc, aux, &sharp_panel); #if NWSDISPLAY == 0 struct imx51_ipuv3_screen *screen; int error; error = imx51_ipuv3_new_screen(sc, 16, &screen); #ifdef LCD_DEBUG draw_test_pattern(sc, screen); #endif if (error == 0) { sc->active = screen; imx51_ipuv3_start_dma(sc, screen); } #else struct wsemuldisplaydev_attach_args aa; #if defined(IMXIPUCONSOLE) aa.console = true; #else aa.console = false; #endif aa.scrdata = &netwalker_lcd_screen_list; aa.accessops = &netwalker_lcd_accessops; aa.accesscookie = &sc->vd; (void) config_found(sc->dev, &aa, wsemuldisplaydevprint); #endif }