[U-Boot] [PATCH 1/1] doc: README.iscsi: Open-iSCSI configuration

2018-12-01 Thread Heinrich Schuchardt
Provide settings for Open-iSCSI

Reformat headers. h3-headers marked with ^^^ are not recognized in some
markup editors. Use the ### notation instead.

Signed-off-by: Heinrich Schuchardt 
---
 doc/README.iscsi | 35 ---
 1 file changed, 20 insertions(+), 15 deletions(-)

diff --git a/doc/README.iscsi b/doc/README.iscsi
index faee636264..3a12438f90 100644
--- a/doc/README.iscsi
+++ b/doc/README.iscsi
@@ -1,8 +1,6 @@
-iSCSI booting with U-Boot and iPXE
-==
+# iSCSI booting with U-Boot and iPXE
 
-Motivation
---
+## Motivation
 
 U-Boot has only a reduced set of supported network protocols. The focus for
 network booting has been on UDP based protocols. A TCP stack and HTTP support
@@ -41,8 +39,7 @@ fine grained control of the boot process and can provide a 
command shell.
 iPXE can be built as an EFI application (named snp.efi) which can be loaded and
 run by U-Boot.
 
-Boot sequence
--
+## Boot sequence
 
 U-Boot loads the EFI application iPXE snp.efi using the bootefi command. This
 application has network access via the simple network protocol offered by
@@ -106,19 +103,16 @@ the EFI stub Linux is called as an EFI application::
   |
|
   | ~ ~ ~ 
~|
 
-Security
-
+## Security
 
 The iSCSI protocol is not encrypted. The traffic could be secured using IPsec
 but neither U-Boot nor iPXE does support this. So we should at least separate
 the iSCSI traffic from all other network traffic. This can be achieved using a
 virtual local area network (VLAN).
 
-Configuration
--
+## Configuration
 
-iPXE
-
+### iPXE
 
 For running iPXE on arm64 the bin-arm64-efi/snp.efi build target is needed::
 
@@ -157,9 +151,20 @@ following into src/config/local/general.h is sufficient 
for most use cases::
 #define DOWNLOAD_PROTO_NFS  /* Network File System Protocol */
 #define DOWNLOAD_PROTO_FILE /* Local file system access */
 
