There was a programming error which made most USB port4 setup wrong. This patch uses...
[coreboot.git] / src / southbridge / amd / cs5536 / cs5536.c
1 /*
2  * This file is part of the coreboot project.
3  *
4  * Copyright (C) 2007 Advanced Micro Devices, Inc.
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         val = 0x04601;          /*  5ms, # of 3.57954MHz clock edges */
135         outl(val, port);
136
137         /*      PM_SIDD */
138         port = (PMS_IO_BASE + 0x020);
139         val = 0x08C02;          /*  10ms, # of 3.57954MHz clock edges */
140         outl(val, port);
141 }
142
143 /***************************************************************************
144  *
145  *      ChipsetFlashSetup
146  *
147  *      Flash LBARs need to be setup before VSA init so the PCI BARs have
148  *      correct size info.      Call this routine only if flash needs to be
149  *      configured (don't call it if you want IDE).
150  *
151  **************************************************************************/
152 static void ChipsetFlashSetup(void)
153 {
154         msr_t msr;
155         int i;
156         int numEnabled = 0;
157
158         printk_debug("ChipsetFlashSetup: Start\n");
159         for (i = 0; i < FlashInitTableLen; i++) {
160                 if (FlashInitTable[i].fType != FLASH_TYPE_NONE) {
161                         printk_debug("Enable CS%d\n", i);
162                         /* we need to configure the memory/IO mask */
163                         msr = rdmsr(FlashPort[i]);
164                         msr.hi = 0;     /* start with the "enabled" bit clear */
165                         if (FlashInitTable[i].fType == FLASH_TYPE_NAND)
166                                 msr.hi |= 0x00000002;
167                         else
168                                 msr.hi &= ~0x00000002;
169                         if (FlashInitTable[i].fInterface == FLASH_IF_MEM)
170                                 msr.hi |= 0x00000004;
171                         else
172                                 msr.hi &= ~0x00000004;
173                         msr.hi |= FlashInitTable[i].fMask;
174                         printk_debug("MSR(0x%08X, %08X_%08X)\n", FlashPort[i],
175                                      msr.hi, msr.lo);
176                         wrmsr(FlashPort[i], msr);
177
178                         /* now write-enable the device */
179                         msr = rdmsr(MDD_NORF_CNTRL);
180                         msr.lo |= (1 << i);
181                         printk_debug("MSR(0x%08X, %08X_%08X)\n", MDD_NORF_CNTRL,
182                                      msr.hi, msr.lo);
183                         wrmsr(MDD_NORF_CNTRL, msr);
184
185                         /* update the number enabled */
186                         numEnabled++;
187                 }
188         }
189
190         printk_debug("ChipsetFlashSetup: Finish\n");
191
192 }
193
194 /* ***************************************************************************/
195 /* **/
196 /* *    enable_ide_nand_flash_header */
197 /*              Run after VSA init to enable the flash PCI device header */
198 /* **/
199 /* ***************************************************************************/
200 static void enable_ide_nand_flash_header()
201 {
202         /* Tell VSA to use FLASH PCI header. Not IDE header. */
203         outl(0x80007A40, 0xCF8);
204         outl(0xDEADBEEF, 0xCFC);
205 }
206
207 #define RTC_CENTURY 0x32
208 #define RTC_DOMA        0x3D
209 #define RTC_MONA        0x3E
210
211 static void lpc_init(struct southbridge_amd_cs5536_config *sb)
212 {
213         msr_t msr;
214
215         if (sb->lpc_serirq_enable) {
216                 msr.lo = sb->lpc_serirq_enable;
217                 msr.hi = 0;
218                 wrmsr(MDD_IRQM_LPC, msr);
219                 if (sb->lpc_serirq_polarity) {
220                         msr.lo = sb->lpc_serirq_polarity << 16;
221                         msr.lo |= (sb->lpc_serirq_mode << 6) | (1 << 7);        /* enable */
222                         msr.hi = 0;
223                         wrmsr(MDD_LPC_SIRQ, msr);
224                 }
225         }
226
227         /* Allow DMA from LPC */
228         msr = rdmsr(MDD_DMA_MAP);
229         msr.lo = 0x7777;
230         wrmsr(MDD_DMA_MAP, msr);
231
232         /* enable the RTC/CMOS century byte at address 32h */
233         msr = rdmsr(MDD_RTC_CENTURY_OFFSET);
234         msr.lo = RTC_CENTURY;
235         wrmsr(MDD_RTC_CENTURY_OFFSET, msr);
236
237         /* enable the RTC/CMOS day of month and month alarms */
238         msr = rdmsr(MDD_RTC_DOMA_IND);
239         msr.lo = RTC_DOMA;
240         wrmsr(MDD_RTC_DOMA_IND, msr);
241
242         msr = rdmsr(MDD_RTC_MONA_IND);
243         msr.lo = RTC_MONA;
244         wrmsr(MDD_RTC_MONA_IND, msr);
245
246         rtc_init(0);
247
248         isa_dma_init();
249 }
250
251 static void uarts_init(struct southbridge_amd_cs5536_config *sb)
252 {
253         msr_t msr;
254         uint16_t addr;
255         uint32_t gpio_addr;
256         device_t dev;
257
258         dev = dev_find_device(PCI_VENDOR_ID_AMD, 
259                         PCI_DEVICE_ID_AMD_CS5536_ISA, 0);
260         gpio_addr = pci_read_config32(dev, PCI_BASE_ADDRESS_1);
261         gpio_addr &= ~1;        /* clear IO bit */
262         printk_debug("GPIO_ADDR: %08X\n", gpio_addr);
263
264         /* This could be extended to support IR modes */
265
266         /* COM1 */
267         if (sb->com1_enable) {
268                 /* Set the address */
269                 switch (sb->com1_address) {
270                 case 0x3F8:
271                         addr = 7;
272                         break;
273
274                 case 0x3E8:
275                         addr = 6;
276                         break;
277
278                 case 0x2F8:
279                         addr = 5;
280                         break;
281
282                 case 0x2E8:
283                         addr = 4;
284                         break;
285                 }
286                 msr = rdmsr(MDD_LEG_IO);
287                 msr.lo |= addr << 16;
288                 wrmsr(MDD_LEG_IO, msr);
289
290                 /* Set the IRQ */
291                 msr = rdmsr(MDD_IRQM_YHIGH);
292                 msr.lo |= sb->com1_irq << 24;
293                 wrmsr(MDD_IRQM_YHIGH, msr);
294
295                 /* GPIO8 - UART1_TX */
296                 /* Set: Output Enable  (0x4) */
297                 outl(GPIOL_8_SET, gpio_addr + GPIOL_OUTPUT_ENABLE);
298                 /* Set: OUTAUX1 Select (0x10) */
299                 outl(GPIOL_8_SET, gpio_addr + GPIOL_OUT_AUX1_SELECT);
300
301                 /* GPIO8 - UART1_RX */
302                 /* Set: Input Enable   (0x20) */
303                 outl(GPIOL_9_SET, gpio_addr + GPIOL_INPUT_ENABLE);
304                 /* Set: INAUX1 Select  (0x34) */
305                 outl(GPIOL_9_SET, gpio_addr + GPIOL_IN_AUX1_SELECT);
306
307                 /* Set: GPIO 8 + 9 Pull Up         (0x18) */
308                 outl(GPIOL_8_SET | GPIOL_9_SET,
309                      gpio_addr + GPIOL_PULLUP_ENABLE);
310
311                 /* enable COM1 */
312                 /* Bit 1 = device enable Bit 4 = allow access to the upper banks */
313                 msr.lo = (1 << 4) | (1 << 1);
314                 msr.hi = 0;
315                 wrmsr(MDD_UART1_CONF, msr);
316
317         } else {
318                 /* Reset and disable COM1 */
319                 msr = rdmsr(MDD_UART1_CONF);
320                 msr.lo = 1;     // reset
321                 wrmsr(MDD_UART1_CONF, msr);
322                 msr.lo = 0;     // disabled
323                 wrmsr(MDD_UART1_CONF, msr);
324
325                 /* Disable the IRQ */
326                 msr = rdmsr(MDD_LEG_IO);
327                 msr.lo &= ~(0xF << 16);
328                 wrmsr(MDD_LEG_IO, msr);
329         }
330
331         /* COM2 */
332         if (sb->com2_enable) {
333                 switch (sb->com2_address) {
334                 case 0x3F8:
335                         addr = 7;
336                         break;
337
338                 case 0x3E8:
339                         addr = 6;
340                         break;
341
342                 case 0x2F8:
343                         addr = 5;
344                         break;
345
346                 case 0x2E8:
347                         addr = 4;
348                         break;
349                 }
350                 msr = rdmsr(MDD_LEG_IO);
351                 msr.lo |= addr << 20;
352                 wrmsr(MDD_LEG_IO, msr);
353
354                 /* Set the IRQ */
355                 msr = rdmsr(MDD_IRQM_YHIGH);
356                 msr.lo |= sb->com2_irq << 28;
357                 wrmsr(MDD_IRQM_YHIGH, msr);
358
359                 /* GPIO4 - UART2_RX */
360                 /* Set: Output Enable (0x4) */
361                 outl(GPIOL_4_SET, gpio_addr + GPIOL_OUTPUT_ENABLE);
362                 /* Set: OUTAUX1 Select (0x10) */
363                 outl(GPIOL_4_SET, gpio_addr + GPIOL_OUT_AUX1_SELECT);
364
365                 /* GPIO3 - UART2_TX */
366                 /* Set: Input Enable (0x20) */
367                 outl(GPIOL_3_SET, gpio_addr + GPIOL_INPUT_ENABLE);
368                 /* Set: INAUX1 Select (0x34) */
369                 outl(GPIOL_3_SET, gpio_addr + GPIOL_IN_AUX1_SELECT);
370
371                 /* Set: GPIO 3 and 4 Pull Up (0x18) */
372                 outl(GPIOL_3_SET | GPIOL_4_SET,
373                      gpio_addr + GPIOL_PULLUP_ENABLE);
374
375                 /* enable COM2 */
376                 /* Bit 1 = device enable Bit 4 = allow access to the upper banks */
377                 msr.lo = (1 << 4) | (1 << 1);
378                 msr.hi = 0;
379                 wrmsr(MDD_UART2_CONF, msr);
380
381         } else {
382                 /* Reset and disable COM2 */
383                 msr = rdmsr(MDD_UART2_CONF);
384                 msr.lo = 1;     // reset
385                 wrmsr(MDD_UART2_CONF, msr);
386                 msr.lo = 0;     // disabled
387                 wrmsr(MDD_UART2_CONF, msr);
388
389                 /* Disable the IRQ */
390                 msr = rdmsr(MDD_LEG_IO);
391                 msr.lo &= ~(0xF << 20);
392                 wrmsr(MDD_LEG_IO, msr);
393         }
394 }
395
396 #define HCCPARAMS               0x08
397 #define IPREG04                 0xA0
398         #define USB_HCCPW_SET   (1 << 1)
399 #define UOCCAP                  0x00
400         #define APU_SET                 (1 << 15)
401 #define UOCMUX                  0x04
402 #define PMUX_HOST               0x02
403 #define PMUX_DEVICE             0x03
404         #define PUEN_SET                (1 << 2)
405 #define UDCDEVCTL               0x404
406         #define UDC_SD_SET              (1 << 10)
407 #define UOCCTL                  0x0C
408         #define PADEN_SET               (1 << 7)
409
410 static void enable_USB_port4(struct southbridge_amd_cs5536_config *sb)
411 {
412         uint8_t *bar;
413         msr_t msr;
414         device_t dev;
415
416         dev = dev_find_device(PCI_VENDOR_ID_AMD, 
417                         PCI_DEVICE_ID_AMD_CS5536_EHCI, 0);
418         if (dev) {
419
420                 /* Serial Short Detect Enable */
421                 msr = rdmsr(USB2_SB_GLD_MSR_CONF);
422                 msr.hi |= USB2_UPPER_SSDEN_SET;
423                 wrmsr(USB2_SB_GLD_MSR_CONF, msr);
424
425                 /* write to clear diag register */
426                 wrmsr(USB2_SB_GLD_MSR_DIAG, rdmsr(USB2_SB_GLD_MSR_DIAG));
427
428                 bar = (uint8_t *) pci_read_config32(dev, PCI_BASE_ADDRESS_0);
429
430                 /* Make HCCPARAMS writeable */
431                 writel(readl(bar + IPREG04) | USB_HCCPW_SET, bar + IPREG04);
432
433                 /* ; EECP=50h, IST=01h, ASPC=1 */
434                 writel(0x00005012, bar + HCCPARAMS);
435         }
436
437         dev = dev_find_device(PCI_VENDOR_ID_AMD, 
438                         PCI_DEVICE_ID_AMD_CS5536_OTG, 0);
439         if (dev) {
440                 bar = (uint8_t *) pci_read_config32(dev, PCI_BASE_ADDRESS_0);
441
442                 writel(readl(bar + UOCMUX) & PUEN_SET, bar + UOCMUX);
443
444                 /* Host or Device? */
445                 if (sb->enable_USBP4_device) {
446                         writel(readl(bar + UOCMUX) | PMUX_DEVICE, bar + UOCMUX);
447                 } else {
448                         writel(readl(bar + UOCMUX) | PMUX_HOST, bar + UOCMUX);
449                 }
450
451                 /* Overcurrent configuration */
452                 if (sb->enable_USBP4_overcurrent) {
453                         writel(readl(bar + UOCCAP)
454                                | sb->enable_USBP4_overcurrent, bar + UOCCAP);
455                 }
456         }
457
458         /* PBz#6466: If the UOC(OTG) device, port 4, is configured as a device,
459          *      then perform the following sequence:
460          *
461          * - set SD bit in DEVCTRL udc register
462          * - set PADEN (former OTGPADEN) bit in uoc register
463          * - set APU bit in uoc register */
464         if (sb->enable_USBP4_device) {
465                 dev = dev_find_device(PCI_VENDOR_ID_AMD, 
466                                 PCI_DEVICE_ID_AMD_CS5536_UDC, 0);
467                 if (dev) {
468                         bar = (uint8_t *) pci_read_config32(dev, 
469                                         PCI_BASE_ADDRESS_0);
470                         writel(readl(bar + UDCDEVCTL) | UDC_SD_SET,
471                                bar + UDCDEVCTL);
472
473                 }
474
475                 dev = dev_find_device(PCI_VENDOR_ID_AMD,
476                                 PCI_DEVICE_ID_AMD_CS5536_OTG, 0);
477                 if (dev) {
478                         bar = (uint8_t *) pci_read_config32(dev,
479                                         PCI_BASE_ADDRESS_0);
480                         writel(readl(bar + UOCCTL) | PADEN_SET, bar + UOCCTL);
481                         writel(readl(bar + UOCCAP) | APU_SET, bar + UOCCAP);
482                 }
483         }
484
485         /* Disable virtual PCI UDC and OTG headers */
486         dev = dev_find_device(PCI_VENDOR_ID_AMD, 
487                         PCI_DEVICE_ID_AMD_CS5536_UDC, 0);
488         if (dev) {
489                 pci_write_config32(dev, 0x7C, 0xDEADBEEF);
490         }
491
492         dev = dev_find_device(PCI_VENDOR_ID_AMD, 
493                         PCI_DEVICE_ID_AMD_CS5536_OTG, 0);
494         if (dev) {
495                 pci_write_config32(dev, 0x7C, 0xDEADBEEF);
496         }
497 }
498
499 /* ***************************************************************************/
500 /* **/
501 /* *    ChipsetInit */
502 /*                      Called from northbridge init (Pre-VSA). */
503 /* **/
504 /* ***************************************************************************/
505 void chipsetinit(void)
506 {
507         device_t dev;
508         msr_t msr;
509         uint32_t msrnum;
510         struct southbridge_amd_cs5536_config *sb =
511             (struct southbridge_amd_cs5536_config *)dev->chip_info;
512         struct msrinit *csi;
513
514         post_code(P80_CHIPSET_INIT);
515
516         /* we hope NEVER to be in coreboot when S3 resumes
517            if (! IsS3Resume()) */
518         {
519                 struct acpiinit *aci = acpi_init_table;
520                 for (; aci->ioreg; aci++) {
521                         outl(aci->regdata, aci->ioreg);
522                         inl(aci->ioreg);
523                 }
524
525                 pmChipsetInit();
526         }
527
528         /* set hd IRQ */
529         outl(GPIOL_2_SET, GPIO_IO_BASE + GPIOL_INPUT_ENABLE);
530         outl(GPIOL_2_SET, GPIO_IO_BASE + GPIOL_IN_AUX1_SELECT);
531
532         /*      Allow IO read and writes during a ATA DMA operation. */
533         /*       This could be done in the HD rom but do it here for easier debugging. */
534         msrnum = ATA_SB_GLD_MSR_ERR;
535         msr = rdmsr(msrnum);
536         msr.lo &= ~0x100;
537         wrmsr(msrnum, msr);
538
539         /*      Enable Post Primary IDE. */
540         msrnum = GLPCI_SB_CTRL;
541         msr = rdmsr(msrnum);
542         msr.lo |= GLPCI_CRTL_PPIDE_SET;
543         wrmsr(msrnum, msr);
544
545         csi = SB_MASTER_CONF_TABLE;
546         for (; csi->msrnum; csi++) {
547                 msr.lo = csi->msr.lo;
548                 msr.hi = csi->msr.hi;
549                 wrmsr(csi->msrnum, msr);        // MSR - see table above
550         }
551
552         /*      Flash BAR size Setup */
553         printk_err("%sDoing ChipsetFlashSetup()\n",
554                    sb->enable_ide_nand_flash == 1 ? "" : "Not ");
555         if (sb->enable_ide_nand_flash == 1)
556                 ChipsetFlashSetup();
557
558         /* */
559         /*      Set up Hardware Clock Gating */
560         /* */
561         {
562                 csi = CS5536_CLOCK_GATING_TABLE;
563                 for (; csi->msrnum; csi++) {
564                         msr.lo = csi->msr.lo;
565                         msr.hi = csi->msr.hi;
566                         wrmsr(csi->msrnum, msr);        // MSR - see table above
567                 }
568         }
569 }
570
571 static void southbridge_init(struct device *dev)
572 {
573         struct southbridge_amd_cs5536_config *sb =
574             (struct southbridge_amd_cs5536_config *)dev->chip_info;
575         int i;
576         /*
577          * struct device *gpiodev;
578          * unsigned short gpiobase = MDD_GPIO;
579          */
580
581         printk_err("cs5536: %s\n", __FUNCTION__);
582         setup_i8259();
583         lpc_init(sb);
584         uarts_init(sb);
585
586         if (sb->enable_gpio_int_route) {
587                 vrWrite((VRC_MISCELLANEOUS << 8) + PCI_INT_AB,
588                         (sb->enable_gpio_int_route & 0xFFFF));
589                 vrWrite((VRC_MISCELLANEOUS << 8) + PCI_INT_CD,
590                         (sb->enable_gpio_int_route >> 16));
591         }
592
593         printk_err("cs5536: %s: enable_ide_nand_flash is %d\n", __FUNCTION__,
594                    sb->enable_ide_nand_flash);
595         if (sb->enable_ide_nand_flash == 1) {
596                 enable_ide_nand_flash_header();
597         }
598
599         enable_USB_port4(sb);
600
601         /* disable unwanted virtual PCI devices */
602         for (i = 0; (i < MAX_UNWANTED_VPCI) && (0 != sb->unwanted_vpci[i]); i++) {
603                 printk_debug("Disabling VPCI device: 0x%08X\n",
604                              sb->unwanted_vpci[i]);
605                 outl(sb->unwanted_vpci[i] + 0x7C, 0xCF8);
606                 outl(0xDEADBEEF, 0xCFC);
607         }
608 }
609
610 static void southbridge_enable(struct device *dev)
611 {
612         printk_err("cs5536: %s: dev is %p\n", __FUNCTION__, dev);
613
614 }
615
616 static void cs5536_pci_dev_enable_resources(device_t dev)
617 {
618         printk_err("cs5536: %s()\n", __FUNCTION__);
619         pci_dev_enable_resources(dev);
620         enable_childrens_resources(dev);
621 }
622
623 static struct device_operations southbridge_ops = {
624         .read_resources = pci_dev_read_resources,
625         .set_resources = pci_dev_set_resources,
626         .enable_resources = cs5536_pci_dev_enable_resources,
627         .init = southbridge_init,
628 //      .enable                   = southbridge_enable,
629         .scan_bus = scan_static_bus,
630 };
631
632 static const struct pci_driver cs5536_pci_driver __pci_driver = {
633         .ops = &southbridge_ops,
634         .vendor = PCI_VENDOR_ID_AMD,
635         .device = PCI_DEVICE_ID_AMD_CS5536_ISA
636 };
637
638 struct chip_operations southbridge_amd_cs5536_ops = {
639         CHIP_NAME("AMD Geode CS5536 Southbridge")
640             /* This is only called when this device is listed in the
641              * static device tree.
642              */
643             .enable_dev = southbridge_enable,
644 };