static void ar7240_dispatch_gpio_intr(struct pt_regs *regs) { int pending, i; pending = ar7240_reg_rd(AR7240_GPIO_INT_PENDING) & ar7240_reg_rd(AR7240_GPIO_INT_MASK); for(i = 0; i < AR7240_GPIO_COUNT; i++) { if (pending & (1 << i)) do_IRQ(AR7240_GPIO_IRQn(i), regs); } }
void ar7240wdt_init(void) { int ret; extern void ar7240_gpio_config_input(int); printk("%s: Registering WDT ", __func__); if ((ret = misc_register(&ar7240wdt_miscdev))) { printk("failed %d\n", ret); return; } else { printk("success\n"); } #ifdef CONFIG_WASP_SUPPORT wdt->clk_freq = ath_ref_clk_freq; #else wdt->clk_freq = ar7240_ahb_freq; #endif #ifdef CONFIG_MACH_HORNET wdt->tmo = AR7240_DEFAULT_WD_TMO; ar7240_set_wd_timer(wdt->tmo * 6); ar7240_set_wd_timer_action(AR7240_WD_ACT_RESET); mod_timer(&wd_timer, AR7240_DEFAULT_MOD_TMO); if (request_irq( AR7240_GPIO_IRQn(AR7240_GPIO_RESET), ar7240_wdt_isr, 0, "Watchdog Reset", wdt)) { wddbg("%s: request_irq %d\n", __func__, ret); } #endif ar7240_gpio_config_input(AR7240_GPIO_RESET); }
int __init ar7240_simple_config_init(void) { int req; /* restore factory default and system led */ dev_t dev; int rt; int ar7240_gpio_major = gpio_major; int ar7240_gpio_minor = gpio_minor; init_timer(&rst_timer); rst_timer.function = check_rst; #ifdef CONFIG_PID_MR302001 printk("\n\nWhoops! This kernel is for product mr3020 v1.0!\n\n"); #endif #ifdef CONFIG_PID_WR74104 printk("\n\nWhoops! This kernel is for product wr741 v4.0!\n\n"); #endif #ifdef CONFIG_PID_MR322001 printk("\n\nWhoops! This kernel is for product mr3220 v1.0!\n\n"); #endif #ifdef CONFIG_PID_MR322002 printk("\n\nWhoops! This kernel is for product mr3220 v2.0!\n\n"); #endif #ifdef CONFIG_PID_WR70301 printk("\n\nWhoops! This kernel is for product wr703 v1.0!\n\n"); #endif #ifdef SUPPORT_HARDWARE_MULTI_MODE /* added by ZCF, 20110420 */ init_sysMode(); init_timer(&sysMode_timer); sysMode_timer.function = check_sysMode; mod_timer(&sysMode_timer, jiffies + 1 * HZ); #endif #ifndef JUMPSTART_RST_MULTIPLEXED #ifdef JUMPSTART_GPIO init_timer(&wps_timer); wps_timer.function = check_wps; /* This is NECESSARY, lsz 090109 */ ar7240_gpio_config_input(JUMPSTART_GPIO); /* configure JUMPSTART_GPIO as level triggered interrupt */ ar7240_gpio_config_int (JUMPSTART_GPIO, INT_TYPE_LEVEL, INT_POL_ACTIVE_HIGH); req = request_irq (AR7240_GPIO_IRQn(JUMPSTART_GPIO), jumpstart_irq, 0, "SW_JUMPSTART", NULL); if (req != 0) { printk (KERN_ERR "unable to request IRQ for SWJUMPSTART GPIO (error %d)\n", req); } #endif #endif #ifdef GPIO_INTERNET_LED_BIT g_internetLedPin = GPIO_INTERNET_LED_BIT; #endif #ifdef AP_USB_LED_GPIO ar7240_gpio_config_output(AP_USB_LED_GPIO); /* init Internet LED status (off) */ ar7240_gpio_out_val(AP_USB_LED_GPIO, USB_LED_OFF); #endif #ifdef GPIO_WLAN_LED_BIT /* init WLAN LED status (off) */ ar7240_gpio_out_val(WLAN_LED_GPIO, WLAN_LED_OFF); #endif #ifdef SYS_LED_GPIO /* configure SYS_LED_GPIO as output led */ ar7240_gpio_config_output(SYS_LED_GPIO); //ar7240_gpio_out_val(SYS_LED_GPIO, SYS_LED_OFF); #endif #ifdef GPIO_SLOW_ETH_LED init_timer(&slow_led_timer); slow_led_timer.function = slow_led_expire; mod_timer(&slow_led_timer, jiffies + 1 * HZ); #endif #ifdef GPIO_JUMPSTART_LED_BIT /* configure gpio as outputs */ ar7240_gpio_config_output (TRICOLOR_LED_GREEN_PIN); /* switch off the led */ ar7240_gpio_out_val(TRICOLOR_LED_GREEN_PIN, OFF); #endif #ifdef GPIO_USB_POWER_SUPPORT /* configure gpio as outputs */ ar7240_gpio_config_output (SYS_USB_POWER_GPIO); /* power on usb modem */ ar7240_gpio_out_val(SYS_USB_POWER_GPIO, USB_POWER_ON); #endif create_simple_config_led_proc_entry (); ar7240_gpio_config_input(RST_DFT_GPIO); /* configure GPIO RST_DFT_GPIO as level triggered interrupt */ ar7240_gpio_config_int (RST_DFT_GPIO, INT_TYPE_LEVEL, INT_POL_ACTIVE_HIGH); rt = request_irq (AR7240_GPIO_IRQn(RST_DFT_GPIO), rst_irq, 0, "RESTORE_FACTORY_DEFAULT", NULL); if (rt != 0) { printk (KERN_ERR "unable to request IRQ for RESTORE_FACTORY_DEFAULT GPIO (error %d)\n", rt); } if (ar7240_gpio_major) { dev = MKDEV(ar7240_gpio_major, ar7240_gpio_minor); rt = register_chrdev_region(dev, 1, "ar7240_gpio_chrdev"); } else { rt = alloc_chrdev_region(&dev, ar7240_gpio_minor, 1, "ar7240_gpio_chrdev"); ar7240_gpio_major = MAJOR(dev); } if (rt < 0) { printk(KERN_WARNING "ar7240_gpio_chrdev : can`t get major %d\n", ar7240_gpio_major); return rt; } cdev_init (&gpio_device_cdev, &gpio_device_op); rt = cdev_add(&gpio_device_cdev, dev, 1); if (rt < 0) printk(KERN_NOTICE "Error %d adding ar7240_gpio_chrdev ", rt); return 0; }