* [PATCH] mfd: qcom_rpm: parametrize also ack selector size
@ 2016-06-22 6:27 Linus Walleij
2016-06-22 16:09 ` Bjorn Andersson
2016-06-28 15:35 ` Lee Jones
0 siblings, 2 replies; 3+ messages in thread
From: Linus Walleij @ 2016-06-22 6:27 UTC (permalink / raw)
To: lee.jones, linux-kernel, Bjorn Andersson, Stephen Boyd
Cc: Neil Armstrong, Linus Walleij, stable
The RPM has two sets of selectors (IPC bit fields): request and
acknowledge. Apparently, some models use 4*32 bit words for select
and some use 7*32 bit words for request, but all use 7*32 words
for acknowledge bits.
So apparently you can on the models with requests of 4*32 select
bits send 4*32 messages and get 7*32 different replies, so on ACK
interrupt, 7*32 bit words need to be read. This is how the vendor
code apparently works.
Cc: stable@vger.kernel.org
Cc: Stephen Boyd <sboyd@codeaurora.org>
Cc: Björn Andersson <bjorn.andersson@linaro.org>
Reported-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
Lee: this patch goes on top of the previous patch I sent:
"mfd: qcom_rpm: fix offset error for msm8660"
You can also squash them, if you prefer.
---
drivers/mfd/qcom_rpm.c | 19 ++++++++++++-------
1 file changed, 12 insertions(+), 7 deletions(-)
diff --git a/drivers/mfd/qcom_rpm.c b/drivers/mfd/qcom_rpm.c
index 9364f88264e5..880d4699bcb0 100644
--- a/drivers/mfd/qcom_rpm.c
+++ b/drivers/mfd/qcom_rpm.c
@@ -39,7 +39,8 @@ struct qcom_rpm_data {
unsigned int req_sel_off;
unsigned int ack_ctx_off;
unsigned int ack_sel_off;
- unsigned int sel_size;
+ unsigned int req_sel_size;
+ unsigned int ack_sel_size;
};
struct qcom_rpm {
@@ -162,7 +163,8 @@ static const struct qcom_rpm_data apq8064_template = {
.req_sel_off = 11,
.ack_ctx_off = 15,
.ack_sel_off = 23,
- .sel_size = 4,
+ .req_sel_size = 4,
+ .ack_sel_size = 7,
};
static const struct qcom_rpm_resource msm8660_rpm_resource_table[] = {
@@ -250,7 +252,8 @@ static const struct qcom_rpm_data msm8660_template = {
.req_sel_off = 11,
.ack_ctx_off = 19,
.ack_sel_off = 27,
- .sel_size = 7,
+ .req_sel_size = 7,
+ .ack_sel_size = 7,
};
static const struct qcom_rpm_resource msm8960_rpm_resource_table[] = {
@@ -337,7 +340,8 @@ static const struct qcom_rpm_data msm8960_template = {
.req_sel_off = 11,
.ack_ctx_off = 15,
.ack_sel_off = 23,
- .sel_size = 4,
+ .req_sel_size = 4,
+ .ack_sel_size = 7,
};
static const struct qcom_rpm_resource ipq806x_rpm_resource_table[] = {
@@ -382,7 +386,8 @@ static const struct qcom_rpm_data ipq806x_template = {
.req_sel_off = 11,
.ack_ctx_off = 15,
.ack_sel_off = 23,
- .sel_size = 4,
+ .req_sel_size = 4,
+ .ack_sel_size = 7,
};
static const struct of_device_id qcom_rpm_of_match[] = {
@@ -419,7 +424,7 @@ int qcom_rpm_write(struct qcom_rpm *rpm,
writel_relaxed(buf[i], RPM_REQ_REG(rpm, res->target_id + i));
bitmap_set((unsigned long *)sel_mask, res->select_id, 1);
- for (i = 0; i < rpm->data->sel_size; i++) {
+ for (i = 0; i < rpm->data->req_sel_size; i++) {
writel_relaxed(sel_mask[i],
RPM_CTRL_REG(rpm, rpm->data->req_sel_off + i));
}
@@ -448,7 +453,7 @@ static irqreturn_t qcom_rpm_ack_interrupt(int irq, void *dev)
int i;
ack = readl_relaxed(RPM_CTRL_REG(rpm, rpm->data->ack_ctx_off));
- for (i = 0; i < rpm->data->sel_size; i++)
+ for (i = 0; i < rpm->data->ack_sel_size; i++)
writel_relaxed(0,
RPM_CTRL_REG(rpm, rpm->data->ack_sel_off + i));
writel(0, RPM_CTRL_REG(rpm, rpm->data->ack_ctx_off));
--
2.4.11
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] mfd: qcom_rpm: parametrize also ack selector size
2016-06-22 6:27 [PATCH] mfd: qcom_rpm: parametrize also ack selector size Linus Walleij
@ 2016-06-22 16:09 ` Bjorn Andersson
2016-06-28 15:35 ` Lee Jones
1 sibling, 0 replies; 3+ messages in thread
From: Bjorn Andersson @ 2016-06-22 16:09 UTC (permalink / raw)
To: Linus Walleij
Cc: lee.jones, linux-kernel, Stephen Boyd, Neil Armstrong, stable
On Tue 21 Jun 23:27 PDT 2016, Linus Walleij wrote:
> The RPM has two sets of selectors (IPC bit fields): request and
> acknowledge. Apparently, some models use 4*32 bit words for select
> and some use 7*32 bit words for request, but all use 7*32 words
> for acknowledge bits.
>
> So apparently you can on the models with requests of 4*32 select
> bits send 4*32 messages and get 7*32 different replies, so on ACK
> interrupt, 7*32 bit words need to be read. This is how the vendor
> code apparently works.
>
> Cc: stable@vger.kernel.org
> Cc: Stephen Boyd <sboyd@codeaurora.org>
> Cc: Björn Andersson <bjorn.andersson@linaro.org>
I would have expected a define, but I was wrong about these things being
static in the first place, so...
Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Regards,
Bjorn
> Reported-by: Stephen Boyd <sboyd@codeaurora.org>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> ---
> Lee: this patch goes on top of the previous patch I sent:
> "mfd: qcom_rpm: fix offset error for msm8660"
> You can also squash them, if you prefer.
> ---
> drivers/mfd/qcom_rpm.c | 19 ++++++++++++-------
> 1 file changed, 12 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/mfd/qcom_rpm.c b/drivers/mfd/qcom_rpm.c
> index 9364f88264e5..880d4699bcb0 100644
> --- a/drivers/mfd/qcom_rpm.c
> +++ b/drivers/mfd/qcom_rpm.c
> @@ -39,7 +39,8 @@ struct qcom_rpm_data {
> unsigned int req_sel_off;
> unsigned int ack_ctx_off;
> unsigned int ack_sel_off;
> - unsigned int sel_size;
> + unsigned int req_sel_size;
> + unsigned int ack_sel_size;
> };
>
> struct qcom_rpm {
> @@ -162,7 +163,8 @@ static const struct qcom_rpm_data apq8064_template = {
> .req_sel_off = 11,
> .ack_ctx_off = 15,
> .ack_sel_off = 23,
> - .sel_size = 4,
> + .req_sel_size = 4,
> + .ack_sel_size = 7,
> };
>
> static const struct qcom_rpm_resource msm8660_rpm_resource_table[] = {
> @@ -250,7 +252,8 @@ static const struct qcom_rpm_data msm8660_template = {
> .req_sel_off = 11,
> .ack_ctx_off = 19,
> .ack_sel_off = 27,
> - .sel_size = 7,
> + .req_sel_size = 7,
> + .ack_sel_size = 7,
> };
>
> static const struct qcom_rpm_resource msm8960_rpm_resource_table[] = {
> @@ -337,7 +340,8 @@ static const struct qcom_rpm_data msm8960_template = {
> .req_sel_off = 11,
> .ack_ctx_off = 15,
> .ack_sel_off = 23,
> - .sel_size = 4,
> + .req_sel_size = 4,
> + .ack_sel_size = 7,
> };
>
> static const struct qcom_rpm_resource ipq806x_rpm_resource_table[] = {
> @@ -382,7 +386,8 @@ static const struct qcom_rpm_data ipq806x_template = {
> .req_sel_off = 11,
> .ack_ctx_off = 15,
> .ack_sel_off = 23,
> - .sel_size = 4,
> + .req_sel_size = 4,
> + .ack_sel_size = 7,
> };
>
> static const struct of_device_id qcom_rpm_of_match[] = {
> @@ -419,7 +424,7 @@ int qcom_rpm_write(struct qcom_rpm *rpm,
> writel_relaxed(buf[i], RPM_REQ_REG(rpm, res->target_id + i));
>
> bitmap_set((unsigned long *)sel_mask, res->select_id, 1);
> - for (i = 0; i < rpm->data->sel_size; i++) {
> + for (i = 0; i < rpm->data->req_sel_size; i++) {
> writel_relaxed(sel_mask[i],
> RPM_CTRL_REG(rpm, rpm->data->req_sel_off + i));
> }
> @@ -448,7 +453,7 @@ static irqreturn_t qcom_rpm_ack_interrupt(int irq, void *dev)
> int i;
>
> ack = readl_relaxed(RPM_CTRL_REG(rpm, rpm->data->ack_ctx_off));
> - for (i = 0; i < rpm->data->sel_size; i++)
> + for (i = 0; i < rpm->data->ack_sel_size; i++)
> writel_relaxed(0,
> RPM_CTRL_REG(rpm, rpm->data->ack_sel_off + i));
> writel(0, RPM_CTRL_REG(rpm, rpm->data->ack_ctx_off));
> --
> 2.4.11
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] mfd: qcom_rpm: parametrize also ack selector size
2016-06-22 6:27 [PATCH] mfd: qcom_rpm: parametrize also ack selector size Linus Walleij
2016-06-22 16:09 ` Bjorn Andersson
@ 2016-06-28 15:35 ` Lee Jones
1 sibling, 0 replies; 3+ messages in thread
From: Lee Jones @ 2016-06-28 15:35 UTC (permalink / raw)
To: Linus Walleij
Cc: linux-kernel, Bjorn Andersson, Stephen Boyd, Neil Armstrong,
stable
On Wed, 22 Jun 2016, Linus Walleij wrote:
> The RPM has two sets of selectors (IPC bit fields): request and
> acknowledge. Apparently, some models use 4*32 bit words for select
> and some use 7*32 bit words for request, but all use 7*32 words
> for acknowledge bits.
>
> So apparently you can on the models with requests of 4*32 select
> bits send 4*32 messages and get 7*32 different replies, so on ACK
> interrupt, 7*32 bit words need to be read. This is how the vendor
> code apparently works.
>
> Cc: stable@vger.kernel.org
> Cc: Stephen Boyd <sboyd@codeaurora.org>
> Cc: Björn Andersson <bjorn.andersson@linaro.org>
> Reported-by: Stephen Boyd <sboyd@codeaurora.org>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> ---
> Lee: this patch goes on top of the previous patch I sent:
> "mfd: qcom_rpm: fix offset error for msm8660"
> You can also squash them, if you prefer.
> ---
> drivers/mfd/qcom_rpm.c | 19 ++++++++++++-------
> 1 file changed, 12 insertions(+), 7 deletions(-)
Applied, thanks.
> diff --git a/drivers/mfd/qcom_rpm.c b/drivers/mfd/qcom_rpm.c
> index 9364f88264e5..880d4699bcb0 100644
> --- a/drivers/mfd/qcom_rpm.c
> +++ b/drivers/mfd/qcom_rpm.c
> @@ -39,7 +39,8 @@ struct qcom_rpm_data {
> unsigned int req_sel_off;
> unsigned int ack_ctx_off;
> unsigned int ack_sel_off;
> - unsigned int sel_size;
> + unsigned int req_sel_size;
> + unsigned int ack_sel_size;
> };
>
> struct qcom_rpm {
> @@ -162,7 +163,8 @@ static const struct qcom_rpm_data apq8064_template = {
> .req_sel_off = 11,
> .ack_ctx_off = 15,
> .ack_sel_off = 23,
> - .sel_size = 4,
> + .req_sel_size = 4,
> + .ack_sel_size = 7,
> };
>
> static const struct qcom_rpm_resource msm8660_rpm_resource_table[] = {
> @@ -250,7 +252,8 @@ static const struct qcom_rpm_data msm8660_template = {
> .req_sel_off = 11,
> .ack_ctx_off = 19,
> .ack_sel_off = 27,
> - .sel_size = 7,
> + .req_sel_size = 7,
> + .ack_sel_size = 7,
> };
>
> static const struct qcom_rpm_resource msm8960_rpm_resource_table[] = {
> @@ -337,7 +340,8 @@ static const struct qcom_rpm_data msm8960_template = {
> .req_sel_off = 11,
> .ack_ctx_off = 15,
> .ack_sel_off = 23,
> - .sel_size = 4,
> + .req_sel_size = 4,
> + .ack_sel_size = 7,
> };
>
> static const struct qcom_rpm_resource ipq806x_rpm_resource_table[] = {
> @@ -382,7 +386,8 @@ static const struct qcom_rpm_data ipq806x_template = {
> .req_sel_off = 11,
> .ack_ctx_off = 15,
> .ack_sel_off = 23,
> - .sel_size = 4,
> + .req_sel_size = 4,
> + .ack_sel_size = 7,
> };
>
> static const struct of_device_id qcom_rpm_of_match[] = {
> @@ -419,7 +424,7 @@ int qcom_rpm_write(struct qcom_rpm *rpm,
> writel_relaxed(buf[i], RPM_REQ_REG(rpm, res->target_id + i));
>
> bitmap_set((unsigned long *)sel_mask, res->select_id, 1);
> - for (i = 0; i < rpm->data->sel_size; i++) {
> + for (i = 0; i < rpm->data->req_sel_size; i++) {
> writel_relaxed(sel_mask[i],
> RPM_CTRL_REG(rpm, rpm->data->req_sel_off + i));
> }
> @@ -448,7 +453,7 @@ static irqreturn_t qcom_rpm_ack_interrupt(int irq, void *dev)
> int i;
>
> ack = readl_relaxed(RPM_CTRL_REG(rpm, rpm->data->ack_ctx_off));
> - for (i = 0; i < rpm->data->sel_size; i++)
> + for (i = 0; i < rpm->data->ack_sel_size; i++)
> writel_relaxed(0,
> RPM_CTRL_REG(rpm, rpm->data->ack_sel_off + i));
> writel(0, RPM_CTRL_REG(rpm, rpm->data->ack_ctx_off));
--
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-06-28 15:34 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-22 6:27 [PATCH] mfd: qcom_rpm: parametrize also ack selector size Linus Walleij
2016-06-22 16:09 ` Bjorn Andersson
2016-06-28 15:35 ` Lee Jones
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).