Re: [PATCH v3 4/5] rockchip: mkimage: Update init size limit

2023-02-17 Thread Johan Jonker
Hi Jonas,

On 2/17/23 21:52, Jonas Karlman wrote:
> Sync init size limit from vendor u-boot:

This sync might not be correct.
Please recheck with each SoC or limit your change to the rk3328 SoC if prove 
fails.
Could Kever disclose SoC details here?

Johan 

> 
>  px30: 12KiB (+2KiB)

>  rk3066: 32KiB (+2KiB)


On the rk3066 the limitation depends on the bootrom logic and the tpl location 
it is loaded in memory:

//SPL
flash_boot_size = idb_buf[0].flash_boot_size;
size = flash_boot_size - 5;
if ( size >= 32763 )
flash_boot_size = 10;
//TPL
flash_data_size = idb_buf[0].flash_data_size;
if (flash_data_size - 4 >= 61 ||
flash_boot_size < flash_data_size ||
flash_data_size & 3) {
flash_data_size = 4;
}

offset = idb_buf[0].boot_code1_offset + start;

===

CONFIG_TPL_TEXT_BASE=0x10080C00
TPL/SPL truncated to 2048 = 4 sectors of 512bytes per NAND page.
Header size = 4 x 512bytes

limit1: flash_data_size - 4 >= 61
limit2: flash_boot_size < flash_data_size

===

usFlashDataSec = (ALIGN(dwLoaderDataSize, 2048)) / SECTOR_SIZE;
usFlashBootSec = (ALIGN(dwLoaderSize, 2048)) / SECTOR_SIZE;

dwSectorNum = 4 + usFlashDataSec + usFlashBootSec;

pSec0->usBootDataSize = usFlashDataSec;
pSec0->usBootCodeSize = usFlashDataSec + usFlashBootSec;

>  rk3328: 30KiB (+2KiB)
>  rk3568: 60KiB (-16KiB)
> 
> This makes it possible to use latest vendor TPL with RK3328 without
> getting a size limit error running the mkimage command.
> 
> Signed-off-by: Jonas Karlman 
> ---
> v3:
> - Sync with vendor u-boot as-is
> - Update commit message to include size changes
> 
> v2:
> - New patch
> 
>  tools/rkcommon.c | 10 +-
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/tools/rkcommon.c b/tools/rkcommon.c
> index 1f1eaa16752b..630e54b1a54d 100644
> --- a/tools/rkcommon.c
> +++ b/tools/rkcommon.c
> @@ -121,20 +121,20 @@ struct spl_info {
>  };
>  
>  static struct spl_info spl_infos[] = {
> - { "px30", "RK33", 0x2800, false, RK_HEADER_V1 },
> + { "px30", "RK33", 0x4000 - 0x1000, false, RK_HEADER_V1 },
>   { "rk3036", "RK30", 0x1000, false, RK_HEADER_V1 },

> - { "rk3066", "RK30", 0x8000 - 0x800, true, RK_HEADER_V1 },

This is OK.

> - { "rk3128", "RK31", 0x1800, false, RK_HEADER_V1 },

> + { "rk3066", "RK30", 0x8000, true, RK_HEADER_V1 },

This wrong.

printf "%d\n" $(((0x8000 - 0x800 ) / 512))
60 sectors of size 512


> + { "rk3128", "RK31", 0x2000 - 0x800, false, RK_HEADER_V1 },
>   { "rk3188", "RK31", 0x8000 - 0x800, true, RK_HEADER_V1 },
>   { "rk322x", "RK32", 0x8000 - 0x1000, false, RK_HEADER_V1 },
>   { "rk3288", "RK32", 0x8000, false, RK_HEADER_V1 },
>   { "rk3308", "RK33", 0x4 - 0x1000, false, RK_HEADER_V1 },
> - { "rk3328", "RK32", 0x8000 - 0x1000, false, RK_HEADER_V1 },
> + { "rk3328", "RK32", 0x8000 - 0x800, false, RK_HEADER_V1 },
>   { "rk3368", "RK33", 0x8000 - 0x1000, false, RK_HEADER_V1 },
>   { "rk3399", "RK33", 0x3 - 0x2000, false, RK_HEADER_V1 },
>   { "rv1108", "RK11", 0x1800, false, RK_HEADER_V1 },
>   { "rv1126", "110B", 0x1 - 0x1000, false, RK_HEADER_V1 },
> - { "rk3568", "RK35", 0x14000 - 0x1000, false, RK_HEADER_V2 },
> + { "rk3568", "RK35", 0x1 - 0x1000, false, RK_HEADER_V2 },
>  };
>  
>  /**


Re: [PATCH 4/5] binman: Use a private directory for bintools

2023-02-17 Thread Tom Rini
On Fri, Feb 17, 2023 at 04:19:22PM -0700, Simon Glass wrote:

> At present binman writes tools into the ~/bin directory. This is
> convenient but some may be concerned about downloading unverified
> binaries and running them. Place then in a special ~/.binman-tools
> directory instead.
> 
> Mention this in the documentation.
> 
> Signed-off-by: Simon Glass 

Thanks for following up here.

Reviewed-by: Tom Rini 

-- 
Tom


signature.asc
Description: PGP signature


[PATCH 2/2] cmd: introduce 'write' command

2023-02-17 Thread Rasmus Villemoes
It's almost no extra code to hook up a buddy to the 'read' command. In
fact, since the command is passed its own 'struct cmd_tbl', we can use
the exact same callback, and let it figure out for itself whether it
was invoked as "read" or "write".

Signed-off-by: Rasmus Villemoes 
---
 cmd/Kconfig  |  5 +
 cmd/Makefile |  1 +
 cmd/read.c   | 29 ++---
 3 files changed, 28 insertions(+), 7 deletions(-)

diff --git a/cmd/Kconfig b/cmd/Kconfig
index 4fe2c75de2..e87796c538 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -1556,6 +1556,11 @@ config CMD_WDT
help
  This provides commands to control the watchdog timer devices.
 
+config CMD_WRITE
+   bool "write - Write binary data to a partition"
+   help
+ Provides low-level write access to a partition.
+
 config CMD_AXI
bool "axi"
depends on AXI
diff --git a/cmd/Makefile b/cmd/Makefile
index 0b6a96c1d9..cfbabb9ef6 100644
--- a/cmd/Makefile
+++ b/cmd/Makefile
@@ -142,6 +142,7 @@ obj-$(CONFIG_CMD_PXE) += pxe.o
 obj-$(CONFIG_CMD_WOL) += wol.o
 obj-$(CONFIG_CMD_QFW) += qfw.o
 obj-$(CONFIG_CMD_READ) += read.o
+obj-$(CONFIG_CMD_WRITE) += read.o
 obj-$(CONFIG_CMD_REGINFO) += reginfo.o
 obj-$(CONFIG_CMD_REISER) += reiser.o
 obj-$(CONFIG_CMD_REMOTEPROC) += remoteproc.o
diff --git a/cmd/read.c b/cmd/read.c
index 8645db49bb..1218e7acfd 100644
--- a/cmd/read.c
+++ b/cmd/read.c
@@ -13,14 +13,14 @@
 #include 
 #include 
 
-int do_read(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
+static int
+do_rw(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
struct blk_desc *dev_desc = NULL;
struct disk_partition part_info;
ulong offset, limit;
+   uint blk, cnt, res;
void *addr;
-   uint blk;
-   uint cnt;
int part;
 
if (argc != 6) {
@@ -47,20 +47,35 @@ int do_read(struct cmd_tbl *cmdtp, int flag, int argc, char 
*const argv[])
}
 
if (cnt + blk > limit) {
-   printf("Read out of range\n");
+   printf("%s out of range\n", cmdtp->name);
return 1;
}
 
-   if (blk_dread(dev_desc, offset + blk, cnt, addr) != cnt) {
-   printf("Error reading blocks\n");
+   if (IS_ENABLED(CONFIG_CMD_WRITE) && !strcmp(cmdtp->name, "write"))
+   res = blk_dwrite(dev_desc, offset + blk, cnt, addr);
+   else
+   res = blk_dread(dev_desc, offset + blk, cnt, addr);
+
+   if (res != cnt) {
+   printf("%s error\n", cmdtp->name);
return 1;
}
 
return 0;
 }
 
+#ifdef CONFIG_CMD_READ
 U_BOOT_CMD(
-   read,   6,  0,  do_read,
+   read,   6,  0,  do_rw,
"Load binary data from a partition",
"  addr blk# cnt"
 );
+#endif
+
+#ifdef CONFIG_CMD_WRITE
+U_BOOT_CMD(
+   write,  6,  0,  do_rw,
+   "Store binary data to a partition",
+   "  addr blk# cnt"
+);
+#endif
-- 
2.37.2



[PATCH 1/2] cmd: read: use part_get_info_by_dev_and_name_or_num() instead of open-coded dev_part parsing

2023-02-17 Thread Rasmus Villemoes
Use the helper part_get_info_by_dev_and_name_or_num() for parsing a
dev[:part] string and obtaining the partition info in one go, instead
of open-coding all that.

As a bonus, this will automatically allow using the dev#partname
syntax as well, for accessing raw partitions by name.

Signed-off-by: Rasmus Villemoes 
---
 cmd/read.c | 32 
 1 file changed, 8 insertions(+), 24 deletions(-)

diff --git a/cmd/read.c b/cmd/read.c
index fecfadaa1f..8645db49bb 100644
--- a/cmd/read.c
+++ b/cmd/read.c
@@ -15,50 +15,34 @@
 
 int do_read(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
-   char *ep;
struct blk_desc *dev_desc = NULL;
-   int dev;
-   int part = 0;
struct disk_partition part_info;
-   ulong offset = 0u;
-   ulong limit = 0u;
+   ulong offset, limit;
void *addr;
uint blk;
uint cnt;
+   int part;
 
if (argc != 6) {
cmd_usage(cmdtp);
return 1;
}
 
-   dev = (int)hextoul(argv[2], );
-   if (*ep) {
-   if (*ep != ':') {
-   printf("Invalid block device %s\n", argv[2]);
-   return 1;
-   }
-   part = (int)hextoul(++ep, NULL);
-   }
-
-   dev_desc = blk_get_dev(argv[1], dev);
-   if (dev_desc == NULL) {
-   printf("Block device %s %d not supported\n", argv[1], dev);
+   part = part_get_info_by_dev_and_name_or_num(argv[1], argv[2],
+   _desc, _info, 1);
+   if (part < 0)
return 1;
-   }
 
addr = map_sysmem(hextoul(argv[3], NULL), 0);
blk = hextoul(argv[4], NULL);
cnt = hextoul(argv[5], NULL);
 
-   if (part != 0) {
-   if (part_get_info(dev_desc, part, _info)) {
-   printf("Cannot find partition %d\n", part);
-   return 1;
-   }
+   if (part > 0) {
offset = part_info.start;
limit = part_info.size;
} else {
/* Largest address not available in struct blk_desc. */
+   offset = 0;
limit = ~0;
}
 
@@ -78,5 +62,5 @@ int do_read(struct cmd_tbl *cmdtp, int flag, int argc, char 
*const argv[])
 U_BOOT_CMD(
read,   6,  0,  do_read,
"Load binary data from a partition",
-   "  addr blk# cnt"
+   "  addr blk# cnt"
 );
-- 
2.37.2



[PATCH 0/2] improve 'read' command, add 'write' command

2023-02-17 Thread Rasmus Villemoes
The first patch simplies do_read somewhat by making use of an existing
helper instead of parsing the dev_part string manually. As a bonus
(and my actual motivation), it now understands dev#partname syntax -
hard-coded partition numbers are so last decade.

I also need the symmetrical operation, being able to write to a named
raw partition, and fortunately it doesn't require that many lines of
code to implement that.

There's a very minor change in the error reporting due to using
cmdtp->name to generate the new messages, but I don't think "Error
reading blocks" offers much that "read error" doesn't.



Rasmus Villemoes (2):
  cmd: read: use part_get_info_by_dev_and_name_or_num() instead of
open-coded dev_part parsing
  cmd: introduce 'write' command

 cmd/Kconfig  |  5 +
 cmd/Makefile |  1 +
 cmd/read.c   | 61 ++--
 3 files changed, 36 insertions(+), 31 deletions(-)

-- 
2.37.2



Re: [PATCH 01/13] common/Kconfig: Reword text for BOARD_TYPES

2023-02-17 Thread Simon Glass
On Wed, 15 Feb 2023 at 20:37, Tom Rini  wrote:
>
> While it is true that for some Samsung platforms, we call
> get_board_type() the main usage of this CONFIG switch is to enable
> board_types in global data, which is then used by various platforms.
>
> Signed-off-by: Tom Rini 
> ---
>  common/Kconfig | 9 -
>  1 file changed, 4 insertions(+), 5 deletions(-)

Reviewed-by: Simon Glass 


Re: [PATCH 1/3] binman: add sign option for binman

2023-02-17 Thread Simon Glass
HI Ivan,

On Tue, 14 Feb 2023 at 13:38, Ivan Mikhaylov  wrote:
>
> On Sat, 2023-02-04 at 15:23 -0700, Simon Glass wrote:
> > Hi Ivan,
> >
> > On Sun, 15 Jan 2023 at 16:54, Ivan Mikhaylov 
> > wrote:
> > >
> > > On Fri, 2023-01-13 at 11:00 -0700, Simon Glass wrote:
> > > > Hi Ivan,
> > > >
> > > > On Sat, 24 Dec 2022 at 15:35, Ivan Mikhaylov
> > > > 
> > > > wrote:
> > > > >
> > > > > On Sat, 2022-12-17 at 15:02 -0700, Simon Glass wrote:
> > > > > > Hi Ivan,
> > > > > >
> > > > > > On Tue, 13 Dec 2022 at 11:51, Ivan Mikhaylov
> > > > > > 
> > > > > > wrote:
> > > > > > >
> > > > > > > On Fri, 2022-11-18 at 13:50 -0700, Simon Glass wrote:
> > > > > > > > Hi Ivan,
> > > > > > > >
> > > > > > > > On Thu, 15 Sept 2022 at 13:44, Ivan Mikhaylov
> > > > > > > > 
> > > > > > > > wrote:
> > > > > > > > >
> > > > > > > > > On Wed, 2022-09-07 at 15:10 -0600, Simon Glass wrote:
> > > > > > > > > > Hi Ivan,
> > > > > > > > > >
> > > > > > > > > > Section data comes from the BuildSectionData()
> > > > > > > > > > method, so
> > > > > > > > > > you
> > > > > > > > > > could
> > > > > > > > > > try calling that.
> > > > > > > > > >
> > > > > > > > > > See also collect_contents_to_file()
> > > > > > > > > >
> > > > > > > > > > Regards,
> > > > > > > > > > Simon
> > > > > > > > >
> > > > > > > > > Simon, I've tried both these ways and they both don't
> > > > > > > > > work
> > > > > > > > > to
> > > > > > > > > me.
> > > > > > > > > What
> > > > > > > > > I've got:
> > > > > > > > >
> > > > > > > > > def SignEntries(image_fname, input_fname,
> > > > > > > > > privatekey_fname,
> > > > > > > > > algo,
> > > > > > > > > entry_paths):
> > > > > > > > > image_fname = os.path.abspath(image_fname)
> > > > > > > > > image = Image.FromFile(image_fname)
> > > > > > > > > state.PrepareFromLoadedData(image)
> > > > > > > > > image.LoadData()
> > > > > > > > >
> > > > > > > > > 1. BuildSectionData
> > > > > > > > >
> > > > > > > > > for entry_path in entry_paths:
> > > > > > > > > entry = image.FindEntryPath(entry_path)
> > > > > > > > >
> > > > > > > > > try:
> > > > > > > > > entry.BuildSectionData(True)
> > > > > > > > > except Exception as e:
> > > > > > > > > logging.error(traceback.format_exc())
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > ERROR:root:AttributeError: 'NoneType' object has no
> > > > > > > > > attribute
> > > > > > > > > 'run'
> > > > > > >
> > > > > > > Hi Simon, sorry for long delay.
> > > > > > >
> > > > > > > binman: 'NoneType' object has no attribute 'run'
> > > > > > >
> > > > > > > Traceback (most recent call last):
> > > > > > >   File "/home/fr/upstream_uboot/tools/binman/binman", line
> > > > > > > 133,
> > > > > > > in
> > > > > > > RunBinman
> > > > > > > ret_code = control.Binman(args)
> > > > > > >   File "/home/fr/upstream_uboot/tools/binman/control.py",
> > > > > > > line
> > > > > > > 684,
> > > > > > > in
> > > > > > > Binman
> > > > > > > SignEntries(args.image, args.file, args.key, args.algo,
> > > > > > > args.paths)
> > > > > > >   File "/home/fr/upstream_uboot/tools/binman/control.py",
> > > > > > > line
> > > > > > > 469,
> > > > > > > in
> > > > > > > SignEntries
> > > > > > > entry.BuildSectionData(True)
> > > > > > >   File "/home/fr/upstream_uboot/tools/binman/etype/fit.py",
> > > > > > > line
> > > > > > > 426,
> > > > > > > in BuildSectionData
> > > > > > > if self.mkimage.run(reset_timestamp=True,
> > > > > > > output_fname=output_fname,
> > > > > > > AttributeError: 'NoneType' object has no attribute 'run'
> > > > > > >
> > > > > >
> > > > > > You need to call image.CollectBintolls() like ReadEntry() and
> > > > > > other
> > > > > > functions similar to yours that read images from a file. This
> > > > > > is
> > > > > > the
> > > > > > only way that the 'mkimage' tool becomes available to fit.py
> > > > > >
> > > > > > See fit.AddBintools() which is called by that function and
> > > > > > sets
> > > > > > 'self.mkimage'
> > > > > > >
> > > > > Simon, thanks, now this part works fine but there is still
> > > > > issue
> > > > > with
> > > > > updating of fit section, saw that there exists some functions
> > > > > like
> > > > > WriteData but for section(etype/fit.py) it is not implemented
> > > > > yet.
> > > > >
> > > > > ValueError: Node '/fit': Replacing sections is not implemented
> > > > > yet
> > > > >
> > > > > Also tried SetContents but it doesn't update fit section in
> > > > > place.
> > > > > Any
> > > > > suggestions here?
> > > >
> > > > Updating a FIT in the image is not supported, or at least not
> > > > tested,
> > > > so presumably doesn't work.
> > > >
> > > > I obtained fdt_add_pubkey
> > > > from
> > > > https://patchwork.ozlabs.org/project/uboot/list/?series=271511=
> > > > *
> > > >
> > > > I tried this:
> > > >
> > > > binman test testSignSimple
> > > >  Running binman tests
> > > > 
> > > > E
> > > > 

Re: [PATCH] binman: Avoid requiring a home directory on startup

2023-02-17 Thread Simon Glass
Hi Quentin,

On Fri, 17 Feb 2023 at 05:21, Quentin Schulz
 wrote:
>
> Hi all,
>
> On 2/17/23 03:55, Simon Glass wrote:
> > Hi Tom,
> >
> > On Thu, 16 Feb 2023 at 17:19, Tom Rini  wrote:
> >>
> >> On Thu, Feb 16, 2023 at 05:12:33PM -0700, Simon Glass wrote:
> >>> Hi Tom,
> >>>
> >>> On Tue, 14 Feb 2023 at 13:27, Tom Rini  wrote:
> 
>  On Tue, Feb 14, 2023 at 03:12:46PM -0500, Mike Frysinger wrote:
> > On Tue, Feb 14, 2023 at 3:08 PM Tom Rini  wrote:
> >> Downloading things from the internet and putting them in to the default
> >> PATH always and forever is also kinda not great?
> >
> > you just described a standard distribution.  this is like literally
> > how all of them work.  not to mention every other language-specific
> > distro tool out there (e.g. Python pip, Perl cpan, Go, etc...).
> >
> > maybe you'd like more guarantees on top (e.g. signature verification)
> > which is reasonable.
> >
> > but to be clear, this script is already merged & in the tree, so your
> > feedback doesn't block this patch.
> 
>  Yes, exactly. This is a fix on top of what we do today, so it should go
>  in. But modern distributions only install signed packages, and
>  language-specific tools tend to be a hive of bad examples. Looking over
>  binman right now, I see that we're either using apt (and oh, there's
>  "aot" typo in one spot) or downloading from a known Google drive, for
>  only a few less common tools.
> 
>  So yes, I would like to see some ideas on how to improve things in the
>  future so we aren't putting the binaries somewhere that's not a default
>  (or frequently common) PATH location.
> >>>
> >>> Are you thinking they should go in ~/.binman-tools or something like
> >>> that? Then we would need to tell people to add it to their path. But
> >>> we could make binman look there automatically.
> >>
> >> We should document that it's where we're putting stuff, not so much
> >> "tell" them, unless you mean as a note when downloading.  But yes,
> >> ~/.binman-tools sounds reasonable.  Maybe a flag to point elsewhere?
> >
> > OK I will take a look.
> >
>
> I think this should be directly put into the output/build directory used
> by U-Boot, because what happens when you have two U-Boot git repos with
> different version requirements for those host tools? Then you need to
> make sure you're not building both at the same time, that you update
> them properly before each build, etc.

My advice: *Don't do that*

So far as binman is concerned, a tool is a tool. Tools should be
backwards compatible so updating to the new one should fix all the
problems.

The problem with using the output dir is we then have to download them
for each build, or cache them somewhere. To my mind, the 'binman tool'
feature is a convenience to reduce the pain involved in obtaining
tools needed to build. It is a not a panacea for strange situations.

>
> We also have an issue with buildman creating (image) temporary files in
> the current git repo which makes people unhappy because they then get a
> dirty tree because we tend to forget to update the .gitignore. What
> about building out-of-tree by default like Buildroot does? e.g. with
> make O=$PWD/output/ ?

I don't tend to use in-tree builds, but, yes, this is a problem.

I believe the best solution is, I think, to make binman put its
intermediate files in a subdir. At present there is no distinction
between output files and files produced along the way for debugging
purposes. This has been on my mind for a while and has been discussed
at least once before, too.

We do want the output files to be in the build directory. It would be
annoying to put u-boot.itb in a subdir.

Binman should all track all the files it produced (both final output
and intermediate) so that info is available.

For now, the solution is to use 'make O=xxx' as you say. With that,
binman should not write anything to the current dir. If it does, that
is a bug.

Regards,
Simon


Re: [PATCH v3 9/9] video console: add 12x22 console simple font test

2023-02-17 Thread Simon Glass
Hi Dzmitry,

On Fri, 17 Feb 2023 at 07:13, Dzmitry Sankouski  wrote:
>
> How does CONSOLE_TRUETYPE interfere with CONFIG_VIDEO_FONT_SUN12X22?
>

I don't mean that.

I tried resyncing the sandbox defconfig, and found that the defconfig
additions in this patch went away, meaning they are not used.

I think I know what is needed:

vidconsole_get_font_size()
 - implement this in vidconsole-uclass.c by calling the method for the
driver. See how this is done with vidconsole_putc_xy(), for example.
You can see this problem if you enable CMD_SELECT_FONT but don't
enable CONSOLE_TRUETYPE

config CMD_SELECT_FONT
- the 'bool' needs to be indented with a tab. I think it is is being
ignored with Kconfig which is why it doesn't work

resync configs with 'make savedefconfig'
- patches should have the CONFIG options (in defconfigs) in the
correct order, and this is how you check it.

>
> I've got all video tests passed:
>
> make sandbox_defconfig && make -j4 && ./u-boot -T -c 'ut dm'
> (...)
> Test: dm_test_video_ansi: video.c
> Test: dm_test_video_base: video.c
> Test: dm_test_video_base: video.c (flat tree)
> Test: dm_test_video_bmp: video.c
> Test: dm_test_video_bmp16: video.c
> Test: dm_test_video_bmp24: video.c
> Test: dm_test_video_bmp24_32: video.c
> Test: dm_test_video_bmp32: video.c
> Test: dm_test_video_bmp8: video.c
> Test: dm_test_video_bmp_comp: video.c
> Test: dm_test_video_chars: video.c
> Test: dm_test_video_comp_bmp32: video.c
> Test: dm_test_video_comp_bmp8: video.c
> Test: dm_test_video_context: video.c
> Test: dm_test_video_rotation1: video.c
> Test: dm_test_video_rotation2: video.c
> Test: dm_test_video_rotation3: video.c
> Test: dm_test_video_text: video.c
> Test: dm_test_video_text_12x22: video.c
> Test: dm_test_video_truetype: video.c
> Test: dm_test_video_truetype_bs: video.c
> Test: dm_test_video_truetype_scroll: video.c
> Test: dm_test_virtio_all_ops: virtio_device.c
> Test: dm_test_virtio_all_ops: virtio_device.c (flat tree)
> Test: dm_test_virtio_base: virtio_device.c
> (...)
>

Yes, as you say, the tests pass and look good. I think my problem was
the above issues.

Regards,
Simon




