int __init ath_simple_config_init(void) { #if 0 #ifdef CONFIG_CUS100 u32 mask = 0; #endif int req, ret; ret = misc_register(&athfr_miscdev); if (ret < 0) { printk("*** ath misc_register failed %d *** \n", ret); return -1; } #ifdef CONFIG_CUS100 mask = ath_reg_rd(ATH_MISC_INT_MASK); ath_reg_wr(ATH_MISC_INT_MASK, mask | (1 << 2)); ath_gpio_config_int(JUMPSTART_GPIO, INT_TYPE_LEVEL, INT_POL_ACTIVE_HIGH); ath_gpio_intr_enable(JUMPSTART_GPIO); ath_gpio_config_input(JUMPSTART_GPIO); #else ath_gpio_config_input(JUMPSTART_GPIO); /* configure Jumpstart GPIO as level triggered interrupt */ ath_gpio_config_int(JUMPSTART_GPIO, INT_TYPE_LEVEL, INT_POL_ACTIVE_LOW); printk("%s JUMPSTART_GPIO: %d\n", __func__, JUMPSTART_GPIO); #ifndef CONFIG_MACH_AR934x ath_reg_rmw_clear(ATH_GPIO_FUNCTIONS, (1 << 2)); ath_reg_rmw_clear(ATH_GPIO_FUNCTIONS, (1 << 16)); ath_reg_rmw_clear(ATH_GPIO_FUNCTIONS, (1 << 20)); #endif #endif req = request_irq(ATH_GPIO_IRQn(JUMPSTART_GPIO), jumpstart_irq, 0, "SW JUMPSTART/FACTORY RESET", NULL); if (req != 0) { printk("request_irq for jumpstart failed (error %d)\n", req); misc_deregister(&athfr_miscdev); ath_gpio_intr_shutdown(ATH_GPIO_IRQn(JUMPSTART_GPIO)); return -1; } #if !defined(CONFIG_I2S) && defined(AP_USB_LED_GPIO) ath_gpio_config_output(AP_USB_LED_GPIO); #endif init_waitqueue_head(&ath_fr_wq); #endif create_simple_config_led_proc_entry(); return 0; }
static unsigned int ath_gpio_intr_startup(unsigned int irq) { ath_gpio_intr_enable(irq); return 0; }
static void ath_gpio_intr_end(unsigned int irq) { if (!(irq_desc[irq].status & (IRQ_DISABLED | IRQ_INPROGRESS))) ath_gpio_intr_enable(irq); }
int __init ath_simple_config_init(void) { #ifdef CONFIG_CUS100 u32 mask = 0; #endif #ifdef JUMPSTART_GPIO int req; #endif int ret; #ifdef AP_RESET_GPIO int req2; #endif ret = misc_register(&athfr_miscdev); if (ret < 0) { printk("*** ath misc_register failed %d *** \n", ret); return -1; } #ifdef AP_RESET_GPIO ath_gpio_config_input(AP_RESET_GPIO); ath_gpio_config_int(AP_RESET_GPIO, INT_TYPE_LEVEL, INT_POL_ACTIVE_LOW); printk("%s (%s) AP_RESET_GPIO: %d\n", __FILE__, __func__, AP_RESET_GPIO); #endif #ifdef JUMPSTART_GPIO #ifdef CONFIG_CUS100 mask = ath_reg_rd(ATH_MISC_INT_MASK); ath_reg_wr(ATH_MISC_INT_MASK, mask | (1 << 2)); ath_gpio_config_int(JUMPSTART_GPIO, INT_TYPE_LEVEL, INT_POL_ACTIVE_HIGH); ath_gpio_intr_enable(JUMPSTART_GPIO); ath_gpio_config_input(JUMPSTART_GPIO); #else ath_gpio_config_input(JUMPSTART_GPIO); /* configure Jumpstart GPIO as level triggered interrupt */ ath_gpio_config_int(JUMPSTART_GPIO, INT_TYPE_LEVEL, INT_POL_ACTIVE_LOW); printk("%s (%s) JUMPSTART_GPIO: %d\n", __FILE__, __func__, JUMPSTART_GPIO); #ifndef CONFIG_MACH_AR934x ath_reg_rmw_clear(ATH_GPIO_FUNCTIONS, (1 << 2)); ath_reg_rmw_clear(ATH_GPIO_FUNCTIONS, (1 << 16)); ath_reg_rmw_clear(ATH_GPIO_FUNCTIONS, (1 << 20)); #endif #endif req = request_irq(ATH_GPIO_IRQn(JUMPSTART_GPIO), jumpstart_irq, 0, #ifdef AP_RESET_GPIO "SW JUMPSTART", NULL); #else "SW JUMPSTART/FACTORY RESET", NULL); #endif if (req != 0) { printk("request_irq for jumpstart failed (error %d)\n", req); misc_deregister(&athfr_miscdev); ath_gpio_intr_shutdown(ATH_GPIO_IRQn(JUMPSTART_GPIO)); return -1; } #endif /* #ifdef JUMPSTART_GPIO */ #ifdef AP_RESET_GPIO req2 = request_irq(ATH_GPIO_IRQn(AP_RESET_GPIO), ath_reset_irq, 0, "FACTORY RESET", NULL); if (req2 != 0) { printk("request_irq for factory reset failed (error %d)\n", req); misc_deregister(&athfr_miscdev); free_irq(req, NULL); return -1; } #endif #ifdef ATH_S17INT_GPIO ath_gpio_config_input(ATH_S17INT_GPIO); /* configure S17 interrupt GPIO as level triggered interrupt */ ath_gpio_config_int(ATH_S17INT_GPIO, INT_TYPE_LEVEL, INT_POL_ACTIVE_LOW); printk("%s (%s) ATH_S17INT_GPIO: %d\n", __FILE__, __func__, ATH_S17INT_GPIO); #endif #if !defined(CONFIG_I2S) && defined(AP_USB_LED_GPIO) ath_gpio_config_output(AP_USB_LED_GPIO); #endif init_waitqueue_head(&ath_fr_wq); #ifdef WPS_LED_GPIO create_simple_config_led_proc_entry(); #endif #ifdef POWER_ON_GLED_GPIO printk("%s (%s) POWER_ON_GLED_GPIO: %d\n", __FILE__, __func__, POWER_ON_GLED_GPIO); ath_gpio_config_output(POWER_ON_GLED_GPIO); ath_gpio_out_val(POWER_ON_GLED_GPIO, POWER_LED_ON); #endif #ifdef POWER_ON_RLED_GPIO printk("%s (%s) POWER_ON_RLED_GPIO: %d\n", __FILE__, __func__, POWER_ON_RLED_GPIO); ath_gpio_config_output(POWER_ON_RLED_GPIO); ath_gpio_out_val(POWER_ON_RLED_GPIO, POWER_LED_OFF); OS_INIT_TIMER(NULL, &power_on_timer, power_led_blink, NULL); OS_SET_TIMER(&power_on_timer, POWER_LED_BLINK_INTERVAL); #endif return 0; }