File Index
Files and directories
Sign in
FILE

ubwc.h

File preview with syntax highlighting.

linux-6.19.14/include/linux/soc/qcom/ubwc.h C
 1/* SPDX-License-Identifier: GPL-2.0-only */
 2/*
 3 * Copyright (c) 2018, The Linux Foundation
 4 * Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
 5 */
 6
 7#ifndef __QCOM_UBWC_H__
 8#define __QCOM_UBWC_H__
 9
10#include <linux/bits.h>
11#include <linux/printk.h>
12#include <linux/types.h>
13
14struct qcom_ubwc_cfg_data {
15	u32 ubwc_enc_version;
16	/* Can be read from MDSS_BASE + 0x58 */
17	u32 ubwc_dec_version;
18
19	/**
20	 * @ubwc_swizzle: Whether to enable level 1, 2 & 3 bank swizzling.
21	 *
22	 * UBWC 1.0 always enables all three levels.
23	 * UBWC 2.0 removes level 1 bank swizzling, leaving levels 2 & 3.
24	 * UBWC 4.0 adds the optional ability to disable levels 2 & 3.
25	 */
26	u32 ubwc_swizzle;
27#define UBWC_SWIZZLE_ENABLE_LVL1	BIT(0)
28#define UBWC_SWIZZLE_ENABLE_LVL2	BIT(1)
29#define UBWC_SWIZZLE_ENABLE_LVL3	BIT(2)
30
31	/**
32	 * @highest_bank_bit: Highest Bank Bit
33	 *
34	 * The Highest Bank Bit value represents the bit of the highest
35	 * DDR bank.  This should ideally use DRAM type detection.
36	 */
37	int highest_bank_bit;
38	bool ubwc_bank_spread;
39
40	/**
41	 * @macrotile_mode: Macrotile Mode
42	 *
43	 * Whether to use 4-channel macrotiling mode or the newer
44	 * 8-channel macrotiling mode introduced in UBWC 3.1. 0 is
45	 * 4-channel and 1 is 8-channel.
46	 */
47	bool macrotile_mode;
48};
49
50#define UBWC_1_0 0x10000000
51#define UBWC_2_0 0x20000000
52#define UBWC_3_0 0x30000000
53#define UBWC_4_0 0x40000000
54#define UBWC_4_3 0x40030000
55#define UBWC_5_0 0x50000000
56#define UBWC_6_0 0x60000000
57
58#if IS_ENABLED(CONFIG_QCOM_UBWC_CONFIG)
59const struct qcom_ubwc_cfg_data *qcom_ubwc_config_get_data(void);
60#else
61static inline const struct qcom_ubwc_cfg_data *qcom_ubwc_config_get_data(void)
62{
63	return ERR_PTR(-EOPNOTSUPP);
64}
65#endif
66
67static inline bool qcom_ubwc_get_ubwc_mode(const struct qcom_ubwc_cfg_data *cfg)
68{
69	bool ret = cfg->ubwc_enc_version == UBWC_1_0;
70
71	if (ret && !(cfg->ubwc_swizzle & UBWC_SWIZZLE_ENABLE_LVL1))
72		pr_err("UBWC config discrepancy - level 1 swizzling disabled on UBWC 1.0\n");
73
74	return ret;
75}
76
77#endif /* __QCOM_UBWC_H__ */
~/ Read-only file preview.