conga-qeval20-qa3.c 1.4 KB

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