Commit 0deba29c202695f3e166256d87515b99b74adc8e

Authored by Simon Glass
Committed by Tom Warren
1 parent 346451b588

tegra: nyan-big: Add LCD PMIC init and board ID

Add required setup for the LCD display, and a function to provide the
board ID. This requires GPIOs to be available prior to relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Warren <twarren@nvidia.com>

Showing 2 changed files with 37 additions and 1 deletions Side-by-side Diff

arch/arm/dts/tegra124-nyan-big.dts
... ... @@ -310,6 +310,10 @@
310 310 };
311 311 };
312 312  
  313 + gpio@6000d000 {
  314 + u-boot,dm-pre-reloc;
  315 + };
  316 +
313 317 gpio-keys {
314 318 compatible = "gpio-keys";
315 319  
board/nvidia/nyan-big/nyan-big.c
... ... @@ -6,8 +6,11 @@
6 6 */
7 7  
8 8 #include <common.h>
9   -#include <asm/arch/gpio.h>
  9 +#include <errno.h>
  10 +#include <asm/gpio.h>
10 11 #include <asm/arch/pinmux.h>
  12 +#include <power/as3722.h>
  13 +#include <power/pmic.h>
11 14 #include "pinmux-config-nyan-big.h"
12 15  
13 16 /*
... ... @@ -24,5 +27,34 @@
24 27  
25 28 pinmux_config_drvgrp_table(nyan_big_drvgrps,
26 29 ARRAY_SIZE(nyan_big_drvgrps));
  30 +}
  31 +
  32 +int tegra_board_id(void)
  33 +{
  34 + static const int vector[] = {GPIO_PQ3, GPIO_PT1, GPIO_PX1,
  35 + GPIO_PX4, -1};
  36 +
  37 + gpio_claim_vector(vector, "board_id%d");
  38 + return gpio_get_values_as_int(vector);
  39 +}
  40 +
  41 +int tegra_lcd_pmic_init(int board_id)
  42 +{
  43 + struct udevice *pmic;
  44 + int ret;
  45 +
  46 + ret = as3722_get(&pmic);
  47 + if (ret)
  48 + return -ENOENT;
  49 +
  50 + if (board_id == 0)
  51 + as3722_write(pmic, 0x00, 0x3c);
  52 + else
  53 + as3722_write(pmic, 0x00, 0x50);
  54 + as3722_write(pmic, 0x12, 0x10);
  55 + as3722_write(pmic, 0x0c, 0x07);
  56 + as3722_write(pmic, 0x20, 0x10);
  57 +
  58 + return 0;
27 59 }