blob: 624421496a408fe72128bdf31083ab249559da8f [file] [log] [blame]
Marcel Ziswiler11e2a532014-09-05 10:18:38 +02001/*
2 * (C) Copyright 2014
3 * Marcel Ziswiler <marcel@ziswiler.com>
4 *
5 * SPDX-License-Identifier: GPL-2.0+
6 */
7
8#include <common.h>
Simon Glass667aee92014-12-10 08:55:57 -07009#include <dm.h>
Marcel Ziswiler11e2a532014-09-05 10:18:38 +020010#include <asm/arch/gp_padctrl.h>
11#include <asm/arch/pinmux.h>
12#include <asm/gpio.h>
13#include <i2c.h>
14#include <netdev.h>
15
16#include "pinmux-config-apalis_t30.h"
17
18#define PMU_I2C_ADDRESS 0x2D
19#define MAX_I2C_RETRY 3
20
21/*
22 * Routine: pinmux_init
23 * Description: Do individual peripheral pinmux configs
24 */
25void pinmux_init(void)
26{
27 pinmux_config_pingrp_table(tegra3_pinmux_common,
28 ARRAY_SIZE(tegra3_pinmux_common));
29
30 pinmux_config_pingrp_table(unused_pins_lowpower,
31 ARRAY_SIZE(unused_pins_lowpower));
32
33 /* Initialize any non-default pad configs (APB_MISC_GP regs) */
34 pinmux_config_drvgrp_table(apalis_t30_padctrl,
35 ARRAY_SIZE(apalis_t30_padctrl));
36}
37
38#ifdef CONFIG_PCI_TEGRA
39int tegra_pcie_board_init(void)
40{
Simon Glass667aee92014-12-10 08:55:57 -070041 struct udevice *dev;
Marcel Ziswiler11e2a532014-09-05 10:18:38 +020042 u8 addr, data[1];
43 int err;
44
Simon Glassa2723ae2015-01-25 08:26:55 -070045 err = i2c_get_chip_for_busnum(0, PMU_I2C_ADDRESS, 1, &dev);
Marcel Ziswiler11e2a532014-09-05 10:18:38 +020046 if (err) {
Simon Glass667aee92014-12-10 08:55:57 -070047 debug("%s: Cannot find PMIC I2C chip\n", __func__);
Marcel Ziswiler11e2a532014-09-05 10:18:38 +020048 return err;
49 }
Marcel Ziswiler11e2a532014-09-05 10:18:38 +020050 /* TPS659110: VDD2_OP_REG = 1.05V */
51 data[0] = 0x27;
52 addr = 0x25;
53
Simon Glass7d722762015-01-12 18:02:07 -070054 err = dm_i2c_write(dev, addr, data, 1);
Marcel Ziswiler11e2a532014-09-05 10:18:38 +020055 if (err) {
56 debug("failed to set VDD supply\n");
57 return err;
58 }
59
60 /* TPS659110: VDD2_REG 7.5 mV/us, ACTIVE */
61 data[0] = 0x0D;
62 addr = 0x24;
63
Simon Glass7d722762015-01-12 18:02:07 -070064 err = dm_i2c_write(dev, addr, data, 1);
Marcel Ziswiler11e2a532014-09-05 10:18:38 +020065 if (err) {
66 debug("failed to enable VDD supply\n");
67 return err;
68 }
69
70 /* TPS659110: LDO6_REG = 1.1V, ACTIVE */
71 data[0] = 0x0D;
72 addr = 0x35;
73
Simon Glass7d722762015-01-12 18:02:07 -070074 err = dm_i2c_write(dev, addr, data, 1);
Marcel Ziswiler11e2a532014-09-05 10:18:38 +020075 if (err) {
76 debug("failed to set AVDD supply\n");
77 return err;
78 }
79
Marcel Ziswiler11e2a532014-09-05 10:18:38 +020080 return 0;
81}
82
83int board_eth_init(bd_t *bis)
84{
85 return pci_eth_init(bis);
86}
87#endif /* CONFIG_PCI_TEGRA */