static int proc_read_dump(char *page, char **start, off_t off, int count, int *eof, void *data) { g_pdata->power(0); eeprom_check_cal(); return 0; }
static ssize_t dump_show(struct device *dev, struct device_attribute *attr, char *buf) { struct wimax732_platform_data *pdata = dev_get_drvdata(dev); pdata->power(0); eeprom_check_cal(); return 0; }
static int proc_write_eeprom(struct file *foke, const char *buffer, unsigned long count, void *data) { if (count != 5) return count; if (strncmp(buffer, "wb00", 4) == 0) { dump_debug("Write EEPROM!!"); eeprom_write_boot(); } else if (strncmp(buffer, "rb00", 4) == 0) { dump_debug("Read Boot!!"); eeprom_read_boot(); } else if (strncmp(buffer, "re00", 4) == 0) { dump_debug("Read EEPROM!!"); eeprom_read_all(); } else if (strncmp(buffer, "ee00", 4) == 0) { dump_debug("Erase EEPROM!!"); eeprom_erase_all(); } else if (strncmp(buffer, "rcal", 4) == 0) { dump_debug("Check Cal!!"); eeprom_check_cal(); } else if (strncmp(buffer, "ecer", 4) == 0) { dump_debug("Erase Cert!!"); eeprom_erase_cert(); } else if (strncmp(buffer, "rcer", 4) == 0) { dump_debug("Check Cert!!"); eeprom_check_cert(); } else if (strncmp(buffer, "wrev", 4) == 0) { dump_debug("Write Rev!!"); eeprom_write_rev(); } else if (strncmp(buffer, "ons0", 4) == 0) { dump_debug("Power On - SDIO MODE!!"); g_pdata->power(0); g_pdata->g_cfg->wimax_mode = SDIO_MODE; g_pdata->power(1); } else if (strncmp(buffer, "off0", 4) == 0) { dump_debug("Power Off!!"); g_pdata->power(0); } else if (strncmp(buffer, "wu00", 4) == 0) { dump_debug("WiMAX UART!!"); g_pdata->switch_uart_wimax(); } else if (strncmp(buffer, "au00", 4) == 0) { dump_debug("AP UART!!"); g_pdata->switch_uart_ap(); } else if (strncmp(buffer, "don0", 4) == 0) { dump_debug("Enable Dump!!"); g_pdata->g_cfg->enable_dump_msg = 1; } else if (strncmp(buffer, "doff", 4) == 0) { dump_debug("Disable Dump!!"); g_pdata->g_cfg->enable_dump_msg = 0; } else if (strncmp(buffer, "gpio", 4) == 0) { dump_debug("Display GPIOs!!"); g_pdata->display_gpios(); } else if (strncmp(buffer, "wake", 4) == 0) { dump_debug("g_pdata->wimax_wakeup!!"); g_pdata->wakeup_assert(1); msleep(10); g_pdata->wakeup_assert(0); } return count - 1; }
int swmxdev_ioctl(struct inode *inode, struct file *file, u_int cmd, u_long arg) { int ret = 0; u_int val = ((u_char *)arg)[0]; struct wimax732_platform_data *gpdata = (struct wimax732_platform_data *)(file->private_data); dump_debug("CMD: %x, PID: %d", cmd, current->tgid); switch (cmd) { case CONTROL_IOCTL_WIMAX_POWER_CTL: { dump_debug("CONTROL_IOCTL_WIMAX_POWER_CTL.."); if (val == 0) ret = gpdata->power(0); else ret = gpdata->power(1); break; } case CONTROL_IOCTL_WIMAX_MODE_CHANGE: { dump_debug("CONTROL_IOCTL_WIMAX_MODE_CHANGE" " to %d..", val); if ((val < 0) || (val > AUTH_MODE)) { dump_debug("Wrong mode %d", val); return 0; } gpdata->power(0); gpdata->g_cfg->wimax_mode = val; ret = gpdata->power(1); break; } case CONTROL_IOCTL_WIMAX_EEPROM_DOWNLOAD: { dump_debug("CNT_IOCTL_WIMAX_EEPROM_DOWNLOAD"); gpdata->power(0); ret = eeprom_write_boot(); break; } case CONTROL_IOCTL_WIMAX_SLEEP_MODE: { if (val == 0) { dump_debug("AP SLEEP: WIMAX VI"); gpdata->g_cfg->sleep_mode = 0; } else { dump_debug("AP SLEEP: WIMAX IDLE"); gpdata->g_cfg->sleep_mode = 1; } break; } case CONTROL_IOCTL_WIMAX_WRITE_REV: { dump_debug("CONTROL_IOCTL_WIMAX_WRITE_REV"); gpdata->power(0); ret = eeprom_write_rev(); break; } case CONTROL_IOCTL_WIMAX_CHECK_CERT: { dump_debug("CONTROL_IOCTL_WIMAX_CHECK_CERT"); gpdata->power(0); ret = eeprom_check_cert(); break; } case CONTROL_IOCTL_WIMAX_CHECK_CAL: { dump_debug("CONTROL_IOCTL_WIMAX_CHECK_CAL"); gpdata->power(0); ret = eeprom_check_cal(); break; } } /* switch (cmd) */ return ret; }
static ssize_t eeprom_store(struct device *dev, struct device_attribute *attr, const char *buffer, size_t count) { struct wimax732_platform_data *pdata = dev_get_drvdata(dev); if (count != 5) return count; if (strncmp(buffer, "wb00", 4) == 0) { dump_debug("Write EEPROM!!"); eeprom_write_boot(); } else if (strncmp(buffer, "rb00", 4) == 0) { dump_debug("Read Boot!!"); eeprom_read_boot(); } else if (strncmp(buffer, "re00", 4) == 0) { dump_debug("Read EEPROM!!"); eeprom_read_all(); } else if (strncmp(buffer, "rrdb", 4) == 0) { dump_debug("Read EEPROM(RDB)!!"); eeprom_read_RDB(); } else if (strncmp(buffer, "srdb", 4) == 0) { dump_debug("Store EEPROM(RDB)!!"); eeprom_store_RDB(); } else if (strncmp(buffer, "rcrt", 4) == 0) { dump_debug("Read EEPROM(CERTI)!!"); eeprom_read_CERTI(); } else if (strncmp(buffer, "ee00", 4) == 0) { dump_debug("Erase EEPROM!!"); eeprom_erase_all(); } else if (strncmp(buffer, "rcal", 4) == 0) { dump_debug("Check Cal!!"); eeprom_check_cal(); } else if (strncmp(buffer, "ecer", 4) == 0) { dump_debug("Erase Cert!!"); eeprom_erase_cert(); } else if (strncmp(buffer, "rcer", 4) == 0) { dump_debug("Check Cert!!"); eeprom_check_cert(); } else if (strncmp(buffer, "wrev", 4) == 0) { dump_debug("Write Rev!!"); eeprom_write_rev(); } else if (strncmp(buffer, "ons0", 4) == 0) { dump_debug("Power On - SDIO MODE!!"); pdata->power(0); pdata->g_cfg->wimax_mode = SDIO_MODE ; pdata->power(1); } else if (strncmp(buffer, "off0", 4) == 0) { dump_debug("Power Off!!"); pdata->power(0); } else if (strncmp(buffer, "wu00", 4) == 0) { dump_debug("WiMAX UART!!"); pdata->uart_wimax(); } else if (strncmp(buffer, "au00", 4) == 0) { dump_debug("AP UART!!"); pdata->uart_ap(); } else if (strncmp(buffer, "don0", 4) == 0) { dump_debug("Enable Dump!!"); pdata->g_cfg->enable_dump_msg = 1; } else if (strncmp(buffer, "doff", 4) == 0) { dump_debug("Disable Dump!!"); pdata->g_cfg->enable_dump_msg = 0; } else if (strncmp(buffer, "gpio", 4) == 0) { dump_debug("Display GPIOs!!"); pdata->gpio_display(); } else if (strncmp(buffer, "wake", 4) == 0) { dump_debug("WIMAX_WAKEUP!!"); pdata->wakeup_assert(1); msleep(10); pdata->wakeup_assert(0); } return count - 1; }