]> git.sur5r.net Git - u-boot/commitdiff
board:universal: Enable device tree on Universal
authorPiotr Wilczek <p.wilczek@samsung.com>
Fri, 7 Mar 2014 13:59:47 +0000 (14:59 +0100)
committerMinkyu Kang <mk7.kang@samsung.com>
Wed, 12 Mar 2014 10:55:00 +0000 (19:55 +0900)
This patch enables to run Universal board on device tree.

Signed-off-by: Piotr Wilczek <p.wilczek@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Acked-by: Przemyslaw Marczak <p.marczak@samsung.com>
Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
arch/arm/dts/Makefile
arch/arm/dts/exynos4210-universal_c210.dts [new file with mode: 0644]
board/samsung/universal_c210/universal.c
include/configs/s5pc210_universal.h

index dad03cf89fa06a68240464d98ee1536aa4ac8b65..488aec20033824ba24a562cad13ddd01dc895826 100644 (file)
@@ -1,4 +1,5 @@
-dtb-$(CONFIG_EXYNOS4) += exynos4210-origen.dtb
+dtb-$(CONFIG_EXYNOS4) += exynos4210-origen.dtb \
+       exynos4210-universal_c210.dtb
 
 dtb-$(CONFIG_EXYNOS5) += exynos5250-arndale.dtb \
        exynos5250-snow.dtb \