> чт, 16 февр. 2023 г. в 02:50, Simon Glass :
> >
> > Hi Dzmitry,
> >
> > On Wed, 15 Feb 2023 at 04:43, Dzmitry Sankouski  
> > wrote:
> > >
> > > Tests fonts wider than a byte.
> > >
> > > Signed-off-by: Dzmitry Sankouski 
> > > Reviewed-by: Simon Glass 
> >
> > I found a problem with this
> >
> > > ---
> > > Changes for v2: N/A
> > > Changes for v2: none
> > >
> > >  configs/sandbox_defconfig |  3 +++
> > >  test/dm/video.c   | 41 +++
> > >  2 files changed, 44 insertions(+)
> > >
> > > diff --git a/configs/sandbox_defconfig b/configs/sandbox_defconfig
> > > index 34c342b6f5..625ca35f5c 100644
> > > --- a/configs/sandbox_defconfig
> > > +++ b/configs/sandbox_defconfig
> > > @@ -337,3 +337,6 @@ CONFIG_TEST_FDTDEC=y
> > >  CONFIG_UNIT_TEST=y
> > >  CONFIG_UT_TIME=y
> > >  CONFIG_UT_DM=y
> > > +CONFIG_CMD_SELECT_FONT=y
> > > +CONFIG_VIDEO_FONT_8X16=y
> > > +CONFIG_VIDEO_FONT_SUN12X22=y
> >
> > I don't think you can enable this, since sandbox uses
> > CONSOLE_TRUETYPE. Can we perhaps use sandbox_flattree to run this
> > test?
> >
> > Also, for me the tests crash with signal 8 (I think).
> >
> > > diff --git a/test/dm/video.c b/test/dm/video.c
> > > index 17a33cc7af..30778157d9 100644
> > > --- a/test/dm/video.c
> > > +++ b/test/dm/video.c
> > > @@ -151,6 +151,8 @@ static int dm_test_video_text(struct unit_test_state 
> > > *uts)
> > >
> > > ut_assertok(select_vidconsole(uts, "vidconsole0"));
> > > ut_assertok(video_get_nologo(uts, ));
> > > +   ut_assertok(uclass_get_device(UCLASS_VIDEO_CONSOLE, 0, ));
> > > +   ut_assertok(vidconsole_select_font(con, "8x16", 0));
> > > ut_asserteq(46, compress_frame_buffer(uts, dev));
> > >
> > > ut_assertok(uclass_get_device(UCLASS_VIDEO_CONSOLE, 0, ));
> > > @@ -175,6 +177,42 @@ static int dm_test_video_text(struct unit_test_state 
> > > *uts)
> > >  }
> > >  DM_TEST(dm_test_video_text, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT);
> > >
> > > +static int dm_test_video_text_12x22(struct unit_test_state *uts)
> > > +{
> > > +   struct udevice *dev, *con;
> > > +   int i;
> > > +
> > > +#define WHITE  0x
> > > +#define SCROLL_LINES   100
> > > +
> > > +   ut_assertok(select_vidconsole(uts, "vidconsole0"));
> > > +   ut_assertok(video_get_nologo(uts, ));
> > > +   ut_assertok(uclass_get_device(UCLASS_VIDEO_CONSOLE, 0, ));
> > > +   ut_assertok(vidconsole_select_font(con, "12x22", 0));
> > > +   ut_asserteq(46, compress_frame_buffer(uts, dev));
> > > +
> > > +   ut_assertok(uclass_get_device(UCLASS_VIDEO_CONSOLE, 0, ));
> > > +   vidconsole_putc_xy(con, 0, 0, 'a');
> > > +   ut_asserteq(89, compress_frame_buffer(uts, dev));
> > > +
> > > +   vidconsole_putc_xy(con, 0, 0, ' ');
> > > +   ut_asserteq(46, compress_frame_buffer(uts, dev));
> > > +

Re: [PATCH 13/13] common: Make ARCH_MISC_INIT be selected only

2023-02-17 Thread Simon Glass
On Wed, 15 Feb 2023 at 20:39, Tom Rini  wrote:
>
> As platforms which require this hook need this hook enabled, in order to
> function, or do not need this hook, it doesn't make sense to prompt the
> user. As all platforms that need this hook now select the symbol, remove
> the prompt text.
>
> Signed-off-by: Tom Rini 
> ---
>  common/Kconfig | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>

Reviewed-by: Simon Glass 


Re: [PATCH v2] riscv: binman: Add help message for missing blobs

2023-02-17 Thread Simon Glass
On Fri, 17 Feb 2023 at 03:25, Yu-Chien Peter Lin  wrote:
>
> On Fri, Feb 17, 2023 at 04:57:01PM +0800, Rick Chen wrote:
> > Add the 'missing-msg' for more detailed output
> > on missing system firmware.
> >
> > Signed-off-by: Rick Chen 
> > Reviewed-by: Leo Yu-Chi Liang 
>
> Reviewed-by: Yu Chien Peter Lin 
>
> > ---
> > Changes in v2
> >  - Add more descriptions about fw_dynamic.bin
> > ---
> >  arch/riscv/dts/binman.dtsi | 1 +
> >  tools/binman/missing-blob-help | 6 ++
> >  2 files changed, 7 insertions(+)
> >

Reviewed-by: Simon Glass 

Thanks


Re: [PATCH v4 1/1] video console: refactoring and optimization

2023-02-17 Thread Simon Glass
Hi Dzmitry,

On Fri, 17 Feb 2023 at 08:01, Dzmitry Sankouski  wrote:
>
> - move common code to vidconsole_internal.h
> - unite probe functions
> - get rid of code duplications in switch across bpp values
> - extract common pixel fill logic in two functions one per
> horizontal and vertical filling
> - rearrange statements in put_xy* methods in unified way
> - replace types - uint*_t to u*
>
> Signed-off-by: Dzmitry Sankouski 
> ---
> Changes for v2: none
> Changes for v3: none
> Changes for v4:
> - move common code to vidconsole_internal.h
> - unite probe functions
>
>  drivers/video/console_normal.c  | 150 +++-
>  drivers/video/console_rotate.c  | 364 
>  drivers/video/vidconsole_internal.h | 148 +++
>  3 files changed, 288 insertions(+), 374 deletions(-)
>  create mode 100644 drivers/video/vidconsole_internal.h

Can you put the actual code from the shared functions in
vidconsole-uclass.c - that way it won't be compiled in twice into
those two files.



>
> diff --git a/drivers/video/console_normal.c b/drivers/video/console_normal.c
> index 04f022491e..57186bedd8 100644
> --- a/drivers/video/console_normal.c
> +++ b/drivers/video/console_normal.c
> @@ -1,10 +1,9 @@
>  // SPDX-License-Identifier: GPL-2.0+
>  /*
>   * Copyright (c) 2015 Google, Inc
> - * (C) Copyright 2001-2015
> - * DENX Software Engineering -- w...@denx.de
> - * Compulab Ltd - http://compulab.co.il/
> + * (C) Copyright 2015
>   * Bernecker & Rainer Industrieelektronik GmbH - http://www.br-automation.com
> + * (C) Copyright 2023 Dzmitry Sankouski 
>   */
>
>  #include 
> @@ -12,47 +11,28 @@
>  #include 
>  #include 
>  #include /* Get font data, width and height */
> +#include "vidconsole_internal.h"
>
> -static int console_normal_set_row(struct udevice *dev, uint row, int clr)
> +static int console_set_row(struct udevice *dev, uint row, int clr)
>  {
> struct video_priv *vid_priv = dev_get_uclass_priv(dev->parent);
> -   void *line, *end;
> +   void *line, *dst, *end;
> int pixels = VIDEO_FONT_HEIGHT * vid_priv->xsize;
> int ret;
> int i;
> +   int pbytes;
> +
> +   ret = check_bpix_support(vid_priv->bpix);
> +   if (ret)
> +   return ret;
>
> line = vid_priv->fb + row * VIDEO_FONT_HEIGHT * vid_priv->line_length;
> -   switch (vid_priv->bpix) {
> -   case VIDEO_BPP8:
> -   if (IS_ENABLED(CONFIG_VIDEO_BPP8)) {
> -   uint8_t *dst = line;
> -
> -   for (i = 0; i < pixels; i++)
> -   *dst++ = clr;
> -   end = dst;
> -   break;
> -   }
> -   case VIDEO_BPP16:
> -   if (IS_ENABLED(CONFIG_VIDEO_BPP16)) {
> -   uint16_t *dst = line;
> -
> -   for (i = 0; i < pixels; i++)
> -   *dst++ = clr;
> -   end = dst;
> -   break;
> -   }
> -   case VIDEO_BPP32:
> -   if (IS_ENABLED(CONFIG_VIDEO_BPP32)) {
> -   uint32_t *dst = line;
> -
> -   for (i = 0; i < pixels; i++)
> -   *dst++ = clr;
> -   end = dst;
> -   break;
> -   }
> -   default:
> -   return -ENOSYS;
> -   }
> +   dst = line;
> +   pbytes = VNBYTES(vid_priv->bpix);
> +   for (i = 0; i < pixels; i++)
> +   fill_pixel_and_goto_next(, clr, pbytes, pbytes);
> +   end = dst;
> +
> ret = vidconsole_sync_copy(dev, line, end);
> if (ret)
> return ret;
> @@ -60,8 +40,8 @@ static int console_normal_set_row(struct udevice *dev, uint 
> row, int clr)
> return 0;
>  }
>
> -static int console_normal_move_rows(struct udevice *dev, uint rowdst,
> -uint rowsrc, uint count)
> +static int console_move_rows(struct udevice *dev, uint rowdst,
> +uint rowsrc, uint count)
>  {
> struct video_priv *vid_priv = dev_get_uclass_priv(dev->parent);
> void *dst;
> @@ -79,70 +59,30 @@ static int console_normal_move_rows(struct udevice *dev, 
> uint rowdst,
> return 0;
>  }
>
> -static int console_normal_putc_xy(struct udevice *dev, uint x_frac, uint y,
> - char ch)
> +static int console_putc_xy(struct udevice *dev, uint x_frac, uint y, char ch)
>  {
> struct vidconsole_priv *vc_priv = dev_get_uclass_priv(dev);
> struct udevice *vid = dev->parent;
> struct video_priv *vid_priv = dev_get_uclass_priv(vid);
> -   int i, row;
> -   void *start;
> -   void *line;
> -   int ret;
> +   int pbytes = VNBYTES(vid_priv->bpix);
> +   int x, linenum, ret;
> +   void *start, *line;
> +   uchar *pfont = video_fontdata + (u8)ch * 

[PATCH 2/5] binman: Update bintools documentation

2023-02-17 Thread Simon Glass
This was not regenerated with recent changes. Update it.

Signed-off-by: Simon Glass 
---

 tools/binman/bintools.rst | 70 +++
 1 file changed, 70 insertions(+)

diff --git a/tools/binman/bintools.rst b/tools/binman/bintools.rst
index edb373ab59b..c30e7eb9ff5 100644
--- a/tools/binman/bintools.rst
+++ b/tools/binman/bintools.rst
@@ -10,6 +10,20 @@ binaries. It is fairly easy to create new bintools. Just add 
a new file to the
 
 
 
+Bintool: bzip2: Compression/decompression using the bzip2 algorithm
+---
+
+This bintool supports running `bzip2` to compress and decompress data, as
+used by binman.
+
+It is also possible to fetch the tool, which uses `apt` to install it.
+
+Documentation is available via::
+
+man bzip2
+
+
+
 Bintool: cbfstool: Coreboot filesystem (CBFS) tool
 --
 
@@ -58,6 +72,20 @@ See `Chromium OS vboot documentation`_ for more information.
 
 
 
+Bintool: gzip: Compression/decompression using the gzip algorithm
+-
+
+This bintool supports running `gzip` to compress and decompress data, as
+used by binman.
+
+It is also possible to fetch the tool, which uses `apt` to install it.
+
+Documentation is available via::
+
+man gzip
+
+
+
 Bintool: ifwitool: Handles the 'ifwitool' tool
 --
 
@@ -101,6 +129,20 @@ Documentation is available via::
 
 
 
+Bintool: lzop: Compression/decompression using the lzop algorithm
+-
+
+This bintool supports running `lzop` to compress and decompress data, as
+used by binman.
+
+It is also possible to fetch the tool, which uses `apt` to install it.
+
+Documentation is available via::
+
+man lzop
+
+
+
 Bintool: mkimage: Image generation for U-Boot
 -
 
@@ -113,3 +155,31 @@ Support is provided for fetching this on Debian-like 
systems, using apt.
 
 
 
+Bintool: xz: Compression/decompression using the xz algorithm
+-
+
+This bintool supports running `xz` to compress and decompress data, as
+used by binman.
+
+It is also possible to fetch the tool, which uses `apt` to install it.
+
+Documentation is available via::
+
+man xz
+
+
+
+Bintool: zstd: Compression/decompression using the zstd algorithm
+-
+
+This bintool supports running `zstd` to compress and decompress data, as
+used by binman.
+
+It is also possible to fetch the tool, which uses `apt` to install it.
+
+Documentation is available via::
+
+man zstd
+
+
+
-- 
2.39.2.637.g21b0678d19-goog



[PATCH 5/5] binman: Make the tooldir configurable

2023-02-17 Thread Simon Glass
Add a command-line argument for setting the tooldir, so that the default
can be overridden. Add this directory to the toolpath automatically.
Create the directory if it does not already exist.

Put the default in the argument parser instead of the class, so that it
is more obvious.

Update a few tests that expect the utility name to be provided without
any path (e.g. 'futility'), so they can accept a path, e.g.
/path/to/futility

Update the documentation and add a few tests.

Improve the help for --toolpath while we are here.

Signed-off-by: Simon Glass 
---

 tools/binman/binman.rst  | 19 +++
 tools/binman/bintool.py  |  8 +++-
 tools/binman/bintool_test.py | 11 ---
 tools/binman/cmdline.py  |  6 +-
 tools/binman/control.py  | 10 --
 tools/binman/ftest.py| 21 +++--
 6 files changed, 62 insertions(+), 13 deletions(-)

diff --git a/tools/binman/binman.rst b/tools/binman/binman.rst
index 29034da92f1..3b0a9c38d72 100644
--- a/tools/binman/binman.rst
+++ b/tools/binman/binman.rst
@@ -1407,7 +1407,15 @@ You can also use `--fetch all` to fetch all tools or 
`--fetch ` to fetch
 a particular tool. Some tools are built from source code, in which case you 
will
 need to have at least the `build-essential` and `git` packages installed.
 
-Tools are fetched into the `~/.binman-tools` directory.
+Tools are fetched into the `~/.binman-tools` directory. This directory is
+automatically added to the toolpath so there is no need to use `--toolpath` to
+specify it. If you want to use these tools outside binman, you may want to
+add this directory to your `PATH`. For example, if you use bash, add this to
+the end of `.bashrc`::
+
+   PATH="$HOME/.binman-tools:$PATH"
+
+To select a custom directory, use the `--tooldir` option.
 
 Bintool Documentation
 =
@@ -1427,8 +1435,9 @@ Binman commands and arguments
 
 Usage::
 
-binman [-h] [-B BUILD_DIR] [-D] [-H] [--toolpath TOOLPATH] [-T THREADS]
-[--test-section-timeout] [-v VERBOSITY] [-V]
+binman [-h] [-B BUILD_DIR] [-D] [--tooldir TOOLDIR] [-H]
+[--toolpath TOOLPATH] [-T THREADS] [--test-section-timeout]
+[-v VERBOSITY] [-V]
 {build,bintool-docs,entry-docs,ls,extract,replace,test,tool} ...
 
 Binman provides the following commands:
@@ -1453,11 +1462,13 @@ Options:
 -D, --debug
 Enabling debugging (provides a full traceback on error)
 
+--tooldir TOOLDIR Set the directory to store tools
+
 -H, --full-help
 Display the README file
 
 --toolpath TOOLPATH
-Add a path to the directories containing tools
+Add a path to the list of directories containing tools
 
 -T THREADS, --threads THREADS
 Number of threads to use (0=single-thread). Note that -T0 is useful for
diff --git a/tools/binman/bintool.py b/tools/binman/bintool.py
index 6ca3d886200..bd6555a0aac 100644
--- a/tools/binman/bintool.py
+++ b/tools/binman/bintool.py
@@ -52,7 +52,7 @@ class Bintool:
 missing_list = []
 
 # Directory to store tools
-tooldir = os.path.join(os.getenv('HOME'), '.binman-tools')
+tooldir = None
 
 def __init__(self, name, desc, version_regex=None, version_args='-V'):
 self.name = name
@@ -113,6 +113,10 @@ class Bintool:
 obj = cls(name)
 return obj
 
+@classmethod
+def set_tool_dir(cls, pathname):
+cls.tooldir = pathname
+
 def show(self):
 """Show a line of information about a bintool"""
 if self.is_present():
@@ -210,6 +214,8 @@ class Bintool:
 if result is not True:
 fname, tmpdir = result
 dest = os.path.join(self.tooldir, self.name)
+if not os.path.exists(self.tooldir):
+os.makedirs(self.tooldir)
 print(f"- writing to '{dest}'")
 shutil.move(fname, dest)
 if tmpdir:
diff --git a/tools/binman/bintool_test.py b/tools/binman/bintool_test.py
index 57e866eff93..39e4fb13e92 100644
--- a/tools/binman/bintool_test.py
+++ b/tools/binman/bintool_test.py
@@ -134,8 +134,10 @@ class TestBintool(unittest.TestCase):
 dirname = os.path.join(self._indir, 'download_dir')
 os.mkdir(dirname)
 fname = os.path.join(dirname, 'downloaded')
+
+# Rely on bintool to create this directory
 destdir = os.path.join(self._indir, 'dest_dir')
-os.mkdir(destdir)
+
 dest_fname = os.path.join(destdir, '_testing')
 self.seq = 0
 
@@ -344,8 +346,11 @@ class TestBintool(unittest.TestCase):
 
 def test_failed_command(self):
 """Check that running a command that does not exist returns None"""
-btool = Bintool.create('_testing')
-result = btool.run_cmd_result('fred')
+destdir = os.path.join(self._indir, 'dest_dir')
+os.mkdir(destdir)
+with unittest.mock.patch.object(bintool.Bintool, 'tooldir', destdir):
+btool = Bintool.create('_testing')
+result = 

[PATCH 3/5] binman: Move the tools directory into the Bintool class

2023-02-17 Thread Simon Glass
We want to be able to change this directory. Use a class member to hold
the value, since changing a constant is not good.

Signed-off-by: Simon Glass 
---

 tools/binman/bintool.py  | 7 ---
 tools/binman/bintool_test.py | 4 ++--
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/tools/binman/bintool.py b/tools/binman/bintool.py
index e1dff9aa1b5..302161fcb47 100644
--- a/tools/binman/bintool.py
+++ b/tools/binman/bintool.py
@@ -43,8 +43,6 @@ FETCH_NAMES = {
 # Status of tool fetching
 FETCHED, FAIL, PRESENT, STATUS_COUNT = range(4)
 
-DOWNLOAD_DESTDIR = os.path.join(os.getenv('HOME'), 'bin')
-
 class Bintool:
 """Tool which operates on binaries to help produce entry contents
 
@@ -53,6 +51,9 @@ class Bintool:
 # List of bintools to regard as missing
 missing_list = []
 
+# Directory to store tools
+tooldir = os.path.join(os.getenv('HOME'), 'bin')
+
 def __init__(self, name, desc, version_regex=None, version_args='-V'):
 self.name = name
 self.desc = desc
@@ -208,7 +209,7 @@ class Bintool:
 return FAIL
 if result is not True:
 fname, tmpdir = result
-dest = os.path.join(DOWNLOAD_DESTDIR, self.name)
+dest = os.path.join(self.tooldir, self.name)
 print(f"- writing to '{dest}'")
 shutil.move(fname, dest)
 if tmpdir:
diff --git a/tools/binman/bintool_test.py b/tools/binman/bintool_test.py
index 7efb8391db2..57e866eff93 100644
--- a/tools/binman/bintool_test.py
+++ b/tools/binman/bintool_test.py
@@ -139,7 +139,7 @@ class TestBintool(unittest.TestCase):
 dest_fname = os.path.join(destdir, '_testing')
 self.seq = 0
 
-with unittest.mock.patch.object(bintool, 'DOWNLOAD_DESTDIR', destdir):
+with unittest.mock.patch.object(bintool.Bintool, 'tooldir', destdir):
 with unittest.mock.patch.object(tools, 'download',
 side_effect=handle_download):
 with test_util.capture_sys_output() as (stdout, _):
@@ -250,7 +250,7 @@ class TestBintool(unittest.TestCase):
 btest = Bintool.create('_testing')
 col = terminal.Color()
 self.fname = None
-with unittest.mock.patch.object(bintool, 'DOWNLOAD_DESTDIR',
+with unittest.mock.patch.object(bintool.Bintool, 'tooldir',
 self._indir):
 with unittest.mock.patch.object(tools, 'run', 
side_effect=fake_run):
 with test_util.capture_sys_output() as (stdout, _):
-- 
2.39.2.637.g21b0678d19-goog



[PATCH 4/5] binman: Use a private directory for bintools

2023-02-17 Thread Simon Glass
At present binman writes tools into the ~/bin directory. This is
convenient but some may be concerned about downloading unverified
binaries and running them. Place then in a special ~/.binman-tools
directory instead.

Mention this in the documentation.

Signed-off-by: Simon Glass 
---

 tools/binman/binman.rst | 2 ++
 tools/binman/bintool.py | 2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/tools/binman/binman.rst b/tools/binman/binman.rst
index 2bcb7d3886f..29034da92f1 100644
--- a/tools/binman/binman.rst
+++ b/tools/binman/binman.rst
@@ -1407,6 +1407,8 @@ You can also use `--fetch all` to fetch all tools or 
`--fetch ` to fetch
 a particular tool. Some tools are built from source code, in which case you 
will
 need to have at least the `build-essential` and `git` packages installed.
 
+Tools are fetched into the `~/.binman-tools` directory.
+
 Bintool Documentation
 =
 
diff --git a/tools/binman/bintool.py b/tools/binman/bintool.py
index 302161fcb47..6ca3d886200 100644
--- a/tools/binman/bintool.py
+++ b/tools/binman/bintool.py
@@ -52,7 +52,7 @@ class Bintool:
 missing_list = []
 
 # Directory to store tools
-tooldir = os.path.join(os.getenv('HOME'), 'bin')
+tooldir = os.path.join(os.getenv('HOME'), '.binman-tools')
 
 def __init__(self, name, desc, version_regex=None, version_args='-V'):
 self.name = name
-- 
2.39.2.637.g21b0678d19-goog



[PATCH 1/5] binman: Correct an 'aot' typo

2023-02-17 Thread Simon Glass
Fix this typo.

Signed-off-by: Simon Glass 
---

 tools/binman/bintool.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/binman/bintool.py b/tools/binman/bintool.py
index 8fda13ff012..e1dff9aa1b5 100644
--- a/tools/binman/bintool.py
+++ b/tools/binman/bintool.py
@@ -389,7 +389,7 @@ class Bintool:
 
 @classmethod
 def apt_install(cls, package):
-"""Install a bintool using the 'aot' tool
+"""Install a bintool using the 'apt' tool
 
 This requires use of servo so may request a password
 
-- 
2.39.2.637.g21b0678d19-goog



[PATCH 0/5] binman: Tidy up the location for bintools

2023-02-17 Thread Simon Glass
This series makes the directory used for downloaded bintools
configurable and changes the default to something that is unlikely to be
unintentionally on the user's path. See [1] for discussion relating to
this.

[1] 
https://patchwork.ozlabs.org/project/uboot/patch/20230210135941.1.I81a5b410c8645752b44ba7afa2c4406f7c80f3d2@changeid/


Simon Glass (5):
  binman: Correct an 'aot' typo
  binman: Update bintools documentation
  binman: Move the tools directory into the Bintool class
  binman: Use a private directory for bintools
  binman: Make the tooldir configurable

 tools/binman/binman.rst  | 19 --
 tools/binman/bintool.py  | 15 +---
 tools/binman/bintool_test.py | 15 +---
 tools/binman/bintools.rst| 70 
 tools/binman/cmdline.py  |  6 +++-
 tools/binman/control.py  | 10 --
 tools/binman/ftest.py| 21 +--
 7 files changed, 139 insertions(+), 17 deletions(-)

-- 
2.39.2.637.g21b0678d19-goog



[PATCH] sandbox: video: Fix building without SDL

2023-02-17 Thread Simon Glass
This is currently broken. If SDL is not installed, SANDBOX_SDL becomes
false and build errors are generated, e.g.:

   test/dm/video.c:424: undefined reference to `sandbox_sdl_set_bpp'

Fix it by making the function return an error in this case.

Signed-off-by: Simon Glass 
---

 arch/sandbox/include/asm/test.h | 8 
 1 file changed, 8 insertions(+)

diff --git a/arch/sandbox/include/asm/test.h b/arch/sandbox/include/asm/test.h
index 4853dc948f3..e482271fe97 100644
--- a/arch/sandbox/include/asm/test.h
+++ b/arch/sandbox/include/asm/test.h
@@ -300,6 +300,7 @@ void sandbox_cros_ec_set_test_flags(struct udevice *dev, 
uint flags);
  */
 int sandbox_cros_ec_get_pwm_duty(struct udevice *dev, uint index, uint *duty);
 
+#if IS_ENABLED(CONFIG_SANDBOX_SDL)
 /**
  * sandbox_sdl_set_bpp() - Set the depth of the sandbox display
  *
@@ -315,6 +316,13 @@ int sandbox_cros_ec_get_pwm_duty(struct udevice *dev, uint 
index, uint *duty);
  * after the change
  */
 int sandbox_sdl_set_bpp(struct udevice *dev, enum video_log2_bpp l2bpp);
+#else
+static inline int sandbox_sdl_set_bpp(struct udevice *dev,
+ enum video_log2_bpp l2bpp)
+{
+   return -ENOSYS;
+}
+#endif
 
 /**
  * sandbox_set_fake_efi_mgr_dev() - Control EFI bootmgr producing valid 
bootflow
-- 
2.39.2.637.g21b0678d19-goog



[PATCH] trace: Relax test requirements

2023-02-17 Thread Simon Glass
We expect the profile and bootstage to agree on timing, but when
running on slow machines there can be a larger descrepency. Increase the
tolerance to fix this.

Fixes: 9cea4797aeb ("trace: Add a test")
Signed-off-by: Simon Glass 
---

 test/py/tests/test_trace.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/test/py/tests/test_trace.py b/test/py/tests/test_trace.py
index 14584d11a23..ac3e95925e9 100644
--- a/test/py/tests/test_trace.py
+++ b/test/py/tests/test_trace.py
@@ -299,6 +299,7 @@ def test_trace(u_boot_console):
 
 fg_time = check_flamegraph(cons, fname, proftool, map_fname, trace_fg)
 
-# Check that bootstage and flamegraph agree to within 10%
+# Check that bootstage and flamegraph agree to within 30%
+# This allows for CI being slow to run
 diff = abs(fg_time - dm_f_time)
-assert diff / dm_f_time < 0.1
+assert diff / dm_f_time < 0.3
-- 
2.39.2.637.g21b0678d19-goog



[PATCH v3 5/5] rockchip: evb-rk3568: Update defconfig

2023-02-17 Thread Jonas Karlman
Update defconfig for evb-rk3568 with new defaults.

Remove the SPL_ROCKCHIP_BACK_TO_BROM=y option, SPL is expected to load
next stage from a FIT image and then jump to next stage not back to
BootRom.

Add CONFIG_SPL_FIT_SIGNATURE=y to let SPL verify an auto generated hash
of FIT images. This help indicate if there is an issue loading any of
the images to DRAM or SRAM.

Extend SPL_MAX_SIZE to 0x4, SPL is loaded to 0x0 and TF-A is loaded
to 0x4, use the space in between as SPL_MAX_SIZE.

Add CONFIG_SPL_ATF_NO_PLATFORM_PARAM=y to prevent vendor TF-A from
crashing in some cases when fdt_addr is provided as platform param.

Filter out assigned-clock props with CONFIG_OF_SPL_REMOVE_PROPS,
U-Boot proper will read and configure assigned-clock props.

Signed-off-by: Jonas Karlman 
---
v3:
- Rebased on resynced savedefconfigs

v2:
- New patch

 configs/evb-rk3568_defconfig | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/configs/evb-rk3568_defconfig b/configs/evb-rk3568_defconfig
index 0f72925b3a32..9c380aa5fe3d 100644
--- a/configs/evb-rk3568_defconfig
+++ b/configs/evb-rk3568_defconfig
@@ -11,9 +11,7 @@ CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0xc0
 CONFIG_DEFAULT_DEVICE_TREE="rk3568-evb"
 CONFIG_DM_RESET=y
 CONFIG_ROCKCHIP_RK3568=y
-CONFIG_SPL_ROCKCHIP_BACK_TO_BROM=y
 CONFIG_SPL_ROCKCHIP_COMMON_BOARD=y
-CONFIG_SPL_MMC=y
 CONFIG_SPL_SERIAL=y
 CONFIG_SPL_STACK_R_ADDR=0x60
 CONFIG_TARGET_EVB_RK3568=y
@@ -24,11 +22,12 @@ CONFIG_SYS_LOAD_ADDR=0xc00800
 CONFIG_DEBUG_UART=y
 CONFIG_FIT=y
 CONFIG_FIT_VERBOSE=y
+CONFIG_SPL_FIT_SIGNATURE=y
 CONFIG_SPL_LOAD_FIT=y
 CONFIG_DEFAULT_FDT_FILE="rockchip/rk3568-evb.dtb"
 # CONFIG_DISPLAY_CPUINFO is not set
 CONFIG_DISPLAY_BOARDINFO_LATE=y
-CONFIG_SPL_MAX_SIZE=0x2
+CONFIG_SPL_MAX_SIZE=0x4
 CONFIG_SPL_PAD_TO=0x7f8000
 CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
 CONFIG_SPL_BSS_START_ADDR=0x400
@@ -37,12 +36,14 @@ CONFIG_SPL_BSS_MAX_SIZE=0x4000
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
 CONFIG_SPL_STACK_R=y
 CONFIG_SPL_ATF=y
+CONFIG_SPL_ATF_NO_PLATFORM_PARAM=y
 CONFIG_CMD_GPT=y
 CONFIG_CMD_MMC=y
 # CONFIG_CMD_SETEXPR is not set
 # CONFIG_SPL_DOS_PARTITION is not set
 CONFIG_SPL_OF_CONTROL=y
 CONFIG_OF_LIVE=y
+CONFIG_OF_SPL_REMOVE_PROPS="pinctrl-0 pinctrl-names clock-names 
interrupt-parent assigned-clocks assigned-clock-rates assigned-clock-parents"
 CONFIG_NET_RANDOM_ETHADDR=y
 CONFIG_SPL_REGMAP=y
 CONFIG_SPL_SYSCON=y
-- 
2.39.1



[PATCH v3 2/5] rockchip: Use an external TPL binary on RK3568

2023-02-17 Thread Jonas Karlman
Rockchip SoCs typically use U-Boot TPL to initialize DRAM, then jumps
back to BootRom to load next stage, U-Boot SPL, into DRAM. BootRom then
jumps to U-Boot SPL to continue the normal boot flow.

However, there is no support to initialize DRAM on RK35xx SoCs using
U-Boot TPL and instead an external TPL binary must be used to generate a
bootable u-boot-rockchip.bin image.

Add CONFIG_ROCKCHIP_EXTERNAL_TPL to indicate that an external TPL should
be used. Build U-Boot with ROCKCHIP_TPL=/path/to/ddr.bin to generate a
bootable u-boot-rockchip.bin image for RK3568.

Signed-off-by: Jonas Karlman 
Reviewed-by: Simon Glass 
Reviewed-by: Kever Yang 
Tested-by: Eugen Hristev 
---
v3:
- Add help text to Kconfig option
- Add build step for rk3568 to documentation
- Collect r-b and t-b tags

v2:
- Rename external-tpl-path to rockchip-tpl-path
- Rename EXTERNAL_TPL to ROCKCHIP_TPL
- Add CONFIG_ROCKCHIP_EXTERNAL_TPL option

 Makefile  |  1 +
 arch/arm/dts/rockchip-u-boot.dtsi | 10 --
 arch/arm/mach-rockchip/Kconfig|  8 
 doc/board/rockchip/rockchip.rst   | 11 +++
 4 files changed, 28 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index 54f894dab841..58f8c7a35335 100644
--- a/Makefile
+++ b/Makefile
@@ -1335,6 +1335,7 @@ cmd_binman = $(srctree)/tools/binman/binman $(if 
$(BINMAN_DEBUG),-D) \
-a opensbi-path=${OPENSBI} \
-a default-dt=$(default_dt) \
-a scp-path=$(SCP) \
+   -a rockchip-tpl-path=$(ROCKCHIP_TPL) \
-a spl-bss-pad=$(if $(CONFIG_SPL_SEPARATE_BSS),,1) \
-a tpl-bss-pad=$(if $(CONFIG_TPL_SEPARATE_BSS),,1) \
-a spl-dtb=$(CONFIG_SPL_OF_REAL) \
diff --git a/arch/arm/dts/rockchip-u-boot.dtsi 
b/arch/arm/dts/rockchip-u-boot.dtsi
index 6c662a72d4f9..2878b80926c4 100644
--- a/arch/arm/dts/rockchip-u-boot.dtsi
+++ b/arch/arm/dts/rockchip-u-boot.dtsi
@@ -20,9 +20,12 @@
mkimage {
filename = "idbloader.img";
args = "-n", CONFIG_SYS_SOC, "-T", "rksd";
-#ifdef CONFIG_TPL
multiple-data-files;
 
+#ifdef CONFIG_ROCKCHIP_EXTERNAL_TPL
+   rockchip-tpl {
+   };
+#elif defined(CONFIG_TPL)
u-boot-tpl {
};
 #endif
@@ -134,9 +137,12 @@
mkimage {
filename = "idbloader-spi.img";
args = "-n", CONFIG_SYS_SOC, "-T", "rkspi";
-#ifdef CONFIG_TPL
multiple-data-files;
 
+#ifdef CONFIG_ROCKCHIP_EXTERNAL_TPL
+   rockchip-tpl {
+   };
+#elif defined(CONFIG_TPL)
u-boot-tpl {
};
 #endif
diff --git a/arch/arm/mach-rockchip/Kconfig b/arch/arm/mach-rockchip/Kconfig
index b678ec41318e..0b191b364264 100644
--- a/arch/arm/mach-rockchip/Kconfig
+++ b/arch/arm/mach-rockchip/Kconfig
@@ -401,6 +401,14 @@ config TPL_ROCKCHIP_COMMON_BOARD
  common board is a basic TPL board init which can be shared for most
  of SoCs to avoid copy-paste for different SoCs.
 
+config ROCKCHIP_EXTERNAL_TPL
+   bool "Use external TPL binary"
+   default y if ROCKCHIP_RK3568
+   help
+ Some Rockchip SoCs require an external TPL to initialize DRAM.
+ Enable this option and build with ROCKCHIP_TPL=/path/to/ddr.bin to
+ include the external TPL in the image built by binman.
+
 config ROCKCHIP_BOOT_MODE_REG
hex "Rockchip boot mode flag register address"
help
diff --git a/doc/board/rockchip/rockchip.rst b/doc/board/rockchip/rockchip.rst
index 28c837a38200..ac4dcce1a77d 100644
--- a/doc/board/rockchip/rockchip.rst
+++ b/doc/board/rockchip/rockchip.rst
@@ -86,6 +86,8 @@ List of mainline supported Rockchip boards:
  - Radxa ROCK Pi 4 (rock-pi-4-rk3399)
  - Rockchip Evb-RK3399 (evb_rk3399)
  - Theobroma Systems RK3399-Q7 SoM - Puma (puma_rk3399)
+* rk3568
+ - Rockchip Evb-RK3568 (evb-rk3568)
 * rv1108
  - Rockchip Evb-rv1108 (evb-rv1108)
  - Elgin-R1 (elgin-rv1108)
@@ -167,6 +169,15 @@ To build rk3399 boards:
 make evb-rk3399_defconfig
 make CROSS_COMPILE=aarch64-linux-gnu-
 
+To build rk3568 boards:
+
+.. code-block:: bash
+
+export BL31=../rkbin/bin/rk35/rk3568_bl31_v1.34.elf
+export ROCKCHIP_TPL=../rkbin/bin/rk35/rk3568_ddr_1560MHz_v1.13.bin
+make evb-rk3568_defconfig
+make CROSS_COMPILE=aarch64-linux-gnu-
+
 Flashing
 
 
-- 
2.39.1



[PATCH v3 4/5] rockchip: mkimage: Update init size limit

2023-02-17 Thread Jonas Karlman
Sync init size limit from vendor u-boot:

 px30: 12KiB (+2KiB)
 rk3066: 32KiB (+2KiB)
 rk3328: 30KiB (+2KiB)
 rk3568: 60KiB (-16KiB)

This makes it possible to use latest vendor TPL with RK3328 without
getting a size limit error running the mkimage command.

Signed-off-by: Jonas Karlman 
---
v3:
- Sync with vendor u-boot as-is
- Update commit message to include size changes

v2:
- New patch

 tools/rkcommon.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/tools/rkcommon.c b/tools/rkcommon.c
index 1f1eaa16752b..630e54b1a54d 100644
--- a/tools/rkcommon.c
+++ b/tools/rkcommon.c
@@ -121,20 +121,20 @@ struct spl_info {
 };
 
 static struct spl_info spl_infos[] = {
-   { "px30", "RK33", 0x2800, false, RK_HEADER_V1 },
+   { "px30", "RK33", 0x4000 - 0x1000, false, RK_HEADER_V1 },
{ "rk3036", "RK30", 0x1000, false, RK_HEADER_V1 },
-   { "rk3066", "RK30", 0x8000 - 0x800, true, RK_HEADER_V1 },
-   { "rk3128", "RK31", 0x1800, false, RK_HEADER_V1 },
+   { "rk3066", "RK30", 0x8000, true, RK_HEADER_V1 },
+   { "rk3128", "RK31", 0x2000 - 0x800, false, RK_HEADER_V1 },
{ "rk3188", "RK31", 0x8000 - 0x800, true, RK_HEADER_V1 },
{ "rk322x", "RK32", 0x8000 - 0x1000, false, RK_HEADER_V1 },
{ "rk3288", "RK32", 0x8000, false, RK_HEADER_V1 },
{ "rk3308", "RK33", 0x4 - 0x1000, false, RK_HEADER_V1 },
-   { "rk3328", "RK32", 0x8000 - 0x1000, false, RK_HEADER_V1 },
+   { "rk3328", "RK32", 0x8000 - 0x800, false, RK_HEADER_V1 },
{ "rk3368", "RK33", 0x8000 - 0x1000, false, RK_HEADER_V1 },
{ "rk3399", "RK33", 0x3 - 0x2000, false, RK_HEADER_V1 },
{ "rv1108", "RK11", 0x1800, false, RK_HEADER_V1 },
{ "rv1126", "110B", 0x1 - 0x1000, false, RK_HEADER_V1 },
-   { "rk3568", "RK35", 0x14000 - 0x1000, false, RK_HEADER_V2 },
+   { "rk3568", "RK35", 0x1 - 0x1000, false, RK_HEADER_V2 },
 };
 
 /**
-- 
2.39.1



[PATCH v3 3/5] Revert "board: rockchip: Fix binman_init failure on EVB-RK3568"

2023-02-17 Thread Jonas Karlman
An external TPL binary is now expected to be provided using ROCKCHIP_TPL
when building RK3568 targets.

This reverts commit 31500e7bcfaca08ab7c2879f502a6cf852410244.

Signed-off-by: Jonas Karlman 
Reviewed-by: Simon Glass 
Reviewed-by: Kever Yang 
---
v3:
- Collect r-b tag

v2:
- Collect r-b tag

 configs/evb-rk3568_defconfig | 1 -
 1 file changed, 1 deletion(-)

diff --git a/configs/evb-rk3568_defconfig b/configs/evb-rk3568_defconfig
index c7e0e5a796f4..0f72925b3a32 100644
--- a/configs/evb-rk3568_defconfig
+++ b/configs/evb-rk3568_defconfig
@@ -65,5 +65,4 @@ CONFIG_BAUDRATE=150
 CONFIG_DEBUG_UART_SHIFT=2
 CONFIG_SYS_NS16550_MEM32=y
 CONFIG_SYSRESET=y
-# CONFIG_BINMAN_FDT is not set
 CONFIG_ERRNO_STR=y
-- 
2.39.1



[PATCH v3 1/5] binman: Add support for a rockchip-tpl entry

2023-02-17 Thread Jonas Karlman
The rockchip-tpl entry can be used when an external TPL binary should be
used instead of the normal U-Boot TPL.

Signed-off-by: Jonas Karlman 
Reviewed-by: Simon Glass 
Reviewed-by: Kever Yang 
Tested-by: Eugen Hristev 
---
v3:
- Move test function last
- Collect r-b and t-b tags

v2:
- Rename external-tpl to rockchip-tpl
- Missing message moved to this patch

 tools/binman/entries.rst   | 14 ++
 tools/binman/etype/rockchip_tpl.py | 20 
 tools/binman/ftest.py  |  7 +++
 tools/binman/missing-blob-help |  5 +
 tools/binman/test/277_rockchip_tpl.dts | 16 
 5 files changed, 62 insertions(+)
 create mode 100644 tools/binman/etype/rockchip_tpl.py
 create mode 100644 tools/binman/test/277_rockchip_tpl.dts

diff --git a/tools/binman/entries.rst b/tools/binman/entries.rst
index 7a04a613992d..e177860a6a82 100644
--- a/tools/binman/entries.rst
+++ b/tools/binman/entries.rst
@@ -1386,6 +1386,20 @@ For example, this creates an image with a pre-load 
header and a binary::
 
 
 
+.. _etype_rockchip_tpl:
+
+Entry: rockchip-tpl: Rockchip TPL binary
+
+
+Properties / Entry arguments:
+- rockchip-tpl-path: Filename of file to read into the entry,
+ typically _ddr_.bin
+
+This entry holds an external TPL binary used by some Rockchip SoCs
+instead of normal U-Boot TPL, typically to initialize DRAM.
+
+
+
 .. _etype_scp:
 
 Entry: scp: System Control Processor (SCP) firmware blob
diff --git a/tools/binman/etype/rockchip_tpl.py 
b/tools/binman/etype/rockchip_tpl.py
new file mode 100644
index ..74f58ba8570c
--- /dev/null
+++ b/tools/binman/etype/rockchip_tpl.py
@@ -0,0 +1,20 @@
+# SPDX-License-Identifier: GPL-2.0+
+#
+# Entry-type module for Rockchip TPL binary
+#
+
+from binman.etype.blob_named_by_arg import Entry_blob_named_by_arg
+
+class Entry_rockchip_tpl(Entry_blob_named_by_arg):
+"""Rockchip TPL binary
+
+Properties / Entry arguments:
+- rockchip-tpl-path: Filename of file to read into the entry,
+ typically _ddr_.bin
+
+This entry holds an external TPL binary used by some Rockchip SoCs
+instead of normal U-Boot TPL, typically to initialize DRAM.
+"""
+def __init__(self, section, etype, node):
+super().__init__(section, etype, node, 'rockchip-tpl')
+self.external = True
diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py
index 062f54adb0ed..48ac1540bfd8 100644
--- a/tools/binman/ftest.py
+++ b/tools/binman/ftest.py
@@ -90,6 +90,7 @@ TEE_OS_DATA   = b'this is some tee OS data'
 ATF_BL2U_DATA = b'bl2u'
 OPENSBI_DATA  = b'opensbi'
 SCP_DATA  = b'scp'
+ROCKCHIP_TPL_DATA = b'rockchip-tpl'
 TEST_FDT1_DATA= b'fdt1'
 TEST_FDT2_DATA= b'test-fdt2'
 ENV_DATA  = b'var1=1\nvar2="2"'
@@ -205,6 +206,7 @@ class TestFunctional(unittest.TestCase):
 TestFunctional._MakeInputFile('bl2u.bin', ATF_BL2U_DATA)
 TestFunctional._MakeInputFile('fw_dynamic.bin', OPENSBI_DATA)
 TestFunctional._MakeInputFile('scp.bin', SCP_DATA)
+TestFunctional._MakeInputFile('rockchip-tpl.bin', ROCKCHIP_TPL_DATA)
 
 # Add a few .dtb files for testing
 TestFunctional._MakeInputFile('%s/test-fdt1.dtb' % TEST_FDT_SUBDIR,
@@ -6386,6 +6388,11 @@ fdt fdtmapExtract the devicetree 
blob from the fdtmap
 self.assertEqual(['u-boot', 'atf-2'],
  fdt_util.GetStringList(node, 'loadables'))
 
+def testPackRockchipTpl(self):
+"""Test that an image with a Rockchip TPL binary can be created"""
+data = self._DoReadFile('277_rockchip_tpl.dts')
+self.assertEqual(ROCKCHIP_TPL_DATA, data[:len(ROCKCHIP_TPL_DATA)])
+
 
 if __name__ == "__main__":
 unittest.main()
diff --git a/tools/binman/missing-blob-help b/tools/binman/missing-blob-help
index 4448ac93112a..f3a44d08acce 100644
--- a/tools/binman/missing-blob-help
+++ b/tools/binman/missing-blob-help
@@ -34,6 +34,11 @@ If CONFIG_WDT_K3_RTI_LOAD_FW is enabled, a firmware image is 
needed for
 the R5F core(s) to trigger the system reset. One possible source is
 https://github.com/siemens/k3-rti-wdt.
 
+rockchip-tpl:
+An external TPL is required to initialize DRAM. Get the external TPL
+binary and build with ROCKCHIP_TPL=/path/to/ddr.bin. One possible source
+for the external TPL binary is https://github.com/rockchip-linux/rkbin.
+
 tee-os:
 See the documentation for your board. You may need to build Open Portable
 Trusted Execution Environment (OP-TEE) with TEE=/path/to/tee.bin
diff --git a/tools/binman/test/277_rockchip_tpl.dts 
b/tools/binman/test/277_rockchip_tpl.dts
new file mode 100644
index ..269f56e2545c
--- /dev/null
+++ b/tools/binman/test/277_rockchip_tpl.dts
@@ -0,0 +1,16 @@
+// SPDX-License-Identifier: GPL-2.0+
+
+/dts-v1/;
+
+/ {
+   #address-cells = <1>;
+

[PATCH v3 0/5] rockchip: Use external TPL binary to create a working firmware image

2023-02-17 Thread Jonas Karlman
Rockchip SoCs typically use U-Boot TPL to initialize DRAM, then jumps
back to BootRom to load next stage, U-Boot SPL, into DRAM. BootRom then
jumps to U-Boot SPL to continue the boot flow.

For RK356x there is no support to initialize DRAM using U-Boot
TPL and instead an external TPL binary must be used to generate a
bootable u-boot-rockchip.bin image.

This adds a new rockchip-tpl entry to binman and make use of this new
entry in rockchip-u-boot.dtsi.

Build U-Boot with ROCKCHIP_TPL=/path/to/ddr.bin to generate a
bootable u-boot-rockchip.bin image for RK356x.

I have dropped the RFC patch that was related to showing a friendly
message instead of a generic file not found message when TPL blob is
missing in v3. Will address that in a follow-up series.

The last patch that updates evb-rk3568_defconfig is strictly not needed,
it updates a few options that seemed relevant during testing.

Tested on RK3568 (ODROID-M1, ROCK 3A) and RK3566 (ROCK 3C, Quartz64)
boards using evb-rk3568_defconfig.

Changes in v3:
- Move test function last
- Add help text to Kconfig option
- Add build step for rk3568 to documentation
- Resync init size limit table
- Drop missing message RFC patch

Changes in v2:
- Renamed external-tpl to rockchip-tpl
- Renamed EXTERNAL_TPL to ROCKCHIP_TPL
- Add CONFIG_ROCKCHIP_EXTERNAL_TPL Kconfig option
- New patch to sync init size limit in mkimage
- New RFC patch to improve allow-missing/fake-ext-blobs handling for
  binman mkimage entry

Jonas Karlman (5):
  binman: Add support for a rockchip-tpl entry
  rockchip: Use an external TPL binary on RK3568
  Revert "board: rockchip: Fix binman_init failure on EVB-RK3568"
  rockchip: mkimage: Update init size limit
  rockchip: evb-rk3568: Update defconfig

 Makefile   |  1 +
 arch/arm/dts/rockchip-u-boot.dtsi  | 10 --
 arch/arm/mach-rockchip/Kconfig |  8 
 configs/evb-rk3568_defconfig   |  8 
 doc/board/rockchip/rockchip.rst| 11 +++
 tools/binman/entries.rst   | 14 ++
 tools/binman/etype/rockchip_tpl.py | 20 
 tools/binman/ftest.py  |  7 +++
 tools/binman/missing-blob-help |  5 +
 tools/binman/test/277_rockchip_tpl.dts | 16 
 tools/rkcommon.c   | 10 +-
 11 files changed, 99 insertions(+), 11 deletions(-)
 create mode 100644 tools/binman/etype/rockchip_tpl.py
 create mode 100644 tools/binman/test/277_rockchip_tpl.dts

-- 
2.39.1



Re: [PATCH v3 08/10] phy: socionext: Add UniPhier USB3 PHY driver

2023-02-17 Thread Marek Vasut

On 2/16/23 17:14, Kunihiko Hayashi wrote:

Hi Marek,


Hello Hayashi-san,


Sorry for late reply.

On 2023/02/14 6:06, Marek Vasut wrote:

On 2/13/23 04:08, Kunihiko Hayashi wrote:

Hi Marek,


Hello Hayashi-san,



[...]


I think so, however, when I added .exit() and executed "usb stop;usb
start",
unfortunately the command got stuck.

Currently uniphier clk doesn't support CLK_CCF and can't be nested.
I think more changes are needed.


Do you know where exactly the system hangs ?


Yes.

The controller-reset driver controls the clock/reset for the glue
in probe(). The phy driver controls the clock/reset for the glue and
the phy in init(). There is an inconsistency.

When submitting "usb stop", the phy driver disables all the clock/reset
in exit().

When submitting "usb start" again, the controller-reset driver accesses
the glue register without enabling the clock/reset, and the system hangs.


Shouldn't the PHY enable its own set of clock, while the controller 
should only enable its own (different) set of clock ?


If it is the same clock and there is no refcounting, then maybe what you 
should do for now is enable/disable all the clock in the controller 
driver only, and deal with the PHY once CCF with refcounting is in place ?



Do you expect to add the CCF support ?


Yes, first I thought the clock needed the CCF support to count the clock
function calls, but there is no support to count the reset function calls.
I need another solution.

Currently the phy driver controls all the clock/reset in init() and exit(),
however, it should control the phy clock/reset only.


If that's possible on this hardware, that would be good, let controller 
control its clock and PHY control its (different) clock.



If so, then add at least a FIXME code comment that the exit callback
must be implemented, so that this is not forgotten once CCF is in place.
I don't want this series to grow much further into some "rework
everything at once" thing.


As above, I should put the glue clock/reset into probe(),
and the phy clock/reset into init() without using bulk function.


OK


Re: [PATCH] cpsw_mdio.c: Use correct reg in cpsw_mdio_get_alive

2023-02-17 Thread Tom Rini
On Tue, Feb 07, 2023 at 09:25:27AM +0100, Ulf Samuelsson wrote:

> cpsw_mdio_get_alive reads the wrong register.
> See page 2316 in SPRUH73Q AM335x TRM
> 
> Signed-off-by: Ulf Samuelsson 
> Cc: Joe Hershberger 
> Cc: Ramon Fried 
> Reviewed-by: Siddharth Vadapalli 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH v4] common: avb_verify: prevent opening incorrect session

2023-02-17 Thread Tom Rini
On Fri, Jan 27, 2023 at 10:02:14PM +0200, Ivan Khoronzhuk wrote:

> The arg->session is not valid if arg->ret != NULL, so can't be
> assigned, correct this.
> 
> Signed-off-by: Ivan Khoronzhuk 
> Reviewed-by: Jens Wiklander 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH] rockchip: dts: rk3328: fix sdram params

2023-02-17 Thread Tom Rini
On Fri, Feb 17, 2023 at 11:39:35PM +0530, Jagan Teki wrote:
> Hi Kever and Tom,
> 
> On Sat, Feb 11, 2023 at 12:00 AM Jonas Karlman  wrote:
> >
> > The rk3328 sdram driver read sdram parameters from the devicetree into a
> > struct rk3328_sdram_params using dev_read_u32_array.
> >
> > After commit 5ab30c3176bf ("ram: rockchip: Update ddr pctl regs for px30")
> > changed the size of struct ddr_pctl_regs, a member of struct
> > rk3328_sdram_params, U-Boot TPL can no longer initialize DRAM on RK3328.
> >
> > Add ten u32 to the sdram parameter array in devicetree to align with
> > this size change. This fixes DRAM initialization on RK3328.
> >
> > Fixes: 5ab30c3176bf ("ram: rockchip: Update ddr pctl regs for px30")
> > Signed-off-by: Jonas Karlman 
> > ---
> 
> Can someone merge this soon, rk3328 platform has broken in the last two RCs.

I would really like to see a rockchip PR of fixes at this point, yes. I
believe we'll need one of the TPL/binary-blob related series as well?

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH] rockchip: dts: rk3328: fix sdram params

2023-02-17 Thread Jagan Teki
Hi Kever and Tom,

On Sat, Feb 11, 2023 at 12:00 AM Jonas Karlman  wrote:
>
> The rk3328 sdram driver read sdram parameters from the devicetree into a
> struct rk3328_sdram_params using dev_read_u32_array.
>
> After commit 5ab30c3176bf ("ram: rockchip: Update ddr pctl regs for px30")
> changed the size of struct ddr_pctl_regs, a member of struct
> rk3328_sdram_params, U-Boot TPL can no longer initialize DRAM on RK3328.
>
> Add ten u32 to the sdram parameter array in devicetree to align with
> this size change. This fixes DRAM initialization on RK3328.
>
> Fixes: 5ab30c3176bf ("ram: rockchip: Update ddr pctl regs for px30")
> Signed-off-by: Jonas Karlman 
> ---

Can someone merge this soon, rk3328 platform has broken in the last two RCs.

Thanks,
Jagan.


Re: [PATCH] rockchip: dts: rk3328: fix sdram params

2023-02-17 Thread Jagan Teki
On Sat, Feb 11, 2023 at 12:00 AM Jonas Karlman  wrote:
>
> The rk3328 sdram driver read sdram parameters from the devicetree into a
> struct rk3328_sdram_params using dev_read_u32_array.
>
> After commit 5ab30c3176bf ("ram: rockchip: Update ddr pctl regs for px30")
> changed the size of struct ddr_pctl_regs, a member of struct
> rk3328_sdram_params, U-Boot TPL can no longer initialize DRAM on RK3328.
>
> Add ten u32 to the sdram parameter array in devicetree to align with
> this size change. This fixes DRAM initialization on RK3328.
>
> Fixes: 5ab30c3176bf ("ram: rockchip: Update ddr pctl regs for px30")
> Signed-off-by: Jonas Karlman 
> ---

Reviewed-by: Jagan Teki 
Tested-by: Jagan Teki  # roc-rk3328-cc


Re: [PATCH v2] efi_loader: Measure the loaded DTB

2023-02-17 Thread Ilias Apalodimas
Hi Etienne

On Thu, Feb 16, 2023 at 05:29:48PM +0100, Etienne Carriere wrote:
> Measures the DTB passed to the EFI application upon new boolean config
> switch CONFIG_EFI_TCG2_PROTOCOL_MEASURE_DTB. For platforms where the
> content of the DTB passed to the OS can change across reboots, there is
> not point measuring it hence the config switch to allow platform to not
> embed this feature.
>
> Co-developed-by: Ilias Apalodimas 
> Signed-off-by: Ilias Apalodimas 
> Signed-off-by: Etienne Carriere 
> ---
> Changes since v1
> - Moved measurement to after DTB tweaks in efi_install_fdt() and change
>   its measure to hash only populated areas in the DTB (header, structs,
>   strings and reserved memory maps). efi_tcg2_measure_dtb() computes
>   the hash of these concatenated areas and used it as DTB  measurement.
> - Remove useless default value 'n' for EFI_TCG2_PROTOCOL_MEASURE_DTB.
> - I did not add EFI_TCG2_PROTOCOL_MEASURE_DTB dependencies on
>   !NET_RANDOM_ETHADDR neither on !CMD_KASLRSEED. If ethernet address
>   is random but always the same at each boot as saved in environment,
>   it's measure is meaningful. CMD_KASLRSEED effect in DT if already
>   addressed by efi_try_purge_kaslr_seed() prior measurement.

That's correct, and since the TPM is guaranteed to have an RNG, we will
always install the EFI_RNG protocol and get rid of kaslr-seed for the DT.

> ---
>  cmd/bootefi.c |  8 +
>  include/efi_loader.h  |  2 ++
>  include/efi_tcg2.h| 10 ++
>  include/tpm-v2.h  |  2 ++
>  lib/efi_loader/Kconfig| 11 ++
>  lib/efi_loader/efi_tcg2.c | 73 +++
>  6 files changed, 106 insertions(+)
>
> diff --git a/cmd/bootefi.c b/cmd/bootefi.c
> index 2a7d42925d..6618335ddf 100644
> --- a/cmd/bootefi.c
> +++ b/cmd/bootefi.c
> @@ -332,6 +332,14 @@ efi_status_t efi_install_fdt(void *fdt)
>
>   efi_try_purge_kaslr_seed(fdt);
>
> + if (CONFIG_IS_ENABLED(EFI_TCG2_PROTOCOL_MEASURE_DTB)) {
> + ret = efi_tcg2_measure_dtb(fdt);
> + if (ret == EFI_SECURITY_VIOLATION) {
> + log_err("ERROR: failed to measure DTB\n");
> + return ret;
> + }
> + }
> +
>   /* Install device tree as UEFI table */
>   ret = efi_install_configuration_table(_guid_fdt, fdt);
>   if (ret != EFI_SUCCESS) {
> diff --git a/include/efi_loader.h b/include/efi_loader.h
> index 4560b0d04c..4ecfdf919b 100644
> --- a/include/efi_loader.h
> +++ b/include/efi_loader.h
> @@ -531,6 +531,8 @@ efi_status_t 
> efi_tcg2_notify_exit_boot_services_failed(void);
>  efi_status_t efi_tcg2_measure_efi_app_invocation(struct efi_loaded_image_obj 
> *handle);
>  /* Measure efi application exit */
>  efi_status_t efi_tcg2_measure_efi_app_exit(void);
> +/* Measure DTB */
> +efi_status_t efi_tcg2_measure_dtb(void *dtb);
>  /* Called by bootefi to initialize root node */
>  efi_status_t efi_root_node_register(void);
>  /* Called by bootefi to initialize runtime */
> diff --git a/include/efi_tcg2.h b/include/efi_tcg2.h
> index 874306dc11..b1c3abd097 100644
> --- a/include/efi_tcg2.h
> +++ b/include/efi_tcg2.h
> @@ -233,6 +233,16 @@ struct efi_gpt_data {
>   gpt_entry partitions[];
>  } __packed;
>
> +/**
> + * struct tdUEFI_PLATFORM_FIRMWARE_BLOB2
> + * @blob_description_size:   Byte size of @data
> + * @data:Description data
> + */
> +struct uefi_platform_firmware_blob2 {
> + u8 blob_description_size;
> + u8 data[];
> +} __packed;
> +
>  struct efi_tcg2_protocol {
>   efi_status_t (EFIAPI * get_capability)(struct efi_tcg2_protocol *this,
>  struct 
> efi_tcg2_boot_service_capability *capability);
> diff --git a/include/tpm-v2.h b/include/tpm-v2.h
> index 737e57551d..2df3dad553 100644
> --- a/include/tpm-v2.h
> +++ b/include/tpm-v2.h
> @@ -105,6 +105,8 @@ struct udevice;
>   "Exit Boot Services Returned with Failure"
>  #define EFI_EXIT_BOOT_SERVICES_SUCCEEDED\
>   "Exit Boot Services Returned with Success"
> +#define EFI_DTB_EVENT_STRING \
> + "DTB DATA"
>
>  /* TPMS_TAGGED_PROPERTY Structure */
>  struct tpms_tagged_property {
> diff --git a/lib/efi_loader/Kconfig b/lib/efi_loader/Kconfig
> index c56904afc2..c05a54df16 100644
> --- a/lib/efi_loader/Kconfig
> +++ b/lib/efi_loader/Kconfig
> @@ -346,6 +346,17 @@ config EFI_TCG2_PROTOCOL_EVENTLOG_SIZE
>   this is going to be allocated twice. One for the eventlog it 
> self
>   and one for the configuration table that is required from the 
> spec
>
> +config EFI_TCG2_PROTOCOL_MEASURE_DTB
> + bool "Measure DTB with EFI_TCG2_PROTOCOL"
> + depends on EFI_TCG2_PROTOCOL
> + help
> +   When enabled, the DTB image passed to the booted EFI image is
> +   measured using the EFI TCG2 protocol. Do not enable this feature if
> +   the passed DTB contains data that change across platform reboots
> +   and cannot be used has a 

Re: [PATCH 10/13] verdin-imx8mm: Remove unused SPL_BOARD_INIT

2023-02-17 Thread Tom Rini
On Fri, Feb 17, 2023 at 05:14:11PM +0100, Francesco Dolcini wrote:
> On Fri, Feb 17, 2023 at 09:03:07AM -0500, Tom Rini wrote:
> > On Fri, Feb 17, 2023 at 01:18:34PM +, Marcel Ziswiler wrote:
> > > Hi Tom
> > > 
> > > On Thu, 2023-02-16 at 13:37 +0100, Marcel Ziswiler wrote:
> > > > On Wed, 2023-02-15 at 22:36 -0500, Tom Rini wrote:
> > > > > On this platform SPL_BOARD_INIT is used to call arch_misc_init which 
> > > > > is
> > > > > in turn empty, drop the call.
> > > > > 
> > > > > Cc: Marcel Ziswiler 
> > > > > Signed-off-by: Tom Rini 
> > > > 
> > > > Acked-by: Marcel Ziswiler 
> > > 
> > > Sorry, I have to take my ack back. Marek (and Francesco) are, of course, 
> > > right and this is indeed needed for
> > > CAAM. Please see also [1] where it got changed/introduced in/to the 
> > > current form.
> > > 
> > > [1] https://lore.kernel.org/all/20220919194118.105820-1-ma...@denx.de/
> > 
> > Alright, yeah. I've posted v2 which preserves the existing behavior, but
> > it could be improved further still by someone with the hardware to
> > confirm behavior on.
> 
> [PATCHv2 12/13] global: Add a select for ARCH_MISC_INIT where used -- ?
> 
> I would say that even with that patch in, this specific one should be
> dropped.

Yes, with v2 of 12/13, patches 10 and 11 from v1 of the series are
dropped, to be clear.

> At least this is what I understand from your comment here:
> > Yes, it's still on the board to call arch_misc_init() inside 
> > spl_board_init().
> 
> We can test your changes on the Verdin iMX8MM, even Marek should have
> one to my understanding, in case we are somehow late.

What I mean is that Marek has suggested a more specific fix to this
problem (it should not be per-board to get the CAAM working for HAB
here, it should be in the SoC code and hooks), and I would quite welcome
the general clean-up but can't test it, so won't write it, right now.

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH v4 00/16] General Tegra improvements

2023-02-17 Thread Svyatoslav Ryhel
No problem, it is nice that the second attempt passed smoothly.

Thank you!

Best regards,
Svyatoslav R.

P. S. I am a bit hesitant about DC related patch set I wanted to send
next. I would like to include a T30 DSI driver into it but it seems to
be partially broken. May I write to you directly with a description of
the state I have reached? Maybe you could advise in which direction I
should look?

пт, 17 лют. 2023 р. о 18:27 Tom Warren  пише:
>
> OK, now it's working fine on top of u-boot-tegra/master, and rebasing that 
> result against u-boot/master TOT is fine, too. Sorry - don't know what I did 
> wrong before.
> I'll run buildman on it and then get a PR out to TomR if it all looks good.
>
> Thanks!
>
> -Original Message-
> From: Tom Warren
> Sent: Friday, February 17, 2023 9:22 AM
> To: Svyatoslav Ryhel 
> Cc: u-boot@lists.denx.de
> Subject: RE: [PATCH v4 00/16] General Tegra improvements
>
> OK, let me retry on u-boot-tegra/master.
>
> -Original Message-
> From: Svyatoslav Ryhel 
> Sent: Friday, February 17, 2023 9:07 AM
> To: Tom Warren 
> Cc: u-boot@lists.denx.de
> Subject: Re: [PATCH v4 00/16] General Tegra improvements
>
> External email: Use caution opening links or attachments
>
>
> I was able to git am it on top of u-boot/master without any errors
>
> clamor@xeon:/media/clamor/work/u-boot$ git am 
> bundle-23303-Svyatoslav-16-v4.mbox
> Застосування: tegra30: clock: add EXTPERIPH
> Застосування: ARM: t20/t30: swap host1x and disp1 clock parents
> Застосування: ARM: tegra: clock: add clk_id_to_pll_id helper
> Застосування: ARM: tegra: clock: add clock_decode_pair helper
> Застосування: ARM: tegra30: add PLLD to pll setup
> Застосування: ARM: tegra: Fix Tegra PWM parent clock
> Застосування: spi: tegra20_slink: accept any word length
> Застосування: ARM: tegra: provide default USB gadget setup
> Застосування: ARM: tegra: add late init support
> Застосування: ARM: tegra: create common pre-dm i2c write
> Застосування: board: tegra124: switch to updated pre-dm i2c write
> Застосування: board: tegra30: switch to updated pre-dm i2c write
> Застосування: ARM: tegra: expose crypto module for all Tegra SoCs
> Застосування: ARM: tegra: crypto: extend crypto functional
> Застосування: ARM: tegra30: implement BCT patching
> Застосування: ARM: tegra20: implement BCT patching
> .git/rebase-apply/patch:249: new blank line at EOF.
> +
> warning: 1 рядок додав помилки в пробільних символах.
> clamor@xeon:/media/clamor/work/u-boot$
>
> пт, 17 лют. 2023 р. о 17:57 Tom Warren  пише:
> >
> > I've got a bundle with your 16 patches, created using PatchWork/U-Boot, and 
> > the patches are ordered correctly within that bundle. Attached here - see 
> > if it works for you.
> >
> > Tom
> >
> > -Original Message-
> > From: Svyatoslav Ryhel 
> > Sent: Friday, February 17, 2023 1:39 AM
> > To: Tom Warren 
> > Cc: u-boot@lists.denx.de
> > Subject: Re: [PATCH v4 00/16] General Tegra improvements
> >
> > External email: Use caution opening links or attachments
> >
> >
> > You have NOT applied patch 13 ARM: tegra: expose crypto module for all 
> > Tegra SoCs or applied it after patch 14 which brakes order. PTAL.
> >
> > вт, 14 лют. 2023 р. о 23:45 Tom Warren  пише:
> > >
> > > 
> > >
> > > Svyatoslav,
> > >
> > > Taking TOT u-boot-tegra/master, and fast-forwarding to TOT u-boot/master, 
> > > I then try to apply your 16 patch series and get the following failures 
> > > (using patch). Note that I retargeted the crypto.c patch by hand to point 
> > > to tegra20/crypto.c, which I believe one of your patches moves to 
> > > arch/arm/tegra. PTAL.
> > >
> > > tom@tom-ThinkPad-T580:~/denx/uboot-tegra$ patch -p1 -i
> > > ~/Downloads/bundle-23303-Svyatoslav-16-v4.mbox  --dry-run checking
> > > file arch/arm/include/asm/arch-tegra30/clock-tables.h
> > > checking file arch/arm/mach-tegra/tegra30/clock.c
> > > checking file arch/arm/mach-tegra/tegra20/clock.c
> > > checking file arch/arm/mach-tegra/tegra30/clock.c
> > > checking file arch/arm/include/asm/arch-tegra/clock.h
> > > checking file arch/arm/mach-tegra/tegra114/clock.c
> > > checking file arch/arm/mach-tegra/tegra124/clock.c
> > > checking file arch/arm/mach-tegra/tegra20/clock.c
> > > checking file arch/arm/mach-tegra/tegra210/clock.c
> > > checking file arch/arm/mach-tegra/tegra30/clock.c
> > > checking file arch/arm/include/asm/arch-tegra/clock.h
> > > checking file arch/arm/mach-tegra/clock.c checking file
> > > arch/arm/mach-tegra/tegra30/clock.c
> > > Hunk #1 succeeded at 632 (offset -37 lines).
> > > checking file arch/arm/dts/tegra114.dtsi checking file
> > > arch/arm/dts/tegra124.dtsi checking file
> > > arch/arm/mach-tegra/tegra114/clock.c
> > > Hunk #1 succeeded at 745 (offset -37 lines).
> > > checking file arch/arm/mach-tegra/tegra124/clock.c
> > > Hunk #1 succeeded at 1170 (offset -38 lines).
> > > checking file arch/arm/mach-tegra/tegra20/clock.c
> > > Hunk #1 succeeded at 767 (offset -37 lines).
> > > checking file 

RE: [PATCH v4 00/16] General Tegra improvements

2023-02-17 Thread Tom Warren
OK, now it's working fine on top of u-boot-tegra/master, and rebasing that 
result against u-boot/master TOT is fine, too. Sorry - don't know what I did 
wrong before.
I'll run buildman on it and then get a PR out to TomR if it all looks good.

Thanks!

-Original Message-
From: Tom Warren 
Sent: Friday, February 17, 2023 9:22 AM
To: Svyatoslav Ryhel 
Cc: u-boot@lists.denx.de
Subject: RE: [PATCH v4 00/16] General Tegra improvements

OK, let me retry on u-boot-tegra/master.

-Original Message-
From: Svyatoslav Ryhel 
Sent: Friday, February 17, 2023 9:07 AM
To: Tom Warren 
Cc: u-boot@lists.denx.de
Subject: Re: [PATCH v4 00/16] General Tegra improvements

External email: Use caution opening links or attachments


I was able to git am it on top of u-boot/master without any errors

clamor@xeon:/media/clamor/work/u-boot$ git am bundle-23303-Svyatoslav-16-v4.mbox
Застосування: tegra30: clock: add EXTPERIPH
Застосування: ARM: t20/t30: swap host1x and disp1 clock parents
Застосування: ARM: tegra: clock: add clk_id_to_pll_id helper
Застосування: ARM: tegra: clock: add clock_decode_pair helper
Застосування: ARM: tegra30: add PLLD to pll setup
Застосування: ARM: tegra: Fix Tegra PWM parent clock
Застосування: spi: tegra20_slink: accept any word length
Застосування: ARM: tegra: provide default USB gadget setup
Застосування: ARM: tegra: add late init support
Застосування: ARM: tegra: create common pre-dm i2c write
Застосування: board: tegra124: switch to updated pre-dm i2c write
Застосування: board: tegra30: switch to updated pre-dm i2c write
Застосування: ARM: tegra: expose crypto module for all Tegra SoCs
Застосування: ARM: tegra: crypto: extend crypto functional
Застосування: ARM: tegra30: implement BCT patching
Застосування: ARM: tegra20: implement BCT patching
.git/rebase-apply/patch:249: new blank line at EOF.
+
warning: 1 рядок додав помилки в пробільних символах.
clamor@xeon:/media/clamor/work/u-boot$

пт, 17 лют. 2023 р. о 17:57 Tom Warren  пише:
>
> I've got a bundle with your 16 patches, created using PatchWork/U-Boot, and 
> the patches are ordered correctly within that bundle. Attached here - see if 
> it works for you.
>
> Tom
>
> -Original Message-
> From: Svyatoslav Ryhel 
> Sent: Friday, February 17, 2023 1:39 AM
> To: Tom Warren 
> Cc: u-boot@lists.denx.de
> Subject: Re: [PATCH v4 00/16] General Tegra improvements
>
> External email: Use caution opening links or attachments
>
>
> You have NOT applied patch 13 ARM: tegra: expose crypto module for all Tegra 
> SoCs or applied it after patch 14 which brakes order. PTAL.
>
> вт, 14 лют. 2023 р. о 23:45 Tom Warren  пише:
> >
> > 
> >
> > Svyatoslav,
> >
> > Taking TOT u-boot-tegra/master, and fast-forwarding to TOT u-boot/master, I 
> > then try to apply your 16 patch series and get the following failures 
> > (using patch). Note that I retargeted the crypto.c patch by hand to point 
> > to tegra20/crypto.c, which I believe one of your patches moves to 
> > arch/arm/tegra. PTAL.
> >
> > tom@tom-ThinkPad-T580:~/denx/uboot-tegra$ patch -p1 -i 
> > ~/Downloads/bundle-23303-Svyatoslav-16-v4.mbox  --dry-run checking 
> > file arch/arm/include/asm/arch-tegra30/clock-tables.h
> > checking file arch/arm/mach-tegra/tegra30/clock.c
> > checking file arch/arm/mach-tegra/tegra20/clock.c
> > checking file arch/arm/mach-tegra/tegra30/clock.c
> > checking file arch/arm/include/asm/arch-tegra/clock.h
> > checking file arch/arm/mach-tegra/tegra114/clock.c
> > checking file arch/arm/mach-tegra/tegra124/clock.c
> > checking file arch/arm/mach-tegra/tegra20/clock.c
> > checking file arch/arm/mach-tegra/tegra210/clock.c
> > checking file arch/arm/mach-tegra/tegra30/clock.c
> > checking file arch/arm/include/asm/arch-tegra/clock.h
> > checking file arch/arm/mach-tegra/clock.c checking file 
> > arch/arm/mach-tegra/tegra30/clock.c
> > Hunk #1 succeeded at 632 (offset -37 lines).
> > checking file arch/arm/dts/tegra114.dtsi checking file 
> > arch/arm/dts/tegra124.dtsi checking file 
> > arch/arm/mach-tegra/tegra114/clock.c
> > Hunk #1 succeeded at 745 (offset -37 lines).
> > checking file arch/arm/mach-tegra/tegra124/clock.c
> > Hunk #1 succeeded at 1170 (offset -38 lines).
> > checking file arch/arm/mach-tegra/tegra20/clock.c
> > Hunk #1 succeeded at 767 (offset -37 lines).
> > checking file arch/arm/mach-tegra/tegra210/clock.c
> > Hunk #1 succeeded at 1241 (offset -37 lines).
> > checking file arch/arm/mach-tegra/tegra30/clock.c
> > Hunk #1 succeeded at 806 (offset -78 lines).
> > checking file drivers/pwm/tegra_pwm.c checking file 
> > drivers/spi/tegra20_slink.c checking file configs/beaver_defconfig 
> > checking file configs/cei-tk1-som_defconfig checking file 
> > configs/dalmore_defconfig checking file configs/jetson-tk1_defconfig 
> > checking file configs/nyan-big_defconfig checking file 
> > configs/p2371-_defconfig checking file 
> > configs/p2371-2180_defconfig checking file configs/p2571_defconfig 
> > checking file 

RE: [PATCH v4 00/16] General Tegra improvements

2023-02-17 Thread Tom Warren
OK, let me retry on u-boot-tegra/master.

-Original Message-
From: Svyatoslav Ryhel  
Sent: Friday, February 17, 2023 9:07 AM
To: Tom Warren 
Cc: u-boot@lists.denx.de
Subject: Re: [PATCH v4 00/16] General Tegra improvements

External email: Use caution opening links or attachments


I was able to git am it on top of u-boot/master without any errors

clamor@xeon:/media/clamor/work/u-boot$ git am bundle-23303-Svyatoslav-16-v4.mbox
Застосування: tegra30: clock: add EXTPERIPH
Застосування: ARM: t20/t30: swap host1x and disp1 clock parents
Застосування: ARM: tegra: clock: add clk_id_to_pll_id helper
Застосування: ARM: tegra: clock: add clock_decode_pair helper
Застосування: ARM: tegra30: add PLLD to pll setup
Застосування: ARM: tegra: Fix Tegra PWM parent clock
Застосування: spi: tegra20_slink: accept any word length
Застосування: ARM: tegra: provide default USB gadget setup
Застосування: ARM: tegra: add late init support
Застосування: ARM: tegra: create common pre-dm i2c write
Застосування: board: tegra124: switch to updated pre-dm i2c write
Застосування: board: tegra30: switch to updated pre-dm i2c write
Застосування: ARM: tegra: expose crypto module for all Tegra SoCs
Застосування: ARM: tegra: crypto: extend crypto functional
Застосування: ARM: tegra30: implement BCT patching
Застосування: ARM: tegra20: implement BCT patching
.git/rebase-apply/patch:249: new blank line at EOF.
+
warning: 1 рядок додав помилки в пробільних символах.
clamor@xeon:/media/clamor/work/u-boot$

пт, 17 лют. 2023 р. о 17:57 Tom Warren  пише:
>
> I've got a bundle with your 16 patches, created using PatchWork/U-Boot, and 
> the patches are ordered correctly within that bundle. Attached here - see if 
> it works for you.
>
> Tom
>
> -Original Message-
> From: Svyatoslav Ryhel 
> Sent: Friday, February 17, 2023 1:39 AM
> To: Tom Warren 
> Cc: u-boot@lists.denx.de
> Subject: Re: [PATCH v4 00/16] General Tegra improvements
>
> External email: Use caution opening links or attachments
>
>
> You have NOT applied patch 13 ARM: tegra: expose crypto module for all Tegra 
> SoCs or applied it after patch 14 which brakes order. PTAL.
>
> вт, 14 лют. 2023 р. о 23:45 Tom Warren  пише:
> >
> > 
> >
> > Svyatoslav,
> >
> > Taking TOT u-boot-tegra/master, and fast-forwarding to TOT u-boot/master, I 
> > then try to apply your 16 patch series and get the following failures 
> > (using patch). Note that I retargeted the crypto.c patch by hand to point 
> > to tegra20/crypto.c, which I believe one of your patches moves to 
> > arch/arm/tegra. PTAL.
> >
> > tom@tom-ThinkPad-T580:~/denx/uboot-tegra$ patch -p1 -i 
> > ~/Downloads/bundle-23303-Svyatoslav-16-v4.mbox  --dry-run checking 
> > file arch/arm/include/asm/arch-tegra30/clock-tables.h
> > checking file arch/arm/mach-tegra/tegra30/clock.c
> > checking file arch/arm/mach-tegra/tegra20/clock.c
> > checking file arch/arm/mach-tegra/tegra30/clock.c
> > checking file arch/arm/include/asm/arch-tegra/clock.h
> > checking file arch/arm/mach-tegra/tegra114/clock.c
> > checking file arch/arm/mach-tegra/tegra124/clock.c
> > checking file arch/arm/mach-tegra/tegra20/clock.c
> > checking file arch/arm/mach-tegra/tegra210/clock.c
> > checking file arch/arm/mach-tegra/tegra30/clock.c
> > checking file arch/arm/include/asm/arch-tegra/clock.h
> > checking file arch/arm/mach-tegra/clock.c checking file 
> > arch/arm/mach-tegra/tegra30/clock.c
> > Hunk #1 succeeded at 632 (offset -37 lines).
> > checking file arch/arm/dts/tegra114.dtsi checking file 
> > arch/arm/dts/tegra124.dtsi checking file 
> > arch/arm/mach-tegra/tegra114/clock.c
> > Hunk #1 succeeded at 745 (offset -37 lines).
> > checking file arch/arm/mach-tegra/tegra124/clock.c
> > Hunk #1 succeeded at 1170 (offset -38 lines).
> > checking file arch/arm/mach-tegra/tegra20/clock.c
> > Hunk #1 succeeded at 767 (offset -37 lines).
> > checking file arch/arm/mach-tegra/tegra210/clock.c
> > Hunk #1 succeeded at 1241 (offset -37 lines).
> > checking file arch/arm/mach-tegra/tegra30/clock.c
> > Hunk #1 succeeded at 806 (offset -78 lines).
> > checking file drivers/pwm/tegra_pwm.c checking file 
> > drivers/spi/tegra20_slink.c checking file configs/beaver_defconfig 
> > checking file configs/cei-tk1-som_defconfig checking file 
> > configs/dalmore_defconfig checking file configs/jetson-tk1_defconfig 
> > checking file configs/nyan-big_defconfig checking file 
> > configs/p2371-_defconfig checking file 
> > configs/p2371-2180_defconfig checking file configs/p2571_defconfig 
> > checking file configs/p3450-_defconfig checking file 
> > configs/venice2_defconfig checking file drivers/usb/gadget/Kconfig 
> > checking file arch/arm/include/asm/arch-tegra/sys_proto.h
> > checking file arch/arm/mach-tegra/board2.c checking file 
> > arch/arm/include/asm/arch-tegra/tegra_i2c.h
> > checking file arch/arm/mach-tegra/cpu.h checking file 
> > arch/arm/mach-tegra/tegra124/cpu.c
> > checking file arch/arm/mach-tegra/tegra30/cpu.c checking file 
> > 

Re: [PATCH 10/13] verdin-imx8mm: Remove unused SPL_BOARD_INIT

2023-02-17 Thread Francesco Dolcini
On Fri, Feb 17, 2023 at 09:03:07AM -0500, Tom Rini wrote:
> On Fri, Feb 17, 2023 at 01:18:34PM +, Marcel Ziswiler wrote:
> > Hi Tom
> > 
> > On Thu, 2023-02-16 at 13:37 +0100, Marcel Ziswiler wrote:
> > > On Wed, 2023-02-15 at 22:36 -0500, Tom Rini wrote:
> > > > On this platform SPL_BOARD_INIT is used to call arch_misc_init which is
> > > > in turn empty, drop the call.
> > > > 
> > > > Cc: Marcel Ziswiler 
> > > > Signed-off-by: Tom Rini 
> > > 
> > > Acked-by: Marcel Ziswiler 
> > 
> > Sorry, I have to take my ack back. Marek (and Francesco) are, of course, 
> > right and this is indeed needed for
> > CAAM. Please see also [1] where it got changed/introduced in/to the current 
> > form.
> > 
> > [1] https://lore.kernel.org/all/20220919194118.105820-1-ma...@denx.de/
> 
> Alright, yeah. I've posted v2 which preserves the existing behavior, but
> it could be improved further still by someone with the hardware to
> confirm behavior on.

[PATCHv2 12/13] global: Add a select for ARCH_MISC_INIT where used -- ?

I would say that even with that patch in, this specific one should be
dropped.

At least this is what I understand from your comment here:
> Yes, it's still on the board to call arch_misc_init() inside spl_board_init().

We can test your changes on the Verdin iMX8MM, even Marek should have
one to my understanding, in case we are somehow late.

Thanks,
Francesco



Re: [PATCH v4 00/16] General Tegra improvements

2023-02-17 Thread Svyatoslav Ryhel
I was able to git am it on top of u-boot/master without any errors

clamor@xeon:/media/clamor/work/u-boot$ git am bundle-23303-Svyatoslav-16-v4.mbox
Застосування: tegra30: clock: add EXTPERIPH
Застосування: ARM: t20/t30: swap host1x and disp1 clock parents
Застосування: ARM: tegra: clock: add clk_id_to_pll_id helper
Застосування: ARM: tegra: clock: add clock_decode_pair helper
Застосування: ARM: tegra30: add PLLD to pll setup
Застосування: ARM: tegra: Fix Tegra PWM parent clock
Застосування: spi: tegra20_slink: accept any word length
Застосування: ARM: tegra: provide default USB gadget setup
Застосування: ARM: tegra: add late init support
Застосування: ARM: tegra: create common pre-dm i2c write
Застосування: board: tegra124: switch to updated pre-dm i2c write
Застосування: board: tegra30: switch to updated pre-dm i2c write
Застосування: ARM: tegra: expose crypto module for all Tegra SoCs
Застосування: ARM: tegra: crypto: extend crypto functional
Застосування: ARM: tegra30: implement BCT patching
Застосування: ARM: tegra20: implement BCT patching
.git/rebase-apply/patch:249: new blank line at EOF.
+
warning: 1 рядок додав помилки в пробільних символах.
clamor@xeon:/media/clamor/work/u-boot$

пт, 17 лют. 2023 р. о 17:57 Tom Warren  пише:
>
> I've got a bundle with your 16 patches, created using PatchWork/U-Boot, and 
> the patches are ordered correctly within that bundle. Attached here - see if 
> it works for you.
>
> Tom
>
> -Original Message-
> From: Svyatoslav Ryhel 
> Sent: Friday, February 17, 2023 1:39 AM
> To: Tom Warren 
> Cc: u-boot@lists.denx.de
> Subject: Re: [PATCH v4 00/16] General Tegra improvements
>
> External email: Use caution opening links or attachments
>
>
> You have NOT applied patch 13 ARM: tegra: expose crypto module for all Tegra 
> SoCs or applied it after patch 14 which brakes order. PTAL.
>
> вт, 14 лют. 2023 р. о 23:45 Tom Warren  пише:
> >
> > 
> >
> > Svyatoslav,
> >
> > Taking TOT u-boot-tegra/master, and fast-forwarding to TOT u-boot/master, I 
> > then try to apply your 16 patch series and get the following failures 
> > (using patch). Note that I retargeted the crypto.c patch by hand to point 
> > to tegra20/crypto.c, which I believe one of your patches moves to 
> > arch/arm/tegra. PTAL.
> >
> > tom@tom-ThinkPad-T580:~/denx/uboot-tegra$ patch -p1 -i
> > ~/Downloads/bundle-23303-Svyatoslav-16-v4.mbox  --dry-run checking
> > file arch/arm/include/asm/arch-tegra30/clock-tables.h
> > checking file arch/arm/mach-tegra/tegra30/clock.c
> > checking file arch/arm/mach-tegra/tegra20/clock.c
> > checking file arch/arm/mach-tegra/tegra30/clock.c
> > checking file arch/arm/include/asm/arch-tegra/clock.h
> > checking file arch/arm/mach-tegra/tegra114/clock.c
> > checking file arch/arm/mach-tegra/tegra124/clock.c
> > checking file arch/arm/mach-tegra/tegra20/clock.c
> > checking file arch/arm/mach-tegra/tegra210/clock.c
> > checking file arch/arm/mach-tegra/tegra30/clock.c
> > checking file arch/arm/include/asm/arch-tegra/clock.h
> > checking file arch/arm/mach-tegra/clock.c checking file
> > arch/arm/mach-tegra/tegra30/clock.c
> > Hunk #1 succeeded at 632 (offset -37 lines).
> > checking file arch/arm/dts/tegra114.dtsi checking file
> > arch/arm/dts/tegra124.dtsi checking file
> > arch/arm/mach-tegra/tegra114/clock.c
> > Hunk #1 succeeded at 745 (offset -37 lines).
> > checking file arch/arm/mach-tegra/tegra124/clock.c
> > Hunk #1 succeeded at 1170 (offset -38 lines).
> > checking file arch/arm/mach-tegra/tegra20/clock.c
> > Hunk #1 succeeded at 767 (offset -37 lines).
> > checking file arch/arm/mach-tegra/tegra210/clock.c
> > Hunk #1 succeeded at 1241 (offset -37 lines).
> > checking file arch/arm/mach-tegra/tegra30/clock.c
> > Hunk #1 succeeded at 806 (offset -78 lines).
> > checking file drivers/pwm/tegra_pwm.c
> > checking file drivers/spi/tegra20_slink.c checking file
> > configs/beaver_defconfig checking file configs/cei-tk1-som_defconfig
> > checking file configs/dalmore_defconfig checking file
> > configs/jetson-tk1_defconfig checking file configs/nyan-big_defconfig
> > checking file configs/p2371-_defconfig checking file
> > configs/p2371-2180_defconfig checking file configs/p2571_defconfig
> > checking file configs/p3450-_defconfig checking file
> > configs/venice2_defconfig checking file drivers/usb/gadget/Kconfig
> > checking file arch/arm/include/asm/arch-tegra/sys_proto.h
> > checking file arch/arm/mach-tegra/board2.c checking file
> > arch/arm/include/asm/arch-tegra/tegra_i2c.h
> > checking file arch/arm/mach-tegra/cpu.h checking file
> > arch/arm/mach-tegra/tegra124/cpu.c
> > checking file arch/arm/mach-tegra/tegra30/cpu.c checking file
> > board/nvidia/venice2/as3722_init.c
> > checking file board/nvidia/venice2/as3722_init.h
> > checking file board/toradex/apalis-tk1/as3722_init.c
> > checking file board/toradex/apalis-tk1/as3722_init.h
> > checking file arch/arm/mach-tegra/tegra30/Kconfig
> > checking file arch/arm/mach-tegra/tegra30/cpu.c Hunk #1 

Re: [PATCH v3] bootstd: Replicate the dtb-filename quirks of distroboot

2023-02-17 Thread Tom Rini
On Sun, Feb 05, 2023 at 01:24:38PM -0700, Simon Glass wrote:

> For EFI, the distro boot scripts search in three different directories
> for the .dtb file. The SOC-based filename fallback is supported only for
> 32-bit ARM.
> 
> Adjust the code to mirror this behaviour.
> 
> Also some boards can use a prior-stage FDT if one is not found in the
> normal way. Support this and show a warning in that case.
> 
> Signed-off-by: Simon Glass 
> Suggested-by: Mark Kettenis 

As-is, sandbox fails to build with this, on master.

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH v2 1/1] spl: allow loading via partition type GUID

2023-02-17 Thread Tom Rini
On Fri, Feb 17, 2023 at 12:06:40PM +0100, Heinrich Schuchardt wrote:
> On 2/17/23 11:34, Mark Kettenis wrote:
> > > Date: Fri, 17 Feb 2023 07:55:58 +0100
> > > From: Heinrich Schuchardt 
> > > 
> > > > I'm not sure, but at some point this is all going to get out of hand.
> > > > Already we have these options:
> > > > 
> > > > common/spl/Kconfig:config SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR
> > > > common/spl/Kconfig:config SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR
> > > > common/spl/Kconfig:config SYS_MMCSD_RAW_MODE_U_BOOT_DATA_PART_OFFSET
> > > > common/spl/Kconfig:config SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION
> > > > common/spl/Kconfig:config SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION
> > > > common/spl/Kconfig:config SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION_TYPE
> > > > common/spl/Kconfig:config SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION_TYPE
> > > > common/spl/Kconfig:config SYS_MMCSD_RAW_MODE_EMMC_BOOT_PARTITION
> > > > common/spl/Kconfig:config SYS_MMCSD_FS_BOOT_PARTITION
> > > > common/spl/Kconfig:config SYS_MMCSD_RAW_MODE_KERNEL_SECTOR
> > > > common/spl/Kconfig:config SYS_MMCSD_RAW_MODE_ARGS_SECTOR
> > > > common/spl/Kconfig:config SYS_MMCSD_RAW_MODE_ARGS_SECTORS
> > > > 
> > > > That is just for MMC raw mode.
> > > > 
> > > > For environment we have SYS_MMC_ENV_DEV and _PART. If you look around
> > > > you'll see loads of these options.
> > > > 
> > > > I see that rockchip uses u-boot,spl-boot-order as a way to determine
> > > > the boot order. This makes it configurable without rebuilding
> > > > U-Boot...although I don't think we need to make the MMC stuff
> > > > configurable, since I am assuming that the boot ROM determines at
> > > > least some of it...?
> > > 
> > > This patch is about SPL loading main U-Boot. So the boot ROM is not
> > > involved.
> > 
> > But in that case we surely want to have a single board and SoC
> > independent partition GUID?
> > 
> 
> No. I want to create one installation image which runs on multiple boards,
> e.g.
> 
> part 1, GUID 8300, /boot
> part 2, GUID 8300, /
> part 15, GUID EF00, /boot/efi
> part 20, GUID SPL 1, SPL for board 1
> part 21, GUID U-Boot 2, U-Boot for board 1
> ...
> part 127, GUID SPL 54, SPL for board 54
> part 128, GUID U-Boot 54, U-Boot for board 54

Is this concept proposed somewhere that OS / distro people might further
comment on?

-- 
Tom


signature.asc
Description: PGP signature


Re: [PULL] u-boot-riscv/master

2023-02-17 Thread Tom Rini
On Fri, Feb 17, 2023 at 12:12:18PM +, Leo Liang wrote:

> Hi Tom,
> 
> The following changes since commit faac9dee8e0629326dc122f4624fc4897e3f38b0:
> 
>   Prepare v2023.04-rc2 (2023-02-13 18:39:15 -0500)
> 
> are available in the Git repository at:
> 
>   https://source.denx.de/u-boot/custodians/u-boot-riscv.git
> 
> for you to fetch changes up to 7574b6476afc1fd76816be6567458f6ca4f44234:
> 
>   riscv: binman: Add help message for missing blobs (2023-02-17 19:07:48 
> +0800)
> 
> CI result shows no issue: 
> https://source.denx.de/u-boot/custodians/u-boot-riscv/-/pipelines/15225
> 

I've taken this to u-boot/master, but for the rest of the cycle please
make sure any changes for master are clearly bug fixes, and otherwise
apply to next instead. Thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [ANN] U-Boot v2023.04-rc2 released

2023-02-17 Thread Tom Rini
On Thu, Feb 16, 2023 at 11:03:01AM +0100, Michal Simek wrote:
> Hi Tom,
> 
> On 2/14/23 00:39, Tom Rini wrote:
> > Hey all,
> > 
> > It's the scheduled day for -rc2, and I've waited until the end of my
> > day, to give the most time for more PRs to come in. Between -rc1 and now
> > I've gone over my queue, looked over a few other things and tried to
> > make sure everything I could take in, was taken in. I'm now going to try
> > and follow through on what I've said and ask that PRs from here to
> > release contain fixes. I can see "remove unmaintained code" as a fix,
> > but not "add missing platform" as a fix. With that, I'll be updating the
> > next branch shortly and we'll take things from there.
> > 
> > In terms of a changelog,
> > git log --merges v2023.04-rc1..v2023.04-rc2
> > contains what I've pulled but as always, better PR messages and tags
> > will provide better results here.
> > 
> > Continuing on schedule now and that means the rest of the rcs every
> > other Monday, and with final release on April 3rd, 2023.  Thanks all!
> > 
> 
> can you please also resync defconfigs?

Ah yes, will do.

-- 
Tom


signature.asc
Description: PGP signature


[PATCH v4 1/1] video console: refactoring and optimization

2023-02-17 Thread Dzmitry Sankouski
- move common code to vidconsole_internal.h
- unite probe functions
- get rid of code duplications in switch across bpp values
- extract common pixel fill logic in two functions one per
horizontal and vertical filling
- rearrange statements in put_xy* methods in unified way
- replace types - uint*_t to u*

Signed-off-by: Dzmitry Sankouski 
---
Changes for v2: none
Changes for v3: none
Changes for v4:
- move common code to vidconsole_internal.h
- unite probe functions

 drivers/video/console_normal.c  | 150 +++-
 drivers/video/console_rotate.c  | 364 
 drivers/video/vidconsole_internal.h | 148 +++
 3 files changed, 288 insertions(+), 374 deletions(-)
 create mode 100644 drivers/video/vidconsole_internal.h

diff --git a/drivers/video/console_normal.c b/drivers/video/console_normal.c
index 04f022491e..57186bedd8 100644
--- a/drivers/video/console_normal.c
+++ b/drivers/video/console_normal.c
@@ -1,10 +1,9 @@
 // SPDX-License-Identifier: GPL-2.0+
 /*
  * Copyright (c) 2015 Google, Inc
- * (C) Copyright 2001-2015
- * DENX Software Engineering -- w...@denx.de
- * Compulab Ltd - http://compulab.co.il/
+ * (C) Copyright 2015
  * Bernecker & Rainer Industrieelektronik GmbH - http://www.br-automation.com
+ * (C) Copyright 2023 Dzmitry Sankouski 
  */
 
 #include 
@@ -12,47 +11,28 @@
 #include 
 #include 
 #include /* Get font data, width and height */
+#include "vidconsole_internal.h"
 
-static int console_normal_set_row(struct udevice *dev, uint row, int clr)
+static int console_set_row(struct udevice *dev, uint row, int clr)
 {
struct video_priv *vid_priv = dev_get_uclass_priv(dev->parent);
-   void *line, *end;
+   void *line, *dst, *end;
int pixels = VIDEO_FONT_HEIGHT * vid_priv->xsize;
int ret;
int i;
+   int pbytes;
+
+   ret = check_bpix_support(vid_priv->bpix);
+   if (ret)
+   return ret;
 
line = vid_priv->fb + row * VIDEO_FONT_HEIGHT * vid_priv->line_length;
-   switch (vid_priv->bpix) {
-   case VIDEO_BPP8:
-   if (IS_ENABLED(CONFIG_VIDEO_BPP8)) {
-   uint8_t *dst = line;
-
-   for (i = 0; i < pixels; i++)
-   *dst++ = clr;
-   end = dst;
-   break;
-   }
-   case VIDEO_BPP16:
-   if (IS_ENABLED(CONFIG_VIDEO_BPP16)) {
-   uint16_t *dst = line;
-
-   for (i = 0; i < pixels; i++)
-   *dst++ = clr;
-   end = dst;
-   break;
-   }
-   case VIDEO_BPP32:
-   if (IS_ENABLED(CONFIG_VIDEO_BPP32)) {
-   uint32_t *dst = line;
-
-   for (i = 0; i < pixels; i++)
-   *dst++ = clr;
-   end = dst;
-   break;
-   }
-   default:
-   return -ENOSYS;
-   }
+   dst = line;
+   pbytes = VNBYTES(vid_priv->bpix);
+   for (i = 0; i < pixels; i++)
+   fill_pixel_and_goto_next(, clr, pbytes, pbytes);
+   end = dst;
+
ret = vidconsole_sync_copy(dev, line, end);
if (ret)
return ret;
@@ -60,8 +40,8 @@ static int console_normal_set_row(struct udevice *dev, uint 
row, int clr)
return 0;
 }
 
-static int console_normal_move_rows(struct udevice *dev, uint rowdst,
-uint rowsrc, uint count)
+static int console_move_rows(struct udevice *dev, uint rowdst,
+uint rowsrc, uint count)
 {
struct video_priv *vid_priv = dev_get_uclass_priv(dev->parent);
void *dst;
@@ -79,70 +59,30 @@ static int console_normal_move_rows(struct udevice *dev, 
uint rowdst,
return 0;
 }
 
-static int console_normal_putc_xy(struct udevice *dev, uint x_frac, uint y,
- char ch)
+static int console_putc_xy(struct udevice *dev, uint x_frac, uint y, char ch)
 {
struct vidconsole_priv *vc_priv = dev_get_uclass_priv(dev);
struct udevice *vid = dev->parent;
struct video_priv *vid_priv = dev_get_uclass_priv(vid);
-   int i, row;
-   void *start;
-   void *line;
-   int ret;
+   int pbytes = VNBYTES(vid_priv->bpix);
+   int x, linenum, ret;
+   void *start, *line;
+   uchar *pfont = video_fontdata + (u8)ch * VIDEO_FONT_HEIGHT;
 
-   start = vid_priv->fb + y * vid_priv->line_length +
-   VID_TO_PIXEL(x_frac) * VNBYTES(vid_priv->bpix);
+   if (x_frac + VID_TO_POS(vc_priv->x_charsize) > vc_priv->xsize_frac)
+   return -EAGAIN;
+   linenum = y;
+   x = VID_TO_PIXEL(x_frac);
+   start = vid_priv->fb + linenum * vid_priv->line_length + x * pbytes;
line = start;
 
if (x_frac + VID_TO_POS(vc_priv->x_charsize) > 

[PATCH v4 0/1] vidconsole: refactoring and support for wider fonts

2023-02-17 Thread Dzmitry Sankouski
In version 4, only first patch sent, because review fixes to this would add
large rebase & patch formatting overhead. When it'll receive reviewed tag,
I'll resent entire rebased series.

Modern mobile phones typically have high pixel density.
Bootmenu is hardly readable on those with 8x16 font.

This patch series aims to add wider fonts for devices with high ppi.

Add 16x32, 12x22 fonts from linux, and allow font size configuration.

There was significant changes in version 2:
- fix video tests failures
- add runtime font size configuration
- add test for 12x22 font

In version 3,
'video console: add select font logic to vidconsole uclass driver'
patch was removed in favor of already merged patch
'video: Add font functions to the vidconsole API'

Dzmitry Sankouski (1):
  video console: refactoring and optimization

 drivers/video/console_normal.c  | 150 +++-
 drivers/video/console_rotate.c  | 364 
 drivers/video/vidconsole_internal.h | 148 +++
 3 files changed, 288 insertions(+), 374 deletions(-)
 create mode 100644 drivers/video/vidconsole_internal.h

-- 
2.30.2



Re: [PATCHv2 12/13] global: Add a select for ARCH_MISC_INIT where used

2023-02-17 Thread Tom Rini
On Fri, Feb 17, 2023 at 03:40:28PM +0100, Marek Vasut wrote:
> On 2/17/23 15:00, Tom Rini wrote:
> > On Fri, Feb 17, 2023 at 02:33:28PM +0100, Marek Vasut wrote:
> > > On 2/17/23 13:50, Tom Rini wrote:
> > > > When we have an arch_misc_init function, we can select it to ensure it's
> > > > used.
> > > > 
> > > > In that there is a functional change here, it's that on i.MX6 it's
> > > > always been possible to populate "serial#" with something meaningful,
> > > > but not every platform was taking the hook, and now it is.
> > > > 
> > > > Signed-off-by: Tom Rini 
> > > > ---
> > > > Cc: Marcel Ziswiler 
> > > > Cc: Marek Vasut 
> > > > Cc: Olaf Mandel 
> > > > Cc: Stefano Babic 
> > > > Cc: Fabio Estevam 
> > > > Cc: NXP i.MX U-Boot Team 
> > > > 
> > > > Changes in v2:
> > > > - Always select ARCH_MISC_INIT on IMX8M as dealing with FSL_CAAM or not
> > > > needs further SoC-specific clean up work. This replaces patches 10 
> > > > and
> > > > 11 from before so that if the user enables FSL_CAAM then they will
> > > > continue to get the functionality they had before. As Marek noted 
> > > > in the
> > > > thread, further clean-up in this area would be good.
> > > 
> > > The SPL code does not automatically call arch_misc_init() if 
> > > ARCH_MISC_INIT
> > > is selected , so this won't work as-is. Is there another patch on which I
> > > wasn't CCed which deals with that ?
> > 
> > This preserves the exiting behavior, nothing more.
> 
> Where does the arch_misc_init() get called from in SPL ?
> If that remains in board code for now, then yeah, fine by me.

Yes, it's still on the board to call arch_misc_init() inside
spl_board_init().

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH v2 6/6] RFC: binman: Improve allow missing for mkimage entry

2023-02-17 Thread Jonas Karlman

Hi Simon,
On 2023-02-17 03:55, Simon Glass wrote:

Hi Jonas,

On Wed, 15 Feb 2023 at 11:25, Jonas Karlman  wrote:


Hi Simon,

On 2023-02-14 20:48, Simon Glass wrote:

Hi Jonas,

On Tue, 14 Feb 2023 at 03:34, Jonas Karlman  wrote:


Implement CheckMissing and CheckOptional methods that is adapted to
Entry_mkimage in order to improve support for allow missing flag.

Use collect_contents_to_file in multiple-data-files handling to improve
support for allow missing and fake blobs handling.

Signed-off-by: Jonas Karlman 
---
Building for RK3568 without ROCKCHIP_TPL will result in the following
error message, regardless if BINMAN_ALLOW_MISSING is used or not.

   binman: Filename 'rockchip-tpl' not found in input path (...)

With this patch and using BINMAN_ALLOW_MISSING=1 a new external blob
with no content is created and then passed to mkimage, resulting in an
error from the mkimage command.

   binman: Error 255 running 'mkimage -d 
./mkimage-0.simple-bin.mkimage:./mkimage-1.simple-bin.mkimage -n rk3568 -T rksd 
./idbloader.img': mkimage: Can't read ./mkimage-0.simple-bin.mkimage: Invalid 
argument

If the --fake-ext-blobs argument is also used I get the message I was
expecting to see from the beginning.

   Image 'main-section' is missing external blobs and is non-functional: 
rockchip-tpl

   /binman/simple-bin/mkimage/rockchip-tpl:
  An external TPL is required to initialize DRAM. Get the external TPL
  binary and build with ROCKCHIP_TPL=/path/to/ddr.bin. One possible source
  for the external TPL binary is https://github.com/rockchip-linux/rkbin   
Image 'main-section' has faked external blobs and is non-functional: 
rockchip-tpl

   Some images are invalid

Not sure how this should work, but I was expecting to see the message
about the missing rockchip-tpl from the beginning instead of the generic
"not found in input path" message. At leas with BINMAN_ALLOW_MISSING=1.

  tools/binman/etype/mkimage.py | 37 +++
  1 file changed, 33 insertions(+), 4 deletions(-)

diff --git a/tools/binman/etype/mkimage.py b/tools/binman/etype/mkimage.py
index cb264c3cad0b..44510a8c40ba 100644
--- a/tools/binman/etype/mkimage.py
+++ b/tools/binman/etype/mkimage.py
@@ -153,10 +153,12 @@ class Entry_mkimage(Entry):
  if self._multiple_data_files:
  fnames = []
  uniq = self.GetUniqueName()
-for entry in self._mkimage_entries.values():
-if not entry.ObtainContents(fake_size=fake_size):
+for idx, entry in enumerate(self._mkimage_entries.values()):
+entry_data, entry_fname, _ = self.collect_contents_to_file(
+[entry], 'mkimage-%s' % idx, fake_size)
+if entry_data is None:


This is OK, I suppose, but I'm not quite sure what actually changes
here, other than writing each entry to a file?


The collect_contents_to_file function seemed to handle the
external/missing/optional/faked entry flags. So I changed to use that
function in order to see if that would change anything, see below.

Use of this function does make it possible to use entry type other
then external blobs, not sure if that would ever be needed/useful.



Also, if you do this, please add / extend a test that checks that the
output files are written, since there is otherwise no coverage here.

What test uses these optional mkimage pieces?


Sorry, I was not clear enough about the reason for these changes in my
message above.

Building with --rockchip-tpl-path=/path/to/existing/tpl works as
expected and generates a working image.

I was expecting that the missing-blob-help message added in patch 1
would be shown by binman when rockchip-tpl-path was empty/not-existing,
or at least together with the allow-missing flag.

However, whatever I tested, empty/none-existing rockchip-tpl-path,
allow-missing, fake-ext-blobs, I was not able to see this message.
Instead, all I could get from binman was this "Filename 'rockchip-tpl'
not found in input path" message.

Maybe my assumptions about when these missing messages should be shown
is wrong?

Trying binman with the following two dts and --allow-missing gives
different results. First one shows the missing message, second one show
filename not found.

binman {
 rockchip-tpl {
 };
};

binman {
 mkimage {
 args = "-n rk3568 -T rksd";
 multiple-data-files;

 rockchip-tpl {
 };
 };
};

With the changes in this patch I instead get the missing message when I
also add the --fake-ext-blobs flag, so it clearly needs more work or
a completely different approach if we want to be able to see the missing
message added in patch 1.

Adding a message that never will be displayed annoys me :-)
Maybe I should just drop this rfc/patch for a v3 of this series?



Does the mkimage etype need a CheckMissing() function? That is how
binman knows whether something is missing.


I think I have 

Re: [PATCHv2 12/13] global: Add a select for ARCH_MISC_INIT where used

2023-02-17 Thread Marek Vasut

On 2/17/23 15:00, Tom Rini wrote:

On Fri, Feb 17, 2023 at 02:33:28PM +0100, Marek Vasut wrote:

On 2/17/23 13:50, Tom Rini wrote:

When we have an arch_misc_init function, we can select it to ensure it's
used.

In that there is a functional change here, it's that on i.MX6 it's
always been possible to populate "serial#" with something meaningful,
but not every platform was taking the hook, and now it is.

Signed-off-by: Tom Rini 
---
Cc: Marcel Ziswiler 
Cc: Marek Vasut 
Cc: Olaf Mandel 
Cc: Stefano Babic 
Cc: Fabio Estevam 
Cc: NXP i.MX U-Boot Team 

Changes in v2:
- Always select ARCH_MISC_INIT on IMX8M as dealing with FSL_CAAM or not
needs further SoC-specific clean up work. This replaces patches 10 and
11 from before so that if the user enables FSL_CAAM then they will
continue to get the functionality they had before. As Marek noted in the
thread, further clean-up in this area would be good.


The SPL code does not automatically call arch_misc_init() if ARCH_MISC_INIT
is selected , so this won't work as-is. Is there another patch on which I
wasn't CCed which deals with that ?


This preserves the exiting behavior, nothing more.


Where does the arch_misc_init() get called from in SPL ?
If that remains in board code for now, then yeah, fine by me.


Re: [PATCH v3 9/9] video console: add 12x22 console simple font test

2023-02-17 Thread Dzmitry Sankouski
How does CONSOLE_TRUETYPE interfere with CONFIG_VIDEO_FONT_SUN12X22?


I've got all video tests passed:

make sandbox_defconfig && make -j4 && ./u-boot -T -c 'ut dm'
(...)
Test: dm_test_video_ansi: video.c
Test: dm_test_video_base: video.c
Test: dm_test_video_base: video.c (flat tree)
Test: dm_test_video_bmp: video.c
Test: dm_test_video_bmp16: video.c
Test: dm_test_video_bmp24: video.c
Test: dm_test_video_bmp24_32: video.c
Test: dm_test_video_bmp32: video.c
Test: dm_test_video_bmp8: video.c
Test: dm_test_video_bmp_comp: video.c
Test: dm_test_video_chars: video.c
Test: dm_test_video_comp_bmp32: video.c
Test: dm_test_video_comp_bmp8: video.c
Test: dm_test_video_context: video.c
Test: dm_test_video_rotation1: video.c
Test: dm_test_video_rotation2: video.c
Test: dm_test_video_rotation3: video.c
Test: dm_test_video_text: video.c
Test: dm_test_video_text_12x22: video.c
Test: dm_test_video_truetype: video.c
Test: dm_test_video_truetype_bs: video.c
Test: dm_test_video_truetype_scroll: video.c
Test: dm_test_virtio_all_ops: virtio_device.c
Test: dm_test_virtio_all_ops: virtio_device.c (flat tree)
Test: dm_test_virtio_base: virtio_device.c
(...)

чт, 16 февр. 2023 г. в 02:50, Simon Glass :
>
> Hi Dzmitry,
>
> On Wed, 15 Feb 2023 at 04:43, Dzmitry Sankouski  wrote:
> >
> > Tests fonts wider than a byte.
> >
> > Signed-off-by: Dzmitry Sankouski 
> > Reviewed-by: Simon Glass 
>
> I found a problem with this
>
> > ---
> > Changes for v2: N/A
> > Changes for v2: none
> >
> >  configs/sandbox_defconfig |  3 +++
> >  test/dm/video.c   | 41 +++
> >  2 files changed, 44 insertions(+)
> >
> > diff --git a/configs/sandbox_defconfig b/configs/sandbox_defconfig
> > index 34c342b6f5..625ca35f5c 100644
> > --- a/configs/sandbox_defconfig
> > +++ b/configs/sandbox_defconfig
> > @@ -337,3 +337,6 @@ CONFIG_TEST_FDTDEC=y
> >  CONFIG_UNIT_TEST=y
> >  CONFIG_UT_TIME=y
> >  CONFIG_UT_DM=y
> > +CONFIG_CMD_SELECT_FONT=y
> > +CONFIG_VIDEO_FONT_8X16=y
> > +CONFIG_VIDEO_FONT_SUN12X22=y
>
> I don't think you can enable this, since sandbox uses
> CONSOLE_TRUETYPE. Can we perhaps use sandbox_flattree to run this
> test?
>
> Also, for me the tests crash with signal 8 (I think).
>
> > diff --git a/test/dm/video.c b/test/dm/video.c
> > index 17a33cc7af..30778157d9 100644
> > --- a/test/dm/video.c
> > +++ b/test/dm/video.c
> > @@ -151,6 +151,8 @@ static int dm_test_video_text(struct unit_test_state 
> > *uts)
> >
> > ut_assertok(select_vidconsole(uts, "vidconsole0"));
> > ut_assertok(video_get_nologo(uts, ));
> > +   ut_assertok(uclass_get_device(UCLASS_VIDEO_CONSOLE, 0, ));
> > +   ut_assertok(vidconsole_select_font(con, "8x16", 0));
> > ut_asserteq(46, compress_frame_buffer(uts, dev));
> >
> > ut_assertok(uclass_get_device(UCLASS_VIDEO_CONSOLE, 0, ));
> > @@ -175,6 +177,42 @@ static int dm_test_video_text(struct unit_test_state 
> > *uts)
> >  }
> >  DM_TEST(dm_test_video_text, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT);
> >
> > +static int dm_test_video_text_12x22(struct unit_test_state *uts)
> > +{
> > +   struct udevice *dev, *con;
> > +   int i;
> > +
> > +#define WHITE  0x
> > +#define SCROLL_LINES   100
> > +
> > +   ut_assertok(select_vidconsole(uts, "vidconsole0"));
> > +   ut_assertok(video_get_nologo(uts, ));
> > +   ut_assertok(uclass_get_device(UCLASS_VIDEO_CONSOLE, 0, ));
> > +   ut_assertok(vidconsole_select_font(con, "12x22", 0));
> > +   ut_asserteq(46, compress_frame_buffer(uts, dev));
> > +
> > +   ut_assertok(uclass_get_device(UCLASS_VIDEO_CONSOLE, 0, ));
> > +   vidconsole_putc_xy(con, 0, 0, 'a');
> > +   ut_asserteq(89, compress_frame_buffer(uts, dev));
> > +
> > +   vidconsole_putc_xy(con, 0, 0, ' ');
> > +   ut_asserteq(46, compress_frame_buffer(uts, dev));
> > +
> > +   for (i = 0; i < 20; i++)
> > +   vidconsole_putc_xy(con, VID_TO_POS(i * 8), 0, ' ' + i);
> > +   ut_asserteq(363, compress_frame_buffer(uts, dev));
> > +
> > +   vidconsole_set_row(con, 0, WHITE);
> > +   ut_asserteq(46, compress_frame_buffer(uts, dev));
> > +
> > +   for (i = 0; i < 20; i++)
> > +   vidconsole_putc_xy(con, VID_TO_POS(i * 8), 0, ' ' + i);
> > +   ut_asserteq(363, compress_frame_buffer(uts, dev));
> > +
> > +   return 0;
> > +}
> > +DM_TEST(dm_test_video_text_12x22, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT);
> > +
> >  /* Test handling of special characters in the console */
> >  static int dm_test_video_chars(struct unit_test_state *uts)
> >  {
> > @@ -184,6 +222,7 @@ static int dm_test_video_chars(struct unit_test_state 
> > *uts)
> > ut_assertok(select_vidconsole(uts, "vidconsole0"));
> > ut_assertok(video_get_nologo(uts, ));
> > ut_assertok(uclass_get_device(UCLASS_VIDEO_CONSOLE, 0, ));
> > +   ut_assertok(vidconsole_select_font(con, "8x16", 0));
> > vidconsole_put_string(con, test_string);
> > 

Re: [PATCH 10/13] verdin-imx8mm: Remove unused SPL_BOARD_INIT

2023-02-17 Thread Tom Rini
On Fri, Feb 17, 2023 at 01:18:34PM +, Marcel Ziswiler wrote:
> Hi Tom
> 
> On Thu, 2023-02-16 at 13:37 +0100, Marcel Ziswiler wrote:
> > On Wed, 2023-02-15 at 22:36 -0500, Tom Rini wrote:
> > > On this platform SPL_BOARD_INIT is used to call arch_misc_init which is
> > > in turn empty, drop the call.
> > > 
> > > Cc: Marcel Ziswiler 
> > > Signed-off-by: Tom Rini 
> > 
> > Acked-by: Marcel Ziswiler 
> 
> Sorry, I have to take my ack back. Marek (and Francesco) are, of course, 
> right and this is indeed needed for
> CAAM. Please see also [1] where it got changed/introduced in/to the current 
> form.
> 
> [1] https://lore.kernel.org/all/20220919194118.105820-1-ma...@denx.de/

Alright, yeah. I've posted v2 which preserves the existing behavior, but
it could be improved further still by someone with the hardware to
confirm behavior on.

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCHv2 12/13] global: Add a select for ARCH_MISC_INIT where used

2023-02-17 Thread Tom Rini
On Fri, Feb 17, 2023 at 02:33:28PM +0100, Marek Vasut wrote:
> On 2/17/23 13:50, Tom Rini wrote:
> > When we have an arch_misc_init function, we can select it to ensure it's
> > used.
> > 
> > In that there is a functional change here, it's that on i.MX6 it's
> > always been possible to populate "serial#" with something meaningful,
> > but not every platform was taking the hook, and now it is.
> > 
> > Signed-off-by: Tom Rini 
> > ---
> > Cc: Marcel Ziswiler 
> > Cc: Marek Vasut 
> > Cc: Olaf Mandel 
> > Cc: Stefano Babic 
> > Cc: Fabio Estevam 
> > Cc: NXP i.MX U-Boot Team 
> > 
> > Changes in v2:
> > - Always select ARCH_MISC_INIT on IMX8M as dealing with FSL_CAAM or not
> >needs further SoC-specific clean up work. This replaces patches 10 and
> >11 from before so that if the user enables FSL_CAAM then they will
> >continue to get the functionality they had before. As Marek noted in the
> >thread, further clean-up in this area would be good.
> 
> The SPL code does not automatically call arch_misc_init() if ARCH_MISC_INIT
> is selected , so this won't work as-is. Is there another patch on which I
> wasn't CCed which deals with that ?

This preserves the exiting behavior, nothing more.

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH v2 3/5] usb: xhci-mtk: modify the SOF/ITP interval for mt8195

2023-02-17 Thread Marek Vasut

On 2/17/23 10:04, Chunfeng Yun wrote:

There are 4 USB controllers on MT8195, the controllers (IP1~IP3,
exclude IP0) have a wrong default SOF/ITP interval which is
calculated from the frame counter clock 24Mhz by default, but
in fact, the frame counter clock is 48Mhz, so we shall set the
accurate interval according to 48Mhz for those controllers.

Note:
The first controller no need set it, but if set it, shall change
tphy's pll at the same time.

Signed-off-by: Chunfeng Yun 


Reviewed-by: Marek Vasut 

Feel free to pull the entire series via mediatek tree, so it would go in 
together.


Re: [PATCHv2 12/13] global: Add a select for ARCH_MISC_INIT where used

2023-02-17 Thread Marek Vasut

On 2/17/23 13:50, Tom Rini wrote:

When we have an arch_misc_init function, we can select it to ensure it's
used.

In that there is a functional change here, it's that on i.MX6 it's
always been possible to populate "serial#" with something meaningful,
but not every platform was taking the hook, and now it is.

Signed-off-by: Tom Rini 
---
Cc: Marcel Ziswiler 
Cc: Marek Vasut 
Cc: Olaf Mandel 
Cc: Stefano Babic 
Cc: Fabio Estevam 
Cc: NXP i.MX U-Boot Team 

Changes in v2:
- Always select ARCH_MISC_INIT on IMX8M as dealing with FSL_CAAM or not
   needs further SoC-specific clean up work. This replaces patches 10 and
   11 from before so that if the user enables FSL_CAAM then they will
   continue to get the functionality they had before. As Marek noted in the
   thread, further clean-up in this area would be good.


The SPL code does not automatically call arch_misc_init() if 
ARCH_MISC_INIT is selected , so this won't work as-is. Is there another 
patch on which I wasn't CCed which deals with that ?


Re: [RFC PATCH v3] doc: arch: Add document for RISC-V architecture

2023-02-17 Thread Heinrich Schuchardt

On 2/14/23 11:18, Yu Chien Peter Lin wrote:

This patch adds a brief introduction to the RISC-V architecture and
the typical boot process used on a variety of RISC-V platforms.

Signed-off-by: Yu Chien Peter Lin 
Reviewed-by: Samuel Holland 
Reviewed-by: Simon Glass 
Reviewed-by: Rick Chen 
---
Changes v1 -> v2
- Use 'boot phases' rather than 'boot stages'
- Pick up Samuel and Simon's RB tags
Changes v2 -> v3
- Follow the suggestion by Heinrich [1]
- Add the document as an entry of Andes maintainer in MAINTAINERS
- Add some pointers to OpenSBI document

[1] 
https://patchwork.ozlabs.org/project/uboot/patch/20230212070053.14800-1-peter...@andestech.com/
---
  MAINTAINERS|  1 +
  doc/arch/index.rst |  1 +
  doc/arch/riscv.rst | 74 ++
  3 files changed, 76 insertions(+)
  create mode 100644 doc/arch/riscv.rst

diff --git a/MAINTAINERS b/MAINTAINERS
index b9c505d5fa..5eb79faf29 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1292,6 +1292,7 @@ S:Maintained
  T:git https://source.denx.de/u-boot/custodians/u-boot-riscv.git
  F:arch/riscv/
  F:cmd/riscv/
+F: doc/arch/riscv.rst
  F:doc/usage/sbi.rst
  F:drivers/sysreset/sysreset_sbi.c
  F:drivers/timer/andes_plmt_timer.c
diff --git a/doc/arch/index.rst b/doc/arch/index.rst
index b3e85f9bf3..b8da4b8c8e 100644
--- a/doc/arch/index.rst
+++ b/doc/arch/index.rst
@@ -11,6 +11,7 @@ Architecture-specific doc
 m68k
 mips
 nios2
+   riscv
 sandbox/index
 sh
 x86
diff --git a/doc/arch/riscv.rst b/doc/arch/riscv.rst
new file mode 100644
index 00..10bf3e6849
--- /dev/null
+++ b/doc/arch/riscv.rst
@@ -0,0 +1,74 @@
+.. SPDX-License-Identifier: GPL-2.0+
+.. Copyright (C) 2023, Yu Chien Peter Lin 
+
+RISC-V
+==
+
+Overview
+
+
+This document outlines the U-Boot boot process for the RISC-V architecture.
+RISC-V is an open-source instruction set architecture (ISA) based on the
+principles of reduced instruction set computing (RISC). It has been designed
+to be flexible and customizable, allowing it to be adapted to different use
+cases, from embedded systems to high performance servers.
+
+Typical Boot Process
+
+
+U-Boot can run in either M-mode or S-mode, depending on whether it runs before
+the initialization of the firmware providing SBI (Supervisor Binary Interface).
+The firmware is necessary in the RISC-V boot process as it serves as a SEE
+(Supervisor Execution Environment) to handle exceptions for the S-mode U-Boot
+or Operating System.
+
+In between the boot phases, the hartid is passed through the a0 register, and
+the start address of the devicetree is passed through the a1 register.
+
+As a reference, OpenSBI is an SBI implementation that can be used with U-Boot
+in different modes, see the `OpenSBI firmware document 
`_ for 
more details.
+
+M-mode U-Boot
+^
+
+When running in M-mode U-Boot, it will load the payload image (e.g. `fw_payload 
`_)
+which contains the firmware and the S-mode Operating System; in this case, you
+can use mkimage to package the payload image into an uImage format, and boot it
+using the bootm command.
+
+The following diagram illustrates the boot process::
+
+   <---( M-mode )--><--( S-mode )-->
+   +--+   +--+++
+   |  U-Boot  |-->| SBI firmware |--->| OS |
+   +--+   +--+++
+
+To examine the boot process with the QEMU virt machine, you can follow the
+steps in the "Building U-Boot" section of the following document:
+:doc:`../board/emulation/qemu-riscv.rst`


This patch does not build. '.rst' has to removed here.

doc/arch/riscv.rst:46:unknown document: ../board/emulation/qemu-riscv.rst
make[1]: *** [doc/Makefile:70: htmldocs] Error 2
make: *** [Makefile:2348: htmldocs] Error 2

Please, execute the build process as described in

https://u-boot.readthedocs.io/en/latest/build/documentation.html#html-documentation

for testing your documentation patches.

I will fix this issue when merging. Thank you for the contribution.

Best regards

Heinrich


+
+S-mode U-Boot
+^
+
+RISC-V production boot images may include a U-Boot SPL for platform-specific
+initialization. The U-Boot SPL then loads a FIT image (u-boot.itb), which
+contains a firmware (e.g. `fw_dynamic 
`_)
 providing the SBI, as well as a regular
+U-Boot (or U-Boot proper) running in S-mode. Finally, the S-mode Operating
+System is loaded.
+
+The following diagram illustrates the boot process::
+
+   <-( M-mode )--><--( S-mode )--->
+   ++   +--++--+   +--+
+   | U-Boot SPL 

Re: [PATCH 10/13] verdin-imx8mm: Remove unused SPL_BOARD_INIT

2023-02-17 Thread Marcel Ziswiler
Hi Tom

On Thu, 2023-02-16 at 13:37 +0100, Marcel Ziswiler wrote:
> On Wed, 2023-02-15 at 22:36 -0500, Tom Rini wrote:
> > On this platform SPL_BOARD_INIT is used to call arch_misc_init which is
> > in turn empty, drop the call.
> > 
> > Cc: Marcel Ziswiler 
> > Signed-off-by: Tom Rini 
> 
> Acked-by: Marcel Ziswiler 

Sorry, I have to take my ack back. Marek (and Francesco) are, of course, right 
and this is indeed needed for
CAAM. Please see also [1] where it got changed/introduced in/to the current 
form.

[1] https://lore.kernel.org/all/20220919194118.105820-1-ma...@denx.de/

Cheers

Marcel

> > ---
> >  board/toradex/verdin-imx8mm/spl.c | 5 -
> >  configs/verdin-imx8mm_defconfig   | 1 -
> >  2 files changed, 6 deletions(-)
> > 
> > diff --git a/board/toradex/verdin-imx8mm/spl.c 
> > b/board/toradex/verdin-imx8mm/spl.c
> > index 9d54d60bb17d..3f33ff7d87a4 100644
> > --- a/board/toradex/verdin-imx8mm/spl.c
> > +++ b/board/toradex/verdin-imx8mm/spl.c
> > @@ -51,11 +51,6 @@ void spl_dram_init(void)
> > ddr_init(_timing);
> >  }
> >  
> > -void spl_board_init(void)
> > -{
> > -   arch_misc_init();
> > -}
> > -
> >  #ifdef CONFIG_SPL_LOAD_FIT
> >  int board_fit_config_name_match(const char *name)
> >  {
> > diff --git a/configs/verdin-imx8mm_defconfig 
> > b/configs/verdin-imx8mm_defconfig
> > index 5b5f7c051e54..0e7d67cf093d 100644
> > --- a/configs/verdin-imx8mm_defconfig
> > +++ b/configs/verdin-imx8mm_defconfig
> > @@ -40,7 +40,6 @@ CONFIG_BOARD_LATE_INIT=y
> >  CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
> >  CONFIG_SPL_BSS_START_ADDR=0x91
> >  CONFIG_SPL_BSS_MAX_SIZE=0x2000
> > -CONFIG_SPL_BOARD_INIT=y
> >  # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
> >  CONFIG_SPL_STACK=0x92
> >  CONFIG_SYS_SPL_MALLOC=y


[PATCHv2 12/13] global: Add a select for ARCH_MISC_INIT where used

2023-02-17 Thread Tom Rini
When we have an arch_misc_init function, we can select it to ensure it's
used.

In that there is a functional change here, it's that on i.MX6 it's
always been possible to populate "serial#" with something meaningful,
but not every platform was taking the hook, and now it is.

Signed-off-by: Tom Rini 
---
Cc: Marcel Ziswiler 
Cc: Marek Vasut 
Cc: Olaf Mandel 
Cc: Stefano Babic 
Cc: Fabio Estevam 
Cc: NXP i.MX U-Boot Team 

Changes in v2:
- Always select ARCH_MISC_INIT on IMX8M as dealing with FSL_CAAM or not
  needs further SoC-specific clean up work. This replaces patches 10 and
  11 from before so that if the user enables FSL_CAAM then they will
  continue to get the functionality they had before. As Marek noted in the
  thread, further clean-up in this area would be good.

---
 arch/arm/Kconfig  | 7 +++
 arch/arm/cpu/armv7/ls102xa/Kconfig| 1 +
 arch/arm/cpu/armv8/fsl-layerscape/Kconfig | 1 +
 arch/arm/mach-imx/imx8/Kconfig| 2 --
 arch/arm/mach-imx/imx8m/Kconfig   | 6 --
 arch/arm/mach-imx/mx6/Kconfig | 5 -
 arch/arm/mach-imx/mx7ulp/Kconfig  | 1 -
 arch/arm/mach-imx/mxs/Kconfig | 3 +++
 arch/arm/mach-omap2/Kconfig   | 1 +
 arch/arm/mach-tegra/tegra124/Kconfig  | 1 +
 arch/arm/mach-tegra/tegra20/Kconfig   | 1 +
 arch/arm/mach-tegra/tegra30/Kconfig   | 2 ++
 arch/mips/Kconfig | 1 +
 arch/powerpc/Kconfig  | 1 +
 14 files changed, 19 insertions(+), 14 deletions(-)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index c51f15fcf465..2838b1e87dbd 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -605,6 +605,7 @@ config ARCH_MVEBU
 
 config ARCH_ORION5X
bool "Marvell Orion"
+   select ARCH_MISC_INIT
select CPU_ARM926EJS
select GPIO_EXTRA_HEADER
select SPL_SEPARATE_BSS if SPL
@@ -819,6 +820,7 @@ config ARCH_LPC32XX
 config ARCH_IMX8
bool "NXP i.MX8 platform"
select ARM64
+   select ARCH_MISC_INIT if FSL_CAAM
select SYS_FSL_HAS_SEC
select SYS_FSL_SEC_COMPAT_4
select SYS_FSL_SEC_LE
@@ -832,6 +834,7 @@ config ARCH_IMX8
 config ARCH_IMX8M
bool "NXP i.MX8M platform"
select ARM64
+   select ARCH_MISC_INIT
select GPIO_EXTRA_HEADER
select MACH_IMX
select SYS_FSL_HAS_SEC
@@ -902,6 +905,7 @@ config ARCH_MX31
 
 config ARCH_MX7ULP
bool "NXP MX7ULP"
+   select ARCH_MISC_INIT if FSL_CAAM
select BOARD_POSTCLK_INIT
select CPU_V7A
select GPIO_EXTRA_HEADER
@@ -929,6 +933,7 @@ config ARCH_MX7
 
 config ARCH_MX6
bool "Freescale MX6"
+   select ARCH_MISC_INIT
select BOARD_POSTCLK_INIT
select CPU_V7A
select GPIO_EXTRA_HEADER
@@ -1023,6 +1028,7 @@ config ARCH_QEMU
 
 config ARCH_RMOBILE
bool "Renesas ARM SoCs"
+   select ARCH_MISC_INIT if !RZA1
select DM
select DM_SERIAL
select GPIO_EXTRA_HEADER
@@ -1198,6 +1204,7 @@ config ARCH_VERSAL_NET
 
 config ARCH_VF610
bool "Freescale Vybrid"
+   select ARCH_MISC_INIT
select CPU_V7A
select GPIO_EXTRA_HEADER
select IOMUX_SHARE_CONF_REG
diff --git a/arch/arm/cpu/armv7/ls102xa/Kconfig 
b/arch/arm/cpu/armv7/ls102xa/Kconfig
index 3e292bf70e18..4546025195b9 100644
--- a/arch/arm/cpu/armv7/ls102xa/Kconfig
+++ b/arch/arm/cpu/armv7/ls102xa/Kconfig
@@ -1,5 +1,6 @@
 config ARCH_LS1021A
bool
+   select ARCH_MISC_INIT if FSL_CAAM
select FSL_DEVICE_DISABLE
select FSL_IFC if !QSPI_BOOT && !SD_BOOT_QSPI
select LS102XA_STREAM_ID
diff --git a/arch/arm/cpu/armv8/fsl-layerscape/Kconfig 
b/arch/arm/cpu/armv8/fsl-layerscape/Kconfig
index a8b493e2f875..a42ede24f189 100644
--- a/arch/arm/cpu/armv8/fsl-layerscape/Kconfig
+++ b/arch/arm/cpu/armv8/fsl-layerscape/Kconfig
@@ -328,6 +328,7 @@ config ARCH_LX2160A
 
 config FSL_LSCH2
bool
+   select ARCH_MISC_INIT if FSL_CAAM
select SKIP_LOWLEVEL_INIT
select SYS_FSL_CCSR_GUR_BE
select SYS_FSL_CCSR_SCFG_BE
diff --git a/arch/arm/mach-imx/imx8/Kconfig b/arch/arm/mach-imx/imx8/Kconfig
index 37d12d189586..c211a1bb687e 100644
--- a/arch/arm/mach-imx/imx8/Kconfig
+++ b/arch/arm/mach-imx/imx8/Kconfig
@@ -75,7 +75,6 @@ config TARGET_IMX8QM_MEK
select BOARD_LATE_INIT
select IMX8QM
select FSL_CAAM
-   select ARCH_MISC_INIT
select SPL_CRYPTO if SPL
 
 config TARGET_CONGA_QMX8
@@ -98,7 +97,6 @@ config TARGET_IMX8QXP_MEK
select BOARD_LATE_INIT
select IMX8QXP
select FSL_CAAM
-   select ARCH_MISC_INIT
select SPL_CRYPTO if SPL
 
 endchoice
diff --git a/arch/arm/mach-imx/imx8m/Kconfig b/arch/arm/mach-imx/imx8m/Kconfig
index 5e4836b02feb..d6845c053718 100644
--- a/arch/arm/mach-imx/imx8m/Kconfig
+++ b/arch/arm/mach-imx/imx8m/Kconfig
@@ -51,7 +51,6 @@ config TARGET_IMX8MQ_EVK
select IMX8MQ
select 

Re: [PATCH 04/13] arm: rk3368: Select ARCH_EARLY_INIT_R when used

2023-02-17 Thread Quentin Schulz

Hi Tom,

On 2/16/23 04:36, Tom Rini wrote:

On the lion and evb-px5 platforms, we need this function, so select it.

Cc: Andy Yan 
Cc: Quentin Schulz 


Reviewed-by: Quentin Schulz 

Thanks,
Quentin


Re: [PATCH] binman: Avoid requiring a home directory on startup

2023-02-17 Thread Quentin Schulz

Hi all,

On 2/17/23 03:55, Simon Glass wrote:

Hi Tom,

On Thu, 16 Feb 2023 at 17:19, Tom Rini  wrote:


On Thu, Feb 16, 2023 at 05:12:33PM -0700, Simon Glass wrote:

Hi Tom,

On Tue, 14 Feb 2023 at 13:27, Tom Rini  wrote:


On Tue, Feb 14, 2023 at 03:12:46PM -0500, Mike Frysinger wrote:

On Tue, Feb 14, 2023 at 3:08 PM Tom Rini  wrote:

Downloading things from the internet and putting them in to the default
PATH always and forever is also kinda not great?


you just described a standard distribution.  this is like literally
how all of them work.  not to mention every other language-specific
distro tool out there (e.g. Python pip, Perl cpan, Go, etc...).

maybe you'd like more guarantees on top (e.g. signature verification)
which is reasonable.

but to be clear, this script is already merged & in the tree, so your
feedback doesn't block this patch.


Yes, exactly. This is a fix on top of what we do today, so it should go
in. But modern distributions only install signed packages, and
language-specific tools tend to be a hive of bad examples. Looking over
binman right now, I see that we're either using apt (and oh, there's
"aot" typo in one spot) or downloading from a known Google drive, for
only a few less common tools.

So yes, I would like to see some ideas on how to improve things in the
future so we aren't putting the binaries somewhere that's not a default
(or frequently common) PATH location.


Are you thinking they should go in ~/.binman-tools or something like
that? Then we would need to tell people to add it to their path. But
we could make binman look there automatically.


We should document that it's where we're putting stuff, not so much
"tell" them, unless you mean as a note when downloading.  But yes,
~/.binman-tools sounds reasonable.  Maybe a flag to point elsewhere?


OK I will take a look.



I think this should be directly put into the output/build directory used 
by U-Boot, because what happens when you have two U-Boot git repos with 
different version requirements for those host tools? Then you need to 
make sure you're not building both at the same time, that you update 
them properly before each build, etc.


We also have an issue with buildman creating (image) temporary files in 
the current git repo which makes people unhappy because they then get a 
dirty tree because we tend to forget to update the .gitignore. What 
about building out-of-tree by default like Buildroot does? e.g. with 
make O=$PWD/output/ ?


Cheers,
Quentin


sunxi A33 MIPI DSI LCD support

2023-02-17 Thread Mateusz Ferenc
Hello,

I have a PC tablet based on Allwinner A33 CPU and have LCD connected to
MIPI DSI interface.
I searched a lot, including U-Boot sources, but unfortunately I didn't find
any way to use it with mainline U-Boot.
I extracted fex file from Android partition of this tablet and there are
data about DSI interface used, but I have no clue how to use it with
mainline.

If you could provide me any useful information how to make it work or if
there are no drivers for that CPU and it's interface so I could write
driver for it.

Any information will be appreciated.

Kind regards,
Mateusz Ferenc


[PULL] u-boot-riscv/master

2023-02-17 Thread Leo Liang
Hi Tom,

The following changes since commit faac9dee8e0629326dc122f4624fc4897e3f38b0:

  Prepare v2023.04-rc2 (2023-02-13 18:39:15 -0500)

are available in the Git repository at:

  https://source.denx.de/u-boot/custodians/u-boot-riscv.git

for you to fetch changes up to 7574b6476afc1fd76816be6567458f6ca4f44234:

  riscv: binman: Add help message for missing blobs (2023-02-17 19:07:48 +0800)

CI result shows no issue: 
https://source.denx.de/u-boot/custodians/u-boot-riscv/-/pipelines/15225



- binman: Add help message if opensbi is absent when building u-boot SPL
- AndesTech: rename cpu and board name to 'andesv5' and 'ae350'
- Clean up cache operation for Andes ae350 platform


Leo Yu-Chi Liang (3):
  riscv: Remove redundant Kconfig "RISCV_NDS_CACHE"
  riscv: Rename Andes cpu and board names
  riscv: ae350: Adjust the memory layout of ae350

Rick Chen (1):
  riscv: binman: Add help message for missing blobs

Yu Chien Peter Lin (10):
  riscv: global_data.h: Correct the comment for PLICSW
  board: AndesTech: ax25-ae350.c: Enable v5l2-cache in spl_board_init()
  driver: cache: cache-v5l2: Update memory-mapped scheme to support Gen2 
platform
  riscv: cpu: ax25: Simplify cache enabling logic in harts_early_init()
  riscv: ae350: dts: Update L2 cache compatible string
  riscv: ax25: cache.c: Cleanups to L1/L2 cache function used in SPL
  configs: ae350: Enable v5l2 cache for AE350 platforms in SPL
  configs: ae350: Increase maximum retry count for AE350 platforms
  configs: ae350: Display CPU and board info for AE350 platforms
  driver: cache-v5l2: Fix type casting warning on RV32

 arch/riscv/Kconfig |   8 
 arch/riscv/cpu/{ax25 => andesv5}/Kconfig   |  11 +--
 arch/riscv/cpu/{ax25 => andesv5}/Makefile  |   0
 arch/riscv/cpu/andesv5/cache.c | 130 

 arch/riscv/cpu/andesv5/cpu.c   |  50 

 arch/riscv/cpu/{ax25 => andesv5}/spl.c |   0
 arch/riscv/cpu/ax25/cache.c| 172 
-
 arch/riscv/cpu/ax25/cpu.c  |  75 

 arch/riscv/dts/Makefile|   2 +-
 arch/riscv/dts/ae350_32.dts|   2 +-
 arch/riscv/dts/ae350_64.dts|   2 +-
 arch/riscv/dts/binman.dtsi |   1 +
 arch/riscv/include/asm/arch-andes/csr.h|  31 
++
 arch/riscv/include/asm/global_data.h   |   2 +-
 board/AndesTech/{ax25-ae350 => ae350}/Kconfig  |   8 
 board/AndesTech/{ax25-ae350 => ae350}/MAINTAINERS  |   6 +++---
 board/AndesTech/{ax25-ae350 => ae350}/Makefile |   2 +-
 board/AndesTech/{ax25-ae350/ax25-ae350.c => ae350/ae350.c} |  17 
+
 configs/ae350_rv32_defconfig   |   5 -
 configs/ae350_rv32_spl_defconfig   |  13 +
 configs/ae350_rv32_spl_xip_defconfig   |  13 +
 configs/ae350_rv32_xip_defconfig   |   5 -
 configs/ae350_rv64_defconfig   |   5 -
 configs/ae350_rv64_spl_defconfig   |  13 +
 configs/ae350_rv64_spl_xip_defconfig   |  13 +
 configs/ae350_rv64_xip_defconfig   |   5 -
 doc/board/AndesTech/{ax25-ae350.rst => ae350.rst}  |  16 

 doc/board/AndesTech/index.rst  |   2 +-
 drivers/cache/Kconfig  |   1 -
 drivers/cache/cache-v5l2.c |  36 
+--
 include/configs/{ax25-ae350.h => ae350.h}  |   0
 tools/binman/missing-blob-help |   6 ++
 32 files changed, 331 insertions(+), 321 deletions(-)
 rename arch/riscv/cpu/{ax25 => andesv5}/Kconfig (66%)
 rename arch/riscv/cpu/{ax25 => andesv5}/Makefile (100%)
 create mode 100644 arch/riscv/cpu/andesv5/cache.c
 create mode 100644 arch/riscv/cpu/andesv5/cpu.c
 rename arch/riscv/cpu/{ax25 => andesv5}/spl.c (100%)
 delete mode 100644 arch/riscv/cpu/ax25/cache.c
 delete mode 100644 arch/riscv/cpu/ax25/cpu.c
 create mode 

[PATCH v4 10/12] rockchip: rk3568: add rk3568 pinctrl driver

2023-02-17 Thread Jagan Teki
From: Jagan Teki 

Add driver supporting pin multiplexing on rk3568 platform.

Co-developed-by: Manoj Sai 
Signed-off-by: Manoj Sai 
Co-developed-by: Jianqun Xu 
Signed-off-by: Jianqun Xu 
Signed-off-by: Jagan Teki 
---
 drivers/pinctrl/rockchip/Makefile |   1 +
 drivers/pinctrl/rockchip/pinctrl-rk3568.c | 362 ++
 2 files changed, 363 insertions(+)
 create mode 100644 drivers/pinctrl/rockchip/pinctrl-rk3568.c

diff --git a/drivers/pinctrl/rockchip/Makefile 
b/drivers/pinctrl/rockchip/Makefile
index 9884355473..90461ae881 100644
--- a/drivers/pinctrl/rockchip/Makefile
+++ b/drivers/pinctrl/rockchip/Makefile
@@ -14,5 +14,6 @@ obj-$(CONFIG_ROCKCHIP_RK3308) += pinctrl-rk3308.o
 obj-$(CONFIG_ROCKCHIP_RK3328) += pinctrl-rk3328.o
 obj-$(CONFIG_ROCKCHIP_RK3368) += pinctrl-rk3368.o
 obj-$(CONFIG_ROCKCHIP_RK3399) += pinctrl-rk3399.o
+obj-$(CONFIG_ROCKCHIP_RK3568) += pinctrl-rk3568.o
 obj-$(CONFIG_ROCKCHIP_RV1108) += pinctrl-rv1108.o
 obj-$(CONFIG_ROCKCHIP_RV1126) += pinctrl-rv1126.o
diff --git a/drivers/pinctrl/rockchip/pinctrl-rk3568.c 
b/drivers/pinctrl/rockchip/pinctrl-rk3568.c
new file mode 100644
index 00..935aed9efc
--- /dev/null
+++ b/drivers/pinctrl/rockchip/pinctrl-rk3568.c
@@ -0,0 +1,362 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * (C) Copyright 2020 Rockchip Electronics Co., Ltd
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "pinctrl-rockchip.h"
+
+static struct rockchip_mux_route_data rk3568_mux_route_data[] = {
+   MR_TOPGRF(RK_GPIO0, RK_PB3, RK_FUNC_2, 0x0300, RK_GENMASK_VAL(0, 0, 
0)), /* CAN0 IO mux selection M0 */
+   MR_TOPGRF(RK_GPIO2, RK_PA1, RK_FUNC_4, 0x0300, RK_GENMASK_VAL(0, 0, 
1)), /* CAN0 IO mux selection M1 */
+   MR_TOPGRF(RK_GPIO1, RK_PA1, RK_FUNC_3, 0x0300, RK_GENMASK_VAL(2, 2, 
0)), /* CAN1 IO mux selection M0 */
+   MR_TOPGRF(RK_GPIO4, RK_PC3, RK_FUNC_3, 0x0300, RK_GENMASK_VAL(2, 2, 
1)), /* CAN1 IO mux selection M1 */
+   MR_TOPGRF(RK_GPIO4, RK_PB5, RK_FUNC_3, 0x0300, RK_GENMASK_VAL(4, 4, 
0)), /* CAN2 IO mux selection M0 */
+   MR_TOPGRF(RK_GPIO2, RK_PB2, RK_FUNC_4, 0x0300, RK_GENMASK_VAL(4, 4, 
1)), /* CAN2 IO mux selection M1 */
+   MR_TOPGRF(RK_GPIO4, RK_PC4, RK_FUNC_1, 0x0300, RK_GENMASK_VAL(6, 6, 
0)), /* EDPDP_HPDIN IO mux selection M0 */
+   MR_TOPGRF(RK_GPIO0, RK_PC2, RK_FUNC_2, 0x0300, RK_GENMASK_VAL(6, 6, 
1)), /* EDPDP_HPDIN IO mux selection M1 */
+   MR_TOPGRF(RK_GPIO3, RK_PB1, RK_FUNC_3, 0x0300, RK_GENMASK_VAL(8, 8, 
0)), /* GMAC1 IO mux selection M0 */
+   MR_TOPGRF(RK_GPIO4, RK_PA7, RK_FUNC_3, 0x0300, RK_GENMASK_VAL(8, 8, 
1)), /* GMAC1 IO mux selection M1 */
+   MR_TOPGRF(RK_GPIO4, RK_PD1, RK_FUNC_1, 0x0300, RK_GENMASK_VAL(10, 10, 
0)), /* HDMITX IO mux selection M0 */
+   MR_TOPGRF(RK_GPIO0, RK_PC7, RK_FUNC_1, 0x0300, RK_GENMASK_VAL(10, 10, 
1)), /* HDMITX IO mux selection M1 */
+   MR_TOPGRF(RK_GPIO0, RK_PB6, RK_FUNC_1, 0x0300, RK_GENMASK_VAL(14, 14, 
0)), /* I2C2 IO mux selection M0 */
+   MR_TOPGRF(RK_GPIO4, RK_PB4, RK_FUNC_1, 0x0300, RK_GENMASK_VAL(14, 14, 
1)), /* I2C2 IO mux selection M1 */
+   MR_TOPGRF(RK_GPIO1, RK_PA0, RK_FUNC_1, 0x0304, RK_GENMASK_VAL(0, 0, 
0)), /* I2C3 IO mux selection M0 */
+   MR_TOPGRF(RK_GPIO3, RK_PB6, RK_FUNC_4, 0x0304, RK_GENMASK_VAL(0, 0, 
1)), /* I2C3 IO mux selection M1 */
+   MR_TOPGRF(RK_GPIO4, RK_PB2, RK_FUNC_1, 0x0304, RK_GENMASK_VAL(2, 2, 
0)), /* I2C4 IO mux selection M0 */
+   MR_TOPGRF(RK_GPIO2, RK_PB1, RK_FUNC_2, 0x0304, RK_GENMASK_VAL(2, 2, 
1)), /* I2C4 IO mux selection M1 */
+   MR_TOPGRF(RK_GPIO3, RK_PB4, RK_FUNC_4, 0x0304, RK_GENMASK_VAL(4, 4, 
0)), /* I2C5 IO mux selection M0 */
+   MR_TOPGRF(RK_GPIO4, RK_PD0, RK_FUNC_2, 0x0304, RK_GENMASK_VAL(4, 4, 
1)), /* I2C5 IO mux selection M1 */
+   MR_TOPGRF(RK_GPIO3, RK_PD2, RK_FUNC_1, 0x0304, RK_GENMASK_VAL(6, 6, 
0)), /* PWM4 IO mux selection M0 */
+   MR_TOPGRF(RK_GPIO3, RK_PD2, RK_FUNC_1, 0x0304, RK_GENMASK_VAL(6, 6, 
1)), /* PWM4 IO mux selection M1 */
+   MR_TOPGRF(RK_GPIO3, RK_PD2, RK_FUNC_1, 0x0304, RK_GENMASK_VAL(8, 8, 
0)), /* PWM5 IO mux selection M0 */
+   MR_TOPGRF(RK_GPIO3, RK_PD2, RK_FUNC_1, 0x0304, RK_GENMASK_VAL(8, 8, 
1)), /* PWM5 IO mux selection M1 */
+   MR_TOPGRF(RK_GPIO3, RK_PD2, RK_FUNC_1, 0x0304, RK_GENMASK_VAL(10, 10, 
0)), /* PWM6 IO mux selection M0 */
+   MR_TOPGRF(RK_GPIO3, RK_PD2, RK_FUNC_1, 0x0304, RK_GENMASK_VAL(10, 10, 
1)), /* PWM6 IO mux selection M1 */
+   MR_TOPGRF(RK_GPIO3, RK_PD2, RK_FUNC_1, 0x0304, RK_GENMASK_VAL(12, 12, 
0)), /* PWM7 IO mux selection M0 */
+   MR_TOPGRF(RK_GPIO3, RK_PD2, RK_FUNC_1, 0x0304, RK_GENMASK_VAL(12, 12, 
1)), /* PWM7 IO mux selection M1 */
+   MR_TOPGRF(RK_GPIO3, RK_PD2, RK_FUNC_1, 0x0304, RK_GENMASK_VAL(14, 14, 
0)), /* PWM8 IO mux selection M0 */
+   MR_TOPGRF(RK_GPIO3, RK_PD2, RK_FUNC_1, 0x0304, RK_GENMASK_VAL(14, 14, 
1)), /* PWM8 IO mux selection M1 */
+   MR_TOPGRF(RK_GPIO3, RK_PD2, RK_FUNC_1, 

[PATCH v4 12/12] rk3566: radxa-cm3: Enable USB2.0, USB3.0 support

2023-02-17 Thread Jagan Teki
From: Manoj Sai 

=> usb start
starting USB...
Bus usb@fd00: Register 2000140 NbrPorts 2
Starting the controller
USB XHCI 1.10
Bus usb@fd80: USB EHCI 1.00
scanning bus usb@fd00 for devices... cannot reset port 1!?
2 USB Device(s) found
scanning bus usb@fd80 for devices... 4 USB Device(s) found
   scanning usb for storage devices... 2 Storage Device(s) found
=> usb tree
USB device tree:
  1  Hub (5 Gb/s, 0mA)
  |  U-Boot XHCI Host Controller
  |
  +-2  Mass Storage (5 Gb/s, 224mA)
   SanDisk Dual Drive 04019c9b2e1a58f24ee318c3c123aa5

  1  Hub (480 Mb/s, 0mA)
  |  u-boot EHCI Host Controller
  |
  +-2  Hub (480 Mb/s, 100mA)
|   USB 2.0 Hub
|
+-3  Mass Storage (480 Mb/s, 500mA)
|JetFlash Mass Storage Device 19M7I4ZQFTSC08SU
|
+-4  Human Interface (12 Mb/s, 98mA)
 Logitech USB Receiver

Co-developed-by: Suniel Mahesh 
Signed-off-by: Suniel Mahesh 
Signed-off-by: Manoj Sai 
---
 configs/radxa-cm3-io-rk3566_defconfig | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/configs/radxa-cm3-io-rk3566_defconfig 
b/configs/radxa-cm3-io-rk3566_defconfig
index a79d9b25e3..2100cf2cb2 100644
--- a/configs/radxa-cm3-io-rk3566_defconfig
+++ b/configs/radxa-cm3-io-rk3566_defconfig
@@ -38,6 +38,7 @@ CONFIG_SPL_STACK_R=y
 CONFIG_SPL_ATF=y
 CONFIG_CMD_GPT=y
 CONFIG_CMD_MMC=y
+CONFIG_CMD_USB=y
 # CONFIG_CMD_SETEXPR is not set
 # CONFIG_SPL_DOS_PARTITION is not set
 CONFIG_SPL_OF_CONTROL=y
@@ -57,10 +58,20 @@ CONFIG_MMC_SDHCI_SDMA=y
 CONFIG_MMC_SDHCI_ROCKCHIP=y
 CONFIG_ETH_DESIGNWARE=y
 CONFIG_GMAC_ROCKCHIP=y
+CONFIG_PHY_ROCKCHIP_INNO_USB2=y
+CONFIG_PHY_ROCKCHIP_NANENG_COMBOPHY=y
 CONFIG_REGULATOR_PWM=y
+CONFIG_DM_REGULATOR_GPIO=y
 CONFIG_PWM_ROCKCHIP=y
 CONFIG_SPL_RAM=y
 CONFIG_BAUDRATE=150
 CONFIG_DEBUG_UART_SHIFT=2
 CONFIG_SYSRESET=y
+CONFIG_USB=y
+CONFIG_USB_XHCI_HCD=y
+CONFIG_USB_XHCI_DWC3=y
+CONFIG_USB_EHCI_HCD=y
+CONFIG_USB_EHCI_GENERIC=y
+CONFIG_USB_DWC3=y
+CONFIG_USB_DWC3_GENERIC=y
 CONFIG_ERRNO_STR=y
-- 
2.25.1



[PATCH v4 11/12] rockchip: rk3568: Select DM_REGULATOR_FIXED

2023-02-17 Thread Jagan Teki
From: Manoj Sai 

Select the DM_REGULATOR_FIXED on RK3568 platform.

Co-developed-by: Suniel Mahesh 
Signed-off-by: Suniel Mahesh 
Signed-off-by: Manoj Sai 
---
 arch/arm/mach-rockchip/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/mach-rockchip/Kconfig b/arch/arm/mach-rockchip/Kconfig
index 3dc85df65d..6fa8c050cb 100644
--- a/arch/arm/mach-rockchip/Kconfig
+++ b/arch/arm/mach-rockchip/Kconfig
@@ -286,6 +286,7 @@ config ROCKCHIP_RK3568
select REGMAP
select SYSCON
select BOARD_LATE_INIT
+   select DM_REGULATOR_FIXED
select DM_RESET
imply ROCKCHIP_COMMON_BOARD
help
-- 
2.25.1



[PATCH v4 08/12] drivers: phy: add naneng combphy for rk3568

2023-02-17 Thread Jagan Teki
From: Jagan Teki 

RK3568 has three combo phys, and PCIe/USB3/SATA/QSGMII controllers
share one pipe interface for each combo phy, here is the diagram
of the complex connection.

++
|| +--+
| USB3 OTG CTRL0 |>|  |
|| |  | ++
++ | PIPE | ||
   | MUX  |>| Combo PHY0 |
++ |  | ||
|| |  | ++
|   SATA CTRL0   |>|  |
|| +--+
++

++
|| +--+
| USB3 HOST CTRL1|>|  |
|| |  | ++
++ | PIPE | ||
   | MUX  |>| Combo PHY1 |
++ |  | ||
||>|  | ++
|   SATA CTRL1   |  -->|  |
||  |  +--+
++  |
|
++  |
||  |  +--+
|  QSGMII CTRL   |>|  |
|| |  | ++
++ | PIPE | ||
   | MUX  |>| Combo PHY2 |
++ |  | ||
||>|  | ++
|   SATA CTRL2   |  -->|  |
||  |  +--+
++  |
|
++  |
||  |
|  PCIe2 1-Lane  |---
||
++

Co-developed-by: Manoj Sai 
Signed-off-by: Manoj Sai 
Co-developed-by: Yifeng Zhao 
Signed-off-by: Yifeng Zhao 
Signed-off-by: Jagan Teki 
---
 drivers/phy/rockchip/Kconfig  |   7 +
 drivers/phy/rockchip/Makefile |   1 +
 .../rockchip/phy-rockchip-naneng-combphy.c| 441 ++
 3 files changed, 449 insertions(+)
 create mode 100644 drivers/phy/rockchip/phy-rockchip-naneng-combphy.c

diff --git a/drivers/phy/rockchip/Kconfig b/drivers/phy/rockchip/Kconfig
index e477a6cd9e..1305763940 100644
--- a/drivers/phy/rockchip/Kconfig
+++ b/drivers/phy/rockchip/Kconfig
@@ -11,6 +11,13 @@ config PHY_ROCKCHIP_INNO_USB2
help
  Support for Rockchip USB2.0 PHY with Innosilicon IP block.
 
+config PHY_ROCKCHIP_NANENG_COMBOPHY
+   bool "Support Rockchip NANENG combo PHY Driver"
+   depends on ARCH_ROCKCHIP
+   select PHY
+   help
+ Enable this to support the Rockchip NANENG combo PHY.
+
 config PHY_ROCKCHIP_PCIE
bool "Rockchip PCIe PHY Driver"
depends on ARCH_ROCKCHIP
diff --git a/drivers/phy/rockchip/Makefile b/drivers/phy/rockchip/Makefile
index f6ad3bf59a..a236877234 100644
--- a/drivers/phy/rockchip/Makefile
+++ b/drivers/phy/rockchip/Makefile
@@ -4,6 +4,7 @@
 #
 
 obj-$(CONFIG_PHY_ROCKCHIP_INNO_USB2)   += phy-rockchip-inno-usb2.o
+obj-$(CONFIG_PHY_ROCKCHIP_NANENG_COMBOPHY) += phy-rockchip-naneng-combphy.o
 obj-$(CONFIG_PHY_ROCKCHIP_PCIE)+= phy-rockchip-pcie.o
 obj-$(CONFIG_PHY_ROCKCHIP_SNPS_PCIE3)  += phy-rockchip-snps-pcie3.o
 obj-$(CONFIG_PHY_ROCKCHIP_TYPEC)   += phy-rockchip-typec.o
diff --git a/drivers/phy/rockchip/phy-rockchip-naneng-combphy.c 
b/drivers/phy/rockchip/phy-rockchip-naneng-combphy.c
new file mode 100644
index 00..78da5fe797
--- /dev/null
+++ b/drivers/phy/rockchip/phy-rockchip-naneng-combphy.c
@@ -0,0 +1,441 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Rockchip USB3.0/PCIe Gen2/SATA/SGMII combphy driver
+ *
+ * Copyright (C) 2021 Rockchip Electronics Co., Ltd.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define BIT_WRITEABLE_SHIFT16
+
+struct rockchip_combphy_priv;
+
+struct combphy_reg {
+   u16 offset;
+   u16 bitend;
+   u16 bitstart;
+   u16 disable;
+   u16 enable;
+};
+
+struct rockchip_combphy_grfcfg {
+   struct combphy_reg pcie_mode_set;
+   struct combphy_reg usb_mode_set;
+   struct combphy_reg sgmii_mode_set;
+   struct combphy_reg qsgmii_mode_set;
+   struct combphy_reg pipe_rxterm_set;
+   struct combphy_reg pipe_txelec_set;
+   struct combphy_reg pipe_txcomp_set;
+   struct combphy_reg pipe_clk_25m;
+   struct combphy_reg pipe_clk_100m;
+   struct combphy_reg pipe_phymode_sel;
+   struct combphy_reg pipe_rate_sel;
+   struct combphy_reg pipe_rxterm_sel;
+   struct combphy_reg pipe_txelec_sel;
+   struct combphy_reg pipe_txcomp_sel;
+   struct combphy_reg pipe_clk_ext;
+   struct combphy_reg pipe_sel_usb;
+   struct combphy_reg pipe_sel_qsgmii;
+   struct combphy_reg pipe_phy_status;
+   struct combphy_reg con0_for_pcie;
+   struct combphy_reg con1_for_pcie;
+   struct combphy_reg con2_for_pcie;
+   struct combphy_reg con3_for_pcie;
+   struct combphy_reg 

[PATCH v4 06/12] phy: rockchip: inno-usb2: Add support #address_cells = 2

2023-02-17 Thread Jagan Teki
New Rockchip devices have the usb phy nodes as standalone devices.
These nodes have register nodes with #address_cells = 2, but only
use 32 bit addresses.

Adjust the driver to check if the returned address is "0", and adjust
the index in that case.

Derived and adjusted the similar change from linux-next with below
 commit <9c19c531dc98> ("phy: phy-rockchip-inno-usb2: support
 #address_cells = 2")

Co-developed-by: Manoj Sai 
Signed-off-by: Manoj Sai 
Signed-off-by: Jagan Teki 
---
 drivers/phy/rockchip/phy-rockchip-inno-usb2.c | 11 ++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c 
b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c
index b32a498ea7..a01148db22 100644
--- a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c
+++ b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c
@@ -179,12 +179,21 @@ static int rockchip_usb2phy_probe(struct udevice *dev)
if (IS_ERR(priv->reg_base))
return PTR_ERR(priv->reg_base);
 
-   ret = ofnode_read_u32(dev_ofnode(dev), "reg", );
+   ret = ofnode_read_u32_index(dev_ofnode(dev), "reg", 0, );
if (ret) {
dev_err(dev, "failed to read reg property (ret = %d)\n", ret);
return ret;
}
 
+   /* support address_cells=2 */
+   if (reg == 0) {
+   if (ofnode_read_u32_index(dev_ofnode(dev), "reg", 1, )) {
+   dev_err(dev, "%s must have reg[1]\n",
+   ofnode_get_name(dev_ofnode(dev)));
+   return -EINVAL;
+   }
+   }
+
phy_cfgs = (const struct rockchip_usb2phy_cfg *)
dev_get_driver_data(dev);
if (!phy_cfgs)
-- 
2.25.1



[PATCH v4 04/12] arm64: dts: rockchip: rk3566: Add Radxa Compute Module 3 IO

2023-02-17 Thread Jagan Teki
Radxa Compute Module 3(CM3) IO board an application board from Radxa
and is compatible with Raspberry Pi CM4 IO form factor.

Specification:
- 1x HDMI,
- 2x MIPI DSI
- 2x MIPI CSI2
- 1x eDP
- 1x PCIe card
- 2x SATA
- 2x USB 2.0 Host
- 1x USB 3.0
- 1x USB 2.0 OTG
- Phone jack
- microSD slot
- 40-pin GPIO expansion header
- 12V DC

Radxa CM3 needs to mount on top of this IO board in order to create
complete Radxa CM3 IO board platform.

linux-next commit for the same,

commit <8f19828844f2> ("arm64: dts: rockchip: Fix compatible for Radxa
CM3")

Add support for Radxa CM3 IO Board.

Co-developed-by: FUKAUMI Naoki 
Signed-off-by: FUKAUMI Naoki 
Co-developed-by: Manoj Sai 
Signed-off-by: Manoj Sai 
Signed-off-by: Jagan Teki 
---
 arch/arm/dts/Makefile|   1 +
 arch/arm/dts/rk3566-radxa-cm3-io.dts | 272 +++
 2 files changed, 273 insertions(+)
 create mode 100644 arch/arm/dts/rk3566-radxa-cm3-io.dts

diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index 9d647b9639..037ffc09b1 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -165,6 +165,7 @@ dtb-$(CONFIG_ROCKCHIP_RK3399) += \
rk3399pro-rock-pi-n10.dtb
 
 dtb-$(CONFIG_ROCKCHIP_RK3568) += \
+   rk3566-radxa-cm3-io.dtb \
rk3568-evb.dtb
 
 dtb-$(CONFIG_ROCKCHIP_RV1108) += \
diff --git a/arch/arm/dts/rk3566-radxa-cm3-io.dts 
b/arch/arm/dts/rk3566-radxa-cm3-io.dts
new file mode 100644
index 00..d89d5263cb
--- /dev/null
+++ b/arch/arm/dts/rk3566-radxa-cm3-io.dts
@@ -0,0 +1,272 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (c) 2022 Radxa Limited
+ * Copyright (c) 2022 Amarula Solutions(India)
+ */
+
+/dts-v1/;
+#include 
+#include "rk3566.dtsi"
+#include "rk3566-radxa-cm3.dtsi"
+
+/ {
+   model = "Radxa Compute Module 3(CM3) IO Board";
+   compatible = "radxa,cm3-io", "radxa,cm3", "rockchip,rk3566";
+
+   aliases {
+   mmc1 = 
+   };
+
+   chosen: chosen {
+   stdout-path = "serial2:150n8";
+   };
+
+   gmac1_clkin: external-gmac1-clock {
+   compatible = "fixed-clock";
+   clock-frequency = <12500>;
+   clock-output-names = "gmac1_clkin";
+   #clock-cells = <0>;
+   };
+
+   hdmi-con {
+   compatible = "hdmi-connector";
+   type = "a";
+
+   port {
+   hdmi_con_in: endpoint {
+   remote-endpoint = <_out_con>;
+   };
+   };
+   };
+
+   leds {
+   compatible = "gpio-leds";
+
+   led-1 {
+   gpios = < RK_PA4 GPIO_ACTIVE_LOW>;
+   color = ;
+   function = LED_FUNCTION_ACTIVITY;
+   linux,default-trigger = "heartbeat";
+   pinctrl-names = "default";
+   pinctrl-0 = <_nled_activity>;
+   };
+   };
+
+   vcc5v0_usb30: vcc5v0-usb30-regulator {
+   compatible = "regulator-fixed";
+   regulator-name = "vcc5v0_usb30";
+   enable-active-high;
+   gpio = < RK_PC2 GPIO_ACTIVE_HIGH>;
+   pinctrl-names = "default";
+   pinctrl-0 = <_usb30_en_h>;
+   regulator-always-on;
+   regulator-min-microvolt = <500>;
+   regulator-max-microvolt = <500>;
+   vin-supply = <_sys>;
+   };
+
+   vcca1v8_image: vcca1v8-image-regulator {
+   compatible = "regulator-fixed";
+   regulator-name = "vcca1v8_image";
+   regulator-always-on;
+   regulator-boot-on;
+   regulator-min-microvolt = <180>;
+   regulator-max-microvolt = <180>;
+   vin-supply = <_1v8_p>;
+   };
+
+   vdda0v9_image: vdda0v9-image-regulator {
+   compatible = "regulator-fixed";
+   regulator-name = "vcca0v9_image";
+   regulator-always-on;
+   regulator-boot-on;
+   regulator-min-microvolt = <90>;
+   regulator-max-microvolt = <90>;
+   vin-supply = <_0v9>;
+   };
+};
+
+ {
+   status = "okay";
+};
+
+ {
+   assigned-clocks = < SCLK_GMAC1_RX_TX>, < SCLK_GMAC1>;
+   assigned-clock-parents = < SCLK_GMAC1_RGMII_SPEED>, <_clkin>;
+   assigned-clock-rates = <0>, <12500>;
+   clock_in_out = "input";
+   phy-handle = <_phy1>;
+   phy-mode = "rgmii";
+   pinctrl-names = "default";
+   pinctrl-0 = <_miim
+_tx_bus2
+_rx_bus2
+_rgmii_clk
+_rgmii_bus
+_clkinout>;
+   snps,reset-gpio = < RK_PC2 GPIO_ACTIVE_LOW>;
+   snps,reset-active-low;
+   /* Reset time is 20ms, 100ms for rtl8211f */
+   snps,reset-delays-us = <0 2 10>;
+   tx_delay = <0x46>;
+ 

[PATCH v4 09/12] arm64: dts: rk356x-u-boot: Drop combphy1 assigned-clocks/rates

2023-02-17 Thread Jagan Teki
From: Jagan Teki 

combphy1 is failing to probe due to unhandled assigned-clocks and
assigned-clocks-rates.

=> usb start
starting USB...
Bus usb@fd00: Failed to get PHY1 for usb@fd00
Port not available.
Bus usb@fd80: USB EHCI 1.00

There is no real requirement for them in U-Boot to handle, hence
mark them as deleted-properties for the  probe to success

Signed-off-by: Jagan Teki 
---
 arch/arm/dts/rk356x-u-boot.dtsi | 5 +
 1 file changed, 5 insertions(+)

diff --git a/arch/arm/dts/rk356x-u-boot.dtsi b/arch/arm/dts/rk356x-u-boot.dtsi
index ccb8db0001..4e2d059fcf 100644
--- a/arch/arm/dts/rk356x-u-boot.dtsi
+++ b/arch/arm/dts/rk356x-u-boot.dtsi
@@ -22,6 +22,11 @@
};
 };
 
+ {
+   /delete-property/ assigned-clocks;
+   /delete-property/ assigned-clock-rates;
+};
+
  {
u-boot,dm-pre-reloc;
status = "okay";
-- 
2.25.1



[PATCH v4 05/12] board: rockchip: Add Radxa Compute Module 3 IO Board

2023-02-17 Thread Jagan Teki
Radxa Compute Module 3(CM3) IO board an application board from Radxa
and is compatible with Raspberry Pi CM4 IO form factor.

Radxa CM3 needs to mount on top of this IO board in order to create
complete Radxa CM3 IO board platform.

Add support for Radxa CM3 IO Board defconfig and -u-boot.dtsi

Reviewed-by: Kever Yang 
Signed-off-by: Jagan Teki 
---
 arch/arm/dts/rk3566-radxa-cm3-io-u-boot.dtsi | 18 ++
 board/rockchip/evb_rk3568/MAINTAINERS|  5 ++
 configs/radxa-cm3-io-rk3566_defconfig| 66 
 3 files changed, 89 insertions(+)
 create mode 100644 arch/arm/dts/rk3566-radxa-cm3-io-u-boot.dtsi
 create mode 100644 configs/radxa-cm3-io-rk3566_defconfig

diff --git a/arch/arm/dts/rk3566-radxa-cm3-io-u-boot.dtsi 
b/arch/arm/dts/rk3566-radxa-cm3-io-u-boot.dtsi
new file mode 100644
index 00..3c925161d4
--- /dev/null
+++ b/arch/arm/dts/rk3566-radxa-cm3-io-u-boot.dtsi
@@ -0,0 +1,18 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * (C) Copyright 2021 Rockchip Electronics Co., Ltd
+ */
+
+#include "rk356x-u-boot.dtsi"
+
+/ {
+   chosen {
+   stdout-path = 
+   };
+};
+
+ {
+   clock-frequency = <2400>;
+   u-boot,dm-spl;
+   status = "okay";
+};
diff --git a/board/rockchip/evb_rk3568/MAINTAINERS 
b/board/rockchip/evb_rk3568/MAINTAINERS
index b6ea498d2b..88d11f05c2 100644
--- a/board/rockchip/evb_rk3568/MAINTAINERS
+++ b/board/rockchip/evb_rk3568/MAINTAINERS
@@ -4,3 +4,8 @@ S:  Maintained
 F:  board/rockchip/evb_rk3568
 F:  include/configs/evb_rk3568.h
 F:  configs/evb-rk3568_defconfig
+
+RADXA-CM3
+M: Jagan Teki 
+S: Maintained
+F: configs/radxa-cm3-io-rk3566_defconfig
diff --git a/configs/radxa-cm3-io-rk3566_defconfig 
b/configs/radxa-cm3-io-rk3566_defconfig
new file mode 100644
index 00..a79d9b25e3
--- /dev/null
+++ b/configs/radxa-cm3-io-rk3566_defconfig
@@ -0,0 +1,66 @@
+CONFIG_ARM=y
+CONFIG_SKIP_LOWLEVEL_INIT=y
+CONFIG_COUNTER_FREQUENCY=2400
+CONFIG_ARCH_ROCKCHIP=y
+CONFIG_TEXT_BASE=0x00a0
+CONFIG_SPL_LIBCOMMON_SUPPORT=y
+CONFIG_SPL_LIBGENERIC_SUPPORT=y
+CONFIG_NR_DRAM_BANKS=2
+CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
+CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0xc0
+CONFIG_DEFAULT_DEVICE_TREE="rk3566-radxa-cm3-io"
+CONFIG_ROCKCHIP_RK3568=y
+CONFIG_SPL_ROCKCHIP_BACK_TO_BROM=y
+CONFIG_SPL_ROCKCHIP_COMMON_BOARD=y
+CONFIG_SPL_MMC=y
+CONFIG_SPL_SERIAL=y
+CONFIG_SPL_STACK_R_ADDR=0x60
+CONFIG_TARGET_EVB_RK3568=y
+CONFIG_SPL_STACK=0x40
+CONFIG_DEBUG_UART_BASE=0xFE66
+CONFIG_DEBUG_UART_CLOCK=2400
+CONFIG_SYS_LOAD_ADDR=0xc00800
+CONFIG_DEBUG_UART=y
+CONFIG_FIT=y
+CONFIG_FIT_VERBOSE=y
+CONFIG_SPL_LOAD_FIT=y
+CONFIG_DEFAULT_FDT_FILE="rockchip/rk3566-radxa-cm3-io.dtb"
+# CONFIG_DISPLAY_CPUINFO is not set
+CONFIG_DISPLAY_BOARDINFO_LATE=y
+CONFIG_SPL_MAX_SIZE=0x2
+CONFIG_SPL_PAD_TO=0x7f8000
+CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
+CONFIG_SPL_BSS_START_ADDR=0x400
+CONFIG_SPL_BSS_MAX_SIZE=0x4000
+# CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
+# CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
+CONFIG_SPL_STACK_R=y
+CONFIG_SPL_ATF=y
+CONFIG_CMD_GPT=y
+CONFIG_CMD_MMC=y
+# CONFIG_CMD_SETEXPR is not set
+# CONFIG_SPL_DOS_PARTITION is not set
+CONFIG_SPL_OF_CONTROL=y
+CONFIG_OF_LIVE=y
+CONFIG_NET_RANDOM_ETHADDR=y
+CONFIG_SPL_REGMAP=y
+CONFIG_SPL_SYSCON=y
+CONFIG_SPL_CLK=y
+CONFIG_ROCKCHIP_GPIO=y
+CONFIG_SYS_I2C_ROCKCHIP=y
+CONFIG_MISC=y
+CONFIG_SUPPORT_EMMC_RPMB=y
+CONFIG_MMC_DW=y
+CONFIG_MMC_DW_ROCKCHIP=y
+CONFIG_MMC_SDHCI=y
+CONFIG_MMC_SDHCI_SDMA=y
+CONFIG_MMC_SDHCI_ROCKCHIP=y
+CONFIG_ETH_DESIGNWARE=y
+CONFIG_GMAC_ROCKCHIP=y
+CONFIG_REGULATOR_PWM=y
+CONFIG_PWM_ROCKCHIP=y
+CONFIG_SPL_RAM=y
+CONFIG_BAUDRATE=150
+CONFIG_DEBUG_UART_SHIFT=2
+CONFIG_SYSRESET=y
+CONFIG_ERRNO_STR=y
-- 
2.25.1



[PATCH v4 07/12] phy: rockchip-inno-usb2: Add USB2 PHY for rk3568

2023-02-17 Thread Jagan Teki
From: Manoj Sai 

RK3568 has two USB 2.0 PHYs, and each PHY has two ports, the OTG port
of PHY0 support OTG mode with charging detection function, they are
similar to previous Rockchip SoCs.

However, there are three different designs for RK3568 USB 2.0 PHY.
1. RK3568 uses independent USB GRF module for each USB 2.0 PHY.
2. RK3568 accesses the registers of USB 2.0 PHY IP directly by APB.
3. The two ports of USB 2.0 PHY share one interrupt.

This patch only PHY1 with necessary attributes required to function
USBPHY1 on U-Boot.

Co-developed-by: Ren Jianing 
Signed-off-by: Ren Jianing 
Co-developed-by: Jagan Teki 
Signed-off-by: Jagan Teki 
Signed-off-by: Manoj Sai 
---
 drivers/phy/rockchip/phy-rockchip-inno-usb2.c | 54 +++
 1 file changed, 54 insertions(+)

diff --git a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c 
b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c
index a01148db22..55e1dbcfef 100644
--- a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c
+++ b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c
@@ -298,11 +298,65 @@ static const struct rockchip_usb2phy_cfg 
rk3399_usb2phy_cfgs[] = {
{ /* sentinel */ }
 };
 
+static const struct rockchip_usb2phy_cfg rk3568_phy_cfgs[] = {
+   {
+   .reg= 0xfe8a,
+   .port_cfgs  = {
+   [USB2PHY_PORT_OTG] = {
+   .phy_sus= { 0x, 8, 0, 0x052, 0x1d1 
},
+   .bvalid_det_en  = { 0x0080, 2, 2, 0, 1 },
+   .bvalid_det_st  = { 0x0084, 2, 2, 0, 1 },
+   .bvalid_det_clr = { 0x0088, 2, 2, 0, 1 },
+   .ls_det_en  = { 0x0080, 0, 0, 0, 1 },
+   .ls_det_st  = { 0x0084, 0, 0, 0, 1 },
+   .ls_det_clr = { 0x0088, 0, 0, 0, 1 },
+   .utmi_avalid= { 0x00c0, 10, 10, 0, 1 },
+   .utmi_bvalid= { 0x00c0, 9, 9, 0, 1 },
+   .utmi_ls= { 0x00c0, 5, 4, 0, 1 },
+   },
+   [USB2PHY_PORT_HOST] = {
+   .phy_sus= { 0x0004, 8, 0, 0x1d2, 0x1d1 
},
+   .ls_det_en  = { 0x0080, 1, 1, 0, 1 },
+   .ls_det_st  = { 0x0084, 1, 1, 0, 1 },
+   .ls_det_clr = { 0x0088, 1, 1, 0, 1 },
+   .utmi_ls= { 0x00c0, 17, 16, 0, 1 },
+   .utmi_hstdet= { 0x00c0, 19, 19, 0, 1 }
+   }
+   },
+   },
+   {
+   .reg= 0xfe8b,
+   .port_cfgs  = {
+   [USB2PHY_PORT_OTG] = {
+   .phy_sus= { 0x, 8, 0, 0x1d2, 0x1d1 
},
+   .ls_det_en  = { 0x0080, 0, 0, 0, 1 },
+   .ls_det_st  = { 0x0084, 0, 0, 0, 1 },
+   .ls_det_clr = { 0x0088, 0, 0, 0, 1 },
+   .utmi_ls= { 0x00c0, 5, 4, 0, 1 },
+   .utmi_hstdet= { 0x00c0, 7, 7, 0, 1 }
+   },
+   [USB2PHY_PORT_HOST] = {
+   .phy_sus= { 0x0004, 8, 0, 0x1d2, 0x1d1 
},
+   .ls_det_en  = { 0x0080, 1, 1, 0, 1 },
+   .ls_det_st  = { 0x0084, 1, 1, 0, 1 },
+   .ls_det_clr = { 0x0088, 1, 1, 0, 1 },
+   .utmi_ls= { 0x00c0, 17, 16, 0, 1 },
+   .utmi_hstdet= { 0x00c0, 19, 19, 0, 1 }
+   }
+   },
+   },
+   { /* sentinel */ }
+};
+
 static const struct udevice_id rockchip_usb2phy_ids[] = {
{
.compatible = "rockchip,rk3399-usb2phy",
.data = (ulong)_usb2phy_cfgs,
},
+   {
+   .compatible = "rockchip,rk3568-usb2phy",
+   .data = (ulong)_phy_cfgs,
+   },
{ /* sentinel */ }
 };
 
-- 
2.25.1



[PATCH v4 03/12] arm64: dts: rockchip: rk3566: Add Radxa Compute Module 3

2023-02-17 Thread Jagan Teki
Radxa Compute Module 3(CM3) is one of the modules from a series
System On Module based on the Radxa ROCK 3 series and is compatible
with Raspberry Pi CM4 pinout and form factor.

Specification:
- Rockchip RK3566
- up to 8GB LPDDR4
- up to 128GB high performance eMMC
- Optional wireless LAN, 2.4GHz and 5.0GHz IEEE 802.11b/g/n/ac wireless,
  BT 5.0, BLE with onboard and external antenna.
- Gigabit Ethernet PHY

Radxa CM3 needs to mount on top of this IO board in order to create
complete Radxa CM3 IO board platform.

Since Radxa CM3 is compatible with Raspberry Pi CM4 pinout so it is
possible to mount Radxa CM3 on top of the Rasberry Pi CM4 IO board.

linux-next commit for the same,

commit <8f19828844f2> ("arm64: dts: rockchip: Fix compatible for Radxa
CM3")

Add support for Radxa CM3.

Reviewed-by: Kever Yang 
Co-developed-by: FUKAUMI Naoki 
Signed-off-by: FUKAUMI Naoki 
Signed-off-by: Jagan Teki 
---
 arch/arm/dts/rk3566-radxa-cm3.dtsi | 425 +
 1 file changed, 425 insertions(+)
 create mode 100644 arch/arm/dts/rk3566-radxa-cm3.dtsi

diff --git a/arch/arm/dts/rk3566-radxa-cm3.dtsi 
b/arch/arm/dts/rk3566-radxa-cm3.dtsi
new file mode 100644
index 00..45de2630bb
--- /dev/null
+++ b/arch/arm/dts/rk3566-radxa-cm3.dtsi
@@ -0,0 +1,425 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (c) 2022 Radxa Limited
+ * Copyright (c) 2022 Amarula Solutions(India)
+ */
+
+#include 
+#include 
+
+/ {
+   compatible = "radxa,cm3", "rockchip,rk3566";
+
+   aliases {
+   mmc0 = 
+   };
+
+   leds {
+   compatible = "gpio-leds";
+
+   led-0 {
+   gpios = < RK_PA6 GPIO_ACTIVE_HIGH>;
+   color = ;
+   function = LED_FUNCTION_STATUS;
+   linux,default-trigger = "timer";
+   default-state = "on";
+   pinctrl-names = "default";
+   pinctrl-0 = <_led2>;
+   };
+   };
+
+   vcc_sys: vcc-sys-regulator {
+   compatible = "regulator-fixed";
+   regulator-name = "vcc_sys";
+   regulator-always-on;
+   regulator-boot-on;
+   regulator-min-microvolt = <500>;
+   regulator-max-microvolt = <500>;
+   };
+
+   vcc_1v8: vcc-1v8-regulator {
+   compatible = "regulator-fixed";
+   regulator-name = "vcc_1v8";
+   regulator-always-on;
+   regulator-boot-on;
+   regulator-min-microvolt = <180>;
+   regulator-max-microvolt = <180>;
+   vin-supply = <_1v8_p>;
+   };
+
+   vcc_3v3: vcc-3v3-regulator {
+   compatible = "regulator-fixed";
+   regulator-name = "vcc_3v3";
+   regulator-always-on;
+   regulator-boot-on;
+   regulator-min-microvolt = <330>;
+   regulator-max-microvolt = <330>;
+   vin-supply = <_sys>;
+   };
+
+   vcca_1v8: vcca-1v8-regulator {
+   compatible = "regulator-fixed";
+   regulator-name = "vcca_1v8";
+   regulator-always-on;
+   regulator-boot-on;
+   regulator-min-microvolt = <180>;
+   regulator-max-microvolt = <180>;
+   vin-supply = <_1v8_p>;
+   };
+
+   sdio_pwrseq: pwrseq-sdio {
+   compatible = "mmc-pwrseq-simple";
+   clocks = < 1>;
+   clock-names = "ext_clock";
+   pinctrl-names = "default";
+   pinctrl-0 = <_reg_on_h>;
+   reset-gpios = < RK_PB7 GPIO_ACTIVE_LOW>;
+   };
+};
+
+ {
+   cpu-supply = <_cpu>;
+};
+
+ {
+   cpu-supply = <_cpu>;
+};
+
+ {
+   cpu-supply = <_cpu>;
+};
+
+ {
+   cpu-supply = <_cpu>;
+};
+
+ {
+   mali-supply = <_gpu_npu>;
+   status = "okay";
+};
+
+ {
+   status = "okay";
+
+   vdd_cpu: regulator@1c {
+   compatible = "tcs,tcs4525";
+   reg = <0x1c>;
+   fcs,suspend-voltage-selector = <1>;
+   regulator-name = "vdd_cpu";
+   regulator-always-on;
+   regulator-boot-on;
+   regulator-min-microvolt = <712500>;
+   regulator-max-microvolt = <139>;
+   regulator-ramp-delay = <2300>;
+   vin-supply = <_sys>;
+
+   regulator-state-mem {
+   regulator-off-in-suspend;
+   };
+   };
+
+   rk817: pmic@20 {
+   compatible = "rockchip,rk817";
+   reg = <0x20>;
+   #clock-cells = <1>;
+   clock-output-names = "rk817-clkout1", "rk817-clkout2";
+   interrupt-parent = <>;
+   interrupts = ;
+   pinctrl-names = "default";
+   pinctrl-0 = <_int_l>;
+   rockchip,system-power-controller;

[PATCH v4 01/12] rockchip: rk3568: Move DM_RESET in arch kconfig

2023-02-17 Thread Jagan Teki
Like other rockchip SoCs, DM_RESET is useful across rk3568
platform.

Select it from arch kconfig.

Signed-off-by: Jagan Teki 
---
 arch/arm/mach-rockchip/Kconfig | 1 +
 configs/evb-rk3568_defconfig   | 1 -
 2 files changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/mach-rockchip/Kconfig b/arch/arm/mach-rockchip/Kconfig
index b678ec4131..3dc85df65d 100644
--- a/arch/arm/mach-rockchip/Kconfig
+++ b/arch/arm/mach-rockchip/Kconfig
@@ -286,6 +286,7 @@ config ROCKCHIP_RK3568
select REGMAP
select SYSCON
select BOARD_LATE_INIT
+   select DM_RESET
imply ROCKCHIP_COMMON_BOARD
help
  The Rockchip RK3568 is a ARM-based SoC with quad-core Cortex-A55,
diff --git a/configs/evb-rk3568_defconfig b/configs/evb-rk3568_defconfig
index a76d924d38..0b2325ff24 100644
--- a/configs/evb-rk3568_defconfig
+++ b/configs/evb-rk3568_defconfig
@@ -60,7 +60,6 @@ CONFIG_GMAC_ROCKCHIP=y
 CONFIG_REGULATOR_PWM=y
 CONFIG_PWM_ROCKCHIP=y
 CONFIG_SPL_RAM=y
-CONFIG_DM_RESET=y
 CONFIG_BAUDRATE=150
 CONFIG_DEBUG_UART_SHIFT=2
 CONFIG_SYS_NS16550_MEM32=y
-- 
2.25.1



[PATCH v4 02/12] dt-bindings: rockchip: Sync rockchip, vop2.h from Linux

2023-02-17 Thread Jagan Teki
Sync rockchip,vop2.h from linux-next, and the last commit is

commit <604be85547ce> ("drm/rockchip: Add VOP2 driver")

Reviewed-by: Kever Yang 
Signed-off-by: Jagan Teki 
---
 include/dt-bindings/soc/rockchip,vop2.h | 14 ++
 1 file changed, 14 insertions(+)
 create mode 100644 include/dt-bindings/soc/rockchip,vop2.h

diff --git a/include/dt-bindings/soc/rockchip,vop2.h 
b/include/dt-bindings/soc/rockchip,vop2.h
new file mode 100644
index 00..6e66a802b9
--- /dev/null
+++ b/include/dt-bindings/soc/rockchip,vop2.h
@@ -0,0 +1,14 @@
+/* SPDX-License-Identifier: GPL-2.0 OR BSD-2-Clause */
+
+#ifndef __DT_BINDINGS_ROCKCHIP_VOP2_H
+#define __DT_BINDINGS_ROCKCHIP_VOP2_H
+
+#define ROCKCHIP_VOP2_EP_RGB0  1
+#define ROCKCHIP_VOP2_EP_HDMI0 2
+#define ROCKCHIP_VOP2_EP_EDP0  3
+#define ROCKCHIP_VOP2_EP_MIPI0 4
+#define ROCKCHIP_VOP2_EP_LVDS0 5
+#define ROCKCHIP_VOP2_EP_MIPI1 6
+#define ROCKCHIP_VOP2_EP_LVDS1 7
+
+#endif /* __DT_BINDINGS_ROCKCHIP_VOP2_H */
-- 
2.25.1



[PATCH v4 00/12] rockchip: Add Radxa CM3 support

2023-02-17 Thread Jagan Teki
From: Jagan Teki 

This series support Radxa CM3 with USB2.0 and USB3.0.

Changes for v4:
- drop BINMAN_FDT unset
- usb3.0
- config additions
changes for v3:
- linux-next dts tags
Changes for v2:
- collect RB from kever

Jagan Teki (9):
  rockchip: rk3568: Move DM_RESET in arch kconfig
  dt-bindings: rockchip: Sync rockchip, vop2.h from Linux
  arm64: dts: rockchip: rk3566: Add Radxa Compute Module 3
  arm64: dts: rockchip: rk3566: Add Radxa Compute Module 3 IO
  board: rockchip: Add Radxa Compute Module 3 IO Board
  phy: rockchip: inno-usb2: Add support #address_cells = 2
  drivers: phy: add naneng combphy for rk3568
  arm64: dts: rk356x-u-boot: Drop combphy1 assigned-clocks/rates
  rockchip: rk3568: add rk3568 pinctrl driver

Manoj Sai (3):
  phy: rockchip-inno-usb2: Add USB2 PHY for rk3568
  rockchip: rk3568: Select DM_REGULATOR_FIXED
  rk3566: radxa-cm3: Enable USB2.0, USB3.0 support

 arch/arm/dts/Makefile |   1 +
 arch/arm/dts/rk3566-radxa-cm3-io-u-boot.dtsi  |  18 +
 arch/arm/dts/rk3566-radxa-cm3-io.dts  | 272 +++
 arch/arm/dts/rk3566-radxa-cm3.dtsi| 425 +
 arch/arm/dts/rk356x-u-boot.dtsi   |   5 +
 arch/arm/mach-rockchip/Kconfig|   2 +
 board/rockchip/evb_rk3568/MAINTAINERS |   5 +
 configs/evb-rk3568_defconfig  |   1 -
 configs/radxa-cm3-io-rk3566_defconfig |  77 +++
 drivers/phy/rockchip/Kconfig  |   7 +
 drivers/phy/rockchip/Makefile |   1 +
 drivers/phy/rockchip/phy-rockchip-inno-usb2.c |  65 ++-
 .../rockchip/phy-rockchip-naneng-combphy.c| 441 ++
 drivers/pinctrl/rockchip/Makefile |   1 +
 drivers/pinctrl/rockchip/pinctrl-rk3568.c | 362 ++
 include/dt-bindings/soc/rockchip,vop2.h   |  14 +
 16 files changed, 1695 insertions(+), 2 deletions(-)
 create mode 100644 arch/arm/dts/rk3566-radxa-cm3-io-u-boot.dtsi
 create mode 100644 arch/arm/dts/rk3566-radxa-cm3-io.dts
 create mode 100644 arch/arm/dts/rk3566-radxa-cm3.dtsi
 create mode 100644 configs/radxa-cm3-io-rk3566_defconfig
 create mode 100644 drivers/phy/rockchip/phy-rockchip-naneng-combphy.c
 create mode 100644 drivers/pinctrl/rockchip/pinctrl-rk3568.c
 create mode 100644 include/dt-bindings/soc/rockchip,vop2.h

-- 
2.25.1



[PATCH v2] binman: bintool: Add support for tool directories

2023-02-17 Thread Neha Malcom Francis
Currently, bintool supports external compilable tools as single
executable files. Adding support for git repos that can be used to run
non-compilable scripting tools that cannot otherwise be present in
binman.

Signed-off-by: Neha Malcom Francis 
---
Changes in v2:
- added parameter to obtain path to download the directory
  optionally, enables flexibility to avoid using
  DOWNLOAD_DESTDIR
- added test to bintool_test.py
- s/FETCH_NO_BUILD/FETCH_SOURCE
- code reformatting

 tools/binman/bintool.py| 45 --
 tools/binman/bintool_test.py   | 22 +
 tools/binman/btool/_testing.py |  5 
 tools/patman/tools.py  |  2 +-
 4 files changed, 66 insertions(+), 8 deletions(-)

diff --git a/tools/binman/bintool.py b/tools/binman/bintool.py
index 8fda13ff01..04c951fa0b 100644
--- a/tools/binman/bintool.py
+++ b/tools/binman/bintool.py
@@ -32,12 +32,13 @@ FORMAT = '%-16.16s %-12.12s %-26.26s %s'
 modules = {}
 
 # Possible ways of fetching a tool (FETCH_COUNT is number of ways)
-FETCH_ANY, FETCH_BIN, FETCH_BUILD, FETCH_COUNT = range(4)
+FETCH_ANY, FETCH_BIN, FETCH_BUILD, FETCH_SOURCE, FETCH_COUNT = range(5)
 
 FETCH_NAMES = {
 FETCH_ANY: 'any method',
 FETCH_BIN: 'binary download',
-FETCH_BUILD: 'build from source'
+FETCH_BUILD: 'build from source',
+FETCH_SOURCE: 'download source without building'
 }
 
 # Status of tool fetching
@@ -201,12 +202,13 @@ class Bintool:
 print(f'- trying method: {FETCH_NAMES[try_method]}')
 result = try_fetch(try_method)
 if result:
+method = try_method
 break
 else:
 result = try_fetch(method)
 if not result:
 return FAIL
-if result is not True:
+if result is not True and method != FETCH_SOURCE:
 fname, tmpdir = result
 dest = os.path.join(DOWNLOAD_DESTDIR, self.name)
 print(f"- writing to '{dest}'")
@@ -261,7 +263,7 @@ class Bintool:
 show_status(col.RED, 'Failures', status[FAIL])
 return not status[FAIL]
 
-def run_cmd_result(self, *args, binary=False, raise_on_error=True):
+def run_cmd_result(self, *args, binary=False, raise_on_error=True, 
add_name=True):
 """Run the bintool using command-line arguments
 
 Args:
@@ -278,7 +280,10 @@ class Bintool:
 if self.name in self.missing_list:
 return None
 name = os.path.expanduser(self.name)  # Expand paths containing ~
-all_args = (name,) + args
+if add_name:
+all_args = (name,) + args
+else:
+all_args = args
 env = tools.get_env_with_path()
 tout.detail(f"bintool: {' '.join(all_args)}")
 result = command.run_pipe(
@@ -304,7 +309,7 @@ class Bintool:
 tout.debug(result.stderr)
 return result
 
-def run_cmd(self, *args, binary=False):
+def run_cmd(self, *args, binary=False, add_name=True):
 """Run the bintool using command-line arguments
 
 Args:
@@ -315,7 +320,7 @@ class Bintool:
 Returns:
 str or bytes: Resulting stdout from the bintool
 """
-result = self.run_cmd_result(*args, binary=binary)
+result = self.run_cmd_result(*args, binary=binary, add_name=add_name)
 if result:
 return result.stdout
 
@@ -354,6 +359,32 @@ class Bintool:
 return None
 return fname, tmpdir
 
+@classmethod
+def fetch_from_git(cls, git_repo, name, toolpath=DOWNLOAD_DESTDIR):
+"""Fetch a bintool git repo
+
+This clones the repo and returns
+
+Args:
+git_repo (str): URL of git repo
+name (str): Bintool name assigned as tool directory name
+
+Returns:
+str: Directory of fetched repo
+or None on error
+"""
+dir = os.path.join(toolpath, name)
+if os.path.exists(dir):
+print(f"- Repo {dir} already exists")
+return None
+os.mkdir(dir)
+print(f"- clone git repo '{git_repo}' to '{dir}'")
+tools.run('git', 'clone', '--depth', '1', git_repo, dir)
+if not os.path.exists(dir):
+print(f"- Repo '{dir}' was not produced")
+return None
+return dir
+
 @classmethod
 def fetch_from_url(cls, url):
 """Fetch a bintool from a URL
diff --git a/tools/binman/bintool_test.py b/tools/binman/bintool_test.py
index 7efb8391db..d95b0b7025 100644
--- a/tools/binman/bintool_test.py
+++ b/tools/binman/bintool_test.py
@@ -258,6 +258,28 @@ class TestBintool(unittest.TestCase):
 fname = os.path.join(self._indir, '_testing')
 return fname if write_file else self.fname, stdout.getvalue()
 
+def check_fetch_source_method(self, write_file):
+"""Check output from fetching using SOURCE 

Re: [PATCH v2 1/1] spl: allow loading via partition type GUID

2023-02-17 Thread Heinrich Schuchardt

On 2/17/23 11:34, Mark Kettenis wrote:

Date: Fri, 17 Feb 2023 07:55:58 +0100
From: Heinrich Schuchardt 


I'm not sure, but at some point this is all going to get out of hand.
Already we have these options:

common/spl/Kconfig:config SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR
common/spl/Kconfig:config SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR
common/spl/Kconfig:config SYS_MMCSD_RAW_MODE_U_BOOT_DATA_PART_OFFSET
common/spl/Kconfig:config SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION
common/spl/Kconfig:config SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION
common/spl/Kconfig:config SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION_TYPE
common/spl/Kconfig:config SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION_TYPE
common/spl/Kconfig:config SYS_MMCSD_RAW_MODE_EMMC_BOOT_PARTITION
common/spl/Kconfig:config SYS_MMCSD_FS_BOOT_PARTITION
common/spl/Kconfig:config SYS_MMCSD_RAW_MODE_KERNEL_SECTOR
common/spl/Kconfig:config SYS_MMCSD_RAW_MODE_ARGS_SECTOR
common/spl/Kconfig:config SYS_MMCSD_RAW_MODE_ARGS_SECTORS

That is just for MMC raw mode.

For environment we have SYS_MMC_ENV_DEV and _PART. If you look around
you'll see loads of these options.

I see that rockchip uses u-boot,spl-boot-order as a way to determine
the boot order. This makes it configurable without rebuilding
U-Boot...although I don't think we need to make the MMC stuff
configurable, since I am assuming that the boot ROM determines at
least some of it...?


This patch is about SPL loading main U-Boot. So the boot ROM is not
involved.


But in that case we surely want to have a single board and SoC
independent partition GUID?



No. I want to create one installation image which runs on multiple 
boards, e.g.


part 1, GUID 8300, /boot
part 2, GUID 8300, /
part 15, GUID EF00, /boot/efi
part 20, GUID SPL 1, SPL for board 1
part 21, GUID U-Boot 2, U-Boot for board 1
...
part 127, GUID SPL 54, SPL for board 54
part 128, GUID U-Boot 54, U-Boot for board 54


It seems that the whole thing is crying out for a bit of organisation
and a proper schema.


The discussion was about hard-coding the values vs configuration.

OS distributions should have enough flexibility to deliver an
installation image with U-Boot for multiple boards on the same medium.
For the build process it is preferable to use different configurations
instead of patching source code per U-Boot which might be required if
hard-coded values for partition GUIDs in the device-trees are used.


Well, yes, but it would be even more helpful to have a single
well-known partition GUID such that the OS partitioning tools can
recognize the U-Boot partition.  If you make it configurable and every
contributed board uses a different GUID that will be impractical.


The OS partitioning tools simply shouldn't touch partitions with GUIDs 
that they don't know.


Best regards

Heinrich




I think Tom's approach is right. The U-Boot documentation should give
guidance on how new boards should find U-Boot SPL and main U-Boot.

Best regards

Heinrich





Re: [PATCH v2 1/1] spl: allow loading via partition type GUID

2023-02-17 Thread Mark Kettenis
> Date: Fri, 17 Feb 2023 07:55:58 +0100
> From: Heinrich Schuchardt 
> 
> > I'm not sure, but at some point this is all going to get out of hand.
> > Already we have these options:
> > 
> > common/spl/Kconfig:config SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR
> > common/spl/Kconfig:config SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR
> > common/spl/Kconfig:config SYS_MMCSD_RAW_MODE_U_BOOT_DATA_PART_OFFSET
> > common/spl/Kconfig:config SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION
> > common/spl/Kconfig:config SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION
> > common/spl/Kconfig:config SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION_TYPE
> > common/spl/Kconfig:config SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION_TYPE
> > common/spl/Kconfig:config SYS_MMCSD_RAW_MODE_EMMC_BOOT_PARTITION
> > common/spl/Kconfig:config SYS_MMCSD_FS_BOOT_PARTITION
> > common/spl/Kconfig:config SYS_MMCSD_RAW_MODE_KERNEL_SECTOR
> > common/spl/Kconfig:config SYS_MMCSD_RAW_MODE_ARGS_SECTOR
> > common/spl/Kconfig:config SYS_MMCSD_RAW_MODE_ARGS_SECTORS
> > 
> > That is just for MMC raw mode.
> > 
> > For environment we have SYS_MMC_ENV_DEV and _PART. If you look around
> > you'll see loads of these options.
> > 
> > I see that rockchip uses u-boot,spl-boot-order as a way to determine
> > the boot order. This makes it configurable without rebuilding
> > U-Boot...although I don't think we need to make the MMC stuff
> > configurable, since I am assuming that the boot ROM determines at
> > least some of it...?
> 
> This patch is about SPL loading main U-Boot. So the boot ROM is not 
> involved.

But in that case we surely want to have a single board and SoC
independent partition GUID?

> > It seems that the whole thing is crying out for a bit of organisation
> > and a proper schema.
> 
> The discussion was about hard-coding the values vs configuration.
> 
> OS distributions should have enough flexibility to deliver an 
> installation image with U-Boot for multiple boards on the same medium. 
> For the build process it is preferable to use different configurations 
> instead of patching source code per U-Boot which might be required if 
> hard-coded values for partition GUIDs in the device-trees are used.

Well, yes, but it would be even more helpful to have a single
well-known partition GUID such that the OS partitioning tools can
recognize the U-Boot partition.  If you make it configurable and every
contributed board uses a different GUID that will be impractical.

> I think Tom's approach is right. The U-Boot documentation should give 
> guidance on how new boards should find U-Boot SPL and main U-Boot.
> 
> Best regards
> 
> Heinrich
> 


Re: [PATCH v2] riscv: binman: Add help message for missing blobs

2023-02-17 Thread Yu-Chien Peter Lin
On Fri, Feb 17, 2023 at 04:57:01PM +0800, Rick Chen wrote:
> Add the 'missing-msg' for more detailed output
> on missing system firmware.
> 
> Signed-off-by: Rick Chen 
> Reviewed-by: Leo Yu-Chi Liang 

Reviewed-by: Yu Chien Peter Lin 

> ---
> Changes in v2
>  - Add more descriptions about fw_dynamic.bin
> ---
>  arch/riscv/dts/binman.dtsi | 1 +
>  tools/binman/missing-blob-help | 6 ++
>  2 files changed, 7 insertions(+)
> 
> diff --git a/arch/riscv/dts/binman.dtsi b/arch/riscv/dts/binman.dtsi
> index b8fc8f7f35..156cb00971 100644
> --- a/arch/riscv/dts/binman.dtsi
> +++ b/arch/riscv/dts/binman.dtsi
> @@ -45,6 +45,7 @@
>  
>   opensbi_blob: opensbi {
>   filename = "fw_dynamic.bin";
> + missing-msg = "opensbi";
>   };
>   };
>  
> diff --git a/tools/binman/missing-blob-help b/tools/binman/missing-blob-help
> index c61ca02a35..4448ac9311 100644
> --- a/tools/binman/missing-blob-help
> +++ b/tools/binman/missing-blob-help
> @@ -37,3 +37,9 @@ https://github.com/siemens/k3-rti-wdt.
>  tee-os:
>  See the documentation for your board. You may need to build Open Portable
>  Trusted Execution Environment (OP-TEE) with TEE=/path/to/tee.bin
> +
> +opensbi:
> +See the documentation for your board. The OpenSBI git repo is at
> +https://github.com/riscv/opensbi.git
> +You may need to build fw_dynamic.bin first and re-build u-boot with
> +OPENSBI=/path/to/fw_dynamic.bin
> -- 
> 2.17.1
> 


Re: [PATCH] lmb: Bump CONFIG_LMB_MAX_REGIONS

2023-02-17 Thread Michal Suchánek
Hello,

On Sun, Feb 12, 2023 at 06:45:36PM -0500, Tom Rini wrote:
> On Wed, Feb 08, 2023 at 02:50:16PM -0500, Tom Rini wrote:
> > On Wed, Feb 08, 2023 at 08:11:34PM +0100, Michal Suchánek wrote:
> > > Hello,
> > > 
> > > On Wed, Feb 08, 2023 at 01:25:50PM -0500, Tom Rini wrote:
> > > > On Wed, Feb 08, 2023 at 07:24:25PM +0100, Francesco Dolcini wrote:
> > > > > Hello,
> > > > > 
> > > > > On Fri, Jan 27, 2023 at 08:54:55AM -0500, Tom Rini wrote:
> > > > > > On Fri, Jan 27, 2023 at 02:00:12PM +0100, Michal Suchanek wrote:
> > > > > > > It is reported that in some configurations it is not possible to 
> > > > > > > boot
> > > > > > > because u-boot runs out of lmbs.
> > > > > > > 
> > > > > > > commit 06d514d77c ("lmb: consider EFI memory map") increases lmb 
> > > > > > > usage,
> > > > > > > hence is likely the cause of the lmb overflow.
> > > > > > > 
> > > > > > > Fixes: 06d514d77c ("lmb: consider EFI memory map")
> > > > > > > Link: https://bugzilla.opensuse.org/show_bug.cgi?id=1207562
> > > > > > > Signed-off-by: Michal Suchanek 
> > > > > 
> > > > > Reviewed-by: Francesco Dolcini 
> > > > > 
> > > > > > I plan to pick up
> > > > > > https://patchwork.ozlabs.org/project/uboot/patch/20230125230823.1567778-1-tr...@konsulko.com/
> > > > > > as the alternative fix for this issue and would suggest that any 
> > > > > > distro
> > > > > > hitting the problem on v2023.01 apply the above instead of 
> > > > > > increasing
> > > > > > the limit.
> > > > > 
> > > > > Tom, my understanding is that you plan to merge this or an equivalent
> > > > > change, correct? Otherwise I would need to send some more patches to
> > > > > update a few board defconfig that are affected by this specific issue.
> > > > 
> > > > Yes, I was hoping to push the equivalent of this patch a few hours ago,
> > > > along with the revert. Then I noticed the test in test/lib/lmb.c doesn't
> > > > scale past 8, and I just now figured out what that should look like
> > > > instead, I believe.
> > > 
> > > reportedly neither fixes the problem in all cases, and raising
> > > CONFIG_LMB_RESERVED_REGIONS is required.
> > > 
> > > Looks like the mechanism to add regions above the default number does
> > > not work as intended.
> > > 
> > > The test is to boot rPi 4 from USB directly with recent firmware.
> > 
> > Well, given 0089affee275 ("configs: stm32mp15: increase the number of
> > reserved memory region in lmb") I guess this has been run in to before,
> > but not resolved more generically.
> 
> I wonder if
> https://patchwork.ozlabs.org/project/uboot/patch/20230212150706.2967007-2-sjo...@collabora.com/
> is what will finish dealing with these issues, even the ones that had
> perhaps shown up before and been addressed in the commit I mentioned
> above?

Looks like this together with raising the maximum number of regions
works, that is v2023.04-rc2 should be fixed.

Thanks

Michal


[PATCH v2 1/5] phy: phy-mtk-tphy: remove macros to prepare bitfield value

2023-02-17 Thread Chunfeng Yun
Prefer to make use of FIELD_PREP() macro to prepare bitfield value,
then no need local macros anymore.

Signed-off-by: Chunfeng Yun 
---
v2: new patch
---
 drivers/phy/phy-mtk-tphy.c | 122 ++---
 1 file changed, 47 insertions(+), 75 deletions(-)

diff --git a/drivers/phy/phy-mtk-tphy.c b/drivers/phy/phy-mtk-tphy.c
index 2dd964f7b2..24e6124b76 100644
--- a/drivers/phy/phy-mtk-tphy.c
+++ b/drivers/phy/phy-mtk-tphy.c
@@ -14,6 +14,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -48,14 +49,12 @@
 #define U3P_USBPHYACR5 0x014
 #define PA5_RG_U2_HSTX_SRCAL_ENBIT(15)
 #define PA5_RG_U2_HSTX_SRCTRL  GENMASK(14, 12)
-#define PA5_RG_U2_HSTX_SRCTRL_VAL(x)   ((0x7 & (x)) << 12)
 #define PA5_RG_U2_HS_100U_U3_ENBIT(11)
 
 #define U3P_USBPHYACR6 0x018
 #define PA6_RG_U2_BC11_SW_EN   BIT(23)
 #define PA6_RG_U2_OTG_VBUSCMP_EN   BIT(20)
 #define PA6_RG_U2_SQTH GENMASK(3, 0)
-#define PA6_RG_U2_SQTH_VAL(x)  (0xf & (x))
 
 #define U3P_U2PHYACR4  0x020
 #define P2C_RG_USB20_GPIO_CTL  BIT(9)
@@ -72,11 +71,9 @@
 #define P2C_FORCE_SUSPENDM BIT(18)
 #define P2C_FORCE_TERMSEL  BIT(17)
 #define P2C_RG_DATAIN  GENMASK(13, 10)
-#define P2C_RG_DATAIN_VAL(x)   ((0xf & (x)) << 10)
 #define P2C_RG_DMPULLDOWN  BIT(7)
 #define P2C_RG_DPPULLDOWN  BIT(6)
 #define P2C_RG_XCVRSEL GENMASK(5, 4)
-#define P2C_RG_XCVRSEL_VAL(x)  ((0x3 & (x)) << 4)
 #define P2C_RG_SUSPENDMBIT(3)
 #define P2C_RG_TERMSEL BIT(2)
 #define P2C_DTM0_PART_MASK \
@@ -104,72 +101,53 @@
 
 #define U3P_U3_PHYA_REG0   0x000
 #define P3A_RG_CLKDRV_OFF  GENMASK(3, 2)
-#define P3A_RG_CLKDRV_OFF_VAL(x)   ((0x3 & (x)) << 2)
 
 #define U3P_U3_PHYA_REG1   0x004
 #define P3A_RG_CLKDRV_AMP  GENMASK(31, 29)
-#define P3A_RG_CLKDRV_AMP_VAL(x)   ((0x7 & (x)) << 29)
 
 #define U3P_U3_PHYA_REG6   0x018
 #define P3A_RG_TX_EIDLE_CM GENMASK(31, 28)
-#define P3A_RG_TX_EIDLE_CM_VAL(x)  ((0xf & (x)) << 28)
 
 #define U3P_U3_PHYA_REG9   0x024
 #define P3A_RG_RX_DAC_MUX  GENMASK(5, 1)
-#define P3A_RG_RX_DAC_MUX_VAL(x)   ((0x1f & (x)) << 1)
 
 #define U3P_U3_PHYA_DA_REG00x100
 #define P3A_RG_XTAL_EXT_PE2H   GENMASK(17, 16)
-#define P3A_RG_XTAL_EXT_PE2H_VAL(x)((0x3 & (x)) << 16)
 #define P3A_RG_XTAL_EXT_PE1H   GENMASK(13, 12)
-#define P3A_RG_XTAL_EXT_PE1H_VAL(x)((0x3 & (x)) << 12)
 #define P3A_RG_XTAL_EXT_EN_U3  GENMASK(11, 10)
-#define P3A_RG_XTAL_EXT_EN_U3_VAL(x)   ((0x3 & (x)) << 10)
 
 #define U3P_U3_PHYA_DA_REG40x108
 #define P3A_RG_PLL_DIVEN_PE2H  GENMASK(21, 19)
 #define P3A_RG_PLL_BC_PE2H GENMASK(7, 6)
-#define P3A_RG_PLL_BC_PE2H_VAL(x)  ((0x3 & (x)) << 6)
 
 #define U3P_U3_PHYA_DA_REG50x10c
 #define P3A_RG_PLL_BR_PE2H GENMASK(29, 28)
-#define P3A_RG_PLL_BR_PE2H_VAL(x)  ((0x3 & (x)) << 28)
 #define P3A_RG_PLL_IC_PE2H GENMASK(15, 12)
-#define P3A_RG_PLL_IC_PE2H_VAL(x)  ((0xf & (x)) << 12)
 
 #define U3P_U3_PHYA_DA_REG60x110
 #define P3A_RG_PLL_IR_PE2H GENMASK(19, 16)
-#define P3A_RG_PLL_IR_PE2H_VAL(x)  ((0xf & (x)) << 16)
 
 #define U3P_U3_PHYA_DA_REG70x114
 #define P3A_RG_PLL_BP_PE2H GENMASK(19, 16)
-#define P3A_RG_PLL_BP_PE2H_VAL(x)  ((0xf & (x)) << 16)
 
 #define U3P_U3_PHYA_DA_REG20   0x13c
 #define P3A_RG_PLL_DELTA1_PE2H GENMASK(31, 16)
-#define P3A_RG_PLL_DELTA1_PE2H_VAL(x)  ((0x & (x)) << 16)
 
 #define U3P_U3_PHYA_DA_REG25   0x148
 #define P3A_RG_PLL_DELTA_PE2H  GENMASK(15, 0)
-#define P3A_RG_PLL_DELTA_PE2H_VAL(x)   (0x & (x))
 
 #define U3P_U3_PHYD_LFPS1  0x00c
 #define P3D_RG_FWAKE_THGENMASK(21, 16)
-#define P3D_RG_FWAKE_TH_VAL(x) ((0x3f & (x)) << 16)
 
 #define U3P_U3_PHYD_CDR1   0x05c
 #define P3D_RG_CDR_BIR_LTD1GENMASK(28, 24)
-#define P3D_RG_CDR_BIR_LTD1_VAL(x) ((0x1f & (x)) << 24)
 #define P3D_RG_CDR_BIR_LTD0GENMASK(12, 8)
-#define P3D_RG_CDR_BIR_LTD0_VAL(x) ((0x1f & (x)) << 8)
 
 #define U3P_U3_PHYD_RXDET1 0x128
 #define P3D_RG_RXDET_STB2_SET  GENMASK(17, 9)
-#define P3D_RG_RXDET_STB2_SET_VAL(x)   ((0x1ff & (x)) << 9)
 
 #define U3P_U3_PHYD_RXDET2 0x12c
 #define P3D_RG_RXDET_STB2_SET_P3   GENMASK(8, 0)
-#define P3D_RG_RXDET_STB2_SET_P3_VAL(x)(0x1ff & (x))
 
 #define U3P_SPLLC_XTALCTL3 0x018
 #define XC3_RG_U3_XTAL_RX_PWD  BIT(9)
@@ -179,60 +157,45 @@
 #define PHYD_CTRL_SIGNAL_MODE4 0x1c
 /* CDR Charge Pump P-path current adjustment */
 #define RG_CDR_BICLTD1_GEN1_MSK   

[PATCH v2 4/5] dt-bindings: phy-mtk-tphy: add support mt8195

2023-02-17 Thread Chunfeng Yun
Add a new compatible for mt8195 to add a workaround for hardware
issue.

Signed-off-by: Chunfeng Yun 
---
v2: no change
---
 doc/device-tree-bindings/phy/phy-mtk-tphy.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/doc/device-tree-bindings/phy/phy-mtk-tphy.txt 
b/doc/device-tree-bindings/phy/phy-mtk-tphy.txt
index 8cd23d8c0b..3042c39d09 100644
--- a/doc/device-tree-bindings/phy/phy-mtk-tphy.txt
+++ b/doc/device-tree-bindings/phy/phy-mtk-tphy.txt
@@ -8,6 +8,7 @@ Required properties (controller (parent) node):
  - compatible  : should be one of
  "mediatek,generic-tphy-v1"
  "mediatek,generic-tphy-v2"
+ "mediatek,mt8195-tphy"
 
 - #address-cells:  the number of cells used to represent physical
base addresses.
-- 
2.18.0



[PATCH v2 5/5] dt-bindings: usb: mtk-xhci: add support mt8195

2023-02-17 Thread Chunfeng Yun
Add a new compatible for mt8195 to add a workaround for hardware
issue.

Signed-off-by: Chunfeng Yun 
---
v2: no change
---
 doc/device-tree-bindings/usb/mediatek,mtk-xhci.txt | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/doc/device-tree-bindings/usb/mediatek,mtk-xhci.txt 
b/doc/device-tree-bindings/usb/mediatek,mtk-xhci.txt
index 2a298f7b16..e26e9618eb 100644
--- a/doc/device-tree-bindings/usb/mediatek,mtk-xhci.txt
+++ b/doc/device-tree-bindings/usb/mediatek,mtk-xhci.txt
@@ -3,7 +3,9 @@ MediaTek xHCI
 The device node for USB3 host controller on MediaTek SoCs.
 
 Required properties:
- - compatible : should be "mediatek,mtk-xhci"
+ - compatible : should be one of
+   "mediatek,mtk-xhci"
+   "mediatek,mt8195-xhci"
  - reg : specifies physical base address and size of the registers
  - reg-names: should be "mac" for xHCI MAC and "ippc" for IP port control
  - power-domains : a phandle to USB power domain node to control USB's
-- 
2.18.0



[PATCH v2 2/5] phy: phy-mtk-tphy: add support mt8195

2023-02-17 Thread Chunfeng Yun
The T-PHY controller is designed to use use PLL integer mode, but
in fact use fractional mode for some ones on mt8195 by mistake,
this causes signal degradation (e.g. eye diagram test fail), fix
it by switching PLL to 26Mhz from default 48Mhz to improve signal
quality.

Signed-off-by: Chunfeng Yun 
---
v2: use FIELD_PREP() macro
---
 drivers/phy/phy-mtk-tphy.c | 91 +-
 1 file changed, 81 insertions(+), 10 deletions(-)

diff --git a/drivers/phy/phy-mtk-tphy.c b/drivers/phy/phy-mtk-tphy.c
index 24e6124b76..1883f9f83e 100644
--- a/drivers/phy/phy-mtk-tphy.c
+++ b/drivers/phy/phy-mtk-tphy.c
@@ -44,8 +44,12 @@
 
 #define U3P_USBPHYACR0 0x000
 #define PA0_RG_U2PLL_FORCE_ON  BIT(15)
+#define PA0_USB20_PLL_PREDIV   GENMASK(7, 6)
 #define PA0_RG_USB20_INTR_EN   BIT(5)
 
+#define U3P_USBPHYACR2 0x008
+#define PA2_RG_U2PLL_BWGENMASK(21, 19)
+
 #define U3P_USBPHYACR5 0x014
 #define PA5_RG_U2_HSTX_SRCAL_ENBIT(15)
 #define PA5_RG_U2_HSTX_SRCTRL  GENMASK(14, 12)
@@ -62,6 +66,14 @@
 #define P2C_U2_GPIO_CTR_MSK\
(P2C_RG_USB20_GPIO_CTL | P2C_USB20_GPIO_MODE)
 
+#define U3P_U2PHYA_RESV0x030
+#define P2R_RG_U2PLL_FBDIV_26M 0x1bb13b
+#define P2R_RG_U2PLL_FBDIV_48M 0x3c
+
+#define U3P_U2PHYA_RESV1   0x044
+#define P2R_RG_U2PLL_REFCLK_SELBIT(5)
+#define P2R_RG_U2PLL_FRA_ENBIT(3)
+
 #define U3P_U2PHYDTM0  0x068
 #define P2C_FORCE_UART_EN  BIT(26)
 #define P2C_FORCE_DATAIN   BIT(23)
@@ -202,6 +214,17 @@ enum mtk_phy_version {
MTK_TPHY_V2,
 };
 
+struct tphy_pdata {
+   enum mtk_phy_version version;
+
+   /*
+* workaround only for mt8195:
+* u2phy should use integer mode instead of fractional mode of
+* 48M PLL, fix it by switching PLL to 26M from default 48M
+*/
+   bool sw_pll_48m_to_26m;
+};
+
 struct u2phy_banks {
void __iomem *misc;
void __iomem *fmreg;
@@ -232,11 +255,32 @@ struct mtk_phy_instance {
 struct mtk_tphy {
struct udevice *dev;
void __iomem *sif_base;
-   enum mtk_phy_version version;
+   const struct tphy_pdata *pdata;
struct mtk_phy_instance **phys;
int nphys;
 };
 
+/* workaround only for mt8195 */
+static void u2_phy_pll_26m_set(struct mtk_tphy *tphy,
+  struct mtk_phy_instance *instance)
+{
+   struct u2phy_banks *u2_banks = >u2_banks;
+
+   if (!tphy->pdata->sw_pll_48m_to_26m)
+   return;
+
+   clrsetbits_le32(u2_banks->com + U3P_USBPHYACR0, PA0_USB20_PLL_PREDIV,
+   FIELD_PREP(PA0_USB20_PLL_PREDIV, 0));
+
+   clrsetbits_le32(u2_banks->com + U3P_USBPHYACR2, PA2_RG_U2PLL_BW,
+   FIELD_PREP(PA2_RG_U2PLL_BW, 3));
+
+   writel(P2R_RG_U2PLL_FBDIV_26M, u2_banks->com + U3P_U2PHYA_RESV);
+
+   setbits_le32(u2_banks->com + U3P_U2PHYA_RESV1,
+P2R_RG_U2PLL_FRA_EN | P2R_RG_U2PLL_REFCLK_SEL);
+}
+
 static void u2_phy_instance_init(struct mtk_tphy *tphy,
 struct mtk_phy_instance *instance)
 {
@@ -266,6 +310,8 @@ static void u2_phy_instance_init(struct mtk_tphy *tphy,
PA5_RG_U2_HSTX_SRCTRL,
FIELD_PREP(PA5_RG_U2_HSTX_SRCTRL, 4));
 
+   u2_phy_pll_26m_set(tphy, instance);
+
dev_dbg(tphy->dev, "%s(%d)\n", __func__, instance->index);
 }
 
@@ -350,7 +396,7 @@ static void pcie_phy_instance_init(struct mtk_tphy *tphy,
 {
struct u3phy_banks *u3_banks = >u3_banks;
 
-   if (tphy->version != MTK_TPHY_V1)
+   if (tphy->pdata->version != MTK_TPHY_V1)
return;
 
clrsetbits_le32(u3_banks->phya + U3P_U3_PHYA_DA_REG0,
@@ -634,11 +680,14 @@ static int mtk_phy_xlate(struct phy *phy,
return -EINVAL;
}
 
-   if (tphy->version == MTK_TPHY_V1) {
+   switch (tphy->pdata->version) {
+   case MTK_TPHY_V1:
phy_v1_banks_init(tphy, instance);
-   } else if (tphy->version == MTK_TPHY_V2) {
+   break;
+   case MTK_TPHY_V2:
phy_v2_banks_init(tphy, instance);
-   } else {
+   break;
+   default:
dev_err(phy->dev, "phy version is not supported\n");
return -EINVAL;
}
@@ -668,13 +717,12 @@ static int mtk_tphy_probe(struct udevice *dev)
return -ENOMEM;
 
tphy->dev = dev;
-   tphy->version = dev_get_driver_data(dev);
+   tphy->pdata = (void *)dev_get_driver_data(dev);
 
/* v1 has shared banks for usb/pcie mode, */
/* but not for sata mode */
-   if (tphy->version == MTK_TPHY_V1) {
+   if (tphy->pdata->version == MTK_TPHY_V1)
tphy->sif_base = dev_read_addr_ptr(dev);
-   }
 

[PATCH v2 3/5] usb: xhci-mtk: modify the SOF/ITP interval for mt8195

2023-02-17 Thread Chunfeng Yun
There are 4 USB controllers on MT8195, the controllers (IP1~IP3,
exclude IP0) have a wrong default SOF/ITP interval which is
calculated from the frame counter clock 24Mhz by default, but
in fact, the frame counter clock is 48Mhz, so we shall set the
accurate interval according to 48Mhz for those controllers.

Note:
The first controller no need set it, but if set it, shall change
tphy's pll at the same time.

Signed-off-by: Chunfeng Yun 
---
v2: use FIELD_PREP() suggested by Marek
---
 drivers/usb/host/xhci-mtk.c | 49 -
 1 file changed, 48 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/host/xhci-mtk.c b/drivers/usb/host/xhci-mtk.c
index 3838a990ec..63dfb793c6 100644
--- a/drivers/usb/host/xhci-mtk.c
+++ b/drivers/usb/host/xhci-mtk.c
@@ -14,8 +14,9 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
+#include 
 #include 
 
 /* IPPC (IP Port Control) registers */
@@ -50,6 +51,25 @@
 #define IPPC_U3_CTRL(p)(IPPC_U3_CTRL_0P + ((p) * 0x08))
 #define IPPC_U2_CTRL(p)(IPPC_U2_CTRL_0P + ((p) * 0x08))
 
+/* xHCI CSR */
+#define LS_EOF_CFG 0x930
+#define LSEOF_OFFSET   0x89
+
+#define FS_EOF_CFG 0x934
+#define FSEOF_OFFSET   0x2e
+
+#define SS_GEN1_EOF_CFG0x93c
+#define SSG1EOF_OFFSET 0x78
+
+#define HFCNTR_CFG 0x944
+#define ITP_DELTA_CLK_MASK GENMASK(5, 1)
+#define FRMCNT_LEV1_RANG_MASK  GENMASK(19, 8)
+
+#define SS_GEN2_EOF_CFG0x990
+#define SSG2EOF_OFFSET 0x3c
+
+#define XSEOF_OFFSET_MASK  GENMASK(11, 0)
+
 struct mtk_xhci {
struct xhci_ctrl ctrl;  /* Needs to come first in this struct! */
struct xhci_hccr *hcd;
@@ -65,6 +85,30 @@ struct mtk_xhci {
u32 u2p_dis_msk;
 };
 
+/*
+ * workaround for mt8195:
+ * MT8195 has 4 controllers, the controller1~3's default SOF/ITP interval
+ * is calculated from the frame counter clock 24M, but in fact, the clock
+ * is 48M.
+ */
+static void xhci_mtk_set_frame_interval(struct mtk_xhci *mtk)
+{
+   void __iomem *mac = (void __iomem *)mtk->hcd;
+
+   if (!ofnode_device_is_compatible(dev_ofnode(mtk->dev), 
"mediatek,mt8195-xhci"))
+   return;
+
+   clrsetbits_le32(mac + HFCNTR_CFG,
+   ITP_DELTA_CLK_MASK | FRMCNT_LEV1_RANG_MASK,
+   FIELD_PREP(ITP_DELTA_CLK_MASK, 0xa) |
+   FIELD_PREP(FRMCNT_LEV1_RANG_MASK, 0x12b));
+
+   clrsetbits_le32(mac + LS_EOF_CFG, XSEOF_OFFSET_MASK, LSEOF_OFFSET);
+   clrsetbits_le32(mac + FS_EOF_CFG, XSEOF_OFFSET_MASK, FSEOF_OFFSET);
+   clrsetbits_le32(mac + SS_GEN1_EOF_CFG, XSEOF_OFFSET_MASK, 
SSG1EOF_OFFSET);
+   clrsetbits_le32(mac + SS_GEN2_EOF_CFG, XSEOF_OFFSET_MASK, 
SSG2EOF_OFFSET);
+}
+
 static int xhci_mtk_host_enable(struct mtk_xhci *mtk)
 {
int u3_ports_disabed = 0;
@@ -278,6 +322,8 @@ static int xhci_mtk_probe(struct udevice *dev)
if (ret)
goto ssusb_init_err;
 
+   xhci_mtk_set_frame_interval(mtk);
+
mtk->ctrl.quirks = XHCI_MTK_HOST;
hcor = (struct xhci_hcor *)((uintptr_t)mtk->hcd +
HC_LENGTH(xhci_readl(>hcd->cr_capbase)));
@@ -308,6 +354,7 @@ static int xhci_mtk_remove(struct udevice *dev)
 
 static const struct udevice_id xhci_mtk_ids[] = {
{ .compatible = "mediatek,mtk-xhci" },
+   { .compatible = "mediatek,mt8195-xhci" },
{ }
 };
 
-- 
2.18.0



[PATCH v2] riscv: binman: Add help message for missing blobs

2023-02-17 Thread Rick Chen
Add the 'missing-msg' for more detailed output
on missing system firmware.

Signed-off-by: Rick Chen 
Reviewed-by: Leo Yu-Chi Liang 
---
Changes in v2
 - Add more descriptions about fw_dynamic.bin
---
 arch/riscv/dts/binman.dtsi | 1 +
 tools/binman/missing-blob-help | 6 ++
 2 files changed, 7 insertions(+)

diff --git a/arch/riscv/dts/binman.dtsi b/arch/riscv/dts/binman.dtsi
index b8fc8f7f35..156cb00971 100644
--- a/arch/riscv/dts/binman.dtsi
+++ b/arch/riscv/dts/binman.dtsi
@@ -45,6 +45,7 @@
 
opensbi_blob: opensbi {
filename = "fw_dynamic.bin";
+   missing-msg = "opensbi";
};
};
 
diff --git a/tools/binman/missing-blob-help b/tools/binman/missing-blob-help
index c61ca02a35..4448ac9311 100644
--- a/tools/binman/missing-blob-help
+++ b/tools/binman/missing-blob-help
@@ -37,3 +37,9 @@ https://github.com/siemens/k3-rti-wdt.
 tee-os:
 See the documentation for your board. You may need to build Open Portable
 Trusted Execution Environment (OP-TEE) with TEE=/path/to/tee.bin
+
+opensbi:
+See the documentation for your board. The OpenSBI git repo is at
+https://github.com/riscv/opensbi.git
+You may need to build fw_dynamic.bin first and re-build u-boot with
+OPENSBI=/path/to/fw_dynamic.bin
-- 
2.17.1



Re: [PATCH v3 06/11] mtd: nand: raw: rockchip_nfc: use dev_read_addr_ptr

2023-02-17 Thread Michael Nazzareno Trimarchi
On Thu, Feb 16, 2023 at 6:59 PM Johan Jonker  wrote:
>
> The fdt_addr_t and phys_addr_t size have been decoupled.
> A 32bit CPU can expext 64-bit data from the device tree parser,
> so use dev_read_addr_ptr in the rockchip_nfc.c file.
>
> Signed-off-by: Johan Jonker 
> ---
>  drivers/mtd/nand/raw/rockchip_nfc.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/mtd/nand/raw/rockchip_nfc.c 
> b/drivers/mtd/nand/raw/rockchip_nfc.c
> index d016d255..5d444133 100644
> --- a/drivers/mtd/nand/raw/rockchip_nfc.c
> +++ b/drivers/mtd/nand/raw/rockchip_nfc.c
> @@ -1180,9 +1180,9 @@ static int rk_nfc_probe(struct udevice *dev)
> nfc->cfg = (void *)dev_get_driver_data(dev);
> nfc->dev = dev;
>
> -   nfc->regs = (void *)dev_read_addr(dev);
> -   if (IS_ERR(nfc->regs)) {
> -   ret = PTR_ERR(nfc->regs);
> +   nfc->regs = dev_read_addr_ptr(dev);

Reviewed-By: Michael Trimarchi 

> +   if (!nfc->regs) {
> +   ret = -ENODATA;
> goto release_nfc;
> }
>
> --
> 2.20.1
>


-- 
Michael Nazzareno Trimarchi
Co-Founder & Chief Executive Officer
M. +39 347 913 2170
mich...@amarulasolutions.com
__

Amarula Solutions BV
Joop Geesinkweg 125, 1114 AB, Amsterdam, NL
T. +31 (0)85 111 9172
i...@amarulasolutions.com
www.amarulasolutions.com


Re: [PATCH v4 00/16] General Tegra improvements

2023-02-17 Thread Svyatoslav Ryhel
You have NOT applied patch 13 ARM: tegra: expose crypto module for all
Tegra SoCs or applied it after patch 14 which brakes order. PTAL.

вт, 14 лют. 2023 р. о 23:45 Tom Warren  пише:
>
> 
>
> Svyatoslav,
>
> Taking TOT u-boot-tegra/master, and fast-forwarding to TOT u-boot/master, I 
> then try to apply your 16 patch series and get the following failures (using 
> patch). Note that I retargeted the crypto.c patch by hand to point to 
> tegra20/crypto.c, which I believe one of your patches moves to 
> arch/arm/tegra. PTAL.
>
> tom@tom-ThinkPad-T580:~/denx/uboot-tegra$ patch -p1 -i 
> ~/Downloads/bundle-23303-Svyatoslav-16-v4.mbox  --dry-run
> checking file arch/arm/include/asm/arch-tegra30/clock-tables.h
> checking file arch/arm/mach-tegra/tegra30/clock.c
> checking file arch/arm/mach-tegra/tegra20/clock.c
> checking file arch/arm/mach-tegra/tegra30/clock.c
> checking file arch/arm/include/asm/arch-tegra/clock.h
> checking file arch/arm/mach-tegra/tegra114/clock.c
> checking file arch/arm/mach-tegra/tegra124/clock.c
> checking file arch/arm/mach-tegra/tegra20/clock.c
> checking file arch/arm/mach-tegra/tegra210/clock.c
> checking file arch/arm/mach-tegra/tegra30/clock.c
> checking file arch/arm/include/asm/arch-tegra/clock.h
> checking file arch/arm/mach-tegra/clock.c
> checking file arch/arm/mach-tegra/tegra30/clock.c
> Hunk #1 succeeded at 632 (offset -37 lines).
> checking file arch/arm/dts/tegra114.dtsi
> checking file arch/arm/dts/tegra124.dtsi
> checking file arch/arm/mach-tegra/tegra114/clock.c
> Hunk #1 succeeded at 745 (offset -37 lines).
> checking file arch/arm/mach-tegra/tegra124/clock.c
> Hunk #1 succeeded at 1170 (offset -38 lines).
> checking file arch/arm/mach-tegra/tegra20/clock.c
> Hunk #1 succeeded at 767 (offset -37 lines).
> checking file arch/arm/mach-tegra/tegra210/clock.c
> Hunk #1 succeeded at 1241 (offset -37 lines).
> checking file arch/arm/mach-tegra/tegra30/clock.c
> Hunk #1 succeeded at 806 (offset -78 lines).
> checking file drivers/pwm/tegra_pwm.c
> checking file drivers/spi/tegra20_slink.c
> checking file configs/beaver_defconfig
> checking file configs/cei-tk1-som_defconfig
> checking file configs/dalmore_defconfig
> checking file configs/jetson-tk1_defconfig
> checking file configs/nyan-big_defconfig
> checking file configs/p2371-_defconfig
> checking file configs/p2371-2180_defconfig
> checking file configs/p2571_defconfig
> checking file configs/p3450-_defconfig
> checking file configs/venice2_defconfig
> checking file drivers/usb/gadget/Kconfig
> checking file arch/arm/include/asm/arch-tegra/sys_proto.h
> checking file arch/arm/mach-tegra/board2.c
> checking file arch/arm/include/asm/arch-tegra/tegra_i2c.h
> checking file arch/arm/mach-tegra/cpu.h
> checking file arch/arm/mach-tegra/tegra124/cpu.c
> checking file arch/arm/mach-tegra/tegra30/cpu.c
> checking file board/nvidia/venice2/as3722_init.c
> checking file board/nvidia/venice2/as3722_init.h
> checking file board/toradex/apalis-tk1/as3722_init.c
> checking file board/toradex/apalis-tk1/as3722_init.h
> checking file arch/arm/mach-tegra/tegra30/Kconfig
> checking file arch/arm/mach-tegra/tegra30/cpu.c
> Hunk #1 FAILED at 15.
> Hunk #2 FAILED at 41.
> 2 out of 2 hunks FAILED
> checking file board/avionic-design/tec-ng/Makefile
> checking file board/avionic-design/tec-ng/tec-ng-spl.c
> checking file board/nvidia/beaver/Makefile
> checking file board/nvidia/beaver/beaver-spl.c
> checking file board/nvidia/cardhu/Makefile
> checking file board/nvidia/cardhu/cardhu-spl.c
> checking file board/toradex/apalis_t30/Makefile
> checking file board/toradex/apalis_t30/apalis_t30-spl.c
> checking file board/toradex/colibri_t30/Makefile
> checking file board/toradex/colibri_t30/colibri_t30-spl.c
> checking file arch/arm/mach-tegra/Kconfig
> checking file arch/arm/mach-tegra/Makefile
> checking file arch/arm/mach-tegra/crypto.c (renamed from 
> arch/arm/mach-tegra/tegra20/crypto.c)
> checking file arch/arm/mach-tegra/crypto.h (renamed from 
> arch/arm/mach-tegra/tegra20/crypto.h)
> checking file arch/arm/mach-tegra/tegra20/Kconfig
> checking file arch/arm/mach-tegra/tegra20/Makefile
> checking file arch/arm/include/asm/arch-tegra/crypto.h
> can't find file to patch at input line 3811
> Perhaps you used the wrong -p or --strip option?
> The text leading up to this was:
> --
> |diff --git a/arch/arm/mach-tegra/crypto.c b/arch/arm/mach-tegra/crypto.c
> |index 1efaa5c3ec..893da35e0b 100644
> |--- a/arch/arm/mach-tegra/crypto.c
> |+++ b/arch/arm/mach-tegra/crypto.c
> --
> File to patch: arch/arm/mach-tegra/tegra20/crypto.c
> checking file arch/arm/mach-tegra/tegra20/crypto.c
> The next patch would delete the file arch/arm/mach-tegra/crypto.h,
> which does not exist!  Assume -R? [n]
> Apply anyway? [n]
> Skipping patch.
> 1 out of 1 hunk ignored
> checking file arch/arm/mach-tegra/Kconfig
> Hunk #1 succeeded at 224 (offset -5 lines).
> checking file 

Re: [PATCH] arm: mvebu: Use 4K sector for Thecus N2350 SPI flash

2023-02-17 Thread Stefan Roese

On 2/17/23 04:34, Tony Dinh wrote:

Since the SPI flash chip mx25l3205d on this board has 4K-sector
capability, enable it for the envs.

Signed-off-by: Tony Dinh 


Reviewed-by: Stefan Roese 

Thanks,
Stefan


---

  configs/n2350_defconfig | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configs/n2350_defconfig b/configs/n2350_defconfig
index dcb2c96791..b85ef0dfeb 100644
--- a/configs/n2350_defconfig
+++ b/configs/n2350_defconfig
@@ -14,7 +14,7 @@ CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0xff
  CONFIG_TARGET_N2350=y
  CONFIG_ENV_SIZE=0x1
  CONFIG_ENV_OFFSET=0x10
-CONFIG_ENV_SECT_SIZE=0x1
+CONFIG_ENV_SECT_SIZE=0x1000
  CONFIG_DEFAULT_DEVICE_TREE="armada-385-thecus-n2350"
  CONFIG_SPL_TEXT_BASE=0x4030
  CONFIG_SYS_PROMPT="N2350 > "


Viele Grüße,
Stefan Roese

--
DENX Software Engineering GmbH,  Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: s...@denx.de


Re: [PATCH] riscv: binman: Add help message for missing blobs

2023-02-17 Thread Rick Chen
Hi Leo

> On Thu, Feb 16, 2023 at 09:19:45AM +0800, Rick Chen wrote:
> > Add the 'missing-msg' for more detailed output
> > on missing system firmware.
> >
> > Signed-off-by: Rick Chen 
> > ---
> >  arch/riscv/dts/binman.dtsi | 1 +
> >  tools/binman/missing-blob-help | 4 
> >  2 files changed, 5 insertions(+)
> >
> > diff --git a/arch/riscv/dts/binman.dtsi b/arch/riscv/dts/binman.dtsi
> > index b8fc8f7f35..156cb00971 100644
> > --- a/arch/riscv/dts/binman.dtsi
> > +++ b/arch/riscv/dts/binman.dtsi
> > @@ -45,6 +45,7 @@
> >
> >   opensbi_blob: opensbi {
> >   filename = "fw_dynamic.bin";
> > + missing-msg = "opensbi";
> >   };
> >   };
> >
> > diff --git a/tools/binman/missing-blob-help b/tools/binman/missing-blob-help
> > index c61ca02a35..654ad642a3 100644
> > --- a/tools/binman/missing-blob-help
> > +++ b/tools/binman/missing-blob-help
> > @@ -37,3 +37,7 @@ https://github.com/siemens/k3-rti-wdt.
> >  tee-os:
> >  See the documentation for your board. You may need to build Open Portable
> >  Trusted Execution Environment (OP-TEE) with TEE=/path/to/tee.bin
> > +
> > +opensbi:
> > +See the documentation for your board. The OpenSBI git repo is at
> > +https://github.com/riscv/opensbi.git
> Hi Rick,
>
> Could we add something like
> "build fw_dynamic.bin first and re-build u-boot with 
> OPENSBI=/path/to/fw_dynamic.bin"

OK.

Thanks,
Rick

>
> Other than that,
> Reviewed-by: Leo Yu-Chi Liang 
>
> > --
> > 2.17.1
> >