blob: 62782a901037fa395e9c3d6c88fda0f6def55449 [file] [log] [blame]
Deepa Dinamani645e9b12012-12-21 14:23:40 -08001/* Copyright (c) 2012-2013, 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>
Channagoud Kadabif6f71742013-05-23 14:05:05 -070031#include <platform/irqs.h>
Deepa Dinamani645e9b12012-12-21 14:23:40 -080032#include <reg.h>
33#include <target.h>
34#include <platform.h>
Pavel Nedev16f49232013-04-29 16:15:36 +030035#include <dload_util.h>
Deepa Dinamani645e9b12012-12-21 14:23:40 -080036#include <uart_dm.h>
Channagoud Kadabi3c50c312013-05-02 17:16:03 -070037#include <mmc_sdhci.h>
Stanimir Varbanovf0650ca2013-07-01 12:30:24 +030038#include <platform/clock.h>
Deepa Dinamani7e729772013-02-25 11:54:05 -080039#include <platform/gpio.h>
Deepa Dinamani645e9b12012-12-21 14:23:40 -080040#include <spmi.h>
41#include <board.h>
Deepa Dinamaniff2b9ce2013-02-25 11:01:00 -080042#include <smem.h>
43#include <baseband.h>
Deepa Dinamani7e729772013-02-25 11:54:05 -080044#include <dev/keys.h>
Deepa Dinamani058f1cd2013-02-25 10:53:01 -080045#include <pm8x41.h>
Deepa Dinamani6bb87d52013-02-26 14:37:36 -080046#include <crypto5_wrapper.h>
Amol Jadi85e19192013-02-28 22:45:04 -080047#include <hsusb.h>
Stanimir Varbanovf0650ca2013-07-01 12:30:24 +030048#include <scm.h>
49#include <stdlib.h>
50#include <partition_parser.h>
Deepa Dinamani645e9b12012-12-21 14:23:40 -080051
Deepa Dinamani6bb87d52013-02-26 14:37:36 -080052extern bool target_use_signed_kernel(void);
Channagoud Kadabi3c50c312013-05-02 17:16:03 -070053static void set_sdc_power_ctrl(void);
Deepa Dinamani6bb87d52013-02-26 14:37:36 -080054
55#define PMIC_ARB_CHANNEL_NUM 0
56#define PMIC_ARB_OWNER_ID 0
57
58#define CRYPTO_ENGINE_INSTANCE 1
59#define CRYPTO_ENGINE_EE 1
60#define CRYPTO_ENGINE_FIFO_SIZE 64
61#define CRYPTO_ENGINE_READ_PIPE 3
62#define CRYPTO_ENGINE_WRITE_PIPE 2
Deepa Dinamanibbcf1ca2013-07-09 14:10:57 -070063#define CRYPTO_READ_PIPE_LOCK_GRP 0
64#define CRYPTO_WRITE_PIPE_LOCK_GRP 0
Deepa Dinamani6bb87d52013-02-26 14:37:36 -080065#define CRYPTO_ENGINE_CMD_ARRAY_SIZE 20
Deepa Dinamani645e9b12012-12-21 14:23:40 -080066
Deepa Dinamani7e729772013-02-25 11:54:05 -080067#define TLMM_VOL_UP_BTN_GPIO 106
68
Stanimir Varbanovf0650ca2013-07-01 12:30:24 +030069#define SSD_CE_INSTANCE 1
70
Maria Yub8fd0822013-06-26 10:10:45 +080071enum target_subtype {
72 HW_PLATFORM_SUBTYPE_SKUAA = 1,
73 HW_PLATFORM_SUBTYPE_SKUF = 2,
74 HW_PLATFORM_SUBTYPE_SKUAB = 3,
Jie Chengf3d8a3b2013-08-01 15:37:55 +080075 HW_PLATFORM_SUBTYPE_SKUG = 5,
Maria Yub8fd0822013-06-26 10:10:45 +080076};
77
Channagoud Kadabif6f71742013-05-23 14:05:05 -070078static uint32_t mmc_pwrctl_base[] =
79 { MSM_SDC1_BASE, MSM_SDC2_BASE, MSM_SDC3_BASE };
80
Channagoud Kadabi3c50c312013-05-02 17:16:03 -070081static uint32_t mmc_sdhci_base[] =
82 { MSM_SDC1_SDHCI_BASE, MSM_SDC2_SDHCI_BASE, MSM_SDC3_SDHCI_BASE };
83
Channagoud Kadabif6f71742013-05-23 14:05:05 -070084static uint32_t mmc_sdc_pwrctl_irq[] =
85 { SDCC1_PWRCTL_IRQ, SDCC2_PWRCTL_IRQ, SDCC3_PWRCTL_IRQ };
86
Channagoud Kadabi3c50c312013-05-02 17:16:03 -070087struct mmc_device *dev;
Deepa Dinamani645e9b12012-12-21 14:23:40 -080088
Stanimir Varbanovf0650ca2013-07-01 12:30:24 +030089void target_load_ssd_keystore(void)
90{
91 uint64_t ptn;
92 int index;
93 uint64_t size;
94 uint32_t *buffer;
95
96 if (!target_is_ssd_enabled())
97 return;
98
99 index = partition_get_index("ssd");
100
101 ptn = partition_get_offset(index);
102 if (ptn == 0){
103 dprintf(CRITICAL, "Error: ssd partition not found\n");
104 return;
105 }
106
107 size = partition_get_size(index);
108 if (size == 0) {
109 dprintf(CRITICAL, "Error: invalid ssd partition size\n");
110 return;
111 }
112
113 buffer = memalign(CACHE_LINE, ROUNDUP(size, CACHE_LINE));
114 if (!buffer) {
115 dprintf(CRITICAL, "Error: allocating memory for ssd buffer\n");
116 return;
117 }
118
119 if (mmc_read(ptn, buffer, size)) {
120 dprintf(CRITICAL, "Error: cannot read data\n");
121 free(buffer);
122 return;
123 }
124
125 clock_ce_enable(SSD_CE_INSTANCE);
126 scm_protect_keystore(buffer, size);
127 clock_ce_disable(SSD_CE_INSTANCE);
128 free(buffer);
129}
130
Deepa Dinamani645e9b12012-12-21 14:23:40 -0800131void target_early_init(void)
132{
133#if WITH_DEBUG_UART
Deepa Dinamani0a6c48c2013-02-04 15:45:01 -0800134 uart_dm_init(1, 0, BLSP1_UART2_BASE);
Deepa Dinamani645e9b12012-12-21 14:23:40 -0800135#endif
136}
137
Deepa Dinamani7e729772013-02-25 11:54:05 -0800138/* Return 1 if vol_up pressed */
139static int target_volume_up()
140{
141 uint8_t status = 0;
142
143 gpio_tlmm_config(TLMM_VOL_UP_BTN_GPIO, 0, GPIO_INPUT, GPIO_PULL_UP, GPIO_2MA, GPIO_ENABLE);
144
aiquny933017c2013-03-02 12:48:52 -0800145 thread_sleep(10);
146
Deepa Dinamani7e729772013-02-25 11:54:05 -0800147 /* Get status of GPIO */
148 status = gpio_status(TLMM_VOL_UP_BTN_GPIO);
149
150 /* Active low signal. */
151 return !status;
152}
153
154/* Return 1 if vol_down pressed */
155uint32_t target_volume_down()
156{
157 /* Volume down button tied in with PMIC RESIN. */
158 return pm8x41_resin_status();
159}
160
Deepa Dinamani645e9b12012-12-21 14:23:40 -0800161static void target_keystatus()
162{
Deepa Dinamani7e729772013-02-25 11:54:05 -0800163 keys_init();
164
165 if(target_volume_down())
166 keys_post_event(KEY_VOLUMEDOWN, 1);
167
168 if(target_volume_up())
169 keys_post_event(KEY_VOLUMEUP, 1);
Deepa Dinamani645e9b12012-12-21 14:23:40 -0800170}
171
Deepa Dinamani6bb87d52013-02-26 14:37:36 -0800172/* Set up params for h/w CRYPTO_ENGINE. */
173void target_crypto_init_params()
174{
175 struct crypto_init_params ce_params;
176
177 /* Set up base addresses and instance. */
178 ce_params.crypto_instance = CRYPTO_ENGINE_INSTANCE;
179 ce_params.crypto_base = MSM_CE1_BASE;
180 ce_params.bam_base = MSM_CE1_BAM_BASE;
181
182 /* Set up BAM config. */
Deepa Dinamanibbcf1ca2013-07-09 14:10:57 -0700183 ce_params.bam_ee = CRYPTO_ENGINE_EE;
184 ce_params.pipes.read_pipe = CRYPTO_ENGINE_READ_PIPE;
185 ce_params.pipes.write_pipe = CRYPTO_ENGINE_WRITE_PIPE;
186 ce_params.pipes.read_pipe_grp = CRYPTO_READ_PIPE_LOCK_GRP;
187 ce_params.pipes.write_pipe_grp = CRYPTO_WRITE_PIPE_LOCK_GRP;
Deepa Dinamani6bb87d52013-02-26 14:37:36 -0800188
189 /* Assign buffer sizes. */
190 ce_params.num_ce = CRYPTO_ENGINE_CMD_ARRAY_SIZE;
191 ce_params.read_fifo_size = CRYPTO_ENGINE_FIFO_SIZE;
192 ce_params.write_fifo_size = CRYPTO_ENGINE_FIFO_SIZE;
193
Stanimir Varbanovf0650ca2013-07-01 12:30:24 +0300194 ce_params.do_bam_init = 0;
195
Deepa Dinamani6bb87d52013-02-26 14:37:36 -0800196 crypto_init_params(&ce_params);
197}
198
Channagoud Kadabi3c50c312013-05-02 17:16:03 -0700199void target_sdc_init()
200{
Channagoud Kadabif6f71742013-05-23 14:05:05 -0700201 struct mmc_config_data config = {0};
Channagoud Kadabi3c50c312013-05-02 17:16:03 -0700202
203 /*
204 * Set drive strength & pull ctrl for emmc
205 */
206 set_sdc_power_ctrl();
207
Channagoud Kadabi3c50c312013-05-02 17:16:03 -0700208 config.bus_width = DATA_BUS_WIDTH_8BIT;
209 config.max_clk_rate = MMC_CLK_200MHZ;
210
211 /* Trying Slot 1*/
212 config.slot = 1;
Channagoud Kadabif6f71742013-05-23 14:05:05 -0700213 config.sdhc_base = mmc_sdhci_base[config.slot - 1];
214 config.pwrctl_base = mmc_pwrctl_base[config.slot - 1];
215 config.pwr_irq = mmc_sdc_pwrctl_irq[config.slot - 1];
216
Channagoud Kadabi3c50c312013-05-02 17:16:03 -0700217 if (!(dev = mmc_init(&config)))
218 {
219 /* Trying Slot 2 next */
220 config.slot = 2;
Channagoud Kadabif6f71742013-05-23 14:05:05 -0700221 config.sdhc_base = mmc_sdhci_base[config.slot - 1];
222 config.pwrctl_base = mmc_pwrctl_base[config.slot - 1];
223 config.pwr_irq = mmc_sdc_pwrctl_irq[config.slot - 1];
224
Channagoud Kadabi3c50c312013-05-02 17:16:03 -0700225 if (!(dev = mmc_init(&config))) {
226 dprintf(CRITICAL, "mmc init failed!");
227 ASSERT(0);
228 }
229 }
230
231 /*
232 * MMC initialization is complete, read the partition table info
233 */
234 if (partition_read_table()) {
235 dprintf(CRITICAL, "Error reading the partition table info\n");
236 ASSERT(0);
237 }
238}
239
Deepa Dinamani645e9b12012-12-21 14:23:40 -0800240void target_init(void)
241{
Deepa Dinamani645e9b12012-12-21 14:23:40 -0800242 dprintf(INFO, "target_init()\n");
243
244 spmi_init(PMIC_ARB_CHANNEL_NUM, PMIC_ARB_OWNER_ID);
245
246 target_keystatus();
247
Aparna Mallavarapu63a62252013-08-23 17:59:43 +0530248 target_sdc_init();
249
Ray Zhang743e5032013-05-25 23:25:39 +0800250 /* Display splash screen if enabled */
251#if DISPLAY_SPLASH_SCREEN
252 dprintf(SPEW, "Display Init: Start\n");
253 display_init();
254 dprintf(SPEW, "Display Init: Done\n");
255#endif
256
Deepa Dinamani6bb87d52013-02-26 14:37:36 -0800257 if (target_use_signed_kernel())
258 target_crypto_init_params();
Deepa Dinamani645e9b12012-12-21 14:23:40 -0800259}
260
Deepa Dinamani058f1cd2013-02-25 10:53:01 -0800261/* Do any target specific intialization needed before entering fastboot mode */
262void target_fastboot_init(void)
263{
264 /* Set the BOOT_DONE flag in PM8026 */
265 pm8x41_set_boot_done();
Stanimir Varbanovf0650ca2013-07-01 12:30:24 +0300266
267 if (target_is_ssd_enabled()) {
268 clock_ce_enable(SSD_CE_INSTANCE);
269 target_load_ssd_keystore();
270 }
Deepa Dinamani058f1cd2013-02-25 10:53:01 -0800271}
272
Deepa Dinamaniff2b9ce2013-02-25 11:01:00 -0800273/* Detect the target type */
274void target_detect(struct board_data *board)
275{
Maria Yuca51ee22013-06-27 21:45:24 +0800276 /*
277 * already fill the board->target on board.c
278 */
Deepa Dinamaniff2b9ce2013-02-25 11:01:00 -0800279}
280
281/* Detect the modem type */
282void target_baseband_detect(struct board_data *board)
283{
284 uint32_t platform;
285 uint32_t platform_subtype;
286
287 platform = board->platform;
288 platform_subtype = board->platform_subtype;
289
290 /*
291 * Look for platform subtype if present, else
292 * check for platform type to decide on the
293 * baseband type
294 */
295 switch(platform_subtype)
296 {
297 case HW_PLATFORM_SUBTYPE_UNKNOWN:
298 break;
Maria Yub8fd0822013-06-26 10:10:45 +0800299 case HW_PLATFORM_SUBTYPE_SKUAA:
300 break;
301 case HW_PLATFORM_SUBTYPE_SKUF:
302 break;
303 case HW_PLATFORM_SUBTYPE_SKUAB:
304 break;
Jie Chengf3d8a3b2013-08-01 15:37:55 +0800305 case HW_PLATFORM_SUBTYPE_SKUG:
306 break;
Deepa Dinamaniff2b9ce2013-02-25 11:01:00 -0800307 default:
308 dprintf(CRITICAL, "Platform Subtype : %u is not supported\n", platform_subtype);
309 ASSERT(0);
310 };
311
312 switch(platform)
313 {
314 case MSM8826:
315 case MSM8626:
316 case MSM8226:
Deepa Dinamani7eeecf62013-05-21 12:43:26 -0700317 case MSM8926:
318 case MSM8126:
319 case MSM8326:
Deepa Dinamanicd795aa2013-09-05 16:30:53 -0700320 case MSM8528:
321 case MSM8628:
322 case MSM8228:
323 case MSM8928:
324 case MSM8128:
Deepa Dinamaniff2b9ce2013-02-25 11:01:00 -0800325 board->baseband = BASEBAND_MSM;
326 break;
Deepa Dinamani7eeecf62013-05-21 12:43:26 -0700327 case APQ8026:
Deepa Dinamanicd795aa2013-09-05 16:30:53 -0700328 case APQ8028:
Deepa Dinamani7eeecf62013-05-21 12:43:26 -0700329 board->baseband = BASEBAND_APQ;
330 break;
Deepa Dinamaniff2b9ce2013-02-25 11:01:00 -0800331 default:
332 dprintf(CRITICAL, "Platform type: %u is not supported\n", platform);
333 ASSERT(0);
334 };
335}
336
Deepa Dinamani645e9b12012-12-21 14:23:40 -0800337void target_serialno(unsigned char *buf)
338{
339 uint32_t serialno;
340 if (target_is_emmc_boot()) {
341 serialno = mmc_get_psn();
342 snprintf((char *)buf, 13, "%x", serialno);
343 }
344}
345
Deepa Dinamani8d2bb222013-02-26 14:03:04 -0800346unsigned check_reboot_mode(void)
347{
348 uint32_t restart_reason = 0;
349
350 /* Read reboot reason and scrub it */
351 restart_reason = readl(RESTART_REASON_ADDR);
352 writel(0x00, RESTART_REASON_ADDR);
353
354 return restart_reason;
355}
356
Deepa Dinamanif7c03c12013-02-26 14:17:20 -0800357void reboot_device(unsigned reboot_reason)
358{
359 writel(reboot_reason, RESTART_REASON_ADDR);
360
361 /* Configure PMIC for warm reset */
362 pm8x41_reset_configure(PON_PSHOLD_WARM_RESET);
363
364 /* Drop PS_HOLD for MSM */
365 writel(0x00, MPM2_MPM_PS_HOLD);
366
367 mdelay(5000);
368
369 dprintf(CRITICAL, "Rebooting failed\n");
370}
371
Deepa Dinamani6bb87d52013-02-26 14:37:36 -0800372crypto_engine_type board_ce_type(void)
373{
374 return CRYPTO_ENGINE_TYPE_HW;
375}
376
Deepa Dinamani645e9b12012-12-21 14:23:40 -0800377unsigned board_machtype(void)
378{
Deepa Dinamani8d6b4252013-03-06 11:16:41 -0800379 return 0;
380}
381
382void target_usb_stop(void)
383{
384 /* Disable VBUS mimicing in the controller. */
385 ulpi_write(ULPI_MISC_A_VBUSVLDEXTSEL | ULPI_MISC_A_VBUSVLDEXT, ULPI_MISC_A_CLEAR);
Deepa Dinamani645e9b12012-12-21 14:23:40 -0800386}
Amol Jadi85e19192013-02-28 22:45:04 -0800387
Channagoud Kadabie3a695a2013-06-18 18:35:00 -0700388void target_uninit(void)
389{
390 mmc_put_card_to_sleep(dev);
Stanimir Varbanovf0650ca2013-07-01 12:30:24 +0300391
392 if (target_is_ssd_enabled())
393 clock_ce_disable(SSD_CE_INSTANCE);
Channagoud Kadabib53d2d82013-12-04 12:38:27 -0800394
395 if (crypto_initialized())
396 crypto_eng_cleanup();
Channagoud Kadabie3a695a2013-06-18 18:35:00 -0700397}
398
Amol Jadi85e19192013-02-28 22:45:04 -0800399void target_usb_init(void)
400{
401 uint32_t val;
402
403 /* Select and enable external configuration with USB PHY */
404 ulpi_write(ULPI_MISC_A_VBUSVLDEXTSEL | ULPI_MISC_A_VBUSVLDEXT, ULPI_MISC_A_SET);
405
406 /* Enable sess_vld */
407 val = readl(USB_GENCONFIG_2) | GEN2_SESS_VLD_CTRL_EN;
408 writel(val, USB_GENCONFIG_2);
409
410 /* Enable external vbus configuration in the LINK */
411 val = readl(USB_USBCMD);
412 val |= SESS_VLD_CTRL;
413 writel(val, USB_USBCMD);
414}
Deepa Dinamanicde64572013-02-25 15:02:25 -0800415
Pradeep Jilagamfeb15982013-10-29 13:08:51 +0530416uint8_t target_panel_auto_detect_enabled()
417{
418 switch(board_hardware_id())
419 {
420 case HW_PLATFORM_QRD:
421 return 1;
422 case HW_PLATFORM_SURF:
423 case HW_PLATFORM_MTP:
424 default:
425 return 0;
426 }
427 return 0;
428}
429
430static uint8_t splash_override;
Ray Zhang743e5032013-05-25 23:25:39 +0800431/* Returns 1 if target supports continuous splash screen. */
432int target_cont_splash_screen()
433{
Pradeep Jilagamfeb15982013-10-29 13:08:51 +0530434 uint8_t splash_screen = 0;
435 if(!splash_override) {
436 switch(board_hardware_id())
437 {
438 case HW_PLATFORM_MTP:
439 case HW_PLATFORM_QRD:
440 case HW_PLATFORM_SURF:
441 dprintf(SPEW, "Target_cont_splash=1\n");
442 splash_screen = 1;
443 break;
444 default:
445 dprintf(SPEW, "Target_cont_splash=0\n");
446 splash_screen = 0;
447 }
448 }
449 return splash_screen;
450}
451
452void target_force_cont_splash_disable(uint8_t override)
453{
454 splash_override = override;
Ray Zhang743e5032013-05-25 23:25:39 +0800455}
456
Deepa Dinamanicde64572013-02-25 15:02:25 -0800457unsigned target_pause_for_battery_charge(void)
458{
459 uint8_t pon_reason = pm8x41_get_pon_reason();
Ameya Thakur06041312013-06-25 13:46:21 -0700460 uint8_t is_cold_boot = pm8x41_get_is_cold_boot();
Ameya Thakur531e59a2013-07-17 16:53:53 -0700461 dprintf(INFO, "%s : pon_reason is %d cold_boot:%d\n", __func__,
462 pon_reason, is_cold_boot);
Ameya Thakura8711dc2013-07-19 17:52:51 -0700463 /* In case of fastboot reboot,adb reboot or if we see the power key
464 * pressed we do not want go into charger mode.
Ameya Thakur531e59a2013-07-17 16:53:53 -0700465 * fastboot reboot is warm boot with PON hard reset bit not set
466 * adb reboot is a cold boot with PON hard reset bit set
467 */
Ameya Thakura8711dc2013-07-19 17:52:51 -0700468 if (is_cold_boot &&
469 (!(pon_reason & HARD_RST)) &&
470 (!(pon_reason & KPDPWR_N)) &&
Ameya Thakur531e59a2013-07-17 16:53:53 -0700471 ((pon_reason & USB_CHG) || (pon_reason & DC_CHG)))
472 return 1;
473 else
474 return 0;
Deepa Dinamanicde64572013-02-25 15:02:25 -0800475}
Channagoud Kadabida54ca12013-03-29 11:22:15 -0700476
477unsigned target_baseband()
478{
479 return board_baseband();
480}
Stanimir Varbanov7f9d7a72013-04-29 12:05:39 +0300481
482int emmc_recovery_init(void)
483{
Pavel Nedev16f49232013-04-29 16:15:36 +0300484 return _emmc_recovery_init();
485}
486
Pavel Nedeva4c9d3a2013-05-15 14:42:34 +0300487int set_download_mode(enum dload_mode mode)
Pavel Nedev16f49232013-04-29 16:15:36 +0300488{
Pavel Nedeva4c9d3a2013-05-15 14:42:34 +0300489 dload_util_write_cookie(mode == NORMAL_DLOAD ?
490 DLOAD_MODE_ADDR : EMERGENCY_DLOAD_MODE_ADDR, mode);
Pavel Nedev16f49232013-04-29 16:15:36 +0300491
Xiaocheng Li73c57122013-09-14 17:32:00 +0800492 pm8x41_clear_pmic_watchdog();
493
Pavel Nedev16f49232013-04-29 16:15:36 +0300494 return 0;
Stanimir Varbanov7f9d7a72013-04-29 12:05:39 +0300495}
Channagoud Kadabi3c50c312013-05-02 17:16:03 -0700496
497static void set_sdc_power_ctrl()
498{
499 /* Drive strength configs for sdc pins */
500 struct tlmm_cfgs sdc1_hdrv_cfg[] =
501 {
Channagoud Kadabi29d389d2013-10-28 14:55:02 -0700502 { SDC1_CLK_HDRV_CTL_OFF, TLMM_CUR_VAL_6MA, TLMM_HDRV_MASK },
503 { SDC1_CMD_HDRV_CTL_OFF, TLMM_CUR_VAL_6MA, TLMM_HDRV_MASK },
504 { SDC1_DATA_HDRV_CTL_OFF, TLMM_CUR_VAL_6MA, TLMM_HDRV_MASK },
Channagoud Kadabi3c50c312013-05-02 17:16:03 -0700505 };
506
507 /* Pull configs for sdc pins */
508 struct tlmm_cfgs sdc1_pull_cfg[] =
509 {
510 { SDC1_CLK_PULL_CTL_OFF, TLMM_NO_PULL, TLMM_PULL_MASK },
511 { SDC1_CMD_PULL_CTL_OFF, TLMM_PULL_UP, TLMM_PULL_MASK },
512 { SDC1_DATA_PULL_CTL_OFF, TLMM_PULL_UP, TLMM_PULL_MASK },
513 };
514
515 /* Set the drive strength & pull control values */
516 tlmm_set_hdrive_ctrl(sdc1_hdrv_cfg, ARRAY_SIZE(sdc1_hdrv_cfg));
517 tlmm_set_pull_ctrl(sdc1_pull_cfg, ARRAY_SIZE(sdc1_pull_cfg));
518}
519
Channagoud Kadabi504de062013-09-10 15:02:22 -0700520void *target_mmc_device()
Channagoud Kadabi3c50c312013-05-02 17:16:03 -0700521{
Channagoud Kadabi504de062013-09-10 15:02:22 -0700522 return (void *) dev;
Channagoud Kadabi3c50c312013-05-02 17:16:03 -0700523}