Skip to contentSkip to conversation

mtd: rawnand: meson: Fix linking error on 32-bit platforms

PATCH In review Nathan Chancellor 3 participants 7 messages Jan 29, 2019 – Feb 5, 2019

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mtd: rawnand: meson: Fix linking error on 32-bit platforms

On arm little endian allyesconfig:

ld.lld: error: undefined symbol: __aeabi_uldivmod

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

referenced by meson_nand.c mtd/nand/raw/meson_nand.o:(meson_nfc_setup_data_interface) in archive drivers/built-in.a

The dividend tBERS_max is u64, meaning we need to use DIV_ROUND_UP_ULL (which wraps do_div) to prevent the compiler from emitting __aebi_uldivmod.

Fixes 2d570b34b41a ("mtd: rawnand: meson: add support for Amlogic NAND flash controller")
---
 drivers/mtd/nand/raw/meson_nand.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/mtd/nand/raw/meson_nand.c +2 -2
index e858d58d97b0..6f12a96195d1 100644
@@ -1116,8 +1116,8 @@ int meson_nfc_setup_data_interface(struct nand_chip *nand, int csline,
 				       div * NFC_CLK_CYCLE);
 	meson_chip->tadl = DIV_ROUND_UP(PSEC_TO_NSEC(timings->tADL_min),
 					div * NFC_CLK_CYCLE);
-	tbers_clocks = DIV_ROUND_UP(PSEC_TO_NSEC(timings->tBERS_max),
-				    div * NFC_CLK_CYCLE);
+	tbers_clocks = DIV_ROUND_UP_ULL(PSEC_TO_NSEC(timings->tBERS_max),
+					div * NFC_CLK_CYCLE);
 	meson_chip->tbers_max = ilog2(tbers_clocks);
 	if (!is_power_of_2(tbers_clocks))
 		meson_chip->tbers_max++;
Signature · 1 line
2.20.1
maintainer
#1 lore raw

Hello Nathan,

Quoted 10 lines · Nathan Chancellor

On arm little endian allyesconfig:

ld.lld: error: undefined symbol: __aeabi_uldivmod

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

referenced by meson_nand.c mtd/nand/raw/meson_nand.o:(meson_nfc_setup_data_interface) in archive drivers/built-in.a

The dividend tBERS_max is u64, meaning we need to use DIV_ROUND_UP_ULL (which wraps do_div) to prevent the compiler from emitting __aebi_uldivmod.

ok. thanks for your time.

Quoted 11 lines
Fixes 2d570b34b41a ("mtd: rawnand: meson: add support for Amlogic NAND flash controller")
---
  drivers/mtd/nand/raw/meson_nand.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
drivers/mtd/nand/raw/meson_nand.c +0 -0
index e858d58d97b0..6f12a96195d1 100644