-Links
--
+### Open-iSCSI
+
+When the root file system is on an iSCSI drive you should disable pings and set
+the replacement timer to a high value [3]:
+
+node.conn[0].timeo.noop_out_interval = 0
+node.conn[0].timeo.noop_out_timeout = 0
+node.session.timeo.replacement_timeout = 86400
+
+## Links
 
 * [1](https://ipxe.org) https://ipxe.org - iPXE open source boot firmware
 * [2](https://www.gnu.org/software/grub/) https://www.gnu.org/software/grub/ -
-  GNU GRUB (Grand Unified Bootloader)
+ GNU GRUB (Grand Unified Bootloader)
+* [3](https://github.com/open-iscsi/open-iscsi/blob/master/README)
+ https://github.com/open-iscsi/open-iscsi/blob/master/README -
+ Open-iSCSI README
-- 
2.19.1

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v4 0/7] Fix CVE-2018-18440 and CVE-2018-18439

2018-12-01 Thread Simon Goldschmidt
On Fri, Nov 30, 2018 at 6:51 PM Frank Wunderlich
 wrote:
>
> Hi Simon,
>
> after applying these Patch-series i cannot load to any address (fatload). Do 
> i need any additional Patch ("fdt: parse "reserved-memory" for memory 
> reservation" sounds like that). Maybe there should be a fallback if no 
> reservation is defined.

No, you should not need additional patches. The code makes use of
"lmb" memory allocation just like the "bootm" code does. The "memory
reservation" patch you cited only ensures that memory which is marked
as reserved in the fdt cannot be overwritten by load.

If it doesn't work for you at all, the available memory is probably
not described correctly. Could you check the values of the following
defines (or if they are defined at all):
- CONFIG_SYS_SDRAM_BASE
- CONFIG_ARM
- CONFIG_NR_DRAM_BANKS

I might need to improve the DRAM detection code in v5 (which is still
pending as I am working on lmb tests).

Regards,
Simon

>
> regards Frank
>
> > Gesendet: Samstag, 24. November 2018 um 15:11 Uhr
> > Von: "Simon Goldschmidt" 
> > An: "Tom Rini" , u-boot@lists.denx.de, "Joe 
> > Hershberger" 
> > Cc: "Alexey Brodkin" , "Heinrich Schuchardt" 
> > , "Michal Simek" , "Alexander 
> > Graf" , "Andrea Barisani" 
> > Betreff: [U-Boot] [PATCH v4 0/7] Fix CVE-2018-18440 and CVE-2018-18439
> >
> > This series fixes CVE-2018-18440 ("insufficient boundary checks in
> > filesystem image load") by adding restrictions to the 'load'
> > command and fixes CVE-2018-18439 ("insufficient boundary checks in
> > network image boot") by adding restrictions to the tftp code.
> > The functions from lmb.c are used to setup regions of allowed and
> > reserved memory. Then, the file size to load is checked against these
> > addresses and loading the file is aborted if it would overwrite
> > reserved memory.
> >
> > The memory reservation code is reused from bootm/image.
> >
> > Changes in v4:
> > - fixed invalid 'if' statement without braces in boot_fdt_reserve_region
> > - removed patch 7 ("net: remove CONFIG_MCAST_TFTP), adapted patch 8
> >
> > Changes in v3:
> > - No patch changes, but needed to resend since patman added too many cc
> >   addresses that gmail seemed to detect as spam :-(
> >
> > Changes in v2:
> > - added code to reserve devicetree reserved-memory in lmb
> > - added tftp fixes (patches 7 and 8)
> > - fixed a bug in new function lmb_alloc_addr
> >
> > Simon Goldschmidt (7):
> >   lib: lmb: reserving overlapping regions should fail
> >   fdt: parse "reserved-memory" for memory reservation
> >   lib: lmb: extend lmb for checks at load time
> >   fs: prevent overwriting reserved memory
> >   bootm: use new common function lmb_init_and_reserve
> >   lmb: remove unused extern declaration
> >   tftp: prevent overwriting reserved memory
> >
> >  common/bootm.c |  8 ++
> >  common/image-fdt.c | 53 +--
> >  fs/fs.c| 56 +++--
> >  include/lmb.h  |  7 +++--
> >  lib/lmb.c  | 69 ++
> >  net/tftp.c | 66 ++--
> >  6 files changed, 231 insertions(+), 28 deletions(-)
> >
> > --
> > 2.17.1
> >
> > ___
> > U-Boot mailing list
> > U-Boot@lists.denx.de
> > https://lists.denx.de/listinfo/u-boot
> >
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH] mtd: sf_probe: add jedec,spi-nor compatible

2018-12-01 Thread Simon Goldschmidt
On Fri, Nov 30, 2018 at 5:12 PM Neil Armstrong  wrote:
>
> Hi Simon,
>
> On 25/11/2018 19:57, Simon Goldschmidt wrote:
> > On 14.11.2018 10:15, Jagan Teki wrote:
> >> On Wed, Nov 14, 2018 at 2:39 PM Simon Goldschmidt
> >>  wrote:
> >>> On Wed, Nov 14, 2018 at 9:59 AM Jagan Teki  
> >>> wrote:
>  On Sat, Nov 10, 2018 at 1:14 AM Simon Goldschmidt
>   wrote:
> > On 06.11.2018 10:24, Neil Armstrong wrote:
> >> There is no reason not to use the Linux "jedec,spi-nor" binding in 
> >> u-boot.
> >> This patch adds this compatible into sf_probe and will avoid changing 
> >> the
> >> device tree files to add a u-boot specific compatible to probe a spi 
> >> flash.
> >>
> >> This change is needed to enable SPI NOR Flash support using the 
> >> non-modified
> >> device tree file for Amlogic Meson GX SoC based boards.
> >>
> >> Signed-off-by: Neil Armstrong 
> > This is definitively a move in the right direction! I was only days away
> > from sending this myself ;-)
> >
> > Reviewed-by: Simon Goldschmidt 
> >
> > I would still need more changes to U-Boot to boot the Linux socfpga
> > devicetrees without patches (they have compatible = "n25q256a" etc.),
> > but then again, maybe it's easier to change the Linux ones to include
> > "jedec,spi-nor" than trying the effort of changing U-Boot here...
>  It's better to revert/remove "spi-flash" from Linux sync dts(s) files
>  along with this compatible change, u-boot specific stuff like sandbox
>  still use the legacy.
> >>> Is this a reply to me to change the scofpga dts files or to Neil to
> >>> remove "spi-flash" from U-Boot with his patch?
> >> Not to remove as of now.
> >>
> >>> Because, sure, once U-Boot supports "jedec-spi-nor", I'll make sure
> >>> the Linux devicetrees get that, too (in addition to the "n25q..."
> >>> compatibles) so that they just work in U-Boot and can be synced again.
> >> I think it's better to go with all respective changes in one patch? do
> >> you think it's risky? because many of Linux sync dts on respective
> >> driver will work straightaway. I have no objection to add this
> >> "jedec-spi-nor" below of "spi-flash". Once all moved we can drop the
> >> "spi-flash"
> >
> > Neil, are you planning to send a conversion patch for the ~100 dts files 
> > using "spi-flash" today? I think it would be good to have this as one 
> > series with 3 patches where 1 introduces "jedec-spi-nor", 2 converts 
> > existing boards and 3 removes "spi-flash".
>
> Sorry I missed your reply, I didn't plan that, but I can evaluate and do it 
> if it's simple enough.

I would have thought it's a matter of just search&replace. But I don't
know what's the procedure of reviewing & pushing such a big change
throughout the U-Boot sources...

Simon
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v4 0/7] Fix CVE-2018-18440 and CVE-2018-18439

2018-12-01 Thread Frank Wunderlich
Hi Simon

#define CONFIG_SYS_SDRAM_BASE   0x8000

https://github.com/frank-w/u-boot/blob/a6d0c3f8e992a2e428f05443647fe9f5b13f8634/include/configs/mt7623.h#L47

CONFIG_ARM=y
CONFIG_NR_DRAM_BANKS=1
https://github.com/frank-w/u-boot/blob/a6d0c3f8e992a2e428f05443647fe9f5b13f8634/configs/mt7623n_bpir2_defconfig#L7

i applied the patch-series on top of my 2018-11 final (currently removed from 
github)

https://github.com/frank-w/u-boot/tree/bpi-r2_v5

tried ${scriptaddr}=0x8300

here the fatload-command:

https://github.com/frank-w/u-boot/blob/60bc4075c7744e36058fcba76cd6e6c3a4002265/uEnv.txt#L22

working before, 0x8100 and some higher values

HTH

regards Frank

> Gesendet: Samstag, 01. Dezember 2018 um 10:25 Uhr
> Von: "Simon Goldschmidt" 
> An: "Frank Wunderlich" 
> Cc: "U-Boot Mailing List" 
> Betreff: Re: [U-Boot] [PATCH v4 0/7] Fix CVE-2018-18440 and CVE-2018-18439
>
> On Fri, Nov 30, 2018 at 6:51 PM Frank Wunderlich
>  wrote:
> >
> > Hi Simon,
> >
> > after applying these Patch-series i cannot load to any address (fatload). 
> > Do i need any additional Patch ("fdt: parse "reserved-memory" for memory 
> > reservation" sounds like that). Maybe there should be a fallback if no 
> > reservation is defined.
> 
> No, you should not need additional patches. The code makes use of
> "lmb" memory allocation just like the "bootm" code does. The "memory
> reservation" patch you cited only ensures that memory which is marked
> as reserved in the fdt cannot be overwritten by load.
> 
> If it doesn't work for you at all, the available memory is probably
> not described correctly. Could you check the values of the following
> defines (or if they are defined at all):
> - CONFIG_SYS_SDRAM_BASE
> - CONFIG_ARM
> - CONFIG_NR_DRAM_BANKS
> 
> I might need to improve the DRAM detection code in v5 (which is still
> pending as I am working on lmb tests).
> 
> Regards,
> Simon
> 
> >
> > regards Frank
> >
> > > Gesendet: Samstag, 24. November 2018 um 15:11 Uhr
> > > Von: "Simon Goldschmidt" 
> > > An: "Tom Rini" , u-boot@lists.denx.de, "Joe 
> > > Hershberger" 
> > > Cc: "Alexey Brodkin" , "Heinrich Schuchardt" 
> > > , "Michal Simek" , 
> > > "Alexander Graf" , "Andrea Barisani" 
> > > 
> > > Betreff: [U-Boot] [PATCH v4 0/7] Fix CVE-2018-18440 and CVE-2018-18439
> > >
> > > This series fixes CVE-2018-18440 ("insufficient boundary checks in
> > > filesystem image load") by adding restrictions to the 'load'
> > > command and fixes CVE-2018-18439 ("insufficient boundary checks in
> > > network image boot") by adding restrictions to the tftp code.
> > > The functions from lmb.c are used to setup regions of allowed and
> > > reserved memory. Then, the file size to load is checked against these
> > > addresses and loading the file is aborted if it would overwrite
> > > reserved memory.
> > >
> > > The memory reservation code is reused from bootm/image.
> > >
> > > Changes in v4:
> > > - fixed invalid 'if' statement without braces in boot_fdt_reserve_region
> > > - removed patch 7 ("net: remove CONFIG_MCAST_TFTP), adapted patch 8
> > >
> > > Changes in v3:
> > > - No patch changes, but needed to resend since patman added too many cc
> > >   addresses that gmail seemed to detect as spam :-(
> > >
> > > Changes in v2:
> > > - added code to reserve devicetree reserved-memory in lmb
> > > - added tftp fixes (patches 7 and 8)
> > > - fixed a bug in new function lmb_alloc_addr
> > >
> > > Simon Goldschmidt (7):
> > >   lib: lmb: reserving overlapping regions should fail
> > >   fdt: parse "reserved-memory" for memory reservation
> > >   lib: lmb: extend lmb for checks at load time
> > >   fs: prevent overwriting reserved memory
> > >   bootm: use new common function lmb_init_and_reserve
> > >   lmb: remove unused extern declaration
> > >   tftp: prevent overwriting reserved memory
> > >
> > >  common/bootm.c |  8 ++
> > >  common/image-fdt.c | 53 +--
> > >  fs/fs.c| 56 +++--
> > >  include/lmb.h  |  7 +++--
> > >  lib/lmb.c  | 69 ++
> > >  net/tftp.c | 66 ++--
> > >  6 files changed, 231 insertions(+), 28 deletions(-)
> > >
> > > --
> > > 2.17.1
> > >
> > > ___
> > > U-Boot mailing list
> > > U-Boot@lists.denx.de
> > > https://lists.denx.de/listinfo/u-boot
> > >
> 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH] cmd: add clear screen 'cls' command

2018-12-01 Thread Anatolij Gustschin
Hi Patrick,

On Mon, 19 Nov 2018 18:09:12 +
Patrick DELAUNAY patrick.delau...@st.com wrote:
...
> > +config CMD_CLS
> > +   bool "Enable clear screen command 'cls'"
> > +   depends on CFB_CONSOLE || DM_VIDEO || LCD || VIDEO  
> 
> Just a minor remark, you can also add :
> 
>   default y  if !DM_VIDEO

There are also a few boards with DM_VIDEO and LCD both enabled:

$ git grep CONFIG_LCD `git grep DM_VIDEO=y configs/ | awk -F : '{print $1}'`
configs/peach-pi_defconfig:CONFIG_LCD=y
configs/peach-pit_defconfig:CONFIG_LCD=y
configs/snow_defconfig:CONFIG_LCD=y
configs/spring_defconfig:CONFIG_LCD=y

so using y if !DM_VIDEO would disable the command for them.

> To avoid the defconfig modifications in the patch.
> (lcd.o if compiled ifndef CONFIG_DM_VIDEO) / command previously always define 
> in this case)
> But you prefer perhaps to have clear CONFIG_CMD configuration in each 
> defconfig.

I'd like to reduce the defconfig size, so v2 patch uses
"default y if LCD" to auto-select the command (compatibility for
existing CONFIG_LCD users). For other configurations the command
should be enabled in defconfig by users, when needed.

...
> But Ok for the rest. 
> Tested on my board (stm32mp157_ev1 with DM_VIDEO activated)
> 
> Regards, Patrick.
> 
> Tested-by: Patrick.Delaunay 

Thanks for testing it!

--
Anatolij
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v2] cmd: add clear screen 'cls' command

2018-12-01 Thread Anatolij Gustschin
Add common clear screen command for configurations
CONFIG_DM_VIDEO, CONFIG_LCD and CONFIG_CFB_CONSOLE.

Remove the existing cls command implementation from
lcd.c code and activate the command for all boards
enabling CONFIG_LCD for compatibility reasons.

Signed-off-by: Anatolij Gustschin 
Tested-by: Patrick.Delaunay 
---
Changes in v2:
 - auto-select the command when CONFIG_LCD defined
   instead of extending each affected board defconfig
 - add Tested-by tag

 cmd/Kconfig  |  8 
 cmd/Makefile |  1 +
 cmd/cls.c| 35 +++
 common/lcd.c |  8 
 4 files changed, 44 insertions(+), 8 deletions(-)
 create mode 100644 cmd/cls.c

diff --git a/cmd/Kconfig b/cmd/Kconfig
index e2973b3c51..b1cd1c9690 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -1380,6 +1380,14 @@ config CMD_CONITRACE
  Enable the 'conitrace' command which displays the codes received
  from the console input as hexadecimal numbers.
 
+config CMD_CLS
+   bool "Enable clear screen command 'cls'"
+   depends on CFB_CONSOLE || DM_VIDEO || LCD || VIDEO
+   default y if LCD
+   help
+ Enable the 'cls' command which clears the screen contents
+ on video frame buffer.
+
 config CMD_DISPLAY
bool "Enable the 'display' command, for character displays"
help
diff --git a/cmd/Makefile b/cmd/Makefile
index 5ec2f9e8eb..49986437ba 100644
--- a/cmd/Makefile
+++ b/cmd/Makefile
@@ -32,6 +32,7 @@ obj-$(CONFIG_CMD_BTRFS) += btrfs.o
 obj-$(CONFIG_CMD_CACHE) += cache.o
 obj-$(CONFIG_CMD_CBFS) += cbfs.o
 obj-$(CONFIG_CMD_CLK) += clk.o
+obj-$(CONFIG_CMD_CLS) += cls.o
 obj-$(CONFIG_CMD_CONFIG) += config.o
 obj-$(CONFIG_CMD_CONITRACE) += conitrace.o
 obj-$(CONFIG_CMD_CONSOLE) += console.o
diff --git a/cmd/cls.c b/cmd/cls.c
new file mode 100644
index 00..f1ce6e8df1
--- /dev/null
+++ b/cmd/cls.c
@@ -0,0 +1,35 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * (C) Copyright 2018
+ * DENX Software Engineering, Anatolij Gustschin 
+ *
+ * cls - clear screen command
+ */
+#include 
+#include 
+#include 
+#include 
+#include 
+
+static int do_video_clear(cmd_tbl_t *cmdtp, int flag, int argc,
+ char *const argv[])
+{
+#if defined(CONFIG_DM_VIDEO)
+   struct udevice *dev;
+
+   if (uclass_first_device_err(UCLASS_VIDEO, &dev))
+   return CMD_RET_FAILURE;
+
+   if (video_clear(dev))
+   return CMD_RET_FAILURE;
+#elif defined(CONFIG_CFB_CONSOLE)
+   video_clear();
+#elif defined(CONFIG_LCD)
+   lcd_clear();
+#else
+   return CMD_RET_FAILURE;
+#endif
+   return CMD_RET_SUCCESS;
+}
+
+U_BOOT_CMD(cls,1, 1, do_video_clear, "clear screen", "");
diff --git a/common/lcd.c b/common/lcd.c
index 2e2bef3848..74407a17e9 100644
--- a/common/lcd.c
+++ b/common/lcd.c
@@ -242,14 +242,6 @@ void lcd_clear(void)
lcd_sync();
 }
 
-static int do_lcd_clear(cmd_tbl_t *cmdtp, int flag, int argc,
-   char *const argv[])
-{
-   lcd_clear();
-   return 0;
-}
-U_BOOT_CMD(cls,1, 1, do_lcd_clear, "clear screen", "");
-
 static int lcd_init(void *lcdbase)
 {
debug("[LCD] Initializing LCD frambuffer at %p\n", lcdbase);
-- 
2.17.1

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v3 0/5] Migrate BOUNCE_BUFFER

2018-12-01 Thread Simon Goldschmidt

Am 30.11.2018 um 22:13 schrieb Philipp Tomsich:

A number of MMC drivers uses BOUNCE_BUFFER for their DMA buffers.
This moves it into Kconfig and performs a step-by-step migration for
the affected boards/drivers.

Given that BOUNCE_BUFFER only controls whether the bounce_buffer_*
functions are build and linked, this configuration option could be
entirely removed and the utility functions built unconditionally.  For
platforms that don't make use of these functions, the linker will then
remove the unused symbols.

I'll leave the final decision if this would be a better implementation
(or if this should be done in a two-stage process) to someone else...


Reviewed-by: Simon Goldschmidt 

I had to manually change patch 2/5 since it did not apply, but after 
that it worked for socfpga gen5.


I only wonder if we need to clean up the defconfigs again after 
selecting BOUNCE_BUFFER via dw_mmc?


Regards,
Simon




Changes in v3:
- also remove the define from the recently added rv1108_common.h

Changes in v2:
- address sequencing of changes to ensure that tree remains buildable
   after each individual patch is applied
- extended help message in Kconfig to explicitly note that bounce
   buffers can be used to have properly aligned buffers

Philipp Tomsich (5):
   Kconfig: Migrate BOUNCE_BUFFER
   mmc: dw_mmc: depend on BOUNCE_BUFFER
   mmc: mxsmmc: select BOUNCE_BUFFER unconditionally
   mmc: tegra: select BOUNCE_BUFFER unconditionally
   arc: select BOUNCE_BUFFER for CMD_NAND on AXS10x

  arch/arc/Kconfig  |  2 ++
  common/Kconfig| 11 +++
  configs/apalis-tk1_defconfig  |  1 +
  configs/apalis_imx6_defconfig |  1 +
  configs/apalis_imx6_nospl_com_defconfig   |  1 +
  configs/apalis_imx6_nospl_it_defconfig|  1 +
  configs/apalis_t30_defconfig  |  1 +
  configs/apx4devkit_defconfig  |  1 +
  configs/aristainetos2_defconfig   |  1 +
  configs/aristainetos2b_defconfig  |  1 +
  configs/aristainetos_defconfig|  1 +
  configs/arndale_defconfig |  1 +
  configs/bcm911360_entphn-ns_defconfig |  1 +
  configs/bcm911360_entphn_defconfig|  1 +
  configs/bcm911360k_defconfig  |  1 +
  configs/bcm958300k-ns_defconfig   |  1 +
  configs/bcm958300k_defconfig  |  1 +
  configs/bcm958305k_defconfig  |  1 +
  configs/bcm958622hr_defconfig |  1 +
  configs/beaver_defconfig  |  1 +
  configs/cardhu_defconfig  |  1 +
  configs/cei-tk1-som_defconfig |  1 +
  configs/cgtqmx6eval_defconfig |  1 +
  configs/chromebit_mickey_defconfig|  1 +
  configs/chromebook_jerry_defconfig|  1 +
  configs/chromebook_minnie_defconfig   |  1 +
  configs/cl-som-imx7_defconfig |  1 +
  configs/cm_fx6_defconfig  |  1 +
  configs/colibri-imx6ull_defconfig |  1 +
  configs/colibri_imx6_defconfig|  1 +
  configs/colibri_imx6_nospl_defconfig  |  1 +
  configs/colibri_imx7_defconfig|  1 +
  configs/colibri_t20_defconfig |  1 +
  configs/colibri_t30_defconfig |  1 +
  configs/dalmore_defconfig |  1 +
  configs/dh_imx6_defconfig |  1 +
  configs/display5_defconfig|  1 +
  configs/display5_factory_defconfig|  1 +
  configs/dms-ba16-1g_defconfig |  1 +
  configs/dms-ba16_defconfig|  1 +
  configs/e2220-1170_defconfig  |  1 +
  configs/evb-px5_defconfig |  1 +
  configs/evb-rk3036_defconfig  |  1 +
  configs/evb-rk3128_defconfig  |  1 +
  configs/evb-rk3229_defconfig  |  1 +
  configs/evb-rk3288_defconfig  |  1 +
  configs/evb-rk3328_defconfig  |  1 +
  configs/evb-rk3399_defconfig  |  1 +
  configs/fennec-rk3288_defconfig   |  1 +
  configs/firefly-rk3288_defconfig  |  1 +
  configs/firefly-rk3399_defconfig  |  1 +
  configs/ge_bx50v3_defconfig   |  1 +
  configs/geekbox_defconfig |  1 +
  configs/gwventana_emmc_defconfig  |  1 +
  configs/gwventana_gw5904_defconfig|  1 +
  configs/gwventana_nand_defconfig  |  1 +
  configs/harmony_defconfig |  1 +
  configs/hikey_defconfig   |  1 +
  configs/imx6dl_icore_nand_defconfig   |  1 +
  configs/imx6dl_mamoj_defconfig|  1 +
  configs/imx6q_icore_nand_defconfig|  1 +
  configs/imx6q_logic_defconfig |  1 +
  configs/imx6qdl_icore_mipi_defconfig  |  1 +
  configs/imx6qdl_icore_mmc_defconfig   |  1 +
  configs/imx6qdl_icore_nand_defconfig  |  1 +
  configs/imx6qdl_icore_rqs_defconfig   |  1 +
  configs/imx6ul_geam_mmc_defconfig |  1 +
  configs/imx6ul_geam_nand_defconfig|  1 +
  configs/imx6

Re: [U-Boot] [RFC PATCH] tools: add a generic config for native tools building

2018-12-01 Thread Peter Robinson
On Thu, Nov 29, 2018 at 6:40 PM Tom Rini  wrote:
>
> On Tue, Nov 27, 2018 at 06:20:08PM -0200, Otavio Salvador wrote:
>
> > The motivation for this is to allow distributions to distribute all
> > possible tools in a generic way, avoiding the need of specific tools
> > building for each machine.
> >
> > Especially on OpenEmbedded / Yocto Project ecosystem, it is very
> > common each BSP to end providing their specific tools when they need
> > to generate images for some SoC (e.g MX23 / MX28 in meta-freescale
> > case).
> >
> > Using this, we can package the tools doing:
> >
> > $: make tools-only_defconfig
> > $: make tools-only
> >
> > Signed-off-by: Otavio Salvador 
> > ---
> >
> >  configs/tools-only_defconfig | 3 +++
> >  tools/Makefile   | 2 +-
> >  2 files changed, 4 insertions(+), 1 deletion(-)
> >  create mode 100644 configs/tools-only_defconfig
> >
> > diff --git a/configs/tools-only_defconfig b/configs/tools-only_defconfig
> > new file mode 100644
> > index 00..be69bdf43a
> > --- /dev/null
> > +++ b/configs/tools-only_defconfig
> > @@ -0,0 +1,3 @@
> > +CONFIG_SYS_TEXT_BASE=0
> > +CONFIG_FIT=y
> > +CONFIG_FIT_SIGNATURE=y
> > diff --git a/tools/Makefile b/tools/Makefile
> > index 3c0521f655..e916d0cebb 100644
> > --- a/tools/Makefile
> > +++ b/tools/Makefile
> > @@ -124,7 +124,7 @@ fit_info-objs   := $(dumpimage-mkimage-objs) fit_info.o
> >  fit_check_sign-objs   := $(dumpimage-mkimage-objs) fit_check_sign.o
> >  file2include-objs := file2include.o
> >
> > -ifneq ($(CONFIG_MX23)$(CONFIG_MX28),)
> > +ifneq ($(CONFIG_MX23)$(CONFIG_MX28)$(CONFIG_FIT_SIGNATURE),)
> >  # Add CONFIG_MXS into host CFLAGS, so we can check whether or not register
> >  # the mxsimage support within tools/mxsimage.c .
> >  HOSTCFLAGS_mxsimage.o += -DCONFIG_MXS
>
> Adding in Peter since Fedora had this same problem crop up.  Does
> something like this work for you guys?  Also adding in Vagrant Cascadian
> since Debian might want to switch to this too.  Thoughts?  Thanks!

We currently use the tools-all option, details below, to build the
tools, which broken in 2018.11 on non arm/x86 platforms due to the
sandbox dep being added in there. I'm happy to adjust as necessary to
fix that but I'm not sure the difference between tools-all vs the
above.

make CROSS_COMPILE="" defconfig V=1 O=builds/
make CROSS_COMPILE="" tools-all V=1 O=builds/
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v4 0/7] Fix CVE-2018-18440 and CVE-2018-18439

2018-12-01 Thread Frank Wunderlich
forgot error-message and detailed command:

fatload ${device} ${partition} ${scriptaddr} 
${bpi}/${board}/${service}/${bootenv}
** Reading file would overwrite reserved memory **
echo ${device} ${partition} ${scriptaddr} ${bpi}/${board}/${service}/${bootenv}
mmc 1:1 0x8300 bananapi/bpi-r2/linux/uEnv.txt

file exists i checked with test, but fatload failed, after reverting the 
Patches same command works

regards Frank

> Gesendet: Samstag, 01. Dezember 2018 um 10:46 Uhr
> Von: "Frank Wunderlich" 
> An: "Simon Goldschmidt" 
> Cc: u-boot@lists.denx.de
> Betreff: Re: [U-Boot] [PATCH v4 0/7] Fix CVE-2018-18440 and CVE-2018-18439
>
> Hi Simon
> 
> #define CONFIG_SYS_SDRAM_BASE 0x8000
> 
> https://github.com/frank-w/u-boot/blob/a6d0c3f8e992a2e428f05443647fe9f5b13f8634/include/configs/mt7623.h#L47
> 
> CONFIG_ARM=y
> CONFIG_NR_DRAM_BANKS=1
> https://github.com/frank-w/u-boot/blob/a6d0c3f8e992a2e428f05443647fe9f5b13f8634/configs/mt7623n_bpir2_defconfig#L7
> 
> i applied the patch-series on top of my 2018-11 final (currently removed from 
> github)
> 
> https://github.com/frank-w/u-boot/tree/bpi-r2_v5
> 
> tried ${scriptaddr}=0x8300
> 
> here the fatload-command:
> 
> https://github.com/frank-w/u-boot/blob/60bc4075c7744e36058fcba76cd6e6c3a4002265/uEnv.txt#L22
> 
> working before, 0x8100 and some higher values
> 
> HTH
> 
> regards Frank
> 
> > Gesendet: Samstag, 01. Dezember 2018 um 10:25 Uhr
> > Von: "Simon Goldschmidt" 
> > An: "Frank Wunderlich" 
> > Cc: "U-Boot Mailing List" 
> > Betreff: Re: [U-Boot] [PATCH v4 0/7] Fix CVE-2018-18440 and CVE-2018-18439
> >
> > On Fri, Nov 30, 2018 at 6:51 PM Frank Wunderlich
> >  wrote:
> > >
> > > Hi Simon,
> > >
> > > after applying these Patch-series i cannot load to any address (fatload). 
> > > Do i need any additional Patch ("fdt: parse "reserved-memory" for memory 
> > > reservation" sounds like that). Maybe there should be a fallback if no 
> > > reservation is defined.
> > 
> > No, you should not need additional patches. The code makes use of
> > "lmb" memory allocation just like the "bootm" code does. The "memory
> > reservation" patch you cited only ensures that memory which is marked
> > as reserved in the fdt cannot be overwritten by load.
> > 
> > If it doesn't work for you at all, the available memory is probably
> > not described correctly. Could you check the values of the following
> > defines (or if they are defined at all):
> > - CONFIG_SYS_SDRAM_BASE
> > - CONFIG_ARM
> > - CONFIG_NR_DRAM_BANKS
> > 
> > I might need to improve the DRAM detection code in v5 (which is still
> > pending as I am working on lmb tests).
> > 
> > Regards,
> > Simon
> > 
> > >
> > > regards Frank
> > >
> > > > Gesendet: Samstag, 24. November 2018 um 15:11 Uhr
> > > > Von: "Simon Goldschmidt" 
> > > > An: "Tom Rini" , u-boot@lists.denx.de, "Joe 
> > > > Hershberger" 
> > > > Cc: "Alexey Brodkin" , "Heinrich 
> > > > Schuchardt" , "Michal Simek" 
> > > > , "Alexander Graf" , "Andrea 
> > > > Barisani" 
> > > > Betreff: [U-Boot] [PATCH v4 0/7] Fix CVE-2018-18440 and CVE-2018-18439
> > > >
> > > > This series fixes CVE-2018-18440 ("insufficient boundary checks in
> > > > filesystem image load") by adding restrictions to the 'load'
> > > > command and fixes CVE-2018-18439 ("insufficient boundary checks in
> > > > network image boot") by adding restrictions to the tftp code.
> > > > The functions from lmb.c are used to setup regions of allowed and
> > > > reserved memory. Then, the file size to load is checked against these
> > > > addresses and loading the file is aborted if it would overwrite
> > > > reserved memory.
> > > >
> > > > The memory reservation code is reused from bootm/image.
> > > >
> > > > Changes in v4:
> > > > - fixed invalid 'if' statement without braces in boot_fdt_reserve_region
> > > > - removed patch 7 ("net: remove CONFIG_MCAST_TFTP), adapted patch 8
> > > >
> > > > Changes in v3:
> > > > - No patch changes, but needed to resend since patman added too many cc
> > > >   addresses that gmail seemed to detect as spam :-(
> > > >
> > > > Changes in v2:
> > > > - added code to reserve devicetree reserved-memory in lmb
> > > > - added tftp fixes (patches 7 and 8)
> > > > - fixed a bug in new function lmb_alloc_addr
> > > >
> > > > Simon Goldschmidt (7):
> > > >   lib: lmb: reserving overlapping regions should fail
> > > >   fdt: parse "reserved-memory" for memory reservation
> > > >   lib: lmb: extend lmb for checks at load time
> > > >   fs: prevent overwriting reserved memory
> > > >   bootm: use new common function lmb_init_and_reserve
> > > >   lmb: remove unused extern declaration
> > > >   tftp: prevent overwriting reserved memory
> > > >
> > > >  common/bootm.c |  8 ++
> > > >  common/image-fdt.c | 53 +--
> > > >  fs/fs.c| 56 +++--
> > > >  include/lmb.h  |  7 +++--
> > > >  lib/lmb.c  | 69 ++
> > > > 

Re: [U-Boot] add default-option to bootmenu

2018-12-01 Thread Frank Wunderlich
thank you

as a small improvement (i've recently experienced), menu->active should be 
checked against menu->count (at the end of bootmenu_create), else it can be 
"outside" of the menu and selection is not visible till menu->active is below 
menu->count.

http://git.denx.de/?p=u-boot.git;a=blob;f=cmd/bootmenu.c;h=979ac4a638df48b9552feb82dd80ddbe74e69b8e;hb=f7bb20a53e829ce0b4d3c22c704e80b490d24016#l353

but i'm not 100% sure, how to handle it correctly, so i post it for discussion

because menu->active is initialized with 0 my preferred version is this:

if (menu->active >= menu->count)
  menu->active=0; //or any other value below menu->count (maybe a const set by 
boardconfig, but this can also be outside the menu, so 0 is imho better)

this is a user-configured environment-var so it is not a big problem :) but a 
simple check avoids this issue

regards Frank

> Gesendet: Dienstag, 27. November 2018 um 19:47 Uhr
> Von: "Tom Rini" 
> An: "Frank Wunderlich" 
> Cc: u-boot@lists.denx.de
> Betreff: Re: [U-Boot] add default-option to bootmenu
>
> On Fri, Oct 05, 2018 at 11:58:39AM +0200, Frank Wunderlich wrote:
> 
> > >From 6304b2ee2d2e9be47672d3559fee8d879b7328ff Mon Sep 17 00:00:00 2001
> > From: Frank Wunderlich 
> > Date: Fri, 5 Oct 2018 11:41:59 +0200
> > Subject: [PATCH] add default-option to bootmenu
> > with this patch the selected Entry in bootmenu can be set by
> > environment-var bootmenu_default=
> > Signed-off-by: Frank Wunderlich 
> 
> Applied to u-boot/master, thanks!
> 
> -- 
> Tom
> 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] r40 enable loading from spi

2018-12-01 Thread Ralph Spitzner

small patch to enable loading of u-boot from spi-flash  on allwinner r40 boards
( Bananapi_M2_Ultra/Berry)

testet on my Berry, now loading linux from scsi :-)


diff --git a/arch/arm/mach-sunxi/Kconfig b/arch/arm/mach-sunxi/Kconfig
index 3c54f5106d..69f6748f6b 100644
--- a/arch/arm/mach-sunxi/Kconfig
+++ b/arch/arm/mach-sunxi/Kconfig
@@ -973,7 +973,7 @@ config SPL_STACK_R_ADDR

 config SPL_SPI_SUNXI
bool "Support for SPI Flash on Allwinner SoCs in SPL"
-   depends on MACH_SUN4I || MACH_SUN5I || MACH_SUN7I || MACH_SUNXI_H3_H5 
|| MACH_SUN50I
+   depends on MACH_SUN4I || MACH_SUN5I || MACH_SUN7I || MACH_SUNXI_H3_H5 
|| MACH_SUN50I || MACH_SUN8I_R40
help
  Enable support for SPI Flash. This option allows SPL to read from
  sunxi SPI Flash. It uses the same method as the boot ROM, so does
diff --git a/arch/arm/mach-sunxi/spl_spi_sunxi.c 
b/arch/arm/mach-sunxi/spl_spi_sunxi.c
index 043d9f6ead..07e08c184d 100644
--- a/arch/arm/mach-sunxi/spl_spi_sunxi.c
+++ b/arch/arm/mach-sunxi/spl_spi_sunxi.c
@@ -54,7 +54,28 @@
 /* SUN6I variant of the SPI controller   */
 /*/

-#define SUN6I_SPI0_CCTL (0x01C68000 + 0x24)
+/* R40 has the same register map as other sun6i's, but a different base address
+ * and uses PC23 for cs-r...@spitzner.org 12/'18
+ */
+
+#if IS_ENABLED(ONFIG_MACH_SUN8I_R40)
+#define SUN6I_SPI0_CCTL (0x01c05000 + 0x24)
+#define SUN6I_SPI0_GCR  (0x01c05000 + 0x04)
+#define SUN6I_SPI0_TCR  (0x01c05000 + 0x08)
+#define SUN6I_SPI0_FIFO_STA (0x01c05000 + 0x1C)
+#define SUN6I_SPI0_MBC  (0x01c05000 + 0x30)
+#define SUN6I_SPI0_MTC  (0x01c05000 + 0x34)
+#define SUN6I_SPI0_BCC  (0x01c05000 + 0x38)
+#define SUN6I_SPI0_TXD  (0x01c05000 + 0x200)
+#define SUN6I_SPI0_RXD  (0x01c05000 + 0x300)
+
+#define SUN6I_CTL_ENABLEBIT(0)
+#define SUN6I_CTL_MASTERBIT(1)
+#define SUN6I_CTL_SRST  BIT(31)
+#define SUN6I_TCR_XCH   BIT(31)
+
+#else
+#define SUN6I_SPI0_CCTL (0x01c68000 + 0x24)
 #define SUN6I_SPI0_GCR  (0x01C68000 + 0x04)

+#define SUN6I_TCR_XCH   BIT(31)
+
+#else
+#define SUN6I_SPI0_CCTL (0x01c68000 + 0x24)
 #define SUN6I_SPI0_GCR  (0x01C68000 + 0x04)
 #define SUN6I_SPI0_TCR  (0x01C68000 + 0x08)
 #define SUN6I_SPI0_FIFO_STA (0x01C68000 + 0x1C)
@@ -68,6 +89,9 @@
 #define SUN6I_CTL_MASTERBIT(1)
 #define SUN6I_CTL_SRST  BIT(31)
 #define SUN6I_TCR_XCH   BIT(31)
+#endif/*r40 */
+
+

 /*/

@@ -94,7 +118,7 @@ static void spi0_pinmux_setup(unsigned int pin_function)
for (pin = SUNXI_GPC(0); pin <= SUNXI_GPC(2); pin++)
sunxi_gpio_set_cfgpin(pin, pin_function);

-   if (IS_ENABLED(CONFIG_MACH_SUN4I) || IS_ENABLED(CONFIG_MACH_SUN7I))
+   if (IS_ENABLED(CONFIG_MACH_SUN4I) || IS_ENABLED(CONFIG_MACH_SUN7I) || 
IS_ENABLED(CONFIG_MACH_SUN8I_R40))
sunxi_gpio_set_cfgpin(SUNXI_GPC(23), pin_function);
else
sunxi_gpio_set_cfgpin(SUNXI_GPC(3), pin_function);
@@ -103,6 +127,8 @@ static void spi0_pinmux_setup(unsigned int pin_function)
 /*
  * Setup 6 MHz from OSC24M (because the BROM is doing the same).
  */
+
+
 static void spi0_enable_clock(void)
 {
/* Deassert SPI0 reset on SUN6I */
diff --git a/configs/Bananapi_M2_Ultra_defconfig 
b/configs/Bananapi_M2_Ultra_defconfig
index c18afc839e..0fa9122dc8 100644
--- a/configs/Bananapi_M2_Ultra_defconfig
+++ b/configs/Bananapi_M2_Ultra_defconfig
@@ -20,3 +20,4 @@ CONFIG_AXP_DLDO4_VOLT=2500
 CONFIG_AXP_ELDO3_VOLT=1200
 CONFIG_SCSI=y
 CONFIG_SYS_USB_EVENT_POLL_VIA_INT_QUEUE=y
+CONFIG_SPL_SPI_SUNXI=y



--
The more you know, the less you do.
-me

diff --git a/arch/arm/mach-sunxi/Kconfig b/arch/arm/mach-sunxi/Kconfig
index 3c54f5106d..69f6748f6b 100644
--- a/arch/arm/mach-sunxi/Kconfig
+++ b/arch/arm/mach-sunxi/Kconfig
@@ -973,7 +973,7 @@ config SPL_STACK_R_ADDR
 
 config SPL_SPI_SUNXI
bool "Support for SPI Flash on Allwinner SoCs in SPL"
-   depends on MACH_SUN4I || MACH_SUN5I || MACH_SUN7I || MACH_SUNXI_H3_H5 
|| MACH_SUN50I
+   depends on MACH_SUN4I || MACH_SUN5I || MACH_SUN7I || MACH_SUNXI_H3_H5 
|| MACH_SUN50I || MACH_SUN8I_R40
help
  Enable support for SPI Flash. This option allows SPL to read from
  sunxi SPI Flash. It uses the same method as the boot ROM, so does
diff --git a/arch/arm/mach-sunxi/spl_spi_sunxi.c 
b/arch/arm/mach-sunxi/spl_spi_sunxi.c
index 043d9f6ead..07e08c184d 100644
--- a/arch/arm/mach-sunxi/spl_spi_sunxi.c
+++ b/arch/arm/mach-sunxi/spl_spi_sunxi.c
@@ -54,7 +54,28 @@
 /* SUN6I variant of the SPI controller 

[U-Boot] [PATCH] imx6: apalis: Make the boot process more generic

2018-12-01 Thread Petr Štetiar
I'm preparing support for Apalis imx6 boards in OpenWrt and I've ended
up with quite huge patchset against upstream U-Boot 2018.03, so I'm
trying to propose more generic way of boot process handling.

In OpenWrt we usually have kernel, dtbs and U-Boot boot script in boot
partition with ext4fs, so for some use cases it would be handy to be
able to replace some of the files

I've added TDX_APALIS_IMX6_BOOT_PART and TDX_APALIS_IMX6_ROOT_PART
config variables so this could be distro specific and overridden.

I've added `set_blkcnt` environment variable which is needed for every
`mmc write` command as we need to always specify size in block count.
This is copy&pasted from official Toradex's flashing scripts, so all the
credits for this work belongs to them.

Currently the rootfs location is passed via mmcblk number and the
problem with this approach is that the mmcblk number for the boot device
changes depending on the kernel version and imx6 SoC type.  In order to
avoid such issues, use the UUID method to specify the rootfs location.

I've added new boot sequence, where we first try to load and run boot
script defined in the new `script` variable, so the boot process could
be more generic and overridden by the distro. When the boot script isn't
loaded, it will use the previous boot sequence so it should be backward
compatible.

For the recovery purposes and better end user experience I've added boot
from SDP as the last boot command if every other boot option fails. I
plan to use SDP as official flashing/recovery procedure in OpenWrt for
Apalis imx6 boards.

I've copy&pasted almost everything from the `f086812a mx6sxsabresd: Use
PARTUUID to specify the rootfs location` commit, so credits for the rest
of this patch belongs to Fabio.

Cc: Stefan Agner 
Cc: Max Krummenacher 
Signed-off-by: Petr Štetiar 
---
 board/toradex/apalis_imx6/Kconfig | 15 +++
 configs/apalis_imx6_defconfig |  2 ++
 include/configs/apalis_imx6.h | 29 -
 3 files changed, 41 insertions(+), 5 deletions(-)

diff --git a/board/toradex/apalis_imx6/Kconfig 
b/board/toradex/apalis_imx6/Kconfig
index 14f8c10..584bc9f 100644
--- a/board/toradex/apalis_imx6/Kconfig
+++ b/board/toradex/apalis_imx6/Kconfig
@@ -50,6 +50,21 @@ config TDX_APALIS_IMX6_V1_0
otherwise the UARTs are configuered in DTE mode.
default n
 
+config TDX_APALIS_IMX6_BOOT_PART
+   int "Partition number to use for boot filesystem"
+   default 1
+   help
+ The partition number to use for boot filesystem this is the
+ partition that typically contains boot.scr, DTBs, uImage etc.
+
+config TDX_APALIS_IMX6_ROOT_PART
+   int "Partition number to use for root filesystem"
+   default 2
+   help
+ The partition number to use for root filesystem this is the
+ partition that is typically specified with root=/dev/sdaX or
+ which gets converted into a root=PARTUUID=some_uuid.
+
 source "board/toradex/common/Kconfig"
 
 endif
diff --git a/configs/apalis_imx6_defconfig b/configs/apalis_imx6_defconfig
index 133fc1a..279d39f 100644
--- a/configs/apalis_imx6_defconfig
+++ b/configs/apalis_imx6_defconfig
@@ -39,6 +39,7 @@ CONFIG_CMD_DFU=y
 CONFIG_CMD_GPIO=y
 CONFIG_CMD_I2C=y
 CONFIG_CMD_MMC=y
+CONFIG_CMD_PART=y
 CONFIG_CMD_USB=y
 CONFIG_CMD_USB_SDP=y
 CONFIG_CMD_USB_MASS_STORAGE=y
@@ -48,6 +49,7 @@ CONFIG_CMD_PING=y
 CONFIG_CMD_BMP=y
 CONFIG_CMD_CACHE=y
 CONFIG_CMD_EXT4=y
+CONFIG_CMD_EXT4_WRITE=y
 CONFIG_CMD_FAT=y
 CONFIG_CMD_FS_GENERIC=y
 CONFIG_ENV_IS_IN_MMC=y
diff --git a/include/configs/apalis_imx6.h b/include/configs/apalis_imx6.h
index 135b3c9..9af5b29 100644
--- a/include/configs/apalis_imx6.h
+++ b/include/configs/apalis_imx6.h
@@ -142,9 +142,9 @@
"imx6q-colibri-cam-eval-v3.dtb fat 0 1"
 
 #define EMMC_BOOTCMD \
-   "emmcargs=ip=off root=/dev/mmcblk0p2 rw,noatime rootfstype=ext3 " \
+   "emmcargs=ip=off root=PARTUUID=${uuid} rw,noatime rootfstype=ext3 " \
"rootwait\0" \
-   "emmcboot=run setup; " \
+   "emmcboot=run setup; run finduuid;" \
"setenv bootargs ${defargs} ${emmcargs} ${setupargs} " \
"${vidargs}; echo Booting from internal eMMC chip...; " \
"run emmcdtbload; load mmc 0:1 ${kernel_addr_r} " \
@@ -201,10 +201,20 @@
 #define FDT_FILE "imx6q-apalis_v1_0-eval.dtb"
 #endif
 #define CONFIG_EXTRA_ENV_SETTINGS \
-   "bootcmd=run emmcboot ; echo ; echo emmcboot failed ; " \
+   "script=boot.scr\0" \
+   "mmcbootdev=" __stringify(CONFIG_SYS_MMC_ENV_DEV) "\0" \
+   "bootpart=" __stringify(CONFIG_TDX_APALIS_IMX6_BOOT_PART) "\0" \
+   "rootpart=" __stringify(CONFIG_TDX_APALIS_IMX6_ROOT_PART) "\0" \
+   "finduuid=part uuid mmc ${mmcbootdev}:${rootpart} uuid\0" \
+   "loadbootscript=" \
+   "load mmc ${mmcbootdev}:${bootpart} ${loadaddr} ${script};\0" \
+   "bootscript=echo Running bootscript from mmc ...; " \
+   "source\0" \

[U-Boot] [PATCH v2] cmd: bmp: manage centered display

2018-12-01 Thread Anatolij Gustschin
From: Patrick Delaunay 

Allow to display BMP at the middle of the screen.

'm' means "middle" as it is done for the splashscreen variable:
splashpos=m,m

Signed-off-by: Patrick Delaunay 
---
Changes in v2:
 - drop BMP_ALIGN_CENTER define since it is already included
   with splash.h

 cmd/bmp.c | 18 +-
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/cmd/bmp.c b/cmd/bmp.c
index 02bdf48b4d..b8af784590 100644
--- a/cmd/bmp.c
+++ b/cmd/bmp.c
@@ -124,8 +124,14 @@ static int do_bmp_display(cmd_tbl_t * cmdtp, int flag, int 
argc, char * const ar
break;
case 4:
addr = simple_strtoul(argv[1], NULL, 16);
-   x = simple_strtoul(argv[2], NULL, 10);
-   y = simple_strtoul(argv[3], NULL, 10);
+   if (!strcmp(argv[2], "m"))
+   x = BMP_ALIGN_CENTER;
+   else
+   x = simple_strtoul(argv[2], NULL, 10);
+   if (!strcmp(argv[3], "m"))
+   y = BMP_ALIGN_CENTER;
+   else
+   y = simple_strtoul(argv[3], NULL, 10);
break;
default:
return CMD_RET_USAGE;
@@ -249,9 +255,11 @@ int bmp_display(ulong addr, int x, int y)
if (!ret) {
bool align = false;
 
-# ifdef CONFIG_SPLASH_SCREEN_ALIGN
-   align = true;
-# endif /* CONFIG_SPLASH_SCREEN_ALIGN */
+   if (CONFIG_IS_ENABLED(SPLASH_SCREEN_ALIGN) ||
+   x == BMP_ALIGN_CENTER ||
+   y == BMP_ALIGN_CENTER)
+   align = true;
+
ret = video_bmp_display(dev, addr, x, y, align);
}
 #elif defined(CONFIG_LCD)
-- 
2.17.1

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH] video: Allow driver to specify the line length

2018-12-01 Thread Anatolij Gustschin
On Thu, 29 Nov 2018 15:08:52 -0700
Simon Glass s...@chromium.org wrote:

> At present line_length is always calculated in video_post_probe(). But
> some hardware may use a different line length, e.g. with a 1366-wide
> display.
> 
> Allow the driver to set this value if needed.
> 
> Signed-off-by: Simon Glass 
> ---
> 
>  drivers/pci/pci_rom.c| 1 +
>  drivers/video/video-uclass.c | 4 +++-
>  include/video.h  | 4 +++-
>  3 files changed, 7 insertions(+), 2 deletions(-)

Applied to u-boot-video/master, thanks!

--
Anatolij
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [RFC PATCH] tools: add a generic config for native tools building

2018-12-01 Thread Tom Rini
On Sat, Dec 01, 2018 at 10:27:49AM +, Peter Robinson wrote:
> On Thu, Nov 29, 2018 at 6:40 PM Tom Rini  wrote:
> >
> > On Tue, Nov 27, 2018 at 06:20:08PM -0200, Otavio Salvador wrote:
> >
> > > The motivation for this is to allow distributions to distribute all
> > > possible tools in a generic way, avoiding the need of specific tools
> > > building for each machine.
> > >
> > > Especially on OpenEmbedded / Yocto Project ecosystem, it is very
> > > common each BSP to end providing their specific tools when they need
> > > to generate images for some SoC (e.g MX23 / MX28 in meta-freescale
> > > case).
> > >
> > > Using this, we can package the tools doing:
> > >
> > > $: make tools-only_defconfig
> > > $: make tools-only
> > >
> > > Signed-off-by: Otavio Salvador 
> > > ---
> > >
> > >  configs/tools-only_defconfig | 3 +++
> > >  tools/Makefile   | 2 +-
> > >  2 files changed, 4 insertions(+), 1 deletion(-)
> > >  create mode 100644 configs/tools-only_defconfig
> > >
> > > diff --git a/configs/tools-only_defconfig b/configs/tools-only_defconfig
> > > new file mode 100644
> > > index 00..be69bdf43a
> > > --- /dev/null
> > > +++ b/configs/tools-only_defconfig
> > > @@ -0,0 +1,3 @@
> > > +CONFIG_SYS_TEXT_BASE=0
> > > +CONFIG_FIT=y
> > > +CONFIG_FIT_SIGNATURE=y
> > > diff --git a/tools/Makefile b/tools/Makefile
> > > index 3c0521f655..e916d0cebb 100644
> > > --- a/tools/Makefile
> > > +++ b/tools/Makefile
> > > @@ -124,7 +124,7 @@ fit_info-objs   := $(dumpimage-mkimage-objs) 
> > > fit_info.o
> > >  fit_check_sign-objs   := $(dumpimage-mkimage-objs) fit_check_sign.o
> > >  file2include-objs := file2include.o
> > >
> > > -ifneq ($(CONFIG_MX23)$(CONFIG_MX28),)
> > > +ifneq ($(CONFIG_MX23)$(CONFIG_MX28)$(CONFIG_FIT_SIGNATURE),)
> > >  # Add CONFIG_MXS into host CFLAGS, so we can check whether or not 
> > > register
> > >  # the mxsimage support within tools/mxsimage.c .
> > >  HOSTCFLAGS_mxsimage.o += -DCONFIG_MXS
> >
> > Adding in Peter since Fedora had this same problem crop up.  Does
> > something like this work for you guys?  Also adding in Vagrant Cascadian
> > since Debian might want to switch to this too.  Thoughts?  Thanks!
> 
> We currently use the tools-all option, details below, to build the
> tools, which broken in 2018.11 on non arm/x86 platforms due to the
> sandbox dep being added in there. I'm happy to adjust as necessary to
> fix that but I'm not sure the difference between tools-all vs the
> above.
> 
> make CROSS_COMPILE="" defconfig V=1 O=builds/
> make CROSS_COMPILE="" tools-all V=1 O=builds/

Well, with the above you would do tools-only_defconfig then tools-all,
and we would make sure to _not_ enable options in tools-only_defconfig
that may not build on some host platforms as it's intended only for
building tools rather than the myriad of things sandbox is used for.

-- 
Tom


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH] ARM: rockchip: Add rv1108-elgin-r1 board support

2018-12-01 Thread Otavio Salvador
Add the initial support for Elgin R1 board, which is based on the
RV1108 SoC and has the following features currently supported in
U-Boot:

- UART
- eMMC
- USB

Signed-off-by: Otavio Salvador 
---

 arch/arm/dts/Makefile   |  1 +
 arch/arm/dts/rv1108-elgin-r1.dts| 48 
 arch/arm/mach-rockchip/rv1108/Kconfig   |  6 ++
 board/elgin/elgin_rv1108/Kconfig| 15 +
 board/elgin/elgin_rv1108/MAINTAINERS|  6 ++
 board/elgin/elgin_rv1108/Makefile   |  7 +++
 board/elgin/elgin_rv1108/elgin_rv1108.c | 74 +
 configs/elgin-rv1108_defconfig  | 58 +++
 include/configs/elgin_rv1108.h  | 13 +
 9 files changed, 228 insertions(+)
 create mode 100644 arch/arm/dts/rv1108-elgin-r1.dts
 create mode 100644 board/elgin/elgin_rv1108/Kconfig
 create mode 100644 board/elgin/elgin_rv1108/MAINTAINERS
 create mode 100644 board/elgin/elgin_rv1108/Makefile
 create mode 100644 board/elgin/elgin_rv1108/elgin_rv1108.c
 create mode 100644 configs/elgin-rv1108_defconfig
 create mode 100644 include/configs/elgin_rv1108.h

diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index d8be3a30dc..748b5c2e3b 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -51,6 +51,7 @@ dtb-$(CONFIG_ARCH_ROCKCHIP) += \
rk3399-puma-ddr1333.dtb \
rk3399-puma-ddr1600.dtb \
rk3399-puma-ddr1866.dtb \
+   rv1108-elgin-r1.dtb \
rv1108-evb.dtb
 dtb-$(CONFIG_ARCH_MESON) += \
meson-gxbb-nanopi-k2.dtb \
diff --git a/arch/arm/dts/rv1108-elgin-r1.dts b/arch/arm/dts/rv1108-elgin-r1.dts
new file mode 100644
index 00..32b95940b0
--- /dev/null
+++ b/arch/arm/dts/rv1108-elgin-r1.dts
@@ -0,0 +1,48 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * (C) Copyright 2016 Rockchip Electronics Co., Ltd
+ */
+
+/dts-v1/;
+
+#include "rv1108.dtsi"
+
+/ {
+   model = "Elgin RV1108 R1 board";
+   compatible = "elgin,rv1108-elgin", "rockchip,rv1108";
+
+   memory@6000 {
+   device_type = "memory";
+   reg = <0x6000 0x0800>;
+   };
+
+   chosen {
+   stdout-path = "serial2:150n8";
+   };
+};
+
+&emmc {
+   pinctrl-names = "default";
+   pinctrl-0 = <&emmc_clk &emmc_cmd &emmc_bus8>;
+   bus-width = <8>;
+   cap-mmc-highspeed;
+   disable-wp;
+   non-removable;
+   status = "okay";
+};
+
+&u2phy {
+   status = "okay";
+
+   u2phy_otg: otg-port {
+   status = "okay";
+   };
+};
+
+&uart2 {
+   status = "okay";
+};
+
+&usb20_otg {
+   status = "okay";
+};
diff --git a/arch/arm/mach-rockchip/rv1108/Kconfig 
b/arch/arm/mach-rockchip/rv1108/Kconfig
index e6cba66578..8883aeae7a 100644
--- a/arch/arm/mach-rockchip/rv1108/Kconfig
+++ b/arch/arm/mach-rockchip/rv1108/Kconfig
@@ -17,6 +17,11 @@ config TARGET_EVB_RV1108
   * 10/100 Mbps Ethernet
   * camera interface compatible with imx323 / ov2710 / ov4689
 
+config TARGET_ELGIN_RV1108
+   bool "ELGIN_RV1108"
+   help
+ RV1108 ELGIN is a board based on the Rockchip RV1108.
+
 config SYS_SOC
default "rockchip"
 
@@ -24,5 +29,6 @@ config SYS_MALLOC_F_LEN
default 0x400
 
 source board/rockchip/evb_rv1108/Kconfig
+source board/elgin/elgin_rv1108/Kconfig
 
 endif
diff --git a/board/elgin/elgin_rv1108/Kconfig b/board/elgin/elgin_rv1108/Kconfig
new file mode 100644
index 00..be9243164a
--- /dev/null
+++ b/board/elgin/elgin_rv1108/Kconfig
@@ -0,0 +1,15 @@
+if TARGET_ELGIN_RV1108
+
+config SYS_BOARD
+   default "elgin_rv1108"
+
+config SYS_VENDOR
+   default "elgin"
+
+config SYS_CONFIG_NAME
+   default "elgin_rv1108"
+
+config BOARD_SPECIFIC_OPTIONS # dummy
+   def_bool y
+
+endif
diff --git a/board/elgin/elgin_rv1108/MAINTAINERS 
b/board/elgin/elgin_rv1108/MAINTAINERS
new file mode 100644
index 00..7747490163
--- /dev/null
+++ b/board/elgin/elgin_rv1108/MAINTAINERS
@@ -0,0 +1,6 @@
+ELGIN-RV1108
+M:  Otavio Salvador 
+S:  Maintained
+F:  board/elgin/elgin_rv1108
+F:  include/configs/elgin_rv1108.h
+F:  configs/elgin-rv1108_defconfig
diff --git a/board/elgin/elgin_rv1108/Makefile 
b/board/elgin/elgin_rv1108/Makefile
new file mode 100644
index 00..382218006a
--- /dev/null
+++ b/board/elgin/elgin_rv1108/Makefile
@@ -0,0 +1,7 @@
+#
+# (C) Copyright 2016 Rockchip Electronics Co., Ltd
+#
+# SPDX-License-Identifier: GPL-2.0+
+#
+
+obj-y  += elgin_rv1108.o
diff --git a/board/elgin/elgin_rv1108/elgin_rv1108.c 
b/board/elgin/elgin_rv1108/elgin_rv1108.c
new file mode 100644
index 00..3abc514412
--- /dev/null
+++ b/board/elgin/elgin_rv1108/elgin_rv1108.c
@@ -0,0 +1,74 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * (C)Copyright 2016 Rockchip Electronics Co., Ltd
+ * Authors: Andy Yan 
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+DECLARE_GLOBAL_DATA_PTR;
+
+int mach_cpu_init(void)
+{
+   int node;
+   str

Re: [U-Boot] [PATCH] cmd: bmp: manage centered display

2018-12-01 Thread Anatolij Gustschin
Hi Patrick,

On Wed, 14 Nov 2018 10:18:22 +0100
Patrick Delaunay patrick.delau...@st.com wrote:
...
> diff --git a/cmd/bmp.c b/cmd/bmp.c
> index 02bdf48..1ace8a8 100644
> --- a/cmd/bmp.c
> +++ b/cmd/bmp.c
> @@ -108,6 +108,7 @@ static int do_bmp_info(cmd_tbl_t * cmdtp, int flag, int 
> argc, char * const argv[
>   return (bmp_info(addr));
>  }
>  
> +#define BMP_ALIGN_CENTER 0x7FFF

this already exists when including splash.h, I dropped it in v2.

--
Anatolij
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [RFC PATCH] tools: add a generic config for native tools building

2018-12-01 Thread Peter Robinson
On Sat, 1 Dec 2018, 13:54 Tom Rini  On Sat, Dec 01, 2018 at 10:27:49AM +, Peter Robinson wrote:
> > On Thu, Nov 29, 2018 at 6:40 PM Tom Rini  wrote:
> > >
> > > On Tue, Nov 27, 2018 at 06:20:08PM -0200, Otavio Salvador wrote:
> > >
> > > > The motivation for this is to allow distributions to distribute all
> > > > possible tools in a generic way, avoiding the need of specific tools
> > > > building for each machine.
> > > >
> > > > Especially on OpenEmbedded / Yocto Project ecosystem, it is very
> > > > common each BSP to end providing their specific tools when they need
> > > > to generate images for some SoC (e.g MX23 / MX28 in meta-freescale
> > > > case).
> > > >
> > > > Using this, we can package the tools doing:
> > > >
> > > > $: make tools-only_defconfig
> > > > $: make tools-only
> > > >
> > > > Signed-off-by: Otavio Salvador 
> > > > ---
> > > >
> > > >  configs/tools-only_defconfig | 3 +++
> > > >  tools/Makefile   | 2 +-
> > > >  2 files changed, 4 insertions(+), 1 deletion(-)
> > > >  create mode 100644 configs/tools-only_defconfig
> > > >
> > > > diff --git a/configs/tools-only_defconfig
> b/configs/tools-only_defconfig
> > > > new file mode 100644
> > > > index 00..be69bdf43a
> > > > --- /dev/null
> > > > +++ b/configs/tools-only_defconfig
> > > > @@ -0,0 +1,3 @@
> > > > +CONFIG_SYS_TEXT_BASE=0
> > > > +CONFIG_FIT=y
> > > > +CONFIG_FIT_SIGNATURE=y
> > > > diff --git a/tools/Makefile b/tools/Makefile
> > > > index 3c0521f655..e916d0cebb 100644
> > > > --- a/tools/Makefile
> > > > +++ b/tools/Makefile
> > > > @@ -124,7 +124,7 @@ fit_info-objs   := $(dumpimage-mkimage-objs)
> fit_info.o
> > > >  fit_check_sign-objs   := $(dumpimage-mkimage-objs) fit_check_sign.o
> > > >  file2include-objs := file2include.o
> > > >
> > > > -ifneq ($(CONFIG_MX23)$(CONFIG_MX28),)
> > > > +ifneq ($(CONFIG_MX23)$(CONFIG_MX28)$(CONFIG_FIT_SIGNATURE),)
> > > >  # Add CONFIG_MXS into host CFLAGS, so we can check whether or not
> register
> > > >  # the mxsimage support within tools/mxsimage.c .
> > > >  HOSTCFLAGS_mxsimage.o += -DCONFIG_MXS
> > >
> > > Adding in Peter since Fedora had this same problem crop up.  Does
> > > something like this work for you guys?  Also adding in Vagrant
> Cascadian
> > > since Debian might want to switch to this too.  Thoughts?  Thanks!
> >
> > We currently use the tools-all option, details below, to build the
> > tools, which broken in 2018.11 on non arm/x86 platforms due to the
> > sandbox dep being added in there. I'm happy to adjust as necessary to
> > fix that but I'm not sure the difference between tools-all vs the
> > above.
> >
> > make CROSS_COMPILE="" defconfig V=1 O=builds/
> > make CROSS_COMPILE="" tools-all V=1 O=builds/
>
> Well, with the above you would do tools-only_defconfig then tools-all,
> and we would make sure to _not_ enable options in tools-only_defconfig
> that may not build on some host platforms as it's intended only for
> building tools rather than the myriad of things sandbox is used for.
>

That would be fine as far as I'm concerned.

Thanks
Peter

>
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH] video: use BMP_ALIGN_CENTER define from splash.h

2018-12-01 Thread Anatolij Gustschin
Drop BMP_ALIGN_CENTER define in lcd.c and video_bmp.c as it is
already defined by splash.h. Include splash.h in bmp code.

Signed-off-by: Anatolij Gustschin 
---
 common/lcd.c  | 1 -
 drivers/video/video_bmp.c | 3 +--
 2 files changed, 1 insertion(+), 3 deletions(-)

diff --git a/common/lcd.c b/common/lcd.c
index 2e2bef3848..bd3e1c2846 100644
--- a/common/lcd.c
+++ b/common/lcd.c
@@ -389,7 +389,6 @@ static inline void lcd_logo_plot(int x, int y) {}
 
 #if defined(CONFIG_CMD_BMP) || defined(CONFIG_SPLASH_SCREEN)
 #ifdef CONFIG_SPLASH_SCREEN_ALIGN
-#define BMP_ALIGN_CENTER   0x7FFF
 
 static void splash_align_axis(int *axis, unsigned long panel_size,
unsigned long picture_size)
diff --git a/drivers/video/video_bmp.c b/drivers/video/video_bmp.c
index 1377e19081..2898b0b55d 100644
--- a/drivers/video/video_bmp.c
+++ b/drivers/video/video_bmp.c
@@ -7,6 +7,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -140,8 +141,6 @@ __weak void fb_put_word(uchar **fb, uchar **from)
 }
 #endif /* CONFIG_BMP_16BPP */
 
-#define BMP_ALIGN_CENTER   0x7fff
-
 /**
  * video_splash_align_axis() - Align a single coordinate
  *
-- 
2.17.1

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [RFC PATCH] tools: add a generic config for native tools building

2018-12-01 Thread Otavio Salvador
On Sat, Dec 1, 2018 at 12:18 PM Peter Robinson  wrote:
> On Sat, 1 Dec 2018, 13:54 Tom Rini  > On Sat, Dec 01, 2018 at 10:27:49AM +, Peter Robinson wrote:
> > > On Thu, Nov 29, 2018 at 6:40 PM Tom Rini  wrote:
> > > >
> > > > On Tue, Nov 27, 2018 at 06:20:08PM -0200, Otavio Salvador wrote:
> > > >
> > > > > The motivation for this is to allow distributions to distribute all
> > > > > possible tools in a generic way, avoiding the need of specific tools
> > > > > building for each machine.
> > > > >
> > > > > Especially on OpenEmbedded / Yocto Project ecosystem, it is very
> > > > > common each BSP to end providing their specific tools when they need
> > > > > to generate images for some SoC (e.g MX23 / MX28 in meta-freescale
> > > > > case).
> > > > >
> > > > > Using this, we can package the tools doing:
> > > > >
> > > > > $: make tools-only_defconfig
> > > > > $: make tools-only
> > > > >
> > > > > Signed-off-by: Otavio Salvador 
> > > > > ---
> > > > >
> > > > >  configs/tools-only_defconfig | 3 +++
> > > > >  tools/Makefile   | 2 +-
> > > > >  2 files changed, 4 insertions(+), 1 deletion(-)
> > > > >  create mode 100644 configs/tools-only_defconfig
> > > > >
> > > > > diff --git a/configs/tools-only_defconfig
> > b/configs/tools-only_defconfig
> > > > > new file mode 100644
> > > > > index 00..be69bdf43a
> > > > > --- /dev/null
> > > > > +++ b/configs/tools-only_defconfig
> > > > > @@ -0,0 +1,3 @@
> > > > > +CONFIG_SYS_TEXT_BASE=0
> > > > > +CONFIG_FIT=y
> > > > > +CONFIG_FIT_SIGNATURE=y
> > > > > diff --git a/tools/Makefile b/tools/Makefile
> > > > > index 3c0521f655..e916d0cebb 100644
> > > > > --- a/tools/Makefile
> > > > > +++ b/tools/Makefile
> > > > > @@ -124,7 +124,7 @@ fit_info-objs   := $(dumpimage-mkimage-objs)
> > fit_info.o
> > > > >  fit_check_sign-objs   := $(dumpimage-mkimage-objs) fit_check_sign.o
> > > > >  file2include-objs := file2include.o
> > > > >
> > > > > -ifneq ($(CONFIG_MX23)$(CONFIG_MX28),)
> > > > > +ifneq ($(CONFIG_MX23)$(CONFIG_MX28)$(CONFIG_FIT_SIGNATURE),)
> > > > >  # Add CONFIG_MXS into host CFLAGS, so we can check whether or not
> > register
> > > > >  # the mxsimage support within tools/mxsimage.c .
> > > > >  HOSTCFLAGS_mxsimage.o += -DCONFIG_MXS
> > > >
> > > > Adding in Peter since Fedora had this same problem crop up.  Does
> > > > something like this work for you guys?  Also adding in Vagrant
> > Cascadian
> > > > since Debian might want to switch to this too.  Thoughts?  Thanks!
> > >
> > > We currently use the tools-all option, details below, to build the
> > > tools, which broken in 2018.11 on non arm/x86 platforms due to the
> > > sandbox dep being added in there. I'm happy to adjust as necessary to
> > > fix that but I'm not sure the difference between tools-all vs the
> > > above.
> > >
> > > make CROSS_COMPILE="" defconfig V=1 O=builds/
> > > make CROSS_COMPILE="" tools-all V=1 O=builds/
> >
> > Well, with the above you would do tools-only_defconfig then tools-all,
> > and we would make sure to _not_ enable options in tools-only_defconfig
> > that may not build on some host platforms as it's intended only for
> > building tools rather than the myriad of things sandbox is used for.
> >
>
> That would be fine as far as I'm concerned.

If people are likely to use tools-all, we may use tools-all_defconfig
so we connect both. What do you think guys?

-- 
Otavio Salvador O.S. Systems
http://www.ossystems.com.brhttp://code.ossystems.com.br
Mobile: +55 (53) 9 9981-7854  Mobile: +1 (347) 903-9750
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v2 0/3] serial: bcm6345: switch to raw I/O functions

2018-12-01 Thread Álvaro Fernández Rojas
These patches allow to use bcm6345 uart driver for both BE and LE,
making bcm6858 serial driver unneeded.

Álvaro Fernández Rojas (3):
  serial: bcm6345: switch to raw I/O functions
  arm: implement {in, out}_{16, 32} and {clr, set, clrset}bits_{16, 32}
  serial: bcm6858: remove driver and switch to bcm6345

 arch/arm/dts/bcm6858.dtsi   |   2 +-
 arch/arm/include/asm/io.h   |  13 ++
 configs/bcm968580_ram_defconfig |   2 +-
 drivers/serial/Kconfig  |   8 +-
 drivers/serial/Makefile |   1 -
 drivers/serial/serial_bcm6345.c |  99 +++--
 drivers/serial/serial_bcm6858.c | 300 
 7 files changed, 65 insertions(+), 360 deletions(-)
 delete mode 100644 drivers/serial/serial_bcm6858.c

-- 
2.11.0

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v2 1/3] serial: bcm6345: switch to raw I/O functions

2018-12-01 Thread Álvaro Fernández Rojas
Signed-off-by: Álvaro Fernández Rojas 
---
 v2: introduce changes suggested by Daniel Schwierzeck:
  - Use readl/writel instead of __raw_readl/__raw_writel.
  - Remove DM_FLAG_PRE_RELOC.

 drivers/serial/serial_bcm6345.c | 99 -
 1 file changed, 49 insertions(+), 50 deletions(-)

diff --git a/drivers/serial/serial_bcm6345.c b/drivers/serial/serial_bcm6345.c
index a0e709a11e..9ad8c770d5 100644
--- a/drivers/serial/serial_bcm6345.c
+++ b/drivers/serial/serial_bcm6345.c
@@ -89,26 +89,26 @@ struct bcm6345_serial_priv {
 /* enable rx & tx operation on uart */
 static void bcm6345_serial_enable(void __iomem *base)
 {
-   setbits_be32(base + UART_CTL_REG, UART_CTL_BRGEN_MASK |
-UART_CTL_TXEN_MASK | UART_CTL_RXEN_MASK);
+   setbits_32(base + UART_CTL_REG, UART_CTL_BRGEN_MASK |
+  UART_CTL_TXEN_MASK | UART_CTL_RXEN_MASK);
 }
 
 /* disable rx & tx operation on uart */
 static void bcm6345_serial_disable(void __iomem *base)
 {
-   clrbits_be32(base + UART_CTL_REG, UART_CTL_BRGEN_MASK |
-UART_CTL_TXEN_MASK | UART_CTL_RXEN_MASK);
+   clrbits_32(base + UART_CTL_REG, UART_CTL_BRGEN_MASK |
+  UART_CTL_TXEN_MASK | UART_CTL_RXEN_MASK);
 }
 
 /* clear all unread data in rx fifo and unsent data in tx fifo */
 static void bcm6345_serial_flush(void __iomem *base)
 {
/* empty rx and tx fifo */
-   setbits_be32(base + UART_CTL_REG, UART_CTL_RSTRXFIFO_MASK |
-UART_CTL_RSTTXFIFO_MASK);
+   setbits_32(base + UART_CTL_REG, UART_CTL_RSTRXFIFO_MASK |
+  UART_CTL_RSTTXFIFO_MASK);
 
/* read any pending char to make sure all irq status are cleared */
-   readl_be(base + UART_FIFO_REG);
+   readl(base + UART_FIFO_REG);
 }
 
 static int bcm6345_serial_init(void __iomem *base, ulong clk, u32 baudrate)
@@ -120,40 +120,40 @@ static int bcm6345_serial_init(void __iomem *base, ulong 
clk, u32 baudrate)
bcm6345_serial_flush(base);
 
/* set uart control config */
-   clrsetbits_be32(base + UART_CTL_REG,
-   /* clear rx timeout */
-   UART_CTL_RXTIMEOUT_MASK |
-   /* clear stop bits */
-   UART_CTL_STOPBITS_MASK |
-   /* clear bits per symbol */
-   UART_CTL_BITSPERSYM_MASK |
-   /* clear xmit break */
-   UART_CTL_XMITBRK_MASK |
-   /* clear reserved bit */
-   UART_CTL_RSVD_MASK |
-   /* disable parity */
-   UART_CTL_RXPAREN_MASK |
-   UART_CTL_TXPAREN_MASK |
-   /* disable loopback */
-   UART_CTL_LOOPBACK_MASK,
-   /* set timeout to 5 */
-   UART_CTL_RXTIMEOUT_5 |
-   /* set 8 bits/symbol */
-   UART_CTL_BITSPERSYM_8 |
-   /* set 1 stop bit */
-   UART_CTL_STOPBITS_1 |
-   /* set parity to even */
-   UART_CTL_RXPAREVEN_MASK |
-   UART_CTL_TXPAREVEN_MASK);
+   clrsetbits_32(base + UART_CTL_REG,
+ /* clear rx timeout */
+ UART_CTL_RXTIMEOUT_MASK |
+ /* clear stop bits */
+ UART_CTL_STOPBITS_MASK |
+ /* clear bits per symbol */
+ UART_CTL_BITSPERSYM_MASK |
+ /* clear xmit break */
+ UART_CTL_XMITBRK_MASK |
+ /* clear reserved bit */
+ UART_CTL_RSVD_MASK |
+ /* disable parity */
+ UART_CTL_RXPAREN_MASK |
+ UART_CTL_TXPAREN_MASK |
+ /* disable loopback */
+ UART_CTL_LOOPBACK_MASK,
+ /* set timeout to 5 */
+ UART_CTL_RXTIMEOUT_5 |
+ /* set 8 bits/symbol */
+ UART_CTL_BITSPERSYM_8 |
+ /* set 1 stop bit */
+ UART_CTL_STOPBITS_1 |
+ /* set parity to even */
+ UART_CTL_RXPAREVEN_MASK |
+ UART_CTL_TXPAREVEN_MASK);
 
/* set uart fifo config */
-   clrsetbits_be32(base + UART_FIFO_CFG_REG,
-   /* clear fifo config */
-   UART_FIFO_CFG_RX_MASK |
-   UART_FIFO_CFG_TX_MASK,
-   /* set fifo config to 4 */
-   UART_FIFO_CFG_RX_4 |
-   UART_FIFO_CFG_TX_4);
+   clrsetbits_32(base + UART_FIFO_CFG_REG,
+ /* clear fifo config */
+ UART_FIFO_CFG_RX_MASK |
+ UART_FIFO_CFG_TX_MASK,
+ /* set fifo conf

[U-Boot] [PATCH v2 2/3] arm: implement {in, out}_{16, 32} and {clr, set, clrset}bits_{16, 32}

2018-12-01 Thread Álvaro Fernández Rojas
Signed-off-by: Álvaro Fernández Rojas 
---
 v2: no changes

 arch/arm/include/asm/io.h | 13 +
 1 file changed, 13 insertions(+)

diff --git a/arch/arm/include/asm/io.h b/arch/arm/include/asm/io.h
index 5df74728de..12bc7fbe06 100644
--- a/arch/arm/include/asm/io.h
+++ b/arch/arm/include/asm/io.h
@@ -160,7 +160,12 @@ static inline void __raw_readsl(unsigned long addr, void 
*data, int longlen)
 #define in_be32(a) in_arch(l,be32,a)
 #define in_be16(a) in_arch(w,be16,a)
 
+#define out_32(a,v)__raw_writel(v,a)
+#define out_16(a,v)__raw_writew(v,a)
 #define out_8(a,v) __raw_writeb(v,a)
+
+#define in_32(a)   __raw_readl(a)
+#define in_16(a)   __raw_readw(a)
 #define in_8(a)__raw_readb(a)
 
 #define clrbits(type, addr, clear) \
@@ -180,6 +185,10 @@ static inline void __raw_readsl(unsigned long addr, void 
*data, int longlen)
 #define setbits_le32(addr, set) setbits(le32, addr, set)
 #define clrsetbits_le32(addr, clear, set) clrsetbits(le32, addr, clear, set)
 
+#define clrbits_32(addr, clear) clrbits(32, addr, clear)
+#define setbits_32(addr, set) setbits(32, addr, set)
+#define clrsetbits_32(addr, clear, set) clrsetbits(32, addr, clear, set)
+
 #define clrbits_be16(addr, clear) clrbits(be16, addr, clear)
 #define setbits_be16(addr, set) setbits(be16, addr, set)
 #define clrsetbits_be16(addr, clear, set) clrsetbits(be16, addr, clear, set)
@@ -188,6 +197,10 @@ static inline void __raw_readsl(unsigned long addr, void 
*data, int longlen)
 #define setbits_le16(addr, set) setbits(le16, addr, set)
 #define clrsetbits_le16(addr, clear, set) clrsetbits(le16, addr, clear, set)
 
+#define clrbits_16(addr, clear) clrbits(16, addr, clear)
+#define setbits_16(addr, set) setbits(16, addr, set)
+#define clrsetbits_16(addr, clear, set) clrsetbits(16, addr, clear, set)
+
 #define clrbits_8(addr, clear) clrbits(8, addr, clear)
 #define setbits_8(addr, set) setbits(8, addr, set)
 #define clrsetbits_8(addr, clear, set) clrsetbits(8, addr, clear, set)
-- 
2.11.0

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v2 3/3] serial: bcm6858: remove driver and switch to bcm6345

2018-12-01 Thread Álvaro Fernández Rojas
Signed-off-by: Álvaro Fernández Rojas 
---
 v2: no changes

 arch/arm/dts/bcm6858.dtsi   |   2 +-
 configs/bcm968580_ram_defconfig |   2 +-
 drivers/serial/Kconfig  |   8 +-
 drivers/serial/Makefile |   1 -
 drivers/serial/serial_bcm6858.c | 300 
 5 files changed, 3 insertions(+), 310 deletions(-)
 delete mode 100644 drivers/serial/serial_bcm6858.c

diff --git a/arch/arm/dts/bcm6858.dtsi b/arch/arm/dts/bcm6858.dtsi
index 9869d729d3..d78d34d213 100644
--- a/arch/arm/dts/bcm6858.dtsi
+++ b/arch/arm/dts/bcm6858.dtsi
@@ -75,7 +75,7 @@
u-boot,dm-pre-reloc;
 
uart0: serial@ff800640 {
-   compatible = "brcm,bcm6858-uart";
+   compatible = "brcm,bcm6345-uart";
reg = <0x0 0xff800640 0x0 0x18>;
clocks = <&periph_osc>;
 
diff --git a/configs/bcm968580_ram_defconfig b/configs/bcm968580_ram_defconfig
index abe90ee75f..4e10175a50 100644
--- a/configs/bcm968580_ram_defconfig
+++ b/configs/bcm968580_ram_defconfig
@@ -30,7 +30,7 @@ CONFIG_SPECIFY_CONSOLE_INDEX=y
 CONFIG_CONS_INDEX=0
 CONFIG_DM_SERIAL=y
 CONFIG_SERIAL_SEARCH_ALL=y
-CONFIG_BCM6858_SERIAL=y
+CONFIG_BCM6345_SERIAL=y
 CONFIG_SYSRESET=y
 CONFIG_REGEX=y
 # CONFIG_GENERATE_SMBIOS_TABLE is not set
diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig
index 3bcc61e731..6252dd8c4b 100644
--- a/drivers/serial/Kconfig
+++ b/drivers/serial/Kconfig
@@ -506,16 +506,10 @@ config BCM283X_PL011_SERIAL
 
 config BCM6345_SERIAL
bool "Support for BCM6345 UART"
-   depends on DM_SERIAL && ARCH_BMIPS
+   depends on DM_SERIAL
help
  Select this to enable UART on BCM6345 SoCs.
 
-config BCM6858_SERIAL
-   bool "Support for BCM6858 UART"
-   depends on DM_SERIAL && ARCH_BCM6858
-   help
- Select this to enable UART on BCM6358 SoCs.
-
 config FSL_LINFLEXUART
bool "Freescale Linflex UART support"
depends on DM_SERIAL
diff --git a/drivers/serial/Makefile b/drivers/serial/Makefile
index b6377b1076..2f8d065a4c 100644
--- a/drivers/serial/Makefile
+++ b/drivers/serial/Makefile
@@ -35,7 +35,6 @@ obj-$(CONFIG_AR933X_UART) += serial_ar933x.o
 obj-$(CONFIG_ARM_DCC) += arm_dcc.o
 obj-$(CONFIG_ATMEL_USART) += atmel_usart.o
 obj-$(CONFIG_BCM6345_SERIAL) += serial_bcm6345.o
-obj-$(CONFIG_BCM6858_SERIAL) += serial_bcm6858.o
 obj-$(CONFIG_EFI_APP) += serial_efi.o
 obj-$(CONFIG_LPC32XX_HSUART) += lpc32xx_hsuart.o
 obj-$(CONFIG_MCFUART) += mcfuart.o
diff --git a/drivers/serial/serial_bcm6858.c b/drivers/serial/serial_bcm6858.c
deleted file mode 100644
index 8aa37055f0..00
--- a/drivers/serial/serial_bcm6858.c
+++ /dev/null
@@ -1,300 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * Copyright (C) 2018 Philippe Reynes 
- *
- * Derived from linux/drivers/tty/serial/bcm63xx_uart.c:
- * Copyright (C) 2008 Maxime Bizon 
- * Derived from linux/drivers/tty/serial/serial_bcm6345.c
- * Copyright (C) 2017 Álvaro Fernández Rojas 
- */
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-/* UART Control register */
-#define UART_CTL_REG   0x0
-#define UART_CTL_RXTIMEOUT_MASK0x1f
-#define UART_CTL_RXTIMEOUT_5   0x5
-#define UART_CTL_RSTRXFIFO_SHIFT   6
-#define UART_CTL_RSTRXFIFO_MASK(1 << UART_CTL_RSTRXFIFO_SHIFT)
-#define UART_CTL_RSTTXFIFO_SHIFT   7
-#define UART_CTL_RSTTXFIFO_MASK(1 << UART_CTL_RSTTXFIFO_SHIFT)
-#define UART_CTL_STOPBITS_SHIFT8
-#define UART_CTL_STOPBITS_MASK (0xf << UART_CTL_STOPBITS_SHIFT)
-#define UART_CTL_STOPBITS_1(0x7 << UART_CTL_STOPBITS_SHIFT)
-#define UART_CTL_BITSPERSYM_SHIFT  12
-#define UART_CTL_BITSPERSYM_MASK   (0x3 << UART_CTL_BITSPERSYM_SHIFT)
-#define UART_CTL_BITSPERSYM_8  (0x3 << UART_CTL_BITSPERSYM_SHIFT)
-#define UART_CTL_XMITBRK_SHIFT 14
-#define UART_CTL_XMITBRK_MASK  (1 << UART_CTL_XMITBRK_SHIFT)
-#define UART_CTL_RSVD_SHIFT15
-#define UART_CTL_RSVD_MASK (1 << UART_CTL_RSVD_SHIFT)
-#define UART_CTL_RXPAREVEN_SHIFT   16
-#define UART_CTL_RXPAREVEN_MASK(1 << UART_CTL_RXPAREVEN_SHIFT)
-#define UART_CTL_RXPAREN_SHIFT 17
-#define UART_CTL_RXPAREN_MASK  (1 << UART_CTL_RXPAREN_SHIFT)
-#define UART_CTL_TXPAREVEN_SHIFT   18
-#define UART_CTL_TXPAREVEN_MASK(1 << UART_CTL_TXPAREVEN_SHIFT)
-#define UART_CTL_TXPAREN_SHIFT 19
-#define UART_CTL_TXPAREN_MASK  (1 << UART_CTL_TXPAREN_SHIFT)
-#define UART_CTL_LOOPBACK_SHIFT20
-#define UART_CTL_LOOPBACK_MASK (1 << UART_CTL_LOOPBACK_SHIFT)
-#define UART_CTL_RXEN_SHIFT21
-#define UART_CTL_RXEN_MASK (1 << UART_CTL_RXEN_SHIFT)
-#define UART_CTL_TXEN_SHIFT22
-#define UART_CTL_TXEN_MASK (1 << UART_CTL_TXEN_SHIFT)
-#define UART_CTL_BRGEN_

[U-Boot] [PATCH v11 00/28] bmips: add iudma/enet support

2018-12-01 Thread Álvaro Fernández Rojas
In order to add bcm6348-enet support, dma-uclass must be extended to support
dma channels and reworked to operate like the other dm uclass (clk, reset...).

v11: Introduce change suggested by Daniel Schwierzeck:
 - Avoid trimming ethernet FCS from DMA driver.
v10: Introduce changes suggested by Daniel Schwierzeck:
 - Fix license identifiers.
 bcm6348-iudma:
  - Move DMAD_ST defines out of dma desc struct definition.
  - Remove unneded aigned attribute from dma desc struct definition.
  - Fill dma ring from consumer driver instead of allocating a new buffer.
  - Correctly check clock/reset errors while probing.
  - Switch to live DM live tree.
 bcm6348-enet:
  - Remove packet queue.
  - Move dma_prepare_rcv_buf to free_pkt.
  - Switch to live DM live tree.
 bcm6368-enet:
  - Remove packet queue.
  - Move dma_prepare_rcv_buf to free_pkt.
  - Pad packets smaller than ETH_ZLEN.
  - Switch to live DM live tree.
v9: Separate generic dma channels support from bmips enet support
 bcm6348-iudma:
  - bcm6348_iudma_chan_stop: switch to mdelay when resetting channel.
  - bcm6348_iudma_receive: track dirty dma descriptors and no longer trigger
   dma rx channel.
  - bcm6348_iudma_send: reorder to properly flush cache and set dma descriptor
   config.
  - bcm6348_iudma_prepare_rcv_buf: implemented to clear dirty dma descriptors.
 bcm6348-enet:
  - bcm6348_eth_recv: clear dirty dma descriptors only when packets are copied
   from rx dma.
  - bcm6348_eth_send: remove dma rx channel reset when sending packet.
 bcm6368-enet:
  - introduce rx packets caching functionality from bcm6348-eth to fix flow
   control issues.
  - code style fixes.
v8: Introduce bcm6368-enet driver support.
v5: Fix issues reported by Grygorii Strashko and other fixes:
 - Remove unused bcm6348-iudma defines.
 - Increment bcm6348-iudma rx descriptors.
 - Fix bcm6348-iudma flow control issues.
 - bcm6348-iudma error checking now depends on hw.
 - Remove unneeded bcm6348-iudma interrupts.
 - Receive as much packets as possible from bcm6348-eth and cache them in
 net_rx_packets. This is needed in order to fix flow control issues.
v4: Fix issues reported by Grygorii Strashko and other fixes:
 - Remove usage of net_rx_packets as buffer from bcm6348-iudma.
 - Allocate dynamic rx buffer on bcm6348-iudma.
 - Copy received dma buffer to net_rx_packets in order to avoid possible
 dma overwrites.
 - Check dma errors and discard invalid packets.
 - Reset dma rx channel when sending a new packet to prevent flow control
 issues.
 - Fix packet casting on bcm6348_eth_recv/send.
v3: Switch to live tree API.
v2: Fix bcm6348-iudma rx burst config.

Álvaro Fernández Rojas (28):
  dma: add bcm6348-iudma support
  bmips: bcm6338: add bcm6348-iudma support
  bmips: bcm6348: add bcm6348-iudma support
  bmips: bcm6358: add bcm6348-iudma support
  bmips: bcm6368: add bcm6348-iudma support
  bmips: bcm6328: add bcm6348-iudma support
  bmips: bcm6362: add bcm6348-iudma support
  bmips: bcm63268: add bcm6348-iudma support
  bmips: bcm6318: add bcm6348-iudma support
  net: add support for bcm6348-enet
  bmips: bcm6338: add support for bcm6348-enet
  bmips: enable f@st1704 enet support
  bmips: bcm6348: add support for bcm6348-enet
  bmips: enable ct-5361 enet support
  bmips: bcm6358: add support for bcm6348-enet
  bmips: enable hg556a enet support
  bmips: enable nb4-ser enet support
  net: add support for bcm6368-enet
  bmips: bcm6368: add support for bcm6368-enet
  bmips: enable wap-5813n enet support
  bmips: bcm6328: add support for bcm6368-enet
  bmips: enable ar-5387un enet support
  bmips: bcm6362: add support for bcm6368-enet
  bmips: enable dgnd3700v2 enet support
  bmips: bcm63268: add support for bcm6368-enet
  bmips: enable vr-3032u enet support
  bmips: bcm6318: add support for bcm6368-enet
  bmips: enable ar-5315u enet support

 arch/mips/dts/brcm,bcm6318.dtsi   |  38 ++
 arch/mips/dts/brcm,bcm63268.dtsi  |  38 ++
 arch/mips/dts/brcm,bcm6328.dtsi   |  30 ++
 arch/mips/dts/brcm,bcm6338.dtsi   |  29 ++
 arch/mips/dts/brcm,bcm6348.dtsi   |  42 ++
 arch/mips/dts/brcm,bcm6358.dtsi   |  46 +++
 arch/mips/dts/brcm,bcm6362.dtsi   |  32 ++
 arch/mips/dts/brcm,bcm6368.dtsi   |  32 ++
 arch/mips/dts/comtrend,ar-5315u.dts   |  32 ++
 arch/mips/dts/comtrend,ar-5387un.dts  |  32 ++
 arch/mips/dts/comtrend,ct-5361.dts|  12 +
 arch/mips/dts/comtrend,vr-3032u.dts   |  32 ++
 arch/mips/dts/comtrend,wap-5813n.dts  |  14 +
 arch/mips/dts/huawei,hg556a.dts   |  12 +
 arch/mips/dts/netgear,dgnd3700v2.dts  |  14 +
 arch/mips/dts/sagem,f...@st1704.dts  |  12 +
 arch/mips/dts/sfr,nb4-ser.dts |  24 ++
 configs/comtrend_ar5315u_ram_defconfig|   7 +-
 configs/comtrend_ar5387un_ram_defconfig   |   7 +-
 configs/comtrend_ct5361_ram_defconfig |   8 +-
 configs/comtrend_vr3032u_ram_defconfig|   7 +-
 configs/comtrend_wap5813n_ram_defconfig   |   8 +-
 configs/huawei_h

[U-Boot] [PATCH v11 01/28] dma: add bcm6348-iudma support

2018-12-01 Thread Álvaro Fernández Rojas
BCM6348 IUDMA controller is present on multiple BMIPS (BCM63xx) SoCs.

Signed-off-by: Álvaro Fernández Rojas 
Reviewed-by: Daniel Schwierzeck 
---
 v11: Introduce change suggested by Daniel Schwierzeck:
  - Avoid trimming ethernet FCS from DMA driver.
 v10: Introduce changes suggested by Daniel Schwierzeck:
  - Fix license identifiers.
  - Move DMAD_ST defines out of dma desc struct definition.
  - Remove unneded aigned attribute from dma desc struct definition.
  - Fill dma ring from consumer driver instead of allocating a new buffer.
  - Correctly check clock/reset errors while probing.
  - Switch to live DM live tree.
 v9: introduce dma_prepare_rcv_buf dma op:
  - bcm6348_iudma_chan_stop: switch to mdelay when resetting channel.
  - bcm6348_iudma_receive: track dirty dma descriptors and no longer trigger
   dma rx channel.
  - bcm6348_iudma_send: reorder to properly flush cache and set dma descriptor
   config.
  - bcm6348_iudma_prepare_rcv_buf: implemented to clear dirty dma descriptors.
 v8: Introduce changes from Grygorii Strashko
 v5: Several fixes and improvements:
  - Remove unused defines.
  - Increment rx descriptors.
  - Fix flow control issues.
  - Error checking now depends on hw.
  - Remove unneeded interrupts.
 v4: Fix issues reported by Grygorii Strashko and other fixes:
  - Remove usage of net_rx_packets as buffer.
  - Allocate dynamic rx buffer.
  - Check dma errors and discard invalid packets.
 v3: no changes
 v2: Fix dma rx burst config and select DMA_CHANNELS.

 drivers/dma/Kconfig |   9 +
 drivers/dma/Makefile|   1 +
 drivers/dma/bcm6348-iudma.c | 642 
 3 files changed, 652 insertions(+)
 create mode 100644 drivers/dma/bcm6348-iudma.c

diff --git a/drivers/dma/Kconfig b/drivers/dma/Kconfig
index 8a4162eccd..1820676d7a 100644
--- a/drivers/dma/Kconfig
+++ b/drivers/dma/Kconfig
@@ -26,6 +26,15 @@ config SANDBOX_DMA
  Enable support for a test DMA uclass implementation. It stimulates
  DMA transfer by simple copying data between channels.
 
+config BCM6348_IUDMA
+   bool "BCM6348 IUDMA driver"
+   depends on ARCH_BMIPS
+   select DMA_CHANNELS
+   help
+ Enable the BCM6348 IUDMA driver.
+ This driver support data transfer from devices to
+ memory and from memory to devices.
+
 config TI_EDMA3
bool "TI EDMA3 driver"
help
diff --git a/drivers/dma/Makefile b/drivers/dma/Makefile
index aff31f986a..b5f9147e0a 100644
--- a/drivers/dma/Makefile
+++ b/drivers/dma/Makefile
@@ -7,6 +7,7 @@ obj-$(CONFIG_DMA) += dma-uclass.o
 
 obj-$(CONFIG_FSLDMAFEC) += MCD_tasksInit.o MCD_dmaApi.o MCD_tasks.o
 obj-$(CONFIG_APBH_DMA) += apbh_dma.o
+obj-$(CONFIG_BCM6348_IUDMA) += bcm6348-iudma.o
 obj-$(CONFIG_FSL_DMA) += fsl_dma.o
 obj-$(CONFIG_SANDBOX_DMA) += sandbox-dma-test.o
 obj-$(CONFIG_TI_KSNAV) += keystone_nav.o keystone_nav_cfg.o
diff --git a/drivers/dma/bcm6348-iudma.c b/drivers/dma/bcm6348-iudma.c
new file mode 100644
index 00..1d3c192cfe
--- /dev/null
+++ b/drivers/dma/bcm6348-iudma.c
@@ -0,0 +1,642 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2018 Álvaro Fernández Rojas 
+ *
+ * Derived from linux/drivers/dma/bcm63xx-iudma.c:
+ * Copyright (C) 2015 Simon Arlott 
+ *
+ * Derived from linux/drivers/net/ethernet/broadcom/bcm63xx_enet.c:
+ * Copyright (C) 2008 Maxime Bizon 
+ *
+ * Derived from 
bcm963xx_4.12L.06B_consumer/shared/opensource/include/bcm963xx/63268_map_part.h:
+ * Copyright (C) 2000-2010 Broadcom Corporation
+ *
+ * Derived from 
bcm963xx_4.12L.06B_consumer/bcmdrivers/opensource/net/enet/impl4/bcmenet.c:
+ * Copyright (C) 2010 Broadcom Corporation
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define DMA_RX_DESC6
+#define DMA_TX_DESC1
+
+/* DMA Channels */
+#define DMA_CHAN_FLOWC(x)  ((x) >> 1)
+#define DMA_CHAN_MAX   16
+#define DMA_CHAN_SIZE  0x10
+#define DMA_CHAN_TOUT  500
+
+/* DMA Global Configuration register */
+#define DMA_CFG_REG0x00
+#define  DMA_CFG_ENABLE_SHIFT  0
+#define  DMA_CFG_ENABLE_MASK   (1 << DMA_CFG_ENABLE_SHIFT)
+#define  DMA_CFG_FLOWC_ENABLE(x)   BIT(DMA_CHAN_FLOWC(x) + 1)
+#define  DMA_CFG_NCHANS_SHIFT  24
+#define  DMA_CFG_NCHANS_MASK   (0xf << DMA_CFG_NCHANS_SHIFT)
+
+/* DMA Global Flow Control registers */
+#define DMA_FLOWC_THR_LO_REG(x)(0x04 + DMA_CHAN_FLOWC(x) * 
0x0c)
+#define DMA_FLOWC_THR_HI_REG(x)(0x08 + DMA_CHAN_FLOWC(x) * 
0x0c)
+#define DMA_FLOWC_ALLOC_REG(x) (0x0c + DMA_CHAN_FLOWC(x) * 0x0c)
+#define  DMA_FLOWC_ALLOC_FORCE_SHIFT   31
+#define  DMA_FLOWC_ALLOC_FORCE_MASK(1 << DMA_FLOWC_ALLOC_FORCE_SHIFT)
+
+/* DMA Global Reset register */
+#define DMA_RST_REG0x34
+#define  DMA_RST_CHAN_SHIFT0
+#define  DMA_RST_CHAN_MASK(x)  (1 << x)
+
+/* 

[U-Boot] [PATCH v11 02/28] bmips: bcm6338: add bcm6348-iudma support

2018-12-01 Thread Álvaro Fernández Rojas
Signed-off-by: Álvaro Fernández Rojas 
---
 v11: no changes
 v10: fix license identifiers
 v9: no changes
 v8: no changes
 v5: no changes
 v4: no changes
 v3: no changes
 v2: no changes

 arch/mips/dts/brcm,bcm6338.dtsi   | 14 ++
 include/dt-bindings/dma/bcm6338-dma.h | 14 ++
 2 files changed, 28 insertions(+)
 create mode 100644 include/dt-bindings/dma/bcm6338-dma.h

diff --git a/arch/mips/dts/brcm,bcm6338.dtsi b/arch/mips/dts/brcm,bcm6338.dtsi
index bbd58cf803..990355481c 100644
--- a/arch/mips/dts/brcm,bcm6338.dtsi
+++ b/arch/mips/dts/brcm,bcm6338.dtsi
@@ -4,6 +4,7 @@
  */
 
 #include 
+#include 
 #include 
 #include 
 #include "skeleton.dtsi"
@@ -130,5 +131,18 @@
reg = <0xfffe3100 0x38>;
u-boot,dm-pre-reloc;
};
+
+   iudma: dma-controller@fffe2400 {
+   compatible = "brcm,bcm6348-iudma";
+   reg = <0xfffe2400 0x1c>,
+ <0xfffe2500 0x60>,
+ <0xfffe2600 0x60>;
+   reg-names = "dma",
+   "dma-channels",
+   "dma-sram";
+   #dma-cells = <1>;
+   dma-channels = <6>;
+   resets = <&periph_rst BCM6338_RST_DMAMEM>;
+   };
};
 };