diff --git a/arch/arm/dts/exynos4210-universal_c210.dts b/arch/arm/dts/exynos4210-universal_c210.dts
new file mode 100644 (file)
index 0000000..1cdd981
--- /dev/null
@@ -0,0 +1,83 @@
+/*
+ * Samsung's Exynos4210 based Universal C210 board device tree source
+ *
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ *             http://www.samsung.com
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
+/dts-v1/;
+/include/ "exynos4.dtsi"
+
+/ {
+       model = "Samsung Universal C210 based on Exynos4210 rev0";
+       compatible = "samsung,universal_c210", "samsung,exynos4210";
+
+       aliases {
+               serial0 = "/serial@13800000";
+               console = "/serial@13820000";
+               mmc0 = "sdhci@12510000";
+               mmc2 = "sdhci@12530000";
+       };
+
+       sdhci@12510000 {
+               samsung,bus-width = <8>;
+               samsung,timing = <1 3 3>;
+               pwr-gpios = <&gpio 0x2008002 0>;
+       };
+
+       sdhci@12520000 {
+               status = "disabled";
+       };
+
+       sdhci@12530000 {
+               samsung,bus-width = <4>;
+               samsung,timing = <1 2 3>;
+               cd-gpios = <&gpio 0x20c6004 0>;
+       };
+
+       sdhci@12540000 {
+               status = "disabled";
+       };
+
+       fimd@11c00000 {
+               compatible = "samsung,exynos-fimd";
+               reg = <0x11c00000 0xa4>;
+
+               samsung,vl-freq = <60>;
+               samsung,vl-col = <480>;
+               samsung,vl-row = <800>;
+               samsung,vl-width = <480>;
+               samsung,vl-height = <800>;
+
+               samsung,vl-clkp = <0>;
+               samsung,vl-oep = <0>;
+               samsung,vl-hsp = <1>;
+               samsung,vl-vsp = <1>;
+               samsung,vl-dp = <1>;
+               samsung,vl-bpix = <4>;
+
+               samsung,vl-hspw = <2>;
+               samsung,vl-hbpd = <16>;
+               samsung,vl-hfpd = <16>;
+               samsung,vl-vspw = <2>;
+               samsung,vl-vbpd = <8>;
+               samsung,vl-vfpd = <8>;
+               samsung,vl-cmd-allow-len = <0xf>;
+
+               samsung,pclk_name = <1>;
+               samsung,sclk_div = <1>;
+
+               samsung,winid = <0>;
+               samsung,power-on-delay = <10000>;
+               samsung,interface-mode = <1>;
+               samsung,mipi-enabled = <0>;
+               samsung,dp-enabled;
+               samsung,dual-lcd-enabled;
+
+               samsung,logo-on = <1>;
+               samsung,resolution = <0>;
+               samsung,rgb-mode = <0>;
+       };
+};
index 96da7e0861eb996586388ab815095a1d1dd9d280..f9d71b617dd0256a4083f329cbf67884d8261fff 100644 (file)
 #include <asm/gpio.h>
 #include <asm/arch/adc.h>
 #include <asm/arch/gpio.h>
-#include <asm/arch/mmc.h>
 #include <asm/arch/pinmux.h>
 #include <asm/arch/watchdog.h>
-#include <libtizen.h>
 #include <ld9040.h>
 #include <power/pmic.h>
+#include <usb.h>
 #include <usb/s3c_udc.h>
 #include <asm/arch/cpu.h>
 #include <power/max8998_pmic.h>
+#include <libtizen.h>
 #include <samsung/misc.h>
+#include <usb_mass_storage.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -42,7 +43,7 @@ static int get_hwrev(void)
 
 static void init_pmic_lcd(void);
 
-int power_init_board(void)
+int exynos_power_init(void)
 {
        int ret;
 
@@ -59,22 +60,6 @@ int power_init_board(void)
        return 0;
 }
 
-int dram_init(void)
-{
-       gd->ram_size = get_ram_size((long *)PHYS_SDRAM_1, PHYS_SDRAM_1_SIZE) +
-               get_ram_size((long *)PHYS_SDRAM_2, PHYS_SDRAM_2_SIZE);
-
-       return 0;
-}
-
-void dram_init_banksize(void)
-{
-       gd->bd->bi_dram[0].start = PHYS_SDRAM_1;
-       gd->bd->bi_dram[0].size = PHYS_SDRAM_1_SIZE;
-       gd->bd->bi_dram[1].start = PHYS_SDRAM_2;
-       gd->bd->bi_dram[1].size = PHYS_SDRAM_2_SIZE;
-}
-
 static unsigned short get_adc_value(int channel)
 {
        struct s5p_adc *adc = (struct s5p_adc *)samsung_get_base_adc();
@@ -159,71 +144,6 @@ static void check_hw_revision(void)
        board_rev |= hwrev;
 }
 
-#ifdef CONFIG_DISPLAY_BOARDINFO
-int checkboard(void)
-{
-       puts("Board:\tUniversal C210\n");
-       return 0;
-}
-#endif
-
-#ifdef CONFIG_GENERIC_MMC
-int board_mmc_init(bd_t *bis)
-{
-       int err;
-
-       switch (get_hwrev()) {
-       case 0:
-               /*
-                * Set the low to enable LDO_EN
-                * But when you use the test board for eMMC booting
-                * you should set it HIGH since it removes the inverter
-                */
-               /* MASSMEMORY_EN: XMDMDATA_6: GPE3[6] */
-               s5p_gpio_direction_output(&gpio1->e3, 6, 0);
-               break;
-       default:
-               /*
-                * Default reset state is High and there's no inverter
-                * But set it as HIGH to ensure
-                */
-               /* MASSMEMORY_EN: XMDMADDR_3: GPE1[3] */
-               s5p_gpio_direction_output(&gpio1->e1, 3, 1);
-               break;
-       }
-
-       /*
-        * MMC device init
-        * mmc0  : eMMC (8-bit buswidth)
-        * mmc2  : SD card (4-bit buswidth)
-        */
-       err = exynos_pinmux_config(PERIPH_ID_SDMMC0, PINMUX_FLAG_8BIT_MODE);
-       if (err)
-               debug("SDMMC0 not configured\n");
-       else
-               err = s5p_mmc_init(0, 8);
-
-       /* T-flash detect */
-       s5p_gpio_cfg_pin(&gpio2->x3, 4, 0xf);
-       s5p_gpio_set_pull(&gpio2->x3, 4, GPIO_PULL_UP);
-
-       /*
-        * Check the T-flash  detect pin
-        * GPX3[4] T-flash detect pin
-        */
-       if (!s5p_gpio_get_value(&gpio2->x3, 4)) {
-               err = exynos_pinmux_config(PERIPH_ID_SDMMC2, PINMUX_FLAG_NONE);
-               if (err)
-                       debug("SDMMC2 not configured\n");
-               else
-                       err = s5p_mmc_init(2, 4);
-       }
-
-       return err;
-
-}
-#endif
-
 #ifdef CONFIG_USB_GADGET
 static int s5pc210_phy_control(int on)
 {
@@ -271,7 +191,20 @@ struct s3c_plat_otg_data s5pc210_otg_data = {
 };
 #endif
 
-int board_early_init_f(void)
+int board_usb_init(int index, enum usb_init_type init)
+{
+       debug("USB_udc_probe\n");
+       return s3c_udc_probe(&s5pc210_otg_data);
+}
+
+#ifdef CONFIG_USB_CABLE_CHECK
+int usb_cable_connected(void)
+{
+       return 0;
+}
+#endif
+
+int exynos_early_init_f(void)
 {
        wdt_stop();
 
@@ -412,6 +345,11 @@ void exynos_cfg_lcd_gpio(void)
        spi_init();
 }
 
+int mipi_power(void)
+{
+       return 0;
+}
+
 void exynos_reset_lcd(void)
 {
        s5p_gpio_set_value(&gpio2->y4, 5, 1);
@@ -436,39 +374,6 @@ void exynos_lcd_power_on(void)
        pmic_set_output(p, MAX8998_REG_ONOFF2, MAX8998_LDO7, LDO_ON);
 }
 
-vidinfo_t panel_info = {
-       .vl_freq        = 60,
-       .vl_col         = 480,
-       .vl_row         = 800,
-       .vl_width       = 480,
-       .vl_height      = 800,
-       .vl_clkp        = CONFIG_SYS_HIGH,
-       .vl_hsp         = CONFIG_SYS_HIGH,
-       .vl_vsp         = CONFIG_SYS_HIGH,
-       .vl_dp          = CONFIG_SYS_HIGH,
-
-       .vl_bpix        = 4,    /* Bits per pixel */
-
-       /* LD9040 LCD Panel */
-       .vl_hspw        = 2,
-       .vl_hbpd        = 16,
-       .vl_hfpd        = 16,
-
-       .vl_vspw        = 2,
-       .vl_vbpd        = 8,
-       .vl_vfpd        = 8,
-       .vl_cmd_allow_len = 0xf,
-
-       .win_id         = 0,
-       .dual_lcd_enabled = 0,
-
-       .init_delay     = 0,
-       .power_on_delay = 10000,
-       .reset_delay    = 10000,
-       .interface_mode = FIMD_RGB_INTERFACE,
-       .mipi_enabled   = 0,
-};
-
 void exynos_cfg_ldo(void)
 {
        ld9040_cfg_ldo();
@@ -479,30 +384,32 @@ void exynos_enable_ldo(unsigned int onoff)
        ld9040_enable_ldo(onoff);
 }
 
-void init_panel_info(vidinfo_t *vid)
-{
-       vid->logo_on    = 1;
-       vid->resolution = HD_RESOLUTION;
-       vid->rgb_mode   = MODE_RGB_P;
-
-#ifdef CONFIG_TIZEN
-       get_tizen_logo_info(vid);
-#endif
-
-       /* for LD9040. */
-       vid->pclk_name = 1;     /* MPLL */
-       vid->sclk_div = 1;
-
-       setenv("lcdinfo", "lcd=ld9040");
-}
-
-int board_init(void)
+int exynos_init(void)
 {
        gpio1 = (struct exynos4_gpio_part1 *) EXYNOS4_GPIO_PART1_BASE;
        gpio2 = (struct exynos4_gpio_part2 *) EXYNOS4_GPIO_PART2_BASE;
 
        gd->bd->bi_arch_number = MACH_TYPE_UNIVERSAL_C210;
-       gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x100;
+
+       switch (get_hwrev()) {
+       case 0:
+               /*
+                * Set the low to enable LDO_EN
+                * But when you use the test board for eMMC booting
+                * you should set it HIGH since it removes the inverter
+                */
+               /* MASSMEMORY_EN: XMDMDATA_6: GPE3[6] */
+               s5p_gpio_direction_output(&gpio1->e3, 6, 0);
+               break;
+       default:
+               /*
+                * Default reset state is High and there's no inverter
+                * But set it as HIGH to ensure
+                */
+               /* MASSMEMORY_EN: XMDMADDR_3: GPE1[3] */
+               s5p_gpio_direction_output(&gpio1->e1, 3, 1);
+               break;
+       }
 
 #ifdef CONFIG_SOFT_SPI
        soft_spi_init();
@@ -513,20 +420,15 @@ int board_init(void)
        return 0;
 }
 
-#ifdef CONFIG_MISC_INIT_R
-int misc_init_r(void)
+void exynos_lcd_misc_init(vidinfo_t *vid)
 {
-#ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
-       set_board_info();
-#endif
-#ifdef CONFIG_LCD_MENU
-       keys_init();
-       check_boot_mode();
-#endif
-#ifdef CONFIG_CMD_BMP
-       if (panel_info.logo_on)
-               draw_logo();
+#ifdef CONFIG_TIZEN
+       get_tizen_logo_info(vid);
 #endif
-       return 0;
+
+       /* for LD9040. */
+       vid->pclk_name = 1;     /* MPLL */
+       vid->sclk_div = 1;
+
+       setenv("lcdinfo", "lcd=ld9040");
 }
-#endif
index 67921e900be196ad40c41d22c764f038b510bdea..2da887109d985a0d0d91c11c0c05c73ef0f2219c 100644 (file)
@@ -7,78 +7,56 @@
  * SPDX-License-Identifier:    GPL-2.0+
  */
 
-#ifndef __CONFIG_H
-#define __CONFIG_H
+#ifndef __CONFIG_UNIVERSAL_H
+#define __CONFIG_UNIVERSAL_H
 
-/*
- * High Level Configuration Options
- * (easy to change)
- */
-#define CONFIG_SAMSUNG         1       /* in a SAMSUNG core */
-#define CONFIG_S5P             1       /* which is in a S5P Family */
-#define CONFIG_EXYNOS4210      1       /* which is in a EXYNOS4210 */
-#define CONFIG_UNIVERSAL       1       /* working with Universal */
-#define CONFIG_TIZEN           1       /* TIZEN lib */
+#include <configs/exynos4-dt.h>
+
+#define CONFIG_SYS_PROMPT      "Universal # "  /* Monitor Command Prompt */
 
-#include <asm/arch/cpu.h>              /* get chip and board defs */
+#undef CONFIG_DEFAULT_DEVICE_TREE
+#define CONFIG_DEFAULT_DEVICE_TREE     exynos4210-universal_c210
 
-#define CONFIG_ARCH_CPU_INIT
-#define CONFIG_DISPLAY_CPUINFO
-#define CONFIG_DISPLAY_BOARDINFO
+#define CONFIG_TIZEN                   /* TIZEN lib */
 
 /* Keep L2 Cache Disabled */
 #define CONFIG_SYS_L2CACHE_OFF         1
 
+/* Universal has 2 banks of DRAM */
+#define CONFIG_NR_DRAM_BANKS           2
 #define CONFIG_SYS_SDRAM_BASE          0x40000000
-#define CONFIG_SYS_TEXT_BASE           0x44800000
-
-/* input clock of PLL: Universal has 24MHz input clock at EXYNOS4210 */
-#define CONFIG_SYS_CLK_FREQ_C210       24000000
-#define CONFIG_SYS_CLK_FREQ            CONFIG_SYS_CLK_FREQ_C210
+#define PHYS_SDRAM_1                   CONFIG_SYS_SDRAM_BASE
 
-#define CONFIG_SETUP_MEMORY_TAGS
-#define CONFIG_CMDLINE_TAG
-#define CONFIG_INITRD_TAG
-#define CONFIG_REVISION_TAG
-#define CONFIG_CMDLINE_EDITING
-#define CONFIG_SKIP_LOWLEVEL_INIT
-#define CONFIG_BOARD_EARLY_INIT_F
+#define SDRAM_BANK_SIZE                        (256 << 20)     /* 256 MB */
 
 /* Size of malloc() pool */
-#define CONFIG_SYS_MALLOC_LEN          (CONFIG_ENV_SIZE + (1 << 20))
+#define CONFIG_SYS_MALLOC_LEN          (CONFIG_ENV_SIZE + (80 * SZ_1M))
 
 /* select serial console configuration */
-#define CONFIG_SERIAL2         1       /* use SERIAL 2 */
-#define CONFIG_BAUDRATE                115200
-
-/* MMC */
-#define CONFIG_GENERIC_MMC
-#define CONFIG_MMC
-#define CONFIG_SDHCI
-#define CONFIG_S5P_SDHCI
-
-/* PWM */
-#define CONFIG_PWM                     1
-
-/* It should define before config_cmd_default.h */
-#define CONFIG_SYS_NO_FLASH            1
-
-/* Command definition */
-#include <config_cmd_default.h>
-
-#undef CONFIG_CMD_FPGA
-#undef CONFIG_CMD_MISC
-#undef CONFIG_CMD_NET
-#undef CONFIG_CMD_NFS
-#undef CONFIG_CMD_XIMG
-#define CONFIG_CMD_CACHE
-#define CONFIG_CMD_ONENAND
-#define CONFIG_CMD_MTDPARTS
-#define CONFIG_CMD_MMC
-#define CONFIG_CMD_FAT
-
-#define CONFIG_BOOTDELAY               1
-#define CONFIG_ZERO_BOOTDELAY_CHECK
+#define CONFIG_SERIAL2
+#define CONFIG_BAUDRATE                        115200
+
+/* Console configuration */
+#define CONFIG_SYS_CONSOLE_INFO_QUIET
+#define CONFIG_SYS_CONSOLE_IS_IN_ENV
+
+#define CONFIG_BOOTARGS                        "Please use defined boot"
+#define CONFIG_BOOTCOMMAND             "run mmcboot"
+#define CONFIG_DEFAULT_CONSOLE         "console=ttySAC1,115200n8\0"
+
+#define CONFIG_SYS_INIT_SP_ADDR        (CONFIG_SYS_LOAD_ADDR \
+                                       - GENERATED_GBL_DATA_SIZE)
+
+#define CONFIG_SYS_MEM_TOP_HIDE        (1 << 20)       /* ram console */
+
+#define CONFIG_SYS_MONITOR_BASE        0x00000000
+
+/* memtest works on */
+#define CONFIG_SYS_MEMTEST_START       CONFIG_SYS_SDRAM_BASE
+#define CONFIG_SYS_MEMTEST_END         (CONFIG_SYS_SDRAM_BASE + 0x5000000)
+#define CONFIG_SYS_LOAD_ADDR           (CONFIG_SYS_SDRAM_BASE + 0x4800000)
+
+#define CONFIG_SYS_TEXT_BASE           0x44800000
 
 #define CONFIG_MTD_DEVICE
 #define CONFIG_MTD_PARTITIONS
                                ",100M(swap)"\
                                ",-(UMS)\0"
 
