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