void exynos5_spi_config(int peripheral) { int cfg = 0, pin = 0, i; switch (peripheral) { case PERIPH_ID_SPI0: cfg = S5P_GPIO_FUNC(0x2); pin = EXYNOS5_GPIO_A20; break; case PERIPH_ID_SPI1: cfg = S5P_GPIO_FUNC(0x2); pin = EXYNOS5_GPIO_A24; break; case PERIPH_ID_SPI2: cfg = S5P_GPIO_FUNC(0x5); pin = EXYNOS5_GPIO_B11; break; case PERIPH_ID_SPI3: cfg = S5P_GPIO_FUNC(0x2); pin = EXYNOS5_GPIO_F10; break; case PERIPH_ID_SPI4: for (i = 0; i < 2; i++) { gpio_cfg_pin(EXYNOS5_GPIO_F02 + i, S5P_GPIO_FUNC(0x4)); gpio_cfg_pin(EXYNOS5_GPIO_E04 + i, S5P_GPIO_FUNC(0x4)); } break; } if (peripheral != PERIPH_ID_SPI4) { for (i = pin; i < pin + 4; i++) gpio_cfg_pin(i, cfg); } }
static void exynos_pinmux_i2c(int start, int func) { gpio_cfg_pin(start, GPIO_FUNC(func)); gpio_cfg_pin(start + 1, GPIO_FUNC(func)); gpio_set_pull(start, GPIO_PULL_NONE); gpio_set_pull(start + 1, GPIO_PULL_NONE); }
static void check_hw_revision(void) { int modelrev = 0; int i; /* * GPM1[1:0]: MODEL_REV[1:0] * Don't set as pull-none for these N/C pin. * TRM say that it may cause unexcepted state and leakage current. * and pull-none is only for output function. */ for (i = EXYNOS4X12_GPIO_M10; i < EXYNOS4X12_GPIO_M12; i++) gpio_cfg_pin(i, S5P_GPIO_INPUT); /* GPM1[5:2]: HW_REV[3:0] */ for (i = EXYNOS4X12_GPIO_M12; i < EXYNOS4X12_GPIO_M16; i++) { gpio_cfg_pin(i, S5P_GPIO_INPUT); gpio_set_pull(i, S5P_GPIO_PULL_NONE); } /* GPM1[1:0]: MODEL_REV[1:0] */ for (i = 0; i < 2; i++) modelrev |= (gpio_get_value(EXYNOS4X12_GPIO_M10 + i) << i); /* board_rev[15:8] = model */ board_rev = modelrev << 8; }
int board_mmc_init(bd_t *bis) { int i, ret, ret_sd = 0; /* MASSMEMORY_EN: XMSMDATA7: GPJ2[7] output high */ gpio_request(S5PC110_GPIO_J27, "massmemory_en"); gpio_direction_output(S5PC110_GPIO_J27, 1); /* * MMC0 GPIO * GPG0[0] SD_0_CLK * GPG0[1] SD_0_CMD * GPG0[2] SD_0_CDn -> Not used * GPG0[3:6] SD_0_DATA[0:3] */ for (i = S5PC110_GPIO_G00; i < S5PC110_GPIO_G07; i++) { if (i == S5PC110_GPIO_G02) continue; /* GPG0[0:6] special function 2 */ gpio_cfg_pin(i, 0x2); /* GPG0[0:6] pull disable */ gpio_set_pull(i, S5P_GPIO_PULL_NONE); /* GPG0[0:6] drv 4x */ gpio_set_drv(i, S5P_GPIO_DRV_4X); } ret = s5p_mmc_init(0, 4); if (ret) pr_err("MMC: Failed to init MMC:0.\n"); /* * SD card (T_FLASH) detect and init * T_FLASH_DETECT: EINT28: GPH3[4] input mode */ gpio_request(S5PC110_GPIO_H34, "t_flash_detect"); gpio_cfg_pin(S5PC110_GPIO_H34, S5P_GPIO_INPUT); gpio_set_pull(S5PC110_GPIO_H34, S5P_GPIO_PULL_UP); if (!gpio_get_value(S5PC110_GPIO_H34)) { for (i = S5PC110_GPIO_G20; i < S5PC110_GPIO_G27; i++) { if (i == S5PC110_GPIO_G22) continue; /* GPG2[0:6] special function 2 */ gpio_cfg_pin(i, 0x2); /* GPG2[0:6] pull disable */ gpio_set_pull(i, S5P_GPIO_PULL_NONE); /* GPG2[0:6] drv 4x */ gpio_set_drv(i, S5P_GPIO_DRV_4X); } ret_sd = s5p_mmc_init(2, 4); if (ret_sd) pr_err("MMC: Failed to init SD card (MMC:2).\n"); } return ret & ret_sd; }
void exynos_pinmux_lcd(void) { gpio_cfg_pin(GPIO_Y25, GPIO_OUTPUT); gpio_set_value(GPIO_Y25, 1); gpio_cfg_pin(GPIO_X15, GPIO_OUTPUT); gpio_set_value(GPIO_X15, 1); gpio_cfg_pin(GPIO_X30, GPIO_OUTPUT); gpio_set_value(GPIO_X30, 1); }
void exynos_pinmux_spi4(void) { int i; for (i = 0; i < 2; i++) { gpio_cfg_pin(GPIO_F02 + i, GPIO_FUNC(0x4)); gpio_cfg_pin(GPIO_E04 + i, GPIO_FUNC(0x4)); } }
int do_led_sample(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { int i, j; struct s5p_gpio_bank gpio_bank; unsigned char value, tmp = 0x0f; unsigned char led_patten[] = { 0x0f, //0000_1111 0x0e, //0000_1110 0x0d, //0000_1101 0x0b, //0000_1011 0x07, //0000_0111 0x00, //0000_0000 0x05, //0000_0101 0x0a, //0000_1010 }; printf("%s\n", __func__); gpio_bank.con = GPIO_M4_CON; gpio_bank.dat = GPIO_M4_DAT; gpio_bank.pull = GPIO_M4_PULL; gpio_bank.drv = GPIO_M4_DRV; gpio_bank.pdn_con = GPIO_M4_PDN_CON; gpio_bank.pdn_pull = GPIO_M4_PDN_PULL; /* configure gpio as output */ gpio_cfg_pin(&gpio_bank, 0, 1); gpio_cfg_pin(&gpio_bank, 1, 1); gpio_cfg_pin(&gpio_bank, 2, 1); gpio_cfg_pin(&gpio_bank, 3, 1); /* disabled GPM4PUD */ gpio_set_pull(&gpio_bank, 0, GPIO_PULL_NONE); gpio_set_pull(&gpio_bank, 1, GPIO_PULL_NONE); gpio_set_pull(&gpio_bank, 2, GPIO_PULL_NONE); gpio_set_pull(&gpio_bank, 3, GPIO_PULL_NONE); for (j = 0; j < 2; j++) { tmp = 0x0f; /* led_0 ~ led_3 off */ gpio_set_value(&gpio_bank, 0, 1); gpio_set_value(&gpio_bank, 1, 1); gpio_set_value(&gpio_bank, 2, 1); gpio_set_value(&gpio_bank, 3, 1); for (i = 0; i < 8; i++) { tmp = tmp < i; set_led(&gpio_bank, led_patten[i]); udelay(1000000); } } return 0; }
static int exynos5_mmc_config(int peripheral, int flags) { int i, start, start_ext, gpio_func = 0; switch (peripheral) { case PERIPH_ID_SDMMC0: start = EXYNOS5_GPIO_C00; start_ext = EXYNOS5_GPIO_C10; gpio_func = S5P_GPIO_FUNC(0x2); break; case PERIPH_ID_SDMMC1: start = EXYNOS5_GPIO_C20; start_ext = 0; break; case PERIPH_ID_SDMMC2: start = EXYNOS5_GPIO_C30; start_ext = EXYNOS5_GPIO_C43; gpio_func = S5P_GPIO_FUNC(0x3); break; case PERIPH_ID_SDMMC3: start = EXYNOS5_GPIO_C40; start_ext = 0; break; default: debug("%s: invalid peripheral %d", __func__, peripheral); return -1; } if ((flags & PINMUX_FLAG_8BIT_MODE) && !start_ext) { debug("SDMMC device %d does not support 8bit mode", peripheral); return -1; } if (flags & PINMUX_FLAG_8BIT_MODE) { for (i = start_ext; i <= (start_ext + 3); i++) { gpio_cfg_pin(i, gpio_func); gpio_set_pull(i, S5P_GPIO_PULL_UP); gpio_set_drv(i, S5P_GPIO_DRV_4X); } } for (i = start; i < (start + 2); i++) { gpio_cfg_pin(i, S5P_GPIO_FUNC(0x2)); gpio_set_pull(i, S5P_GPIO_PULL_NONE); gpio_set_drv(i, S5P_GPIO_DRV_4X); } for (i = (start + 3); i <= (start + 6); i++) { gpio_cfg_pin(i, S5P_GPIO_FUNC(0x2)); gpio_set_pull(i, S5P_GPIO_PULL_UP); gpio_set_drv(i, S5P_GPIO_DRV_4X); } return 0; }
static void exynos_dp_bridge_setup(void) { exynos_pinmux_dphpd(); gpio_set_value(dp_pd_l, 1); gpio_cfg_pin(dp_pd_l, GPIO_OUTPUT); gpio_set_pull(dp_pd_l, GPIO_PULL_NONE); gpio_set_value(dp_rst_l, 0); gpio_cfg_pin(dp_rst_l, GPIO_OUTPUT); gpio_set_pull(dp_rst_l, GPIO_PULL_NONE); udelay(10); gpio_set_value(dp_rst_l, 1); }
static void exynos5_i2s_config(int peripheral) { int i; switch (peripheral) { case PERIPH_ID_I2S0: for (i = 0; i < 5; i++) gpio_cfg_pin(EXYNOS5_GPIO_Z0 + i, S5P_GPIO_FUNC(0x02)); break; case PERIPH_ID_I2S1: for (i = 0; i < 5; i++) gpio_cfg_pin(EXYNOS5_GPIO_B00 + i, S5P_GPIO_FUNC(0x02)); break; } }
int board_mmc_init(bd_t *bis) { int i, err; /* * MMC2 SD card GPIO: * * GPK2[0] SD_2_CLK(2) * GPK2[1] SD_2_CMD(2) * GPK2[2] SD_2_CDn * GPK2[3:6] SD_2_DATA[0:3](2) */ for (i = EXYNOS4_GPIO_K20; i < EXYNOS4_GPIO_K27; i++) { /* GPK2[0:6] special function 2 */ gpio_cfg_pin(i, S5P_GPIO_FUNC(0x2)); /* GPK2[0:6] drv 4x */ gpio_set_drv(i, S5P_GPIO_DRV_4X); /* GPK2[0:1] pull disable */ if (i == EXYNOS4_GPIO_K20 || i == EXYNOS4_GPIO_K21) { gpio_set_pull(i, S5P_GPIO_PULL_NONE); continue; } /* GPK2[2:6] pull up */ gpio_set_pull(i, S5P_GPIO_PULL_UP); } err = s5p_mmc_init(2, 4); return err; }
void exynos_cfg_lcd_gpio(void) { /* For Backlight */ gpio_request(EXYNOS5_GPIO_B20, "lcd_backlight"); gpio_cfg_pin(EXYNOS5_GPIO_B20, S5P_GPIO_OUTPUT); gpio_set_value(EXYNOS5_GPIO_B20, 1); }
int board_mmc_init(bd_t *bis) { int i; /* MASSMEMORY_EN: XMSMDATA7: GPJ2[7] output high */ gpio_direction_output(&s5pc110_gpio->j2, 7, 1); /* * MMC0 GPIO * GPG0[0] SD_0_CLK * GPG0[1] SD_0_CMD * GPG0[2] SD_0_CDn -> Not used * GPG0[3:6] SD_0_DATA[0:3] */ for (i = 0; i < 7; i++) { if (i == 2) continue; /* GPG0[0:6] special function 2 */ gpio_cfg_pin(&s5pc110_gpio->g0, i, 0x2); /* GPG0[0:6] pull disable */ gpio_set_pull(&s5pc110_gpio->g0, i, GPIO_PULL_NONE); /* GPG0[0:6] drv 4x */ gpio_set_drv(&s5pc110_gpio->g0, i, GPIO_DRV_4X); } return s5p_mmc_init(0, 4); }
static void exynos4x12_uart_config(int peripheral) { int i, start, count; switch (peripheral) { case PERIPH_ID_UART0: start = EXYNOS4X12_GPIO_A00; count = 4; break; case PERIPH_ID_UART1: start = EXYNOS4X12_GPIO_A04; count = 4; break; case PERIPH_ID_UART2: start = EXYNOS4X12_GPIO_A10; count = 4; break; case PERIPH_ID_UART3: start = EXYNOS4X12_GPIO_A14; count = 2; break; default: debug("%s: invalid peripheral %d", __func__, peripheral); return; } for (i = start; i < (start + count); i++) { gpio_set_pull(i, S5P_GPIO_PULL_NONE); gpio_cfg_pin(i, S5P_GPIO_FUNC(0x2)); } }
static unsigned int get_hw_revision(void) { int hwrev = 0; char str[10]; int i; /* hw_rev[3:0] == GPE1[3:0] */ for (i = 0; i < 4; i++) { int pin = i + EXYNOS4_GPIO_E10; sprintf(str, "hw_rev%d", i); gpio_request(pin, str); gpio_cfg_pin(pin, S5P_GPIO_INPUT); gpio_set_pull(pin, S5P_GPIO_PULL_NONE); } udelay(1); for (i = 0; i < 4; i++) hwrev |= (gpio_get_value(EXYNOS4_GPIO_E10 + i) << i); debug("hwrev 0x%x\n", hwrev); return hwrev; }
void exynos_pinmux_sromc(int bank, int sixteen_bit) { int i; if (bank > 3) { printk(BIOS_DEBUG, "Unsupported sromc bank %d.\n", bank); return; } gpio_cfg_pin(GPIO_Y00 + bank, GPIO_FUNC(2)); gpio_cfg_pin(GPIO_Y04, GPIO_FUNC(2)); gpio_cfg_pin(GPIO_Y05, GPIO_FUNC(2)); for (i = 2; i < 4; i++) gpio_cfg_pin(GPIO_Y10 + i, GPIO_FUNC(2)); for (i = 0; i < 8; i++) { gpio_cfg_pin(GPIO_Y30 + i, GPIO_FUNC(2)); gpio_set_pull(GPIO_Y30 + i, GPIO_PULL_UP); gpio_cfg_pin(GPIO_Y50 + i, GPIO_FUNC(2)); gpio_set_pull(GPIO_Y50 + i, GPIO_PULL_UP); if (sixteen_bit) { gpio_cfg_pin(GPIO_Y60 + i, GPIO_FUNC(2)); gpio_set_pull(GPIO_Y60 + i, GPIO_PULL_UP); } } }
static int exynos4_mmc_config(int peripheral, int flags) { int i, start = 0, start_ext = 0; unsigned int func, ext_func; switch (peripheral) { case PERIPH_ID_SDMMC0: start = EXYNOS4_GPIO_K00; start_ext = EXYNOS4_GPIO_K13; func = S5P_GPIO_FUNC(0x2); ext_func = S5P_GPIO_FUNC(0x3); break; case PERIPH_ID_SDMMC2: start = EXYNOS4_GPIO_K20; start_ext = EXYNOS4_GPIO_K33; func = S5P_GPIO_FUNC(0x2); ext_func = S5P_GPIO_FUNC(0x3); break; case PERIPH_ID_SDMMC4: start = EXYNOS4_GPIO_K00; start_ext = EXYNOS4_GPIO_K13; func = S5P_GPIO_FUNC(0x3); ext_func = S5P_GPIO_FUNC(0x4); break; default: return -1; } for (i = start; i < (start + 7); i++) { if (i == (start + 2)) continue; gpio_cfg_pin(i, func); gpio_set_pull(i, S5P_GPIO_PULL_NONE); gpio_set_drv(i, S5P_GPIO_DRV_4X); } /* SDMMC2 do not use 8bit mode at exynos4 */ if (flags & PINMUX_FLAG_8BIT_MODE) { for (i = start_ext; i < (start_ext + 4); i++) { gpio_cfg_pin(i, ext_func); gpio_set_pull(i, S5P_GPIO_PULL_NONE); gpio_set_drv(i, S5P_GPIO_DRV_4X); } } return 0; }
static void exynos_pinmux_uart(int start, int count) { int i; for (i = start; i < start + count; i++) { gpio_set_pull(i, GPIO_PULL_NONE); gpio_cfg_pin(i, GPIO_FUNC(0x2)); } }
void exynos_pinmux_i2s1(void) { int i; for (i = 0; i < 5; i++) { gpio_cfg_pin(GPIO_B00 + i, GPIO_FUNC(0x02)); gpio_set_pull(GPIO_B00 + i, GPIO_PULL_NONE); } }
void exynos5420_spi_config(int peripheral) { int cfg, pin, i; switch (peripheral) { case PERIPH_ID_SPI0: pin = EXYNOS5420_GPIO_A20; cfg = S5P_GPIO_FUNC(0x2); break; case PERIPH_ID_SPI1: pin = EXYNOS5420_GPIO_A24; cfg = S5P_GPIO_FUNC(0x2); break; case PERIPH_ID_SPI2: pin = EXYNOS5420_GPIO_B11; cfg = S5P_GPIO_FUNC(0x5); break; case PERIPH_ID_SPI3: pin = EXYNOS5420_GPIO_F10; cfg = S5P_GPIO_FUNC(0x2); break; case PERIPH_ID_SPI4: cfg = 0; pin = 0; break; default: cfg = 0; pin = 0; debug("%s: invalid peripheral %d", __func__, peripheral); return; } if (peripheral != PERIPH_ID_SPI4) { for (i = pin; i < pin + 4; i++) gpio_cfg_pin(i, cfg); } else { for (i = 0; i < 2; i++) { gpio_cfg_pin(EXYNOS5420_GPIO_F02 + i, S5P_GPIO_FUNC(0x4)); gpio_cfg_pin(EXYNOS5420_GPIO_E04 + i, S5P_GPIO_FUNC(0x4)); } } }
static void exynos_pinmux_spi(int start, int cfg) { int i; for (i = start; i < start + 4; i++) { gpio_cfg_pin(i, cfg); gpio_set_pull(i, GPIO_PULL_NONE); gpio_set_drv(i, GPIO_DRV_3X); } }
static void exynos_pinmux_spi(int start, int cfg) { int i; for (i = 0; i < 4; i++) { gpio_cfg_pin(start + i, GPIO_FUNC(cfg)); gpio_set_pull(start + i, GPIO_PULL_NONE); gpio_set_drv(start + i, GPIO_DRV_3X); } }
static void parade_dp_bridge_setup(void) { int i; gpio_set_value(dp_pd_l, 1); gpio_cfg_pin(dp_pd_l, GPIO_OUTPUT); gpio_set_pull(dp_pd_l, GPIO_PULL_NONE); gpio_set_value(dp_rst_l, 0); gpio_cfg_pin(dp_rst_l, GPIO_OUTPUT); gpio_set_pull(dp_rst_l, GPIO_PULL_NONE); udelay(10); gpio_set_value(dp_rst_l, 1); gpio_set_pull(dp_hpd, GPIO_PULL_NONE); gpio_cfg_pin(dp_hpd, GPIO_INPUT); /* De-assert PD (and possibly RST) to power up the bridge. */ gpio_set_value(dp_pd_l, 1); gpio_set_value(dp_rst_l, 1); /* Hang around for the bridge to come up. */ mdelay(40); /* Configure the bridge chip. */ exynos_pinmux_i2c7(); i2c_init(7, 100000, 0x00); parade_ps8625_bridge_setup(7, 0x48, parade_writes, ARRAY_SIZE(parade_writes)); /* Spin until the display is ready. * It's quite important to try really hard to get the display up, * so be generous. It will typically be ready in only 5 ms. and * we're out of here. * If it's not ready after a second, then we're in big trouble. */ for(i = 0; i < 1000; i++){ if (gpio_get_value(dp_hpd)) break; mdelay(1); } }
static void exynos_pinmux_sdmmc(struct gpio *gpios, int num_gpios) { int i; for (i = 0; i < num_gpios; i++) { gpio_set_drv(gpios[i].pin, gpios[i].drv); gpio_set_pull(gpios[i].pin, gpios[i].pull); gpio_cfg_pin(gpios[i].pin, GPIO_FUNC(gpios[i].func)); } }
static int exynos5_pinmux_config(int peripheral, int flags) { switch (peripheral) { case PERIPH_ID_UART0: case PERIPH_ID_UART1: case PERIPH_ID_UART2: case PERIPH_ID_UART3: exynos5_uart_config(peripheral); break; case PERIPH_ID_SDMMC0: case PERIPH_ID_SDMMC1: case PERIPH_ID_SDMMC2: case PERIPH_ID_SDMMC3: return exynos5_mmc_config(peripheral, flags); case PERIPH_ID_SROMC: exynos5_sromc_config(flags); break; case PERIPH_ID_I2C0: case PERIPH_ID_I2C1: case PERIPH_ID_I2C2: case PERIPH_ID_I2C3: case PERIPH_ID_I2C4: case PERIPH_ID_I2C5: case PERIPH_ID_I2C6: case PERIPH_ID_I2C7: exynos5_i2c_config(peripheral, flags); break; case PERIPH_ID_I2S0: case PERIPH_ID_I2S1: exynos5_i2s_config(peripheral); break; case PERIPH_ID_SPI0: case PERIPH_ID_SPI1: case PERIPH_ID_SPI2: case PERIPH_ID_SPI3: case PERIPH_ID_SPI4: exynos5_spi_config(peripheral); break; case PERIPH_ID_DPHPD: /* Set Hotplug detect for DP */ gpio_cfg_pin(EXYNOS5_GPIO_X07, S5P_GPIO_FUNC(0x3)); /* * Hotplug detect should have an external pullup; disable the * internal pulldown so they don't fight. */ gpio_set_pull(EXYNOS5_GPIO_X07, S5P_GPIO_PULL_NONE); break; default: debug("%s: invalid peripheral %d", __func__, peripheral); return -1; } return 0; }
int board_dp_bridge_setup(const void *blob, unsigned *wait_ms) { int ret; ret = board_dp_fill_gpios(blob); if (ret) return ret; /* Mux HPHPD to the special hotplug detect mode */ exynos_pinmux_config(PERIPH_ID_DPHPD, 0); /* Setup the GPIOs */ ret = fdtdec_setup_gpio(&local.dp_pd); if (ret) { debug("%s: Could not setup pd gpio (%d)\n", __func__, ret); return ret; } ret = fdtdec_setup_gpio(&local.dp_rst); if (ret) { debug("%s: Could not setup rst gpio (%d)\n", __func__, ret); return ret; } ret = fdtdec_setup_gpio(&local.dp_hpd); if (ret) { debug("%s: Could not setup hpd gpio (%d)\n", __func__, ret); return ret; } fdtdec_set_gpio(&local.dp_pd, 0); gpio_cfg_pin(local.dp_pd.gpio, EXYNOS_GPIO_OUTPUT); gpio_set_pull(local.dp_pd.gpio, EXYNOS_GPIO_PULL_NONE); if (fdt_gpio_isvalid(&local.dp_rst)) { fdtdec_set_gpio(&local.dp_rst, 1); gpio_cfg_pin(local.dp_rst.gpio, EXYNOS_GPIO_OUTPUT); gpio_set_pull(local.dp_rst.gpio, EXYNOS_GPIO_PULL_NONE); udelay(10); fdtdec_set_gpio(&local.dp_rst, 0); } *wait_ms = 0; return 0; }
void exynos_pinmux_dphpd(void) { /* Set Hotplug detect for DP */ gpio_cfg_pin(GPIO_X07, GPIO_FUNC(0x3)); /* * Hotplug detect should have an external pullup; disable the * internal pulldown so they don't fight. */ gpio_set_pull(GPIO_X07, GPIO_PULL_NONE); }
void exynos_backlight_on(unsigned int onoff) { /* For PWM */ gpio_request(EXYNOS5420_GPIO_B20, "backlight_on"); gpio_cfg_pin(EXYNOS5420_GPIO_B20, S5P_GPIO_FUNC(0x1)); gpio_set_value(EXYNOS5420_GPIO_B20, 1); #ifdef CONFIG_POWER_TPS65090 tps65090_fet_enable(1); #endif }
void gpio_direction_output(struct s5p_gpio_bank *bank, int gpio, int en) { unsigned int value; gpio_cfg_pin(bank, gpio, GPIO_OUTPUT); value = readl(&bank->dat); value &= ~DAT_MASK(gpio); if (en) value |= DAT_SET(gpio); writel(value, &bank->dat); }
static void exynos_pinmux_sdmmc(int start, int start_ext) { int i; if (start_ext) { for (i = 0; i <= 3; i++) { gpio_cfg_pin(start_ext + i, GPIO_FUNC(0x2)); gpio_set_pull(start_ext + i, GPIO_PULL_UP); gpio_set_drv(start_ext + i, GPIO_DRV_4X); } } for (i = 0; i < 2; i++) { gpio_cfg_pin(start + i, GPIO_FUNC(0x2)); gpio_set_pull(start + i, GPIO_PULL_NONE); gpio_set_drv(start + i, GPIO_DRV_4X); } for (i = 2; i <= 6; i++) { gpio_cfg_pin(start + i, GPIO_FUNC(0x2)); gpio_set_pull(start + i, GPIO_PULL_UP); gpio_set_drv(start + i, GPIO_DRV_4X); } }