-#define CONFIG_BOOTARGS                "Please use defined boot"
-#define CONFIG_BOOTCOMMAND     "run mmcboot"
-#define CONFIG_DEFAULT_CONSOLE "console=ttySAC2,115200n8\0"
-
 #define CONFIG_ENV_UBI_MTD     " ubi.mtd=${ubiblock} ubi.mtd=4 ubi.mtd=7"
 #define CONFIG_BOOTBLOCK       "10"
 #define CONFIG_UBIBLOCK                "9"
 
+#define CONFIG_ENV_IS_IN_MMC
+#define CONFIG_SYS_MMC_ENV_DEV         CONFIG_MMC_DEFAULT_DEV
+#define CONFIG_ENV_SIZE                        4096
+#define CONFIG_ENV_OFFSET              ((32 - 4) << 10) /* 32KiB - 4KiB */
+
 #define CONFIG_ENV_UBIFS_OPTION        " rootflags=bulk_read,no_chk_data_crc "
 #define CONFIG_ENV_FLASHBOOT   CONFIG_ENV_UBI_MTD CONFIG_ENV_UBIFS_OPTION \
                                "${mtdparts}"
 
 #define CONFIG_ENV_COMMON_BOOT "${console} ${meminfo}"
 
-#define CONFIG_ENV_OVERWRITE
-#define CONFIG_SYS_CONSOLE_INFO_QUIET
-#define CONFIG_SYS_CONSOLE_IS_IN_ENV
-
 #define CONFIG_ENV_VARS_UBOOT_CONFIG
 #define CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
 
        "mmcrootpart=3\0" \
        "opts=always_resume=1"
 
