blob: 8e4253bb07424df6acde6f81233cb4f286cacf19 [file] [log] [blame]
Duy Truonge833aca2013-02-12 13:35:08 -08001/* Copyright (c) 2012, The Linux Foundation. All rights reserved.
Niranjana Vishwanathapuraf1427ac2012-05-03 14:28:21 -06002 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 */
12
13#ifndef __ARCH_ARM_MACH_MSM_PCIE_H
14#define __ARCH_ARM_MACH_MSM_PCIE_H
15
16#include <linux/clk.h>
17#include <linux/compiler.h>
18#include <linux/platform_device.h>
19#include <linux/regulator/consumer.h>
20#include <linux/types.h>
21#include <mach/msm_pcie.h>
22
23#define MSM_PCIE_MAX_VREG 4
24#define MSM_PCIE_MAX_CLK 3
25
26#define PCIE_DBG(x...) do { \
27 if (msm_pcie_get_debug_mask()) \
28 pr_info(x); \
29 } while (0)
30
31/* voltage regulator info structrue */
32struct msm_pcie_vreg_info_t {
33 struct regulator *hdl;
34 char *name;
35 uint32_t max_v;
36 uint32_t min_v;
37 uint32_t opt_mode;
38};
39
40/* clock info structure */
41struct msm_pcie_clk_info_t {
42 struct clk *hdl;
43 char *name;
44};
45
46/* resource info structure */
47struct msm_pcie_res_info_t {
Niranjana Vishwanathapura68210ff2012-06-24 18:03:49 -060048 char *name;
49 struct resource *resource;
50 void __iomem *base;
Niranjana Vishwanathapuraf1427ac2012-05-03 14:28:21 -060051};
52
53/* msm pcie device structure */
54struct msm_pcie_dev_t {
55 struct platform_device *pdev;
56
57 struct msm_pcie_vreg_info_t *vreg;
58 struct msm_pcie_gpio_info_t *gpio;
59 struct msm_pcie_clk_info_t *clk;
60 struct msm_pcie_res_info_t *res;
61
62 void __iomem *parf;
63 void __iomem *elbi;
64 void __iomem *pcie20;
65 void __iomem *axi_conf;
Niranjana Vishwanathapura68210ff2012-06-24 18:03:49 -060066
67 uint32_t axi_bar_start;
68 uint32_t axi_bar_end;
69
70 struct resource dev_mem_res;
Niranjana Vishwanathapura459a27d2012-07-20 12:23:55 -060071
72 uint32_t wake_n;
Niranjana Vishwanathapuraf1427ac2012-05-03 14:28:21 -060073};
74
75extern uint32_t msm_pcie_irq_init(struct msm_pcie_dev_t *dev);
76extern void msm_pcie_irq_deinit(struct msm_pcie_dev_t *dev);
77extern int msm_pcie_get_debug_mask(void);
78
79#endif