conga-qeval20-qa3.c 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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 <init.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 board_late_init(void)
  27. {
  28. struct udevice *dev;
  29. u8 buf[8];
  30. int ret;
  31. /* Configure SMSC USB2513 USB Hub: 7bit address 0x2c */
  32. ret = i2c_get_chip_for_busnum(0, 0x2c, 1, &dev);
  33. if (ret) {
  34. printf("Cannot find USB2513: %d\n", ret);
  35. return 0;
  36. }
  37. /*
  38. * The first access to the USB Hub fails sometimes, so lets read
  39. * a dummy byte to be sure here
  40. */
  41. dm_i2c_read(dev, 0x00, buf, 1);
  42. /*
  43. * The SMSC hub is not visible on the I2C bus after the first
  44. * configuration at power-up. The following code deliberately
  45. * does not report upon failure of these I2C write calls.
  46. */
  47. buf[0] = 0x93;
  48. dm_i2c_write(dev, 0x06, buf, 1);
  49. buf[0] = 0xaa;
  50. dm_i2c_write(dev, 0xf8, buf, 1);
  51. buf[0] = 0x0f;
  52. dm_i2c_write(dev, 0xfa, buf, 1);
  53. buf[0] = 0x01;
  54. dm_i2c_write(dev, 0xff, buf, 1);
  55. return 0;
  56. }