1 /*
2 * (C) Copyright 2009-2010
3 * Max Tretene, ACube Systems Srl. mtretene@acube-systems.com.
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 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
21 * MA 02111-1307 USA
22 */
23
24 #include <common.h>
25 #include <pci.h>
26 #include <sm501.h>
27
28 #ifdef CONFIG_VIDEO_SM502
29
30 DECLARE_GLOBAL_DATA_PTR;
31
32 #undef DEBUG
33
34 #ifdef DEBUG
35 #define PRINTF(fmt,args...) printf (fmt ,##args)
36 #else
37 #define PRINTF(fmt,args...)
38 #endif
39
40 unsigned char SM502INIT = 0;
41 u32 *fb_base_phys_sm502;
42 pci_dev_t dev_sm502 = ~0;
43
init_sm502()44 void init_sm502()
45 {
46 int jj = 0;
47
48 dev_sm502 = pci_find_device(PCI_VENDOR_SM, PCI_DEVICE_SM501, 0);
49
50 if (dev_sm502 != -1)
51 {
52 printf("SM502: found\n");
53 PRINTF("calling video_hw_init\n");
54 SM502INIT = 1;
55 video_hw_init();
56
57 PRINTF("read config\n");
58 pci_read_config_dword(dev_sm502, PCI_BASE_ADDRESS_0, &fb_base_phys_sm502);
59 *fb_base_phys_sm502 = *fb_base_phys_sm502 & 0xfffff000;
60 PRINTF("fb_base = %8x\n",fb_base_phys_sm502);
61
62 for (jj=0;jj<256;jj++)
63 video_set_lut(jj,jj,jj,jj);
64
65 jj = (800 * 600) / 4;
66 u32 *tmp = fb_base_phys_sm502;
67 while (jj--)
68 *tmp++ = 0;
69 }
70 else printf("SM502: not found\n");
71 }
72 #endif
73