Index: linux-2.6.16-rc5/arch/arm/mach-ep93xx/micro9.c =================================================================== --- linux-2.6.16-rc5.orig/arch/arm/mach-ep93xx/micro9.c +++ linux-2.6.16-rc5/arch/arm/mach-ep93xx/micro9.c @@ -40,11 +40,127 @@ #include +/* + * FPGA extension board + */ +#ifdef CONFIG_MICRO9_FPGA_EXTENSION_BOARD +#include +#endif + +#ifdef CONFIG_ARCH_EP93XX_GPIO_IRQ +#ifdef CONFIG_GENERIC_HARDIRQS +#include +#endif +#include "ep93xx_gpio_irq.h" +#endif + +#ifdef CONFIG_LEDS + +#define LED_STATE_ENABLED 1 +#define LED_STATE_CLAIMED 2 + +static unsigned int led_state; +static unsigned int hw_led_state; + +#define LED_ON 1 + +void micro9_leds_event(led_event_t evt) +{ + unsigned long flags; + +/* Has to be checked if wee need locking here, because of locking in gpio code */ +#ifdef CONFIG_PREEMPT_RT + raw_local_irq_save(flags); +#else + local_irq_save(flags); +#endif + switch (evt) { + case led_start: + led_state = LED_STATE_ENABLED; + hw_led_state = LED_ON ; + break; + + case led_stop: + led_state &= ~LED_STATE_ENABLED; + hw_led_state = 0; + break; + + case led_claim: + led_state |= LED_STATE_CLAIMED; + hw_led_state = LED_ON; + break; + + case led_release: + led_state &= ~LED_STATE_CLAIMED; + hw_led_state = 0; + break; + + case led_timer: + break; + + case led_idle_start: + if (!(led_state & LED_STATE_CLAIMED)) + hw_led_state &= ~LED_ON; + break; + + case led_idle_end: + if (!(led_state & LED_STATE_CLAIMED)) + hw_led_state |= LED_ON; + break; + + case led_halted: + break; + + case led_amber_on: + break; + + case led_amber_off: + break; + + case led_red_on: + if (led_state & LED_STATE_CLAIMED) + hw_led_state |= LED_ON; + break; + + case led_red_off: + if (led_state & LED_STATE_CLAIMED) + hw_led_state &= ~LED_ON; + break; + + default: + break; + } + + gpio_line_config(EP93XX_GPIO_LINE_E(1), GPIO_OUT); + + if (led_state & LED_STATE_ENABLED) + { + if(hw_led_state) + gpio_line_set(EP93XX_GPIO_LINE_E(1), EP93XX_GPIO_HIGH); + else + gpio_line_set(EP93XX_GPIO_LINE_E(1), EP93XX_GPIO_LOW); + } + +/* Has to be checked if wee need locking here, because of locking in gpio code */ +#ifdef CONFIG_PREEMPT_RT + raw_local_irq_restore(flags); +#else + local_irq_restore(flags); +#endif +} + +#else +#define micro9_leds_event 0 +#endif + static void __init micro9_init_machine(void) { ep93xx_init_devices(); +#ifdef CONFIG_MTD_PHYSMAP physmap_configure(0x10000000 , SZ_64M , 4, NULL); + /* OLD platform_device_register(&cfi_flash_device); */ +#endif /* * CAN memory, can't be used by other things. @@ -75,6 +191,53 @@ static void __init micro9_init_machine(v "Micro9 FPGA extension board\n"); } #endif + +#ifdef CONFIG_LEDS + leds_event = micro9_leds_event; + leds_event(led_start); +#endif + +#ifdef CONFIG_RASTER_BUS_ARBITRATION + /* This is run default with a display, bad latencies because + * usb, mac, dma is allowed to take bus also when irq is active + * bus prio 1 raster + * bus prio 2 raster cursor + * bus prio 3 mac + * bus prio 4 usb + * bus prio 5 core + * bus prio 6 dma + */ + outl(0x1, SYSCON_BMAR); +#endif + +#ifdef CONFIG_IRQ_BUS_ARBITRATION + /* This is run on PREEMPT_RT with a display, not so well latencies + * but a lot better than CONFIG_RASTER_BUS_ARBITRATION + * bus accesss for usb, mac, dma is not allowed when a irq is active + * core has not the highest prio + * bus prio 1 raster + * bus prio 2 raster cursor + * bus prio 3 mac + * bus prio 4 usb + * bus prio 5 core + * bus prio 6 dma + */ + outl(0x151, SYSCON_BMAR); +#endif + +#ifdef CONFIG_CORE_IRQ_BUS_ARBITRATION + /* This is run on PREEMPT_RT without a display, good latencies + * core has highest prio !!! + * don't allow usb, mac, dma to bus if irq is active !! + * bus prio 1 raster + * bus prio 2 raster cursor + * bus prio 3 mac + * bus prio 4 usb + * bus prio 5 core + * bus prio 6 dma + */ + outl(0x159, SYSCON_BMAR); +#endif } MACHINE_START(MICRO9, "Contec Hypercontrol Micro9")