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