* [PATCH v12 07/12] soc: mediatek: cmdq: reorder the parameter
From: Bibby Hsieh @ 2019-08-19 2:53 UTC (permalink / raw)
To: Jassi Brar, Matthias Brugger, Rob Herring, CK HU
Cc: devicetree, Nicolas Boichat, Philipp Zabel, srv_heupstream,
Daoyuan Huang, Sascha Hauer, linux-kernel, Daniel Kurtz,
Dennis-YC Hsieh, linux-mediatek, Houlong Wei, Sascha Hauer,
YT Shen, Jiaguang Zhang, Bibby Hsieh, linux-arm-kernel,
ginny.chen
In-Reply-To: <20190819025359.11381-1-bibby.hsieh@mediatek.com>
The order of gce instructions is [subsys offset value]
so reorder the parameter of cmdq_pkt_write_mask
and cmdq_pkt_write function.
Signed-off-by: Bibby Hsieh <bibby.hsieh@mediatek.com>
Reviewed-by: CK Hu <ck.hu@mediatek.com>
---
drivers/soc/mediatek/mtk-cmdq-helper.c | 6 +++---
include/linux/soc/mediatek/mtk-cmdq.h | 10 +++++-----
2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/drivers/soc/mediatek/mtk-cmdq-helper.c b/drivers/soc/mediatek/mtk-cmdq-helper.c
index ff9fef5a032b..082b8978651e 100644
--- a/drivers/soc/mediatek/mtk-cmdq-helper.c
+++ b/drivers/soc/mediatek/mtk-cmdq-helper.c
@@ -136,7 +136,7 @@ static int cmdq_pkt_append_command(struct cmdq_pkt *pkt, enum cmdq_code code,
return 0;
}
-int cmdq_pkt_write(struct cmdq_pkt *pkt, u32 value, u32 subsys, u32 offset)
+int cmdq_pkt_write(struct cmdq_pkt *pkt, u32 subsys, u32 offset, u32 value)
{
u32 arg_a = (offset & CMDQ_ARG_A_WRITE_MASK) |
(subsys << CMDQ_SUBSYS_SHIFT);
@@ -145,8 +145,8 @@ int cmdq_pkt_write(struct cmdq_pkt *pkt, u32 value, u32 subsys, u32 offset)
}
EXPORT_SYMBOL(cmdq_pkt_write);
-int cmdq_pkt_write_mask(struct cmdq_pkt *pkt, u32 value,
- u32 subsys, u32 offset, u32 mask)
+int cmdq_pkt_write_mask(struct cmdq_pkt *pkt, u32 subsys,
+ u32 offset, u32 value, u32 mask)
{
u32 offset_mask = offset;
int err = 0;
diff --git a/include/linux/soc/mediatek/mtk-cmdq.h b/include/linux/soc/mediatek/mtk-cmdq.h
index 4e8899972db4..39d813dde4b4 100644
--- a/include/linux/soc/mediatek/mtk-cmdq.h
+++ b/include/linux/soc/mediatek/mtk-cmdq.h
@@ -60,26 +60,26 @@ void cmdq_pkt_destroy(struct cmdq_pkt *pkt);
/**
* cmdq_pkt_write() - append write command to the CMDQ packet
* @pkt: the CMDQ packet
- * @value: the specified target register value
* @subsys: the CMDQ sub system code
* @offset: register offset from CMDQ sub system
+ * @value: the specified target register value
*
* Return: 0 for success; else the error code is returned
*/
-int cmdq_pkt_write(struct cmdq_pkt *pkt, u32 value, u32 subsys, u32 offset);
+int cmdq_pkt_write(struct cmdq_pkt *pkt, u32 subsys, u32 offset, u32 value);
/**
* cmdq_pkt_write_mask() - append write command with mask to the CMDQ packet
* @pkt: the CMDQ packet
- * @value: the specified target register value
* @subsys: the CMDQ sub system code
* @offset: register offset from CMDQ sub system
+ * @value: the specified target register value
* @mask: the specified target register mask
*
* Return: 0 for success; else the error code is returned
*/
-int cmdq_pkt_write_mask(struct cmdq_pkt *pkt, u32 value,
- u32 subsys, u32 offset, u32 mask);
+int cmdq_pkt_write_mask(struct cmdq_pkt *pkt, u32 subsys,
+ u32 offset, u32 value, u32 mask);
/**
* cmdq_pkt_wfe() - append wait for event command to the CMDQ packet
--
2.18.0
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related
* Re: [PATCH] clk: spear: Make structure i2s_sclk_masks constant
From: Viresh Kumar @ 2019-08-19 2:20 UTC (permalink / raw)
To: Nishka Dasgupta; +Cc: sboyd, vireshk, mturquette, linux-clk, linux-arm-kernel
In-Reply-To: <20190813085714.8079-1-nishkadg.linux@gmail.com>
On 13-08-19, 14:27, Nishka Dasgupta wrote:
> Static structure i2s_sclk_masks, having type aux_clk_masks, is only used
> when it is passed as the sixth argument to function clk_register_aux().
> However, clk_register_aux() is defined with its sixth argument as const.
> Hence i2s_sclk_masks is not modified by clk_register_aux, which is also
> the only usage of the former. Therefore make i2s_sclk_masks constant as
> it is never modified.
> Issue found with Coccinelle.
>
> Signed-off-by: Nishka Dasgupta <nishkadg.linux@gmail.com>
> ---
> drivers/clk/spear/spear1340_clock.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/clk/spear/spear1340_clock.c b/drivers/clk/spear/spear1340_clock.c
> index e5bc8c828cf0..9163bbb46411 100644
> --- a/drivers/clk/spear/spear1340_clock.c
> +++ b/drivers/clk/spear/spear1340_clock.c
> @@ -335,7 +335,7 @@ static const struct aux_clk_masks i2s_prs1_masks = {
> };
>
> /* i2s sclk (bit clock) syynthesizers masks */
> -static struct aux_clk_masks i2s_sclk_masks = {
> +static const struct aux_clk_masks i2s_sclk_masks = {
> .eq_sel_mask = AUX_EQ_SEL_MASK,
> .eq_sel_shift = SPEAR1340_I2S_SCLK_EQ_SEL_SHIFT,
> .eq1_mask = AUX_EQ1_SEL,
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
--
viresh
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply
* Re: [PATCH 2/2] clk: Add support for AST2600 SoC
From: Joel Stanley @ 2019-08-19 2:03 UTC (permalink / raw)
To: Stephen Boyd
Cc: Ryan Chen, linux-aspeed, Andrew Jeffery, Michael Turquette,
Linux Kernel Mailing List, Rob Herring, linux-clk, Linux ARM
In-Reply-To: <20190816171441.3B8F720665@mail.kernel.org>
On Fri, 16 Aug 2019 at 17:14, Stephen Boyd <sboyd@kernel.org> wrote:
>
> Quoting Joel Stanley (2019-08-16 08:58:06)
> > diff --git a/drivers/clk/clk-ast2600.c b/drivers/clk/clk-ast2600.c
> > new file mode 100644
> > index 000000000000..083d5299238c
> > --- /dev/null
> > +++ b/drivers/clk/clk-ast2600.c
> > @@ -0,0 +1,701 @@
> > +// SPDX-License-Identifier: GPL-2.0-or-later
> > +// Copyright IBM Corp
> > +// Copyright ASPEED Technology
> > +
> [...]
> > +#define ASPEED_DPLL_PARAM 0x260
> > +
> > +#define ASPEED_G6_STRAP1 0x500
> > +
> > +/* Globally visible clocks */
> > +static DEFINE_SPINLOCK(aspeed_clk_lock);
>
> I guess we can be guaranteed that the two drivers aren't compiled into
> the same image? Otherwise this will alias with clk-aspeed.c and make
> kallsyms annoying to use.
I will change the name.
>
> > +
> > +/* Keeps track of all clocks */
> > +static struct clk_hw_onecell_data *aspeed_g6_clk_data;
> > +
> > +static void __iomem *scu_g6_base;
> > +
> > +static const struct aspeed_gate_data aspeed_g6_gates[] = {
> > + /* clk rst name parent flags */
> > + [ASPEED_CLK_GATE_MCLK] = { 0, -1, "mclk-gate", "mpll", CLK_IS_CRITICAL }, /* SDRAM */
>
> Please document CLK_IS_CRITICAL usage. I guess it's memory so never turn
> it off?
Yes.
I added some comments and removed some uses that I didn't know the
reason for. We can add them back later if required, with the
reasoning.
> > +static const char * const vclk_parent_names[] = {
>
> Can you use the new way of specifying clk parents instead of just using
> strings?
How does this work? I had a browse of the APIs in clk-provider.h and
it appeared the functions all take char *s still.
> > + hw = clk_hw_register_fixed_factor(NULL, "ahb", "hpll", 0, 1, axi_div * ahb_div);
>
> There aren't checks for if these things fail. I guess it doesn't matter
> and just let it fail hard?
I think that's sensible here. If the system has run out of memory this
early on then there's not going to be much that works.
Thanks for the review. I've fixed all of the style issues you
mentioned, but would appreciate some guidance on the parent API.
Cheers,
Joel
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply
* Re: [RFC V2 10/11] interconnect: mediatek: Add mt8183 interconnect provider driver
From: Henry Chen @ 2019-08-19 1:53 UTC (permalink / raw)
To: Georgi Djakov
Cc: Nicolas Boichat, Weiyi Lu, James Liao, Viresh Kumar,
Linux PM list, linux-kernel, Stephen Boyd, Fan Chen, devicetree,
Rob Herring, linux-mediatek, Matthias Brugger, linux-arm-kernel
In-Reply-To: <b8db4f70-4b95-5a98-38b4-9990bae023b4@linaro.org>
Hi Georgi,
Sorry for late reply.
On Tue, 2019-05-14 at 09:43 +0300, Georgi Djakov wrote:
> Hi Henry,
>
> On 4/30/19 11:51, Henry Chen wrote:
> > Introduce Mediatek MT8183 specific provider driver using the
> > interconnect framework.
> >
> > Signed-off-by: Henry Chen <henryc.chen@mediatek.com>
> > ---
> > drivers/interconnect/Kconfig | 1 +
> > drivers/interconnect/Makefile | 1 +
> > drivers/interconnect/mediatek/Kconfig | 13 ++
> > drivers/interconnect/mediatek/Makefile | 5 +
> > drivers/interconnect/mediatek/mt8183.c | 223 +++++++++++++++++++++++++++++++++
> > 5 files changed, 243 insertions(+)
> > create mode 100644 drivers/interconnect/mediatek/Kconfig
> > create mode 100644 drivers/interconnect/mediatek/Makefile
> > create mode 100644 drivers/interconnect/mediatek/mt8183.c
> >
> > diff --git a/drivers/interconnect/Kconfig b/drivers/interconnect/Kconfig
> > index 07a8276..ac41ea6 100644
> > --- a/drivers/interconnect/Kconfig
> > +++ b/drivers/interconnect/Kconfig
> > @@ -11,5 +11,6 @@ menuconfig INTERCONNECT
> > if INTERCONNECT
> >
> > source "drivers/interconnect/qcom/Kconfig"
> > +source "drivers/interconnect/mediatek/Kconfig"
> >
> > endif
> > diff --git a/drivers/interconnect/Makefile b/drivers/interconnect/Makefile
> > index 28f2ab0..253f24a3 100644
> > --- a/drivers/interconnect/Makefile
> > +++ b/drivers/interconnect/Makefile
> > @@ -4,3 +4,4 @@ icc-core-objs := core.o
> >
> > obj-$(CONFIG_INTERCONNECT) += icc-core.o
> > obj-$(CONFIG_INTERCONNECT_QCOM) += qcom/
> > +obj-$(CONFIG_INTERCONNECT_MTK) += mediatek/
> > diff --git a/drivers/interconnect/mediatek/Kconfig b/drivers/interconnect/mediatek/Kconfig
> > new file mode 100644
> > index 0000000..0686494
> > --- /dev/null
> > +++ b/drivers/interconnect/mediatek/Kconfig
> > @@ -0,0 +1,13 @@
> > +config INTERCONNECT_MTK
> > + bool "Mediatek Network-on-Chip interconnect drivers"
> > + depends on ARCH_MEDIATEK
> > + help
> > + Support for Mediatek's Network-on-Chip interconnect hardware.
> > +
> > +config INTERCONNECT_MTK_MT8183
> > + tristate "Mediatek MT8183 interconnect driver"
> > + depends on INTERCONNECT_MTK
> > + depends on (MTK_DVFSRC && OF)
> > + help
> > + This is a driver for the Mediatek Network-on-Chip on mt8183-based
> > + platforms.
> > diff --git a/drivers/interconnect/mediatek/Makefile b/drivers/interconnect/mediatek/Makefile
> > new file mode 100644
> > index 0000000..a39ceee
> > --- /dev/null
> > +++ b/drivers/interconnect/mediatek/Makefile
> > @@ -0,0 +1,5 @@
> > +# SPDX-License-Identifier: GPL-2.0
> > +
> > +mtk-mt8183-objs := mt8183.o
> > +
> > +obj-$(CONFIG_INTERCONNECT_MTK_MT8183) += mtk-mt8183.o
> > \ No newline at end of file
> > diff --git a/drivers/interconnect/mediatek/mt8183.c b/drivers/interconnect/mediatek/mt8183.c
> > new file mode 100644
> > index 0000000..38ffe0b
> > --- /dev/null
> > +++ b/drivers/interconnect/mediatek/mt8183.c
> > @@ -0,0 +1,223 @@
> > +// SPDX-License-Identifier: GPL-2.0
> > +/*
> > + * Copyright (c) 2019, The Linux Foundation. All rights reserved.
> > + *
> > + */
> > +
> > +#include <dt-bindings/interconnect/mtk,mt8183.h>
> > +#include <linux/device.h>
> > +#include <linux/interconnect.h>
>
> This is not needed.
ok, thanks.
>
> > +#include <linux/interconnect-provider.h>
> > +#include <linux/module.h>
> > +#include <linux/of_device.h>
> > +#include <linux/of_platform.h>
> > +#include <linux/platform_device.h>
> > +#include <soc/mediatek/mtk_dvfsrc.h>
> > +
> > +#define MT8183_MAX_LINKS 6
> > +
> > +/**
> > + * struct mtk_icc_node - Mediatek specific interconnect nodes
> > + * @name: the node name used in debugfs
> > + * @ep: true if the node is an end point.
> > + * @id: a unique node identifier
> > + * @links: an array of nodes where we can go next while traversing
> > + * @num_links: the total number of @links
> > + * @buswidth: width of the interconnect between a node and the bus
>
> Maybe mention the units?
ok, I will add it.
>
> > + * @sum_avg: current sum aggregate value of all avg bw requests
> > + * @max_peak: current max aggregate value of all peak bw requests
>
> units?
>
> > + */
> > +struct mtk_icc_node {
> > + unsigned char *name;
> > + bool ep;
> > + u16 id;
> > + u16 links[MT8183_MAX_LINKS];
> > + u16 num_links;
> > + u16 buswidth;
> > + u64 sum_avg;
> > + u64 max_peak;
> > +};
> > +
> > +struct mtk_icc_desc {
> > + struct mtk_icc_node **nodes;
> > + size_t num_nodes;
> > +};
> > +
> > +#define DEFINE_MNODE(_name, _id, _buswidth, _ep, _numlinks, ...) \
>
> We can drop the _numlinks and..
ok, thank you for the advice.
>
> > + static struct mtk_icc_node _name = { \
> > + .name = #_name, \
> > + .id = _id, \
> > + .buswidth = _buswidth, \
> > + .ep = _ep, \
> > + .num_links = _numlinks, \
>
> ..just use .num_links = ARRAY_SIZE(((int[]){ __VA_ARGS__ }))
>
> > + .links = { __VA_ARGS__ }, \
> > +}
> > +
> > +DEFINE_MNODE(ddr_emi, SLAVE_DDR_EMI, 1024, 1, 0, 0);
> > +DEFINE_MNODE(mcusys, MASTER_MCUSYS, 256, 0, 1, SLAVE_DDR_EMI);
> > +DEFINE_MNODE(gpu, MASTER_GPU, 256, 0, 1, SLAVE_DDR_EMI);
> > +DEFINE_MNODE(mmsys, MASTER_MMSYS, 256, 0, 1, SLAVE_DDR_EMI);
> > +DEFINE_MNODE(mm_vpu, MASTER_MM_VPU, 128, 0, 1, MASTER_MMSYS);
> > +DEFINE_MNODE(mm_disp, MASTER_MM_DISP, 128, 0, 1, MASTER_MMSYS);
> > +DEFINE_MNODE(mm_vdec, MASTER_MM_VDEC, 128, 0, 1, MASTER_MMSYS);
> > +DEFINE_MNODE(mm_venc, MASTER_MM_VENC, 128, 0, 1, MASTER_MMSYS);
> > +DEFINE_MNODE(mm_cam, MASTER_MM_CAM, 128, 0, 1, MASTER_MMSYS);
> > +DEFINE_MNODE(mm_img, MASTER_MM_IMG, 128, 0, 1, MASTER_MMSYS);
> > +DEFINE_MNODE(mm_mdp, MASTER_MM_MDP, 128, 0, 1, MASTER_MMSYS);
> > +
> > +static struct mtk_icc_node *mt8183_icc_nodes[] = {
> > + &ddr_emi,
> > + &mcusys,
> > + &gpu,
> > + &mmsys,
> > + &mm_vpu,
> > + &mm_disp,
> > + &mm_vdec,
> > + &mm_venc,
> > + &mm_cam,
> > + &mm_img,
> > + &mm_mdp,
> > +};
> > +
> > +static struct mtk_icc_desc mt8183_icc = {
> > + .nodes = mt8183_icc_nodes,
> > + .num_nodes = ARRAY_SIZE(mt8183_icc_nodes),
> > +};
> > +
> > +static int mt8183_icc_aggregate(struct icc_node *node, u32 avg_bw,
> > + u32 peak_bw, u32 *agg_avg, u32 *agg_peak)
> > +{
> > + struct mtk_icc_node *in;
> > +
> > + in = node->data;
> > +
> > + *agg_avg += avg_bw;
> > + *agg_peak = max_t(u32, *agg_peak, peak_bw);
> > +
> > + in->sum_avg = *agg_avg;
> > + in->max_peak = *agg_peak;
> > +
> > + return 0;
> > +}
> > +
> > +static int mt8183_icc_set(struct icc_node *src, struct icc_node *dst)
> > +{
> > + int ret = 0;
> > + struct mtk_icc_node *node;
> > +
> > + node = dst->data;
> > + if (node->ep) {
> > + pr_debug("sum_avg (%llu), max_peak (%llu)\n",
> > + node->sum_avg, node->max_peak);
> > + mtk_dvfsrc_send_request(src->provider->dev->parent,
> > + MTK_DVFSRC_CMD_BW_REQUEST,
> > + node->max_peak);
> > + }
> > +
> > + return ret;
> > +}
> > +
> > +static int mt8183_icc_probe(struct platform_device *pdev)
> > +{
> > + int ret;
> > + const struct mtk_icc_desc *desc;
> > + struct icc_node *node;
> > + struct icc_onecell_data *data;
> > + struct icc_provider *provider;
> > + struct mtk_icc_node **mnodes;
> > + size_t num_nodes, i, j;
> > +
> > + desc = of_device_get_match_data(&pdev->dev);
> > + if (!desc)
> > + return -EINVAL;
> > +
> > + mnodes = desc->nodes;
> > + num_nodes = desc->num_nodes;
> > +
> > + provider = devm_kzalloc(&pdev->dev, sizeof(*provider), GFP_KERNEL);
> > + if (!provider)
> > + return -ENOMEM;
> > +
> > + data = devm_kcalloc(&pdev->dev, num_nodes, sizeof(*node), GFP_KERNEL);
> > + if (!data)
> > + return -ENOMEM;
> > +
> > + provider->dev = &pdev->dev;
> > + provider->set = mt8183_icc_set;
> > + provider->aggregate = mt8183_icc_aggregate;
> > + provider->xlate = of_icc_xlate_onecell;
> > + INIT_LIST_HEAD(&provider->nodes);
> > + provider->data = data;
> > +
> > + ret = icc_provider_add(provider);
> > + if (ret) {
> > + dev_err(&pdev->dev, "error adding interconnect provider\n");
> > + return ret;
> > + }
> > +
> > + for (i = 0; i < num_nodes; i++) {
> > + node = icc_node_create(mnodes[i]->id);
> > + if (IS_ERR(node)) {
> > + ret = PTR_ERR(node);
> > + goto err;
> > + }
> > +
> > + node->name = mnodes[i]->name;
> > + node->data = mnodes[i];
> > + icc_node_add(node, provider);
> > +
> > + dev_dbg(&pdev->dev, "registered node %s, num link: %d\n",
> > + mnodes[i]->name, mnodes[i]->num_links);
> > +
> > + /* populate links */
> > + for (j = 0; j < mnodes[i]->num_links; j++)
> > + icc_link_create(node, mnodes[i]->links[j]);
> > +
> > + data->nodes[i] = node;
> > + }
> > + data->num_nodes = num_nodes;
> > +
> > + platform_set_drvdata(pdev, provider);
> > +
> > + return ret;
>
> just return 0;
ok.
>
> > +err:
> > + list_for_each_entry(node, &provider->nodes, node_list) {
> > + icc_node_del(node);
> > + icc_node_destroy(node->id);
> > + }
> > +
> > + icc_provider_del(provider);
> > + return ret;
> > +}
> > +
> > +static int mt8183_icc_remove(struct platform_device *pdev)
> > +{
> > + struct icc_provider *provider = platform_get_drvdata(pdev);
> > + struct icc_node *n;
> > +
> > + list_for_each_entry(n, &provider->nodes, node_list) {
> > + icc_node_del(n);
> > + icc_node_destroy(n->id);
> > + }
> > +
> > + return icc_provider_del(provider);
> > +}
> > +
> > +static const struct of_device_id mt8183_icc_of_match[] = {
> > + { .compatible = "mediatek,mt8183-emi-icc", .data = &mt8183_icc },
>
> A separate -icc compatible should not be needed.
ok.
>
> Thanks,
> Georgi
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply
* Re: [RFC V2 09/11] dt-bindings: interconnect: Add header for interconnect node
From: Henry Chen @ 2019-08-19 1:43 UTC (permalink / raw)
To: Rob Herring
Cc: Nicolas Boichat, Weiyi Lu, James Liao, Viresh Kumar, linux-kernel,
Stephen Boyd, Fan Chen, devicetree, linux-mediatek,
Matthias Brugger, Georgi Djakov, linux-arm-kernel
In-Reply-To: <20190501202844.GA5092@bogus>
On Wed, 2019-05-01 at 15:28 -0500, Rob Herring wrote:
> On Tue, Apr 30, 2019 at 04:51:03PM +0800, Henry Chen wrote:
> > Add header file for mt8183 interconnect node that could be shared between
> > the interconeect provider driver and Device Tree source files.
> >
> > Signed-off-by: Henry Chen <henryc.chen@mediatek.com>
> > ---
> > include/dt-bindings/interconnect/mtk,mt8183.h | 18 ++++++++++++++++++
> > 1 file changed, 18 insertions(+)
> > create mode 100644 include/dt-bindings/interconnect/mtk,mt8183.h
>
> This goes with the binding patch.
ok, will merged into previous patch 08.
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply
* Re: [RFC V2 08/11] dt-bindings: interconnect: add MT8183 interconnect dt-bindings
From: Henry Chen @ 2019-08-19 1:39 UTC (permalink / raw)
To: Rob Herring
Cc: Nicolas Boichat, Weiyi Lu, James Liao, Viresh Kumar, linux-kernel,
Stephen Boyd, Fan Chen, devicetree, linux-mediatek,
Matthias Brugger, Georgi Djakov, linux-arm-kernel
In-Reply-To: <20190501202753.GA2862@bogus>
Hi Rob,
Sorry for late reply.
On Wed, 2019-05-01 at 15:27 -0500, Rob Herring wrote:
> On Tue, Apr 30, 2019 at 04:51:02PM +0800, Henry Chen wrote:
> > Add interconnect provider dt-bindings for MT8183.
> >
> > Signed-off-by: Henry Chen <henryc.chen@mediatek.com>
> > ---
> > .../bindings/interconnect/mtk,mt8183.txt | 24 ++++++++++++++++++++++
> > 1 file changed, 24 insertions(+)
> > create mode 100644 Documentation/devicetree/bindings/interconnect/mtk,mt8183.txt
> >
> > diff --git a/Documentation/devicetree/bindings/interconnect/mtk,mt8183.txt b/Documentation/devicetree/bindings/interconnect/mtk,mt8183.txt
> > new file mode 100644
> > index 0000000..1cf1841
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/interconnect/mtk,mt8183.txt
> > @@ -0,0 +1,24 @@
> > +Mediatek MT8183 interconnect binding
>
> This should be part of the dvfsrc binding.
ok, will add these into dvfsrc binding.
>
> > +
> > +MT8183 interconnect providers support dram bandwidth requirements. The provider
> > +is able to communicate with the DVFSRC and send the dram bandwidth to it.
> > +Provider nodes must reside within an DVFSRC device node.
> > +
> > +Required properties :
> > +- compatible : shall contain only one of the following:
> > + "mediatek,mt8183-emi-icc"
> > +- #interconnect-cells : should contain 1
> > +
> > +Examples:
> > +
> > +dvfsrc@10012000 {
> > + compatible = "mediatek,mt8183-dvfsrc";
> > + reg = <0 0x10012000 0 0x1000>;
> > + clocks = <&infracfg CLK_INFRA_DVFSRC>;
> > + clock-names = "dvfsrc";
> > + ddr_emi: interconnect {
> > + compatible = "mediatek,mt8183-emi-icc";
> > + #interconnect-cells = <1>;
>
> No need for a child node here. Just move #interconnect-cells to the
> parent.
Ihave tried and it cannot work if move "#interconnect-cells" to the
parent.
The provider nodes must reside within an DVFSRC device node.
>
> Rob
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply
* Re: [RFC V2 06/11] soc: mediatek: add MT8183 dvfsrc support
From: Henry Chen @ 2019-08-19 1:35 UTC (permalink / raw)
To: Ryan Case
Cc: Nicolas Boichat, Weiyi Lu, James Liao, Viresh Kumar, linux-kernel,
Stephen Boyd, Fan Chen, devicetree, Rob Herring, linux-mediatek,
Matthias Brugger, Georgi Djakov, linux-arm-kernel
In-Reply-To: <CACjz--=OPx06-pLdoKv_h+y=4nSW0O7zrHM5=hPqTBvMAfmpWA@mail.gmail.com>
On Mon, 2019-06-10 at 14:00 -0700, Ryan Case wrote:
Hi Ryan,
Sorry for late reply.
> Hi Henry,
>
> On Tue, Apr 30, 2019 at 2:45 AM Henry Chen <henryc.chen@mediatek.com> wrote:
> >
> > Add dvfsrc driver for MT8183
> >
> > Signed-off-by: Henry Chen <henryc.chen@mediatek.com>
> > ---
> > drivers/soc/mediatek/Kconfig | 15 ++
> > drivers/soc/mediatek/Makefile | 1 +
> > drivers/soc/mediatek/mtk-dvfsrc.c | 347 ++++++++++++++++++++++++++++++++++++++
> > include/soc/mediatek/mtk_dvfsrc.h | 22 +++
> > 4 files changed, 385 insertions(+)
> > create mode 100644 drivers/soc/mediatek/mtk-dvfsrc.c
> > create mode 100644 include/soc/mediatek/mtk_dvfsrc.h
> >
> > diff --git a/drivers/soc/mediatek/Kconfig b/drivers/soc/mediatek/Kconfig
> > index 17bd759..2721fd6 100644
> > --- a/drivers/soc/mediatek/Kconfig
> > +++ b/drivers/soc/mediatek/Kconfig
> > @@ -24,6 +24,21 @@ config MTK_INFRACFG
> > INFRACFG controller contains various infrastructure registers not
> > directly associated to any device.
> >
> > +config MTK_DVFSRC
> > + bool "MediaTek DVFSRC Support"
> > + depends on ARCH_MEDIATEK
> > + default ARCH_MEDIATEK
> > + select MTK_INFRACFG
> > + select PM_GENERIC_DOMAINS if PM
> > + depends on MTK_SCPSYS
> > + help
> > + Say yes here to add support for the MediaTek DVFSRC (dynamic voltage
> > + and frequency scaling resource collector) found
> > + on different MediaTek SoCs. The DVFSRC is a proprietary
> > + hardware which is used to collect all the requests from
> > + system and turn into the decision of minimum Vcore voltage
> > + and minimum DRAM frequency to fulfill those requests.
> > +
> > config MTK_PMIC_WRAP
> > tristate "MediaTek PMIC Wrapper Support"
> > depends on RESET_CONTROLLER
> > diff --git a/drivers/soc/mediatek/Makefile b/drivers/soc/mediatek/Makefile
> > index b9dbad6..cd9d63f 100644
> > --- a/drivers/soc/mediatek/Makefile
> > +++ b/drivers/soc/mediatek/Makefile
> > @@ -1,4 +1,5 @@
> > obj-$(CONFIG_MTK_CMDQ) += mtk-cmdq-helper.o
> > +obj-$(CONFIG_MTK_DVFSRC) += mtk-dvfsrc.o
> > obj-$(CONFIG_MTK_INFRACFG) += mtk-infracfg.o mtk-scpsys-ext.o
> > obj-$(CONFIG_MTK_PMIC_WRAP) += mtk-pmic-wrap.o
> > obj-$(CONFIG_MTK_SCPSYS) += mtk-scpsys.o
> > diff --git a/drivers/soc/mediatek/mtk-dvfsrc.c b/drivers/soc/mediatek/mtk-dvfsrc.c
> > new file mode 100644
> > index 0000000..e54a654
> > --- /dev/null
> > +++ b/drivers/soc/mediatek/mtk-dvfsrc.c
> > @@ -0,0 +1,347 @@
> > +// SPDX-License-Identifier: GPL-2.0
> > +/*
> > + * Copyright (C) 2018 MediaTek Inc.
> > + */
> > +#include <linux/arm-smccc.h>
> > +#include <linux/clk.h>
> > +#include <linux/io.h>
> > +#include <linux/module.h>
> > +#include <linux/notifier.h>
> > +#include <linux/of_device.h>
> > +#include <linux/platform_device.h>
> > +#include <soc/mediatek/mtk_dvfsrc.h>
> > +#include <soc/mediatek/mtk_sip.h>
> > +#include <dt-bindings/power/mt8183-power.h>
> > +#include <dt-bindings/soc/mtk,dvfsrc.h>
> > +#include <dt-bindings/soc/mtk,dvfsrc.h>
> > +#include "mtk-scpsys.h"
> > +
> > +#define DVFSRC_IDLE 0x00
> > +#define DVFSRC_GET_TARGET_LEVEL(x) (((x) >> 0) & 0x0000ffff)
> > +#define DVFSRC_GET_CURRENT_LEVEL(x) (((x) >> 16) & 0x0000ffff)
> > +
> > +#define MT8183_DVFSRC_OPP_LP4 0
> > +#define MT8183_DVFSRC_OPP_LP4X 1
> > +#define MT8183_DVFSRC_OPP_LP3 2
> > +
> > +struct dvfsrc_opp {
> > + u32 vcore_opp;
> > + u32 dram_opp;
> > +};
> > +
> > +struct dvfsrc_domain {
> > + u32 id;
> > + u32 state;
> > +};
> > +
> > +struct mtk_dvfsrc;
> > +struct dvfsrc_soc_data {
> > + const int *regs;
> > + u32 num_opp;
> > + u32 num_domains;
> > + const struct dvfsrc_opp **opps;
> > + struct dvfsrc_domain *domains;
> > + int (*get_target_level)(struct mtk_dvfsrc *dvfsrc);
> > + int (*get_current_level)(struct mtk_dvfsrc *dvfsrc);
> > + void (*set_dram_bw)(struct mtk_dvfsrc *dvfsrc, u64 bw);
> > + void (*set_opp_level)(struct mtk_dvfsrc *dvfsrc, u32 level);
> > +};
> > +
> > +struct mtk_dvfsrc {
> > + struct device *dev;
> > + struct clk *clk_dvfsrc;
> > + const struct dvfsrc_soc_data *dvd;
> > + int dram_type;
> > + void __iomem *regs;
> > + struct mutex lock;
> > + struct notifier_block scpsys_notifier;
> > +};
> > +
> > +static u32 dvfsrc_read(struct mtk_dvfsrc *dvfs, u32 offset)
> > +{
> > + return readl(dvfs->regs + dvfs->dvd->regs[offset]);
> > +}
> > +
> > +static void dvfsrc_write(struct mtk_dvfsrc *dvfs, u32 offset, u32 val)
> > +{
> > + writel(val, dvfs->regs + dvfs->dvd->regs[offset]);
> > +}
> > +
> > +enum dvfsrc_regs {
> > + DVFSRC_SW_REQ,
> > + DVFSRC_LEVEL,
> > + DVFSRC_SW_BW_0,
> > + DVFSRC_LAST,
> > +};
> > +
> > +static const int mt8183_regs[] = {
> > + [DVFSRC_SW_REQ] = 0x4,
> > + [DVFSRC_LEVEL] = 0xDC,
> > + [DVFSRC_SW_BW_0] = 0x160,
> > + [DVFSRC_LAST] = 0x308,
> > +};
> > +
> > +static bool dvfsrc_is_idle(struct mtk_dvfsrc *dvfsrc)
> > +{
> > + if (!dvfsrc->dvd->get_target_level)
> > + return true;
> > +
> > + return dvfsrc->dvd->get_target_level(dvfsrc) == DVFSRC_IDLE;
> > +}
> > +
> > +static int dvfsrc_wait_for_idle(struct mtk_dvfsrc *dvfsrc)
> > +{
> > + unsigned long timeout;
> > +
> > + timeout = jiffies + usecs_to_jiffies(1000);
> > +
> > + do {
> > + if (dvfsrc_is_idle(dvfsrc))
> > + return 0;
> > + } while (!time_after(jiffies, timeout));
>
> This all seems like it would be better handled by readx_poll_timeout
> rather than rolling your own.
It's great suggestion, thanks.
>
> > +
> > + return -ETIMEDOUT;
> > +}
> > +
> > +static int mt8183_get_target_level(struct mtk_dvfsrc *dvfsrc)
> > +{
> > + return DVFSRC_GET_TARGET_LEVEL(dvfsrc_read(dvfsrc, DVFSRC_LEVEL));
> > +}
> > +
> > +static int mt8183_get_current_level(struct mtk_dvfsrc *dvfsrc)
> > +{
> > + return ffs(DVFSRC_GET_CURRENT_LEVEL(dvfsrc_read(dvfsrc, DVFSRC_LEVEL)));
> > +}
> > +
> > +static void mt8183_set_dram_bw(struct mtk_dvfsrc *dvfsrc, u64 bw)
> > +{
> > + dvfsrc_write(dvfsrc, DVFSRC_SW_BW_0, bw);
> > +}
> > +
> > +static void mt8183_set_opp_level(struct mtk_dvfsrc *dvfsrc, u32 level)
> > +{
> > + int vcore_opp, dram_opp;
> > + const struct dvfsrc_opp *opp;
> > +
> > + /* translate pstate to dvfsrc level, and set it to DVFSRC HW */
> > + opp = &dvfsrc->dvd->opps[dvfsrc->dram_type][level - 1];
> > + vcore_opp = opp->vcore_opp;
> > + dram_opp = opp->dram_opp;
> > +
> > + dev_dbg(dvfsrc->dev, "vcore_opp: %d, dram_opp: %d\n",
> > + vcore_opp, dram_opp);
> > + dvfsrc_write(dvfsrc, DVFSRC_SW_REQ, dram_opp | vcore_opp << 2);
> > +}
> > +
> > +void mtk_dvfsrc_send_request(const struct device *dev, u32 cmd, u64 data)
> > +{
> > + struct mtk_dvfsrc *dvfsrc = dev_get_drvdata(dev);
> > +
> > + dev_dbg(dvfsrc->dev, "cmd: %d, data: %llu\n", cmd, data);
> > +
> > + mutex_lock(&dvfsrc->lock);
> > +
> > + if (dvfsrc_wait_for_idle(dvfsrc)) {
> > + dev_warn(dvfsrc->dev, "[%s] wait idle, last: %d -> %d\n",
> > + __func__, dvfsrc_read(dvfsrc, DVFSRC_LEVEL),
> > + dvfsrc_read(dvfsrc, DVFSRC_LAST));
> > + goto out;
> > + }
> > +
> > + switch (cmd) {
> > + case MTK_DVFSRC_CMD_BW_REQUEST:
> > + dvfsrc->dvd->set_dram_bw(dvfsrc, data);
> > + goto out;
> > + case MTK_DVFSRC_CMD_OPP_REQUEST:
> > + dvfsrc->dvd->set_opp_level(dvfsrc, data);
> > + break;
> > + default:
> > + dev_err(dvfsrc->dev, "unknown command: %d\n", cmd);
> > + break;
> > + }
> > +
> > + if (dvfsrc_wait_for_idle(dvfsrc)) {
> > + dev_warn(dvfsrc->dev, "[%s] wait idle, last: %d -> %d\n",
> > + __func__, dvfsrc_read(dvfsrc, DVFSRC_LEVEL),
> > + dvfsrc_read(dvfsrc, DVFSRC_LAST));
> > + goto out;
> > + }
> > +
> > +out:
> > + mutex_unlock(&dvfsrc->lock);
> > +}
> > +EXPORT_SYMBOL(mtk_dvfsrc_send_request);
> > +
> > +static int dvfsrc_set_performance(struct notifier_block *b,
> > + unsigned long l, void *v)
> > +{
> > + int i, val, highest;
>
> Variable names could be improved. "val" is only ever used to store the
> current level, would be nice to make the name more specific. Similarly
> "l" looks like it would be better as something state related.
>
> val and highest at least should be u32.
ok, about naming, I will correct and make it more clearly.
>
> > + struct mtk_dvfsrc *dvfsrc;
> > + struct scp_event_data *sc = v;
> > + struct dvfsrc_domain *d;
> > +
> > + if (sc->event_type != MTK_SCPSYS_PSTATE)
> > + return 0;
> > +
> > + dvfsrc = container_of(b, struct mtk_dvfsrc, scpsys_notifier);
> > +
> > + d = dvfsrc->dvd->domains;
> > +
> > + if (l > dvfsrc->dvd->num_opp) {
> > + dev_err(dvfsrc->dev, "pstate out of range = %ld\n", l);
> > + goto out;
>
> Can just return 0;
ok.
>
> > + }
> > +
> > + for (i = 0, highest = 0; i < dvfsrc->dvd->num_domains - 1; i++, d++) {
>
> It's not immediately clear to me why a domain is skipped (the -1).
> This is either worth a comment or it may be a bug?
Indeed, it no need, I will check and re-test again, thanks.
>
> > + if (sc->domain_id == d->id)
> > + d->state = l;
> > + if (d->state > highest)
> > + highest = d->state;
> > + }
> > +
> > + if (highest == 0) {
> > + dev_err(dvfsrc->dev, "domain not match\n");
>
> This text is incorrect. You're checking whether all domains had a
> state of zero, not whether you found a domain match. Is this check
> actually needed?
I intend to check if the domain match or no. To avoid confusing, I will
re-write it and used flag to check it.
>
> > + goto out;
>
> return 0;
ok.
>
> > + }
> > +
> > + mtk_dvfsrc_send_request(dvfsrc->dev, MTK_DVFSRC_CMD_OPP_REQUEST,
> > + highest);
> > +
> > + val = dvfsrc->dvd->get_current_level(dvfsrc);
> > +
> > + dev_dbg(dvfsrc->dev, "DVFSRC_LEVEL: %x, val: %x, DVFSRC_SW_REQ: %x\n",
> > + dvfsrc_read(dvfsrc, DVFSRC_LEVEL), val,
> > + dvfsrc_read(dvfsrc, DVFSRC_SW_REQ));
>
> "val:" to "current level:" or something similarly descriptive.
ok.
>
> > +
> > + if (val < highest) {
> > + dev_err(dvfsrc->dev, "current: %d < highest: %x\n",
> > + val, highest);
>
> This message isn't clear and should be more explicit. Something like
> "Current level %d < highest requested %d"
>
> > + goto out;
>
> return 0;
ok.
>
> > + }
> > +
> > +out:
>
> Out label no longer needed.
ok.
>
> > + return 0;
> > +}
> > +
> > +static void pstate_notifier_register(struct mtk_dvfsrc *dvfsrc)
> > +{
> > + dvfsrc->scpsys_notifier.notifier_call = dvfsrc_set_performance;
> > + register_scpsys_notifier(&dvfsrc->scpsys_notifier);
> > +}
> > +
> > +static int mtk_dvfsrc_probe(struct platform_device *pdev)
> > +{
> > + struct arm_smccc_res ares;
> > + struct resource *res;
> > + struct mtk_dvfsrc *dvfsrc;
> > + int ret;
> > +
> > + dvfsrc = devm_kzalloc(&pdev->dev, sizeof(*dvfsrc), GFP_KERNEL);
> > + if (!dvfsrc)
> > + return -ENOMEM;
> > +
> > + dvfsrc->dvd = of_device_get_match_data(&pdev->dev);
> > + dvfsrc->dev = &pdev->dev;
> > +
> > + res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> > + dvfsrc->regs = devm_ioremap_resource(&pdev->dev, res);
> > + if (IS_ERR(dvfsrc->regs))
> > + return PTR_ERR(dvfsrc->regs);
> > +
> > + dvfsrc->clk_dvfsrc = devm_clk_get(dvfsrc->dev, "dvfsrc");
> > + if (IS_ERR(dvfsrc->clk_dvfsrc)) {
> > + dev_err(dvfsrc->dev, "failed to get clock: %ld\n",
> > + PTR_ERR(dvfsrc->clk_dvfsrc));
> > + return PTR_ERR(dvfsrc->clk_dvfsrc);
> > + }
> > +
> > + ret = clk_prepare_enable(dvfsrc->clk_dvfsrc);
> > + if (ret)
> > + return ret;
> > +
> > + mutex_init(&dvfsrc->lock);
> > +
> > + arm_smccc_smc(MTK_SIP_SPM, MTK_SIP_SPM_DVFSRC_INIT, 0, 0, 0, 0, 0, 0,
> > + &ares);
> > +
> > + if (!ares.a0) {
> > + dvfsrc->dram_type = ares.a1;
> > + } else {
> > + dev_err(dvfsrc->dev, "init fails: %lu\n", ares.a0);
> > + clk_disable_unprepare(dvfsrc->clk_dvfsrc);
> > + return ares.a0;
> > + }
> > +
> > + platform_set_drvdata(pdev, dvfsrc);
> > + pstate_notifier_register(dvfsrc);
> > +
> > + return devm_of_platform_populate(&pdev->dev);
> > +}
> > +
> > +static const struct dvfsrc_opp dvfsrc_opp_mt8183_lp4[] = {
> > + {0, 0}, {0, 1}, {0, 2}, {1, 2},
> > +};
> > +
> > +static const struct dvfsrc_opp dvfsrc_opp_mt8183_lp3[] = {
> > + {0, 0}, {0, 1}, {1, 1}, {1, 2},
> > +};
> > +
> > +static const struct dvfsrc_opp *dvfsrc_opp_mt8183[] = {
> > + [MT8183_DVFSRC_OPP_LP4] = dvfsrc_opp_mt8183_lp4,
> > + [MT8183_DVFSRC_OPP_LP4X] = dvfsrc_opp_mt8183_lp3,
> > + [MT8183_DVFSRC_OPP_LP3] = dvfsrc_opp_mt8183_lp3,
> > +};
> > +
> > +static struct dvfsrc_domain dvfsrc_domains_mt8183[] = {
> > + { MT8183_POWER_DOMAIN_MFG_ASYNC, 0 },
> > + { MT8183_POWER_DOMAIN_MFG, 0 },
> > + { MT8183_POWER_DOMAIN_CAM, 0 },
> > + { MT8183_POWER_DOMAIN_DISP, 0 },
> > + { MT8183_POWER_DOMAIN_ISP, 0 },
> > + { MT8183_POWER_DOMAIN_VDEC, 0 },
> > + { MT8183_POWER_DOMAIN_VENC, 0 },
> > +};
> > +
> > +static const struct dvfsrc_soc_data mt8183_data = {
> > + .opps = dvfsrc_opp_mt8183,
> > + .num_opp = ARRAY_SIZE(dvfsrc_opp_mt8183_lp4),
> > + .regs = mt8183_regs,
> > + .domains = dvfsrc_domains_mt8183,
> > + .num_domains = ARRAY_SIZE(dvfsrc_domains_mt8183),
> > + .get_target_level = mt8183_get_target_level,
> > + .get_current_level = mt8183_get_current_level,
> > + .set_dram_bw = mt8183_set_dram_bw,
> > + .set_opp_level = mt8183_set_opp_level,
> > +};
> > +
> > +static int mtk_dvfsrc_remove(struct platform_device *pdev)
> > +{
> > + struct mtk_dvfsrc *dvfsrc = platform_get_drvdata(pdev);
> > +
> > + clk_disable_unprepare(dvfsrc->clk_dvfsrc);
> > +
> > + return 0;
> > +}
> > +
> > +static const struct of_device_id mtk_dvfsrc_of_match[] = {
> > + {
> > + .compatible = "mediatek,mt8183-dvfsrc",
> > + .data = &mt8183_data,
> > + }, {
> > + /* sentinel */
> > + },
> > +};
> > +
> > +static struct platform_driver mtk_dvfsrc_driver = {
> > + .probe = mtk_dvfsrc_probe,
> > + .remove = mtk_dvfsrc_remove,
> > + .driver = {
> > + .name = "mtk-dvfsrc",
> > + .of_match_table = of_match_ptr(mtk_dvfsrc_of_match),
> > + },
> > +};
> > +
> > +builtin_platform_driver(mtk_dvfsrc_driver);
> > +
> > +MODULE_LICENSE("GPL v2");
> > +MODULE_DESCRIPTION("MTK DVFSRC driver");
> > diff --git a/include/soc/mediatek/mtk_dvfsrc.h b/include/soc/mediatek/mtk_dvfsrc.h
> > new file mode 100644
> > index 0000000..e759a65
> > --- /dev/null
> > +++ b/include/soc/mediatek/mtk_dvfsrc.h
> > @@ -0,0 +1,22 @@
> > +/* SPDX-License-Identifier: GPL-2.0
> > + *
> > + * Copyright (c) 2018 MediaTek Inc.
> > + */
> > +#ifndef __SOC_MTK_DVFSRC_H
> > +#define __SOC_MTK_DVFSRC_H
> > +
> > +#define MTK_DVFSRC_CMD_BW_REQUEST 0
> > +#define MTK_DVFSRC_CMD_OPP_REQUEST 1
> > +
> > +#if IS_ENABLED(CONFIG_MTK_DVFSRC)
> > +void mtk_dvfsrc_send_request(const struct device *dev, u32 cmd, u64 data);
> > +
> > +#else
> > +
> > +static inline void mtk_dvfsrc_send_request(const struct device *dev, u32 cmd,
> > + u64 data)
> > +{ return -ENODEV; }
> > +
> > +#endif /* CONFIG_MTK_DVFSRC */
> > +
> > +#endif
> > --
> > 1.9.1
> >
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply
* Re: [PATCH] gpu: drm: mediatek: mtk_drm_drv.c: Add of_node_put() before goto
From: CK Hu @ 2019-08-19 1:30 UTC (permalink / raw)
To: Nishka Dasgupta
Cc: p.zabel, airlie, dri-devel, linux-mediatek, daniel, matthias.bgg,
linux-arm-kernel
In-Reply-To: <20190706133021.3308-1-nishkadg.linux@gmail.com>
Hi, Nishka:
On Sat, 2019-07-06 at 19:00 +0530, Nishka Dasgupta wrote:
> Each iteration of for_each_child_of_node puts the previous
> node, but in the case of a goto from the middle of the loop, there is
> no put, thus causing a memory leak. Hence add an of_node_put before the
> goto in two places.
> Issue found with Coccinelle.
Applied to mediatek-drm-fixes-5.3 [1], thanks.
[1]
https://github.com/ckhu-mediatek/linux.git-tags/tree/mediatek-drm-fixes-5.3
Regards,
CK
>
> Signed-off-by: Nishka Dasgupta <nishkadg.linux@gmail.com>
> ---
> drivers/gpu/drm/mediatek/mtk_drm_drv.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.c b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
> index 95fdbd0fbcac..2dffbc8c6d73 100644
> --- a/drivers/gpu/drm/mediatek/mtk_drm_drv.c
> +++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
> @@ -524,12 +524,15 @@ static int mtk_drm_probe(struct platform_device *pdev)
> comp = devm_kzalloc(dev, sizeof(*comp), GFP_KERNEL);
> if (!comp) {
> ret = -ENOMEM;
> + of_node_put(node);
> goto err_node;
> }
>
> ret = mtk_ddp_comp_init(dev, node, comp, comp_id, NULL);
> - if (ret)
> + if (ret) {
> + of_node_put(node);
> goto err_node;
> + }
>
> private->ddp_comp[comp_id] = comp;
> }
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply
* RE: [PATCH] clk: imx8mn: fix int pll clk gate
From: Peng Fan @ 2019-08-19 1:05 UTC (permalink / raw)
To: Stephen Boyd, mturquette@baylibre.com, s.hauer@pengutronix.de,
shawnguo@kernel.org
Cc: Jacky Bai, Anson Huang, linux-kernel@vger.kernel.org,
dl-linux-imx, kernel@pengutronix.de, festevam@gmail.com,
linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
Abel Vesa
In-Reply-To: <20190816180246.D37BD20665@mail.kernel.org>
Hi Stephen,
> Subject: Re: [PATCH] clk: imx8mn: fix int pll clk gate
>
> Quoting peng.fan@nxp.com (2019-08-13 18:53:12)
> > From: Peng Fan <peng.fan@nxp.com>
> >
> > To Frac pll, the gate shift is 13, however to Int PLL the gate shift
> > is 11.
> >
> > Cc: <stable@vger.kernel.org>
> > Fixes: 96d6392b54db ("clk: imx: Add support for i.MX8MN clock driver")
> > Signed-off-by: Peng Fan <peng.fan@nxp.com>
> > Reviewed-by: Jacky Bai <ping.bai@nxp.com>
> > ---
>
> This is a fix for a change in -next. Why is stable Cced?
Sorry, that was added by mistaken. Should I resend v2 to drop it?
Thanks,
Peng.
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply
* Re: [PATCH v2] arm: dts: rockchip: fix vcc_host_5v regulator for usb3 host
From: Kever Yang @ 2019-08-19 0:29 UTC (permalink / raw)
To: Heiko Stuebner
Cc: Mark Rutland, devicetree, Jonas Karlman, Katsuhiro Suzuki,
linux-kernel, linux-rockchip, Chen-Yu Tsai, Rob Herring,
Tomohiro Mayama, linux-arm-kernel
In-Reply-To: <2932927.UJgUFA1Pmh@phil>
Hi Heiko,
On 2019/8/16 下午8:24, Heiko Stuebner wrote:
> Hi Kever, TL,
>
> [added TL Lim for clarification]
>
> Am Donnerstag, 15. August 2019, 10:12:52 CEST schrieb Kever Yang:
>> According to rock64 schemetic V2 and V3, the VCC_HOST_5V output is
>> controlled by USB_20_HOST_DRV, which is the same as VCC_HOST1_5V.
> The v1 schematics I have do reference the GPIO0_A0 as controlling this
> supply, so the big question would be how to handle the different versions.
>
> Because adding this would probably break v1 boards in this function.
>
> @TL: where v1 boards also sold or were they only used during development?
I have check this with TL when I make this patch, the V1 hardware was
never sold and only V2/V3
are available on the market.
Thanks,
- Kever
> If this were the case, we could just apply the patch, not caring about
> v1 boards, but if v1 boards were also sold to customers there would be
> more of a problem.
>
> Thanks
> Heiko
>
>
>> Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
>> ---
>>
>> Changes in v2:
>> - remove enable-active-high property
>>
>> arch/arm64/boot/dts/rockchip/rk3328-rock64.dts | 11 ++---------
>> 1 file changed, 2 insertions(+), 9 deletions(-)
>>
>> diff --git a/arch/arm64/boot/dts/rockchip/rk3328-rock64.dts b/arch/arm64/boot/dts/rockchip/rk3328-rock64.dts
>> index 7cfd5ca6cc85..62936b432f9a 100644
>> --- a/arch/arm64/boot/dts/rockchip/rk3328-rock64.dts
>> +++ b/arch/arm64/boot/dts/rockchip/rk3328-rock64.dts
>> @@ -34,10 +34,9 @@
>>
>> vcc_host_5v: vcc-host-5v-regulator {
>> compatible = "regulator-fixed";
>> - enable-active-high;
>> - gpio = <&gpio0 RK_PA0 GPIO_ACTIVE_HIGH>;
>> + gpio = <&gpio0 RK_PA2 GPIO_ACTIVE_LOW>;
>> pinctrl-names = "default";
>> - pinctrl-0 = <&usb30_host_drv>;
>> + pinctrl-0 = <&usb20_host_drv>;
>> regulator-name = "vcc_host_5v";
>> regulator-always-on;
>> regulator-boot-on;
>> @@ -320,12 +319,6 @@
>> rockchip,pins = <0 RK_PA2 RK_FUNC_GPIO &pcfg_pull_none>;
>> };
>> };
>> -
>> - usb3 {
>> - usb30_host_drv: usb30-host-drv {
>> - rockchip,pins = <0 RK_PA0 RK_FUNC_GPIO &pcfg_pull_none>;
>> - };
>> - };
>> };
>>
>> &sdmmc {
>>
>
>
>
>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply
* Re: [PATCH 1/2] dt-bindings: watchdog: Add ast2600 compatible
From: Andrew Jeffery @ 2019-08-19 0:16 UTC (permalink / raw)
To: Joel Stanley, Wim Van Sebroeck, Guenter Roeck, Rob Herring
Cc: devicetree, linux-aspeed, Ryan Chen, linux-watchdog,
linux-arm-kernel
In-Reply-To: <20190816160347.23393-2-joel@jms.id.au>
On Sat, 17 Aug 2019, at 01:34, Joel Stanley wrote:
> This adds a compatible for the ast2600, a new ASPEED SoC.
>
> Signed-off-by: Joel Stanley <joel@jms.id.au>
Reviewed-by: Andrew Jeffery <andrew@aj.id.au>
> ---
> Documentation/devicetree/bindings/watchdog/aspeed-wdt.txt | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/Documentation/devicetree/bindings/watchdog/aspeed-wdt.txt
> b/Documentation/devicetree/bindings/watchdog/aspeed-wdt.txt
> index c5077a1f5cb3..d78d4a8fb868 100644
> --- a/Documentation/devicetree/bindings/watchdog/aspeed-wdt.txt
> +++ b/Documentation/devicetree/bindings/watchdog/aspeed-wdt.txt
> @@ -4,6 +4,7 @@ Required properties:
> - compatible: must be one of:
> - "aspeed,ast2400-wdt"
> - "aspeed,ast2500-wdt"
> + - "aspeed,ast2600-wdt"
>
> - reg: physical base address of the controller and length of memory mapped
> region
> --
> 2.23.0.rc1
>
>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply
* Re: [BUG] removing and reinserting imx-media causes kernel to explode
From: Steve Longerbeam @ 2019-08-18 22:41 UTC (permalink / raw)
To: Russell King - ARM Linux admin
Cc: open list:STAGING SUBSYSTEM, Philipp Zabel, Ezequiel Garcia,
Greg Kroah-Hartman, Sascha Hauer, open list, Sakari Ailus,
NXP Linux Team, Pengutronix Kernel Team, Shawn Guo,
Mauro Carvalho Chehab, Fabio Estevam,
moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE,
linux-media
In-Reply-To: <20190814092506.GH13294@shell.armlinux.org.uk>
On 8/14/19 2:25 AM, Russell King - ARM Linux admin wrote:
> I just did this:
>
> rmmod imx-media
> modprobe imx-media
>
> and was greeted by the below kernel messages.
Yes this needs fixing, the CSI needs to check first that it is already
registered before going through the ->registered() steps. Posting a patch.
> I don't think this has
> been the first issue I found with the iMX media stuff involving a module
> unload/reload cycle - may I suggest that this is added to the testing
> regime for this code? Thanks.
I do test module unload/reload cycles, but v4l2-async does not support
re-registering subdevices unless the subdevice is basically completely
removed and re-probed, so there won't be a working media device if only
imx-media is reloaded. So I have always unloaded/reloaded all modules
for every entity in the graph, i.e.:
rmmod imx6_media imx6_media_csi imx6_mipi_csi2 ov5640 video_mux
imx_media_common
(replace ov5640 with your imx219 sensor).
But I'll make sure to test single module unload/reload cycles in the future.
But note after applying the patch mentioned above to CSI ->registered()
callback, there are list corruption backtraces, see [1]. The root cause
is that both media_device_register_entity() and media_entity_pads_init()
add the same graph objects for the entity's pads, so duplicate pad
objects are added to the media device pads list. Removing the pad object
creation in media_device_register_entity() fixes the list corruption.
Sending a patch for that also.
This is a problem for any entity that sets its ->num_pads to a non-zero
value before media_device_register_entity() is called. For example, the
following will produce the same list corruption backtrace:
rmmod video-mux
modprobe video-mux
rmmod video-mux
Steve
[1]
rmmod imx6-media
modprobe imx6-media
rmmod imx6-media
[ 249.387953] WARNING: CPU: 2 PID: 843 at lib/list_debug.c:53
__list_del_entry_valid+0xa0/0xdc
[ 249.396442] list_del corruption. prev->next should be e8fb0510, but
was e93b5914
[ 249.404076] Modules linked in: imx6_media_csi(C) imx6_media(C-)
imx6_mipi_csi2(C) bnep dw_hdmi_ahb_audio dw_hdmi_cec ov5640 mux_mmio
video_mux mux_core dw_hdmi_imx dw_hdmi coda_vpu cec imx_vdoa
videobuf2_vmalloc imx_media_common(C) v4l2_fwnode imx_ldb imxdrm
imx_ipu_v3 [last unloaded: imx6_media_csi]
[ 249.430956] CPU: 2 PID: 843 Comm: rmmod Tainted: G C
5.3.0-rc4-01115-g62119fd20fda #5
[ 249.440115] Hardware name: Freescale i.MX6 Quad/DualLite (Device Tree)
[ 249.446689] [<c0113a58>] (unwind_backtrace) from [<c010de5c>]
(show_stack+0x10/0x14)
[ 249.454462] [<c010de5c>] (show_stack) from [<c0bdfdcc>]
(dump_stack+0xd8/0x110)
[ 249.461804] [<c0bdfdcc>] (dump_stack) from [<c0128c28>]
(__warn+0xe0/0x10c)
[ 249.468789] [<c0128c28>] (__warn) from [<c0128c98>]
(warn_slowpath_fmt+0x44/0x6c)
[ 249.476301] [<c0128c98>] (warn_slowpath_fmt) from [<c04e8e00>]
(__list_del_entry_valid+0xa0/0xdc)
[ 249.485207] [<c04e8e00>] (__list_del_entry_valid) from [<c07e2b8c>]
(media_gobj_destroy.part.4+0x30/0x64)
[ 249.494802] [<c07e2b8c>] (media_gobj_destroy.part.4) from
[<c07e01d4>] (__media_device_unregister_entity+0xa8/0xcc)
[ 249.505259] [<c07e01d4>] (__media_device_unregister_entity) from
[<c07e0224>] (media_device_unregister_entity+0x2c/0x38)
[ 249.516157] [<c07e0224>] (media_device_unregister_entity) from
[<c07ece34>] (v4l2_device_unregister_subdev+0x90/0xb4)
[ 249.526793] [<c07ece34>] (v4l2_device_unregister_subdev) from
[<c07f9668>] (v4l2_async_cleanup+0x10/0x3c)
[ 249.536382] [<c07f9668>] (v4l2_async_cleanup) from [<c07f9730>]
(v4l2_async_notifier_unbind_all_subdevs+0x9c/0x10c)
[ 249.546840] [<c07f9730>] (v4l2_async_notifier_unbind_all_subdevs)
from [<c07f9700>] (v4l2_async_notifier_unbind_all_subdevs+0x6c/0x10c)
[ 249.559035] [<c07f9700>] (v4l2_async_notifier_unbind_all_subdevs)
from [<c07fa3a0>] (__v4l2_async_notifier_unregister.part.4+0xc/0x44)
[ 249.571140] [<c07fa3a0>] (__v4l2_async_notifier_unregister.part.4)
from [<c07fa408>] (v4l2_async_notifier_unregister+0x30/0x50)
[ 249.582665] [<c07fa408>] (v4l2_async_notifier_unregister) from
[<bf03e020>] (imx_media_remove+0x20/0x54 [imx6_media])
[ 249.593389] [<bf03e020>] (imx_media_remove [imx6_media]) from
[<c064a684>] (platform_drv_remove+0x20/0x40)
[ 249.603068] [<c064a684>] (platform_drv_remove) from [<c0648b50>]
(device_release_driver_internal+0xdc/0x1ac)
[ 249.612917] [<c0648b50>] (device_release_driver_internal) from
[<c0648c7c>] (driver_detach+0x44/0x80)
[ 249.622164] [<c0648c7c>] (driver_detach) from [<c0647404>]
(bus_remove_driver+0x5c/0xd8)
[ 249.630287] [<c0647404>] (bus_remove_driver) from [<c01d305c>]
(sys_delete_module+0x17c/0x20c)
[ 249.638926] [<c01d305c>] (sys_delete_module) from [<c0101000>]
(ret_fast_syscall+0x0/0x28)
[ 249.647205] Exception stack(0xe90d5fa8 to 0xe90d5ff0)
[ 249.652278] 5fa0: beed5d6c 00000003 01401134
00000800 4f13b6f4 00002002
[ 249.660475] 5fc0: beed5d6c 00000003 beed5b80 00000081 beed5e78
00000001 00000000 014010f8
[ 249.668669] 5fe0: 0003b2c4 beed5b4c 0001f248 4f1012dc
[ 249.673859] irq event stamp: 4113
[ 249.677267] hardirqs last enabled at (4131): [<c018d810>]
console_unlock+0x408/0x5f8
[ 249.685125] hardirqs last disabled at (4138): [<c018d490>]
console_unlock+0x88/0x5f8
[ 249.692970] softirqs last enabled at (4154): [<c0102580>]
__do_softirq+0x360/0x524
[ 249.700735] softirqs last disabled at (4165): [<c01306ec>]
irq_exit+0x12c/0x17c
[ 249.708134] ---[ end trace 6fde63f19c7b10b8 ]---
Steve
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply
* Re: [PATCH 2/2] arm64: dts: allwinner: h6: Introduce Tanix TX6 board
From: Clément Péron @ 2019-08-18 22:18 UTC (permalink / raw)
To: Jernej Škrabec
Cc: Mark Rutland, devicetree, kbuild test robot, linux-kernel,
Maxime Ripard, Chen-Yu Tsai, Rob Herring, kbuild-all,
linux-arm-kernel
In-Reply-To: <7640522.c0V0aH5rf2@jernej-laptop>
Hi,
On Sun, 18 Aug 2019 at 21:00, Jernej Škrabec <jernej.skrabec@siol.net> wrote:
>
> Dne nedelja, 18. avgust 2019 ob 20:42:49 CEST je kbuild test robot napisal(a):
> > Hi Jernej,
> >
> > Thank you for the patch! Yet something to improve:
> >
> > [auto build test ERROR on linus/master]
> > [cannot apply to v5.3-rc4 next-20190816]
> > [if your patch is applied to the wrong git tree, please drop us a note to
> > help improve the system]
> >
> > url:
> > https://github.com/0day-ci/linux/commits/Jernej-Skrabec/dt-bindings-arm-sun
> > xi-Add-compatible-for-Tanix-TX6-board/20190819-002034 config:
> > arm64-defconfig (attached as .config)
> > compiler: aarch64-linux-gcc (GCC) 7.4.0
> > reproduce:
> > wget
> > https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O
> > ~/bin/make.cross chmod +x ~/bin/make.cross
> > # save the attached .config to linux build tree
> > GCC_VERSION=7.4.0 make.cross ARCH=arm64
> >
> > If you fix the issue, kindly add following tag
> > Reported-by: kbuild test robot <lkp@intel.com>
> >
> > All errors (new ones prefixed by >>):
> > >> Error: arch/arm64/boot/dts/allwinner/sun50i-h6-tanix-tx6.dts:83.1-6 Label
> > >> or path r_ir not found FATAL ERROR: Syntax error parsing input tree
>
> Strange, Allwinner tree has commit, which introduces r_ir node:
> https://git.kernel.org/pub/scm/linux/kernel/git/sunxi/linux.git/commit/?
> h=sunxi/dt-for-5.4&id=9267811aad3524c857cf2e16bbadd8c569e15ab9
>
> Maybe kbuild test robot tree doesn't have it?
Yes Kbuild is on v5.3-rc4 vs the IR patch is planned for 5.4.
Regards,
Clément
>
> Best regards,
> Jernej
>
> >
> > ---
> > 0-DAY kernel test infrastructure Open Source Technology
> > Center https://lists.01.org/pipermail/kbuild-all Intel
> > Corporation
>
>
>
>
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply
* Re: [PATCH 2/2] arm64: dts: allwinner: h6: Introduce Tanix TX6 board
From: Jernej Škrabec @ 2019-08-18 18:59 UTC (permalink / raw)
To: kbuild test robot
Cc: mark.rutland, devicetree, linux-kernel, mripard, wens, robh+dt,
kbuild-all, linux-arm-kernel
In-Reply-To: <201908190222.ZdIp2gT1%lkp@intel.com>
Dne nedelja, 18. avgust 2019 ob 20:42:49 CEST je kbuild test robot napisal(a):
> Hi Jernej,
>
> Thank you for the patch! Yet something to improve:
>
> [auto build test ERROR on linus/master]
> [cannot apply to v5.3-rc4 next-20190816]
> [if your patch is applied to the wrong git tree, please drop us a note to
> help improve the system]
>
> url:
> https://github.com/0day-ci/linux/commits/Jernej-Skrabec/dt-bindings-arm-sun
> xi-Add-compatible-for-Tanix-TX6-board/20190819-002034 config:
> arm64-defconfig (attached as .config)
> compiler: aarch64-linux-gcc (GCC) 7.4.0
> reproduce:
> wget
> https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O
> ~/bin/make.cross chmod +x ~/bin/make.cross
> # save the attached .config to linux build tree
> GCC_VERSION=7.4.0 make.cross ARCH=arm64
>
> If you fix the issue, kindly add following tag
> Reported-by: kbuild test robot <lkp@intel.com>
>
> All errors (new ones prefixed by >>):
> >> Error: arch/arm64/boot/dts/allwinner/sun50i-h6-tanix-tx6.dts:83.1-6 Label
> >> or path r_ir not found FATAL ERROR: Syntax error parsing input tree
Strange, Allwinner tree has commit, which introduces r_ir node:
https://git.kernel.org/pub/scm/linux/kernel/git/sunxi/linux.git/commit/?
h=sunxi/dt-for-5.4&id=9267811aad3524c857cf2e16bbadd8c569e15ab9
Maybe kbuild test robot tree doesn't have it?
Best regards,
Jernej
>
> ---
> 0-DAY kernel test infrastructure Open Source Technology
> Center https://lists.01.org/pipermail/kbuild-all Intel
> Corporation
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply
* Re: [PATCH 2/2] arm64: dts: allwinner: h6: Introduce Tanix TX6 board
From: kbuild test robot @ 2019-08-18 18:42 UTC (permalink / raw)
To: Jernej Skrabec
Cc: mark.rutland, devicetree, jernej.skrabec, linux-kernel, mripard,
wens, robh+dt, kbuild-all, linux-arm-kernel
In-Reply-To: <20190816205342.29552-3-jernej.skrabec@siol.net>
[-- Attachment #1: Type: text/plain, Size: 1168 bytes --]
Hi Jernej,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on linus/master]
[cannot apply to v5.3-rc4 next-20190816]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Jernej-Skrabec/dt-bindings-arm-sunxi-Add-compatible-for-Tanix-TX6-board/20190819-002034
config: arm64-defconfig (attached as .config)
compiler: aarch64-linux-gcc (GCC) 7.4.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
GCC_VERSION=7.4.0 make.cross ARCH=arm64
If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>
All errors (new ones prefixed by >>):
>> Error: arch/arm64/boot/dts/allwinner/sun50i-h6-tanix-tx6.dts:83.1-6 Label or path r_ir not found
>> FATAL ERROR: Syntax error parsing input tree
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 45357 bytes --]
[-- Attachment #3: Type: text/plain, Size: 176 bytes --]
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply
* Re: [PATCH v3 00/10] KVM: arm/arm64: vgic: ITS translation cache
From: Marc Zyngier @ 2019-08-18 17:55 UTC (permalink / raw)
To: linux-arm-kernel, kvmarm, kvm
Cc: Suzuki K Poulose, Raslan, KarimAllah, Andre Przywara,
Christoffer Dall, Eric Auger, James Morse, Saidi, Ali, Zenghui Yu,
Julien Thierry
In-Reply-To: <20190725153543.24386-1-maz@kernel.org>
On Thu, 25 Jul 2019 16:35:33 +0100
Marc Zyngier <maz@kernel.org> wrote:
> From: Marc Zyngier <marc.zyngier@arm.com>
>
> It recently became apparent[1] that our LPI injection path is not as
> efficient as it could be when injecting interrupts coming from a VFIO
> assigned device.
>
> Although the proposed patch wasn't 100% correct, it outlined at least
> two issues:
>
> (1) Injecting an LPI from VFIO always results in a context switch to a
> worker thread: no good
>
> (2) We have no way of amortising the cost of translating a DID+EID pair
> to an LPI number
>
> The reason for (1) is that we may sleep when translating an LPI, so we
> do need a context process. A way to fix that is to implement a small
> LPI translation cache that could be looked up from an atomic
> context. It would also solve (2).
>
> This is what this small series proposes. It implements a very basic
> LRU cache of pre-translated LPIs, which gets used to implement
> kvm_arch_set_irq_inatomic. The size of the cache is currently
> hard-coded at 16 times the number of vcpus, a number I have picked
> under the influence of Ali Saidi. If that's not enough for you, blame
> me, though.
>
> Does it work? well, it doesn't crash, and is thus perfect. More
> seriously, I don't really have a way to benchmark it directly, so my
> observations are only indirect:
>
> On a TX2 system, I run a 4 vcpu VM with an Ethernet interface passed
> to it directly. From the host, I inject interrupts using debugfs. In
> parallel, I look at the number of context switch, and the number of
> interrupts on the host. Without this series, I get the same number for
> both IRQ and CS (about half a million of each per second is pretty
> easy to reach). With this series, the number of context switches drops
> to something pretty small (in the low 2k), while the number of
> interrupts stays the same.
>
> Yes, this is a pretty rubbish benchmark, what did you expect? ;-)
>
> Andre did run some benchmarks of his own, with some rather positive
> results[2]. So I'm putting this out for people with real workloads to
> try out and report what they see.
>
> [1] https://lore.kernel.org/lkml/1552833373-19828-1-git-send-email-yuzenghui@huawei.com/
> [2] https://www.spinics.net/lists/arm-kernel/msg742655.html
>
> * From v2:
>
> - Added invalidation on turning the ITS off
> - Added invalidation on MAPC with V=0
> - Added Rb's from Eric
>
> * From v1:
>
> - Fixed race on allocation, where the same LPI could be cached multiple times
> - Now invalidate the cache on vgic teardown, avoiding memory leaks
> - Change patch split slightly, general reshuffling
> - Small cleanups here and there
> - Rebased on 5.2-rc4
>
> Marc Zyngier (10):
> KVM: arm/arm64: vgic: Add LPI translation cache definition
> KVM: arm/arm64: vgic: Add __vgic_put_lpi_locked primitive
> KVM: arm/arm64: vgic-its: Add MSI-LPI translation cache invalidation
> KVM: arm/arm64: vgic-its: Invalidate MSI-LPI translation cache on
> specific commands
> KVM: arm/arm64: vgic-its: Invalidate MSI-LPI translation cache on
> disabling LPIs
> KVM: arm/arm64: vgic-its: Invalidate MSI-LPI translation cache on ITS
> disable
> KVM: arm/arm64: vgic-its: Invalidate MSI-LPI translation cache on vgic
> teardown
> KVM: arm/arm64: vgic-its: Cache successful MSI->LPI translation
> KVM: arm/arm64: vgic-its: Check the LPI translation cache on MSI
> injection
> KVM: arm/arm64: vgic-irqfd: Implement kvm_arch_set_irq_inatomic
>
> include/kvm/arm_vgic.h | 3 +
> virt/kvm/arm/vgic/vgic-init.c | 5 +
> virt/kvm/arm/vgic/vgic-irqfd.c | 36 +++++-
> virt/kvm/arm/vgic/vgic-its.c | 207 +++++++++++++++++++++++++++++++
> virt/kvm/arm/vgic/vgic-mmio-v3.c | 4 +-
> virt/kvm/arm/vgic/vgic.c | 26 ++--
> virt/kvm/arm/vgic/vgic.h | 5 +
> 7 files changed, 270 insertions(+), 16 deletions(-)
>
FWIW, I've now queued this for 5.4, with Eric's RBs and Andre's TBs.
Thanks,
M.
--
Without deviation from the norm, progress is not possible.
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply
* Re: [PATCH] KVM: arm/arm64: vgic: Make function comments match function declarations
From: Marc Zyngier @ 2019-08-18 17:44 UTC (permalink / raw)
To: Alexandru Elisei
Cc: kvm, suzuki.poulose, andre.przywara, eric.auger, julien.grall,
james.morse, linux-arm-kernel, kvmarm, julien.thierry.kdev
In-Reply-To: <1565862982-9787-1-git-send-email-alexandru.elisei@arm.com>
On Thu, 15 Aug 2019 10:56:22 +0100
Alexandru Elisei <alexandru.elisei@arm.com> wrote:
> Since commit 503a62862e8f ("KVM: arm/arm64: vgic: Rely on the GIC driver to
> parse the firmware tables"), the vgic_v{2,3}_probe functions stopped using
> a DT node. Commit 909777324588 ("KVM: arm/arm64: vgic-new: vgic_init:
> implement kvm_vgic_hyp_init") changed the functions again, and now they
> require exactly one argument, a struct gic_kvm_info populated by the GIC
> driver. Unfortunately the comments regressed and state that a DT node is
> used instead. Change the function comments to reflect the current
> prototypes.
>
> Signed-off-by: Alexandru Elisei <alexandru.elisei@arm.com>
> ---
> virt/kvm/arm/vgic/vgic-v2.c | 7 ++++---
> virt/kvm/arm/vgic/vgic-v3.c | 7 ++++---
> 2 files changed, 8 insertions(+), 6 deletions(-)
>
> diff --git a/virt/kvm/arm/vgic/vgic-v2.c b/virt/kvm/arm/vgic/vgic-v2.c
> index 96aab77d0471..27b1ddf71aa0 100644
> --- a/virt/kvm/arm/vgic/vgic-v2.c
> +++ b/virt/kvm/arm/vgic/vgic-v2.c
> @@ -354,10 +354,11 @@ int vgic_v2_map_resources(struct kvm *kvm)
> DEFINE_STATIC_KEY_FALSE(vgic_v2_cpuif_trap);
>
> /**
> - * vgic_v2_probe - probe for a GICv2 compatible interrupt controller in DT
> - * @node: pointer to the DT node
> + * vgic_v2_probe - probe for a VGICv2 compatible interrupt controller
> + * @info: pointer to the GIC description
> *
> - * Returns 0 if a GICv2 has been found, returns an error code otherwise
> + * Returns 0 if the VGICv2 has been probed successfully, returns an error code
> + * otherwise
> */
> int vgic_v2_probe(const struct gic_kvm_info *info)
> {
> diff --git a/virt/kvm/arm/vgic/vgic-v3.c b/virt/kvm/arm/vgic/vgic-v3.c
> index 0c653a1e5215..4874f3266bea 100644
> --- a/virt/kvm/arm/vgic/vgic-v3.c
> +++ b/virt/kvm/arm/vgic/vgic-v3.c
> @@ -570,10 +570,11 @@ static int __init early_gicv4_enable(char *buf)
> early_param("kvm-arm.vgic_v4_enable", early_gicv4_enable);
>
> /**
> - * vgic_v3_probe - probe for a GICv3 compatible interrupt controller in DT
> - * @node: pointer to the DT node
> + * vgic_v3_probe - probe for a VGICv3 compatible interrupt controller
> + * @info: pointer to the GIC description
> *
> - * Returns 0 if a GICv3 has been found, returns an error code otherwise
> + * Returns 0 if the VGICv3 has been probed successfully, returns an error code
> + * otherwise
> */
> int vgic_v3_probe(const struct gic_kvm_info *info)
> {
Queued, thanks.
M.
--
Without deviation from the norm, progress is not possible.
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply
* Re: [PATCH] arm64/kvm: remove VMID rollover I-cache maintenance
From: Marc Zyngier @ 2019-08-18 17:42 UTC (permalink / raw)
To: James Morse
Cc: Mark Rutland, Suzuki K Poulose, Christoffer Dall,
linux-arm-kernel, kvmarm, Julien Thierry
In-Reply-To: <1dca0489-9e85-cb8f-b846-b6da65f41773@arm.com>
On Fri, 16 Aug 2019 14:39:31 +0100
James Morse <james.morse@arm.com> wrote:
> Hi Mark,
>
> On 06/08/2019 16:57, Mark Rutland wrote:
> > For VPIPT I-caches, we need I-cache maintenance on VMID rollover to
> > avoid an ABA problem. Consider a single vCPU VM, with a pinned stage-2,
> > running with an idmap VA->IPA and idmap IPA->PA. If we don't do
> > maintenance on rollover:
> >
> > // VMID A
> > Writes insn X to PA 0xF
> > Invalidates PA 0xF (for VMID A)
> >
> > I$ contains [{A,F}->X]
> >
> > [VMID ROLLOVER]
> >
> > // VMID B
> > Writes insn Y to PA 0xF
> > Invalidates PA 0xF (for VMID B)
> >
> > I$ contains [{A,F}->X, {B,F}->Y]
> >
> > [VMID ROLLOVER]
> >
> > // VMID A
> > I$ contains [{A,F}->X, {B,F}->Y]
> >
> > Unexpectedly hits stale I$ line {A,F}->X.
> >
> > However, for PIPT and VIPT I-caches, the VMID doesn't affect lookup or
> > constrain maintenance. Given the VMID doesn't affect PIPT and VIPT
> > I-caches, and given VMID rollover is independent of changes to stage-2
> > mappings, I-cache maintenance cannot be necessary on VMID rollover for
> > PIPT or VIPT I-caches.
> >
> > This patch removes the maintenance on rollover for VIPT and PIPT
> > I-caches. At the same time, the unnecessary colons are removed from the
> > asm statement to make it more legible.
>
> Makes sense!
>
> Reviewed-by: James Morse <james.morse@arm.com>
Queued for 5.4. Thanks both.
M.
--
Without deviation from the norm, progress is not possible.
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply
* [PATCH] MAINTAINERS: Extend patterns for Samsung SoC, Security Subsystem and clock drivers
From: Krzysztof Kozlowski @ 2019-08-18 17:27 UTC (permalink / raw)
To: Kukjin Kim, Krzysztof Kozlowski, Vladimir Zapolskiy,
Kamil Konieczny, Herbert Xu, David S. Miller, Sylwester Nawrocki,
Tomasz Figa, Chanwoo Choi, Michael Turquette, Stephen Boyd,
linux-arm-kernel, linux-samsung-soc, linux-kernel, linux-crypto,
linux-clk
Extend the patterns to cover all related files in respective
categories:
1. Samsung Exynos ARM architecture: add soc drivers headers and make
directory matches consistent,
2. Samsung Security SubSystem driver (crypto): add bindings,
3. Samsung SoC clock drivers: add S3C24xx, S3C64xx and S5Pv210 bindings.
Cc: Kukjin Kim <kgene@kernel.org>
Cc: Vladimir Zapolskiy <vz@mleia.com>
Cc: Kamil Konieczny <k.konieczny@partner.samsung.com>
Cc: Sylwester Nawrocki <s.nawrocki@samsung.com>
Cc: Tomasz Figa <tomasz.figa@gmail.com>
Cc: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
---
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-samsung-soc@vger.kernel.org
Cc: linux-crypto@vger.kernel.org
Cc: linux-clk@vger.kernel.org
---
MAINTAINERS | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/MAINTAINERS b/MAINTAINERS
index 420567d1519a..35a4002ac58b 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -2199,8 +2199,9 @@ F: drivers/*/*s3c24*
F: drivers/*/*/*s3c24*
F: drivers/*/*s3c64xx*
F: drivers/*/*s5pv210*
-F: drivers/memory/samsung/*
-F: drivers/soc/samsung/*
+F: drivers/memory/samsung/
+F: drivers/soc/samsung/
+F: include/linux/soc/samsung/
F: Documentation/arm/samsung/
F: Documentation/devicetree/bindings/arm/samsung/
F: Documentation/devicetree/bindings/sram/samsung-sram.txt
@@ -14174,6 +14175,8 @@ M: Kamil Konieczny <k.konieczny@partner.samsung.com>
L: linux-crypto@vger.kernel.org
L: linux-samsung-soc@vger.kernel.org
S: Maintained
+F: Documentation/devicetree/bindings/crypto/samsung-slimsss.txt
+F: Documentation/devicetree/bindings/crypto/samsung-sss.txt
F: drivers/crypto/s5p-sss.c
SAMSUNG S5P/EXYNOS4 SOC SERIES CAMERA SUBSYSTEM DRIVERS
@@ -14194,6 +14197,8 @@ T: git git://git.kernel.org/pub/scm/linux/kernel/git/snawrocki/clk.git
F: drivers/clk/samsung/
F: include/dt-bindings/clock/exynos*.h
F: Documentation/devicetree/bindings/clock/exynos*.txt
+F: Documentation/devicetree/bindings/clock/samsung,s3c*
+F: Documentation/devicetree/bindings/clock/samsung,s5p*
SAMSUNG SPI DRIVERS
M: Kukjin Kim <kgene@kernel.org>
--
2.17.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related
* [PATCH v6 13/13] arm: dts: mt6323: add keys, power-controller, rtc and codec
From: Frank Wunderlich @ 2019-08-18 16:07 UTC (permalink / raw)
To: linux-arm-kernel; +Cc: Josef Friedl, Frank Wunderlich
In-Reply-To: <20190818160757.8206-1-frank-w@public-files.de>
From: Josef Friedl <josef.friedl@speed.at>
support poweroff and power-related keys on bpi-r2
Suggested-by: Frank Wunderlich <frank-w@public-files.de>
Signed-off-by: Josef Friedl <josef.friedl@speed.at>
Signed-off-by: Frank Wunderlich <frank-w@public-files.de>
---
changes since v5: none
changes since v4: none
changes since v3: none
changes since v2: none (=v2 part 7)
---
arch/arm/boot/dts/mt6323.dtsi | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)
diff --git a/arch/arm/boot/dts/mt6323.dtsi b/arch/arm/boot/dts/mt6323.dtsi
index ba397407c1dd..7fda40ab5fe8 100644
--- a/arch/arm/boot/dts/mt6323.dtsi
+++ b/arch/arm/boot/dts/mt6323.dtsi
@@ -238,5 +238,32 @@
regulator-enable-ramp-delay = <216>;
};
};
+
+ mt6323keys: mt6323keys {
+ compatible = "mediatek,mt6323-keys";
+ mediatek,long-press-mode = <1>;
+ power-off-time-sec = <0>;
+
+ power {
+ linux,keycodes = <116>;
+ wakeup-source;
+ };
+
+ home {
+ linux,keycodes = <114>;
+ };
+ };
+
+ codec: mt6397codec {
+ compatible = "mediatek,mt6397-codec";
+ };
+
+ power-controller {
+ compatible = "mediatek,mt6323-pwrc";
+ };
+
+ rtc {
+ compatible = "mediatek,mt6323-rtc";
+ };
};
};
--
2.17.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related
* [PATCH v6 12/13] MAINTAINERS: add Mediatek shutdown drivers
From: Frank Wunderlich @ 2019-08-18 16:07 UTC (permalink / raw)
To: linux-arm-kernel; +Cc: Josef Friedl, Frank Wunderlich
In-Reply-To: <20190818160757.8206-1-frank-w@public-files.de>
From: Josef Friedl <josef.friedl@speed.at>
add Section in MAINTAINERS file for poweroff driver
Signed-off-by: Josef Friedl <josef.friedl@speed.at>
Signed-off-by: Frank Wunderlich <frank-w@public-files.de>
---
changes since v5: none
changes since v4: none
changes since v3: moved SOB
changes since v2: none (=v2 part 6)
---
MAINTAINERS | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/MAINTAINERS b/MAINTAINERS
index 6426db5198f0..4172a3177633 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -10128,6 +10128,13 @@ S: Maintained
F: drivers/net/dsa/mt7530.*
F: net/dsa/tag_mtk.c
+MEDIATEK BOARD LEVEL SHUTDOWN DRIVERS
+M: Sean Wang <sean.wang@mediatek.com>
+L: linux-pm@vger.kernel.org
+S: Maintained
+F: Documentation/devicetree/bindings/power/reset/mt6323-poweroff.txt
+F: drivers/power/reset/mt6323-poweroff.c
+
MEDIATEK JPEG DRIVER
M: Rick Chang <rick.chang@mediatek.com>
M: Bin Liu <bin.liu@mediatek.com>
--
2.17.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related
* [PATCH v6 11/13] power: reset: add driver for mt6323 poweroff
From: Frank Wunderlich @ 2019-08-18 16:07 UTC (permalink / raw)
To: linux-arm-kernel; +Cc: Josef Friedl, Frank Wunderlich
In-Reply-To: <20190818160757.8206-1-frank-w@public-files.de>
From: Josef Friedl <josef.friedl@speed.at>
add poweroff driver for mt6323 and make Makefile and Kconfig-Entries
Suggested-by: Frank Wunderlich <frank-w@public-files.de>
Signed-off-by: Josef Friedl <josef.friedl@speed.at>
Signed-off-by: Frank Wunderlich <frank-w@public-files.de>
---
changes since v5: split out mfd/mt6397/core.h
changes since v4: none
changes since v3: none
changes since v2: none (=v2 part 5)
---
drivers/power/reset/Kconfig | 10 +++
drivers/power/reset/Makefile | 1 +
drivers/power/reset/mt6323-poweroff.c | 97 +++++++++++++++++++++++++++
3 files changed, 108 insertions(+)
create mode 100644 drivers/power/reset/mt6323-poweroff.c
diff --git a/drivers/power/reset/Kconfig b/drivers/power/reset/Kconfig
index a564237278ff..c721939767eb 100644
--- a/drivers/power/reset/Kconfig
+++ b/drivers/power/reset/Kconfig
@@ -140,6 +140,16 @@ config POWER_RESET_LTC2952
This driver supports an external powerdown trigger and board power
down via the LTC2952. Bindings are made in the device tree.
+config POWER_RESET_MT6323
+ bool "MediaTek MT6323 power-off driver"
+ depends on MFD_MT6397
+ help
+ The power-off driver is responsible for externally shutdown down
+ the power of a remote MediaTek SoC MT6323 is connected to through
+ controlling a tiny circuit BBPU inside MT6323 RTC.
+
+ Say Y if you have a board where MT6323 could be found.
+
config POWER_RESET_QNAP
bool "QNAP power-off driver"
depends on OF_GPIO && PLAT_ORION
diff --git a/drivers/power/reset/Makefile b/drivers/power/reset/Makefile
index 85da3198e4e0..da37f8b851dc 100644
--- a/drivers/power/reset/Makefile
+++ b/drivers/power/reset/Makefile
@@ -11,6 +11,7 @@ obj-$(CONFIG_POWER_RESET_GPIO) += gpio-poweroff.o
obj-$(CONFIG_POWER_RESET_GPIO_RESTART) += gpio-restart.o
obj-$(CONFIG_POWER_RESET_HISI) += hisi-reboot.o
obj-$(CONFIG_POWER_RESET_MSM) += msm-poweroff.o
+obj-$(CONFIG_POWER_RESET_MT6323) += mt6323-poweroff.o
obj-$(CONFIG_POWER_RESET_QCOM_PON) += qcom-pon.o
obj-$(CONFIG_POWER_RESET_OCELOT_RESET) += ocelot-reset.o
obj-$(CONFIG_POWER_RESET_PIIX4_POWEROFF) += piix4-poweroff.o
diff --git a/drivers/power/reset/mt6323-poweroff.c b/drivers/power/reset/mt6323-poweroff.c
new file mode 100644
index 000000000000..1caf43d9e46d
--- /dev/null
+++ b/drivers/power/reset/mt6323-poweroff.c
@@ -0,0 +1,97 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Power off through MediaTek PMIC
+ *
+ * Copyright (C) 2018 MediaTek Inc.
+ *
+ * Author: Sean Wang <sean.wang@mediatek.com>
+ *
+ */
+
+#include <linux/err.h>
+#include <linux/module.h>
+#include <linux/of.h>
+#include <linux/platform_device.h>
+#include <linux/mfd/mt6397/core.h>
+#include <linux/mfd/mt6397/rtc.h>
+
+struct mt6323_pwrc {
+ struct device *dev;
+ struct regmap *regmap;
+ u32 base;
+};
+
+static struct mt6323_pwrc *mt_pwrc;
+
+static void mt6323_do_pwroff(void)
+{
+ struct mt6323_pwrc *pwrc = mt_pwrc;
+ unsigned int val;
+ int ret;
+
+ regmap_write(pwrc->regmap, pwrc->base + RTC_BBPU, RTC_BBPU_KEY);
+ regmap_write(pwrc->regmap, pwrc->base + RTC_WRTGR, 1);
+
+ ret = regmap_read_poll_timeout(pwrc->regmap,
+ pwrc->base + RTC_BBPU, val,
+ !(val & RTC_BBPU_CBUSY),
+ MTK_RTC_POLL_DELAY_US,
+ MTK_RTC_POLL_TIMEOUT);
+ if (ret)
+ dev_err(pwrc->dev, "failed to write BBPU: %d\n", ret);
+
+ /* Wait some time until system down, otherwise, notice with a warn */
+ mdelay(1000);
+
+ WARN_ONCE(1, "Unable to power off system\n");
+}
+
+static int mt6323_pwrc_probe(struct platform_device *pdev)
+{
+ struct mt6397_chip *mt6397_chip = dev_get_drvdata(pdev->dev.parent);
+ struct mt6323_pwrc *pwrc;
+ struct resource *res;
+
+ pwrc = devm_kzalloc(&pdev->dev, sizeof(*pwrc), GFP_KERNEL);
+ if (!pwrc)
+ return -ENOMEM;
+
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+ pwrc->base = res->start;
+ pwrc->regmap = mt6397_chip->regmap;
+ pwrc->dev = &pdev->dev;
+ mt_pwrc = pwrc;
+
+ pm_power_off = &mt6323_do_pwroff;
+
+ return 0;
+}
+
+static int mt6323_pwrc_remove(struct platform_device *pdev)
+{
+ if (pm_power_off == &mt6323_do_pwroff)
+ pm_power_off = NULL;
+
+ return 0;
+}
+
+static const struct of_device_id mt6323_pwrc_dt_match[] = {
+ { .compatible = "mediatek,mt6323-pwrc" },
+ {},
+};
+MODULE_DEVICE_TABLE(of, mt6323_pwrc_dt_match);
+
+static struct platform_driver mt6323_pwrc_driver = {
+ .probe = mt6323_pwrc_probe,
+ .remove = mt6323_pwrc_remove,
+ .driver = {
+ .name = "mt6323-pwrc",
+ .of_match_table = mt6323_pwrc_dt_match,
+ },
+};
+
+module_platform_driver(mt6323_pwrc_driver);
+
+MODULE_DESCRIPTION("Poweroff driver for MT6323 PMIC");
+MODULE_AUTHOR("Sean Wang <sean.wang@mediatek.com>");
+MODULE_LICENSE("GPL v2");
--
2.17.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related
* [PATCH v6 07/13] rtc: mt6397: improvements of rtc driver
From: Frank Wunderlich @ 2019-08-18 16:07 UTC (permalink / raw)
To: linux-arm-kernel; +Cc: Josef Friedl, Frank Wunderlich
In-Reply-To: <20190818160757.8206-1-frank-w@public-files.de>
From: Josef Friedl <josef.friedl@speed.at>
- use regmap_read_poll_timeout to drop while-loop
- use devm-api to drop remove-callback
Suggested-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Josef Friedl <josef.friedl@speed.at>
Signed-off-by: Frank Wunderlich <frank-w@public-files.de>
---
changes since v5: none
changes since v4: none
changes since v3: none
changes since v2:
- fix allocation after irq-request
- compatible for mt6323 in separate commit => part 5
---
drivers/rtc/rtc-mt6397.c | 51 +++++++++++++++-------------------------
1 file changed, 19 insertions(+), 32 deletions(-)
diff --git a/drivers/rtc/rtc-mt6397.c b/drivers/rtc/rtc-mt6397.c
index c08ee5edf865..9370b7fc9f81 100644
--- a/drivers/rtc/rtc-mt6397.c
+++ b/drivers/rtc/rtc-mt6397.c
@@ -4,16 +4,19 @@
* Author: Tianping.Fang <tianping.fang@mediatek.com>
*/
-#include <linux/delay.h>
-#include <linux/init.h>
+#include <linux/err.h>
+#include <linux/interrupt.h>
+#include <linux/mfd/mt6397/core.h>
#include <linux/module.h>
+#include <linux/mutex.h>
+#include <linux/platform_device.h>
#include <linux/regmap.h>
#include <linux/rtc.h>
#include <linux/mfd/mt6397/rtc.h>
+#include <linux/mod_devicetable.h>
static int mtk_rtc_write_trigger(struct mt6397_rtc *rtc)
{
- unsigned long timeout = jiffies + HZ;
int ret;
u32 data;
@@ -21,19 +24,13 @@ static int mtk_rtc_write_trigger(struct mt6397_rtc *rtc)
if (ret < 0)
return ret;
- while (1) {
- ret = regmap_read(rtc->regmap, rtc->addr_base + RTC_BBPU,
- &data);
- if (ret < 0)
- break;
- if (!(data & RTC_BBPU_CBUSY))
- break;
- if (time_after(jiffies, timeout)) {
- ret = -ETIMEDOUT;
- break;
- }
- cpu_relax();
- }
+ ret = regmap_read_poll_timeout(rtc->regmap,
+ rtc->addr_base + RTC_BBPU, data,
+ !(data & RTC_BBPU_CBUSY),
+ MTK_RTC_POLL_DELAY_US,
+ MTK_RTC_POLL_TIMEOUT);
+ if (ret < 0)
+ dev_err(rtc->dev, "failed to write WRTGE: %d\n", ret);
return ret;
}
@@ -266,19 +263,19 @@ static int mtk_rtc_probe(struct platform_device *pdev)
return rtc->irq;
rtc->regmap = mt6397_chip->regmap;
- rtc->dev = &pdev->dev;
mutex_init(&rtc->lock);
platform_set_drvdata(pdev, rtc);
- rtc->rtc_dev = devm_rtc_allocate_device(rtc->dev);
+ rtc->rtc_dev = devm_rtc_allocate_device(&pdev->dev);
if (IS_ERR(rtc->rtc_dev))
return PTR_ERR(rtc->rtc_dev);
- ret = request_threaded_irq(rtc->irq, NULL,
- mtk_rtc_irq_handler_thread,
- IRQF_ONESHOT | IRQF_TRIGGER_HIGH,
- "mt6397-rtc", rtc);
+ ret = devm_request_threaded_irq(&pdev->dev, rtc->irq, NULL,
+ mtk_rtc_irq_handler_thread,
+ IRQF_ONESHOT | IRQF_TRIGGER_HIGH,
+ "mt6397-rtc", rtc);
+
if (ret) {
dev_err(&pdev->dev, "Failed to request alarm IRQ: %d: %d\n",
rtc->irq, ret);
@@ -302,15 +299,6 @@ static int mtk_rtc_probe(struct platform_device *pdev)
return ret;
}
-static int mtk_rtc_remove(struct platform_device *pdev)
-{
- struct mt6397_rtc *rtc = platform_get_drvdata(pdev);
-
- free_irq(rtc->irq, rtc);
-
- return 0;
-}
-
#ifdef CONFIG_PM_SLEEP
static int mt6397_rtc_suspend(struct device *dev)
{
@@ -349,7 +337,6 @@ static struct platform_driver mtk_rtc_driver = {
.pm = &mt6397_pm_ops,
},
.probe = mtk_rtc_probe,
- .remove = mtk_rtc_remove,
};
module_platform_driver(mtk_rtc_driver);
--
2.17.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related
* [PATCH v6 08/13] mfd: mt6323: some improvements of mt6397-core
From: Frank Wunderlich @ 2019-08-18 16:07 UTC (permalink / raw)
To: linux-arm-kernel; +Cc: Josef Friedl, Frank Wunderlich
In-Reply-To: <20190818160757.8206-1-frank-w@public-files.de>
From: Josef Friedl <josef.friedl@speed.at>
simplyfications (resource definitions my DEFINE_RES_* macros)
Signed-off-by: Josef Friedl <josef.friedl@speed.at>
Signed-off-by: Frank Wunderlich <frank-w@public-files.de>
Acked-for-MFD-by: Lee Jones <lee.jones@linaro.org>
---
changes since v5: none
changes since v4: do not touch year of copyright
changes since v3: moved part 6 forward to let compatible and driver be together
changes since v2: splitted v2 part 4 into 6+7
---
drivers/mfd/mt6397-core.c | 13 +++----------
1 file changed, 3 insertions(+), 10 deletions(-)
diff --git a/drivers/mfd/mt6397-core.c b/drivers/mfd/mt6397-core.c
index 337bcccdb914..c9a81087fa55 100644
--- a/drivers/mfd/mt6397-core.c
+++ b/drivers/mfd/mt6397-core.c
@@ -5,6 +5,7 @@
*/
#include <linux/interrupt.h>
+#include <linux/ioport.h>
#include <linux/module.h>
#include <linux/of_device.h>
#include <linux/of_irq.h>
@@ -23,16 +24,8 @@
#define MT6397_CID_CODE 0x97
static const struct resource mt6397_rtc_resources[] = {
- {
- .start = MT6397_RTC_BASE,
- .end = MT6397_RTC_BASE + MT6397_RTC_SIZE,
- .flags = IORESOURCE_MEM,
- },
- {
- .start = MT6397_IRQ_RTC,
- .end = MT6397_IRQ_RTC,
- .flags = IORESOURCE_IRQ,
- },
+ DEFINE_RES_MEM(MT6397_RTC_BASE, MT6397_RTC_SIZE),
+ DEFINE_RES_IRQ(MT6397_IRQ_RTC),
};
static const struct resource mt6323_keys_resources[] = {
--
2.17.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related
* [PATCH v6 10/13] mfd: mt6323: add mt6323 rtc+pwrc
From: Frank Wunderlich @ 2019-08-18 16:07 UTC (permalink / raw)
To: linux-arm-kernel; +Cc: Josef Friedl, Frank Wunderlich
In-Reply-To: <20190818160757.8206-1-frank-w@public-files.de>
From: Josef Friedl <josef.friedl@speed.at>
add entry for rtc and power-controller to mt6323
Signed-off-by: Josef Friedl <josef.friedl@speed.at>
Signed-off-by: Frank Wunderlich <frank-w@public-files.de>
Acked-for-MFD-by: Lee Jones <lee.jones@linaro.org>
---
changes since v5: none
changes since v4: none
changes since v3: none
changes since v2: only splitting, second part of v2 part 4
---
drivers/mfd/mt6397-core.c | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
diff --git a/drivers/mfd/mt6397-core.c b/drivers/mfd/mt6397-core.c
index c9a81087fa55..5916978a8feb 100644
--- a/drivers/mfd/mt6397-core.c
+++ b/drivers/mfd/mt6397-core.c
@@ -16,13 +16,24 @@
#include <linux/mfd/mt6397/registers.h>
#include <linux/mfd/mt6323/registers.h>
+#define MT6323_RTC_BASE 0x8000
+#define MT6323_RTC_SIZE 0x40
+
#define MT6397_RTC_BASE 0xe000
#define MT6397_RTC_SIZE 0x3e
+#define MT6323_PWRC_BASE 0x8000
+#define MT6323_PWRC_SIZE 0x40
+
#define MT6323_CID_CODE 0x23
#define MT6391_CID_CODE 0x91
#define MT6397_CID_CODE 0x97
+static const struct resource mt6323_rtc_resources[] = {
+ DEFINE_RES_MEM(MT6323_RTC_BASE, MT6323_RTC_SIZE),
+ DEFINE_RES_IRQ(MT6323_IRQ_STATUS_RTC),
+};
+
static const struct resource mt6397_rtc_resources[] = {
DEFINE_RES_MEM(MT6397_RTC_BASE, MT6397_RTC_SIZE),
DEFINE_RES_IRQ(MT6397_IRQ_RTC),
@@ -38,8 +49,17 @@ static const struct resource mt6397_keys_resources[] = {
DEFINE_RES_IRQ(MT6397_IRQ_HOMEKEY),
};
+static const struct resource mt6323_pwrc_resources[] = {
+ DEFINE_RES_MEM(MT6323_PWRC_BASE, MT6323_PWRC_SIZE),
+};
+
static const struct mfd_cell mt6323_devs[] = {
{
+ .name = "mt6323-rtc",
+ .num_resources = ARRAY_SIZE(mt6323_rtc_resources),
+ .resources = mt6323_rtc_resources,
+ .of_compatible = "mediatek,mt6323-rtc",
+ }, {
.name = "mt6323-regulator",
.of_compatible = "mediatek,mt6323-regulator"
}, {
@@ -50,6 +70,11 @@ static const struct mfd_cell mt6323_devs[] = {
.num_resources = ARRAY_SIZE(mt6323_keys_resources),
.resources = mt6323_keys_resources,
.of_compatible = "mediatek,mt6323-keys"
+ }, {
+ .name = "mt6323-pwrc",
+ .num_resources = ARRAY_SIZE(mt6323_pwrc_resources),
+ .resources = mt6323_pwrc_resources,
+ .of_compatible = "mediatek,mt6323-pwrc"
},
};
--
2.17.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox