[U-Boot] [PATCH 1/1] spi: fsl_qspi: remove superfluous assignment

2018-03-18 Thread Heinrich Schuchardt
In

void *rx_addr = NULL;
rx_add = A;

the first assignment has no effect. Remove it.

Signed-off-by: Heinrich Schuchardt 
---
 drivers/spi/fsl_qspi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/spi/fsl_qspi.c b/drivers/spi/fsl_qspi.c
index 5dc69a6865..75793dd1ab 100644
--- a/drivers/spi/fsl_qspi.c
+++ b/drivers/spi/fsl_qspi.c
@@ -389,7 +389,7 @@ static inline void qspi_ahb_read(struct fsl_qspi_priv 
*priv, u8 *rxbuf, int len)
 {
struct fsl_qspi_regs *regs = priv->regs;
u32 mcr_reg;
-   void *rx_addr = NULL;
+   void *rx_addr;
 
mcr_reg = qspi_read32(priv->flags, >mcr);
 
-- 
2.16.2

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


[U-Boot] [PATCH 1/1] spi: atcspi200: avoid NULL dereference

2018-03-18 Thread Heinrich Schuchardt
For SPI_XFER_BEGIN | SPI_XFER_END the code sets data_out = NULL.
In the debug statement we should not dereference this value.
As we do not transfer any data the debug statement is not needed in this
case anyway.

Signed-off-by: Heinrich Schuchardt 
---
 drivers/spi/atcspi200_spi.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/spi/atcspi200_spi.c b/drivers/spi/atcspi200_spi.c
index bc08914b9e..2638f2ab25 100644
--- a/drivers/spi/atcspi200_spi.c
+++ b/drivers/spi/atcspi200_spi.c
@@ -230,8 +230,10 @@ static int __atcspi200_spi_xfer(struct nds_spi_slave *ns,
__atcspi200_spi_start(ns);
break;
}
-   debug("spi_xfer: data_out %08X(%p) data_in %08X(%p) data_len 
%u\n",
- *(uint *)data_out, data_out, *(uint *)data_in, data_in, 
data_len);
+   if (data_out)
+   debug("spi_xfer: data_out %08X(%p) data_in %08X(%p) 
data_len %u\n",
+ *(uint *)data_out, data_out, *(uint *)data_in,
+ data_in, data_len);
num_chunks = DIV_ROUND_UP(data_len, max_tran_len);
din = data_in;
dout = data_out;
-- 
2.16.2

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


[U-Boot] [RFC 1/1] driver: ram: rockchip: rk3399: missing counter increment

2018-03-18 Thread Heinrich Schuchardt
If we want to check the duration we need to increment the counter.

Signed-off-by: Heinrich Schuchardt 
---
I do not have the hardware for testing. But the current coding is
obviously flawed.
---
 drivers/ram/rockchip/sdram_rk3399.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/ram/rockchip/sdram_rk3399.c 
b/drivers/ram/rockchip/sdram_rk3399.c
index 76c1fe80a7..5cb470c209 100644
--- a/drivers/ram/rockchip/sdram_rk3399.c
+++ b/drivers/ram/rockchip/sdram_rk3399.c
@@ -1015,6 +1015,7 @@ static int switch_to_phy_index1(struct dram_info *dram,
writel(RK_CLRSETBITS(1 << 1, 1 << 1), >cic->cic_ctrl0);
while (!(readl(>cic->cic_status0) & (1 << 0))) {
mdelay(10);
+   i++;
if (i > 10) {
debug("index1 frequency done overtime\n");
return -ETIME;
-- 
2.16.2

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


[U-Boot] [PATCH 1/1] regulator: pbias: don't evaluate variable before assignment

2018-03-18 Thread Heinrich Schuchardt
We should not evaluate the value of reg before its value is set.

Signed-off-by: Heinrich Schuchardt 
---
 drivers/power/regulator/pbias_regulator.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/power/regulator/pbias_regulator.c 
b/drivers/power/regulator/pbias_regulator.c
index 116b7f480a..adf589b224 100644
--- a/drivers/power/regulator/pbias_regulator.c
+++ b/drivers/power/regulator/pbias_regulator.c
@@ -225,9 +225,6 @@ static int pbias_regulator_set_value(struct udevice *dev, 
int uV)
int rc;
u32 reg;
 
-   debug("Setting %s voltage to %s\n", p->name,
- (reg & p->vmode) ? "3.0v" : "1.8v");
-
rc = pmic_read(dev->parent, 0, (uint8_t *), sizeof(reg));
if (rc)
return rc;
@@ -239,6 +236,9 @@ static int pbias_regulator_set_value(struct udevice *dev, 
int uV)
else
return -EINVAL;
 
+   debug("Setting %s voltage to %s\n", p->name,
+ (reg & p->vmode) ? "3.0v" : "1.8v");
+
return pmic_write(dev->parent, 0, (uint8_t *), sizeof(reg));
 }
 
-- 
2.16.2

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


[U-Boot] [PATCH 1/1] drivers:power:max77693: remove redundant logical constraint

2018-03-18 Thread Heinrich Schuchardt
As ret is not set when calling max77693_get_vcell() there is no
need to check ret again.

Signed-off-by: Heinrich Schuchardt 
---
 drivers/power/mfd/fg_max77693.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/power/mfd/fg_max77693.c b/drivers/power/mfd/fg_max77693.c
index df1550816e..a1407318ef 100644
--- a/drivers/power/mfd/fg_max77693.c
+++ b/drivers/power/mfd/fg_max77693.c
@@ -60,8 +60,6 @@ static int power_update_battery(struct pmic *p, struct pmic 
*bat)
return ret;
 
max77693_get_vcell(>bat->voltage_uV);
-   if (ret)
-   return ret;
 
return 0;
 }
-- 
2.16.2

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


[U-Boot] [PATCH 1/1] net: macb: remove superfluous logical constraint

2018-03-18 Thread Heinrich Schuchardt
In

if (a > =0) {...}
else (a < 0) {...}

the second logical constraint is superfluous.

Signed-off-by: Heinrich Schuchardt 
---
 drivers/net/macb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/macb.c b/drivers/net/macb.c
index e62aefcd0d..fe370bf728 100644
--- a/drivers/net/macb.c
+++ b/drivers/net/macb.c
@@ -915,7 +915,7 @@ static int macb_recv(struct eth_device *netdev)
if (length >= 0) {
net_process_received_packet(packet, length);
reclaim_rx_buffers(macb, macb->next_rx_tail);
-   } else if (length < 0) {
+   } else {
return length;
}
}
-- 
2.16.2

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


[U-Boot] [PATCH 1/1] drivers: net: cpsw: remove superfluous assignment.

2018-03-18 Thread Heinrich Schuchardt
In

int ret = A;
ret = B;

the first assignment has not effect.

Signed-off-by: Heinrich Schuchardt 
---
 drivers/net/cpsw.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/cpsw.c b/drivers/net/cpsw.c
index b72258f83b..e2395dbeb9 100644
--- a/drivers/net/cpsw.c
+++ b/drivers/net/cpsw.c
@@ -949,7 +949,7 @@ static int _cpsw_recv(struct cpsw_priv *priv, uchar **pkt)
 {
void *buffer;
int len;
-   int ret = -EAGAIN;
+   int ret;
 
ret = cpdma_process(priv, >rx_chan, , );
if (ret < 0)
-- 
2.16.2

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


[U-Boot] [PATCH 1/1] i2c: lpi2c: remove superfluous assignments

2018-03-18 Thread Heinrich Schuchardt
In

lpi2c_status_t result = A;
result = B;

the first assignment has no effect. Let's remove it.

Signed-off-by: Heinrich Schuchardt 
---
 drivers/i2c/imx_lpi2c.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/i2c/imx_lpi2c.c b/drivers/i2c/imx_lpi2c.c
index de74e89efd..32d7809dba 100644
--- a/drivers/i2c/imx_lpi2c.c
+++ b/drivers/i2c/imx_lpi2c.c
@@ -156,7 +156,7 @@ static int bus_i2c_receive(struct imx_lpi2c_reg *regs, u8 
*rxbuf, int len)
 
 static int bus_i2c_start(struct imx_lpi2c_reg *regs, u8 addr, u8 dir)
 {
-   lpi2c_status_t result = LPI2C_SUCESS;
+   lpi2c_status_t result;
u32 val;
 
result = imx_lpci2c_check_busy_bus(regs);
@@ -184,7 +184,7 @@ static int bus_i2c_start(struct imx_lpi2c_reg *regs, u8 
addr, u8 dir)
 
 static int bus_i2c_stop(struct imx_lpi2c_reg *regs)
 {
-   lpi2c_status_t result = LPI2C_SUCESS;
+   lpi2c_status_t result;
u32 status;
 
result = bus_i2c_wait_for_tx_ready(regs);
@@ -213,7 +213,7 @@ static int bus_i2c_stop(struct imx_lpi2c_reg *regs)
 
 static int bus_i2c_read(struct imx_lpi2c_reg *regs, u32 chip, u8 *buf, int len)
 {
-   lpi2c_status_t result = LPI2C_SUCESS;
+   lpi2c_status_t result;
 
result = bus_i2c_start(regs, chip, 1);
if (result)
@@ -230,7 +230,7 @@ static int bus_i2c_read(struct imx_lpi2c_reg *regs, u32 
chip, u8 *buf, int len)
 
 static int bus_i2c_write(struct imx_lpi2c_reg *regs, u32 chip, u8 *buf, int 
len)
 {
-   lpi2c_status_t result = LPI2C_SUCESS;
+   lpi2c_status_t result;
 
result = bus_i2c_start(regs, chip, 0);
if (result)
@@ -354,7 +354,7 @@ static int imx_lpi2c_probe_chip(struct udevice *bus, u32 
chip,
u32 chip_flags)
 {
struct imx_lpi2c_reg *regs;
-   lpi2c_status_t result = LPI2C_SUCESS;
+   lpi2c_status_t result;
 
regs = (struct imx_lpi2c_reg *)devfdt_get_addr(bus);
result = bus_i2c_start(regs, chip, 0);
-- 
2.16.2

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


[U-Boot] [PATCH 1/1] bios_emulator: remove assignment without effect

2018-03-18 Thread Heinrich Schuchardt
Assigning a parameter which is not used afterwards has not effect.

Signed-off-by: Heinrich Schuchardt 
---
 drivers/bios_emulator/atibios.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/bios_emulator/atibios.c b/drivers/bios_emulator/atibios.c
index 2d5b5dc562..545ccd6f1e 100644
--- a/drivers/bios_emulator/atibios.c
+++ b/drivers/bios_emulator/atibios.c
@@ -602,7 +602,6 @@ int biosemu_run(pci_dev_t pcidev, uchar *bios_rom, int 
bios_len,
(ulong)(vga_info->BIOSImage) != 0xc)
free(vga_info->BIOSImage);
free(vga_info);
-   vga_info = NULL;
}
 
return 0;
-- 
2.16.2

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


Re: [U-Boot] [PATCH 1/3] phy: add support for bcm6348 usbh phy

2018-03-18 Thread Álvaro Fernández Rojas

Hi Daniel,


El 17/03/2018 a las 20:30, Daniel Schwierzeck escribió:


On 04.02.2018 11:18, Álvaro Fernández Rojas wrote:

Signed-off-by: Álvaro Fernández Rojas 
---
  drivers/phy/Kconfig|  6 +++
  drivers/phy/Makefile   |  1 +
  drivers/phy/bcm6348-usbh-phy.c | 94 ++
  3 files changed, 101 insertions(+)
  create mode 100644 drivers/phy/bcm6348-usbh-phy.c

diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig
index 3b9a09ce18..cec2130c05 100644
--- a/drivers/phy/Kconfig
+++ b/drivers/phy/Kconfig
@@ -59,6 +59,12 @@ config SPL_NOP_PHY
  This is useful when a driver uses the PHY framework but no real PHY
  hardware exists.
  
+config BCM6348_USBH_PHY

+   bool "BCM6348 USBH PHY support"
+   depends on PHY && ARCH_BMIPS
+   help
+ Support for the Broadcom MIPS BCM6348 USBH PHY.
+
  config PIPE3_PHY
bool "Support omap's PIPE3 PHY"
depends on PHY && ARCH_OMAP2PLUS
diff --git a/drivers/phy/Makefile b/drivers/phy/Makefile
index 668040b0bb..06e01e86eb 100644
--- a/drivers/phy/Makefile
+++ b/drivers/phy/Makefile
@@ -7,6 +7,7 @@
  
  obj-$(CONFIG_$(SPL_)PHY) += phy-uclass.o

  obj-$(CONFIG_$(SPL_)NOP_PHY) += nop-phy.o
+obj-$(CONFIG_BCM6348_USBH_PHY) += bcm6348-usbh-phy.o
  obj-$(CONFIG_PHY_SANDBOX) += sandbox-phy.o
  obj-$(CONFIG_$(SPL_)PIPE3_PHY) += ti-pipe3-phy.o
  obj-$(CONFIG_STI_USB_PHY) += sti_usb_phy.o
diff --git a/drivers/phy/bcm6348-usbh-phy.c b/drivers/phy/bcm6348-usbh-phy.c
new file mode 100644
index 00..55e865c53d
--- /dev/null
+++ b/drivers/phy/bcm6348-usbh-phy.c
@@ -0,0 +1,94 @@
+/*
+ * Copyright (C) 2018 Álvaro Fernández Rojas 
+ *
+ * Derived from linux/arch/mips/bcm63xx/usb-common.c:
+ * Copyright 2008 Maxime Bizon 
+ * Copyright 2013 Florian Fainelli 
+ *
+ * SPDX-License-Identifier: GPL-2.0+
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define USBH_SETUP_PORT1_ENBIT(0)
+
+struct bcm6348_usbh_priv {
+   void __iomem *regs;
+};
+
+static int bcm6348_usbh_init(struct phy *phy)
+{
+   struct bcm6348_usbh_priv *priv = dev_get_priv(phy->dev);
+
+   writel_be(USBH_SETUP_PORT1_EN, priv->regs);
+
+   return 0;
+}
+
+static struct phy_ops bcm6348_usbh_ops = {
+   .init = bcm6348_usbh_init,
+};
+
+static const struct udevice_id bcm6348_usbh_ids[] = {
+   { .compatible = "brcm,bcm6348-usbh" },
+   { /* sentinel */ }
+};
+
+static int bcm6348_usbh_probe(struct udevice *dev)
+{
+   struct bcm6348_usbh_priv *priv = dev_get_priv(dev);
+   struct reset_ctl rst_ctl;
+   struct clk clk;
+   fdt_addr_t addr;
+   fdt_size_t size;
+   int ret;
+
+   addr = devfdt_get_addr_size_index(dev, 0, );
+   if (addr == FDT_ADDR_T_NONE)
+   return -EINVAL;
+
+   priv->regs = ioremap(addr, size);

since you started to convert the other BMIPS related drivers to
live-tree, shall I pick up the current patches and you send a separate
patch for the conversion later? Or do you want to resend a v2?
You can pick the current patches and I will send a conversion patch 
later :).





+
+   /* enable usbh clock */
+   ret = clk_get_by_name(dev, "usbh", );
+   if (ret < 0)
+   return ret;
+
+   ret = clk_enable();
+   if (ret < 0)
+   return ret;
+
+   ret = clk_free();
+   if (ret < 0)
+   return ret;
+
+   /* perform reset */
+   ret = reset_get_by_index(dev, 0, _ctl);
+   if (ret < 0)
+   return ret;
+
+   ret = reset_deassert(_ctl);
+   if (ret < 0)
+   return ret;
+
+   ret = reset_free(_ctl);
+   if (ret < 0)
+   return ret;
+
+   return 0;
+}
+
+U_BOOT_DRIVER(bcm6348_usbh) = {
+   .name = "bcm6348-usbh",
+   .id = UCLASS_PHY,
+   .of_match = bcm6348_usbh_ids,
+   .ops = _usbh_ops,
+   .priv_auto_alloc_size = sizeof(struct bcm6348_usbh_priv),
+   .probe = bcm6348_usbh_probe,
+};


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


Re: [U-Boot] tools/mxsimage: Support building with LibreSSL

2018-03-18 Thread Jonathan Gray
On Sun, Mar 18, 2018 at 01:55:29AM +0100, Hauke Mehrtens wrote:
> On 03/18/2018 01:33 AM, Jonathan Gray wrote:
> > On Sat, Mar 17, 2018 at 05:24:47PM +0100, Marek Vasut wrote:
> >> On 03/17/2018 04:09 PM, Hauke Mehrtens wrote:
> >>> On 03/17/2018 03:47 PM, Marek Vasut wrote:
>  On 03/17/2018 01:23 PM, Hauke Mehrtens wrote:
> > The mxsimage utility fails to compile against LibreSSL because LibreSSL
> > says it is OpenSSL 2.0, but it does not support the complete OpenSSL 1.1
> > interface.
> 
>  The mxsimage does support OpenSSL 1.1 , the commit message is confusing.
>  Can you elaborate on that and reword the last part ?
> >>>
> >>> libressl defines the following in version 2.7.4:
> >>> #define OPENSSL_VERSION_NUMBER0x2000L
> >>> #define LIBRESSL_VERSION_NUMBER   0x2060400fL
> >>> see here:
> >>> https://github.com/libressl-portable/openbsd/blob/OPENBSD_6_2/src/lib/libcrypto/opensslv.h
> >>>
> >>> But OPENSSL_zalloc() is not provided by libressl, that is only available
> >>> in OpeSSL 1.1.0 and later.
> >>
> >> So it's libressl that's API-incompatible and thus broken ? OK
> >>
> >> I guess the commit message should mention that and then yes, if
> >> LIBRESSL_VERSION_NUMBER is defined, we should treat it as old version of
> >> OpenSSL.
> > 
> > LibreSSL implements parts of the OpenSSL 1.1 API without breaking
> > backwards compat like OpenSSL did.
> > 
> > The proposed patch to mxsimage.c is wrong as some of these functions
> > are now implemented by LibreSSL.
> > 
> > https://marc.info/?l=openbsd-cvs=151887933725237=2
> > EVP_MD_CTX_new()
> > EVP_MD_CTX_free()
> > EVP_CIPHER_CTX_reset()
> > 
> > OPENSSL_zalloc() is not implemented but it is only used in this ifdef block.
> > 
> > A patch along the lines of the below would be better.
> > 
> > diff --git a/tools/mxsimage.c b/tools/mxsimage.c
> > index 32a7978cae..c8f1f204e3 100644
> > --- a/tools/mxsimage.c
> > +++ b/tools/mxsimage.c
> > @@ -26,7 +26,8 @@
> >   * OpenSSL 1.1.0 and newer compatibility functions:
> >   * https://wiki.openssl.org/index.php/1.1_API_Changes
> >   */
> > -#if OPENSSL_VERSION_NUMBER < 0x1010L
> > +#if OPENSSL_VERSION_NUMBER < 0x1010L || \
> > +(defined(LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER < 
> > 0x207fL)
> >  static void *OPENSSL_zalloc(size_t num)
> >  {
> > void *ret = OPENSSL_malloc(num);
> > 
> Yes you are right your patch is better. Now I also found these functions
> in the libressl repository and they will be available with the version
> 2.7.0.
> https://github.com/libressl-portable/openbsd/commit/2443cc9a48b200ef126dba99cbbb2f25937382e0
> https://github.com/libressl-portable/openbsd/commit/651a8b53a2a41bbfc31d665b3f7030109d09606e
> 
> Is this sufficient or should I send a new patch?

I think you'll need to send a v2 for it to get picked up.
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


<    1   2