static void bcm947xx_reboot_handler(void) { #ifndef BCMDBG int wombo_reset; #endif /* BCMDBG */ /* Reset the PCI(e) interfaces */ if (CHIPID(sih->chip) == BCM4706_CHIP_ID) hndpci_deinit(sih); if (lanports_enable) { uint lp = 1 << lanports_enable; si_gpioout(sih, lp, 0, GPIO_DRV_PRIORITY); si_gpioouten(sih, lp, lp, GPIO_DRV_PRIORITY); bcm_mdelay(1); } #ifndef BCMDBG /* gpio 0 is also valid wombo_reset */ if ((wombo_reset = getgpiopin(NULL, "wombo_reset", GPIO_PIN_NOTDEFINED)) != GPIO_PIN_NOTDEFINED) { int reset = 1 << wombo_reset; si_gpioout(sih, reset, 0, GPIO_DRV_PRIORITY); si_gpioouten(sih, reset, reset, GPIO_DRV_PRIORITY); bcm_mdelay(10); } #endif /* BCMDBG */ }
/* Disable outputs to the chip */ static void adm_disout(adm_info_t *adm, uint32 pins) { /* Disable GPIO outputs */ si_gpioouten(adm->sih, pins, 0, GPIO_DRV_PRIORITY); OSL_DELAY(EECK_EDGE_TIME); }
static void led_control(uint32 gpio, uint32 value) { uint32 mask = 1 << gpio; uint32 gpio_value; if (sih == NULL) { xprintf("si attach failed\n"); return; } if (value) { gpio_value = 1 << gpio; } else { gpio_value = 0 << gpio; } /* * output mode */ si_gpioouten(sih, mask, mask, GPIO_DRV_PRIORITY); si_gpioout(sih, mask, gpio_value, GPIO_DRV_PRIORITY); }
static ssize_t gpio_write(struct file *file, const char *buf, size_t count, loff_t *ppos) { u32 val; if (get_user(val, (u32 *) buf)) return -EFAULT; switch (MINOR(file->f_dentry->d_inode->i_rdev)) { case 0: return -EACCES; case 1: si_gpioout(gpio_sih, ~0, val, GPIO_APP_PRIORITY); break; case 2: si_gpioouten(gpio_sih, ~0, val, GPIO_APP_PRIORITY); break; case 3: si_gpiocontrol(gpio_sih, ~0, val, GPIO_APP_PRIORITY); break; default: return -ENODEV; } return sizeof(val); }
static ssize_t gpio_read(struct file *file, char *buf, size_t count, loff_t *ppos) { u32 val; switch (MINOR(file->f_dentry->d_inode->i_rdev)) { case 0: val = si_gpioin(gpio_sih); break; case 1: val = si_gpioout(gpio_sih, 0, 0, GPIO_APP_PRIORITY); break; case 2: val = si_gpioouten(gpio_sih, 0, 0, GPIO_APP_PRIORITY); break; case 3: val = si_gpiocontrol(gpio_sih, 0, 0, GPIO_APP_PRIORITY); break; default: return -ENODEV; } if (put_user(val, (u32 *) buf)) return -EFAULT; return sizeof(val); }
/* for driver-call usage */ uint32 _gpio_ctrl(unsigned int cmd, uint32 mask, uint32 val) { struct gpio_ioctl gpioioc; unsigned long flags; gpioioc.mask = mask; gpioioc.val = val; switch (cmd) { case GPIO_IOC_RESERVE: gpioioc.val = si_gpioreserve(gpio_sih, gpioioc.mask, GPIO_APP_PRIORITY); break; case GPIO_IOC_RELEASE: gpioioc.val = si_gpiorelease(gpio_sih, gpioioc.mask, GPIO_APP_PRIORITY); break; case GPIO_IOC_OUT: gpioioc.val = si_gpioout(gpio_sih, gpioioc.mask, gpioioc.val, GPIO_APP_PRIORITY); break; case GPIO_IOC_OUTEN: gpioioc.val = si_gpioouten(gpio_sih, gpioioc.mask, gpioioc.val, GPIO_APP_PRIORITY); break; case GPIO_IOC_IN: gpioioc.val = si_gpioin(gpio_sih); break; default: break; } return gpioioc.val; }
int gpio_kernel_api(unsigned int cmd, unsigned int mask, unsigned int val) { if (gpio_init_flag != 1) { if (gpio_init() != 0) return -EFAULT; } switch (cmd) { case 0: si_gpioout(gpio_sih, mask, val, GPIO_HI_PRIORITY); break; case 1: si_gpioouten(gpio_sih, mask, val, GPIO_HI_PRIORITY); break; case 3: si_gpioreserve(gpio_sih, mask, GPIO_HI_PRIORITY); break; default: printk("Unknown gpio_kenerl_api command\n"); break; } return 0; }
/* GENERIC_GPIO calls */ int gpio_direction_input(unsigned gpio) { int ret; ret = si_gpioouten(gpio_sih, (1<<gpio), 0, GPIO_APP_PRIORITY); DBG("%s: gpio %d - input 0x%x\n", __FUNCTION__, gpio, ret); return 0; }
void __init brcm_setup(void) { char *value; /* Get global SB handle */ sih = si_kattach(SI_OSH); /* Initialize clocks and interrupts */ si_mips_init(sih, SBMIPS_VIRTIRQ_BASE); if (BCM330X(current_cpu_data.processor_id) && (read_c0_diag() & BRCM_PFC_AVAIL)) { /* * Now that the sih is inited set the proper PFC value */ printk("Setting the PFC to its default value\n"); enable_pfc(PFC_AUTO); } #ifdef CONFIG_SERIAL_CORE /* Initialize UARTs */ serial_setup(sih); #endif /* CONFIG_SERIAL_CORE */ /* Override default command line arguments */ value = nvram_get("kernel_args"); if (value && strlen(value) && strncmp(value, "empty", 5)) strncpy(arcs_cmdline, value, sizeof(arcs_cmdline)); if ((lanports_enable = getgpiopin(NULL, "lanports_enable", GPIO_PIN_NOTDEFINED)) == GPIO_PIN_NOTDEFINED) lanports_enable = 0; /* wombo reset */ if ((wombo_reset = getgpiopin(NULL, "wombo_reset", GPIO_PIN_NOTDEFINED)) != GPIO_PIN_NOTDEFINED) { int reset = 1 << wombo_reset; printk("wombo_reset set to gpio %d\n", wombo_reset); si_gpioout(sih, reset, 0, GPIO_DRV_PRIORITY); si_gpioouten(sih, reset, reset, GPIO_DRV_PRIORITY); bcm_mdelay(10); si_gpioout(sih, reset, reset, GPIO_DRV_PRIORITY); bcm_mdelay(20); } /* Generic setup */ _machine_restart = bcm947xx_machine_restart; _machine_halt = bcm947xx_machine_halt; pm_power_off = bcm947xx_machine_halt; }
/* Enable outputs with specified value to the chip */ static void adm_enout(adm_info_t *adm, uint32 pins, uint val) { /* Prepare GPIO output value */ si_gpioout(adm->sih, pins, val, GPIO_DRV_PRIORITY); /* Enable GPIO outputs */ si_gpioouten(adm->sih, pins, pins, GPIO_DRV_PRIORITY); OSL_DELAY(EECK_EDGE_TIME); }
int gpio_direction_output(unsigned gpio, int value) { int out, outen; outen = si_gpioouten(gpio_sih, (1<<gpio), (1<<gpio), GPIO_APP_PRIORITY); out = si_gpioout(gpio_sih, (1<<gpio), (value ? (1<<gpio) : 0), GPIO_APP_PRIORITY); DBG("%s: gpio %d, value %d - out 0x%x outen 0x%x\n", __FUNCTION__, gpio, value, out, outen); return 0; }
static long gpio_ioctl(struct file *file, unsigned int cmd, unsigned long arg) { #else static int gpio_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) { #endif /* linux-2.6.22 */ struct gpio_ioctl gpioioc; if (copy_from_user(&gpioioc, (struct gpio_ioctl *)arg, sizeof(struct gpio_ioctl))) return -EFAULT; switch (cmd) { case GPIO_IOC_RESERVE: gpioioc.val = si_gpioreserve(gpio_sih, gpioioc.mask, GPIO_APP_PRIORITY); break; case GPIO_IOC_RELEASE: /* * releasing the gpio doesn't change the current * value on the GPIO last write value * persists till some one overwrites it */ gpioioc.val = si_gpiorelease(gpio_sih, gpioioc.mask, GPIO_APP_PRIORITY); break; case GPIO_IOC_OUT: gpioioc.val = si_gpioout(gpio_sih, gpioioc.mask, gpioioc.val, GPIO_APP_PRIORITY); break; case GPIO_IOC_OUTEN: gpioioc.val = si_gpioouten(gpio_sih, gpioioc.mask, gpioioc.val, GPIO_APP_PRIORITY); break; case GPIO_IOC_IN: gpioioc.val = si_gpioin(gpio_sih); break; default: break; } if (copy_to_user((struct gpio_ioctl *)arg, &gpioioc, sizeof(struct gpio_ioctl))) return -EFAULT; return 0; } static struct file_operations gpio_fops = { owner: THIS_MODULE, open: gpio_open, release: gpio_release, #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 36) unlocked_ioctl: gpio_ioctl #else ioctl: gpio_ioctl #endif };
static void bcm947xx_reboot_handler(void) { if (lanports_enable) { uint lp = 1 << lanports_enable; si_gpioout(sih, lp, 0, GPIO_DRV_PRIORITY); si_gpioouten(sih, lp, lp, GPIO_DRV_PRIORITY); bcm_mdelay(1); } /* gpio 0 is also valid wombo_reset */ if (wombo_reset != GPIO_PIN_NOTDEFINED) { int reset = 1 << wombo_reset; si_gpioout(sih, reset, 0, GPIO_DRV_PRIORITY); si_gpioouten(sih, reset, reset, GPIO_DRV_PRIORITY); bcm_mdelay(10); } }
void recovery_button_init(void) { if (sih == NULL) { xprintf("si attach failed\n"); return; } /* * input mode */ si_gpioouten(sih, ((uint32) 1 << RECOVERY_GPIO_BUTTON), 0, GPIO_DRV_PRIORITY); }
void leds_gpio_init(void) { uint32 mask = 1 << LED_WLAN2G_GPIO_PIN | 1 << LED_WLAN5G_GPIO_PIN | 1 << LED_INTERNET_GPIO_PIN | 1 << LED_SYS_GPIO_PIN; if (sih == NULL) { xprintf("si attach failed\n"); return; } /* * output mode */ si_gpioouten(sih, mask, mask, GPIO_DRV_PRIORITY); }
static void bcm947xx_reboot_handler(void) { /* Reset the PCI(e) interfaces */ if (CHIPID(sih->chip) == BCM4706_CHIP_ID) hndpci_deinit(sih); if (lanports_enable) { uint lp = 1 << lanports_enable; si_gpioout(sih, lp, 0, GPIO_DRV_PRIORITY); si_gpioouten(sih, lp, lp, GPIO_DRV_PRIORITY); bcm_mdelay(1); } /* gpio 0 is also valid wombo_reset */ if (wombo_reset != GPIO_PIN_NOTDEFINED) { int reset = 1 << wombo_reset; si_gpioout(sih, reset, 0, GPIO_DRV_PRIORITY); si_gpioouten(sih, reset, reset, GPIO_DRV_PRIORITY); bcm_mdelay(10); } }
int BCMINITFN(nvram_resetgpio_init)(void *si) { int gpio; si_t *sih; sih = (si_t *)si; gpio = bcmgpio_getpin(WPS_GPIO_BUTTON_VALUE); if ((gpio > 31) || (gpio < 0)) return -1; /* Setup GPIO input */ si_gpioouten(sih, ((uint32) 1 << gpio), 0, GPIO_DRV_PRIORITY); return gpio; }
void board_power_init(si_t *sih) { uint origidx; chipcregs_t *cc; int gpio; /* Drive gpio pin to HIGH to enable on-board switching regulator for COMA mode */ origidx = si_coreidx(sih); if ((cc = (chipcregs_t *)si_setcore(sih, CC_CORE_ID, 0)) != NULL) { gpio = getgpiopin(NULL, "coma_swreg", GPIO_PIN_NOTDEFINED); if (gpio != GPIO_PIN_NOTDEFINED) { gpio = 1 << gpio; si_gpioout(sih, gpio, gpio, GPIO_DRV_PRIORITY); si_gpioouten(sih, gpio, gpio, GPIO_DRV_PRIORITY); } } si_setcoreidx(sih, origidx); }
int BCMINITFN(nvram_wsgpio_init)(void *si) { #if defined(RTAC68U) || defined(DSLAC68U) int gpio = 5; #else int gpio = 7; #endif si_t *sih; sih = (si_t *)si; if (gpio > 31) return -1; /* Setup GPIO input */ si_gpioouten(sih, ((uint32) 1 << gpio), 0, GPIO_DRV_PRIORITY); return gpio; }
static int gpio_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) { struct gpio_ioctl gpioioc; if (copy_from_user(&gpioioc, (struct gpio_ioctl *)arg, sizeof(struct gpio_ioctl))) return -EFAULT; switch (cmd) { case GPIO_IOC_RESERVE: gpioioc.val = si_gpioreserve(gpio_sih, gpioioc.mask, GPIO_APP_PRIORITY); break; case GPIO_IOC_RELEASE: /* * releasing the gpio doesn't change the current * value on the GPIO last write value * persists till some one overwrites it */ gpioioc.val = si_gpiorelease(gpio_sih, gpioioc.mask, GPIO_APP_PRIORITY); break; case GPIO_IOC_OUT: gpioioc.val = si_gpioout(gpio_sih, gpioioc.mask, gpioioc.val, GPIO_APP_PRIORITY); break; case GPIO_IOC_OUTEN: gpioioc.val = si_gpioouten(gpio_sih, gpioioc.mask, gpioioc.val, GPIO_APP_PRIORITY); break; case GPIO_IOC_IN: gpioioc.val = si_gpioin(gpio_sih); break; default: break; } if (copy_to_user((struct gpio_ioctl *)arg, &gpioioc, sizeof(struct gpio_ioctl))) return -EFAULT; return 0; }
int BCMINITFN(nvram_resetgpio_init)(void *si) { char *value; int gpio; si_t *sih; sih = (si_t *)si; value = nvram_get("reset_gpio"); if (!value) return -1; gpio = (int) bcm_atoi(value); if (gpio > 7) return -1; /* Setup GPIO input */ si_gpioouten(sih, ((uint32) 1 << gpio), 0, GPIO_DRV_PRIORITY); return gpio; }
void board_pinmux_init(si_t *sih) { uint origidx; chipcommonbregs_t *chipcb; origidx = si_coreidx(sih); chipcb = si_setcore(sih, NS_CCB_CORE_ID, 0); if (chipcb != NULL) { /* Default select the mux pins for GPIO */ W_REG(osh, &chipcb->cru_gpio_control0, 0x1fffff); } si_setcoreidx(sih, origidx); si_gpioouten(sih, PWR_LED_GPIO, PWR_LED_GPIO, GPIO_DRV_PRIORITY); si_gpioouten(sih, USB_LED_GPIO, USB_LED_GPIO, GPIO_DRV_PRIORITY); #ifdef RTAC68U si_gpioouten(sih, TURBO_LED_GPIO, TURBO_LED_GPIO, GPIO_DRV_PRIORITY); #endif #ifndef RTN18U si_gpioouten(sih, WL5G_LED_GPIO, WL5G_LED_GPIO, GPIO_DRV_PRIORITY); si_gpioouten(sih, USB3_LED_GPIO, USB3_LED_GPIO, GPIO_DRV_PRIORITY); #endif #ifndef RTAC68U si_gpioouten(sih, WAN_LED_GPIO, WAN_LED_GPIO, GPIO_DRV_PRIORITY); si_gpioouten(sih, LAN_LED_GPIO, LAN_LED_GPIO, GPIO_DRV_PRIORITY); #endif #ifndef RTN18U // for RT-AC56U & RT-AC68U si_gpioouten(sih, USB_PWR1_GPIO, USB_PWR1_GPIO, GPIO_DRV_PRIORITY); #ifndef RTAC68U si_gpioouten(sih, USB_PWR2_GPIO, USB_PWR2_GPIO, GPIO_DRV_PRIORITY); #endif #endif #ifdef RTN18U // RT-N18U si_gpioouten(sih, USB_PWR1_GPIO, USB_PWR1_GPIO, GPIO_DRV_PRIORITY); si_gpioouten(sih, WL2G_LED_GPIO, WL2G_LED_GPIO, GPIO_DRV_PRIORITY); si_gpioouten(sih, USB3_LED_GPIO, USB3_LED_GPIO, GPIO_DRV_PRIORITY); #endif si_gpioout(sih, PWR_LED_GPIO, 0, GPIO_DRV_PRIORITY); si_gpioout(sih, USB_LED_GPIO, USB_LED_GPIO, GPIO_DRV_PRIORITY); #ifdef RTAC68U si_gpioout(sih, TURBO_LED_GPIO, 0, GPIO_DRV_PRIORITY); #endif #ifndef RTN18U // for RT-AC56U & RT-AC68U to enable USB power si_gpioout(sih, WL5G_LED_GPIO, WL5G_LED_GPIO, GPIO_DRV_PRIORITY); si_gpioout(sih, USB3_LED_GPIO, USB3_LED_GPIO, GPIO_DRV_PRIORITY); #endif #ifndef RTAC68U si_gpioout(sih, WAN_LED_GPIO, WAN_LED_GPIO, GPIO_DRV_PRIORITY); si_gpioout(sih, LAN_LED_GPIO, LAN_LED_GPIO, GPIO_DRV_PRIORITY); #endif #ifndef RTN18U // for RT-AC56U & RT-AC68U to enable USB power si_gpioout(sih, USB_PWR1_GPIO, USB_PWR1_GPIO, GPIO_DRV_PRIORITY); #ifndef RTAC68U si_gpioout(sih, USB_PWR2_GPIO, USB_PWR2_GPIO, GPIO_DRV_PRIORITY); #endif #endif #ifdef RTN18U // RT-N18U /* enable USB power */ si_gpioout(sih, USB_PWR1_GPIO, USB_PWR1_GPIO, GPIO_DRV_PRIORITY); /* power on LEDs */ si_gpioout(sih, PWR_LED_GPIO, PWR_LED_GPIO, GPIO_DRV_PRIORITY); si_gpioout(sih, WL2G_LED_GPIO, WL2G_LED_GPIO, GPIO_DRV_PRIORITY); si_gpioout(sih, WAN_LED_GPIO, WAN_LED_GPIO, GPIO_DRV_PRIORITY); si_gpioout(sih, LAN_LED_GPIO, LAN_LED_GPIO, GPIO_DRV_PRIORITY); si_gpioout(sih, USB_LED_GPIO, USB_LED_GPIO, GPIO_DRV_PRIORITY); si_gpioout(sih, USB3_LED_GPIO, USB3_LED_GPIO, GPIO_DRV_PRIORITY); #endif }
static int bcmgpio_ioctl(int gpioreg, unsigned int mask , unsigned int val) { #if defined(__ECOS) int value; switch (gpioreg) { case BCMGPIO_REG_IN: value = si_gpioin(gpio_sih); break; case BCMGPIO_REG_OUT: value = si_gpioout(gpio_sih, mask, val,GPIO_APP_PRIORITY); break; case BCMGPIO_REG_OUTEN: value = si_gpioouten(gpio_sih, mask, val,GPIO_APP_PRIORITY); break; case BCMGPIO_REG_RESERVE: value = si_gpioreserve(gpio_sih, mask, GPIO_APP_PRIORITY); break; case BCMGPIO_REG_RELEASE: /* * releasing the gpio doesn't change the current * value on the GPIO last write value * persists till some one overwrites it */ value = si_gpiorelease(gpio_sih, mask, GPIO_APP_PRIORITY); break; default: GPIO_ERROR ("invalid gpioreg %d\n", gpioreg); value = -1; break; } return value; #else struct gpio_ioctl gpio; int type; gpio.val = val; gpio.mask = mask; switch (gpioreg) { case BCMGPIO_REG_IN: type = GPIO_IOC_IN; break; case BCMGPIO_REG_OUT: type = GPIO_IOC_OUT; break; case BCMGPIO_REG_OUTEN: type = GPIO_IOC_OUTEN; break; case BCMGPIO_REG_RESERVE: type = GPIO_IOC_RESERVE; break; case BCMGPIO_REG_RELEASE: type = GPIO_IOC_RELEASE; break; default: GPIO_ERROR ("invalid gpioreg %d\n", gpioreg); return -1; } if (ioctl(bcmgpio_fd, type, &gpio) < 0) { GPIO_ERROR ("invalid gpioreg %d\n", gpioreg); return -1; } return (gpio.val); #endif }
static int __init gpio_init(void) { int i; if (!(gpio_sih = si_kattach(SI_OSH))) return -ENODEV; si_gpiosetcore(gpio_sih); if ((gpio_major = register_chrdev(127, "gpio", &gpio_fops)) < 0) { return gpio_major; } // devfs_mk_cdev(MKDEV(gpio_major, 0), S_IFCHR | S_IRUGO | S_IWUGO, "gpio"); // devfs_mk_dir("gpio"); gpio_class = class_create(THIS_MODULE, "gpio"); for (i = 0; i < ARRAYSIZE(gpio_file); i++) { // register_chrdev(MKDEV(127, i), gpio_file[i].name, &gpio_fops); class_device_create(gpio_class, NULL, MKDEV(127, i), NULL, gpio_file[i].name); // printk("gpio dev %d created\n",dev); // devfs_mk_cdev(MKDEV(127, i), S_IFCHR | S_IRUGO | S_IWUGO, gpio_file[i].name); } gpio_init_flag=1; int gpios = 0; if (iswrt350n) { printk(KERN_EMERG "WRT350N GPIO Init\n"); /* For WRT350N USB LED control */ si_gpioreserve(gpio_sih, 0x400, GPIO_HI_PRIORITY); si_gpioouten(gpio_sih, 0x400, 0x400, GPIO_HI_PRIORITY); si_gpioreserve(gpio_sih, 0x800, GPIO_HI_PRIORITY); si_gpioouten(gpio_sih, 0x800, 0x800, GPIO_HI_PRIORITY); //if (nvram_match("disabled_5397", "1")) { // printk("5397 switch GPIO-Reset \n"); //} USB_SET_LED(USB_DISCONNECT); //2005-02-24 by kanki for USB LED } if (iswrt350n) { si_gpioreserve(gpio_sih, 0x4, GPIO_HI_PRIORITY); si_gpioouten(gpio_sih, 0x4, 0x4, GPIO_HI_PRIORITY); si_gpioout(gpio_sih, 0x4, 0x4, GPIO_HI_PRIORITY); } uint boardnum = bcm_strtoul( nvram_safe_get( "boardnum" ), NULL, 0 ); gpios = 1<<0 | 1<<1 | 1<<2 | 1<<3 | 1<<4 | 1<<5 | 1<<6 | 1<<7 | 1<<8 | 1<<9 | 1<<10 | 1<<11; if ((boardnum == 1 || boardnum == 3500) && nvram_match("boardtype", "0x04CF") && (nvram_match("boardrev", "0x1213") || nvram_match("boardrev", "02"))) { printk(KERN_EMERG "WNR3500V2 GPIO Init\n"); gpios = 1 << 1 | 1 << 2 | 1 << 3 | 1 << 7; } if ((boardnum == 42 || boardnum == 66) && nvram_match("boardtype", "0x04EF") && (nvram_match("boardrev", "0x1304") || nvram_match("boardrev", "0x1305") || nvram_match("boardrev", "0x1307"))) { printk(KERN_EMERG "WRT320N/E2000 GPIO Init\n"); gpios = 1 << 2 | 1 << 3 | 1 << 4; } if (boardnum == 42 && ((nvram_match("boot_hw_model", "WRT160N") && nvram_match("boot_hw_ver", "3.0")) || (nvram_match("boot_hw_model", "M10") && nvram_match("boot_hw_ver", "1.0")) || (nvram_match("boot_hw_model", "E100") && nvram_match("boot_hw_ver", "1.0")) ) ) { printk(KERN_EMERG "WRT160Nv3/M10/E1000 GPIO Init\n"); gpios = 1 << 1 | 1 << 2 | 1 << 4; } if (boardnum == 42 && ((nvram_match("boot_hw_model", "WRT310N") && nvram_match("boot_hw_ver", "2.0")) || (nvram_match("boot_hw_model", "M20") && nvram_match("boot_hw_ver", "1.0")) ) ) { printk(KERN_EMERG "WRT310Nv2/M20 GPIO Init\n"); gpios = 1 << 1 | 1 << 2 | 1 << 4; } if (nvram_match("boardnum", "00") && nvram_match("boardrev", "0x11") && nvram_match("boardtype", "0x048e") && (nvram_match("melco_id", "32093") || nvram_match("melco_id", "32064"))) { printk(KERN_EMERG "WHR-G125 / WHR-HP-G125 GPIO Init\n"); gpios = 1 << 1 | 1 << 6 | 1 << 7; } if (nvram_match("boardnum", "00") && nvram_match("boardrev", "0x13") && nvram_match("boardtype", "0x467")) { printk(KERN_EMERG "WHR-G54S / WHR-HP-G54 GPIO Init\n"); gpios = 1 << 1 | 1 << 6 | 1 << 7; } if (nvram_match("boardtype", "0x04cf") && (nvram_match("boot_hw_model", "WRT610N") || nvram_match("boot_hw_model", "E300"))) { printk(KERN_EMERG "WRT610Nv2/E3000 GPIO Init\n"); gpios = 1 << 0 | 1 << 3 | 1 << 5 | 1 << 7; } if (boardnum == 42 && nvram_match("boardrev", "0x10") && (nvram_match("boardtype", "0x0467") || nvram_match("boardtype", "0x0708") || nvram_match("boardtype", "0x0101"))) { printk(KERN_EMERG "WRT54G/GS/GL/TM GPIO Init\n"); gpios = 1 << 1 | 1 << 2 | 1 << 3 | 1 << 4 | 1 << 7; } if (boardnum == 45 && nvram_match("boardrev", "0x1402") && nvram_match("boardtype", "0x04EC")) { printk(KERN_EMERG "RT-N10 GPIO Init\n"); gpios = 1 << 1; } if (boardnum == 45 && nvram_match("boardrev", "0x1102") && nvram_match("boardtype", "0x0550")) { printk(KERN_EMERG "RT-N10U GPIO Init\n"); gpios = 1 << 5; } if (boardnum == 45 && nvram_match("boardrev", "0x1153") && nvram_match("boardtype", "0x058e")) { printk(KERN_EMERG "RT-N10+ D1 GPIO INIT\n"); gpios = 1 << 6 | 1 << 7 | 1 << 21 | 1 << 20; } if (boardnum == 1 && nvram_match("boardtype", "0xE4CD") && nvram_match("boardrev", "0x1700")) { printk(KERN_EMERG "WNR2000v2 GPIO Init\n"); gpios = 1 << 2 | 1 << 6 | 1 << 7 | 1 << 8; } if (boardnum == 45 && nvram_match("boardrev", "0x1201") && nvram_match("boardtype", "0x04CD")) { printk(KERN_EMERG "RT-N12 GPIO Init\n"); gpios = 1 << 0 | 1 << 2; } if (boardnum == 45 && nvram_match("boardrev", "0x1218") && nvram_match("boardtype", "0x04cf")) { printk(KERN_EMERG "RT-N16 GPIO Init\n"); gpios = 1 << 1; } if (boardnum == 1 && nvram_match("boardrev", "0x23") && nvram_match("boardtype", "0x0472")) { if (nvram_match("cardbus", "1")) { printk(KERN_EMERG "WNR324v2 GPIO Init\n"); gpios = 1 << 2 | 1 << 3 | 1 << 7; } else { printk(KERN_EMERG "WNDR3300 GPIO Init\n"); gpios = 1 << 5 | 1 << 7; } } if (nvram_match("boardnum", "00") && nvram_match("boardtype", "0x0101") && nvram_match("boardrev", "0x10")) { printk(KERN_EMERG "WBR2-G54(S) GPIO Init\n"); gpios = 1 << 1 | 1 << 6; } if (nvram_match("boardtype", "0xd4cf") && nvram_match("boardrev", "0x1204")) { printk(KERN_EMERG "F7D4301v1 GPIO Init\n"); gpios = 1 << 10 | 1 << 11 | 1 << 13; } if (nvram_match("boardtype", "0xa4cf") && (nvram_match("boardrev", "0x1100") || nvram_match("boardrev", "0x1102"))) { printk(KERN_EMERG "F7D3301v1/3302v1/4302v1 - F5D8235v3 GPIO Init\n"); gpios = 1 << 10 | 1 << 11 | 1 << 13; } if (nvram_match("boot_hw_model", "E1000") && (nvram_match("boot_hw_ver", "2.0") || nvram_match("boot_hw_ver", "2.1"))) { printk(KERN_EMERG "E1000v2/v21 GPIO Init\n"); gpios = 1 << 6 | 1 << 7 | 1 << 8; } if (nvram_match("boot_hw_model", "E4200") && nvram_match("boot_hw_ver", "1.0")) { printk(KERN_EMERG "E4200 GPIO Init\n"); gpios = 1 << 3 | 1 << 5; } if (nvram_match("boardnum", "01") && nvram_match("boardtype", "0xb4cf") && nvram_match("boardrev", "0x1100")) { printk(KERN_EMERG "WNDR3400 GPIO Init\n"); gpios = 1 << 0 | 1 << 1 | 1 << 2 | 1 << 3 | 1 << 7; } if (nvram_match("boardnum", "01") && nvram_match("boardtype", "0xF52C") && nvram_match("boardrev", "0x1101")) { printk(KERN_EMERG "WNDR4000 GPIO Init\n"); gpios = 1 << 0 | 1 << 6 | 1 << 7; } /*if (iswrt300n11) { printk(KERN_EMERG "WRT300N v1.1 GPIO Init\n"); int reset = 1 << 8; sb_gpioout(gpio_sbh, reset, 0, GPIO_DRV_PRIORITY); sb_gpioouten(gpio_sbh, reset, reset, GPIO_DRV_PRIORITY); bcm_mdelay(50); sb_gpioout(gpio_sbh, reset, reset, GPIO_DRV_PRIORITY); bcm_mdelay(20); }*/ for (i = 0; i < 16; i++) { if (gpios&1) { si_gpioreserve(gpio_sih, 1 << i, GPIO_APP_PRIORITY); } gpios>>=1; } return 0; }