| /* |
| * Copyright (c) 2018 MediaTek Inc. |
| * |
| * Permission is hereby granted, free of charge, to any person obtaining |
| * a copy of this software and associated documentation files |
| * (the "Software"), to deal in the Software without restriction, |
| * including without limitation the rights to use, copy, modify, merge, |
| * publish, distribute, sublicense, and/or sell copies of the Software, |
| * and to permit persons to whom the Software is furnished to do so, |
| * subject to the following conditions: |
| * |
| * The above copyright notice and this permission notice shall be |
| * included in all copies or substantial portions of the Software. |
| * |
| * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
| * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
| * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
| * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY |
| * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, |
| * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE |
| * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
| */ |
| |
| #include <platform/mmc_core.h> |
| #include <platform/mt_reg_base.h> |
| #include <platform/mt_typedefs.h> |
| #include <platform/mt6358.h> |
| |
| struct mmc_card *card; |
| bool retry_opcond; |
| |
| static void stm_mcu_gpio_init(void) |
| { |
| /* set AD25(GPIO169) output-low */ |
| DRV_WriteReg32(GPIO_BASE + 0x450, DRV_Reg32(GPIO_BASE + 0x450) & (~ (7 << 4)));//set gpio169 gpio mode |
| DRV_WriteReg32(GPIO_BASE + 0x050, DRV_Reg32(GPIO_BASE + 0x050) | (1 << 9));//set gpio169 direction output |
| DRV_WriteReg32(GPIO_BASE + 0x150, DRV_Reg32(GPIO_BASE + 0x150) & (~ (1 << 9)));//set gpio169 output-low |
| |
| /* Set Y25(GPIO165) output-low */ |
| DRV_WriteReg32(GPIO_BASE + 0x440, DRV_Reg32(GPIO_BASE + 0x440) & (~(7 << 20)));//set gpio165 gpio mode |
| DRV_WriteReg32(GPIO_BASE + 0x050, DRV_Reg32(GPIO_BASE + 0x050) | (1 << 5));//set gpio165 direction output |
| DRV_WriteReg32(GPIO_BASE + 0x150, DRV_Reg32(GPIO_BASE + 0x150) & (~(1 << 5)));//set gpio165 output-high |
| } |
| |
| void target_early_init(void) |
| { |
| /* enable VCN33_bt */ |
| pmic_config_interface(0x1D1C, 0x1, 0x3, 0); |
| |
| stm_mcu_gpio_init(); |
| #if 0 |
| card = emmc_init_stage1(&retry_opcond); |
| #endif |
| } |
| |
| void target_init(void) |
| { |
| #if 0 |
| if (card) { |
| emmc_init_stage2(card, retry_opcond); |
| } |
| #endif |
| } |