blob: ccc5b8f2b2ad9ca1b3ff4612bb26daa415fc882b [file] [log] [blame]
Aparna Mallavarapufe1f3d12013-10-19 15:05:30 +05301/* Copyright (c) 2014, 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>
Aparna Mallavarapu7cc5a792014-02-27 21:49:59 -080036#include <platform/gpio.h>
37#include <dev/keys.h>
38#include <spmi_v2.h>
39#include <pm8x41.h>
Aparna Mallavarapufe1f3d12013-10-19 15:05:30 +053040#include <board.h>
Aparna Mallavarapu7cc5a792014-02-27 21:49:59 -080041#include <baseband.h>
42#include <hsusb.h>
Aparna Mallavarapuacb6ede2014-03-21 19:22:00 +053043#include <scm.h>
Aparna Mallavarapu7cc5a792014-02-27 21:49:59 -080044#include <platform/gpio.h>
45#include <platform/gpio.h>
46#include <platform/irqs.h>
Aparna Mallavarapu7c8e75f2014-04-22 20:20:28 +053047#include <platform/clock.h>
48#include <crypto5_wrapper.h>
49#include <partition_parser.h>
50#include <stdlib.h>
Aparna Mallavarapufe1f3d12013-10-19 15:05:30 +053051
Matthew Qinf3ebf182014-04-08 11:38:14 +080052#if LONG_PRESS_POWER_ON
53#include <shutdown_detect.h>
54#endif
55
Matthew Qin7f5ab932014-04-08 15:25:54 +080056#if PON_VIB_SUPPORT
57#include <vibrator.h>
58#endif
59
Aparna Mallavarapufe1f3d12013-10-19 15:05:30 +053060#define PMIC_ARB_CHANNEL_NUM 0
61#define PMIC_ARB_OWNER_ID 0
Aparna Mallavarapu7cc5a792014-02-27 21:49:59 -080062#define TLMM_VOL_UP_BTN_GPIO 107
Aparna Mallavarapufe1f3d12013-10-19 15:05:30 +053063
Matthew Qin7f5ab932014-04-08 15:25:54 +080064#if PON_VIB_SUPPORT
65#define VIBRATE_TIME 250
66#endif
67
Aparna Mallavarapuacb6ede2014-03-21 19:22:00 +053068#define FASTBOOT_MODE 0x77665500
69
Aparna Mallavarapu7c8e75f2014-04-22 20:20:28 +053070#define CE1_INSTANCE 1
71#define CE_EE 1
72#define CE_FIFO_SIZE 64
73#define CE_READ_PIPE 3
74#define CE_WRITE_PIPE 2
75#define CE_READ_PIPE_LOCK_GRP 0
76#define CE_WRITE_PIPE_LOCK_GRP 0
77#define CE_ARRAY_SIZE 20
78
Aparna Mallavarapu7cc5a792014-02-27 21:49:59 -080079static void set_sdc_power_ctrl(void);
80
81struct mmc_device *dev;
82
83static uint32_t mmc_pwrctl_base[] =
Aparna Mallavarapufe1f3d12013-10-19 15:05:30 +053084 { MSM_SDC1_BASE, MSM_SDC2_BASE };
85
Aparna Mallavarapu7cc5a792014-02-27 21:49:59 -080086static uint32_t mmc_sdhci_base[] =
87 { MSM_SDC1_SDHCI_BASE, MSM_SDC2_SDHCI_BASE };
88
89static uint32_t mmc_sdc_pwrctl_irq[] =
90 { SDCC1_PWRCTL_IRQ, SDCC2_PWRCTL_IRQ };
91
Aparna Mallavarapufe1f3d12013-10-19 15:05:30 +053092void target_early_init(void)
93{
94#if WITH_DEBUG_UART
Aparna Mallavarapu7cc5a792014-02-27 21:49:59 -080095 uart_dm_init(2, 0, BLSP1_UART1_BASE);
Aparna Mallavarapufe1f3d12013-10-19 15:05:30 +053096#endif
97}
Aparna Mallavarapu7cc5a792014-02-27 21:49:59 -080098
99void target_sdc_init()
Aparna Mallavarapufe1f3d12013-10-19 15:05:30 +0530100{
Aparna Mallavarapu7cc5a792014-02-27 21:49:59 -0800101 struct mmc_config_data config;
102
103 /* Set drive strength & pull ctrl values */
104 set_sdc_power_ctrl();
105
106 config.bus_width = DATA_BUS_WIDTH_8BIT;
Aparna Mallavarapu53b09402014-03-26 14:46:43 +0530107 config.max_clk_rate = MMC_CLK_177MHZ;
Aparna Mallavarapu7cc5a792014-02-27 21:49:59 -0800108
109 /* Try slot 1*/
110 config.slot = 1;
111 config.sdhc_base = mmc_sdhci_base[config.slot - 1];
112 config.pwrctl_base = mmc_pwrctl_base[config.slot - 1];
113 config.pwr_irq = mmc_sdc_pwrctl_irq[config.slot - 1];
114 config.hs400_support = 0;
115
116 if (!(dev = mmc_init(&config))) {
117 /* Try slot 2 */
118 config.slot = 2;
Aparna Mallavarapu53b09402014-03-26 14:46:43 +0530119 config.max_clk_rate = MMC_CLK_200MHZ;
Aparna Mallavarapu7cc5a792014-02-27 21:49:59 -0800120 config.sdhc_base = mmc_sdhci_base[config.slot - 1];
121 config.pwrctl_base = mmc_pwrctl_base[config.slot - 1];
122 config.pwr_irq = mmc_sdc_pwrctl_irq[config.slot - 1];
123
124 if (!(dev = mmc_init(&config))) {
125 dprintf(CRITICAL, "mmc init failed!");
126 ASSERT(0);
127 }
128 }
Aparna Mallavarapufe1f3d12013-10-19 15:05:30 +0530129}
Aparna Mallavarapu7cc5a792014-02-27 21:49:59 -0800130
131void *target_mmc_device()
132{
133 return (void *) dev;
134}
135
136/* Return 1 if vol_up pressed */
137static int target_volume_up()
138{
139 uint8_t status = 0;
140
141 gpio_tlmm_config(TLMM_VOL_UP_BTN_GPIO, 0, GPIO_INPUT, GPIO_PULL_UP, GPIO_2MA, GPIO_ENABLE);
142
143 /* Wait for the gpio config to take effect - debounce time */
144 thread_sleep(10);
145
146 /* Get status of GPIO */
147 status = gpio_status(TLMM_VOL_UP_BTN_GPIO);
148
149 /* Active low signal. */
150 return !status;
151}
152
153/* Return 1 if vol_down pressed */
154uint32_t target_volume_down()
155{
156 /* Volume down button tied in with PMIC RESIN. */
157 return pm8x41_resin_status();
158}
159
Aparna Mallavarapufe1f3d12013-10-19 15:05:30 +0530160static void target_keystatus()
161{
Aparna Mallavarapu7cc5a792014-02-27 21:49:59 -0800162 keys_init();
163
164 if(target_volume_down())
165 keys_post_event(KEY_VOLUMEDOWN, 1);
166
167 if(target_volume_up())
168 keys_post_event(KEY_VOLUMEUP, 1);
Aparna Mallavarapufe1f3d12013-10-19 15:05:30 +0530169}
170
171void target_init(void)
172{
173 uint32_t base_addr;
174 uint8_t slot;
175
176 dprintf(INFO, "target_init()\n");
177
178 spmi_init(PMIC_ARB_CHANNEL_NUM, PMIC_ARB_OWNER_ID);
179
180 target_keystatus();
Aparna Mallavarapu7cc5a792014-02-27 21:49:59 -0800181 set_sdc_power_ctrl();
Aparna Mallavarapufe1f3d12013-10-19 15:05:30 +0530182
Aparna Mallavarapu7cc5a792014-02-27 21:49:59 -0800183 target_sdc_init();
184 if (partition_read_table())
Aparna Mallavarapufe1f3d12013-10-19 15:05:30 +0530185 {
Aparna Mallavarapu7cc5a792014-02-27 21:49:59 -0800186 dprintf(CRITICAL, "Error reading the partition table info\n");
Aparna Mallavarapufe1f3d12013-10-19 15:05:30 +0530187 ASSERT(0);
188 }
Matthew Qinf3ebf182014-04-08 11:38:14 +0800189
190#if LONG_PRESS_POWER_ON
191 shutdown_detect();
192#endif
Matthew Qin7f5ab932014-04-08 15:25:54 +0800193
194#if PON_VIB_SUPPORT
195 /* turn on vibrator to indicate that phone is booting up to end user */
196 vib_timed_turn_on(VIBRATE_TIME);
197#endif
Aparna Mallavarapu7c8e75f2014-04-22 20:20:28 +0530198
199 if (target_use_signed_kernel())
200 target_crypto_init_params();
Aparna Mallavarapufe1f3d12013-10-19 15:05:30 +0530201}
202
203void target_serialno(unsigned char *buf)
204{
205 uint32_t serialno;
206 if (target_is_emmc_boot()) {
207 serialno = mmc_get_psn();
208 snprintf((char *)buf, 13, "%x", serialno);
209 }
210}
211
212unsigned board_machtype(void)
213{
Aparna Mallavarapu7cc5a792014-02-27 21:49:59 -0800214 return LINUX_MACHTYPE_UNKNOWN;
215}
216
217unsigned check_reboot_mode(void)
218{
219 uint32_t restart_reason = 0;
220
221 /* Read reboot reason and scrub it */
222 restart_reason = readl(RESTART_REASON_ADDR);
223 writel(0x00, RESTART_REASON_ADDR);
224
225 return restart_reason;
226}
227
Aparna Mallavarapuacb6ede2014-03-21 19:22:00 +0530228static int scm_dload_mode(int mode)
229{
230 int ret = 0;
231 uint32_t dload_type;
232
233 dprintf(SPEW, "DLOAD mode: %d\n", mode);
234 if (mode == NORMAL_DLOAD)
235 dload_type = SCM_DLOAD_MODE;
236 else if(mode == EMERGENCY_DLOAD)
237 dload_type = SCM_EDLOAD_MODE;
238 else
239 dload_type = 0;
240
241 ret = scm_call_atomic2(SCM_SVC_BOOT, SCM_DLOAD_CMD, dload_type, 0);
242 if (ret)
243 dprintf(CRITICAL, "Failed to write to boot misc: %d\n", ret);
244
245 ret = scm_call_atomic2(SCM_SVC_BOOT, WDOG_DEBUG_DISABLE, 1, 0);
246 if (ret)
247 dprintf(CRITICAL, "Failed to disable the wdog debug \n");
248
249 return ret;
250}
Matthew Qin6ba6ed12014-04-08 11:29:48 +0800251/* Configure PMIC and Drop PS_HOLD for shutdown */
252void shutdown_device()
253{
254 dprintf(CRITICAL, "Going down for shutdown.\n");
255
256 /* Configure PMIC for shutdown */
257 pm8x41_reset_configure(PON_PSHOLD_SHUTDOWN);
258
259 /* Drop PS_HOLD for MSM */
260 writel(0x00, MPM2_MPM_PS_HOLD);
261
262 mdelay(5000);
263
264 dprintf(CRITICAL, "shutdown failed\n");
265
266 ASSERT(0);
267}
268
Aparna Mallavarapu7cc5a792014-02-27 21:49:59 -0800269void reboot_device(unsigned reboot_reason)
270{
Aparna Mallavarapuacb6ede2014-03-21 19:22:00 +0530271 uint8_t reset_type = 0;
272 uint32_t ret = 0;
273
274 /* Need to clear the SW_RESET_ENTRY register and
275 * write to the BOOT_MISC_REG for known reset cases
276 */
277 if(reboot_reason != DLOAD)
278 scm_dload_mode(NORMAL_MODE);
279
Aparna Mallavarapu7cc5a792014-02-27 21:49:59 -0800280 writel(reboot_reason, RESTART_REASON_ADDR);
281
Aparna Mallavarapuacb6ede2014-03-21 19:22:00 +0530282 /* For Reboot-bootloader and Dload cases do a warm reset
283 * For Reboot cases do a hard reset
284 */
285 if((reboot_reason == FASTBOOT_MODE) || (reboot_reason == DLOAD))
286 reset_type = PON_PSHOLD_WARM_RESET;
287 else
288 reset_type = PON_PSHOLD_HARD_RESET;
289
290 pm8x41_reset_configure(reset_type);
291
292 ret = scm_halt_pmic_arbiter();
293 if (ret)
294 dprintf(CRITICAL , "Failed to halt pmic arbiter: %d\n", ret);
Aparna Mallavarapu7cc5a792014-02-27 21:49:59 -0800295
296 /* Drop PS_HOLD for MSM */
297 writel(0x00, MPM2_MPM_PS_HOLD);
298
299 mdelay(5000);
300
301 dprintf(CRITICAL, "Rebooting failed\n");
302}
303
304/* Detect the target type */
305void target_detect(struct board_data *board)
306{
307 /*
308 * already fill the board->target on board.c
309 */
310}
311
312void target_baseband_detect(struct board_data *board)
313{
314 uint32_t platform;
315
316 platform = board->platform;
317 switch(platform)
318 {
319 case MSM8916:
Aparna Mallavarapud81c99e2014-04-20 23:32:51 +0530320 case MSM8939:
321 case MSM8236:
322 case MSM8636:
Aparna Mallavarapu7cc5a792014-02-27 21:49:59 -0800323 board->baseband = BASEBAND_MSM;
324 break;
Aparna Mallavarapud81c99e2014-04-20 23:32:51 +0530325 case APQ8039:
326 case APQ8036:
327 board->baseband = BASEBAND_APQ;
328 break;
Aparna Mallavarapu7cc5a792014-02-27 21:49:59 -0800329 default:
330 dprintf(CRITICAL, "Platform type: %u is not supported\n", platform);
331 ASSERT(0);
332 };
333}
334
335unsigned target_baseband()
336{
337 return board_baseband();
338}
339
340int emmc_recovery_init(void)
341{
342 return _emmc_recovery_init();
343}
344
345static void set_sdc_power_ctrl()
346{
347 /* Drive strength configs for sdc pins */
348 struct tlmm_cfgs sdc1_hdrv_cfg[] =
349 {
350 { SDC1_CLK_HDRV_CTL_OFF, TLMM_CUR_VAL_16MA, TLMM_HDRV_MASK },
351 { SDC1_CMD_HDRV_CTL_OFF, TLMM_CUR_VAL_10MA, TLMM_HDRV_MASK },
352 { SDC1_DATA_HDRV_CTL_OFF, TLMM_CUR_VAL_6MA, TLMM_HDRV_MASK },
353 };
354
355 /* Pull configs for sdc pins */
356 struct tlmm_cfgs sdc1_pull_cfg[] =
357 {
358 { SDC1_CLK_PULL_CTL_OFF, TLMM_NO_PULL, TLMM_PULL_MASK },
359 { SDC1_CMD_PULL_CTL_OFF, TLMM_PULL_UP, TLMM_PULL_MASK },
360 { SDC1_DATA_PULL_CTL_OFF, TLMM_PULL_UP, TLMM_PULL_MASK },
361 };
362
363 /* Set the drive strength & pull control values */
364 tlmm_set_hdrive_ctrl(sdc1_hdrv_cfg, ARRAY_SIZE(sdc1_hdrv_cfg));
365 tlmm_set_pull_ctrl(sdc1_pull_cfg, ARRAY_SIZE(sdc1_pull_cfg));
366}
367
368void target_usb_init(void)
369{
370 uint32_t val;
371
372 /* Select and enable external configuration with USB PHY */
373 ulpi_write(ULPI_MISC_A_VBUSVLDEXTSEL | ULPI_MISC_A_VBUSVLDEXT, ULPI_MISC_A_SET);
374
375 /* Enable sess_vld */
376 val = readl(USB_GENCONFIG_2) | GEN2_SESS_VLD_CTRL_EN;
377 writel(val, USB_GENCONFIG_2);
378
379 /* Enable external vbus configuration in the LINK */
380 val = readl(USB_USBCMD);
381 val |= SESS_VLD_CTRL;
382 writel(val, USB_USBCMD);
383}
384
Padmanabhan Komanduru1869a762014-04-01 20:12:05 +0530385uint8_t target_panel_auto_detect_enabled()
386{
387 uint8_t ret = 0;
388 uint32_t hw_subtype = board_hardware_subtype();
389
390 switch(board_hardware_id()) {
391 case HW_PLATFORM_SURF:
392 ret = 1;
393 break;
394 default:
395 ret = 0;
396 break;
397 }
398 return ret;
399}
400
401static uint8_t splash_override;
Padmanabhan Komandurucd5645e2014-03-25 20:34:18 +0530402/* Returns 1 if target supports continuous splash screen. */
403int target_cont_splash_screen()
404{
405 uint8_t splash_screen = 0;
Padmanabhan Komanduru1869a762014-04-01 20:12:05 +0530406 if (!splash_override) {
407 switch (board_hardware_id()) {
Padmanabhan Komandurucd5645e2014-03-25 20:34:18 +0530408 case HW_PLATFORM_MTP:
409 case HW_PLATFORM_SURF:
Mao Flynn81409472014-04-10 15:01:30 +0800410 case HW_PLATFORM_QRD:
Padmanabhan Komandurucd5645e2014-03-25 20:34:18 +0530411 splash_screen = 1;
412 break;
413 default:
Padmanabhan Komandurucd5645e2014-03-25 20:34:18 +0530414 splash_screen = 0;
415 break;
Padmanabhan Komanduru1869a762014-04-01 20:12:05 +0530416 }
417 dprintf(SPEW, "Target_cont_splash=%d\n", splash_screen);
Padmanabhan Komandurucd5645e2014-03-25 20:34:18 +0530418 }
Padmanabhan Komanduru1869a762014-04-01 20:12:05 +0530419 return splash_screen;
420}
421
422void target_force_cont_splash_disable(uint8_t override)
423{
424 splash_override = override;
Padmanabhan Komandurucd5645e2014-03-25 20:34:18 +0530425}
426
Zhenhua Huang9b8cb1c2014-04-11 15:23:05 +0800427unsigned target_pause_for_battery_charge(void)
428{
429 uint8_t pon_reason = pm8x41_get_pon_reason();
430 uint8_t is_cold_boot = pm8x41_get_is_cold_boot();
431 dprintf(INFO, "%s : pon_reason is %d cold_boot:%d\n", __func__,
432 pon_reason, is_cold_boot);
433 /* In case of fastboot reboot,adb reboot or if we see the power key
434 * pressed we do not want go into charger mode.
435 * fastboot reboot is warm boot with PON hard reset bit not set
436 * adb reboot is a cold boot with PON hard reset bit set
437 */
438 if (is_cold_boot &&
439 (!(pon_reason & HARD_RST)) &&
440 (!(pon_reason & KPDPWR_N)) &&
441 ((pon_reason & USB_CHG) || (pon_reason & DC_CHG)))
442 return 1;
443 else
444 return 0;
445}
446
Aparna Mallavarapu7cc5a792014-02-27 21:49:59 -0800447void target_usb_stop(void)
448{
449 /* Disable VBUS mimicing in the controller. */
450 ulpi_write(ULPI_MISC_A_VBUSVLDEXTSEL | ULPI_MISC_A_VBUSVLDEXT, ULPI_MISC_A_CLEAR);
451}
452
453
454void target_uninit(void)
455{
Matthew Qin7f5ab932014-04-08 15:25:54 +0800456#if PON_VIB_SUPPORT
457 /* wait for the vibrator timer is expried */
458 wait_vib_timeout();
459#endif
460
Aparna Mallavarapu7cc5a792014-02-27 21:49:59 -0800461 mmc_put_card_to_sleep(dev);
462 sdhci_mode_disable(&dev->host);
Aparna Mallavarapu7c8e75f2014-04-22 20:20:28 +0530463
Aparna Mallavarapu7c8e75f2014-04-22 20:20:28 +0530464 if (crypto_initialized())
465 crypto_eng_cleanup();
Aparna Mallavarapu25aff012014-05-08 12:21:44 +0530466
467 if (target_is_ssd_enabled())
468 clock_ce_disable(CE1_INSTANCE);
Aparna Mallavarapu7cc5a792014-02-27 21:49:59 -0800469}
470
471/* Do any target specific intialization needed before entering fastboot mode */
472void target_fastboot_init(void)
473{
474 /* Set the BOOT_DONE flag in PM8916 */
475 pm8x41_set_boot_done();
Aparna Mallavarapu7c8e75f2014-04-22 20:20:28 +0530476
477 if (target_is_ssd_enabled()) {
478 clock_ce_enable(CE1_INSTANCE);
479 target_load_ssd_keystore();
480 }
Aparna Mallavarapufe1f3d12013-10-19 15:05:30 +0530481}
Aparna Mallavarapuacb6ede2014-03-21 19:22:00 +0530482
483int set_download_mode(enum dload_mode mode)
484{
485 int ret = 0;
486 ret = scm_dload_mode(mode);
487
488 pm8x41_clear_pmic_watchdog();
489
490 return ret;
491}
Aparna Mallavarapu7c8e75f2014-04-22 20:20:28 +0530492
493void target_load_ssd_keystore(void)
494{
495 uint64_t ptn;
496 int index;
497 uint64_t size;
498 uint32_t *buffer = NULL;
499
500 if (!target_is_ssd_enabled())
501 return;
502
503 index = partition_get_index("ssd");
504
505 ptn = partition_get_offset(index);
506 if (ptn == 0){
507 dprintf(CRITICAL, "Error: ssd partition not found\n");
508 return;
509 }
510
511 size = partition_get_size(index);
512 if (size == 0) {
513 dprintf(CRITICAL, "Error: invalid ssd partition size\n");
514 return;
515 }
516
517 buffer = memalign(CACHE_LINE, ROUNDUP(size, CACHE_LINE));
518 if (!buffer) {
519 dprintf(CRITICAL, "Error: allocating memory for ssd buffer\n");
520 return;
521 }
522
523 if (mmc_read(ptn, buffer, size)) {
524 dprintf(CRITICAL, "Error: cannot read data\n");
525 free(buffer);
526 return;
527 }
528
529 clock_ce_enable(CE1_INSTANCE);
530 scm_protect_keystore(buffer, size);
531 clock_ce_disable(CE1_INSTANCE);
532 free(buffer);
533}
534
535crypto_engine_type board_ce_type(void)
536{
537 return CRYPTO_ENGINE_TYPE_HW;
538}
539
540/* Set up params for h/w CE. */
541void target_crypto_init_params()
542{
543 struct crypto_init_params ce_params;
544
545 /* Set up base addresses and instance. */
546 ce_params.crypto_instance = CE1_INSTANCE;
547 ce_params.crypto_base = MSM_CE1_BASE;
548 ce_params.bam_base = MSM_CE1_BAM_BASE;
549
550 /* Set up BAM config. */
551 ce_params.bam_ee = CE_EE;
552 ce_params.pipes.read_pipe = CE_READ_PIPE;
553 ce_params.pipes.write_pipe = CE_WRITE_PIPE;
554 ce_params.pipes.read_pipe_grp = CE_READ_PIPE_LOCK_GRP;
555 ce_params.pipes.write_pipe_grp = CE_WRITE_PIPE_LOCK_GRP;
556
557 /* Assign buffer sizes. */
558 ce_params.num_ce = CE_ARRAY_SIZE;
559 ce_params.read_fifo_size = CE_FIFO_SIZE;
560 ce_params.write_fifo_size = CE_FIFO_SIZE;
561
562 /* BAM is initialized by TZ for this platform.
563 * Do not do it again as the initialization address space
564 * is locked.
565 */
566 ce_params.do_bam_init = 0;
567
568 crypto_init_params(&ce_params);
569}
Aparna Mallavarapua1158242014-05-23 14:47:44 +0530570
571uint32_t target_get_hlos_subtype()
572{
573 return board_hlos_subtype();
574}