linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/4] dt-bindings: memory: jz4780-nemc: Add compatible string for JZ4725B
@ 2018-08-22 17:29 Paul Cercueil
  2018-08-22 17:29 ` [PATCH 2/4] memory: jz4780_nemc: Drop dependency on MACH_JZ4780, use COMPILE_TEST Paul Cercueil
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Paul Cercueil @ 2018-08-22 17:29 UTC (permalink / raw)
  To: Rob Herring, Mark Rutland, Alex Smith
  Cc: od, devicetree, linux-kernel, Paul Cercueil

The jz4780-nemc driver was modified to be compatible with the JZ4725B
SoC.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
---
 .../bindings/memory-controllers/ingenic,jz4780-nemc.txt          | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/memory-controllers/ingenic,jz4780-nemc.txt b/Documentation/devicetree/bindings/memory-controllers/ingenic,jz4780-nemc.txt
index f936b5589b19..7cce6d761f2d 100644
--- a/Documentation/devicetree/bindings/memory-controllers/ingenic,jz4780-nemc.txt
+++ b/Documentation/devicetree/bindings/memory-controllers/ingenic,jz4780-nemc.txt
@@ -5,6 +5,7 @@ controller in Ingenic JZ4780
 
 Required properties:
 - compatible: Should be set to one of:
+    "ingenic,jz4725b-nemc" (JZ4725B)
     "ingenic,jz4780-nemc" (JZ4780)
 - reg: Should specify the NEMC controller registers location and length.
 - clocks: Clock for the NEMC controller.
-- 
2.18.0


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 2/4] memory: jz4780_nemc: Drop dependency on MACH_JZ4780, use COMPILE_TEST
  2018-08-22 17:29 [PATCH 1/4] dt-bindings: memory: jz4780-nemc: Add compatible string for JZ4725B Paul Cercueil
@ 2018-08-22 17:29 ` Paul Cercueil
  2018-08-22 17:29 ` [PATCH 3/4] memory: jz4780-nemc: Reduce size of const array Paul Cercueil
  2018-08-22 17:29 ` [PATCH 4/4] memory: jz4780_nemc: Add support for the JZ4725B Paul Cercueil
  2 siblings, 0 replies; 10+ messages in thread
From: Paul Cercueil @ 2018-08-22 17:29 UTC (permalink / raw)
  To: Rob Herring, Mark Rutland, Alex Smith
  Cc: od, devicetree, linux-kernel, Paul Cercueil

Depending on MACH_JZ4780 prevent us from creating a generic kernel that
works on more than one MIPS board. Instead, we just depend on MIPS being
set.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
---
 drivers/memory/Kconfig | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/memory/Kconfig b/drivers/memory/Kconfig
index 8d731d6c3e54..68bf8b2b45f6 100644
--- a/drivers/memory/Kconfig
+++ b/drivers/memory/Kconfig
@@ -120,8 +120,8 @@ config FSL_IFC
 
 config JZ4780_NEMC
 	bool "Ingenic JZ4780 SoC NEMC driver"
-	default y
-	depends on MACH_JZ4780
+	default MACH_JZ4780
+	depends on MIPS || COMPILE_TEST
 	help
 	  This driver is for the NAND/External Memory Controller (NEMC) in
 	  the Ingenic JZ4780. This controller is used to handle external
