blob: ac1b75ff66d5a7dd3dcc2c92a4f88b4476603467 [file] [log] [blame]
Aparna Mallavarapu01fc00a2015-06-01 20:37:05 +05301/* Copyright (c) 2015, The Linux Foundation. All rights reserved.
2 *
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>
Aparna Mallavarapu01fc00a2015-06-01 20:37:05 +053061
62#if LONG_PRESS_POWER_ON
63#include <shutdown_detect.h>
64#endif
65
66#define PMIC_ARB_CHANNEL_NUM 0
67#define PMIC_ARB_OWNER_ID 0
68#define TLMM_VOL_UP_BTN_GPIO 85
69
70#define FASTBOOT_MODE 0x77665500
P.V. Phani Kumar77826d32015-12-26 20:56:35 +053071#define RECOVERY_MODE 0x77665502
Aparna Mallavarapu01fc00a2015-06-01 20:37:05 +053072#define PON_SOFT_RB_SPARE 0x88F
73
P.V. Phani Kumar77826d32015-12-26 20:56:35 +053074#define CE1_INSTANCE 1
75#define CE_EE 1
76#define CE_FIFO_SIZE 64
77#define CE_READ_PIPE 3
78#define CE_WRITE_PIPE 2
79#define CE_READ_PIPE_LOCK_GRP 0
80#define CE_WRITE_PIPE_LOCK_GRP 0
81#define CE_ARRAY_SIZE 20
82
P.V. Phani Kumara053a322015-08-13 18:36:05 +053083struct mmc_device *dev;
84
85static uint32_t mmc_pwrctl_base[] =
Aparna Mallavarapu01fc00a2015-06-01 20:37:05 +053086 { MSM_SDC1_BASE, MSM_SDC2_BASE };
87
P.V. Phani Kumara053a322015-08-13 18:36:05 +053088static uint32_t mmc_sdhci_base[] =
89 { MSM_SDC1_SDHCI_BASE, MSM_SDC2_SDHCI_BASE };
90
91static uint32_t mmc_sdc_pwrctl_irq[] =
92 { SDCC1_PWRCTL_IRQ, SDCC2_PWRCTL_IRQ };
Aparna Mallavarapu01fc00a2015-06-01 20:37:05 +053093
94void target_early_init(void)
95{
96#if WITH_DEBUG_UART
P.V. Phani Kumar77826d32015-12-26 20:56:35 +053097 uart_dm_init(2, 0, BLSP1_UART1_BASE);
Aparna Mallavarapu01fc00a2015-06-01 20:37:05 +053098#endif
99}
100
P.V. Phani Kumara053a322015-08-13 18:36:05 +0530101static void set_sdc_power_ctrl()
Aparna Mallavarapu01fc00a2015-06-01 20:37:05 +0530102{
P.V. Phani Kumara053a322015-08-13 18:36:05 +0530103 /* Drive strength configs for sdc pins */
104 struct tlmm_cfgs sdc1_hdrv_cfg[] =
105 {
106 { SDC1_CLK_HDRV_CTL_OFF, TLMM_CUR_VAL_16MA, TLMM_HDRV_MASK, 0},
107 { SDC1_CMD_HDRV_CTL_OFF, TLMM_CUR_VAL_10MA, TLMM_HDRV_MASK, 0},
108 { SDC1_DATA_HDRV_CTL_OFF, TLMM_CUR_VAL_10MA, TLMM_HDRV_MASK , 0},
109 };
110
111 /* Pull configs for sdc pins */
112 struct tlmm_cfgs sdc1_pull_cfg[] =
113 {
114 { SDC1_CLK_PULL_CTL_OFF, TLMM_NO_PULL, TLMM_PULL_MASK, 0},
115 { SDC1_CMD_PULL_CTL_OFF, TLMM_PULL_UP, TLMM_PULL_MASK, 0},
116 { SDC1_DATA_PULL_CTL_OFF, TLMM_PULL_UP, TLMM_PULL_MASK, 0},
117 };
118
119 struct tlmm_cfgs sdc1_rclk_cfg[] =
120 {
121 { SDC1_RCLK_PULL_CTL_OFF, TLMM_PULL_DOWN, TLMM_PULL_MASK, 0},
122 };
123
124 /* Set the drive strength & pull control values */
125 tlmm_set_hdrive_ctrl(sdc1_hdrv_cfg, ARRAY_SIZE(sdc1_hdrv_cfg));
126 tlmm_set_pull_ctrl(sdc1_pull_cfg, ARRAY_SIZE(sdc1_pull_cfg));
127 tlmm_set_pull_ctrl(sdc1_rclk_cfg, ARRAY_SIZE(sdc1_rclk_cfg));
128}
129
130void target_sdc_init()
131{
132 struct mmc_config_data config;
133
134 /* Set drive strength & pull ctrl values */
135 set_sdc_power_ctrl();
136
137 config.slot = MMC_SLOT;
138 config.bus_width = DATA_BUS_WIDTH_8BIT;
139 config.max_clk_rate = MMC_CLK_192MHZ;
140 config.sdhc_base = mmc_sdhci_base[config.slot - 1];
141 config.pwrctl_base = mmc_pwrctl_base[config.slot - 1];
142 config.pwr_irq = mmc_sdc_pwrctl_irq[config.slot - 1];
143 config.hs400_support = 1;
144
145 if (!(dev = mmc_init(&config))) {
146 /* Try different config. values */
147 config.max_clk_rate = MMC_CLK_200MHZ;
148 config.sdhc_base = mmc_sdhci_base[config.slot - 1];
149 config.pwrctl_base = mmc_pwrctl_base[config.slot - 1];
150 config.pwr_irq = mmc_sdc_pwrctl_irq[config.slot - 1];
151 config.hs400_support = 0;
152
153 if (!(dev = mmc_init(&config))) {
154 dprintf(CRITICAL, "mmc init failed!");
155 ASSERT(0);
156 }
157 }
158}
159
160void *target_mmc_device()
161{
162 return (void *) dev;
Aparna Mallavarapu01fc00a2015-06-01 20:37:05 +0530163}
164
165/* Return 1 if vol_up pressed */
166static int target_volume_up()
167{
168 uint8_t status = 0;
169
170 gpio_tlmm_config(TLMM_VOL_UP_BTN_GPIO, 0, GPIO_INPUT, GPIO_PULL_UP, GPIO_2MA, GPIO_ENABLE);
171
172 /* Wait for the gpio config to take effect - debounce time */
173 thread_sleep(10);
174
175 /* Get status of GPIO */
176 status = gpio_status(TLMM_VOL_UP_BTN_GPIO);
177
178 /* Active high signal. */
P.V. Phani Kumar77826d32015-12-26 20:56:35 +0530179 return !status;
Aparna Mallavarapu01fc00a2015-06-01 20:37:05 +0530180}
181
182/* Return 1 if vol_down pressed */
183uint32_t target_volume_down()
184{
185 /* Volume down button tied in with PMIC RESIN. */
186 return pm8x41_resin_status();
187}
188
P.V. Phani Kumar77826d32015-12-26 20:56:35 +0530189uint32_t target_is_pwrkey_pon_reason()
190{
191 uint8_t pon_reason = pm8950_get_pon_reason();
192 if (pm8x41_get_is_cold_boot() && ((pon_reason == KPDPWR_N) || (pon_reason == (KPDPWR_N|PON1))))
193 return 1;
194 else
195 return 0;
196}
197
Aparna Mallavarapu01fc00a2015-06-01 20:37:05 +0530198static void target_keystatus()
199{
200 keys_init();
201
202 if(target_volume_down())
203 keys_post_event(KEY_VOLUMEDOWN, 1);
204
205 if(target_volume_up())
206 keys_post_event(KEY_VOLUMEUP, 1);
207}
208
Aparna Mallavarapu01fc00a2015-06-01 20:37:05 +0530209void target_init(void)
210{
P.V. Phani Kumar77826d32015-12-26 20:56:35 +0530211#if VERIFIED_BOOT
212#if !VBOOT_MOTA
213 int ret = 0;
214#endif
215#endif
Aparna Mallavarapu01fc00a2015-06-01 20:37:05 +0530216 dprintf(INFO, "target_init()\n");
217
218 spmi_init(PMIC_ARB_CHANNEL_NUM, PMIC_ARB_OWNER_ID);
219
220 target_keystatus();
221
P.V. Phani Kumara053a322015-08-13 18:36:05 +0530222 target_sdc_init();
223 if (partition_read_table())
224 {
225 dprintf(CRITICAL, "Error reading the partition table info\n");
226 ASSERT(0);
Aparna Mallavarapu01fc00a2015-06-01 20:37:05 +0530227 }
P.V. Phani Kumara053a322015-08-13 18:36:05 +0530228
Aparna Mallavarapu01fc00a2015-06-01 20:37:05 +0530229#if LONG_PRESS_POWER_ON
230 shutdown_detect();
231#endif
P.V. Phani Kumar77826d32015-12-26 20:56:35 +0530232
233
234 if (target_use_signed_kernel())
235 target_crypto_init_params();
236
237#if VERIFIED_BOOT
238#if !VBOOT_MOTA
239 clock_ce_enable(CE1_INSTANCE);
240
241 /* Initialize Qseecom */
242 ret = qseecom_init();
243
244 if (ret < 0)
245 {
246 dprintf(CRITICAL, "Failed to initialize qseecom, error: %d\n", ret);
247 ASSERT(0);
248 }
249
250 /* Start Qseecom */
251 ret = qseecom_tz_init();
252
253 if (ret < 0)
254 {
255 dprintf(CRITICAL, "Failed to start qseecom, error: %d\n", ret);
256 ASSERT(0);
257 }
258
259 if (rpmb_init() < 0)
260 {
261 dprintf(CRITICAL, "RPMB init failed\n");
262 ASSERT(0);
263 }
264
265 /*
266 * Load the sec app for first time
267 */
268 if (load_sec_app() < 0)
269 {
270 dprintf(CRITICAL, "Failed to load App for verified\n");
271 ASSERT(0);
272 }
273#endif
274#endif
275
276#if SMD_SUPPORT
277 rpm_smd_init();
278#endif
Aparna Mallavarapu01fc00a2015-06-01 20:37:05 +0530279}
280
281void target_serialno(unsigned char *buf)
282{
283 uint32_t serialno;
284 if (target_is_emmc_boot()) {
285 serialno = mmc_get_psn();
286 snprintf((char *)buf, 13, "%x", serialno);
287 }
288}
289
290unsigned board_machtype(void)
291{
P.V. Phani Kumara053a322015-08-13 18:36:05 +0530292 return LINUX_MACHTYPE_UNKNOWN;
293}
294
295/* Detect the target type */
296void target_detect(struct board_data *board)
297{
298 /* This is already filled as part of board.c */
299}
300
P.V. Phani Kumar77826d32015-12-26 20:56:35 +0530301/* Detect the modem type */
P.V. Phani Kumara053a322015-08-13 18:36:05 +0530302void target_baseband_detect(struct board_data *board)
303{
304 uint32_t platform;
305
306 platform = board->platform;
307
308 switch(platform) {
309 case MSMTITANIUM:
310 board->baseband = BASEBAND_MSM;
311 break;
312 default:
313 dprintf(CRITICAL, "Platform type: %u is not supported\n",platform);
314 ASSERT(0);
315 };
Aparna Mallavarapu01fc00a2015-06-01 20:37:05 +0530316}
317
P.V. Phani Kumar77826d32015-12-26 20:56:35 +0530318unsigned target_baseband()
319{
320 return board_baseband();
321}
Aparna Mallavarapu01fc00a2015-06-01 20:37:05 +0530322int set_download_mode(enum dload_mode mode)
323{
324 int ret = 0;
325 ret = scm_dload_mode(mode);
326
327 pm8x41_clear_pmic_watchdog();
328
329 return ret;
330}
331
332int emmc_recovery_init(void)
333{
334 return _emmc_recovery_init();
335}
336
337unsigned target_pause_for_battery_charge(void)
338{
339 uint8_t pon_reason = pm8x41_get_pon_reason();
340 uint8_t is_cold_boot = pm8x41_get_is_cold_boot();
341 dprintf(INFO, "%s : pon_reason is %d cold_boot:%d\n", __func__,
342 pon_reason, is_cold_boot);
343 /* In case of fastboot reboot,adb reboot or if we see the power key
344 * pressed we do not want go into charger mode.
345 * fastboot reboot is warm boot with PON hard reset bit not set
346 * adb reboot is a cold boot with PON hard reset bit set
347 */
348 if (is_cold_boot &&
349 (!(pon_reason & HARD_RST)) &&
350 (!(pon_reason & KPDPWR_N)) &&
351 ((pon_reason & USB_CHG) || (pon_reason & DC_CHG) || (pon_reason & CBLPWR_N)))
352 return 1;
353 else
354 return 0;
355}
356
P.V. Phani Kumar77826d32015-12-26 20:56:35 +0530357void target_uninit(void)
358{
359 mmc_put_card_to_sleep(dev);
360 sdhci_mode_disable(&dev->host);
361 if (crypto_initialized())
362 crypto_eng_cleanup();
363
364 if (target_is_ssd_enabled())
365 clock_ce_disable(CE1_INSTANCE);
366
367#if VERIFIED_BOOT
368#if !VBOOT_MOTA
369 if (is_sec_app_loaded())
370 {
371 if (send_milestone_call_to_tz() < 0)
372 {
373 dprintf(CRITICAL, "Failed to unload App for rpmb\n");
374 ASSERT(0);
375 }
376 }
377
378 if (rpmb_uninit() < 0)
379 {
380 dprintf(CRITICAL, "RPMB uninit failed\n");
381 ASSERT(0);
382 }
383
384 clock_ce_disable(CE1_INSTANCE);
385#endif
386#endif
387
388#if SMD_SUPPORT
389 rpm_smd_uninit();
390#endif
391}
392
Aparna Mallavarapu01fc00a2015-06-01 20:37:05 +0530393/* UTMI MUX configuration to connect PHY to SNPS controller:
394 * Configure primary HS phy mux to use UTMI interface
395 * (connected to usb30 controller).
396 */
397static void tcsr_hs_phy_mux_configure(void)
398{
399 uint32_t reg;
400
401 reg = readl(USB2_PHY_SEL);
402
403 writel(reg | 0x1, USB2_PHY_SEL);
404}
405
406/* configure hs phy mux if using dwc controller */
407void target_usb_phy_mux_configure(void)
408{
409 if(!strcmp(target_usb_controller(), "dwc"))
410 {
411 tcsr_hs_phy_mux_configure();
412 }
413}
414
P.V. Phani Kumar77826d32015-12-26 20:56:35 +0530415void target_usb_phy_reset()
416{
417
418 usb30_qmp_phy_reset();
419 qusb2_phy_reset();
420}
421
Aparna Mallavarapu01fc00a2015-06-01 20:37:05 +0530422/* Initialize target specific USB handlers */
423target_usb_iface_t* target_usb30_init()
424{
425 target_usb_iface_t *t_usb_iface;
426
P.V. Phani Kumar77826d32015-12-26 20:56:35 +0530427 t_usb_iface = (target_usb_iface_t *) calloc(1, sizeof(target_usb_iface_t));
Aparna Mallavarapu01fc00a2015-06-01 20:37:05 +0530428 ASSERT(t_usb_iface);
429
P.V. Phani Kumar77826d32015-12-26 20:56:35 +0530430 t_usb_iface->mux_config = NULL;
431 t_usb_iface->phy_init = usb30_qmp_phy_init;
432 t_usb_iface->phy_reset = target_usb_phy_reset;
433 t_usb_iface->clock_init = clock_usb30_init;
434 t_usb_iface->vbus_override = 1;
Aparna Mallavarapu01fc00a2015-06-01 20:37:05 +0530435
436 return t_usb_iface;
437}
438
439/* identify the usb controller to be used for the target */
440const char * target_usb_controller()
441{
442 return "dwc";
443}
P.V. Phani Kumara053a322015-08-13 18:36:05 +0530444
P.V. Phani Kumar77826d32015-12-26 20:56:35 +0530445/* Do any target specific intialization needed before entering fastboot mode */
446void target_fastboot_init(void)
447{
448 if (target_is_ssd_enabled()) {
449 clock_ce_enable(CE1_INSTANCE);
450 target_load_ssd_keystore();
451 }
452}
453
454void target_load_ssd_keystore(void)
455{
456 uint64_t ptn;
457 int index;
458 uint64_t size;
459 uint32_t *buffer = NULL;
460
461 if (!target_is_ssd_enabled())
462 return;
463
464 index = partition_get_index("ssd");
465
466 ptn = partition_get_offset(index);
467 if (ptn == 0){
468 dprintf(CRITICAL, "Error: ssd partition not found\n");
469 return;
470 }
471
472 size = partition_get_size(index);
473 if (size == 0) {
474 dprintf(CRITICAL, "Error: invalid ssd partition size\n");
475 return;
476 }
477
478 buffer = memalign(CACHE_LINE, ROUNDUP(size, CACHE_LINE));
479 if (!buffer) {
480 dprintf(CRITICAL, "Error: allocating memory for ssd buffer\n");
481 return;
482 }
483
484 if (mmc_read(ptn, buffer, size)) {
485 dprintf(CRITICAL, "Error: cannot read data\n");
486 free(buffer);
487 return;
488 }
489
490 clock_ce_enable(CE1_INSTANCE);
491 scm_protect_keystore(buffer, size);
492 clock_ce_disable(CE1_INSTANCE);
493 free(buffer);
494}
P.V. Phani Kumara053a322015-08-13 18:36:05 +0530495
496crypto_engine_type board_ce_type(void)
497{
498 return CRYPTO_ENGINE_TYPE_HW;
499}
500
P.V. Phani Kumar77826d32015-12-26 20:56:35 +0530501/* Set up params for h/w CE. */
502void target_crypto_init_params()
503{
504 struct crypto_init_params ce_params;
505
506 /* Set up base addresses and instance. */
507 ce_params.crypto_instance = CE1_INSTANCE;
508 ce_params.crypto_base = MSM_CE1_BASE;
509 ce_params.bam_base = MSM_CE1_BAM_BASE;
510
511 /* Set up BAM config. */
512 ce_params.bam_ee = CE_EE;
513 ce_params.pipes.read_pipe = CE_READ_PIPE;
514 ce_params.pipes.write_pipe = CE_WRITE_PIPE;
515 ce_params.pipes.read_pipe_grp = CE_READ_PIPE_LOCK_GRP;
516 ce_params.pipes.write_pipe_grp = CE_WRITE_PIPE_LOCK_GRP;
517
518 /* Assign buffer sizes. */
519 ce_params.num_ce = CE_ARRAY_SIZE;
520 ce_params.read_fifo_size = CE_FIFO_SIZE;
521 ce_params.write_fifo_size = CE_FIFO_SIZE;
522
523 /* BAM is initialized by TZ for this platform.
524 * Do not do it again as the initialization address space
525 * is locked.
526 */
527 ce_params.do_bam_init = 0;
528
529 crypto_init_params(&ce_params);
530}
P.V. Phani Kumara053a322015-08-13 18:36:05 +0530531
532void pmic_reset_configure(uint8_t reset_type)
533{
534 pm8x41_reset_configure(reset_type);
535}
P.V. Phani Kumar77826d32015-12-26 20:56:35 +0530536
537uint32_t target_get_pmic()
538{
539 return PMIC_IS_PMI8950;
540}
541
542struct qmp_reg qmp_settings[] =
543{
544 {0x804, 0x01}, /*USB3PHY_PCIE_USB3_PCS_POWER_DOWN_CONTROL */
545 {0xAC, 0x14}, /* QSERDES_COM_SYSCLK_EN_SEL */
546 {0x34, 0x08}, /* QSERDES_COM_BIAS_EN_CLKBUFLR_EN */
547 {0x174, 0x30}, /* QSERDES_COM_CLK_SELECT */
548 {0x3C, 0x06}, /* QSERDES_COM_SYS_CLK_CTRL */
549 {0xB4, 0x00}, /* QSERDES_COM_RESETSM_CNTRL */
550 {0xB8, 0x08}, /* QSERDES_COM_RESETSM_CNTRL2 */
551 {0x194, 0x06}, /* QSERDES_COM_CMN_CONFIG */
552 {0x19c, 0x01}, /* QSERDES_COM_SVS_MODE_CLK_SEL */
553 {0x178, 0x00}, /* QSERDES_COM_HSCLK_SEL */
554 {0xd0, 0x82}, /* QSERDES_COM_DEC_START_MODE0 */
555 {0xdc, 0x55}, /* QSERDES_COM_DIV_FRAC_START1_MODE0 */
556 {0xe0, 0x55}, /* QSERDES_COM_DIV_FRAC_START2_MODE0 */
557 {0xe4, 0x03}, /* QSERDES_COM_DIV_FRAC_START3_MODE0 */
558 {0x78, 0x0b}, /* QSERDES_COM_CP_CTRL_MODE0 */
559 {0x84, 0x16}, /* QSERDES_COM_PLL_RCTRL_MODE0 */
560 {0x90, 0x28}, /* QSERDES_COM_PLL_CCTRL_MODE0 */
561 {0x108, 0x80}, /* QSERDES_COM_INTEGLOOP_GAIN0_MODE0 */
562 {0x10C, 0x00}, /* QSERDES_COM_INTEGLOOP_GAIN1_MODE0 */
563 {0x184, 0x0A}, /* QSERDES_COM_CORECLK_DIV */
564 {0x4c, 0x15}, /* QSERDES_COM_LOCK_CMP1_MODE0 */
565 {0x50, 0x34}, /* QSERDES_COM_LOCK_CMP2_MODE0 */
566 {0x54, 0x00}, /* QSERDES_COM_LOCK_CMP3_MODE0 */
567 {0xC8, 0x00}, /* QSERDES_COM_LOCK_CMP_EN */
568 {0x18c, 0x00}, /* QSERDES_COM_CORE_CLK_EN */
569 {0xcc, 0x00}, /* QSERDES_COM_LOCK_CMP_CFG */
570 {0x128, 0x00}, /* QSERDES_COM_VCO_TUNE_MAP */
571 {0x0C, 0x0A}, /* QSERDES_COM_BG_TIMER */
572 {0x10, 0x01}, /* QSERDES_COM_SSC_EN_CENTER */
573 {0x1c, 0x31}, /* QSERDES_COM_SSC_PER1 */
574 {0x20, 0x01}, /* QSERDES_COM_SSC_PER2 */
575 {0x14, 0x00}, /* QSERDES_COM_SSC_ADJ_PER1 */
576 {0x18, 0x00}, /* QSERDES_COM_SSC_ADJ_PER2 */
577 {0x24, 0xde}, /* QSERDES_COM_SSC_STEP_SIZE1 */
578 {0x28, 0x07}, /* QSERDES_COM_SSC_STEP_SIZE2 */
579 {0x48, 0x0F}, /* USB3PHY_QSERDES_COM_PLL_IVCO */
580 {0x70, 0x0F}, /* USB3PHY_QSERDES_COM_BG_TRIM */
581 {0x100, 0x80}, /* QSERDES_COM_INTEGLOOP_INITVAL */
582
583 /* Rx Settings */
584 {0x440, 0x0b}, /* QSERDES_RX_UCDR_FASTLOCK_FO_GAIN */
585 {0x4d8, 0x02}, /* QSERDES_RX_RX_EQU_ADAPTOR_CNTRL2 */
586 {0x4dc, 0x6c}, /* QSERDES_RX_RX_EQU_ADAPTOR_CNTRL3 */
587 {0x4e0, 0xbb}, /* QSERDES_RX_RX_EQU_ADAPTOR_CNTRL4 */
588 {0x508, 0x77}, /* QSERDES_RX_RX_EQ_OFFSET_ADAPTOR_CNTRL1 */
589 {0x50c, 0x80}, /* QSERDES_RX_RX_OFFSET_ADAPTOR_CNTRL2 */
590 {0x514, 0x03}, /* QSERDES_RX_SIGDET_CNTRL */
591 {0x51c, 0x16}, /* QSERDES_RX_SIGDET_DEGLITCH_CNTRL */
592 {0x448, 0x75}, /* QSERDES_RX_UCDR_SO_SATURATION_AND_ENABLE */
593 {0x450, 0x00}, /* QSERDES_RX_UCDR_FASTLOCK_COUNT_LOW */
594 {0x454, 0x00}, /* QSERDES_RX_UCDR_FASTLOCK_COUNT_HIGH */
595 {0x40C, 0x0a}, /* QSERDES_RX_UCDR_FO_GAIN */
596 {0x41C, 0x06}, /* QSERDES_RX_UCDR_SO_GAIN */
597 {0x510, 0x00}, /*QSERDES_RX_SIGDET_ENABLES */
598
599 /* Tx settings */
600 {0x268, 0x45}, /* QSERDES_TX_HIGHZ_TRANSCEIVEREN_BIAS_DRVR_EN */
601 {0x2ac, 0x12}, /* QSERDES_TX_RCV_DETECT_LVL_2 */
602 {0x294, 0x06}, /* QSERDES_TX_LANE_MODE */
603 {0x254, 0x00}, /* QSERDES_TX_RES_CODE_LANE_OFFSET */
604
605 /* FLL settings */
606 {0x8c8, 0x83}, /* PCIE_USB3_PCS_FLL_CNTRL2 */
607 {0x8c4, 0x02}, /* PCIE_USB3_PCS_FLL_CNTRL1 */
608 {0x8cc, 0x09}, /* PCIE_USB3_PCS_FLL_CNT_VAL_L */
609 {0x8D0, 0xA2}, /* PCIE_USB3_PCS_FLL_CNT_VAL_H_TOL */
610 {0x8D4, 0x85}, /* PCIE_USB3_PCS_FLL_MAN_CODE */
611
612 /* PCS Settings */
613 {0x880, 0xD1}, /* PCIE_USB3_PCS_LOCK_DETECT_CONFIG1 */
614 {0x884, 0x1F}, /* PCIE_USB3_PCS_LOCK_DETECT_CONFIG2 */
615 {0x888, 0x47}, /* PCIE_USB3_PCS_LOCK_DETECT_CONFIG3 */
616 {0x80C, 0x9F}, /* PCIE_USB3_PCS_TXMGN_V0 */
617 {0x824, 0x17}, /* PCIE_USB3_PCS_TXDEEMPH_M6DB_V0 */
618 {0x828, 0x0F}, /* PCIE_USB3_PCS_TXDEEMPH_M3P5DB_V0 */
619 {0x8B8, 0x75}, /* PCIE_USB3_PCS_RXEQTRAINING_WAIT_TIME */
620 {0x8BC, 0x13}, /* PCIE_USB3_PCS_RXEQTRAINING_RUN_TIME */
621 {0x8B0, 0x86}, /* PCIE_USB3_PCS_LFPS_TX_ECSTART_EQTLOCK */
622 {0x8A0, 0x04}, /* PCIE_USB3_PCS_PWRUP_RESET_DLY_TIME_AUXCLK */
623 {0x88C, 0x44}, /* PCIE_USB3_PCS_TSYNC_RSYNC_TIME */
624 {0x870, 0xE7}, /* PCIE_USB3_PCS_RCVR_DTCT_DLY_P1U2_L */
625 {0x874, 0x03}, /* PCIE_USB3_PCS_RCVR_DTCT_DLY_P1U2_H */
626 {0x878, 0x40}, /* PCIE_USB3_PCS_RCVR_DTCT_DLY_U3_L */
627 {0x87c, 0x00}, /* PCIE_USB3_PCS_RCVR_DTCT_DLY_U3_H */
628 {0x9D8, 0x88}, /* PCIE_USB3_PCS_RX_SIGDET_LVL */
629 {0x808, 0x03}, /* PCIE_USB3_PCS_START_CONTROL */
630 {0x800, 0x00}, /* PCIE_USB3_PCS_SW_RESET */
631};
632
633struct qmp_reg *target_get_qmp_settings()
634{
635 return qmp_settings;
636}
637
638int target_get_qmp_regsize()
639{
640 return ARRAY_SIZE(qmp_settings);
641}