diff --git a/include/dt-bindings/dma/bcm6338-dma.h 
b/include/dt-bindings/dma/bcm6338-dma.h
new file mode 100644
index 00..f2e0b20444
--- /dev/null
+++ b/include/dt-bindings/dma/bcm6338-dma.h
@@ -0,0 +1,14 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2018 Álvaro Fernández Rojas 
+ *
+ * Derived from linux/drivers/net/ethernet/broadcom/bcm63xx_enet.c
+ */
+
+#ifndef __DT_BINDINGS_DMA_BCM6338_H
+#define __DT_BINDINGS_DMA_BCM6338_H
+
+#define BCM6338_DMA_ENET_RX0
+#define BCM6338_DMA_ENET_TX1
+
+#endif /* __DT_BINDINGS_DMA_BCM6338_H */
-- 
2.11.0

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v11 05/28] bmips: bcm6368: add bcm6348-iudma support

2018-12-01 Thread Álvaro Fernández Rojas
Signed-off-by: Álvaro Fernández Rojas 
---
 v11: no changes
 v10: fix license identifiers
 v9: no changes
 v8: introduce bcm6368-enet driver

 arch/mips/dts/brcm,bcm6368.dtsi   | 13 +
 include/dt-bindings/dma/bcm6368-dma.h | 14 ++
 2 files changed, 27 insertions(+)
 create mode 100644 include/dt-bindings/dma/bcm6368-dma.h