-/* Miscellaneous configurable options */
-#define CONFIG_SYS_LONGHELP            /* undef to save memory */
-#define CONFIG_SYS_HUSH_PARSER         /* use "hush" command parser    */
-#define CONFIG_SYS_PROMPT      "Universal # "
-#define CONFIG_SYS_CBSIZE      256     /* Console I/O Buffer Size */
-#define CONFIG_SYS_PBSIZE      384     /* Print Buffer Size */
-#define CONFIG_SYS_MAXARGS     16      /* max number of command args */
-/* Boot Argument Buffer Size */
-#define CONFIG_SYS_BARGSIZE            CONFIG_SYS_CBSIZE
-/* memtest works on */
-#define CONFIG_SYS_MEMTEST_START       CONFIG_SYS_SDRAM_BASE
-#define CONFIG_SYS_MEMTEST_END         (CONFIG_SYS_SDRAM_BASE + 0x5000000)
-#define CONFIG_SYS_LOAD_ADDR           (CONFIG_SYS_SDRAM_BASE + 0x4800000)
-
-/* Universal has 2 banks of DRAM */
-#define CONFIG_NR_DRAM_BANKS   2
-#define PHYS_SDRAM_1           CONFIG_SYS_SDRAM_BASE   /* LDDDR2 DMC 0 */
-#define PHYS_SDRAM_1_SIZE      (256 << 20)             /* 256 MB in CS 0 */
-#define PHYS_SDRAM_2           0x50000000              /* LPDDR2 DMC 1 */
-#define PHYS_SDRAM_2_SIZE      (256 << 20)             /* 256 MB in CS 0 */
-
-#define CONFIG_SYS_MEM_TOP_HIDE                (1 << 20)       /* ram console */
-
-#define CONFIG_SYS_MONITOR_BASE                0x00000000
-#define CONFIG_SYS_MONITOR_LEN         (256 << 10)     /* Reserve 2 sectors */
-
 #define CONFIG_USE_ONENAND_BOARD_INIT
 #define CONFIG_SAMSUNG_ONENAND
 #define CONFIG_SYS_ONENAND_BASE                0x0C000000
 
