| 1 |
/* SPDX-License-Identifier: GPL-2.0 */ |
| 2 |
/* |
| 3 |
* Cadence PCIe Host controller driver. |
| 4 |
* |
| 5 |
* Copyright (c) 2017 Cadence |
| 6 |
* Author: Cyrille Pitchen <[email protected]> |
| 7 |
*/ |
| 8 |
#ifndef _PCIE_CADENCE_HOST_COMMON_H |
| 9 |
#define _PCIE_CADENCE_HOST_COMMON_H |
| 10 |
|
| 11 |
#include <linux/kernel.h> |
| 12 |
#include <linux/pci.h> |
| 13 |
|
| 14 |
extern u64 bar_max_size[]; |
| 15 |
|
| 16 |
typedef int (*cdns_pcie_host_bar_ib_cfg)(struct cdns_pcie_rc *, |
| 17 |
enum cdns_pcie_rp_bar, |
| 18 |
u64, |
| 19 |
u64, |
| 20 |
unsigned long); |
| 21 |
typedef bool (*cdns_pcie_linkup_func)(struct cdns_pcie *); |
| 22 |
|
| 23 |
int cdns_pcie_host_training_complete(struct cdns_pcie *pcie); |
| 24 |
int cdns_pcie_host_wait_for_link(struct cdns_pcie *pcie, |
| 25 |
cdns_pcie_linkup_func pcie_link_up); |
| 26 |
int cdns_pcie_retrain(struct cdns_pcie *pcie, cdns_pcie_linkup_func pcie_linkup_func); |
| 27 |
int cdns_pcie_host_start_link(struct cdns_pcie_rc *rc, |
| 28 |
cdns_pcie_linkup_func pcie_link_up); |
| 29 |
enum cdns_pcie_rp_bar |
| 30 |
cdns_pcie_host_find_min_bar(struct cdns_pcie_rc *rc, u64 size); |
| 31 |
enum cdns_pcie_rp_bar |
| 32 |
cdns_pcie_host_find_max_bar(struct cdns_pcie_rc *rc, u64 size); |
| 33 |
int cdns_pcie_host_dma_ranges_cmp(void *priv, const struct list_head *a, |
| 34 |
const struct list_head *b); |
| 35 |
int cdns_pcie_host_bar_ib_config(struct cdns_pcie_rc *rc, |
| 36 |
enum cdns_pcie_rp_bar bar, |
| 37 |
u64 cpu_addr, |
| 38 |
u64 size, |
| 39 |
unsigned long flags); |
| 40 |
int cdns_pcie_host_bar_config(struct cdns_pcie_rc *rc, |
| 41 |
struct resource_entry *entry, |
| 42 |
cdns_pcie_host_bar_ib_cfg pci_host_ib_config); |
| 43 |
int cdns_pcie_host_map_dma_ranges(struct cdns_pcie_rc *rc, |
| 44 |
cdns_pcie_host_bar_ib_cfg pci_host_ib_config); |
| 45 |
|
| 46 |
#endif /* _PCIE_CADENCE_HOST_COMMON_H */ |