-- 
2.18.0


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 3/4] memory: jz4780-nemc: Reduce size of const array
  2018-08-22 17:29 [PATCH 1/4] dt-bindings: memory: jz4780-nemc: Add compatible string for JZ4725B Paul Cercueil
  2018-08-22 17:29 ` [PATCH 2/4] memory: jz4780_nemc: Drop dependency on MACH_JZ4780, use COMPILE_TEST Paul Cercueil
@ 2018-08-22 17:29 ` Paul Cercueil
  2018-08-23 10:41   ` David Laight
  2018-08-31 12:18   ` Rob Herring
  2018-08-22 17:29 ` [PATCH 4/4] memory: jz4780_nemc: Add support for the JZ4725B Paul Cercueil
  2 siblings, 2 replies; 10+ messages in thread
From: Paul Cercueil @ 2018-08-22 17:29 UTC (permalink / raw)
  To: Rob Herring, Mark Rutland, Alex Smith
  Cc: od, devicetree, linux-kernel, Paul Cercueil

The maximum value found in that array is 15, there's no need to store
these values as uint32_t, a uint8_t is enough.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
---
 drivers/memory/jz4780-nemc.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/memory/jz4780-nemc.c b/drivers/memory/jz4780-nemc.c
index bcf06adefc96..ef3f20e46590 100644
--- a/drivers/memory/jz4780-nemc.c
+++ b/drivers/memory/jz4780-nemc.c
@@ -161,7 +161,7 @@ static bool jz4780_nemc_configure_bank(struct jz4780_nemc *nemc,
 	 * Conversion of tBP and tAW cycle counts to values supported by the
 	 * hardware (round up to the next supported value).
 	 */
-	static const uint32_t convert_tBP_tAW[] = {
+	static const u8 convert_tBP_tAW[] = {
 		0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
 
 		/* 11 - 12 -> 12 cycles */
@@ -232,7 +232,7 @@ static bool jz4780_nemc_configure_bank(struct jz4780_nemc *nemc,
 			return false;
 		}
 
-		smcr |= convert_tBP_tAW[cycles] << NEMC_SMCR_TBP_SHIFT;
+		smcr |= (u32)convert_tBP_tAW[cycles] << NEMC_SMCR_TBP_SHIFT;
 	}
 
 	if (of_property_read_u32(node, "ingenic,nemc-tAW", &val) == 0) {
@@ -244,7 +244,7 @@ static bool jz4780_nemc_configure_bank(struct jz4780_nemc *nemc,
 			return false;
 		}
 
-		smcr |= convert_tBP_tAW[cycles] << NEMC_SMCR_TAW_SHIFT;
+		smcr |= (u32)convert_tBP_tAW[cycles] << NEMC_SMCR_TAW_SHIFT;
 	}
 
 	if (of_property_read_u32(node, "ingenic,nemc-tSTRV", &val) == 0) {
-- 
2.18.0


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 4/4] memory: jz4780_nemc: Add support for the JZ4725B
  2018-08-22 17:29 [PATCH 1/4] dt-bindings: memory: jz4780-nemc: Add compatible string for JZ4725B Paul Cercueil
  2018-08-22 17:29 ` [PATCH 2/4] memory: jz4780_nemc: Drop dependency on MACH_JZ4780, use COMPILE_TEST Paul Cercueil
  2018-08-22 17:29 ` [PATCH 3/4] memory: jz4780-nemc: Reduce size of const array Paul Cercueil
@ 2018-08-22 17:29 ` Paul Cercueil
  2 siblings, 0 replies; 10+ messages in thread
From: Paul Cercueil @ 2018-08-22 17:29 UTC (permalink / raw)
  To: Rob Herring, Mark Rutland, Alex Smith
  Cc: od, devicetree, linux-kernel, Paul Cercueil

The NEMC module in the JZ4725B is very similar to the one in the JZ4780.
The only difference I could spot was that the TAS/TAH timings are
limited to 7 clock ticks on the JZ4725B instead of 15 on the JZ4780.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
---
 drivers/memory/jz4780-nemc.c | 24 +++++++++++++++++++++---
 1 file changed, 21 insertions(+), 3 deletions(-)

diff --git a/drivers/memory/jz4780-nemc.c b/drivers/memory/jz4780-nemc.c
index ef3f20e46590..c52d254988dc 100644
--- a/drivers/memory/jz4780-nemc.c
+++ b/drivers/memory/jz4780-nemc.c
@@ -44,9 +44,14 @@
 #define NEMC_NFCSR_NFCEn(n)	BIT((((n) - 1) << 1) + 1)
 #define NEMC_NFCSR_TNFEn(n)	BIT(16 + (n) - 1)
 
