Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /*
0003  * the definition file of cs5536 Virtual Support Module(VSM).
0004  * pci configuration space can be accessed through the VSM, so
0005  * there is no need of the MSR read/write now, except the spec.
0006  * MSR registers which are not implemented yet.
0007  *
0008  * Copyright (C) 2007 Lemote Inc.
0009  * Author : jlliu, liujl@lemote.com
0010  */
0011 
0012 #ifndef _CS5536_PCI_H
0013 #define _CS5536_PCI_H
0014 
0015 #include <linux/types.h>
0016 #include <linux/pci_regs.h>
0017 
0018 extern void cs5536_pci_conf_write4(int function, int reg, u32 value);
0019 extern u32 cs5536_pci_conf_read4(int function, int reg);
0020 
0021 #define CS5536_ACC_INTR     9
0022 #define CS5536_IDE_INTR     14
0023 #define CS5536_USB_INTR     11
0024 #define CS5536_MFGPT_INTR   5
0025 #define CS5536_UART1_INTR   4
0026 #define CS5536_UART2_INTR   3
0027 
0028 /************** PCI BUS DEVICE FUNCTION ***************/
0029 
0030 /*
0031  * PCI bus device function
0032  */
0033 #define PCI_BUS_CS5536      0
0034 #define PCI_IDSEL_CS5536    14
0035 
0036 /********** STANDARD PCI-2.2 EXPANSION ****************/
0037 
0038 /*
0039  * PCI configuration space
0040  * we have to virtualize the PCI configure space head, so we should
0041  * define the necessary IDs and some others.
0042  */
0043 
0044 /* CONFIG of PCI VENDOR ID*/
0045 #define CFG_PCI_VENDOR_ID(mod_dev_id, sys_vendor_id) \
0046     (((mod_dev_id) << 16) | (sys_vendor_id))
0047 
0048 /* VENDOR ID */
0049 #define CS5536_VENDOR_ID    0x1022
0050 
0051 /* DEVICE ID */
0052 #define CS5536_ISA_DEVICE_ID        0x2090
0053 #define CS5536_IDE_DEVICE_ID        0x209a
0054 #define CS5536_ACC_DEVICE_ID        0x2093
0055 #define CS5536_OHCI_DEVICE_ID       0x2094
0056 #define CS5536_EHCI_DEVICE_ID       0x2095
0057 
0058 /* CLASS CODE : CLASS SUB-CLASS INTERFACE */
0059 #define CS5536_ISA_CLASS_CODE       0x060100
0060 #define CS5536_IDE_CLASS_CODE       0x010180
0061 #define CS5536_ACC_CLASS_CODE       0x040100
0062 #define CS5536_OHCI_CLASS_CODE      0x0C0310
0063 #define CS5536_EHCI_CLASS_CODE      0x0C0320
0064 
0065 /* BHLC : BIST HEADER-TYPE LATENCY-TIMER CACHE-LINE-SIZE */
0066 
0067 #define CFG_PCI_CACHE_LINE_SIZE(header_type, latency_timer) \
0068     ((PCI_NONE_BIST << 24) | ((header_type) << 16) \
0069         | ((latency_timer) << 8) | PCI_NORMAL_CACHE_LINE_SIZE);
0070 
0071 #define PCI_NONE_BIST           0x00    /* RO not implemented yet. */
0072 #define PCI_BRIDGE_HEADER_TYPE      0x80    /* RO */
0073 #define PCI_NORMAL_HEADER_TYPE      0x00
0074 #define PCI_NORMAL_LATENCY_TIMER    0x00
0075 #define PCI_NORMAL_CACHE_LINE_SIZE  0x08    /* RW */
0076 
0077 /* BAR */
0078 #define PCI_BAR0_REG            0x10
0079 #define PCI_BAR1_REG            0x14
0080 #define PCI_BAR2_REG            0x18
0081 #define PCI_BAR3_REG            0x1c
0082 #define PCI_BAR4_REG            0x20
0083 #define PCI_BAR5_REG            0x24
0084 #define PCI_BAR_RANGE_MASK      0xFFFFFFFF
0085 
0086 /* CARDBUS CIS POINTER */
0087 #define PCI_CARDBUS_CIS_POINTER     0x00000000
0088 
0089 /* SUBSYSTEM VENDOR ID  */
0090 #define CS5536_SUB_VENDOR_ID        CS5536_VENDOR_ID
0091 
0092 /* SUBSYSTEM ID */
0093 #define CS5536_ISA_SUB_ID       CS5536_ISA_DEVICE_ID
0094 #define CS5536_IDE_SUB_ID       CS5536_IDE_DEVICE_ID
0095 #define CS5536_ACC_SUB_ID       CS5536_ACC_DEVICE_ID
0096 #define CS5536_OHCI_SUB_ID      CS5536_OHCI_DEVICE_ID
0097 #define CS5536_EHCI_SUB_ID      CS5536_EHCI_DEVICE_ID
0098 
0099 /* EXPANSION ROM BAR */
0100 #define PCI_EXPANSION_ROM_BAR       0x00000000
0101 
0102 /* CAPABILITIES POINTER */
0103 #define PCI_CAPLIST_POINTER     0x00000000
0104 #define PCI_CAPLIST_USB_POINTER     0x40
0105 /* INTERRUPT */
0106 
0107 #define CFG_PCI_INTERRUPT_LINE(pin, mod_intr) \
0108     ((PCI_MAX_LATENCY << 24) | (PCI_MIN_GRANT << 16) | \
0109         ((pin) << 8) | (mod_intr))
0110 
0111 #define PCI_MAX_LATENCY         0x40
0112 #define PCI_MIN_GRANT           0x00
0113 #define PCI_DEFAULT_PIN         0x01
0114 
0115 /*********** EXPANSION PCI REG ************************/
0116 
0117 /*
0118  * ISA EXPANSION
0119  */
0120 #define PCI_UART1_INT_REG   0x50
0121 #define PCI_UART2_INT_REG   0x54
0122 #define PCI_ISA_FIXUP_REG   0x58
0123 
0124 /*
0125  * IDE EXPANSION
0126  */
0127 #define PCI_IDE_CFG_REG     0x40
0128 #define CS5536_IDE_FLASH_SIGNATURE  0xDEADBEEF
0129 #define PCI_IDE_DTC_REG     0x48
0130 #define PCI_IDE_CAST_REG    0x4C
0131 #define PCI_IDE_ETC_REG     0x50
0132 #define PCI_IDE_PM_REG      0x54
0133 #define PCI_IDE_INT_REG     0x60
0134 
0135 /*
0136  * ACC EXPANSION
0137  */
0138 #define PCI_ACC_INT_REG     0x50
0139 
0140 /*
0141  * OHCI EXPANSION : INTTERUPT IS IMPLEMENTED BY THE OHCI
0142  */
0143 #define PCI_OHCI_PM_REG     0x40
0144 #define PCI_OHCI_INT_REG    0x50
0145 
0146 /*
0147  * EHCI EXPANSION
0148  */
0149 #define PCI_EHCI_LEGSMIEN_REG   0x50
0150 #define PCI_EHCI_LEGSMISTS_REG  0x54
0151 #define PCI_EHCI_FLADJ_REG  0x60
0152 
0153 #endif              /* _CS5536_PCI_H_ */