summaryrefstree
path: root/kernel/drivers/misc/modem_v1/s5100_pcie.h
blob: a53a3b99723ac2d903d695297b9339af28fd3748 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
/*
 * Copyright (C) 2010 Samsung Electronics.
 *
 * This software is licensed under the terms of the GNU General Public
 * License version 2, as published by the Free Software Foundation, and
 * may be copied, distributed, and modified under those terms.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 */

#ifndef __S5100_PCIE_H__
#define __S5100_PCIE_H__

#include <linux/exynos-pci-noti.h>

#define MAX_MSI_NUM	(16)

extern int s5100pcie_init(int ch_num);
extern int exynos_pcie_host_v1_register_event(struct exynos_pcie_register_event *reg);
extern void exynos_pcie_host_v1_register_dump(int ch_num);

struct s5100pcie {
	unsigned int busdev_num;
	int pcie_channel_num;
	struct pci_dev *s5100_pdev;
	int irq_num_base;
	u32 __iomem *doorbell_addr;
	u32 __iomem *reg_base;

	unsigned gpio_cp_wakeup;
	u32 link_status;
	bool suspend_try;

	struct exynos_pcie_register_event pcie_event;
	struct pci_saved_state *pci_saved_configs;
};

extern struct s5100pcie s5100pcie;

extern int exynos_pcie_host_v1_poweron(int ch_num);
extern int exynos_pcie_host_v1_poweroff(int ch_num);
extern int exynos_check_pcie_link_status(int ch_num);
extern int pci_alloc_irq_vectors_affinity(struct pci_dev *dev, unsigned int min_vecs, \
                                    unsigned int max_vecs, unsigned int flags, \
				    const struct irq_affinity *affd);
extern int exynos_pcie_host_v1_l1ss_ctrl(int enable, int id);
extern int pcie_iommu_map(int ch_num, unsigned long iova, phys_addr_t paddr,
				size_t size, int prot);

#define AUTOSUSPEND_TIMEOUT	200

int s5100pcie_request_msi_int(int int_num);
void __iomem *s5100pcie_get_doorbell_address(void);
struct pci_dev *s5100pcie_get_pcidev(void);
void s5100pcie_set_cp_wake_gpio(int cp_wakeup);
int s5100pcie_send_doorbell_int(int int_num);
void save_s5100_status(void);
void restore_s5100_state(void);
void disable_msi_int(void);
void print_msi_register(void);
int s5100_recover_pcie_link(bool start);
void s5100_check_doorbell_ready(void);
int request_pcie_msi_int(struct link_device *ld,
				struct platform_device *pdev);

#endif /* __S5100_PCIE_H__ */