Fix the indent and whitespace to match LinuxBIOS standards
[coreboot.git] / src / southbridge / amd / cs5536 / cs5536.c
1 /*
2 * This file is part of the LinuxBIOS project.
3 *
4 * Copyright (C) 2007 Advanced Micro Devices
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA      02110-1301 USA
18 */
19
20 #include <arch/io.h>
21 #include <device/device.h>
22 #include <device/pci.h>
23 #include <device/pci_ops.h>
24 #include <device/pci_ids.h>
25 #include <console/console.h>
26 #include <stdint.h>
27 #include <pc80/isa-dma.h>
28 #include <pc80/mc146818rtc.h>
29 #include <cpu/x86/msr.h>
30 #include <cpu/amd/vr.h>
31 #include <cpu/amd/geode_post_code.h>
32 #include "chip.h"
33 #include "cs5536.h"
34
35 extern void setup_i8259(void);
36
37 struct msrinit {
38         uint32_t msrnum;
39         msr_t msr;
40 };
41
42 /*      Master Configuration Register for Bus Masters.*/
43 struct msrinit SB_MASTER_CONF_TABLE[] = {
44         {USB2_SB_GLD_MSR_CONF, {.hi = 0,.lo = 0x00008f000}},
45         {ATA_SB_GLD_MSR_CONF,  {.hi = 0,.lo = 0x00048f000}},
46         {AC97_SB_GLD_MSR_CONF, {.hi = 0,.lo = 0x00008f000}},
47         {MDD_SB_GLD_MSR_CONF,  {.hi = 0,.lo = 0x00000f000}},
48         {0, {0, 0}}
49 };
50
51 /*      5536 Clock Gating*/
52 struct msrinit CS5536_CLOCK_GATING_TABLE[] = {
53         /* MSR            Setting*/
54         {GLIU_SB_GLD_MSR_PM,  {.hi = 0,.lo = 0x000000004}},
55         {GLPCI_SB_GLD_MSR_PM, {.hi = 0,.lo = 0x000000005}},
56         {GLCP_SB_GLD_MSR_PM,  {.hi = 0,.lo = 0x000000004}},
57         {MDD_SB_GLD_MSR_PM,   {.hi = 0,.lo = 0x050554111}},     /*  SMBus clock gating errata (PBZ 2226 & SiBZ 3977) */
58         {ATA_SB_GLD_MSR_PM,   {.hi = 0,.lo = 0x000000005}},
59         {AC97_SB_GLD_MSR_PM,  {.hi = 0,.lo = 0x000000005}},
60         {0, {0, 0}}
61 };
62
63 struct acpiinit {
64         uint16_t ioreg;
65         uint32_t regdata;
66 };
67
68 struct acpiinit acpi_init_table[] = {
69         {ACPI_IO_BASE + 0x00, 0x01000000},
70         {ACPI_IO_BASE + 0x08, 0},
71         {ACPI_IO_BASE + 0x0C, 0},
72         {ACPI_IO_BASE + 0x1C, 0},
73         {ACPI_IO_BASE + 0x18, 0x0FFFFFFFF},
74         {ACPI_IO_BASE + 0x00, 0x0000FFFF},
75         {PMS_IO_BASE + PM_SCLK, 0x000000E00},
76         {PMS_IO_BASE + PM_SED, 0x000004601},
77         {PMS_IO_BASE + PM_SIDD, 0x000008C02},
78         {PMS_IO_BASE + PM_WKD, 0x0000000A0},
79         {PMS_IO_BASE + PM_WKXD, 0x0000000A0},
80         {0, 0, 0}
81 };
82
83 struct FLASH_DEVICE {
84         unsigned char fType;    /* Flash type: NOR or NAND */
85         unsigned char fInterface;       /* Flash interface: I/O or Memory */
86         unsigned long fMask;    /* Flash size/mask */
87 };
88
89 struct FLASH_DEVICE FlashInitTable[] = {
90         {FLASH_TYPE_NAND, FLASH_IF_MEM, FLASH_MEM_4K},  /* CS0, or Flash Device 0 */
91         {FLASH_TYPE_NONE, 0, 0},        /* CS1, or Flash Device 1 */
92         {FLASH_TYPE_NONE, 0, 0},        /* CS2, or Flash Device 2 */
93         {FLASH_TYPE_NONE, 0, 0},        /* CS3, or Flash Device 3 */
94 };
95
96 #define FlashInitTableLen (sizeof(FlashInitTable)/sizeof(FlashInitTable[0]))
97
98 uint32_t FlashPort[] = {
99         MDD_LBAR_FLSH0,
100         MDD_LBAR_FLSH1,
101         MDD_LBAR_FLSH2,
102         MDD_LBAR_FLSH3
103 };
104
105 /* ***************************************************************************/
106 /* **/
107 /* *    pmChipsetInit*/
108 /* **/
109 /* *    Program ACPI LBAR and initialize ACPI registers.*/
110 /* **/
111 /* ***************************************************************************/
112 static void pmChipsetInit(void)
113 {
114         uint32_t val = 0;
115         uint16_t port;
116
117         port = (PMS_IO_BASE + 0x010);
118         val = 0x0E00;           /*  1ms */
119         outl(val, port);
120
121         /*      PM_WKXD */
122         /*      Make sure bits[3:0]=0000b to clear the */
123         /*      saved Sx state */
124         port = (PMS_IO_BASE + 0x034);
125         val = 0x0A0;            /*  5ms */
126         outl(val, port);
127
128         /*      PM_WKD */
129         port = (PMS_IO_BASE + 0x030);
130         outl(val, port);
131
132         /*      PM_SED */
133         port = (PMS_IO_BASE + 0x014);
134 /*      mov             eax, 0x057642   ; 100ms, works*/
135         val = 0x04601;          /*  5ms */
136         outl(val, port);
137
138         /*      PM_SIDD */
139         port = (PMS_IO_BASE + 0x020);
140 /*      mov             eax, 0x0AEC84   ; 200ms, works*/
141         val = 0x08C02;          /*  10ms */
142         outl(val, port);
143 }
144
145 /***************************************************************************
146  *
147  *      ChipsetFlashSetup
148  *
149  *      Flash LBARs need to be setup before VSA init so the PCI BARs have
150  *      correct size info.      Call this routine only if flash needs to be
151  *      configured (don't call it if you want IDE).
152  *
153  **************************************************************************/
154 static void ChipsetFlashSetup(void)
155 {
156         msr_t msr;
157         int i;
158         int numEnabled = 0;
159
160         printk_debug("ChipsetFlashSetup: Start\n");
161         for (i = 0; i < FlashInitTableLen; i++) {
162                 if (FlashInitTable[i].fType != FLASH_TYPE_NONE) {
163                         printk_debug("Enable CS%d\n", i);
164                         /* we need to configure the memory/IO mask */
165                         msr = rdmsr(FlashPort[i]);
166                         msr.hi = 0;     /* start with the "enabled" bit clear */
167                         if (FlashInitTable[i].fType == FLASH_TYPE_NAND)
168                                 msr.hi |= 0x00000002;
169                         else
170                                 msr.hi &= ~0x00000002;
171                         if (FlashInitTable[i].fInterface == FLASH_IF_MEM)
172                                 msr.hi |= 0x00000004;
173                         else
174                                 msr.hi &= ~0x00000004;
175                         msr.hi |= FlashInitTable[i].fMask;
176                         printk_debug("MSR(0x%08X, %08X_%08X)\n", FlashPort[i],
177                                      msr.hi, msr.lo);
178                         wrmsr(FlashPort[i], msr);
179
180                         /* now write-enable the device */
181                         msr = rdmsr(MDD_NORF_CNTRL);
182                         msr.lo |= (1 << i);
183                         printk_debug("MSR(0x%08X, %08X_%08X)\n", MDD_NORF_CNTRL,
184                                      msr.hi, msr.lo);
185                         wrmsr(MDD_NORF_CNTRL, msr);
186
187                         /* update the number enabled */
188                         numEnabled++;
189                 }
190         }
191
192         printk_debug("ChipsetFlashSetup: Finish\n");
193
194 }
195
196 /* ***************************************************************************/
197 /* **/
198 /* *    enable_ide_nand_flash_header */
199 /*              Run after VSA init to enable the flash PCI device header */
200 /* **/
201 /* ***************************************************************************/
202 static void enable_ide_nand_flash_header()
203 {
204         /* Tell VSA to use FLASH PCI header. Not IDE header. */
205         outl(0x80007A40, 0xCF8);
206         outl(0xDEADBEEF, 0xCFC);
207 }
208
209 #define RTC_CENTURY 0x32
210 #define RTC_DOMA        0x3D
211 #define RTC_MONA        0x3E
212
213 static void lpc_init(struct southbridge_amd_cs5536_config *sb)
214 {
215         msr_t msr;
216
217         if (sb->lpc_serirq_enable) {
218                 msr.lo = sb->lpc_serirq_enable;
219                 msr.hi = 0;
220                 wrmsr(MDD_IRQM_LPC, msr);
221                 if (sb->lpc_serirq_polarity) {
222                         msr.lo = sb->lpc_serirq_polarity << 16;
223                         msr.lo |= (sb->lpc_serirq_mode << 6) | (1 << 7);        /* enable */
224                         msr.hi = 0;
225                         wrmsr(MDD_LPC_SIRQ, msr);
226                 }
227         }
228
229         /* Allow DMA from LPC */
230         msr = rdmsr(MDD_DMA_MAP);
231         msr.lo = 0x7777;
232         wrmsr(MDD_DMA_MAP, msr);
233
234         /* enable the RTC/CMOS century byte at address 32h */
235         msr = rdmsr(MDD_RTC_CENTURY_OFFSET);
236         msr.lo = RTC_CENTURY;
237         wrmsr(MDD_RTC_CENTURY_OFFSET, msr);
238
239         /* enable the RTC/CMOS day of month and month alarms */
240         msr = rdmsr(MDD_RTC_DOMA_IND);
241         msr.lo = RTC_DOMA;
242         wrmsr(MDD_RTC_DOMA_IND, msr);
243
244         msr = rdmsr(MDD_RTC_MONA_IND);
245         msr.lo = RTC_MONA;
246         wrmsr(MDD_RTC_MONA_IND, msr);
247
248         rtc_init(0);
249
250         isa_dma_init();
251 }
252
253 static void uarts_init(struct southbridge_amd_cs5536_config *sb)
254 {
255         msr_t msr;
256         uint16_t addr;
257         uint32_t gpio_addr;
258         device_t dev;
259
260         dev = dev_find_device(PCI_VENDOR_ID_AMD, 
261                         PCI_DEVICE_ID_AMD_CS5536_ISA, 0);
262         gpio_addr = pci_read_config32(dev, PCI_BASE_ADDRESS_1);
263         gpio_addr &= ~1;        /* clear IO bit */
264         printk_debug("GPIO_ADDR: %08X\n", gpio_addr);
265
266         /* This could be extended to support IR modes */
267
268         /* COM1 */
269         if (sb->com1_enable) {
270                 /* Set the address */
271                 switch (sb->com1_address) {
272                 case 0x3F8:
273                         addr = 7;
274                         break;
275
276                 case 0x3E8:
277                         addr = 6;
278                         break;
279
280                 case 0x2F8:
281                         addr = 5;
282                         break;
283
284                 case 0x2E8:
285                         addr = 4;
286                         break;
287                 }
288                 msr = rdmsr(MDD_LEG_IO);
289                 msr.lo |= addr << 16;
290                 wrmsr(MDD_LEG_IO, msr);
291
292                 /* Set the IRQ */
293                 msr = rdmsr(MDD_IRQM_YHIGH);
294                 msr.lo |= sb->com1_irq << 24;
295                 wrmsr(MDD_IRQM_YHIGH, msr);
296
297                 /* GPIO8 - UART1_TX */
298                 /* Set: Output Enable  (0x4) */
299                 outl(GPIOL_8_SET, gpio_addr + GPIOL_OUTPUT_ENABLE);
300                 /* Set: OUTAUX1 Select (0x10) */
301                 outl(GPIOL_8_SET, gpio_addr + GPIOL_OUT_AUX1_SELECT);
302
303                 /* GPIO8 - UART1_RX */
304                 /* Set: Input Enable   (0x20) */
305                 outl(GPIOL_9_SET, gpio_addr + GPIOL_INPUT_ENABLE);
306                 /* Set: INAUX1 Select  (0x34) */
307                 outl(GPIOL_9_SET, gpio_addr + GPIOL_IN_AUX1_SELECT);
308
309                 /* Set: GPIO 8 + 9 Pull Up         (0x18) */
310                 outl(GPIOL_8_SET | GPIOL_9_SET,
311                      gpio_addr + GPIOL_PULLUP_ENABLE);
312
313                 /* enable COM1 */
314                 /* Bit 1 = device enable Bit 4 = allow access to the upper banks */
315                 msr.lo = (1 << 4) | (1 << 1);
316                 msr.hi = 0;
317                 wrmsr(MDD_UART1_CONF, msr);
318
319         } else {
320                 /* Reset and disable COM1 */
321                 printk_err("Not disabling COM1 due to a bug ...\n");
322                 /* for now, don't do this! */
323                 return;
324                 msr = rdmsr(MDD_UART1_CONF);
325                 msr.lo = 1;     // reset
326                 wrmsr(MDD_UART1_CONF, msr);
327                 msr.lo = 0;     // disabled
328                 wrmsr(MDD_UART1_CONF, msr);
329
330                 /* Disable the IRQ */
331                 msr = rdmsr(MDD_LEG_IO);
332                 msr.lo |= ~(0xF << 16);
333                 wrmsr(MDD_LEG_IO, msr);
334         }
335
336         /* COM2 */
337         if (sb->com2_enable) {
338                 switch (sb->com2_address) {
339                 case 0x3F8:
340                         addr = 7;
341                         break;
342
343                 case 0x3E8:
344                         addr = 6;
345                         break;
346
347                 case 0x2F8:
348                         addr = 5;
349                         break;
350
351                 case 0x2E8:
352                         addr = 4;
353                         break;
354                 }
355                 msr = rdmsr(MDD_LEG_IO);
356                 msr.lo |= addr << 20;
357                 wrmsr(MDD_LEG_IO, msr);
358
359                 /* Set the IRQ */
360                 msr = rdmsr(MDD_IRQM_YHIGH);
361                 msr.lo |= sb->com2_irq << 28;
362                 wrmsr(MDD_IRQM_YHIGH, msr);
363
364                 /* GPIO3 - UART2_RX */
365                 /* Set: Output Enable  (0x4) */
366                 outl(GPIOL_3_SET, gpio_addr + GPIOL_OUTPUT_ENABLE);
367                 /* Set: OUTAUX1 Select (0x10) */
368                 outl(GPIOL_3_SET, gpio_addr + GPIOL_OUT_AUX1_SELECT);
369
370                 /* GPIO4 - UART2_TX */
371                 /* Set: Input Enable   (0x20) */
372                 outl(GPIOL_4_SET, gpio_addr + GPIOL_INPUT_ENABLE);
373                 /* Set: INAUX1 Select  (0x34) */
374                 outl(GPIOL_4_SET, gpio_addr + GPIOL_IN_AUX1_SELECT);
375
376                 /* Set: GPIO 3 + 3 Pull Up         (0x18) */
377                 outl(GPIOL_3_SET | GPIOL_4_SET,
378                      gpio_addr + GPIOL_PULLUP_ENABLE);
379
380                 /* enable COM2 */
381                 /* Bit 1 = device enable Bit 4 = allow access to the upper banks */
382                 msr.lo = (1 << 4) | (1 << 1);
383                 msr.hi = 0;
384                 wrmsr(MDD_UART2_CONF, msr);
385
386         } else {
387                 /* Reset and disable COM2 */
388                 msr = rdmsr(MDD_UART2_CONF);
389                 msr.lo = 1;     // reset
390                 wrmsr(MDD_UART2_CONF, msr);
391                 msr.lo = 0;     // disabled
392                 wrmsr(MDD_UART2_CONF, msr);
393
394                 /* Disable the IRQ */
395                 msr = rdmsr(MDD_LEG_IO);
396                 msr.lo |= ~(0xF << 20);
397                 wrmsr(MDD_LEG_IO, msr);
398         }
399 }
400
401 #define HCCPARAMS               0x08
402 #define IPREG04                 0xA0
403         #define USB_HCCPW_SET   (1 << 1)
404 #define UOCCAP                  0x00
405         #define APU_SET                 (1 << 15)
406 #define UOCMUX                  0x04
407 #define PMUX_HOST               0x02
408 #define PMUX_DEVICE             0x03
409         #define PUEN_SET                (1 << 2)
410 #define UDCDEVCTL               0x404
411         #define UDC_SD_SET              (1 << 10)
412 #define UOCCTL                  0x0C
413         #define PADEN_SET               (1 << 7)
414
415 static void enable_USB_port4(struct southbridge_amd_cs5536_config *sb)
416 {
417         uint32_t *bar;
418         msr_t msr;
419         device_t dev;
420
421         dev = dev_find_device(PCI_VENDOR_ID_AMD, 
422                         PCI_DEVICE_ID_AMD_CS5536_EHCI, 0);
423         if (dev) {
424
425                 /* Serial Short Detect Enable */
426                 msr = rdmsr(USB2_SB_GLD_MSR_CONF);
427                 msr.hi |= USB2_UPPER_SSDEN_SET;
428                 wrmsr(USB2_SB_GLD_MSR_CONF, msr);
429
430                 /* write to clear diag register */
431                 wrmsr(USB2_SB_GLD_MSR_DIAG, rdmsr(USB2_SB_GLD_MSR_DIAG));
432
433                 bar = (uint32_t *) pci_read_config32(dev, PCI_BASE_ADDRESS_0);
434
435                 /* Make HCCPARAMS writeable */
436                 *(bar + IPREG04) |= USB_HCCPW_SET;
437
438                 /* ; EECP=50h, IST=01h, ASPC=1 */
439                 *(bar + HCCPARAMS) = 0x00005012;
440         }
441
442         dev = dev_find_device(PCI_VENDOR_ID_AMD, 
443                         PCI_DEVICE_ID_AMD_CS5536_OTG, 0);
444         if (dev) {
445                 bar = (uint32_t *) pci_read_config32(dev, PCI_BASE_ADDRESS_0);
446
447                 *(bar + UOCMUX) &= PUEN_SET;
448
449                 /* Host or Device? */
450                 if (sb->enable_USBP4_device) {
451                         *(bar + UOCMUX) |= PMUX_DEVICE;
452                 } else {
453                         *(bar + UOCMUX) |= PMUX_HOST;
454                 }
455
456                 /* Overcurrent configuration */
457                 if (sb->enable_USBP4_overcurrent) {
458                         *(bar + UOCCAP) |= sb->enable_USBP4_overcurrent;
459                 }
460         }
461
462         /* PBz#6466: If the UOC(OTG) device, port 4, is configured as a device,
463          *      then perform the following sequence:
464          *
465          * - set SD bit in DEVCTRL udc register
466          * - set PADEN (former OTGPADEN) bit in uoc register
467          * - set APU bit in uoc register */
468         if (sb->enable_USBP4_device) {
469                 dev = dev_find_device(PCI_VENDOR_ID_AMD, 
470                                 PCI_DEVICE_ID_AMD_CS5536_UDC, 0);
471                 if (dev) {
472                         bar = (uint32_t *) pci_read_config32(dev, 
473                                         PCI_BASE_ADDRESS_0);
474                         *(bar + UDCDEVCTL) |= UDC_SD_SET;
475
476                 }
477
478                 dev = dev_find_device(PCI_VENDOR_ID_AMD,
479                                 PCI_DEVICE_ID_AMD_CS5536_OTG, 0);
480                 if (dev) {
481                         bar = (uint32_t *) pci_read_config32(dev,
482                                         PCI_BASE_ADDRESS_0);
483                         *(bar + UOCCTL) |= PADEN_SET;
484                         *(bar + UOCCAP) |= APU_SET;
485                 }
486         }
487
488         /* Disable virtual PCI UDC and OTG headers */
489         dev = dev_find_device(PCI_VENDOR_ID_AMD, 
490                         PCI_DEVICE_ID_AMD_CS5536_UDC, 0);
491         if (dev) {
492                 pci_write_config8(dev, 0x7C, 0xDEADBEEF);
493         }
494
495         dev = dev_find_device(PCI_VENDOR_ID_AMD, 
496                         PCI_DEVICE_ID_AMD_CS5536_OTG, 0);
497         if (dev) {
498                 pci_write_config8(dev, 0x7C, 0xDEADBEEF);
499         }
500 }
501
502 /* ***************************************************************************/
503 /* **/
504 /* *    ChipsetInit */
505 /*                      Called from northbridge init (Pre-VSA). */
506 /* **/
507 /* ***************************************************************************/
508 void chipsetinit(void)
509 {
510         device_t dev;
511         msr_t msr;
512         uint32_t msrnum;
513         struct southbridge_amd_cs5536_config *sb =
514             (struct southbridge_amd_cs5536_config *)dev->chip_info;
515         struct msrinit *csi;
516
517         outb(P80_CHIPSET_INIT, 0x80);
518
519         /* we hope NEVER to be in linuxbios when S3 resumes
520            if (! IsS3Resume()) */
521         {
522                 struct acpiinit *aci = acpi_init_table;
523                 for (; aci->ioreg; aci++) {
524                         outl(aci->regdata, aci->ioreg);
525                         inl(aci->ioreg);
526                 }
527
528                 pmChipsetInit();
529         }
530
531         /* set hd IRQ */
532         outl(GPIOL_2_SET, GPIO_IO_BASE + GPIOL_INPUT_ENABLE);
533         outl(GPIOL_2_SET, GPIO_IO_BASE + GPIOL_IN_AUX1_SELECT);
534
535         /*      Allow IO read and writes during a ATA DMA operation. */
536         /*       This could be done in the HD rom but do it here for easier debugging. */
537         msrnum = ATA_SB_GLD_MSR_ERR;
538         msr = rdmsr(msrnum);
539         msr.lo &= ~0x100;
540         wrmsr(msrnum, msr);
541
542         /*      Enable Post Primary IDE. */
543         msrnum = GLPCI_SB_CTRL;
544         msr = rdmsr(msrnum);
545         msr.lo |= GLPCI_CRTL_PPIDE_SET;
546         wrmsr(msrnum, msr);
547
548         csi = SB_MASTER_CONF_TABLE;
549         for (; csi->msrnum; csi++) {
550                 msr.lo = csi->msr.lo;
551                 msr.hi = csi->msr.hi;
552                 wrmsr(csi->msrnum, msr);        // MSR - see table above
553         }
554
555         /*      Flash BAR size Setup */
556         printk_err("%sDoing ChipsetFlashSetup()\n",
557                    sb->enable_ide_nand_flash == 1 ? "" : "Not ");
558         if (sb->enable_ide_nand_flash == 1)
559                 ChipsetFlashSetup();
560
561         /* */
562         /*      Set up Hardware Clock Gating */
563         /* */
564         {
565                 csi = CS5536_CLOCK_GATING_TABLE;
566                 for (; csi->msrnum; csi++) {
567                         msr.lo = csi->msr.lo;
568                         msr.hi = csi->msr.hi;
569                         wrmsr(csi->msrnum, msr);        // MSR - see table above
570                 }
571         }
572 }
573
574 static void southbridge_init(struct device *dev)
575 {
576         struct southbridge_amd_cs5536_config *sb =
577             (struct southbridge_amd_cs5536_config *)dev->chip_info;
578         int i;
579         /*
580          * struct device *gpiodev;
581          * unsigned short gpiobase = MDD_GPIO;
582          */
583
584         printk_err("cs5536: %s\n", __FUNCTION__);
585         setup_i8259();
586         lpc_init(sb);
587         uarts_init(sb);
588
589         if (sb->enable_gpio_int_route) {
590                 vrWrite((VRC_MISCELLANEOUS << 8) + PCI_INT_AB,
591                         (sb->enable_gpio_int_route & 0xFFFF));
592                 vrWrite((VRC_MISCELLANEOUS << 8) + PCI_INT_CD,
593                         (sb->enable_gpio_int_route >> 16));
594         }
595
596         printk_err("cs5536: %s: enable_ide_nand_flash is %d\n", __FUNCTION__,
597                    sb->enable_ide_nand_flash);
598         if (sb->enable_ide_nand_flash == 1) {
599                 enable_ide_nand_flash_header();
600         }
601
602         enable_USB_port4(sb);
603
604         /* disable unwanted virtual PCI devices */
605         for (i = 0; (i < MAX_UNWANTED_VPCI) && (0 != sb->unwanted_vpci[i]); i++) {
606                 printk_debug("Disabling VPCI device: 0x%08X\n",
607                              sb->unwanted_vpci[i]);
608                 outl(sb->unwanted_vpci[i] + 0x7C, 0xCF8);
609                 outl(0xDEADBEEF, 0xCFC);
610         }
611 }
612
613 static void southbridge_enable(struct device *dev)
614 {
615         printk_err("cs5536: %s: dev is %p\n", __FUNCTION__, dev);
616
617 }
618
619 static void cs5536_pci_dev_enable_resources(device_t dev)
620 {
621         printk_err("cs5536: %s()\n", __FUNCTION__);
622         pci_dev_enable_resources(dev);
623         enable_childrens_resources(dev);
624 }
625
626 static struct device_operations southbridge_ops = {
627         .read_resources = pci_dev_read_resources,
628         .set_resources = pci_dev_set_resources,
629         .enable_resources = cs5536_pci_dev_enable_resources,
630         .init = southbridge_init,
631 //      .enable                   = southbridge_enable,
632         .scan_bus = scan_static_bus,
633 };
634
635 static struct pci_driver cs5536_pci_driver __pci_driver = {
636         .ops = &southbridge_ops,
637         .vendor = PCI_VENDOR_ID_AMD,
638         .device = PCI_DEVICE_ID_AMD_CS5536_ISA
639 };
640
641 struct chip_operations southbridge_amd_cs5536_ops = {
642         CHIP_NAME("AMD Geode CS5536 Southbridge")
643             /* This is only called when this device is listed in the
644              * static device tree.
645              */
646             .enable_dev = southbridge_enable,
647 };