+struct jz4780_nemc_soc_info {
+	uint8_t tas_tah_cycles_max;
+};
+
 struct jz4780_nemc {
 	spinlock_t lock;
 	struct device *dev;
+	const struct jz4780_nemc_soc_info *soc_info;
 	void __iomem *base;
 	struct clk *clk;
 	uint32_t clk_period;
@@ -202,7 +207,7 @@ static bool jz4780_nemc_configure_bank(struct jz4780_nemc *nemc,
 	if (of_property_read_u32(node, "ingenic,nemc-tAS", &val) == 0) {
 		smcr &= ~NEMC_SMCR_TAS_MASK;
 		cycles = jz4780_nemc_ns_to_cycles(nemc, val);
-		if (cycles > 15) {
+		if (cycles > nemc->soc_info->tas_tah_cycles_max) {
 			dev_err(nemc->dev, "tAS %u is too high (%u cycles)\n",
 				val, cycles);
 			return false;
@@ -214,7 +219,7 @@ static bool jz4780_nemc_configure_bank(struct jz4780_nemc *nemc,
 	if (of_property_read_u32(node, "ingenic,nemc-tAH", &val) == 0) {
 		smcr &= ~NEMC_SMCR_TAH_MASK;
 		cycles = jz4780_nemc_ns_to_cycles(nemc, val);
-		if (cycles > 15) {
+		if (cycles > nemc->soc_info->tas_tah_cycles_max) {
 			dev_err(nemc->dev, "tAH %u is too high (%u cycles)\n",
 				val, cycles);
 			return false;
@@ -278,6 +283,10 @@ static int jz4780_nemc_probe(struct platform_device *pdev)
 	if (!nemc)
 		return -ENOMEM;
 
+	nemc->soc_info = device_get_match_data(dev);
+	if (!nemc->soc_info)
+		return -EINVAL;
+
 	spin_lock_init(&nemc->lock);
 	nemc->dev = dev;
 
@@ -370,8 +379,17 @@ static int jz4780_nemc_remove(struct platform_device *pdev)
 	return 0;
 }
 
+static const struct jz4780_nemc_soc_info jz4725b_soc_info = {
+	.tas_tah_cycles_max = 7,
+};
+
+static const struct jz4780_nemc_soc_info jz4780_soc_info = {
+	.tas_tah_cycles_max = 15,
+};
+
 static const struct of_device_id jz4780_nemc_dt_match[] = {
-	{ .compatible = "ingenic,jz4780-nemc" },
+	{ .compatible = "ingenic,jz4725b-nemc", .data = &jz4725b_soc_info, },
+	{ .compatible = "ingenic,jz4780-nemc", .data = &jz4780_soc_info, },
 	{},
 };
 
-- 
2.18.0


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* RE: [PATCH 3/4] memory: jz4780-nemc: Reduce size of const array
  2018-08-22 17:29 ` [PATCH 3/4] memory: jz4780-nemc: Reduce size of const array Paul Cercueil
@ 2018-08-23 10:41   ` David Laight
  2018-08-23 12:52     ` Paul Cercueil
  2018-08-31 12:18   ` Rob Herring
  1 sibling, 1 reply; 10+ messages in thread
From: David Laight @ 2018-08-23 10:41 UTC (permalink / raw)
  To: 'Paul Cercueil', Rob Herring, Mark Rutland, Alex Smith
  Cc: od, devicetree, linux-kernel

From: Paul Cercueil
> Sent: 22 August 2018 18:30
> The maximum value found in that array is 15, there's no need to store
> these values as uint32_t, a uint8_t is enough.
> 
> Signed-off-by: Paul Cercueil <paul@crapouillou.net>
> ---
>  drivers/memory/jz4780-nemc.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/memory/jz4780-nemc.c b/drivers/memory/jz4780-nemc.c
> index bcf06adefc96..ef3f20e46590 100644
> --- a/drivers/memory/jz4780-nemc.c
> +++ b/drivers/memory/jz4780-nemc.c
> @@ -161,7 +161,7 @@ static bool jz4780_nemc_configure_bank(struct jz4780_nemc *nemc,
>  	 * Conversion of tBP and tAW cycle counts to values supported by the
>  	 * hardware (round up to the next supported value).
>  	 */
> -	static const uint32_t convert_tBP_tAW[] = {
> +	static const u8 convert_tBP_tAW[] = {
>  		0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
> 
>  		/* 11 - 12 -> 12 cycles */
> @@ -232,7 +232,7 @@ static bool jz4780_nemc_configure_bank(struct jz4780_nemc *nemc,
>  			return false;
>  		}
> 
> -		smcr |= convert_tBP_tAW[cycles] << NEMC_SMCR_TBP_SHIFT;
> +		smcr |= (u32)convert_tBP_tAW[cycles] << NEMC_SMCR_TBP_SHIFT;

You don't need the cast here.

	David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)


^ permalink raw reply	[flat|nested] 10+ messages in thread

* RE: [PATCH 3/4] memory: jz4780-nemc: Reduce size of const array
  2018-08-23 10:41   ` David Laight
@ 2018-08-23 12:52     ` Paul Cercueil
  0 siblings, 0 replies; 10+ messages in thread
From: Paul Cercueil @ 2018-08-23 12:52 UTC (permalink / raw)
  To: David Laight
  Cc: Rob Herring, Mark Rutland, Alex Smith, od, devicetree, linux-kernel

Hi David,

Le jeu. 23 août 2018 à 12:41, David Laight <David.Laight@ACULAB.COM> 
a écrit :
> From: Paul Cercueil
>>  Sent: 22 August 2018 18:30
>>  The maximum value found in that array is 15, there's no need to 
>> store
>>  these values as uint32_t, a uint8_t is enough.
>> 
>>  Signed-off-by: Paul Cercueil <paul@crapouillou.net>
>>  ---
>>   drivers/memory/jz4780-nemc.c | 6 +++---
>>   1 file changed, 3 insertions(+), 3 deletions(-)
>> 
>>  diff --git a/drivers/memory/jz4780-nemc.c 
>> b/drivers/memory/jz4780-nemc.c
>>  index bcf06adefc96..ef3f20e46590 100644
>>  --- a/drivers/memory/jz4780-nemc.c
>>  +++ b/drivers/memory/jz4780-nemc.c
>>  @@ -161,7 +161,7 @@ static bool jz4780_nemc_configure_bank(struct 
>> jz4780_nemc *nemc,
>>   	 * Conversion of tBP and tAW cycle counts to values supported by 
>> the
>>   	 * hardware (round up to the next supported value).
>>   	 */
>>  -	static const uint32_t convert_tBP_tAW[] = {
>>  +	static const u8 convert_tBP_tAW[] = {
>>   		0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
>> 
>>   		/* 11 - 12 -> 12 cycles */
>>  @@ -232,7 +232,7 @@ static bool jz4780_nemc_configure_bank(struct 
>> jz4780_nemc *nemc,
>>   			return false;
>>   		}
>> 
>>  -		smcr |= convert_tBP_tAW[cycles] << NEMC_SMCR_TBP_SHIFT;
>>  +		smcr |= (u32)convert_tBP_tAW[cycles] << NEMC_SMCR_TBP_SHIFT;
> 
> You don't need the cast here.

OK, I will remove them in V2.

> 
> 	David
> 
> -
> Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, 
> MK1 1PT, UK
> Registration No: 1397386 (Wales)
> 


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 3/4] memory: jz4780-nemc: Reduce size of const array
  2018-08-22 17:29 ` [PATCH 3/4] memory: jz4780-nemc: Reduce size of const array Paul Cercueil
  2018-08-23 10:41   ` David Laight
@ 2018-08-31 12:18   ` Rob Herring
  1 sibling, 0 replies; 10+ messages in thread
From: Rob Herring @ 2018-08-31 12:18 UTC (permalink / raw)
  To: Paul Cercueil
  Cc: Mark Rutland, Alex Smith, od, devicetree, linux-kernel, Paul Cercueil

On Wed, 22 Aug 2018 19:29:52 +0200, Paul Cercueil wrote:
> The maximum value found in that array is 15, there's no need to store
> these values as uint32_t, a uint8_t is enough.
> 
> Signed-off-by: Paul Cercueil <paul@crapouillou.net>
> ---
>  drivers/memory/jz4780-nemc.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 

Reviewed-by: Rob Herring <robh@kernel.org>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 3/4] memory: jz4780-nemc: Reduce size of const array
  2019-01-18  8:15   ` Boris Brezillon
@ 2019-01-18 14:10     ` Paul Cercueil
  0 siblings, 0 replies; 10+ messages in thread
From: Paul Cercueil @ 2019-01-18 14:10 UTC (permalink / raw)
  To: Boris Brezillon
  Cc: Rob Herring, Mark Rutland, Miquel Raynal, devicetree, linux-kernel


Hi,

On Fri, Jan 18, 2019 at 5:15 AM, Boris Brezillon 
<bbrezillon@kernel.org> wrote:
> On Thu, 17 Jan 2019 19:45:49 -0300
> Paul Cercueil <paul@crapouillou.net <mailto:paul@crapouillou.net>> 
> wrote:
> 
>>  The maximum value found in that array is 15, there's no need to 
>> store
>>  these values as uint32_t, a uint8_t is enough.
> 
> Is it really worth the additional cast you add in the code?

They're not needed. I had to verify, because it was not obvious to me.
I'll remove them then.

>> 
>>  Signed-off-by: Paul Cercueil <paul@crapouillou.net 
>> <mailto:paul@crapouillou.net>>
>>  ---
>>   drivers/memory/jz4780-nemc.c | 6 +++---
>>   1 file changed, 3 insertions(+), 3 deletions(-)
>> 
>>  diff --git a/drivers/memory/jz4780-nemc.c 
>> b/drivers/memory/jz4780-nemc.c
>>  index bcf06adefc96..ef3f20e46590 100644
>>  --- a/drivers/memory/jz4780-nemc.c
>>  +++ b/drivers/memory/jz4780-nemc.c
>>  @@ -161,7 +161,7 @@ static bool jz4780_nemc_configure_bank(struct 
>> jz4780_nemc *nemc,
>>   	 * Conversion of tBP and tAW cycle counts to values supported by 
>> the
>>   	 * hardware (round up to the next supported value).
>>   	 */
>>  -	static const uint32_t convert_tBP_tAW[] = {
>>  +	static const u8 convert_tBP_tAW[] = {
>>   		0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
>> 
>>   		/* 11 - 12 -> 12 cycles */
>>  @@ -232,7 +232,7 @@ static bool jz4780_nemc_configure_bank(struct 
>> jz4780_nemc *nemc,
>>   			return false;
>>   		}
>> 
>>  -		smcr |= convert_tBP_tAW[cycles] << NEMC_SMCR_TBP_SHIFT;
>>  +		smcr |= (u32)convert_tBP_tAW[cycles] << NEMC_SMCR_TBP_SHIFT;
>>   	}
>> 
>>   	if (of_property_read_u32(node, "ingenic,nemc-tAW", &val) == 0) {
>>  @@ -244,7 +244,7 @@ static bool jz4780_nemc_configure_bank(struct 
>> jz4780_nemc *nemc,
>>   			return false;
>>   		}
>> 
>>  -		smcr |= convert_tBP_tAW[cycles] << NEMC_SMCR_TAW_SHIFT;
>>  +		smcr |= (u32)convert_tBP_tAW[cycles] << NEMC_SMCR_TAW_SHIFT;
>>   	}
>> 
>>   	if (of_property_read_u32(node, "ingenic,nemc-tSTRV", &val) == 0) {
> 



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 3/4] memory: jz4780-nemc: Reduce size of const array
  2019-01-17 22:45 ` [PATCH 3/4] memory: jz4780-nemc: Reduce size of const array Paul Cercueil
@ 2019-01-18  8:15   ` Boris Brezillon
  2019-01-18 14:10     ` Paul Cercueil
  0 siblings, 1 reply; 10+ messages in thread
From: Boris Brezillon @ 2019-01-18  8:15 UTC (permalink / raw)
  To: Paul Cercueil
  Cc: Rob Herring, Mark Rutland, Miquel Raynal, devicetree, linux-kernel

On Thu, 17 Jan 2019 19:45:49 -0300
Paul Cercueil <paul@crapouillou.net> wrote:

> The maximum value found in that array is 15, there's no need to store
> these values as uint32_t, a uint8_t is enough.

Is it really worth the additional cast you add in the code?

> 
> Signed-off-by: Paul Cercueil <paul@crapouillou.net>
> ---
>  drivers/memory/jz4780-nemc.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/memory/jz4780-nemc.c b/drivers/memory/jz4780-nemc.c
> index bcf06adefc96..ef3f20e46590 100644
> --- a/drivers/memory/jz4780-nemc.c
> +++ b/drivers/memory/jz4780-nemc.c
> @@ -161,7 +161,7 @@ static bool jz4780_nemc_configure_bank(struct jz4780_nemc *nemc,
>  	 * Conversion of tBP and tAW cycle counts to values supported by the
>  	 * hardware (round up to the next supported value).
>  	 */
> -	static const uint32_t convert_tBP_tAW[] = {
> +	static const u8 convert_tBP_tAW[] = {
>  		0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
>  
>  		/* 11 - 12 -> 12 cycles */
> @@ -232,7 +232,7 @@ static bool jz4780_nemc_configure_bank(struct jz4780_nemc *nemc,
>  			return false;
>  		}
>  
> -		smcr |= convert_tBP_tAW[cycles] << NEMC_SMCR_TBP_SHIFT;
> +		smcr |= (u32)convert_tBP_tAW[cycles] << NEMC_SMCR_TBP_SHIFT;
>  	}
>  
>  	if (of_property_read_u32(node, "ingenic,nemc-tAW", &val) == 0) {
> @@ -244,7 +244,7 @@ static bool jz4780_nemc_configure_bank(struct jz4780_nemc *nemc,
>  			return false;
>  		}
>  
> -		smcr |= convert_tBP_tAW[cycles] << NEMC_SMCR_TAW_SHIFT;
> +		smcr |= (u32)convert_tBP_tAW[cycles] << NEMC_SMCR_TAW_SHIFT;
>  	}
>  
>  	if (of_property_read_u32(node, "ingenic,nemc-tSTRV", &val) == 0) {


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 3/4] memory: jz4780-nemc: Reduce size of const array
  2019-01-17 22:45 [PATCH 1/4] dt-bindings: memory: jz4780: Add compatible string for JZ4725B SoC Paul Cercueil
@ 2019-01-17 22:45 ` Paul Cercueil
  2019-01-18  8:15   ` Boris Brezillon
  0 siblings, 1 reply; 10+ messages in thread
From: Paul Cercueil @ 2019-01-17 22:45 UTC (permalink / raw)
  To: Rob Herring, Mark Rutland, Miquel Raynal, Boris Brezillon
  Cc: devicetree, linux-kernel, Paul Cercueil

The maximum value found in that array is 15, there's no need to store
these values as uint32_t, a uint8_t is enough.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
---
 drivers/memory/jz4780-nemc.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/memory/jz4780-nemc.c b/drivers/memory/jz4780-nemc.c
index bcf06adefc96..ef3f20e46590 100644
--- a/drivers/memory/jz4780-nemc.c
+++ b/drivers/memory/jz4780-nemc.c
@@ -161,7 +161,7 @@ static bool jz4780_nemc_configure_bank(struct jz4780_nemc *nemc,
 	 * Conversion of tBP and tAW cycle counts to values supported by the
 	 * hardware (round up to the next supported value).
 	 */
-	static const uint32_t convert_tBP_tAW[] = {
+	static const u8 convert_tBP_tAW[] = {
 		0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
 
 		/* 11 - 12 -> 12 cycles */
@@ -232,7 +232,7 @@ static bool jz4780_nemc_configure_bank(struct jz4780_nemc *nemc,
 			return false;
 		}
 
-		smcr |= convert_tBP_tAW[cycles] << NEMC_SMCR_TBP_SHIFT;
+		smcr |= (u32)convert_tBP_tAW[cycles] << NEMC_SMCR_TBP_SHIFT;
 	}
 
 	if (of_property_read_u32(node, "ingenic,nemc-tAW", &val) == 0) {
@@ -244,7 +244,7 @@ static bool jz4780_nemc_configure_bank(struct jz4780_nemc *nemc,
 			return false;
 		}
 
-		smcr |= convert_tBP_tAW[cycles] << NEMC_SMCR_TAW_SHIFT;
+		smcr |= (u32)convert_tBP_tAW[cycles] << NEMC_SMCR_TAW_SHIFT;
 	}
 
 	if (of_property_read_u32(node, "ingenic,nemc-tSTRV", &val) == 0) {
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2019-01-18 14:11 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-22 17:29 [PATCH 1/4] dt-bindings: memory: jz4780-nemc: Add compatible string for JZ4725B Paul Cercueil
2018-08-22 17:29 ` [PATCH 2/4] memory: jz4780_nemc: Drop dependency on MACH_JZ4780, use COMPILE_TEST Paul Cercueil
2018-08-22 17:29 ` [PATCH 3/4] memory: jz4780-nemc: Reduce size of const array Paul Cercueil
2018-08-23 10:41   ` David Laight
2018-08-23 12:52     ` Paul Cercueil
2018-08-31 12:18   ` Rob Herring
2018-08-22 17:29 ` [PATCH 4/4] memory: jz4780_nemc: Add support for the JZ4725B Paul Cercueil
2019-01-17 22:45 [PATCH 1/4] dt-bindings: memory: jz4780: Add compatible string for JZ4725B SoC Paul Cercueil
2019-01-17 22:45 ` [PATCH 3/4] memory: jz4780-nemc: Reduce size of const array Paul Cercueil
2019-01-18  8:15   ` Boris Brezillon
2019-01-18 14:10     ` Paul Cercueil

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).