writel(value, &bank->drv);
}
+
+static char *gpio_name[] = {
+ "GPA0", "GPA1", "GPB", "GPC0", "GPC1", "GPD0", "GPD1", "GPE0", "GPE1",
+ "GPF0", "GPF1", "GPF2", "GPF3", "GPG0", "GPG1", "GPG2", "GPG3", "GPI",
+ "GPJ0", "GPJ1", "GPJ2", "GPJ3", "GPJ4", "MP01", "MP02", "MP03", "MP04",
+ "MP05", "MP06", "MP07", "MP10", "MP11", "MP12", "MP13", "MP14", "MP15",
+ "MP16", "MP17", "MP18", "MP20", "MP21", "MP22", "MP23", "MP24", "MP25",
+ "MP26", "MP27", "MP28",
+};
+
+static char *gpio_name1[] = {
+ "GPH0", "GPH1", "GPH2", "GPH3",
+};
+
+static int do_gpio(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
+{
+ struct s5pc110_gpio *gpio =
+ (struct s5pc110_gpio *)S5PC110_GPIO_BASE;
+ int i = 0;
+ int j;
+
+ if (argc == 1) {
+ cmd_usage(cmdtp);
+ return 1;
+ }
+
+ if (strcmp(argv[1], "show") == 0) {
+ while (1) {
+ printf("%s\n", gpio_name[i]);
+
+ for (j = 0; j < 8; j++) {
+ printf("[%d] %s", j,
+ gpio_get_value(&gpio->gpio_a0 + i, j) ?
+ "hi" : "low");
+ if ((j + 1) % 4)
+ printf("\t");
+ else
+ printf("\n");
+ }
+ printf("\n");
+
+ i++;
+ if ((&gpio->gpio_a0 + i) == &gpio->res1)
+ break;
+ }
+
+ for (i = 0; i < 4; i++) {
+ printf("%s\n", gpio_name1[i]);
+
+ for (j = 0; j < 8; j++) {
+ printf("[%d] %s", j,
+ gpio_get_value(&gpio->gpio_h0 + i, j) ?
+ "hi" : "low");
+ if ((j + 1) % 4)
+ printf("\t");
+ else
+ printf("\n");
+ }
+ printf("\n");
+ }
+
+ return 1;
+ } else if (strcmp(argv[1], "set") == 0) {
+ int num, value;
+
+ if (argc != 5) {
+ cmd_usage(cmdtp);
+ return 1;
+ }
+
+ if (strcmp(argv[2], "GPH0") == 0) {
+ i = 48 + 48 + 0;
+ } else if (strcmp(argv[2], "GPH1") == 0) {
+ i = 48 + 48 + 1;
+ } else if (strcmp(argv[2], "GPH2") == 0) {
+ i = 48 + 48 + 2;
+ } else if (strcmp(argv[2], "GPH3") == 0) {
+ i = 48 + 48 + 3;
+ } else {
+ while (1) {
+ if (strcmp(argv[2], gpio_name[i]) == 0)
+ break;
+ i++;
+
+ if ((&gpio->gpio_a0 + i) == &gpio->res1) {
+ printf("Can't found %s bank\n", argv[2]);
+ return 1;
+ }
+ }
+ }
+ num = simple_strtoul(argv[3], NULL, 10);
+ value = simple_strtoul(argv[4], NULL, 10);
+
+ gpio_set_value(&gpio->gpio_a0 + i, num, value);
+
+ printf("%s[%d] set to %s\n", argv[2], num,
+ value ? "hi" : "low");
+
+ return 1;
+ }
+
+ cmd_usage(cmdtp);
+ return 1;
+}
+
+U_BOOT_CMD(
+ gpio, CONFIG_SYS_MAXARGS, 1, do_gpio,
+ "GPIO Control",
+ "show - show all banks\n"
+ "gpio set bank num value - set gpio value\n"
+);