| 1 |
|
| 2 |
|
| 3 |
#include <device/mmio.h> |
| 4 |
#include <gpio.h> |
| 5 |
#include <soc/mipi.h> |
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
static void set_gpi_from_mipi(void) |
| 14 |
{ |
| 15 |
setbits32(&mt8173_mipi->mipi_rx_ana4c, |
| 16 |
1 << 0 | |
| 17 |
1 << 6 | |
| 18 |
1 << 12 | |
| 19 |
1 << 18 | |
| 20 |
1 << 24); |
| 21 |
|
| 22 |
setbits32(&mt8173_mipi->mipi_rx_ana50, |
| 23 |
1 << 0 | |
| 24 |
1 << 6 | |
| 25 |
1 << 12 | |
| 26 |
1 << 18 | |
| 27 |
1 << 24); |
| 28 |
} |
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
static void gpio_set_duty(enum external_power ext_power) |
| 35 |
{ |
| 36 |
|
| 37 |
if (ext_power == GPIO_EINT_1P8V) { |
| 38 |
|
| 39 |
write16(&mtk_gpio->exmd_ctrl[0].rst, 0x3F5); |
| 40 |
write16(&mtk_gpio->exmd_ctrl[0].set, 0xA); |
| 41 |
} else if (ext_power == GPIO_EINT_3P3V) { |
| 42 |
|
| 43 |
write16(&mtk_gpio->exmd_ctrl[0].rst, 0x335); |
| 44 |
write16(&mtk_gpio->exmd_ctrl[0].set, 0xCA); |
| 45 |
} |
| 46 |
|
| 47 |
|
| 48 |
|
| 49 |
write16(&mtk_gpio->msdc2_ctrl5.set, 0xA); |
| 50 |
write16(&mtk_gpio->msdc2_ctrl5.rst, 0x5); |
| 51 |
} |
| 52 |
|
| 53 |
void gpio_init(enum external_power ext_power) |
| 54 |
{ |
| 55 |
set_gpi_from_mipi(); |
| 56 |
gpio_set_duty(ext_power); |
| 57 |
} |