* [BACKPORT 4.4.y 01/25] mmc: pwrseq: constify mmc_pwrseq_ops structures
2019-03-22 15:43 [BACKPORT 4.4.y 00/25] candidates from spreadtrum 4.4 product kernel Arnd Bergmann
@ 2019-03-22 15:43 ` Arnd Bergmann
2019-03-26 1:08 ` Greg KH
2019-03-22 15:43 ` [BACKPORT 4.4.y 03/25] mmc: pwrseq_simple: Make reset-gpios optional to match doc Arnd Bergmann
` (7 subsequent siblings)
8 siblings, 1 reply; 15+ messages in thread
From: Arnd Bergmann @ 2019-03-22 15:43 UTC (permalink / raw)
To: stable, Ulf Hansson, Janusz Krzysztofik, Linus Walleij,
Tobin C. Harding, Geert Uytterhoeven
Cc: Julia Lawall, Arnd Bergmann, linux-mmc, linux-kernel
From: Julia Lawall <Julia.Lawall@lip6.fr>
The mmc_pwrseq_ops structures are never modified, so declare them as const.
Done with the help of Coccinelle.
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
(cherry picked from commit ffedbd2210f2f4cba490a9205adc11fd1b89a852)
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
drivers/mmc/core/pwrseq.h | 2 +-
drivers/mmc/core/pwrseq_emmc.c | 2 +-
drivers/mmc/core/pwrseq_simple.c | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/mmc/core/pwrseq.h b/drivers/mmc/core/pwrseq.h
index 096da48c6a7e..133de0426687 100644
--- a/drivers/mmc/core/pwrseq.h
+++ b/drivers/mmc/core/pwrseq.h
@@ -16,7 +16,7 @@ struct mmc_pwrseq_ops {
};
struct mmc_pwrseq {
- struct mmc_pwrseq_ops *ops;
+ const struct mmc_pwrseq_ops *ops;
};
#ifdef CONFIG_OF
diff --git a/drivers/mmc/core/pwrseq_emmc.c b/drivers/mmc/core/pwrseq_emmc.c
index ad4f94ec7e8d..4a82bc77fe49 100644
--- a/drivers/mmc/core/pwrseq_emmc.c
+++ b/drivers/mmc/core/pwrseq_emmc.c
@@ -51,7 +51,7 @@ static void mmc_pwrseq_emmc_free(struct mmc_host *host)
kfree(pwrseq);
}
-static struct mmc_pwrseq_ops mmc_pwrseq_emmc_ops = {
+static const struct mmc_pwrseq_ops mmc_pwrseq_emmc_ops = {
.post_power_on = mmc_pwrseq_emmc_reset,
.free = mmc_pwrseq_emmc_free,
};
diff --git a/drivers/mmc/core/pwrseq_simple.c b/drivers/mmc/core/pwrseq_simple.c
index d10538bb5e07..2b16263458af 100644
--- a/drivers/mmc/core/pwrseq_simple.c
+++ b/drivers/mmc/core/pwrseq_simple.c
@@ -87,7 +87,7 @@ static void mmc_pwrseq_simple_free(struct mmc_host *host)
kfree(pwrseq);
}
-static struct mmc_pwrseq_ops mmc_pwrseq_simple_ops = {
+static const struct mmc_pwrseq_ops mmc_pwrseq_simple_ops = {
.pre_power_on = mmc_pwrseq_simple_pre_power_on,
.post_power_on = mmc_pwrseq_simple_post_power_on,
.power_off = mmc_pwrseq_simple_power_off,
--
2.20.0
^ permalink raw reply related [flat|nested] 15+ messages in thread* Re: [BACKPORT 4.4.y 01/25] mmc: pwrseq: constify mmc_pwrseq_ops structures
2019-03-22 15:43 ` [BACKPORT 4.4.y 01/25] mmc: pwrseq: constify mmc_pwrseq_ops structures Arnd Bergmann
@ 2019-03-26 1:08 ` Greg KH
2019-03-26 6:44 ` Julia Lawall
2019-03-26 8:11 ` Arnd Bergmann
0 siblings, 2 replies; 15+ messages in thread
From: Greg KH @ 2019-03-26 1:08 UTC (permalink / raw)
To: Arnd Bergmann
Cc: stable, Ulf Hansson, Janusz Krzysztofik, Linus Walleij,
Tobin C. Harding, Geert Uytterhoeven, Julia Lawall, linux-mmc,
linux-kernel
On Fri, Mar 22, 2019 at 04:43:52PM +0100, Arnd Bergmann wrote:
> From: Julia Lawall <Julia.Lawall@lip6.fr>
>
> The mmc_pwrseq_ops structures are never modified, so declare them as const.
>
> Done with the help of Coccinelle.
>
> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
> (cherry picked from commit ffedbd2210f2f4cba490a9205adc11fd1b89a852)
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
> drivers/mmc/core/pwrseq.h | 2 +-
> drivers/mmc/core/pwrseq_emmc.c | 2 +-
> drivers/mmc/core/pwrseq_simple.c | 2 +-
> 3 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/mmc/core/pwrseq.h b/drivers/mmc/core/pwrseq.h
> index 096da48c6a7e..133de0426687 100644
> --- a/drivers/mmc/core/pwrseq.h
> +++ b/drivers/mmc/core/pwrseq.h
> @@ -16,7 +16,7 @@ struct mmc_pwrseq_ops {
> };
>
> struct mmc_pwrseq {
> - struct mmc_pwrseq_ops *ops;
> + const struct mmc_pwrseq_ops *ops;
> };
>
> #ifdef CONFIG_OF
> diff --git a/drivers/mmc/core/pwrseq_emmc.c b/drivers/mmc/core/pwrseq_emmc.c
> index ad4f94ec7e8d..4a82bc77fe49 100644
> --- a/drivers/mmc/core/pwrseq_emmc.c
> +++ b/drivers/mmc/core/pwrseq_emmc.c
> @@ -51,7 +51,7 @@ static void mmc_pwrseq_emmc_free(struct mmc_host *host)
> kfree(pwrseq);
> }
>
> -static struct mmc_pwrseq_ops mmc_pwrseq_emmc_ops = {
> +static const struct mmc_pwrseq_ops mmc_pwrseq_emmc_ops = {
> .post_power_on = mmc_pwrseq_emmc_reset,
> .free = mmc_pwrseq_emmc_free,
> };
> diff --git a/drivers/mmc/core/pwrseq_simple.c b/drivers/mmc/core/pwrseq_simple.c
> index d10538bb5e07..2b16263458af 100644
> --- a/drivers/mmc/core/pwrseq_simple.c
> +++ b/drivers/mmc/core/pwrseq_simple.c
> @@ -87,7 +87,7 @@ static void mmc_pwrseq_simple_free(struct mmc_host *host)
> kfree(pwrseq);
> }
>
> -static struct mmc_pwrseq_ops mmc_pwrseq_simple_ops = {
> +static const struct mmc_pwrseq_ops mmc_pwrseq_simple_ops = {
> .pre_power_on = mmc_pwrseq_simple_pre_power_on,
> .post_power_on = mmc_pwrseq_simple_post_power_on,
> .power_off = mmc_pwrseq_simple_power_off,
Why is this needed for a stable patch? It doesn't fix a bug, it just
looks like it is a "nice thing" to have, right? I don't think any later
patch in this series relies it it, or am I missing something?
thanks,
greg k-h
^ permalink raw reply [flat|nested] 15+ messages in thread* Re: [BACKPORT 4.4.y 01/25] mmc: pwrseq: constify mmc_pwrseq_ops structures
2019-03-26 1:08 ` Greg KH
@ 2019-03-26 6:44 ` Julia Lawall
2019-03-26 8:11 ` Arnd Bergmann
1 sibling, 0 replies; 15+ messages in thread
From: Julia Lawall @ 2019-03-26 6:44 UTC (permalink / raw)
To: Greg KH
Cc: Arnd Bergmann, stable, Ulf Hansson, Janusz Krzysztofik,
Linus Walleij, Tobin C. Harding, Geert Uytterhoeven, linux-mmc,
linux-kernel
On Tue, 26 Mar 2019, Greg KH wrote:
> On Fri, Mar 22, 2019 at 04:43:52PM +0100, Arnd Bergmann wrote:
> > From: Julia Lawall <Julia.Lawall@lip6.fr>
> >
> > The mmc_pwrseq_ops structures are never modified, so declare them as const.
> >
> > Done with the help of Coccinelle.
> >
> > Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
> > Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
> > (cherry picked from commit ffedbd2210f2f4cba490a9205adc11fd1b89a852)
> > Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> > ---
> > drivers/mmc/core/pwrseq.h | 2 +-
> > drivers/mmc/core/pwrseq_emmc.c | 2 +-
> > drivers/mmc/core/pwrseq_simple.c | 2 +-
> > 3 files changed, 3 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/mmc/core/pwrseq.h b/drivers/mmc/core/pwrseq.h
> > index 096da48c6a7e..133de0426687 100644
> > --- a/drivers/mmc/core/pwrseq.h
> > +++ b/drivers/mmc/core/pwrseq.h
> > @@ -16,7 +16,7 @@ struct mmc_pwrseq_ops {
> > };
> >
> > struct mmc_pwrseq {
> > - struct mmc_pwrseq_ops *ops;
> > + const struct mmc_pwrseq_ops *ops;
> > };
> >
> > #ifdef CONFIG_OF
> > diff --git a/drivers/mmc/core/pwrseq_emmc.c b/drivers/mmc/core/pwrseq_emmc.c
> > index ad4f94ec7e8d..4a82bc77fe49 100644
> > --- a/drivers/mmc/core/pwrseq_emmc.c
> > +++ b/drivers/mmc/core/pwrseq_emmc.c
> > @@ -51,7 +51,7 @@ static void mmc_pwrseq_emmc_free(struct mmc_host *host)
> > kfree(pwrseq);
> > }
> >
> > -static struct mmc_pwrseq_ops mmc_pwrseq_emmc_ops = {
> > +static const struct mmc_pwrseq_ops mmc_pwrseq_emmc_ops = {
> > .post_power_on = mmc_pwrseq_emmc_reset,
> > .free = mmc_pwrseq_emmc_free,
> > };
> > diff --git a/drivers/mmc/core/pwrseq_simple.c b/drivers/mmc/core/pwrseq_simple.c
> > index d10538bb5e07..2b16263458af 100644
> > --- a/drivers/mmc/core/pwrseq_simple.c
> > +++ b/drivers/mmc/core/pwrseq_simple.c
> > @@ -87,7 +87,7 @@ static void mmc_pwrseq_simple_free(struct mmc_host *host)
> > kfree(pwrseq);
> > }
> >
> > -static struct mmc_pwrseq_ops mmc_pwrseq_simple_ops = {
> > +static const struct mmc_pwrseq_ops mmc_pwrseq_simple_ops = {
> > .pre_power_on = mmc_pwrseq_simple_pre_power_on,
> > .post_power_on = mmc_pwrseq_simple_post_power_on,
> > .power_off = mmc_pwrseq_simple_power_off,
>
> Why is this needed for a stable patch? It doesn't fix a bug, it just
> looks like it is a "nice thing" to have, right? I don't think any later
> patch in this series relies it it, or am I missing something?
Fine with me.
julia
^ permalink raw reply [flat|nested] 15+ messages in thread* Re: [BACKPORT 4.4.y 01/25] mmc: pwrseq: constify mmc_pwrseq_ops structures
2019-03-26 1:08 ` Greg KH
2019-03-26 6:44 ` Julia Lawall
@ 2019-03-26 8:11 ` Arnd Bergmann
1 sibling, 0 replies; 15+ messages in thread
From: Arnd Bergmann @ 2019-03-26 8:11 UTC (permalink / raw)
To: Greg KH
Cc: # 3.4.x, Ulf Hansson, Janusz Krzysztofik, Linus Walleij,
Tobin C. Harding, Geert Uytterhoeven, Julia Lawall, linux-mmc,
Linux Kernel Mailing List
On Tue, Mar 26, 2019 at 2:22 AM Greg KH <gregkh@linuxfoundation.org> wrote:
> On Fri, Mar 22, 2019 at 04:43:52PM +0100, Arnd Bergmann wrote:
> > }
> >
> > -static struct mmc_pwrseq_ops mmc_pwrseq_simple_ops = {
> > +static const struct mmc_pwrseq_ops mmc_pwrseq_simple_ops = {
> > .pre_power_on = mmc_pwrseq_simple_pre_power_on,
> > .post_power_on = mmc_pwrseq_simple_post_power_on,
> > .power_off = mmc_pwrseq_simple_power_off,
>
> Why is this needed for a stable patch? It doesn't fix a bug, it just
> looks like it is a "nice thing" to have, right? I don't think any later
> patch in this series relies it it, or am I missing something?
Right, the benefit here is rather small. In theory, any structure of
function pointers is a place into which an exploit can be placed
in case someone finds a way to modify a few bytes of kernel
memory. Placing the structures in read-only memory make this
a little harder (it doesn't prevent rowhammer attacks though).
Dropping this patch is certainly fine with me, as we have a large
supply of other structure definitions like this, and we wont' get close to
plugging enough of them in stable kernels.
Arnd
^ permalink raw reply [flat|nested] 15+ messages in thread
* [BACKPORT 4.4.y 03/25] mmc: pwrseq_simple: Make reset-gpios optional to match doc
2019-03-22 15:43 [BACKPORT 4.4.y 00/25] candidates from spreadtrum 4.4 product kernel Arnd Bergmann
2019-03-22 15:43 ` [BACKPORT 4.4.y 01/25] mmc: pwrseq: constify mmc_pwrseq_ops structures Arnd Bergmann
@ 2019-03-22 15:43 ` Arnd Bergmann
2019-03-22 15:43 ` [BACKPORT 4.4.y 05/25] mmc: debugfs: Add a restriction to mmc debugfs clock setting Arnd Bergmann
` (6 subsequent siblings)
8 siblings, 0 replies; 15+ messages in thread
From: Arnd Bergmann @ 2019-03-22 15:43 UTC (permalink / raw)
To: stable, Ulf Hansson, Janusz Krzysztofik, Linus Walleij,
Geert Uytterhoeven, Tobin C. Harding
Cc: Martin Fuzzey, Tony Lindgren, Arnd Bergmann, linux-mmc,
linux-kernel
From: Martin Fuzzey <mfuzzey@parkeon.com>
The DT binding doc says reset-gpios is an optional property but the code
currently bails out if it is omitted.
This is a regression since it breaks previously working device trees.
Fix it by restoring the original documented behaviour.
Fixes: ce037275861e ("mmc: pwrseq_simple: use GPIO descriptors array API")
Tested-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Martin Fuzzey <mfuzzey@parkeon.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
(cherry picked from commit 64a67d4762ce3ce4c9466eadd152d825fbf84967)
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
drivers/mmc/core/pwrseq_simple.c | 22 ++++++++++++++--------
1 file changed, 14 insertions(+), 8 deletions(-)
diff --git a/drivers/mmc/core/pwrseq_simple.c b/drivers/mmc/core/pwrseq_simple.c
index 2b16263458af..aba786daebca 100644
--- a/drivers/mmc/core/pwrseq_simple.c
+++ b/drivers/mmc/core/pwrseq_simple.c
@@ -29,15 +29,18 @@ struct mmc_pwrseq_simple {
static void mmc_pwrseq_simple_set_gpios_value(struct mmc_pwrseq_simple *pwrseq,
int value)
{
- int i;
struct gpio_descs *reset_gpios = pwrseq->reset_gpios;
- int values[reset_gpios->ndescs];
- for (i = 0; i < reset_gpios->ndescs; i++)
- values[i] = value;
+ if (!IS_ERR(reset_gpios)) {
+ int i;
+ int values[reset_gpios->ndescs];
- gpiod_set_array_value_cansleep(reset_gpios->ndescs, reset_gpios->desc,
- values);
+ for (i = 0; i < reset_gpios->ndescs; i++)
+ values[i] = value;
+
+ gpiod_set_array_value_cansleep(
+ reset_gpios->ndescs, reset_gpios->desc, values);
+ }
}
static void mmc_pwrseq_simple_pre_power_on(struct mmc_host *host)
@@ -79,7 +82,8 @@ static void mmc_pwrseq_simple_free(struct mmc_host *host)
struct mmc_pwrseq_simple *pwrseq = container_of(host->pwrseq,
struct mmc_pwrseq_simple, pwrseq);
- gpiod_put_array(pwrseq->reset_gpios);
+ if (!IS_ERR(pwrseq->reset_gpios))
+ gpiod_put_array(pwrseq->reset_gpios);
if (!IS_ERR(pwrseq->ext_clk))
clk_put(pwrseq->ext_clk);
@@ -112,7 +116,9 @@ struct mmc_pwrseq *mmc_pwrseq_simple_alloc(struct mmc_host *host,
}
pwrseq->reset_gpios = gpiod_get_array(dev, "reset", GPIOD_OUT_HIGH);
- if (IS_ERR(pwrseq->reset_gpios)) {
+ if (IS_ERR(pwrseq->reset_gpios) &&
+ PTR_ERR(pwrseq->reset_gpios) != -ENOENT &&
+ PTR_ERR(pwrseq->reset_gpios) != -ENOSYS) {
ret = PTR_ERR(pwrseq->reset_gpios);
goto clk_put;
}
--
2.20.0
^ permalink raw reply related [flat|nested] 15+ messages in thread* [BACKPORT 4.4.y 05/25] mmc: debugfs: Add a restriction to mmc debugfs clock setting
2019-03-22 15:43 [BACKPORT 4.4.y 00/25] candidates from spreadtrum 4.4 product kernel Arnd Bergmann
2019-03-22 15:43 ` [BACKPORT 4.4.y 01/25] mmc: pwrseq: constify mmc_pwrseq_ops structures Arnd Bergmann
2019-03-22 15:43 ` [BACKPORT 4.4.y 03/25] mmc: pwrseq_simple: Make reset-gpios optional to match doc Arnd Bergmann
@ 2019-03-22 15:43 ` Arnd Bergmann
2019-03-22 15:43 ` [BACKPORT 4.4.y 06/25] mmc: make MAN_BKOPS_EN message a debug Arnd Bergmann
` (5 subsequent siblings)
8 siblings, 0 replies; 15+ messages in thread
From: Arnd Bergmann @ 2019-03-22 15:43 UTC (permalink / raw)
To: stable, Ulf Hansson
Cc: Chuanxiao Dong, Yuan Juntao, Pawel Wodkowski, Arnd Bergmann,
linux-mmc, linux-kernel
From: Chuanxiao Dong <chuanxiao.dong@intel.com>
Clock frequency values written to an mmc host should not be less than
the minimum clock frequency which the mmc host supports.
Signed-off-by: Yuan Juntao <juntaox.yuan@intel.com>
Signed-off-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
(cherry picked from commit e5905ff1281f0a0f5c9863c430ac1ed5faaf5707)
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
drivers/mmc/core/debugfs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/mmc/core/debugfs.c b/drivers/mmc/core/debugfs.c
index 154aced0b91b..705586dcd9fa 100644
--- a/drivers/mmc/core/debugfs.c
+++ b/drivers/mmc/core/debugfs.c
@@ -220,7 +220,7 @@ static int mmc_clock_opt_set(void *data, u64 val)
struct mmc_host *host = data;
/* We need this check due to input value is u64 */
- if (val > host->f_max)
+ if (val != 0 && (val > host->f_max || val < host->f_min))
return -EINVAL;
mmc_claim_host(host);
--
2.20.0
^ permalink raw reply related [flat|nested] 15+ messages in thread* [BACKPORT 4.4.y 06/25] mmc: make MAN_BKOPS_EN message a debug
2019-03-22 15:43 [BACKPORT 4.4.y 00/25] candidates from spreadtrum 4.4 product kernel Arnd Bergmann
` (2 preceding siblings ...)
2019-03-22 15:43 ` [BACKPORT 4.4.y 05/25] mmc: debugfs: Add a restriction to mmc debugfs clock setting Arnd Bergmann
@ 2019-03-22 15:43 ` Arnd Bergmann
2019-03-22 15:43 ` [BACKPORT 4.4.y 07/25] mmc: sanitize 'bus width' in debug output Arnd Bergmann
` (4 subsequent siblings)
8 siblings, 0 replies; 15+ messages in thread
From: Arnd Bergmann @ 2019-03-22 15:43 UTC (permalink / raw)
To: stable, Ulf Hansson, hongjiefang, Simon Horman, Jennifer Dahm,
Yinbo Zhu, Avri Altman, Kyle Roeschley
Cc: Wolfram Sang, Arnd Bergmann, linux-mmc, linux-kernel
From: Wolfram Sang <wsa+renesas@sang-engineering.com>
IMO this info is only useful for developers. Most users won't need this
information, since there is not much they can do about it.
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
(cherry picked from commit 4ec96b4cbde8d5714a4477b5a2562c3dd40bc5fa)
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
drivers/mmc/core/mmc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
index a31789be0840..adc3291e9d6a 100644
--- a/drivers/mmc/core/mmc.c
+++ b/drivers/mmc/core/mmc.c
@@ -508,7 +508,7 @@ static int mmc_decode_ext_csd(struct mmc_card *card, u8 *ext_csd)
card->ext_csd.raw_bkops_status =
ext_csd[EXT_CSD_BKOPS_STATUS];
if (!card->ext_csd.man_bkops_en)
- pr_info("%s: MAN_BKOPS_EN bit is not set\n",
+ pr_debug("%s: MAN_BKOPS_EN bit is not set\n",
mmc_hostname(card->host));
}
--
2.20.0
^ permalink raw reply related [flat|nested] 15+ messages in thread* [BACKPORT 4.4.y 07/25] mmc: sanitize 'bus width' in debug output
2019-03-22 15:43 [BACKPORT 4.4.y 00/25] candidates from spreadtrum 4.4 product kernel Arnd Bergmann
` (3 preceding siblings ...)
2019-03-22 15:43 ` [BACKPORT 4.4.y 06/25] mmc: make MAN_BKOPS_EN message a debug Arnd Bergmann
@ 2019-03-22 15:43 ` Arnd Bergmann
2019-03-22 15:43 ` [BACKPORT 4.4.y 08/25] mmc: core: shut up "voltage-ranges unspecified" pr_info() Arnd Bergmann
` (3 subsequent siblings)
8 siblings, 0 replies; 15+ messages in thread
From: Arnd Bergmann @ 2019-03-22 15:43 UTC (permalink / raw)
To: stable, Ulf Hansson, Avri Altman, Shawn Lin, Martin Hicks,
Niklas Söderlund, Wolfram Sang, Ritesh Harjani, Simon Horman,
hongjiefang, Yinbo Zhu, Kyle Roeschley
Cc: Arnd Bergmann, Jiong Wu, linux-mmc, linux-kernel
From: Wolfram Sang <wsa+renesas@sang-engineering.com>
The bus width is sometimes the actual bus width, and sometimes indices
to different arrays encoding the bus width. In my debugging case "2"
could mean 8-bit as well as 4-bit, which was extremly confusing. Let's
use the human-readable actual bus width in all places.
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
(cherry picked from commit ed9feec72fc1fa194ebfdb79e14561b35decce63)
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
drivers/mmc/core/core.c | 2 +-
drivers/mmc/core/mmc.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index 299a83f1ad38..e2e927d1f7e4 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -1039,7 +1039,7 @@ static inline void mmc_set_ios(struct mmc_host *host)
"width %u timing %u\n",
mmc_hostname(host), ios->clock, ios->bus_mode,
ios->power_mode, ios->chip_select, ios->vdd,
- ios->bus_width, ios->timing);
+ 1 << ios->bus_width, ios->timing);
host->ops->set_ios(host, ios);
}
diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
index adc3291e9d6a..7286d0d324e1 100644
--- a/drivers/mmc/core/mmc.c
+++ b/drivers/mmc/core/mmc.c
@@ -952,7 +952,7 @@ static int mmc_select_bus_width(struct mmc_card *card)
break;
} else {
pr_warn("%s: switch to bus width %d failed\n",
- mmc_hostname(host), ext_csd_bits[idx]);
+ mmc_hostname(host), 1 << bus_width);
}
}
--
2.20.0
^ permalink raw reply related [flat|nested] 15+ messages in thread* [BACKPORT 4.4.y 08/25] mmc: core: shut up "voltage-ranges unspecified" pr_info()
2019-03-22 15:43 [BACKPORT 4.4.y 00/25] candidates from spreadtrum 4.4 product kernel Arnd Bergmann
` (4 preceding siblings ...)
2019-03-22 15:43 ` [BACKPORT 4.4.y 07/25] mmc: sanitize 'bus width' in debug output Arnd Bergmann
@ 2019-03-22 15:43 ` Arnd Bergmann
2019-03-22 15:44 ` [BACKPORT 4.4.y 11/25] mmc: core: fix using wrong io voltage if mmc_select_hs200 fails Arnd Bergmann
` (2 subsequent siblings)
8 siblings, 0 replies; 15+ messages in thread
From: Arnd Bergmann @ 2019-03-22 15:43 UTC (permalink / raw)
To: stable, Ulf Hansson, Avri Altman, Shawn Lin
Cc: Russell King, Arnd Bergmann, Ritesh Harjani,
Niklas Söderlund, Jiong Wu, Martin Hicks, linux-mmc,
linux-kernel
From: Russell King <rmk+kernel@arm.linux.org.uk>
Each time a driver such as sdhci-esdhc-imx is probed, we get a info
printk complaining that the DT voltage-ranges property has not been
specified.
However, the DT binding specifically says that the voltage-ranges
property is optional. That means we should not be complaining that
DT hasn't specified this property: by indicating that it's optional,
it is valid not to have the property in DT.
Silence the warning if the property is missing.
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
(cherry picked from commit 10a16a01d8f72e80f4780e40cf3122f4caffa411)
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
drivers/mmc/core/core.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index e2e927d1f7e4..df074f8c7cb7 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -1220,8 +1220,12 @@ int mmc_of_parse_voltage(struct device_node *np, u32 *mask)
voltage_ranges = of_get_property(np, "voltage-ranges", &num_ranges);
num_ranges = num_ranges / sizeof(*voltage_ranges) / 2;
- if (!voltage_ranges || !num_ranges) {
- pr_info("%s: voltage-ranges unspecified\n", np->full_name);
+ if (!voltage_ranges) {
+ pr_debug("%s: voltage-ranges unspecified\n", np->full_name);
+ return -EINVAL;
+ }
+ if (!num_ranges) {
+ pr_err("%s: voltage-ranges empty\n", np->full_name);
return -EINVAL;
}
--
2.20.0
^ permalink raw reply related [flat|nested] 15+ messages in thread* [BACKPORT 4.4.y 11/25] mmc: core: fix using wrong io voltage if mmc_select_hs200 fails
2019-03-22 15:43 [BACKPORT 4.4.y 00/25] candidates from spreadtrum 4.4 product kernel Arnd Bergmann
` (5 preceding siblings ...)
2019-03-22 15:43 ` [BACKPORT 4.4.y 08/25] mmc: core: shut up "voltage-ranges unspecified" pr_info() Arnd Bergmann
@ 2019-03-22 15:44 ` Arnd Bergmann
2019-03-22 15:44 ` [BACKPORT 4.4.y 17/25] mmc: core: don't try to switch block size for dual rate mode Arnd Bergmann
2019-03-26 2:18 ` [BACKPORT 4.4.y 00/25] candidates from spreadtrum 4.4 product kernel Greg KH
8 siblings, 0 replies; 15+ messages in thread
From: Arnd Bergmann @ 2019-03-22 15:44 UTC (permalink / raw)
To: stable, Ulf Hansson, hongjiefang, Simon Horman, Kyle Roeschley,
Jennifer Dahm, Yinbo Zhu, Avri Altman
Cc: Dong Aisheng, Arnd Bergmann, Shawn Lin, linux-mmc, linux-kernel
From: Dong Aisheng <aisheng.dong@nxp.com>
Currently MMC core will keep going if HS200/HS timing switch failed
with -EBADMSG error by the assumption that the old timing is still valid.
However, for mmc_select_hs200 case, the signal voltage may have already
been switched. If the timing switch failed, we should fall back to
the old voltage in case the card is continue run with legacy timing.
If fall back signal voltage failed, we explicitly report an EIO error
to force retry during the next power cycle.
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
(cherry picked from commit e51534c806609c806d81bfb034f02737461f855c)
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
drivers/mmc/core/mmc.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
index 7286d0d324e1..7844baecf306 100644
--- a/drivers/mmc/core/mmc.c
+++ b/drivers/mmc/core/mmc.c
@@ -1251,10 +1251,11 @@ static int mmc_select_hs200(struct mmc_card *card)
{
struct mmc_host *host = card->host;
bool send_status = true;
- unsigned int old_timing;
+ unsigned int old_timing, old_signal_voltage;
int err = -EINVAL;
u8 val;
+ old_signal_voltage = host->ios.signal_voltage;
if (card->mmc_avail_type & EXT_CSD_CARD_TYPE_HS200_1_2V)
err = __mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_120);
@@ -1263,7 +1264,7 @@ static int mmc_select_hs200(struct mmc_card *card)
/* If fails try again during next card power cycle */
if (err)
- goto err;
+ return err;
mmc_select_driver_type(card);
@@ -1297,9 +1298,14 @@ static int mmc_select_hs200(struct mmc_card *card)
}
}
err:
- if (err)
+ if (err) {
+ /* fall back to the old signal voltage, if fails report error */
+ if (__mmc_set_signal_voltage(host, old_signal_voltage))
+ err = -EIO;
+
pr_err("%s: %s failed, error %d\n", mmc_hostname(card->host),
__func__, err);
+ }
return err;
}
--
2.20.0
^ permalink raw reply related [flat|nested] 15+ messages in thread* [BACKPORT 4.4.y 17/25] mmc: core: don't try to switch block size for dual rate mode
2019-03-22 15:43 [BACKPORT 4.4.y 00/25] candidates from spreadtrum 4.4 product kernel Arnd Bergmann
` (6 preceding siblings ...)
2019-03-22 15:44 ` [BACKPORT 4.4.y 11/25] mmc: core: fix using wrong io voltage if mmc_select_hs200 fails Arnd Bergmann
@ 2019-03-22 15:44 ` Arnd Bergmann
2019-03-26 1:27 ` Greg KH
2019-03-26 2:18 ` [BACKPORT 4.4.y 00/25] candidates from spreadtrum 4.4 product kernel Greg KH
8 siblings, 1 reply; 15+ messages in thread
From: Arnd Bergmann @ 2019-03-22 15:44 UTC (permalink / raw)
To: stable, Ulf Hansson, Shawn Lin, Avri Altman, Ritesh Harjani,
Jiong Wu, Martin Hicks
Cc: Ziyuan Xu, Arnd Bergmann, Wolfram Sang, linux-mmc, linux-kernel
From: Ziyuan Xu <xzy.xu@rock-chips.com>
Per spec, block size should always be 512 bytes for dual rate mode,
so any attempts to switch the block size under dual rate mode should
be neglected.
Signed-off-by: Ziyuan Xu <xzy.xu@rock-chips.com>
Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
(cherry picked from commit 1712c9373f98ae8ed41599a8d7841a6fba29c264)
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
drivers/mmc/core/core.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index df074f8c7cb7..3e17268b9994 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -2406,7 +2406,8 @@ int mmc_set_blocklen(struct mmc_card *card, unsigned int blocklen)
{
struct mmc_command cmd = {0};
- if (mmc_card_blockaddr(card) || mmc_card_ddr52(card))
+ if (mmc_card_blockaddr(card) || mmc_card_ddr52(card) ||
+ mmc_card_hs400(card) || mmc_card_hs400es(card))
return 0;
cmd.opcode = MMC_SET_BLOCKLEN;
--
2.20.0
^ permalink raw reply related [flat|nested] 15+ messages in thread* Re: [BACKPORT 4.4.y 17/25] mmc: core: don't try to switch block size for dual rate mode
2019-03-22 15:44 ` [BACKPORT 4.4.y 17/25] mmc: core: don't try to switch block size for dual rate mode Arnd Bergmann
@ 2019-03-26 1:27 ` Greg KH
2019-03-26 8:14 ` Arnd Bergmann
0 siblings, 1 reply; 15+ messages in thread
From: Greg KH @ 2019-03-26 1:27 UTC (permalink / raw)
To: Arnd Bergmann
Cc: stable, Ulf Hansson, Shawn Lin, Avri Altman, Ritesh Harjani,
Jiong Wu, Martin Hicks, Ziyuan Xu, Wolfram Sang, linux-mmc,
linux-kernel
On Fri, Mar 22, 2019 at 04:44:08PM +0100, Arnd Bergmann wrote:
> From: Ziyuan Xu <xzy.xu@rock-chips.com>
>
> Per spec, block size should always be 512 bytes for dual rate mode,
> so any attempts to switch the block size under dual rate mode should
> be neglected.
>
> Signed-off-by: Ziyuan Xu <xzy.xu@rock-chips.com>
> Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
> (cherry picked from commit 1712c9373f98ae8ed41599a8d7841a6fba29c264)
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
> drivers/mmc/core/core.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
> index df074f8c7cb7..3e17268b9994 100644
> --- a/drivers/mmc/core/core.c
> +++ b/drivers/mmc/core/core.c
> @@ -2406,7 +2406,8 @@ int mmc_set_blocklen(struct mmc_card *card, unsigned int blocklen)
> {
> struct mmc_command cmd = {0};
>
> - if (mmc_card_blockaddr(card) || mmc_card_ddr52(card))
> + if (mmc_card_blockaddr(card) || mmc_card_ddr52(card) ||
> + mmc_card_hs400(card) || mmc_card_hs400es(card))
This breaks the build, there is no mmc_card_hs400es() call in 4.4.y.
How did this build for you?
greg k-h
^ permalink raw reply [flat|nested] 15+ messages in thread* Re: [BACKPORT 4.4.y 17/25] mmc: core: don't try to switch block size for dual rate mode
2019-03-26 1:27 ` Greg KH
@ 2019-03-26 8:14 ` Arnd Bergmann
0 siblings, 0 replies; 15+ messages in thread
From: Arnd Bergmann @ 2019-03-26 8:14 UTC (permalink / raw)
To: Greg KH
Cc: # 3.4.x, Ulf Hansson, Shawn Lin, Avri Altman, Ritesh Harjani,
Jiong Wu, Martin Hicks, Ziyuan Xu, Wolfram Sang, linux-mmc,
Linux Kernel Mailing List
On Tue, Mar 26, 2019 at 2:27 AM Greg KH <gregkh@linuxfoundation.org> wrote:
>
> On Fri, Mar 22, 2019 at 04:44:08PM +0100, Arnd Bergmann wrote:
> > From: Ziyuan Xu <xzy.xu@rock-chips.com>
> >
> > Per spec, block size should always be 512 bytes for dual rate mode,
> > so any attempts to switch the block size under dual rate mode should
> > be neglected.
> >
> > Signed-off-by: Ziyuan Xu <xzy.xu@rock-chips.com>
> > Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
> > Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
> > (cherry picked from commit 1712c9373f98ae8ed41599a8d7841a6fba29c264)
> > Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> > ---
> > drivers/mmc/core/core.c | 3 ++-
> > 1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
> > index df074f8c7cb7..3e17268b9994 100644
> > --- a/drivers/mmc/core/core.c
> > +++ b/drivers/mmc/core/core.c
> > @@ -2406,7 +2406,8 @@ int mmc_set_blocklen(struct mmc_card *card, unsigned int blocklen)
> > {
> > struct mmc_command cmd = {0};
> >
> > - if (mmc_card_blockaddr(card) || mmc_card_ddr52(card))
> > + if (mmc_card_blockaddr(card) || mmc_card_ddr52(card) ||
> > + mmc_card_hs400(card) || mmc_card_hs400es(card))
>
> This breaks the build, there is no mmc_card_hs400es() call in 4.4.y.
>
> How did this build for you?
I had a larger set of backported patches and then dropped others
that did not look like stable material, but then did not rebuild again
afterwards. I'll make sure to do that next time.
Arnd
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [BACKPORT 4.4.y 00/25] candidates from spreadtrum 4.4 product kernel
2019-03-22 15:43 [BACKPORT 4.4.y 00/25] candidates from spreadtrum 4.4 product kernel Arnd Bergmann
` (7 preceding siblings ...)
2019-03-22 15:44 ` [BACKPORT 4.4.y 17/25] mmc: core: don't try to switch block size for dual rate mode Arnd Bergmann
@ 2019-03-26 2:18 ` Greg KH
8 siblings, 0 replies; 15+ messages in thread
From: Greg KH @ 2019-03-26 2:18 UTC (permalink / raw)
To: Arnd Bergmann
Cc: stable, linux-arm-kernel, linux-kernel, linux-mmc, linux-serial,
linux-usb, linux-fsdevel, netdev, linux-mm, dccp, alsa-devel
On Fri, Mar 22, 2019 at 04:43:51PM +0100, Arnd Bergmann wrote:
> I took a scripted approach to look at some product kernels for patches
> backported into vendor kernels. This is a set of (mostly) bugfixes I found
> in Spreadtrum's linux-4.4 kernel that are missing in 4.4.176:
>
> ffedbd2210f2 mmc: pwrseq: constify mmc_pwrseq_ops structures
> c10368897e10 ALSA: compress: add support for 32bit calls in a 64bit kernel
> 64a67d4762ce mmc: pwrseq_simple: Make reset-gpios optional to match doc
> 4ec0ef3a8212 USB: iowarrior: fix oops with malicious USB descriptors
> e5905ff1281f mmc: debugfs: Add a restriction to mmc debugfs clock setting
> 4ec96b4cbde8 mmc: make MAN_BKOPS_EN message a debug
> ed9feec72fc1 mmc: sanitize 'bus width' in debug output
> 10a16a01d8f7 mmc: core: shut up "voltage-ranges unspecified" pr_info()
> 9772b47a4c29 usb: dwc3: gadget: Fix suspend/resume during device mode
> 6afedcd23cfd arm64: mm: Add trace_irqflags annotations to do_debug_exception()
> 437db4c6e798 mmc: mmc: Attempt to flush cache before reset
> e51534c80660 mmc: core: fix using wrong io voltage if mmc_select_hs200 fails
> e4c5800a3991 mm/rmap: replace BUG_ON(anon_vma->degree) with VM_WARN_ON
> 04c080080855 extcon: usb-gpio: Don't miss event during suspend/resume
> 78283edf2c01 kbuild: setlocalversion: print error to STDERR
> c526c62d565e usb: gadget: composite: fix dereference after null check coverify warning
> 511a36d2f357 usb: gadget: Add the gserial port checking in gs_start_tx()
> 1712c9373f98 mmc: core: don't try to switch block size for dual rate mode
> 5ea8ea2cb7f1 tcp/dccp: drop SYN packets if accept queue is full
> e1dc9b08051a serial: sprd: adjust TIMEOUT to a big value
> 81be24d263db Hang/soft lockup in d_invalidate with simultaneous calls
> 6f44a0bacb79 arm64: traps: disable irq in die()
> b7d44c36a6f6 usb: renesas_usbhs: gadget: fix unused-but-set-variable warning
> 4350782570b9 serial: sprd: clear timeout interrupt only rather than all interrupts
> 3f3295709ede lib/int_sqrt: optimize small argument
> 32fd87b3bbf5 USB: core: only clean up what we allocated
All now queued up, except for the exceptions I have responded to.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 15+ messages in thread