Random small sunxi fixes
Subsystems (3)
cover Random small sunxi fixes
From: Ondrej Jirman <[email protected]>
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(-)
Signature · 1 line
2.20.1
PATCH 1/4 sunxi: Fix build when CONFIG_CMD_NET is disabled
From: Ondrej Jirman <[email protected]>
--- board/sunxi/board.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
board/sunxi/board.c +6 -1
@@ -774,9 +774,12 @@ static void setup_environment(const void *fdt) {char serial_string[17 ] = {0 };unsigned int sid[4 ]; +#if definedCONFIG_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 definedCONFIG_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),
Signature · 1 line
2.20.1
PATCH 1/4 sunxi: Fix build when CONFIG_CMD_NET is disabled
Hi Ondřej,
Quoted 34 lines · megous at megous.com
From: Ondrej Jirman <[email protected]>
Signed-off-by Ondřej Jirman <[email protected]>--- board/sunxi/board.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)board/sunxi/board.c +5
-1@@ -774,9 +774,12 @@ static void setup_environment(const void *fdt) {char serial_string[17 ] = {0 };unsigned int sid[4 ]; +#if definedCONFIG_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 definedCONFIG_CMD_NET for (i =0 ; i <4 ; i++) {sprintf (ethaddr,"ethernet%d" , i);if (!fdt_get_alias (fdt, ethaddr))
board/sunxi/board.c static void setup_environment(const void *fdt) · line 834
Quoted 7 lines
board/sunxi/board.c +1
-0@@ -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
PATCH 1/4 sunxi: Fix build when CONFIG_CMD_NET is disabled
Hi Tomas,
Quoted 43 lines · Tomas Novotny
Hi Ondřej,
Quoted 39 lines · megous at megous.com
From: Ondrej Jirman <[email protected]>
Signed-off-by Ondřej Jirman <[email protected]>--- board/sunxi/board.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)board/sunxi/board.c +6
-1@@ -774,9 +774,12 @@ static void setup_environment(const void *fdt) {char serial_string[17 ] = {0 };unsigned int sid[4 ]; +#if definedCONFIG_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 definedCONFIG_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
Quoted 7 lines
board/sunxi/board.c static void setup_environment(const void *fdt) · line 834
Quoted 2 lines
board/sunxi/board.c +0
-0if (!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.
Quoted 1 line
Tomas
PATCH 2/4 sunxi: Fix build when CONFIG_CMD_PXE or CONFIG_CMD_DHCP are disabled
In reply to megous at megous.comFrom: Ondrej Jirman <[email protected]>
--- include/configs/sunxi-common.h | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-)
include/configs/sunxi-common.h +14 -2
@@ -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 \
Signature · 1 line
2.20.1
PATCH 2/4 sunxi: Fix build when CONFIG_CMD_PXE or CONFIG_CMD_DHCP are disabled
Quoted 3 lines · On Sat, Feb 9, 2019 at 7:14 PM <[email protected]> wrote:
From: Ondrej Jirman <[email protected]>
Commit message please.
PATCH 3/4 lib: decode_timing_property should return -NOENT when proprty is not found
In reply to megous at megous.comFrom: Ondrej Jirman <[email protected]>
Length may be unitialized when fdt_getprop fails.
--- lib/fdtdec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
lib/fdtdec.c +1 -1
@@ -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)) {
Signature · 1 line
2.20.1
PATCH 3/4 lib: decode_timing_property should return -NOENT when proprty is not found
Hi,
Quoted 4 lines · On Sat, 9 Feb 2019 at 06:44, <[email protected]> wrote:
From: Ondrej Jirman <[email protected]>
Length may be unitialized when
fdt_getpropfails.
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?
Quoted 20 lines
Signed-off-by Ondřej Jirman <[email protected]>--- lib/fdtdec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)lib/fdtdec.c +1
-2@@ -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)) { --
Quoted 2 lines
2.20.1
Regards,
Simon
PATCH 3/4 lib: decode_timing_property should return -NOENT when proprty is not found
Hi,
Quoted 10 lines · Simon Glass
Hi,
Quoted 4 lines · On Sat, 9 Feb 2019 at 06:44, <[email protected]> wrote:
From: Ondrej Jirman <[email protected]>
Length may be unitialized when
fdt_getpropfails.Not according to the docs:
Quoted 12 lines
* 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 toFDT_BEGIN_NODE
* tag
* -FDT_ERR_BADMAGIC,
* -FDT_ERR_BADVERSION,
* -FDT_ERR_BADSTATE,
* -FDT_ERR_BADSTRUCTURE,
* -FDT_ERR_TRUNCATED, standard meanings
Ah, you're right.
Quoted 1 line
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.
Quoted 25 lines
Quoted 20 lines
Signed-off-by Ondřej Jirman <[email protected]>--- lib/fdtdec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)lib/fdtdec.c +1
-2@@ -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)) { --Quoted 2 lines
2.20.1
Regards,
Simon
PATCH 4/4 power: axp818: Fix typo in axp_set_dldo
In reply to megous at megous.comFrom: Ondrej Jirman <[email protected]>
--- drivers/power/axp818.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/power/axp818.c +1 -1
@@ -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;
Signature · 1 line
2.20.1
PATCH 4/4 power: axp818: Fix typo in axp_set_dldo
Quoted 1 line · On Sat, Feb 9, 2019 at 7:59 PM <[email protected]> wrote:
Add commit message, it look some fix of using DLDO1 instead of ELDO1