All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 0/2] cmd: Minor fixes for commands 'mtdparts' and 'nand'
@ 2019-10-30 15:53 Alexander Dahl
  2019-10-30 15:53 ` [U-Boot] [PATCH 1/2] cmd: nand: Remove not used declaration Alexander Dahl
  2019-10-30 15:53 ` [U-Boot] [PATCH 2/2] cmd: mtdparts: Fix build with option ..._SHOW_NET_SIZES Alexander Dahl
  0 siblings, 2 replies; 5+ messages in thread
From: Alexander Dahl @ 2019-10-30 15:53 UTC (permalink / raw)
  To: u-boot

Hei hei,

I reviewed some code today to explore possibilities and came across
two minor issues. See the two patches.

Greets
Alex

Alexander Dahl (2):
  cmd: nand: Remove not used declaration
  cmd: mtdparts: Fix build with option ..._SHOW_NET_SIZES

 cmd/Kconfig    | 8 ++++++++
 cmd/mtdparts.c | 6 +++---
 cmd/nand.c     | 1 -
 3 files changed, 11 insertions(+), 4 deletions(-)

-- 
2.20.1

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

* [U-Boot] [PATCH 1/2] cmd: nand: Remove not used declaration
  2019-10-30 15:53 [U-Boot] [PATCH 0/2] cmd: Minor fixes for commands 'mtdparts' and 'nand' Alexander Dahl
@ 2019-10-30 15:53 ` Alexander Dahl
  2019-11-08 15:33   ` Tom Rini
  2019-10-30 15:53 ` [U-Boot] [PATCH 2/2] cmd: mtdparts: Fix build with option ..._SHOW_NET_SIZES Alexander Dahl
  1 sibling, 1 reply; 5+ messages in thread
From: Alexander Dahl @ 2019-10-30 15:53 UTC (permalink / raw)
  To: u-boot

This declaration is not used anywhere in the whole tree. There is a
function 'mtd_id_parse()' which was renamed from 'id_parse()' in
commit 68d7d65100e8 ("Separate mtdparts command from jffs2"), but that
function is not used (anymore?) in cmd nand and build is fine without
that declaration, so it's probably just safe to remove.

Signed-off-by: Alexander Dahl <ada@thorsis.com>
---
 cmd/nand.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/cmd/nand.c b/cmd/nand.c
index 27efef20bc..24c9df89c1 100644
--- a/cmd/nand.c
+++ b/cmd/nand.c
@@ -34,7 +34,6 @@
 
 /* partition handling routines */
 int mtdparts_init(void);
-int id_parse(const char *id, const char **ret_id, u8 *dev_type, u8 *dev_num);
 int find_dev_and_part(const char *id, struct mtd_device **dev,
 		      u8 *part_num, struct part_info **part);
 #endif
-- 
2.20.1

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

* [U-Boot] [PATCH 2/2] cmd: mtdparts: Fix build with option ..._SHOW_NET_SIZES
  2019-10-30 15:53 [U-Boot] [PATCH 0/2] cmd: Minor fixes for commands 'mtdparts' and 'nand' Alexander Dahl
  2019-10-30 15:53 ` [U-Boot] [PATCH 1/2] cmd: nand: Remove not used declaration Alexander Dahl
@ 2019-10-30 15:53 ` Alexander Dahl
  2019-11-08 15:33   ` Tom Rini
  1 sibling, 1 reply; 5+ messages in thread
From: Alexander Dahl @ 2019-10-30 15:53 UTC (permalink / raw)
  To: u-boot

