|
@@ -452,3 +452,157 @@ static struct spi_board_info __initdata htcherald_spi_board_info[] = {
|
|
|
.chip_select = 1,
|
|
|
}
|
|
|
};
|
|
|
+
|
|
|
+/*
|
|
|
+ * Init functions from here on
|
|
|
+ */
|
|
|
+
|
|
|
+static void __init htcherald_lcd_init(void)
|
|
|
+{
|
|
|
+ u32 reg;
|
|
|
+ unsigned int tries = 200;
|
|
|
+
|
|
|
+ /* disable controller if active */
|
|
|
+ reg = omap_readl(OMAP_LCDC_CONTROL);
|
|
|
+ if (reg & OMAP_LCDC_CTRL_LCD_EN) {
|
|
|
+ reg &= ~OMAP_LCDC_CTRL_LCD_EN;
|
|
|
+ omap_writel(reg, OMAP_LCDC_CONTROL);
|
|
|
+
|
|
|
+ /* wait for end of frame */
|
|
|
+ while (!(omap_readl(OMAP_LCDC_STATUS) & OMAP_LCDC_STAT_DONE)) {
|
|
|
+ tries--;
|
|
|
+ if (!tries)
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ if (!tries)
|
|
|
+ pr_err("Timeout waiting for end of frame -- LCD may not be available\n");
|
|
|
+
|
|
|
+ /* turn off DMA */
|
|
|
+ reg = omap_readw(OMAP_DMA_LCD_CCR);
|
|
|
+ reg &= ~(1 << 7);
|
|
|
+ omap_writew(reg, OMAP_DMA_LCD_CCR);
|
|
|
+
|
|
|
+ reg = omap_readw(OMAP_DMA_LCD_CTRL);
|
|
|
+ reg &= ~(1 << 8);
|
|
|
+ omap_writew(reg, OMAP_DMA_LCD_CTRL);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+static void __init htcherald_map_io(void)
|
|
|
+{
|
|
|
+ omap7xx_map_io();
|
|
|
+
|
|
|
+ /*
|
|
|
+ * The LCD panel must be disabled and DMA turned off here, as doing
|
|
|
+ * it later causes the LCD never to reinitialize.
|
|
|
+ */
|
|
|
+ htcherald_lcd_init();
|
|
|
+
|
|
|
+ printk(KERN_INFO "htcherald_map_io done.\n");
|
|
|
+}
|
|
|
+
|
|
|
+static void __init htcherald_disable_watchdog(void)
|
|
|
+{
|
|
|
+ /* Disable watchdog if running */
|
|
|
+ if (omap_readl(OMAP_WDT_TIMER_MODE) & 0x8000) {
|
|
|
+ /*
|
|
|
+ * disable a potentially running watchdog timer before
|
|
|
+ * it kills us.
|
|
|
+ */
|
|
|
+ printk(KERN_WARNING "OMAP850 Watchdog seems to be activated, disabling it for now.\n");
|
|
|
+ omap_writel(0xF5, OMAP_WDT_TIMER_MODE);
|
|
|
+ omap_writel(0xA0, OMAP_WDT_TIMER_MODE);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+#define HTCHERALD_GPIO_USB_EN1 33
|
|
|
+#define HTCHERALD_GPIO_USB_EN2 73
|
|
|
+#define HTCHERALD_GPIO_USB_DM 35
|
|
|
+#define HTCHERALD_GPIO_USB_DP 36
|
|
|
+
|
|
|
+static void __init htcherald_usb_enable(void)
|
|
|
+{
|
|
|
+ unsigned int tries = 20;
|
|
|
+ unsigned int value = 0;
|
|
|
+
|
|
|
+ /* Request the GPIOs we need to control here */
|
|
|
+ if (gpio_request(HTCHERALD_GPIO_USB_EN1, "herald_usb") < 0)
|
|
|
+ goto err1;
|
|
|
+
|
|
|
+ if (gpio_request(HTCHERALD_GPIO_USB_EN2, "herald_usb") < 0)
|
|
|
+ goto err2;
|
|
|
+
|
|
|
+ if (gpio_request(HTCHERALD_GPIO_USB_DM, "herald_usb") < 0)
|
|
|
+ goto err3;
|
|
|
+
|
|
|
+ if (gpio_request(HTCHERALD_GPIO_USB_DP, "herald_usb") < 0)
|
|
|
+ goto err4;
|
|
|
+
|
|
|
+ /* force USB_EN GPIO to 0 */
|
|
|
+ do {
|
|
|
+ /* output low */
|
|
|
+ gpio_direction_output(HTCHERALD_GPIO_USB_EN1, 0);
|
|
|
+ } while ((value = gpio_get_value(HTCHERALD_GPIO_USB_EN1)) == 1 &&
|
|
|
+ --tries);
|
|
|
+
|
|
|
+ if (value == 1)
|
|
|
+ printk(KERN_WARNING "Unable to reset USB, trying to continue\n");
|
|
|
+
|
|
|
+ gpio_direction_output(HTCHERALD_GPIO_USB_EN2, 0); /* output low */
|
|
|
+ gpio_direction_input(HTCHERALD_GPIO_USB_DM); /* input */
|
|
|
+ gpio_direction_input(HTCHERALD_GPIO_USB_DP); /* input */
|
|
|
+
|
|
|
+ goto done;
|
|
|
+
|
|
|
+err4:
|
|
|
+ gpio_free(HTCHERALD_GPIO_USB_DM);
|
|
|
+err3:
|
|
|
+ gpio_free(HTCHERALD_GPIO_USB_EN2);
|
|
|
+err2:
|
|
|
+ gpio_free(HTCHERALD_GPIO_USB_EN1);
|
|
|
+err1:
|
|
|
+ printk(KERN_ERR "Unabled to request GPIO for USB\n");
|
|
|
+done:
|
|
|
+ printk(KERN_INFO "USB setup complete.\n");
|
|
|
+}
|
|
|
+
|
|
|
+static void __init htcherald_init(void)
|
|
|
+{
|
|
|
+ printk(KERN_INFO "HTC Herald init.\n");
|
|
|
+
|
|
|
+ /* Do board initialization before we register all the devices */
|
|
|
+ htcpld_resources[0].start = gpio_to_irq(HTCHERALD_GIRQ_BTNS);
|
|
|
+ htcpld_resources[0].end = gpio_to_irq(HTCHERALD_GIRQ_BTNS);
|
|
|
+ platform_add_devices(devices, ARRAY_SIZE(devices));
|
|
|
+
|
|
|
+ htcherald_disable_watchdog();
|
|
|
+
|
|
|
+ htcherald_usb_enable();
|
|
|
+ omap1_usb_init(&htcherald_usb_config);
|
|
|
+
|
|
|
+ htcherald_spi_board_info[0].irq = gpio_to_irq(HTCHERALD_GPIO_TS);
|
|
|
+ spi_register_board_info(htcherald_spi_board_info,
|
|
|
+ ARRAY_SIZE(htcherald_spi_board_info));
|
|
|
+
|
|
|
+ omap_register_i2c_bus(1, 100, NULL, 0);
|
|
|
+
|
|
|
+#if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE)
|
|
|
+ htc_mmc_data[0] = &htc_mmc1_data;
|
|
|
+ omap1_init_mmc(htc_mmc_data, 1);
|
|
|
+#endif
|
|
|
+
|
|
|
+ omapfb_set_lcd_config(&htcherald_lcd_config);
|
|
|
+}
|
|
|
+
|
|
|
+MACHINE_START(HERALD, "HTC Herald")
|
|
|
+ /* Maintainer: Cory Maccarrone <darkstar6262@gmail.com> */
|
|
|
+ /* Maintainer: wing-linux.sourceforge.net */
|
|
|
+ .atag_offset = 0x100,
|
|
|
+ .map_io = htcherald_map_io,
|
|
|
+ .init_early = omap1_init_early,
|
|
|
+ .init_irq = omap1_init_irq,
|
|
|
+ .init_machine = htcherald_init,
|
|
|
+ .init_late = omap1_init_late,
|
|
|
+ .timer = &omap1_timer,
|
|
|
+ .restart = omap1_restart,
|
|
|
+MACHINE_END
|