All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 0/4] Random small sunxi fixes
@ 2019-02-09 13:39 megous at megous.com
  2019-02-09 13:39 ` [U-Boot] [PATCH 1/4] sunxi: Fix build when CONFIG_CMD_NET is disabled megous at megous.com
                   ` (3 more replies)
  0 siblings, 4 replies; 11+ messages in thread
From: megous at megous.com @ 2019-02-09 13:39 UTC (permalink / raw)
  To: u-boot

From: Ondrej Jirman <megous@megous.com>

Patch 1 and 2 are fixes for compilation failures with disabled network
support on sunxi platform.

Patch 3 is a fix for error path bug in decode_timing_property(), I've
found while debugging a missing LCD panel output.

Patch 4 is typo fix.

regards,
  Ondřej Jirman

Ondrej Jirman (4):
  sunxi: Fix build when CONFIG_CMD_NET is disabled
  sunxi: Fix build when CONFIG_CMD_PXE or CONFIG_CMD_DHCP are disabled
  lib: decode_timing_property should return -NOENT when proprty is not
    found
  power: axp818: Fix typo in axp_set_dldo

 board/sunxi/board.c            |  7 ++++++-
 drivers/power/axp818.c         |  2 +-
 include/configs/sunxi-common.h | 16 ++++++++++++++--
 lib/fdtdec.c                   |  2 +-
 4 files changed, 22 insertions(+), 5 deletions(-)

-- 
2.20.1

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

* [U-Boot] [PATCH 1/4] sunxi: Fix build when CONFIG_CMD_NET is disabled
  2019-02-09 13:39 [U-Boot] [PATCH 0/4] Random small sunxi fixes megous at megous.com
@ 2019-02-09 13:39 ` megous at megous.com
  2019-02-11 12:14   ` Tomas Novotny
  2019-02-09 13:39 ` [U-Boot] [PATCH 2/4] sunxi: Fix build when CONFIG_CMD_PXE or CONFIG_CMD_DHCP are disabled megous at megous.com
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 11+ messages in thread
From: megous at megous.com @ 2019-02-09 13:39 UTC (permalink / raw)
  To: u-boot

From: Ondrej Jirman <megous@megous.com>

Signed-off-by: Ondřej Jirman <megous@megous.com>
---
 board/sunxi/board.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/board/sunxi/board.c b/board/sunxi/board.c
index 98bc3cd0c1..e918bdf36b 100644
--- a/board/sunxi/board.c
+++ b/board/sunxi/board.c
@@ -774,9 +774,12 @@ static void setup_environment(const void *fdt)
 {
 	char serial_string[17] = { 0 };
 	unsigned int sid[4];
+#if defined CONFIG_CMD_NET
 	uint8_t mac_addr[6];
 	char ethaddr[16];
-	int i, ret;
+	int i;
+#endif
+	int ret;
 
 	ret = sunxi_get_sid(sid);
 	if (ret == 0 && sid[0] != 0) {
@@ -801,6 +804,7 @@ static void setup_environment(const void *fdt)
 		if ((sid[3] & 0xffffff) == 0)
 			sid[3] |= 0x800000;
 
+#if defined CONFIG_CMD_NET
 		for (i = 0; i < 4; i++) {
 			sprintf(ethaddr, "ethernet%d", i);
 			if (!fdt_get_alias(fdt, ethaddr))
@@ -824,6 +828,7 @@ static void setup_environment(const void *fdt)
 
 			eth_env_set_enetaddr(ethaddr, mac_addr);
 		}
+#endif
 
 		if (!env_get("serial#")) {
 			snprintf(serial_string, sizeof(serial_string),
-- 
2.20.1

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

* [U-Boot] [PATCH 2/4] sunxi: Fix build when CONFIG_CMD_PXE or CONFIG_CMD_DHCP are disabled
  2019-02-09 13:39 [U-Boot] [PATCH 0/4] Random small sunxi fixes megous at megous.com
  2019-02-09 13:39 ` [U-Boot] [PATCH 1/4] sunxi: Fix build when CONFIG_CMD_NET is disabled megous at megous.com
@ 2019-02-09 13:39 ` megous at megous.com
  2019-02-13 17:01   ` Jagan Teki
  2019-02-09 13:39 ` [U-Boot] [PATCH 3/4] lib: decode_timing_property should return -NOENT when proprty is not found megous at megous.com
  2019-02-09 13:39 ` [U-Boot] [PATCH 4/4] power: axp818: Fix typo in axp_set_dldo megous at megous.com
  3 siblings, 1 reply; 11+ messages in thread
