| 1 |
|
| 2 |
|
| 3 |
#include <device/mmio.h> |
| 4 |
#include <delay.h> |
| 5 |
#include <soc/addressmap.h> |
| 6 |
#include <soc/clk_rst.h> |
| 7 |
#include <soc/clock.h> |
| 8 |
#include <soc/nvidia/tegra/i2c.h> |
| 9 |
#include <soc/padconfig.h> |
| 10 |
#include <soc/power.h> |
| 11 |
|
| 12 |
#define I2C6_PADCTL 0xC001 |
| 13 |
#define DPAUX_HYBRID_PADCTL 0x545C0124 |
| 14 |
#define DPAUX_HYBRID_SPARE 0x545C0134 |
| 15 |
|
| 16 |
static void enable_sor_periph_clocks(void) |
| 17 |
{ |
| 18 |
clock_enable(CLK_L_HOST1X, 0, 0, 0, 0, CLK_X_DPAUX, 0); |
| 19 |
|
| 20 |
|
| 21 |
udelay(IO_STABILIZATION_DELAY); |
| 22 |
} |
| 23 |
|
| 24 |
static void disable_sor_periph_clocks(void) |
| 25 |
{ |
| 26 |
clock_disable(CLK_L_HOST1X, 0, 0, 0, 0, CLK_X_DPAUX, 0); |
| 27 |
|
| 28 |
|
| 29 |
udelay(IO_STABILIZATION_DELAY); |
| 30 |
} |
| 31 |
|
| 32 |
static void unreset_sor_periphs(void) |
| 33 |
{ |
| 34 |
clock_clr_reset(CLK_L_HOST1X, 0, 0, 0, 0, CLK_X_DPAUX, 0); |
| 35 |
} |
| 36 |
|
| 37 |
void soc_configure_i2c6pad(void) |
| 38 |
{ |
| 39 |
|
| 40 |
|
| 41 |
|
| 42 |
|
| 43 |
|
| 44 |
|
| 45 |
|
| 46 |
|
| 47 |
|
| 48 |
|
| 49 |
soc_configure_host1x(); |
| 50 |
|
| 51 |
|
| 52 |
clock_enable_y(CLK_Y_DPAUX1 | CLK_Y_SOR_SAFE); |
| 53 |
|
| 54 |
|
| 55 |
write32((void *)DPAUX_HYBRID_PADCTL, I2C6_PADCTL); |
| 56 |
|
| 57 |
write32((void *)DPAUX_HYBRID_SPARE, 0); |
| 58 |
|
| 59 |
|
| 60 |
|
| 61 |
|
| 62 |
|
| 63 |
|
| 64 |
udelay(CLOCK_PLL_STABLE_DELAY_US); |
| 65 |
|
| 66 |
|
| 67 |
disable_sor_periph_clocks(); |
| 68 |
clock_set_reset_l(CLK_L_HOST1X); |
| 69 |
} |
| 70 |
|
| 71 |
void soc_configure_host1x(void) |
| 72 |
{ |
| 73 |
power_ungate_partition(POWER_PARTID_SOR); |
| 74 |
|
| 75 |
|
| 76 |
clock_configure_source(host1x, PLLP, 204000); |
| 77 |
|
| 78 |
enable_sor_periph_clocks(); |
| 79 |
remove_clamps(POWER_PARTID_SOR); |
| 80 |
unreset_sor_periphs(); |
| 81 |
} |