-#define CONFIG_ENV_IS_IN_MMC           1
-#define CONFIG_SYS_MMC_ENV_DEV         0
-#define CONFIG_ENV_SIZE                        4096
-#define CONFIG_ENV_OFFSET              ((32 - 4) << 10)/* 32KiB - 4KiB */
-
-#define CONFIG_DOS_PARTITION           1
-
-#define CONFIG_SYS_INIT_SP_ADDR        (CONFIG_SYS_LOAD_ADDR - GENERATED_GBL_DATA_SIZE)
-
-#define CONFIG_SYS_CACHELINE_SIZE       32
-
 #include <asm/arch/gpio.h>
 /*
  * I2C Settings
 #define CONFIG_SOFT_I2C_GPIO_SCL exynos4_gpio_get(1, b, 7)
 #define CONFIG_SOFT_I2C_GPIO_SDA exynos4_gpio_get(1, b, 6)
 
+#define CONFIG_CMD_I2C
+
 #define CONFIG_SYS_I2C
 #define CONFIG_SYS_I2C_SOFT            /* I2C bit-banged */
 #define CONFIG_SYS_I2C_SOFT_SPEED      50000
@@ -307,8 +247,10 @@ int universal_spi_read(void);
 #define CONFIG_CMD_BMP
 #define CONFIG_BMP_16BPP
 #define CONFIG_LD9040
-#define CONFIG_EXYNOS_MIPI_DSIM
 #define CONFIG_VIDEO_BMP_GZIP
 #define CONFIG_SYS_VIDEO_LOGO_MAX_SIZE ((500 * 160 * 4) + 54)
 
+#define LCD_XRES       480
+#define LCD_YRES       800
+
 #endif /* __CONFIG_H */