That option is currently not used by any defconfig and could not be set
anymore since it became mandatory to used Kconfig when introducing new
options with U-Boot v2016.11 or commit eed921d92348 ("Kconfig: Add a
whitelist of ad-hoc CONFIG options") and commit 371244cb19f9 ("Makefile:
Give a build error if ad-hoc CONFIG options are added").

It was also not considered when fixing build warnings in
commit 39ac34473f3c ("cmd_mtdparts: use 64 bits for flash size,
partition size & offset") and could probably not be compiled anyway
after commit dfe64e2c8973 ("mtd: resync with Linux-3.7.1"), which
renamed some members of struct mtd_info … so it was probably broken
since then, which was U-Boot v2013.07-rc1.

However it still seems to work, see example output below:

U-Boot 2019.10-00035-g06a9b259ca-dirty (Oct 30 2019 - 14:03:44 +0100)

CPU: SAMA5D27 1G bits DDR2 SDRAM
Crystal frequency:       24 MHz
CPU clock        :      492 MHz
Master clock     :      164 MHz
Model: ***
DRAM:  128 MiB
NAND:  256 MiB
Loading Environment from NAND... OK
In:    serial at f8020000
Out:   serial at f8020000
Err:   serial at f8020000
Net:   eth0: ethernet at f8008000
Hit keys 'tt' to stop autoboot (3 seconds).
U-Boot> mtdparts

device nand0 <atmel_nand>, # parts = 8
 #: name                size            net size        offset          mask_flags
 0: bootstrap           0x00040000      0x00040000      0x00000000      1
 1: uboot               0x000c0000      0x000c0000      0x00040000      1
 2: env1                0x00040000      0x00040000      0x00100000      0
 3: env2                0x00040000      0x00040000      0x00140000      0
 4: fpga_led            0x00040000      0x00040000      0x00180000      1
 5: reserved            0x00040000      0x00040000      0x001c0000      1
 6: rootfs_rec          0x03200000      0x03200000      0x00200000      1
 7: filesystem          0x0cc00000      0x0cb80000 (!)  0x03400000      0

active partition: nand0,0 - (bootstrap) 0x00040000 @ 0x00000000

defaults:
mtdids  : nand0=atmel_nand
mtdparts: mtdparts=atmel_nand:256k(bootstrap)ro,768k(uboot)ro,256k(env1),256k(env2),256k(fpga_led)ro,256k(reserved)ro,50M(rootfs_rec)ro,-(filesystem)

Signed-off-by: Alexander Dahl <ada@thorsis.com>
---
 cmd/Kconfig    | 8 ++++++++
 cmd/mtdparts.c | 6 +++---
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/cmd/Kconfig b/cmd/Kconfig
index 82b5d300d2..07cb85e08c 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -1984,6 +1984,14 @@ config CMD_MTDPARTS_SPREAD
 	  at least as large as the size specified in the mtdparts variable and
 	  2) each partition starts on a good block.
 
+config CMD_MTDPARTS_SHOW_NET_SIZES
+	bool "Show net size (w/o bad blocks) of partitions"
+	depends on CMD_MTDPARTS
+	help
+	  Adds two columns to the printed partition table showing the
+	  effective usable size of a partition, if bad blocks are taken
+	  into account.
+
 config CMD_REISER
 	bool "reiser - Access to reiserfs filesystems"
 	help
diff --git a/cmd/mtdparts.c b/cmd/mtdparts.c
index 46155cabf6..b40c2afadd 100644
--- a/cmd/mtdparts.c
+++ b/cmd/mtdparts.c
@@ -1233,11 +1233,11 @@ static uint64_t net_part_size(struct mtd_info *mtd, struct part_info *part)
 {
 	uint64_t i, net_size = 0;
 
-	if (!mtd->block_isbad)
+	if (!mtd->_block_isbad)
 		return part->size;
 
 	for (i = 0; i < part->size; i += mtd->erasesize) {
-		if (!mtd->block_isbad(mtd, part->offset + i))
+		if (!mtd->_block_isbad(mtd, part->offset + i))
 			net_size += mtd->erasesize;
 	}
 
@@ -1274,7 +1274,7 @@ static void print_partition_table(void)
 			part = list_entry(pentry, struct part_info, link);
 			net_size = net_part_size(mtd, part);
 			size_note = part->size == net_size ? " " : " (!)";
-			printf("%2d: %-20s0x%08x\t0x%08x%s\t0x%08x\t%d\n",
+			printf("%2d: %-20s0x%08llx\t0x%08x%s\t0x%08llx\t%d\n",
 					part_num, part->name, part->size,
 					net_size, size_note, part->offset,
 					part->mask_flags);
-- 
2.20.1

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

* [U-Boot] [PATCH 1/2] cmd: nand: Remove not used declaration
  2019-10-30 15:53 ` [U-Boot] [PATCH 1/2] cmd: nand: Remove not used declaration Alexander Dahl
@ 2019-11-08 15:33   ` Tom Rini
  0 siblings, 0 replies; 5+ messages in thread
From: Tom Rini @ 2019-11-08 15:33 UTC (permalink / raw)
  To: u-boot

On Wed, Oct 30, 2019 at 04:53:54PM +0100, Alexander Dahl wrote:

> This declaration is not used anywhere in the whole tree. There is a
> function 'mtd_id_parse()' which was renamed from 'id_parse()' in
> commit 68d7d65100e8 ("Separate mtdparts command from jffs2"), but that
> function is not used (anymore?) in cmd nand and build is fine without
> that declaration, so it's probably just safe to remove.
> 
> Signed-off-by: Alexander Dahl <ada@thorsis.com>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20191108/60a40498/attachment.sig>

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

* [U-Boot] [PATCH 2/2] cmd: mtdparts: Fix build with option ..._SHOW_NET_SIZES
  2019-10-30 15:53 ` [U-Boot] [PATCH 2/2] cmd: mtdparts: Fix build with option ..._SHOW_NET_SIZES Alexander Dahl
@ 2019-11-08 15:33   ` Tom Rini
  0 siblings, 0 replies; 5+ messages in thread
From: Tom Rini @ 2019-11-08 15:33 UTC (permalink / raw)
  To: u-boot

On Wed, Oct 30, 2019 at 04:53:55PM +0100, Alexander Dahl wrote:

> That option is currently not used by any defconfig and could not be set
> anymore since it became mandatory to used Kconfig when introducing new
> options with U-Boot v2016.11 or commit eed921d92348 ("Kconfig: Add a
> whitelist of ad-hoc CONFIG options") and commit 371244cb19f9 ("Makefile:
> Give a build error if ad-hoc CONFIG options are added").
> 
> It was also not considered when fixing build warnings in
> commit 39ac34473f3c ("cmd_mtdparts: use 64 bits for flash size,
> partition size & offset") and could probably not be compiled anyway
> after commit dfe64e2c8973 ("mtd: resync with Linux-3.7.1"), which
> renamed some members of struct mtd_info … so it was probably broken
> since then, which was U-Boot v2013.07-rc1.
> 
> However it still seems to work, see example output below:
> 
> U-Boot 2019.10-00035-g06a9b259ca-dirty (Oct 30 2019 - 14:03:44 +0100)
> 
> CPU: SAMA5D27 1G bits DDR2 SDRAM
> Crystal frequency:       24 MHz
> CPU clock        :      492 MHz
> Master clock     :      164 MHz
> Model: ***
> DRAM:  128 MiB
> NAND:  256 MiB
> Loading Environment from NAND... OK
> In:    serial at f8020000
> Out:   serial at f8020000
> Err:   serial at f8020000
> Net:   eth0: ethernet at f8008000
> Hit keys 'tt' to stop autoboot (3 seconds).
> U-Boot> mtdparts
> 
> device nand0 <atmel_nand>, # parts = 8
>  #: name                size            net size        offset          mask_flags
>  0: bootstrap           0x00040000      0x00040000      0x00000000      1
>  1: uboot               0x000c0000      0x000c0000      0x00040000      1
>  2: env1                0x00040000      0x00040000      0x00100000      0
>  3: env2                0x00040000      0x00040000      0x00140000      0
>  4: fpga_led            0x00040000      0x00040000      0x00180000      1
>  5: reserved            0x00040000      0x00040000      0x001c0000      1
>  6: rootfs_rec          0x03200000      0x03200000      0x00200000      1
>  7: filesystem          0x0cc00000      0x0cb80000 (!)  0x03400000      0
> 
> active partition: nand0,0 - (bootstrap) 0x00040000 @ 0x00000000
> 
> defaults:
> mtdids  : nand0=atmel_nand
> mtdparts: mtdparts=atmel_nand:256k(bootstrap)ro,768k(uboot)ro,256k(env1),256k(env2),256k(fpga_led)ro,256k(reserved)ro,50M(rootfs_rec)ro,-(filesystem)
> 
> Signed-off-by: Alexander Dahl <ada@thorsis.com>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20191108/48f23063/attachment.sig>

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

end of thread, other threads:[~2019-11-08 15:33 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-30 15:53 [U-Boot] [PATCH 0/2] cmd: Minor fixes for commands 'mtdparts' and 'nand' Alexander Dahl
2019-10-30 15:53 ` [U-Boot] [PATCH 1/2] cmd: nand: Remove not used declaration Alexander Dahl
2019-11-08 15:33   ` Tom Rini
2019-10-30 15:53 ` [U-Boot] [PATCH 2/2] cmd: mtdparts: Fix build with option ..._SHOW_NET_SIZES Alexander Dahl
2019-11-08 15:33   ` Tom Rini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.