blob: 166881a753d24217e04c4989b0f1ed4071c77521 [file] [log] [blame]
Jingoo Han4b1ced82013-07-31 17:14:10 +09001/*
2 * PCIe host controller driver for Samsung EXYNOS SoCs
3 *
4 * Copyright (C) 2013 Samsung Electronics Co., Ltd.
5 * http://www.samsung.com
6 *
7 * Author: Jingoo Han <jg1.han@samsung.com>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 */
13
14#include <linux/clk.h>
15#include <linux/delay.h>
16#include <linux/gpio.h>
17#include <linux/interrupt.h>
18#include <linux/kernel.h>
Paul Gortmakercaf55482016-08-22 17:59:47 -040019#include <linux/init.h>
Jingoo Han4b1ced82013-07-31 17:14:10 +090020#include <linux/of_gpio.h>
21#include <linux/pci.h>
22#include <linux/platform_device.h>
23#include <linux/resource.h>
24#include <linux/signal.h>
25#include <linux/types.h>
26
27#include "pcie-designware.h"
28
29#define to_exynos_pcie(x) container_of(x, struct exynos_pcie, pp)
30
31struct exynos_pcie {
Bjorn Helgaas6b1f1852016-10-06 13:33:40 -050032 struct pcie_port pp;
33 void __iomem *elbi_base; /* DT 0th resource */
34 void __iomem *phy_base; /* DT 1st resource */
35 void __iomem *block_base; /* DT 2nd resource */
Jingoo Han4b1ced82013-07-31 17:14:10 +090036 int reset_gpio;
37 struct clk *clk;
38 struct clk *bus_clk;
Jingoo Han4b1ced82013-07-31 17:14:10 +090039};
40
41/* PCIe ELBI registers */
42#define PCIE_IRQ_PULSE 0x000
43#define IRQ_INTA_ASSERT (0x1 << 0)
44#define IRQ_INTB_ASSERT (0x1 << 2)
45#define IRQ_INTC_ASSERT (0x1 << 4)
46#define IRQ_INTD_ASSERT (0x1 << 6)
47#define PCIE_IRQ_LEVEL 0x004
48#define PCIE_IRQ_SPECIAL 0x008
49#define PCIE_IRQ_EN_PULSE 0x00c
50#define PCIE_IRQ_EN_LEVEL 0x010
Jingoo Hanf342d942013-09-06 15:54:59 +090051#define IRQ_MSI_ENABLE (0x1 << 2)
Jingoo Han4b1ced82013-07-31 17:14:10 +090052#define PCIE_IRQ_EN_SPECIAL 0x014
53#define PCIE_PWR_RESET 0x018
54#define PCIE_CORE_RESET 0x01c
55#define PCIE_CORE_RESET_ENABLE (0x1 << 0)
56#define PCIE_STICKY_RESET 0x020
57#define PCIE_NONSTICKY_RESET 0x024
58#define PCIE_APP_INIT_RESET 0x028
59#define PCIE_APP_LTSSM_ENABLE 0x02c
60#define PCIE_ELBI_RDLH_LINKUP 0x064
61#define PCIE_ELBI_LTSSM_ENABLE 0x1
62#define PCIE_ELBI_SLV_AWMISC 0x11c
63#define PCIE_ELBI_SLV_ARMISC 0x120
64#define PCIE_ELBI_SLV_DBI_ENABLE (0x1 << 21)
65
66/* PCIe Purple registers */
67#define PCIE_PHY_GLOBAL_RESET 0x000
68#define PCIE_PHY_COMMON_RESET 0x004
69#define PCIE_PHY_CMN_REG 0x008
70#define PCIE_PHY_MAC_RESET 0x00c
71#define PCIE_PHY_PLL_LOCKED 0x010
72#define PCIE_PHY_TRSVREG_RESET 0x020
73#define PCIE_PHY_TRSV_RESET 0x024
74
75/* PCIe PHY registers */
76#define PCIE_PHY_IMPEDANCE 0x004
77#define PCIE_PHY_PLL_DIV_0 0x008
78#define PCIE_PHY_PLL_BIAS 0x00c
79#define PCIE_PHY_DCC_FEEDBACK 0x014
80#define PCIE_PHY_PLL_DIV_1 0x05c
Jingoo Hanf62b8782013-09-06 17:21:45 +090081#define PCIE_PHY_COMMON_POWER 0x064
82#define PCIE_PHY_COMMON_PD_CMN (0x1 << 3)
Jingoo Han4b1ced82013-07-31 17:14:10 +090083#define PCIE_PHY_TRSV0_EMP_LVL 0x084
84#define PCIE_PHY_TRSV0_DRV_LVL 0x088
85#define PCIE_PHY_TRSV0_RXCDR 0x0ac
Jingoo Hanf62b8782013-09-06 17:21:45 +090086#define PCIE_PHY_TRSV0_POWER 0x0c4
87#define PCIE_PHY_TRSV0_PD_TSV (0x1 << 7)
Jingoo Han4b1ced82013-07-31 17:14:10 +090088#define PCIE_PHY_TRSV0_LVCC 0x0dc
89#define PCIE_PHY_TRSV1_EMP_LVL 0x144
90#define PCIE_PHY_TRSV1_RXCDR 0x16c
Jingoo Hanf62b8782013-09-06 17:21:45 +090091#define PCIE_PHY_TRSV1_POWER 0x184
92#define PCIE_PHY_TRSV1_PD_TSV (0x1 << 7)
Jingoo Han4b1ced82013-07-31 17:14:10 +090093#define PCIE_PHY_TRSV1_LVCC 0x19c
94#define PCIE_PHY_TRSV2_EMP_LVL 0x204
95#define PCIE_PHY_TRSV2_RXCDR 0x22c
Jingoo Hanf62b8782013-09-06 17:21:45 +090096#define PCIE_PHY_TRSV2_POWER 0x244
97#define PCIE_PHY_TRSV2_PD_TSV (0x1 << 7)
Jingoo Han4b1ced82013-07-31 17:14:10 +090098#define PCIE_PHY_TRSV2_LVCC 0x25c
99#define PCIE_PHY_TRSV3_EMP_LVL 0x2c4
100#define PCIE_PHY_TRSV3_RXCDR 0x2ec
Jingoo Hanf62b8782013-09-06 17:21:45 +0900101#define PCIE_PHY_TRSV3_POWER 0x304
102#define PCIE_PHY_TRSV3_PD_TSV (0x1 << 7)
Jingoo Han4b1ced82013-07-31 17:14:10 +0900103#define PCIE_PHY_TRSV3_LVCC 0x31c
104
Jaehoon Chungd6da7d92017-01-16 15:31:35 +0900105static void exynos_pcie_writel(void __iomem *base, u32 val, u32 reg)
Seungwon Jeon058dd012013-08-29 21:35:56 +0900106{
Jaehoon Chungd6da7d92017-01-16 15:31:35 +0900107 writel(val, base + reg);
Seungwon Jeon058dd012013-08-29 21:35:56 +0900108}
109
Jaehoon Chungd6da7d92017-01-16 15:31:35 +0900110static u32 exynos_pcie_readl(void __iomem *base, u32 reg)
Seungwon Jeon058dd012013-08-29 21:35:56 +0900111{
Jaehoon Chungd6da7d92017-01-16 15:31:35 +0900112 return readl(base + reg);
Seungwon Jeon058dd012013-08-29 21:35:56 +0900113}
114
Jaehoon Chung4e0a90b382017-01-16 15:31:34 +0900115static void exynos_pcie_sideband_dbi_w_mode(struct exynos_pcie *ep, bool on)
Jingoo Han4b1ced82013-07-31 17:14:10 +0900116{
117 u32 val;
Jingoo Han4b1ced82013-07-31 17:14:10 +0900118
119 if (on) {
Jaehoon Chungd6da7d92017-01-16 15:31:35 +0900120 val = exynos_pcie_readl(ep->elbi_base, PCIE_ELBI_SLV_AWMISC);
Jingoo Han4b1ced82013-07-31 17:14:10 +0900121 val |= PCIE_ELBI_SLV_DBI_ENABLE;
Jaehoon Chungd6da7d92017-01-16 15:31:35 +0900122 exynos_pcie_writel(ep->elbi_base, val, PCIE_ELBI_SLV_AWMISC);
Jingoo Han4b1ced82013-07-31 17:14:10 +0900123 } else {
Jaehoon Chungd6da7d92017-01-16 15:31:35 +0900124 val = exynos_pcie_readl(ep->elbi_base, PCIE_ELBI_SLV_AWMISC);
Jingoo Han4b1ced82013-07-31 17:14:10 +0900125 val &= ~PCIE_ELBI_SLV_DBI_ENABLE;
Jaehoon Chungd6da7d92017-01-16 15:31:35 +0900126 exynos_pcie_writel(ep->elbi_base, val, PCIE_ELBI_SLV_AWMISC);
Jingoo Han4b1ced82013-07-31 17:14:10 +0900127 }
128}
129
Jaehoon Chung4e0a90b382017-01-16 15:31:34 +0900130static void exynos_pcie_sideband_dbi_r_mode(struct exynos_pcie *ep, bool on)
Jingoo Han4b1ced82013-07-31 17:14:10 +0900131{
132 u32 val;
Jingoo Han4b1ced82013-07-31 17:14:10 +0900133
134 if (on) {
Jaehoon Chungd6da7d92017-01-16 15:31:35 +0900135 val = exynos_pcie_readl(ep->elbi_base, PCIE_ELBI_SLV_ARMISC);
Jingoo Han4b1ced82013-07-31 17:14:10 +0900136 val |= PCIE_ELBI_SLV_DBI_ENABLE;
Jaehoon Chungd6da7d92017-01-16 15:31:35 +0900137 exynos_pcie_writel(ep->elbi_base, val, PCIE_ELBI_SLV_ARMISC);
Jingoo Han4b1ced82013-07-31 17:14:10 +0900138 } else {
Jaehoon Chungd6da7d92017-01-16 15:31:35 +0900139 val = exynos_pcie_readl(ep->elbi_base, PCIE_ELBI_SLV_ARMISC);
Jingoo Han4b1ced82013-07-31 17:14:10 +0900140 val &= ~PCIE_ELBI_SLV_DBI_ENABLE;
Jaehoon Chungd6da7d92017-01-16 15:31:35 +0900141 exynos_pcie_writel(ep->elbi_base, val, PCIE_ELBI_SLV_ARMISC);
Jingoo Han4b1ced82013-07-31 17:14:10 +0900142 }
143}
144
Jaehoon Chung4e0a90b382017-01-16 15:31:34 +0900145static void exynos_pcie_assert_core_reset(struct exynos_pcie *ep)
Jingoo Han4b1ced82013-07-31 17:14:10 +0900146{
147 u32 val;
Jingoo Han4b1ced82013-07-31 17:14:10 +0900148
Jaehoon Chungd6da7d92017-01-16 15:31:35 +0900149 val = exynos_pcie_readl(ep->elbi_base, PCIE_CORE_RESET);
Jingoo Han4b1ced82013-07-31 17:14:10 +0900150 val &= ~PCIE_CORE_RESET_ENABLE;
Jaehoon Chungd6da7d92017-01-16 15:31:35 +0900151 exynos_pcie_writel(ep->elbi_base, val, PCIE_CORE_RESET);
152 exynos_pcie_writel(ep->elbi_base, 0, PCIE_PWR_RESET);
153 exynos_pcie_writel(ep->elbi_base, 0, PCIE_STICKY_RESET);
154 exynos_pcie_writel(ep->elbi_base, 0, PCIE_NONSTICKY_RESET);
Jingoo Han4b1ced82013-07-31 17:14:10 +0900155}
156
Jaehoon Chung4e0a90b382017-01-16 15:31:34 +0900157static void exynos_pcie_deassert_core_reset(struct exynos_pcie *ep)
Jingoo Han4b1ced82013-07-31 17:14:10 +0900158{
159 u32 val;
Jingoo Han4b1ced82013-07-31 17:14:10 +0900160
Jaehoon Chungd6da7d92017-01-16 15:31:35 +0900161 val = exynos_pcie_readl(ep->elbi_base, PCIE_CORE_RESET);
Jingoo Han4b1ced82013-07-31 17:14:10 +0900162 val |= PCIE_CORE_RESET_ENABLE;
Seungwon Jeon058dd012013-08-29 21:35:56 +0900163
Jaehoon Chungd6da7d92017-01-16 15:31:35 +0900164 exynos_pcie_writel(ep->elbi_base, val, PCIE_CORE_RESET);
165 exynos_pcie_writel(ep->elbi_base, 1, PCIE_STICKY_RESET);
166 exynos_pcie_writel(ep->elbi_base, 1, PCIE_NONSTICKY_RESET);
167 exynos_pcie_writel(ep->elbi_base, 1, PCIE_APP_INIT_RESET);
168 exynos_pcie_writel(ep->elbi_base, 0, PCIE_APP_INIT_RESET);
169 exynos_pcie_writel(ep->block_base, 1, PCIE_PHY_MAC_RESET);
Jingoo Han4b1ced82013-07-31 17:14:10 +0900170}
171
Jaehoon Chung4e0a90b382017-01-16 15:31:34 +0900172static void exynos_pcie_assert_phy_reset(struct exynos_pcie *ep)
Jingoo Han4b1ced82013-07-31 17:14:10 +0900173{
Jaehoon Chungd6da7d92017-01-16 15:31:35 +0900174 exynos_pcie_writel(ep->block_base, 0, PCIE_PHY_MAC_RESET);
175 exynos_pcie_writel(ep->block_base, 1, PCIE_PHY_GLOBAL_RESET);
Jingoo Han4b1ced82013-07-31 17:14:10 +0900176}
177
Jaehoon Chung4e0a90b382017-01-16 15:31:34 +0900178static void exynos_pcie_deassert_phy_reset(struct exynos_pcie *ep)
Jingoo Han4b1ced82013-07-31 17:14:10 +0900179{
Jaehoon Chungd6da7d92017-01-16 15:31:35 +0900180 exynos_pcie_writel(ep->block_base, 0, PCIE_PHY_GLOBAL_RESET);
181 exynos_pcie_writel(ep->elbi_base, 1, PCIE_PWR_RESET);
182 exynos_pcie_writel(ep->block_base, 0, PCIE_PHY_COMMON_RESET);
183 exynos_pcie_writel(ep->block_base, 0, PCIE_PHY_CMN_REG);
184 exynos_pcie_writel(ep->block_base, 0, PCIE_PHY_TRSVREG_RESET);
185 exynos_pcie_writel(ep->block_base, 0, PCIE_PHY_TRSV_RESET);
Jingoo Han4b1ced82013-07-31 17:14:10 +0900186}
187
Jaehoon Chung4e0a90b382017-01-16 15:31:34 +0900188static void exynos_pcie_power_on_phy(struct exynos_pcie *ep)
Jingoo Hanf62b8782013-09-06 17:21:45 +0900189{
190 u32 val;
Jingoo Hanf62b8782013-09-06 17:21:45 +0900191
Jaehoon Chungd6da7d92017-01-16 15:31:35 +0900192 val = exynos_pcie_readl(ep->phy_base, PCIE_PHY_COMMON_POWER);
Jingoo Hanf62b8782013-09-06 17:21:45 +0900193 val &= ~PCIE_PHY_COMMON_PD_CMN;
Jaehoon Chungd6da7d92017-01-16 15:31:35 +0900194 exynos_pcie_writel(ep->phy_base, val, PCIE_PHY_COMMON_POWER);
Jingoo Hanf62b8782013-09-06 17:21:45 +0900195
Jaehoon Chungd6da7d92017-01-16 15:31:35 +0900196 val = exynos_pcie_readl(ep->phy_base, PCIE_PHY_TRSV0_POWER);
Jingoo Hanf62b8782013-09-06 17:21:45 +0900197 val &= ~PCIE_PHY_TRSV0_PD_TSV;
Jaehoon Chungd6da7d92017-01-16 15:31:35 +0900198 exynos_pcie_writel(ep->phy_base, val, PCIE_PHY_TRSV0_POWER);
Jingoo Hanf62b8782013-09-06 17:21:45 +0900199
Jaehoon Chungd6da7d92017-01-16 15:31:35 +0900200 val = exynos_pcie_readl(ep->phy_base, PCIE_PHY_TRSV1_POWER);
Jingoo Hanf62b8782013-09-06 17:21:45 +0900201 val &= ~PCIE_PHY_TRSV1_PD_TSV;
Jaehoon Chungd6da7d92017-01-16 15:31:35 +0900202 exynos_pcie_writel(ep->phy_base, val, PCIE_PHY_TRSV1_POWER);
Jingoo Hanf62b8782013-09-06 17:21:45 +0900203
Jaehoon Chungd6da7d92017-01-16 15:31:35 +0900204 val = exynos_pcie_readl(ep->phy_base, PCIE_PHY_TRSV2_POWER);
Jingoo Hanf62b8782013-09-06 17:21:45 +0900205 val &= ~PCIE_PHY_TRSV2_PD_TSV;
Jaehoon Chungd6da7d92017-01-16 15:31:35 +0900206 exynos_pcie_writel(ep->phy_base, val, PCIE_PHY_TRSV2_POWER);
Jingoo Hanf62b8782013-09-06 17:21:45 +0900207
Jaehoon Chungd6da7d92017-01-16 15:31:35 +0900208 val = exynos_pcie_readl(ep->phy_base, PCIE_PHY_TRSV3_POWER);
Jingoo Hanf62b8782013-09-06 17:21:45 +0900209 val &= ~PCIE_PHY_TRSV3_PD_TSV;
Jaehoon Chungd6da7d92017-01-16 15:31:35 +0900210 exynos_pcie_writel(ep->phy_base, val, PCIE_PHY_TRSV3_POWER);
Jingoo Hanf62b8782013-09-06 17:21:45 +0900211}
212
Jaehoon Chung4e0a90b382017-01-16 15:31:34 +0900213static void exynos_pcie_power_off_phy(struct exynos_pcie *ep)
Jingoo Hanf62b8782013-09-06 17:21:45 +0900214{
215 u32 val;
Jingoo Hanf62b8782013-09-06 17:21:45 +0900216
Jaehoon Chungd6da7d92017-01-16 15:31:35 +0900217 val = exynos_pcie_readl(ep->phy_base, PCIE_PHY_COMMON_POWER);
Jingoo Hanf62b8782013-09-06 17:21:45 +0900218 val |= PCIE_PHY_COMMON_PD_CMN;
Jaehoon Chungd6da7d92017-01-16 15:31:35 +0900219 exynos_pcie_writel(ep->phy_base, val, PCIE_PHY_COMMON_POWER);
Jingoo Hanf62b8782013-09-06 17:21:45 +0900220
Jaehoon Chungd6da7d92017-01-16 15:31:35 +0900221 val = exynos_pcie_readl(ep->phy_base, PCIE_PHY_TRSV0_POWER);
Jingoo Hanf62b8782013-09-06 17:21:45 +0900222 val |= PCIE_PHY_TRSV0_PD_TSV;
Jaehoon Chungd6da7d92017-01-16 15:31:35 +0900223 exynos_pcie_writel(ep->phy_base, val, PCIE_PHY_TRSV0_POWER);
Jingoo Hanf62b8782013-09-06 17:21:45 +0900224
Jaehoon Chungd6da7d92017-01-16 15:31:35 +0900225 val = exynos_pcie_readl(ep->phy_base, PCIE_PHY_TRSV1_POWER);
Jingoo Hanf62b8782013-09-06 17:21:45 +0900226 val |= PCIE_PHY_TRSV1_PD_TSV;
Jaehoon Chungd6da7d92017-01-16 15:31:35 +0900227 exynos_pcie_writel(ep->phy_base, val, PCIE_PHY_TRSV1_POWER);
Jingoo Hanf62b8782013-09-06 17:21:45 +0900228
Jaehoon Chungd6da7d92017-01-16 15:31:35 +0900229 val = exynos_pcie_readl(ep->phy_base, PCIE_PHY_TRSV2_POWER);
Jingoo Hanf62b8782013-09-06 17:21:45 +0900230 val |= PCIE_PHY_TRSV2_PD_TSV;
Jaehoon Chungd6da7d92017-01-16 15:31:35 +0900231 exynos_pcie_writel(ep->phy_base, val, PCIE_PHY_TRSV2_POWER);
Jingoo Hanf62b8782013-09-06 17:21:45 +0900232
Jaehoon Chungd6da7d92017-01-16 15:31:35 +0900233 val = exynos_pcie_readl(ep->phy_base, PCIE_PHY_TRSV3_POWER);
Jingoo Hanf62b8782013-09-06 17:21:45 +0900234 val |= PCIE_PHY_TRSV3_PD_TSV;
Jaehoon Chungd6da7d92017-01-16 15:31:35 +0900235 exynos_pcie_writel(ep->phy_base, val, PCIE_PHY_TRSV3_POWER);
Jingoo Hanf62b8782013-09-06 17:21:45 +0900236}
237
Jaehoon Chung4e0a90b382017-01-16 15:31:34 +0900238static void exynos_pcie_init_phy(struct exynos_pcie *ep)
Jingoo Han4b1ced82013-07-31 17:14:10 +0900239{
Jingoo Han4b1ced82013-07-31 17:14:10 +0900240 /* DCC feedback control off */
Jaehoon Chungd6da7d92017-01-16 15:31:35 +0900241 exynos_pcie_writel(ep->phy_base, 0x29, PCIE_PHY_DCC_FEEDBACK);
Jingoo Han4b1ced82013-07-31 17:14:10 +0900242
243 /* set TX/RX impedance */
Jaehoon Chungd6da7d92017-01-16 15:31:35 +0900244 exynos_pcie_writel(ep->phy_base, 0xd5, PCIE_PHY_IMPEDANCE);
Jingoo Han4b1ced82013-07-31 17:14:10 +0900245
246 /* set 50Mhz PHY clock */
Jaehoon Chungd6da7d92017-01-16 15:31:35 +0900247 exynos_pcie_writel(ep->phy_base, 0x14, PCIE_PHY_PLL_DIV_0);
248 exynos_pcie_writel(ep->phy_base, 0x12, PCIE_PHY_PLL_DIV_1);
Jingoo Han4b1ced82013-07-31 17:14:10 +0900249
250 /* set TX Differential output for lane 0 */
Jaehoon Chungd6da7d92017-01-16 15:31:35 +0900251 exynos_pcie_writel(ep->phy_base, 0x7f, PCIE_PHY_TRSV0_DRV_LVL);
Jingoo Han4b1ced82013-07-31 17:14:10 +0900252
253 /* set TX Pre-emphasis Level Control for lane 0 to minimum */
Jaehoon Chungd6da7d92017-01-16 15:31:35 +0900254 exynos_pcie_writel(ep->phy_base, 0x0, PCIE_PHY_TRSV0_EMP_LVL);
Jingoo Han4b1ced82013-07-31 17:14:10 +0900255
256 /* set RX clock and data recovery bandwidth */
Jaehoon Chungd6da7d92017-01-16 15:31:35 +0900257 exynos_pcie_writel(ep->phy_base, 0xe7, PCIE_PHY_PLL_BIAS);
258 exynos_pcie_writel(ep->phy_base, 0x82, PCIE_PHY_TRSV0_RXCDR);
259 exynos_pcie_writel(ep->phy_base, 0x82, PCIE_PHY_TRSV1_RXCDR);
260 exynos_pcie_writel(ep->phy_base, 0x82, PCIE_PHY_TRSV2_RXCDR);
261 exynos_pcie_writel(ep->phy_base, 0x82, PCIE_PHY_TRSV3_RXCDR);
Jingoo Han4b1ced82013-07-31 17:14:10 +0900262
263 /* change TX Pre-emphasis Level Control for lanes */
Jaehoon Chungd6da7d92017-01-16 15:31:35 +0900264 exynos_pcie_writel(ep->phy_base, 0x39, PCIE_PHY_TRSV0_EMP_LVL);
265 exynos_pcie_writel(ep->phy_base, 0x39, PCIE_PHY_TRSV1_EMP_LVL);
266 exynos_pcie_writel(ep->phy_base, 0x39, PCIE_PHY_TRSV2_EMP_LVL);
267 exynos_pcie_writel(ep->phy_base, 0x39, PCIE_PHY_TRSV3_EMP_LVL);
Jingoo Han4b1ced82013-07-31 17:14:10 +0900268
269 /* set LVCC */
Jaehoon Chungd6da7d92017-01-16 15:31:35 +0900270 exynos_pcie_writel(ep->phy_base, 0x20, PCIE_PHY_TRSV0_LVCC);
271 exynos_pcie_writel(ep->phy_base, 0xa0, PCIE_PHY_TRSV1_LVCC);
272 exynos_pcie_writel(ep->phy_base, 0xa0, PCIE_PHY_TRSV2_LVCC);
273 exynos_pcie_writel(ep->phy_base, 0xa0, PCIE_PHY_TRSV3_LVCC);
Jingoo Han4b1ced82013-07-31 17:14:10 +0900274}
275
Jaehoon Chung4e0a90b382017-01-16 15:31:34 +0900276static void exynos_pcie_assert_reset(struct exynos_pcie *ep)
Jingoo Han4b1ced82013-07-31 17:14:10 +0900277{
Jaehoon Chung4e0a90b382017-01-16 15:31:34 +0900278 struct pcie_port *pp = &ep->pp;
Bjorn Helgaasfae68d62016-10-06 13:33:41 -0500279 struct device *dev = pp->dev;
Jingoo Han4b1ced82013-07-31 17:14:10 +0900280
Jaehoon Chung4e0a90b382017-01-16 15:31:34 +0900281 if (ep->reset_gpio >= 0)
282 devm_gpio_request_one(dev, ep->reset_gpio,
Jingoo Han4b1ced82013-07-31 17:14:10 +0900283 GPIOF_OUT_INIT_HIGH, "RESET");
Jingoo Han4b1ced82013-07-31 17:14:10 +0900284}
285
Jaehoon Chung4e0a90b382017-01-16 15:31:34 +0900286static int exynos_pcie_establish_link(struct exynos_pcie *ep)
Jingoo Han4b1ced82013-07-31 17:14:10 +0900287{
Jaehoon Chung4e0a90b382017-01-16 15:31:34 +0900288 struct pcie_port *pp = &ep->pp;
Bjorn Helgaasfae68d62016-10-06 13:33:41 -0500289 struct device *dev = pp->dev;
Bjorn Helgaas6cbb2472015-06-02 16:47:17 -0500290 u32 val;
Jingoo Han4b1ced82013-07-31 17:14:10 +0900291
292 if (dw_pcie_link_up(pp)) {
Bjorn Helgaasfae68d62016-10-06 13:33:41 -0500293 dev_err(dev, "Link already up\n");
Jingoo Han4b1ced82013-07-31 17:14:10 +0900294 return 0;
295 }
296
Jaehoon Chung4e0a90b382017-01-16 15:31:34 +0900297 exynos_pcie_assert_core_reset(ep);
298 exynos_pcie_assert_phy_reset(ep);
299 exynos_pcie_deassert_phy_reset(ep);
300 exynos_pcie_power_on_phy(ep);
301 exynos_pcie_init_phy(ep);
Jingoo Han4b1ced82013-07-31 17:14:10 +0900302
303 /* pulse for common reset */
Jaehoon Chungd6da7d92017-01-16 15:31:35 +0900304 exynos_pcie_writel(ep->block_base, 1, PCIE_PHY_COMMON_RESET);
Jingoo Han4b1ced82013-07-31 17:14:10 +0900305 udelay(500);
Jaehoon Chungd6da7d92017-01-16 15:31:35 +0900306 exynos_pcie_writel(ep->block_base, 0, PCIE_PHY_COMMON_RESET);
Jingoo Han4b1ced82013-07-31 17:14:10 +0900307
Jaehoon Chung4e0a90b382017-01-16 15:31:34 +0900308 exynos_pcie_deassert_core_reset(ep);
Jingoo Han4b1ced82013-07-31 17:14:10 +0900309 dw_pcie_setup_rc(pp);
Jaehoon Chung4e0a90b382017-01-16 15:31:34 +0900310 exynos_pcie_assert_reset(ep);
Jingoo Han4b1ced82013-07-31 17:14:10 +0900311
312 /* assert LTSSM enable */
Jaehoon Chungd6da7d92017-01-16 15:31:35 +0900313 exynos_pcie_writel(ep->elbi_base, PCIE_ELBI_LTSSM_ENABLE,
Seungwon Jeon058dd012013-08-29 21:35:56 +0900314 PCIE_APP_LTSSM_ENABLE);
Jingoo Han4b1ced82013-07-31 17:14:10 +0900315
316 /* check if the link is up or not */
Joao Pinto886bc5c2016-03-10 14:44:35 -0600317 if (!dw_pcie_wait_for_link(pp))
318 return 0;
Jingoo Han4b1ced82013-07-31 17:14:10 +0900319
Jaehoon Chungd6da7d92017-01-16 15:31:35 +0900320 while (exynos_pcie_readl(ep->phy_base, PCIE_PHY_PLL_LOCKED) == 0) {
321 val = exynos_pcie_readl(ep->block_base, PCIE_PHY_PLL_LOCKED);
Bjorn Helgaasfae68d62016-10-06 13:33:41 -0500322 dev_info(dev, "PLL Locked: 0x%x\n", val);
Bjorn Helgaas6cbb2472015-06-02 16:47:17 -0500323 }
Jaehoon Chung4e0a90b382017-01-16 15:31:34 +0900324 exynos_pcie_power_off_phy(ep);
Joao Pinto886bc5c2016-03-10 14:44:35 -0600325 return -ETIMEDOUT;
Jingoo Han4b1ced82013-07-31 17:14:10 +0900326}
327
Jaehoon Chung4e0a90b382017-01-16 15:31:34 +0900328static void exynos_pcie_clear_irq_pulse(struct exynos_pcie *ep)
Jingoo Han4b1ced82013-07-31 17:14:10 +0900329{
330 u32 val;
Jingoo Han4b1ced82013-07-31 17:14:10 +0900331
Jaehoon Chungd6da7d92017-01-16 15:31:35 +0900332 val = exynos_pcie_readl(ep->elbi_base, PCIE_IRQ_PULSE);
333 exynos_pcie_writel(ep->elbi_base, val, PCIE_IRQ_PULSE);
Jingoo Han4b1ced82013-07-31 17:14:10 +0900334}
335
Jaehoon Chung4e0a90b382017-01-16 15:31:34 +0900336static void exynos_pcie_enable_irq_pulse(struct exynos_pcie *ep)
Jingoo Han4b1ced82013-07-31 17:14:10 +0900337{
338 u32 val;
Jingoo Han4b1ced82013-07-31 17:14:10 +0900339
340 /* enable INTX interrupt */
341 val = IRQ_INTA_ASSERT | IRQ_INTB_ASSERT |
Jaehoon Chung01d06a92015-03-25 14:13:12 +0900342 IRQ_INTC_ASSERT | IRQ_INTD_ASSERT;
Jaehoon Chungd6da7d92017-01-16 15:31:35 +0900343 exynos_pcie_writel(ep->elbi_base, val, PCIE_IRQ_EN_PULSE);
Jingoo Han4b1ced82013-07-31 17:14:10 +0900344}
345
346static irqreturn_t exynos_pcie_irq_handler(int irq, void *arg)
347{
Jaehoon Chung4e0a90b382017-01-16 15:31:34 +0900348 struct exynos_pcie *ep = arg;
Jingoo Han4b1ced82013-07-31 17:14:10 +0900349
Jaehoon Chung4e0a90b382017-01-16 15:31:34 +0900350 exynos_pcie_clear_irq_pulse(ep);
Jingoo Han4b1ced82013-07-31 17:14:10 +0900351 return IRQ_HANDLED;
352}
353
Jingoo Hanf342d942013-09-06 15:54:59 +0900354static irqreturn_t exynos_pcie_msi_irq_handler(int irq, void *arg)
355{
Jaehoon Chung4e0a90b382017-01-16 15:31:34 +0900356 struct exynos_pcie *ep = arg;
357 struct pcie_port *pp = &ep->pp;
Jingoo Hanf342d942013-09-06 15:54:59 +0900358
Lucas Stach7f4f16e2014-03-28 17:52:58 +0100359 return dw_handle_msi_irq(pp);
Jingoo Hanf342d942013-09-06 15:54:59 +0900360}
361
Jaehoon Chung4e0a90b382017-01-16 15:31:34 +0900362static void exynos_pcie_msi_init(struct exynos_pcie *ep)
Jingoo Hanf342d942013-09-06 15:54:59 +0900363{
Jaehoon Chung4e0a90b382017-01-16 15:31:34 +0900364 struct pcie_port *pp = &ep->pp;
Jingoo Hanf342d942013-09-06 15:54:59 +0900365 u32 val;
Jingoo Hanf342d942013-09-06 15:54:59 +0900366
367 dw_pcie_msi_init(pp);
368
369 /* enable MSI interrupt */
Jaehoon Chungd6da7d92017-01-16 15:31:35 +0900370 val = exynos_pcie_readl(ep->elbi_base, PCIE_IRQ_EN_LEVEL);
Jingoo Hanf342d942013-09-06 15:54:59 +0900371 val |= IRQ_MSI_ENABLE;
Jaehoon Chungd6da7d92017-01-16 15:31:35 +0900372 exynos_pcie_writel(ep->elbi_base, val, PCIE_IRQ_EN_LEVEL);
Jingoo Hanf342d942013-09-06 15:54:59 +0900373}
374
Jaehoon Chung4e0a90b382017-01-16 15:31:34 +0900375static void exynos_pcie_enable_interrupts(struct exynos_pcie *ep)
Jingoo Han4b1ced82013-07-31 17:14:10 +0900376{
Jaehoon Chung4e0a90b382017-01-16 15:31:34 +0900377 exynos_pcie_enable_irq_pulse(ep);
Jingoo Hanf342d942013-09-06 15:54:59 +0900378
379 if (IS_ENABLED(CONFIG_PCI_MSI))
Jaehoon Chung4e0a90b382017-01-16 15:31:34 +0900380 exynos_pcie_msi_init(ep);
Jingoo Han4b1ced82013-07-31 17:14:10 +0900381}
382
Bjorn Helgaas53e5bff12016-10-10 07:50:07 -0500383static u32 exynos_pcie_readl_rc(struct pcie_port *pp, u32 reg)
Jingoo Han4b1ced82013-07-31 17:14:10 +0900384{
Jaehoon Chung4e0a90b382017-01-16 15:31:34 +0900385 struct exynos_pcie *ep = to_exynos_pcie(pp);
Bjorn Helgaas446fc232016-08-17 14:17:58 -0500386 u32 val;
387
Jaehoon Chung4e0a90b382017-01-16 15:31:34 +0900388 exynos_pcie_sideband_dbi_r_mode(ep, true);
Bjorn Helgaas7e00dfd2016-10-06 13:25:46 -0500389 val = readl(pp->dbi_base + reg);
Jaehoon Chung4e0a90b382017-01-16 15:31:34 +0900390 exynos_pcie_sideband_dbi_r_mode(ep, false);
Bjorn Helgaas446fc232016-08-17 14:17:58 -0500391 return val;
Jingoo Han4b1ced82013-07-31 17:14:10 +0900392}
393
Bjorn Helgaas53e5bff12016-10-10 07:50:07 -0500394static void exynos_pcie_writel_rc(struct pcie_port *pp, u32 reg, u32 val)
Jingoo Han4b1ced82013-07-31 17:14:10 +0900395{
Jaehoon Chung4e0a90b382017-01-16 15:31:34 +0900396 struct exynos_pcie *ep = to_exynos_pcie(pp);
Bjorn Helgaascc08e822016-10-06 13:33:39 -0500397
Jaehoon Chung4e0a90b382017-01-16 15:31:34 +0900398 exynos_pcie_sideband_dbi_w_mode(ep, true);
Bjorn Helgaas7e00dfd2016-10-06 13:25:46 -0500399 writel(val, pp->dbi_base + reg);
Jaehoon Chung4e0a90b382017-01-16 15:31:34 +0900400 exynos_pcie_sideband_dbi_w_mode(ep, false);
Jingoo Han4b1ced82013-07-31 17:14:10 +0900401}
402
403static int exynos_pcie_rd_own_conf(struct pcie_port *pp, int where, int size,
404 u32 *val)
405{
Jaehoon Chung4e0a90b382017-01-16 15:31:34 +0900406 struct exynos_pcie *ep = to_exynos_pcie(pp);
Jingoo Han4b1ced82013-07-31 17:14:10 +0900407 int ret;
408
Jaehoon Chung4e0a90b382017-01-16 15:31:34 +0900409 exynos_pcie_sideband_dbi_r_mode(ep, true);
Gabriele Paoloni4c458522015-10-08 14:27:48 -0500410 ret = dw_pcie_cfg_read(pp->dbi_base + where, size, val);
Jaehoon Chung4e0a90b382017-01-16 15:31:34 +0900411 exynos_pcie_sideband_dbi_r_mode(ep, false);
Jingoo Han4b1ced82013-07-31 17:14:10 +0900412 return ret;
413}
414
415static int exynos_pcie_wr_own_conf(struct pcie_port *pp, int where, int size,
416 u32 val)
417{
Jaehoon Chung4e0a90b382017-01-16 15:31:34 +0900418 struct exynos_pcie *ep = to_exynos_pcie(pp);
Jingoo Han4b1ced82013-07-31 17:14:10 +0900419 int ret;
420
Jaehoon Chung4e0a90b382017-01-16 15:31:34 +0900421 exynos_pcie_sideband_dbi_w_mode(ep, true);
Gabriele Paoloni4c458522015-10-08 14:27:48 -0500422 ret = dw_pcie_cfg_write(pp->dbi_base + where, size, val);
Jaehoon Chung4e0a90b382017-01-16 15:31:34 +0900423 exynos_pcie_sideband_dbi_w_mode(ep, false);
Jingoo Han4b1ced82013-07-31 17:14:10 +0900424 return ret;
425}
426
427static int exynos_pcie_link_up(struct pcie_port *pp)
428{
Jaehoon Chung4e0a90b382017-01-16 15:31:34 +0900429 struct exynos_pcie *ep = to_exynos_pcie(pp);
Bjorn Helgaascc08e822016-10-06 13:33:39 -0500430 u32 val;
Jingoo Han4b1ced82013-07-31 17:14:10 +0900431
Jaehoon Chungd6da7d92017-01-16 15:31:35 +0900432 val = exynos_pcie_readl(ep->elbi_base, PCIE_ELBI_RDLH_LINKUP);
Jingoo Han4b1ced82013-07-31 17:14:10 +0900433 if (val == PCIE_ELBI_LTSSM_ENABLE)
434 return 1;
435
436 return 0;
437}
438
439static void exynos_pcie_host_init(struct pcie_port *pp)
440{
Jaehoon Chung4e0a90b382017-01-16 15:31:34 +0900441 struct exynos_pcie *ep = to_exynos_pcie(pp);
Bjorn Helgaascc08e822016-10-06 13:33:39 -0500442
Jaehoon Chung4e0a90b382017-01-16 15:31:34 +0900443 exynos_pcie_establish_link(ep);
444 exynos_pcie_enable_interrupts(ep);
Jingoo Han4b1ced82013-07-31 17:14:10 +0900445}
446
447static struct pcie_host_ops exynos_pcie_host_ops = {
448 .readl_rc = exynos_pcie_readl_rc,
449 .writel_rc = exynos_pcie_writel_rc,
450 .rd_own_conf = exynos_pcie_rd_own_conf,
451 .wr_own_conf = exynos_pcie_wr_own_conf,
452 .link_up = exynos_pcie_link_up,
453 .host_init = exynos_pcie_host_init,
454};
455
Jaehoon Chung4e0a90b382017-01-16 15:31:34 +0900456static int __init exynos_add_pcie_port(struct exynos_pcie *ep,
Jingoo Han70b3e892014-10-22 13:58:49 +0900457 struct platform_device *pdev)
Jingoo Han4b1ced82013-07-31 17:14:10 +0900458{
Jaehoon Chung4e0a90b382017-01-16 15:31:34 +0900459 struct pcie_port *pp = &ep->pp;
Bjorn Helgaasfae68d62016-10-06 13:33:41 -0500460 struct device *dev = pp->dev;
Jingoo Han4b1ced82013-07-31 17:14:10 +0900461 int ret;
462
463 pp->irq = platform_get_irq(pdev, 1);
464 if (!pp->irq) {
Bjorn Helgaasfae68d62016-10-06 13:33:41 -0500465 dev_err(dev, "failed to get irq\n");
Jingoo Han4b1ced82013-07-31 17:14:10 +0900466 return -ENODEV;
467 }
Bjorn Helgaasfae68d62016-10-06 13:33:41 -0500468 ret = devm_request_irq(dev, pp->irq, exynos_pcie_irq_handler,
Jaehoon Chung4e0a90b382017-01-16 15:31:34 +0900469 IRQF_SHARED, "exynos-pcie", ep);
Jingoo Han4b1ced82013-07-31 17:14:10 +0900470 if (ret) {
Bjorn Helgaasfae68d62016-10-06 13:33:41 -0500471 dev_err(dev, "failed to request irq\n");
Jingoo Han4b1ced82013-07-31 17:14:10 +0900472 return ret;
473 }
474
Jingoo Hanf342d942013-09-06 15:54:59 +0900475 if (IS_ENABLED(CONFIG_PCI_MSI)) {
476 pp->msi_irq = platform_get_irq(pdev, 0);
477 if (!pp->msi_irq) {
Bjorn Helgaasfae68d62016-10-06 13:33:41 -0500478 dev_err(dev, "failed to get msi irq\n");
Jingoo Hanf342d942013-09-06 15:54:59 +0900479 return -ENODEV;
480 }
481
Bjorn Helgaasfae68d62016-10-06 13:33:41 -0500482 ret = devm_request_irq(dev, pp->msi_irq,
Jingoo Hanf342d942013-09-06 15:54:59 +0900483 exynos_pcie_msi_irq_handler,
Grygorii Strashko8ff0ef92015-12-10 21:18:20 +0200484 IRQF_SHARED | IRQF_NO_THREAD,
Jaehoon Chung4e0a90b382017-01-16 15:31:34 +0900485 "exynos-pcie", ep);
Jingoo Hanf342d942013-09-06 15:54:59 +0900486 if (ret) {
Bjorn Helgaasfae68d62016-10-06 13:33:41 -0500487 dev_err(dev, "failed to request msi irq\n");
Jingoo Hanf342d942013-09-06 15:54:59 +0900488 return ret;
489 }
490 }
491
Jingoo Han4b1ced82013-07-31 17:14:10 +0900492 pp->root_bus_nr = -1;
493 pp->ops = &exynos_pcie_host_ops;
494
Jingoo Han4b1ced82013-07-31 17:14:10 +0900495 ret = dw_pcie_host_init(pp);
496 if (ret) {
Bjorn Helgaasfae68d62016-10-06 13:33:41 -0500497 dev_err(dev, "failed to initialize host\n");
Jingoo Han4b1ced82013-07-31 17:14:10 +0900498 return ret;
499 }
500
501 return 0;
502}
503
504static int __init exynos_pcie_probe(struct platform_device *pdev)
505{
Bjorn Helgaasfae68d62016-10-06 13:33:41 -0500506 struct device *dev = &pdev->dev;
Jaehoon Chung4e0a90b382017-01-16 15:31:34 +0900507 struct exynos_pcie *ep;
Jingoo Han4b1ced82013-07-31 17:14:10 +0900508 struct pcie_port *pp;
Bjorn Helgaasfae68d62016-10-06 13:33:41 -0500509 struct device_node *np = dev->of_node;
Jingoo Han4b1ced82013-07-31 17:14:10 +0900510 struct resource *elbi_base;
511 struct resource *phy_base;
512 struct resource *block_base;
513 int ret;
514
Jaehoon Chung4e0a90b382017-01-16 15:31:34 +0900515 ep = devm_kzalloc(dev, sizeof(*ep), GFP_KERNEL);
516 if (!ep)
Jingoo Han4b1ced82013-07-31 17:14:10 +0900517 return -ENOMEM;
Jingoo Han4b1ced82013-07-31 17:14:10 +0900518
Jaehoon Chung4e0a90b382017-01-16 15:31:34 +0900519 pp = &ep->pp;
Bjorn Helgaasfae68d62016-10-06 13:33:41 -0500520 pp->dev = dev;
Jingoo Han4b1ced82013-07-31 17:14:10 +0900521
Jaehoon Chung4e0a90b382017-01-16 15:31:34 +0900522 ep->reset_gpio = of_get_named_gpio(np, "reset-gpio", 0);
Jingoo Han4b1ced82013-07-31 17:14:10 +0900523
Jaehoon Chung4e0a90b382017-01-16 15:31:34 +0900524 ep->clk = devm_clk_get(dev, "pcie");
525 if (IS_ERR(ep->clk)) {
Bjorn Helgaasfae68d62016-10-06 13:33:41 -0500526 dev_err(dev, "Failed to get pcie rc clock\n");
Jaehoon Chung4e0a90b382017-01-16 15:31:34 +0900527 return PTR_ERR(ep->clk);
Jingoo Han4b1ced82013-07-31 17:14:10 +0900528 }
Jaehoon Chung4e0a90b382017-01-16 15:31:34 +0900529 ret = clk_prepare_enable(ep->clk);
Jingoo Han4b1ced82013-07-31 17:14:10 +0900530 if (ret)
531 return ret;
532
Jaehoon Chung4e0a90b382017-01-16 15:31:34 +0900533 ep->bus_clk = devm_clk_get(dev, "pcie_bus");
534 if (IS_ERR(ep->bus_clk)) {
Bjorn Helgaasfae68d62016-10-06 13:33:41 -0500535 dev_err(dev, "Failed to get pcie bus clock\n");
Jaehoon Chung4e0a90b382017-01-16 15:31:34 +0900536 ret = PTR_ERR(ep->bus_clk);
Jingoo Han4b1ced82013-07-31 17:14:10 +0900537 goto fail_clk;
538 }
Jaehoon Chung4e0a90b382017-01-16 15:31:34 +0900539 ret = clk_prepare_enable(ep->bus_clk);
Jingoo Han4b1ced82013-07-31 17:14:10 +0900540 if (ret)
541 goto fail_clk;
542
543 elbi_base = platform_get_resource(pdev, IORESOURCE_MEM, 0);
Jaehoon Chung4e0a90b382017-01-16 15:31:34 +0900544 ep->elbi_base = devm_ioremap_resource(dev, elbi_base);
545 if (IS_ERR(ep->elbi_base)) {
546 ret = PTR_ERR(ep->elbi_base);
Wei Yongjunf8db3c92013-09-29 10:29:11 +0800547 goto fail_bus_clk;
548 }
Jingoo Han4b1ced82013-07-31 17:14:10 +0900549
550 phy_base = platform_get_resource(pdev, IORESOURCE_MEM, 1);
Jaehoon Chung4e0a90b382017-01-16 15:31:34 +0900551 ep->phy_base = devm_ioremap_resource(dev, phy_base);
552 if (IS_ERR(ep->phy_base)) {
553 ret = PTR_ERR(ep->phy_base);
Wei Yongjunf8db3c92013-09-29 10:29:11 +0800554 goto fail_bus_clk;
555 }
Jingoo Han4b1ced82013-07-31 17:14:10 +0900556
557 block_base = platform_get_resource(pdev, IORESOURCE_MEM, 2);
Jaehoon Chung4e0a90b382017-01-16 15:31:34 +0900558 ep->block_base = devm_ioremap_resource(dev, block_base);
559 if (IS_ERR(ep->block_base)) {
560 ret = PTR_ERR(ep->block_base);
Wei Yongjunf8db3c92013-09-29 10:29:11 +0800561 goto fail_bus_clk;
562 }
Jingoo Han4b1ced82013-07-31 17:14:10 +0900563
Jaehoon Chung4e0a90b382017-01-16 15:31:34 +0900564 ret = exynos_add_pcie_port(ep, pdev);
Jingoo Han4b1ced82013-07-31 17:14:10 +0900565 if (ret < 0)
566 goto fail_bus_clk;
567
Jaehoon Chung4e0a90b382017-01-16 15:31:34 +0900568 platform_set_drvdata(pdev, ep);
Jingoo Han4b1ced82013-07-31 17:14:10 +0900569 return 0;
570
571fail_bus_clk:
Jaehoon Chung4e0a90b382017-01-16 15:31:34 +0900572 clk_disable_unprepare(ep->bus_clk);
Jingoo Han4b1ced82013-07-31 17:14:10 +0900573fail_clk:
Jaehoon Chung4e0a90b382017-01-16 15:31:34 +0900574 clk_disable_unprepare(ep->clk);
Jingoo Han4b1ced82013-07-31 17:14:10 +0900575 return ret;
576}
577
578static int __exit exynos_pcie_remove(struct platform_device *pdev)
579{
Jaehoon Chung4e0a90b382017-01-16 15:31:34 +0900580 struct exynos_pcie *ep = platform_get_drvdata(pdev);
Jingoo Han4b1ced82013-07-31 17:14:10 +0900581
Jaehoon Chung4e0a90b382017-01-16 15:31:34 +0900582 clk_disable_unprepare(ep->bus_clk);
583 clk_disable_unprepare(ep->clk);
Jingoo Han4b1ced82013-07-31 17:14:10 +0900584
585 return 0;
586}
587
588static const struct of_device_id exynos_pcie_of_match[] = {
589 { .compatible = "samsung,exynos5440-pcie", },
590 {},
591};
Jingoo Han4b1ced82013-07-31 17:14:10 +0900592
593static struct platform_driver exynos_pcie_driver = {
594 .remove = __exit_p(exynos_pcie_remove),
595 .driver = {
596 .name = "exynos-pcie",
Sachin Kamateb363092013-10-21 14:36:43 +0530597 .of_match_table = exynos_pcie_of_match,
Jingoo Han4b1ced82013-07-31 17:14:10 +0900598 },
599};
600
601/* Exynos PCIe driver does not allow module unload */
602
Jingoo Han70b3e892014-10-22 13:58:49 +0900603static int __init exynos_pcie_init(void)
Jingoo Han4b1ced82013-07-31 17:14:10 +0900604{
605 return platform_driver_probe(&exynos_pcie_driver, exynos_pcie_probe);
606}
Jingoo Han70b3e892014-10-22 13:58:49 +0900607subsys_initcall(exynos_pcie_init);