diff --git a/arch/mips/dts/brcm,bcm6368.dtsi b/arch/mips/dts/brcm,bcm6368.dtsi
index 65d769ab4f..30047f6360 100644
--- a/arch/mips/dts/brcm,bcm6368.dtsi
+++ b/arch/mips/dts/brcm,bcm6368.dtsi
@@ -4,6 +4,7 @@
  */
 
 #include 
+#include 
 #include 
 #include 
 #include "skeleton.dtsi"
@@ -192,5 +193,17 @@
 
status = "disabled";
};
+
+   iudma: dma-controller@10006800 {
+   compatible = "brcm,bcm6368-iudma";
+   reg = <0x10006800 0x80>,
+ <0x10006a00 0x80>,
+ <0x10006c00 0x80>;
+   reg-names = "dma",
+   "dma-channels",
+   "dma-sram";
+   #dma-cells = <1>;
+   dma-channels = <8>;
+   };
};
 };
diff --git a/include/dt-bindings/dma/bcm6368-dma.h 
b/include/dt-bindings/dma/bcm6368-dma.h
new file mode 100644
index 00..36c6caa0e1
--- /dev/null
+++ b/include/dt-bindings/dma/bcm6368-dma.h
@@ -0,0 +1,14 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2018 Álvaro Fernández Rojas 
+ *
+ * Derived from linux/drivers/net/ethernet/broadcom/bcm63xx_enet.c
+ */
+
+#ifndef __DT_BINDINGS_DMA_BCM6368_H
+#define __DT_BINDINGS_DMA_BCM6368_H
+
+#define BCM6368_DMA_ENETSW_RX  0
+#define BCM6368_DMA_ENETSW_TX  1
+
+#endif /* __DT_BINDINGS_DMA_BCM6368_H */
-- 
2.11.0

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v11 04/28] bmips: bcm6358: add bcm6348-iudma support

