2 * Copyright (C) ADMtek Incorporated.
3 * Copyright (C) 2005 Jeroen Vreeken (pe1rxq@amsat.org)
6 #include <linux/autoconf.h>
7 #include <linux/types.h>
9 #include <linux/kernel.h>
10 #include <linux/init.h>
12 volatile u32
* pci_config_address_reg
= (volatile u32
*)KSEG1ADDR(0x115ffff0);
13 volatile u32
* pci_config_data_reg
= (volatile u32
*)KSEG1ADDR(0x115ffff8);
15 #define PCI_ENABLE 0x80000000
17 static int pci_config_read(struct pci_bus
*bus
, unsigned int devfn
, int where
,
18 int size
, uint32_t *val
)
20 *pci_config_address_reg
= ((bus
->number
& 0xff) << 0x10) |
21 ((devfn
& 0xff) << 0x08) | (where
& 0xfc) | PCI_ENABLE
;
24 *val
= ((*pci_config_data_reg
)>>((where
&3)<<3))&0xff;
27 *val
= ((*pci_config_data_reg
)>>((where
&3)<<3))&0xffff;
30 *val
= (*pci_config_data_reg
);
32 return PCIBIOS_SUCCESSFUL
;
35 static int pci_config_write(struct pci_bus
*bus
, unsigned int devfn
, int where
,
36 int size
, uint32_t val
)
38 *pci_config_address_reg
= ((bus
->number
& 0xff) << 0x10) |
39 ((devfn
& 0xff) << 0x08) | (where
& 0xfc) | PCI_ENABLE
;
42 *(volatile u8
*)(((int)pci_config_data_reg
) +
46 *(volatile u16
*)(((int)pci_config_data_reg
) +
50 *pci_config_data_reg
= (val
);
53 return PCIBIOS_SUCCESSFUL
;
56 struct pci_ops adm5120_pci_ops
= {
57 .read
= pci_config_read
,
58 .write
= pci_config_write
,