video_display.c 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. // SPDX-License-Identifier: GPL-2.0+
  2. /*
  3. * Copyright (C) 2017 Microchip
  4. * Wenyou Yang <wenyou.yang@microchip.com>
  5. */
  6. #include <common.h>
  7. #include <atmel_lcd.h>
  8. #include <dm.h>
  9. #include <nand.h>
  10. #include <version.h>
  11. #include <video.h>
  12. #include <video_console.h>
  13. #include <asm/io.h>
  14. #include <asm/arch/clk.h>
  15. DECLARE_GLOBAL_DATA_PTR;
  16. int at91_video_show_board_info(void)
  17. {
  18. ulong dram_size, nand_size;
  19. int i;
  20. u32 len = 0;
  21. char buf[255];
  22. char *corp = "2017 Microchip Technology Inc.\n";
  23. char temp[32];
  24. struct udevice *dev, *con;
  25. const char *s;
  26. vidinfo_t logo_info;
  27. int ret;
  28. len += sprintf(&buf[len], "%s\n", U_BOOT_VERSION);
  29. memcpy(&buf[len], corp, strlen(corp));
  30. len += strlen(corp);
  31. len += sprintf(&buf[len], "%s CPU at %s MHz\n", get_cpu_name(),
  32. strmhz(temp, get_cpu_clk_rate()));
  33. dram_size = 0;
  34. for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++)
  35. dram_size += gd->bd->bi_dram[i].size;
  36. nand_size = 0;
  37. #ifdef CONFIG_NAND_ATMEL
  38. for (i = 0; i < CONFIG_SYS_MAX_NAND_DEVICE; i++)
  39. nand_size += get_nand_dev_by_index(i)->size;
  40. #endif
  41. len += sprintf(&buf[len], "%ld MB SDRAM, %ld MB NAND\n",
  42. dram_size >> 20, nand_size >> 20);
  43. ret = uclass_get_device(UCLASS_VIDEO, 0, &dev);
  44. if (ret)
  45. return ret;
  46. microchip_logo_info(&logo_info);
  47. ret = video_bmp_display(dev, logo_info.logo_addr,
  48. logo_info.logo_x_offset,
  49. logo_info.logo_y_offset, false);
  50. if (ret)
  51. return ret;
  52. ret = uclass_get_device(UCLASS_VIDEO_CONSOLE, 0, &con);
  53. if (ret)
  54. return ret;
  55. vidconsole_position_cursor(con, 0, logo_info.logo_height);
  56. for (s = buf, i = 0; i < len; s++, i++)
  57. vidconsole_put_char(con, *s);
  58. return 0;
  59. }