2018-12-01 Thread Álvaro Fernández Rojas
Signed-off-by: Álvaro Fernández Rojas 
---
 v11: no changes
 v10: fix license identifiers
 v9: no changes
 v8: no changes
 v5: no changes
 v4: no changes
 v3: no changes
 v2: no changes

 arch/mips/dts/brcm,bcm6358.dtsi   | 18 ++
 include/dt-bindings/dma/bcm6358-dma.h | 16 
 2 files changed, 34 insertions(+)
 create mode 100644 include/dt-bindings/dma/bcm6358-dma.h

diff --git a/arch/mips/dts/brcm,bcm6358.dtsi b/arch/mips/dts/brcm,bcm6358.dtsi
index 0617b46e92..5605723e83 100644
--- a/arch/mips/dts/brcm,bcm6358.dtsi
+++ b/arch/mips/dts/brcm,bcm6358.dtsi
@@ -4,6 +4,7 @@
  */
 
 #include 
+#include 
 #include 
 #include 
 #include "skeleton.dtsi"
@@ -190,5 +191,22 @@
 
status = "disabled";
};
+
+   iudma: dma-controller@fffe5000 {
+   compatible = "brcm,bcm6348-iudma";
+   reg = <0xfffe5000 0x24>,
+ <0xfffe5100 0x80>,
+ <0xfffe5200 0x80>;
+   reg-names = "dma",
+   "dma-channels",
+   "dma-sram";
+   #dma-cells = <1>;
+   dma-channels = <8>;
+   clocks = <&periph_clk BCM6358_CLK_EMUSB>,
+<&periph_clk BCM6358_CLK_USBSU>,
+<&periph_clk BCM6358_CLK_EPHY>;
+   resets = <&periph_rst BCM6358_RST_ENET>,
+<&periph_rst BCM6358_RST_EPHY>;
+   };
};
 };
diff --git a/include/dt-bindings/dma/bcm6358-dma.h 
b/include/dt-bindings/dma/bcm6358-dma.h
new file mode 100644
index 00..3118b9da0a
--- /dev/null
+++ b/include/dt-bindings/dma/bcm6358-dma.h
@@ -0,0 +1,16 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2018 Álvaro Fernández Rojas 
+ *
+ * Derived from linux/drivers/net/ethernet/broadcom/bcm63xx_enet.c
+ */
+
+#ifndef __DT_BINDINGS_DMA_BCM6358_H
+#define __DT_BINDINGS_DMA_BCM6358_H
+
+#define BCM6358_DMA_ENET0_RX   0
+#define BCM6358_DMA_ENET0_TX   1
+#define BCM6358_DMA_ENET1_RX   2
+#define BCM6358_DMA_ENET1_TX   3
+
+#endif /* __DT_BINDINGS_DMA_BCM6358_H */
-- 
2.11.0

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v11 15/28] bmips: bcm6358: add support for bcm6348-enet

2018-12-01 Thread Álvaro Fernández Rojas
Signed-off-by: Álvaro Fernández Rojas 
---
 v11: no changes
 v10: no changes
 v9: no changes
 v8: no changes
 v5: no changes
 v4: no changes
 v3: no changes
 v2: no changes

 arch/mips/dts/brcm,bcm6358.dtsi | 28 
 1 file changed, 28 insertions(+)

diff --git a/arch/mips/dts/brcm,bcm6358.dtsi b/arch/mips/dts/brcm,bcm6358.dtsi
index 5605723e83..5e9c9ad769 100644
--- a/arch/mips/dts/brcm,bcm6358.dtsi
+++ b/arch/mips/dts/brcm,bcm6358.dtsi
@@ -192,6 +192,34 @@
status = "disabled";
};
 
+   enet0: ethernet@fffe4000 {
+   compatible = "brcm,bcm6348-enet";
+   #address-cells = <1>;
+   #size-cells = <0>;
+   reg = <0xfffe4000 0x2dc>;
+   clocks = <&periph_clk BCM6358_CLK_ENET0>;
+   dmas = <&iudma BCM6358_DMA_ENET0_RX>,
+  <&iudma BCM6358_DMA_ENET0_TX>;
+   dma-names = "rx",
+   "tx";
+
+   status = "disabled";
+   };
+
+   enet1: ethernet@fffe4800 {
+   compatible = "brcm,bcm6348-enet";
+   #address-cells = <1>;
+   #size-cells = <0>;
+   reg = <0xfffe4800 0x2dc>;
+   clocks = <&periph_clk BCM6358_CLK_ENET1>;
+   dmas = <&iudma BCM6358_DMA_ENET1_RX>,
+  <&iudma BCM6358_DMA_ENET1_TX>;
+   dma-names = "rx",
+   "tx";
+
+   status = "disabled";
+   };
+
iudma: dma-controller@fffe5000 {
compatible = "brcm,bcm6348-iudma";
reg = <0xfffe5000 0x24>,
-- 
2.11.0

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v11 14/28] bmips: enable ct-5361 enet support

2018-12-01 Thread Álvaro Fernández Rojas
Signed-off-by: Álvaro Fernández Rojas 
---
 v11: no changes
 v10: no changes
 v9: no changes
 v8: no changes
 v5: no changes
 v4: no changes
 v3: no changes
 v2: no changes

 arch/mips/dts/comtrend,ct-5361.dts| 12 
 configs/comtrend_ct5361_ram_defconfig |  8 +++-
 2 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/arch/mips/dts/comtrend,ct-5361.dts 
b/arch/mips/dts/comtrend,ct-5361.dts
index 25747ca95d..f6b8a94e25 100644
--- a/arch/mips/dts/comtrend,ct-5361.dts
+++ b/arch/mips/dts/comtrend,ct-5361.dts
@@ -34,6 +34,18 @@
};
 };
 
+&enet1 {
+   status = "okay";
+   phy = <&enet1phy>;
+   phy-mode = "mii";
+
+   enet1phy: fixed-link {
+   reg = <1>;
+   speed = <100>;
+   full-duplex;
+   };
+};
+
 &gpio0 {
status = "okay";
 };
diff --git a/configs/comtrend_ct5361_ram_defconfig 
b/configs/comtrend_ct5361_ram_defconfig
index 82f2070713..6297e78fd9 100644
--- a/configs/comtrend_ct5361_ram_defconfig
+++ b/configs/comtrend_ct5361_ram_defconfig
@@ -25,11 +25,14 @@ CONFIG_CMD_LICENSE=y
 CONFIG_CMD_MEMINFO=y
 # CONFIG_CMD_LOADS is not set
 CONFIG_CMD_USB=y
+CONFIG_CMD_MII=y
+CONFIG_CMD_PING=y
 # CONFIG_CMD_MISC is not set
 CONFIG_OF_EMBED=y
 CONFIG_DEFAULT_DEVICE_TREE="comtrend,ct-5361"
-# CONFIG_NET is not set
+CONFIG_NET_RANDOM_ETHADDR=y
 # CONFIG_DM_DEVICE_REMOVE is not set
+CONFIG_BCM6348_IUDMA=y
 CONFIG_DM_GPIO=y
 CONFIG_BCM6345_GPIO=y
 CONFIG_LED=y
@@ -40,6 +43,9 @@ CONFIG_FLASH_CFI_DRIVER=y
 CONFIG_CFI_FLASH=y
 CONFIG_SYS_FLASH_PROTECTION=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_PHY_FIXED=y
+CONFIG_DM_ETH=y
+CONFIG_BCM6348_ETH=y
 CONFIG_PHY=y
 CONFIG_BCM6348_USBH_PHY=y
 CONFIG_DM_RESET=y
-- 
2.11.0

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v11 23/28] bmips: bcm6362: add support for bcm6368-enet

2018-12-01 Thread Álvaro Fernández Rojas
Signed-off-by: Álvaro Fernández Rojas 
---
 v11: no changes
 v10: no changes
 v9: no changes
 v8: introduce bcm6368-enet driver

 arch/mips/dts/brcm,bcm6362.dtsi | 19 +++
 1 file changed, 19 insertions(+)

diff --git a/arch/mips/dts/brcm,bcm6362.dtsi b/arch/mips/dts/brcm,bcm6362.dtsi
index 94e7de096d..c77b80a4cc 100644
--- a/arch/mips/dts/brcm,bcm6362.dtsi
+++ b/arch/mips/dts/brcm,bcm6362.dtsi
@@ -224,5 +224,24 @@
#dma-cells = <1>;
dma-channels = <8>;
};
+
+   enet: ethernet@10e0 {
+   compatible = "brcm,bcm6368-enet";
+   #address-cells = <1>;
+   #size-cells = <0>;
+   reg = <0x10e0 0x1>;
+   clocks = <&periph_clk BCM6362_CLK_SWPKT_USB>,
+<&periph_clk BCM6362_CLK_SWPKT_SAR>,
+<&periph_clk BCM6362_CLK_ROBOSW>;
+   resets = <&periph_rst BCM6362_RST_ENETSW>,
+<&periph_rst BCM6362_RST_EPHY>;
+   dmas = <&iudma BCM6362_DMA_ENETSW_RX>,
+  <&iudma BCM6362_DMA_ENETSW_TX>;
+   dma-names = "rx",
+   "tx";
+   brcm,num-ports = <6>;
+
+   status = "disabled";
+   };
};
 };
