Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4bae6204 authored by Naina Mehta's avatar Naina Mehta Committed by Gerrit - the friendly Code Review server
Browse files

drivers: llcc: Add LLCC driver for Yupik



Add Last Level Cache Controller(LLCC) driver for
Yupik platform.

Change-Id: I2ce5e70c2d112f9ff3a7f3c68b54a809e9f7d00d
Signed-off-by: default avatarNaina Mehta <nainmeht@codeaurora.org>
parent cfcc5550
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -194,6 +194,15 @@ config QCOM_SHIMA_LLCC
	  can start using the LLCC slices.
	  If unsure, say n.

config QCOM_YUPIK_LLCC
	tristate "Qualcomm Technologies, Inc. YUPIK LLCC driver"
	depends on QCOM_LLCC
	help
	  Say y or m here to enable the LLCC driver for Yupik platform.
	  This provides data required to configure LLCC so that clients
	  can start using the LLCC slices.
	  If unsure, say n.

config QCOM_SDM845_LLCC
	tristate "Qualcomm Technologies, Inc. SDM845 LLCC driver"
	depends on QCOM_LLCC
+1 −0
Original line number Diff line number Diff line
@@ -42,6 +42,7 @@ obj-$(CONFIG_QCOM_LLCC) += llcc-slice.o
obj-$(CONFIG_QCOM_LAHAINA_LLCC) += llcc-lahaina.o
obj-$(CONFIG_QCOM_SDXLEMUR_LLCC) += llcc-sdxlemur.o
obj-$(CONFIG_QCOM_SHIMA_LLCC) += llcc-shima.o
obj-$(CONFIG_QCOM_YUPIK_LLCC) += llcc-yupik.o
obj-$(CONFIG_QCOM_MINIDUMP) += msm_minidump.o minidump_log.o
obj-$(CONFIG_QCOM_MEM_OFFLINE) += mem-offline.o
obj-$(CONFIG_QCOM_MEM_BUF) += mem-buf.o mem_buf_dma_buf.o
+86 −0
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (c) 2020, The Linux Foundation. All rights reserved.
 *
 */

#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/soc/qcom/llcc-qcom.h>

/*
 * SCT entry contains of the following parameters
 * uid: Unique id for the client's use case
 * slice_id: llcc slice id for each client
 * max_cap: The maximum capacity of the cache slice provided in KB
 * priority: Priority of the client used to select victim line for replacement
 * fixed_size: Determine of the slice has a fixed capacity
 * bonus_ways: Bonus ways to be used by any slice, bonus way is used only if
 *             it't not a reserved way.
 * res_ways: Reserved ways for the cache slice, the reserved ways cannot be used
 *           by any other client than the one its assigned to.
 * cache_mode: Each slice operates as a cache, this controls the mode of the
 *             slice normal or TCM
 * probe_target_ways: Determines what ways to probe for access hit. When
 *                    configured to 1 only bonus and reserved ways are probed.
 *                    when configured to 0 all ways in llcc are probed.
 * dis_cap_alloc: Disable capacity based allocation for a client
 * write_scid_en: Bit enables write cache support for a given scid.
 * retain_on_pc: If this bit is set and client has maitained active vote
 *               then the ways assigned to this client are not flushed on power
 *               collapse.
 * activate_on_init: Activate the slice immidiately after the SCT is programmed
 */
#define SCT_ENTRY(uid, sid, mc, p, fs, bway, rway, cmod, ptw, dca, wse, rp, a) \
	{					\
		.usecase_id = uid,		\
		.slice_id = sid,		\
		.max_cap = mc,			\
		.priority = p,			\
		.fixed_size = fs,		\
		.bonus_ways = bway,		\
		.res_ways = rway,		\
		.cache_mode = cmod,		\
		.probe_target_ways = ptw,	\
		.dis_cap_alloc = dca,		\
		.write_scid_en = wse,		\
		.retain_on_pc = rp,		\
		.activate_on_init = a,		\
	}

static struct llcc_slice_config yupik_data[] =  {
	SCT_ENTRY(LLCC_CPUSS,    1, 768, 1, 0, 0x3F, 0x0, 0, 0, 0, 0, 1, 1),
	SCT_ENTRY(LLCC_MDMHPGRW, 7, 512, 2, 1, 0x3F, 0x0, 0, 0, 0, 0, 1, 0),
	SCT_ENTRY(LLCC_CMPT,     10, 768, 1, 1, 0x3F, 0x0, 0, 0, 0, 0, 1, 0),
	SCT_ENTRY(LLCC_GPUHTW,   11, 256, 1, 1, 0x3F, 0x0, 0, 0, 0, 0, 1, 0),
	SCT_ENTRY(LLCC_GPU,      12, 512, 1, 0, 0x3F, 0x0, 0, 0, 0, 0, 1, 0),
	SCT_ENTRY(LLCC_MMUHWT,   13, 256, 1, 1, 0x3F, 0x0, 0, 0, 0, 0, 1, 1),
	SCT_ENTRY(LLCC_MDMPNG,   21, 768, 0, 1, 0x3F, 0x0, 0, 0, 0, 0, 1, 0),
	SCT_ENTRY(LLCC_WLNHW,    24, 256, 1, 1, 0x3F, 0x0, 0, 0, 0, 0, 1, 0),
	SCT_ENTRY(LLCC_MDMVPE,   29, 64,  1, 1, 0x3F, 0x0, 0, 0, 0, 0, 1, 0),
};

static int yupik_qcom_llcc_probe(struct platform_device *pdev)
{
	return qcom_llcc_probe(pdev, yupik_data,
				 ARRAY_SIZE(yupik_data));
}

static const struct of_device_id yupik_qcom_llcc_of_match[] = {
	{ .compatible = "qcom,yupik-llcc", },
	{ },
};

static struct platform_driver yupik_qcom_llcc_driver = {
	.driver = {
		.name = "yupik-llcc",
		.of_match_table = yupik_qcom_llcc_of_match,
	},
	.probe = yupik_qcom_llcc_probe,
};
module_platform_driver(yupik_qcom_llcc_driver);

MODULE_DESCRIPTION("QCOM yupik LLCC driver");
MODULE_LICENSE("GPL v2");
+1 −0
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@
#define LLCC_MDMHPFX     20
#define LLCC_MDMPNG      21
#define LLCC_AUDHW       22
#define LLCC_WLNHW       24
#define LLCC_CVP         28
#define LLCC_MDMVPE      29
#define LLCC_APTCM       30