coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
i2c6.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-only */
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  /* Give clocks time to stabilize. */
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  /* Give clocks time to stabilize. */
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 
38 {
39  /*
40  * I2C6 on Tegra1xx requires some special init.
41  * The SOR block must be unpowergated, and a couple of
42  * display-based peripherals must be clocked and taken
43  * out of reset so that a DPAUX register can be
44  * configured to enable the I2C6 mux routing.
45  * Afterwards, we can disable clocks to the display blocks
46  * and put Host1X back in reset. DPAUX must remain out of
47  * reset and the SOR partition must remained unpowergated.
48  */
50 
51  /* enable SOR_SAFE and DPAUX_1 clocks */
53 
54  /* Now we can write the I2C6 mux in DPAUX */
56  /* Finally, power up the pads */
57  write32((void *)DPAUX_HYBRID_SPARE, 0);
58 
59  /*
60  * Delay before turning off Host1X/DPAUX clocks.
61  * This delay is needed to keep the sequence from
62  * hanging the system.
63  */
65 
66  /* Stop Host1X/DPAUX clocks and reset Host1X */
69 }
70 
72 {
74 
75  /* Host1X needs a valid clock source so DPAUX can be accessed. */
76  clock_configure_source(host1x, PLLP, 204000);
77 
81 }
static void write32(void *addr, uint32_t val)
Definition: mmio.h:40
void soc_configure_host1x(void)
Definition: i2c6.c:71
static void disable_sor_periph_clocks(void)
Definition: i2c6.c:24
#define DPAUX_HYBRID_SPARE
Definition: i2c6.c:14
#define DPAUX_HYBRID_PADCTL
Definition: i2c6.c:13
void soc_configure_i2c6pad(void)
Definition: i2c6.c:37
static void enable_sor_periph_clocks(void)
Definition: i2c6.c:16
#define I2C6_PADCTL
Definition: i2c6.c:12
static void unreset_sor_periphs(void)
Definition: i2c6.c:32
static void power_ungate_partition(uint32_t id)
Definition: power.c:24
@ POWER_PARTID_SOR
Definition: pmc.h:24
void remove_clamps(int id)
Definition: power.c:100
@ CLK_X_DPAUX
Definition: clock.h:149
@ CLK_L_HOST1X
Definition: clock.h:38
#define IO_STABILIZATION_DELAY
Definition: clock.h:165
#define clock_configure_source(device, src, freq)
Definition: clock.h:229
#define CLOCK_PLL_STABLE_DELAY_US
Definition: clock.h:163
@ PLLP
Definition: clock.h:245
#define clock_disable(l, h, u, v, w, x, y)
Definition: clock.h:339
#define clock_enable(l, h, u, v, w, x, y)
Definition: clock.h:333
#define clock_set_reset_l(l)
Definition: clock.h:373
#define clock_enable_y(y)
Definition: clock.h:363
@ CLK_Y_SOR_SAFE
Definition: clock.h:147
@ CLK_Y_DPAUX1
Definition: clock.h:145
#define clock_clr_reset(l, h, u, v, w, x, y)
Definition: clock.h:351
void udelay(uint32_t us)
Definition: udelay.c:15