-- 
2.11.0

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v11 03/28] bmips: bcm6348: add bcm6348-iudma support

2018-12-01 Thread Álvaro Fernández Rojas
Signed-off-by: Álvaro Fernández Rojas 
---
 v11: no changes
 v10: fix license identifiers
 v9: no changes
 v8: no changes
 v5: no changes
 v4: no changes
 v3: no changes
 v2: no changes

 arch/mips/dts/brcm,bcm6348.dtsi   | 16 
 include/dt-bindings/dma/bcm6348-dma.h | 16 
 2 files changed, 32 insertions(+)
 create mode 100644 include/dt-bindings/dma/bcm6348-dma.h

diff --git a/arch/mips/dts/brcm,bcm6348.dtsi b/arch/mips/dts/brcm,bcm6348.dtsi
index cc80bbc808..875de232ca 100644
--- a/arch/mips/dts/brcm,bcm6348.dtsi
+++ b/arch/mips/dts/brcm,bcm6348.dtsi
@@ -4,6 +4,7 @@
  */
 
 #include 
+#include 
 #include 
 #include 
 #include "skeleton.dtsi"
@@ -159,5 +160,20 @@
reg = <0xfffe2300 0x38>;
u-boot,dm-pre-reloc;
};
+
+   iudma: dma-controller@fffe7000 {
+   compatible = "brcm,bcm6348-iudma";
+   reg = <0xfffe7000 0x1c>,
+ <0xfffe7100 0x40>,
+ <0xfffe7200 0x40>;
+   reg-names = "dma",
+   "dma-channels",
+   "dma-sram";
+   #dma-cells = <1>;
+   dma-channels = <4>;
+   clocks = <&periph_clk BCM6348_CLK_ENET>;
+   resets = <&periph_rst BCM6348_RST_ENET>,
+<&periph_rst BCM6348_RST_DMAMEM>;
+   };
};
 };
diff --git a/include/dt-bindings/dma/bcm6348-dma.h 
b/include/dt-bindings/dma/bcm6348-dma.h
new file mode 100644
index 00..36c2ffd412
--- /dev/null
+++ b/include/dt-bindings/dma/bcm6348-dma.h
@@ -0,0 +1,16 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2018 Álvaro Fernández Rojas 
+ *
+ * Derived from linux/drivers/net/ethernet/broadcom/bcm63xx_enet.c
+ */
+
+#ifndef __DT_BINDINGS_DMA_BCM6348_H
+#define __DT_BINDINGS_DMA_BCM6348_H
+
+#define BCM6348_DMA_ENET0_RX   0
+#define BCM6348_DMA_ENET0_TX   1
+#define BCM6348_DMA_ENET1_RX   2
+#define BCM6348_DMA_ENET1_TX   3
+
+#endif /* __DT_BINDINGS_DMA_BCM6348_H */
-- 
2.11.0

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v11 08/28] bmips: bcm63268: add bcm6348-iudma support

2018-12-01 Thread Álvaro Fernández Rojas
Signed-off-by: Álvaro Fernández Rojas 
---
 v11: no changes
 v10: fix license identifiers
 v9: no changes
 v8: introduce bcm6368-enet driver

 arch/mips/dts/brcm,bcm63268.dtsi   | 13 +
 include/dt-bindings/dma/bcm63268-dma.h | 14 ++
 2 files changed, 27 insertions(+)
 create mode 100644 include/dt-bindings/dma/bcm63268-dma.h

diff --git a/arch/mips/dts/brcm,bcm63268.dtsi b/arch/mips/dts/brcm,bcm63268.dtsi
index 62c440e675..c7ad83c306 100644
--- a/arch/mips/dts/brcm,bcm63268.dtsi
+++ b/arch/mips/dts/brcm,bcm63268.dtsi
@@ -4,6 +4,7 @@
  */
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -217,5 +218,17 @@
reg = <0x10003000 0x894>;
u-boot,dm-pre-reloc;
};
+
+   iudma: dma-controller@1000d800 {
+   compatible = "brcm,bcm6368-iudma";
+   reg = <0x1000d800 0x80>,
+ <0x1000da00 0x80>,
+ <0x1000dc00 0x80>;
+   reg-names = "dma",
+   "dma-channels",
+   "dma-sram";
+   #dma-cells = <1>;
+   dma-channels = <8>;
+   };
};
 };
diff --git a/include/dt-bindings/dma/bcm63268-dma.h 
b/include/dt-bindings/dma/bcm63268-dma.h
new file mode 100644
index 00..7d027119e6
--- /dev/null
+++ b/include/dt-bindings/dma/bcm63268-dma.h
@@ -0,0 +1,14 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2018 Álvaro Fernández Rojas 
+ *
+ * Derived from linux/drivers/net/ethernet/broadcom/bcm63xx_enet.c
+ */
+
+#ifndef __DT_BINDINGS_DMA_BCM63268_H
+#define __DT_BINDINGS_DMA_BCM63268_H
+
+#define BCM63268_DMA_ENETSW_RX 0
+#define BCM63268_DMA_ENETSW_TX 1
+
+#endif /* __DT_BINDINGS_DMA_BCM63268_H */
-- 
2.11.0

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v11 24/28] bmips: enable dgnd3700v2 enet support

2018-12-01 Thread Álvaro Fernández Rojas
Signed-off-by: Álvaro Fernández Rojas 
---
 v11: no changes
 v10: no changes
 v9: no changes
 v8: introduce bcm6368-enet driver

 arch/mips/dts/netgear,dgnd3700v2.dts | 14 ++
 configs/netgear_dgnd3700v2_ram_defconfig |  8 +++-
 2 files changed, 21 insertions(+), 1 deletion(-)

diff --git a/arch/mips/dts/netgear,dgnd3700v2.dts 
b/arch/mips/dts/netgear,dgnd3700v2.dts
index 322d1567ff..2b72491f0b 100644
--- a/arch/mips/dts/netgear,dgnd3700v2.dts
+++ b/arch/mips/dts/netgear,dgnd3700v2.dts
@@ -43,6 +43,20 @@
status = "okay";
 };
 
+&enet {
+   status = "okay";
+
+   port@4 {
+   compatible = "brcm,enetsw-port";
+   reg = <4>;
+   label = "rgmii";
+   brcm,phy-id = <0xff>;
+   speed = <1000>;
+   full-duplex;
+   bypass-link;
+   };
+};
+
 &gpio0 {
status = "okay";
 };
diff --git a/configs/netgear_dgnd3700v2_ram_defconfig 
b/configs/netgear_dgnd3700v2_ram_defconfig
index 1abc869856..0f3914fe7e 100644
--- a/configs/netgear_dgnd3700v2_ram_defconfig
+++ b/configs/netgear_dgnd3700v2_ram_defconfig
@@ -27,17 +27,23 @@ CONFIG_CMD_MEMINFO=y
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_LOADS is not set
 CONFIG_CMD_USB=y
-# CONFIG_CMD_NET is not set
+CONFIG_CMD_MII=y
+CONFIG_CMD_PING=y
 # CONFIG_CMD_MISC is not set
 CONFIG_OF_EMBED=y
 CONFIG_DEFAULT_DEVICE_TREE="netgear,dgnd3700v2"
+CONFIG_NET_RANDOM_ETHADDR=y
 # CONFIG_DM_DEVICE_REMOVE is not set
+CONFIG_BCM6348_IUDMA=y
 CONFIG_DM_GPIO=y
 CONFIG_BCM6345_GPIO=y
 CONFIG_LED=y
 CONFIG_LED_BCM6328=y
 CONFIG_LED_BLINK=y
 CONFIG_LED_GPIO=y
+CONFIG_DM_ETH=y
+CONFIG_PHY_GIGE=y
+CONFIG_BCM6368_ETH=y
 CONFIG_PHY=y
 CONFIG_BCM6368_USBH_PHY=y
 CONFIG_POWER_DOMAIN=y
-- 
2.11.0

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v11 09/28] bmips: bcm6318: add bcm6348-iudma support

2018-12-01 Thread Álvaro Fernández Rojas
Signed-off-by: Álvaro Fernández Rojas 
---
 v11: no changes
 v10: fix license identifiers
 v9: no changes
 v8: introduce bcm6368-enet driver

 arch/mips/dts/brcm,bcm6318.dtsi   | 19 +++
 include/dt-bindings/dma/bcm6318-dma.h | 14 ++
 2 files changed, 33 insertions(+)
 create mode 100644 include/dt-bindings/dma/bcm6318-dma.h

diff --git a/arch/mips/dts/brcm,bcm6318.dtsi b/arch/mips/dts/brcm,bcm6318.dtsi
index f75988be12..d04b7cbb01 100644
--- a/arch/mips/dts/brcm,bcm6318.dtsi
+++ b/arch/mips/dts/brcm,bcm6318.dtsi
@@ -4,6 +4,7 @@
  */
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -54,6 +55,12 @@
reg = <0x1004 0x4>;
#clock-cells = <1>;
};
+
+   ubus_clk: ubus-clk {
+   compatible = "brcm,bcm6345-clk";
+   reg = <0x1008 0x4>;
+   #clock-cells = <1>;
+   };
};
 
ubus {
@@ -182,5 +189,17 @@
 
status = "disabled";
};
+
+   iudma: dma-controller@10088000 {
+   compatible = "brcm,bcm6368-iudma";
+   reg = <0x10088000 0x80>,
+ <0x10088200 0x80>,
+ <0x10088400 0x80>;
+   reg-names = "dma",
+   "dma-channels",
+   "dma-sram";
+   #dma-cells = <1>;
+   dma-channels = <8>;
+   };
};
 };
diff --git a/include/dt-bindings/dma/bcm6318-dma.h 
b/include/dt-bindings/dma/bcm6318-dma.h
new file mode 100644
index 00..ad7c5ac2df
--- /dev/null
+++ b/include/dt-bindings/dma/bcm6318-dma.h
@@ -0,0 +1,14 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2018 Álvaro Fernández Rojas 
+ *
+ * Derived from linux/drivers/net/ethernet/broadcom/bcm63xx_enet.c
+ */
+
+#ifndef __DT_BINDINGS_DMA_BCM6318_H
+#define __DT_BINDINGS_DMA_BCM6318_H
+
+#define BCM6318_DMA_ENETSW_RX  0
+#define BCM6318_DMA_ENETSW_TX  1
+
+#endif /* __DT_BINDINGS_DMA_BCM6318_H */
-- 
2.11.0

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v11 12/28] bmips: enable f@st1704 enet support

2018-12-01 Thread Álvaro Fernández Rojas
Signed-off-by: Álvaro Fernández Rojas 
---
 v11: no changes
 v10: no changes
 v9: no changes
 v8: no changes
 v5: no changes
 v4: no changes
 v3: no changes
 v2: no changes

 arch/mips/dts/sagem,f...@st1704.dts | 12 
 configs/sagem_f@st1704_ram_defconfig |  8 +++-
 2 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/arch/mips/dts/sagem,f...@st1704.dts 
b/arch/mips/dts/sagem,f...@st1704.dts
index 5300f8b6df..ec6846dd9f 100644
--- a/arch/mips/dts/sagem,f...@st1704.dts
+++ b/arch/mips/dts/sagem,f...@st1704.dts
@@ -39,6 +39,18 @@
};
 };
 
+&enet {
+   status = "okay";
+   phy = <&enetphy>;
+   phy-mode = "mii";
+
+   enetphy: fixed-link {
+   reg = <1>;
+   speed = <100>;
+   full-duplex;
+   };
+};
+
 &gpio {
status = "okay";
 };
diff --git a/configs/sagem_f@st1704_ram_defconfig 
b/configs/sagem_f@st1704_ram_defconfig
index 91a966327a..8c36f5dbf8 100644
--- a/configs/sagem_f@st1704_ram_defconfig
+++ b/configs/sagem_f@st1704_ram_defconfig
@@ -27,11 +27,14 @@ CONFIG_CMD_MEMINFO=y
 # CONFIG_CMD_LOADS is not set
 CONFIG_CMD_SF=y
 CONFIG_CMD_SPI=y
+CONFIG_CMD_MII=y
+CONFIG_CMD_PING=y
 # CONFIG_CMD_MISC is not set
 CONFIG_OF_EMBED=y
 CONFIG_DEFAULT_DEVICE_TREE="sagem,f@st1704"
-# CONFIG_NET is not set
+CONFIG_NET_RANDOM_ETHADDR=y
 # CONFIG_DM_DEVICE_REMOVE is not set
+CONFIG_BCM6348_IUDMA=y
 CONFIG_DM_GPIO=y
 CONFIG_BCM6345_GPIO=y
 CONFIG_LED=y
@@ -40,6 +43,9 @@ CONFIG_DM_SPI_FLASH=y
 CONFIG_SPI_FLASH=y
 CONFIG_SPI_FLASH_WINBOND=y
 CONFIG_SPI_FLASH_MTD=y
+CONFIG_PHY_FIXED=y
+CONFIG_DM_ETH=y
+CONFIG_BCM6348_ETH=y
 CONFIG_DM_RESET=y
 CONFIG_RESET_BCM6345=y
 # CONFIG_SPL_SERIAL_PRESENT is not set
-- 
2.11.0

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v11 19/28] bmips: bcm6368: add support for bcm6368-enet

2018-12-01 Thread Álvaro Fernández Rojas
Signed-off-by: Álvaro Fernández Rojas 
---
 v11: no changes
 v10: no changes
 v9: no changes
 v8: introduce bcm6368-enet driver

 arch/mips/dts/brcm,bcm6368.dtsi | 19 +++
 1 file changed, 19 insertions(+)

diff --git a/arch/mips/dts/brcm,bcm6368.dtsi b/arch/mips/dts/brcm,bcm6368.dtsi
index 30047f6360..89590d6ff9 100644
--- a/arch/mips/dts/brcm,bcm6368.dtsi
+++ b/arch/mips/dts/brcm,bcm6368.dtsi
@@ -205,5 +205,24 @@
#dma-cells = <1>;
dma-channels = <8>;
};
+
+   enet: ethernet@10f0 {
+   compatible = "brcm,bcm6368-enet";
+   #address-cells = <1>;
+   #size-cells = <0>;
+   reg = <0x10f0 0x1>;
+   clocks = <&periph_clk BCM6368_CLK_SWPKT_USB>,
+<&periph_clk BCM6368_CLK_SWPKT_SAR>,
+<&periph_clk BCM6368_CLK_ROBOSW>;
+   resets = <&periph_rst BCM6368_RST_SWITCH>,
+<&periph_rst BCM6368_RST_EPHY>;
+   dmas = <&iudma BCM6368_DMA_ENETSW_RX>,
+  <&iudma BCM6368_DMA_ENETSW_TX>;
+   dma-names = "rx",
+   "tx";
+   brcm,num-ports = <6>;
+
+   status = "disabled";
+   };
};
 };
-- 
2.11.0

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v11 06/28] bmips: bcm6328: add bcm6348-iudma support

2018-12-01 Thread Álvaro Fernández Rojas
Signed-off-by: Álvaro Fernández Rojas 
---
 v11: no changes
 v10: fix license identifiers
 v9: no changes
 v8: introduce bcm6368-enet driver

 arch/mips/dts/brcm,bcm6328.dtsi   | 13 +
 include/dt-bindings/dma/bcm6328-dma.h | 14 ++
 2 files changed, 27 insertions(+)
 create mode 100644 include/dt-bindings/dma/bcm6328-dma.h

diff --git a/arch/mips/dts/brcm,bcm6328.dtsi b/arch/mips/dts/brcm,bcm6328.dtsi
index e00a2950e2..6fa49e22bb 100644
--- a/arch/mips/dts/brcm,bcm6328.dtsi
+++ b/arch/mips/dts/brcm,bcm6328.dtsi
@@ -4,6 +4,7 @@
  */
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -187,5 +188,17 @@
reg = <0x10003000 0x864>;
u-boot,dm-pre-reloc;
};
+
+   iudma: dma-controller@1000d800 {
+   compatible = "brcm,bcm6368-iudma";
+   reg = <0x1000d800 0x80>,
+ <0x1000da00 0x80>,
+ <0x1000dc00 0x80>;
+   reg-names = "dma",
+   "dma-channels",
+   "dma-sram";
+   #dma-cells = <1>;
+   dma-channels = <8>;
+   };
};
 };
diff --git a/include/dt-bindings/dma/bcm6328-dma.h 
b/include/dt-bindings/dma/bcm6328-dma.h
new file mode 100644
index 00..7494df2feb
--- /dev/null
+++ b/include/dt-bindings/dma/bcm6328-dma.h
@@ -0,0 +1,14 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2018 Álvaro Fernández Rojas 
+ *
+ * Derived from linux/drivers/net/ethernet/broadcom/bcm63xx_enet.c
+ */
+
+#ifndef __DT_BINDINGS_DMA_BCM6328_H
+#define __DT_BINDINGS_DMA_BCM6328_H
+
+#define BCM6328_DMA_ENETSW_RX  0
+#define BCM6328_DMA_ENETSW_TX  1
+
+#endif /* __DT_BINDINGS_DMA_BCM6328_H */
-- 
2.11.0

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v11 22/28] bmips: enable ar-5387un enet support

2018-12-01 Thread Álvaro Fernández Rojas
Signed-off-by: Álvaro Fernández Rojas 
---
 v11: no changes
 v10: no changes
 v9: no changes
 v8: introduce bcm6368-enet driver

 arch/mips/dts/comtrend,ar-5387un.dts| 32 
 configs/comtrend_ar5387un_ram_defconfig |  7 ++-
 2 files changed, 38 insertions(+), 1 deletion(-)

diff --git a/arch/mips/dts/comtrend,ar-5387un.dts 
b/arch/mips/dts/comtrend,ar-5387un.dts
index e993b5cd89..03e3851ab1 100644
--- a/arch/mips/dts/comtrend,ar-5387un.dts
+++ b/arch/mips/dts/comtrend,ar-5387un.dts
@@ -24,6 +24,38 @@
status = "okay";
 };
 
+&enet {
+   status = "okay";
+
+   port@0 {
+   compatible = "brcm,enetsw-port";
+   reg = <0>;
+   label = "fe1";
+   brcm,phy-id = <1>;
+   };
+
+   port@1 {
+   compatible = "brcm,enetsw-port";
+   reg = <1>;
+   label = "fe2";
+   brcm,phy-id = <2>;
+   };
+
+   port@2 {
+   compatible = "brcm,enetsw-port";
+   reg = <2>;
+   label = "fe3";
+   brcm,phy-id = <3>;
+   };
+
+   port@3 {
+   compatible = "brcm,enetsw-port";
+   reg = <3>;
+   label = "fe4";
+   brcm,phy-id = <4>;
+   };
+};
+
 &leds {
status = "okay";
 
diff --git a/configs/comtrend_ar5387un_ram_defconfig 
b/configs/comtrend_ar5387un_ram_defconfig
index f129870ca0..5ba401a441 100644
--- a/configs/comtrend_ar5387un_ram_defconfig
+++ b/configs/comtrend_ar5387un_ram_defconfig
@@ -28,11 +28,14 @@ CONFIG_CMD_MEMINFO=y
 CONFIG_CMD_SF=y
 CONFIG_CMD_SPI=y
 CONFIG_CMD_USB=y
+CONFIG_CMD_MII=y
+CONFIG_CMD_PING=y
 # CONFIG_CMD_MISC is not set
 CONFIG_OF_EMBED=y
 CONFIG_DEFAULT_DEVICE_TREE="comtrend,ar-5387un"
-# CONFIG_NET is not set
+CONFIG_NET_RANDOM_ETHADDR=y
 # CONFIG_DM_DEVICE_REMOVE is not set
+CONFIG_BCM6348_IUDMA=y
 CONFIG_DM_GPIO=y
 CONFIG_LED=y
 CONFIG_LED_BCM6328=y
@@ -41,6 +44,8 @@ CONFIG_DM_SPI_FLASH=y
 CONFIG_SPI_FLASH=y
 CONFIG_SPI_FLASH_MACRONIX=y
 CONFIG_SPI_FLASH_MTD=y
+CONFIG_DM_ETH=y
+CONFIG_BCM6368_ETH=y
 CONFIG_PHY=y
 CONFIG_BCM6368_USBH_PHY=y
 CONFIG_POWER_DOMAIN=y
-- 
2.11.0

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v11 10/28] net: add support for bcm6348-enet

2018-12-01 Thread Álvaro Fernández Rojas
Signed-off-by: Álvaro Fernández Rojas 
Reviewed-by: Daniel Schwierzeck 
---
 v11: no changes
 v10: Introduce changes suggested by Daniel Schwierzeck:
  - Fix license identifiers.
  - Remove packet queue.
  - Move dma_prepare_rcv_buf to free_pkt.
  - Switch to live DM live tree.
 v9: use dma_prepare_rcv_buf and remove dma rx channel reset:
  - bcm6348_eth_recv: clear dirty dma descriptors only when packets are copied
   from rx dma.
  - bcm6348_eth_send: remove dma rx channel reset when sending packet.
 v8: Introduce changes from Grygorii Strashko
 v5: Receive as much packets as possible from bcm6348-eth and cache them in
 net_rx_packets. This is needed in order to fix flow control issues.
 v4: Fix issues reported by Grygorii Strashko and other fixes:
  - Copy received dma buffer to net_rx_packets in order to avoid possible
  dma overwrites.
  - Reset dma rx channel when sending a new packet to prevent flow control
  issues.
  - Fix packet casting on bcm6348_eth_recv/send.
 v3: no changes
 v2: select DMA_CHANNELS.

 drivers/net/Kconfig|  10 +
 drivers/net/Makefile   |   1 +
 drivers/net/bcm6348-eth.c  | 537 +
 include/configs/bmips_common.h |   6 +-
 4 files changed, 553 insertions(+), 1 deletion(-)
 create mode 100644 drivers/net/bcm6348-eth.c

diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index 8fb365fc5d..2b7cec8804 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -72,6 +72,16 @@ config BCM_SF2_ETH_GMAC
  by the BCM_SF2_ETH driver.
  Say Y to any bcmcygnus based platforms.
 
+config BCM6348_ETH
+   bool "BCM6348 EMAC support"
+   depends on DM_ETH && ARCH_BMIPS
+   select DMA
+   select DMA_CHANNELS
+   select MII
+   select PHYLIB
+   help
+ This driver supports the BCM6348 Ethernet MAC.
+
 config DWC_ETH_QOS
