Skip to contentSkip to conversation

tegra: cros_ec: Add tegra support for Chrome OS EC

PATCH New Simon Glass 1 participant 15 messages Jun 5, 2015

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

PATCH v3 1/15 tegra: cros_ec: Add tegra support for Chrome OS EC

This requires a change to stdin to include the 'cros-ec-keyb' input device. Put this in the common file, enabled by the relevant CONFIG.

---

Changes in v3: None
Changes in v2: None

 include/configs/tegra-common-post.h | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
include/configs/tegra-common-post.h +7 -1
index 0cea795..48c1a7a 100644
@@ -40,8 +40,14 @@
 #define STDOUT_LCD ""
 #endif
 
+#ifdef CONFIG_CROS_EC_KEYB
+#define STDOUT_CROS_EC	",cros-ec-keyb"
+#else
+#define STDOUT_CROS_EC	""
+#endif
+
 #define TEGRA_DEVICE_SETTINGS \
-	"stdin=serial" STDIN_KBD_KBC STDIN_KBD_USB "\0" \
+	"stdin=serial" STDIN_KBD_KBC STDIN_KBD_USB STDOUT_CROS_EC "\0" \
 	"stdout=serial" STDOUT_LCD "\0" \
 	"stderr=serial" STDOUT_LCD "\0" \
 	""
Signature · 1 line
2.2.0.rc0.207.ga3a616c
#1 lore raw

PATCH v3 2/15 tegra: spi: Drop the claim_bus() method to correct delays

At present the driver does not properly honour the requested SPI CS deactivation delay since the SPI bus is changed in the claim_bus() method.

Everything the claim_bus() method does can be done when the device is probed (setting the speed and mode) and at the start of a new transfer (where the fifo_status is already cleared). So drop this method.

Also, until the delay is complete, we should not touch the bus, so make sure that spi_cs_activate() is called before other things are done in the xfer() method.

---

Changes in v3: None
Changes in v2: None

 drivers/spi/tegra114_spi.c | 26 +++++++++-----------------
 1 file changed, 9 insertions(+), 17 deletions(-)
