Ronald G. Minnich | f89e6b2 | 2012-12-10 16:13:43 -0800 | [diff] [blame] | 1 | /* |
Stefan Reinauer | 043eb0e | 2013-05-10 16:21:58 -0700 | [diff] [blame] | 2 | * This file is part of the coreboot project. |
Ronald G. Minnich | f89e6b2 | 2012-12-10 16:13:43 -0800 | [diff] [blame] | 3 | * |
Stefan Reinauer | 08dc357 | 2013-05-14 16:57:50 -0700 | [diff] [blame] | 4 | * Copyright 2013 Google Inc. |
Stefan Reinauer | 043eb0e | 2013-05-10 16:21:58 -0700 | [diff] [blame] | 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License as published by |
| 8 | * the Free Software Foundation; version 2 of the License. |
Ronald G. Minnich | f89e6b2 | 2012-12-10 16:13:43 -0800 | [diff] [blame] | 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
Ronald G. Minnich | f89e6b2 | 2012-12-10 16:13:43 -0800 | [diff] [blame] | 14 | */ |
| 15 | |
Julius Werner | 1ed0c8c | 2014-10-20 13:16:29 -0700 | [diff] [blame] | 16 | #include <arch/cache.h> |
| 17 | #include <boot/coreboot_tables.h> |
David Hendricks | 50c0a50 | 2013-01-31 17:05:50 -0800 | [diff] [blame] | 18 | #include <console/console.h> |
Julius Werner | 1ed0c8c | 2014-10-20 13:16:29 -0700 | [diff] [blame] | 19 | #include <delay.h> |
Stefan Reinauer | 2ae6d6f | 2013-05-09 16:16:13 -0700 | [diff] [blame] | 20 | #include <device/device.h> |
Nico Huber | 0f2dd1e | 2017-08-01 14:02:40 +0200 | [diff] [blame] | 21 | #include <device/i2c_simple.h> |
Stefan Reinauer | 2ae6d6f | 2013-05-09 16:16:13 -0700 | [diff] [blame] | 22 | #include <drivers/ti/tps65090/tps65090.h> |
Stefan Reinauer | 2ae6d6f | 2013-05-09 16:16:13 -0700 | [diff] [blame] | 23 | #include <edid.h> |
Julius Werner | 1ed0c8c | 2014-10-20 13:16:29 -0700 | [diff] [blame] | 24 | #include <soc/clk.h> |
| 25 | #include <soc/dp.h> |
| 26 | #include <soc/dp-core.h> |
| 27 | #include <soc/gpio.h> |
| 28 | #include <soc/i2c.h> |
| 29 | #include <soc/periph.h> |
| 30 | #include <soc/power.h> |
| 31 | #include <soc/tmu.h> |
| 32 | #include <soc/usb.h> |
Julius Werner | ec5e5e0 | 2014-08-20 15:29:56 -0700 | [diff] [blame] | 33 | #include <symbols.h> |
Julius Werner | 1ed0c8c | 2014-10-20 13:16:29 -0700 | [diff] [blame] | 34 | #include <vbe.h> |
David Hendricks | 0d4f97e | 2013-02-03 18:09:58 -0800 | [diff] [blame] | 35 | |
Stefan Reinauer | 043eb0e | 2013-05-10 16:21:58 -0700 | [diff] [blame] | 36 | #include "exynos5250.h" |
David Hendricks | 0d4f97e | 2013-02-03 18:09:58 -0800 | [diff] [blame] | 37 | |
Julius Werner | ad4556f2 | 2013-08-21 17:33:31 -0700 | [diff] [blame] | 38 | #define MMC0_GPIO_PIN (58) |
| 39 | |
Stefan Reinauer | 2ae6d6f | 2013-05-09 16:16:13 -0700 | [diff] [blame] | 40 | /* convenient shorthand (in MB) */ |
Julius Werner | ec5e5e0 | 2014-08-20 15:29:56 -0700 | [diff] [blame] | 41 | #define DRAM_START ((uintptr_t)_dram/MiB) |
Stefan Reinauer | 2ae6d6f | 2013-05-09 16:16:13 -0700 | [diff] [blame] | 42 | #define DRAM_SIZE CONFIG_DRAM_SIZE_MB |
| 43 | #define DRAM_END (DRAM_START + DRAM_SIZE) /* plus one... */ |
| 44 | |
Stefan Reinauer | 043eb0e | 2013-05-10 16:21:58 -0700 | [diff] [blame] | 45 | static struct edid edid = { |
David Hendricks | 7dbf9c6 | 2015-07-30 18:49:48 -0700 | [diff] [blame] | 46 | .mode.ha = 1366, |
| 47 | .mode.va = 768, |
Ronald G. Minnich | 9518b56 | 2013-09-19 16:45:22 -0700 | [diff] [blame] | 48 | .framebuffer_bits_per_pixel = 16, |
Gabe Black | dcaaba4 | 2013-07-07 04:05:51 -0700 | [diff] [blame] | 49 | .x_resolution = 1366, |
| 50 | .y_resolution = 768, |
| 51 | .bytes_per_line = 2 * 1366 |
David Hendricks | 0d4f97e | 2013-02-03 18:09:58 -0800 | [diff] [blame] | 52 | }; |
| 53 | |
Stefan Reinauer | 2ae6d6f | 2013-05-09 16:16:13 -0700 | [diff] [blame] | 54 | /* TODO: transplanted DP stuff, clean up once we have something that works */ |
| 55 | static enum exynos5_gpio_pin dp_pd_l = GPIO_Y25; /* active low */ |
| 56 | static enum exynos5_gpio_pin dp_rst_l = GPIO_X15; /* active low */ |
| 57 | static enum exynos5_gpio_pin dp_hpd = GPIO_X07; /* active high */ |
| 58 | |
| 59 | static void exynos_dp_bridge_setup(void) |
Ronald G. Minnich | f89e6b2 | 2012-12-10 16:13:43 -0800 | [diff] [blame] | 60 | { |
Gabe Black | fe64060 | 2013-06-15 20:33:05 -0700 | [diff] [blame] | 61 | exynos_pinmux_dphpd(); |
David Hendricks | 0d4f97e | 2013-02-03 18:09:58 -0800 | [diff] [blame] | 62 | |
Stefan Reinauer | 2ae6d6f | 2013-05-09 16:16:13 -0700 | [diff] [blame] | 63 | gpio_set_value(dp_pd_l, 1); |
Stefan Reinauer | dc006c1 | 2013-05-15 14:54:07 -0700 | [diff] [blame] | 64 | gpio_cfg_pin(dp_pd_l, GPIO_OUTPUT); |
| 65 | gpio_set_pull(dp_pd_l, GPIO_PULL_NONE); |
David Hendricks | 0d4f97e | 2013-02-03 18:09:58 -0800 | [diff] [blame] | 66 | |
Stefan Reinauer | 2ae6d6f | 2013-05-09 16:16:13 -0700 | [diff] [blame] | 67 | gpio_set_value(dp_rst_l, 0); |
Stefan Reinauer | dc006c1 | 2013-05-15 14:54:07 -0700 | [diff] [blame] | 68 | gpio_cfg_pin(dp_rst_l, GPIO_OUTPUT); |
| 69 | gpio_set_pull(dp_rst_l, GPIO_PULL_NONE); |
Stefan Reinauer | 2ae6d6f | 2013-05-09 16:16:13 -0700 | [diff] [blame] | 70 | udelay(10); |
| 71 | gpio_set_value(dp_rst_l, 1); |
Ronald G. Minnich | f89e6b2 | 2012-12-10 16:13:43 -0800 | [diff] [blame] | 72 | } |
| 73 | |
Stefan Reinauer | 2ae6d6f | 2013-05-09 16:16:13 -0700 | [diff] [blame] | 74 | static void exynos_dp_bridge_init(void) |
| 75 | { |
| 76 | /* De-assert PD (and possibly RST) to power up the bridge */ |
| 77 | gpio_set_value(dp_pd_l, 1); |
| 78 | gpio_set_value(dp_rst_l, 1); |
| 79 | |
| 80 | /* |
| 81 | * We need to wait for 90ms after bringing up the bridge since |
| 82 | * there is a phantom "high" on the HPD chip during its |
| 83 | * bootup. The phantom high comes within 7ms of de-asserting |
| 84 | * PD and persists for at least 15ms. The real high comes |
| 85 | * roughly 50ms after PD is de-asserted. The phantom high |
| 86 | * makes it hard for us to know when the NXP chip is up. |
| 87 | */ |
| 88 | udelay(90000); |
| 89 | } |
| 90 | |
| 91 | static int exynos_dp_hotplug(void) |
| 92 | { |
| 93 | /* Check HPD. If it's high, we're all good. */ |
| 94 | return gpio_get_value(dp_hpd) ? 0 : 1; |
| 95 | } |
| 96 | |
| 97 | static void exynos_dp_reset(void) |
| 98 | { |
| 99 | gpio_set_value(dp_pd_l, 0); |
| 100 | gpio_set_value(dp_rst_l, 0); |
| 101 | /* paranoid delay period (300ms) */ |
| 102 | udelay(300 * 1000); |
| 103 | } |
| 104 | |
| 105 | /* |
| 106 | * This delay is T3 in the LCD timing spec (defined as >200ms). We set |
| 107 | * this down to 60ms since that's the approximate maximum amount of time |
| 108 | * it'll take a bridge to start outputting LVDS data. The delay of |
| 109 | * >200ms is just a conservative value to avoid turning on the backlight |
| 110 | * when there's random LCD data on the screen. Shaving 140ms off the |
| 111 | * boot is an acceptable trade-off. |
| 112 | */ |
| 113 | #define LCD_T3_DELAY_MS 60 |
| 114 | |
| 115 | #define LCD_T5_DELAY_MS 10 |
| 116 | #define LCD_T6_DELAY_MS 10 |
| 117 | |
Stefan Reinauer | 043eb0e | 2013-05-10 16:21:58 -0700 | [diff] [blame] | 118 | static void backlight_pwm(void) |
Stefan Reinauer | 2ae6d6f | 2013-05-09 16:16:13 -0700 | [diff] [blame] | 119 | { |
| 120 | /*Configure backlight PWM as a simple output high (100% brightness) */ |
| 121 | gpio_direction_output(GPIO_B20, 1); |
| 122 | udelay(LCD_T6_DELAY_MS * 1000); |
| 123 | } |
| 124 | |
Stefan Reinauer | 043eb0e | 2013-05-10 16:21:58 -0700 | [diff] [blame] | 125 | static void backlight_en(void) |
Stefan Reinauer | 2ae6d6f | 2013-05-09 16:16:13 -0700 | [diff] [blame] | 126 | { |
Stefan Reinauer | dc006c1 | 2013-05-15 14:54:07 -0700 | [diff] [blame] | 127 | /* Configure GPIO for LCD_BL_EN */ |
Stefan Reinauer | 2ae6d6f | 2013-05-09 16:16:13 -0700 | [diff] [blame] | 128 | gpio_direction_output(GPIO_X30, 1); |
| 129 | } |
| 130 | |
Gabe Black | 49c98dc | 2014-01-22 21:06:32 -0800 | [diff] [blame] | 131 | #define TPS65090_BUS 4 /* Daisy-specific */ |
Stefan Reinauer | 2ae6d6f | 2013-05-09 16:16:13 -0700 | [diff] [blame] | 132 | |
| 133 | #define FET1_CTRL 0x0f |
Julius Werner | ad4556f2 | 2013-08-21 17:33:31 -0700 | [diff] [blame] | 134 | #define FET4_CTRL 0x12 |
Stefan Reinauer | 2ae6d6f | 2013-05-09 16:16:13 -0700 | [diff] [blame] | 135 | #define FET6_CTRL 0x14 |
| 136 | |
Stefan Reinauer | 043eb0e | 2013-05-10 16:21:58 -0700 | [diff] [blame] | 137 | static void lcd_vdd(void) |
Stefan Reinauer | 2ae6d6f | 2013-05-09 16:16:13 -0700 | [diff] [blame] | 138 | { |
| 139 | /* Enable FET6, lcd panel */ |
David Hendricks | 8ccabb6 | 2013-08-01 19:12:56 -0700 | [diff] [blame] | 140 | tps65090_fet_enable(TPS65090_BUS, FET6_CTRL); |
Stefan Reinauer | 2ae6d6f | 2013-05-09 16:16:13 -0700 | [diff] [blame] | 141 | } |
| 142 | |
Stefan Reinauer | 043eb0e | 2013-05-10 16:21:58 -0700 | [diff] [blame] | 143 | static void backlight_vdd(void) |
Stefan Reinauer | 2ae6d6f | 2013-05-09 16:16:13 -0700 | [diff] [blame] | 144 | { |
| 145 | /* Enable FET1, backlight */ |
David Hendricks | 8ccabb6 | 2013-08-01 19:12:56 -0700 | [diff] [blame] | 146 | tps65090_fet_enable(TPS65090_BUS, FET1_CTRL); |
Stefan Reinauer | 2ae6d6f | 2013-05-09 16:16:13 -0700 | [diff] [blame] | 147 | udelay(LCD_T5_DELAY_MS * 1000); |
| 148 | } |
| 149 | |
Julius Werner | ad4556f2 | 2013-08-21 17:33:31 -0700 | [diff] [blame] | 150 | static void sdmmc_vdd(void) |
| 151 | { |
| 152 | /* Enable FET4, P3.3V_SDCARD */ |
| 153 | tps65090_fet_enable(TPS65090_BUS, FET4_CTRL); |
| 154 | } |
| 155 | |
Julius Werner | 79bff70 | 2013-08-15 17:34:45 -0700 | [diff] [blame] | 156 | static enum exynos5_gpio_pin usb_host_vbus = GPIO_X11; |
| 157 | static enum exynos5_gpio_pin usb_drd_vbus = GPIO_X27; |
| 158 | /* static enum exynos5_gpio_pin hsic_reset_l = GPIO_E10; */ |
| 159 | |
Julius Werner | 68aef11 | 2013-09-03 15:07:31 -0700 | [diff] [blame] | 160 | static void prepare_usb(void) |
| 161 | { |
| 162 | /* Kick this reset off early so it gets at least 100ms to settle */ |
| 163 | reset_usb_drd_dwc3(); |
| 164 | } |
| 165 | |
Julius Werner | 79bff70 | 2013-08-15 17:34:45 -0700 | [diff] [blame] | 166 | static void setup_usb(void) |
| 167 | { |
| 168 | /* HSIC not needed in firmware on this board */ |
Julius Werner | 68aef11 | 2013-09-03 15:07:31 -0700 | [diff] [blame] | 169 | setup_usb_drd_phy(); |
| 170 | setup_usb_drd_dwc3(); |
Julius Werner | 79bff70 | 2013-08-15 17:34:45 -0700 | [diff] [blame] | 171 | setup_usb_host_phy(0); |
| 172 | |
| 173 | gpio_direction_output(usb_host_vbus, 1); |
| 174 | gpio_direction_output(usb_drd_vbus, 1); |
| 175 | } |
| 176 | |
Stefan Reinauer | 2ae6d6f | 2013-05-09 16:16:13 -0700 | [diff] [blame] | 177 | //static struct video_info smdk5250_dp_config = { |
Stefan Reinauer | 043eb0e | 2013-05-10 16:21:58 -0700 | [diff] [blame] | 178 | static struct video_info dp_video_info = { |
Stefan Reinauer | 2ae6d6f | 2013-05-09 16:16:13 -0700 | [diff] [blame] | 179 | /* FIXME: fix video_info struct to use const for name */ |
| 180 | .name = (char *)"eDP-LVDS NXP PTN3460", |
| 181 | |
| 182 | .h_sync_polarity = 0, |
| 183 | .v_sync_polarity = 0, |
| 184 | .interlaced = 0, |
| 185 | |
| 186 | .color_space = COLOR_RGB, |
| 187 | .dynamic_range = VESA, |
| 188 | .ycbcr_coeff = COLOR_YCBCR601, |
| 189 | .color_depth = COLOR_8, |
| 190 | |
| 191 | .link_rate = LINK_RATE_2_70GBPS, |
| 192 | .lane_count = LANE_COUNT2, |
| 193 | }; |
| 194 | |
| 195 | /* FIXME: move some place more appropriate */ |
Stefan Reinauer | 043eb0e | 2013-05-10 16:21:58 -0700 | [diff] [blame] | 196 | #define MAX_DP_TRIES 5 |
Stefan Reinauer | 2ae6d6f | 2013-05-09 16:16:13 -0700 | [diff] [blame] | 197 | |
| 198 | /* |
| 199 | * This function disables the USB3.0 PLL to save power |
| 200 | */ |
| 201 | static void disable_usb30_pll(void) |
| 202 | { |
| 203 | enum exynos5_gpio_pin usb3_pll_l = GPIO_Y11; |
| 204 | |
| 205 | gpio_direction_output(usb3_pll_l, 0); |
| 206 | } |
| 207 | |
Julius Werner | ad4556f2 | 2013-08-21 17:33:31 -0700 | [diff] [blame] | 208 | static void setup_storage(void) |
| 209 | { |
| 210 | /* MMC0: Fixed, 8 bit mode, connected with GPIO. */ |
| 211 | if (clock_set_mshci(PERIPH_ID_SDMMC0)) |
| 212 | printk(BIOS_CRIT, "%s: Failed to set MMC0 clock.\n", __func__); |
| 213 | if (gpio_direction_output(MMC0_GPIO_PIN, 1)) { |
| 214 | printk(BIOS_CRIT, "%s: Unable to power on MMC0.\n", __func__); |
| 215 | } |
| 216 | gpio_set_pull(MMC0_GPIO_PIN, GPIO_PULL_NONE); |
| 217 | gpio_set_drv(MMC0_GPIO_PIN, GPIO_DRV_4X); |
| 218 | exynos_pinmux_sdmmc0(); |
| 219 | |
| 220 | /* MMC2: Removable, 4 bit mode, no GPIO. */ |
| 221 | /* (Must be after romstage to avoid breaking SDMMC boot.) */ |
| 222 | clock_set_mshci(PERIPH_ID_SDMMC2); |
| 223 | exynos_pinmux_sdmmc2(); |
| 224 | } |
| 225 | |
Gabe Black | 1387b43 | 2013-05-18 15:55:47 -0700 | [diff] [blame] | 226 | static void gpio_init(void) |
| 227 | { |
| 228 | /* Set up the I2C busses. */ |
Gabe Black | fe64060 | 2013-06-15 20:33:05 -0700 | [diff] [blame] | 229 | exynos_pinmux_i2c0(); |
| 230 | exynos_pinmux_i2c1(); |
| 231 | exynos_pinmux_i2c2(); |
| 232 | exynos_pinmux_i2c3(); |
| 233 | exynos_pinmux_i2c4(); |
| 234 | exynos_pinmux_i2c7(); |
Gabe Black | 1387b43 | 2013-05-18 15:55:47 -0700 | [diff] [blame] | 235 | |
| 236 | /* Set up the GPIOs used to arbitrate for I2C bus 4. */ |
| 237 | gpio_set_pull(GPIO_F03, GPIO_PULL_NONE); |
| 238 | gpio_set_pull(GPIO_E04, GPIO_PULL_NONE); |
| 239 | gpio_direction_output(GPIO_F03, 1); |
| 240 | gpio_direction_input(GPIO_E04); |
| 241 | |
| 242 | /* Set up the GPIO used to enable the audio codec. */ |
| 243 | gpio_set_pull(GPIO_X17, GPIO_PULL_NONE); |
| 244 | gpio_set_pull(GPIO_X15, GPIO_PULL_NONE); |
| 245 | gpio_direction_output(GPIO_X17, 1); |
| 246 | gpio_direction_output(GPIO_X15, 1); |
| 247 | |
| 248 | /* Set up the I2S busses. */ |
Gabe Black | e6789c1 | 2013-08-05 22:19:36 -0700 | [diff] [blame] | 249 | exynos_pinmux_i2s0(); |
Gabe Black | fe64060 | 2013-06-15 20:33:05 -0700 | [diff] [blame] | 250 | exynos_pinmux_i2s1(); |
Gabe Black | 1387b43 | 2013-05-18 15:55:47 -0700 | [diff] [blame] | 251 | } |
| 252 | |
Stefan Reinauer | 2ae6d6f | 2013-05-09 16:16:13 -0700 | [diff] [blame] | 253 | /* this happens after cpu_init where exynos resources are set */ |
Elyes HAOUAS | d129d43 | 2018-05-04 20:23:33 +0200 | [diff] [blame] | 254 | static void mainboard_init(struct device *dev) |
Stefan Reinauer | 2ae6d6f | 2013-05-09 16:16:13 -0700 | [diff] [blame] | 255 | { |
| 256 | int dp_tries; |
| 257 | struct s5p_dp_device dp_device = { |
Julius Werner | fa938c7 | 2013-08-29 14:17:36 -0700 | [diff] [blame] | 258 | .base = exynos_dp1, |
Stefan Reinauer | 043eb0e | 2013-05-10 16:21:58 -0700 | [diff] [blame] | 259 | .video_info = &dp_video_info, |
Stefan Reinauer | 2ae6d6f | 2013-05-09 16:16:13 -0700 | [diff] [blame] | 260 | }; |
Stefan Reinauer | 6628744 | 2013-06-19 15:54:19 -0700 | [diff] [blame] | 261 | void *fb_addr = (void *)(get_fb_base_kb() * KiB); |
Stefan Reinauer | 2ae6d6f | 2013-05-09 16:16:13 -0700 | [diff] [blame] | 262 | |
Julius Werner | 68aef11 | 2013-09-03 15:07:31 -0700 | [diff] [blame] | 263 | prepare_usb(); |
Gabe Black | 1387b43 | 2013-05-18 15:55:47 -0700 | [diff] [blame] | 264 | gpio_init(); |
Julius Werner | ad4556f2 | 2013-08-21 17:33:31 -0700 | [diff] [blame] | 265 | setup_storage(); |
Gabe Black | 1387b43 | 2013-05-18 15:55:47 -0700 | [diff] [blame] | 266 | |
David Hendricks | 8ccabb6 | 2013-08-01 19:12:56 -0700 | [diff] [blame] | 267 | i2c_init(TPS65090_BUS, I2C_0_SPEED, I2C_SLAVE); |
Stefan Reinauer | 043eb0e | 2013-05-10 16:21:58 -0700 | [diff] [blame] | 268 | i2c_init(7, I2C_0_SPEED, I2C_SLAVE); |
Stefan Reinauer | 2ae6d6f | 2013-05-09 16:16:13 -0700 | [diff] [blame] | 269 | |
| 270 | tmu_init(&exynos5250_tmu_info); |
| 271 | |
| 272 | /* Clock Gating all the unused IP's to save power */ |
| 273 | clock_gate(); |
| 274 | |
| 275 | /* Disable USB3.0 PLL to save 250mW of power */ |
| 276 | disable_usb30_pll(); |
| 277 | |
Julius Werner | ad4556f2 | 2013-08-21 17:33:31 -0700 | [diff] [blame] | 278 | sdmmc_vdd(); |
| 279 | |
Gabe Black | 1e797bd | 2013-05-18 15:58:46 -0700 | [diff] [blame] | 280 | set_vbe_mode_info_valid(&edid, (uintptr_t)fb_addr); |
Stefan Reinauer | 2ae6d6f | 2013-05-09 16:16:13 -0700 | [diff] [blame] | 281 | |
Stefan Reinauer | 043eb0e | 2013-05-10 16:21:58 -0700 | [diff] [blame] | 282 | lcd_vdd(); |
Stefan Reinauer | a86c33a | 2013-05-17 10:34:25 -0700 | [diff] [blame] | 283 | |
| 284 | // FIXME: should timeout |
Stefan Reinauer | 2ae6d6f | 2013-05-09 16:16:13 -0700 | [diff] [blame] | 285 | do { |
| 286 | udelay(50); |
| 287 | } while (!exynos_dp_hotplug()); |
| 288 | |
| 289 | exynos_dp_bridge_setup(); |
Stefan Reinauer | 043eb0e | 2013-05-10 16:21:58 -0700 | [diff] [blame] | 290 | for (dp_tries = 1; dp_tries <= MAX_DP_TRIES; dp_tries++) { |
Stefan Reinauer | 2ae6d6f | 2013-05-09 16:16:13 -0700 | [diff] [blame] | 291 | exynos_dp_bridge_init(); |
| 292 | if (exynos_dp_hotplug()) { |
| 293 | exynos_dp_reset(); |
| 294 | continue; |
| 295 | } |
| 296 | |
| 297 | if (dp_controller_init(&dp_device)) |
| 298 | continue; |
| 299 | |
| 300 | udelay(LCD_T3_DELAY_MS * 1000); |
| 301 | |
Stefan Reinauer | 043eb0e | 2013-05-10 16:21:58 -0700 | [diff] [blame] | 302 | backlight_vdd(); |
| 303 | backlight_pwm(); |
| 304 | backlight_en(); |
Stefan Reinauer | 2ae6d6f | 2013-05-09 16:16:13 -0700 | [diff] [blame] | 305 | /* if we're here, we're successful */ |
| 306 | break; |
| 307 | } |
| 308 | |
Stefan Reinauer | 043eb0e | 2013-05-10 16:21:58 -0700 | [diff] [blame] | 309 | if (dp_tries > MAX_DP_TRIES) |
Stefan Reinauer | 2ae6d6f | 2013-05-09 16:16:13 -0700 | [diff] [blame] | 310 | printk(BIOS_ERR, "%s: Failed to set up displayport\n", __func__); |
Stefan Reinauer | dc006c1 | 2013-05-15 14:54:07 -0700 | [diff] [blame] | 311 | |
Julius Werner | 68aef11 | 2013-09-03 15:07:31 -0700 | [diff] [blame] | 312 | setup_usb(); |
| 313 | |
Stefan Reinauer | a86c33a | 2013-05-17 10:34:25 -0700 | [diff] [blame] | 314 | // Uncomment to get excessive GPIO output: |
| 315 | // gpio_info(); |
Stefan Reinauer | 2ae6d6f | 2013-05-09 16:16:13 -0700 | [diff] [blame] | 316 | } |
| 317 | |
Elyes HAOUAS | d129d43 | 2018-05-04 20:23:33 +0200 | [diff] [blame] | 318 | static void mainboard_enable(struct device *dev) |
Stefan Reinauer | 2ae6d6f | 2013-05-09 16:16:13 -0700 | [diff] [blame] | 319 | { |
| 320 | dev->ops->init = &mainboard_init; |
| 321 | |
Stefan Reinauer | 2ae6d6f | 2013-05-09 16:16:13 -0700 | [diff] [blame] | 322 | /* set up dcache and MMU */ |
| 323 | /* FIXME: this should happen via resource allocator */ |
| 324 | exynos5250_config_l2_cache(); |
| 325 | mmu_init(); |
| 326 | mmu_config_range(0, DRAM_START, DCACHE_OFF); |
| 327 | mmu_config_range(DRAM_START, DRAM_SIZE, DCACHE_WRITEBACK); |
Julius Werner | ec5e5e0 | 2014-08-20 15:29:56 -0700 | [diff] [blame] | 328 | mmu_config_range((uintptr_t)_dma_coherent/MiB, |
Julius Werner | 7e0dea6 | 2019-02-20 18:39:22 -0800 | [diff] [blame] | 329 | REGION_SIZE(dma_coherent)/MiB, DCACHE_OFF); |
Stefan Reinauer | 2ae6d6f | 2013-05-09 16:16:13 -0700 | [diff] [blame] | 330 | mmu_config_range(DRAM_END, 4096 - DRAM_END, DCACHE_OFF); |
Stefan Reinauer | 2ae6d6f | 2013-05-09 16:16:13 -0700 | [diff] [blame] | 331 | dcache_mmu_enable(); |
| 332 | |
Stefan Reinauer | 2ae6d6f | 2013-05-09 16:16:13 -0700 | [diff] [blame] | 333 | const unsigned epll_hz = 192000000; |
| 334 | const unsigned sample_rate = 48000; |
| 335 | const unsigned lr_frame_size = 256; |
| 336 | clock_epll_set_rate(epll_hz); |
| 337 | clock_select_i2s_clk_source(); |
| 338 | clock_set_i2s_clk_prescaler(epll_hz, sample_rate * lr_frame_size); |
| 339 | |
| 340 | power_enable_xclkout(); |
| 341 | } |
| 342 | |
Ronald G. Minnich | f89e6b2 | 2012-12-10 16:13:43 -0800 | [diff] [blame] | 343 | struct chip_operations mainboard_ops = { |
David Hendricks | 054c83a | 2015-01-09 11:46:43 -0800 | [diff] [blame] | 344 | .name = "daisy", |
| 345 | .enable_dev = mainboard_enable, |
Ronald G. Minnich | f89e6b2 | 2012-12-10 16:13:43 -0800 | [diff] [blame] | 346 | }; |
Julius Werner | b8fad3d | 2013-08-27 15:48:32 -0700 | [diff] [blame] | 347 | |
| 348 | void lb_board(struct lb_header *header) |
| 349 | { |
| 350 | struct lb_range *dma; |
| 351 | |
| 352 | dma = (struct lb_range *)lb_new_record(header); |
Patrick Georgi | 68999a8 | 2019-05-23 12:44:00 +0200 | [diff] [blame^] | 353 | dma->tag = LB_TAG_DMA; |
Julius Werner | b8fad3d | 2013-08-27 15:48:32 -0700 | [diff] [blame] | 354 | dma->size = sizeof(*dma); |
Julius Werner | ec5e5e0 | 2014-08-20 15:29:56 -0700 | [diff] [blame] | 355 | dma->range_start = (uintptr_t)_dma_coherent; |
Julius Werner | 7e0dea6 | 2019-02-20 18:39:22 -0800 | [diff] [blame] | 356 | dma->range_size = REGION_SIZE(dma_coherent); |
Julius Werner | b8fad3d | 2013-08-27 15:48:32 -0700 | [diff] [blame] | 357 | } |