bool "Synopsys DWC Ethernet QOS device support"
depends on DM_ETH
diff --git a/drivers/net/Makefile b/drivers/net/Makefile
index 99056aa041..2647d4dd23 100644
--- a/drivers/net/Makefile
+++ b/drivers/net/Makefile
@@ -6,6 +6,7 @@
 obj-$(CONFIG_ALTERA_TSE) += altera_tse.o
 obj-$(CONFIG_AG7XXX) += ag7xxx.o
 obj-$(CONFIG_ARMADA100_FEC) += armada100_fec.o
+obj-$(CONFIG_BCM6348_ETH) += bcm6348-eth.o
 obj-$(CONFIG_DRIVER_AT91EMAC) += at91_emac.o
 obj-$(CONFIG_DRIVER_AX88180) += ax88180.o
 obj-$(CONFIG_BCM_SF2_ETH) += bcm-sf2-eth.o
diff --git a/drivers/net/bcm6348-eth.c b/drivers/net/bcm6348-eth.c
new file mode 100644
index 00..7100e68bd2
--- /dev/null
+++ b/drivers/net/bcm6348-eth.c
@@ -0,0 +1,537 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2018 Álvaro Fernández Rojas 
+ *
+ * Derived from linux/drivers/net/ethernet/broadcom/bcm63xx_enet.c:
+ * Copyright (C) 2008 Maxime Bizon 
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define ETH_RX_DESCPKTBUFSRX
+#define ETH_MAX_MTU_SIZE   1518
+#define ETH_TIMEOUT100
+#define ETH_TX_WATERMARK   32
+
+/* ETH Receiver Configuration register */
+#define ETH_RXCFG_REG  0x00
+#define ETH_RXCFG_ENFLOW_SHIFT 5
+#define ETH_RXCFG_ENFLOW_MASK  (1 << ETH_RXCFG_ENFLOW_SHIFT)
+
+/* ETH Receive Maximum Length register */
+#define ETH_RXMAXLEN_REG   0x04
+#define ETH_RXMAXLEN_SHIFT 0
+#define ETH_RXMAXLEN_MASK  (0x7ff << ETH_RXMAXLEN_SHIFT)
+
+/* ETH Transmit Maximum Length register */
+#define ETH_TXMAXLEN_REG   0x08
+#define ETH_TXMAXLEN_SHIFT 0
+#define ETH_TXMAXLEN_MASK  (0x7ff << ETH_TXMAXLEN_SHIFT)
+
+/* MII Status/Control register */
+#define MII_SC_REG 0x10
+#define MII_SC_MDCFREQDIV_SHIFT0
+#define MII_SC_MDCFREQDIV_MASK (0x7f << MII_SC_MDCFREQDIV_SHIFT)
+#define MII_SC_PREAMBLE_EN_SHIFT   7
+#define MII_SC_PREAMBLE_EN_MASK(1 << MII_SC_PREAMBLE_EN_SHIFT)
+
+/* MII Data register */
+#define MII_DAT_REG0x14
+#define MII_DAT_DATA_SHIFT 0
+#define MII_DAT_DATA_MASK  (0x << MII_DAT_DATA_SHIFT)
+#define MII_DAT_TA_SHIFT   16
+#define MII_DAT_TA_MASK(0x3 << MII_DAT_TA_SHIFT)
+#define MII_DAT_REG_SHIFT  18
+#define MII_DAT_REG_MASK   (0x1f << MII_DAT_REG_SHIFT)
+#define MII_DAT_PHY_SHIFT  23
+#define MII_DAT_PHY_MASK   (0x1f << MII_DAT_PHY_SHIFT)
+#define MII_DAT_OP_SHIFT   28
+#define MII_DAT_OP_WRITE   (0x5 << MII_DAT_OP_SHIFT)
+#define MII_DAT_OP_READ(0x6 << MII_DAT_OP_SHIFT)
+
+/* ETH Interrupts Mask register */
+#define ETH_IRMASK_REG 0x18
+
+/* ETH Interrupts register */
+#define ETH_IR_REG 0x1c
+#define ETH_IR_MII_SHIFT   0
+#define ETH_IR_MII_MASK   

[U-Boot] [PATCH v11 16/28] bmips: enable hg556a enet support

2018-12-01 Thread Álvaro Fernández Rojas
Signed-off-by: Álvaro Fernández Rojas 
---
 v11: no changes
 v10: no changes
 v9: no changes
 v8: no changes
 v5: no changes
 v4: no changes
 v3: no changes
 v2: no changes

 arch/mips/dts/huawei,hg556a.dts | 12 
 configs/huawei_hg556a_ram_defconfig |  8 +++-
 2 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/arch/mips/dts/huawei,hg556a.dts b/arch/mips/dts/huawei,hg556a.dts
index 60455c2ff8..6a7fc1df4b 100644
--- a/arch/mips/dts/huawei,hg556a.dts
+++ b/arch/mips/dts/huawei,hg556a.dts
@@ -93,6 +93,18 @@
status = "okay";
 };
 
+&enet1 {
+   status = "okay";
+   phy = <&enet1phy>;
+   phy-mode = "mii";
+
+   enet1phy: fixed-link {
+   reg = <1>;
+   speed = <100>;
+   full-duplex;
+   };
+};
+
 &gpio0 {
status = "okay";
 };
diff --git a/configs/huawei_hg556a_ram_defconfig 
b/configs/huawei_hg556a_ram_defconfig
index 6bb14ba736..d4e6144319 100644
--- a/configs/huawei_hg556a_ram_defconfig
+++ b/configs/huawei_hg556a_ram_defconfig
@@ -25,11 +25,14 @@ CONFIG_CMD_LICENSE=y
 CONFIG_CMD_MEMINFO=y
 # CONFIG_CMD_LOADS is not set
 CONFIG_CMD_USB=y
+CONFIG_CMD_MII=y
+CONFIG_CMD_PING=y
 # CONFIG_CMD_MISC is not set
 CONFIG_OF_EMBED=y
 CONFIG_DEFAULT_DEVICE_TREE="huawei,hg556a"
-# CONFIG_NET is not set
+CONFIG_NET_RANDOM_ETHADDR=y
 # CONFIG_DM_DEVICE_REMOVE is not set
+CONFIG_BCM6348_IUDMA=y
 CONFIG_DM_GPIO=y
 CONFIG_BCM6345_GPIO=y
 CONFIG_LED=y
@@ -40,6 +43,9 @@ CONFIG_FLASH_CFI_DRIVER=y
 CONFIG_CFI_FLASH=y
 CONFIG_SYS_FLASH_PROTECTION=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_PHY_FIXED=y
+CONFIG_DM_ETH=y
+CONFIG_BCM6348_ETH=y
 CONFIG_PHY=y
 CONFIG_BCM6358_USBH_PHY=y
 CONFIG_DM_RESET=y
-- 
2.11.0

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v11 13/28] bmips: bcm6348: add support for bcm6348-enet

2018-12-01 Thread Álvaro Fernández Rojas
Signed-off-by: Álvaro Fernández Rojas 
---
 v11: no changes
 v10: no changes
 v9: no changes
 v8: no changes
 v5: no changes
 v4: no changes
 v3: no changes
 v2: no changes

 arch/mips/dts/brcm,bcm6348.dtsi | 26 ++
 1 file changed, 26 insertions(+)

diff --git a/arch/mips/dts/brcm,bcm6348.dtsi b/arch/mips/dts/brcm,bcm6348.dtsi
index 875de232ca..79e7bd892b 100644
--- a/arch/mips/dts/brcm,bcm6348.dtsi
+++ b/arch/mips/dts/brcm,bcm6348.dtsi
@@ -161,6 +161,32 @@
u-boot,dm-pre-reloc;
};
 
+   enet0: ethernet@fffe6000 {
+   compatible = "brcm,bcm6348-enet";
+   #address-cells = <1>;
+   #size-cells = <0>;
+   reg = <0xfffe6000 0x2dc>;
+   dmas = <&iudma BCM6348_DMA_ENET0_RX>,
+  <&iudma BCM6348_DMA_ENET0_TX>;
+   dma-names = "rx",
+   "tx";
+
+   status = "disabled";
+   };
+
+   enet1: ethernet@fffe6800 {
+   compatible = "brcm,bcm6348-enet";
+   #address-cells = <1>;
+   #size-cells = <0>;
+   reg = <0xfffe6800 0x2dc>;
+   dmas = <&iudma BCM6348_DMA_ENET1_RX>,
+  <&iudma BCM6348_DMA_ENET1_TX>;
+   dma-names = "rx",
+   "tx";
+
+   status = "disabled";
+   };
+
iudma: dma-controller@fffe7000 {
compatible = "brcm,bcm6348-iudma";
reg = <0xfffe7000 0x1c>,
-- 
2.11.0

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v11 11/28] bmips: bcm6338: add support for bcm6348-enet

2018-12-01 Thread Álvaro Fernández Rojas
Signed-off-by: Álvaro Fernández Rojas 
---
 v11: no changes
 v10: no changes
 v9: no changes
 v8: no changes
 v5: no changes
 v4: no changes
 v3: no changes
 v2: no changes

 arch/mips/dts/brcm,bcm6338.dtsi | 15 +++
 1 file changed, 15 insertions(+)

diff --git a/arch/mips/dts/brcm,bcm6338.dtsi b/arch/mips/dts/brcm,bcm6338.dtsi
index 990355481c..c547e949dd 100644
--- a/arch/mips/dts/brcm,bcm6338.dtsi
+++ b/arch/mips/dts/brcm,bcm6338.dtsi
@@ -144,5 +144,20 @@
dma-channels = <6>;
resets = <&periph_rst BCM6338_RST_DMAMEM>;
};
+
+   enet: ethernet@fffe2800 {
+   compatible = "brcm,bcm6348-enet";
+   #address-cells = <1>;
+   #size-cells = <0>;
+   reg = <0xfffe2800 0x2dc>;
+   clocks = <&periph_clk BCM6338_CLK_ENET>;
+   resets = <&periph_rst BCM6338_RST_ENET>;
+   dmas = <&iudma BCM6338_DMA_ENET_RX>,
+  <&iudma BCM6338_DMA_ENET_TX>;
+   dma-names = "rx",
+   "tx";
+
+   status = "disabled";
+   };
};
 };
-- 
2.11.0

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v11 07/28] bmips: bcm6362: add bcm6348-iudma support

2018-12-01 Thread Álvaro Fernández Rojas
Signed-off-by: Álvaro Fernández Rojas 
---
 v11: no changes
 v10: fix license identifiers
 v9: no changes
 v8: introduce bcm6368-enet driver

 arch/mips/dts/brcm,bcm6362.dtsi   | 13 +
 include/dt-bindings/dma/bcm6362-dma.h | 14 ++
 2 files changed, 27 insertions(+)
 create mode 100644 include/dt-bindings/dma/bcm6362-dma.h

diff --git a/arch/mips/dts/brcm,bcm6362.dtsi b/arch/mips/dts/brcm,bcm6362.dtsi
index 3047b82b21..94e7de096d 100644
--- a/arch/mips/dts/brcm,bcm6362.dtsi
+++ b/arch/mips/dts/brcm,bcm6362.dtsi
@@ -4,6 +4,7 @@
  */
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -211,5 +212,17 @@
reg = <0x10003000 0x864>;
u-boot,dm-pre-reloc;
};
+
+   iudma: dma-controller@1000d800 {
+   compatible = "brcm,bcm6368-iudma";
+   reg = <0x1000d800 0x80>,
+ <0x1000da00 0x80>,
+ <0x1000dc00 0x80>;
+   reg-names = "dma",
+   "dma-channels",
+   "dma-sram";
+   #dma-cells = <1>;
+   dma-channels = <8>;
+   };
};
 };
diff --git a/include/dt-bindings/dma/bcm6362-dma.h 
b/include/dt-bindings/dma/bcm6362-dma.h
new file mode 100644
index 00..1e62236daa
--- /dev/null
+++ b/include/dt-bindings/dma/bcm6362-dma.h
@@ -0,0 +1,14 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2018 Álvaro Fernández Rojas 
+ *
+ * Derived from linux/drivers/net/ethernet/broadcom/bcm63xx_enet.c
+ */
+
+#ifndef __DT_BINDINGS_DMA_BCM6362_H
+#define __DT_BINDINGS_DMA_BCM6362_H
+
+#define BCM6362_DMA_ENETSW_RX  0
+#define BCM6362_DMA_ENETSW_TX  1
+
+#endif /* __DT_BINDINGS_DMA_BCM6362_H */
-- 
2.11.0

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v11 21/28] bmips: bcm6328: add support for bcm6368-enet

2018-12-01 Thread Álvaro Fernández Rojas
Signed-off-by: Álvaro Fernández Rojas 
---
 v11: no changes
 v10: no changes
 v9: no changes
 v8: introduce bcm6368-enet driver

 arch/mips/dts/brcm,bcm6328.dtsi | 17 +
 1 file changed, 17 insertions(+)

diff --git a/arch/mips/dts/brcm,bcm6328.dtsi b/arch/mips/dts/brcm,bcm6328.dtsi
index 6fa49e22bb..50beed4171 100644
--- a/arch/mips/dts/brcm,bcm6328.dtsi
+++ b/arch/mips/dts/brcm,bcm6328.dtsi
@@ -200,5 +200,22 @@
#dma-cells = <1>;
dma-channels = <8>;
};
+
+   enet: ethernet@10e0 {
+   compatible = "brcm,bcm6368-enet";
+   #address-cells = <1>;
+   #size-cells = <0>;
+   reg = <0x10e0 0x1>;
+   clocks = <&periph_clk BCM6328_CLK_ROBOSW>;
+   resets = <&periph_rst BCM6328_RST_ENETSW>,
+<&periph_rst BCM6328_RST_EPHY>;
+   dmas = <&iudma BCM6328_DMA_ENETSW_RX>,
+  <&iudma BCM6328_DMA_ENETSW_TX>;
+   dma-names = "rx",
+   "tx";
+   brcm,num-ports = <5>;
+
+   status = "disabled";
+   };
};
 };
-- 
2.11.0

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v11 27/28] bmips: bcm6318: add support for bcm6368-enet

2018-12-01 Thread Álvaro Fernández Rojas
Signed-off-by: Álvaro Fernández Rojas 
---
 v11: no changes
 v10: no changes
 v9: no changes
 v8: introduce bcm6368-enet driver

 arch/mips/dts/brcm,bcm6318.dtsi   | 19 +++
 include/dt-bindings/clock/bcm6318-clock.h | 11 +++
 2 files changed, 30 insertions(+)

diff --git a/arch/mips/dts/brcm,bcm6318.dtsi b/arch/mips/dts/brcm,bcm6318.dtsi
index d04b7cbb01..d678dab242 100644
--- a/arch/mips/dts/brcm,bcm6318.dtsi
+++ b/arch/mips/dts/brcm,bcm6318.dtsi
@@ -190,6 +190,25 @@
status = "disabled";
};
 
+   enet: ethernet@1008 {
+   compatible = "brcm,bcm6368-enet";
+   #address-cells = <1>;
+   #size-cells = <0>;
+   reg = <0x1008 0x8000>;
+   clocks = <&periph_clk BCM6318_CLK_ROBOSW250>,
+<&periph_clk BCM6318_CLK_ROBOSW025>,
+<&ubus_clk BCM6318_UCLK_ROBOSW>;
+   resets = <&periph_rst BCM6318_RST_ENETSW>,
+<&periph_rst BCM6318_RST_EPHY>;
+   dmas = <&iudma BCM6318_DMA_ENETSW_RX>,
+  <&iudma BCM6318_DMA_ENETSW_TX>;
+   dma-names = "rx",
+   "tx";
+   brcm,num-ports = <5>;
+
+   status = "disabled";
+   };
+
iudma: dma-controller@10088000 {
compatible = "brcm,bcm6368-iudma";
reg = <0x10088000 0x80>,
diff --git a/include/dt-bindings/clock/bcm6318-clock.h 
b/include/dt-bindings/clock/bcm6318-clock.h
index d5e13c5c2d..3f10448cef 100644
--- a/include/dt-bindings/clock/bcm6318-clock.h
+++ b/include/dt-bindings/clock/bcm6318-clock.h
@@ -33,4 +33,15 @@
 #define BCM6318_CLK_AFE29
 #define BCM6318_CLK_QPROC  30
 
+#define BCM6318_UCLK_ADSL  0
+#define BCM6318_UCLK_ARB   1
+#define BCM6318_UCLK_MIPS  2
+#define BCM6318_UCLK_PCIE  3
+#define BCM6318_UCLK_PERIPH4
+#define BCM6318_UCLK_PHYMIPS   5
+#define BCM6318_UCLK_ROBOSW6
+#define BCM6318_UCLK_SAR   7
+#define BCM6318_UCLK_SDR   8
+#define BCM6318_UCLK_USB   9
+
 #endif /* __DT_BINDINGS_CLOCK_BCM6318_H */
-- 
2.11.0

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v11 20/28] bmips: enable wap-5813n enet support

2018-12-01 Thread Álvaro Fernández Rojas
Signed-off-by: Álvaro Fernández Rojas 
---
 v11: no changes
 v10: no changes
 v9: no changes
 v8: introduce bcm6368-enet driver

 arch/mips/dts/comtrend,wap-5813n.dts| 14 ++
 configs/comtrend_wap5813n_ram_defconfig |  8 +++-
 2 files changed, 21 insertions(+), 1 deletion(-)

diff --git a/arch/mips/dts/comtrend,wap-5813n.dts 
b/arch/mips/dts/comtrend,wap-5813n.dts
index bd41dab9f8..7e835b28d2 100644
--- a/arch/mips/dts/comtrend,wap-5813n.dts
+++ b/arch/mips/dts/comtrend,wap-5813n.dts
@@ -54,6 +54,20 @@
status = "okay";
 };
 
+&enet {
+   status = "okay";
+
+   port@4 {
+   compatible = "brcm,enetsw-port";
+   reg = <4>;
+   label = "rgmii";
+   brcm,phy-id = <0xff>;
+   speed = <1000>;
+   full-duplex;
+   bypass-link;
+   };
+};
+
 &gpio0 {
status = "okay";
 };
diff --git a/configs/comtrend_wap5813n_ram_defconfig 
b/configs/comtrend_wap5813n_ram_defconfig
index 987e4c3fbc..fd5107bb7d 100644
--- a/configs/comtrend_wap5813n_ram_defconfig
+++ b/configs/comtrend_wap5813n_ram_defconfig
@@ -25,11 +25,14 @@ CONFIG_CMD_LICENSE=y
 CONFIG_CMD_MEMINFO=y
 # CONFIG_CMD_LOADS is not set
 CONFIG_CMD_USB=y
+CONFIG_CMD_MII=y
+CONFIG_CMD_PING=y
 # CONFIG_CMD_MISC is not set
 CONFIG_OF_EMBED=y
 CONFIG_DEFAULT_DEVICE_TREE="comtrend,wap-5813n"
-# CONFIG_NET is not set
+CONFIG_NET_RANDOM_ETHADDR=y
 # CONFIG_DM_DEVICE_REMOVE is not set
+CONFIG_BCM6348_IUDMA=y
 CONFIG_DM_GPIO=y
 CONFIG_BCM6345_GPIO=y
 CONFIG_LED=y
@@ -40,6 +43,9 @@ CONFIG_FLASH_CFI_DRIVER=y
 CONFIG_CFI_FLASH=y
 CONFIG_SYS_FLASH_PROTECTION=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_DM_ETH=y
+CONFIG_PHY_GIGE=y
+CONFIG_BCM6368_ETH=y
 CONFIG_PHY=y
 CONFIG_BCM6368_USBH_PHY=y
 CONFIG_DM_RESET=y
-- 
2.11.0

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v11 25/28] bmips: bcm63268: add support for bcm6368-enet

2018-12-01 Thread Álvaro Fernández Rojas
Signed-off-by: Álvaro Fernández Rojas 
---
 v11: no changes
 v10: no changes
 v9: no changes
 v8: introduce bcm6368-enet driver

 arch/mips/dts/brcm,bcm63268.dtsi | 25 +
 1 file changed, 25 insertions(+)

diff --git a/arch/mips/dts/brcm,bcm63268.dtsi b/arch/mips/dts/brcm,bcm63268.dtsi
index c7ad83c306..f8a72ef535 100644
--- a/arch/mips/dts/brcm,bcm63268.dtsi
+++ b/arch/mips/dts/brcm,bcm63268.dtsi
@@ -230,5 +230,30 @@
#dma-cells = <1>;
dma-channels = <8>;
};
+
+   enet: ethernet@1070 {
+   compatible = "brcm,bcm6368-enet";
+   #address-cells = <1>;
+   #size-cells = <0>;
+   reg = <0x1070 0x1>;
+   clocks = <&periph_clk BCM63268_CLK_GMAC>,
+<&periph_clk BCM63268_CLK_ROBOSW>,
+<&periph_clk BCM63268_CLK_ROBOSW250>,
+<&timer_clk BCM63268_TCLK_EPHY1>,
+<&timer_clk BCM63268_TCLK_EPHY2>,
+<&timer_clk BCM63268_TCLK_EPHY3>,
+<&timer_clk BCM63268_TCLK_GPHY>;
+   resets = <&periph_rst BCM63268_RST_ENETSW>,
+<&periph_rst BCM63268_RST_EPHY>,
+<&periph_rst BCM63268_RST_GPHY>;
+   dmas = <&iudma BCM63268_DMA_ENETSW_RX>,
+  <&iudma BCM63268_DMA_ENETSW_TX>;
+   dma-names = "rx",
+   "tx";
+   brcm,rgmii-override;
+   brcm,rgmii-timing;
+
+   status = "disabled";
+   };
};
 };
-- 
2.11.0

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v11 28/28] bmips: enable ar-5315u enet support

2018-12-01 Thread Álvaro Fernández Rojas
Signed-off-by: Álvaro Fernández Rojas 
---
 v11: no changes
 v10: no changes
 v9: no changes
 v8: introduce bcm6368-enet driver

 arch/mips/dts/comtrend,ar-5315u.dts| 32 
 configs/comtrend_ar5315u_ram_defconfig |  7 ++-
 2 files changed, 38 insertions(+), 1 deletion(-)

diff --git a/arch/mips/dts/comtrend,ar-5315u.dts 
b/arch/mips/dts/comtrend,ar-5315u.dts
index 45570189d0..eb60aaa8d5 100644
--- a/arch/mips/dts/comtrend,ar-5315u.dts
+++ b/arch/mips/dts/comtrend,ar-5315u.dts
@@ -24,6 +24,38 @@
status = "okay";
 };
 