drivers/spi/tegra114_spi.c +9 -17
index 4bec663..0d69376 100644
@@ -143,24 +143,18 @@ static int tegra114_spi_probe(struct udevice *bus)
 {
 	struct tegra_spi_platdata *plat = dev_get_platdata(bus);
 	struct tegra114_spi_priv *priv = dev_get_priv(bus);
+	struct spi_regs *regs;
 
 	priv->regs = (struct spi_regs *)plat->base;
+	regs = priv->regs;
 
 	priv->last_transaction_us = timer_get_us();
 	priv->freq = plat->frequency;
 	priv->periph_id = plat->periph_id;
 
-	return 0;
-}
-
-static int tegra114_spi_claim_bus(struct udevice *dev)
-{
-	struct udevice *bus = dev->parent;
-	struct tegra114_spi_priv *priv = dev_get_priv(bus);
-	struct spi_regs *regs = priv->regs;
-
 	/* Change SPI clock to correct frequency, PLLP_OUT0 source */
-	clock_start_periph_pll(priv->periph_id, CLOCK_ID_PERIPH, priv->freq);
+	clock_start_periph_pll(priv->periph_id, CLOCK_ID_PERIPH,
+			       priv->freq);
 
 	/* Clear stale status here */
 	setbits_le32(&regs->fifo_status,
@@ -175,9 +169,8 @@ static int tegra114_spi_claim_bus(struct udevice *dev)
 		     SPI_FIFO_STS_RX_FIFO_EMPTY);
 	debug("%s: FIFO STATUS = %08x\n", __func__, readl(&regs->fifo_status));
 
-	/* Set master mode and sw controlled CS */
-	setbits_le32(&regs->command1, SPI_CMD1_M_S | SPI_CMD1_CS_SW_HW |
-		     (priv->mode << SPI_CMD1_MODE_SHIFT));
+	setbits_le32(&priv->regs->command1, SPI_CMD1_M_S | SPI_CMD1_CS_SW_HW |
+		     (priv->mode << SPI_CMD1_MODE_SHIFT) | SPI_CMD1_CS_SW_VAL);
 	debug("%s: COMMAND1 = %08x\n", __func__, readl(&regs->command1));
 
 	return 0;
@@ -249,6 +242,9 @@ static int tegra114_spi_xfer(struct udevice *dev, unsigned int bitlen,
 
 	ret = 0;
 
+	if (flags & SPI_XFER_BEGIN)
+		spi_cs_activate(dev);
+
 	/* clear all error status bits */
 	reg = readl(&regs->fifo_status);
 	writel(reg, &regs->fifo_status);
@@ -260,9 +256,6 @@ static int tegra114_spi_xfer(struct udevice *dev, unsigned int bitlen,
 	/* set xfer size to 1 block (32 bits) */
 	writel(0, &regs->dma_blk);
 
-	if (flags & SPI_XFER_BEGIN)
-		spi_cs_activate(dev);
-
 	/* handle data in 32-bit chunks */
 	while (num_bytes > 0) {
 		int bytes;
@@ -385,7 +378,6 @@ static int tegra114_spi_set_mode(struct udevice *bus, uint mode)
 }
 
 static const struct dm_spi_ops tegra114_spi_ops = {
-	.claim_bus	= tegra114_spi_claim_bus,
 	.xfer		= tegra114_spi_xfer,
 	.set_speed	= tegra114_spi_set_speed,
 	.set_mode	= tegra114_spi_set_mode,
Signature · 1 line
2.2.0.rc0.207.ga3a616c
#2 lore raw

PATCH v3 3/15 dm: tegra: cros_ec: Enable Chrome OS EC on Nyan-big

In reply to Simon Glass

Enable the EC and keyboard, using the SPI bus.

The EC driver requires a particular format and a deactivation delay. Also U-Boot does not support interrupts.

For now, adjust the device tree to comply. At some point we should tidy this up to support interrupts and make tegra and exynos use the same setup.

---

Changes in v3: None
Changes in v2:
- Use spi-max-frequency in both the bus and slave nodes

 arch/arm/dts/tegra124-nyan-big.dts | 3 +++
 configs/nyan-big_defconfig         | 5 +++++
 include/configs/nyan-big.h         | 2 ++
 3 files changed, 10 insertions(+)
arch/arm/dts/tegra124-nyan-big.dts +3 -0
index 5a39e93..8be6adb 100644
@@ -163,12 +163,15 @@
 
 	spi at 7000d400 {
 		status = "okay";
+		spi-deactivate-delay = <200>;
+		spi-max-frequency = <3000000>;
 
 		cros_ec: cros-ec at 0 {
 			compatible = "google,cros-ec-spi";
 			spi-max-frequency = <3000000>;
 			interrupt-parent = <&gpio>;
 			interrupts = <TEGRA_GPIO(C, 7) IRQ_TYPE_LEVEL_LOW>;
+			ec-interrupt = <&gpio TEGRA_GPIO(C, 7) GPIO_ACTIVE_LOW>;
 			reg = <0>;
 
 			google,cros-ec-spi-msg-delay = <2000>;
configs/nyan-big_defconfig +5 -0
index d447ddc..4a94d7b 100644
@@ -5,3 +5,8 @@ CONFIG_TARGET_NYAN_BIG=y
 CONFIG_DEFAULT_DEVICE_TREE="tegra124-nyan-big"
 CONFIG_DISPLAY_PORT=y
 CONFIG_VIDEO_TEGRA124=y
+CONFIG_DM_CROS_EC=y
+CONFIG_CROS_EC=y
+CONFIG_CROS_EC_SPI=y
+CONFIG_CROS_EC_KEYB=y
+CONFIG_CMD_CROS_EC=y
include/configs/nyan-big.h +2 -0
index caca98b..aae54f8 100644
@@ -80,6 +80,8 @@
 #define CONFIG_FIT
 #define CONFIG_OF_LIBFDT
 
+#define CONFIG_KEYBOARD
+
 #include "tegra-common-usb-gadget.h"
 #include "tegra-common-post.h"
 
Signature · 1 line
2.2.0.rc0.207.ga3a616c
#3 lore raw

PATCH v3 4/15 tegra: spi: Support slow SPI rates

In reply to Simon Glass

Use the oscillator as the source clock when we cannot achieve a low-enough speed with the peripheral clock. This happens when we request 3MHz on a SPI clock, for example.

---

Changes in v3: None
Changes in v2: None

 drivers/spi/tegra114_spi.c | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)
drivers/spi/tegra114_spi.c +15 -3
index 0d69376..d7eecd5 100644
@@ -144,6 +144,7 @@ static int tegra114_spi_probe(struct udevice *bus)
 	struct tegra_spi_platdata *plat = dev_get_platdata(bus);
 	struct tegra114_spi_priv *priv = dev_get_priv(bus);
 	struct spi_regs *regs;
+	ulong rate;
 
 	priv->regs = (struct spi_regs *)plat->base;
 	regs = priv->regs;
@@ -152,9 +153,20 @@ static int tegra114_spi_probe(struct udevice *bus)
 	priv->freq = plat->frequency;
 	priv->periph_id = plat->periph_id;
 
-	/* Change SPI clock to correct frequency, PLLP_OUT0 source */
-	clock_start_periph_pll(priv->periph_id, CLOCK_ID_PERIPH,
-			       priv->freq);
+	/*
+	 * Change SPI clock to correct frequency, PLLP_OUT0 source, falling
+	 * back to the oscillator if that is too fast.
+	 */
+	rate = clock_start_periph_pll(priv->periph_id, CLOCK_ID_PERIPH,
+				      priv->freq);
+	if (rate > priv->freq + 100000) {
+		rate = clock_start_periph_pll(priv->periph_id, CLOCK_ID_OSC,
+					      priv->freq);
+		if (rate != priv->freq) {
+			printf("Warning: SPI '%s' requested clock %u, actual clock %lu\n",
+			       bus->name, priv->freq, rate);
+		}
+	}
 
 	/* Clear stale status here */
 	setbits_le32(&regs->fifo_status,
Signature · 1 line
2.2.0.rc0.207.ga3a616c
#4 lore raw

PATCH v3 5/15 tegra: clock: Support enabling external clocks

In reply to Simon Glass

Add a simple function to enable external clocks.

---

Changes in v3: None
Changes in v2: None

 arch/arm/include/asm/arch-tegra/clock.h |  8 ++++++++
 arch/arm/mach-tegra/clock.c             | 17 +++++++++++++++++
 2 files changed, 25 insertions(+)
arch/arm/include/asm/arch-tegra/clock.h +8 -0
index 04011ae..f9dd3c8 100644
@@ -336,4 +336,12 @@ void arch_timer_init(void);
 
 void tegra30_set_up_pllp(void);
 
+/**
+ * Enable output clock for external peripherals
+ *
+ * @param clk_id	Clock ID to output (1, 2 or 3)
+ * @return 0 if OK. -ve on error
+ */
+int clock_external_output(int clk_id);
+
 #endif  /* _TEGRA_CLOCK_H_ */
arch/arm/mach-tegra/clock.c +17 -0
index cdd5438..5908260 100644
@@ -17,11 +17,13 @@
 /* Tegra SoC common clock control functions */
 
 #include <common.h>
+#include <errno.h>
 #include <asm/io.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/tegra.h>
 #include <asm/arch-tegra/ap.h>
 #include <asm/arch-tegra/clk_rst.h>
+#include <asm/arch-tegra/pmc.h>
 #include <asm/arch-tegra/timer.h>
 #include <div64.h>
 #include <fdtdec.h>
@@ -702,3 +704,18 @@ void tegra30_set_up_pllp(void)
 
 	set_avp_clock_source(SCLK_SOURCE_PLLP_OUT4);
 }
+
+int clock_external_output(int clk_id)
+{
+	struct pmc_ctlr *pmc = (struct pmc_ctlr *)NV_PA_PMC_BASE;
+
+	if (clk_id >= 1 && clk_id <= 3) {
+		setbits_le32(&pmc->pmc_clk_out_cntrl,
+			     1 << (2 + (clk_id - 1) * 8));
+	} else {
+		printf("%s: Unknown output clock id %d\n", __func__, clk_id);
+		return -EINVAL;
+	}
+
+	return 0;
+}
Signature · 1 line
2.2.0.rc0.207.ga3a616c
#5 lore raw

PATCH v3 6/15 tegra: clock: Adjust PLL access to avoid a warning

In reply to Simon Glass

A harmless but confusing warning is displayed when looking up the DisplayPort PLL. Correct this.

---

Changes in v3: None
Changes in v2: None

 arch/arm/mach-tegra/clock.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
arch/arm/mach-tegra/clock.c +5 -2
index 5908260..24047b8 100644
@@ -84,7 +84,7 @@ static struct clk_pll *get_pll(enum clock_id clkid)
 
 	assert(clock_id_is_pll(clkid));
 	if (clkid >= (enum clock_id)TEGRA_CLK_PLLS) {
-		debug("%s: Invalid PLL\n", __func__);
+		debug("%s: Invalid PLL %d\n", __func__, clkid);
 		return NULL;
 	}
 	return &clkrst->crc_pll[clkid];
@@ -120,9 +120,12 @@ int clock_ll_read_pll(enum clock_id clkid, u32 *divm, u32 *divn,
 unsigned long clock_start_pll(enum clock_id clkid, u32 divm, u32 divn,
 		u32 divp, u32 cpcon, u32 lfcon)
 {
-	struct clk_pll *pll = get_pll(clkid);
+	struct clk_pll *pll = NULL;
 	u32 misc_data, data;
 
+	if (clkid < (enum clock_id)TEGRA_CLK_PLLS)
+		pll = get_pll(clkid);
+
 	/*
 	 * We cheat by treating all PLL (except PLLU) in the same fashion.
 	 * This works only because:
Signature · 1 line
2.2.0.rc0.207.ga3a616c
#6 lore raw

PATCH v3 7/15 tegra: Introduce SRAM repair on tegra124

In reply to Simon Glass

This is required in order to avoid instability when running from caches after the kernel starts.

---

Changes in v3: None
Changes in v2: None

 arch/arm/include/asm/arch-tegra124/flow.h | 12 ++++++++++++
 arch/arm/mach-tegra/powergate.c           | 20 +++++++++++++++++++-
 2 files changed, 31 insertions(+), 1 deletion(-)
arch/arm/include/asm/arch-tegra124/flow.h +12 -0
index d6f515f..7818b1b 100644
@@ -26,6 +26,12 @@ struct flow_ctlr {
 	u32 cpu_pwr_csr;	/* offset 0x38 */
 	u32 mpid;		/* offset 0x3c */
 	u32 ram_repair;		/* offset 0x40 */
+	u32 flow_dbg_sel;	/* offset 0x44 */
+	u32 flow_dbg_cnt0;	/* offset 0x48 */
+	u32 flow_dbg_cnt1;	/* offset 0x4c */
+	u32 flow_dbg_qual;	/* offset 0x50 */
+	u32 flow_ctlr_spare;	/* offset 0x54 */
+	u32 ram_repair_cluster1;/* offset 0x58 */
 };
 
 /* HALT_COP_EVENTS_0, 0x04 */
@@ -43,4 +49,10 @@ struct flow_ctlr {
 #define CSR_WAIT_WFI_SHIFT	8
 #define CSR_PWR_OFF_STS		(1 << 16)
 
+/* RAM_REPAIR, 0x40, 0x58 */
+enum {
+	RAM_REPAIR_REQ = 0x1 << 0,
+	RAM_REPAIR_STS = 0x1 << 1,
+};
+
 #endif	/*  _TEGRA124_FLOW_H_ */
arch/arm/mach-tegra/powergate.c +19 -1
index 6331cd4..30ae036 100644
@@ -9,7 +9,7 @@
 
 #include <asm/io.h>
 #include <asm/types.h>
-
+#include <asm/arch/flow.h>
 #include <asm/arch/powergate.h>
 #include <asm/arch/tegra.h>
 
@@ -75,11 +75,29 @@ static int tegra_powergate_remove_clamping(enum tegra_powergate id)
 	return 0;
 }
 
+static void tegra_powergate_ram_repair(void)
+{
+#ifdef CONFIG_TEGRA124
+	struct flow_ctlr *flow = (struct flow_ctlr *)NV_PA_FLOW_BASE;
+
+	/* Request RAM repair for cluster 0 and wait until complete */
+	setbits_le32(&flow->ram_repair, RAM_REPAIR_REQ);
+	while (!(readl(&flow->ram_repair) & RAM_REPAIR_STS))
+		;
+
+	/* Same for cluster 1 */
+	setbits_le32(&flow->ram_repair_cluster1, RAM_REPAIR_REQ);
+	while (!(readl(&flow->ram_repair_cluster1) & RAM_REPAIR_STS))
+		;
+#endif
+}
+
 int tegra_powergate_sequence_power_up(enum tegra_powergate id,
 				      enum periph_id periph)
 {
 	int err;
 
+	tegra_powergate_ram_repair();
 	reset_set_enable(periph, 1);
 
 	err = tegra_powergate_power_on(id);
Signature · 1 line
2.2.0.rc0.207.ga3a616c
#7 lore raw

PATCH v3 8/15 tegra: Add missing tegra124 peripherals

In reply to Simon Glass

There are some missing entries in the tables. Add them.

---

Changes in v3: None
Changes in v2: None

 arch/arm/include/asm/arch-tegra124/clock-tables.h | 12 ++++++------
 arch/arm/mach-tegra/tegra124/clock.c              |  2 +-
 2 files changed, 7 insertions(+), 7 deletions(-)
arch/arm/include/asm/arch-tegra124/clock-tables.h +6 -6
index 7005855..3c67e72 100644
@@ -285,12 +285,12 @@ enum periph_id {
 	/* 184 */
 	PERIPH_ID_GPU,
 	PERIPH_ID_AMX1,
-	PERIPH_ID_X_RESERVED26,
-	PERIPH_ID_X_RESERVED27,
-	PERIPH_ID_X_RESERVED28,
-	PERIPH_ID_X_RESERVED29,
-	PERIPH_ID_X_RESERVED30,
-	PERIPH_ID_X_RESERVED31,
+	PERIPH_ID_AFC5,
+	PERIPH_ID_AFC4,
+	PERIPH_ID_AFC3,
+	PERIPH_ID_AFC2,
+	PERIPH_ID_AFC1,
+	PERIPH_ID_AFC0,
 
 	PERIPH_ID_COUNT,
 	PERIPH_ID_NONE = -1,
arch/arm/mach-tegra/tegra124/clock.c +1 -1
index 2d17550..b955848 100644
@@ -475,7 +475,7 @@ static s8 periph_id_to_internal_id[PERIPH_ID_COUNT] = {
 	PERIPHC_ACTMON,
 
 	/* 120 */
-	NONE(EXTPERIPH1),
+	PERIPHC_EXTPERIPH1,
 	NONE(EXTPERIPH2),
 	NONE(EXTPERIPH3),
 	NONE(OOB),
Signature · 1 line
2.2.0.rc0.207.ga3a616c
#8 lore raw

PATCH v3 9/15 tegra: Increase maximum arguments to 32

In reply to Simon Glass

When setting up large environment variables we can exceed 16 arguemnts. Increase this to avoid problems.

---

Changes in v3: None
Changes in v2: None

 include/configs/tegra-common.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/configs/tegra-common.h +1 -1
index 7ae1792..30f9ebc 100644
@@ -105,7 +105,7 @@
 /* Print Buffer Size */
 #define CONFIG_SYS_PBSIZE		(CONFIG_SYS_CBSIZE + \
 					sizeof(CONFIG_SYS_PROMPT) + 16)
-#define CONFIG_SYS_MAXARGS		16	/* max number of command args */
+#define CONFIG_SYS_MAXARGS		32	/* max number of command args */
 /* Boot Argument Buffer Size */
 #define CONFIG_SYS_BARGSIZE		(CONFIG_SYS_CBSIZE)
 
Signature · 1 line
2.2.0.rc0.207.ga3a616c
#9 lore raw

PATCH v3 10/15 tegra: lcd: Tidy up clock init

In reply to Simon Glass

Use the correct function for clock init.

---

Changes in v3: None
Changes in v2: None

 drivers/video/tegra124/tegra124-lcd.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/video/tegra124/tegra124-lcd.c +1 -3
index 2733590..cfdc77f 100644
@@ -51,15 +51,13 @@ static int tegra124_lcd_init(void *lcdbase)
 	int ret;
 
 	clock_set_up_plldp();
-	clock_adjust_periph_pll_div(PERIPH_ID_HOST1X, CLOCK_ID_PERIPH,
-				    408000000, NULL);
+	clock_start_periph_pll(PERIPH_ID_HOST1X, CLOCK_ID_PERIPH, 408000000);
 
 	clock_enable(PERIPH_ID_HOST1X);
 	clock_enable(PERIPH_ID_DISP1);
 	clock_enable(PERIPH_ID_PWM);
 	clock_enable(PERIPH_ID_DPAUX);
 	clock_enable(PERIPH_ID_SOR0);
-
 	udelay(2);
 
 	reset_set_enable(PERIPH_ID_HOST1X, 0);
Signature · 1 line
2.2.0.rc0.207.ga3a616c
#10 lore raw

PATCH v3 11/15 tegra: Allow board-specific init

In reply to Simon Glass

Add a hook to allows boards to add their own init to board_init().

---

Changes in v3: None
Changes in v2: None

 arch/arm/include/asm/arch-tegra/sys_proto.h | 7 +++++++
 arch/arm/mach-tegra/board2.c                | 8 ++++++--
 2 files changed, 13 insertions(+), 2 deletions(-)
arch/arm/include/asm/arch-tegra/sys_proto.h +7 -0
index 83f9f47..b64f9d8 100644
@@ -25,4 +25,11 @@ int tegra_board_id(void);
  */
 int tegra_lcd_pmic_init(int board_id);
 
+/**
+ * nvidia_board_init() - perform any board-specific init
+ *
+ * @return 0 if OK, -ve on error
+ */
+int nvidia_board_init(void);
+
 #endif
arch/arm/mach-tegra/board2.c +6 -2
index 131802a..ebcee4e 100644
@@ -107,6 +107,11 @@ __weak int tegra_lcd_pmic_init(int board_it)
 	return 0;
 }
 
+__weak int nvidia_board_init(void)
+{
+	return 0;
+}
+
 /*
  * Routine: board_init
  * Description: Early hardware init.
@@ -180,8 +185,7 @@ int board_init(void)
 	/* prepare the WB code to LP0 location */
 	warmboot_prepare_code(TEGRA_LP0_ADDR, TEGRA_LP0_SIZE);
 #endif
-
-	return 0;
+	return nvidia_board_init();
 }
 
 #ifdef CONFIG_BOARD_EARLY_INIT_F
Signature · 1 line
2.2.0.rc0.207.ga3a616c
#11 lore raw

PATCH v3 12/15 tegra: nyan-big: Add additional clock and kernel init

In reply to Simon Glass

We need to turn on all audio-related clocks for the Chrome OS kernel to boot. Otherwise it will hang when trying to enable audio.

Also for Linux set up graphics driver video protection.

---

Changes in v3: None
Changes in v2:
- Remove unnecessary ODMDATA mangling

 board/nvidia/nyan-big/nyan-big.c | 69 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 69 insertions(+)
board/nvidia/nyan-big/nyan-big.c +69 -0
index ae8874b..ba96401 100644
@@ -8,7 +8,12 @@
 #include <common.h>
 #include <errno.h>
 #include <asm/gpio.h>
+#include <asm/io.h>
 #include <asm/arch/pinmux.h>
+#include <asm/arch/clock.h>
+#include <asm/arch/mc.h>
+#include <asm/arch-tegra/clk_rst.h>
+#include <asm/arch-tegra/pmc.h>
 #include <power/as3722.h>
 #include <power/pmic.h>
 #include "pinmux-config-nyan-big.h"
@@ -57,3 +62,67 @@ int tegra_lcd_pmic_init(int board_id)
 
 	return 0;
 }
+
+/* Setup required information for Linux kernel */
+static void setup_kernel_info(void)
+{
+	struct mc_ctlr *mc = (void *)NV_PA_MC_BASE;
+
+	/* The kernel graphics driver needs this region locked down */
+	writel(0, &mc->mc_video_protect_bom);
+	writel(0, &mc->mc_video_protect_size_mb);
+	writel(1, &mc->mc_video_protect_reg_ctrl);
+}
+
+/*
+ * We need to take ALL audio devices conntected to AHUB (AUDIO, APBIF,
+ * I2S, DAM, AMX, ADX, SPDIF, AFC) out of reset and enable the clocks.
+ * Otherwise reading AHUB devices will hang when the kernel boots.
+ */
+static void enable_required_clocks(void)
+{
+	static enum periph_id ids[] = {
+		PERIPH_ID_I2S0,
+		PERIPH_ID_I2S1,
+		PERIPH_ID_I2S2,
+		PERIPH_ID_I2S3,
+		PERIPH_ID_I2S4,
+		PERIPH_ID_AUDIO,
+		PERIPH_ID_APBIF,
+		PERIPH_ID_DAM0,
+		PERIPH_ID_DAM1,
+		PERIPH_ID_DAM2,
+		PERIPH_ID_AMX0,
+		PERIPH_ID_AMX1,
+		PERIPH_ID_ADX0,
+		PERIPH_ID_ADX1,
+		PERIPH_ID_SPDIF,
+		PERIPH_ID_AFC0,
+		PERIPH_ID_AFC1,
+		PERIPH_ID_AFC2,
+		PERIPH_ID_AFC3,
+		PERIPH_ID_AFC4,
+		PERIPH_ID_AFC5,
+		PERIPH_ID_EXTPERIPH1
+	};
+	int i;
+
+	for (i = 0; i < ARRAY_SIZE(ids); i++)
+		clock_enable(ids[i]);
+	udelay(2);
+	for (i = 0; i < ARRAY_SIZE(ids); i++)
+		reset_set_enable(ids[i], 0);
+}
+
+int nvidia_board_init(void)
+{
+	clock_start_periph_pll(PERIPH_ID_EXTPERIPH1, CLOCK_ID_OSC, 12000000);
+	clock_start_periph_pll(PERIPH_ID_I2S1, CLOCK_ID_OSC, 1500000);
+
+	/* For external MAX98090 audio codec */
+	clock_external_output(1);
+	setup_kernel_info();
+	enable_required_clocks();
+
+	return 0;
+}
Signature · 1 line
2.2.0.rc0.207.ga3a616c
#12 lore raw

PATCH v3 13/15 tegra: config: Allow Chrome OS environment settings to be included

In reply to Simon Glass

Bring these in if they are provided by the board.

---

Changes in v3: None
Changes in v2: None

 include/configs/tegra-common-post.h | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
include/configs/tegra-common-post.h +6 -1
index 48c1a7a..483222f 100644
@@ -58,13 +58,18 @@
 
 #define CONFIG_SYS_LOAD_ADDR CONFIG_LOADADDR
 
+#ifndef CONFIG_CHROMEOS_EXTRA_ENV_SETTINGS
+#define CONFIG_CHROMEOS_EXTRA_ENV_SETTINGS
+#endif
+
 #define CONFIG_EXTRA_ENV_SETTINGS \
 	TEGRA_DEVICE_SETTINGS \
 	MEM_LAYOUT_ENV_SETTINGS \
 	"fdt_high=ffffffff\0" \
 	"initrd_high=ffffffff\0" \
 	BOOTENV \
-	BOARD_EXTRA_ENV_SETTINGS
+	BOARD_EXTRA_ENV_SETTINGS \
+	CONFIG_CHROMEOS_EXTRA_ENV_SETTINGS
 
 #if defined(CONFIG_TEGRA20_SFLASH) || defined(CONFIG_TEGRA20_SLINK) || defined(CONFIG_TEGRA114_SPI)
 #define CONFIG_TEGRA_SPI
Signature · 1 line
2.2.0.rc0.207.ga3a616c
#13 lore raw

PATCH v3 14/15 tegra: Replace 'Norrin' with 'Nyan-big' and fix typo

In reply to Simon Glass

With the rename the MAINTAINER file was not updated. Fix it and the 'Chrombook' typo in Kconfig.

---

Changes in v3: None
Changes in v2: None

 arch/arm/mach-tegra/tegra124/Kconfig | 2 +-
 board/nvidia/nyan-big/MAINTAINERS    | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
arch/arm/mach-tegra/tegra124/Kconfig +1 -1
index 6579e3f..f3324ff 100644
@@ -10,7 +10,7 @@ config TARGET_JETSON_TK1
 	select CPU_V7_HAS_VIRT if !SPL_BUILD
 
 config TARGET_NYAN_BIG
-	bool "Google/NVIDIA Nyan-big Chrombook"
+	bool "Google/NVIDIA Nyan-big Chromebook"
 	help
 	  Nyan Big is a Tegra124 clamshell board that is very similar
 	  to venice2, but it has a different panel, the sdcard CD and WP
board/nvidia/nyan-big/MAINTAINERS +1 -1
index ff74627..7790777 100644
@@ -1,4 +1,4 @@
-NORRIN BOARD
+NYAN-BIG BOARD
 M:	Allen Martin <[email protected]>
 S:	Maintained
 F:	board/nvidia/nyan-big/
Signature · 1 line
2.2.0.rc0.207.ga3a616c
#14 lore raw

PATCH v3 15/15 tegra: config: nyan-big: Add options required by Chrome OS boot

In reply to Simon Glass

We need to match the device tree in the FIT with the U-Boot model so we can automatically select the right device tree. Also adjust the load address so that the device tree is not in the way when a zImage kernel tries to extract itself.

---

Changes in v3:
- Rebase to tegra/master
- Drop chromeos.h header patch and #include

Changes in v2:
- Drop tegra timer patch as it is not needed
- Drop a few patches that have already been applied

 include/configs/nyan-big.h | 5 +++++
 1 file changed, 5 insertions(+)
include/configs/nyan-big.h +5 -0
index aae54f8..335c088 100644
@@ -47,6 +47,7 @@
 #define CONFIG_AS3722_POWER
 #define LCD_BPP				LCD_COLOR16
 #define CONFIG_SYS_WHITE_ON_BLACK
+#define CONFIG_CMD_BMP
 
 /* Align LCD to 1MB boundary */
 #define CONFIG_LCD_ALIGNMENT	MMU_SECTION_SIZE
@@ -78,10 +79,14 @@
 #define CONFIG_CMD_DHCP
 
 #define CONFIG_FIT
+#define CONFIG_FIT_BEST_MATCH
 #define CONFIG_OF_LIBFDT
 
 #define CONFIG_KEYBOARD
 
+#undef CONFIG_LOADADDR
+#define CONFIG_LOADADDR		0x82408000
+
 #include "tegra-common-usb-gadget.h"
 #include "tegra-common-post.h"
 
Signature · 1 line
2.2.0.rc0.207.ga3a616c