Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

soc: mediatek: mtk-cmdq: Add pa_base parsing for hardware without subsys ID support

When GCE executes instructions, it typically locates the corresponding
hardware register using the subsys ID. For hardware that does not
support subsys ID, the subsys ID is set to an invalid value, and the
physical address must be used to generate GCE instructions.

The main advantage of using subsys ID is to reduce the number of
instructions. Without subsys ID, an additional `ASSIGN` instruction
is needed to assign the high bytes of the physical address, which can
impact performance if too many instructions are required. However, if
the hardware does not support subsys ID, using the physical address
is the only option to achieve the same functionality.

This commit adds a pa_base parsing flow to the cmdq_client_reg structure
to handle hardware without subsys ID support.

Signed-off-by: Jason-JH Lin <jason-jh.lin@mediatek.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Acked-by: Jassi Brar <jassisinghbrar@gmail.com>
Acked-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>

authored by

Jason-JH Lin and committed by
AngeloGioacchino Del Regno
4bf783d8 c775b23b

+17 -2
+14 -2
drivers/soc/mediatek/mtk-cmdq-helper.c
··· 8 8 #include <linux/module.h> 9 9 #include <linux/mailbox_controller.h> 10 10 #include <linux/of.h> 11 + #include <linux/of_address.h> 11 12 #include <linux/soc/mediatek/mtk-cmdq.h> 12 13 13 14 #define CMDQ_WRITE_ENABLE_MASK BIT(0) ··· 61 60 struct cmdq_client_reg *client_reg, int idx) 62 61 { 63 62 struct of_phandle_args spec; 63 + struct resource res; 64 64 int err; 65 65 66 66 if (!client_reg) 67 67 return -ENOENT; 68 68 69 + err = of_address_to_resource(dev->of_node, 0, &res); 70 + if (err) { 71 + dev_err(dev, "Missing reg in %s node\n", dev->of_node->full_name); 72 + return -EINVAL; 73 + } 74 + client_reg->pa_base = res.start; 75 + 69 76 err = of_parse_phandle_with_fixed_args(dev->of_node, 70 77 "mediatek,gce-client-reg", 71 78 3, idx, &spec); 72 79 if (err < 0) { 73 - dev_warn(dev, 80 + dev_dbg(dev, 74 81 "error %d can't parse gce-client-reg property (%d)", 75 82 err, idx); 76 83 77 - return err; 84 + /* make subsys invalid */ 85 + client_reg->subsys = CMDQ_SUBSYS_INVALID; 86 + 87 + return 0; 78 88 } 79 89 80 90 client_reg->subsys = (u8)spec.args[0];
+3
include/linux/soc/mediatek/mtk-cmdq.h
··· 23 23 #define CMDQ_THR_SPR_IDX2 (2) 24 24 #define CMDQ_THR_SPR_IDX3 (3) 25 25 26 + #define CMDQ_SUBSYS_INVALID (U8_MAX) 27 + 26 28 struct cmdq_pkt; 27 29 28 30 enum cmdq_logic_op { ··· 54 52 55 53 struct cmdq_client_reg { 56 54 u8 subsys; 55 + phys_addr_t pa_base; 57 56 u16 offset; 58 57 u16 size; 59 58 };