called PCI errata for all pci_write_...() functions

This commit is contained in:
Markus Fröschle
2014-10-02 14:21:43 +00:00
parent a251cd4b44
commit b3ef74342e
2 changed files with 9 additions and 5 deletions

View File

@@ -346,5 +346,4 @@ extern int32_t wrapper_phys_to_virt(uint32_t address, PCI_CONV_ADR *pointer);
#define PCI_DEVICE_FROM_HANDLE(h) (((h) & 0xf8) >> 3) #define PCI_DEVICE_FROM_HANDLE(h) (((h) & 0xf8) >> 3)
#define PCI_FUNCTION_FROM_HANDLE(h) (((h) & 0x7)) #define PCI_FUNCTION_FROM_HANDLE(h) (((h) & 0x7))
extern void chip_errata_135(void); /* needed in ohci-hcd.c */
#endif /* _PCI_H_ */ #endif /* _PCI_H_ */

View File

@@ -99,7 +99,7 @@ struct pci_interrupt
#define MAX_INTERRUPTS (NUM_CARDS * 3) #define MAX_INTERRUPTS (NUM_CARDS * 3)
static struct pci_interrupt interrupts[MAX_INTERRUPTS]; static struct pci_interrupt interrupts[MAX_INTERRUPTS];
__attribute__((aligned(16))) void chip_errata_135(void) static inline __attribute__((aligned(16))) void chip_errata_135(void)
{ {
/* /*
* Errata type: Silicon * Errata type: Silicon
@@ -376,17 +376,19 @@ int32_t pci_write_config_longword(int32_t handle, int offset, uint32_t value)
MCF_PCI_PCICAR_DEVNUM(PCI_DEVICE_FROM_HANDLE(handle)) | /* device number, devices 0 - 9 are reserved */ MCF_PCI_PCICAR_DEVNUM(PCI_DEVICE_FROM_HANDLE(handle)) | /* device number, devices 0 - 9 are reserved */
MCF_PCI_PCICAR_FUNCNUM(PCI_FUNCTION_FROM_HANDLE(handle)) | /* function number */ MCF_PCI_PCICAR_FUNCNUM(PCI_FUNCTION_FROM_HANDLE(handle)) | /* function number */
MCF_PCI_PCICAR_DWORD(offset / 4); MCF_PCI_PCICAR_DWORD(offset / 4);
chip_errata_135();
__asm__ __volatile__("nop" ::: "memory"); __asm__ __volatile__("nop" ::: "memory");
* (volatile uint32_t *) PCI_IO_OFFSET = value; /* access device */ * (volatile uint32_t *) PCI_IO_OFFSET = value; /* access device */
chip_errata_135();
__asm__ __volatile__("tpf" ::: "memory"); __asm__ __volatile__("tpf" ::: "memory");
/* finish configuration space access cycle */ /* finish configuration space access cycle */
MCF_PCI_PCICAR &= ~MCF_PCI_PCICAR_E; MCF_PCI_PCICAR &= ~MCF_PCI_PCICAR_E;
chip_errata_135();
chip_errata_135();
return PCI_SUCCESSFUL; return PCI_SUCCESSFUL;
} }
@@ -402,17 +404,18 @@ int32_t pci_write_config_word(int32_t handle, int offset, uint16_t value)
MCF_PCI_PCICAR_DEVNUM(PCI_DEVICE_FROM_HANDLE(handle)) | MCF_PCI_PCICAR_DEVNUM(PCI_DEVICE_FROM_HANDLE(handle)) |
MCF_PCI_PCICAR_FUNCNUM(PCI_FUNCTION_FROM_HANDLE(handle)) | MCF_PCI_PCICAR_FUNCNUM(PCI_FUNCTION_FROM_HANDLE(handle)) |
MCF_PCI_PCICAR_DWORD(offset / 4); MCF_PCI_PCICAR_DWORD(offset / 4);
chip_errata_135();
__asm__ __volatile__("tpf" ::: "memory"); __asm__ __volatile__("tpf" ::: "memory");
* (volatile uint16_t *) (PCI_IO_OFFSET + (offset & 2)) = value; * (volatile uint16_t *) (PCI_IO_OFFSET + (offset & 2)) = value;
chip_errata_135();
__asm__ __volatile__("tpf" ::: "memory"); __asm__ __volatile__("tpf" ::: "memory");
/* finish configuration space access cycle */ /* finish configuration space access cycle */
MCF_PCI_PCICAR &= ~MCF_PCI_PCICAR_E; MCF_PCI_PCICAR &= ~MCF_PCI_PCICAR_E;
chip_errata_135();
chip_errata_135();
return PCI_SUCCESSFUL; return PCI_SUCCESSFUL;
} }
@@ -427,10 +430,12 @@ int32_t pci_write_config_byte(int32_t handle, int offset, uint8_t value)
MCF_PCI_PCICAR_DEVNUM(PCI_DEVICE_FROM_HANDLE(handle)) | MCF_PCI_PCICAR_DEVNUM(PCI_DEVICE_FROM_HANDLE(handle)) |
MCF_PCI_PCICAR_FUNCNUM(PCI_FUNCTION_FROM_HANDLE(handle)) | MCF_PCI_PCICAR_FUNCNUM(PCI_FUNCTION_FROM_HANDLE(handle)) |
MCF_PCI_PCICAR_DWORD(offset / 4); MCF_PCI_PCICAR_DWORD(offset / 4);
chip_errata_135();
__asm__ __volatile__("tpf" ::: "memory"); __asm__ __volatile__("tpf" ::: "memory");
* (volatile uint8_t *) (PCI_IO_OFFSET + (offset & 3)) = value; * (volatile uint8_t *) (PCI_IO_OFFSET + (offset & 3)) = value;
chip_errata_135();
__asm__ __volatile__("tpf" ::: "memory"); __asm__ __volatile__("tpf" ::: "memory");