conga-qeval20-qa3.c 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. // SPDX-License-Identifier: GPL-2.0+
  2. /*
  3. * Copyright (C) 2016 Stefan Roese <sr@denx.de>
  4. */
  5. #include <common.h>
  6. #include <i2c.h>
  7. #include <winbond_w83627.h>
  8. #include <asm/gpio.h>
  9. #include <asm/ibmpc.h>
  10. #include <asm/pnp_def.h>
  11. int board_early_init_f(void)
  12. {
  13. #ifndef CONFIG_INTERNAL_UART
  14. /*
  15. * The FSP enables the BayTrail internal legacy UART (again).
  16. * Disable it again, so that the Winbond one can be used.
  17. */
  18. setup_internal_uart(0);
  19. /* Enable the legacy UART in the Winbond W83627 Super IO chip */
  20. winbond_enable_serial(PNP_DEV(WINBOND_IO_PORT, W83627DHG_SP1),
  21. UART0_BASE, UART0_IRQ);
  22. #endif
  23. return 0;
  24. }
  25. int board_late_init(void)
  26. {
  27. struct udevice *dev;
  28. u8 buf[8];
  29. int ret;
  30. /* Configure SMSC USB2513 USB Hub: 7bit address 0x2c */
  31. ret = i2c_get_chip_for_busnum(0, 0x2c, 1, &dev);
  32. if (ret) {
  33. printf("Cannot find USB2513: %d\n", ret);
  34. return 0;
  35. }
  36. /*
  37. * The first access to the USB Hub fails sometimes, so lets read
  38. * a dummy byte to be sure here
  39. */
  40. dm_i2c_read(dev, 0x00, buf, 1);
  41. /*
  42. * The SMSC hub is not visible on the I2C bus after the first
  43. * configuration at power-up. The following code deliberately
  44. * does not report upon failure of these I2C write calls.
  45. */
  46. buf[0] = 0x93;
  47. dm_i2c_write(dev, 0x06, buf, 1);
  48. buf[0] = 0xaa;
  49. dm_i2c_write(dev, 0xf8, buf, 1);
  50. buf[0] = 0x0f;
  51. dm_i2c_write(dev, 0xfa, buf, 1);
  52. buf[0] = 0x01;
  53. dm_i2c_write(dev, 0xff, buf, 1);
  54. return 0;
  55. }