+&enet {
+   status = "okay";
+
+   port@0 {
+   compatible = "brcm,enetsw-port";
+   reg = <0>;
+   label = "fe4";
+   brcm,phy-id = <1>;
+   };
+
+   port@1 {
+   compatible = "brcm,enetsw-port";
+   reg = <1>;
+   label = "fe3";
+   brcm,phy-id = <2>;
+   };
+
+   port@2 {
+   compatible = "brcm,enetsw-port";
+   reg = <2>;
+   label = "fe2";
+   brcm,phy-id = <3>;
+   };
+
+   port@3 {
+   compatible = "brcm,enetsw-port";
+   reg = <3>;
+   label = "fe1";
+   brcm,phy-id = <4>;
+   };
+};
+
 &leds {
status = "okay";
 
diff --git a/configs/comtrend_ar5315u_ram_defconfig 
b/configs/comtrend_ar5315u_ram_defconfig
index d9ef52e68d..1b8e4e43c4 100644
--- a/configs/comtrend_ar5315u_ram_defconfig
+++ b/configs/comtrend_ar5315u_ram_defconfig
@@ -28,11 +28,14 @@ CONFIG_CMD_MEMINFO=y
 CONFIG_CMD_SF=y
 CONFIG_CMD_SPI=y
 CONFIG_CMD_USB=y
+CONFIG_CMD_MII=y
+CONFIG_CMD_PING=y
 # CONFIG_CMD_MISC is not set
 CONFIG_OF_EMBED=y
 CONFIG_DEFAULT_DEVICE_TREE="comtrend,ar-5315u"
-# CONFIG_NET is not set
+CONFIG_NET_RANDOM_ETHADDR=y
 # CONFIG_DM_DEVICE_REMOVE is not set
+CONFIG_BCM6348_IUDMA=y
 CONFIG_DM_GPIO=y
 CONFIG_LED=y
 CONFIG_LED_BCM6328=y
@@ -41,6 +44,8 @@ CONFIG_DM_SPI_FLASH=y
 CONFIG_SPI_FLASH=y
 CONFIG_SPI_FLASH_WINBOND=y
 CONFIG_SPI_FLASH_MTD=y
+CONFIG_DM_ETH=y
+CONFIG_BCM6368_ETH=y
 CONFIG_PHY=y
 CONFIG_BCM6318_USBH_PHY=y
 CONFIG_BCM6328_POWER_DOMAIN=y
-- 
2.11.0

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v11 17/28] bmips: enable nb4-ser enet support

2018-12-01 Thread Álvaro Fernández Rojas
Signed-off-by: Álvaro Fernández Rojas 
---
 v11: no changes
 v10: no changes
 v9: no changes
 v8: no changes
 v5: no changes
 v4: no changes
 v3: no changes
 v2: no changes

 arch/mips/dts/sfr,nb4-ser.dts | 24 
 configs/sfr_nb4-ser_ram_defconfig |  8 +++-
 2 files changed, 31 insertions(+), 1 deletion(-)

diff --git a/arch/mips/dts/sfr,nb4-ser.dts b/arch/mips/dts/sfr,nb4-ser.dts
index bdc6f8ae45..dfbc4148dc 100644
--- a/arch/mips/dts/sfr,nb4-ser.dts
+++ b/arch/mips/dts/sfr,nb4-ser.dts
@@ -53,6 +53,30 @@
status = "okay";
 };
 
+&enet0 {
+   status = "okay";
+   phy = <&enet0phy>;
+   phy-mode = "internal";
+
+   enet0phy: fixed-link {
+   reg = <1>;
+   speed = <100>;
+   full-duplex;
+   };
+};
+
+&enet1 {
+   status = "okay";
+   phy = <&enet1phy>;
+   phy-mode = "mii";
+
+   enet1phy: fixed-link {
+   reg = <1>;
+   speed = <100>;
+   full-duplex;
+   };
+};
+
 &gpio0 {
status = "okay";
 };
diff --git a/configs/sfr_nb4-ser_ram_defconfig 
b/configs/sfr_nb4-ser_ram_defconfig
index 12adfb01e7..39622875b1 100644
--- a/configs/sfr_nb4-ser_ram_defconfig
+++ b/configs/sfr_nb4-ser_ram_defconfig
@@ -26,11 +26,14 @@ CONFIG_CMD_LICENSE=y
 CONFIG_CMD_MEMINFO=y
 # CONFIG_CMD_LOADS is not set
 CONFIG_CMD_USB=y
+CONFIG_CMD_MII=y
+CONFIG_CMD_PING=y
 # CONFIG_CMD_MISC is not set
 CONFIG_OF_EMBED=y
 CONFIG_DEFAULT_DEVICE_TREE="sfr,nb4-ser"
-# CONFIG_NET is not set
+CONFIG_NET_RANDOM_ETHADDR=y
 # CONFIG_DM_DEVICE_REMOVE is not set
+CONFIG_BCM6348_IUDMA=y
 CONFIG_DM_GPIO=y
 CONFIG_BCM6345_GPIO=y
 CONFIG_LED=y
@@ -42,6 +45,9 @@ CONFIG_FLASH_CFI_DRIVER=y
 CONFIG_CFI_FLASH=y
 CONFIG_SYS_FLASH_PROTECTION=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_PHY_FIXED=y
+CONFIG_DM_ETH=y
+CONFIG_BCM6348_ETH=y
 CONFIG_PHY=y
 CONFIG_BCM6358_USBH_PHY=y
 CONFIG_DM_RESET=y
-- 
2.11.0

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v11 26/28] bmips: enable vr-3032u enet support

2018-12-01 Thread Álvaro Fernández Rojas
Signed-off-by: Álvaro Fernández Rojas 
---
 v11: no changes
 v10: no changes
 v9: no changes
 v8: introduce bcm6368-enet driver

 arch/mips/dts/comtrend,vr-3032u.dts| 32 
 configs/comtrend_vr3032u_ram_defconfig |  7 ++-
 2 files changed, 38 insertions(+), 1 deletion(-)

diff --git a/arch/mips/dts/comtrend,vr-3032u.dts 
b/arch/mips/dts/comtrend,vr-3032u.dts
index 8c6a4a1eac..512cb52de3 100644
--- a/arch/mips/dts/comtrend,vr-3032u.dts
+++ b/arch/mips/dts/comtrend,vr-3032u.dts
@@ -24,6 +24,38 @@
status = "okay";
 };
 
+&enet {
+   status = "okay";
+
+   port@0 {
+   compatible = "brcm,enetsw-port";
+   reg = <0>;
+   label = "fe2";
+   brcm,phy-id = <1>;
+   };
+
+   port@1 {
+   compatible = "brcm,enetsw-port";
+   reg = <1>;
+   label = "fe3";
+   brcm,phy-id = <2>;
+   };
+
+   port@2 {
+   compatible = "brcm,enetsw-port";
+   reg = <2>;
+   label = "fe4";
+   brcm,phy-id = <3>;
+   };
+
+   port@3 {
+   compatible = "brcm,enetsw-port";
+   reg = <3>;
+   label = "fe1";
+   brcm,phy-id = <4>;
+   };
+};
+
 &leds {
status = "okay";
brcm,serial-leds;
diff --git a/configs/comtrend_vr3032u_ram_defconfig 
b/configs/comtrend_vr3032u_ram_defconfig
index 1689eecec1..47f53998e1 100644
--- a/configs/comtrend_vr3032u_ram_defconfig
+++ b/configs/comtrend_vr3032u_ram_defconfig
@@ -26,15 +26,20 @@ CONFIG_CMD_MEMINFO=y
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_LOADS is not set
 CONFIG_CMD_USB=y
+CONFIG_CMD_MII=y
+CONFIG_CMD_PING=y
 # CONFIG_CMD_MISC is not set
 CONFIG_OF_EMBED=y
 CONFIG_DEFAULT_DEVICE_TREE="comtrend,vr-3032u"
-# CONFIG_NET is not set
+CONFIG_NET_RANDOM_ETHADDR=y
 # CONFIG_DM_DEVICE_REMOVE is not set
+CONFIG_BCM6348_IUDMA=y
 CONFIG_DM_GPIO=y
 CONFIG_LED=y
 CONFIG_LED_BCM6328=y
 CONFIG_LED_BLINK=y
+CONFIG_DM_ETH=y
+CONFIG_BCM6368_ETH=y
 CONFIG_PHY=y
 CONFIG_BCM6368_USBH_PHY=y
 CONFIG_POWER_DOMAIN=y
-- 
2.11.0

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v11 18/28] net: add support for bcm6368-enet

2018-12-01 Thread Álvaro Fernández Rojas
Signed-off-by: Álvaro Fernández Rojas 
Reviewed-by: Daniel Schwierzeck 
---
 v11: no changes
 v10: Introduce changes suggested by Daniel Schwierzeck:
  - Fix license identifiers.
  - Remove packet queue.
  - Move dma_prepare_rcv_buf to free_pkt.
  - Pad packets smaller than ETH_ZLEN.
  - Switch to live DM live tree.
 v9: introduce flow control improvements from bcm6348-eth:
  - introduce rx packets caching functionality from bcm6348-eth to fix flow
   control issues.
  - code style fixes.
 v8: introduce bcm6368-enet driver

 drivers/net/Kconfig   |   8 +
 drivers/net/Makefile  |   1 +
 drivers/net/bcm6368-eth.c | 625 ++
 3 files changed, 634 insertions(+)
 create mode 100644 drivers/net/bcm6368-eth.c

diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index 2b7cec8804..7044c6adf3 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -82,6 +82,14 @@ config BCM6348_ETH
help
  This driver supports the BCM6348 Ethernet MAC.
 
+config BCM6368_ETH
+   bool "BCM6368 EMAC support"
+   depends on DM_ETH && ARCH_BMIPS
+   select DMA
+   select MII
+   help
+ This driver supports the BCM6368 Ethernet MAC.
+
 config DWC_ETH_QOS
bool "Synopsys DWC Ethernet QOS device support"
depends on DM_ETH
diff --git a/drivers/net/Makefile b/drivers/net/Makefile
index 2647d4dd23..0dbfa03306 100644
--- a/drivers/net/Makefile
+++ b/drivers/net/Makefile
@@ -7,6 +7,7 @@ obj-$(CONFIG_ALTERA_TSE) += altera_tse.o
 obj-$(CONFIG_AG7XXX) += ag7xxx.o
 obj-$(CONFIG_ARMADA100_FEC) += armada100_fec.o
 obj-$(CONFIG_BCM6348_ETH) += bcm6348-eth.o
+obj-$(CONFIG_BCM6368_ETH) += bcm6368-eth.o
 obj-$(CONFIG_DRIVER_AT91EMAC) += at91_emac.o
 obj-$(CONFIG_DRIVER_AX88180) += ax88180.o
 obj-$(CONFIG_BCM_SF2_ETH) += bcm-sf2-eth.o
diff --git a/drivers/net/bcm6368-eth.c b/drivers/net/bcm6368-eth.c
new file mode 100644
index 00..a31efba9d1
--- /dev/null
+++ b/drivers/net/bcm6368-eth.c
@@ -0,0 +1,625 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2018 Álvaro Fernández Rojas 
+ *
+ * Derived from linux/drivers/net/ethernet/broadcom/bcm63xx_enet.c:
+ * Copyright (C) 2008 Maxime Bizon 
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define ETH_PORT_STR   "brcm,enetsw-port"
+
+#define ETH_RX_DESCPKTBUFSRX
+#define ETH_ZLEN   60
+#define ETH_TIMEOUT100
+
+#define ETH_MAX_PORT   8
+#define ETH_RGMII_PORT04
+
+/* Port traffic control */
+#define ETH_PTCTRL_REG(x)  (0x0 + (x))
+#define ETH_PTCTRL_RXDIS_SHIFT 0
+#define ETH_PTCTRL_RXDIS_MASK  (1 << ETH_PTCTRL_RXDIS_SHIFT)
+#define ETH_PTCTRL_TXDIS_SHIFT 1
+#define ETH_PTCTRL_TXDIS_MASK  (1 << ETH_PTCTRL_TXDIS_SHIFT)
+
+/* Switch mode register */
+#define ETH_SWMODE_REG 0xb
+#define ETH_SWMODE_FWD_EN_SHIFT1
+#define ETH_SWMODE_FWD_EN_MASK (1 << ETH_SWMODE_FWD_EN_SHIFT)
+
+/* IMP override Register */
+#define ETH_IMPOV_REG  0xe
+#define ETH_IMPOV_LINKUP_SHIFT 0
+#define ETH_IMPOV_LINKUP_MASK  (1 << ETH_IMPOV_LINKUP_SHIFT)
+#define ETH_IMPOV_FDX_SHIFT1
+#define ETH_IMPOV_FDX_MASK (1 << ETH_IMPOV_FDX_SHIFT)
+#define ETH_IMPOV_100_SHIFT2
+#define ETH_IMPOV_100_MASK (1 << ETH_IMPOV_100_SHIFT)
+#define ETH_IMPOV_1000_SHIFT   3
+#define ETH_IMPOV_1000_MASK(1 << ETH_IMPOV_1000_SHIFT)
+#define ETH_IMPOV_RXFLOW_SHIFT 4
+#define ETH_IMPOV_RXFLOW_MASK  (1 << ETH_IMPOV_RXFLOW_SHIFT)
+#define ETH_IMPOV_TXFLOW_SHIFT 5
+#define ETH_IMPOV_TXFLOW_MASK  (1 << ETH_IMPOV_TXFLOW_SHIFT)
+#define ETH_IMPOV_FORCE_SHIFT  7
+#define ETH_IMPOV_FORCE_MASK   (1 << ETH_IMPOV_FORCE_SHIFT)
+
+/* Port override Register */
+#define ETH_PORTOV_REG(x)  (0x58 + (x))
+#define ETH_PORTOV_LINKUP_SHIFT0
+#define ETH_PORTOV_LINKUP_MASK (1 << ETH_PORTOV_LINKUP_SHIFT)
+#define ETH_PORTOV_FDX_SHIFT   1
+#define ETH_PORTOV_FDX_MASK(1 << ETH_PORTOV_FDX_SHIFT)
+#define ETH_PORTOV_100_SHIFT   2
+#define ETH_PORTOV_100_MASK(1 << ETH_PORTOV_100_SHIFT)
+#define ETH_PORTOV_1000_SHIFT  3
+#define ETH_PORTOV_1000_MASK   (1 << ETH_PORTOV_1000_SHIFT)
+#define ETH_PORTOV_RXFLOW_SHIFT4
+#define ETH_PORTOV_RXFLOW_MASK (1 << ETH_PORTOV_RXFLOW_SHIFT)
+#define ETH_PORTOV_TXFLOW_SHIFT5
+#define ETH_PORTOV_TXFLOW_MASK (1 << ETH_PORTOV_TXFLOW_SHIFT)
+#define ETH_PORTOV_ENABLE_SHIFT6
+#define ETH_PORTOV_ENABLE_MASK (1 << ETH_PORTOV_ENABLE_SHIFT)
+
+/* Port RGMII control register */
+#define ETH_RGMII_CTRL_REG(x)  (0x60 + (x))
+#define ETH_RGMII_CTRL_GMII_CLK_EN (1 

[U-Boot] [PATCH v2 1/1] dm: core: add functions to get/remap I/O addresses by name

2018-12-01 Thread Álvaro Fernández Rojas
Signed-off-by: Álvaro Fernández Rojas 
---
 v2: add remap tests

 arch/sandbox/dts/test.dts |  1 +
 drivers/core/fdtaddr.c| 10 ++
 drivers/core/read.c   | 20 
 include/dm/fdtaddr.h  | 13 
 include/dm/read.h | 36 +
 test/dm/test-fdt.c| 82 +--
 6 files changed, 160 insertions(+), 2 deletions(-)

diff --git a/arch/sandbox/dts/test.dts b/arch/sandbox/dts/test.dts
index 2c6b422312..df523b0c37 100644
--- a/arch/sandbox/dts/test.dts
+++ b/arch/sandbox/dts/test.dts
@@ -680,6 +680,7 @@
dev@0,0 {
compatible = "denx,u-boot-fdt-dummy";
reg = <0 0x0 0x1000>;
+   reg-names = "sandbox-dummy-0";
};
 
dev@1,100 {
diff --git a/drivers/core/fdtaddr.c b/drivers/core/fdtaddr.c
index bfd9580050..e113f1dd39 100644
--- a/drivers/core/fdtaddr.c
+++ b/drivers/core/fdtaddr.c
@@ -146,6 +146,16 @@ void *devfdt_remap_addr_index(struct udevice *dev, int 
index)
return map_physmem(addr, 0, MAP_NOCACHE);
 }
 
+void *devfdt_remap_addr_name(struct udevice *dev, const char *name)
+{
+   fdt_addr_t addr = devfdt_get_addr_name(dev, name);
+
+   if (addr == FDT_ADDR_T_NONE)
+   return NULL;
+
+   return map_physmem(addr, 0, MAP_NOCACHE);
+}
+
 void *devfdt_remap_addr(struct udevice *dev)
 {
return devfdt_remap_addr_index(dev, 0);
diff --git a/drivers/core/read.c b/drivers/core/read.c
index 96766c7876..cdd78be03e 100644
--- a/drivers/core/read.c
+++ b/drivers/core/read.c
@@ -69,6 +69,26 @@ void *dev_remap_addr_index(struct udevice *dev, int index)
return map_physmem(addr, 0, MAP_NOCACHE);
 }
 
+fdt_addr_t dev_read_addr_name(struct udevice *dev, const char *name)
+{
+   int index = dev_read_stringlist_search(dev, "reg-names", name);
+
+   if (index < 0)
+   return FDT_ADDR_T_NONE;
+   else
+   return dev_read_addr_index(dev, index);
+}
+
+void *dev_remap_addr_name(struct udevice *dev, const char *name)
+{
+   fdt_addr_t addr = dev_read_addr_name(dev, name);
+
+   if (addr == FDT_ADDR_T_NONE)
+   return NULL;
+
+   return map_physmem(addr, 0, MAP_NOCACHE);
+}
+
 fdt_addr_t dev_read_addr(struct udevice *dev)
 {
return dev_read_addr_index(dev, 0);
diff --git a/include/dm/fdtaddr.h b/include/dm/fdtaddr.h
index 49a6ffd5f8..c171d9bc2f 100644
--- a/include/dm/fdtaddr.h
+++ b/include/dm/fdtaddr.h
@@ -56,6 +56,19 @@ void *devfdt_remap_addr(struct udevice *dev);
 void *devfdt_remap_addr_index(struct udevice *dev, int index);
 
 /**
+ * devfdt_remap_addr_name() - Get the reg property of a device, indexed by
+ *name, as a memory-mapped I/O pointer
+ * @name: the 'reg' property can hold a list of  pairs, with the
+ *   'reg-names' property providing named-based identification. @index
+ *   indicates the value to search for in 'reg-names'.
+ *
+ * @dev: Pointer to a device
+ *
+ * @return Pointer to addr, or NULL if there is no such property
+ */
+void *devfdt_remap_addr_name(struct udevice *dev, const char *name);
+
+/**
  * devfdt_map_physmem() - Read device address from reg property of the
  * device node and map the address into CPU address
  * space.
diff --git a/include/dm/read.h b/include/dm/read.h
index a27b8554fb..efcbee15ec 100644
--- a/include/dm/read.h
+++ b/include/dm/read.h
@@ -125,6 +125,31 @@ fdt_addr_t dev_read_addr_index(struct udevice *dev, int 
index);
 void *dev_remap_addr_index(struct udevice *dev, int index);
 
 /**
+ * dev_read_addr_name() - Get the reg property of a device, indexed by name
+ *
+ * @dev: Device to read from
+ * @name: the 'reg' property can hold a list of  pairs, with the
+ *   'reg-names' property providing named-based identification. @index
+ *   indicates the value to search for in 'reg-names'.
+ *
+ * @return address or FDT_ADDR_T_NONE if not found
+ */
+fdt_addr_t dev_read_addr_name(struct udevice *dev, const char* name);
+
+/**
+ * dev_remap_addr_name() - Get the reg property of a device, indexed by name,
+ * as a memory-mapped I/O pointer
+ *
+ * @dev: Device to read from
+ * @name: the 'reg' property can hold a list of  pairs, with the
+ *   'reg-names' property providing named-based identification. @index
+ *   indicates the value to search for in 'reg-names'.
+ *
+ * @return pointer or NULL if not found
+ */
+void *dev_remap_addr_name(struct udevice *dev, const char* name);
+
+/**
  * dev_read_addr() - Get the reg property of a device
  *
  * @dev: Device to read from
@@ -494,6 +519,12 @@ static inline fdt_addr_t dev_read_addr_index(struct 
udevice *dev, int index)
return devfdt_get_addr_index(dev, index);
 }
 
+static inline fdt_addr_t dev_read_addr_name(struct udevice *dev,
+   const char *name)
+{
+  

[U-Boot] [PATCH 1/1] drivers: rtc: correctly convert seconds to time structure

2018-12-01 Thread Heinrich Schuchardt
Variable 'days' must be defined as signed int. Otherwise the conversion
fails for some dates, e.g. 2004-08-25. Cf function rtc_time64_to_tm() in
the Linux kernel source.

Fixes: 992c1db45591 "drivers: rtc: resolve year 2038 problem in rtc_to_tm"
Signed-off-by: Heinrich Schuchardt 
---
 drivers/rtc/rtc-lib.c | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/rtc/rtc-lib.c b/drivers/rtc/rtc-lib.c
index b8a7a8b2d3b..6ab5d41ee0d 100644
--- a/drivers/rtc/rtc-lib.c
+++ b/drivers/rtc/rtc-lib.c
@@ -31,10 +31,14 @@ static int rtc_month_days(unsigned int month, unsigned int 
year)
 /*
  * rtc_to_tm - Converts u64 to rtc_time.
  * Convert seconds since 01-01-1970 00:00:00 to Gregorian date.
+ *
+ * This function is copied from rtc_time64_to_tm() in the Linux kernel.
+ * But in U-Boot January is month 1 and we do not subtract 1900 from the year.
  */
 void rtc_to_tm(u64 time, struct rtc_time *tm)
 {
-   unsigned int month, year, secs, days;
+   unsigned int month, year, secs;
+   int days;
 
days = div_u64_rem(time, 86400, &secs);
 
-- 
2.19.2

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [BUG] sandbox_defconfig cannot be run anymore after 4a5b5e1a466d76f "sandbox: Update some drivers to work in SPL/TPL"

2018-12-01 Thread Heinrich Schuchardt
On Debian Buster with gcc 8.2.0

$ git checkout d814ff34a1ffb1e60059c964ad692c5c8fc8564b
$ make mrproper
$ make sandbox_defconfig
$ ./u-boot -D
Error binding driver 'sandbox_tpm': -12
Error binding driver 'serial_sandbox': -12
Some drivers failed to bind
initcall sequence 55af34e45860 failed at call 55af34cf5749 (err=-12)
### ERROR ### Please RESET the board ##

Git bisect points to

commit 4a5b5e1a466d76fc1c9e6fc8a6ee1337acdcadd0
Author: Simon Glass 
Date:   Tue Nov 6 15:21:27 2018 -0700

sandbox: Update some drivers to work in SPL/TPL

At present sandbox drivers are mostly not used before relocation.
Some of
these are needed by Chromium OS verified boot, since it uses sandbox
TPL,
so update them accordingly.

Signed-off-by: Simon Glass 


Best regards

Heinrich

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot