Merge branch 'u-boot-imx/master' into 'u-boot-arm/master'
[platform/kernel/u-boot.git] / board / samsung / smdk5420 / smdk5420.c
1 /*
2  * Copyright (C) 2013 Samsung Electronics
3  *
4  * SPDX-License-Identifier:     GPL-2.0+
5  */
6
7 #include <common.h>
8 #include <fdtdec.h>
9 #include <asm/io.h>
10 #include <i2c.h>
11 #include <lcd.h>
12 #include <spi.h>
13 #include <asm/arch/board.h>
14 #include <asm/arch/cpu.h>
15 #include <asm/arch/gpio.h>
16 #include <asm/arch/pinmux.h>
17 #include <asm/arch/dp_info.h>
18
19 DECLARE_GLOBAL_DATA_PTR;
20
21 #ifdef CONFIG_USB_EHCI_EXYNOS
22 static int board_usb_vbus_init(void)
23 {
24         /* Enable VBUS power switch */
25         gpio_direction_output(EXYNOS5420_GPIO_X26, 1);
26
27         /* VBUS turn ON time */
28         mdelay(3);
29
30         return 0;
31 }
32 #endif
33
34 int exynos_init(void)
35 {
36 #ifdef CONFIG_USB_EHCI_EXYNOS
37         board_usb_vbus_init();
38 #endif
39         return 0;
40 }
41
42 #ifdef CONFIG_LCD
43 void cfg_lcd_gpio(void)
44 {
45         struct exynos5_gpio_part1 *gpio1 =
46                 (struct exynos5_gpio_part1 *)samsung_get_base_gpio_part1();
47
48         /* For Backlight */
49         gpio_cfg_pin(EXYNOS5420_GPIO_B20, S5P_GPIO_OUTPUT);
50         gpio_set_value(EXYNOS5420_GPIO_B20, 1);
51
52         /* LCD power on */
53         gpio_cfg_pin(EXYNOS5420_GPIO_X15, S5P_GPIO_OUTPUT);
54         gpio_set_value(EXYNOS5420_GPIO_X15, 1);
55
56         /* Set Hotplug detect for DP */
57         gpio_cfg_pin(EXYNOS5420_GPIO_X07, S5P_GPIO_FUNC(0x3));
58 }
59
60 vidinfo_t panel_info = {
61         .vl_freq        = 60,
62         .vl_col         = 2560,
63         .vl_row         = 1600,
64         .vl_width       = 2560,
65         .vl_height      = 1600,
66         .vl_clkp        = CONFIG_SYS_LOW,
67         .vl_hsp         = CONFIG_SYS_LOW,
68         .vl_vsp         = CONFIG_SYS_LOW,
69         .vl_dp          = CONFIG_SYS_LOW,
70         .vl_bpix        = 4,    /* LCD_BPP = 2^4, for output conosle on LCD */
71
72         /* wDP panel timing infomation */
73         .vl_hspw        = 32,
74         .vl_hbpd        = 80,
75         .vl_hfpd        = 48,
76
77         .vl_vspw        = 6,
78         .vl_vbpd        = 37,
79         .vl_vfpd        = 3,
80         .vl_cmd_allow_len = 0xf,
81
82         .win_id         = 3,
83         .cfg_gpio       = cfg_lcd_gpio,
84         .backlight_on   = NULL,
85         .lcd_power_on   = NULL,
86         .reset_lcd      = NULL,
87         .dual_lcd_enabled = 0,
88
89         .init_delay     = 0,
90         .power_on_delay = 0,
91         .reset_delay    = 0,
92         .interface_mode = FIMD_RGB_INTERFACE,
93         .dp_enabled     = 1,
94 };
95
96 static struct edp_device_info edp_info = {
97         .disp_info = {
98                 .h_res = 2560,
99                 .h_sync_width = 32,
100                 .h_back_porch = 80,
101                 .h_front_porch = 48,
102                 .v_res = 1600,
103                 .v_sync_width  = 6,
104                 .v_back_porch = 37,
105                 .v_front_porch = 3,
106                 .v_sync_rate = 60,
107         },
108         .lt_info = {
109                 .lt_status = DP_LT_NONE,
110         },
111         .video_info = {
112                 .master_mode = 0,
113                 .bist_mode = DP_DISABLE,
114                 .bist_pattern = NO_PATTERN,
115                 .h_sync_polarity = 0,
116                 .v_sync_polarity = 0,
117                 .interlaced = 0,
118                 .color_space = COLOR_RGB,
119                 .dynamic_range = VESA,
120                 .ycbcr_coeff = COLOR_YCBCR601,
121                 .color_depth = COLOR_8,
122         },
123 };
124
125 static struct exynos_dp_platform_data dp_platform_data = {
126         .phy_enable     = set_dp_phy_ctrl,
127         .edp_dev_info   = &edp_info,
128 };
129
130 void init_panel_info(vidinfo_t *vid)
131 {
132         vid->rgb_mode   = MODE_RGB_P;
133
134         exynos_set_dp_platform_data(&dp_platform_data);
135 }
136 #endif
137
138 int board_get_revision(void)
139 {
140         return 0;
141 }