2 * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License,
6 * version 2, as published by the Free Software Foundation.
8 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 #ifndef __SOC_TEGRA_BPMP_H
15 #define __SOC_TEGRA_BPMP_H
17 #include <linux/mailbox_client.h>
18 #include <linux/pm_domain.h>
19 #include <linux/reset-controller.h>
20 #include <linux/semaphore.h>
21 #include <linux/types.h>
23 #include <soc/tegra/bpmp-abi.h>
25 struct tegra_bpmp_clk
;
27 struct tegra_bpmp_soc
{
33 } cpu_tx
, thread
, cpu_rx
;
35 unsigned int num_resets
;
38 struct tegra_bpmp_mb_data
{
41 u8 data
[MSG_DATA_MIN_SZ
];
44 struct tegra_bpmp_channel
{
45 struct tegra_bpmp
*bpmp
;
46 struct tegra_bpmp_mb_data
*ib
;
47 struct tegra_bpmp_mb_data
*ob
;
48 struct completion completion
;
49 struct tegra_ivc
*ivc
;
52 typedef void (*tegra_bpmp_mrq_handler_t
)(unsigned int mrq
,
53 struct tegra_bpmp_channel
*channel
,
56 struct tegra_bpmp_mrq
{
57 struct list_head list
;
59 tegra_bpmp_mrq_handler_t handler
;
64 const struct tegra_bpmp_soc
*soc
;
68 struct gen_pool
*pool
;
74 struct mbox_client client
;
75 struct mbox_chan
*channel
;
78 struct tegra_bpmp_channel
*channels
;
79 unsigned int num_channels
;
82 unsigned long *allocated
;
85 struct semaphore lock
;
88 struct list_head mrqs
;
91 struct tegra_bpmp_clk
**clocks
;
92 unsigned int num_clocks
;
94 struct reset_controller_dev rstc
;
96 struct genpd_onecell_data genpd
;
99 struct tegra_bpmp
*tegra_bpmp_get(struct device
*dev
);
100 void tegra_bpmp_put(struct tegra_bpmp
*bpmp
);
102 struct tegra_bpmp_message
{
116 int tegra_bpmp_transfer_atomic(struct tegra_bpmp
*bpmp
,
117 struct tegra_bpmp_message
*msg
);
118 int tegra_bpmp_transfer(struct tegra_bpmp
*bpmp
,
119 struct tegra_bpmp_message
*msg
);
121 int tegra_bpmp_request_mrq(struct tegra_bpmp
*bpmp
, unsigned int mrq
,
122 tegra_bpmp_mrq_handler_t handler
, void *data
);
123 void tegra_bpmp_free_mrq(struct tegra_bpmp
*bpmp
, unsigned int mrq
,
126 #if IS_ENABLED(CONFIG_CLK_TEGRA_BPMP)
127 int tegra_bpmp_init_clocks(struct tegra_bpmp
*bpmp
);
129 static inline int tegra_bpmp_init_clocks(struct tegra_bpmp
*bpmp
)
135 #if IS_ENABLED(CONFIG_RESET_TEGRA_BPMP)
136 int tegra_bpmp_init_resets(struct tegra_bpmp
*bpmp
);
138 static inline int tegra_bpmp_init_resets(struct tegra_bpmp
*bpmp
)
144 #if IS_ENABLED(CONFIG_SOC_TEGRA_POWERGATE_BPMP)
145 int tegra_bpmp_init_powergates(struct tegra_bpmp
*bpmp
);
147 static inline int tegra_bpmp_init_powergates(struct tegra_bpmp
*bpmp
)
153 #endif /* __SOC_TEGRA_BPMP_H */