diff options
author | Kishon Vijay Abraham I <kishon@ti.com> | 2017-02-15 08:18:10 -0500 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2017-02-21 16:00:26 -0500 |
commit | b90dc392212d1153a12eea15cbc6eae352a3c989 (patch) | |
tree | 24bc8526d3652c231d4f2cecb150a320e5c0f815 | |
parent | 11a61a8602812c024d8c404193ce1654ee3b8f08 (diff) |
PCI: dwc: designware: Move register defines to designware header file
No functional change. Move the register defines and other macros from
pcie-designware.c to pcie-designware.h. This is in preparation to split the
pcie-designware.c file into designware core file and host-specific file.
While at that also fix a checkpatch warning.
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-By: Joao Pinto <jpinto@synopsys.com>
-rw-r--r-- | drivers/pci/dwc/pcie-designware.c | 70 | ||||
-rw-r--r-- | drivers/pci/dwc/pcie-designware.h | 71 |
2 files changed, 71 insertions, 70 deletions
diff --git a/drivers/pci/dwc/pcie-designware.c b/drivers/pci/dwc/pcie-designware.c index af8f6e92e885..d0e49041dd0a 100644 --- a/drivers/pci/dwc/pcie-designware.c +++ b/drivers/pci/dwc/pcie-designware.c | |||
@@ -25,76 +25,6 @@ | |||
25 | 25 | ||
26 | #include "pcie-designware.h" | 26 | #include "pcie-designware.h" |
27 | 27 | ||
28 | /* Parameters for the waiting for link up routine */ | ||
29 | #define LINK_WAIT_MAX_RETRIES 10 | ||
30 | #define LINK_WAIT_USLEEP_MIN 90000 | ||
31 | #define LINK_WAIT_USLEEP_MAX 100000 | ||
32 | |||
33 | /* Parameters for the waiting for iATU enabled routine */ | ||
34 | #define LINK_WAIT_MAX_IATU_RETRIES 5 | ||
35 | #define LINK_WAIT_IATU_MIN 9000 | ||
36 | #define LINK_WAIT_IATU_MAX 10000 | ||
37 | |||
38 | /* Synopsys-specific PCIe configuration registers */ | ||
39 | #define PCIE_PORT_LINK_CONTROL 0x710 | ||
40 | #define PORT_LINK_MODE_MASK (0x3f << 16) | ||
41 | #define PORT_LINK_MODE_1_LANES (0x1 << 16) | ||
42 | #define PORT_LINK_MODE_2_LANES (0x3 << 16) | ||
43 | #define PORT_LINK_MODE_4_LANES (0x7 << 16) | ||
44 | #define PORT_LINK_MODE_8_LANES (0xf << 16) | ||
45 | |||
46 | #define PCIE_LINK_WIDTH_SPEED_CONTROL 0x80C | ||
47 | #define PORT_LOGIC_SPEED_CHANGE (0x1 << 17) | ||
48 | #define PORT_LOGIC_LINK_WIDTH_MASK (0x1f << 8) | ||
49 | #define PORT_LOGIC_LINK_WIDTH_1_LANES (0x1 << 8) | ||
50 | #define PORT_LOGIC_LINK_WIDTH_2_LANES (0x2 << 8) | ||
51 | #define PORT_LOGIC_LINK_WIDTH_4_LANES (0x4 << 8) | ||
52 | #define PORT_LOGIC_LINK_WIDTH_8_LANES (0x8 << 8) | ||
53 | |||
54 | #define PCIE_MSI_ADDR_LO 0x820 | ||
55 | #define PCIE_MSI_ADDR_HI 0x824 | ||
56 | #define PCIE_MSI_INTR0_ENABLE 0x828 | ||
57 | #define PCIE_MSI_INTR0_MASK 0x82C | ||
58 | #define PCIE_MSI_INTR0_STATUS 0x830 | ||
59 | |||
60 | #define PCIE_ATU_VIEWPORT 0x900 | ||
61 | #define PCIE_ATU_REGION_INBOUND (0x1 << 31) | ||
62 | #define PCIE_ATU_REGION_OUTBOUND (0x0 << 31) | ||
63 | #define PCIE_ATU_REGION_INDEX2 (0x2 << 0) | ||
64 | #define PCIE_ATU_REGION_INDEX1 (0x1 << 0) | ||
65 | #define PCIE_ATU_REGION_INDEX0 (0x0 << 0) | ||
66 | #define PCIE_ATU_CR1 0x904 | ||
67 | #define PCIE_ATU_TYPE_MEM (0x0 << 0) | ||
68 | #define PCIE_ATU_TYPE_IO (0x2 << 0) | ||
69 | #define PCIE_ATU_TYPE_CFG0 (0x4 << 0) | ||
70 | #define PCIE_ATU_TYPE_CFG1 (0x5 << 0) | ||
71 | #define PCIE_ATU_CR2 0x908 | ||
72 | #define PCIE_ATU_ENABLE (0x1 << 31) | ||
73 | #define PCIE_ATU_BAR_MODE_ENABLE (0x1 << 30) | ||
74 | #define PCIE_ATU_LOWER_BASE 0x90C | ||
75 | #define PCIE_ATU_UPPER_BASE 0x910 | ||
76 | #define PCIE_ATU_LIMIT 0x914 | ||
77 | #define PCIE_ATU_LOWER_TARGET 0x918 | ||
78 | #define PCIE_ATU_BUS(x) (((x) & 0xff) << 24) | ||
79 | #define PCIE_ATU_DEV(x) (((x) & 0x1f) << 19) | ||
80 | #define PCIE_ATU_FUNC(x) (((x) & 0x7) << 16) | ||
81 | #define PCIE_ATU_UPPER_TARGET 0x91C | ||
82 | |||
83 | /* | ||
84 | * iATU Unroll-specific register definitions | ||
85 | * From 4.80 core version the address translation will be made by unroll | ||
86 | */ | ||
87 | #define PCIE_ATU_UNR_REGION_CTRL1 0x00 | ||
88 | #define PCIE_ATU_UNR_REGION_CTRL2 0x04 | ||
89 | #define PCIE_ATU_UNR_LOWER_BASE 0x08 | ||
90 | #define PCIE_ATU_UNR_UPPER_BASE 0x0C | ||
91 | #define PCIE_ATU_UNR_LIMIT 0x10 | ||
92 | #define PCIE_ATU_UNR_LOWER_TARGET 0x14 | ||
93 | #define PCIE_ATU_UNR_UPPER_TARGET 0x18 | ||
94 | |||
95 | /* Register address builder */ | ||
96 | #define PCIE_GET_ATU_OUTB_UNR_REG_OFFSET(region) ((0x3 << 20) | (region << 9)) | ||
97 | |||
98 | /* PCIe Port Logic registers */ | 28 | /* PCIe Port Logic registers */ |
99 | #define PLR_OFFSET 0x700 | 29 | #define PLR_OFFSET 0x700 |
100 | #define PCIE_PHY_DEBUG_R1 (PLR_OFFSET + 0x2c) | 30 | #define PCIE_PHY_DEBUG_R1 (PLR_OFFSET + 0x2c) |
diff --git a/drivers/pci/dwc/pcie-designware.h b/drivers/pci/dwc/pcie-designware.h index a567ea288ee2..b5226d471d52 100644 --- a/drivers/pci/dwc/pcie-designware.h +++ b/drivers/pci/dwc/pcie-designware.h | |||
@@ -14,6 +14,77 @@ | |||
14 | #ifndef _PCIE_DESIGNWARE_H | 14 | #ifndef _PCIE_DESIGNWARE_H |
15 | #define _PCIE_DESIGNWARE_H | 15 | #define _PCIE_DESIGNWARE_H |
16 | 16 | ||
17 | /* Parameters for the waiting for link up routine */ | ||
18 | #define LINK_WAIT_MAX_RETRIES 10 | ||
19 | #define LINK_WAIT_USLEEP_MIN 90000 | ||
20 | #define LINK_WAIT_USLEEP_MAX 100000 | ||
21 | |||
22 | /* Parameters for the waiting for iATU enabled routine */ | ||
23 | #define LINK_WAIT_MAX_IATU_RETRIES 5 | ||
24 | #define LINK_WAIT_IATU_MIN 9000 | ||
25 | #define LINK_WAIT_IATU_MAX 10000 | ||
26 | |||
27 | /* Synopsys-specific PCIe configuration registers */ | ||
28 | #define PCIE_PORT_LINK_CONTROL 0x710 | ||
29 | #define PORT_LINK_MODE_MASK (0x3f << 16) | ||
30 | #define PORT_LINK_MODE_1_LANES (0x1 << 16) | ||
31 | #define PORT_LINK_MODE_2_LANES (0x3 << 16) | ||
32 | #define PORT_LINK_MODE_4_LANES (0x7 << 16) | ||
33 | #define PORT_LINK_MODE_8_LANES (0xf << 16) | ||
34 | |||
35 | #define PCIE_LINK_WIDTH_SPEED_CONTROL 0x80C | ||
36 | #define PORT_LOGIC_SPEED_CHANGE (0x1 << 17) | ||
37 | #define PORT_LOGIC_LINK_WIDTH_MASK (0x1f << 8) | ||
38 | #define PORT_LOGIC_LINK_WIDTH_1_LANES (0x1 << 8) | ||
39 | #define PORT_LOGIC_LINK_WIDTH_2_LANES (0x2 << 8) | ||
40 | #define PORT_LOGIC_LINK_WIDTH_4_LANES (0x4 << 8) | ||
41 | #define PORT_LOGIC_LINK_WIDTH_8_LANES (0x8 << 8) | ||
42 | |||
43 | #define PCIE_MSI_ADDR_LO 0x820 | ||
44 | #define PCIE_MSI_ADDR_HI 0x824 | ||
45 | #define PCIE_MSI_INTR0_ENABLE 0x828 | ||
46 | #define PCIE_MSI_INTR0_MASK 0x82C | ||
47 | #define PCIE_MSI_INTR0_STATUS 0x830 | ||
48 | |||
49 | #define PCIE_ATU_VIEWPORT 0x900 | ||
50 | #define PCIE_ATU_REGION_INBOUND (0x1 << 31) | ||
51 | #define PCIE_ATU_REGION_OUTBOUND (0x0 << 31) | ||
52 | #define PCIE_ATU_REGION_INDEX2 (0x2 << 0) | ||
53 | #define PCIE_ATU_REGION_INDEX1 (0x1 << 0) | ||
54 | #define PCIE_ATU_REGION_INDEX0 (0x0 << 0) | ||
55 | #define PCIE_ATU_CR1 0x904 | ||
56 | #define PCIE_ATU_TYPE_MEM (0x0 << 0) | ||
57 | #define PCIE_ATU_TYPE_IO (0x2 << 0) | ||
58 | #define PCIE_ATU_TYPE_CFG0 (0x4 << 0) | ||
59 | #define PCIE_ATU_TYPE_CFG1 (0x5 << 0) | ||
60 | #define PCIE_ATU_CR2 0x908 | ||
61 | #define PCIE_ATU_ENABLE (0x1 << 31) | ||
62 | #define PCIE_ATU_BAR_MODE_ENABLE (0x1 << 30) | ||
63 | #define PCIE_ATU_LOWER_BASE 0x90C | ||
64 | #define PCIE_ATU_UPPER_BASE 0x910 | ||
65 | #define PCIE_ATU_LIMIT 0x914 | ||
66 | #define PCIE_ATU_LOWER_TARGET 0x918 | ||
67 | #define PCIE_ATU_BUS(x) (((x) & 0xff) << 24) | ||
68 | #define PCIE_ATU_DEV(x) (((x) & 0x1f) << 19) | ||
69 | #define PCIE_ATU_FUNC(x) (((x) & 0x7) << 16) | ||
70 | #define PCIE_ATU_UPPER_TARGET 0x91C | ||
71 | |||
72 | /* | ||
73 | * iATU Unroll-specific register definitions | ||
74 | * From 4.80 core version the address translation will be made by unroll | ||
75 | */ | ||
76 | #define PCIE_ATU_UNR_REGION_CTRL1 0x00 | ||
77 | #define PCIE_ATU_UNR_REGION_CTRL2 0x04 | ||
78 | #define PCIE_ATU_UNR_LOWER_BASE 0x08 | ||
79 | #define PCIE_ATU_UNR_UPPER_BASE 0x0C | ||
80 | #define PCIE_ATU_UNR_LIMIT 0x10 | ||
81 | #define PCIE_ATU_UNR_LOWER_TARGET 0x14 | ||
82 | #define PCIE_ATU_UNR_UPPER_TARGET 0x18 | ||
83 | |||
84 | /* Register address builder */ | ||
85 | #define PCIE_GET_ATU_OUTB_UNR_REG_OFFSET(region) \ | ||
86 | ((0x3 << 20) | ((region) << 9)) | ||
87 | |||
17 | /* | 88 | /* |
18 | * Maximum number of MSI IRQs can be 256 per controller. But keep | 89 | * Maximum number of MSI IRQs can be 256 per controller. But keep |
19 | * it 32 as of now. Probably we will never need more than 32. If needed, | 90 | * it 32 as of now. Probably we will never need more than 32. If needed, |