sm107.c 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. /*
  2. * Copyright (C) 2011 Matrix Vision GmbH
  3. * Andre Schwarz <andre.schwarz@matrix-vision.de>
  4. *
  5. * See file CREDITS for list of people who contributed to this
  6. * project.
  7. *
  8. * This program is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU General Public License as
  10. * published by the Free Software Foundation; either version 2 of
  11. * the License, or (at your option) any later version.
  12. */
  13. #include <common.h>
  14. #include <asm/io.h>
  15. #include <ns16550.h>
  16. #include <netdev.h>
  17. #include <sm501.h>
  18. #include <pci.h>
  19. #include "../common/mv_common.h"
  20. #ifdef CONFIG_VIDEO
  21. static const SMI_REGS init_regs_800x480[] = {
  22. /* set endianess to little endian */
  23. {0x0005c, 0x00000000},
  24. /* PCI drive 12mA */
  25. {0x00004, 0x42401001},
  26. /* current clock */
  27. {0x0003c, 0x310a1818},
  28. /* clocks for pm0... */
  29. {0x00040, 0x0002184f},
  30. {0x00044, 0x2a1a0a01},
  31. /* GPIO */
  32. {0x10008, 0x00000000},
  33. {0x1000C, 0x00000000},
  34. /* panel control regs */
  35. {0x80000, 0x0f017106},
  36. {0x80004, 0x0},
  37. {0x80008, 0x0},
  38. {0x8000C, 0x00000000},
  39. {0x80010, 0x0c800c80},
  40. /* width 0x320 */
  41. {0x80014, 0x03200000},
  42. /* height 0x1e0 */
  43. {0x80018, 0x01E00000},
  44. {0x8001C, 0x0},
  45. {0x80020, 0x01df031f},
  46. {0x80024, 0x041f031f},
  47. {0x80028, 0x00800347},
  48. {0x8002C, 0x020c01df},
  49. {0x80030, 0x000201e9},
  50. {0x80200, 0x00000000},
  51. /* ZV[0:7] */
  52. {0x00008, 0x00ff0000},
  53. /* 24-Bit TFT */
  54. {0x0000c, 0x3f000000},
  55. {0, 0}
  56. };
  57. /*
  58. * Returns SM107 register base address. First thing called in the driver.
  59. */
  60. unsigned int board_video_init(void)
  61. {
  62. pci_dev_t devbusfn;
  63. u32 addr;
  64. devbusfn = pci_find_device(PCI_VENDOR_SM, PCI_DEVICE_SM501, 0);
  65. if (devbusfn != -1) {
  66. pci_read_config_dword(devbusfn, PCI_BASE_ADDRESS_1,
  67. (u32 *)&addr);
  68. return addr & 0xfffffffe;
  69. }
  70. return 0;
  71. }
  72. /*
  73. * Called after initializing the SM501 and before clearing the screen.
  74. */
  75. void board_validate_screen(unsigned int base)
  76. {
  77. }
  78. /*
  79. * Returns SM107 framebuffer address
  80. */
  81. unsigned int board_video_get_fb(void)
  82. {
  83. pci_dev_t devbusfn;
  84. u32 addr;
  85. devbusfn = pci_find_device(PCI_VENDOR_SM, PCI_DEVICE_SM501, 0);
  86. if (devbusfn != -1) {
  87. pci_read_config_dword(devbusfn, PCI_BASE_ADDRESS_0,
  88. (u32 *)&addr);
  89. addr &= 0xfffffffe;
  90. #ifdef CONFIG_VIDEO_SM501_FBMEM_OFFSET
  91. addr += CONFIG_VIDEO_SM501_FBMEM_OFFSET;
  92. #endif
  93. return addr;
  94. }
  95. printf("board_video_get_fb(): FAILED\n");
  96. return 0;
  97. }
  98. /*
  99. * Return a pointer to the initialization sequence.
  100. */
  101. const SMI_REGS *board_get_regs(void)
  102. {
  103. return init_regs_800x480;
  104. }
  105. int board_get_width(void)
  106. {
  107. return 800;
  108. }
  109. int board_get_height(void)
  110. {
  111. return 480;
  112. }
  113. #endif