blob: 12c8325e98630c05b81763367eb197a8ef874cd8 [file] [log] [blame]
Gagan Mac068e84d2013-05-28 18:22:33 -06001/* Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
Gagan Mac8cbbb802012-02-08 15:35:54 -07002 *
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_BUS_BIMC_H
14#define _ARCH_ARM_MACH_MSM_BUS_BIMC_H
15
16struct msm_bus_bimc_params {
17 uint32_t bus_id;
18 uint32_t addr_width;
19 uint32_t data_width;
20 uint32_t nmasters;
21 uint32_t nslaves;
22};
23
24struct msm_bus_bimc_commit {
25 struct msm_bus_node_hw_info *mas;
26 struct msm_bus_node_hw_info *slv;
27};
28
29struct msm_bus_bimc_info {
30 void __iomem *base;
31 uint32_t base_addr;
32 uint32_t qos_freq;
33 struct msm_bus_bimc_params params;
34 struct msm_bus_bimc_commit cdata[NUM_CTX];
35};
36
37struct msm_bus_bimc_node {
38 uint32_t conn_mask;
39 uint32_t data_width;
40 uint8_t slv_arb_mode;
41};
42
43enum msm_bus_bimc_arb_mode {
44 BIMC_ARB_MODE_RR = 0,
45 BIMC_ARB_MODE_PRIORITY_RR,
46 BIMC_ARB_MODE_TIERED_RR,
47};
48
49
50enum msm_bus_bimc_interleave {
51 BIMC_INTERLEAVE_NONE = 0,
52 BIMC_INTERLEAVE_ODD,
53 BIMC_INTERLEAVE_EVEN,
54};
55
56struct msm_bus_bimc_slave_seg {
57 bool enable;
58 uint64_t start_addr;
59 uint64_t seg_size;
60 uint8_t interleave;
61};
62
63enum msm_bus_bimc_qos_mode_type {
64 BIMC_QOS_MODE_FIXED = 0,
65 BIMC_QOS_MODE_LIMITER,
66 BIMC_QOS_MODE_BYPASS,
67 BIMC_QOS_MODE_REGULATOR,
68};
69
70struct msm_bus_bimc_qos_health {
71 bool limit_commands;
72 uint32_t areq_prio;
73 uint32_t prio_level;
74};
75
76struct msm_bus_bimc_mode_fixed {
77 uint32_t prio_level;
78 uint32_t areq_prio_rd;
79 uint32_t areq_prio_wr;
80};
81
82struct msm_bus_bimc_mode_rl {
83 uint8_t qhealthnum;
84 struct msm_bus_bimc_qos_health qhealth[4];
85};
86
87struct msm_bus_bimc_qos_mode {
88 uint8_t mode;
89 struct msm_bus_bimc_mode_fixed fixed;
90 struct msm_bus_bimc_mode_rl rl;
91};
92
93struct msm_bus_bimc_qos_bw {
94 uint64_t bw; /* bw is in Bytes/sec */
95 uint32_t ws; /* Window size in nano seconds*/
Gagan Mac068e84d2013-05-28 18:22:33 -060096 int64_t thh; /* Threshold high, bytes per second */
97 int64_t thm; /* Threshold medium, bytes per second */
98 int64_t thl; /* Threshold low, bytes per second */
99 u32 gp; /* Grant Period in micro seconds */
100 u32 thmp; /* Threshold medium in percentage */
Gagan Mac8cbbb802012-02-08 15:35:54 -0700101};
102
103struct msm_bus_bimc_clk_gate {
104 bool core_clk_gate_en;
105 bool arb_clk_gate_en; /* For arbiter */
106 bool port_clk_gate_en; /* For regs on BIMC core clock */
107};
108
109void msm_bus_bimc_set_slave_seg(struct msm_bus_bimc_info *binfo,
110 uint32_t slv_index, uint32_t seg_index,
111 struct msm_bus_bimc_slave_seg *bsseg);
112void msm_bus_bimc_set_slave_clk_gate(struct msm_bus_bimc_info *binfo,
113 uint32_t slv_index, struct msm_bus_bimc_clk_gate *bgate);
114void msm_bus_bimc_set_mas_clk_gate(struct msm_bus_bimc_info *binfo,
115 uint32_t mas_index, struct msm_bus_bimc_clk_gate *bgate);
116void msm_bus_bimc_arb_en(struct msm_bus_bimc_info *binfo,
117 uint32_t slv_index, bool en);
118void msm_bus_bimc_get_params(struct msm_bus_bimc_info *binfo,
119 struct msm_bus_bimc_params *params);
120void msm_bus_bimc_get_mas_params(struct msm_bus_bimc_info *binfo,
121 uint32_t mas_index, struct msm_bus_bimc_node *mparams);
122void msm_bus_bimc_get_slv_params(struct msm_bus_bimc_info *binfo,
123 uint32_t slv_index, struct msm_bus_bimc_node *sparams);
124bool msm_bus_bimc_get_arb_en(struct msm_bus_bimc_info *binfo,
125 uint32_t slv_index);
126
127#endif /*_ARCH_ARM_MACH_MSM_BUS_BIMC_H*/