1 #include <console/console.h>
2 #include <device/device.h>
3 #include <device/pci.h>
4 #include <device/pci_ids.h>
5 #include <device/pci_ops.h>
6 #include <cpu/amd/sc520.h>
12 volatile unsigned char *irq;
17 int irqlist[] = {0xd00, 0xd02, 0xd03, 0xd04, 0xd08, 0xd0a,
18 0xd14, 0xd18, 0xd1a, 0xd1b, 0xd1c,
19 0xd20, 0xd21, 0xd22, 0xd28, 0xd29,
20 0xd30, 0xd31, 0xd32, 0xd33,
21 0xd40, 0xd41, 0xd42, 0xd43,0xd44, 0xd45, 0xd46,
22 0xd50, 0xd51, 0xd52, 0xd53,0xd54, 0xd55, 0xd56, 0xd57,0xd58, 0xd59, 0xd5a,
24 mmcr = (void *) 0xfffef000;
26 printk_err("mmcr is %p\n", mmcr);
27 for(i = 0; irqlist[i] >= 0; i++) {
28 irq = mmcr + irqlist[i];
29 printk_err("0x%x register @%p is 0x%lx\n", irqlist[i], irq, *irq);
34 /* TODO: finish up mmcr struct in sc520.h, and;
35 - set ADDDECTL (now done in raminit.c in cpu/amd/sc520
37 static void enable_dev(struct device *dev) {
38 volatile struct mmcrpic *pic = MMCRPIC;
39 volatile struct mmcr *mmcr = MMCRDEFAULT;
41 /* msm586seg has this register set to a weird value.
42 * follow the board, not the manual!
45 /* currently, nothing in the device to use, so ignore it. */
46 printk_err("digital logic msm586 seg ENTER %s\n", __func__);
49 /* from fuctory bios */
50 /* NOTE: the following interrupt settings made interrupts work
51 * for hard drive, and serial, but not for ethernet
53 /* just do what they say and nobody gets hurt. */
54 mmcr->pic.pcicr = 0 ; // M_GINT_MODE | M_S1_MODE | M_S2_MODE;
55 /* all ints to level */
56 mmcr->pic.mpicmode = 0;
57 mmcr->pic.sl1picmode = 0;
58 mmcr->pic.sl2picmode = 0x80;
60 mmcr->pic.intpinpol = 0;
62 mmcr->pic.pit0map = 1;
63 mmcr->pic.uart1map = 0xc;
64 mmcr->pic.uart2map = 0xb;
66 mmcr->pic.ferrmap = 8;
67 mmcr->pic.gp0imap = 6;
68 mmcr->pic.gp1imap = 2;
69 mmcr->pic.gp2imap = 7;
70 mmcr->pic.gp6imap = 0x15;
71 mmcr->pic.gp7imap = 0x16;
72 mmcr->pic.gp10imap = 0x9;
73 mmcr->pic.gp9imap = 0x4;
80 printk_err("uart 1 ctl is 0x%x\n", *(unsigned char *) 0xfffefcc0);
82 printk_err("0xc20 ctl is 0x%x\n", *(unsigned short *) 0xfffefc20);
83 printk_err("0xc22 0x%x\n", *(unsigned short *) 0xfffefc22b);
85 /* The following block has NOT proven sufficient to get
86 * the VGA hardware to talk to us
88 /* let's set some mmcr stuff per the BIOS settings */
89 mmcr->dbctl.dbctl = 0x10;
91 mmcr->sysarb.menb = 0xf;
92 mmcr->sysarb.prictl = 0xc0000f0f;
93 /* this is bios setting, depends on sysarb above */
94 mmcr->hostbridge.ctl = 0x108;
95 printk_err("digital logic msm586 seg EXIT %s\n", __func__);
98 mmcr->pio.data31_16 = 0xffbf;
101 mmcr->pic.pciintamap = 0xa;
103 /* END block where vga hardware still will not talk to us */
104 /* all we get from VGA I/O addresses are ffff etc.
106 mmcr->sysmap.adddecctl = 0x10;
108 /* VGA now talks to us, so this adddecctl was the trick.
109 * still no interrupts from enet.
110 * Let's try fixing the piodata stuff, as there may be
111 * some wire there not documented.
113 mmcr->pio.data31_16 = 0xffbf;
114 /* also, our sl?picmode needs to match fuctory bios */
115 mmcr->pic.sl1picmode = 0x80;
116 mmcr->pic.sl2picmode = 0x0;
117 /* and, finally, they do set gp5imap and we don't.
119 mmcr->pic.gp5imap = 0xd;
120 /* remaining problem: almost certainly, the irq table is bogus
121 * NO SHOCK as it came from fuctory bios.
122 * but let's try these 4 changes for now and see what shakes.
124 /* still not interrupts. */
125 /* their IRQ table is wrong. Just hardwire it */
127 char pciints[4] = {15, 15, 15, 15};
128 pci_assign_irqs(0, 12, pciints);
130 /* the assigned failed but we just noticed -- there is no
131 * dma mapping, and selftest on e100 requires that dma work
133 /* follow fuctory here */
134 mmcr->dmacontrol.extchanmapa = 0x3210;
136 struct chip_operations mainboard_ops = {
137 CHIP_NAME("DIGITAL-LOGIC MSM586SEG Mainboard")
138 .enable_dev = enable_dev