blob: 9d53acd5621a23be95c36a20733686f785d0dcb9 [file] [log] [blame]
lijuang395b5e62015-11-19 17:39:44 +08001/* Copyright (c) 2015-2016, The Linux Foundation. All rights reserved.
Aparna Mallavarapu01fc00a2015-06-01 20:37:05 +05302 *
3 * Redistribution and use in source and binary forms, with or without
4 * modification, are permitted provided that the following conditions are
5 * met:
6 * * Redistributions of source code must retain the above copyright
7 * notice, this list of conditions and the following disclaimer.
8 * * Redistributions in binary form must reproduce the above
9 * copyright notice, this list of conditions and the following
10 * disclaimer in the documentation and/or other materials provided
11 * with the distribution.
12 * * Neither the name of The Linux Foundation nor the names of its
13 * contributors may be used to endorse or promote products derived
14 * from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
17 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
18 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
19 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
20 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
23 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
24 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
25 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
26 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
29#include <debug.h>
30#include <platform/iomap.h>
31#include <reg.h>
32#include <target.h>
33#include <platform.h>
34#include <uart_dm.h>
35#include <mmc.h>
36#include <platform/gpio.h>
37#include <dev/keys.h>
38#include <spmi_v2.h>
39#include <pm8x41.h>
P.V. Phani Kumara053a322015-08-13 18:36:05 +053040#include <pm8x41_hw.h>
Aparna Mallavarapu01fc00a2015-06-01 20:37:05 +053041#include <board.h>
42#include <baseband.h>
43#include <hsusb.h>
44#include <scm.h>
Aparna Mallavarapu01fc00a2015-06-01 20:37:05 +053045#include <platform/irqs.h>
46#include <platform/clock.h>
P.V. Phani Kumara053a322015-08-13 18:36:05 +053047#include <platform/timer.h>
Aparna Mallavarapu01fc00a2015-06-01 20:37:05 +053048#include <crypto5_wrapper.h>
49#include <partition_parser.h>
50#include <stdlib.h>
P.V. Phani Kumara053a322015-08-13 18:36:05 +053051#include <rpm-smd.h>
52#include <spmi.h>
53#include <sdhci_msm.h>
54#include <clock.h>
P.V. Phani Kumar77826d32015-12-26 20:56:35 +053055#include <boot_device.h>
56#include <secapp_loader.h>
57#include <rpmb.h>
58#include <smem.h>
59#include <qmp_phy.h>
60#include <qusb2_phy.h>
Padmanabhan Komanduru0104a892016-01-22 16:58:10 +053061#include "target/display.h"
Aparna Mallavarapu01fc00a2015-06-01 20:37:05 +053062
63#if LONG_PRESS_POWER_ON
64#include <shutdown_detect.h>
65#endif
66
c_wufeng41310ae2016-01-14 17:59:22 +080067#if PON_VIB_SUPPORT
68#include <vibrator.h>
69#define VIBRATE_TIME 250
70#endif
71
Aparna Mallavarapu01fc00a2015-06-01 20:37:05 +053072#define PMIC_ARB_CHANNEL_NUM 0
73#define PMIC_ARB_OWNER_ID 0
74#define TLMM_VOL_UP_BTN_GPIO 85
75
76#define FASTBOOT_MODE 0x77665500
P.V. Phani Kumar77826d32015-12-26 20:56:35 +053077#define RECOVERY_MODE 0x77665502
Aparna Mallavarapu01fc00a2015-06-01 20:37:05 +053078#define PON_SOFT_RB_SPARE 0x88F
79
P.V. Phani Kumar77826d32015-12-26 20:56:35 +053080#define CE1_INSTANCE 1
81#define CE_EE 1
82#define CE_FIFO_SIZE 64
83#define CE_READ_PIPE 3
84#define CE_WRITE_PIPE 2
85#define CE_READ_PIPE_LOCK_GRP 0
86#define CE_WRITE_PIPE_LOCK_GRP 0
87#define CE_ARRAY_SIZE 20
88
P.V. Phani Kumara053a322015-08-13 18:36:05 +053089struct mmc_device *dev;
90
91static uint32_t mmc_pwrctl_base[] =
Aparna Mallavarapu01fc00a2015-06-01 20:37:05 +053092 { MSM_SDC1_BASE, MSM_SDC2_BASE };
93
P.V. Phani Kumara053a322015-08-13 18:36:05 +053094static uint32_t mmc_sdhci_base[] =
95 { MSM_SDC1_SDHCI_BASE, MSM_SDC2_SDHCI_BASE };
96
97static uint32_t mmc_sdc_pwrctl_irq[] =
98 { SDCC1_PWRCTL_IRQ, SDCC2_PWRCTL_IRQ };
Aparna Mallavarapu01fc00a2015-06-01 20:37:05 +053099
100void target_early_init(void)
101{
102#if WITH_DEBUG_UART
P.V. Phani Kumar2e4eeae2015-12-31 16:52:54 +0530103 uart_dm_init(1, 0, BLSP1_UART0_BASE);
Aparna Mallavarapu01fc00a2015-06-01 20:37:05 +0530104#endif
105}
106
P.V. Phani Kumara053a322015-08-13 18:36:05 +0530107static void set_sdc_power_ctrl()
Aparna Mallavarapu01fc00a2015-06-01 20:37:05 +0530108{
P.V. Phani Kumara053a322015-08-13 18:36:05 +0530109 /* Drive strength configs for sdc pins */
110 struct tlmm_cfgs sdc1_hdrv_cfg[] =
111 {
112 { SDC1_CLK_HDRV_CTL_OFF, TLMM_CUR_VAL_16MA, TLMM_HDRV_MASK, 0},
113 { SDC1_CMD_HDRV_CTL_OFF, TLMM_CUR_VAL_10MA, TLMM_HDRV_MASK, 0},
114 { SDC1_DATA_HDRV_CTL_OFF, TLMM_CUR_VAL_10MA, TLMM_HDRV_MASK , 0},
115 };
116
117 /* Pull configs for sdc pins */
118 struct tlmm_cfgs sdc1_pull_cfg[] =
119 {
120 { SDC1_CLK_PULL_CTL_OFF, TLMM_NO_PULL, TLMM_PULL_MASK, 0},
121 { SDC1_CMD_PULL_CTL_OFF, TLMM_PULL_UP, TLMM_PULL_MASK, 0},
122 { SDC1_DATA_PULL_CTL_OFF, TLMM_PULL_UP, TLMM_PULL_MASK, 0},
123 };
124
125 struct tlmm_cfgs sdc1_rclk_cfg[] =
126 {
127 { SDC1_RCLK_PULL_CTL_OFF, TLMM_PULL_DOWN, TLMM_PULL_MASK, 0},
128 };
129
130 /* Set the drive strength & pull control values */
131 tlmm_set_hdrive_ctrl(sdc1_hdrv_cfg, ARRAY_SIZE(sdc1_hdrv_cfg));
132 tlmm_set_pull_ctrl(sdc1_pull_cfg, ARRAY_SIZE(sdc1_pull_cfg));
133 tlmm_set_pull_ctrl(sdc1_rclk_cfg, ARRAY_SIZE(sdc1_rclk_cfg));
134}
135
136void target_sdc_init()
137{
138 struct mmc_config_data config;
139
140 /* Set drive strength & pull ctrl values */
141 set_sdc_power_ctrl();
142
143 config.slot = MMC_SLOT;
144 config.bus_width = DATA_BUS_WIDTH_8BIT;
145 config.max_clk_rate = MMC_CLK_192MHZ;
146 config.sdhc_base = mmc_sdhci_base[config.slot - 1];
147 config.pwrctl_base = mmc_pwrctl_base[config.slot - 1];
148 config.pwr_irq = mmc_sdc_pwrctl_irq[config.slot - 1];
149 config.hs400_support = 1;
150
151 if (!(dev = mmc_init(&config))) {
152 /* Try different config. values */
153 config.max_clk_rate = MMC_CLK_200MHZ;
154 config.sdhc_base = mmc_sdhci_base[config.slot - 1];
155 config.pwrctl_base = mmc_pwrctl_base[config.slot - 1];
156 config.pwr_irq = mmc_sdc_pwrctl_irq[config.slot - 1];
157 config.hs400_support = 0;
158
159 if (!(dev = mmc_init(&config))) {
160 dprintf(CRITICAL, "mmc init failed!");
161 ASSERT(0);
162 }
163 }
164}
165
166void *target_mmc_device()
167{
168 return (void *) dev;
Aparna Mallavarapu01fc00a2015-06-01 20:37:05 +0530169}
170
171/* Return 1 if vol_up pressed */
Gaurav Nebhwanid9dd0342016-01-28 16:35:55 +0530172int target_volume_up()
Aparna Mallavarapu01fc00a2015-06-01 20:37:05 +0530173{
174 uint8_t status = 0;
175
176 gpio_tlmm_config(TLMM_VOL_UP_BTN_GPIO, 0, GPIO_INPUT, GPIO_PULL_UP, GPIO_2MA, GPIO_ENABLE);
177
178 /* Wait for the gpio config to take effect - debounce time */
179 thread_sleep(10);
180
181 /* Get status of GPIO */
182 status = gpio_status(TLMM_VOL_UP_BTN_GPIO);
183
184 /* Active high signal. */
P.V. Phani Kumar77826d32015-12-26 20:56:35 +0530185 return !status;
Aparna Mallavarapu01fc00a2015-06-01 20:37:05 +0530186}
187
188/* Return 1 if vol_down pressed */
189uint32_t target_volume_down()
190{
191 /* Volume down button tied in with PMIC RESIN. */
192 return pm8x41_resin_status();
193}
194
P.V. Phani Kumar77826d32015-12-26 20:56:35 +0530195uint32_t target_is_pwrkey_pon_reason()
196{
197 uint8_t pon_reason = pm8950_get_pon_reason();
198 if (pm8x41_get_is_cold_boot() && ((pon_reason == KPDPWR_N) || (pon_reason == (KPDPWR_N|PON1))))
199 return 1;
200 else
201 return 0;
202}
203
Aparna Mallavarapu01fc00a2015-06-01 20:37:05 +0530204static void target_keystatus()
205{
206 keys_init();
207
208 if(target_volume_down())
209 keys_post_event(KEY_VOLUMEDOWN, 1);
210
211 if(target_volume_up())
212 keys_post_event(KEY_VOLUMEUP, 1);
213}
214
Aparna Mallavarapu01fc00a2015-06-01 20:37:05 +0530215void target_init(void)
216{
P.V. Phani Kumar77826d32015-12-26 20:56:35 +0530217#if VERIFIED_BOOT
218#if !VBOOT_MOTA
219 int ret = 0;
220#endif
221#endif
Aparna Mallavarapu01fc00a2015-06-01 20:37:05 +0530222 dprintf(INFO, "target_init()\n");
223
224 spmi_init(PMIC_ARB_CHANNEL_NUM, PMIC_ARB_OWNER_ID);
225
226 target_keystatus();
227
P.V. Phani Kumara053a322015-08-13 18:36:05 +0530228 target_sdc_init();
229 if (partition_read_table())
230 {
231 dprintf(CRITICAL, "Error reading the partition table info\n");
232 ASSERT(0);
Aparna Mallavarapu01fc00a2015-06-01 20:37:05 +0530233 }
P.V. Phani Kumara053a322015-08-13 18:36:05 +0530234
Aparna Mallavarapu01fc00a2015-06-01 20:37:05 +0530235#if LONG_PRESS_POWER_ON
236 shutdown_detect();
237#endif
P.V. Phani Kumar77826d32015-12-26 20:56:35 +0530238
c_wufeng41310ae2016-01-14 17:59:22 +0800239#if PON_VIB_SUPPORT
240 vib_timed_turn_on(VIBRATE_TIME);
241#endif
242
P.V. Phani Kumar77826d32015-12-26 20:56:35 +0530243
244 if (target_use_signed_kernel())
245 target_crypto_init_params();
246
247#if VERIFIED_BOOT
248#if !VBOOT_MOTA
249 clock_ce_enable(CE1_INSTANCE);
250
251 /* Initialize Qseecom */
252 ret = qseecom_init();
253
254 if (ret < 0)
255 {
256 dprintf(CRITICAL, "Failed to initialize qseecom, error: %d\n", ret);
257 ASSERT(0);
258 }
259
260 /* Start Qseecom */
261 ret = qseecom_tz_init();
262
263 if (ret < 0)
264 {
265 dprintf(CRITICAL, "Failed to start qseecom, error: %d\n", ret);
266 ASSERT(0);
267 }
268
269 if (rpmb_init() < 0)
270 {
271 dprintf(CRITICAL, "RPMB init failed\n");
272 ASSERT(0);
273 }
274
275 /*
276 * Load the sec app for first time
277 */
278 if (load_sec_app() < 0)
279 {
280 dprintf(CRITICAL, "Failed to load App for verified\n");
281 ASSERT(0);
282 }
283#endif
284#endif
285
286#if SMD_SUPPORT
287 rpm_smd_init();
288#endif
Aparna Mallavarapu01fc00a2015-06-01 20:37:05 +0530289}
290
291void target_serialno(unsigned char *buf)
292{
293 uint32_t serialno;
294 if (target_is_emmc_boot()) {
295 serialno = mmc_get_psn();
296 snprintf((char *)buf, 13, "%x", serialno);
297 }
298}
299
300unsigned board_machtype(void)
301{
P.V. Phani Kumara053a322015-08-13 18:36:05 +0530302 return LINUX_MACHTYPE_UNKNOWN;
303}
304
305/* Detect the target type */
306void target_detect(struct board_data *board)
307{
308 /* This is already filled as part of board.c */
309}
310
P.V. Phani Kumar77826d32015-12-26 20:56:35 +0530311/* Detect the modem type */
P.V. Phani Kumara053a322015-08-13 18:36:05 +0530312void target_baseband_detect(struct board_data *board)
313{
314 uint32_t platform;
315
316 platform = board->platform;
317
318 switch(platform) {
319 case MSMTITANIUM:
320 board->baseband = BASEBAND_MSM;
321 break;
Gaurav Nebhwani22a0d9f2015-12-29 13:49:26 +0530322 case APQTITANIUM:
323 board->baseband = BASEBAND_APQ;
324 break;
P.V. Phani Kumara053a322015-08-13 18:36:05 +0530325 default:
326 dprintf(CRITICAL, "Platform type: %u is not supported\n",platform);
327 ASSERT(0);
328 };
Aparna Mallavarapu01fc00a2015-06-01 20:37:05 +0530329}
330
P.V. Phani Kumar77826d32015-12-26 20:56:35 +0530331unsigned target_baseband()
332{
333 return board_baseband();
334}
lijuang395b5e62015-11-19 17:39:44 +0800335
336int set_download_mode(enum reboot_reason mode)
Aparna Mallavarapu01fc00a2015-06-01 20:37:05 +0530337{
338 int ret = 0;
339 ret = scm_dload_mode(mode);
340
341 pm8x41_clear_pmic_watchdog();
342
343 return ret;
344}
345
346int emmc_recovery_init(void)
347{
348 return _emmc_recovery_init();
349}
350
Zhenhua Huangcf812d72016-01-27 17:27:47 +0800351#define SMBCHG_USB_RT_STS 0x21310
352#define USBIN_UV_RT_STS BIT(0)
Aparna Mallavarapu01fc00a2015-06-01 20:37:05 +0530353unsigned target_pause_for_battery_charge(void)
354{
355 uint8_t pon_reason = pm8x41_get_pon_reason();
356 uint8_t is_cold_boot = pm8x41_get_is_cold_boot();
Zhenhua Huangcf812d72016-01-27 17:27:47 +0800357 bool usb_present_sts = !(USBIN_UV_RT_STS &
358 pm8x41_reg_read(SMBCHG_USB_RT_STS));
359 dprintf(INFO, "%s : pon_reason is:0x%x cold_boot:%d usb_sts:%d\n", __func__,
360 pon_reason, is_cold_boot, usb_present_sts);
Aparna Mallavarapu01fc00a2015-06-01 20:37:05 +0530361 /* In case of fastboot reboot,adb reboot or if we see the power key
362 * pressed we do not want go into charger mode.
363 * fastboot reboot is warm boot with PON hard reset bit not set
364 * adb reboot is a cold boot with PON hard reset bit set
365 */
366 if (is_cold_boot &&
367 (!(pon_reason & HARD_RST)) &&
368 (!(pon_reason & KPDPWR_N)) &&
Zhenhua Huangcf812d72016-01-27 17:27:47 +0800369 usb_present_sts)
Aparna Mallavarapu01fc00a2015-06-01 20:37:05 +0530370 return 1;
371 else
372 return 0;
373}
374
P.V. Phani Kumar77826d32015-12-26 20:56:35 +0530375void target_uninit(void)
376{
377 mmc_put_card_to_sleep(dev);
378 sdhci_mode_disable(&dev->host);
379 if (crypto_initialized())
380 crypto_eng_cleanup();
381
382 if (target_is_ssd_enabled())
383 clock_ce_disable(CE1_INSTANCE);
384
385#if VERIFIED_BOOT
386#if !VBOOT_MOTA
387 if (is_sec_app_loaded())
388 {
389 if (send_milestone_call_to_tz() < 0)
390 {
391 dprintf(CRITICAL, "Failed to unload App for rpmb\n");
392 ASSERT(0);
393 }
394 }
395
396 if (rpmb_uninit() < 0)
397 {
398 dprintf(CRITICAL, "RPMB uninit failed\n");
399 ASSERT(0);
400 }
401
402 clock_ce_disable(CE1_INSTANCE);
403#endif
404#endif
405
406#if SMD_SUPPORT
407 rpm_smd_uninit();
408#endif
409}
410
Aparna Mallavarapu01fc00a2015-06-01 20:37:05 +0530411/* UTMI MUX configuration to connect PHY to SNPS controller:
412 * Configure primary HS phy mux to use UTMI interface
413 * (connected to usb30 controller).
414 */
415static void tcsr_hs_phy_mux_configure(void)
416{
417 uint32_t reg;
418
419 reg = readl(USB2_PHY_SEL);
420
421 writel(reg | 0x1, USB2_PHY_SEL);
422}
423
424/* configure hs phy mux if using dwc controller */
425void target_usb_phy_mux_configure(void)
426{
427 if(!strcmp(target_usb_controller(), "dwc"))
428 {
429 tcsr_hs_phy_mux_configure();
430 }
431}
432
P.V. Phani Kumar77826d32015-12-26 20:56:35 +0530433void target_usb_phy_reset()
434{
435
436 usb30_qmp_phy_reset();
437 qusb2_phy_reset();
438}
439
Aparna Mallavarapu01fc00a2015-06-01 20:37:05 +0530440/* Initialize target specific USB handlers */
441target_usb_iface_t* target_usb30_init()
442{
443 target_usb_iface_t *t_usb_iface;
444
P.V. Phani Kumar77826d32015-12-26 20:56:35 +0530445 t_usb_iface = (target_usb_iface_t *) calloc(1, sizeof(target_usb_iface_t));
Aparna Mallavarapu01fc00a2015-06-01 20:37:05 +0530446 ASSERT(t_usb_iface);
447
P.V. Phani Kumar77826d32015-12-26 20:56:35 +0530448 t_usb_iface->mux_config = NULL;
449 t_usb_iface->phy_init = usb30_qmp_phy_init;
450 t_usb_iface->phy_reset = target_usb_phy_reset;
451 t_usb_iface->clock_init = clock_usb30_init;
452 t_usb_iface->vbus_override = 1;
Aparna Mallavarapu01fc00a2015-06-01 20:37:05 +0530453
454 return t_usb_iface;
455}
456
457/* identify the usb controller to be used for the target */
458const char * target_usb_controller()
459{
460 return "dwc";
461}
P.V. Phani Kumara053a322015-08-13 18:36:05 +0530462
P.V. Phani Kumar77826d32015-12-26 20:56:35 +0530463/* Do any target specific intialization needed before entering fastboot mode */
464void target_fastboot_init(void)
465{
466 if (target_is_ssd_enabled()) {
467 clock_ce_enable(CE1_INSTANCE);
468 target_load_ssd_keystore();
469 }
470}
471
472void target_load_ssd_keystore(void)
473{
474 uint64_t ptn;
475 int index;
476 uint64_t size;
477 uint32_t *buffer = NULL;
478
479 if (!target_is_ssd_enabled())
480 return;
481
482 index = partition_get_index("ssd");
483
484 ptn = partition_get_offset(index);
485 if (ptn == 0){
486 dprintf(CRITICAL, "Error: ssd partition not found\n");
487 return;
488 }
489
490 size = partition_get_size(index);
491 if (size == 0) {
492 dprintf(CRITICAL, "Error: invalid ssd partition size\n");
493 return;
494 }
495
496 buffer = memalign(CACHE_LINE, ROUNDUP(size, CACHE_LINE));
497 if (!buffer) {
498 dprintf(CRITICAL, "Error: allocating memory for ssd buffer\n");
499 return;
500 }
501
502 if (mmc_read(ptn, buffer, size)) {
503 dprintf(CRITICAL, "Error: cannot read data\n");
504 free(buffer);
505 return;
506 }
507
508 clock_ce_enable(CE1_INSTANCE);
509 scm_protect_keystore(buffer, size);
510 clock_ce_disable(CE1_INSTANCE);
511 free(buffer);
512}
P.V. Phani Kumara053a322015-08-13 18:36:05 +0530513
514crypto_engine_type board_ce_type(void)
515{
516 return CRYPTO_ENGINE_TYPE_HW;
517}
518
P.V. Phani Kumar77826d32015-12-26 20:56:35 +0530519/* Set up params for h/w CE. */
520void target_crypto_init_params()
521{
522 struct crypto_init_params ce_params;
523
524 /* Set up base addresses and instance. */
525 ce_params.crypto_instance = CE1_INSTANCE;
526 ce_params.crypto_base = MSM_CE1_BASE;
527 ce_params.bam_base = MSM_CE1_BAM_BASE;
528
529 /* Set up BAM config. */
530 ce_params.bam_ee = CE_EE;
531 ce_params.pipes.read_pipe = CE_READ_PIPE;
532 ce_params.pipes.write_pipe = CE_WRITE_PIPE;
533 ce_params.pipes.read_pipe_grp = CE_READ_PIPE_LOCK_GRP;
534 ce_params.pipes.write_pipe_grp = CE_WRITE_PIPE_LOCK_GRP;
535
536 /* Assign buffer sizes. */
537 ce_params.num_ce = CE_ARRAY_SIZE;
538 ce_params.read_fifo_size = CE_FIFO_SIZE;
539 ce_params.write_fifo_size = CE_FIFO_SIZE;
540
541 /* BAM is initialized by TZ for this platform.
542 * Do not do it again as the initialization address space
543 * is locked.
544 */
545 ce_params.do_bam_init = 0;
546
547 crypto_init_params(&ce_params);
548}
P.V. Phani Kumara053a322015-08-13 18:36:05 +0530549
550void pmic_reset_configure(uint8_t reset_type)
551{
P.V. Phani Kumar765fe3e2016-01-23 00:59:03 +0530552 pm8994_reset_configure(reset_type);
P.V. Phani Kumara053a322015-08-13 18:36:05 +0530553}
P.V. Phani Kumar77826d32015-12-26 20:56:35 +0530554
555uint32_t target_get_pmic()
556{
557 return PMIC_IS_PMI8950;
558}
559
560struct qmp_reg qmp_settings[] =
561{
562 {0x804, 0x01}, /*USB3PHY_PCIE_USB3_PCS_POWER_DOWN_CONTROL */
563 {0xAC, 0x14}, /* QSERDES_COM_SYSCLK_EN_SEL */
564 {0x34, 0x08}, /* QSERDES_COM_BIAS_EN_CLKBUFLR_EN */
565 {0x174, 0x30}, /* QSERDES_COM_CLK_SELECT */
566 {0x3C, 0x06}, /* QSERDES_COM_SYS_CLK_CTRL */
567 {0xB4, 0x00}, /* QSERDES_COM_RESETSM_CNTRL */
568 {0xB8, 0x08}, /* QSERDES_COM_RESETSM_CNTRL2 */
569 {0x194, 0x06}, /* QSERDES_COM_CMN_CONFIG */
570 {0x19c, 0x01}, /* QSERDES_COM_SVS_MODE_CLK_SEL */
571 {0x178, 0x00}, /* QSERDES_COM_HSCLK_SEL */
572 {0xd0, 0x82}, /* QSERDES_COM_DEC_START_MODE0 */
573 {0xdc, 0x55}, /* QSERDES_COM_DIV_FRAC_START1_MODE0 */
574 {0xe0, 0x55}, /* QSERDES_COM_DIV_FRAC_START2_MODE0 */
575 {0xe4, 0x03}, /* QSERDES_COM_DIV_FRAC_START3_MODE0 */
576 {0x78, 0x0b}, /* QSERDES_COM_CP_CTRL_MODE0 */
577 {0x84, 0x16}, /* QSERDES_COM_PLL_RCTRL_MODE0 */
578 {0x90, 0x28}, /* QSERDES_COM_PLL_CCTRL_MODE0 */
579 {0x108, 0x80}, /* QSERDES_COM_INTEGLOOP_GAIN0_MODE0 */
580 {0x10C, 0x00}, /* QSERDES_COM_INTEGLOOP_GAIN1_MODE0 */
581 {0x184, 0x0A}, /* QSERDES_COM_CORECLK_DIV */
582 {0x4c, 0x15}, /* QSERDES_COM_LOCK_CMP1_MODE0 */
583 {0x50, 0x34}, /* QSERDES_COM_LOCK_CMP2_MODE0 */
584 {0x54, 0x00}, /* QSERDES_COM_LOCK_CMP3_MODE0 */
585 {0xC8, 0x00}, /* QSERDES_COM_LOCK_CMP_EN */
586 {0x18c, 0x00}, /* QSERDES_COM_CORE_CLK_EN */
587 {0xcc, 0x00}, /* QSERDES_COM_LOCK_CMP_CFG */
588 {0x128, 0x00}, /* QSERDES_COM_VCO_TUNE_MAP */
589 {0x0C, 0x0A}, /* QSERDES_COM_BG_TIMER */
590 {0x10, 0x01}, /* QSERDES_COM_SSC_EN_CENTER */
591 {0x1c, 0x31}, /* QSERDES_COM_SSC_PER1 */
592 {0x20, 0x01}, /* QSERDES_COM_SSC_PER2 */
593 {0x14, 0x00}, /* QSERDES_COM_SSC_ADJ_PER1 */
594 {0x18, 0x00}, /* QSERDES_COM_SSC_ADJ_PER2 */
595 {0x24, 0xde}, /* QSERDES_COM_SSC_STEP_SIZE1 */
596 {0x28, 0x07}, /* QSERDES_COM_SSC_STEP_SIZE2 */
597 {0x48, 0x0F}, /* USB3PHY_QSERDES_COM_PLL_IVCO */
598 {0x70, 0x0F}, /* USB3PHY_QSERDES_COM_BG_TRIM */
599 {0x100, 0x80}, /* QSERDES_COM_INTEGLOOP_INITVAL */
600
601 /* Rx Settings */
602 {0x440, 0x0b}, /* QSERDES_RX_UCDR_FASTLOCK_FO_GAIN */
603 {0x4d8, 0x02}, /* QSERDES_RX_RX_EQU_ADAPTOR_CNTRL2 */
604 {0x4dc, 0x6c}, /* QSERDES_RX_RX_EQU_ADAPTOR_CNTRL3 */
605 {0x4e0, 0xbb}, /* QSERDES_RX_RX_EQU_ADAPTOR_CNTRL4 */
606 {0x508, 0x77}, /* QSERDES_RX_RX_EQ_OFFSET_ADAPTOR_CNTRL1 */
607 {0x50c, 0x80}, /* QSERDES_RX_RX_OFFSET_ADAPTOR_CNTRL2 */
608 {0x514, 0x03}, /* QSERDES_RX_SIGDET_CNTRL */
609 {0x51c, 0x16}, /* QSERDES_RX_SIGDET_DEGLITCH_CNTRL */
610 {0x448, 0x75}, /* QSERDES_RX_UCDR_SO_SATURATION_AND_ENABLE */
611 {0x450, 0x00}, /* QSERDES_RX_UCDR_FASTLOCK_COUNT_LOW */
612 {0x454, 0x00}, /* QSERDES_RX_UCDR_FASTLOCK_COUNT_HIGH */
613 {0x40C, 0x0a}, /* QSERDES_RX_UCDR_FO_GAIN */
614 {0x41C, 0x06}, /* QSERDES_RX_UCDR_SO_GAIN */
615 {0x510, 0x00}, /*QSERDES_RX_SIGDET_ENABLES */
616
617 /* Tx settings */
618 {0x268, 0x45}, /* QSERDES_TX_HIGHZ_TRANSCEIVEREN_BIAS_DRVR_EN */
619 {0x2ac, 0x12}, /* QSERDES_TX_RCV_DETECT_LVL_2 */
620 {0x294, 0x06}, /* QSERDES_TX_LANE_MODE */
621 {0x254, 0x00}, /* QSERDES_TX_RES_CODE_LANE_OFFSET */
622
623 /* FLL settings */
624 {0x8c8, 0x83}, /* PCIE_USB3_PCS_FLL_CNTRL2 */
625 {0x8c4, 0x02}, /* PCIE_USB3_PCS_FLL_CNTRL1 */
626 {0x8cc, 0x09}, /* PCIE_USB3_PCS_FLL_CNT_VAL_L */
627 {0x8D0, 0xA2}, /* PCIE_USB3_PCS_FLL_CNT_VAL_H_TOL */
628 {0x8D4, 0x85}, /* PCIE_USB3_PCS_FLL_MAN_CODE */
629
630 /* PCS Settings */
631 {0x880, 0xD1}, /* PCIE_USB3_PCS_LOCK_DETECT_CONFIG1 */
632 {0x884, 0x1F}, /* PCIE_USB3_PCS_LOCK_DETECT_CONFIG2 */
633 {0x888, 0x47}, /* PCIE_USB3_PCS_LOCK_DETECT_CONFIG3 */
634 {0x80C, 0x9F}, /* PCIE_USB3_PCS_TXMGN_V0 */
635 {0x824, 0x17}, /* PCIE_USB3_PCS_TXDEEMPH_M6DB_V0 */
636 {0x828, 0x0F}, /* PCIE_USB3_PCS_TXDEEMPH_M3P5DB_V0 */
637 {0x8B8, 0x75}, /* PCIE_USB3_PCS_RXEQTRAINING_WAIT_TIME */
638 {0x8BC, 0x13}, /* PCIE_USB3_PCS_RXEQTRAINING_RUN_TIME */
639 {0x8B0, 0x86}, /* PCIE_USB3_PCS_LFPS_TX_ECSTART_EQTLOCK */
640 {0x8A0, 0x04}, /* PCIE_USB3_PCS_PWRUP_RESET_DLY_TIME_AUXCLK */
641 {0x88C, 0x44}, /* PCIE_USB3_PCS_TSYNC_RSYNC_TIME */
642 {0x870, 0xE7}, /* PCIE_USB3_PCS_RCVR_DTCT_DLY_P1U2_L */
643 {0x874, 0x03}, /* PCIE_USB3_PCS_RCVR_DTCT_DLY_P1U2_H */
644 {0x878, 0x40}, /* PCIE_USB3_PCS_RCVR_DTCT_DLY_U3_L */
645 {0x87c, 0x00}, /* PCIE_USB3_PCS_RCVR_DTCT_DLY_U3_H */
646 {0x9D8, 0x88}, /* PCIE_USB3_PCS_RX_SIGDET_LVL */
647 {0x808, 0x03}, /* PCIE_USB3_PCS_START_CONTROL */
648 {0x800, 0x00}, /* PCIE_USB3_PCS_SW_RESET */
649};
650
651struct qmp_reg *target_get_qmp_settings()
652{
653 return qmp_settings;
654}
655
656int target_get_qmp_regsize()
657{
658 return ARRAY_SIZE(qmp_settings);
659}
Padmanabhan Komanduru0104a892016-01-22 16:58:10 +0530660static uint8_t splash_override;
661/* Returns 1 if target supports continuous splash screen. */
662int target_cont_splash_screen()
663{
664 uint8_t splash_screen = 0;
665 if (!splash_override) {
666 switch (board_hardware_id()) {
667 case HW_PLATFORM_MTP:
668 case HW_PLATFORM_SURF:
669 case HW_PLATFORM_RCM:
670 case HW_PLATFORM_QRD:
671 splash_screen = 1;
672 break;
673 default:
674 splash_screen = 0;
675 break;
676 }
677 dprintf(SPEW, "Target_cont_splash=%d\n", splash_screen);
678 }
679 return splash_screen;
680}
681
682void target_force_cont_splash_disable(uint8_t override)
683{
684 splash_override = override;
685}