mirror of
https://github.com/brain-hackers/u-boot-brain
synced 2024-09-30 16:40:44 +09:00
EXYNOS4210: Configure GPIO for uart
This patch configures the gpio values for UART on Origen and SMDKV310 using pinmux Signed-off-by: Rajeshwari Shinde <rajeshwari.s@samsung.com> Acked-by: Simon Glass <sjg@chromium.org> Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
This commit is contained in:
parent
6e50e5ca02
commit
198a40b9f6
@ -408,9 +408,49 @@ static int exynos4_mmc_config(int peripheral, int flags)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void exynos4_uart_config(int peripheral)
|
||||||
|
{
|
||||||
|
struct exynos4_gpio_part1 *gpio1 =
|
||||||
|
(struct exynos4_gpio_part1 *)samsung_get_base_gpio_part1();
|
||||||
|
struct s5p_gpio_bank *bank;
|
||||||
|
int i, start, count;
|
||||||
|
|
||||||
|
switch (peripheral) {
|
||||||
|
case PERIPH_ID_UART0:
|
||||||
|
bank = &gpio1->a0;
|
||||||
|
start = 0;
|
||||||
|
count = 4;
|
||||||
|
break;
|
||||||
|
case PERIPH_ID_UART1:
|
||||||
|
bank = &gpio1->a0;
|
||||||
|
start = 4;
|
||||||
|
count = 4;
|
||||||
|
break;
|
||||||
|
case PERIPH_ID_UART2:
|
||||||
|
bank = &gpio1->a1;
|
||||||
|
start = 0;
|
||||||
|
count = 4;
|
||||||
|
break;
|
||||||
|
case PERIPH_ID_UART3:
|
||||||
|
bank = &gpio1->a1;
|
||||||
|
start = 4;
|
||||||
|
count = 2;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
for (i = start; i < start + count; i++) {
|
||||||
|
s5p_gpio_set_pull(bank, i, GPIO_PULL_NONE);
|
||||||
|
s5p_gpio_cfg_pin(bank, i, GPIO_FUNC(0x2));
|
||||||
|
}
|
||||||
|
}
|
||||||
static int exynos4_pinmux_config(int peripheral, int flags)
|
static int exynos4_pinmux_config(int peripheral, int flags)
|
||||||
{
|
{
|
||||||
switch (peripheral) {
|
switch (peripheral) {
|
||||||
|
case PERIPH_ID_UART0:
|
||||||
|
case PERIPH_ID_UART1:
|
||||||
|
case PERIPH_ID_UART2:
|
||||||
|
case PERIPH_ID_UART3:
|
||||||
|
exynos4_uart_config(peripheral);
|
||||||
|
break;
|
||||||
case PERIPH_ID_I2C0:
|
case PERIPH_ID_I2C0:
|
||||||
case PERIPH_ID_I2C1:
|
case PERIPH_ID_I2C1:
|
||||||
case PERIPH_ID_I2C2:
|
case PERIPH_ID_I2C2:
|
||||||
|
@ -25,6 +25,8 @@
|
|||||||
#include <asm/arch/cpu.h>
|
#include <asm/arch/cpu.h>
|
||||||
#include <asm/arch/gpio.h>
|
#include <asm/arch/gpio.h>
|
||||||
#include <asm/arch/mmc.h>
|
#include <asm/arch/mmc.h>
|
||||||
|
#include <asm/arch/periph.h>
|
||||||
|
#include <asm/arch/pinmux.h>
|
||||||
|
|
||||||
DECLARE_GLOBAL_DATA_PTR;
|
DECLARE_GLOBAL_DATA_PTR;
|
||||||
struct exynos4_gpio_part1 *gpio1;
|
struct exynos4_gpio_part1 *gpio1;
|
||||||
@ -39,6 +41,50 @@ int board_init(void)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int board_uart_init(void)
|
||||||
|
{
|
||||||
|
int err;
|
||||||
|
|
||||||
|
err = exynos_pinmux_config(PERIPH_ID_UART0, PINMUX_FLAG_NONE);
|
||||||
|
if (err) {
|
||||||
|
debug("UART0 not configured\n");
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
|
err = exynos_pinmux_config(PERIPH_ID_UART1, PINMUX_FLAG_NONE);
|
||||||
|
if (err) {
|
||||||
|
debug("UART1 not configured\n");
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
|
err = exynos_pinmux_config(PERIPH_ID_UART2, PINMUX_FLAG_NONE);
|
||||||
|
if (err) {
|
||||||
|
debug("UART2 not configured\n");
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
|
err = exynos_pinmux_config(PERIPH_ID_UART3, PINMUX_FLAG_NONE);
|
||||||
|
if (err) {
|
||||||
|
debug("UART3 not configured\n");
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef CONFIG_BOARD_EARLY_INIT_F
|
||||||
|
int board_early_init_f(void)
|
||||||
|
{
|
||||||
|
int err;
|
||||||
|
err = board_uart_init();
|
||||||
|
if (err) {
|
||||||
|
debug("UART init failed\n");
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
int dram_init(void)
|
int dram_init(void)
|
||||||
{
|
{
|
||||||
gd->ram_size = get_ram_size((long *)PHYS_SDRAM_1, PHYS_SDRAM_1_SIZE)
|
gd->ram_size = get_ram_size((long *)PHYS_SDRAM_1, PHYS_SDRAM_1_SIZE)
|
||||||
|
@ -26,6 +26,8 @@
|
|||||||
#include <asm/arch/cpu.h>
|
#include <asm/arch/cpu.h>
|
||||||
#include <asm/arch/gpio.h>
|
#include <asm/arch/gpio.h>
|
||||||
#include <asm/arch/mmc.h>
|
#include <asm/arch/mmc.h>
|
||||||
|
#include <asm/arch/periph.h>
|
||||||
|
#include <asm/arch/pinmux.h>
|
||||||
#include <asm/arch/sromc.h>
|
#include <asm/arch/sromc.h>
|
||||||
|
|
||||||
DECLARE_GLOBAL_DATA_PTR;
|
DECLARE_GLOBAL_DATA_PTR;
|
||||||
@ -137,3 +139,47 @@ int board_mmc_init(bd_t *bis)
|
|||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static int board_uart_init(void)
|
||||||
|
{
|
||||||
|
int err;
|
||||||
|
|
||||||
|
err = exynos_pinmux_config(PERIPH_ID_UART0, PINMUX_FLAG_NONE);
|
||||||
|
if (err) {
|
||||||
|
debug("UART0 not configured\n");
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
|
err = exynos_pinmux_config(PERIPH_ID_UART1, PINMUX_FLAG_NONE);
|
||||||
|
if (err) {
|
||||||
|
debug("UART1 not configured\n");
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
|
err = exynos_pinmux_config(PERIPH_ID_UART2, PINMUX_FLAG_NONE);
|
||||||
|
if (err) {
|
||||||
|
debug("UART2 not configured\n");
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
|
err = exynos_pinmux_config(PERIPH_ID_UART3, PINMUX_FLAG_NONE);
|
||||||
|
if (err) {
|
||||||
|
debug("UART3 not configured\n");
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef CONFIG_BOARD_EARLY_INIT_F
|
||||||
|
int board_early_init_f(void)
|
||||||
|
{
|
||||||
|
int err;
|
||||||
|
err = board_uart_init();
|
||||||
|
if (err) {
|
||||||
|
debug("UART init failed\n");
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
@ -36,6 +36,7 @@
|
|||||||
#define CONFIG_ARCH_CPU_INIT
|
#define CONFIG_ARCH_CPU_INIT
|
||||||
#define CONFIG_DISPLAY_CPUINFO
|
#define CONFIG_DISPLAY_CPUINFO
|
||||||
#define CONFIG_DISPLAY_BOARDINFO
|
#define CONFIG_DISPLAY_BOARDINFO
|
||||||
|
#define CONFIG_BOARD_EARLY_INIT_F
|
||||||
|
|
||||||
/* Keep L2 Cache Disabled */
|
/* Keep L2 Cache Disabled */
|
||||||
#define CONFIG_L2_OFF 1
|
#define CONFIG_L2_OFF 1
|
||||||
|
@ -36,6 +36,7 @@
|
|||||||
#define CONFIG_ARCH_CPU_INIT
|
#define CONFIG_ARCH_CPU_INIT
|
||||||
#define CONFIG_DISPLAY_CPUINFO
|
#define CONFIG_DISPLAY_CPUINFO
|
||||||
#define CONFIG_DISPLAY_BOARDINFO
|
#define CONFIG_DISPLAY_BOARDINFO
|
||||||
|
#define CONFIG_BOARD_EARLY_INIT_F
|
||||||
|
|
||||||
/* Mach Type */
|
/* Mach Type */
|
||||||
#define CONFIG_MACH_TYPE MACH_TYPE_SMDKV310
|
#define CONFIG_MACH_TYPE MACH_TYPE_SMDKV310
|
||||||
|
Loading…
Reference in New Issue
Block a user