drivers/mtd/nand/raw/meson_nand.c int meson_nfc_setup_data_interface(struct nand_chip *nand, int csline, · line 1120

Quoted 7 lines
drivers/mtd/nand/raw/meson_nand.c +2 -2
@@ -1116,8 +1116,8 @@ int meson_nfc_setup_data_interface(struct nand_chip *nand, int csline,
  				       div * NFC_CLK_CYCLE);
  	meson_chip->tadl = DIV_ROUND_UP(PSEC_TO_NSEC(timings->tADL_min),
  					div * NFC_CLK_CYCLE);
-	tbers_clocks = DIV_ROUND_UP(PSEC_TO_NSEC(timings->tBERS_max),
-				    div * NFC_CLK_CYCLE);
+	tbers_clocks = DIV_ROUND_UP_ULL(PSEC_TO_NSEC(timings->tBERS_max),
+					div * NFC_CLK_CYCLE);

ok.

drivers/mtd/nand/raw/meson_nand.c int meson_nfc_setup_data_interface(struct nand_chip *nand, int csline, · line 1123

Quoted 4 lines
drivers/mtd/nand/raw/meson_nand.c +0 -0
  	meson_chip->tbers_max = ilog2(tbers_clocks);
  	if (!is_power_of_2(tbers_clocks))
  		meson_chip->tbers_max++;

_______________________________________________
linux-amlogic mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-amlogic

maintainer Acked-by on v1 1/1
#2 lore raw
In reply to Nathan Chancellor

Hi Nathan,

Quoted 21 lines · Nathan Chancellor

On arm little endian allyesconfig:

ld.lld: error: undefined symbol: __aeabi_uldivmod

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

referenced by meson_nand.c mtd/nand/raw/meson_nand.o:(meson_nfc_setup_data_interface) in archive drivers/built-in.a

The dividend tBERS_max is u64, meaning we need to use DIV_ROUND_UP_ULL (which wraps do_div) to prevent the compiler from emitting __aebi_uldivmod.

Fixes 2d570b34b41a ("mtd: rawnand: meson: add support for Amlogic NAND flash controller")
---
  drivers/mtd/nand/raw/meson_nand.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
drivers/mtd/nand/raw/meson_nand.c +0 -0
index e858d58d97b0..6f12a96195d1 100644

drivers/mtd/nand/raw/meson_nand.c int meson_nfc_setup_data_interface(struct nand_chip *nand, int csline, · line 1120

Quoted 7 lines
drivers/mtd/nand/raw/meson_nand.c +2 -2
@@ -1116,8 +1116,8 @@ int meson_nfc_setup_data_interface(struct nand_chip *nand, int csline,
  				       div * NFC_CLK_CYCLE);
  	meson_chip->tadl = DIV_ROUND_UP(PSEC_TO_NSEC(timings->tADL_min),
  					div * NFC_CLK_CYCLE);
-	tbers_clocks = DIV_ROUND_UP(PSEC_TO_NSEC(timings->tBERS_max),
-				    div * NFC_CLK_CYCLE);
+	tbers_clocks = DIV_ROUND_UP_ULL(PSEC_TO_NSEC(timings->tBERS_max),
+					div * NFC_CLK_CYCLE);

Looks good to me:

Quoted 4 lines
drivers/mtd/nand/raw/meson_nand.c +0 -0
  	meson_chip->tbers_max = ilog2(tbers_clocks);
  	if (!is_power_of_2(tbers_clocks))
  		meson_chip->tbers_max++;
maintainer
#3 lore raw

Hi Liang, Nathan,

Liang Yang <[email protected]> wrote on Wed, 30 Jan 2019 17:26:39 +0800:

Quoted 34 lines

Hi Nathan,

Quoted 21 lines · Nathan Chancellor

On arm little endian allyesconfig:

ld.lld: error: undefined symbol: __aeabi_uldivmod

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

referenced by meson_nand.c mtd/nand/raw/meson_nand.o:(meson_nfc_setup_data_interface) in archive drivers/built-in.a

The dividend tBERS_max is u64, meaning we need to use DIV_ROUND_UP_ULL (which wraps do_div) to prevent the compiler from emitting __aebi_uldivmod.

Fixes 2d570b34b41a ("mtd: rawnand: meson: add support for Amlogic NAND flash controller")
---
  drivers/mtd/nand/raw/meson_nand.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
drivers/mtd/nand/raw/meson_nand.c +0 -0
index e858d58d97b0..6f12a96195d1 100644

drivers/mtd/nand/raw/meson_nand.c int meson_nfc_setup_data_interface(struct nand_chip *nand, int csline, · line 1120

Quoted 7 lines
drivers/mtd/nand/raw/meson_nand.c +2 -2
@@ -1116,8 +1116,8 @@ int meson_nfc_setup_data_interface(struct nand_chip *nand, int csline,
  				       div * NFC_CLK_CYCLE);
  	meson_chip->tadl = DIV_ROUND_UP(PSEC_TO_NSEC(timings->tADL_min),
  					div * NFC_CLK_CYCLE);
-	tbers_clocks = DIV_ROUND_UP(PSEC_TO_NSEC(timings->tBERS_max),
-				    div * NFC_CLK_CYCLE);
+	tbers_clocks = DIV_ROUND_UP_ULL(PSEC_TO_NSEC(timings->tBERS_max),
+					div * NFC_CLK_CYCLE);  

Looks good to me:

Quoted 1 line

This is nand/next material, so if you don't mind I would like to squash this fix into the original commit inserting the driver.

Thanks,
Miquèl

#4 lore raw
Quoted 39 lines · Miquel Raynal

Hi Liang, Nathan,

Liang Yang <[email protected]> wrote on Wed, 30 Jan 2019 17:26:39 +0800:

Quoted 34 lines

Hi Nathan,

Quoted 21 lines · Nathan Chancellor

On arm little endian allyesconfig:

ld.lld: error: undefined symbol: __aeabi_uldivmod

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

referenced by meson_nand.c mtd/nand/raw/meson_nand.o:(meson_nfc_setup_data_interface) in archive drivers/built-in.a

The dividend tBERS_max is u64, meaning we need to use DIV_ROUND_UP_ULL (which wraps do_div) to prevent the compiler from emitting __aebi_uldivmod.

Fixes 2d570b34b41a ("mtd: rawnand: meson: add support for Amlogic NAND flash controller")
---
  drivers/mtd/nand/raw/meson_nand.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
drivers/mtd/nand/raw/meson_nand.c +0 -0
index e858d58d97b0..6f12a96195d1 100644

drivers/mtd/nand/raw/meson_nand.c int meson_nfc_setup_data_interface(struct nand_chip *nand, int csline, · line 1120

Quoted 7 lines
drivers/mtd/nand/raw/meson_nand.c +2 -2
@@ -1116,8 +1116,8 @@ int meson_nfc_setup_data_interface(struct nand_chip *nand, int csline,
  				       div * NFC_CLK_CYCLE);
  	meson_chip->tadl = DIV_ROUND_UP(PSEC_TO_NSEC(timings->tADL_min),
  					div * NFC_CLK_CYCLE);
-	tbers_clocks = DIV_ROUND_UP(PSEC_TO_NSEC(timings->tBERS_max),
-				    div * NFC_CLK_CYCLE);
+	tbers_clocks = DIV_ROUND_UP_ULL(PSEC_TO_NSEC(timings->tBERS_max),
+					div * NFC_CLK_CYCLE);  

Looks good to me:

Quoted 8 lines
Quoted 1 line

This is nand/next material, so if you don't mind I would like to squash this fix into the original commit inserting the driver.

Thanks,
Miquèl

Hi Miquel,

That is totally fine by me, thanks for the quick response!

Nathan

maintainer
#5 lore raw

Hi Miquel, Nathan,

Quoted 46 lines · Nathan Chancellor
Quoted 45 lines · Miquel Raynal

Hi Liang, Nathan,

Liang Yang <[email protected]> wrote on Wed, 30 Jan 2019 17:26:39 +0800:

Quoted 34 lines

Hi Nathan,

Quoted 21 lines · Nathan Chancellor

On arm little endian allyesconfig:

ld.lld: error: undefined symbol: __aeabi_uldivmod
>>> referenced by meson_nand.c
>>> mtd/nand/raw/meson_nand.o:(meson_nfc_setup_data_interface) in archive drivers/built-in.a

The dividend tBERS_max is u64, meaning we need to use DIV_ROUND_UP_ULL (which wraps do_div) to prevent the compiler from emitting __aebi_uldivmod.

Fixes 2d570b34b41a ("mtd: rawnand: meson: add support for Amlogic NAND flash controller")
---
   drivers/mtd/nand/raw/meson_nand.c | 4 ++--
   1 file changed, 2 insertions(+), 2 deletions(-)
drivers/mtd/nand/raw/meson_nand.c +0 -0
index e858d58d97b0..6f12a96195d1 100644

drivers/mtd/nand/raw/meson_nand.c int meson_nfc_setup_data_interface(struct nand_chip *nand, int csline, · line 1120

Quoted 7 lines
drivers/mtd/nand/raw/meson_nand.c +2 -2
@@ -1116,8 +1116,8 @@ int meson_nfc_setup_data_interface(struct nand_chip *nand, int csline,
   				       div * NFC_CLK_CYCLE);
   	meson_chip->tadl = DIV_ROUND_UP(PSEC_TO_NSEC(timings->tADL_min),
   					div * NFC_CLK_CYCLE);
-	tbers_clocks = DIV_ROUND_UP(PSEC_TO_NSEC(timings->tBERS_max),
-				    div * NFC_CLK_CYCLE);
+	tbers_clocks = DIV_ROUND_UP_ULL(PSEC_TO_NSEC(timings->tBERS_max),
+					div * NFC_CLK_CYCLE);

Looks good to me:

Quoted 1 line

This is nand/next material, so if you don't mind I would like to squash this fix into the original commit inserting the driver.

Quoted 9 lines
Quoted 2 lines

Thanks,
Miquèl

Hi Miquel,

That is totally fine by me, thanks for the quick response!

Nathan

it is ok with me.

Quoted 2 lines

.

maintainer
#6 lore raw
In reply to Nathan Chancellor

Hi Nathan,

Nathan Chancellor <[email protected]> wrote on Tue, 29 Jan 2019 14:46:57 -0700:

Quoted 6 lines

On arm little endian allyesconfig:

ld.lld: error: undefined symbol: __aeabi_uldivmod

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

referenced by meson_nand.c mtd/nand/raw/meson_nand.o:(meson_nfc_setup_data_interface) in archive drivers/built-in.a

Quoted 7 lines

The dividend tBERS_max is u64, meaning we need to use DIV_ROUND_UP_ULL (which wraps do_div) to prevent the compiler from emitting __aebi_uldivmod.

Fixes 2d570b34b41a ("mtd: rawnand: meson: add support for Amlogic NAND flash controller")

---

Merged in nand/next with the original commit.

Thanks,
Miquèl