1 
   2 
   3 
   4 
   5 
   6 
   7 
   8 
   9 
  10 #ifndef _MSP_PCI_H_
  11 #define _MSP_PCI_H_
  12 
  13 #define MSP_HAS_PCI(ID) (((u32)(ID) <= 0x4236) && ((u32)(ID) >= 0x4220))
  14 
  15 
  16 
  17 
  18 
  19 
  20 
  21 
  22 
  23 
  24 
  25 
  26 
  27 
  28 
  29 
  30 
  31 
  32 
  33 
  34 
  35 
  36 
  37 
  38 
  39 
  40 
  41 
  42 #define MSP_PCI_OATRAN          0xB8000000UL
  43 
  44 #define MSP_PCI_SPACE_BASE      (MSP_PCI_OATRAN + 0x1002000UL)
  45 #define MSP_PCI_SPACE_SIZE      (0x3000000UL - 0x2000)
  46 #define MSP_PCI_SPACE_END \
  47                 (MSP_PCI_SPACE_BASE + MSP_PCI_SPACE_SIZE - 1)
  48 #define MSP_PCI_IOSPACE_BASE    (MSP_PCI_OATRAN + 0x1001000UL)
  49 #define MSP_PCI_IOSPACE_SIZE    0x1000
  50 #define MSP_PCI_IOSPACE_END  \
  51                 (MSP_PCI_IOSPACE_BASE + MSP_PCI_IOSPACE_SIZE - 1)
  52 
  53 
  54 #define PCI_STAT_IRQ    20
  55 
  56 #define QFLUSH_REG_1    0xB7F40000
  57 
  58 typedef volatile unsigned int pcireg;
  59 typedef void * volatile ppcireg;
  60 
  61 struct pci_block_copy
  62 {
  63     pcireg   unused1; 
  64     pcireg   unused2; 
  65     ppcireg  unused3; 
  66     ppcireg  unused4; 
  67     pcireg   unused5; 
  68     pcireg   unused6; 
  69     pcireg   unused7; 
  70     ppcireg  unused8; 
  71     ppcireg  unused9; 
  72     pcireg   unusedA; 
  73     ppcireg  unusedB; 
  74     ppcireg  unusedC; 
  75 };
  76 
  77 enum
  78 {
  79     config_device_vendor,  
  80     config_status_command, 
  81     config_class_revision, 
  82     config_BIST_header_latency_cache, 
  83     config_BAR0,           
  84     config_BAR1,           
  85     config_BAR2,           
  86     config_not_used7,      
  87     config_not_used8,      
  88     config_not_used9,      
  89     config_CIS,            
  90     config_subsystem,      
  91     config_not_used12,     
  92     config_capabilities,   
  93     config_not_used14,     
  94     config_lat_grant_irq,  
  95     config_message_control,
  96     config_message_addr,   
  97     config_message_data,   
  98     config_VPD_addr,       
  99     config_VPD_data,       
 100     config_maxregs         
 101 };
 102 
 103 struct msp_pci_regs
 104 {
 105     pcireg hop_unused_00; 
 106     pcireg hop_unused_04; 
 107     pcireg hop_unused_08; 
 108     pcireg hop_unused_0C; 
 109     pcireg hop_unused_10; 
 110     pcireg hop_unused_14; 
 111     pcireg hop_unused_18; 
 112     pcireg hop_unused_1C; 
 113     pcireg hop_unused_20; 
 114     pcireg hop_unused_24; 
 115     pcireg hop_unused_28; 
 116     pcireg hop_unused_2C; 
 117     pcireg hop_unused_30; 
 118     pcireg hop_unused_34; 
 119     pcireg if_control;    
 120     pcireg oatran;        
 121     pcireg reset_ctl;     
 122     pcireg config_addr;   
 123     pcireg hop_unused_48; 
 124     pcireg msg_signaled_int_status; 
 125     pcireg msg_signaled_int_mask;   
 126     pcireg if_status;     
 127     pcireg if_mask;       
 128     pcireg hop_unused_5C; 
 129     pcireg hop_unused_60; 
 130     pcireg hop_unused_64; 
 131     pcireg hop_unused_68; 
 132     pcireg hop_unused_6C; 
 133     pcireg hop_unused_70; 
 134 
 135     struct pci_block_copy pci_bc[2] __attribute__((aligned(64)));
 136 
 137     pcireg error_hdr1; 
 138     pcireg error_hdr2; 
 139 
 140     pcireg config[config_maxregs] __attribute__((aligned(256)));
 141 
 142 };
 143 
 144 #define BPCI_CFGADDR_BUSNUM_SHF 16
 145 #define BPCI_CFGADDR_FUNCTNUM_SHF 8
 146 #define BPCI_CFGADDR_REGNUM_SHF 2
 147 #define BPCI_CFGADDR_ENABLE (1<<31)
 148 
 149 #define BPCI_IFCONTROL_RTO (1<<20) 
 150 #define BPCI_IFCONTROL_HCE (1<<16) 
 151 #define BPCI_IFCONTROL_CTO_SHF 12  
 152 #define BPCI_IFCONTROL_SE  (1<<5)  
 153 #define BPCI_IFCONTROL_BIST (1<<4) 
 154 #define BPCI_IFCONTROL_CAP (1<<3)  
 155 #define BPCI_IFCONTROL_MMC_SHF 0   
 156 
 157 #define BPCI_IFSTATUS_MGT  (1<<8)  
 158 #define BPCI_IFSTATUS_MTT  (1<<9)  
 159 #define BPCI_IFSTATUS_MRT  (1<<10) 
 160 #define BPCI_IFSTATUS_BC0F (1<<13) 
 161 #define BPCI_IFSTATUS_BC1F (1<<14) 
 162 #define BPCI_IFSTATUS_PCIU (1<<15) 
 163 #define BPCI_IFSTATUS_BSIZ (1<<16) 
 164 #define BPCI_IFSTATUS_BADD (1<<17) 
 165 #define BPCI_IFSTATUS_RTO  (1<<18) 
 166 #define BPCI_IFSTATUS_SER  (1<<19) 
 167 #define BPCI_IFSTATUS_PER  (1<<20) 
 168 #define BPCI_IFSTATUS_LCA  (1<<21) 
 169 #define BPCI_IFSTATUS_MEM  (1<<22) 
 170 #define BPCI_IFSTATUS_ARB  (1<<23) 
 171 #define BPCI_IFSTATUS_STA  (1<<27) 
 172 #define BPCI_IFSTATUS_TA   (1<<28) 
 173 #define BPCI_IFSTATUS_MA   (1<<29) 
 174 #define BPCI_IFSTATUS_PEI  (1<<30) 
 175 #define BPCI_IFSTATUS_PET  (1<<31) 
 176 
 177 #define BPCI_RESETCTL_PR (1<<0)    
 178 #define BPCI_RESETCTL_RT (1<<4)    
 179 #define BPCI_RESETCTL_CT (1<<8)    
 180 #define BPCI_RESETCTL_PE (1<<12)   
 181 #define BPCI_RESETCTL_HM (1<<13)   
 182 #define BPCI_RESETCTL_RI (1<<14)   
 183 
 184 extern struct msp_pci_regs msp_pci_regs
 185                         __attribute__((section(".register")));
 186 extern unsigned long msp_pci_config_space
 187                         __attribute__((section(".register")));
 188 
 189 #endif