]> git.ipfire.org Git - thirdparty/u-boot.git/blame - board/congatec/conga-qeval20-qa3-e3845/conga-qeval20-qa3.c
Revert "Merge patch series "arm: dts: am62-beagleplay: Fix Beagleplay Ethernet""
[thirdparty/u-boot.git] / board / congatec / conga-qeval20-qa3-e3845 / conga-qeval20-qa3.c
CommitLineData
83d290c5 1// SPDX-License-Identifier: GPL-2.0+
82ceba2c
SR
2/*
3 * Copyright (C) 2016 Stefan Roese <sr@denx.de>
82ceba2c
SR
4 */
5
d678a59d 6#include <common.h>
303dfc2e 7#include <i2c.h>
5255932f 8#include <init.h>
82ceba2c
SR
9#include <winbond_w83627.h>
10#include <asm/gpio.h>
11#include <asm/ibmpc.h>
12#include <asm/pnp_def.h>
13
14int board_early_init_f(void)
15{
f2a751be 16#ifndef CONFIG_INTERNAL_UART
82ceba2c
SR
17 /*
18 * The FSP enables the BayTrail internal legacy UART (again).
19 * Disable it again, so that the Winbond one can be used.
20 */
21 setup_internal_uart(0);
22
23 /* Enable the legacy UART in the Winbond W83627 Super IO chip */
24 winbond_enable_serial(PNP_DEV(WINBOND_IO_PORT, W83627DHG_SP1),
25 UART0_BASE, UART0_IRQ);
f2a751be 26#endif
82ceba2c
SR
27
28 return 0;
29}
30
303dfc2e
SR
31int board_late_init(void)
32{
33 struct udevice *dev;
34 u8 buf[8];
35 int ret;
36
37 /* Configure SMSC USB2513 USB Hub: 7bit address 0x2c */
38 ret = i2c_get_chip_for_busnum(0, 0x2c, 1, &dev);
39 if (ret) {
40 printf("Cannot find USB2513: %d\n", ret);
41 return 0;
42 }
43
44 /*
45 * The first access to the USB Hub fails sometimes, so lets read
46 * a dummy byte to be sure here
47 */
48 dm_i2c_read(dev, 0x00, buf, 1);
49
50 /*
51 * The SMSC hub is not visible on the I2C bus after the first
52 * configuration at power-up. The following code deliberately
53 * does not report upon failure of these I2C write calls.
54 */
55 buf[0] = 0x93;
56 dm_i2c_write(dev, 0x06, buf, 1);
57
58 buf[0] = 0xaa;
59 dm_i2c_write(dev, 0xf8, buf, 1);
60
61 buf[0] = 0x0f;
62 dm_i2c_write(dev, 0xfa, buf, 1);
63
64 buf[0] = 0x01;
65 dm_i2c_write(dev, 0xff, buf, 1);
66
67 return 0;
68}