2 * Copyright (C) ADMtek Incorporated.
3 * Copyright (C) 2005 Jeroen Vreeken (pe1rxq@amsat.org)
4 * Copyright (C) 2007 Gabor Juhos <juhosg@freemail.hu>
5 * Copyright (C) 2007 OpenWrt.org
8 #include <linux/autoconf.h>
9 #include <linux/types.h>
10 #include <linux/pci.h>
11 #include <linux/kernel.h>
12 #include <linux/init.h>
14 #include <adm5120_defs.h>
16 volatile u32
* pci_config_address_reg
= (volatile u32
*)KSEG1ADDR(ADM5120_PCICFG_ADDR
);
17 volatile u32
* pci_config_data_reg
= (volatile u32
*)KSEG1ADDR(ADM5120_PCICFG_DATA
);
19 #define PCI_ENABLE 0x80000000
21 static int pci_config_read(struct pci_bus
*bus
, unsigned int devfn
, int where
,
22 int size
, uint32_t *val
)
24 *pci_config_address_reg
= ((bus
->number
& 0xff) << 0x10) |
25 ((devfn
& 0xff) << 0x08) | (where
& 0xfc) | PCI_ENABLE
;
28 *val
= ((*pci_config_data_reg
)>>((where
&3)<<3))&0xff;
31 *val
= ((*pci_config_data_reg
)>>((where
&3)<<3))&0xffff;
34 *val
= (*pci_config_data_reg
);
36 return PCIBIOS_SUCCESSFUL
;
39 static int pci_config_write(struct pci_bus
*bus
, unsigned int devfn
, int where
,
40 int size
, uint32_t val
)
42 *pci_config_address_reg
= ((bus
->number
& 0xff) << 0x10) |
43 ((devfn
& 0xff) << 0x08) | (where
& 0xfc) | PCI_ENABLE
;
46 *(volatile u8
*)(((int)pci_config_data_reg
) +
50 *(volatile u16
*)(((int)pci_config_data_reg
) +
54 *pci_config_data_reg
= (val
);
57 return PCIBIOS_SUCCESSFUL
;
60 struct pci_ops adm5120_pci_ops
= {
61 .read
= pci_config_read
,
62 .write
= pci_config_write
,
This page took 0.053432 seconds and 5 git commands to generate.