File indexing completed on 2025-05-11 08:23:52
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046
0047
0048
0049
0050
0051
0052
0053
0054
0055 #include <rtems.h>
0056 #include <rtems/bspIo.h>
0057 #include <bsp.h>
0058 #include <bsp/gtreg.h>
0059 #include <bsp/pci.h>
0060 #include <stdint.h>
0061
0062 #ifndef PCI_VENDOR_ID_MARVELL
0063 #define PCI_VENDOR_ID_MARVELL 0x11ab
0064 #endif
0065
0066 #ifndef PCI_DEVICE_ID_MARVELL_GT64260
0067 #define PCI_DEVICE_ID_MARVELL_GT64260 0x6430
0068 #endif
0069
0070 #ifndef PCI_DEVICE_ID_MARVELL_MV64360
0071 #define PCI_DEVICE_ID_MARVELL_MV64360 0x6460
0072 #endif
0073
0074 #if 0
0075 #define MV64x60_PCI0_CONFIG_ADDR (BSP_MV64x60_BASE + 0xcf8)
0076 #define MV64x60_PCI0_CONFIG_DATA (BSP_MV64x60_BASE + 0xcfc)
0077
0078
0079 static unsigned long
0080 pci_early_config_read(int offset, int width)
0081 {
0082 out_be32((uint32_t*) pci.pci_config_addr,
0083 0x80|(0<<8)|(PCI_DEVFN(0,0)<<16)|((offset&~3)<<24));
0084 switch (width) {
0085 default:
0086 case 1:
0087 return in_8((uint8_t*)pci.pci_config_data + (offset&3));
0088 case 2:
0089 return in_le16((uint16_t*)pci.pci_config_data + (offset&3));
0090 case 4:
0091 return in_le32((uint32_t *)pci.pci_config_data + (offset&3));
0092 }
0093 }
0094 #endif
0095
0096 DiscoveryVersion
0097 BSP_getDiscoveryVersion(int assertion)
0098 {
0099 static DiscoveryVersion rval = unknown;
0100
0101 if ( unknown ==rval ) {
0102 unsigned char dc;
0103 unsigned short ds;
0104
0105
0106
0107
0108
0109 printk("config addr is %p\n", BSP_pci_configuration.pci_config_addr);
0110 printk("config data is %p\n", BSP_pci_configuration.pci_config_data);
0111 pci_read_config_word(0,0,0,PCI_VENDOR_ID, &ds);
0112 if ( PCI_VENDOR_ID_MARVELL != ds ) {
0113 if ( assertion ) {
0114 printk("Host bridge vendor id: 0x%04x\n",ds);
0115 rtems_panic("Host bridge vendor @ pci(0,0,0) is not MARVELL");
0116 }
0117 else return unknown;
0118 }
0119 pci_read_config_word(0,0,0,PCI_DEVICE_ID, &ds);
0120 pci_read_config_byte(0,0,0,PCI_REVISION_ID, &dc);
0121 switch (ds) {
0122 case PCI_DEVICE_ID_MARVELL_MV64360:
0123 rval = MV_64360;
0124 break;
0125
0126 case PCI_DEVICE_ID_MARVELL_GT64260:
0127 switch (dc) {
0128 default:
0129 break;
0130
0131 case 0x10:
0132 return (rval = GT_64260_A);
0133
0134 case 0x20:
0135 return (rval = GT_64260_B);
0136 }
0137
0138 default:
0139 if ( assertion ) {
0140 printk("Marvell device id 0x%04x, revision 0x%02x; check %s:%u\n",
0141 ds, dc,
0142 __FILE__,__LINE__);
0143 rtems_panic("Unknown Marvell bridge or revision@ pci(0,0,0) is not MARVELL");
0144 }
0145 break;
0146 }
0147 }
0148
0149 return rval;
0150 }