162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * Copyright (c) 2021-2022, NVIDIA CORPORATION. All rights reserved
462306a36Sopenharmony_ci */
562306a36Sopenharmony_ci
662306a36Sopenharmony_ci#ifndef TEGRA_CBB_H
762306a36Sopenharmony_ci#define TEGRA_CBB_H
862306a36Sopenharmony_ci
962306a36Sopenharmony_ci#include <linux/list.h>
1062306a36Sopenharmony_ci
1162306a36Sopenharmony_cistruct tegra_cbb_error {
1262306a36Sopenharmony_ci	const char *code;
1362306a36Sopenharmony_ci	const char *source;
1462306a36Sopenharmony_ci	const char *desc;
1562306a36Sopenharmony_ci};
1662306a36Sopenharmony_ci
1762306a36Sopenharmony_cistruct tegra_cbb {
1862306a36Sopenharmony_ci	struct device *dev;
1962306a36Sopenharmony_ci	const struct tegra_cbb_ops *ops;
2062306a36Sopenharmony_ci	struct list_head node;
2162306a36Sopenharmony_ci};
2262306a36Sopenharmony_ci
2362306a36Sopenharmony_cistruct tegra_cbb_ops {
2462306a36Sopenharmony_ci	int (*debugfs_show)(struct tegra_cbb *cbb, struct seq_file *s, void *v);
2562306a36Sopenharmony_ci	int (*interrupt_enable)(struct tegra_cbb *cbb);
2662306a36Sopenharmony_ci	void (*error_enable)(struct tegra_cbb *cbb);
2762306a36Sopenharmony_ci	void (*fault_enable)(struct tegra_cbb *cbb);
2862306a36Sopenharmony_ci	void (*stall_enable)(struct tegra_cbb *cbb);
2962306a36Sopenharmony_ci	void (*error_clear)(struct tegra_cbb *cbb);
3062306a36Sopenharmony_ci	u32 (*get_status)(struct tegra_cbb *cbb);
3162306a36Sopenharmony_ci};
3262306a36Sopenharmony_ci
3362306a36Sopenharmony_ciint tegra_cbb_get_irq(struct platform_device *pdev, unsigned int *nonsec_irq,
3462306a36Sopenharmony_ci		      unsigned int *sec_irq);
3562306a36Sopenharmony_ci__printf(2, 3)
3662306a36Sopenharmony_civoid tegra_cbb_print_err(struct seq_file *file, const char *fmt, ...);
3762306a36Sopenharmony_ci
3862306a36Sopenharmony_civoid tegra_cbb_print_cache(struct seq_file *file, u32 cache);
3962306a36Sopenharmony_civoid tegra_cbb_print_prot(struct seq_file *file, u32 prot);
4062306a36Sopenharmony_ciint tegra_cbb_register(struct tegra_cbb *cbb);
4162306a36Sopenharmony_ci
4262306a36Sopenharmony_civoid tegra_cbb_fault_enable(struct tegra_cbb *cbb);
4362306a36Sopenharmony_civoid tegra_cbb_stall_enable(struct tegra_cbb *cbb);
4462306a36Sopenharmony_civoid tegra_cbb_error_clear(struct tegra_cbb *cbb);
4562306a36Sopenharmony_ciu32 tegra_cbb_get_status(struct tegra_cbb *cbb);
4662306a36Sopenharmony_ci
4762306a36Sopenharmony_ci#endif /* TEGRA_CBB_H */
48