From: megous at megous.com @ 2019-02-09 13:39 UTC (permalink / raw)
  To: u-boot

From: Ondrej Jirman <megous@megous.com>

Signed-off-by: Ondřej Jirman <megous@megous.com>
---
 include/configs/sunxi-common.h | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/include/configs/sunxi-common.h b/include/configs/sunxi-common.h
index b01d1c3c84..d421b93509 100644
--- a/include/configs/sunxi-common.h
+++ b/include/configs/sunxi-common.h
@@ -399,6 +399,18 @@ extern int soft_i2c_gpio_scl;
 #define BOOT_TARGET_DEVICES_USB(func)
 #endif
 
+#ifdef CONFIG_CMD_PXE
+#define BOOT_TARGET_DEVICES_PXE(func) func(PXE, pxe, na)
+#else
+#define BOOT_TARGET_DEVICES_PXE(func)
+#endif
+
+#ifdef CONFIG_CMD_DHCP
+#define BOOT_TARGET_DEVICES_DHCP(func) func(DHCP, dhcp, na)
+#else
+#define BOOT_TARGET_DEVICES_DHCP(func)
+#endif
+
 /* FEL boot support, auto-execute boot.scr if a script address was provided */
 #define BOOTENV_DEV_FEL(devtypeu, devtypel, instance) \
 	"bootcmd_fel=" \
@@ -414,8 +426,8 @@ extern int soft_i2c_gpio_scl;
 	BOOT_TARGET_DEVICES_MMC(func) \
 	BOOT_TARGET_DEVICES_SCSI(func) \
 	BOOT_TARGET_DEVICES_USB(func) \
-	func(PXE, pxe, na) \
-	func(DHCP, dhcp, na)
+	BOOT_TARGET_DEVICES_PXE(func) \
+	BOOT_TARGET_DEVICES_DHCP(func)
 
 #ifdef CONFIG_OLD_SUNXI_KERNEL_COMPAT
 #define BOOTCMD_SUNXI_COMPAT \
-- 
2.20.1

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

* [U-Boot] [PATCH 3/4] lib: decode_timing_property should return -NOENT when proprty is not found
  2019-02-09 13:39 [U-Boot] [PATCH 0/4] Random small sunxi fixes megous at megous.com
  2019-02-09 13:39 ` [U-Boot] [PATCH 1/4] sunxi: Fix build when CONFIG_CMD_NET is disabled megous at megous.com
  2019-02-09 13:39 ` [U-Boot] [PATCH 2/4] sunxi: Fix build when CONFIG_CMD_PXE or CONFIG_CMD_DHCP are disabled megous at megous.com
@ 2019-02-09 13:39 ` megous at megous.com
  2019-02-19 15:17   ` Simon Glass
  2019-02-09 13:39 ` [U-Boot] [PATCH 4/4] power: axp818: Fix typo in axp_set_dldo megous at megous.com
  3 siblings, 1 reply; 11+ messages in thread
From: megous at megous.com @ 2019-02-09 13:39 UTC (permalink / raw)
  To: u-boot

From: Ondrej Jirman <megous@megous.com>

Length may be unitialized when fdt_getprop fails.

Signed-off-by: Ondřej Jirman <megous@megous.com>
---
 lib/fdtdec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/fdtdec.c b/lib/fdtdec.c
index 18663ce6bd..3510de78e1 100644
--- a/lib/fdtdec.c
+++ b/lib/fdtdec.c
@@ -980,7 +980,7 @@ static int decode_timing_property(const void *blob, int node, const char *name,
 	if (!prop) {
 		debug("%s: could not find property %s\n",
 		      fdt_get_name(blob, node, NULL), name);
-		return length;
+		return -ENOENT;
 	}
 
 	if (length == sizeof(u32)) {
-- 
2.20.1

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

* [U-Boot] [PATCH 4/4] power: axp818: Fix typo in axp_set_dldo
  2019-02-09 13:39 [U-Boot] [PATCH 0/4] Random small sunxi fixes megous at megous.com
                   ` (2 preceding siblings ...)
  2019-02-09 13:39 ` [U-Boot] [PATCH 3/4] lib: decode_timing_property should return -NOENT when proprty is not found megous at megous.com
@ 2019-02-09 13:39 ` megous at megous.com
  2019-02-13 17:01   ` Jagan Teki
  3 siblings, 1 reply; 11+ messages in thread
From: megous at megous.com @ 2019-02-09 13:39 UTC (permalink / raw)
  To: u-boot

From: Ondrej Jirman <megous@megous.com>

Signed-off-by: Ondřej Jirman <megous@megous.com>
---
 drivers/power/axp818.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/power/axp818.c b/drivers/power/axp818.c
index c737da1180..834919ddd4 100644
--- a/drivers/power/axp818.c
+++ b/drivers/power/axp818.c
@@ -161,7 +161,7 @@ int axp_set_dldo(int dldo_num, unsigned int mvolt)
 	cfg = axp818_mvolt_to_cfg(mvolt, 700, 3300, 100);
 	if (dldo_num == 2 && mvolt > 3300)
 		cfg += 1 + axp818_mvolt_to_cfg(mvolt, 3400, 4200, 200);
-	ret = pmic_bus_write(AXP818_ELDO1_CTRL + (dldo_num - 1), cfg);
+	ret = pmic_bus_write(AXP818_DLDO1_CTRL + (dldo_num - 1), cfg);
 	if (ret)
 		return ret;
 
-- 
2.20.1

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

* [U-Boot] [PATCH 1/4] sunxi: Fix build when CONFIG_CMD_NET is disabled
  2019-02-09 13:39 ` [U-Boot] [PATCH 1/4] sunxi: Fix build when CONFIG_CMD_NET is disabled megous at megous.com
