diff options
author | Bjorn Helgaas <bhelgaas@google.com> | 2016-10-06 14:33:39 -0400 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2016-10-11 22:26:39 -0400 |
commit | cc08e82b854c332d506a5e84ef8feca85d98b436 (patch) | |
tree | eb6c28cb84fbbd23ca445202b16c73ab5ccb5a3f /drivers/pci/host/pci-exynos.c | |
parent | 10284bfa347815fcce3f7133860fb9570576f8ab (diff) |
PCI: exynos: Pass device-specific struct to internal functions
Only interfaces used from outside the driver, e.g., those called by the
DesignWare core, need to accept pointers to the generic struct pcie_port.
Internal interfaces can accept pointers to the device-specific struct,
which makes them more straightforward. No functional change intended.
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Diffstat (limited to 'drivers/pci/host/pci-exynos.c')
-rw-r--r-- | drivers/pci/host/pci-exynos.c | 132 |
1 files changed, 58 insertions, 74 deletions
diff --git a/drivers/pci/host/pci-exynos.c b/drivers/pci/host/pci-exynos.c index 2b4d88633040..829aa6be0861 100644 --- a/drivers/pci/host/pci-exynos.c +++ b/drivers/pci/host/pci-exynos.c | |||
@@ -132,10 +132,10 @@ static u32 exynos_blk_readl(struct exynos_pcie *exynos_pcie, u32 reg) | |||
132 | return readl(exynos_pcie->block_base + reg); | 132 | return readl(exynos_pcie->block_base + reg); |
133 | } | 133 | } |
134 | 134 | ||
135 | static void exynos_pcie_sideband_dbi_w_mode(struct pcie_port *pp, bool on) | 135 | static void exynos_pcie_sideband_dbi_w_mode(struct exynos_pcie *exynos_pcie, |
136 | bool on) | ||
136 | { | 137 | { |
137 | u32 val; | 138 | u32 val; |
138 | struct exynos_pcie *exynos_pcie = to_exynos_pcie(pp); | ||
139 | 139 | ||
140 | if (on) { | 140 | if (on) { |
141 | val = exynos_elb_readl(exynos_pcie, PCIE_ELBI_SLV_AWMISC); | 141 | val = exynos_elb_readl(exynos_pcie, PCIE_ELBI_SLV_AWMISC); |
@@ -148,10 +148,10 @@ static void exynos_pcie_sideband_dbi_w_mode(struct pcie_port *pp, bool on) | |||
148 | } | 148 | } |
149 | } | 149 | } |
150 | 150 | ||
151 | static void exynos_pcie_sideband_dbi_r_mode(struct pcie_port *pp, bool on) | 151 | static void exynos_pcie_sideband_dbi_r_mode(struct exynos_pcie *exynos_pcie, |
152 | bool on) | ||
152 | { | 153 | { |
153 | u32 val; | 154 | u32 val; |
154 | struct exynos_pcie *exynos_pcie = to_exynos_pcie(pp); | ||
155 | 155 | ||
156 | if (on) { | 156 | if (on) { |
157 | val = exynos_elb_readl(exynos_pcie, PCIE_ELBI_SLV_ARMISC); | 157 | val = exynos_elb_readl(exynos_pcie, PCIE_ELBI_SLV_ARMISC); |
@@ -164,10 +164,9 @@ static void exynos_pcie_sideband_dbi_r_mode(struct pcie_port *pp, bool on) | |||
164 | } | 164 | } |
165 | } | 165 | } |
166 | 166 | ||
167 | static void exynos_pcie_assert_core_reset(struct pcie_port *pp) | 167 | static void exynos_pcie_assert_core_reset(struct exynos_pcie *exynos_pcie) |
168 | { | 168 | { |
169 | u32 val; | 169 | u32 val; |
170 | struct exynos_pcie *exynos_pcie = to_exynos_pcie(pp); | ||
171 | 170 | ||
172 | val = exynos_elb_readl(exynos_pcie, PCIE_CORE_RESET); | 171 | val = exynos_elb_readl(exynos_pcie, PCIE_CORE_RESET); |
173 | val &= ~PCIE_CORE_RESET_ENABLE; | 172 | val &= ~PCIE_CORE_RESET_ENABLE; |
@@ -177,10 +176,9 @@ static void exynos_pcie_assert_core_reset(struct pcie_port *pp) | |||
177 | exynos_elb_writel(exynos_pcie, 0, PCIE_NONSTICKY_RESET); | 176 | exynos_elb_writel(exynos_pcie, 0, PCIE_NONSTICKY_RESET); |
178 | } | 177 | } |
179 | 178 | ||
180 | static void exynos_pcie_deassert_core_reset(struct pcie_port *pp) | 179 | static void exynos_pcie_deassert_core_reset(struct exynos_pcie *exynos_pcie) |
181 | { | 180 | { |
182 | u32 val; | 181 | u32 val; |
183 | struct exynos_pcie *exynos_pcie = to_exynos_pcie(pp); | ||
184 | 182 | ||
185 | val = exynos_elb_readl(exynos_pcie, PCIE_CORE_RESET); | 183 | val = exynos_elb_readl(exynos_pcie, PCIE_CORE_RESET); |
186 | val |= PCIE_CORE_RESET_ENABLE; | 184 | val |= PCIE_CORE_RESET_ENABLE; |
@@ -193,18 +191,14 @@ static void exynos_pcie_deassert_core_reset(struct pcie_port *pp) | |||
193 | exynos_blk_writel(exynos_pcie, 1, PCIE_PHY_MAC_RESET); | 191 | exynos_blk_writel(exynos_pcie, 1, PCIE_PHY_MAC_RESET); |
194 | } | 192 | } |
195 | 193 | ||
196 | static void exynos_pcie_assert_phy_reset(struct pcie_port *pp) | 194 | static void exynos_pcie_assert_phy_reset(struct exynos_pcie *exynos_pcie) |
197 | { | 195 | { |
198 | struct exynos_pcie *exynos_pcie = to_exynos_pcie(pp); | ||
199 | |||
200 | exynos_blk_writel(exynos_pcie, 0, PCIE_PHY_MAC_RESET); | 196 | exynos_blk_writel(exynos_pcie, 0, PCIE_PHY_MAC_RESET); |
201 | exynos_blk_writel(exynos_pcie, 1, PCIE_PHY_GLOBAL_RESET); | 197 | exynos_blk_writel(exynos_pcie, 1, PCIE_PHY_GLOBAL_RESET); |
202 | } | 198 | } |
203 | 199 | ||
204 | static void exynos_pcie_deassert_phy_reset(struct pcie_port *pp) | 200 | static void exynos_pcie_deassert_phy_reset(struct exynos_pcie *exynos_pcie) |
205 | { | 201 | { |
206 | struct exynos_pcie *exynos_pcie = to_exynos_pcie(pp); | ||
207 | |||
208 | exynos_blk_writel(exynos_pcie, 0, PCIE_PHY_GLOBAL_RESET); | 202 | exynos_blk_writel(exynos_pcie, 0, PCIE_PHY_GLOBAL_RESET); |
209 | exynos_elb_writel(exynos_pcie, 1, PCIE_PWR_RESET); | 203 | exynos_elb_writel(exynos_pcie, 1, PCIE_PWR_RESET); |
210 | exynos_blk_writel(exynos_pcie, 0, PCIE_PHY_COMMON_RESET); | 204 | exynos_blk_writel(exynos_pcie, 0, PCIE_PHY_COMMON_RESET); |
@@ -213,10 +207,9 @@ static void exynos_pcie_deassert_phy_reset(struct pcie_port *pp) | |||
213 | exynos_blk_writel(exynos_pcie, 0, PCIE_PHY_TRSV_RESET); | 207 | exynos_blk_writel(exynos_pcie, 0, PCIE_PHY_TRSV_RESET); |
214 | } | 208 | } |
215 | 209 | ||
216 | static void exynos_pcie_power_on_phy(struct pcie_port *pp) | 210 | static void exynos_pcie_power_on_phy(struct exynos_pcie *exynos_pcie) |
217 | { | 211 | { |
218 | u32 val; | 212 | u32 val; |
219 | struct exynos_pcie *exynos_pcie = to_exynos_pcie(pp); | ||
220 | 213 | ||
221 | val = exynos_phy_readl(exynos_pcie, PCIE_PHY_COMMON_POWER); | 214 | val = exynos_phy_readl(exynos_pcie, PCIE_PHY_COMMON_POWER); |
222 | val &= ~PCIE_PHY_COMMON_PD_CMN; | 215 | val &= ~PCIE_PHY_COMMON_PD_CMN; |
@@ -239,10 +232,9 @@ static void exynos_pcie_power_on_phy(struct pcie_port *pp) | |||
239 | exynos_phy_writel(exynos_pcie, val, PCIE_PHY_TRSV3_POWER); | 232 | exynos_phy_writel(exynos_pcie, val, PCIE_PHY_TRSV3_POWER); |
240 | } | 233 | } |
241 | 234 | ||
242 | static void exynos_pcie_power_off_phy(struct pcie_port *pp) | 235 | static void exynos_pcie_power_off_phy(struct exynos_pcie *exynos_pcie) |
243 | { | 236 | { |
244 | u32 val; | 237 | u32 val; |
245 | struct exynos_pcie *exynos_pcie = to_exynos_pcie(pp); | ||
246 | 238 | ||
247 | val = exynos_phy_readl(exynos_pcie, PCIE_PHY_COMMON_POWER); | 239 | val = exynos_phy_readl(exynos_pcie, PCIE_PHY_COMMON_POWER); |
248 | val |= PCIE_PHY_COMMON_PD_CMN; | 240 | val |= PCIE_PHY_COMMON_PD_CMN; |
@@ -265,10 +257,8 @@ static void exynos_pcie_power_off_phy(struct pcie_port *pp) | |||
265 | exynos_phy_writel(exynos_pcie, val, PCIE_PHY_TRSV3_POWER); | 257 | exynos_phy_writel(exynos_pcie, val, PCIE_PHY_TRSV3_POWER); |
266 | } | 258 | } |
267 | 259 | ||
268 | static void exynos_pcie_init_phy(struct pcie_port *pp) | 260 | static void exynos_pcie_init_phy(struct exynos_pcie *exynos_pcie) |
269 | { | 261 | { |
270 | struct exynos_pcie *exynos_pcie = to_exynos_pcie(pp); | ||
271 | |||
272 | /* DCC feedback control off */ | 262 | /* DCC feedback control off */ |
273 | exynos_phy_writel(exynos_pcie, 0x29, PCIE_PHY_DCC_FEEDBACK); | 263 | exynos_phy_writel(exynos_pcie, 0x29, PCIE_PHY_DCC_FEEDBACK); |
274 | 264 | ||
@@ -305,9 +295,9 @@ static void exynos_pcie_init_phy(struct pcie_port *pp) | |||
305 | exynos_phy_writel(exynos_pcie, 0xa0, PCIE_PHY_TRSV3_LVCC); | 295 | exynos_phy_writel(exynos_pcie, 0xa0, PCIE_PHY_TRSV3_LVCC); |
306 | } | 296 | } |
307 | 297 | ||
308 | static void exynos_pcie_assert_reset(struct pcie_port *pp) | 298 | static void exynos_pcie_assert_reset(struct exynos_pcie *exynos_pcie) |
309 | { | 299 | { |
310 | struct exynos_pcie *exynos_pcie = to_exynos_pcie(pp); | 300 | struct pcie_port *pp = &exynos_pcie->pp; |
311 | struct device *dev = pp->dev; | 301 | struct device *dev = pp->dev; |
312 | 302 | ||
313 | if (exynos_pcie->reset_gpio >= 0) | 303 | if (exynos_pcie->reset_gpio >= 0) |
@@ -315,9 +305,9 @@ static void exynos_pcie_assert_reset(struct pcie_port *pp) | |||
315 | GPIOF_OUT_INIT_HIGH, "RESET"); | 305 | GPIOF_OUT_INIT_HIGH, "RESET"); |
316 | } | 306 | } |
317 | 307 | ||
318 | static int exynos_pcie_establish_link(struct pcie_port *pp) | 308 | static int exynos_pcie_establish_link(struct exynos_pcie *exynos_pcie) |
319 | { | 309 | { |
320 | struct exynos_pcie *exynos_pcie = to_exynos_pcie(pp); | 310 | struct pcie_port *pp = &exynos_pcie->pp; |
321 | struct device *dev = pp->dev; | 311 | struct device *dev = pp->dev; |
322 | u32 val; | 312 | u32 val; |
323 | 313 | ||
@@ -326,32 +316,20 @@ static int exynos_pcie_establish_link(struct pcie_port *pp) | |||
326 | return 0; | 316 | return 0; |
327 | } | 317 | } |
328 | 318 | ||
329 | /* assert reset signals */ | 319 | exynos_pcie_assert_core_reset(exynos_pcie); |
330 | exynos_pcie_assert_core_reset(pp); | 320 | exynos_pcie_assert_phy_reset(exynos_pcie); |
331 | exynos_pcie_assert_phy_reset(pp); | 321 | exynos_pcie_deassert_phy_reset(exynos_pcie); |
332 | 322 | exynos_pcie_power_on_phy(exynos_pcie); | |
333 | /* de-assert phy reset */ | 323 | exynos_pcie_init_phy(exynos_pcie); |
334 | exynos_pcie_deassert_phy_reset(pp); | ||
335 | |||
336 | /* power on phy */ | ||
337 | exynos_pcie_power_on_phy(pp); | ||
338 | |||
339 | /* initialize phy */ | ||
340 | exynos_pcie_init_phy(pp); | ||
341 | 324 | ||
342 | /* pulse for common reset */ | 325 | /* pulse for common reset */ |
343 | exynos_blk_writel(exynos_pcie, 1, PCIE_PHY_COMMON_RESET); | 326 | exynos_blk_writel(exynos_pcie, 1, PCIE_PHY_COMMON_RESET); |
344 | udelay(500); | 327 | udelay(500); |
345 | exynos_blk_writel(exynos_pcie, 0, PCIE_PHY_COMMON_RESET); | 328 | exynos_blk_writel(exynos_pcie, 0, PCIE_PHY_COMMON_RESET); |
346 | 329 | ||
347 | /* de-assert core reset */ | 330 | exynos_pcie_deassert_core_reset(exynos_pcie); |
348 | exynos_pcie_deassert_core_reset(pp); | ||
349 | |||
350 | /* setup root complex */ | ||
351 | dw_pcie_setup_rc(pp); | 331 | dw_pcie_setup_rc(pp); |
352 | 332 | exynos_pcie_assert_reset(exynos_pcie); | |
353 | /* assert reset signal */ | ||
354 | exynos_pcie_assert_reset(pp); | ||
355 | 333 | ||
356 | /* assert LTSSM enable */ | 334 | /* assert LTSSM enable */ |
357 | exynos_elb_writel(exynos_pcie, PCIE_ELBI_LTSSM_ENABLE, | 335 | exynos_elb_writel(exynos_pcie, PCIE_ELBI_LTSSM_ENABLE, |
@@ -365,25 +343,21 @@ static int exynos_pcie_establish_link(struct pcie_port *pp) | |||
365 | val = exynos_blk_readl(exynos_pcie, PCIE_PHY_PLL_LOCKED); | 343 | val = exynos_blk_readl(exynos_pcie, PCIE_PHY_PLL_LOCKED); |
366 | dev_info(dev, "PLL Locked: 0x%x\n", val); | 344 | dev_info(dev, "PLL Locked: 0x%x\n", val); |
367 | } | 345 | } |
368 | /* power off phy */ | 346 | exynos_pcie_power_off_phy(exynos_pcie); |
369 | exynos_pcie_power_off_phy(pp); | ||
370 | |||
371 | return -ETIMEDOUT; | 347 | return -ETIMEDOUT; |
372 | } | 348 | } |
373 | 349 | ||
374 | static void exynos_pcie_clear_irq_pulse(struct pcie_port *pp) | 350 | static void exynos_pcie_clear_irq_pulse(struct exynos_pcie *exynos_pcie) |
375 | { | 351 | { |
376 | u32 val; | 352 | u32 val; |
377 | struct exynos_pcie *exynos_pcie = to_exynos_pcie(pp); | ||
378 | 353 | ||
379 | val = exynos_elb_readl(exynos_pcie, PCIE_IRQ_PULSE); | 354 | val = exynos_elb_readl(exynos_pcie, PCIE_IRQ_PULSE); |
380 | exynos_elb_writel(exynos_pcie, val, PCIE_IRQ_PULSE); | 355 | exynos_elb_writel(exynos_pcie, val, PCIE_IRQ_PULSE); |
381 | } | 356 | } |
382 | 357 | ||
383 | static void exynos_pcie_enable_irq_pulse(struct pcie_port *pp) | 358 | static void exynos_pcie_enable_irq_pulse(struct exynos_pcie *exynos_pcie) |
384 | { | 359 | { |
385 | u32 val; | 360 | u32 val; |
386 | struct exynos_pcie *exynos_pcie = to_exynos_pcie(pp); | ||
387 | 361 | ||
388 | /* enable INTX interrupt */ | 362 | /* enable INTX interrupt */ |
389 | val = IRQ_INTA_ASSERT | IRQ_INTB_ASSERT | | 363 | val = IRQ_INTA_ASSERT | IRQ_INTB_ASSERT | |
@@ -393,23 +367,24 @@ static void exynos_pcie_enable_irq_pulse(struct pcie_port *pp) | |||
393 | 367 | ||
394 | static irqreturn_t exynos_pcie_irq_handler(int irq, void *arg) | 368 | static irqreturn_t exynos_pcie_irq_handler(int irq, void *arg) |
395 | { | 369 | { |
396 | struct pcie_port *pp = arg; | 370 | struct exynos_pcie *exynos_pcie = arg; |
397 | 371 | ||
398 | exynos_pcie_clear_irq_pulse(pp); | 372 | exynos_pcie_clear_irq_pulse(exynos_pcie); |
399 | return IRQ_HANDLED; | 373 | return IRQ_HANDLED; |
400 | } | 374 | } |
401 | 375 | ||
402 | static irqreturn_t exynos_pcie_msi_irq_handler(int irq, void *arg) | 376 | static irqreturn_t exynos_pcie_msi_irq_handler(int irq, void *arg) |
403 | { | 377 | { |
404 | struct pcie_port *pp = arg; | 378 | struct exynos_pcie *exynos_pcie = arg; |
379 | struct pcie_port *pp = &exynos_pcie->pp; | ||
405 | 380 | ||
406 | return dw_handle_msi_irq(pp); | 381 | return dw_handle_msi_irq(pp); |
407 | } | 382 | } |
408 | 383 | ||
409 | static void exynos_pcie_msi_init(struct pcie_port *pp) | 384 | static void exynos_pcie_msi_init(struct exynos_pcie *exynos_pcie) |
410 | { | 385 | { |
386 | struct pcie_port *pp = &exynos_pcie->pp; | ||
411 | u32 val; | 387 | u32 val; |
412 | struct exynos_pcie *exynos_pcie = to_exynos_pcie(pp); | ||
413 | 388 | ||
414 | dw_pcie_msi_init(pp); | 389 | dw_pcie_msi_init(pp); |
415 | 390 | ||
@@ -419,58 +394,64 @@ static void exynos_pcie_msi_init(struct pcie_port *pp) | |||
419 | exynos_elb_writel(exynos_pcie, val, PCIE_IRQ_EN_LEVEL); | 394 | exynos_elb_writel(exynos_pcie, val, PCIE_IRQ_EN_LEVEL); |
420 | } | 395 | } |
421 | 396 | ||
422 | static void exynos_pcie_enable_interrupts(struct pcie_port *pp) | 397 | static void exynos_pcie_enable_interrupts(struct exynos_pcie *exynos_pcie) |
423 | { | 398 | { |
424 | exynos_pcie_enable_irq_pulse(pp); | 399 | exynos_pcie_enable_irq_pulse(exynos_pcie); |
425 | 400 | ||
426 | if (IS_ENABLED(CONFIG_PCI_MSI)) | 401 | if (IS_ENABLED(CONFIG_PCI_MSI)) |
427 | exynos_pcie_msi_init(pp); | 402 | exynos_pcie_msi_init(exynos_pcie); |
428 | } | 403 | } |
429 | 404 | ||
430 | static u32 exynos_pcie_readl_rc(struct pcie_port *pp, u32 reg) | 405 | static u32 exynos_pcie_readl_rc(struct pcie_port *pp, u32 reg) |
431 | { | 406 | { |
407 | struct exynos_pcie *exynos_pcie = to_exynos_pcie(pp); | ||
432 | u32 val; | 408 | u32 val; |
433 | 409 | ||
434 | exynos_pcie_sideband_dbi_r_mode(pp, true); | 410 | exynos_pcie_sideband_dbi_r_mode(exynos_pcie, true); |
435 | val = readl(pp->dbi_base + reg); | 411 | val = readl(pp->dbi_base + reg); |
436 | exynos_pcie_sideband_dbi_r_mode(pp, false); | 412 | exynos_pcie_sideband_dbi_r_mode(exynos_pcie, false); |
437 | return val; | 413 | return val; |
438 | } | 414 | } |
439 | 415 | ||
440 | static void exynos_pcie_writel_rc(struct pcie_port *pp, u32 reg, u32 val) | 416 | static void exynos_pcie_writel_rc(struct pcie_port *pp, u32 reg, u32 val) |
441 | { | 417 | { |
442 | exynos_pcie_sideband_dbi_w_mode(pp, true); | 418 | struct exynos_pcie *exynos_pcie = to_exynos_pcie(pp); |
419 | |||
420 | exynos_pcie_sideband_dbi_w_mode(exynos_pcie, true); | ||
443 | writel(val, pp->dbi_base + reg); | 421 | writel(val, pp->dbi_base + reg); |
444 | exynos_pcie_sideband_dbi_w_mode(pp, false); | 422 | exynos_pcie_sideband_dbi_w_mode(exynos_pcie, false); |
445 | } | 423 | } |
446 | 424 | ||
447 | static int exynos_pcie_rd_own_conf(struct pcie_port *pp, int where, int size, | 425 | static int exynos_pcie_rd_own_conf(struct pcie_port *pp, int where, int size, |
448 | u32 *val) | 426 | u32 *val) |
449 | { | 427 | { |
428 | struct exynos_pcie *exynos_pcie = to_exynos_pcie(pp); | ||
450 | int ret; | 429 | int ret; |
451 | 430 | ||
452 | exynos_pcie_sideband_dbi_r_mode(pp, true); | 431 | exynos_pcie_sideband_dbi_r_mode(exynos_pcie, true); |
453 | ret = dw_pcie_cfg_read(pp->dbi_base + where, size, val); | 432 | ret = dw_pcie_cfg_read(pp->dbi_base + where, size, val); |
454 | exynos_pcie_sideband_dbi_r_mode(pp, false); | 433 | exynos_pcie_sideband_dbi_r_mode(exynos_pcie, false); |
455 | return ret; | 434 | return ret; |
456 | } | 435 | } |
457 | 436 | ||
458 | static int exynos_pcie_wr_own_conf(struct pcie_port *pp, int where, int size, | 437 | static int exynos_pcie_wr_own_conf(struct pcie_port *pp, int where, int size, |
459 | u32 val) | 438 | u32 val) |
460 | { | 439 | { |
440 | struct exynos_pcie *exynos_pcie = to_exynos_pcie(pp); | ||
461 | int ret; | 441 | int ret; |
462 | 442 | ||
463 | exynos_pcie_sideband_dbi_w_mode(pp, true); | 443 | exynos_pcie_sideband_dbi_w_mode(exynos_pcie, true); |
464 | ret = dw_pcie_cfg_write(pp->dbi_base + where, size, val); | 444 | ret = dw_pcie_cfg_write(pp->dbi_base + where, size, val); |
465 | exynos_pcie_sideband_dbi_w_mode(pp, false); | 445 | exynos_pcie_sideband_dbi_w_mode(exynos_pcie, false); |
466 | return ret; | 446 | return ret; |
467 | } | 447 | } |
468 | 448 | ||
469 | static int exynos_pcie_link_up(struct pcie_port *pp) | 449 | static int exynos_pcie_link_up(struct pcie_port *pp) |
470 | { | 450 | { |
471 | struct exynos_pcie *exynos_pcie = to_exynos_pcie(pp); | 451 | struct exynos_pcie *exynos_pcie = to_exynos_pcie(pp); |
472 | u32 val = exynos_elb_readl(exynos_pcie, PCIE_ELBI_RDLH_LINKUP); | 452 | u32 val; |
473 | 453 | ||
454 | val = exynos_elb_readl(exynos_pcie, PCIE_ELBI_RDLH_LINKUP); | ||
474 | if (val == PCIE_ELBI_LTSSM_ENABLE) | 455 | if (val == PCIE_ELBI_LTSSM_ENABLE) |
475 | return 1; | 456 | return 1; |
476 | 457 | ||
@@ -479,8 +460,10 @@ static int exynos_pcie_link_up(struct pcie_port *pp) | |||
479 | 460 | ||
480 | static void exynos_pcie_host_init(struct pcie_port *pp) | 461 | static void exynos_pcie_host_init(struct pcie_port *pp) |
481 | { | 462 | { |
482 | exynos_pcie_establish_link(pp); | 463 | struct exynos_pcie *exynos_pcie = to_exynos_pcie(pp); |
483 | exynos_pcie_enable_interrupts(pp); | 464 | |
465 | exynos_pcie_establish_link(exynos_pcie); | ||
466 | exynos_pcie_enable_interrupts(exynos_pcie); | ||
484 | } | 467 | } |
485 | 468 | ||
486 | static struct pcie_host_ops exynos_pcie_host_ops = { | 469 | static struct pcie_host_ops exynos_pcie_host_ops = { |
@@ -492,9 +475,10 @@ static struct pcie_host_ops exynos_pcie_host_ops = { | |||
492 | .host_init = exynos_pcie_host_init, | 475 | .host_init = exynos_pcie_host_init, |
493 | }; | 476 | }; |
494 | 477 | ||
495 | static int __init exynos_add_pcie_port(struct pcie_port *pp, | 478 | static int __init exynos_add_pcie_port(struct exynos_pcie *exynos_pcie, |
496 | struct platform_device *pdev) | 479 | struct platform_device *pdev) |
497 | { | 480 | { |
481 | struct pcie_port *pp = &exynos_pcie->pp; | ||
498 | struct device *dev = pp->dev; | 482 | struct device *dev = pp->dev; |
499 | int ret; | 483 | int ret; |
500 | 484 | ||
@@ -504,7 +488,7 @@ static int __init exynos_add_pcie_port(struct pcie_port *pp, | |||
504 | return -ENODEV; | 488 | return -ENODEV; |
505 | } | 489 | } |
506 | ret = devm_request_irq(dev, pp->irq, exynos_pcie_irq_handler, | 490 | ret = devm_request_irq(dev, pp->irq, exynos_pcie_irq_handler, |
507 | IRQF_SHARED, "exynos-pcie", pp); | 491 | IRQF_SHARED, "exynos-pcie", exynos_pcie); |
508 | if (ret) { | 492 | if (ret) { |
509 | dev_err(dev, "failed to request irq\n"); | 493 | dev_err(dev, "failed to request irq\n"); |
510 | return ret; | 494 | return ret; |
@@ -520,7 +504,7 @@ static int __init exynos_add_pcie_port(struct pcie_port *pp, | |||
520 | ret = devm_request_irq(dev, pp->msi_irq, | 504 | ret = devm_request_irq(dev, pp->msi_irq, |
521 | exynos_pcie_msi_irq_handler, | 505 | exynos_pcie_msi_irq_handler, |
522 | IRQF_SHARED | IRQF_NO_THREAD, | 506 | IRQF_SHARED | IRQF_NO_THREAD, |
523 | "exynos-pcie", pp); | 507 | "exynos-pcie", exynos_pcie); |
524 | if (ret) { | 508 | if (ret) { |
525 | dev_err(dev, "failed to request msi irq\n"); | 509 | dev_err(dev, "failed to request msi irq\n"); |
526 | return ret; | 510 | return ret; |
@@ -599,7 +583,7 @@ static int __init exynos_pcie_probe(struct platform_device *pdev) | |||
599 | goto fail_bus_clk; | 583 | goto fail_bus_clk; |
600 | } | 584 | } |
601 | 585 | ||
602 | ret = exynos_add_pcie_port(pp, pdev); | 586 | ret = exynos_add_pcie_port(exynos_pcie, pdev); |
603 | if (ret < 0) | 587 | if (ret < 0) |
604 | goto fail_bus_clk; | 588 | goto fail_bus_clk; |
605 | 589 | ||