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