@ 2019-02-11 12:14   ` Tomas Novotny
  2019-02-11 12:41     ` Ondřej Jirman
  0 siblings, 1 reply; 11+ messages in thread
From: Tomas Novotny @ 2019-02-11 12:14 UTC (permalink / raw)
  To: u-boot

Hi Ondřej,

On Sat,  9 Feb 2019 14:39:54 +0100, megous at megous.com <megous@megous.com>
wrote:
> From: Ondrej Jirman <megous@megous.com>
> 
> Signed-off-by: Ondřej Jirman <megous@megous.com>
> ---
>  board/sunxi/board.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/board/sunxi/board.c b/board/sunxi/board.c
> index 98bc3cd0c1..e918bdf36b 100644
> --- a/board/sunxi/board.c
> +++ b/board/sunxi/board.c
> @@ -774,9 +774,12 @@ static void setup_environment(const void *fdt)
>  {
>  	char serial_string[17] = { 0 };
>  	unsigned int sid[4];
> +#if defined CONFIG_CMD_NET
>  	uint8_t mac_addr[6];
>  	char ethaddr[16];
> -	int i, ret;
> +	int i;
> +#endif
> +	int ret;
>  
>  	ret = sunxi_get_sid(sid);
>  	if (ret == 0 && sid[0] != 0) {
> @@ -801,6 +804,7 @@ static void setup_environment(const void *fdt)
>  		if ((sid[3] & 0xffffff) == 0)
>  			sid[3] |= 0x800000;
>  
> +#if defined CONFIG_CMD_NET
>  		for (i = 0; i < 4; i++) {
>  			sprintf(ethaddr, "ethernet%d", i);
>  			if (!fdt_get_alias(fdt, ethaddr))
> @@ -824,6 +828,7 @@ static void setup_environment(const void *fdt)
>  
>  			eth_env_set_enetaddr(ethaddr, mac_addr);
>  		}
> +#endif
>  
>  		if (!env_get("serial#")) {
>  			snprintf(serial_string, sizeof(serial_string),

This patch is not needed anymore. We had a similar one also in 2018.03, but
after 2019.01 upgrade it wasn't needed. It was fixed in Apr-2018:
9925f1dbc38c:
net: Move enetaddr env access code to env config instead of net config

Tomas

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

* [U-Boot] [PATCH 1/4] sunxi: Fix build when CONFIG_CMD_NET is disabled
  2019-02-11 12:14   ` Tomas Novotny
@ 2019-02-11 12:41     ` Ondřej Jirman
  0 siblings, 0 replies; 11+ messages in thread
From: Ondřej Jirman @ 2019-02-11 12:41 UTC (permalink / raw)
  To: u-boot

Hi Tomas,

On Mon, Feb 11, 2019 at 01:14:10PM +0100, Tomas Novotny wrote:
> Hi Ondřej,
> 
> On Sat,  9 Feb 2019 14:39:54 +0100, megous at megous.com <megous@megous.com>
> wrote:
> > From: Ondrej Jirman <megous@megous.com>
> > 
> > Signed-off-by: Ondřej Jirman <megous@megous.com>
> > ---
> >  board/sunxi/board.c | 7 ++++++-
> >  1 file changed, 6 insertions(+), 1 deletion(-)
> > 
> > diff --git a/board/sunxi/board.c b/board/sunxi/board.c
> > index 98bc3cd0c1..e918bdf36b 100644
> > --- a/board/sunxi/board.c
> > +++ b/board/sunxi/board.c
> > @@ -774,9 +774,12 @@ static void setup_environment(const void *fdt)
> >  {
> >  	char serial_string[17] = { 0 };
> >  	unsigned int sid[4];
> > +#if defined CONFIG_CMD_NET
> >  	uint8_t mac_addr[6];
> >  	char ethaddr[16];
> > -	int i, ret;
> > +	int i;
> > +#endif
> > +	int ret;
> >  
> >  	ret = sunxi_get_sid(sid);
> >  	if (ret == 0 && sid[0] != 0) {
> > @@ -801,6 +804,7 @@ static void setup_environment(const void *fdt)
> >  		if ((sid[3] & 0xffffff) == 0)
> >  			sid[3] |= 0x800000;
> >  
> > +#if defined CONFIG_CMD_NET
> >  		for (i = 0; i < 4; i++) {
> >  			sprintf(ethaddr, "ethernet%d", i);
> >  			if (!fdt_get_alias(fdt, ethaddr))
> > @@ -824,6 +828,7 @@ static void setup_environment(const void *fdt)
> >  
> >  			eth_env_set_enetaddr(ethaddr, mac_addr);
> >  		}
> > +#endif
> >  
> >  		if (!env_get("serial#")) {
> >  			snprintf(serial_string, sizeof(serial_string),
> 
> This patch is not needed anymore. We had a similar one also in 2018.03, but
> after 2019.01 upgrade it wasn't needed. It was fixed in Apr-2018:
> 9925f1dbc38c:
> net: Move enetaddr env access code to env config instead of net config

Indeed. I just tested with all my boards, and it's not necessary anymore.

The other one still is though.

thanks,
  o.

> Tomas

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

* [U-Boot] [PATCH 4/4] power: axp818: Fix typo in axp_set_dldo
  2019-02-09 13:39 ` [U-Boot] [PATCH 4/4] power: axp818: Fix typo in axp_set_dldo megous at megous.com
@ 2019-02-13 17:01   ` Jagan Teki
  0 siblings, 0 replies; 11+ messages in thread
From: Jagan Teki @ 2019-02-13 17:01 UTC (permalink / raw)
  To: u-boot

On Sat, Feb 9, 2019 at 7:59 PM <megous@megous.com> wrote:
>

Add commit message, it look some fix of using DLDO1 instead of ELDO1

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

* [U-Boot] [PATCH 2/4] sunxi: Fix build when CONFIG_CMD_PXE or CONFIG_CMD_DHCP are disabled
  2019-02-09 13:39 ` [U-Boot] [PATCH 2/4] sunxi: Fix build when CONFIG_CMD_PXE or CONFIG_CMD_DHCP are disabled megous at megous.com
@ 2019-02-13 17:01   ` Jagan Teki
  0 siblings, 0 replies; 11+ messages in thread
From: Jagan Teki @ 2019-02-13 17:01 UTC (permalink / raw)
  To: u-boot

On Sat, Feb 9, 2019 at 7:14 PM <megous@megous.com> wrote:
>
> From: Ondrej Jirman <megous@megous.com>
>

Commit message please.

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

* [U-Boot] [PATCH 3/4] lib: decode_timing_property should return -NOENT when proprty is not found
  2019-02-09 13:39 ` [U-Boot] [PATCH 3/4] lib: decode_timing_property should return -NOENT when proprty is not found megous at megous.com
@ 2019-02-19 15:17   ` Simon Glass
  2019-02-19 21:43     ` Ondřej Jirman
  0 siblings, 1 reply; 11+ messages in thread
From: Simon Glass @ 2019-02-19 15:17 UTC (permalink / raw)
  To: u-boot

Hi,

On Sat, 9 Feb 2019 at 06:44, <megous@megous.com> wrote:
>
> From: Ondrej Jirman <megous@megous.com>
>
> Length may be unitialized when fdt_getprop fails.

Not according to the docs:

 * if lenp is non-NULL, *lenp contains the length of the property
 * value (>=0)
 * NULL, on error
 * if lenp is non-NULL, *lenp contains an error code (<0):
 * -FDT_ERR_NOTFOUND, node does not have named property
 * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE
 * tag
 * -FDT_ERR_BADMAGIC,
 * -FDT_ERR_BADVERSION,
 * -FDT_ERR_BADSTATE,
 * -FDT_ERR_BADSTRUCTURE,
 * -FDT_ERR_TRUNCATED, standard meanings

I suspect there might be a bug. Can you provide a few more details?

>
> Signed-off-by: Ondřej Jirman <megous@megous.com>
> ---
>  lib/fdtdec.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/lib/fdtdec.c b/lib/fdtdec.c
> index 18663ce6bd..3510de78e1 100644
> --- a/lib/fdtdec.c
> +++ b/lib/fdtdec.c
> @@ -980,7 +980,7 @@ static int decode_timing_property(const void *blob, int node, const char *name,
>         if (!prop) {
>                 debug("%s: could not find property %s\n",
>                       fdt_get_name(blob, node, NULL), name);
> -               return length;
> +               return -ENOENT;
>         }
>
>         if (length == sizeof(u32)) {
> --
> 2.20.1
>

Regards,
Simon

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

* [U-Boot] [PATCH 3/4] lib: decode_timing_property should return -NOENT when proprty is not found
  2019-02-19 15:17   ` Simon Glass
@ 2019-02-19 21:43     ` Ondřej Jirman
  0 siblings, 0 replies; 11+ messages in thread
From: Ondřej Jirman @ 2019-02-19 21:43 UTC (permalink / raw)
  To: u-boot

Hi,

On Tue, Feb 19, 2019 at 07:17:01AM -0800, Simon Glass wrote:
> Hi,
> 
> On Sat, 9 Feb 2019 at 06:44, <megous@megous.com> wrote:
> >
> > From: Ondrej Jirman <megous@megous.com>
> >
> > Length may be unitialized when fdt_getprop fails.
> 
> Not according to the docs:
> 
>  * if lenp is non-NULL, *lenp contains the length of the property
>  * value (>=0)
>  * NULL, on error
>  * if lenp is non-NULL, *lenp contains an error code (<0):
>  * -FDT_ERR_NOTFOUND, node does not have named property
>  * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE
>  * tag
>  * -FDT_ERR_BADMAGIC,
>  * -FDT_ERR_BADVERSION,
>  * -FDT_ERR_BADSTATE,
>  * -FDT_ERR_BADSTRUCTURE,
>  * -FDT_ERR_TRUNCATED, standard meanings

Ah, you're right.

> I suspect there might be a bug. Can you provide a few more details?

The return value of multiple decode_timing_property() calls is ORed together in
such a way in fdtdec_decode_display_timing() that it's pretty meaningless what
it is for each call, other than that it's < 0.

So you can ignore this patch.

regards,
  o.

> >
> > Signed-off-by: Ondřej Jirman <megous@megous.com>
> > ---
> >  lib/fdtdec.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/lib/fdtdec.c b/lib/fdtdec.c
> > index 18663ce6bd..3510de78e1 100644
> > --- a/lib/fdtdec.c
> > +++ b/lib/fdtdec.c
> > @@ -980,7 +980,7 @@ static int decode_timing_property(const void *blob, int node, const char *name,
> >         if (!prop) {
> >                 debug("%s: could not find property %s\n",
> >                       fdt_get_name(blob, node, NULL), name);
> > -               return length;
> > +               return -ENOENT;
> >         }
> >
> >         if (length == sizeof(u32)) {
> > --
> > 2.20.1
> >
> 
> Regards,
> Simon

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

end of thread, other threads:[~2019-02-19 21:43 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-09 13:39 [U-Boot] [PATCH 0/4] Random small sunxi fixes megous at megous.com
2019-02-09 13:39 ` [U-Boot] [PATCH 1/4] sunxi: Fix build when CONFIG_CMD_NET is disabled megous at megous.com
2019-02-11 12:14   ` Tomas Novotny
2019-02-11 12:41     ` Ondřej Jirman
2019-02-09 13:39 ` [U-Boot] [PATCH 2/4] sunxi: Fix build when CONFIG_CMD_PXE or CONFIG_CMD_DHCP are disabled megous at megous.com
2019-02-13 17:01   ` Jagan Teki
2019-02-09 13:39 ` [U-Boot] [PATCH 3/4] lib: decode_timing_property should return -NOENT when proprty is not found megous at megous.com
2019-02-19 15:17   ` Simon Glass
2019-02-19 21:43     ` Ondřej Jirman
2019-02-09 13:39 ` [U-Boot] [PATCH 4/4] power: axp818: Fix typo in axp_set_dldo megous at megous.com
2019-02-13 17:01   ` Jagan Teki

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