Esempio n. 1
0
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
}
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
}