Ver Fonte

efDataStatistics realizationOfDataCalculation.c 朱俊杰 commit at 2021-04-23

朱俊杰 há 4 anos atrás
pai
commit
9f2c336c48

+ 137 - 0
efDataStatistics/calculationOfAlarmUnprocessedData/realizationOfDataCalculation.c

@@ -475,3 +475,140 @@ static void __init osk_mistral_init(void)
 	omap_cfg_reg(Y12_1610_CCP_CLKP);
 	/* CCP_DATAM CONFLICTS WITH UART1.TX (and serial console) */
 	/* omap_cfg_reg(Y14_1610_CCP_DATAM); */
+	omap_cfg_reg(W14_1610_CCP_DATAP);
+
+	/* CAM_PWDN */
+	if (gpio_request(11, "cam_pwdn") == 0) {
+		omap_cfg_reg(N20_1610_GPIO11);
+		gpio_direction_output(11, 0);
+	} else
+		pr_debug("OSK+Mistral: CAM_PWDN is awol\n");
+
+
+	/* omap_cfg_reg(P19_1610_GPIO6); */	/* BUSY */
+	gpio_request(6, "ts_busy");
+	gpio_direction_input(6);
+
+	omap_cfg_reg(P20_1610_GPIO4);	/* PENIRQ */
+	gpio_request(4, "ts_int");
+	gpio_direction_input(4);
+	irq_set_irq_type(gpio_to_irq(4), IRQ_TYPE_EDGE_FALLING);
+
+	mistral_boardinfo[0].irq = gpio_to_irq(4);
+	spi_register_board_info(mistral_boardinfo,
+			ARRAY_SIZE(mistral_boardinfo));
+
+	/* the sideways button (SW1) is for use as a "wakeup" button
+	 *
+	 * NOTE:  The Mistral board has the wakeup button (SW1) wired
+	 * to the LCD 3.3V rail, which is powered down during suspend.
+	 * To allow this button to wake up the omap, work around this
+	 * HW bug by rewiring SW1 to use the main 3.3V rail.
+	 */
+	omap_cfg_reg(N15_1610_MPUIO2);
+	if (gpio_request(OMAP_MPUIO(2), "wakeup") == 0) {
+		int ret = 0;
+		int irq = gpio_to_irq(OMAP_MPUIO(2));
+
+		gpio_direction_input(OMAP_MPUIO(2));
+		irq_set_irq_type(irq, IRQ_TYPE_EDGE_RISING);
+#ifdef	CONFIG_PM
+		/* share the IRQ in case someone wants to use the
+		 * button for more than wakeup from system sleep.
+		 */
+		ret = request_irq(irq,
+				&osk_mistral_wake_interrupt,
+				IRQF_SHARED, "mistral_wakeup",
+				&osk_mistral_wake_interrupt);
+		if (ret != 0) {
+			gpio_free(OMAP_MPUIO(2));
+			printk(KERN_ERR "OSK+Mistral: no wakeup irq, %d?\n",
+				ret);
+		} else
+			enable_irq_wake(irq);
+#endif
+	} else
+		printk(KERN_ERR "OSK+Mistral: wakeup button is awol\n");
+
+	/* LCD:  backlight, and power; power controls other devices on the
+	 * board, like the touchscreen, EEPROM, and wakeup (!) switch.
+	 */
+	omap_cfg_reg(PWL);
+	if (gpio_request(2, "lcd_pwr") == 0)
+		gpio_direction_output(2, 1);
+
+	/*
+	 * GPIO based LEDs
+	 */
+	omap_cfg_reg(P18_1610_GPIO3);
+	omap_cfg_reg(MPUIO4);
+
+	i2c_register_board_info(1, mistral_i2c_board_info,
+			ARRAY_SIZE(mistral_i2c_board_info));
+
+	platform_add_devices(mistral_devices, ARRAY_SIZE(mistral_devices));
+}
+#else
+static void __init osk_mistral_init(void) { }
+#endif
+
+#define EMIFS_CS3_VAL	(0x88013141)
+
+static void __init osk_init(void)
+{
+	u32 l;
+
+	osk_init_smc91x();
+	osk_init_cf();
+
+	/* Workaround for wrong CS3 (NOR flash) timing
+	 * There are some U-Boot versions out there which configure
+	 * wrong CS3 memory timings. This mainly leads to CRC
+	 * or similar errors if you use NOR flash (e.g. with JFFS2)
+	 */
+	l = omap_readl(EMIFS_CCS(3));
+	if (l != EMIFS_CS3_VAL)
+		omap_writel(EMIFS_CS3_VAL, EMIFS_CCS(3));
+
+	osk_flash_resource.end = osk_flash_resource.start = omap_cs3_phys();
+	osk_flash_resource.end += SZ_32M - 1;
+	osk5912_smc91x_resources[1].start = gpio_to_irq(0);
+	osk5912_smc91x_resources[1].end = gpio_to_irq(0);
+	osk5912_cf_resources[0].start = gpio_to_irq(62);
+	osk5912_cf_resources[0].end = gpio_to_irq(62);
+	platform_add_devices(osk5912_devices, ARRAY_SIZE(osk5912_devices));
+
+	l = omap_readl(USB_TRANSCEIVER_CTRL);
+	l |= (3 << 1);
+	omap_writel(l, USB_TRANSCEIVER_CTRL);
+
+	omap1_usb_init(&osk_usb_config);
+
+	/* irq for tps65010 chip */
+	/* bootloader effectively does:  omap_cfg_reg(U19_1610_MPUIO1); */
+	if (gpio_request(OMAP_MPUIO(1), "tps65010") == 0)
+		gpio_direction_input(OMAP_MPUIO(1));
+
+	omap_serial_init();
+	osk_i2c_board_info[0].irq = gpio_to_irq(OMAP_MPUIO(1));
+	omap_register_i2c_bus(1, 400, osk_i2c_board_info,
+			      ARRAY_SIZE(osk_i2c_board_info));
+	osk_mistral_init();
+
+#ifdef	CONFIG_OMAP_OSK_MISTRAL
+	omapfb_set_lcd_config(&osk_lcd_config);
+#endif
+
+}
+
+MACHINE_START(OMAP_OSK, "TI-OSK")
+	/* Maintainer: Dirk Behme <dirk.behme@de.bosch.com> */
+	.atag_offset	= 0x100,
+	.map_io		= omap16xx_map_io,
+	.init_early	= omap1_init_early,
+	.init_irq	= omap1_init_irq,
+	.init_machine	= osk_init,
+	.init_late	= omap1_init_late,
+	.timer		= &omap1_timer,
+	.restart	= omap1_restart,
+MACHINE_END