[U-Boot] [PATCH 0/6] Add support for MIPS Creator CI20

2018-12-10 Thread Ezequiel Garcia
As the subject says, this series adds support for CI20.

Most of the work was done by Paul Burton, and then by Marek Vasut.
I've just rescued the work from the dark wastelands of Mordor,
did some cleaning here and there and submitted.

Patches 1, 2, and 4 are completely untouched. I've picked them
from Marek's tree.

For the MMC driver (patch 3) there is some cleanup, and some
fixes for proper DM migration.

Finally, patches 5 and 6 have been changed a bit: I've cleaned
up the devicetree, the board support files and the defconfig.

This is based on top of today's master (7ff485c68b7e) and has
been tested by SD-card booting both U-Boot and Linux. Booting
Linux via TFTP was also tested.

Please note that I've added Paul's SOB to all the patches
he authored, to make the authorship chain more clear.

Reviews and tests are welcome. Bikesheds not so much! ;-)

Thanks!

Paul Burton (6):
  misc: Add JZ47xx efuse driver
  gpio: Add JZ47xx GPIO driver
  mmc: Add JZ47xx SD/MMC controller driver
  mips: Add SPL header
  mips: jz47xx: Add JZ4780 SoC support
  mips: jz47xx: Add Creator CI20 platform

 arch/mips/Kconfig |   7 +
 arch/mips/Makefile|   1 +
 arch/mips/dts/Makefile|   1 +
 arch/mips/dts/ci20.dts| 120 
 arch/mips/dts/jz4780.dtsi | 162 ++
 arch/mips/include/asm/spl.h   |  35 ++
 arch/mips/mach-jz47xx/Kconfig |  26 +
 arch/mips/mach-jz47xx/Makefile|   7 +
 arch/mips/mach-jz47xx/include/mach/jz4780.h   | 104 
 .../mach-jz47xx/include/mach/jz4780_dram.h| 457 +++
 arch/mips/mach-jz47xx/jz4780/Makefile |   5 +
 arch/mips/mach-jz47xx/jz4780/jz4780.c | 142 +
 arch/mips/mach-jz47xx/jz4780/pll.c| 528 ++
 arch/mips/mach-jz47xx/jz4780/sdram.c  | 271 +
 arch/mips/mach-jz47xx/jz4780/timer.c  | 238 
 arch/mips/mach-jz47xx/jz4780/u-boot-spl.lds   |  52 ++
 arch/mips/mach-jz47xx/start.S |  99 
 board/imgtec/ci20/Kconfig |  15 +
 board/imgtec/ci20/Makefile|   5 +
 board/imgtec/ci20/README  |  10 +
 board/imgtec/ci20/ci20.c  | 365 
 configs/ci20_defconfig|  47 ++
 drivers/gpio/Kconfig  |   7 +
 drivers/gpio/Makefile |   1 +
 drivers/gpio/gpio-jz47xx.c|  78 +++
 drivers/misc/Kconfig  |   6 +
 drivers/misc/Makefile |   1 +
 drivers/misc/jz4780_efuse.c   | 100 
 drivers/mmc/Kconfig   |   6 +
 drivers/mmc/Makefile  |   1 +
 drivers/mmc/jz_mmc.   |   0
 drivers/mmc/jz_mmc.c  | 491 
 include/configs/ci20.h|  74 +++
 include/dt-bindings/clock/jz4780-cgu.h|  88 +++
 34 files changed, 3550 insertions(+)
 create mode 100644 arch/mips/dts/ci20.dts
 create mode 100644 arch/mips/dts/jz4780.dtsi
 create mode 100644 arch/mips/include/asm/spl.h
 create mode 100644 arch/mips/mach-jz47xx/Kconfig
 create mode 100644 arch/mips/mach-jz47xx/Makefile
 create mode 100644 arch/mips/mach-jz47xx/include/mach/jz4780.h
 create mode 100644 arch/mips/mach-jz47xx/include/mach/jz4780_dram.h
 create mode 100644 arch/mips/mach-jz47xx/jz4780/Makefile
 create mode 100644 arch/mips/mach-jz47xx/jz4780/jz4780.c
 create mode 100644 arch/mips/mach-jz47xx/jz4780/pll.c
 create mode 100644 arch/mips/mach-jz47xx/jz4780/sdram.c
 create mode 100644 arch/mips/mach-jz47xx/jz4780/timer.c
 create mode 100644 arch/mips/mach-jz47xx/jz4780/u-boot-spl.lds
 create mode 100644 arch/mips/mach-jz47xx/start.S
 create mode 100644 board/imgtec/ci20/Kconfig
 create mode 100644 board/imgtec/ci20/Makefile
 create mode 100644 board/imgtec/ci20/README
 create mode 100644 board/imgtec/ci20/ci20.c
 create mode 100644 configs/ci20_defconfig
 create mode 100644 drivers/gpio/gpio-jz47xx.c
 create mode 100644 drivers/misc/jz4780_efuse.c
 create mode 100644 drivers/mmc/jz_mmc.
 create mode 100644 drivers/mmc/jz_mmc.c
 create mode 100644 include/configs/ci20.h
 create mode 100644 include/dt-bindings/clock/jz4780-cgu.h

-- 
2.20.0.rc2

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


[U-Boot] [PATCH 2/6] gpio: Add JZ47xx GPIO driver

2018-12-10 Thread Ezequiel Garcia
From: Paul Burton 

Add primitive GPIO controller driver for the JZ47xx SoC.

Cc: Daniel Schwierzeck 
Signed-off-by: Paul Burton 
Signed-off-by: Marek Vasut 
---
 drivers/gpio/Kconfig   |  7 
 drivers/gpio/Makefile  |  1 +
 drivers/gpio/gpio-jz47xx.c | 78 ++
 3 files changed, 86 insertions(+)
 create mode 100644 drivers/gpio/gpio-jz47xx.c

diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
index 35344e57c6c6..46c161c99ce9 100644
--- a/drivers/gpio/Kconfig
+++ b/drivers/gpio/Kconfig
@@ -322,4 +322,11 @@ config MT7621_GPIO
help
  Say yes here to support MediaTek MT7621 compatible GPIOs.
 
+config JZ47XX_GPIO
+   bool "Ingenic JZ47xx GPIO driver"
+   depends on ARCH_JZ47XX
+   default y
+   help
+ Supports GPIO access on Ingenic JZ47xx SoCs.
+
 endmenu
diff --git a/drivers/gpio/Makefile b/drivers/gpio/Makefile
index 7ed9a4ec4221..92310e9ba934 100644
--- a/drivers/gpio/Makefile
+++ b/drivers/gpio/Makefile
@@ -59,3 +59,4 @@ obj-$(CONFIG_MSM_GPIO)+= msm_gpio.o
 obj-$(CONFIG_$(SPL_)PCF8575_GPIO)  += pcf8575_gpio.o
 obj-$(CONFIG_PM8916_GPIO)  += pm8916_gpio.o
 obj-$(CONFIG_MT7621_GPIO)  += mt7621_gpio.o
+obj-$(CONFIG_JZ47XX_GPIO)  += gpio-jz47xx.o
diff --git a/drivers/gpio/gpio-jz47xx.c b/drivers/gpio/gpio-jz47xx.c
new file mode 100644
index ..565108192306
--- /dev/null
+++ b/drivers/gpio/gpio-jz47xx.c
@@ -0,0 +1,78 @@
+/*
+ * Ingenic JZ47xx GPIO
+ *
+ * Copyright (C) 2018 Marek Vasut 
+ *
+ * SPDX-License-Identifier:GPL-2.0+
+ */
+
+#include 
+#include 
+#include 
+#include 
+
+int gpio_get_value(unsigned gpio)
+{
+   void __iomem *gpio_regs = (void __iomem *)GPIO_BASE;
+   int port = gpio / 32;
+   int pin = gpio % 32;
+
+   return readl(gpio_regs + GPIO_PXPIN(port)) & BIT(pin);
+}
+
+int gpio_set_value(unsigned gpio, int value)
+{
+   void __iomem *gpio_regs = (void __iomem *)GPIO_BASE;
+   int port = gpio / 32;
+   int pin = gpio % 32;
+
+   if (value)
+   writel(BIT(pin), gpio_regs + GPIO_PXPAT0S(port));
+   else
+   writel(BIT(pin), gpio_regs + GPIO_PXPAT0C(port));
+
+   return 0;
+}
+
+int gpio_direction_input(unsigned gpio)
+{
+   void __iomem *gpio_regs = (void __iomem *)GPIO_BASE;
+   int port = gpio / 32;
+   int pin = gpio % 32;
+
+   writel(BIT(pin), gpio_regs + GPIO_PXINTC(port));
+   writel(BIT(pin), gpio_regs + GPIO_PXMASKS(port));
+   writel(BIT(pin), gpio_regs + GPIO_PXPAT1S(port));
+
+   return 0;
+}
+
+int gpio_direction_output(unsigned gpio, int value)
+{
+   void __iomem *gpio_regs = (void __iomem *)GPIO_BASE;
+   int port = gpio / 32;
+   int pin = gpio % 32;
+
+   writel(BIT(pin), gpio_regs + GPIO_PXINTC(port));
+   writel(BIT(pin), gpio_regs + GPIO_PXMASKS(port));
+   writel(BIT(pin), gpio_regs + GPIO_PXPAT1C(port));
+
+   gpio_set_value(gpio, value);
+
+   return 0;
+}
+
+int gpio_request(unsigned gpio, const char *label)
+{
+   int port = gpio / 32;
+
+   if (port >= 6)
+   return -EINVAL;
+
+   return 0;
+}
+
+int gpio_free(unsigned gpio)
+{
+   return 0;
+}
-- 
2.20.0.rc2

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


[U-Boot] [PATCH 1/6] misc: Add JZ47xx efuse driver

2018-12-10 Thread Ezequiel Garcia
From: Paul Burton 

Add driver for the efuse block in the JZ47xx SOC.

Cc: Daniel Schwierzeck 
Signed-off-by: Paul Burton 
Signed-off-by: Marek Vasut 
---
 drivers/misc/Kconfig|   6 +++
 drivers/misc/Makefile   |   1 +
 drivers/misc/jz4780_efuse.c | 100 
 3 files changed, 107 insertions(+)
 create mode 100644 drivers/misc/jz4780_efuse.c

diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig
index 48febc47d263..704c8dd1955f 100644
--- a/drivers/misc/Kconfig
+++ b/drivers/misc/Kconfig
@@ -120,6 +120,12 @@ config FSL_SEC_MON
  Security Monitor can be transitioned on any security failures,
  like software violations or hardware security violations.
 
+config JZ4780_EFUSE
+   bool "Ingenic JZ4780 eFUSE support"
+   depends on ARCH_JZ47XX
+   help
+ This selects support for the eFUSE on Ingenic JZ4780 SoCs.
+
 config MXC_OCOTP
bool "Enable MXC OCOTP Driver"
help
diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile
index 302d44159274..6bdf5054f475 100644
--- a/drivers/misc/Makefile
+++ b/drivers/misc/Makefile
@@ -62,3 +62,4 @@ obj-$(CONFIG_TEGRA_CAR) += tegra_car.o
 obj-$(CONFIG_TWL4030_LED) += twl4030_led.o
 obj-$(CONFIG_VEXPRESS_CONFIG) += vexpress_config.o
 obj-$(CONFIG_WINBOND_W83627) += winbond_w83627.o
+obj-$(CONFIG_JZ4780_EFUSE) += jz4780_efuse.o
diff --git a/drivers/misc/jz4780_efuse.c b/drivers/misc/jz4780_efuse.c
new file mode 100644
index ..78383f343dce
--- /dev/null
+++ b/drivers/misc/jz4780_efuse.c
@@ -0,0 +1,100 @@
+/*
+ * JZ4780 EFUSE driver
+ *
+ * Copyright (c) 2014 Imagination Technologies
+ * Author: Alex Smith 
+ *
+ * SPDX-License-Identifier:GPL-2.0+
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define EFUSE_EFUCTRL  0xd0
+#define EFUSE_EFUCFG   0xd4
+#define EFUSE_EFUSTATE 0xd8
+#define EFUSE_EFUDATA(n)   (0xdc + ((n) * 4))
+
+#define EFUSE_EFUCTRL_RD_ENBIT(0)
+#define EFUSE_EFUCTRL_LEN_BIT  16
+#define EFUSE_EFUCTRL_LEN_MASK 0x1f
+#define EFUSE_EFUCTRL_ADDR_BIT 21
+#define EFUSE_EFUCTRL_ADDR_MASK0x1ff
+#define EFUSE_EFUCTRL_CS   BIT(30)
+
+#define EFUSE_EFUCFG_RD_STROBE_BIT 16
+#define EFUSE_EFUCFG_RD_STROBE_MASK0xf
+#define EFUSE_EFUCFG_RD_ADJ_BIT20
+#define EFUSE_EFUCFG_RD_ADJ_MASK   0xf
+
+#define EFUSE_EFUSTATE_RD_DONE BIT(0)
+
+static void jz4780_efuse_read_chunk(size_t addr, size_t count, u8 *buf)
+{
+   void __iomem *regs = (void __iomem *)NEMC_BASE;
+   size_t i;
+   u32 val;
+
+   val = EFUSE_EFUCTRL_RD_EN |
+ ((count - 1) << EFUSE_EFUCTRL_LEN_BIT) |
+ (addr << EFUSE_EFUCTRL_ADDR_BIT) |
+ ((addr > 0x200) ? EFUSE_EFUCTRL_CS : 0);
+   writel(val, regs + EFUSE_EFUCTRL);
+   /* FIXME -- wait_bit() */
+   while (!(readl(regs + EFUSE_EFUSTATE) & EFUSE_EFUSTATE_RD_DONE))
+   ;
+
+   if ((count % 4) == 0) {
+   for (i = 0; i < count / 4; i++) {
+   val = readl(regs + EFUSE_EFUDATA(i));
+   put_unaligned(val, (u32 *)(buf + (i * 4)));
+   }
+   } else {
+   val = readl(regs + EFUSE_EFUDATA(0));
+   if (count > 2)
+   buf[2] = (val >> 16) & 0xff;
+   if (count > 1)
+   buf[1] = (val >> 8) & 0xff;
+   buf[0] = val & 0xff;
+   }
+}
+
+static inline int jz4780_efuse_chunk_size(size_t count)
+{
+   if (count >= 32)
+   return 32;
+   else if ((count / 4) > 0)
+   return (count / 4) * 4;
+   else
+   return count % 4;
+}
+
+void jz4780_efuse_read(size_t addr, size_t count, u8 *buf)
+{
+   size_t chunk;
+
+   while (count > 0) {
+   chunk = jz4780_efuse_chunk_size(count);
+   jz4780_efuse_read_chunk(addr, chunk, buf);
+   addr += chunk;
+   buf += chunk;
+   count -= chunk;
+   }
+}
+
+void jz4780_efuse_init(u32 ahb2_rate)
+{
+   void __iomem *regs = (void __iomem *)NEMC_BASE;
+   u32 rd_adj, rd_strobe, tmp;
+
+   rd_adj = (((6500 * (ahb2_rate / 100)) / 100) + 0xf) / 2;
+   tmp = (((35000 * (ahb2_rate / 100)) / 100) - 4) - rd_adj;
+   rd_strobe = ((tmp + 0xf) / 2 < 7) ? 7 : (tmp + 0xf) / 2;
+
+   tmp = (rd_adj << EFUSE_EFUCFG_RD_ADJ_BIT) |
+ (rd_strobe << EFUSE_EFUCFG_RD_STROBE_BIT);
+   writel(tmp, regs + EFUSE_EFUCFG);
+}
-- 
2.20.0.rc2

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


Re: [U-Boot] [PATCH 0/7] Remove defines for SPI default speed and mode

2018-12-10 Thread Adam Ford
On Mon, Dec 10, 2018 at 1:20 PM Simon Goldschmidt
 wrote:
>
> Am 10.12.2018 um 16:42 schrieb Adam Ford:
> > On Mon, Dec 10, 2018 at 4:54 AM Patrick Delaunay
> >  wrote:
> >>
> >>
> >> This patch-set finish (after the last Simmon comment)
> >> and depends on the previous serie named:
> >> "Read default speed and mode values from DT"
> >>
> >> http://patchwork.ozlabs.org/project/uboot/list/?series=76834
> >>
> >> This patchset remove the unnecessary defines for SPI speed and mode
> >> when DM mode is used for SPI (CONFIG_DM_SPI_FLASH).
> >>
> >> Build result is available for the serie in gihub and travis:
> >> https://github.com/patrickdelaunay/u-boot/tree/topic/spi
> >> https://travis-ci.org/patrickdelaunay/u-boot/branches
> >>
> >>
> > After applying both of your patches, the da850evm no longer boots from
> > SPI flash.
>
> I just did test this and it worked for me. Booting from QSPI on
> socfpga_socrates and loading something in U-Boot via sf probe/sf read, so:
> Tested-by: Simon Goldschmidt 
>
> >
> > U-Boot SPL 2019.01-rc1-00754-g21fb8c41b1 (Dec 10 2018 - 09:02:28 -0600)
> > Trying to boot from SPI
> > Warning: SPI speed fallback to 100 kHz
> >
> > [repeat in perpetuity]
> >
> > U-Boot SPL 2019.01-rc1-00754-g21fb8c41b1 (Dec 10 2018 - 09:02:28 -0600)
> > Trying to boot from SPI
> > Warning: SPI speed fallback to 100 kHz
> >
> > I then tried to apply the first patch, and it also fails booting.
> >
> > I'll reply to the original series with a similar message.  Looking at
> > the comments, it looks like the code is assuming the DM_SPI_FLASH
> > means DT when in reality, the da850evm's SPL is using platdata.  I
> > looked at the platdata structure and I didn't see entries for SPI mode
> > or speed.  However, I cannot prove this is the issue on the da850evm
> > without diving into it a bit more.
>
> Adam, from reading the da850-emv.dts and its '-u-boot.dtsi', it seems
> the fdtgrep indicators to keep the flash for the SPL dts are missing
> (compare to socfpga_cyclone5_socrates-u-boot.dtsi). In this case, the
> code does not find a flash node.
>
> The same would of course apply when using platdata.

I tried modifying the -u-boot.dtsi file to look like:

&flash {
 compatible = "m25p64", "spi-flash";
 u-boot,dm-pre-reloc;
};

Unfortunately, I not get some build errors.  Do you have any
suggestions?   I know the dtsi didn't need the "u-boot,dm-pre-reloc;"
before this patch.
 Might there be a platdata example I can follow?

The build errors as as follows:

make[2]: 'arch/arm/dts/da850-evm.dtb' is up to date.
  CAT u-boot-dtb.bin
  COPYu-boot.bin
  MKIMAGE u-boot.img
  MKIMAGE u-boot-dtb.img
  DTOC C  spl/dts/dt-platdata.c
  DTOC H  include/generated/dt-structs-gen.h
Traceback (most recent call last):
Traceback (most recent call last):
  File "./tools/dtoc/dtoc", line 109, in 
  File "./tools/dtoc/dtoc", line 109, in 
options.output)
options.output)
  File "/home/aford/src/u-boot/tools/dtoc/dtb_platdata.py", line 564,
in run_steps
  File "/home/aford/src/u-boot/tools/dtoc/dtb_platdata.py", line 564,
in run_steps
plat.scan_reg_sizes()
plat.scan_reg_sizes()
  File "/home/aford/src/u-boot/tools/dtoc/dtb_platdata.py", line 335,
in scan_reg_sizes
  File "/home/aford/src/u-boot/tools/dtoc/dtb_platdata.py", line 335,
in scan_reg_sizes
addr = fdt_util.fdt_cells_to_cpu(val[i:], reg.na)
addr = fdt_util.fdt_cells_to_cpu(val[i:], reg.na)
  File "/home/aford/src/u-boot/tools/dtoc/fdt_util.py", line 54, in
fdt_cells_to_cpu
  File "/home/aford/src/u-boot/tools/dtoc/fdt_util.py", line 54, in
fdt_cells_to_cpu
out = out << 32 | fdt32_to_cpu(val[1])
out = out << 32 | fdt32_to_cpu(val[1])
IndexErrorIndexError: : list index out of rangelist index out of range

scripts/Makefile.spl:287: recipe for target 'spl/dts/dt-platdata.c' failed
make[1]: *** [spl/dts/dt-platdata.c] Error 1
make[1]: *** Waiting for unfinished jobs
scripts/Makefile.spl:284: recipe for target
'include/generated/dt-structs-gen.h' failed
make[1]: *** [include/generated/dt-structs-gen.h] Error 1
Makefile:1591: recipe for target 'spl/u-boot-spl' failed
make: *** [spl/u-boot-spl] Error 2




>
> Regards,
> Simon
>
> >
> > adam
> >>
> >> Patrick Delaunay (7):
> >>spi: update management of default speed and mode
> >>spi: add comment for spi_flash_probe_bus_cs function
> >>da850evm: sf: Read default speed and mode values from DT
> >>dfu: sf: Read default speed and mode values from DT
> >>mips: mt76xx: gardena-smart-gateway: Read default speed and mode
> >>  values from DT
> >>env: Read default speed and mode values from DT
> >>spi: remove define for SPI default SPEED and MODE
> >>
> >>   board/davinci/da8xxevm/da850evm.c  |  7 +++
> >>   board/gardena/smart-gateway-mt7688/board.c | 24 
> >>   cmd/sf.c   | 10 ++
> >>   common/spl/spl_spi.c   | 11 ++-
> >>   common/splash_source.c

Re: [U-Boot] [PATCH 0/7] Remove defines for SPI default speed and mode

2018-12-10 Thread Simon Goldschmidt

Am 10.12.2018 um 16:42 schrieb Adam Ford:

On Mon, Dec 10, 2018 at 4:54 AM Patrick Delaunay
 wrote:



This patch-set finish (after the last Simmon comment)
and depends on the previous serie named:
"Read default speed and mode values from DT"

http://patchwork.ozlabs.org/project/uboot/list/?series=76834

This patchset remove the unnecessary defines for SPI speed and mode
when DM mode is used for SPI (CONFIG_DM_SPI_FLASH).

Build result is available for the serie in gihub and travis:
https://github.com/patrickdelaunay/u-boot/tree/topic/spi
https://travis-ci.org/patrickdelaunay/u-boot/branches



After applying both of your patches, the da850evm no longer boots from
SPI flash.


I just did test this and it worked for me. Booting from QSPI on 
socfpga_socrates and loading something in U-Boot via sf probe/sf read, so:

Tested-by: Simon Goldschmidt 



U-Boot SPL 2019.01-rc1-00754-g21fb8c41b1 (Dec 10 2018 - 09:02:28 -0600)
Trying to boot from SPI
Warning: SPI speed fallback to 100 kHz

[repeat in perpetuity]

U-Boot SPL 2019.01-rc1-00754-g21fb8c41b1 (Dec 10 2018 - 09:02:28 -0600)
Trying to boot from SPI
Warning: SPI speed fallback to 100 kHz

I then tried to apply the first patch, and it also fails booting.

I'll reply to the original series with a similar message.  Looking at
the comments, it looks like the code is assuming the DM_SPI_FLASH
means DT when in reality, the da850evm's SPL is using platdata.  I
looked at the platdata structure and I didn't see entries for SPI mode
or speed.  However, I cannot prove this is the issue on the da850evm
without diving into it a bit more.


Adam, from reading the da850-emv.dts and its '-u-boot.dtsi', it seems 
the fdtgrep indicators to keep the flash for the SPL dts are missing 
(compare to socfpga_cyclone5_socrates-u-boot.dtsi). In this case, the 
code does not find a flash node.


The same would of course apply when using platdata.

Regards,
Simon



adam


Patrick Delaunay (7):
   spi: update management of default speed and mode
   spi: add comment for spi_flash_probe_bus_cs function
   da850evm: sf: Read default speed and mode values from DT
   dfu: sf: Read default speed and mode values from DT
   mips: mt76xx: gardena-smart-gateway: Read default speed and mode
 values from DT
   env: Read default speed and mode values from DT
   spi: remove define for SPI default SPEED and MODE

  board/davinci/da8xxevm/da850evm.c  |  7 +++
  board/gardena/smart-gateway-mt7688/board.c | 24 
  cmd/sf.c   | 10 ++
  common/spl/spl_spi.c   | 11 ++-
  common/splash_source.c | 11 ++-
  drivers/dfu/dfu_sf.c   | 10 --
  env/Kconfig|  4 ++--
  env/sf.c   |  5 -
  include/spi_flash.h| 18 ++
  9 files changed, 77 insertions(+), 23 deletions(-)

--
2.7.4



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


Re: [U-Boot] [PATCH 0/7] Remove defines for SPI default speed and mode

2018-12-10 Thread Adam Ford
On Mon, Dec 10, 2018 at 4:54 AM Patrick Delaunay
 wrote:
>
>
> This patch-set finish (after the last Simmon comment)
> and depends on the previous serie named:
> "Read default speed and mode values from DT"
>
> http://patchwork.ozlabs.org/project/uboot/list/?series=76834
>
> This patchset remove the unnecessary defines for SPI speed and mode
> when DM mode is used for SPI (CONFIG_DM_SPI_FLASH).
>
> Build result is available for the serie in gihub and travis:
> https://github.com/patrickdelaunay/u-boot/tree/topic/spi
> https://travis-ci.org/patrickdelaunay/u-boot/branches
>
>
After applying both of your patches, the da850evm no longer boots from
SPI flash.

U-Boot SPL 2019.01-rc1-00754-g21fb8c41b1 (Dec 10 2018 - 09:02:28 -0600)
Trying to boot from SPI
Warning: SPI speed fallback to 100 kHz

[repeat in perpetuity]

U-Boot SPL 2019.01-rc1-00754-g21fb8c41b1 (Dec 10 2018 - 09:02:28 -0600)
Trying to boot from SPI
Warning: SPI speed fallback to 100 kHz

I then tried to apply the first patch, and it also fails booting.

I'll reply to the original series with a similar message.  Looking at
the comments, it looks like the code is assuming the DM_SPI_FLASH
means DT when in reality, the da850evm's SPL is using platdata.  I
looked at the platdata structure and I didn't see entries for SPI mode
or speed.  However, I cannot prove this is the issue on the da850evm
without diving into it a bit more.

adam
>
> Patrick Delaunay (7):
>   spi: update management of default speed and mode
>   spi: add comment for spi_flash_probe_bus_cs function
>   da850evm: sf: Read default speed and mode values from DT
>   dfu: sf: Read default speed and mode values from DT
>   mips: mt76xx: gardena-smart-gateway: Read default speed and mode
> values from DT
>   env: Read default speed and mode values from DT
>   spi: remove define for SPI default SPEED and MODE
>
>  board/davinci/da8xxevm/da850evm.c  |  7 +++
>  board/gardena/smart-gateway-mt7688/board.c | 24 
>  cmd/sf.c   | 10 ++
>  common/spl/spl_spi.c   | 11 ++-
>  common/splash_source.c | 11 ++-
>  drivers/dfu/dfu_sf.c   | 10 --
>  env/Kconfig|  4 ++--
>  env/sf.c   |  5 -
>  include/spi_flash.h| 18 ++
>  9 files changed, 77 insertions(+), 23 deletions(-)
>
> --
> 2.7.4
>
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 6/7] doc: android: Add simple guide for A/B updates

2018-12-10 Thread Ruslan Trofymenko
Hi Simon,

On Thu, 6 Dec 2018 at 03:31, Simon Glass  wrote:
>
> Hi,
>
> On Tue, 27 Nov 2018 at 12:57, Ruslan Trofymenko
>  wrote:
> >
> > Add a short documentation for A/B enablement and 'android_ab_select'
> > command usage.
> >
> > Signed-off-by: Ruslan Trofymenko 
> > ---
> >  doc/README.android-ab | 67 
> > +++
> >  1 file changed, 67 insertions(+)
> >  create mode 100644 doc/README.android-ab
> >
> > diff --git a/doc/README.android-ab b/doc/README.android-ab
> > new file mode 100644
> > index 000..230088c
> > --- /dev/null
> > +++ b/doc/README.android-ab
> > @@ -0,0 +1,67 @@
> > +Android A/B updates
> > +===
> > +
> > +Overview
> > +
> > +
> > +A/B system updates ensures modern approach for system update. This feature
> > +allows one to use two sets (or more) of partitions referred to as slots
> > +(normally slot A and slot B). The system runs from the current slot while 
> > the
> > +partitions in the unused slot can be updated [1].
> > +
> > +A/B enablement
> > +--
> > +
> > +The A/B updates support can be activated by specifying next options in
> > +your board configuration file:
> > +
> > +CONFIG_ANDROID_AB=y
> > +CONFIG_CMD_ANDROID_AB_SELECT=y
> > +
> > +The disk space on target device must be partitioned in a way so that each
> > +partition which needs to be updated has two or more instances. The name of
> > +each instance must be formed by adding suffixes: _a, _b, _c, etc.
> > +For example: boot_a, boot_b, system_a, system_b, vendor_a, vendor_b.
> > +
> > +As a result you can use 'android_ab_select' command to ensure A/B boot 
> > process
> > +in your boot script. This command analyzes and processes A/B metadata 
> > stored
> > +on a special partition (e.g. "misc") and determines which slot should be 
> > used
> > +for booting up.
> > +
> > +Command usage
> > +-
> > +
> > +android_ab_select   
> > 
>
> Can we have a shorter command?
>
> Perhaps we need a new 'android' command with an 'ab_select'
> subcommand? Then the automatica abbreviation will work.
>

Agree with all your previous comments, will send v2 shortly. But this
one I'd like to leave as is (I will drop android_ prefix though). I
think adding "android" command may lead to unneeded architecture
complexity in future, e.g.:
  - we will need to re-work next commands as sub-commands of "android"
command: fastboot, dtimg, mmc_swrite (which can be hard as ab_select
command file has BSD license and other commands have GPL license)
 - we will need to implement sub-sub-commands (e.g. for "android dtimg
dump ..." etc.)
 - having "android" command can be inconvenient for users and may
break existing API (e.g. it will force users to use "android fastboot"
instead of just "fastboot" command)
 - actually I don't see any namespace issues that can be solved by
adding "android" command

Also, in subsequent patch, I will add the dedicated menu option for
Android-related commands and will pull all existing Android commands
(along with ab_select) to that menu entry.

So I hope it's fine with you if I leave this command as "ab_select"?

Thanks.

> > +
> > +for example:
> > +
> > +=> android_ab_select slot_name mmc 1:4
> > +
> > +or
> > +
> > +=> android_ab_select slot_name mmc 1#misc
> > +
> > +Result:
> > +
> > +=> printenv slot_name
> > +slot_name=a
> > +
> > +Based on this slot information, the current boot partition should be 
> > defined,
> > +and next kernel command line parameters should be generated:
> > +
> > + - androidboot.slot_suffix=
> > + - root=
> > +
> > +For example:
> > +
> > +androidboot.slot_suffix=_a root=/dev/mmcblk1p12
> > +
> > +A/B metadata is organized according to AOSP reference [2]. On the first 
> > system
> > +start with A/B enabled, when 'misc' partition doesn't contain required 
> > data,
> > +the default A/B metadata will be created and written to 'misc' partition.
> > +
> > +References
> > +--
> > +
> > +[1] https://source.android.com/devices/tech/ota/ab
> > +[2] 
> > bootable/recovery/bootloader_message/include/bootloader_message/bootloader_message.h
> > --
> > 2.7.4
> >
>
> Regards,
> Simon
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] Regression: dm: i2c: Make i2c_get_chip_for_busnum() fail if the chip is not detected

2018-12-10 Thread Stephen Warren

The following commit:


dm: i2c: Make i2c_get_chip_for_busnum() fail if the chip is not detected

i2c_get_chip_for_busnum() really should check the presence of the chip on

the bus. Most of the users of this function assume that this is done.


... causes a boot failure on NVIDIA Jetson TX2:


U-Boot 2019.01-rc1-00220-g7ff485c68b7e (Dec 10 2018 - 11:20:41 -0700)

TEGRA186
Model: NVIDIA P2771--500
DRAM:  7.8 GiB
tegra_ivc_read_get_next_frame() timed out (-12)
tegra_board_init: Cannot find MAX77620 I2C chip
initcall sequence fffa95a8 failed at call 80083480 (err=-110)
### ERROR ### Please RESET the board ###


This may be due to the fact the bus in question is implemented by RPC to 
a separate CPU, and that mechanism hasn't been used with probing before. 
In general though, there's not guarantee that probing will work even on 
a local/native I2C bus, since different chips don't support all probe 
methods (see i2c-detect in Linux, which supports various different 
probing methods due to this), so I'm rather surprised this change was 
implemented. Is it really necessary? I believe we should revert it.


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


Re: [U-Boot] [PATCH v2] rockchip: rk3288-evb: dts: remove 'vmmc' from emmc node

2018-12-10 Thread Tom Rini
On Sat, Dec 08, 2018 at 12:27:42PM +0800, Kever Yang wrote:
> Hi Tom,
> 
> 
> On 12/07/2018 10:13 PM, Tom Rini wrote:
> > On Fri, Dec 07, 2018 at 02:24:22PM +0100, Philipp Tomsich wrote:
> >> Kever,
> >>
> >>> On 07.12.2018, at 02:39, Kever Yang  wrote:
> >>>
> >>> Hi Philipp,
> >>>
> >>> On 12/06/2018 09:50 PM, Philipp Tomsich wrote:
>  +Tom
> 
> > On 05.12.2018, at 03:25, Kever Yang  wrote:
> >
> > The U-Boot eMMC does not need to care about the power for Rockchip
> > SoC, because if the board is using eMMC, the power will default on
> > (for bootrom), and we do not do power management for it like kernel,
> > so the 'vmmc', 'vqmmc' is only useful for SD in U-Boot.
> >
> > This make U-Boot can boot into kernel even if the pmic driver is
> > broken.
>  If the PMIC driver is broken, we should fix the PMIC driver.
>  I would feel more comfortable w/o this statement.
> 
> > The rk3288-evb dts may be used in many boards using rockchip reference
> > schematic but with little change, so we hope it can be more robust to
> > boot into next stage.
>  Again, this is not how the DTS should be used.  I believe that Heiko, 
>  Fabio and
>  I had already highlighted this in comments to the earlier thread.
> >>> Not sure if you have read my previous mail for answer all your 
> >>> comments,
> >>>
> >>> I do agree DTS should represent the hardware, but please note that the DTS
> >>> is no kind of standard, and people always choose what they need and add
> >>> those part in there dts, but not always add all the property and
> >>> everyone use the same model. I would say there are many boards does not 
> >>> have this
> >>> 'vmmc-supply’ in there emmc node.
> >> That is exactly the reason why I bumped the decision up the stairs (to Tom 
> >> and/or
> >> Simon): what you are saying makes sense to me (viewed through your eyes 
> >> and 
> >> from your specific usecase), but it directly contradicts how the DTS usage 
> >> is intended.
> >>
> >> In other words: Tom (as the top-level decision maker) or Simon (who owns 
> >> the 
> >> device-model and therefore will also have an opinion on DTS usage) should 
> >> make
> >> the final call.
> > My answer is that I would strongly suspect that over in linux "we have N
> > different close-enough boards using this one DTS" isn't acceptable.  You
> > make a dtsi and include it from the board and things that aren't common
> > don't go into the dtsi.  And yes, when starting off everyone (myself
> > included) copies the reference platform dts and then changes it as
> > needed, and sometimes misses a thing or two.  But no, I don't think we
> > want a wrong dts and I'm pretty sure the kernel really wouldn't want
> > wrong dts files and the general goal is that excluding the -u-boot.dtsi
> > files, ours are copies of the kernel.
> I don't think this is a "wrong dts" after my patch, these two nodes are
> not mark
> as required property in kernel, so many dts emmc node does not have it.
> I check the latest kernel dtsi in arch/arm/boot/dts/rk3288-evb.dtsi [1],
> the emmc node do not have 'vmmc' and 'vqmmc' while the SD node have, which
> just like description in my commit message.

OK.  So this would fall into the category of "sync with upstream dts"
then, right?  That is what we want.

> Well, I don't know why U-Boot project is so difficult to accept a
> reasonable patch now, I don't
> want to make you unhappy, but make 'every board must have its own dts'
> in U-Boot to make
> every developer to join U-Boot does not make sense to me. The kernel
> need different
> dts for different board because they need to use/control those different
> feature, but U-Boot
> is not the case, U-Boot should work if the storage driver works.

Well, here's the thing.  If you want U-Boot to then load and pass the
correct DTB to the kernel, we need per-board tweaks to the code anyhow
to find and load that DTB (see the various "findfdt" environment scripts
for example).  If you want to rework things so that you have a "generic"
type board under U-Boot that's more clearly not tied to any specific
board but instead runs on many, that might help clear things up too.
Hope this helps!

-- 
Tom


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


Re: [U-Boot] [PATCH v4 12/25] mtd: ensure MTD and NOR drivers are compiled with ENV_IS_IN_FLASH

2018-12-10 Thread Tom Rini
On Mon, Dec 10, 2018 at 07:02:45PM +0100, Miquel Raynal wrote:
> Hello,
> 
> Miquel Raynal  wrote on Sun,  9 Dec 2018
> 19:07:34 +0100:
> 
> > MTD and NOR flash support must be enabled when the environment is in
> > NOR.
> > 
> > Signed-off-by: Miquel Raynal 
> > ---
> >  configs/armadillo-800eva_defconfig | 2 ++
> >  1 file changed, 2 insertions(+)
> > 
> > diff --git a/configs/armadillo-800eva_defconfig 
> > b/configs/armadillo-800eva_defconfig
> > index b1d923c069..72758884b4 100644
> > --- a/configs/armadillo-800eva_defconfig
> > +++ b/configs/armadillo-800eva_defconfig
> > @@ -32,6 +32,8 @@ CONFIG_CMD_PING=y
> >  # CONFIG_CMD_MISC is not set
> >  CONFIG_ENV_IS_IN_FLASH=y
> >  # CONFIG_MMC is not set
> > +CONFIG_MTD=y
> > +CONFIG_MTD_NOR_FLASH=y
> >  CONFIG_SH_ETHER=y
> >  CONFIG_SCIF_CONSOLE=y
> >  CONFIG_OF_LIBFDT=y
> 
> This change triggered a build failure. This is because, despite
> declaring an in-flash environment, there was absolutely no MTD driver
> compiled-in. No driver named after 'flash' or 'nor' or 'mtd' was
> compiled.
> 
> The fix for this issue (the only one reported by Travis for this
> version of the series) is to just drop this patch. As it has absolutely
> no dependency and only impacts a single defconfig, I would rather
> prefer not re-send 24 identical patches in a v5 unless there are
> comments that I must address.

Thanks.  Do you have a patchwork account?  If so you should be able to
manage the status of your own at least and marking it as "Rejected" or
"Not Applicable" or anything like that will mean it won't be picked up
by accident.  If not, I'll get to it soon.

-- 
Tom


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


[U-Boot] [GIT PULL] u-boot-mips

2018-12-10 Thread Daniel Schwierzeck
Hi Tom,

please pull some fixes for MIPS BCM platforms.

Would you accept another pull request from u-boot-mips/next with the BMIPS part
of the original series "dma: add channels support"? The changes are isolated to
BMIPS platform and it would add a user for the new DMA channel support.



The following changes since commit cde578ff36b15ec9c2033f03b94ecf809af7cc64:

  ARM: mvebu: restore license information in mv_ddr_plat.{c,h} (2018-12-09 
17:10:13 -0500)

are available in the Git repository at:

  git://git.denx.de/u-boot-mips.git tags/mips-fixes-for-2019.01

for you to fetch changes up to 1410708eeb310e74af23dbee53a7774038cb3918:

  bmips: bcm6838: fix device tree warning (2018-12-10 18:47:13 +0100)


- mips: bcm: disable CONFIG_SWAP_IO_SPACE to force native endianess in readl() 
& co.
  this fixes 09ace9161b95ad3a04b33d1d6a65a929901d28c8
- mips: bcm6838: fix device tree warning


Álvaro Fernández Rojas (2):
  bmips: swapping IO space isn't required
  bmips: bcm6838: fix device tree warning

 arch/mips/dts/brcm,bcm6838.dtsi |  2 --
 arch/mips/mach-bmips/Kconfig| 10 --
 2 files changed, 12 deletions(-)
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [RFC PATCH v2 00/11] SF: Migrate to Linux SPI NOR framework

2018-12-10 Thread Miquel Raynal
Hi Vignesh,

Vignesh R  wrote on Mon, 10 Dec 2018 23:08:38 +0530:

> On 10-Dec-18 6:32 PM, Jagan Teki wrote:
> > On Thu, Dec 6, 2018 at 11:55 PM Vignesh R  wrote:  
> >>
> >> Hi Jagan,
> >>
> >> On 06-Dec-18 10:44 PM, Jagan Teki wrote:  
> >>> On Tue, Dec 4, 2018 at 5:56 PM Vignesh R  wrote:  
> 
>  U-Boot SPI NOR support (sf layer) is quite outdated as it does not
>  support 4 byte addressing opcodes, SFDP table parsing and different 
>  types of
>  quad mode enable sequences. Many newer flashes no longer support BANK
>  registers used by sf layer to a access >16MB space.
>  Also, many SPI controllers have special MMIO interfaces which provide
>  accelerated read/write access but require knowledge of flash parameters
>  to make use of it. Recent spi-mem layer provides a way to support such
>  flashes but sf layer isn't using that.
>  This patch series syncs SPI NOR framework from Linux v4.19. It also adds
>  spi-mem support on top.
>  So, we gain 4byte addressing support and SFDP support. This makes
>  migrating to U-Boot MTD framework easier.  
> >>>
> >>> We(someone) has proposed this sync before, but we(at-least I) rely on
> >>> implementing via DM not direct sync to Linux.  
> >>
> >> As I said in my cover letter, U-Boot sf layer is unable to support newer
> >> flashes mainly due to lack of 4 byte addressing and proper support for
> >> MMIO capable SPI controllers.
> >> My idea of fixing this is to borrow _features_ from Linux SPI NOR "as
> >> is". All that's needed is stateless 4 byte addressing, SFDP
> >> parsing(optionally), Quad/Octal support and spi-mem like abstraction for
> >> MMIO capable Controllers. I see no point in re-coding them from ground up.
> >>
> >> Could you be more specific on what you would like to see here in DM way?
> >> I have no issues in adapting this code to any framework here in U-Boot.
> >> Linux has driver model and SPI NOR subsystem is a framework and
> >> therefore any code ported from Linux will inherently have those
> >> abstractions. The only difference I see wrt your code in branch below vs
> >> this series is SPI-NOR uclass. This can be easily achieved by moving
> >> nor->ops out of struct spi_nor into uclass abstraction.
> >> Upstream Linux is anyways merging m25p80 and spi-nor so I did not see a
> >> need for SPI NOR uclass. I am okay to change that if you insist on
> >> having it.  
> > 
> > Merging or syncing spi-nor features stuff from Linux is good, I'm not
> > stopping that. but this can be do by satisfying u-boot driver-model
> > with proper architectural model. I know you take care but I'm not sure
> > ie what can be manageable for long term.
> > 
> > Let's discuss the proper architectural model, so-that we can move
> > further to incorporate the changes accordingly. (thanks at last we
> > have a thread to discuss)
> > 
> > Linux m25p80 is moved to spi-nor right? so does controllers on spi-nor
> > should be reside in same area like drivers/mtd/spi-nor or it should be
> > part of spi-mem. The last mail with  Boris, noted all spi-nor can't be
> > fit into spi-mem(sorry I lost the thread)
> >   
> 
> Yes, ATM all drivers fit into spi/spi-mem APIs and don't see any need
> for new spi-nor uclass
> 
> 
> > Example: we have zynq qspi it support BAR(with >16MB flashes), dual
> > qspi ect so does it comes under spi-mem or spi-nor?
> >   
> 
> In current mainline U-Boot, I see _no_ users of flags:
> SF_DUAL_STACKED_FLASH and SF_DUAL_PARALLEL_FLASH
> (I don't see flash->dual_flash set to any of the above enums).
> But if we do need to support such flashes in future, current address
> translation logic can be added to spi-nor.c (based on a DT flag), along
> with a way to pass this info via spi-mem ops.
> I would suggest to look at spi-mem ops (and in Linux mainline as well),
> if there are any shortcomings we can discuss here.
> 
> > So, if no driver should be part of spi-nor and all can be handle
> > spi-mem even-though they have controller specific features, yes we can
> > skip SPI_NOR_UCLASS otherwise we need spi-nor uclass that can be child
> > uclass of MTD.
> >   
> 
> In fact, after this series is merged, UCLASS_SPI_FLASH can be dropped
> and we can move to spi-nor(and sf_dataflash.c) directly under
> UCLASS_MTD. But, mostly likely would need to provide a lightweight MTD
> for SPL (similar to spi-nor-tiny.c) before that can be done.

That would be great!


Thanks,
Miquèl
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH] bmips: swapping IO space isn't required

2018-12-10 Thread Daniel Schwierzeck


Am 09.12.18 um 10:41 schrieb Álvaro Fernández Rojas:
> Signed-off-by: Álvaro Fernández Rojas 
> ---
>  arch/mips/mach-bmips/Kconfig | 10 --
>  1 file changed, 10 deletions(-)
> 

applied to u-boot-mips/fixes, thanks.

-- 
- Daniel



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


Re: [U-Boot] [PATCH] bmips: bcm6838: fix device tree warning

2018-12-10 Thread Daniel Schwierzeck


Am 10.12.18 um 17:42 schrieb Álvaro Fernández Rojas:
> Signed-off-by: Álvaro Fernández Rojas 
> ---
>  arch/mips/dts/brcm,bcm6838.dtsi | 2 --
>  1 file changed, 2 deletions(-)
> 

applied to u-boot-mips/fixes, thanks.

-- 
- Daniel



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


Re: [U-Boot] [PATCH v4 12/25] mtd: ensure MTD and NOR drivers are compiled with ENV_IS_IN_FLASH

2018-12-10 Thread Miquel Raynal
Hello,

Miquel Raynal  wrote on Sun,  9 Dec 2018
19:07:34 +0100:

> MTD and NOR flash support must be enabled when the environment is in
> NOR.
> 
> Signed-off-by: Miquel Raynal 
> ---
>  configs/armadillo-800eva_defconfig | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/configs/armadillo-800eva_defconfig 
> b/configs/armadillo-800eva_defconfig
> index b1d923c069..72758884b4 100644
> --- a/configs/armadillo-800eva_defconfig
> +++ b/configs/armadillo-800eva_defconfig
> @@ -32,6 +32,8 @@ CONFIG_CMD_PING=y
>  # CONFIG_CMD_MISC is not set
>  CONFIG_ENV_IS_IN_FLASH=y
>  # CONFIG_MMC is not set
> +CONFIG_MTD=y
> +CONFIG_MTD_NOR_FLASH=y
>  CONFIG_SH_ETHER=y
>  CONFIG_SCIF_CONSOLE=y
>  CONFIG_OF_LIBFDT=y

This change triggered a build failure. This is because, despite
declaring an in-flash environment, there was absolutely no MTD driver
compiled-in. No driver named after 'flash' or 'nor' or 'mtd' was
compiled.

The fix for this issue (the only one reported by Travis for this
version of the series) is to just drop this patch. As it has absolutely
no dependency and only impacts a single defconfig, I would rather
prefer not re-send 24 identical patches in a v5 unless there are
comments that I must address.

Travis build for the same series without this patch is there:
https://travis-ci.org/miquelraynal/u-boot/builds/466033792

Thanks,
Miquèl
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v2 20/22] dm: sound: max98095: Tidy up error codes

2018-12-10 Thread Simon Glass
Return a valid error code instead of -1.

Signed-off-by: Simon Glass 
---

Changes in v2:
- Add new patch to tidy up error codes in max98095

 drivers/sound/max98095.c | 47 
 1 file changed, 23 insertions(+), 24 deletions(-)

diff --git a/drivers/sound/max98095.c b/drivers/sound/max98095.c
index 624c5d24ef3..99c0e996b4f 100644
--- a/drivers/sound/max98095.c
+++ b/drivers/sound/max98095.c
@@ -46,7 +46,7 @@ static int rate_value(int rate, u8 *value)
}
*value = 1;
 
-   return -1;
+   return -EINVAL;
 }
 
 /*
@@ -56,7 +56,7 @@ static int rate_value(int rate, u8 *value)
  * @param rate Sampling rate
  * @param bits_per_sample  Bits per sample
  *
- * @return -1 for error  and 0  Success.
+ * @return 0 for success or negative error code.
  */
 static int max98095_hw_params(struct maxim_priv *priv,
  enum en_max_audio_interface aif_id,
@@ -89,13 +89,13 @@ static int max98095_hw_params(struct maxim_priv *priv,
default:
debug("%s: Illegal bits per sample %d.\n",
  __func__, bits_per_sample);
-   return -1;
+   return -EINVAL;
}
 
if (rate_value(rate, ®val)) {
debug("%s: Failed to set sample rate to %d.\n",
  __func__, rate);
-   return -1;
+   return -EINVAL;
}
priv->rate = rate;
 
@@ -112,7 +112,7 @@ static int max98095_hw_params(struct maxim_priv *priv,
 
if (error < 0) {
debug("%s: Error setting hardware params.\n", __func__);
-   return -1;
+   return -EIO;
}
 
return 0;
@@ -124,7 +124,7 @@ static int max98095_hw_params(struct maxim_priv *priv,
  * @param priv max98095 information
  * @param freq Sampling frequency in Hz
  *
- * @return -1 for error and 0 success.
+ * @return 0 for success or negative error code.
  */
 static int max98095_set_sysclk(struct maxim_priv *priv, unsigned int freq)
 {
@@ -147,13 +147,13 @@ static int max98095_set_sysclk(struct maxim_priv *priv, 
unsigned int freq)
error = maxim_i2c_write(priv, M98095_026_SYS_CLK, 0x30);
} else {
debug("%s: Invalid master clock frequency\n", __func__);
-   return -1;
+   return -EINVAL;
}
 
debug("%s: Clock at %uHz\n", __func__, freq);
 
if (error < 0)
-   return -1;
+   return -EIO;
 
priv->sysclk = freq;
return 0;
@@ -166,7 +166,7 @@ static int max98095_set_sysclk(struct maxim_priv *priv, 
unsigned int freq)
  * @param fmt  i2S format - supports a subset of the options defined
  * in i2s.h.
  *
- * @return -1 for error and 0  Success.
+ * @return 0 for success or negative error code.
  */
 static int max98095_set_fmt(struct maxim_priv *priv, int fmt,
enum en_max_audio_interface aif_id)
@@ -209,7 +209,7 @@ static int max98095_set_fmt(struct maxim_priv *priv, int 
fmt,
case SND_SOC_DAIFMT_CBM_CFS:
default:
debug("%s: Clock mode unsupported\n", __func__);
-   return -1;
+   return -EINVAL;
}
 
switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) {
@@ -220,7 +220,7 @@ static int max98095_set_fmt(struct maxim_priv *priv, int 
fmt,
break;
default:
debug("%s: Unrecognized format.\n", __func__);
-   return -1;
+   return -EINVAL;
}
 
switch (fmt & SND_SOC_DAIFMT_INV_MASK) {
@@ -237,7 +237,7 @@ static int max98095_set_fmt(struct maxim_priv *priv, int 
fmt,
break;
default:
debug("%s: Unrecognized inversion settings.\n", __func__);
-   return -1;
+   return -EINVAL;
}
 
error |= maxim_bic_or(priv, M98095_DAI_FORMAT,
@@ -248,7 +248,7 @@ static int max98095_set_fmt(struct maxim_priv *priv, int 
fmt,
 
if (error < 0) {
debug("%s: Error setting i2s format.\n", __func__);
-   return -1;
+   return -EIO;
}
 
return 0;
@@ -258,7 +258,7 @@ static int max98095_set_fmt(struct maxim_priv *priv, int 
fmt,
  * resets the audio codec
  *
  * @param priv Private data for driver
- * @return -1 for error and 0 success.
+ * @return 0 for success or negative error code.
  */
 static int max98095_reset(struct maxim_priv *priv)
 {
@@ -299,22 +299,21 @@ static int max98095_reset(struct maxim_priv *priv)
  * Intialise max98095 codec device
  *
  * @param priv max98095 information
- *
- * @returns -1 for error  and 0 Success.
+ * @return 0 for success or negative error code.
  */
 static int max98095_device_init(struct maxim_priv *priv)
 {
unsigned char id;
-   int error = 0;
+   int ret;
 
/* Enable codec clock */
set_xclkout

[U-Boot] [PATCH v2 16/22] dm: sandbox: sound: Convert to use driver model

2018-12-10 Thread Simon Glass
Update sandbox's device tree and config to use driver model for sound. Use
the double buffer for sound output so that we don't need to wait for the
sound to complete before returning.

Signed-off-by: Simon Glass 
---

Changes in v2:
- Add new patch to convert sandbox to use driver model

 arch/sandbox/cpu/sdl.c | 36 ++
 arch/sandbox/dts/sandbox.dts   | 21 
 arch/sandbox/include/asm/sdl.h |  8 
 3 files changed, 53 insertions(+), 12 deletions(-)

diff --git a/arch/sandbox/cpu/sdl.c b/arch/sandbox/cpu/sdl.c
index 4dacdbf993f..8fc7c172e3a 100644
--- a/arch/sandbox/cpu/sdl.c
+++ b/arch/sandbox/cpu/sdl.c
@@ -4,6 +4,7 @@
  */
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -40,6 +41,7 @@ static struct sdl_info {
bool inited;
int cur_buf;
struct buf_info buf[2];
+   bool running;
 } sdl;
 
 static void sandbox_sdl_poll_events(void)
@@ -331,6 +333,7 @@ int sandbox_sdl_sound_init(void)
sdl.audio_active = true;
sdl.sample_rate = wanted.freq;
sdl.cur_buf = 0;
+   sdl.running = 0;
 
return 0;
 
@@ -340,27 +343,36 @@ err:
return -1;
 }
 
-int sandbox_sdl_sound_start(uint frequency)
+int sandbox_sdl_sound_play(const void *data, uint size)
 {
-   struct buf_info *buf = &sdl.buf[0];
+   struct buf_info *buf;
 
-   if (!sdl.audio_active)
-   return -1;
-   sdl.frequency = frequency;
-   sound_create_square_wave(sdl.sample_rate, (unsigned short *)buf->data,
-buf->alloced, frequency);
+   buf = &sdl.buf[0];
+   if (buf->size)
+   buf = &sdl.buf[1];
+   while (buf->size)
+   usleep(1000);
+
+   if (size > buf->alloced)
+   return -E2BIG;
+
+   memcpy(buf->data, data, size);
+   buf->size = size;
buf->pos = 0;
-   buf->size = buf->alloced;
-   SDL_PauseAudio(0);
+   if (!sdl.running) {
+   SDL_PauseAudio(0);
+   sdl.running = 1;
+   }
 
return 0;
 }
 
 int sandbox_sdl_sound_stop(void)
 {
-   if (!sdl.audio_active)
-   return -1;
-   SDL_PauseAudio(1);
+   if (sdl.running) {
+   SDL_PauseAudio(1);
+   sdl.running = 0;
+   }
 
return 0;
 }
diff --git a/arch/sandbox/dts/sandbox.dts b/arch/sandbox/dts/sandbox.dts
index ce3c88c221d..ae3189ec8cf 100644
--- a/arch/sandbox/dts/sandbox.dts
+++ b/arch/sandbox/dts/sandbox.dts
@@ -18,6 +18,11 @@
stdout-path = "/serial";
};
 
+   audio: audio-codec {
+   compatible = "sandbox,audio-codec";
+   #sound-dai-cells = <1>;
+   };
+
cros_ec: cros-ec {
reg = <0 0>;
u-boot,dm-pre-reloc;
@@ -127,6 +132,11 @@
};
};
 
+   i2s: i2s {
+   compatible = "sandbox,i2s";
+   #sound-dai-cells = <1>;
+   };
+
lcd {
u-boot,dm-pre-reloc;
compatible = "sandbox,lcd-sdl";
@@ -190,6 +200,17 @@
compatible = "sandbox,reset";
};
 
+   sound {
+   compatible = "sandbox,sound";
+   cpu {
+   sound-dai = <&i2s 0>;
+   };
+
+   codec {
+   sound-dai = <&audio 0>;
+   };
+   };
+
spi@0 {
u-boot,dm-pre-reloc;
#address-cells = <1>;
diff --git a/arch/sandbox/include/asm/sdl.h b/arch/sandbox/include/asm/sdl.h
index 1c4380c592a..0143ed9e621 100644
--- a/arch/sandbox/include/asm/sdl.h
+++ b/arch/sandbox/include/asm/sdl.h
@@ -68,6 +68,14 @@ int sandbox_sdl_sound_start(uint frequency);
  */
 int sandbox_sdl_sound_stop(void);
 
+/**
+ * sandbox_sdl_sound_play() - Play a sound
+ *
+ * @data:  Data to play (typically 16-bit)
+ * @count: Number of bytes in data
+ */
+int sandbox_sdl_sound_play(const void *data, uint count);
+
 /**
  * sandbox_sdl_sound_init() - set up the sound system
  *
-- 
2.20.0.rc2.403.gdbc3b29805-goog

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


Re: [U-Boot] [PATCH v3] pinctrl: mscc: Add gpio and pinctrl driver for MSCC MIPS SoCs (VcoreIII based)

2018-12-10 Thread Daniel Schwierzeck


Am 08.12.18 um 09:59 schrieb Gregory CLEMENT:
> This driver supports the pin and gpio controller found in the Ocelot and
> Luton SoCs.
> 
> The driver was inspired from the pinctrl driver in Linux, but was
> simplified and was modified to allow supporting an other SoCs (Luton).
> 
> For Ocelot and Luton the controller is the same, only the pins to program
> differ.
> 
> Signed-off-by: Gregory CLEMENT 
> ---
> Hi,
> 
> I sent the second version _2_ months ago and did not get
> anyfeedback. I hope this patch could be merge soon.
> 
> Thanks!
> 
> Changelog:
> v2 -> v3:
>  - fix the return value of mscc_gpio_get_direction (reported by Lars
>Povlsen)
> 
> v1 -> v2:
>  - use clrbits and setbits from MIPS
>  - use const and static when needed
>  - fix style
>  - use dev_remap_addr
> 
> drivers/pinctrl/Kconfig   |   1 +
>  drivers/pinctrl/Makefile  |   1 +
>  drivers/pinctrl/mscc/Kconfig  |  22 +++
>  drivers/pinctrl/mscc/Makefile |   5 +
>  drivers/pinctrl/mscc/mscc-common.c| 236 ++
>  drivers/pinctrl/mscc/mscc-common.h|  51 ++
>  drivers/pinctrl/mscc/pinctrl-luton.c  | 172 +++
>  drivers/pinctrl/mscc/pinctrl-ocelot.c | 188 
>  8 files changed, 676 insertions(+)
>  create mode 100644 drivers/pinctrl/mscc/Kconfig
>  create mode 100644 drivers/pinctrl/mscc/Makefile
>  create mode 100644 drivers/pinctrl/mscc/mscc-common.c
>  create mode 100644 drivers/pinctrl/mscc/mscc-common.h
>  create mode 100644 drivers/pinctrl/mscc/pinctrl-luton.c
>  create mode 100644 drivers/pinctrl/mscc/pinctrl-ocelot.c

Reviewed-by: Daniel Schwierzeck 

one nit below, but I can fix it when applying

> 
> diff --git a/drivers/pinctrl/Kconfig b/drivers/pinctrl/Kconfig
> index ad0b8daba6..cc82f91579 100644
> --- a/drivers/pinctrl/Kconfig
> +++ b/drivers/pinctrl/Kconfig
> @@ -305,6 +305,7 @@ source "drivers/pinctrl/nxp/Kconfig"
>  source "drivers/pinctrl/renesas/Kconfig"
>  source "drivers/pinctrl/uniphier/Kconfig"
>  source "drivers/pinctrl/exynos/Kconfig"
> +source "drivers/pinctrl/mscc/Kconfig"
>  source "drivers/pinctrl/mvebu/Kconfig"
>  source "drivers/pinctrl/broadcom/Kconfig"
>  
> diff --git a/drivers/pinctrl/Makefile b/drivers/pinctrl/Makefile
> index a3a6c6d163..2461dba293 100644
> --- a/drivers/pinctrl/Makefile
> +++ b/drivers/pinctrl/Makefile
> @@ -16,6 +16,7 @@ obj-$(CONFIG_PINCTRL_UNIPHIER)  += uniphier/
>  obj-$(CONFIG_PINCTRL_PIC32)  += pinctrl_pic32.o
>  obj-$(CONFIG_PINCTRL_EXYNOS) += exynos/
>  obj-$(CONFIG_PINCTRL_MESON)  += meson/
> +obj-y+= mscc/
>  obj-$(CONFIG_ARCH_MVEBU) += mvebu/
>  obj-$(CONFIG_PINCTRL_SINGLE) += pinctrl-single.o
>  obj-$(CONFIG_PINCTRL_STI)+= pinctrl-sti.o
> diff --git a/drivers/pinctrl/mscc/Kconfig b/drivers/pinctrl/mscc/Kconfig
> new file mode 100644
> index 00..cfc6c06076
> --- /dev/null
> +++ b/drivers/pinctrl/mscc/Kconfig
> @@ -0,0 +1,22 @@
> +# SPDX-License-Identifier: (GPL-2.0+ OR MIT)
> +
> +config PINCTRL_MSCC
> + bool
> +
> +config PINCTRL_MSCC_OCELOT
> + depends on SOC_OCELOT && PINCTRL_FULL && OF_CONTROL
> + select PINCTRL_MSCC
> + default y
> + bool "Microsemi ocelot family pin control driver"
> + help
> +Support pin multiplexing and pin configuration control on
> +Microsemi ocelot SoCs.
> +
> +config PINCTRL_MSCC_LUTON
> + depends on SOC_LUTON && PINCTRL_FULL && OF_CONTROL
> + select PINCTRL_MSCC
> + default y
> + bool "Microsemi luton family pin control driver"
> + help
> +Support pin multiplexing and pin configuration control on
> +Microsemi luton SoCs.
> diff --git a/drivers/pinctrl/mscc/Makefile b/drivers/pinctrl/mscc/Makefile
> new file mode 100644
> index 00..941f418ff9
> --- /dev/null
> +++ b/drivers/pinctrl/mscc/Makefile
> @@ -0,0 +1,5 @@
> +# SPDX-License-Identifier: (GPL-2.0+ OR MIT)
> +
> +obj-$(CONFIG_PINCTRL_MSCC) += mscc-common.o
> +obj-$(CONFIG_PINCTRL_MSCC_OCELOT) += pinctrl-ocelot.o
> +obj-$(CONFIG_PINCTRL_MSCC_LUTON) += pinctrl-luton.o
> diff --git a/drivers/pinctrl/mscc/mscc-common.c 
> b/drivers/pinctrl/mscc/mscc-common.c
> new file mode 100644
> index 00..d74b8a6649
> --- /dev/null
> +++ b/drivers/pinctrl/mscc/mscc-common.c
> @@ -0,0 +1,236 @@
> +// SPDX-License-Identifier: (GPL-2.0 OR MIT)
> +/*
> + * Microsemi SoCs pinctrl driver
> + *
> + * Author: 
> + * Author: 
> + * License: Dual MIT/GPL
> + * Copyright (c) 2017 Microsemi Corporation
> + */
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include "mscc-common.h"
> +
> +#define MSCC_GPIO_OUT_SET0x0
> +#define MSCC_GPIO_OUT_CLR0x4
> +#define MSCC_GPIO_OUT0x8
> +#define MSCC_GPIO_IN 0xc
> +#define MSCC_GPIO_OE 0x10
> +#define MSCC_GPIO_INTR   0x14
> +#define MSCC_GPIO_INTR_ENA   0x18
> +#de

Re: [U-Boot] [PATCH v2] gpio: mscc-bitbang-spi: Add a simple gpio driver for bitbgang spi

2018-12-10 Thread Daniel Schwierzeck


Am 08.12.18 um 10:00 schrieb Gregory CLEMENT:
> Hi,
>  
>  On mar., oct. 09 2018, Gregory CLEMENT  wrote:
> 
>> The VCore III SoCs such as the Luton but also the Ocelot can remap an SPI
>> flash directly in memory. However, for writing in the flash the
>> communication has to be done by software.
>>
>> Each of the signal used for the SPI are exposed in a single register. In
>> order to be able to use the soft-spi driver, the management of this pin
>> is done through this simple gpio driver.
>>
>> Even if the main purpose of this driver is to be used by soft-spi, it can
>> still be used as a normal gpio driver but with limitation: for example
>> the first pin can't be used as output.
>>
>> Signed-off-by: Gregory CLEMENT 
>> ---
>> Changelog:
>> v1 -> v2:
>>  - use const and static when needed
>>  - fix style
>>  - use dev_remap_addr
> 
> I sent this version 2 months ago and addressed all the comments, how
> could we going further ?
> 
> Thanks,
> 
> Gregory
> 

I'll apply it along with your Ocelot/Luton series. It only makes sense
to merge a new driver if there is a user for it ;)

Reviewed-by: Daniel Schwierzeck 

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


[U-Boot] [PATCH v2 13/22] dm: sound: Move common code out of maxim98095

2018-12-10 Thread Simon Glass
The register-access code is useful for any maxim codec. Move it out into
its own file.

Signed-off-by: Simon Glass 
---

Changes in v2:
- Add new patch to move common code out of maxim98095

 drivers/sound/Makefile  |   2 +-
 drivers/sound/max98095.c| 181 ++--
 drivers/sound/max98095.h|   2 +
 drivers/sound/maxim_codec.c |  87 +
 drivers/sound/maxim_codec.h |  67 +
 5 files changed, 204 insertions(+), 135 deletions(-)
 create mode 100644 drivers/sound/maxim_codec.c
 create mode 100644 drivers/sound/maxim_codec.h

diff --git a/drivers/sound/Makefile b/drivers/sound/Makefile
index 75fa31ec534..b08845599f9 100644
--- a/drivers/sound/Makefile
+++ b/drivers/sound/Makefile
@@ -15,4 +15,4 @@ else
 obj-$(CONFIG_I2S)  += sound-i2s.o
 endif
 obj-$(CONFIG_SOUND_WM8994) += wm8994.o
-obj-$(CONFIG_SOUND_MAX98095)   += max98095.o
+obj-$(CONFIG_SOUND_MAX98095)   += max98095.o maxim_codec.o
diff --git a/drivers/sound/max98095.c b/drivers/sound/max98095.c
index d6710dfaa7a..e9bf64f82f8 100644
--- a/drivers/sound/max98095.c
+++ b/drivers/sound/max98095.c
@@ -25,96 +25,10 @@
 #include "i2s.h"
 #include "max98095.h"
 
-struct max98095_priv {
-   unsigned int sysclk;
-   unsigned int rate;
-   unsigned int fmt;
-   int i2c_addr;
-   struct udevice *dev;
-};
-
 /* Index 0 is reserved. */
 int rate_table[] = {0, 8000, 11025, 16000, 22050, 24000, 32000, 44100, 48000,
88200, 96000};
 
-/*
- * Writes value to a device register through i2c
- *
- * @param priv Private data for driver
- * @param reg  reg number to be write
- * @param data data to be writen to the above registor
- *
- * @return int value 1 for change, 0 for no change or negative error code.
- */
-static int max98095_i2c_write(struct max98095_priv *priv, unsigned int reg,
- unsigned char data)
-{
-   debug("%s: Write Addr : 0x%02X, Data :  0x%02X\n",
- __func__, reg, data);
-#ifdef CONFIG_DM_SOUND
-   debug("dev = %s\n", priv->dev->name);
-   return dm_i2c_write(priv->dev, reg, &data, 1);
-#else
-   return i2c_write(priv->i2c_addr, reg, 1, &data, 1);
-#endif
-}
-
-/*
- * Read a value from a device register through i2c
- *
- * @param priv Private data for driver
- * @param reg  reg number to be read
- * @param data address of read data to be stored
- *
- * @return int value 0 for success, -1 in case of error.
- */
-static unsigned int max98095_i2c_read(struct max98095_priv *priv,
- unsigned int reg, unsigned char *data)
-{
-   int ret;
-
-#ifdef CONFIG_DM_SOUND
-   return dm_i2c_read(priv->dev, reg, data, 1);
-#else
-   ret = i2c_read(priv->i2c_addr, reg, 1, data, 1);
-#endif
-   if (ret != 0) {
-   debug("%s: Error while reading register %#04x\n",
- __func__, reg);
-   return -1;
-   }
-
-   return 0;
-}
-
-/*
- * update device register bits through i2c
- *
- * @param priv Private data for driver
- * @param reg  codec register
- * @param mask register mask
- * @param valuenew value
- *
- * @return int value 0 for success, non-zero error code.
- */
-static int max98095_bic_or(struct max98095_priv *priv, unsigned int reg,
-  unsigned char mask, unsigned char value)
-{
-   int change, ret = 0;
-   unsigned char old, new;
-
-   if (max98095_i2c_read(priv, reg, &old) != 0)
-   return -1;
-   new = (old & ~mask) | (value & mask);
-   change  = (old != new) ? 1 : 0;
-   if (change)
-   ret = max98095_i2c_write(priv, reg, new);
-   if (ret < 0)
-   return ret;
-
-   return change;
-}
-
 /*
  * codec mclk clock divider coefficients based on sampling rate
  *
@@ -147,7 +61,7 @@ static int rate_value(int rate, u8 *value)
  *
  * @return -1 for error  and 0  Success.
  */
-static int max98095_hw_params(struct max98095_priv *priv,
+static int max98095_hw_params(struct maxim_priv *priv,
  enum en_max_audio_interface aif_id,
  unsigned int rate, unsigned int bits_per_sample)
 {
@@ -169,12 +83,11 @@ static int max98095_hw_params(struct max98095_priv *priv,
 
switch (bits_per_sample) {
case 16:
-   error = max98095_bic_or(priv, M98095_DAI_FORMAT, M98095_DAI_WS,
-   0);
+   error = maxim_bic_or(priv, M98095_DAI_FORMAT, M98095_DAI_WS, 0);
break;
case 24:
-   error = max98095_bic_or(priv, M98095_DAI_FORMAT, M98095_DAI_WS,
-   M98095_DAI_WS);
+   error = maxim_bic_or(priv, M98095_DAI_FORMAT, M98095_DAI_WS,
+M98095_DAI_WS);
break;
default:
debug("%s: Illegal bits per sample %d.\n",
@@ -189,15 +102,15 @@ static int max98095_hw_par

[U-Boot] [PATCH v2 10/22] dm: sound: Add conversion to driver model

2018-12-10 Thread Simon Glass
Move the existing hardware drivers over to use driver model.

Signed-off-by: Simon Glass 
---

Changes in v2:
- Correct conversion for pit
- Use void * for i2c and sound data

 arch/arm/dts/exynos5250-smdk5250.dts |   1 +
 arch/arm/dts/exynos5420-smdk5420.dts |   1 +
 drivers/sound/Makefile   |   6 +-
 drivers/sound/max98095.c |  59 +-
 drivers/sound/samsung-i2s.c  | 111 +++
 drivers/sound/samsung_sound.c| 101 
 drivers/sound/wm8994.c   |  53 -
 7 files changed, 316 insertions(+), 16 deletions(-)
 create mode 100644 drivers/sound/samsung_sound.c

diff --git a/arch/arm/dts/exynos5250-smdk5250.dts 
b/arch/arm/dts/exynos5250-smdk5250.dts
index 8b695442b1a..bf60b82d449 100644
--- a/arch/arm/dts/exynos5250-smdk5250.dts
+++ b/arch/arm/dts/exynos5250-smdk5250.dts
@@ -62,6 +62,7 @@
i2c@12C7 {
soundcodec@1a {
reg = <0x1a>;
+   u-boot,i2c-offset-len = <2>;
compatible = "wolfson,wm8994-codec";
};
};
diff --git a/arch/arm/dts/exynos5420-smdk5420.dts 
b/arch/arm/dts/exynos5420-smdk5420.dts
index cab5ddb61fa..daaa4666964 100644
--- a/arch/arm/dts/exynos5420-smdk5420.dts
+++ b/arch/arm/dts/exynos5420-smdk5420.dts
@@ -84,6 +84,7 @@
i2c@12C7 {
soundcodec@1a {
reg = <0x1a>;
+   u-boot,i2c-offset-len = <2>;
compatible = "wolfson,wm8994-codec";
};
};
diff --git a/drivers/sound/Makefile b/drivers/sound/Makefile
index 70d32c6d6f6..75fa31ec534 100644
--- a/drivers/sound/Makefile
+++ b/drivers/sound/Makefile
@@ -6,9 +6,13 @@
 obj-$(CONFIG_SOUND)+= sound.o
 obj-$(CONFIG_DM_SOUND) += codec-uclass.o
 obj-$(CONFIG_DM_SOUND) += i2s-uclass.o
-obj-$(CONFIG_I2S)  += sound-i2s.o
 obj-$(CONFIG_DM_SOUND) += sound-uclass.o
 obj-$(CONFIG_I2S_SAMSUNG)  += samsung-i2s.o
 obj-$(CONFIG_SOUND_SANDBOX)+= sandbox.o
+ifdef CONFIG_DM_SOUND
+obj-$(CONFIG_I2S_SAMSUNG)  += samsung_sound.o
+else
+obj-$(CONFIG_I2S)  += sound-i2s.o
+endif
 obj-$(CONFIG_SOUND_WM8994) += wm8994.o
 obj-$(CONFIG_SOUND_MAX98095)   += max98095.o
diff --git a/drivers/sound/max98095.c b/drivers/sound/max98095.c
index 7a3dbd09840..d6710dfaa7a 100644
--- a/drivers/sound/max98095.c
+++ b/drivers/sound/max98095.c
@@ -11,6 +11,8 @@
  */
 
 #include 
+#include 
+#include 
 #include 
 #include 
 #include 
@@ -28,6 +30,7 @@ struct max98095_priv {
unsigned int rate;
unsigned int fmt;
int i2c_addr;
+   struct udevice *dev;
 };
 
 /* Index 0 is reserved. */
@@ -48,7 +51,12 @@ static int max98095_i2c_write(struct max98095_priv *priv, 
unsigned int reg,
 {
debug("%s: Write Addr : 0x%02X, Data :  0x%02X\n",
  __func__, reg, data);
+#ifdef CONFIG_DM_SOUND
+   debug("dev = %s\n", priv->dev->name);
+   return dm_i2c_write(priv->dev, reg, &data, 1);
+#else
return i2c_write(priv->i2c_addr, reg, 1, &data, 1);
+#endif
 }
 
 /*
@@ -65,7 +73,11 @@ static unsigned int max98095_i2c_read(struct max98095_priv 
*priv,
 {
int ret;
 
+#ifdef CONFIG_DM_SOUND
+   return dm_i2c_read(priv->dev, reg, data, 1);
+#else
ret = i2c_read(priv->i2c_addr, reg, 1, data, 1);
+#endif
if (ret != 0) {
debug("%s: Error while reading register %#04x\n",
  __func__, reg);
@@ -484,7 +496,7 @@ static int max98095_do_init(struct max98095_priv *priv,
 
ret = max98095_setup_interface(priv, aif_id);
if (ret < 0) {
-   debug("%s: max98095 codec chip init failed\n", __func__);
+   debug("%s: max98095 setup interface failed\n", __func__);
return ret;
}
 
@@ -507,6 +519,7 @@ static int max98095_do_init(struct max98095_priv *priv,
return ret;
 }
 
+#ifndef CONFIG_DM_SOUND
 static int get_max98095_codec_values(struct sound_codec_info *pcodec_info,
const void *blob)
 {
@@ -582,3 +595,47 @@ int max98095_init(const void *blob, enum 
en_max_audio_interface aif_id,
 
return ret;
 }
+#endif
+
+static int max98095_set_params(struct udevice *dev, int interface, int rate,
+  int mclk_freq, int bits_per_sample,
+  uint channels)
+{
+   struct max98095_priv *priv = dev_get_priv(dev);
+
+   return max98095_do_init(priv, interface, rate, mclk_freq,
+   bits_per_sample);
+}
+
+static int max98095_probe(struct udevice *dev)
+{
+   struct max98095_priv *priv = dev_get_priv(dev);
+   int ret;
+
+   priv->dev = dev;
+   ret = max98095_device_init(priv);
+   if (ret < 0) {
+   debug("%s: max98095 codec chip init failed\n", __func__);
+   return ret;
+   }
+
+   return 0;
+}
+
+static const struct audio

Re: [U-Boot] [RFC PATCH v2 00/11] SF: Migrate to Linux SPI NOR framework

2018-12-10 Thread Vignesh R


On 10-Dec-18 6:32 PM, Jagan Teki wrote:
> On Thu, Dec 6, 2018 at 11:55 PM Vignesh R  wrote:
>>
>> Hi Jagan,
>>
>> On 06-Dec-18 10:44 PM, Jagan Teki wrote:
>>> On Tue, Dec 4, 2018 at 5:56 PM Vignesh R  wrote:

 U-Boot SPI NOR support (sf layer) is quite outdated as it does not
 support 4 byte addressing opcodes, SFDP table parsing and different types 
 of
 quad mode enable sequences. Many newer flashes no longer support BANK
 registers used by sf layer to a access >16MB space.
 Also, many SPI controllers have special MMIO interfaces which provide
 accelerated read/write access but require knowledge of flash parameters
 to make use of it. Recent spi-mem layer provides a way to support such
 flashes but sf layer isn't using that.
 This patch series syncs SPI NOR framework from Linux v4.19. It also adds
 spi-mem support on top.
 So, we gain 4byte addressing support and SFDP support. This makes
 migrating to U-Boot MTD framework easier.
>>>
>>> We(someone) has proposed this sync before, but we(at-least I) rely on
>>> implementing via DM not direct sync to Linux.
>>
>> As I said in my cover letter, U-Boot sf layer is unable to support newer
>> flashes mainly due to lack of 4 byte addressing and proper support for
>> MMIO capable SPI controllers.
>> My idea of fixing this is to borrow _features_ from Linux SPI NOR "as
>> is". All that's needed is stateless 4 byte addressing, SFDP
>> parsing(optionally), Quad/Octal support and spi-mem like abstraction for
>> MMIO capable Controllers. I see no point in re-coding them from ground up.
>>
>> Could you be more specific on what you would like to see here in DM way?
>> I have no issues in adapting this code to any framework here in U-Boot.
>> Linux has driver model and SPI NOR subsystem is a framework and
>> therefore any code ported from Linux will inherently have those
>> abstractions. The only difference I see wrt your code in branch below vs
>> this series is SPI-NOR uclass. This can be easily achieved by moving
>> nor->ops out of struct spi_nor into uclass abstraction.
>> Upstream Linux is anyways merging m25p80 and spi-nor so I did not see a
>> need for SPI NOR uclass. I am okay to change that if you insist on
>> having it.
> 
> Merging or syncing spi-nor features stuff from Linux is good, I'm not
> stopping that. but this can be do by satisfying u-boot driver-model
> with proper architectural model. I know you take care but I'm not sure
> ie what can be manageable for long term.
> 
> Let's discuss the proper architectural model, so-that we can move
> further to incorporate the changes accordingly. (thanks at last we
> have a thread to discuss)
> 
> Linux m25p80 is moved to spi-nor right? so does controllers on spi-nor
> should be reside in same area like drivers/mtd/spi-nor or it should be
> part of spi-mem. The last mail with  Boris, noted all spi-nor can't be
> fit into spi-mem(sorry I lost the thread)
> 

Yes, ATM all drivers fit into spi/spi-mem APIs and don't see any need
for new spi-nor uclass


> Example: we have zynq qspi it support BAR(with >16MB flashes), dual
> qspi ect so does it comes under spi-mem or spi-nor?
> 

In current mainline U-Boot, I see _no_ users of flags:
SF_DUAL_STACKED_FLASH and SF_DUAL_PARALLEL_FLASH
(I don't see flash->dual_flash set to any of the above enums).
But if we do need to support such flashes in future, current address
translation logic can be added to spi-nor.c (based on a DT flag), along
with a way to pass this info via spi-mem ops.
I would suggest to look at spi-mem ops (and in Linux mainline as well),
if there are any shortcomings we can discuss here.

> So, if no driver should be part of spi-nor and all can be handle
> spi-mem even-though they have controller specific features, yes we can
> skip SPI_NOR_UCLASS otherwise we need spi-nor uclass that can be child
> uclass of MTD.
> 

In fact, after this series is merged, UCLASS_SPI_FLASH can be dropped
and we can move to spi-nor(and sf_dataflash.c) directly under
UCLASS_MTD. But, mostly likely would need to provide a lightweight MTD
for SPL (similar to spi-nor-tiny.c) before that can be done.

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


[U-Boot] [PATCH v2 22/22] dm: sound: Use the correct number of channels for sound

2018-12-10 Thread Simon Glass
At present the 'beep' sound generates a waveform for only one channel even
if two are being used. This means that the beep is twice the frequency it
should be. Correct this by making it a parameter.

The fix in a previous commit was correct for sandbox but not for other
boards.

Fixes: 03f11e87a8 ("sound: Correct data output in sound_create_square_wave()")
Signed-off-by: Simon Glass 
---

Changes in v2:
- Add new patch to use the correct number of channels for sound

 drivers/sound/sound-uclass.c |  2 +-
 drivers/sound/sound.c| 11 +++
 include/sound.h  | 11 ++-
 3 files changed, 14 insertions(+), 10 deletions(-)

diff --git a/drivers/sound/sound-uclass.c b/drivers/sound/sound-uclass.c
index 71e753cb993..2b836268896 100644
--- a/drivers/sound/sound-uclass.c
+++ b/drivers/sound/sound-uclass.c
@@ -53,7 +53,7 @@ int sound_beep(struct udevice *dev, int msecs, int 
frequency_hz)
}
 
sound_create_square_wave(i2s_uc_priv->samplingrate, data, data_size,
-frequency_hz);
+frequency_hz, i2s_uc_priv->channels);
 
while (msecs >= 1000) {
ret = sound_play(dev, data, data_size);
diff --git a/drivers/sound/sound.c b/drivers/sound/sound.c
index 4f0ad0d8f0d..dd3f9db4f75 100644
--- a/drivers/sound/sound.c
+++ b/drivers/sound/sound.c
@@ -8,7 +8,7 @@
 #include 
 
 void sound_create_square_wave(uint sample_rate, unsigned short *data, int size,
- uint freq)
+ uint freq, uint channels)
 {
const unsigned short amplitude = 16000; /* between 1 and 32767 */
const int period = freq ? sample_rate / freq : 0;
@@ -21,14 +21,17 @@ void sound_create_square_wave(uint sample_rate, unsigned 
short *data, int size,
size--;
 
while (size) {
-   int i;
+   int i, j;
+
for (i = 0; size && i < half; i++) {
size -= 2;
-   *data++ = amplitude;
+   for (j = 0; j < channels; j++)
+   *data++ = amplitude;
}
for (i = 0; size && i < period - half; i++) {
size -= 2;
-   *data++ = -amplitude;
+   for (j = 0; j < channels; j++)
+   *data++ = -amplitude;
}
}
 }
diff --git a/include/sound.h b/include/sound.h
index 02acefd34f0..b7959cc2607 100644
--- a/include/sound.h
+++ b/include/sound.h
@@ -37,13 +37,14 @@ struct sound_uc_priv {
 /**
  * Generates square wave sound data for 1 second
  *
- * @param sample_rate   Sample rate in Hz
- * @param data  data buffer pointer
- * @param size  size of the buffer in bytes
- * @param freq  frequency of the wave
+ * @sample_rate: Sample rate in Hz
+ * @data: data buffer pointer
+ * @size: size of the buffer in bytes
+ * @freq: frequency of the wave
+ * @channels: Number of channels to use
  */
 void sound_create_square_wave(uint sample_rate, unsigned short *data, int size,
- uint freq);
+ uint freq, uint channels);
 
 /*
  * The sound uclass brings together a data transport (currently only I2C) and a
-- 
2.20.0.rc2.403.gdbc3b29805-goog

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


[U-Boot] [PATCH v2 12/22] exynos: Add support for exynos5420 i2s pinmux

2018-12-10 Thread Simon Glass
Allow setting the i2s pinmux correctly on exyno5420 so that i2c can be
used on that SoC. Also rename EXYNOS_AUDSS to something consistent with
other naming.

Signed-off-by: Simon Glass 
---

Changes in v2: None

 arch/arm/mach-exynos/clock.c  | 21 +++--
 arch/arm/mach-exynos/include/mach/clock.h |  3 +++
 arch/arm/mach-exynos/pinmux.c | 17 +
 3 files changed, 39 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-exynos/clock.c b/arch/arm/mach-exynos/clock.c
index 2425a728669..73aa4cdad32 100644
--- a/arch/arm/mach-exynos/clock.c
+++ b/arch/arm/mach-exynos/clock.c
@@ -1317,6 +1317,19 @@ int exynos5_set_epll_clk(unsigned long rate)
return 0;
 }
 
+static int exynos5420_set_i2s_clk_source(void)
+{
+   struct exynos5420_clock *clk =
+   (struct exynos5420_clock *)samsung_get_base_clock();
+
+   setbits_le32(&clk->src_top6, EXYNOS5420_CLK_SRC_MOUT_EPLL);
+   clrsetbits_le32(&clk->src_mau, EXYNOS5420_AUDIO0_SEL_MASK,
+   (EXYNOS5420_CLK_SRC_SCLK_EPLL));
+   setbits_le32(EXYNOS5_AUDIOSS_BASE, 1 << 0);
+
+   return 0;
+}
+
 int exynos5_set_i2s_clk_source(unsigned int i2s_id)
 {
struct exynos5_clock *clk =
@@ -1758,8 +1771,12 @@ int set_i2s_clk_prescaler(unsigned int src_frq, unsigned 
int dst_frq,
 
 int set_i2s_clk_source(unsigned int i2s_id)
 {
-   if (cpu_is_exynos5())
-   return exynos5_set_i2s_clk_source(i2s_id);
+   if (cpu_is_exynos5()) {
+   if (proid_is_exynos542x())
+   return exynos5420_set_i2s_clk_source();
+   else
+   return exynos5_set_i2s_clk_source(i2s_id);
+   }
 
return 0;
 }
diff --git a/arch/arm/mach-exynos/include/mach/clock.h 
b/arch/arm/mach-exynos/include/mach/clock.h
index edf62bdf853..e4c706adeac 100644
--- a/arch/arm/mach-exynos/include/mach/clock.h
+++ b/arch/arm/mach-exynos/include/mach/clock.h
@@ -1370,10 +1370,13 @@ struct set_epll_con_val {
 #define AUDIO_1_RATIO_MASK 0x0f
 
 #define AUDIO0_SEL_MASK0xf
+#define EXYNOS5420_AUDIO0_SEL_MASK (0x3 << 28)
 #define AUDIO1_SEL_MASK0xf
 
 #define CLK_SRC_SCLK_EPLL  0x7
+#define EXYNOS5420_CLK_SRC_SCLK_EPLL   (0x6 << 28)
 #define CLK_SRC_MOUT_EPLL  (1<<12)
+#define EXYNOS5420_CLK_SRC_MOUT_EPLL   BIT(20)
 #define AUDIO_CLKMUX_ASS   (1<<0)
 
 /* CON0 bit-fields */
diff --git a/arch/arm/mach-exynos/pinmux.c b/arch/arm/mach-exynos/pinmux.c
index 5072f4f5691..b24f1bb8f4f 100644
--- a/arch/arm/mach-exynos/pinmux.c
+++ b/arch/arm/mach-exynos/pinmux.c
@@ -378,6 +378,20 @@ static void exynos5_i2s_config(int peripheral)
}
 }
 
+static void exynos5420_i2s_config(int peripheral)
+{
+   int i;
+
+   switch (peripheral) {
+   case PERIPH_ID_I2S0:
+   for (i = 0; i < 5; i++)
+   gpio_cfg_pin(EXYNOS5420_GPIO_Z0 + i,
+S5P_GPIO_FUNC(0x02));
+   break;
+   }
+}
+
+
 void exynos5_spi_config(int peripheral)
 {
int cfg = 0, pin = 0, i;
@@ -550,6 +564,9 @@ static int exynos5420_pinmux_config(int peripheral, int 
flags)
case PERIPH_ID_I2C10:
exynos5420_i2c_config(peripheral);
break;
+   case PERIPH_ID_I2S0:
+   exynos5420_i2s_config(peripheral);
+   break;
case PERIPH_ID_PWM0:
gpio_cfg_pin(EXYNOS5420_GPIO_B20, S5P_GPIO_FUNC(2));
break;
-- 
2.20.0.rc2.403.gdbc3b29805-goog

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


[U-Boot] [PATCH v2 11/22] exynos: Add proid_is_exynos542x() for common 542x

2018-12-10 Thread Simon Glass
Add a convenience function for any Exynos 542x chip.

Signed-off-by: Simon Glass 
---

Changes in v2: None

 arch/arm/mach-exynos/clock.c  | 10 +-
 arch/arm/mach-exynos/clock_init_exynos5.c |  2 +-
 arch/arm/mach-exynos/common_setup.h   |  4 ++--
 arch/arm/mach-exynos/include/mach/cpu.h   |  4 +++-
 arch/arm/mach-exynos/include/mach/gpio.h  |  4 ++--
 arch/arm/mach-exynos/pinmux.c |  2 +-
 arch/arm/mach-exynos/power.c  |  2 +-
 7 files changed, 15 insertions(+), 13 deletions(-)

diff --git a/arch/arm/mach-exynos/clock.c b/arch/arm/mach-exynos/clock.c
index 6a3cd44b5d3..2425a728669 100644
--- a/arch/arm/mach-exynos/clock.c
+++ b/arch/arm/mach-exynos/clock.c
@@ -345,7 +345,7 @@ static struct clk_bit_info *get_clk_bit_info(int peripheral)
int i;
struct clk_bit_info *info;
 
-   if (proid_is_exynos5420() || proid_is_exynos5422())
+   if (proid_is_exynos542x())
info = exynos542x_bit_info;
else
info = exynos5_bit_info;
@@ -557,7 +557,7 @@ static unsigned long exynos542x_get_periph_rate(int 
peripheral)
 unsigned long clock_get_periph_rate(int peripheral)
 {
if (cpu_is_exynos5()) {
-   if (proid_is_exynos5420() || proid_is_exynos5422())
+   if (proid_is_exynos542x())
return exynos542x_get_periph_rate(peripheral);
return exynos5_get_periph_rate(peripheral);
} else {
@@ -1575,7 +1575,7 @@ static unsigned long exynos4_get_i2c_clk(void)
 unsigned long get_pll_clk(int pllreg)
 {
if (cpu_is_exynos5()) {
-   if (proid_is_exynos5420() || proid_is_exynos5422())
+   if (proid_is_exynos542x())
return exynos542x_get_pll_clk(pllreg);
return exynos5_get_pll_clk(pllreg);
} else if (cpu_is_exynos4()) {
@@ -1691,7 +1691,7 @@ void set_mmc_clk(int dev_index, unsigned int div)
div -= 1;
 
if (cpu_is_exynos5()) {
-   if (proid_is_exynos5420() || proid_is_exynos5422())
+   if (proid_is_exynos542x())
exynos5420_set_mmc_clk(dev_index, div);
else
exynos5_set_mmc_clk(dev_index, div);
@@ -1739,7 +1739,7 @@ void set_mipi_clk(void)
 int set_spi_clk(int periph_id, unsigned int rate)
 {
if (cpu_is_exynos5()) {
-   if (proid_is_exynos5420() || proid_is_exynos5422())
+   if (proid_is_exynos542x())
return exynos5420_set_spi_clk(periph_id, rate);
return exynos5_set_spi_clk(periph_id, rate);
}
diff --git a/arch/arm/mach-exynos/clock_init_exynos5.c 
b/arch/arm/mach-exynos/clock_init_exynos5.c
index e63ef645239..1cb8d391e7c 100644
--- a/arch/arm/mach-exynos/clock_init_exynos5.c
+++ b/arch/arm/mach-exynos/clock_init_exynos5.c
@@ -968,7 +968,7 @@ static void exynos5420_system_clock_init(void)
 
 void system_clock_init(void)
 {
-   if (proid_is_exynos5420() || proid_is_exynos5422())
+   if (proid_is_exynos542x())
exynos5420_system_clock_init();
else
exynos5250_system_clock_init();
diff --git a/arch/arm/mach-exynos/common_setup.h 
b/arch/arm/mach-exynos/common_setup.h
index 2829fb269ed..4e3702b9285 100644
--- a/arch/arm/mach-exynos/common_setup.h
+++ b/arch/arm/mach-exynos/common_setup.h
@@ -78,7 +78,7 @@ static inline void configure_l2_ctlr(void)
CACHE_TAG_RAM_LATENCY_2_CYCLES |
CACHE_DATA_RAM_LATENCY_2_CYCLES;
 
-   if (proid_is_exynos5420() || proid_is_exynos5422()) {
+   if (proid_is_exynos542x()) {
val |= CACHE_ECC_AND_PARITY |
CACHE_TAG_RAM_LATENCY_3_CYCLES |
CACHE_DATA_RAM_LATENCY_3_CYCLES;
@@ -97,7 +97,7 @@ static inline void configure_l2_actlr(void)
 {
uint32_t val;
 
-   if (proid_is_exynos5420() || proid_is_exynos5422()) {
+   if (proid_is_exynos542x()) {
mrc_l2_aux_ctlr(val);
val |= CACHE_ENABLE_FORCE_L2_LOGIC |
CACHE_DISABLE_CLEAN_EVICT;
diff --git a/arch/arm/mach-exynos/include/mach/cpu.h 
b/arch/arm/mach-exynos/include/mach/cpu.h
index aeb3755fe6b..766edeeb298 100644
--- a/arch/arm/mach-exynos/include/mach/cpu.h
+++ b/arch/arm/mach-exynos/include/mach/cpu.h
@@ -268,6 +268,8 @@ IS_EXYNOS_TYPE(exynos5250, 0x5250)
 IS_EXYNOS_TYPE(exynos5420, 0x5420)
 IS_EXYNOS_TYPE(exynos5422, 0x5422)
 
+#define proid_is_exynos542x() (proid_is_exynos5420() || proid_is_exynos5422())
+
 #define SAMSUNG_BASE(device, base) \
 static inline unsigned long __attribute__((no_instrument_function)) \
samsung_get_base_##device(void) \
@@ -277,7 +279,7 @@ static inline unsigned long 
__attribute__((no_instrument_function)) \
return EXYNOS4X12_##base;   \
return EXYNOS4_##base;  \
  

[U-Boot] [PATCH v2 21/22] dm: sandbox: Allow selection of sample rate and channels

2018-12-10 Thread Simon Glass
At present these parameters are hard-coded in the sdl interface code.
Allow them to be specified by the driver instead.

Signed-off-by: Simon Glass 
---

Changes in v2: None

 arch/sandbox/cpu/sdl.c | 10 +++---
 arch/sandbox/include/asm/sdl.h |  6 --
 drivers/sound/sandbox.c|  2 +-
 3 files changed, 8 insertions(+), 10 deletions(-)

diff --git a/arch/sandbox/cpu/sdl.c b/arch/sandbox/cpu/sdl.c
index 7eb2df7ddad..66de4040fc8 100644
--- a/arch/sandbox/cpu/sdl.c
+++ b/arch/sandbox/cpu/sdl.c
@@ -9,10 +9,6 @@
 #include 
 #include 
 
-enum {
-   SAMPLE_RATE = 22050,
-};
-
 /**
  * struct buf_info - a data buffer holding audio data
  *
@@ -285,7 +281,7 @@ void sandbox_sdl_fill_audio(void *udata, Uint8 *stream, int 
len)
}
 }
 
-int sandbox_sdl_sound_init(void)
+int sandbox_sdl_sound_init(int rate, int channels)
 {
SDL_AudioSpec wanted;
int i;
@@ -297,9 +293,9 @@ int sandbox_sdl_sound_init(void)
return 0;
 
/* Set the audio format */
-   wanted.freq = SAMPLE_RATE;
+   wanted.freq = rate;
wanted.format = AUDIO_S16;
-   wanted.channels = 1;/* 1 = mono, 2 = stereo */
+   wanted.channels = channels;
wanted.samples = 1024;  /* Good low-latency value for callback */
wanted.callback = sandbox_sdl_fill_audio;
wanted.userdata = NULL;
diff --git a/arch/sandbox/include/asm/sdl.h b/arch/sandbox/include/asm/sdl.h
index 2799a8bee06..1027b59e732 100644
--- a/arch/sandbox/include/asm/sdl.h
+++ b/arch/sandbox/include/asm/sdl.h
@@ -71,9 +71,11 @@ int sandbox_sdl_sound_stop(void);
 /**
  * sandbox_sdl_sound_init() - set up the sound system
  *
+ * @rate:  Sample rate to use
+ * @channels:  Number of channels to use (1=mono, 2=stereo)
  * @return 0 if OK, -ENODEV if no sound is available
  */
-int sandbox_sdl_sound_init(void);
+int sandbox_sdl_sound_init(int rate, int channels);
 
 #else
 static inline int sandbox_sdl_init_display(int width, int height,
@@ -112,7 +114,7 @@ static inline int sandbox_sdl_sound_stop(void)
return -ENODEV;
 }
 
-static inline int sandbox_sdl_sound_init(void)
+int sandbox_sdl_sound_init(int rate, int channels)
 {
return -ENODEV;
 }
diff --git a/drivers/sound/sandbox.c b/drivers/sound/sandbox.c
index 4a3b41dd002..a4f15088236 100644
--- a/drivers/sound/sandbox.c
+++ b/drivers/sound/sandbox.c
@@ -101,7 +101,7 @@ static int sandbox_i2s_probe(struct udevice *dev)
uc_priv->channels = 2;
uc_priv->id = 1;
 
-   return sandbox_sdl_sound_init();
+   return sandbox_sdl_sound_init(uc_priv->samplingrate, uc_priv->channels);
 }
 
 static int sandbox_sound_setup(struct udevice *dev)
-- 
2.20.0.rc2.403.gdbc3b29805-goog

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


[U-Boot] [PATCH v2 15/22] dm: exynos: sound: Convert to use driver model

2018-12-10 Thread Simon Glass
Update snow's device tree and config to use driver model for sound. Also
update the others as best we can.

Spring does not appear to have audio support in the kernel. The smdk5250
and smdk5420 boards use a wolfson codec which I cannot test with. So the
only boards that is tested and known to work are snow, pit and pi.

Signed-off-by: Simon Glass 
---

Changes in v2:
- Correct conversion for pit and pi, updating commit message

 arch/arm/dts/exynos5250-smdk5250.dts  | 20 ++--
 arch/arm/dts/exynos5250-snow.dts  | 21 -
 arch/arm/dts/exynos5250-spring.dts| 24 
 arch/arm/dts/exynos5250.dtsi  | 15 ++-
 arch/arm/dts/exynos5420-peach-pit.dts | 20 ++--
 arch/arm/dts/exynos5420-smdk5420.dts  | 20 ++--
 arch/arm/dts/exynos54xx.dtsi  | 14 ++
 arch/arm/dts/exynos5800-peach-pi.dts  | 20 ++--
 configs/arndale_defconfig |  1 +
 configs/peach-pi_defconfig|  3 +++
 configs/peach-pit_defconfig   |  3 +++
 configs/smdk5250_defconfig|  1 +
 configs/snow_defconfig|  1 +
 configs/spring_defconfig  |  1 +
 drivers/sound/samsung_sound.c |  3 +++
 15 files changed, 145 insertions(+), 22 deletions(-)

diff --git a/arch/arm/dts/exynos5250-smdk5250.dts 
b/arch/arm/dts/exynos5250-smdk5250.dts
index bf60b82d449..e542a790761 100644
--- a/arch/arm/dts/exynos5250-smdk5250.dts
+++ b/arch/arm/dts/exynos5250-smdk5250.dts
@@ -60,10 +60,26 @@
};
 
i2c@12C7 {
-   soundcodec@1a {
+   wm8994: soundcodec@1a {
reg = <0x1a>;
u-boot,i2c-offset-len = <2>;
-   compatible = "wolfson,wm8994-codec";
+   compatible = "wolfson,wm8994";
+   #sound-dai-cells = <1>;
+   };
+   };
+
+   sound {
+   compatible = "google,smdk5250-audio-wm8994";
+
+   samsung,model = "SMDK5250-I2S-WM8994";
+   samsung,audio-codec = <&wm8994>;
+
+   cpu {
+   sound-dai = <&i2s0 0>;
+   };
+
+   codec {
+   sound-dai = <&wm8994 0>;
};
};
 
diff --git a/arch/arm/dts/exynos5250-snow.dts b/arch/arm/dts/exynos5250-snow.dts
index cb5067b9669..7587dc0ff24 100644
--- a/arch/arm/dts/exynos5250-snow.dts
+++ b/arch/arm/dts/exynos5250-snow.dts
@@ -40,7 +40,6 @@
mmc3 = "/mmc@1223";
serial0 = "/serial@12C3";
console = "/serial@12C3";
-   i2s = "/sound@383";
};
 
 memory {
@@ -214,9 +213,10 @@
};
};
 
-   soundcodec@11 {
+   max98095: codec@11 {
+   compatible = "maxim,max98095";
reg = <0x11>;
-   compatible = "maxim,max98095-codec";
+   #sound-dai-cells = <1>;
};
};
 
@@ -273,9 +273,20 @@
};
};
 
-   sound@383 {
-   samsung,codec-type = "max98095";
+   sound {
+   compatible = "google,snow-audio-max98095";
+
+   samsung,model = "Snow-I2S-MAX98095";
+   samsung,audio-codec = <&max98095>;
codec-enable-gpio = <&gpx1 7 GPIO_ACTIVE_HIGH>;
+
+   cpu {
+   sound-dai = <&i2s0 0>;
+   };
+
+   codec {
+   sound-dai = <&max98095 0>;
+   };
};
 
sound@12d6 {
diff --git a/arch/arm/dts/exynos5250-spring.dts 
b/arch/arm/dts/exynos5250-spring.dts
index 7633d36874f..191e12af6a1 100644
--- a/arch/arm/dts/exynos5250-spring.dts
+++ b/arch/arm/dts/exynos5250-spring.dts
@@ -34,7 +34,6 @@
mmc0 = "/mmc@1220";
serial0 = "/serial@12C3";
console = "/serial@12C3";
-   i2s = "/sound@383";
};
 
memory {
@@ -639,10 +638,27 @@
};
};
 
-   soundcodec@20 {
-   reg = <0x20>;
-   compatible = "maxim,max98088-codec";
+   max98095: soundcodec@10 {
+   reg = <0x10>;
+   compatible = "maxim,max98095";
+   #sound-dai-cells = <1>;
};
+
+   sound {
+   compatible = "google,spring-audio-max98095";
+
+   samsung,model = "Spring-I2S-MAX98095";
+   samsung,audio-codec = <&max98095>;
+
+   cpu {
+   sound-dai = <&i2s0 0>;
+   };
+
+   codec {
+   sound-dai = <&max98095 0>;
+   };
+   };
+
 };
 
 #include "cros-ec-keyboard.dtsi"
diff --git a/arch/arm/dts/exynos5250.dtsi b/arch/arm/dts/exynos5250.dtsi
index 502c687802e..66c5b6dca

[U-Boot] [PATCH v2 14/22] dm: sound: exynos: Add support for max98090

2018-12-10 Thread Simon Glass
Add support for this new codec which is used by pit.

Signed-off-by: Simon Glass 
---

Changes in v2:
- Add new patch with support for max98090

 drivers/sound/Kconfig|   8 +
 drivers/sound/Makefile   |   1 +
 drivers/sound/max98090.c | 377 ++
 drivers/sound/max98090.h | 663 +++
 4 files changed, 1049 insertions(+)
 create mode 100644 drivers/sound/max98090.c
 create mode 100644 drivers/sound/max98090.h

diff --git a/drivers/sound/Kconfig b/drivers/sound/Kconfig
index 93f6c36af32..18d7ca1dcb3 100644
--- a/drivers/sound/Kconfig
+++ b/drivers/sound/Kconfig
@@ -37,6 +37,14 @@ config I2S_SAMSUNG
  option provides an implementation for sound_init() and
  sound_play().
 
+config SOUND_MAX98090
+   bool "Support Maxim max98090 audio codec"
+   depends on I2S_SAMSUNG
+   help
+ Enable the max98090 audio codec. This is connected via I2S for
+ audio data and I2C for codec control. At present it only works
+ with the Samsung I2S driver.
+
 config SOUND_MAX98095
bool "Support Maxim max98095 audio codec"
depends on I2S_SAMSUNG
diff --git a/drivers/sound/Makefile b/drivers/sound/Makefile
index b08845599f9..937df152fe6 100644
--- a/drivers/sound/Makefile
+++ b/drivers/sound/Makefile
@@ -15,4 +15,5 @@ else
 obj-$(CONFIG_I2S)  += sound-i2s.o
 endif
 obj-$(CONFIG_SOUND_WM8994) += wm8994.o
+obj-$(CONFIG_SOUND_MAX98090)   += max98090.o maxim_codec.o
 obj-$(CONFIG_SOUND_MAX98095)   += max98095.o maxim_codec.o
diff --git a/drivers/sound/max98090.c b/drivers/sound/max98090.c
new file mode 100644
index 000..346ff5ffbec
--- /dev/null
+++ b/drivers/sound/max98090.c
@@ -0,0 +1,377 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * max98090.c -- MAX98090 ALSA SoC Audio driver
+ *
+ * Copyright 2011 Maxim Integrated Products
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include "maxim_codec.h"
+#include "max98090.h"
+
+/*
+ * Sets hw params for max98090
+ *
+ * @priv: max98090 information pointer
+ * @rate: Sampling rate
+ * @bits_per_sample: Bits per sample
+ *
+ * @return -EIO for error, 0 for success.
+ */
+int max98090_hw_params(struct maxim_priv *priv, unsigned int rate,
+  unsigned int bits_per_sample)
+{
+   int error;
+   unsigned char value;
+
+   switch (bits_per_sample) {
+   case 16:
+   maxim_i2c_read(priv, M98090_REG_INTERFACE_FORMAT, &value);
+   error = maxim_bic_or(priv, M98090_REG_INTERFACE_FORMAT,
+M98090_WS_MASK, 0);
+   maxim_i2c_read(priv, M98090_REG_INTERFACE_FORMAT, &value);
+   break;
+   default:
+   debug("%s: Illegal bits per sample %d.\n",
+ __func__, bits_per_sample);
+   return -1;
+   }
+
+   /* Update filter mode */
+   if (rate < 24)
+   error |= maxim_bic_or(priv, M98090_REG_FILTER_CONFIG,
+ M98090_MODE_MASK, 0);
+   else
+   error |= maxim_bic_or(priv, M98090_REG_FILTER_CONFIG,
+ M98090_MODE_MASK, M98090_MODE_MASK);
+
+   /* Update sample rate mode */
+   if (rate < 5)
+   error |= maxim_bic_or(priv, M98090_REG_FILTER_CONFIG,
+ M98090_DHF_MASK, 0);
+   else
+   error |= maxim_bic_or(priv, M98090_REG_FILTER_CONFIG,
+ M98090_DHF_MASK, M98090_DHF_MASK);
+
+   if (error < 0) {
+   debug("%s: Error setting hardware params.\n", __func__);
+   return -EIO;
+   }
+   priv->rate = rate;
+
+   return 0;
+}
+
+/*
+ * Configures Audio interface system clock for the given frequency
+ *
+ * @priv: max98090 information
+ * @freq: Sampling frequency in Hz
+ *
+ * @return -EIO for error, 0 for success.
+ */
+int max98090_set_sysclk(struct maxim_priv *priv, unsigned int freq)
+{
+   int error = 0;
+
+   /* Requested clock frequency is already setup */
+   if (freq == priv->sysclk)
+   return 0;
+
+   /* Setup clocks for slave mode, and using the PLL
+* PSCLK = 0x01 (when master clk is 10MHz to 20MHz)
+*  0x02 (when master clk is 20MHz to 40MHz)..
+*  0x03 (when master clk is 40MHz to 60MHz)..
+*/
+   if (freq >= 1000 && freq < 2000) {
+   error = maxim_i2c_write(priv, M98090_REG_SYSTEM_CLOCK,
+   M98090_PSCLK_DIV1);
+   } else if (freq >= 2000 && freq < 4000) {
+   error = maxim_i2c_write(priv, M98090_REG_SYSTEM_CLOCK,
+   M98090_PSCLK_DIV2);
+   } else if (freq >= 4000 && freq < 6000) {
+   error = maxim_i2c_write(priv, M98090_REG_SYSTEM_CLOCK,
+  

[U-Boot] [PATCH v2 18/22] dm: sound: Complete migration to driver model

2018-12-10 Thread Simon Glass
All users of sound are converted to use driver model. Drop the old code
and the CONFIG_DM_SOUND option.

Signed-off-by: Simon Glass 
---

Changes in v2:
- Drop CONFIG_DM_SOUND from all defconfig files
- Fix up sandbox files to remove old code
- Update the rest of the samsung boards
- Remove unused sandbox code also
- Drop patches previously applied

 arch/sandbox/cpu/sdl.c   |   1 -
 arch/sandbox/include/asm/sdl.h   |  21 ++--
 arch/sandbox/include/asm/sound.h |  13 --
 cmd/sound.c  |  12 --
 configs/arndale_defconfig|   1 -
 configs/peach-pi_defconfig   |   1 -
 configs/peach-pit_defconfig  |   1 -
 configs/smdk5250_defconfig   |   1 -
 configs/snow_defconfig   |   1 -
 configs/spring_defconfig |   1 -
 drivers/sound/Kconfig|   6 -
 drivers/sound/Makefile   |  10 +-
 drivers/sound/max98095.c |  78 
 drivers/sound/sandbox.c  |  19 +--
 drivers/sound/sound-i2s.c| 206 ---
 drivers/sound/wm8994.c   |  95 --
 include/sound.h  |  18 ---
 test/dm/Makefile |   6 +-
 18 files changed, 16 insertions(+), 475 deletions(-)
 delete mode 100644 arch/sandbox/include/asm/sound.h
 delete mode 100644 drivers/sound/sound-i2s.c

diff --git a/arch/sandbox/cpu/sdl.c b/arch/sandbox/cpu/sdl.c
index 8fc7c172e3a..7eb2df7ddad 100644
--- a/arch/sandbox/cpu/sdl.c
+++ b/arch/sandbox/cpu/sdl.c
@@ -7,7 +7,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 
 enum {
diff --git a/arch/sandbox/include/asm/sdl.h b/arch/sandbox/include/asm/sdl.h
index 0143ed9e621..2799a8bee06 100644
--- a/arch/sandbox/include/asm/sdl.h
+++ b/arch/sandbox/include/asm/sdl.h
@@ -54,12 +54,12 @@ int sandbox_sdl_scan_keys(int key[], int max_keys);
 int sandbox_sdl_key_pressed(int keycode);
 
 /**
- * sandbox_sdl_sound_start() - start playing a sound
+ * sandbox_sdl_sound_play() - Play a sound
  *
- * @frequency: Frequency of sounds in Hertz
- * @return 0 if OK, -ENODEV if no sound is available
+ * @data:  Data to play (typically 16-bit)
+ * @count: Number of bytes in data
  */
-int sandbox_sdl_sound_start(uint frequency);
+int sandbox_sdl_sound_play(const void *data, uint count);
 
 /**
  * sandbox_sdl_sound_stop() - stop playing a sound
@@ -68,14 +68,6 @@ int sandbox_sdl_sound_start(uint frequency);
  */
 int sandbox_sdl_sound_stop(void);
 
-/**
- * sandbox_sdl_sound_play() - Play a sound
- *
- * @data:  Data to play (typically 16-bit)
- * @count: Number of bytes in data
- */
-int sandbox_sdl_sound_play(const void *data, uint count);
-
 /**
  * sandbox_sdl_sound_init() - set up the sound system
  *
@@ -110,6 +102,11 @@ static inline int sandbox_sdl_sound_start(uint frequency)
return -ENODEV;
 }
 
+int sandbox_sdl_sound_play(const void *data, uint count)
+{
+   return -ENODEV;
+}
+
 static inline int sandbox_sdl_sound_stop(void)
 {
return -ENODEV;
diff --git a/arch/sandbox/include/asm/sound.h b/arch/sandbox/include/asm/sound.h
deleted file mode 100644
index a6015b0f60f..000
--- a/arch/sandbox/include/asm/sound.h
+++ /dev/null
@@ -1,13 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0+ */
-/*
- * Copyright (c) 2013 Google, Inc
- */
-
-#ifndef __SANDBOX_SOUND_H
-#define __SANDBOX_SOUND_H
-
-int sound_play(unsigned int msec, unsigned int frequency);
-
-int sound_init(const void *blob);
-
-#endif
diff --git a/cmd/sound.c b/cmd/sound.c
index 77f51529259..638f29df21d 100644
--- a/cmd/sound.c
+++ b/cmd/sound.c
@@ -15,18 +15,12 @@ DECLARE_GLOBAL_DATA_PTR;
 /* Initilaise sound subsystem */
 static int do_init(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
 {
-#ifdef CONFIG_DM_SOUND
struct udevice *dev;
-#endif
int ret;
 
-#ifdef CONFIG_DM_SOUND
ret = uclass_first_device_err(UCLASS_SOUND, &dev);
if (!ret)
ret = sound_setup(dev);
-#else
-   ret = sound_init(gd->fdt_blob);
-#endif
if (ret) {
printf("Initialise Audio driver failed (ret=%d)\n", ret);
return CMD_RET_FAILURE;
@@ -38,9 +32,7 @@ static int do_init(cmd_tbl_t *cmdtp, int flag, int argc, char 
*const argv[])
 /* play sound from buffer */
 static int do_play(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
 {
-#ifdef CONFIG_DM_SOUND
struct udevice *dev;
-#endif
int ret = 0;
int msec = 1000;
int freq = 400;
@@ -50,13 +42,9 @@ static int do_play(cmd_tbl_t *cmdtp, int flag, int argc, 
char *const argv[])
if (argc > 2)
freq = simple_strtoul(argv[2], NULL, 10);
 
-#ifdef CONFIG_DM_SOUND
ret = uclass_first_device_err(UCLASS_SOUND, &dev);
if (!ret)
ret = sound_beep(dev, msec, freq);
-#else
-   ret = sound_play(msec, freq);
-#endif
if (ret) {
printf("Sound device failed to play (err=%d)\n", ret);
return CMD_RET_FAILURE;
diff --git a/configs/arn

[U-Boot] [PATCH v2 17/22] dm: exynos: Drop CONFIG_DM_I2C_COMPAT

2018-12-10 Thread Simon Glass
This option is not needed anymore for all exynos boards except arndale.
Update the config.

Signed-off-by: Simon Glass 
---

Changes in v2: None

 configs/peach-pi_defconfig  | 1 -
 configs/peach-pit_defconfig | 1 -
 configs/smdk5250_defconfig  | 1 -
 configs/smdk5420_defconfig  | 1 -
 configs/snow_defconfig  | 1 -
 configs/spring_defconfig| 1 -
 6 files changed, 6 deletions(-)

diff --git a/configs/peach-pi_defconfig b/configs/peach-pi_defconfig
index 5ced3423160..32b32dd901c 100644
--- a/configs/peach-pi_defconfig
+++ b/configs/peach-pi_defconfig
@@ -29,7 +29,6 @@ CONFIG_CMD_TPM_TEST=y
 CONFIG_CMD_EXT4_WRITE=y
 CONFIG_DEFAULT_DEVICE_TREE="exynos5800-peach-pi"
 CONFIG_ENV_IS_IN_SPI_FLASH=y
-CONFIG_DM_I2C_COMPAT=y
 CONFIG_I2C_CROS_EC_TUNNEL=y
 CONFIG_I2C_MUX=y
 CONFIG_I2C_ARB_GPIO_CHALLENGE=y
diff --git a/configs/peach-pit_defconfig b/configs/peach-pit_defconfig
index b1fe3f73abb..7018737ab4f 100644
--- a/configs/peach-pit_defconfig
+++ b/configs/peach-pit_defconfig
@@ -28,7 +28,6 @@ CONFIG_CMD_TPM_TEST=y
 CONFIG_CMD_EXT4_WRITE=y
 CONFIG_DEFAULT_DEVICE_TREE="exynos5420-peach-pit"
 CONFIG_ENV_IS_IN_SPI_FLASH=y
-CONFIG_DM_I2C_COMPAT=y
 CONFIG_I2C_CROS_EC_TUNNEL=y
 CONFIG_I2C_MUX=y
 CONFIG_I2C_ARB_GPIO_CHALLENGE=y
diff --git a/configs/smdk5250_defconfig b/configs/smdk5250_defconfig
index 90ee0ffbc9d..1e058227e41 100644
--- a/configs/smdk5250_defconfig
+++ b/configs/smdk5250_defconfig
@@ -30,7 +30,6 @@ CONFIG_CMD_REGULATOR=y
 CONFIG_CMD_EXT4_WRITE=y
 CONFIG_DEFAULT_DEVICE_TREE="exynos5250-smdk5250"
 CONFIG_ENV_IS_IN_SPI_FLASH=y
-CONFIG_DM_I2C_COMPAT=y
 CONFIG_MMC_DW=y
 CONFIG_MMC_SDHCI=y
 CONFIG_MMC_SDHCI_S5P=y
diff --git a/configs/smdk5420_defconfig b/configs/smdk5420_defconfig
index 433e9a8447f..4e4558944cc 100644
--- a/configs/smdk5420_defconfig
+++ b/configs/smdk5420_defconfig
@@ -25,7 +25,6 @@ CONFIG_CMD_TIME=y
 CONFIG_CMD_EXT4_WRITE=y
 CONFIG_DEFAULT_DEVICE_TREE="exynos5420-smdk5420"
 CONFIG_ENV_IS_IN_SPI_FLASH=y
-CONFIG_DM_I2C_COMPAT=y
 CONFIG_MMC_DW=y
 CONFIG_MMC_SDHCI=y
 CONFIG_MMC_SDHCI_S5P=y
diff --git a/configs/snow_defconfig b/configs/snow_defconfig
index 4d1c53d4291..10e11fbb337 100644
--- a/configs/snow_defconfig
+++ b/configs/snow_defconfig
@@ -34,7 +34,6 @@ CONFIG_CMD_TPM_TEST=y
 CONFIG_CMD_EXT4_WRITE=y
 CONFIG_DEFAULT_DEVICE_TREE="exynos5250-snow"
 CONFIG_ENV_IS_IN_SPI_FLASH=y
-CONFIG_DM_I2C_COMPAT=y
 CONFIG_I2C_CROS_EC_LDO=y
 CONFIG_I2C_MUX=y
 CONFIG_I2C_ARB_GPIO_CHALLENGE=y
diff --git a/configs/spring_defconfig b/configs/spring_defconfig
index 8f9436c74af..844a87734b8 100644
--- a/configs/spring_defconfig
+++ b/configs/spring_defconfig
@@ -34,7 +34,6 @@ CONFIG_CMD_TPM_TEST=y
 CONFIG_CMD_EXT4_WRITE=y
 CONFIG_DEFAULT_DEVICE_TREE="exynos5250-spring"
 CONFIG_ENV_IS_IN_SPI_FLASH=y
-CONFIG_DM_I2C_COMPAT=y
 CONFIG_I2C_CROS_EC_LDO=y
 CONFIG_I2C_MUX=y
 CONFIG_I2C_ARB_GPIO_CHALLENGE=y
-- 
2.20.0.rc2.403.gdbc3b29805-goog

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


[U-Boot] [PATCH v2 19/22] dm: sound: Fix license headers

2018-12-10 Thread Simon Glass
Fix a few files whos license headers were not converted to SPDX.

Signed-off-by: Simon Glass 
---

Changes in v2:
- Add new patch to fix license headers

 drivers/sound/max98095.c | 7 ++-
 drivers/sound/max98095.h | 5 +
 2 files changed, 3 insertions(+), 9 deletions(-)

diff --git a/drivers/sound/max98095.c b/drivers/sound/max98095.c
index 93be50c34a2..624c5d24ef3 100644
--- a/drivers/sound/max98095.c
+++ b/drivers/sound/max98095.c
@@ -1,13 +1,10 @@
+// SPDX-License-Identifier: GPL-2.0+
 /*
  * max98095.c -- MAX98095 ALSA SoC Audio driver
  *
  * Copyright 2011 Maxim Integrated Products
  *
- * Modified for uboot by R. Chandrasekar (rcse...@samsung.com)
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
+ * Modified for U-Boot by R. Chandrasekar (rcse...@samsung.com)
  */
 
 #include 
diff --git a/drivers/sound/max98095.h b/drivers/sound/max98095.h
index f189db728d1..1521f3f02f9 100644
--- a/drivers/sound/max98095.h
+++ b/drivers/sound/max98095.h
@@ -1,11 +1,8 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
 /*
  * max98095.h -- MAX98095 ALSA SoC Audio driver
  *
  * Copyright 2011 Maxim Integrated Products
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
  */
 
 #ifndef _MAX98095_H
-- 
2.20.0.rc2.403.gdbc3b29805-goog

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


[U-Boot] [PATCH v2 09/22] dm: sound: Start i2c IDs from 0

2018-12-10 Thread Simon Glass
The current ID enums start from 1 but there does not seem to be any reason
that they cannot start with 0. Adjust the code to avoid the +1 in
codec_init().

Signed-off-by: Simon Glass 
---

Changes in v2: None

 drivers/sound/max98095.h  | 2 +-
 drivers/sound/sound-i2s.c | 6 ++
 drivers/sound/wm8994.h| 2 +-
 3 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/sound/max98095.h b/drivers/sound/max98095.h
index 44b1e3a97b4..13ae177a86b 100644
--- a/drivers/sound/max98095.h
+++ b/drivers/sound/max98095.h
@@ -13,7 +13,7 @@
 
 /*  Available audio interface ports in wm8994 codec */
 enum en_max_audio_interface {
-   AIF1 = 1,
+   AIF1,
AIF2,
 };
 
diff --git a/drivers/sound/sound-i2s.c b/drivers/sound/sound-i2s.c
index ed130750b2e..a2fc78154f1 100644
--- a/drivers/sound/sound-i2s.c
+++ b/drivers/sound/sound-i2s.c
@@ -120,13 +120,11 @@ static int codec_init(const void *blob, struct 
i2s_uc_priv *pi2s_tx)
debug("device = %s\n", codectype);
if (!strcmp(codectype, "wm8994")) {
/* Check the codec type and initialise the same */
-   ret = wm8994_init(blob, pi2s_tx->id + 1,
- pi2s_tx->samplingrate,
+   ret = wm8994_init(blob, pi2s_tx->id, pi2s_tx->samplingrate,
  (pi2s_tx->samplingrate * (pi2s_tx->rfs)),
  pi2s_tx->bitspersample, pi2s_tx->channels);
} else if (!strcmp(codectype, "max98095")) {
-   ret = max98095_init(blob, pi2s_tx->id + 1,
-   pi2s_tx->samplingrate,
+   ret = max98095_init(blob, pi2s_tx->id, pi2s_tx->samplingrate,
(pi2s_tx->samplingrate * (pi2s_tx->rfs)),
pi2s_tx->bitspersample);
} else {
diff --git a/drivers/sound/wm8994.h b/drivers/sound/wm8994.h
index ef2878f87ca..e36e6269f00 100644
--- a/drivers/sound/wm8994.h
+++ b/drivers/sound/wm8994.h
@@ -15,7 +15,7 @@
 
 /*  Avilable audi interface ports in wm8994 codec */
 enum en_audio_interface {
-WM8994_AIF1 = 1,
+WM8994_AIF1,
 WM8994_AIF2,
 WM8994_AIF3
 };
-- 
2.20.0.rc2.403.gdbc3b29805-goog

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


[U-Boot] [PATCH v2 07/22] dm: sound: Create a uclass for sound

2018-12-10 Thread Simon Glass
The sound driver pulls together the audio codec and i2s drivers in order
to actually make sounds. It supports setup() and play() methods. The
sound_find_codec_i2s() function allows locating the linked codec and i2s
devices. They can be referred to from uclass-private data.

Add a uclass and a test for sound.

Signed-off-by: Simon Glass 
---

Changes in v2:
- Update 'init' command to print the error code

 arch/sandbox/dts/test.dts   |  11 +++
 arch/sandbox/include/asm/test.h |  20 +
 cmd/sound.c |  23 +-
 drivers/sound/Makefile  |   1 +
 drivers/sound/sandbox.c |  67 +
 drivers/sound/sound-uclass.c| 127 
 include/dm/uclass-id.h  |   1 +
 include/sound.h |  70 +-
 test/dm/Makefile|   1 +
 test/dm/sound.c |  34 +
 10 files changed, 351 insertions(+), 4 deletions(-)
 create mode 100644 drivers/sound/sound-uclass.c
 create mode 100644 test/dm/sound.c

diff --git a/arch/sandbox/dts/test.dts b/arch/sandbox/dts/test.dts
index 28e2818ff37..cedf514382f 100644
--- a/arch/sandbox/dts/test.dts
+++ b/arch/sandbox/dts/test.dts
@@ -536,6 +536,17 @@
compatible = "sandbox,smem";
};
 
+   sound {
+   compatible = "sandbox,sound";
+   cpu {
+   sound-dai = <&i2s 0>;
+   };
+
+   codec {
+   sound-dai = <&audio 0>;
+   };
+   };
+
spi@0 {
#address-cells = <1>;
#size-cells = <0>;
diff --git a/arch/sandbox/include/asm/test.h b/arch/sandbox/include/asm/test.h
index 71bd50bd5bc..74f96188220 100644
--- a/arch/sandbox/include/asm/test.h
+++ b/arch/sandbox/include/asm/test.h
@@ -141,4 +141,24 @@ void sandbox_get_codec_params(struct udevice *dev, int 
*interfacep, int *ratep,
  */
 int sandbox_get_i2s_sum(struct udevice *dev);
 
+/**
+ * sandbox_get_setup_called() - Returns the number of times setup(*) was called
+ *
+ * This is used in the sound test
+ *
+ * @dev: Device to check
+ * @return call count for the setup() method
+ */
+int sandbox_get_setup_called(struct udevice *dev);
+
+/**
+ * sandbox_get_sound_sum() - Read back the sum of the sound data so far
+ *
+ * This data is provided to the sandbox driver by the sound play() method.
+ *
+ * @dev: Device to check
+ * @return sum of audio data
+ */
+int sandbox_get_sound_sum(struct udevice *dev);
+
 #endif
diff --git a/cmd/sound.c b/cmd/sound.c
index d1cbc14f8df..77f51529259 100644
--- a/cmd/sound.c
+++ b/cmd/sound.c
@@ -6,6 +6,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -14,11 +15,20 @@ DECLARE_GLOBAL_DATA_PTR;
 /* Initilaise sound subsystem */
 static int do_init(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
 {
+#ifdef CONFIG_DM_SOUND
+   struct udevice *dev;
+#endif
int ret;
 
+#ifdef CONFIG_DM_SOUND
+   ret = uclass_first_device_err(UCLASS_SOUND, &dev);
+   if (!ret)
+   ret = sound_setup(dev);
+#else
ret = sound_init(gd->fdt_blob);
+#endif
if (ret) {
-   printf("Initialise Audio driver failed\n");
+   printf("Initialise Audio driver failed (ret=%d)\n", ret);
return CMD_RET_FAILURE;
}
 
@@ -28,6 +38,9 @@ static int do_init(cmd_tbl_t *cmdtp, int flag, int argc, char 
*const argv[])
 /* play sound from buffer */
 static int do_play(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
 {
+#ifdef CONFIG_DM_SOUND
+   struct udevice *dev;
+#endif
int ret = 0;
int msec = 1000;
int freq = 400;
@@ -37,9 +50,15 @@ static int do_play(cmd_tbl_t *cmdtp, int flag, int argc, 
char *const argv[])
if (argc > 2)
freq = simple_strtoul(argv[2], NULL, 10);
 
+#ifdef CONFIG_DM_SOUND
+   ret = uclass_first_device_err(UCLASS_SOUND, &dev);
+   if (!ret)
+   ret = sound_beep(dev, msec, freq);
+#else
ret = sound_play(msec, freq);
+#endif
if (ret) {
-   printf("play failed");
+   printf("Sound device failed to play (err=%d)\n", ret);
return CMD_RET_FAILURE;
}
 
diff --git a/drivers/sound/Makefile b/drivers/sound/Makefile
index 4aced9d22b9..70d32c6d6f6 100644
--- a/drivers/sound/Makefile
+++ b/drivers/sound/Makefile
@@ -7,6 +7,7 @@ obj-$(CONFIG_SOUND) += sound.o
 obj-$(CONFIG_DM_SOUND) += codec-uclass.o
 obj-$(CONFIG_DM_SOUND) += i2s-uclass.o
 obj-$(CONFIG_I2S)  += sound-i2s.o
+obj-$(CONFIG_DM_SOUND) += sound-uclass.o
 obj-$(CONFIG_I2S_SAMSUNG)  += samsung-i2s.o
 obj-$(CONFIG_SOUND_SANDBOX)+= sandbox.o
 obj-$(CONFIG_SOUND_WM8994) += wm8994.o
diff --git a/drivers/sound/sandbox.c b/drivers/sound/sandbox.c
index 2f7c68be0c8..ee2635f41d2 100644
--- a/drivers/sound/sandbox.c
+++ b/drivers/sound/sandbox.c
@@ -7,6 +7,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #i

[U-Boot] [PATCH v2 08/22] dm: core: Add a function to read into a unsigned int

2018-12-10 Thread Simon Glass
The current dev_read...() functions use s32 and u32 which are convenient
for device tree but not so useful for normal code, which often wants to
use normal integers for values.

Add a helper which supports returning an unsigned int. Also add signed
versions of the unsigned readers.

Signed-off-by: Simon Glass 
---

Changes in v2: None

 arch/sandbox/dts/test.dts |  2 ++
 drivers/core/read.c   | 23 
 include/dm/read.h | 58 +++
 test/dm/test-fdt.c| 35 +++
 4 files changed, 118 insertions(+)

diff --git a/arch/sandbox/dts/test.dts b/arch/sandbox/dts/test.dts
index cedf514382f..e5c14fec5d8 100644
--- a/arch/sandbox/dts/test.dts
+++ b/arch/sandbox/dts/test.dts
@@ -87,6 +87,8 @@
test2-gpios = <&gpio_a 1>, <&gpio_a 4>, <&gpio_b 6 1 3 2 1>,
<&gpio_b 7 2 3 2 1>, <&gpio_b 8 4 3 2 1>,
<&gpio_b 9 0xc 3 2 1>;
+   int-value = <1234>;
+   uint-value = <(-1234)>;
};
 
junk {
diff --git a/drivers/core/read.c b/drivers/core/read.c
index cdd78be03e2..3c46b3674ed 100644
--- a/drivers/core/read.c
+++ b/drivers/core/read.c
@@ -21,6 +21,29 @@ int dev_read_u32_default(struct udevice *dev, const char 
*propname, int def)
return ofnode_read_u32_default(dev_ofnode(dev), propname, def);
 }
 
+int dev_read_s32(struct udevice *dev, const char *propname, s32 *outp)
+{
+   return ofnode_read_u32(dev_ofnode(dev), propname, (u32 *)outp);
+}
+
+int dev_read_s32_default(struct udevice *dev, const char *propname, int def)
+{
+   return ofnode_read_u32_default(dev_ofnode(dev), propname, def);
+}
+
+int dev_read_u32u(struct udevice *dev, const char *propname, uint *outp)
+{
+   u32 val;
+   int ret;
+
+   ret = ofnode_read_u32(dev_ofnode(dev), propname, &val);
+   if (ret)
+   return ret;
+   *outp = val;
+
+   return 0;
+}
+
 const char *dev_read_string(struct udevice *dev, const char *propname)
 {
return ofnode_read_string(dev_ofnode(dev), propname);
diff --git a/include/dm/read.h b/include/dm/read.h
index efcbee15eca..389e30e7fb4 100644
--- a/include/dm/read.h
+++ b/include/dm/read.h
@@ -64,6 +64,38 @@ int dev_read_u32(struct udevice *dev, const char *propname, 
u32 *outp);
  */
 int dev_read_u32_default(struct udevice *dev, const char *propname, int def);
 
+/**
+ * dev_read_s32() - read a signed 32-bit integer from a device's DT property
+ *
+ * @dev:   device to read DT property from
+ * @propname:  name of the property to read from
+ * @outp:  place to put value (if found)
+ * @return 0 if OK, -ve on error
+ */
+int dev_read_s32(struct udevice *dev, const char *propname, s32 *outp);
+
+/**
+ * dev_read_s32_default() - read a signed 32-bit int from a device's DT 
property
+ *
+ * @dev:   device to read DT property from
+ * @propname:  name of the property to read from
+ * @def:   default value to return if the property has no value
+ * @return property value, or @def if not found
+ */
+int dev_read_s32_default(struct udevice *dev, const char *propname, int def);
+
+/**
+ * dev_read_u32u() - read a 32-bit integer from a device's DT property
+ *
+ * This version uses a standard uint type.
+ *
+ * @dev:   device to read DT property from
+ * @propname:  name of the property to read from
+ * @outp:  place to put value (if found)
+ * @return 0 if OK, -ve on error
+ */
+int dev_read_u32u(struct udevice *dev, const char *propname, uint *outp);
+
 /**
  * dev_read_string() - Read a string from a device's DT property
  *
@@ -492,6 +524,32 @@ static inline int dev_read_u32_default(struct udevice *dev,
return ofnode_read_u32_default(dev_ofnode(dev), propname, def);
 }
 
+static inline int dev_read_s32(struct udevice *dev,
+  const char *propname, s32 *outp)
+{
+   return ofnode_read_s32(dev_ofnode(dev), propname, outp);
+}
+
+static inline int dev_read_s32_default(struct udevice *dev,
+  const char *propname, int def)
+{
+   return ofnode_read_s32_default(dev_ofnode(dev), propname, def);
+}
+
+static inline int dev_read_u32u(struct udevice *dev,
+   const char *propname, uint *outp)
+{
+   u32 val;
+   int ret;
+
+   ret = ofnode_read_u32(dev_ofnode(dev), propname, &val);
+   if (ret)
+   return ret;
+   *outp = val;
+
+   return 0;
+}
+
 static inline const char *dev_read_string(struct udevice *dev,
  const char *propname)
 {
diff --git a/test/dm/test-fdt.c b/test/dm/test-fdt.c
index 96d2528accb..984b80c02c8 100644
--- a/test/dm/test-fdt.c
+++ b/test/dm/test-fdt.c
@@ -736,3 +736,38 @@ static int dm_test_first_child(struct unit_test_state *uts)
return 0;
 }
 DM_TEST(dm_test_first_child, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT);
+
+/* Test integer functions in dm_read_...() */
+static int

[U-Boot] [PATCH v2 05/22] dm: sound: Create a uclass for i2s

2018-12-10 Thread Simon Glass
The i2s bus is commonly used with audio codecs. It provides a way to
stream digital data sychronously in both directions. U-Boot only supports
audio output, so this uclass is very simple, with a single tx_data()
method.

Add a uclass and a test for i2s.

Signed-off-by: Simon Glass 
---

Changes in v2: None

 arch/sandbox/dts/test.dts   |  7 +++-
 arch/sandbox/include/asm/test.h | 10 ++
 drivers/sound/Makefile  |  1 +
 drivers/sound/i2s-uclass.c  | 25 ++
 drivers/sound/sandbox.c | 60 -
 include/dm/uclass-id.h  |  1 +
 include/i2s.h   | 32 +++---
 test/dm/Makefile|  1 +
 test/dm/i2s.c   | 32 ++
 9 files changed, 163 insertions(+), 6 deletions(-)
 create mode 100644 drivers/sound/i2s-uclass.c
 create mode 100644 test/dm/i2s.c

diff --git a/arch/sandbox/dts/test.dts b/arch/sandbox/dts/test.dts
index 73425b125a9..28e2818ff37 100644
--- a/arch/sandbox/dts/test.dts
+++ b/arch/sandbox/dts/test.dts
@@ -47,7 +47,7 @@
#sound-dai-cells = <1>;
};
 
-   cros_ec: cros-ec {
+   cros_ec: cros-ec {
reg = <0 0>;
compatible = "google,cros-ec-sandbox";
 
@@ -378,6 +378,11 @@
u-boot,dm-pre-reloc;
};
 
+   i2s: i2s {
+   compatible = "sandbox,i2s";
+   #sound-dai-cells = <1>;
+   };
+
misc-test {
compatible = "sandbox,misc_sandbox";
};
diff --git a/arch/sandbox/include/asm/test.h b/arch/sandbox/include/asm/test.h
index f70e0d84177..71bd50bd5bc 100644
--- a/arch/sandbox/include/asm/test.h
+++ b/arch/sandbox/include/asm/test.h
@@ -131,4 +131,14 @@ void sandbox_get_codec_params(struct udevice *dev, int 
*interfacep, int *ratep,
  int *mclk_freqp, int *bits_per_samplep,
  uint *channelsp);
 
+/**
+ * sandbox_get_i2s_sum() - Read back the sum of the audio data so far
+ *
+ * This data is provided to the sandbox driver by the I2S tx_data() method.
+ *
+ * @dev: Device to check
+ * @return sum of audio data
+ */
+int sandbox_get_i2s_sum(struct udevice *dev);
+
 #endif
diff --git a/drivers/sound/Makefile b/drivers/sound/Makefile
index ae5fabed846..4aced9d22b9 100644
--- a/drivers/sound/Makefile
+++ b/drivers/sound/Makefile
@@ -5,6 +5,7 @@
 
 obj-$(CONFIG_SOUND)+= sound.o
 obj-$(CONFIG_DM_SOUND) += codec-uclass.o
+obj-$(CONFIG_DM_SOUND) += i2s-uclass.o
 obj-$(CONFIG_I2S)  += sound-i2s.o
 obj-$(CONFIG_I2S_SAMSUNG)  += samsung-i2s.o
 obj-$(CONFIG_SOUND_SANDBOX)+= sandbox.o
diff --git a/drivers/sound/i2s-uclass.c b/drivers/sound/i2s-uclass.c
new file mode 100644
index 000..b741e3952d1
--- /dev/null
+++ b/drivers/sound/i2s-uclass.c
@@ -0,0 +1,25 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright 2018 Google LLC
+ * Written by Simon Glass 
+ */
+
+#include 
+#include 
+#include 
+
+int i2s_tx_data(struct udevice *dev, void *data, uint data_size)
+{
+   struct i2s_ops *ops = i2s_get_ops(dev);
+
+   if (!ops->tx_data)
+   return -ENOSYS;
+
+   return ops->tx_data(dev, data, data_size);
+}
+
+UCLASS_DRIVER(i2s) = {
+   .id = UCLASS_I2S,
+   .name   = "i2s",
+   .per_device_auto_alloc_size = sizeof(struct i2s_uc_priv),
+};
diff --git a/drivers/sound/sandbox.c b/drivers/sound/sandbox.c
index d24eb9ae9ce..2f7c68be0c8 100644
--- a/drivers/sound/sandbox.c
+++ b/drivers/sound/sandbox.c
@@ -4,8 +4,9 @@
  */
 
 #include 
-#include 
 #include 
+#include 
+#include 
 #include 
 #include 
 
@@ -17,6 +18,10 @@ struct sandbox_codec_priv {
uint channels;
 };
 
+struct sandbox_i2s_priv {
+   int sum;/* Use to sum the provided audio data */
+};
+
 int sound_play(uint32_t msec, uint32_t frequency)
 {
sandbox_sdl_sound_start(frequency);
@@ -44,6 +49,13 @@ void sandbox_get_codec_params(struct udevice *dev, int 
*interfacep, int *ratep,
*channelsp = priv->channels;
 }
 
+int sandbox_get_i2s_sum(struct udevice *dev)
+{
+   struct sandbox_i2s_priv *priv = dev_get_priv(dev);
+
+   return priv->sum;
+}
+
 static int sandbox_codec_set_params(struct udevice *dev, int interface,
int rate, int mclk_freq,
int bits_per_sample, uint channels)
@@ -59,6 +71,34 @@ static int sandbox_codec_set_params(struct udevice *dev, int 
interface,
return 0;
 }
 
+static int sandbox_i2s_tx_data(struct udevice *dev, void *data,
+  uint data_size)
+{
+   struct sandbox_i2s_priv *priv = dev_get_priv(dev);
+   int i;
+
+   for (i = 0; i < data_size; i++)
+   priv->sum += ((uint8_t *)data)[i];
+
+   return 0;
+}
+
+static int sandbox_i2s_probe(struct udevice *dev)
+{
+   struct i2s_uc_priv *uc_priv = dev_get_uclass_priv(dev);
+
+   /* Use hard-coded values 

[U-Boot] [PATCH v2 04/22] dm: sound: Create a uclass for audio codecs

2018-12-10 Thread Simon Glass
An audio codec provides a way to convert digital data to sound and vice
versa. Add a simple uclass which just supports setting the parameters for
the codec.

Signed-off-by: Simon Glass 
---

Changes in v2: None

 arch/sandbox/dts/test.dts   |  7 -
 arch/sandbox/include/asm/test.h | 10 ++
 drivers/sound/Makefile  |  1 +
 drivers/sound/codec-uclass.c| 26 
 drivers/sound/sandbox.c | 55 +
 include/audio_codec.h   | 48 
 include/dm/uclass-id.h  |  1 +
 test/dm/Makefile|  1 +
 test/dm/audio.c | 34 
 9 files changed, 182 insertions(+), 1 deletion(-)
 create mode 100644 drivers/sound/codec-uclass.c
 create mode 100644 include/audio_codec.h
 create mode 100644 test/dm/audio.c

diff --git a/arch/sandbox/dts/test.dts b/arch/sandbox/dts/test.dts
index 082fcec3f9e..73425b125a9 100644
--- a/arch/sandbox/dts/test.dts
+++ b/arch/sandbox/dts/test.dts
@@ -42,7 +42,12 @@
osd0 = "/osd";
};
 
-   cros_ec: cros-ec {
+   audio: audio-codec {
+   compatible = "sandbox,audio-codec";
+   #sound-dai-cells = <1>;
+   };
+
+   cros_ec: cros-ec {
reg = <0 0>;
compatible = "google,cros-ec-sandbox";
 
diff --git a/arch/sandbox/include/asm/test.h b/arch/sandbox/include/asm/test.h
index 5e818392959..f70e0d84177 100644
--- a/arch/sandbox/include/asm/test.h
+++ b/arch/sandbox/include/asm/test.h
@@ -121,4 +121,14 @@ int sandbox_pwm_get_config(struct udevice *dev, uint 
channel, uint *period_nsp,
  */
 void sandbox_sf_set_block_protect(struct udevice *dev, int bp_mask);
 
+/**
+ * sandbox_get_codec_params() - Read back codec parameters
+ *
+ * This reads back the parameters set by audio_codec_set_params() for the
+ * sandbox audio driver. Arguments are as for that function.
+ */
+void sandbox_get_codec_params(struct udevice *dev, int *interfacep, int *ratep,
+ int *mclk_freqp, int *bits_per_samplep,
+ uint *channelsp);
+
 #endif
diff --git a/drivers/sound/Makefile b/drivers/sound/Makefile
index 696c5aecbe9..ae5fabed846 100644
--- a/drivers/sound/Makefile
+++ b/drivers/sound/Makefile
@@ -4,6 +4,7 @@
 # R. Chandrasekar 
 
 obj-$(CONFIG_SOUND)+= sound.o
+obj-$(CONFIG_DM_SOUND) += codec-uclass.o
 obj-$(CONFIG_I2S)  += sound-i2s.o
 obj-$(CONFIG_I2S_SAMSUNG)  += samsung-i2s.o
 obj-$(CONFIG_SOUND_SANDBOX)+= sandbox.o
diff --git a/drivers/sound/codec-uclass.c b/drivers/sound/codec-uclass.c
new file mode 100644
index 000..1ec77acfc1c
--- /dev/null
+++ b/drivers/sound/codec-uclass.c
@@ -0,0 +1,26 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright 2018 Google LLC
+ * Written by Simon Glass 
+ */
+
+#include 
+#include 
+#include 
+
+int audio_codec_set_params(struct udevice *dev, int interface, int rate,
+  int mclk_freq, int bits_per_sample, uint channels)
+{
+   struct audio_codec_ops *ops = audio_codec_get_ops(dev);
+
+   if (!ops->set_params)
+   return -ENOSYS;
+
+   return ops->set_params(dev, interface, rate, mclk_freq, bits_per_sample,
+  channels);
+}
+
+UCLASS_DRIVER(audio_codec) = {
+   .id = UCLASS_AUDIO_CODEC,
+   .name   = "audio-codec",
+};
diff --git a/drivers/sound/sandbox.c b/drivers/sound/sandbox.c
index 94eff542824..d24eb9ae9ce 100644
--- a/drivers/sound/sandbox.c
+++ b/drivers/sound/sandbox.c
@@ -4,9 +4,19 @@
  */
 
 #include 
+#include 
+#include 
 #include 
 #include 
 
+struct sandbox_codec_priv {
+   int interface;
+   int rate;
+   int mclk_freq;
+   int bits_per_sample;
+   uint channels;
+};
+
 int sound_play(uint32_t msec, uint32_t frequency)
 {
sandbox_sdl_sound_start(frequency);
@@ -20,3 +30,48 @@ int sound_init(const void *blob)
 {
return sandbox_sdl_sound_init();
 }
+
+void sandbox_get_codec_params(struct udevice *dev, int *interfacep, int *ratep,
+ int *mclk_freqp, int *bits_per_samplep,
+ uint *channelsp)
+{
+   struct sandbox_codec_priv *priv = dev_get_priv(dev);
+
+   *interfacep = priv->interface;
+   *ratep = priv->rate;
+   *mclk_freqp = priv->mclk_freq;
+   *bits_per_samplep = priv->bits_per_sample;
+   *channelsp = priv->channels;
+}
+
+static int sandbox_codec_set_params(struct udevice *dev, int interface,
+   int rate, int mclk_freq,
+   int bits_per_sample, uint channels)
+{
+   struct sandbox_codec_priv *priv = dev_get_priv(dev);
+
+   priv->interface = interface;
+   priv->rate = rate;
+   priv->mclk_freq = mclk_freq;
+   priv->bits_per_sample = bits_per_sample;
+   priv->channels = channels;
+
+   return 0;
+}
+
+static const struct audio_c

[U-Boot] [PATCH v2 02/22] dm: sound: Create an option to use driver model for sound

2018-12-10 Thread Simon Glass
The U-Boot sound system provides basic support for beeping. At present it
does not use driver model, but it needs to be converted. Add an option to
enable driver model for sound. For now it is not connected to anything.
Future work will add drivers which use this option. It will then be
removed once everything is converted.

Signed-off-by: Simon Glass 
---

Changes in v2:
- Use Kconfig instead of defconfig to define DM_SOUND

 arch/Kconfig  | 1 +
 drivers/sound/Kconfig | 6 ++
 2 files changed, 7 insertions(+)

diff --git a/arch/Kconfig b/arch/Kconfig
index 947070fdd35..35e2712fce9 100644
--- a/arch/Kconfig
+++ b/arch/Kconfig
@@ -116,6 +116,7 @@ config SANDBOX
imply VIRTIO_SANDBOX
imply VIRTIO_BLK
imply VIRTIO_NET
+   imply DM_SOUND
 
 config SH
bool "SuperH architecture"
diff --git a/drivers/sound/Kconfig b/drivers/sound/Kconfig
index 5de86c05c60..93f6c36af32 100644
--- a/drivers/sound/Kconfig
+++ b/drivers/sound/Kconfig
@@ -12,6 +12,12 @@ config SOUND
  audio codecs are called from the sound-i2s code. This could be
  converted to driver model.
 
+config DM_SOUND
+   bool "Use driver model for sound"
+   help
+ Enable this option to use driver model for sound devices. This is a
+ migration option and will be removed.
+
 config I2S
bool "Enable I2S support"
depends on SOUND
-- 
2.20.0.rc2.403.gdbc3b29805-goog

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


[U-Boot] [PATCH v2 06/22] dm: sandbox: Update sound to use two buffers

2018-12-10 Thread Simon Glass
At present we use a single buffer for sound which means we cannot be
playing one sound while queueing up the next. This wouldn't matter except
that a long sound (more than a second) has to be created as a single
buffer, thus using a lot of memory. To better mimic what real sound
drivers do, add support for double buffering in sandbox.

Signed-off-by: Simon Glass 
---

Changes in v2: None

 arch/sandbox/cpu/sdl.c | 88 ++
 1 file changed, 63 insertions(+), 25 deletions(-)

diff --git a/arch/sandbox/cpu/sdl.c b/arch/sandbox/cpu/sdl.c
index c7a8d945492..4dacdbf993f 100644
--- a/arch/sandbox/cpu/sdl.c
+++ b/arch/sandbox/cpu/sdl.c
@@ -13,6 +13,21 @@ enum {
SAMPLE_RATE = 22050,
 };
 
+/**
+ * struct buf_info - a data buffer holding audio data
+ *
+ * @pos:   Current position playing in audio buffer
+ * @size:  Size of data in audio buffer (0=empty)
+ * @alloced:   Allocated size of audio buffer (max size it can hold)
+ * @data:  Audio data
+ */
+struct buf_info {
+   uint pos;
+   uint size;
+   uint alloced;
+   uint8_t *data;
+};
+
 static struct sdl_info {
SDL_Surface *screen;
int width;
@@ -20,12 +35,11 @@ static struct sdl_info {
int depth;
int pitch;
uint frequency;
-   uint audio_pos;
-   uint audio_size;
uint sample_rate;
-   uint8_t *audio_data;
bool audio_active;
bool inited;
+   int cur_buf;
+   struct buf_info buf[2];
 } sdl;
 
 static void sandbox_sdl_poll_events(void)
@@ -243,24 +257,37 @@ int sandbox_sdl_key_pressed(int keycode)
 
 void sandbox_sdl_fill_audio(void *udata, Uint8 *stream, int len)
 {
+   struct buf_info *buf;
int avail;
+   int i;
 
-   avail = sdl.audio_size - sdl.audio_pos;
-   if (avail < len)
-   len = avail;
-
-   SDL_MixAudio(stream, sdl.audio_data + sdl.audio_pos, len,
-SDL_MIX_MAXVOLUME);
-   sdl.audio_pos += len;
-
-   /* Loop if we are at the end */
-   if (sdl.audio_pos == sdl.audio_size)
-   sdl.audio_pos = 0;
+   for (i = 0; i < 2; i++) {
+   buf = &sdl.buf[sdl.cur_buf];
+   avail = buf->size - buf->pos;
+   if (avail <= 0) {
+   sdl.cur_buf = 1 - sdl.cur_buf;
+   continue;
+   }
+   if (avail > len)
+   avail = len;
+
+   SDL_MixAudio(stream, buf->data + buf->pos, avail,
+SDL_MIX_MAXVOLUME);
+   buf->pos += avail;
+   len -= avail;
+
+   /* Move to next buffer if we are at the end */
+   if (buf->pos == buf->size)
+   buf->size = 0;
+   else
+   break;
+   }
 }
 
 int sandbox_sdl_sound_init(void)
 {
SDL_AudioSpec wanted;
+   int i;
 
if (sandbox_sdl_ensure_init())
return -1;
@@ -276,13 +303,20 @@ int sandbox_sdl_sound_init(void)
wanted.callback = sandbox_sdl_fill_audio;
wanted.userdata = NULL;
 
-   sdl.audio_size = sizeof(uint16_t) * wanted.freq;
-   sdl.audio_data = malloc(sdl.audio_size);
-   if (!sdl.audio_data) {
-   printf("%s: Out of memory\n", __func__);
-   return -1;
+   for (i = 0; i < 2; i++) {
+   struct buf_info *buf = &sdl.buf[i];
+
+   buf->alloced = sizeof(uint16_t) * wanted.freq * wanted.channels;
+   buf->data = malloc(buf->alloced);
+   if (!buf->data) {
+   printf("%s: Out of memory\n", __func__);
+   if (i == 1)
+   free(sdl.buf[0].data);
+   return -1;
+   }
+   buf->pos = 0;
+   buf->size = 0;
}
-   sdl.audio_pos = 0;
 
if (SDL_InitSubSystem(SDL_INIT_AUDIO) < 0) {
printf("Unable to initialize SDL audio: %s\n", SDL_GetError());
@@ -296,23 +330,27 @@ int sandbox_sdl_sound_init(void)
}
sdl.audio_active = true;
sdl.sample_rate = wanted.freq;
+   sdl.cur_buf = 0;
 
return 0;
 
 err:
-   free(sdl.audio_data);
+   for (i = 0; i < 2; i++)
+   free(sdl.buf[i].data);
return -1;
 }
 
 int sandbox_sdl_sound_start(uint frequency)
 {
+   struct buf_info *buf = &sdl.buf[0];
+
if (!sdl.audio_active)
return -1;
sdl.frequency = frequency;
-   sound_create_square_wave(sdl.sample_rate,
-(unsigned short *)sdl.audio_data,
-sdl.audio_size, frequency);
-   sdl.audio_pos = 0;
+   sound_create_square_wave(sdl.sample_rate, (unsigned short *)buf->data,
+buf->alloced, frequency);
+   buf->pos = 0;
+   buf->size = buf->alloced;
SDL_PauseAudio(0);
 
   

[U-Boot] [PATCH v2 03/22] dm: sound: Rename samsung_i2s_priv to i2s_uc_priv

2018-12-10 Thread Simon Glass
This structure contains information that is likely needed by any i2s
driver so it seems useful to attach it to the (forthcoming) i2c uclass.
For now, just rename it.

Signed-off-by: Simon Glass 
---

Changes in v2: None

 drivers/sound/samsung-i2s.c |  4 ++--
 drivers/sound/sound-i2s.c   | 10 +-
 include/i2s.h   |  6 +++---
 3 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/sound/samsung-i2s.c b/drivers/sound/samsung-i2s.c
index c07d3cdb4c8..5cd585808ab 100644
--- a/drivers/sound/samsung-i2s.c
+++ b/drivers/sound/samsung-i2s.c
@@ -255,7 +255,7 @@ static int i2s_set_samplesize(struct i2s_reg *i2s_reg, 
unsigned int blc)
return 0;
 }
 
-int i2s_transfer_tx_data(struct samsung_i2s_priv *pi2s_tx, unsigned int *data,
+int i2s_transfer_tx_data(struct i2s_uc_priv *pi2s_tx, unsigned int *data,
 unsigned long data_size)
 {
int i;
@@ -293,7 +293,7 @@ int i2s_transfer_tx_data(struct samsung_i2s_priv *pi2s_tx, 
unsigned int *data,
return 0;
 }
 
-int i2s_tx_init(struct samsung_i2s_priv *pi2s_tx)
+int i2s_tx_init(struct i2s_uc_priv *pi2s_tx)
 {
int ret;
struct i2s_reg *i2s_reg =
diff --git a/drivers/sound/sound-i2s.c b/drivers/sound/sound-i2s.c
index 106842a23db..ed130750b2e 100644
--- a/drivers/sound/sound-i2s.c
+++ b/drivers/sound/sound-i2s.c
@@ -20,15 +20,15 @@
 #define SOUND_400_HZ 400
 #define SOUND_BITS_IN_BYTE 8
 
-static struct samsung_i2s_priv g_i2stx_pri;
+static struct i2s_uc_priv g_i2stx_pri;
 
 /*
  * get_sound_i2s_values gets values for i2s parameters
  *
- * @param samsung_i2s_priv i2s transmitter transfer param structure
+ * @param i2s_uc_priv  i2s transmitter transfer param structure
  * @param blob FDT blob if enabled else NULL
  */
-static int get_sound_i2s_values(struct samsung_i2s_priv *i2s, const void *blob)
+static int get_sound_i2s_values(struct i2s_uc_priv *i2s, const void *blob)
 {
int node;
int error = 0;
@@ -97,7 +97,7 @@ static int get_sound_i2s_values(struct samsung_i2s_priv *i2s, 
const void *blob)
  * @param pi2s_tx  i2s parameters required by codec
  * @return  int value, 0 for success
  */
-static int codec_init(const void *blob, struct samsung_i2s_priv *pi2s_tx)
+static int codec_init(const void *blob, struct i2s_uc_priv *pi2s_tx)
 {
int ret;
const char *codectype;
@@ -145,7 +145,7 @@ static int codec_init(const void *blob, struct 
samsung_i2s_priv *pi2s_tx)
 int sound_init(const void *blob)
 {
int ret;
-   struct samsung_i2s_priv *pi2s_tx = &g_i2stx_pri;
+   struct i2s_uc_priv *pi2s_tx = &g_i2stx_pri;
 
/* Get the I2S Values */
if (get_sound_i2s_values(pi2s_tx, blob) < 0) {
diff --git a/include/i2s.h b/include/i2s.h
index 800473abd9c..f23862ca040 100644
--- a/include/i2s.h
+++ b/include/i2s.h
@@ -76,7 +76,7 @@ struct i2s_reg {
 };
 
 /* This structure stores the i2s related information */
-struct samsung_i2s_priv {
+struct i2s_uc_priv {
unsigned int rfs;   /* LR clock frame size */
unsigned int bfs;   /* Bit slock frame size */
unsigned int audio_pll_clk; /* Audio pll frequency in Hz */
@@ -96,7 +96,7 @@ struct samsung_i2s_priv {
  *
  * @return int value 0 for success, -1 in case of error
  */
-int i2s_transfer_tx_data(struct samsung_i2s_priv *pi2s_tx, uint *data,
+int i2s_transfer_tx_data(struct i2s_uc_priv *pi2s_tx, unsigned int *data,
 unsigned long data_size);
 
 /*
@@ -106,6 +106,6 @@ int i2s_transfer_tx_data(struct samsung_i2s_priv *pi2s_tx, 
uint *data,
  *
  * @return int value 0 for success, -1 in case of error
  */
-int i2s_tx_init(struct samsung_i2s_priv *pi2s_tx);
+int i2s_tx_init(struct i2s_uc_priv *pi2s_tx);
 
 #endif /* __I2S_H__ */
-- 
2.20.0.rc2.403.gdbc3b29805-goog

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


[U-Boot] [PATCH v2 01/22] dm: sound: exynos: Correct codec bus addresses

2018-12-10 Thread Simon Glass
For snow the codec is at address 0x11 on the i2c bus, in 7-bit format.
The device tree and code are in 8-bit format (i.e. shifted left one bit).
Fix both. Fix pit in a similar way.

Signed-off-by: Simon Glass 
---

Changes in v2:
- Add fix for pit and pi also
- Fix up tabs in this commit instead of the later one

 arch/arm/dts/exynos5250-snow.dts  | 4 ++--
 arch/arm/dts/exynos5420-peach-pit.dts | 8 
 arch/arm/dts/exynos5800-peach-pi.dts  | 8 
 drivers/sound/max98095.c  | 3 +--
 4 files changed, 11 insertions(+), 12 deletions(-)

diff --git a/arch/arm/dts/exynos5250-snow.dts b/arch/arm/dts/exynos5250-snow.dts
index e99f6e72bf6..cb5067b9669 100644
--- a/arch/arm/dts/exynos5250-snow.dts
+++ b/arch/arm/dts/exynos5250-snow.dts
@@ -214,8 +214,8 @@
};
};
 
-   soundcodec@22 {
-   reg = <0x22>;
+   soundcodec@11 {
+   reg = <0x11>;
compatible = "maxim,max98095-codec";
};
};
diff --git a/arch/arm/dts/exynos5420-peach-pit.dts 
b/arch/arm/dts/exynos5420-peach-pit.dts
index c86f9d9035d..bd0a9c116d4 100644
--- a/arch/arm/dts/exynos5420-peach-pit.dts
+++ b/arch/arm/dts/exynos5420-peach-pit.dts
@@ -69,10 +69,10 @@
 
i2c@12CD { /* i2c7 */
clock-frequency = <10>;
-  soundcodec@20 {
- reg = <0x20>;
- compatible = "maxim,max98090-codec";
-  };
+   soundcodec@10 {
+   reg = <0x10>;
+   compatible = "maxim,max98090-codec";
+   };
 
edp-lvds-bridge@48 {
compatible = "parade,ps8625";
diff --git a/arch/arm/dts/exynos5800-peach-pi.dts 
b/arch/arm/dts/exynos5800-peach-pi.dts
index 7498519d6c6..239781b34bb 100644
--- a/arch/arm/dts/exynos5800-peach-pi.dts
+++ b/arch/arm/dts/exynos5800-peach-pi.dts
@@ -81,10 +81,10 @@
 
i2c@12CD { /* i2c7 */
clock-frequency = <10>;
-  soundcodec@20 {
- reg = <0x20>;
- compatible = "maxim,max98090-codec";
-  };
+   soundcodec@10 {
+   reg = <0x10>;
+   compatible = "maxim,max98090-codec";
+   };
};
 
 sound@383 {
diff --git a/drivers/sound/max98095.c b/drivers/sound/max98095.c
index 6a98dac04bb..7a3dbd09840 100644
--- a/drivers/sound/max98095.c
+++ b/drivers/sound/max98095.c
@@ -569,8 +569,7 @@ int max98095_init(const void *blob, enum 
en_max_audio_interface aif_id,
 
i2c_set_bus_num(pcodec_info.i2c_bus);
 
-   /* shift the device address by 1 for 7 bit addressing */
-   max98095_info.i2c_addr = pcodec_info.i2c_dev_addr >> 1;
+   max98095_info.i2c_addr = pcodec_info.i2c_dev_addr;
ret = max98095_device_init(&max98095_info);
if (ret < 0) {
debug("%s: max98095 codec chip init failed\n", __func__);
-- 
2.20.0.rc2.403.gdbc3b29805-goog

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


[U-Boot] [PATCH v2 00/22] dm: sound: Convert to driver model

2018-12-10 Thread Simon Glass
The sound subsystem has never been converted to driver model. It is is a
little bit complicated since it needs an audio codec, an i2s device and a
sound device to bring them together.

Sound is the main subsystem holding back removal of CONFIG_DM_I2C_COMPAT.

This series takes a stab at doing the conversion. This is tested on snow,
pit and pi. I do not have smdk5250/5420 or arndale to test with.

Changes in v2:
- Add fix for pit and pi also
- Fix up tabs in this commit instead of the later one
- Use Kconfig instead of defconfig to define DM_SOUND
- Update 'init' command to print the error code
- Correct conversion for pit
- Use void * for i2c and sound data
- Add new patch to move common code out of maxim98095
- Add new patch with support for max98090
- Correct conversion for pit and pi, updating commit message
- Add new patch to convert sandbox to use driver model
- Drop CONFIG_DM_SOUND from all defconfig files
- Fix up sandbox files to remove old code
- Update the rest of the samsung boards
- Remove unused sandbox code also
- Drop patches previously applied
- Add new patch to fix license headers
- Add new patch to tidy up error codes in max98095
- Add new patch to use the correct number of channels for sound

Simon Glass (22):
  dm: sound: exynos: Correct codec bus addresses
  dm: sound: Create an option to use driver model for sound
  dm: sound: Rename samsung_i2s_priv to i2s_uc_priv
  dm: sound: Create a uclass for audio codecs
  dm: sound: Create a uclass for i2s
  dm: sandbox: Update sound to use two buffers
  dm: sound: Create a uclass for sound
  dm: core: Add a function to read into a unsigned int
  dm: sound: Start i2c IDs from 0
  dm: sound: Add conversion to driver model
  exynos: Add proid_is_exynos542x() for common 542x
  exynos: Add support for exynos5420 i2s pinmux
  dm: sound: Move common code out of maxim98095
  dm: sound: exynos: Add support for max98090
  dm: exynos: sound: Convert to use driver model
  dm: sandbox: sound: Convert to use driver model
  dm: exynos: Drop CONFIG_DM_I2C_COMPAT
  dm: sound: Complete migration to driver model
  dm: sound: Fix license headers
  dm: sound: max98095: Tidy up error codes
  dm: sandbox: Allow selection of sample rate and channels
  dm: sound: Use the correct number of channels for sound

 arch/Kconfig  |   1 +
 arch/arm/dts/exynos5250-smdk5250.dts  |  21 +-
 arch/arm/dts/exynos5250-snow.dts  |  23 +-
 arch/arm/dts/exynos5250-spring.dts|  24 +-
 arch/arm/dts/exynos5250.dtsi  |  15 +-
 arch/arm/dts/exynos5420-peach-pit.dts |  24 +-
 arch/arm/dts/exynos5420-smdk5420.dts  |  21 +-
 arch/arm/dts/exynos54xx.dtsi  |  14 +
 arch/arm/dts/exynos5800-peach-pi.dts  |  24 +-
 arch/arm/mach-exynos/clock.c  |  31 +-
 arch/arm/mach-exynos/clock_init_exynos5.c |   2 +-
 arch/arm/mach-exynos/common_setup.h   |   4 +-
 arch/arm/mach-exynos/include/mach/clock.h |   3 +
 arch/arm/mach-exynos/include/mach/cpu.h   |   4 +-
 arch/arm/mach-exynos/include/mach/gpio.h  |   4 +-
 arch/arm/mach-exynos/pinmux.c |  19 +-
 arch/arm/mach-exynos/power.c  |   2 +-
 arch/sandbox/cpu/sdl.c| 123 ++--
 arch/sandbox/dts/sandbox.dts  |  21 +
 arch/sandbox/dts/test.dts |  23 +
 arch/sandbox/include/asm/sdl.h|  19 +-
 arch/sandbox/include/asm/sound.h  |  13 -
 arch/sandbox/include/asm/test.h   |  40 ++
 cmd/sound.c   |  15 +-
 configs/peach-pi_defconfig|   3 +-
 configs/peach-pit_defconfig   |   3 +-
 configs/smdk5250_defconfig|   1 -
 configs/smdk5420_defconfig|   1 -
 configs/snow_defconfig|   1 -
 configs/spring_defconfig  |   1 -
 drivers/core/read.c   |  23 +
 drivers/sound/Kconfig |   8 +
 drivers/sound/Makefile|   8 +-
 drivers/sound/codec-uclass.c  |  26 +
 drivers/sound/i2s-uclass.c|  25 +
 drivers/sound/max98090.c  | 377 
 drivers/sound/max98090.h  | 663 ++
 drivers/sound/max98095.c  | 313 --
 drivers/sound/max98095.h  |   9 +-
 drivers/sound/maxim_codec.c   |  87 +++
 drivers/sound/maxim_codec.h   |  67 +++
 drivers/sound/samsung-i2s.c   | 113 +++-
 drivers/sound/samsung_sound.c | 104 
 drivers/sound/sandbox.c   | 177 +-
 drivers/sound/sound-i2s.c | 208 ---
 drivers/sound/sound-uclass.c  | 127 +
 drivers/sound/sound.c |  11 +-
 drivers/sound/wm8994.c| 114 ++--
 drivers/sound/wm8994.h|   2 +-
 include/audio_codec.h |  48 ++
 include/dm/read.h |  58 ++
 include/dm/uc

Re: [U-Boot] [PATCH v3 7/7] MIPS: bootm: Add support for Vcore III linux kernel

2018-12-10 Thread Daniel Schwierzeck


Am 05.12.18 um 18:10 schrieb Gregory CLEMENT:
> The kernels built for the Vcore III linux kernel have different
> expectation in the way the data were passed.
> 
> Unlike with yamon, the command line is expected to be a single string
> passed in argv[1]. An other expectation is that the arguments are located
> in the cached address space.
> 
> However, like yamon, they expect that rd_start and rd_size was passed by
> the bootloader in the command line of the kernel, and besides that it
> also wait for the root=/dev/ram0.



> 
> Signed-off-by: Gregory CLEMENT 
> ---
>  arch/mips/lib/bootm.c | 78 ---
>  1 file changed, 58 insertions(+), 20 deletions(-)
> 
> diff --git a/arch/mips/lib/bootm.c b/arch/mips/lib/bootm.c
> index deca5189e3..a3831c28a4 100644
> --- a/arch/mips/lib/bootm.c
> +++ b/arch/mips/lib/bootm.c
> @@ -15,6 +15,11 @@ DECLARE_GLOBAL_DATA_PTR;
>  #define  LINUX_MAX_ENVS  256
>  #define  LINUX_MAX_ARGS  256
>  
> +enum legacy_boot_type {
> + LEGACY_BOOT_YAML,
> + LEGACY_BOOT_VCORE,
> +};
> +
>  static int linux_argc;
>  static char **linux_argv;
>  static char *linux_argp;
> @@ -44,22 +49,47 @@ void arch_lmb_reserve(struct lmb *lmb)
>   lmb_reserve(lmb, sp, gd->ram_top - sp);
>  }
>  
> -static void linux_cmdline_init(void)
> +static void linux_cmdline_init(enum legacy_boot_type boot_type)
>  {
> + switch (boot_type) {
> + /*
> +  * Vcore III linux kernels expect arguments in the cached
> +  * address space. They also expect the command line being a
> +  * single string in the first argument
> +  */
> + case LEGACY_BOOT_VCORE:
> + linux_argv = (char **)(gd->bd->bi_boot_params);
> + linux_argp = (char *)(linux_argv + LINUX_MAX_ARGS);
> + linux_argv[1] = linux_argp;
> + break;
> + case LEGACY_BOOT_YAML:
> + /* fall-through */
> + default:
> + linux_argv = (char **)UNCACHED_SDRAM(gd->bd->bi_boot_params);
> + linux_argp = (char *)(linux_argv + LINUX_MAX_ARGS);
> + }
>   linux_argc = 1;
> - linux_argv = (char **)UNCACHED_SDRAM(gd->bd->bi_boot_params);
>   linux_argv[0] = 0;
> - linux_argp = (char *)(linux_argv + LINUX_MAX_ARGS);
>  }
>  
> -static void linux_cmdline_set(const char *value, size_t len)
> +static void linux_cmdline_set(const char *value, size_t len,
> +   enum legacy_boot_type boot_type)
>  {
> - linux_argv[linux_argc] = linux_argp;
>   memcpy(linux_argp, value, len);
> - linux_argp[len] = 0;
> -
> + switch (boot_type) {
> + case LEGACY_BOOT_VCORE:
> + linux_argv[linux_argc] = linux_argp;
> + linux_argp[len] = 0;
> + linux_argc++;
> + break;
> + case LEGACY_BOOT_YAML:
> + /* fall-through */
> + default:
> + linux_argp[len] = ' ';
> + linux_argp[len + 1] = 0;
> + linux_argc = 2;
> + }
>   linux_argp += len + 1;
> - linux_argc++;
>  }
>  
>  static void linux_cmdline_dump(void)
> @@ -73,12 +103,11 @@ static void linux_cmdline_dump(void)
>   debug("   arg %03d: %s\n", i, linux_argv[i]);
>  }
>  
> -static void linux_cmdline_legacy(bootm_headers_t *images)
> +static void linux_cmdline_legacy(bootm_headers_t *images,
> +  enum legacy_boot_type boot_type)
>  {
>   const char *bootargs, *next, *quote;
> -
> - linux_cmdline_init();
> -
> + linux_cmdline_init(boot_type);
>   bootargs = env_get("bootargs");
>   if (!bootargs)
>   return;
> @@ -104,7 +133,7 @@ static void linux_cmdline_legacy(bootm_headers_t *images)
>   if (!next)
>   next = bootargs + strlen(bootargs);
>  
> - linux_cmdline_set(bootargs, next - bootargs);
> + linux_cmdline_set(bootargs, next - bootargs, boot_type);
>  
>   if (*next)
>   next++;
> @@ -113,7 +142,8 @@ static void linux_cmdline_legacy(bootm_headers_t *images)
>   }
>  }
>  
> -static void linux_cmdline_append(bootm_headers_t *images)
> +static void linux_cmdline_append(bootm_headers_t *images,
> +  enum legacy_boot_type boot_type)
>  {
>   char buf[24];
>   ulong mem, rd_start, rd_size;
> @@ -121,7 +151,7 @@ static void linux_cmdline_append(bootm_headers_t *images)
>   /* append mem */
>   mem = gd->ram_size >> 20;
>   sprintf(buf, "mem=%luM", mem);
> - linux_cmdline_set(buf, strlen(buf));
> + linux_cmdline_set(buf, strlen(buf), boot_type);
>  
>   /* append rd_start and rd_size */
>   rd_start = images->initrd_start;
> @@ -129,9 +159,13 @@ static void linux_cmdline_append(bootm_headers_t *images)
>  
>   if (rd_size) {
>   sprintf(buf, "rd_start=0x%08lX", rd_start);
> - linux_cmdline_set(buf, strlen(bu

Re: [U-Boot] [PATCH 09/13] serial: Remove DM_FLAG_PRE_RELOC flag in various drivers

2018-12-10 Thread Igor Opaniuk
Hi Bin,

This particular commit leads to a constant Poplar board restart (git
bisect pointed to it).
U-boot is built with the default poplar_config from the latest master
(btw, is uses r), and U-boot is used as default BL33 image (setup:
vanilla ATF + vanilla OP-TEE(BL32, S-EL1 payload) + U-boot).

When BL32 (OP-TEE) tries to make a switch to non-secure bootloader, it
leads to restart (I'll compile ATF with verbose output and send you
more details if there are any):
=
I/TC: OP-TEE version: 3.3.0-110-g7309438-dev #1 понеділок, 10 грудня
2018 12:53:15 + aarch64
D/TC:0 0 check_ta_store:529 TA store: "early TA"
D/TC:0 0 check_ta_store:529 TA store: "Secure Storage TA"
D/TC:0 0 check_ta_store:529 TA store: "REE"
D/TC:0 0 early_ta_init:225 Early TA
023f8f1a-292a-432b-8fc4-de8471358067 size 21735 (compressed,
uncompressed 99680)
D/TC:0 0 mobj_mapped_shm_init:709 Shared memory address range: 400, 600
I/TC: Initialized
D/TC:0 0 init_primary_helper:1033 Primary CPU switching to normal world boot

Bootrom start
Boot Media: eMMC
Entry usb bootstrap
USB: Recv CC:4
Usb disk(1):


btw, for Poplar board serial_pl01x driver is used.

Could you please provide (I just started digging into your patch
series) your ideas why it can happen?

Thanks

On Wed, 24 Oct 2018 at 16:38, Bin Meng  wrote:
>
> When a driver declares DM_FLAG_PRE_RELOC flag, it wishes to be
> bound before relocation. However due to a bug in the DM core,
> the flag only takes effect when devices are statically declared
> via U_BOOT_DEVICE(). This bug has been fixed recently by commit
> "dm: core: Respect drivers with the DM_FLAG_PRE_RELOC flag in
> lists_bind_fdt()", but with the fix, it has a side effect that
> all existing drivers that declared DM_FLAG_PRE_RELOC flag will
> be bound before relocation now. This may expose potential boot
> failure on some boards due to insufficient memory during the
> pre-relocation stage.
>
> To mitigate this potential impact, the following changes are
> implemented:
>
> - Remove DM_FLAG_PRE_RELOC flag in the driver, if the driver
>   only supports configuration from device tree (OF_CONTROL)
> - Keep DM_FLAG_PRE_RELOC flag in the driver only if the device
>   is statically declared via U_BOOT_DEVICE()
> - Surround DM_FLAG_PRE_RELOC flag with OF_CONTROL check, for
>   drivers that support both statically declared devices and
>   configuration from device tree
>
> Signed-off-by: Bin Meng 
> ---
>
>  drivers/serial/altera_jtag_uart.c | 1 -
>  drivers/serial/altera_uart.c  | 1 -
>  drivers/serial/arm_dcc.c  | 1 -
>  drivers/serial/atmel_usart.c  | 2 ++
>  drivers/serial/ns16550.c  | 2 ++
>  drivers/serial/serial_ar933x.c| 1 -
>  drivers/serial/serial_arc.c   | 1 -
>  drivers/serial/serial_bcm283x_mu.c| 2 ++
>  drivers/serial/serial_bcm283x_pl011.c | 2 ++
>  drivers/serial/serial_bcm6345.c   | 1 -
>  drivers/serial/serial_efi.c   | 1 -
>  drivers/serial/serial_intel_mid.c | 1 -
>  drivers/serial/serial_lpuart.c| 1 -
>  drivers/serial/serial_meson.c | 1 -
>  drivers/serial/serial_mvebu_a3700.c   | 1 -
>  drivers/serial/serial_mxc.c   | 2 ++
>  drivers/serial/serial_omap.c  | 2 ++
>  drivers/serial/serial_owl.c   | 1 -
>  drivers/serial/serial_pic32.c | 1 -
>  drivers/serial/serial_pl01x.c | 2 ++
>  drivers/serial/serial_s5p.c   | 1 -
>  drivers/serial/serial_sh.c| 2 ++
>  drivers/serial/serial_sti_asc.c   | 1 -
>  drivers/serial/serial_stm32.c | 2 ++
>  drivers/serial/serial_xuartlite.c | 1 -
>  drivers/serial/serial_zynq.c  | 1 -
>  26 files changed, 18 insertions(+), 17 deletions(-)
>
> diff --git a/drivers/serial/altera_jtag_uart.c 
> b/drivers/serial/altera_jtag_uart.c
> index 61052a9..86c3de4 100644
> --- a/drivers/serial/altera_jtag_uart.c
> +++ b/drivers/serial/altera_jtag_uart.c
> @@ -121,7 +121,6 @@ U_BOOT_DRIVER(altera_jtaguart) = {
> .platdata_auto_alloc_size = sizeof(struct altera_jtaguart_platdata),
> .probe = altera_jtaguart_probe,
> .ops= &altera_jtaguart_ops,
> -   .flags = DM_FLAG_PRE_RELOC,
>  };
>
>  #ifdef CONFIG_DEBUG_UART_ALTERA_JTAGUART
> diff --git a/drivers/serial/altera_uart.c b/drivers/serial/altera_uart.c
> index b7b0a13..67d4719 100644
> --- a/drivers/serial/altera_uart.c
> +++ b/drivers/serial/altera_uart.c
> @@ -117,7 +117,6 @@ U_BOOT_DRIVER(altera_uart) = {
> .platdata_auto_alloc_size = sizeof(struct altera_uart_platdata),
> .probe = altera_uart_probe,
> .ops= &altera_uart_ops,
> -   .flags = DM_FLAG_PRE_RELOC,
>  };
>
>  #ifdef CONFIG_DEBUG_UART_ALTERA_UART
> diff --git a/drivers/serial/arm_dcc.c b/drivers/serial/arm_dcc.c
> index 43e8691..dfcb6fd 100644
> --- a/drivers/serial/arm_dcc.c
> +++ b/drivers/serial/arm_dcc.c
> @@ -155,7 +155,6 @@ U_BOOT_DRIVER(serial_dcc) = {
> 

Re: [U-Boot] [PATCH v3 5/7] MSCC: add board support for the Ocelots based evaluation boards

2018-12-10 Thread Daniel Schwierzeck


Am 05.12.18 um 18:10 schrieb Gregory CLEMENT:
> Adding the support for 2 boards sharing common code for Ocelot chip:
> PCB120 and PCB123
> 
> Signed-off-by: Gregory CLEMENT 
> ---
>  MAINTAINERS  |   5 +
>  arch/mips/dts/mscc,ocelot.dtsi   | 152 +++
>  arch/mips/dts/mscc,ocelot_pcb.dtsi   |  42 
>  arch/mips/dts/ocelot_pcb120.dts  |  12 +++
>  arch/mips/dts/ocelot_pcb123.dts  |  12 +++
>  arch/mips/mach-mscc/Kconfig  |   2 +
>  board/mscc/ocelot/Kconfig|  14 +++
>  board/mscc/ocelot/Makefile   |   4 +
>  board/mscc/ocelot/ocelot.c   |  58 ++
>  configs/mscc_ocelot_defconfig|  73 +
>  configs/mscc_ocelot_pcb120_defconfig |  66 
>  include/configs/vcoreiii.h   |  82 +++
>  12 files changed, 522 insertions(+)
>  create mode 100644 arch/mips/dts/mscc,ocelot.dtsi
>  create mode 100644 arch/mips/dts/mscc,ocelot_pcb.dtsi
>  create mode 100644 arch/mips/dts/ocelot_pcb120.dts
>  create mode 100644 arch/mips/dts/ocelot_pcb123.dts
>  create mode 100644 board/mscc/ocelot/Kconfig
>  create mode 100644 board/mscc/ocelot/Makefile
>  create mode 100644 board/mscc/ocelot/ocelot.c
>  create mode 100644 configs/mscc_ocelot_defconfig
>  create mode 100644 configs/mscc_ocelot_pcb120_defconfig
>  create mode 100644 include/configs/vcoreiii.h
> 
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 53a3c5bec6..c906ca006b 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -490,6 +490,11 @@ M:   Lars Povlsen 
>  M:   Horatiu Vultur 
>  S:   Maintained
>  F:   arch/mips/mach-mscc/
> +F:   arch/mips/dts/mscc*
> +F:   arch/mips/dts/ocelot*
> +F:   board/mscc/
> +F:   configs/mscc*
> +F:   include/configs/vcoreiii.h
>  
>  MMC
>  M:   Jaehoon Chung 
> diff --git a/arch/mips/dts/mscc,ocelot.dtsi b/arch/mips/dts/mscc,ocelot.dtsi
> new file mode 100644
> index 00..87b4736285
> --- /dev/null
> +++ b/arch/mips/dts/mscc,ocelot.dtsi
> @@ -0,0 +1,152 @@
> +// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
> +/*
> + * Copyright (c) 2018 Microsemi Corporation
> + */
> +
> +/ {
> + #address-cells = <1>;
> + #size-cells = <1>;
> + compatible = "mscc,ocelot";
> +
> + cpus {
> + #address-cells = <1>;
> + #size-cells = <0>;
> +
> + cpu@0 {
> + compatible = "mips,mips24KEc";
> + device_type = "cpu";
> + clocks = <&cpu_clk>;
> + reg = <0>;
> + };
> + };
> +
> + aliases {
> + serial0 = &uart0;
> + };
> +
> + cpuintc: interrupt-controller@0 {
> + #address-cells = <0>;
> + #interrupt-cells = <1>;
> + interrupt-controller;
> + compatible = "mti,cpu-interrupt-controller";
> + };
> +
> + cpu_clk: cpu-clock {
> + compatible = "fixed-clock";
> + #clock-cells = <0>;
> + clock-frequency = <5>;
> + };
> +
> + ahb_clk: ahb-clk {
> + compatible = "fixed-clock";
> + #clock-cells = <0>;
> + clock-frequency = <25000>;
> + };
> +
> + ahb {
> + compatible = "simple-bus";
> + #address-cells = <1>;
> + #size-cells = <1>;
> + ranges = <0 0x7000 0x200>;
> +
> + interrupt-parent = <&intc>;
> +
> + cpu_ctrl: syscon@0 {
> + compatible = "mscc,ocelot-cpu-syscon", "syscon";
> + reg = <0x0 0x2c>;
> + };
> +
> + intc: interrupt-controller@70 {
> + compatible = "mscc,ocelot-icpu-intr";
> + reg = <0x70 0x70>;
> + #interrupt-cells = <1>;
> + interrupt-controller;
> + interrupt-parent = <&cpuintc>;
> + interrupts = <2>;
> + };
> +
> + uart0: serial@10 {
> + pinctrl-0 = <&uart_pins>;
> + pinctrl-names = "default";
> + compatible = "ns16550a";
> + reg = <0x10 0x20>;
> + interrupts = <6>;
> + clocks = <&ahb_clk>;
> + reg-io-width = <4>;
> + reg-shift = <2>;
> +
> + status = "disabled";
> + };
> +
> + uart2: serial@100800 {
> + pinctrl-0 = <&uart2_pins>;
> + pinctrl-names = "default";
> + compatible = "ns16550a";
> + reg = <0x100800 0x20>;
> + interrupts = <7>;
> + clocks = <&ahb_clk>;
> + reg-io-width = <4>;
> + reg-shift = <2>;
> +
> + status = "disabled";
> + };
> +
> + spi0: spi-master@101000 {
> +   

Re: [U-Boot] [PATCH v3 4/7] MSCC: add support for Luton SoCs

2018-12-10 Thread Daniel Schwierzeck


Am 05.12.18 um 18:10 schrieb Gregory CLEMENT:
> As the Ocelots SoCs, this family of SoCs are found in the Microsemi
> Switches solution.
> 
> Signed-off-by: Gregory CLEMENT 
> ---
>  arch/mips/mach-mscc/Kconfig   |  13 +
>  arch/mips/mach-mscc/Makefile  |   1 +
>  arch/mips/mach-mscc/cpu.c |  14 +-
>  arch/mips/mach-mscc/dram.c|   2 +
>  arch/mips/mach-mscc/include/mach/common.h |   4 +
>  arch/mips/mach-mscc/include/mach/ddr.h| 112 +++-
>  .../mips/mach-mscc/include/mach/luton/luton.h |  24 ++
>  .../include/mach/luton/luton_devcpu_gcb.h |  14 +
>  .../include/mach/luton/luton_icpu_cfg.h   | 245 ++
>  arch/mips/mach-mscc/lowlevel_init.S   |   7 +
>  arch/mips/mach-mscc/lowlevel_init_luton.S |  62 +
>  11 files changed, 494 insertions(+), 4 deletions(-)
>  create mode 100644 arch/mips/mach-mscc/include/mach/luton/luton.h
>  create mode 100644 arch/mips/mach-mscc/include/mach/luton/luton_devcpu_gcb.h
>  create mode 100644 arch/mips/mach-mscc/include/mach/luton/luton_icpu_cfg.h
>  create mode 100644 arch/mips/mach-mscc/lowlevel_init_luton.S
> 
> diff --git a/arch/mips/mach-mscc/Kconfig b/arch/mips/mach-mscc/Kconfig
> index 7f1b270207..a8cace0e79 100644
> --- a/arch/mips/mach-mscc/Kconfig
> +++ b/arch/mips/mach-mscc/Kconfig
> @@ -21,6 +21,12 @@ config SOC_OCELOT
>   help
> This supports MSCC Ocelot family of SOCs.
>  
> +config SOC_LUTON
> + bool
> + select SOC_VCOREIII
> + help
> +   This supports MSCC Luton family of SOCs.
> +
>  config SYS_CONFIG_NAME
>   default "vcoreiii"
>  
> @@ -41,6 +47,13 @@ config TARGET_OCELOT_PCB123
> When selected, CONFIG_DEFAULT_DEVICE_TREE should be set to
> ocelot_pcb123
>  
> +config TARGET_LUTON_PCB091
> + bool "MSCC PCB091 Reference Board"
> + select SOC_LUTON
> + select MSCC_BITBANG_SPI_GPIO
> + help
> +   When selected, CONFIG_DEFAULT_DEVICE_TREE should be set to
> +   luton_pcb091
>  endchoice
>  
>  choice
> diff --git a/arch/mips/mach-mscc/Makefile b/arch/mips/mach-mscc/Makefile
> index d14ec33838..6c60f26ca4 100644
> --- a/arch/mips/mach-mscc/Makefile
> +++ b/arch/mips/mach-mscc/Makefile
> @@ -3,3 +3,4 @@
>  CFLAGS_cpu.o += -finline-limit=64000
>  
>  obj-y += cpu.o dram.o reset.o lowlevel_init.o
> +obj-$(CONFIG_SOC_LUTON) += lowlevel_init_luton.o
> diff --git a/arch/mips/mach-mscc/cpu.c b/arch/mips/mach-mscc/cpu.c
> index b503e1407b..5be8ff69d5 100644
> --- a/arch/mips/mach-mscc/cpu.c
> +++ b/arch/mips/mach-mscc/cpu.c
> @@ -48,6 +48,10 @@ void vcoreiii_tlb_init(void)
>*/
>   create_tlb(tlbix++, MSCC_IO_ORIGIN1_OFFSET, SZ_16M, MMU_REGIO_RW,
>  MMU_REGIO_RW);
> +#ifdef CONFIG_SOC_LUTON
> + create_tlb(tlbix++, MSCC_IO_ORIGIN2_OFFSET, SZ_16M, MMU_REGIO_RW,
> +MMU_REGIO_RW);
> +#endif
>  
>  #if  CONFIG_SYS_TEXT_BASE == MSCC_FLASH_TO
>   /*
> @@ -75,6 +79,14 @@ void vcoreiii_tlb_init(void)
>  int mach_cpu_init(void)
>  {
>   /* Speed up NOR flash access */
> +#ifdef CONFIG_SOC_LUTON
> + writel(ICPU_PI_MST_CFG_TRISTATE_CTRL +
> +ICPU_PI_MST_CFG_CLK_DIV(4), BASE_CFG + ICPU_PI_MST_CFG);
> +
> + writel(ICPU_SPI_MST_CFG_FAST_READ_ENA +
> +ICPU_SPI_MST_CFG_CS_DESELECT_TIME(0x19) +
> +ICPU_SPI_MST_CFG_CLK_DIV(9), BASE_CFG + ICPU_SPI_MST_CFG);
> +#else
>   writel(ICPU_SPI_MST_CFG_CS_DESELECT_TIME(0x19) +
>  ICPU_SPI_MST_CFG_CLK_DIV(9), BASE_CFG + ICPU_SPI_MST_CFG);
>   /*
> @@ -85,6 +97,6 @@ int mach_cpu_init(void)
>   writel(0, BASE_CFG + ICPU_DST_INTR_MAP(1));
>   writel(0, BASE_CFG + ICPU_DST_INTR_MAP(2));
>   writel(0, BASE_CFG + ICPU_DST_INTR_MAP(3));
> -
> +#endif
>   return 0;
>  }
> diff --git a/arch/mips/mach-mscc/dram.c b/arch/mips/mach-mscc/dram.c
> index 5acee6f918..309007c14e 100644
> --- a/arch/mips/mach-mscc/dram.c
> +++ b/arch/mips/mach-mscc/dram.c
> @@ -19,9 +19,11 @@ static inline int vcoreiii_train_bytelane(void)
>  
>   ret = hal_vcoreiii_train_bytelane(0);
>  
> +#ifdef CONFIG_SOC_OCELOT
>   if (ret)
>   return ret;
>   ret = hal_vcoreiii_train_bytelane(1);
> +#endif
>  
>   return ret;
>  }
> diff --git a/arch/mips/mach-mscc/include/mach/common.h 
> b/arch/mips/mach-mscc/include/mach/common.h
> index 842462aeed..931ecd7985 100644
> --- a/arch/mips/mach-mscc/include/mach/common.h
> +++ b/arch/mips/mach-mscc/include/mach/common.h
> @@ -10,6 +10,10 @@
>  #include 
>  #include 
>  #include 
> +#elif defined(CONFIG_SOC_LUTON)
> +#include 
> +#include 
> +#include 
>  #else
>  #error Unsupported platform
>  #endif
> diff --git a/arch/mips/mach-mscc/include/mach/ddr.h 
> b/arch/mips/mach-mscc/include/mach/ddr.h
> index 4bdea90506..97eff2a196 100644
> --- a/arch/mips/mach-mscc/include/mach/ddr.h
> +++ b/arch/mips/mach-mscc/include/mach/ddr.h
> @@ -598,6 +598,98 @@ static inline int dram_check(void)
>  

Re: [U-Boot] [PATCH v3 3/7] MSCC: add support for Ocelot SoCs

2018-12-10 Thread Daniel Schwierzeck


Am 05.12.18 um 18:10 schrieb Gregory CLEMENT:
> This family of SoCs are found in the Microsemi Switches solution and have
> already a support in the linux kernel.
> 
> Signed-off-by: Gregory CLEMENT 
> ---
>  MAINTAINERS   |   7 +
>  arch/mips/Kconfig |   6 +
>  arch/mips/Makefile|   1 +
>  arch/mips/mach-mscc/Kconfig   |  69 ++
>  arch/mips/mach-mscc/Makefile  |   5 +
>  arch/mips/mach-mscc/cpu.c |  90 +++
>  arch/mips/mach-mscc/dram.c|  71 ++
>  arch/mips/mach-mscc/include/ioremap.h |  51 ++
>  arch/mips/mach-mscc/include/mach/common.h |  24 +
>  arch/mips/mach-mscc/include/mach/ddr.h| 692 ++
>  .../mach-mscc/include/mach/ocelot/ocelot.h|  24 +
>  .../include/mach/ocelot/ocelot_devcpu_gcb.h   |  21 +
>  .../include/mach/ocelot/ocelot_icpu_cfg.h | 274 +++
>  arch/mips/mach-mscc/include/mach/tlb.h|  55 ++
>  arch/mips/mach-mscc/lowlevel_init.S   |  23 +
>  arch/mips/mach-mscc/reset.c   |  36 +
>  16 files changed, 1449 insertions(+)
>  create mode 100644 arch/mips/mach-mscc/Kconfig
>  create mode 100644 arch/mips/mach-mscc/Makefile
>  create mode 100644 arch/mips/mach-mscc/cpu.c
>  create mode 100644 arch/mips/mach-mscc/dram.c
>  create mode 100644 arch/mips/mach-mscc/include/ioremap.h
>  create mode 100644 arch/mips/mach-mscc/include/mach/common.h
>  create mode 100644 arch/mips/mach-mscc/include/mach/ddr.h
>  create mode 100644 arch/mips/mach-mscc/include/mach/ocelot/ocelot.h
>  create mode 100644 
> arch/mips/mach-mscc/include/mach/ocelot/ocelot_devcpu_gcb.h
>  create mode 100644 arch/mips/mach-mscc/include/mach/ocelot/ocelot_icpu_cfg.h
>  create mode 100644 arch/mips/mach-mscc/include/mach/tlb.h
>  create mode 100644 arch/mips/mach-mscc/lowlevel_init.S
>  create mode 100644 arch/mips/mach-mscc/reset.c
> 
> diff --git a/MAINTAINERS b/MAINTAINERS
> index abdb6dcdb5..53a3c5bec6 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -484,6 +484,13 @@ S:   Maintained
>  T:   git git://git.denx.de/u-boot-mips.git
>  F:   arch/mips/
>  
> +MIPS MSCC
> +M:   Gregory CLEMENT 
> +M:   Lars Povlsen 
> +M:   Horatiu Vultur 
> +S:   Maintained
> +F:   arch/mips/mach-mscc/
> +
>  MMC
>  M:   Jaehoon Chung 
>  S:   Maintained
> diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
> index 6d646ef999..bfe9c11069 100644
> --- a/arch/mips/Kconfig
> +++ b/arch/mips/Kconfig
> @@ -59,6 +59,11 @@ config ARCH_ATH79
>   select OF_CONTROL
>   imply CMD_DM
>  
> +config ARCH_MSCC
> + bool "Support MSCC VCore-III"
> + select OF_CONTROL
> + select DM
> +
>  config ARCH_BMIPS
>   bool "Support BMIPS SoCs"
>   select CLK
> @@ -135,6 +140,7 @@ source "board/imgtec/xilfpga/Kconfig"
>  source "board/micronas/vct/Kconfig"
>  source "board/qemu-mips/Kconfig"
>  source "arch/mips/mach-ath79/Kconfig"
> +source "arch/mips/mach-mscc/Kconfig"
>  source "arch/mips/mach-bmips/Kconfig"
>  source "arch/mips/mach-pic32/Kconfig"
>  source "arch/mips/mach-mt7620/Kconfig"
> diff --git a/arch/mips/Makefile b/arch/mips/Makefile
> index 802244a06e..124e93fa26 100644
> --- a/arch/mips/Makefile
> +++ b/arch/mips/Makefile
> @@ -15,6 +15,7 @@ machine-$(CONFIG_ARCH_ATH79) += ath79
>  machine-$(CONFIG_ARCH_BMIPS) += bmips
>  machine-$(CONFIG_MACH_PIC32) += pic32
>  machine-$(CONFIG_ARCH_MT7620) += mt7620
> +machine-$(CONFIG_ARCH_MSCC) += mscc
>  
>  machdirs := $(patsubst %,arch/mips/mach-%/,$(machine-y))
>  libs-y += $(machdirs)
> diff --git a/arch/mips/mach-mscc/Kconfig b/arch/mips/mach-mscc/Kconfig
> new file mode 100644
> index 00..7f1b270207
> --- /dev/null
> +++ b/arch/mips/mach-mscc/Kconfig
> @@ -0,0 +1,69 @@
> +# SPDX-License-Identifier: (GPL-2.0+ OR MIT)
> +
> +menu "MSCC VCore-III platforms"
> + depends on ARCH_MSCC
> +
> +config SOC_VCOREIII
> + select MIPS_TUNE_24KC
> + select ROM_EXCEPTION_VECTORS
> + select SUPPORTS_BIG_ENDIAN
> + select SUPPORTS_CPU_MIPS32_R1
> + select SUPPORTS_CPU_MIPS32_R2
> + select SUPPORTS_LITTLE_ENDIAN
> + bool
> +
> +config SYS_SOC
> + default "mscc"
> +
> +config SOC_OCELOT
> + bool
> + select SOC_VCOREIII
> + help
> +   This supports MSCC Ocelot family of SOCs.
> +
> +config SYS_CONFIG_NAME
> + default "vcoreiii"
> +
> +choice
> + prompt "Board select"
> +
> +config TARGET_OCELOT_PCB120
> + bool "MSCC PCB120 Reference Board (aka VSC5635EV)"
> + select SOC_OCELOT
> + help
> +   When selected, CONFIG_DEFAULT_DEVICE_TREE should be set to
> +   ocelot_pcb120
> +
> +config TARGET_OCELOT_PCB123
> + bool "MSCC PCB123 Reference Board (aka VSC7514EV))"
> + select SOC_OCELOT
> + help
> +   When selected, CONFIG_DEFAULT_DEVICE_TREE should be set to
> +   ocelot_pcb123
> +
> +endchoice
> +
> +choice
> + prompt "DDR type"
> +
> +config DDRTYPE_H5TQ4G63MFR
>

[U-Boot] [PATCH] bmips: bcm6838: fix device tree warning

2018-12-10 Thread Álvaro Fernández Rojas
Signed-off-by: Álvaro Fernández Rojas 
---
 arch/mips/dts/brcm,bcm6838.dtsi | 2 --
 1 file changed, 2 deletions(-)

diff --git a/arch/mips/dts/brcm,bcm6838.dtsi b/arch/mips/dts/brcm,bcm6838.dtsi
index 1018f9ee49..77d6a8e214 100644
--- a/arch/mips/dts/brcm,bcm6838.dtsi
+++ b/arch/mips/dts/brcm,bcm6838.dtsi
@@ -31,8 +31,6 @@
 
clocks {
compatible = "simple-bus";
-   #address-cells = <1>;
-   #size-cells = <1>;
u-boot,dm-pre-reloc;
 
periph_osc: periph-osc {
-- 
2.11.0

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


Re: [U-Boot] [PATCH] bmips: swapping IO space isn't required

2018-12-10 Thread Álvaro Fernández Rojas

Hi Daniel,

El 10/12/2018 a las 15:50, Daniel Schwierzeck escribió:

Am 09.12.18 um 10:41 schrieb Álvaro Fernández Rojas:

Signed-off-by: Álvaro Fernández Rojas 
---
  arch/mips/mach-bmips/Kconfig | 10 --
  1 file changed, 10 deletions(-)

Reviewed-by: Daniel Schwierzeck 

I guess this is related to your recent series "serial: bcm6345: switch
to raw I/O functions"? As Tom already applied this series, this patch
should go in 2019.01 too?


Yes, I completely forgot I had copied SWAP_IO_SPACE from linux target 
without really needing it.


Without this patch serial driver isn't working for bmips boards, so yeah 
this should go in 2019.01.





diff --git a/arch/mips/mach-bmips/Kconfig b/arch/mips/mach-bmips/Kconfig
index 521996599e..b259a931c9 100644
--- a/arch/mips/mach-bmips/Kconfig
+++ b/arch/mips/mach-bmips/Kconfig
@@ -25,7 +25,6 @@ config SOC_BMIPS_BCM3380
select MIPS_TUNE_4KC
select SUPPORTS_BIG_ENDIAN
select SUPPORTS_CPU_MIPS32_R1
-   select SWAP_IO_SPACE
select SYSRESET_WATCHDOG
help
  This supports BMIPS BCM3380 family.
@@ -36,7 +35,6 @@ config SOC_BMIPS_BCM6318
select MIPS_TUNE_4KC
select SUPPORTS_BIG_ENDIAN
select SUPPORTS_CPU_MIPS32_R1
-   select SWAP_IO_SPACE
select SYSRESET_SYSCON
help
  This supports BMIPS BCM6318 family.
@@ -47,7 +45,6 @@ config SOC_BMIPS_BCM6328
select MIPS_TUNE_4KC
select SUPPORTS_BIG_ENDIAN
select SUPPORTS_CPU_MIPS32_R1
-   select SWAP_IO_SPACE
select SYSRESET_SYSCON
help
  This supports BMIPS BCM6328 family including BCM63281 and BCM63283.
@@ -58,7 +55,6 @@ config SOC_BMIPS_BCM6338
select MIPS_TUNE_4KC
select SUPPORTS_BIG_ENDIAN
select SUPPORTS_CPU_MIPS32_R1
-   select SWAP_IO_SPACE
select SYSRESET_SYSCON
help
  This supports BMIPS BCM6338 family.
@@ -69,7 +65,6 @@ config SOC_BMIPS_BCM6348
select MIPS_TUNE_4KC
select SUPPORTS_BIG_ENDIAN
select SUPPORTS_CPU_MIPS32_R1
-   select SWAP_IO_SPACE
select SYSRESET_WATCHDOG
help
  This supports BMIPS BCM6348 family.
@@ -80,7 +75,6 @@ config SOC_BMIPS_BCM6358
select MIPS_TUNE_4KC
select SUPPORTS_BIG_ENDIAN
select SUPPORTS_CPU_MIPS32_R1
-   select SWAP_IO_SPACE
select SYSRESET_SYSCON
help
  This supports BMIPS BCM6358 family including BCM6358 and BCM6359.
@@ -91,7 +85,6 @@ config SOC_BMIPS_BCM6368
select MIPS_TUNE_4KC
select SUPPORTS_BIG_ENDIAN
select SUPPORTS_CPU_MIPS32_R1
-   select SWAP_IO_SPACE
select SYSRESET_SYSCON
help
  This supports BMIPS BCM6368 family including BCM6368 and BCM6369.
@@ -102,7 +95,6 @@ config SOC_BMIPS_BCM6362
select MIPS_TUNE_4KC
select SUPPORTS_BIG_ENDIAN
select SUPPORTS_CPU_MIPS32_R1
-   select SWAP_IO_SPACE
select SYSRESET_SYSCON
help
  This supports BMIPS BCM6362 family including BCM6361 and BCM6362.
@@ -113,7 +105,6 @@ config SOC_BMIPS_BCM63268
select MIPS_TUNE_4KC
select SUPPORTS_BIG_ENDIAN
select SUPPORTS_CPU_MIPS32_R1
-   select SWAP_IO_SPACE
select SYSRESET_SYSCON
help
  This supports BMIPS BCM63268 family including BCM63168, BCM63169,
@@ -125,7 +116,6 @@ config SOC_BMIPS_BCM6838
select MIPS_TUNE_4KC
select SUPPORTS_BIG_ENDIAN
select SUPPORTS_CPU_MIPS32_R1
-   select SWAP_IO_SPACE
select SYSRESET_SYSCON
help
  This supports BMIPS BCM6838 family including BCM68380, BCM68381,


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


[U-Boot] [PATCH] Drivers: USB: MUSB: Remove legacy CONFIG_USB_DA8XX

2018-12-10 Thread Adam Ford
There don't appear to be any boards enabling CONFIG_USB_DA8XX,
and there is a newer version of the MUSB driver, so let's remove
the legacy version of it.

Signed-off-by: Adam Ford 

diff --git a/drivers/usb/musb/Kconfig b/drivers/usb/musb/Kconfig
index 7e6be03f4a..2508b6ed0d 100644
--- a/drivers/usb/musb/Kconfig
+++ b/drivers/usb/musb/Kconfig
@@ -15,10 +15,6 @@ config USB_OMAP3
bool "Legacy MUSB OMAP3 / OMAP4"
depends on ARCH_OMAP2PLUS
 
-config USB_DA8XX
-   bool "Legacy MUSB DA8xx/OMAP-L1x"
-   depends on ARCH_DAVINCI
-
 config USB_AM35X
bool"Legacy MUSB AM35x"
depends on ARCH_OMAP2PLUS && !USB_OMAP3
diff --git a/drivers/usb/musb/Makefile b/drivers/usb/musb/Makefile
index 1242ce1c8c..744f2cfaa2 100644
--- a/drivers/usb/musb/Makefile
+++ b/drivers/usb/musb/Makefile
@@ -6,5 +6,4 @@
 obj-$(CONFIG_USB_MUSB_HCD) += musb_hcd.o musb_core.o
 obj-$(CONFIG_USB_MUSB_UDC) += musb_udc.o musb_core.o
 obj-$(CONFIG_USB_OMAP3) += omap3.o
-obj-$(CONFIG_USB_DA8XX) += da8xx.o
 obj-$(CONFIG_USB_AM35X) += am35x.o
diff --git a/drivers/usb/musb/da8xx.c b/drivers/usb/musb/da8xx.c
deleted file mode 100644
index a652a7c3c1..00
--- a/drivers/usb/musb/da8xx.c
+++ /dev/null
@@ -1,127 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * da8xx.c - TI's DA8xx platform specific usb wrapper functions.
- *
- * Author: Ajay Kumar Gupta 
- *
- * Based on drivers/usb/musb/davinci.c
- *
- * Copyright (C) 2009 Texas Instruments Incorporated
- */
-#include 
-
-#include "musb_core.h"
-#include 
-
-/* MUSB platform configuration */
-struct musb_config musb_cfg = {
-   .regs   = (struct musb_regs *)DA8XX_USB_OTG_CORE_BASE,
-   .timeout= DA8XX_USB_OTG_TIMEOUT,
-   .musb_speed = 0,
-};
-
-/*
- * This function enables VBUS by driving the GPIO Bank4 Pin 15 high.
- */
-static void enable_vbus(void)
-{
-   u32 value;
-
-   /* configure GPIO bank4 pin 15 in output direction */
-   value = readl(&davinci_gpio_bank45->dir);
-   writel((value & (~DA8XX_USB_VBUS_GPIO)), &davinci_gpio_bank45->dir);
-
-   /* set GPIO bank4 pin 15 high to drive VBUS */
-   value = readl(&davinci_gpio_bank45->set_data);
-   writel((value | DA8XX_USB_VBUS_GPIO), &davinci_gpio_bank45->set_data);
-}
-
-/*
- * Enable the usb0 phy. This initialization procedure is explained in
- * the DA8xx USB user guide document.
- */
-static u8 phy_on(void)
-{
-   u32 timeout;
-   u32 cfgchip2;
-
-   cfgchip2 = readl(&davinci_syscfg_regs->cfgchip2);
-
-   cfgchip2 &= ~(CFGCHIP2_RESET | CFGCHIP2_PHYPWRDN | CFGCHIP2_OTGPWRDN |
- CFGCHIP2_OTGMODE | CFGCHIP2_REFFREQ);
-   cfgchip2 |= CFGCHIP2_SESENDEN | CFGCHIP2_VBDTCTEN | CFGCHIP2_PHY_PLLON |
-   CFGCHIP2_REFFREQ_24MHZ;
-
-   writel(cfgchip2, &davinci_syscfg_regs->cfgchip2);
-
-   /* wait until the usb phy pll locks */
-   timeout = musb_cfg.timeout;
-   while (timeout--)
-   if (readl(&davinci_syscfg_regs->cfgchip2) & CFGCHIP2_PHYCLKGD)
-   return 1;
-
-   /* USB phy was not turned on */
-   return 0;
-}
-
-/*
- * Disable the usb phy
- */
-static void phy_off(void)
-{
-   u32 cfgchip2;
-
-   /*
-* Power down the on-chip PHY.
-*/
-   cfgchip2 = readl(&davinci_syscfg_regs->cfgchip2);
-   cfgchip2 &= ~CFGCHIP2_PHY_PLLON;
-   cfgchip2 |= CFGCHIP2_PHYPWRDN | CFGCHIP2_OTGPWRDN;
-   writel(cfgchip2, &davinci_syscfg_regs->cfgchip2);
-}
-
-/*
- * This function performs DA8xx platform specific initialization for usb0.
- */
-int musb_platform_init(void)
-{
-   u32  revision;
-
-   /* enable psc for usb2.0 */
-   lpsc_on(33);
-
-   /* enable usb vbus */
-   enable_vbus();
-
-   /* reset the controller */
-   writel(0x1, &da8xx_usb_regs->control);
-   udelay(5000);
-
-   /* start the on-chip usb phy and its pll */
-   if (phy_on() == 0)
-   return -1;
-
-   /* Returns zero if e.g. not clocked */
-   revision = readl(&da8xx_usb_regs->revision);
-   if (revision == 0)
-   return -1;
-
-   /* Disable all interrupts */
-   writel((DA8XX_USB_USBINT_MASK | DA8XX_USB_TXINT_MASK |
-   DA8XX_USB_RXINT_MASK), &da8xx_usb_regs->intmsk_set);
-   return 0;
-}
-
-/*
- * This function performs DA8xx platform specific deinitialization for usb0.
- */
-void musb_platform_deinit(void)
-{
-   /* Turn of the phy */
-   phy_off();
-
-   /* flush any interrupts */
-   writel((DA8XX_USB_USBINT_MASK | DA8XX_USB_TXINT_MASK |
-   DA8XX_USB_RXINT_MASK), &da8xx_usb_regs->intmsk_clr);
-   writel(0, &da8xx_usb_regs->eoi);
-}
-- 
2.17.1

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


[U-Boot] [PATCH] buildman: Deal nicely with invalid build-status file

2018-12-10 Thread Simon Glass
The 'done' files created by buildman may end up being empty if buildman
runs out of disk space while writing them. This error is then persistent,
since even if disk space is reclaimed and the build retries, the empty
file causes an exception in the builder thread.

Deal with this silently by doing a rebuild.

Signed-off-by: Simon Glass 
---

 tools/buildman/builderthread.py | 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/tools/buildman/builderthread.py b/tools/buildman/builderthread.py
index c84ba6acf11..b91634f3abb 100644
--- a/tools/buildman/builderthread.py
+++ b/tools/buildman/builderthread.py
@@ -156,7 +156,12 @@ class BuilderThread(threading.Thread):
 if result.already_done:
 # Get the return code from that build and use it
 with open(done_file, 'r') as fd:
-result.return_code = int(fd.readline())
+try:
+result.return_code = int(fd.readline())
+except ValueError:
+# The file may be empty due to running out of disk space.
+# Try a rebuild
+result.return_code = RETURN_CODE_RETRY
 
 # Check the signal that the build needs to be retried
 if result.return_code == RETURN_CODE_RETRY:
-- 
2.20.0.rc2.403.gdbc3b29805-goog

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


[U-Boot] [PATCH] Drivers: USB: Remove Legacy CONFIG_USB_DAVINCI

2018-12-10 Thread Adam Ford
This patch removes CONFIG_USB_DAVINCI.  It's a legacy option
that isn't defined anywhere, and there is a newer MUSB driver.

Signed-off-by: Adam Ford 

diff --git a/drivers/usb/musb/Kconfig b/drivers/usb/musb/Kconfig
index dd42f69a6b..7e6be03f4a 100644
--- a/drivers/usb/musb/Kconfig
+++ b/drivers/usb/musb/Kconfig
@@ -11,9 +11,6 @@ config USB_MUSB_HCD
 config USB_MUSB_UDC
bool "Legacy USB Device Controller"
 
-config USB_DAVINCI
-   bool "Legacy MUSB DaVinci"
-   
 config USB_OMAP3
bool "Legacy MUSB OMAP3 / OMAP4"
depends on ARCH_OMAP2PLUS
diff --git a/drivers/usb/musb/Makefile b/drivers/usb/musb/Makefile
index bdb3cd87f6..1242ce1c8c 100644
--- a/drivers/usb/musb/Makefile
+++ b/drivers/usb/musb/Makefile
@@ -5,7 +5,6 @@
 
 obj-$(CONFIG_USB_MUSB_HCD) += musb_hcd.o musb_core.o
 obj-$(CONFIG_USB_MUSB_UDC) += musb_udc.o musb_core.o
-obj-$(CONFIG_USB_DAVINCI) += davinci.o
 obj-$(CONFIG_USB_OMAP3) += omap3.o
 obj-$(CONFIG_USB_DA8XX) += da8xx.o
 obj-$(CONFIG_USB_AM35X) += am35x.o
diff --git a/drivers/usb/musb/musb_udc.c b/drivers/usb/musb/musb_udc.c
index f1d6d85862..7620114bec 100644
--- a/drivers/usb/musb/musb_udc.c
+++ b/drivers/usb/musb/musb_udc.c
@@ -46,8 +46,6 @@
 #include "omap3.h"
 #elif defined(CONFIG_USB_AM35X)
 #include "am35x.h"
-#elif defined(CONFIG_USB_DAVINCI)
-#include "davinci.h"
 #endif
 
 /* Define MUSB_DEBUG for debugging */
-- 
2.17.1

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


Re: [U-Boot] [PATCH v2 0/2] Read default speed and mode values from DT

2018-12-10 Thread Adam Ford
On Mon, Nov 19, 2018 at 12:01 PM Patrick Delaunay
 wrote:
>
>
> This serie generalize the commit 96907c0fe50a
> ("dm: spi: Read default speed and mode values from DT")
>
> In case of DT boot, don't read default speed and mode for SPI from
> CONFIG_*, instead read from DT node. This will make sure that boards
> with multiple SPI/QSPI controllers can be probed at different
> bus frequencies and SPI modes.
>
> Today it is only done in the command sf; this patch do the same
> for the other user of the spi_flash_probe(): spl and splash
> to avoid probe issue.
>
>
> Changes in v2:
> - use variables to avoid duplicated code
> - use variables to avoid duplicated code
>
> Patrick Delaunay (2):
>   spl_spi: Read default speed and mode values from DT
>   splash: sf: Read default speed and mode values from DT
>
>  common/spl/spl_spi.c   | 10 --
>  common/splash_source.c | 12 ++--
>  2 files changed, 18 insertions(+), 4 deletions(-)
>

I replied to another thread, but to prevent a hasty decision, I
thought I'd mention that this patch series breaks the da850evm.

U-Boot SPL 2019.01-rc1-00747-g1a3453efed (Dec 10 2018 - 09:07:08 -0600)
Trying to boot from SPI
Warning: SPI speed fallback to 100 kHz

(And repeat the above forever)

I know Jagan just re-did some of the da850 SPI driver and I wonder if
the updated driver just needs mode and speed entries added to platdata
then extracted from platdata when the driver is initialized.

adam
> --
> 2.7.4
>
> ___
> 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


[U-Boot] [PATCH 2/2] mtd: Get rid of board_mtdparts_default()

2018-12-10 Thread Boris Brezillon
The only implementer of this function has been patched to use
CONFIG_MTD{IDS,PARTS}_DEFAULT instead. Let's get rid of this function
and the associated CONFIG_SYS_MTDPARTS_RUNTIME option.

Signed-off-by: Boris Brezillon 
---
 board/isee/igep00x0/igep00x0.c   | 17 -
 cmd/mtdparts.c   |  6 --
 drivers/mtd/mtd_uboot.c  | 10 ++
 include/configs/omap3_igep00x0.h |  2 --
 scripts/config_whitelist.txt |  1 -
 5 files changed, 2 insertions(+), 34 deletions(-)

diff --git a/board/isee/igep00x0/igep00x0.c b/board/isee/igep00x0/igep00x0.c
index 367af82d4a16..3552be6f3902 100644
--- a/board/isee/igep00x0/igep00x0.c
+++ b/board/isee/igep00x0/igep00x0.c
@@ -239,20 +239,3 @@ int misc_init_r(void)
 
return 0;
 }
-
-void board_mtdparts_default(const char **mtdids, const char **mtdparts)
-{
-   struct mtd_info *mtd = get_mtd_device(NULL, 0);
-   if (mtd) {
-   static char ids[24];
-   static char parts[48];
-   const char *linux_name = "omap2-nand";
-   if (strncmp(mtd->name, "onenand0", 8) == 0)
-   linux_name = "omap2-onenand";
-   snprintf(ids, sizeof(ids), "%s=%s", mtd->name, linux_name);
-   snprintf(parts, sizeof(parts), "mtdparts=%s:%dk(SPL),-(UBI)",
-linux_name, 4 * mtd->erasesize >> 10);
-   *mtdids = ids;
-   *mtdparts = parts;
-   }
-}
diff --git a/cmd/mtdparts.c b/cmd/mtdparts.c
index f7ed1a077974..6b5644523898 100644
--- a/cmd/mtdparts.c
+++ b/cmd/mtdparts.c
@@ -122,9 +122,6 @@ DECLARE_GLOBAL_DATA_PTR;
 #define MTDPARTS_DEFAULT NULL
 #endif
 #endif
-#if defined(CONFIG_SYS_MTDPARTS_RUNTIME)
-extern void board_mtdparts_default(const char **mtdids, const char **mtdparts);
-#endif
 static const char *mtdids_default = MTDIDS_DEFAULT;
 static const char *mtdparts_default = MTDPARTS_DEFAULT;
 
@@ -1733,9 +1730,6 @@ int mtdparts_init(void)
memset(last_ids, 0, sizeof(last_ids));
memset(last_parts, 0, sizeof(last_parts));
memset(last_partition, 0, sizeof(last_partition));
-#if defined(CONFIG_SYS_MTDPARTS_RUNTIME)
-   board_mtdparts_default(&mtdids_default, &mtdparts_default);
-#endif
use_defaults = 1;
initialized = 1;
}
diff --git a/drivers/mtd/mtd_uboot.c b/drivers/mtd/mtd_uboot.c
index d638f700d041..ed619abac390 100644
--- a/drivers/mtd/mtd_uboot.c
+++ b/drivers/mtd/mtd_uboot.c
@@ -13,8 +13,6 @@
 
 #define MTD_NAME_MAX_LEN 20
 
-void board_mtdparts_default(const char **mtdids, const char **mtdparts);
-
 static const char *get_mtdids(void)
 {
__maybe_unused const char *mtdparts = NULL;
@@ -23,9 +21,7 @@ static const char *get_mtdids(void)
if (mtdids)
return mtdids;
 
-#if defined(CONFIG_SYS_MTDPARTS_RUNTIME)
-   board_mtdparts_default(&mtdids, &mtdparts);
-#elif defined(MTDIDS_DEFAULT)
+#if defined(MTDIDS_DEFAULT)
mtdids = MTDIDS_DEFAULT;
 #elif defined(CONFIG_MTDIDS_DEFAULT)
mtdids = CONFIG_MTDIDS_DEFAULT;
@@ -133,9 +129,7 @@ static const char *get_mtdparts(void)
if (mtdparts || !use_defaults)
return mtdparts;
 
-#if defined(CONFIG_SYS_MTDPARTS_RUNTIME)
-   board_mtdparts_default(&mtdids, &mtdparts);
-#elif defined(MTDPARTS_DEFAULT)
+#if defined(MTDPARTS_DEFAULT)
mtdparts = MTDPARTS_DEFAULT;
 #elif defined(CONFIG_MTDPARTS_DEFAULT)
mtdparts = CONFIG_MTDPARTS_DEFAULT;
diff --git a/include/configs/omap3_igep00x0.h b/include/configs/omap3_igep00x0.h
index b9d65697521b..280a094cdbae 100644
--- a/include/configs/omap3_igep00x0.h
+++ b/include/configs/omap3_igep00x0.h
@@ -87,8 +87,6 @@
 
 #endif
 
-#define CONFIG_SYS_MTDPARTS_RUNTIME
-
 /* OneNAND config */
 #define CONFIG_USE_ONENAND_BOARD_INIT
 #define CONFIG_SYS_ONENAND_BASEONENAND_MAP
diff --git a/scripts/config_whitelist.txt b/scripts/config_whitelist.txt
index b8addeaf693a..72608071c486 100644
--- a/scripts/config_whitelist.txt
+++ b/scripts/config_whitelist.txt
@@ -3511,7 +3511,6 @@ CONFIG_SYS_MRAM_SIZE
 CONFIG_SYS_MSC0_VAL
 CONFIG_SYS_MSC1_VAL
 CONFIG_SYS_MSC2_VAL
-CONFIG_SYS_MTDPARTS_RUNTIME
 CONFIG_SYS_MX5_CLK32
 CONFIG_SYS_MX5_HCLK
 CONFIG_SYS_MX6_CLK32
-- 
2.17.1

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


[U-Boot] [PATCH 1/2] configs: igep: Define default mtdids/mtdparts

2018-12-10 Thread Boris Brezillon
We are trying to get rid of the weak board_mtdparts_default() function
and we need to make sure igep defconfigs have proper proper
CONFIG_MTD{IDS,PARTS}_DEFAULT before doing that.

Signed-off-by: Boris Brezillon 
---
 configs/igep0032_defconfig | 2 ++
 configs/igep00x0_defconfig | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/configs/igep0032_defconfig b/configs/igep0032_defconfig
index 383648789c53..d2a614c98f6d 100644
--- a/configs/igep0032_defconfig
+++ b/configs/igep0032_defconfig
@@ -28,6 +28,8 @@ CONFIG_CMD_SPI=y
 CONFIG_CMD_CACHE=y
 CONFIG_CMD_EXT4_WRITE=y
 CONFIG_CMD_MTDPARTS=y
+CONFIG_MTDIDS_DEFAULT="nand0=omap2-nand,onenand0=omap2-onenand"
+CONFIG_MTDPARTS_DEFAULT="omap2-nand:512k(SPL),-(UBI);omap2-onenand:512k(SPL),-(UBI)"
 CONFIG_CMD_UBI=y
 # CONFIG_CMD_UBIFS is not set
 CONFIG_NET_RANDOM_ETHADDR=y
diff --git a/configs/igep00x0_defconfig b/configs/igep00x0_defconfig
index f2989e34e12e..5d3e109ee3c2 100644
--- a/configs/igep00x0_defconfig
+++ b/configs/igep00x0_defconfig
@@ -28,6 +28,8 @@ CONFIG_CMD_SPI=y
 CONFIG_CMD_CACHE=y
 CONFIG_CMD_EXT4_WRITE=y
 CONFIG_CMD_MTDPARTS=y
+CONFIG_MTDIDS_DEFAULT="nand0=omap2-nand,onenand0=omap2-onenand"
+CONFIG_MTDPARTS_DEFAULT="omap2-nand:512k(SPL),-(UBI);omap2-onenand:512k(SPL),-(UBI)"
 CONFIG_CMD_UBI=y
 # CONFIG_CMD_UBIFS is not set
 CONFIG_NET_RANDOM_ETHADDR=y
-- 
2.17.1

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


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

2018-12-10 Thread Daniel Schwierzeck


Am 01.12.18 um 19:00 schrieb Á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

Re: [U-Boot] [PULL] u-boot-sh/master

2018-12-10 Thread Tom Rini
On Mon, Dec 10, 2018 at 05:53:22AM +0100, Marek Vasut wrote:

> The following changes since commit 57dbc151437b36cc1105857d222df28b095236d7:
> 
>   rockchip: rk3399: Add MAINTAINERS entry (2018-12-06 10:24:12 -0500)
> 
> are available in the Git repository at:
> 
>   git://git.denx.de/u-boot-sh.git master
> 
> for you to fetch changes up to 5055a4e9008dcb8db78b98ad6a700605cd3ae0e9:
> 
>   ARM: rmobile: Fix to enable icache early in Gen3 (2018-12-07 16:31:15
> +0100)
> 

Applied to u-boot/master, thanks!

-- 
Tom


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


Re: [U-Boot] Please pull from u-boot-i2c

2018-12-10 Thread Tom Rini
On Mon, Dec 10, 2018 at 11:56:45AM +0100, Heiko Schocher wrote:

> Hello Tom,
> 
> please pull from u-boot-i2c.git master.
> 
> Series contains DM_I2C_COMPAT removal for all ti platforms from Jean-Jacques
> Hiblot. Also a fix in i2c command help output from Chirstoph Muellner.
> 
> Thanks!
> 
> The following changes since commit cde578ff36b15ec9c2033f03b94ecf809af7cc64:
> 
>   ARM: mvebu: restore license information in mv_ddr_plat.{c,h} (2018-12-09 
> 17:10:13 -0500)
> 
> are available in the Git repository at:
> 
>   git://git.denx.de/u-boot-i2c.git master
> 
> for you to fetch changes up to 19f8c4dfb6e744a31da59bdd23b24d144152f1dc:
> 
>   cmd: i2c: Fix help output of i2c command. (2018-12-10 07:30:58 +0100)
> 

Applied to u-boot/master, thanks!

-- 
Tom


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


Re: [U-Boot] [PULL] u-boot-usb/master

2018-12-10 Thread Tom Rini
On Mon, Dec 10, 2018 at 05:51:36AM +0100, Marek Vasut wrote:

> DWC3 and UDC cleanup
> 
> The following changes since commit 57dbc151437b36cc1105857d222df28b095236d7:
> 
>   rockchip: rk3399: Add MAINTAINERS entry (2018-12-06 10:24:12 -0500)
> 
> are available in the Git repository at:
> 
>   git://git.denx.de/u-boot-usb.git master
> 
> for you to fetch changes up to 532ededd5cbff3d55e8c8e5b6377cec9e90f2152:
> 
>   board: ti: am57xx: remove USB platform code (2018-12-07 16:31:46 +0100)
> 

Applied to u-boot/master, thanks!

-- 
Tom


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


Re: [U-Boot] [PULL] u-boot-socfpga/master

2018-12-10 Thread Tom Rini
On Mon, Dec 10, 2018 at 05:52:22AM +0100, Marek Vasut wrote:

> The following changes since commit 57dbc151437b36cc1105857d222df28b095236d7:
> 
>   rockchip: rk3399: Add MAINTAINERS entry (2018-12-06 10:24:12 -0500)
> 
> are available in the Git repository at:
> 
>   git://git.denx.de/u-boot-socfpga.git master
> 
> for you to fetch changes up to a9024dc18e9e864437a456f6c0144764dbee57d4:
> 
>   arm: socfpga: imply SPL options instead of select (2018-12-07 16:32:01
> +0100)
> 

Applied to u-boot/master, thanks!

-- 
Tom


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


Re: [U-Boot] Please pull u-boot-x86

2018-12-10 Thread Tom Rini
On Mon, Dec 10, 2018 at 10:22:27AM +0800, Bin Meng wrote:

> Hi Tom,
> 
> This includes the following changes for x86:
> - Enable RTC for Intel Tangier
> - Wrap the call to 8259 PIC with Kconfig options for old targets without 8259
> - Warp the call to USB init with Kconfg options for coreboot & EFI payload
> 
> The following changes since commit cde578ff36b15ec9c2033f03b94ecf809af7cc64:
> 
>   ARM: mvebu: restore license information in mv_ddr_plat.{c,h}
> (2018-12-09 17:10:13 -0500)
> 
> are available in the git repository at:
> 
>   git://git.denx.de/u-boot-x86.git
> 
> for you to fetch changes up to d3d6531866f2d7aa85b053cef553090b251e909f:
> 
>   efi: payload: only init usb if necessary (2018-12-10 10:14:42 +0800)
> 

Applied to u-boot/master, thanks!

-- 
Tom


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


Re: [U-Boot] [PATCH] ARM: at91: Fix 'boot.bin' generation when CONFIG_SD_BOOT is enabled

2018-12-10 Thread Eugen.Hristev


On 10.12.2018 16:54, Derald Woods wrote:
> 
> 
> On Mon, Dec 10, 2018 at 8:03 AM  > wrote:
> 
> 
> 
> On 10.12.2018 15:01, Derald D. Woods wrote:
>  > On Mon, Dec 10, 2018 at 08:32:33AM +,
> eugen.hris...@microchip.com  wrote:
>  >>
>  >>
>  >> On 08.12.2018 21:49, Derald D. Woods wrote:
>  >>> On AT91 platforms configured for SD_BOOT, this commit avoids the
>  >>> generation of the PMECC header used for booting from NAND
> flash. This
>  >>> issue was found by attempting to boot the SAMA5D3-XPLD board
> with the
>  >>> 'sama5d3_xplained_mmc_defconfig'.
>  >>>
>  >>> [PMECC Reference]
>  >>> http://www.at91.com/linux4sam/bin/view/Linux4SAM/AT91Bootstrap
>  >>>
>  >>> [Mailing List Thread]
>  >>> https://lists.denx.de/pipermail/u-boot/2018-December/350666.html
>  >>>
>  >>> Fixes: 5541543f ("configs: at91: Remove
> CONFIG_SYS_EXTRA_OPTIONS assignment")
>  >>> Reported-by: Daniel Evans  >
>  >>> Cc: Robert Nelson  >
>  >>> Cc: Eugen Hristev  >
>  >>> Cc: Wenyou Yang  >
>  >>> Signed-off-by: Derald D. Woods  >
>  >>> ---
>  >>>    scripts/Makefile.spl | 2 ++
>  >>>    1 file changed, 2 insertions(+)
>  >>>
>  >>> diff --git a/scripts/Makefile.spl b/scripts/Makefile.spl
>  >>> index 22bd8f7c27..e727cb610f 100644
>  >>> --- a/scripts/Makefile.spl
>  >>> +++ b/scripts/Makefile.spl
>  >>> @@ -166,10 +166,12 @@ ifeq ($(CONFIG_SYS_SOC),"at91")
>  >>>    MKIMAGEFLAGS_boot.bin = -T atmelimage
>  >>>
>  >>>    ifeq ($(CONFIG_SPL_GENERATE_ATMEL_PMECC_HEADER),y)
>  >>> +ifneq ($(CONFIG_SD_BOOT),y)
>  >>
>  >> Hi Derald,
>  >>
>  >> Thanks for your patch, however, I don't like that we do not use the
>  >> CONFIG_SPL_GENERATE_ATMEL_PMECC_HEADER anymore... isn't this config
>  >> supposed to say whether we are going to generate the header or not ?
>  >>
>  >
>  > That is not what is happening with this patch.
> SPL_GENERATE_ATMEL_PMECC_HEADER
>  > is not removed. The config still serves its orignal intent. If
> SD_BOOT
>  > is configured, then NAND is not being used. In this non-NAND
> case, the
>  > header is not needed.
>  >
>  >> Checking if "not sd-boot" doesn't look like a good option... we
> may use
>  >> SPI boot or QSPI or some other type at some point and the issue will
>  >> still be there.
>  >>
>  >
>  > This location and method would work for those nod-NAND cases
> also. See
>  > below.
>  >
>  >> I would rather fix the original patch by Wenyou, namely move the
> #ifdef
>  >> below to not have the GENERATE_ATMEL_PMECC enabled for SDBOOT.
>  >>
>  >> Does this sound good for you?
>  >>
>  >
>  > If this SPL_GENERATE_ATMEL_PMECC_HEADER only needs to be there
> for NAND,
>  > why not guard the 'ifdef ($(CONFIG_NAND_BOOT,y))'? Would this be
> better?
>  > Basically we could replace the 'ifneq ($(CONFIG_SD_BOOT),y)' with the
>  > more appropriate 'ifeq ($(CONFIG_NAND_BOOT),y)'. This would actually
>  > allow the future use-cases to be added as they become available
> and can
>  > be shown to actually boot with the header applied.
>  >
>  > I will put together a proper version 2 of my patch later today.
>  >
>  > [patch v2]
>  >
> 
> 
>  > diff --git a/scripts/Makefile.spl b/scripts/Makefile.spl
>  > index 22bd8f7..e727cb6 100644
>  > --- a/scripts/Makefile.spl
>  > +++ b/scripts/Makefile.spl
>  > @@ -166,10 +166,12 @@ ifeq ($(CONFIG_SYS_SOC),"at91")
>  >   MKIMAGEFLAGS_boot.bin = -T atmelimage
>  >
>  >   ifeq ($(CONFIG_SPL_GENERATE_ATMEL_PMECC_HEADER),y)
>  > +ifeq ($(CONFIG_NAND_BOOT),y)
>  >   MKIMAGEFLAGS_boot.bin += -n $(shell
> $(obj)/../tools/atmel_pmecc_params)
>  >
>  >   boot.bin: $(obj)/../tools/atmel_pmecc_params
>  >   endif
>  > +endif
>  >
>  >   boot.bin: $(obj)/u-boot-spl.bin FORCE
>  >       $(call if_changed,mkimage)
>  >
> 
> 
>  >
>  > This would allow other configurations to 'opt-in' to applying the
>  > header. Which I think is the direction this is truly heading.
> 
> My questions are :
> 
> If we have configured CONFIG_SPL_GENERATE_ATMEL_PMECC_HEADER, then why
> the header is not being applied after your patch ?
> 
> And why do we configure CONFIG_SPL_GENERATE_ATMEL_PMECC_HEADER if we do
> not wish the PMECC header in the image ?
> 
>   

Re: [U-Boot] [PATCH] ARM: at91: Fix 'boot.bin' generation when CONFIG_SD_BOOT is enabled

2018-12-10 Thread Derald Woods
On Mon, Dec 10, 2018 at 8:03 AM  wrote:

>
>
> On 10.12.2018 15:01, Derald D. Woods wrote:
> > On Mon, Dec 10, 2018 at 08:32:33AM +, eugen.hris...@microchip.com
> wrote:
> >>
> >>
> >> On 08.12.2018 21:49, Derald D. Woods wrote:
> >>> On AT91 platforms configured for SD_BOOT, this commit avoids the
> >>> generation of the PMECC header used for booting from NAND flash. This
> >>> issue was found by attempting to boot the SAMA5D3-XPLD board with the
> >>> 'sama5d3_xplained_mmc_defconfig'.
> >>>
> >>> [PMECC Reference]
> >>> http://www.at91.com/linux4sam/bin/view/Linux4SAM/AT91Bootstrap
> >>>
> >>> [Mailing List Thread]
> >>> https://lists.denx.de/pipermail/u-boot/2018-December/350666.html
> >>>
> >>> Fixes: 5541543f ("configs: at91: Remove CONFIG_SYS_EXTRA_OPTIONS
> assignment")
> >>> Reported-by: Daniel Evans 
> >>> Cc: Robert Nelson 
> >>> Cc: Eugen Hristev 
> >>> Cc: Wenyou Yang 
> >>> Signed-off-by: Derald D. Woods 
> >>> ---
> >>>scripts/Makefile.spl | 2 ++
> >>>1 file changed, 2 insertions(+)
> >>>
> >>> diff --git a/scripts/Makefile.spl b/scripts/Makefile.spl
> >>> index 22bd8f7c27..e727cb610f 100644
> >>> --- a/scripts/Makefile.spl
> >>> +++ b/scripts/Makefile.spl
> >>> @@ -166,10 +166,12 @@ ifeq ($(CONFIG_SYS_SOC),"at91")
> >>>MKIMAGEFLAGS_boot.bin = -T atmelimage
> >>>
> >>>ifeq ($(CONFIG_SPL_GENERATE_ATMEL_PMECC_HEADER),y)
> >>> +ifneq ($(CONFIG_SD_BOOT),y)
> >>
> >> Hi Derald,
> >>
> >> Thanks for your patch, however, I don't like that we do not use the
> >> CONFIG_SPL_GENERATE_ATMEL_PMECC_HEADER anymore... isn't this config
> >> supposed to say whether we are going to generate the header or not ?
> >>
> >
> > That is not what is happening with this patch.
> SPL_GENERATE_ATMEL_PMECC_HEADER
> > is not removed. The config still serves its orignal intent. If SD_BOOT
> > is configured, then NAND is not being used. In this non-NAND case, the
> > header is not needed.
> >
> >> Checking if "not sd-boot" doesn't look like a good option... we may use
> >> SPI boot or QSPI or some other type at some point and the issue will
> >> still be there.
> >>
> >
> > This location and method would work for those nod-NAND cases also. See
> > below.
> >
> >> I would rather fix the original patch by Wenyou, namely move the #ifdef
> >> below to not have the GENERATE_ATMEL_PMECC enabled for SDBOOT.
> >>
> >> Does this sound good for you?
> >>
> >
> > If this SPL_GENERATE_ATMEL_PMECC_HEADER only needs to be there for NAND,
> > why not guard the 'ifdef ($(CONFIG_NAND_BOOT,y))'? Would this be better?
> > Basically we could replace the 'ifneq ($(CONFIG_SD_BOOT),y)' with the
> > more appropriate 'ifeq ($(CONFIG_NAND_BOOT),y)'. This would actually
> > allow the future use-cases to be added as they become available and can
> > be shown to actually boot with the header applied.
> >
> > I will put together a proper version 2 of my patch later today.
> >
> > [patch v2]
> >
> 
>
> > diff --git a/scripts/Makefile.spl b/scripts/Makefile.spl
> > index 22bd8f7..e727cb6 100644
> > --- a/scripts/Makefile.spl
> > +++ b/scripts/Makefile.spl
> > @@ -166,10 +166,12 @@ ifeq ($(CONFIG_SYS_SOC),"at91")
> >   MKIMAGEFLAGS_boot.bin = -T atmelimage
> >
> >   ifeq ($(CONFIG_SPL_GENERATE_ATMEL_PMECC_HEADER),y)
> > +ifeq ($(CONFIG_NAND_BOOT),y)
> >   MKIMAGEFLAGS_boot.bin += -n $(shell $(obj)/../tools/atmel_pmecc_params)
> >
> >   boot.bin: $(obj)/../tools/atmel_pmecc_params
> >   endif
> > +endif
> >
> >   boot.bin: $(obj)/u-boot-spl.bin FORCE
> >   $(call if_changed,mkimage)
> >
> 
>
> >
> > This would allow other configurations to 'opt-in' to applying the
> > header. Which I think is the direction this is truly heading.
>
> My questions are :
>
> If we have configured CONFIG_SPL_GENERATE_ATMEL_PMECC_HEADER, then why
> the header is not being applied after your patch ?
>
> And why do we configure CONFIG_SPL_GENERATE_ATMEL_PMECC_HEADER if we do
> not wish the PMECC header in the image ?
>
> With your patch, why do we generate the PMECC header w.r.t. the
> configuration of NAND_BOOT and not CONFIG_SPL_GENERATE_ATMEL_PMECC_HEADER ?
>
> Or perhaps I am missing something on the purpose of
> CONFIG_SPL_GENERATE_ATMEL_PMECC_HEADER ?
>
> To quote from doc/README.atmel_pmecc :
> 
> To enable the generation of atmel PMECC header for SPL one need to
> define
> CONFIG_SPL_GENERATE_ATMEL_PMECC_HEADER. The required parameters are
> taken from
> board configuration and compiled into the host tools atmel_pmecc_params.
> This
> tool will be called in build process to parametrize mkimage for
> atmelimage
> type. The mkimage tool has intentionally _not_ compiled in those
> parameters.
> 
>
>
> So I would expect CONFIG_SPL_GENERATE_ATMEL_PMECC_HEADER to generate the
> PMECC header if configured, and if this flag is not present, the PMECC
> header is not generated.
> I do expect that SD card booting conf

Re: [U-Boot] [PATCH] bmips: swapping IO space isn't required

2018-12-10 Thread Daniel Schwierzeck

Am 09.12.18 um 10:41 schrieb Álvaro Fernández Rojas:
> Signed-off-by: Álvaro Fernández Rojas 
> ---
>  arch/mips/mach-bmips/Kconfig | 10 --
>  1 file changed, 10 deletions(-)

Reviewed-by: Daniel Schwierzeck 

I guess this is related to your recent series "serial: bcm6345: switch
to raw I/O functions"? As Tom already applied this series, this patch
should go in 2019.01 too?

> 
> diff --git a/arch/mips/mach-bmips/Kconfig b/arch/mips/mach-bmips/Kconfig
> index 521996599e..b259a931c9 100644
> --- a/arch/mips/mach-bmips/Kconfig
> +++ b/arch/mips/mach-bmips/Kconfig
> @@ -25,7 +25,6 @@ config SOC_BMIPS_BCM3380
>   select MIPS_TUNE_4KC
>   select SUPPORTS_BIG_ENDIAN
>   select SUPPORTS_CPU_MIPS32_R1
> - select SWAP_IO_SPACE
>   select SYSRESET_WATCHDOG
>   help
> This supports BMIPS BCM3380 family.
> @@ -36,7 +35,6 @@ config SOC_BMIPS_BCM6318
>   select MIPS_TUNE_4KC
>   select SUPPORTS_BIG_ENDIAN
>   select SUPPORTS_CPU_MIPS32_R1
> - select SWAP_IO_SPACE
>   select SYSRESET_SYSCON
>   help
> This supports BMIPS BCM6318 family.
> @@ -47,7 +45,6 @@ config SOC_BMIPS_BCM6328
>   select MIPS_TUNE_4KC
>   select SUPPORTS_BIG_ENDIAN
>   select SUPPORTS_CPU_MIPS32_R1
> - select SWAP_IO_SPACE
>   select SYSRESET_SYSCON
>   help
> This supports BMIPS BCM6328 family including BCM63281 and BCM63283.
> @@ -58,7 +55,6 @@ config SOC_BMIPS_BCM6338
>   select MIPS_TUNE_4KC
>   select SUPPORTS_BIG_ENDIAN
>   select SUPPORTS_CPU_MIPS32_R1
> - select SWAP_IO_SPACE
>   select SYSRESET_SYSCON
>   help
> This supports BMIPS BCM6338 family.
> @@ -69,7 +65,6 @@ config SOC_BMIPS_BCM6348
>   select MIPS_TUNE_4KC
>   select SUPPORTS_BIG_ENDIAN
>   select SUPPORTS_CPU_MIPS32_R1
> - select SWAP_IO_SPACE
>   select SYSRESET_WATCHDOG
>   help
> This supports BMIPS BCM6348 family.
> @@ -80,7 +75,6 @@ config SOC_BMIPS_BCM6358
>   select MIPS_TUNE_4KC
>   select SUPPORTS_BIG_ENDIAN
>   select SUPPORTS_CPU_MIPS32_R1
> - select SWAP_IO_SPACE
>   select SYSRESET_SYSCON
>   help
> This supports BMIPS BCM6358 family including BCM6358 and BCM6359.
> @@ -91,7 +85,6 @@ config SOC_BMIPS_BCM6368
>   select MIPS_TUNE_4KC
>   select SUPPORTS_BIG_ENDIAN
>   select SUPPORTS_CPU_MIPS32_R1
> - select SWAP_IO_SPACE
>   select SYSRESET_SYSCON
>   help
> This supports BMIPS BCM6368 family including BCM6368 and BCM6369.
> @@ -102,7 +95,6 @@ config SOC_BMIPS_BCM6362
>   select MIPS_TUNE_4KC
>   select SUPPORTS_BIG_ENDIAN
>   select SUPPORTS_CPU_MIPS32_R1
> - select SWAP_IO_SPACE
>   select SYSRESET_SYSCON
>   help
> This supports BMIPS BCM6362 family including BCM6361 and BCM6362.
> @@ -113,7 +105,6 @@ config SOC_BMIPS_BCM63268
>   select MIPS_TUNE_4KC
>   select SUPPORTS_BIG_ENDIAN
>   select SUPPORTS_CPU_MIPS32_R1
> - select SWAP_IO_SPACE
>   select SYSRESET_SYSCON
>   help
> This supports BMIPS BCM63268 family including BCM63168, BCM63169,
> @@ -125,7 +116,6 @@ config SOC_BMIPS_BCM6838
>   select MIPS_TUNE_4KC
>   select SUPPORTS_BIG_ENDIAN
>   select SUPPORTS_CPU_MIPS32_R1
> - select SWAP_IO_SPACE
>   select SYSRESET_SYSCON
>   help
> This supports BMIPS BCM6838 family including BCM68380, BCM68381,
> 

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


Re: [U-Boot] [RFC PATCH v2 00/11] SF: Migrate to Linux SPI NOR framework

2018-12-10 Thread Tom Rini
On Mon, Dec 10, 2018 at 02:15:05PM +0100, Boris Brezillon wrote:
> On Mon, 10 Dec 2018 18:32:09 +0530
> Jagan Teki  wrote:
> 
> > On Thu, Dec 6, 2018 at 11:55 PM Vignesh R  wrote:
> > >
> > > Hi Jagan,
> > >
> > > On 06-Dec-18 10:44 PM, Jagan Teki wrote:  
> > > > On Tue, Dec 4, 2018 at 5:56 PM Vignesh R  wrote:  
> > > >>
> > > >> U-Boot SPI NOR support (sf layer) is quite outdated as it does not
> > > >> support 4 byte addressing opcodes, SFDP table parsing and different 
> > > >> types of
> > > >> quad mode enable sequences. Many newer flashes no longer support BANK
> > > >> registers used by sf layer to a access >16MB space.
> > > >> Also, many SPI controllers have special MMIO interfaces which provide
> > > >> accelerated read/write access but require knowledge of flash parameters
> > > >> to make use of it. Recent spi-mem layer provides a way to support such
> > > >> flashes but sf layer isn't using that.
> > > >> This patch series syncs SPI NOR framework from Linux v4.19. It also 
> > > >> adds
> > > >> spi-mem support on top.
> > > >> So, we gain 4byte addressing support and SFDP support. This makes
> > > >> migrating to U-Boot MTD framework easier.  
> > > >
> > > > We(someone) has proposed this sync before, but we(at-least I) rely on
> > > > implementing via DM not direct sync to Linux.  
> > >
> > > As I said in my cover letter, U-Boot sf layer is unable to support newer
> > > flashes mainly due to lack of 4 byte addressing and proper support for
> > > MMIO capable SPI controllers.
> > > My idea of fixing this is to borrow _features_ from Linux SPI NOR "as
> > > is". All that's needed is stateless 4 byte addressing, SFDP
> > > parsing(optionally), Quad/Octal support and spi-mem like abstraction for
> > > MMIO capable Controllers. I see no point in re-coding them from ground up.
> > >
> > > Could you be more specific on what you would like to see here in DM way?
> > > I have no issues in adapting this code to any framework here in U-Boot.
> > > Linux has driver model and SPI NOR subsystem is a framework and
> > > therefore any code ported from Linux will inherently have those
> > > abstractions. The only difference I see wrt your code in branch below vs
> > > this series is SPI-NOR uclass. This can be easily achieved by moving
> > > nor->ops out of struct spi_nor into uclass abstraction.
> > > Upstream Linux is anyways merging m25p80 and spi-nor so I did not see a
> > > need for SPI NOR uclass. I am okay to change that if you insist on
> > > having it.  
> > 
> > Merging or syncing spi-nor features stuff from Linux is good, I'm not
> > stopping that. but this can be do by satisfying u-boot driver-model
> > with proper architectural model. I know you take care but I'm not sure
> > ie what can be manageable for long term.
> > 
> > Let's discuss the proper architectural model, so-that we can move
> > further to incorporate the changes accordingly. (thanks at last we
> > have a thread to discuss)
> 
> Having discussions about the long term plan is good, as long as it's
> not blocking support for new features for too long. Look, you've been
> discussing the spi-nor stuff for more than 1 year now, and people are
> still waiting it. Yogesh's attempt seems to go in the right direction,
> so let's not block that just because we don't know how to integrate
> things in the DM (that's not entirely BTW, I suggested an approach in
> one of my previous reply).

To be clear, we've been having this discussion for probably closer to
two or three years now.  Which is why at this point what I'm saying we
need to do is get a logical evolution of To be clear, we've been having
this discussion for probably closer to two or three years now.  Which is
why at this point what I'm saying we need to do is get a logical
evolution of Vignesh's series in, for v2019.04 and improve it over time.
The notion of "we'll block progress on new features in order to make
sure we get conversion done" has failed.  Lets go back to good old
reliable incremental change over time.

-- 
Tom


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


Re: [U-Boot] [RESEND PATCH v3 1/3] Don't enable CONFIG_SPL_DM_USB for non-DM SPL

2018-12-10 Thread Marek Vasut
On 12/10/2018 02:53 PM, Martyn Welch wrote:
> On Mon, 2018-12-10 at 13:07 +0100, Marek Vasut wrote:
>> On 12/10/2018 12:05 PM, Martyn Welch wrote:
>>> When CONFIG_SPL_DM_USB was added, it was added defaulted on without
>>> protection to ensure it didn't get set for non-DM SPL builds.
>>>
>>> This leads to unexpected and confusing failures when building a DM
>>> based
>>> U-Boot but with a non-DM SPL, as the defconfig is unlikely to have
>>> CONFIG_SPL_DM_USB actively disabled.
>>>
>>> Tweak the Kconfig to not enable this setting unless CONFIG_SPL_DM
>>> is set.
>>>
>>> Signed-off-by: Martyn Welch 
>>
>> Ah, I didn't realize the other patches weren't USB too.
>> Applied, thanks.
>>
> 
> Thanks.
> 
> I assume this is juat patch 1/3 that you've applied?

Yes

-- 
Best regards,
Marek Vasut
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH] ARM: at91: Fix 'boot.bin' generation when CONFIG_SD_BOOT is enabled

2018-12-10 Thread Eugen.Hristev


On 10.12.2018 15:01, Derald D. Woods wrote:
> On Mon, Dec 10, 2018 at 08:32:33AM +, eugen.hris...@microchip.com wrote:
>>
>>
>> On 08.12.2018 21:49, Derald D. Woods wrote:
>>> On AT91 platforms configured for SD_BOOT, this commit avoids the
>>> generation of the PMECC header used for booting from NAND flash. This
>>> issue was found by attempting to boot the SAMA5D3-XPLD board with the
>>> 'sama5d3_xplained_mmc_defconfig'.
>>>
>>> [PMECC Reference]
>>> http://www.at91.com/linux4sam/bin/view/Linux4SAM/AT91Bootstrap
>>>
>>> [Mailing List Thread]
>>> https://lists.denx.de/pipermail/u-boot/2018-December/350666.html
>>>
>>> Fixes: 5541543f ("configs: at91: Remove CONFIG_SYS_EXTRA_OPTIONS 
>>> assignment")
>>> Reported-by: Daniel Evans 
>>> Cc: Robert Nelson 
>>> Cc: Eugen Hristev 
>>> Cc: Wenyou Yang 
>>> Signed-off-by: Derald D. Woods 
>>> ---
>>>scripts/Makefile.spl | 2 ++
>>>1 file changed, 2 insertions(+)
>>>
>>> diff --git a/scripts/Makefile.spl b/scripts/Makefile.spl
>>> index 22bd8f7c27..e727cb610f 100644
>>> --- a/scripts/Makefile.spl
>>> +++ b/scripts/Makefile.spl
>>> @@ -166,10 +166,12 @@ ifeq ($(CONFIG_SYS_SOC),"at91")
>>>MKIMAGEFLAGS_boot.bin = -T atmelimage
>>>
>>>ifeq ($(CONFIG_SPL_GENERATE_ATMEL_PMECC_HEADER),y)
>>> +ifneq ($(CONFIG_SD_BOOT),y)
>>
>> Hi Derald,
>>
>> Thanks for your patch, however, I don't like that we do not use the
>> CONFIG_SPL_GENERATE_ATMEL_PMECC_HEADER anymore... isn't this config
>> supposed to say whether we are going to generate the header or not ?
>>
> 
> That is not what is happening with this patch. SPL_GENERATE_ATMEL_PMECC_HEADER
> is not removed. The config still serves its orignal intent. If SD_BOOT
> is configured, then NAND is not being used. In this non-NAND case, the
> header is not needed.
> 
>> Checking if "not sd-boot" doesn't look like a good option... we may use
>> SPI boot or QSPI or some other type at some point and the issue will
>> still be there.
>>
> 
> This location and method would work for those nod-NAND cases also. See
> below.
> 
>> I would rather fix the original patch by Wenyou, namely move the #ifdef
>> below to not have the GENERATE_ATMEL_PMECC enabled for SDBOOT.
>>
>> Does this sound good for you?
>>
> 
> If this SPL_GENERATE_ATMEL_PMECC_HEADER only needs to be there for NAND,
> why not guard the 'ifdef ($(CONFIG_NAND_BOOT,y))'? Would this be better?
> Basically we could replace the 'ifneq ($(CONFIG_SD_BOOT),y)' with the
> more appropriate 'ifeq ($(CONFIG_NAND_BOOT),y)'. This would actually
> allow the future use-cases to be added as they become available and can
> be shown to actually boot with the header applied.
> 
> I will put together a proper version 2 of my patch later today.
> 
> [patch v2]
>   
> diff --git a/scripts/Makefile.spl b/scripts/Makefile.spl
> index 22bd8f7..e727cb6 100644
> --- a/scripts/Makefile.spl
> +++ b/scripts/Makefile.spl
> @@ -166,10 +166,12 @@ ifeq ($(CONFIG_SYS_SOC),"at91")
>   MKIMAGEFLAGS_boot.bin = -T atmelimage
>   
>   ifeq ($(CONFIG_SPL_GENERATE_ATMEL_PMECC_HEADER),y)
> +ifeq ($(CONFIG_NAND_BOOT),y)
>   MKIMAGEFLAGS_boot.bin += -n $(shell $(obj)/../tools/atmel_pmecc_params)
>   
>   boot.bin: $(obj)/../tools/atmel_pmecc_params
>   endif
> +endif
>   
>   boot.bin: $(obj)/u-boot-spl.bin FORCE
>   $(call if_changed,mkimage)
>   
> 
> This would allow other configurations to 'opt-in' to applying the
> header. Which I think is the direction this is truly heading.

My questions are :

If we have configured CONFIG_SPL_GENERATE_ATMEL_PMECC_HEADER, then why 
the header is not being applied after your patch ?

And why do we configure CONFIG_SPL_GENERATE_ATMEL_PMECC_HEADER if we do 
not wish the PMECC header in the image ?

With your patch, why do we generate the PMECC header w.r.t. the 
configuration of NAND_BOOT and not CONFIG_SPL_GENERATE_ATMEL_PMECC_HEADER ?

Or perhaps I am missing something on the purpose of 
CONFIG_SPL_GENERATE_ATMEL_PMECC_HEADER ?

To quote from doc/README.atmel_pmecc :

To enable the generation of atmel PMECC header for SPL one need to 
define
CONFIG_SPL_GENERATE_ATMEL_PMECC_HEADER. The required parameters are 
taken from
board configuration and compiled into the host tools atmel_pmecc_params. 
This
tool will be called in build process to parametrize mkimage for 
atmelimage
type. The mkimage tool has intentionally _not_ compiled in those parameters.



So I would expect CONFIG_SPL_GENERATE_ATMEL_PMECC_HEADER to generate the 
PMECC header if configured, and if this flag is not present, the PMECC 
header is not generated.
I do expect that SD card booting configurations do not select this flag.


> 
> Also, the SPL_GENERATE_ATMEL_PMECC_HEADER needs transitioning to
> Kconfig. Having the logic in "Makefile.spl" would help with that work
> too.
> 
> Derald
> 
> 
>> Thanks again,
>>
>> Eugen
>>
>>>MKIMAGEFLAGS_

Re: [U-Boot] [RESEND PATCH v3 1/3] Don't enable CONFIG_SPL_DM_USB for non-DM SPL

2018-12-10 Thread Martyn Welch
On Mon, 2018-12-10 at 13:07 +0100, Marek Vasut wrote:
> On 12/10/2018 12:05 PM, Martyn Welch wrote:
> > When CONFIG_SPL_DM_USB was added, it was added defaulted on without
> > protection to ensure it didn't get set for non-DM SPL builds.
> > 
> > This leads to unexpected and confusing failures when building a DM
> > based
> > U-Boot but with a non-DM SPL, as the defconfig is unlikely to have
> > CONFIG_SPL_DM_USB actively disabled.
> > 
> > Tweak the Kconfig to not enable this setting unless CONFIG_SPL_DM
> > is set.
> > 
> > Signed-off-by: Martyn Welch 
> 
> Ah, I didn't realize the other patches weren't USB too.
> Applied, thanks.
> 

Thanks.

I assume this is juat patch 1/3 that you've applied?

Martyn

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


Re: [U-Boot] [RESEND PATCH v3 3/3] imx: Add PHYTEC phyBOARD-i.MX6UL-Segin

2018-12-10 Thread Martyn Welch
On Mon, 2018-12-10 at 12:49 +0100, Lukasz Majewski wrote:
> Hi Martyn,
> 
> > Port for the PHYTEC phyBOARD-i.MX6UL-Segin single board computer.
> > Based on the PHYTEC phyCORE-i.MX6UL SOM (PCL063).
> > 
> > CPU:   Freescale i.MX6UL rev1.2 528 MHz (running at 396 MHz)
> > CPU:   Industrial temperature grade (-40C to 105C) at 44C
> > Reset cause: POR
> > Board: PHYTEC phyCORE-i.MX6UL
> > I2C:   ready
> > DRAM:  256 MiB
> > NAND:  512 MiB
> > MMC:   FSL_SDHC: 0
> > In:serial
> > Out:   serial
> > Err:   serial
> > Net:   FEC0
> > 
> > Working:
> >  - Eth0
> >  - i2C
> 
> I've noticed that you are using non DM I2C driver for IMX6Q. Was
> there
> any reason not to use it?
> 

I didn't think I was, though now that you mention it I can see I've
left the defines in the board header. I'll remove them.

Martyn

> >  - MMC/SD
> >  - NAND
> >  - UART (1 & 5)
> >  - USB (host & otg)
> > 
> > Signed-off-by: Martyn Welch 
> > 
> > ---
> > 
> > Changes in v3:
> > - Correct spelling of Phytec
> > - Remove unneeded license information
> > - Correct image name in documentation
> > - Correct whitespacing
> > - Enable SPL to boot from MMC
> > - Simplify defconfig, remove non-SPL build
> > 
> > Changes in v2:
> > - Switch to driver model
> > 
> >  arch/arm/dts/Makefile |   3 +-
> >  arch/arm/dts/imx6ul-pcl063.dtsi   | 173 +
> >  arch/arm/dts/imx6ul-phycore-segin.dts |  76 ++
> >  arch/arm/mach-imx/mx6/Kconfig |  13 ++
> >  board/phytec/pcl063/Kconfig   |  12 ++
> >  board/phytec/pcl063/MAINTAINERS   |   8 +
> >  board/phytec/pcl063/Makefile  |   7 +
> >  board/phytec/pcl063/README|  26 
> >  board/phytec/pcl063/pcl063.c  | 206
> > ++ board/phytec/pcl063/spl.c |
> > 160 
> > configs/phycore_pcl063_defconfig  |  61
> >  include/configs/pcl063.h  | 100 +
> >  12 files changed, 844 insertions(+), 1 deletion(-)
> >  create mode 100644 arch/arm/dts/imx6ul-pcl063.dtsi
> >  create mode 100644 arch/arm/dts/imx6ul-phycore-segin.dts
> >  create mode 100644 board/phytec/pcl063/Kconfig
> >  create mode 100644 board/phytec/pcl063/MAINTAINERS
> >  create mode 100644 board/phytec/pcl063/Makefile
> >  create mode 100644 board/phytec/pcl063/README
> >  create mode 100644 board/phytec/pcl063/pcl063.c
> >  create mode 100644 board/phytec/pcl063/spl.c
> >  create mode 100644 configs/phycore_pcl063_defconfig
> >  create mode 100644 include/configs/pcl063.h
> > 
> > diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
> > index 949ee472fc..68411623e5 100644
> > --- a/arch/arm/dts/Makefile
> > +++ b/arch/arm/dts/Makefile
> > @@ -453,7 +453,8 @@ dtb-$(CONFIG_MX6UL) += \
> > imx6ul-isiot-nand.dtb \
> > imx6ul-opos6uldev.dtb \
> > imx6ul-14x14-evk.dtb \
> > -   imx6ul-9x9-evk.dtb
> > +   imx6ul-9x9-evk.dtb \
> > +   imx6ul-phycore-segin.dtb
> >  
> >  dtb-$(CONFIG_MX6ULL) += imx6ull-14x14-evk.dtb
> >  
> > diff --git a/arch/arm/dts/imx6ul-pcl063.dtsi
> > b/arch/arm/dts/imx6ul-pcl063.dtsi new file mode 100644
> > index 00..24a6a47983
> > --- /dev/null
> > +++ b/arch/arm/dts/imx6ul-pcl063.dtsi
> > @@ -0,0 +1,173 @@
> > +// SPDX-License-Identifier: GPL-2.0+
> > +/*
> > + * Copyright (C) 2018 Collabora Ltd.
> > + *
> > + * Based on dts[i] from Phytec barebox port:
> > + * Copyright (C) 2016 PHYTEC Messtechnik GmbH
> > + * Author: Christian Hemp 
> > + */
> > +
> > +/dts-v1/;
> > +
> > +#include "imx6ul.dtsi"
> > +
> > +/ {
> > +   model = "Phytec phyCORE-i.MX6 Ultra Lite SOM";
> > +   compatible = "phytec,imx6ul-pcl063", "fsl,imx6ul";
> > +
> > +   memory {
> > +   reg = <0x8000 0x2000>;
> > +   };
> > +
> > +   chosen {
> > +   stdout-path = &uart1;
> > +   };
> > +};
> > +
> > +&fec1 {
> > +   pinctrl-names = "default";
> > +   pinctrl-0 = <&pinctrl_enet1>;
> > +   phy-mode = "rmii";
> > +   phy-handle = <ðphy0>;
> > +   status = "okay";
> > +
> > +   mdio: mdio {
> > +   #address-cells = <1>;
> > +   #size-cells = <0>;
> > +
> > +   ethphy0: ethernet-phy@1 {
> > +   reg = <1>;
> > +   micrel,led-mode = <1>;
> > +   };
> > +   };
> > +};
> > +
> > +&gpmi {
> > +   pinctrl-names = "default";
> > +   pinctrl-0 = <&pinctrl_gpmi_nand>;
> > +   nand-on-flash-bbt;
> > +   fsl,no-blockmark-swap;
> > +   status = "okay";
> > +
> > +   #address-cells = <1>;
> > +   #size-cells = <1>;
> > +
> > +   partition@0 {
> > +   label = "uboot";
> > +   reg = <0x0 0x40>;
> > +   };
> > +
> > +   partition@40 {
> > +   label = "uboot-env";
> > +   reg = <0x40 0x10>;
> > +   };
> > +
> > +   partition@50 {
> > +   label = "root";
> > +   reg = <0x50 0x0>;
> > +   };
> > +};
> > +
> > +&i2c1 {
> > +   clock-frequency = <10>;
> > +   pinctrl-names = "default", "gpio";
> > +   pinctrl-0 = <&pinctrl_i2

Re: [U-Boot] [PATCH v3 2/2] core: ofnode: Add ofnode_get_addr_size_index

2018-12-10 Thread Tom Rini
On Mon, Dec 10, 2018 at 07:15:17PM +0530, Lokesh Vutla wrote:
> Hi Simon,
> 
> On 29/11/18 11:12 PM, s...@google.com wrote:
> >Add ofnode_get_addr_size_index function to fetch the address
> >and size of the reg space based on index.
> >
> >Signed-off-by: Keerthy 
> >---
> >  drivers/core/ofnode.c | 14 ++
> >  include/dm/ofnode.h   | 14 ++
> >  2 files changed, 24 insertions(+), 4 deletions(-)
> >
> >Applied to u-boot-dm/master, thanks!
> >
> 
> I do not see this patch in master branch. Any reason why this is dropped?

As I reported in https://patchwork.ozlabs.org/patch/1005644/ this breaks
test.py on sandbox for non-obvious reasons and Keerthy said they'll look
into it.

-- 
Tom


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


Re: [U-Boot] [PATCH v3 2/2] core: ofnode: Add ofnode_get_addr_size_index

2018-12-10 Thread Lokesh Vutla

Hi Simon,

On 29/11/18 11:12 PM, s...@google.com wrote:

Add ofnode_get_addr_size_index function to fetch the address
and size of the reg space based on index.

Signed-off-by: Keerthy 
---
  drivers/core/ofnode.c | 14 ++
  include/dm/ofnode.h   | 14 ++
  2 files changed, 24 insertions(+), 4 deletions(-)

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



I do not see this patch in master branch. Any reason why this is dropped?

Thanks and regards,
Lokesh

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


[U-Boot] Please pull u-boot-rockchip/master (for-master-20181210)

2018-12-10 Thread Philipp Tomsich
Tom,

Here’s another pull-request for rc2.
I expect a few more bug-fixes and DTS-changes later this week after having 
talked to
some of the stakeholders and also having seen internal review requests.

Build-test result for this one is at 
https://travis-ci.org/ptomsich/u-boot-rockchip/builds/465884207

Thanks,
Philipp.



The following changes since commit cde578ff36b15ec9c2033f03b94ecf809af7cc64:

  ARM: mvebu: restore license information in mv_ddr_plat.{c,h} (2018-12-09 
17:10:13 -0500)

are available in the git repository at:

  git://git.denx.de/u-boot-rockchip.git tags/for-master-20181210

for you to fetch changes up to eff43904b7f0c05ed316755e83b5474792059a5c:

  rockchip: rk3399-puma: enable fan53555 regulators in DTS (2018-12-10 10:04:45 
+0100)


Improvements:
- init DRAM for RK322x in SPL
- add FAN53555 PMIC/regulator driver
- update MicroCrystal RV3029 driver to Kconfig and sync from Linux
- add bootcount uclass and first DM-driver for bootcount


Kever Yang (1):
  rockchip: rk322x: ram: enable DRAM init in SPL instead of TPL

Philipp Tomsich (5):
  bootcount: add uclass for bootcount
  bootcount: add a DM RTC backing store for bootcount
  power: add FAN53555 family support
  rockchip: rk3399-puma: defconfig: enable FAN53555 regulator driver
  rockchip: rk3399-puma: enable fan53555 regulators in DTS

 arch/arm/dts/rk3399-puma.dtsi   |   6 ++--
 configs/puma-rk3399_defconfig   |   1 +
 doc/device-tree-bindings/chosen.txt |  30 +
 doc/device-tree-bindings/regulator/fan53555.txt |  23 +
 drivers/bootcount/Kconfig   |  28 
 drivers/bootcount/Makefile  |   3 ++
 drivers/bootcount/bootcount-uclass.c|  93 

 drivers/bootcount/rtc.c |  89 
++
 drivers/power/pmic/Kconfig  |  14 
 drivers/power/pmic/Makefile |   1 +
 drivers/power/pmic/fan53555.c   |  82 
++
 drivers/power/regulator/Kconfig |  16 +
 drivers/power/regulator/Makefile|   1 +
 drivers/power/regulator/fan53555.c  | 222 

 drivers/ram/rockchip/sdram_rk322x.c |  12 +++
 include/bootcount.h |  48 
+++
 include/dm/uclass-id.h  |   1 +
 17 files changed, 662 insertions(+), 8 deletions(-)
 create mode 100644 doc/device-tree-bindings/regulator/fan53555.txt
 create mode 100644 drivers/bootcount/bootcount-uclass.c
 create mode 100644 drivers/bootcount/rtc.c
 create mode 100644 drivers/power/pmic/fan53555.c
 create mode 100644 drivers/power/regulator/fan53555.c

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


[U-Boot] [PATCH] misc: fs_loader: Switching private data allocation to DM auto allocation

2018-12-10 Thread tien . fong . chee
From: Tien Fong Chee 

Switching private data manual allocation to driver model auto allocation
so users no longer need to deallocate themself because this would be
deallocated by driver model when the device is no longer required.

Signed-off-by: Tien Fong Chee 
---
 doc/driver-model/fs_firmware_loader.txt |   35 ++
 drivers/misc/fs_loader.c|  108 +--
 include/fs_loader.h |   32 +
 3 files changed, 56 insertions(+), 119 deletions(-)

diff --git a/doc/driver-model/fs_firmware_loader.txt 
b/doc/driver-model/fs_firmware_loader.txt
index 290915a..b9aee84 100644
--- a/doc/driver-model/fs_firmware_loader.txt
+++ b/doc/driver-model/fs_firmware_loader.txt
@@ -74,17 +74,16 @@ Firmware storage device described in device tree source
 File system firmware Loader API
 ---
 
-int request_firmware_into_buf(struct device_platdata *plat,
+int request_firmware_into_buf(struct udevice *dev,
 const char *name,
-void *buf, size_t size, u32 offset,
-struct firmware **firmwarep)
+void *buf, size_t size, u32 offset)
 
 Load firmware into a previously allocated buffer
 
 Parameters:
 
-1. struct device_platdata *plat
-   Platform data such as storage and partition firmware loading from
+1. struct udevice *dev
+   An instance of a driver
 
 2. const char *name
name of firmware file
@@ -98,36 +97,16 @@ Parameters:
 5. u32 offset
offset of a file for start reading into buffer
 
-6. struct firmware **firmwarep
-   pointer to firmware image
-
 return:
size of total read
-ve when error
 
 Description:
-   The firmware is loaded directly into the buffer pointed to by buf and
-   the @firmwarep data member is pointed at buf
-
-Note: Memory would be allocated for firmware image, hence user should
- free() *firmwarep and *firmwarep->priv structs after usage of
- request_firmware_into_buf(), otherwise it will always leak memory
- while subsequent calls of request_firmware_into_buf() with the same
- *firmwarep argument. Those arguments can be free through calling API
- below release_firmware();
+   The firmware is loaded directly into the buffer pointed to by buf
 
 Example of creating firmware loader instance and calling
 request_firmware_into_buf API:
if (uclass_get_device(UCLASS_FS_FIRMWARE_LOADER, 0, &dev)) {
-   request_firmware_into_buf(dev->plat, filename, buffer_location,
-buffer_size, offset_ofreading, &fw);
+   request_firmware_into_buf(dev, filename, buffer_location,
+buffer_size, offset_ofreading);
}
-
-void release_firmware(struct firmware *firmware)
-
-Release the resource associated with a firmware image
-
-Parameters:
-
-1. struct firmware *firmware
-   Firmware resource to release
diff --git a/drivers/misc/fs_loader.c b/drivers/misc/fs_loader.c
index baa5f83..57a14a3 100644
--- a/drivers/misc/fs_loader.c
+++ b/drivers/misc/fs_loader.c
@@ -16,9 +16,22 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-struct firmware_priv {
-   const char *name;   /* Filename */
-   u32 offset; /* Offset of reading a file */
+/**
+ * struct firmware - A place for storing firmware and its attribute data.
+ *
+ * This holds information about a firmware and its content.
+ *
+ * @size: Size of a file
+ * @data: Buffer for file
+ * @priv: Firmware loader private fields
+ * @name: Filename
+ * @offset: Offset of reading a file
+ */
+struct firmware {
+   size_t size;
+   const u8 *data;
+   const char *name;
+   u32 offset;
 };
 
 #ifdef CONFIG_CMD_UBIFS
@@ -88,74 +101,42 @@ static int select_fs_dev(struct device_platdata *plat)
 /**
  * _request_firmware_prepare - Prepare firmware struct.
  *
+ * @dev: An instance of a driver.
  * @name: Name of firmware file.
  * @dbuf: Address of buffer to load firmware into.
  * @size: Size of buffer.
  * @offset: Offset of a file for start reading into buffer.
- * @firmwarep: Pointer to pointer to firmware image.
  *
  * Return: Negative value if fail, 0 for successful.
  */
-static int _request_firmware_prepare(const char *name, void *dbuf,
-   size_t size, u32 offset,
-   struct firmware **firmwarep)
+static int _request_firmware_prepare(struct udevice *dev,
+   const char *name, void *dbuf,
+   size_t size, u32 offset)
 {
if (!name || name[0] == '\0')
return -EINVAL;
 
-   /* No memory allocation is required if *firmwarep is allocated */
-   if (!(*firmwarep)) {
-   

Re: [U-Boot] [RFC PATCH v2 00/11] SF: Migrate to Linux SPI NOR framework

2018-12-10 Thread Boris Brezillon
On Mon, 10 Dec 2018 18:32:09 +0530
Jagan Teki  wrote:

> On Thu, Dec 6, 2018 at 11:55 PM Vignesh R  wrote:
> >
> > Hi Jagan,
> >
> > On 06-Dec-18 10:44 PM, Jagan Teki wrote:  
> > > On Tue, Dec 4, 2018 at 5:56 PM Vignesh R  wrote:  
> > >>
> > >> U-Boot SPI NOR support (sf layer) is quite outdated as it does not
> > >> support 4 byte addressing opcodes, SFDP table parsing and different 
> > >> types of
> > >> quad mode enable sequences. Many newer flashes no longer support BANK
> > >> registers used by sf layer to a access >16MB space.
> > >> Also, many SPI controllers have special MMIO interfaces which provide
> > >> accelerated read/write access but require knowledge of flash parameters
> > >> to make use of it. Recent spi-mem layer provides a way to support such
> > >> flashes but sf layer isn't using that.
> > >> This patch series syncs SPI NOR framework from Linux v4.19. It also adds
> > >> spi-mem support on top.
> > >> So, we gain 4byte addressing support and SFDP support. This makes
> > >> migrating to U-Boot MTD framework easier.  
> > >
> > > We(someone) has proposed this sync before, but we(at-least I) rely on
> > > implementing via DM not direct sync to Linux.  
> >
> > As I said in my cover letter, U-Boot sf layer is unable to support newer
> > flashes mainly due to lack of 4 byte addressing and proper support for
> > MMIO capable SPI controllers.
> > My idea of fixing this is to borrow _features_ from Linux SPI NOR "as
> > is". All that's needed is stateless 4 byte addressing, SFDP
> > parsing(optionally), Quad/Octal support and spi-mem like abstraction for
> > MMIO capable Controllers. I see no point in re-coding them from ground up.
> >
> > Could you be more specific on what you would like to see here in DM way?
> > I have no issues in adapting this code to any framework here in U-Boot.
> > Linux has driver model and SPI NOR subsystem is a framework and
> > therefore any code ported from Linux will inherently have those
> > abstractions. The only difference I see wrt your code in branch below vs
> > this series is SPI-NOR uclass. This can be easily achieved by moving
> > nor->ops out of struct spi_nor into uclass abstraction.
> > Upstream Linux is anyways merging m25p80 and spi-nor so I did not see a
> > need for SPI NOR uclass. I am okay to change that if you insist on
> > having it.  
> 
> Merging or syncing spi-nor features stuff from Linux is good, I'm not
> stopping that. but this can be do by satisfying u-boot driver-model
> with proper architectural model. I know you take care but I'm not sure
> ie what can be manageable for long term.
> 
> Let's discuss the proper architectural model, so-that we can move
> further to incorporate the changes accordingly. (thanks at last we
> have a thread to discuss)

Having discussions about the long term plan is good, as long as it's
not blocking support for new features for too long. Look, you've been
discussing the spi-nor stuff for more than 1 year now, and people are
still waiting it. Yogesh's attempt seems to go in the right direction,
so let's not block that just because we don't know how to integrate
things in the DM (that's not entirely BTW, I suggested an approach in
one of my previous reply).

> 
> Linux m25p80 is moved to spi-nor right? so does controllers on spi-nor
> should be reside in same area like drivers/mtd/spi-nor or it should be
> part of spi-mem. The last mail with  Boris, noted all spi-nor can't be
> fit into spi-mem(sorry I lost the thread)
> 
> Example: we have zynq qspi it support BAR(with >16MB flashes), dual
> qspi ect so does it comes under spi-mem or spi-nor?

Everything should go in drivers/spi/ and be exposed as spi/spi-mem
controllers. So yes, that's one aspect where Linux and u-boot should
differ IMO, at least until we have all SPI NOR controller drivers
converted to spi-mem in Linux.

> 
> So, if no driver should be part of spi-nor and all can be handle
> spi-mem even-though they have controller specific features, yes we can
> skip SPI_NOR_UCLASS otherwise we need spi-nor uclass that can be child
> uclass of MTD.

That's the idea, yes. Note that I'm open to any discussion regarding the
needed features and how we want expose that at the spi-mem level.
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [RFC PATCH v2 00/11] SF: Migrate to Linux SPI NOR framework

2018-12-10 Thread Jagan Teki
On Thu, Dec 6, 2018 at 11:55 PM Vignesh R  wrote:
>
> Hi Jagan,
>
> On 06-Dec-18 10:44 PM, Jagan Teki wrote:
> > On Tue, Dec 4, 2018 at 5:56 PM Vignesh R  wrote:
> >>
> >> U-Boot SPI NOR support (sf layer) is quite outdated as it does not
> >> support 4 byte addressing opcodes, SFDP table parsing and different types 
> >> of
> >> quad mode enable sequences. Many newer flashes no longer support BANK
> >> registers used by sf layer to a access >16MB space.
> >> Also, many SPI controllers have special MMIO interfaces which provide
> >> accelerated read/write access but require knowledge of flash parameters
> >> to make use of it. Recent spi-mem layer provides a way to support such
> >> flashes but sf layer isn't using that.
> >> This patch series syncs SPI NOR framework from Linux v4.19. It also adds
> >> spi-mem support on top.
> >> So, we gain 4byte addressing support and SFDP support. This makes
> >> migrating to U-Boot MTD framework easier.
> >
> > We(someone) has proposed this sync before, but we(at-least I) rely on
> > implementing via DM not direct sync to Linux.
>
> As I said in my cover letter, U-Boot sf layer is unable to support newer
> flashes mainly due to lack of 4 byte addressing and proper support for
> MMIO capable SPI controllers.
> My idea of fixing this is to borrow _features_ from Linux SPI NOR "as
> is". All that's needed is stateless 4 byte addressing, SFDP
> parsing(optionally), Quad/Octal support and spi-mem like abstraction for
> MMIO capable Controllers. I see no point in re-coding them from ground up.
>
> Could you be more specific on what you would like to see here in DM way?
> I have no issues in adapting this code to any framework here in U-Boot.
> Linux has driver model and SPI NOR subsystem is a framework and
> therefore any code ported from Linux will inherently have those
> abstractions. The only difference I see wrt your code in branch below vs
> this series is SPI-NOR uclass. This can be easily achieved by moving
> nor->ops out of struct spi_nor into uclass abstraction.
> Upstream Linux is anyways merging m25p80 and spi-nor so I did not see a
> need for SPI NOR uclass. I am okay to change that if you insist on
> having it.

Merging or syncing spi-nor features stuff from Linux is good, I'm not
stopping that. but this can be do by satisfying u-boot driver-model
with proper architectural model. I know you take care but I'm not sure
ie what can be manageable for long term.

Let's discuss the proper architectural model, so-that we can move
further to incorporate the changes accordingly. (thanks at last we
have a thread to discuss)

Linux m25p80 is moved to spi-nor right? so does controllers on spi-nor
should be reside in same area like drivers/mtd/spi-nor or it should be
part of spi-mem. The last mail with  Boris, noted all spi-nor can't be
fit into spi-mem(sorry I lost the thread)

Example: we have zynq qspi it support BAR(with >16MB flashes), dual
qspi ect so does it comes under spi-mem or spi-nor?

So, if no driver should be part of spi-nor and all can be handle
spi-mem even-though they have controller specific features, yes we can
skip SPI_NOR_UCLASS otherwise we need spi-nor uclass that can be child
uclass of MTD.
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH] ARM: at91: Fix 'boot.bin' generation when CONFIG_SD_BOOT is enabled

2018-12-10 Thread Derald D. Woods
On Mon, Dec 10, 2018 at 08:32:33AM +, eugen.hris...@microchip.com wrote:
> 
> 
> On 08.12.2018 21:49, Derald D. Woods wrote:
> > On AT91 platforms configured for SD_BOOT, this commit avoids the
> > generation of the PMECC header used for booting from NAND flash. This
> > issue was found by attempting to boot the SAMA5D3-XPLD board with the
> > 'sama5d3_xplained_mmc_defconfig'.
> > 
> > [PMECC Reference]
> > http://www.at91.com/linux4sam/bin/view/Linux4SAM/AT91Bootstrap
> > 
> > [Mailing List Thread]
> > https://lists.denx.de/pipermail/u-boot/2018-December/350666.html
> > 
> > Fixes: 5541543f ("configs: at91: Remove CONFIG_SYS_EXTRA_OPTIONS 
> > assignment")
> > Reported-by: Daniel Evans 
> > Cc: Robert Nelson 
> > Cc: Eugen Hristev 
> > Cc: Wenyou Yang 
> > Signed-off-by: Derald D. Woods 
> > ---
> >   scripts/Makefile.spl | 2 ++
> >   1 file changed, 2 insertions(+)
> > 
> > diff --git a/scripts/Makefile.spl b/scripts/Makefile.spl
> > index 22bd8f7c27..e727cb610f 100644
> > --- a/scripts/Makefile.spl
> > +++ b/scripts/Makefile.spl
> > @@ -166,10 +166,12 @@ ifeq ($(CONFIG_SYS_SOC),"at91")
> >   MKIMAGEFLAGS_boot.bin = -T atmelimage
> >   
> >   ifeq ($(CONFIG_SPL_GENERATE_ATMEL_PMECC_HEADER),y)
> > +ifneq ($(CONFIG_SD_BOOT),y)
> 
> Hi Derald,
> 
> Thanks for your patch, however, I don't like that we do not use the 
> CONFIG_SPL_GENERATE_ATMEL_PMECC_HEADER anymore... isn't this config 
> supposed to say whether we are going to generate the header or not ?
> 

That is not what is happening with this patch. SPL_GENERATE_ATMEL_PMECC_HEADER
is not removed. The config still serves its orignal intent. If SD_BOOT
is configured, then NAND is not being used. In this non-NAND case, the
header is not needed.

> Checking if "not sd-boot" doesn't look like a good option... we may use 
> SPI boot or QSPI or some other type at some point and the issue will 
> still be there.
> 

This location and method would work for those nod-NAND cases also. See
below.

> I would rather fix the original patch by Wenyou, namely move the #ifdef 
> below to not have the GENERATE_ATMEL_PMECC enabled for SDBOOT.
> 
> Does this sound good for you?
> 

If this SPL_GENERATE_ATMEL_PMECC_HEADER only needs to be there for NAND,
why not guard the 'ifdef ($(CONFIG_NAND_BOOT,y))'? Would this be better?
Basically we could replace the 'ifneq ($(CONFIG_SD_BOOT),y)' with the
more appropriate 'ifeq ($(CONFIG_NAND_BOOT),y)'. This would actually
allow the future use-cases to be added as they become available and can
be shown to actually boot with the header applied.

I will put together a proper version 2 of my patch later today.

[patch v2]

diff --git a/scripts/Makefile.spl b/scripts/Makefile.spl
index 22bd8f7..e727cb6 100644
--- a/scripts/Makefile.spl
+++ b/scripts/Makefile.spl
@@ -166,10 +166,12 @@ ifeq ($(CONFIG_SYS_SOC),"at91")
 MKIMAGEFLAGS_boot.bin = -T atmelimage
 
 ifeq ($(CONFIG_SPL_GENERATE_ATMEL_PMECC_HEADER),y)
+ifeq ($(CONFIG_NAND_BOOT),y)
 MKIMAGEFLAGS_boot.bin += -n $(shell $(obj)/../tools/atmel_pmecc_params)
 
 boot.bin: $(obj)/../tools/atmel_pmecc_params
 endif
+endif
 
 boot.bin: $(obj)/u-boot-spl.bin FORCE
$(call if_changed,mkimage)


This would allow other configurations to 'opt-in' to applying the
header. Which I think is the direction this is truly heading.

Also, the SPL_GENERATE_ATMEL_PMECC_HEADER needs transitioning to
Kconfig. Having the logic in "Makefile.spl" would help with that work
too.

Derald


> Thanks again,
> 
> Eugen
> 
> >   MKIMAGEFLAGS_boot.bin += -n $(shell $(obj)/../tools/atmel_pmecc_params)
> >   
> >   boot.bin: $(obj)/../tools/atmel_pmecc_params
> >   endif
> > +endif
> >   
> >   boot.bin: $(obj)/u-boot-spl.bin FORCE
> > $(call if_changed,mkimage)
> > 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 2/2] riscv: qemu: Enable SiFive UART driver in defconfigs

2018-12-10 Thread Anup Patel
On Mon, Dec 10, 2018 at 7:25 AM Bin Meng  wrote:
>
> Hi Anup,
>
> On Wed, Dec 5, 2018 at 2:29 PM Anup Patel  wrote:
> >
> > This patch enables SiFive UART driver in all QEMU RISC-V defconfigs.
> >
> > Signed-off-by: Anup Patel 
> > ---
> >  configs/qemu-riscv32_defconfig   | 1 +
> >  configs/qemu-riscv32_smode_defconfig | 1 +
> >  configs/qemu-riscv64_defconfig   | 1 +
> >  configs/qemu-riscv64_smode_defconfig | 1 +
> >  4 files changed, 4 insertions(+)
> >
>
> Can we "imply SIFIVE_SERIAL" in BOARD_SPECIFIC_OPTIONS in
> board/emulation/qemu-riscv/Kconfig instead?

Sure, will do. If it works then I will drop this patch.

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


Re: [U-Boot] [PATCH 1/2] drivers: serial: Add SiFive UART driver

2018-12-10 Thread Anup Patel
On Mon, Dec 10, 2018 at 7:25 AM Bin Meng  wrote:
>
> Hi Anup,
>
> On Wed, Dec 5, 2018 at 2:29 PM Anup Patel  wrote:
> >
> > This patch adds SiFive UART driver. The driver is 100% DM driver
> > and it determines input clock using clk framework.
> >
> > Signed-off-by: Anup Patel 
> > ---
> >  drivers/serial/Kconfig |  13 +++
> >  drivers/serial/Makefile|   1 +
> >  drivers/serial/serial_sifive.c | 193 +
> >  3 files changed, 207 insertions(+)
> >  create mode 100644 drivers/serial/serial_sifive.c
> >
> > diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig
> > index 3bcc61e731..30f7e00557 100644
> > --- a/drivers/serial/Kconfig
> > +++ b/drivers/serial/Kconfig
> > @@ -343,6 +343,13 @@ config DEBUG_UART_SANDBOX
> >   start up driver model. The driver will be available until the real
> >   driver model serial is running.
> >
> > +config DEBUG_UART_SIFIVE
> > +   bool "SiFive UART"
> > +   help
> > + Select this to enable a debug UART using the serial_sifive 
> > driver. You
> > + will need to provide parameters to make this work. The driver will
> > + be available until the real driver-model serial is running.
> > +
> >  config DEBUG_UART_STM32
> > bool "STMicroelectronics STM32"
> > depends on STM32_SERIAL
> > @@ -685,6 +692,12 @@ config PXA_SERIAL
> >   If you have a machine based on a Marvell XScale PXA2xx CPU you
> >   can enable its onboard serial ports by enabling this option.
> >
> > +config SIFIVE_SERIAL
> > +   bool "SiFive UART support"
> > +   depends on DM_SERIAL
> > +   help
> > + This driver supports the SiFive UART. If unsure say N.
> > +
> >  config STI_ASC_SERIAL
> > bool "STMicroelectronics on-chip UART"
> > depends on DM_SERIAL && ARCH_STI
> > diff --git a/drivers/serial/Makefile b/drivers/serial/Makefile
> > index b6377b1076..b6781535a8 100644
> > --- a/drivers/serial/Makefile
> > +++ b/drivers/serial/Makefile
> > @@ -68,6 +68,7 @@ obj-$(CONFIG_NULLDEV_SERIAL) += serial_nulldev.o
> >  obj-$(CONFIG_OWL_SERIAL) += serial_owl.o
> >  obj-$(CONFIG_OMAP_SERIAL) += serial_omap.o
> >  obj-$(CONFIG_MTK_SERIAL) += serial_mtk.o
> > +obj-$(CONFIG_SIFIVE_SERIAL) += serial_sifive.o
> >
> >  ifndef CONFIG_SPL_BUILD
> >  obj-$(CONFIG_USB_TTY) += usbtty.o
> > diff --git a/drivers/serial/serial_sifive.c b/drivers/serial/serial_sifive.c
> > new file mode 100644
> > index 00..cce05d5a01
> > --- /dev/null
> > +++ b/drivers/serial/serial_sifive.c
> > @@ -0,0 +1,193 @@
> > +// SPDX-License-Identifier: GPL-2.0+
> > +/*
> > + * Copyright (C) 2012 Michal Simek 
> > + * Copyright (C) 2011-2012 Xilinx, Inc. All rights reserved.
>
> nits: pls update the copyright notice

Thanks for catching it. I will update it.

>
> > + */
> > +
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +
> > +DECLARE_GLOBAL_DATA_PTR;
> > +
> > +#define UART_TXFIFO_FULL   0x8000
> > +#define UART_RXFIFO_EMPTY  0x8000
> > +#define UART_RXFIFO_DATA   0x00ff
> > +#define UART_TXCTRL_TXEN   0x1
> > +#define UART_RXCTRL_RXEN   0x1
> > +
> > +struct uart_sifive {
> > +   u32 txfifo;
> > +   u32 rxfifo;
> > +   u32 txctrl;
> > +   u32 rxctrl;
> > +   u32 ie;
> > +   u32 ip;
> > +   u32 div;
> > +};
> > +
> > +struct sifive_uart_platdata {
> > +   unsigned int clock;
> > +   struct uart_sifive *regs;
> > +};
> > +
> > +/* Set up the baud rate in gd struct */
> > +static void _sifive_serial_setbrg(struct uart_sifive *regs,
> > + unsigned long clock, unsigned long baud)
> > +{
> > +   writel((u32)((clock / baud) - 1), ®s->div);
> > +}
> > +
> > +static void _sifive_serial_init(struct uart_sifive *regs)
> > +{
> > +   writel(UART_TXCTRL_TXEN, ®s->txctrl);
> > +   writel(UART_RXCTRL_RXEN, ®s->rxctrl);
> > +   writel(0, ®s->ie);
> > +}
> > +
> > +static int _sifive_serial_putc(struct uart_sifive *regs, const char c)
> > +{
> > +   if (readl(®s->txfifo) & UART_TXFIFO_FULL)
> > +   return -EAGAIN;
> > +
> > +   writel(c, ®s->txfifo);
> > +
> > +   return 0;
> > +}
> > +
> > +static int _sifive_serial_getc(struct uart_sifive *regs)
> > +{
> > +   int ch = readl(®s->rxfifo);
> > +
> > +   if (ch & UART_RXFIFO_EMPTY)
> > +   return -EAGAIN;
> > +   ch &= UART_RXFIFO_DATA;
> > +
> > +   return (!ch) ? -EAGAIN : ch;
> > +}
> > +
> > +static int sifive_serial_setbrg(struct udevice *dev, int baudrate)
> > +{
> > +   int err;
> > +   struct clk clk;
> > +   struct sifive_uart_platdata *platdata = dev_get_platdata(dev);
> > +
> > +   err = clk_get_by_index(dev, 0, &clk);
> > +   if (!err) {
> > +   err = clk_get_rate(&clk);
> > +   if (!IS_ERR_VALUE(err))
> > +

Re: [U-Boot] [PATCH v2 3/5] mtd: sf_probe: remove spi-flash compatible

2018-12-10 Thread Jagan Teki
+ Simon

On Thu, Dec 6, 2018 at 3:22 PM Neil Armstrong  wrote:
>
> Now the "spi-flash" compatible has been removed in the DTS files,
> remove this compatible from sf_probe to finally use the Linux "jedec,spi-nor"
> compatible.
>
> Signed-off-by: Neil Armstrong 
> ---
>  drivers/mtd/spi/sf_probe.c | 1 -
>  1 file changed, 1 deletion(-)
>
> diff --git a/drivers/mtd/spi/sf_probe.c b/drivers/mtd/spi/sf_probe.c
> index 7a379914d8..aae39dd601 100644
> --- a/drivers/mtd/spi/sf_probe.c
> +++ b/drivers/mtd/spi/sf_probe.c
> @@ -160,7 +160,6 @@ static const struct dm_spi_flash_ops spi_flash_std_ops = {
>  };
>
>  static const struct udevice_id spi_flash_std_ids[] = {
> -   { .compatible = "spi-flash" },
> { .compatible = "jedec,spi-nor" },

Sandbox is the user for spi-flash binding, but I'm fine with using
know binding from Linux to use sandbox. Simon is that OK?
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH] drivers: block: Allow to cache 4K blocks by default

2018-12-10 Thread Tom Rini
On Mon, Dec 10, 2018 at 05:13:58AM +0100, Marek Vasut wrote:
> On 12/09/2018 09:55 AM, Jan Kiszka wrote:
> > The default settings of the block cache so far only allow to hold single
> > 1K blocks. However, larger filesystems tend to use 4K. Failing to cache
> > those massively degrades access performance unless you manually tune the
> > cache first. This is not desirable.
> > 
> > Signed-off-by: Jan Kiszka 
> 
> I submitted the same patch before [1], oddly enough it was not picked by
> Tom.
> 
> [1]
> http://u-boot.10912.n7.nabble.com/PATCH-RFC-blk-Increase-cache-element-size-td337975.html

Based on a quick re-read, I had filed that patch as "Marek says he'll
look into a more complex but general scheme".  If that's not the case
then yes, we can just do that.  Thanks!

-- 
Tom


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


Re: [U-Boot] ARM: rockchip: rv1108: Fix booting with initramfs

2018-12-10 Thread Tom Rini
On Mon, Dec 10, 2018 at 10:01:06AM -0200, Otavio Salvador wrote:
> On Sun, Dec 9, 2018 at 10:28 PM Tom Rini  wrote:
> > On Mon, Dec 10, 2018 at 01:01:52AM +0100, Philipp Tomsich wrote:
> > > > We move the ramdisk_addr_r to 0x6800 and disable the initrd and
> > > > fdt relocation, so the initramfs works out of box.
> > > >
> > > > Signed-off-by: Otavio Salvador 
> > > > Reviewed-by: Philipp Tomsich 
> > > > ---
> > > >
> > > >  include/configs/rv1108_common.h | 4 +++-
> > > >  1 file changed, 3 insertions(+), 1 deletion(-)
> > > >
> > >
> > > Applied to u-boot-rockchip, thanks!
> >
> > Ugh, sorry for not spotting this sooner.  Please don't disable
> > fdt/initrd relocation and instead use bootm_size.
> 
> I never used it, any reference to look at?

Specifically?  No.  There should be a lot of general hits on
$search-engine over it however as not disabling and instead using
bootm_size is how to fix "Kernel suddenly stops booting... oh we're
overwriting fdt/initrd".

This isn't to say that disabling fdt/initrd relocation isn't a useful
production optimization, it is.  But it's not a good general best
practice.

-- 
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 0/7] Remove defines for SPI default speed and mode

2018-12-10 Thread Patrick Delaunay

This patch-set finish (after the last Simmon comment)
and depends on the previous serie named:
"Read default speed and mode values from DT"

http://patchwork.ozlabs.org/project/uboot/list/?series=76834

This patchset remove the unnecessary defines for SPI speed and mode
when DM mode is used for SPI (CONFIG_DM_SPI_FLASH).

Build result is available for the serie in gihub and travis:
https://github.com/patrickdelaunay/u-boot/tree/topic/spi
https://travis-ci.org/patrickdelaunay/u-boot/branches



Patrick Delaunay (7):
  spi: update management of default speed and mode
  spi: add comment for spi_flash_probe_bus_cs function
  da850evm: sf: Read default speed and mode values from DT
  dfu: sf: Read default speed and mode values from DT
  mips: mt76xx: gardena-smart-gateway: Read default speed and mode
values from DT
  env: Read default speed and mode values from DT
  spi: remove define for SPI default SPEED and MODE

 board/davinci/da8xxevm/da850evm.c  |  7 +++
 board/gardena/smart-gateway-mt7688/board.c | 24 
 cmd/sf.c   | 10 ++
 common/spl/spl_spi.c   | 11 ++-
 common/splash_source.c | 11 ++-
 drivers/dfu/dfu_sf.c   | 10 --
 env/Kconfig|  4 ++--
 env/sf.c   |  5 -
 include/spi_flash.h| 18 ++
 9 files changed, 77 insertions(+), 23 deletions(-)

-- 
2.7.4

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


[U-Boot] [u-boot][PATCH] ls1046aqds: Bypass xfi port fixup for KR mode

2018-12-10 Thread Florinel Iordache
u-boot makes a fixup for LS1046AQDS board to setup the properties
 'fixed-link' and 'phy-connection-type' to 'xgmii' but in case of
 backplane mode this fixup is not correct because it causes the KR link
 to fail and so it must be bypassed in order to keep the link in KR mode
 as it is defined in DTS.

Signed-off-by: Florinel Iordache 
---
 board/freescale/ls1046aqds/eth.c | 35 +--
 1 file changed, 25 insertions(+), 10 deletions(-)

diff --git a/board/freescale/ls1046aqds/eth.c b/board/freescale/ls1046aqds/eth.c
index d3e8831..1fd755c 100644
--- a/board/freescale/ls1046aqds/eth.c
+++ b/board/freescale/ls1046aqds/eth.c
@@ -1,6 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0+
 /*
  * Copyright 2016 Freescale Semiconductor, Inc.
+ * Copyright 2018 NXP
  */
 
 #include 
@@ -153,6 +154,9 @@ void board_ft_fman_fixup_port(void *fdt, char *compat, 
phys_addr_t addr,
  enum fm_port port, int offset)
 {
struct fixed_link f_link;
+   u32 *handle;
+   char *prop = NULL;
+   int off;
 
if (fm_info_get_enet_if(port) == PHY_INTERFACE_MODE_SGMII) {
switch (port) {
@@ -208,16 +212,27 @@ void board_ft_fman_fixup_port(void *fdt, char *compat, 
phys_addr_t addr,
   "qsgmii");
} else if (fm_info_get_enet_if(port) == PHY_INTERFACE_MODE_XGMII &&
   (port == FM1_10GEC1 || port == FM1_10GEC2)) {
-   /* XFI interface */
-   f_link.phy_id = cpu_to_fdt32(port);
-   f_link.duplex = cpu_to_fdt32(1);
-   f_link.link_speed = cpu_to_fdt32(1);
-   f_link.pause = 0;
-   f_link.asym_pause = 0;
-   /* no PHY for XFI */
-   fdt_delprop(fdt, offset, "phy-handle");
-   fdt_setprop(fdt, offset, "fixed-link", &f_link, sizeof(f_link));
-   fdt_setprop_string(fdt, offset, "phy-connection-type", "xgmii");
+   handle = fdt_getprop(fdt, offset, "phy-handle", NULL);
+   prop = NULL;
+   if (handle) {
+   off = fdt_node_offset_by_phandle(fdt,
+fdt32_to_cpu(*handle));
+   prop = fdt_getprop(fdt, off, "backplane-mode", NULL);
+   }
+   if (!prop || strcmp(prop, "10gbase-kr")) {
+   /* XFI interface */
+   f_link.phy_id = cpu_to_fdt32(port);
+   f_link.duplex = cpu_to_fdt32(1);
+   f_link.link_speed = cpu_to_fdt32(1);
+   f_link.pause = 0;
+   f_link.asym_pause = 0;
+   /* no PHY for XFI */
+   fdt_delprop(fdt, offset, "phy-handle");
+   fdt_setprop(fdt, offset, "fixed-link", &f_link,
+   sizeof(f_link));
+   fdt_setprop_string(fdt, offset, "phy-connection-type",
+  "xgmii");
+   }
}
 }
 
-- 
1.9.1

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


Re: [U-Boot] [PATCH v3 1/3] Don't enable CONFIG_SPL_DM_USB for non-DM SPL

2018-12-10 Thread Martyn Welch
On Mon, 2018-12-03 at 19:29 +0100, Marek Vasut wrote:
> On 12/03/2018 06:29 PM, Martyn Welch wrote:
> > When CONFIG_SPL_DM_USB was added, it was added defaulted on without
> > protection to ensure it didn't get set for non-DM SPL builds.
> > 
> > This leads to unexpected and confusing failures when building a DM
> > based
> > U-Boot but with a non-DM SPL, as the defconfig is unlikely to have
> > CONFIG_SPL_DM_USB actively disabled.
> > 
> > Tweak the Kconfig to not enable this setting unless CONFIG_SPL_DM
> > is set.
> > 
> > Signed-off-by: Martyn Welch 
> 
> It looks OK, but I don't see Sven on CC and I don't see 2/3 and 3/3.
> 

My mistake, trying to get used to patman. I'll resend and ensure you
and Sven are CCed on all 3 patches.

Martyn

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


Re: [U-Boot] [RESEND PATCH v3 1/3] Don't enable CONFIG_SPL_DM_USB for non-DM SPL

2018-12-10 Thread Marek Vasut
On 12/10/2018 12:05 PM, Martyn Welch wrote:
> When CONFIG_SPL_DM_USB was added, it was added defaulted on without
> protection to ensure it didn't get set for non-DM SPL builds.
> 
> This leads to unexpected and confusing failures when building a DM based
> U-Boot but with a non-DM SPL, as the defconfig is unlikely to have
> CONFIG_SPL_DM_USB actively disabled.
> 
> Tweak the Kconfig to not enable this setting unless CONFIG_SPL_DM is set.
> 
> Signed-off-by: Martyn Welch 

Ah, I didn't realize the other patches weren't USB too.
Applied, thanks.

-- 
Best regards,
Marek Vasut
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] ARM: rockchip: rv1108: Fix booting with initramfs

2018-12-10 Thread Otavio Salvador
On Sun, Dec 9, 2018 at 10:28 PM Tom Rini  wrote:
> On Mon, Dec 10, 2018 at 01:01:52AM +0100, Philipp Tomsich wrote:
> > > We move the ramdisk_addr_r to 0x6800 and disable the initrd and
> > > fdt relocation, so the initramfs works out of box.
> > >
> > > Signed-off-by: Otavio Salvador 
> > > Reviewed-by: Philipp Tomsich 
> > > ---
> > >
> > >  include/configs/rv1108_common.h | 4 +++-
> > >  1 file changed, 3 insertions(+), 1 deletion(-)
> > >
> >
> > Applied to u-boot-rockchip, thanks!
>
> Ugh, sorry for not spotting this sooner.  Please don't disable
> fdt/initrd relocation and instead use bootm_size.

I never used it, any reference to look at?

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


Re: [U-Boot] [RESEND PATCH v3 1/3] Don't enable CONFIG_SPL_DM_USB for non-DM SPL

2018-12-10 Thread Jean-Jacques Hiblot


On 10/12/2018 12:05, Martyn Welch wrote:

When CONFIG_SPL_DM_USB was added, it was added defaulted on without
protection to ensure it didn't get set for non-DM SPL builds.

This leads to unexpected and confusing failures when building a DM based
U-Boot but with a non-DM SPL, as the defconfig is unlikely to have
CONFIG_SPL_DM_USB actively disabled.

Tweak the Kconfig to not enable this setting unless CONFIG_SPL_DM is set.

Signed-off-by: Martyn Welch 

---

Changes in v3:
- New in v3

Changes in v2: None

  drivers/usb/Kconfig | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/Kconfig b/drivers/usb/Kconfig
index d456beb43f..3c978d43aa 100644
--- a/drivers/usb/Kconfig
+++ b/drivers/usb/Kconfig
@@ -49,7 +49,7 @@ config DM_USB
  
  config SPL_DM_USB

bool "Enable driver model for USB in SPL"
-   depends on DM_USB
+   depends on SPL_DM && DM_USB
default y
  
  source "drivers/usb/host/Kconfig"


Reviewed-by: Jean-Jacques Hiblot 

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


Re: [U-Boot] [RESEND PATCH v3 3/3] imx: Add PHYTEC phyBOARD-i.MX6UL-Segin

2018-12-10 Thread Lukasz Majewski
Hi Martyn,

> Port for the PHYTEC phyBOARD-i.MX6UL-Segin single board computer.
> Based on the PHYTEC phyCORE-i.MX6UL SOM (PCL063).
> 
> CPU:   Freescale i.MX6UL rev1.2 528 MHz (running at 396 MHz)
> CPU:   Industrial temperature grade (-40C to 105C) at 44C
> Reset cause: POR
> Board: PHYTEC phyCORE-i.MX6UL
> I2C:   ready
> DRAM:  256 MiB
> NAND:  512 MiB
> MMC:   FSL_SDHC: 0
> In:serial
> Out:   serial
> Err:   serial
> Net:   FEC0
> 
> Working:
>  - Eth0
>  - i2C

I've noticed that you are using non DM I2C driver for IMX6Q. Was there
any reason not to use it?

>  - MMC/SD
>  - NAND
>  - UART (1 & 5)
>  - USB (host & otg)
> 
> Signed-off-by: Martyn Welch 
> 
> ---
> 
> Changes in v3:
> - Correct spelling of Phytec
> - Remove unneeded license information
> - Correct image name in documentation
> - Correct whitespacing
> - Enable SPL to boot from MMC
> - Simplify defconfig, remove non-SPL build
> 
> Changes in v2:
> - Switch to driver model
> 
>  arch/arm/dts/Makefile |   3 +-
>  arch/arm/dts/imx6ul-pcl063.dtsi   | 173 +
>  arch/arm/dts/imx6ul-phycore-segin.dts |  76 ++
>  arch/arm/mach-imx/mx6/Kconfig |  13 ++
>  board/phytec/pcl063/Kconfig   |  12 ++
>  board/phytec/pcl063/MAINTAINERS   |   8 +
>  board/phytec/pcl063/Makefile  |   7 +
>  board/phytec/pcl063/README|  26 
>  board/phytec/pcl063/pcl063.c  | 206
> ++ board/phytec/pcl063/spl.c |
> 160  configs/phycore_pcl063_defconfig  |  61
>  include/configs/pcl063.h  | 100 +
>  12 files changed, 844 insertions(+), 1 deletion(-)
>  create mode 100644 arch/arm/dts/imx6ul-pcl063.dtsi
>  create mode 100644 arch/arm/dts/imx6ul-phycore-segin.dts
>  create mode 100644 board/phytec/pcl063/Kconfig
>  create mode 100644 board/phytec/pcl063/MAINTAINERS
>  create mode 100644 board/phytec/pcl063/Makefile
>  create mode 100644 board/phytec/pcl063/README
>  create mode 100644 board/phytec/pcl063/pcl063.c
>  create mode 100644 board/phytec/pcl063/spl.c
>  create mode 100644 configs/phycore_pcl063_defconfig
>  create mode 100644 include/configs/pcl063.h
> 
> diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
> index 949ee472fc..68411623e5 100644
> --- a/arch/arm/dts/Makefile
> +++ b/arch/arm/dts/Makefile
> @@ -453,7 +453,8 @@ dtb-$(CONFIG_MX6UL) += \
>   imx6ul-isiot-nand.dtb \
>   imx6ul-opos6uldev.dtb \
>   imx6ul-14x14-evk.dtb \
> - imx6ul-9x9-evk.dtb
> + imx6ul-9x9-evk.dtb \
> + imx6ul-phycore-segin.dtb
>  
>  dtb-$(CONFIG_MX6ULL) += imx6ull-14x14-evk.dtb
>  
> diff --git a/arch/arm/dts/imx6ul-pcl063.dtsi
> b/arch/arm/dts/imx6ul-pcl063.dtsi new file mode 100644
> index 00..24a6a47983
> --- /dev/null
> +++ b/arch/arm/dts/imx6ul-pcl063.dtsi
> @@ -0,0 +1,173 @@
> +// SPDX-License-Identifier: GPL-2.0+
> +/*
> + * Copyright (C) 2018 Collabora Ltd.
> + *
> + * Based on dts[i] from Phytec barebox port:
> + * Copyright (C) 2016 PHYTEC Messtechnik GmbH
> + * Author: Christian Hemp 
> + */
> +
> +/dts-v1/;
> +
> +#include "imx6ul.dtsi"
> +
> +/ {
> + model = "Phytec phyCORE-i.MX6 Ultra Lite SOM";
> + compatible = "phytec,imx6ul-pcl063", "fsl,imx6ul";
> +
> + memory {
> + reg = <0x8000 0x2000>;
> + };
> +
> + chosen {
> + stdout-path = &uart1;
> + };
> +};
> +
> +&fec1 {
> + pinctrl-names = "default";
> + pinctrl-0 = <&pinctrl_enet1>;
> + phy-mode = "rmii";
> + phy-handle = <ðphy0>;
> + status = "okay";
> +
> + mdio: mdio {
> + #address-cells = <1>;
> + #size-cells = <0>;
> +
> + ethphy0: ethernet-phy@1 {
> + reg = <1>;
> + micrel,led-mode = <1>;
> + };
> + };
> +};
> +
> +&gpmi {
> + pinctrl-names = "default";
> + pinctrl-0 = <&pinctrl_gpmi_nand>;
> + nand-on-flash-bbt;
> + fsl,no-blockmark-swap;
> + status = "okay";
> +
> + #address-cells = <1>;
> + #size-cells = <1>;
> +
> + partition@0 {
> + label = "uboot";
> + reg = <0x0 0x40>;
> + };
> +
> + partition@40 {
> + label = "uboot-env";
> + reg = <0x40 0x10>;
> + };
> +
> + partition@50 {
> + label = "root";
> + reg = <0x50 0x0>;
> + };
> +};
> +
> +&i2c1 {
> + clock-frequency = <10>;
> + pinctrl-names = "default", "gpio";
> + pinctrl-0 = <&pinctrl_i2c1>;
> + pinctrl-1 = <&pinctrl_i2c1_gpio>;
> + scl-gpios = <&gpio1 28 GPIO_ACTIVE_HIGH>;
> + sda-gpios = <&gpio1 29 GPIO_ACTIVE_HIGH>;
> + status = "okay";
> +
> + eeprom@52 {
> + compatible = "cat,24c32";
> + reg = <0x52>;
> + };
> +};
> +
> +&uart1 {
> + pinctrl-names = "default";
> + pinctrl-0 = <&pinctrl_uart1>;
> + status = "okay";
> +};
> +
> +&usdhc1 {
> + 

Re: [U-Boot] [PATCH 5/7] mips: mt76xx: gardena-smart-gateway: Read default speed and mode values from DT

2018-12-10 Thread Stefan Roese

On 10.12.18 11:52, Patrick Delaunay wrote:

In case of DT boot, don't read default speed and mode for SPI from
CONFIG_*, instead read from DT node.

Signed-off-by: Patrick Delaunay 
---

  board/gardena/smart-gateway-mt7688/board.c | 24 
  1 file changed, 20 insertions(+), 4 deletions(-)

diff --git a/board/gardena/smart-gateway-mt7688/board.c 
b/board/gardena/smart-gateway-mt7688/board.c
index 6e11077..8a67e70 100644
--- a/board/gardena/smart-gateway-mt7688/board.c
+++ b/board/gardena/smart-gateway-mt7688/board.c
@@ -89,6 +89,14 @@ static void factory_data_env_config(void)
u32 crc;
int ret;
u8 *ptr;
+   /* In DM mode, defaults will be taken from DT */
+   unsigned int speed = 0;
+   unsigned int mode = 0;
+
+#ifndef CONFIG_DM_SPI_FLASH
+   speed = CONFIG_SF_DEFAULT_SPEED;
+   mode = CONFIG_SF_DEFAULT_MODE;
+#endif


CONFIG_DM_SPI_FLASH is always enabled in this board. So there should
be no need to handle the non-DM case at all.

Could you please change this patch and remove this unnecessary code?

Thanks,
Stefan

  
  	buf = malloc(FACTORY_DATA_SIZE);

if (!buf) {
@@ -101,8 +109,8 @@ static void factory_data_env_config(void)
 */
sf = spi_flash_probe(CONFIG_SF_DEFAULT_BUS,
 CONFIG_SF_DEFAULT_CS,
-CONFIG_SF_DEFAULT_SPEED,
-CONFIG_SF_DEFAULT_MODE);
+speed,
+mode);
if (!sf) {
printf("F-Data:Unable to access SPI NOR flash\n");
goto err_free;
@@ -207,6 +215,14 @@ int do_fd_write(cmd_tbl_t *cmdtp, int flag, int argc, char 
* const argv[])
struct spi_flash *sf;
u8 *buf;
int ret = CMD_RET_FAILURE;
+   /* In DM mode, defaults will be taken from DT */
+   unsigned int speed = 0;
+   unsigned int mode = 0;
+
+#ifndef CONFIG_DM_SPI_FLASH
+   speed = CONFIG_SF_DEFAULT_SPEED;
+   mode = CONFIG_SF_DEFAULT_MODE;
+#endif
  
  	buf = malloc(FACTORY_DATA_SECT_SIZE);

if (!buf) {
@@ -216,8 +232,8 @@ int do_fd_write(cmd_tbl_t *cmdtp, int flag, int argc, char 
* const argv[])
  
  	sf = spi_flash_probe(CONFIG_SF_DEFAULT_BUS,

 CONFIG_SF_DEFAULT_CS,
-CONFIG_SF_DEFAULT_SPEED,
-CONFIG_SF_DEFAULT_MODE);
+speed,
+mode);
if (!sf) {
printf("F-Data:Unable to access SPI NOR flash\n");
goto err_free;



Viele Grüße,
Stefan

--
DENX Software Engineering GmbH,  Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: s...@denx.de
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v3 1/3] Don't enable CONFIG_SPL_DM_USB for non-DM SPL

2018-12-10 Thread Marek Vasut
On 12/10/2018 11:29 AM, Martyn Welch wrote:
> On Mon, 2018-12-03 at 19:29 +0100, Marek Vasut wrote:
>> On 12/03/2018 06:29 PM, Martyn Welch wrote:
>>> When CONFIG_SPL_DM_USB was added, it was added defaulted on without
>>> protection to ensure it didn't get set for non-DM SPL builds.
>>>
>>> This leads to unexpected and confusing failures when building a DM
>>> based
>>> U-Boot but with a non-DM SPL, as the defconfig is unlikely to have
>>> CONFIG_SPL_DM_USB actively disabled.
>>>
>>> Tweak the Kconfig to not enable this setting unless CONFIG_SPL_DM
>>> is set.
>>>
>>> Signed-off-by: Martyn Welch 
>>
>> It looks OK, but I don't see Sven on CC and I don't see 2/3 and 3/3.
>>
> 
> My mistake, trying to get used to patman. I'll resend and ensure you
> and Sven are CCed on all 3 patches.

Thanks!

-- 
Best regards,
Marek Vasut
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 6/7] env: Read default speed and mode values from DT

2018-12-10 Thread Simon Goldschmidt
On Mon, Dec 10, 2018 at 11:54 AM Patrick Delaunay
 wrote:
>
> In case of DT boot, don't read default speed and mode for SPI from
> CONFIG_*, instead read from DT node.
>
> Signed-off-by: Patrick Delaunay 
> ---
>
>  env/Kconfig | 4 ++--
>  env/sf.c| 5 -
>  2 files changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/env/Kconfig b/env/Kconfig
> index 9011109..0f760ce 100644
> --- a/env/Kconfig
> +++ b/env/Kconfig
> @@ -329,11 +329,11 @@ config ENV_IS_IN_SPI_FLASH
>
>   Define the SPI bus and chip select. If not defined they will be 0.
>
> - - CONFIG_ENV_SPI_MAX_HZ (optional):
> + - CONFIG_ENV_SPI_MAX_HZ (optional if !DM_SPI_FLASH):
>
>   Define the SPI max work clock. If not defined then use 1MHz.
>
> - - CONFIG_ENV_SPI_MODE (optional):
> + - CONFIG_ENV_SPI_MODE (optional if !DM_SPI_FLASH):
>
>   Define the SPI work mode. If not defined then use SPI_MODE_3.
>
> diff --git a/env/sf.c b/env/sf.c
> index 2e3c600..edd36f1 100644
> --- a/env/sf.c
> +++ b/env/sf.c
> @@ -24,12 +24,15 @@
>  #ifndef CONFIG_ENV_SPI_CS
>  # define CONFIG_ENV_SPI_CS CONFIG_SF_DEFAULT_CS
>  #endif
> +
> +#ifndef CONFIG_DM_SPI_FLASH
>  #ifndef CONFIG_ENV_SPI_MAX_HZ
>  # define CONFIG_ENV_SPI_MAX_HZ CONFIG_SF_DEFAULT_SPEED
>  #endif
>  #ifndef CONFIG_ENV_SPI_MODE
>  # define CONFIG_ENV_SPI_MODE   CONFIG_SF_DEFAULT_MODE
>  #endif
> +#endif
>
>  #ifndef CONFIG_SPL_BUILD
>  #define CMD_SAVEENV
> @@ -58,7 +61,7 @@ static int setup_flash_device(void)
>
> /* speed and mode will be read from DT */
> ret = spi_flash_probe_bus_cs(CONFIG_ENV_SPI_BUS, CONFIG_ENV_SPI_CS,
> -CONFIG_ENV_SPI_MAX_HZ, 
> CONFIG_ENV_SPI_MODE,
> +0, 0,
>  &new);
> if (ret) {
> set_default_env("spi_flash_probe_bus_cs() failed", 0);

Reviewed-by: Simon Goldschmidt 

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


Re: [U-Boot] [PATCH 7/7] spi: remove define for SPI default SPEED and MODE

2018-12-10 Thread Simon Goldschmidt
On Mon, Dec 10, 2018 at 11:53 AM Patrick Delaunay
 wrote:
>
> In DM mode, the speed and mode defaults value will be taken from DT,
> so these defines should be never used and can be removed.
>
> Signed-off-by: Patrick Delaunay 
> ---
>
>  include/spi_flash.h | 4 
>  1 file changed, 4 insertions(+)
>
> diff --git a/include/spi_flash.h b/include/spi_flash.h
> index 36565bb..c9d20a5 100644
> --- a/include/spi_flash.h
> +++ b/include/spi_flash.h
> @@ -12,12 +12,16 @@
>  #include /* Because we dereference struct udevice here */
>  #include 
>
> +#ifndef CONFIG_DM_SPI_FLASH
> +/* In DM mode, speed and mode value will be taken from DT */
>  #ifndef CONFIG_SF_DEFAULT_SPEED
>  # define CONFIG_SF_DEFAULT_SPEED   100
>  #endif
>  #ifndef CONFIG_SF_DEFAULT_MODE
>  # define CONFIG_SF_DEFAULT_MODESPI_MODE_3
>  #endif
> +#endif
> +
>  #ifndef CONFIG_SF_DEFAULT_CS
>  # define CONFIG_SF_DEFAULT_CS  0
>  #endif

Reviewed-by: Simon Goldschmidt 

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


Re: [U-Boot] [PATCH 2/7] spi: add comment for spi_flash_probe_bus_cs function

2018-12-10 Thread Simon Goldschmidt
On Mon, Dec 10, 2018 at 11:53 AM Patrick Delaunay
 wrote:
>
> Add Kernel style documentation for spi_flash_probe_bus_cs().
>
> Signed-off-by: Patrick Delaunay 
> ---
>
>  include/spi_flash.h | 14 ++
>  1 file changed, 14 insertions(+)
>
> diff --git a/include/spi_flash.h b/include/spi_flash.h
> index e427e96..36565bb 100644
> --- a/include/spi_flash.h
> +++ b/include/spi_flash.h
> @@ -180,6 +180,20 @@ int spi_flash_erase_dm(struct udevice *dev, u32 offset, 
> size_t len);
>   */
>  int spl_flash_get_sw_write_prot(struct udevice *dev);
>
> +/**
> + * spi_flash_probe_bus_cs() - Find flash for selected SPI bus and chip select
> + *
> + * SPI bus probe and search flash chip for one chip select.
> + *
> + * @busnum:SPI bus identifier
> + * @cs:Chip select to look for
> + * @max_hz:Requested spi frequency, 0 = get value from platdata
> + * or device tree
> + * @spi_mode:  Requested spi mode, 0 = get value from platdata
> + * or device tree
> + * @devp:  Returns pointer to the flash device, if found
> + * @return 0 if found, -ve on error
> + */
>  int spi_flash_probe_bus_cs(unsigned int busnum, unsigned int cs,
>unsigned int max_hz, unsigned int spi_mode,
>struct udevice **devp);

Reviewed-by: Simon Goldschmidt 

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


Re: [U-Boot] [PATCH 1/7] spi: update management of default speed and mode

2018-12-10 Thread Simon Goldschmidt
On Mon, Dec 10, 2018 at 11:53 AM Patrick Delaunay
 wrote:
>
> The 2 default values for SPI mode and speed are
> only if CONFIG_DM_SPI_FLASH is not defined
> - CONFIG_SF_DEFAULT_SPEED
> - CONFIG_SF_DEFAULT_MODE
>
> Inverse the logic of the test to remove these two defines.
>
> Signed-off-by: Patrick Delaunay 
> ---
>
>  cmd/sf.c   | 10 ++
>  common/spl/spl_spi.c   | 11 ++-
>  common/splash_source.c | 11 ++-
>  3 files changed, 18 insertions(+), 14 deletions(-)
>
> diff --git a/cmd/sf.c b/cmd/sf.c
> index 84bb057..cfea545 100644
> --- a/cmd/sf.c
> +++ b/cmd/sf.c
> @@ -81,16 +81,18 @@ static int do_spi_flash_probe(int argc, char * const 
> argv[])
>  {
> unsigned int bus = CONFIG_SF_DEFAULT_BUS;
> unsigned int cs = CONFIG_SF_DEFAULT_CS;
> -   unsigned int speed = CONFIG_SF_DEFAULT_SPEED;
> -   unsigned int mode = CONFIG_SF_DEFAULT_MODE;
> +   /* In DM mode, defaults will be taken from DT */
> +   unsigned int speed = 0;
> +   unsigned int mode = 0;
> char *endp;
>  #ifdef CONFIG_DM_SPI_FLASH
> struct udevice *new, *bus_dev;
> int ret;
> -   /* In DM mode defaults will be taken from DT */
> -   speed = 0, mode = 0;
>  #else
> struct spi_flash *new;
> +
> +   speed = CONFIG_SF_DEFAULT_SPEED;
> +   mode = CONFIG_SF_DEFAULT_MODE;
>  #endif
>
> if (argc >= 2) {
> diff --git a/common/spl/spl_spi.c b/common/spl/spl_spi.c
> index b348b45..c1c1fcb 100644
> --- a/common/spl/spl_spi.c
> +++ b/common/spl/spl_spi.c
> @@ -74,12 +74,13 @@ static int spl_spi_load_image(struct spl_image_info 
> *spl_image,
> unsigned payload_offs = CONFIG_SYS_SPI_U_BOOT_OFFS;
> struct spi_flash *flash;
> struct image_header *header;
> -   unsigned int max_hz = CONFIG_SF_DEFAULT_SPEED;
> -   unsigned int spi_mode = CONFIG_SF_DEFAULT_MODE;
> +   /* In DM mode, defaults will be taken from DT */
> +   unsigned int max_hz = 0;
> +   unsigned int spi_mode = 0;
>
> -#ifdef CONFIG_DM_SPI_FLASH
> -   /* In DM mode defaults will be taken from DT */
> -   max_hz = 0, spi_mode = 0;
> +#ifndef CONFIG_DM_SPI_FLASH
> +   max_hz = CONFIG_SF_DEFAULT_SPEED;
> +   spi_mode = CONFIG_SF_DEFAULT_MODE;
>  #endif
> /*
>  * Load U-Boot image from SPI flash into RAM
> diff --git a/common/splash_source.c b/common/splash_source.c
> index 427196c..d5d5550 100644
> --- a/common/splash_source.c
> +++ b/common/splash_source.c
> @@ -24,12 +24,13 @@ DECLARE_GLOBAL_DATA_PTR;
>  static struct spi_flash *sf;
>  static int splash_sf_read_raw(u32 bmp_load_addr, int offset, size_t 
> read_size)
>  {
> -   unsigned int max_hz = CONFIG_SF_DEFAULT_SPEED;
> -   unsigned int spi_mode = CONFIG_SF_DEFAULT_MODE;
> +   /* In DM mode, defaults will be taken from DT */
> +   unsigned int max_hz = 0;
> +   unsigned int spi_mode = 0;
>
> -#ifdef CONFIG_DM_SPI_FLASH
> -   /* In DM mode defaults will be taken from DT */
> -   max_hz = 0, spi_mode = 0;
> +#ifndef CONFIG_DM_SPI_FLASH
> +   max_hz = CONFIG_SF_DEFAULT_SPEED;
> +   spi_mode = CONFIG_SF_DEFAULT_MODE;
>  #endif
>
> if (!sf) {

Reviewed-by: Simon Goldschmidt 

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


Re: [U-Boot] [PATCH 6/7] env: Read default speed and mode values from DT

2018-12-10 Thread Lukasz Majewski
On Mon, 10 Dec 2018 11:52:45 +0100
Patrick Delaunay  wrote:

> In case of DT boot, don't read default speed and mode for SPI from
> CONFIG_*, instead read from DT node.
> 
> Signed-off-by: Patrick Delaunay 
> ---
> 
>  env/Kconfig | 4 ++--
>  env/sf.c| 5 -
>  2 files changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/env/Kconfig b/env/Kconfig
> index 9011109..0f760ce 100644
> --- a/env/Kconfig
> +++ b/env/Kconfig
> @@ -329,11 +329,11 @@ config ENV_IS_IN_SPI_FLASH
>  
> Define the SPI bus and chip select. If not defined they
> will be 0. 
> -   - CONFIG_ENV_SPI_MAX_HZ (optional):
> +   - CONFIG_ENV_SPI_MAX_HZ (optional if !DM_SPI_FLASH):
>  
> Define the SPI max work clock. If not defined then use
> 1MHz. 
> -   - CONFIG_ENV_SPI_MODE (optional):
> +   - CONFIG_ENV_SPI_MODE (optional if !DM_SPI_FLASH):
>  
> Define the SPI work mode. If not defined then use
> SPI_MODE_3. 
> diff --git a/env/sf.c b/env/sf.c
> index 2e3c600..edd36f1 100644
> --- a/env/sf.c
> +++ b/env/sf.c
> @@ -24,12 +24,15 @@
>  #ifndef CONFIG_ENV_SPI_CS
>  # define CONFIG_ENV_SPI_CS   CONFIG_SF_DEFAULT_CS
>  #endif
> +
> +#ifndef CONFIG_DM_SPI_FLASH
>  #ifndef CONFIG_ENV_SPI_MAX_HZ
>  # define CONFIG_ENV_SPI_MAX_HZ   CONFIG_SF_DEFAULT_SPEED
>  #endif
>  #ifndef CONFIG_ENV_SPI_MODE
>  # define CONFIG_ENV_SPI_MODE CONFIG_SF_DEFAULT_MODE
>  #endif
> +#endif
>  
>  #ifndef CONFIG_SPL_BUILD
>  #define CMD_SAVEENV
> @@ -58,7 +61,7 @@ static int setup_flash_device(void)
>  
>   /* speed and mode will be read from DT */
>   ret = spi_flash_probe_bus_cs(CONFIG_ENV_SPI_BUS,
> CONFIG_ENV_SPI_CS,
> -  CONFIG_ENV_SPI_MAX_HZ,
> CONFIG_ENV_SPI_MODE,
> +  0, 0,
>&new);
>   if (ret) {
>   set_default_env("spi_flash_probe_bus_cs() failed",
> 0);

Reviewed-by: Lukasz Majewski 


Best regards,

Lukasz Majewski

--

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


pgpotDm0t1grI.pgp
Description: OpenPGP digital signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 4/7] dfu: sf: Read default speed and mode values from DT

2018-12-10 Thread Lukasz Majewski
On Mon, 10 Dec 2018 11:52:43 +0100
Patrick Delaunay  wrote:

> In case of DT boot, don't read default speed and mode for SPI from
> CONFIG_*, instead read from DT node.
> 
> Signed-off-by: Patrick Delaunay 
> ---
> 
>  drivers/dfu/dfu_sf.c | 10 --
>  1 file changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/dfu/dfu_sf.c b/drivers/dfu/dfu_sf.c
> index 066e767..5e32f80 100644
> --- a/drivers/dfu/dfu_sf.c
> +++ b/drivers/dfu/dfu_sf.c
> @@ -69,11 +69,17 @@ static struct spi_flash *parse_dev(char *devstr)
>  {
>   unsigned int bus;
>   unsigned int cs;
> - unsigned int speed = CONFIG_SF_DEFAULT_SPEED;
> - unsigned int mode = CONFIG_SF_DEFAULT_MODE;
> + /* In DM mode, defaults will be taken from DT */
> + unsigned int speed = 0;
> + unsigned int mode = 0;
>   char *s, *endp;
>   struct spi_flash *dev;
>  
> +#ifndef CONFIG_DM_SPI_FLASH
> + speed = CONFIG_SF_DEFAULT_SPEED;
> + mode = CONFIG_SF_DEFAULT_MODE;
> +#endif
> +
>   s = strsep(&devstr, ":");
>   if (!s || !*s || (bus = simple_strtoul(s, &endp, 0), *endp))
> { printf("Invalid SPI bus %s\n", s);

Reviewed-by: Lukasz Majewski 


Best regards,

Lukasz Majewski

--

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


pgp_YmfBnrVK3.pgp
Description: OpenPGP digital signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [RESEND PATCH v3 3/3] imx: Add PHYTEC phyBOARD-i.MX6UL-Segin

2018-12-10 Thread Martyn Welch
Port for the PHYTEC phyBOARD-i.MX6UL-Segin single board computer. Based on
the PHYTEC phyCORE-i.MX6UL SOM (PCL063).

CPU:   Freescale i.MX6UL rev1.2 528 MHz (running at 396 MHz)
CPU:   Industrial temperature grade (-40C to 105C) at 44C
Reset cause: POR
Board: PHYTEC phyCORE-i.MX6UL
I2C:   ready
DRAM:  256 MiB
NAND:  512 MiB
MMC:   FSL_SDHC: 0
In:serial
Out:   serial
Err:   serial
Net:   FEC0

Working:
 - Eth0
 - i2C
 - MMC/SD
 - NAND
 - UART (1 & 5)
 - USB (host & otg)

Signed-off-by: Martyn Welch 

---

Changes in v3:
- Correct spelling of Phytec
- Remove unneeded license information
- Correct image name in documentation
- Correct whitespacing
- Enable SPL to boot from MMC
- Simplify defconfig, remove non-SPL build

Changes in v2:
- Switch to driver model

 arch/arm/dts/Makefile |   3 +-
 arch/arm/dts/imx6ul-pcl063.dtsi   | 173 +
 arch/arm/dts/imx6ul-phycore-segin.dts |  76 ++
 arch/arm/mach-imx/mx6/Kconfig |  13 ++
 board/phytec/pcl063/Kconfig   |  12 ++
 board/phytec/pcl063/MAINTAINERS   |   8 +
 board/phytec/pcl063/Makefile  |   7 +
 board/phytec/pcl063/README|  26 
 board/phytec/pcl063/pcl063.c  | 206 ++
 board/phytec/pcl063/spl.c | 160 
 configs/phycore_pcl063_defconfig  |  61 
 include/configs/pcl063.h  | 100 +
 12 files changed, 844 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/dts/imx6ul-pcl063.dtsi
 create mode 100644 arch/arm/dts/imx6ul-phycore-segin.dts
 create mode 100644 board/phytec/pcl063/Kconfig
 create mode 100644 board/phytec/pcl063/MAINTAINERS
 create mode 100644 board/phytec/pcl063/Makefile
 create mode 100644 board/phytec/pcl063/README
 create mode 100644 board/phytec/pcl063/pcl063.c
 create mode 100644 board/phytec/pcl063/spl.c
 create mode 100644 configs/phycore_pcl063_defconfig
 create mode 100644 include/configs/pcl063.h

diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index 949ee472fc..68411623e5 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -453,7 +453,8 @@ dtb-$(CONFIG_MX6UL) += \
imx6ul-isiot-nand.dtb \
imx6ul-opos6uldev.dtb \
imx6ul-14x14-evk.dtb \
-   imx6ul-9x9-evk.dtb
+   imx6ul-9x9-evk.dtb \
+   imx6ul-phycore-segin.dtb
 
 dtb-$(CONFIG_MX6ULL) += imx6ull-14x14-evk.dtb
 
diff --git a/arch/arm/dts/imx6ul-pcl063.dtsi b/arch/arm/dts/imx6ul-pcl063.dtsi
new file mode 100644
index 00..24a6a47983
--- /dev/null
+++ b/arch/arm/dts/imx6ul-pcl063.dtsi
@@ -0,0 +1,173 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2018 Collabora Ltd.
+ *
+ * Based on dts[i] from Phytec barebox port:
+ * Copyright (C) 2016 PHYTEC Messtechnik GmbH
+ * Author: Christian Hemp 
+ */
+
+/dts-v1/;
+
+#include "imx6ul.dtsi"
+
+/ {
+   model = "Phytec phyCORE-i.MX6 Ultra Lite SOM";
+   compatible = "phytec,imx6ul-pcl063", "fsl,imx6ul";
+
+   memory {
+   reg = <0x8000 0x2000>;
+   };
+
+   chosen {
+   stdout-path = &uart1;
+   };
+};
+
+&fec1 {
+   pinctrl-names = "default";
+   pinctrl-0 = <&pinctrl_enet1>;
+   phy-mode = "rmii";
+   phy-handle = <ðphy0>;
+   status = "okay";
+
+   mdio: mdio {
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   ethphy0: ethernet-phy@1 {
+   reg = <1>;
+   micrel,led-mode = <1>;
+   };
+   };
+};
+
+&gpmi {
+   pinctrl-names = "default";
+   pinctrl-0 = <&pinctrl_gpmi_nand>;
+   nand-on-flash-bbt;
+   fsl,no-blockmark-swap;
+   status = "okay";
+
+   #address-cells = <1>;
+   #size-cells = <1>;
+
+   partition@0 {
+   label = "uboot";
+   reg = <0x0 0x40>;
+   };
+
+   partition@40 {
+   label = "uboot-env";
+   reg = <0x40 0x10>;
+   };
+
+   partition@50 {
+   label = "root";
+   reg = <0x50 0x0>;
+   };
+};
+
+&i2c1 {
+   clock-frequency = <10>;
+   pinctrl-names = "default", "gpio";
+   pinctrl-0 = <&pinctrl_i2c1>;
+   pinctrl-1 = <&pinctrl_i2c1_gpio>;
+   scl-gpios = <&gpio1 28 GPIO_ACTIVE_HIGH>;
+   sda-gpios = <&gpio1 29 GPIO_ACTIVE_HIGH>;
+   status = "okay";
+
+   eeprom@52 {
+   compatible = "cat,24c32";
+   reg = <0x52>;
+   };
+};
+
+&uart1 {
+   pinctrl-names = "default";
+   pinctrl-0 = <&pinctrl_uart1>;
+   status = "okay";
+};
+
+&usdhc1 {
+   pinctrl-names = "default";
+   pinctrl-0 = <&pinctrl_usdhc1>;
+   cd-gpios = <&gpio1 19 GPIO_ACTIVE_LOW>;
+   bus-width = <0x4>;
+   pinctrl-0 = <&pinctrl_usdhc1>;
+   no-1-8-v;
+   status = "okay";
+};
+
+&iomuxc {
+   pinctrl-names = "default";
+
+   pinctrl_enet1: enet1grp {
+   fsl,pin

[U-Boot] [RESEND PATCH v3 2/3] Enable FEC driver to retrieve PHY address from device tree

2018-12-10 Thread Martyn Welch
Currently if we have more than one phy on the MDIO bus, we do not have a
good mechanism for determining which should be used at runtime. Enable the
FEC driver to determine the address for the PHY from the device tree.

Signed-off-by: Martyn Welch 
Reviewed-by: Lukasz Majewski 

---

Changes in v3:
- No changes in v3

Changes in v2:
- New in v2

 drivers/net/fec_mxc.c | 21 +
 1 file changed, 21 insertions(+)

diff --git a/drivers/net/fec_mxc.c b/drivers/net/fec_mxc.c
index 99c5c649a0..425f6197cb 100644
--- a/drivers/net/fec_mxc.c
+++ b/drivers/net/fec_mxc.c
@@ -1264,11 +1264,32 @@ static const struct eth_ops fecmxc_ops = {
.read_rom_hwaddr= fecmxc_read_rom_hwaddr,
 };
 
+static int device_get_phy_addr(struct udevice *dev)
+{
+   struct ofnode_phandle_args phandle_args;
+   int reg;
+
+   if (dev_read_phandle_with_args(dev, "phy-handle", NULL, 0, 0,
+  &phandle_args)) {
+   debug("Failed to find phy-handle");
+   return -ENODEV;
+   }
+
+   reg = ofnode_read_u32_default(phandle_args.node, "reg", 0);
+
+   return reg;
+}
+
 static int fec_phy_init(struct fec_priv *priv, struct udevice *dev)
 {
struct phy_device *phydev;
+   int addr;
int mask = 0x;
 
+   addr = device_get_phy_addr(dev);
+   if (addr >= 0)
+   mask = 1 << addr;
+
 #ifdef CONFIG_FEC_MXC_PHYADDR
mask = 1 << CONFIG_FEC_MXC_PHYADDR;
 #endif
-- 
2.19.2

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


[U-Boot] [RESEND PATCH v3 1/3] Don't enable CONFIG_SPL_DM_USB for non-DM SPL

2018-12-10 Thread Martyn Welch
When CONFIG_SPL_DM_USB was added, it was added defaulted on without
protection to ensure it didn't get set for non-DM SPL builds.

This leads to unexpected and confusing failures when building a DM based
U-Boot but with a non-DM SPL, as the defconfig is unlikely to have
CONFIG_SPL_DM_USB actively disabled.

Tweak the Kconfig to not enable this setting unless CONFIG_SPL_DM is set.

Signed-off-by: Martyn Welch 

---

Changes in v3:
- New in v3

Changes in v2: None

 drivers/usb/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/Kconfig b/drivers/usb/Kconfig
index d456beb43f..3c978d43aa 100644
--- a/drivers/usb/Kconfig
+++ b/drivers/usb/Kconfig
@@ -49,7 +49,7 @@ config DM_USB
 
 config SPL_DM_USB
bool "Enable driver model for USB in SPL"
-   depends on DM_USB
+   depends on SPL_DM && DM_USB
default y
 
 source "drivers/usb/host/Kconfig"
-- 
2.19.2

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


Re: [U-Boot] [PATCH v2 1/2] spl_spi: Read default speed and mode values from DT

2018-12-10 Thread Patrick DELAUNAY
Hi Simon,

> From: Simon Goldschmidt 
> Sent: mardi 27 novembre 2018 13:55
> Subject: Re: [PATCH v2 1/2] spl_spi: Read default speed and mode values from 
> DT
> 
> On Tue, Nov 27, 2018 at 1:33 PM Patrick DELAUNAY
>  wrote:
> >
> > Hi Simon,
> >
> > > From: Simon Goldschmidt 
> > > Sent: mardi 27 novembre 2018 09:11
> >
> > >
> > > On Tue, Nov 27, 2018 at 9:06 AM Patrick DELAUNAY
> > >  wrote:
> > > >
> > > > Hi Simon,
> > > >
> > > > > -Original Message-
> > > > > From: Simon Goldschmidt 
> > > > > Sent: lundi 19 novembre 2018 20:09
> > > > >
> > > > > On 19.11.2018 18:33, Patrick Delaunay wrote:
> > > > >
> > > > > I do think it would be nice to invert the logic. That way, we
> > > > > could get completely rid of those two CONFIG_SF_DEFAULT settings
> > > > > for DM_SPI_FLASH boards (and eventually for all boards - when's
> > > > > the deadline
> > > for that?).
> > > > > But there are other places that still do it like you do here, so
> > > > > it's probably better to change them all at once...
> > > >
> > > > Agree with you.
> > > >
> > > > In fact I hesitate with directly change the header file
> > > >
> > > > #ifdef CONFIG_DM_SPI_FLASH
> > > > /* In DM mode defaults will be taken from DT */
> > > > #define CONFIG_SF_DEFAULT_SPEED 0
> > > > #define CONFIG_SF_DEFAULT_MODE 0 #endif
> > >
> > > This looks correct to me.
> > >
> > > > But I am afraid of the potential impacts (define is used in many
> > > > boards), but I think it sould be more cleaner way to force the
> > > > expected
> > > behavior.
> > >
> > > Can't we just push this and fix whatever it breaks?
> >
> > Yes I can push it, what is the correct patch strategy.
> >
> > 1/ accept this patch (for short term solution) and propose a update after 
> > (I can
> do it next week).
> 
> I'm totally OK with 1, yes. That's why I've already sent my reviewed-by. But I
> would really appreciate a later update, this got me confused already... ;-)

For information I send the new serie today named  
"[PATCH 0/7] Remove defines for SPI default speed and mode"

http://patchwork.ozlabs.org/project/uboot/list/?series=80769 

Finally I propose to remove the 2 defines when the SPI DM migration will be 
completed.

> Regards,
> Simon

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


[U-Boot] Please pull from u-boot-i2c

2018-12-10 Thread Heiko Schocher

Hello Tom,

please pull from u-boot-i2c.git master.

Series contains DM_I2C_COMPAT removal for all ti platforms from Jean-Jacques
Hiblot. Also a fix in i2c command help output from Chirstoph Muellner.

Thanks!

The following changes since commit cde578ff36b15ec9c2033f03b94ecf809af7cc64:

  ARM: mvebu: restore license information in mv_ddr_plat.{c,h} (2018-12-09 
17:10:13 -0500)

are available in the Git repository at:

  git://git.denx.de/u-boot-i2c.git master

for you to fetch changes up to 19f8c4dfb6e744a31da59bdd23b24d144152f1dc:

  cmd: i2c: Fix help output of i2c command. (2018-12-10 07:30:58 +0100)


Andreas Dannenberg (1):
  ti: common: board_detect: Allow DM I2C without CONFIG_DM_I2C_COMPAT

Christoph Muellner (1):
  cmd: i2c: Fix help output of i2c command.

Jean-Jacques Hiblot (17):
  cmd: Kconfig: Do not include EEPROM if DM_I2C is used without 
DM_I2C_COMPAT
  dm: i2c: Make i2c_get_chip_for_busnum() fail if the chip is not detected
  dm: device: Allow using uclass_find_device_by_seq() without OF_CONTROL
  configs: am335x: am57x: dra7x: Enable CONFIG_SPL_DM_SEQ_ALIAS
  i2c: omap24xx_i2c: Use platdata to probe the device
  am335x: Register the I2C controllers if DM_I2C is used.
  dts: am43x: omap5: Add node for I2C in SPL
  omap: detect the board after DM is available
  power: make most tps drivers and the twl4030 driver compatible with DM_I2C
  configs: am335x_pdu001: remove CONFIG_DM_I2C_COMPAT
  ti: remove usage of DM_I2C_COMPAT and don't disable DM_I2C in SPL
  am57xx: remove non-DM I2C code
  configs: dra7xx-evm: increase the size of the malloc's pool before 
relocation
  lib: fdtdec: Add function re-setup the fdt more effeciently
  drivers: core: Add the option SPL_DM_DEVICE_REMOVE to the Kconfig
  drivers: core: nullify gd->dm_root after dm_uninit()
  dra7: Allow selecting a new dtb after board detection.

Vignesh R (1):
  i2c: omap24xx_i2c: Move away from SoC specific headers for reg offset

 arch/arm/dts/am437x-gp-evm-u-boot.dtsi   |   4 +
 arch/arm/dts/omap5-u-boot.dtsi   |   4 +
 arch/arm/include/asm/arch-am33xx/i2c.h   |  47 +---
 arch/arm/include/asm/arch-omap3/i2c.h|  47 
 arch/arm/include/asm/arch-omap4/i2c.h|  45 ---
 arch/arm/include/asm/arch-omap5/i2c.h|  45 ---
 arch/arm/include/asm/omap_i2c.h  |  24 ++
 arch/arm/mach-keystone/ddr3_spd.c|   7 ++
 arch/arm/mach-omap2/am33xx/board.c   |  24 +-
 arch/arm/mach-omap2/am33xx/clk_synthesizer.c |  56 +++---
 arch/arm/mach-omap2/clocks-common.c  |   2 +
 arch/arm/mach-omap2/hwinit-common.c  |  23 +-
 board/eets/pdu001/board.c|   1 -
 board/ti/am335x/board.c  |  17 -
 board/ti/am335x/mux.c|  11 +++
 board/ti/am43xx/board.c  |  46 +---
 board/ti/am57xx/board.c  |  25 +++
 board/ti/common/board_detect.c   | 110 +--
 board/ti/ks2_evm/board_k2g.c |  11 +++
 cmd/Kconfig  |   1 +
 cmd/i2c.c|   1 +
 configs/am335x_pdu001_defconfig  |   1 +
 configs/am57xx_evm_defconfig |   1 +
 configs/am57xx_hs_evm_defconfig  |   1 +
 configs/dra7xx_evm_defconfig |   4 +-
 configs/dra7xx_hs_evm_defconfig  |   1 +
 configs/omap3_logic_defconfig|   1 +
 doc/README.fdt-control   |  18 +
 drivers/core/Kconfig |  12 ++-
 drivers/core/device.c|  10 ++-
 drivers/core/root.c  |   1 +
 drivers/core/uclass.c|  24 ++
 drivers/i2c/i2c-uclass.c |  11 +++
 drivers/i2c/omap24xx_i2c.c   | 467 
++

 drivers/power/palmas.c   |  39 ++
 drivers/power/pmic/pmic_tps62362.c   |  24 ++
 drivers/power/pmic/pmic_tps65217.c   |  44 ++-
 drivers/power/pmic/pmic_tps65218.c   |  85 +
 drivers/power/pmic/pmic_tps65910.c   |  57 +++---
 drivers/power/twl4030.c  |  39 ++
 drivers/power/twl6030.c  |  39 ++
 include/asm-generic/global_data.h|   4 +
 include/configs/am43xx_evm.h |   2 +
 include/configs/pdu001.h |   6 --
 include/configs/ti_armv7_common.h|  18 +
 include/dm/uclass-internal.h |  13 
 include/fdtdec.h |  21 ++
 include/palmas.h   

<    1   2   3   >