fix and update LP-8x4x to boot DTS kernel
cover fix and update LP-8x4x to boot DTS kernel
Linux kernel maintainers require new machnines to support device tree boot. The config for LP-8x4x needs updating.
In addition, there are a few fixes to board's configuration.
Sergei Ianovich (4):
ARM: pxa: prevent PXA270 occasional reboot freezes
arm: pxa: always init ethaddr for LP-8x4x
arm: pxa: fix 2nd flash chip address on LP-8x4x
arm: pxa: update LP-8x4x to boot DTS kernel
arch/arm/cpu/pxa/pxa2xx.c | 2 +- board/icpdas/lp8x4x/lp8x4x.c | 8 ++++++++ include/configs/lp8x4x.h | 12 ++++++------ 3 files changed, 15 insertions(+), 7 deletions(-)
Signature · 1 line
1.8.4.2
PATCH 1/4 ARM: pxa: prevent PXA270 occasional reboot freezes
Erratum 71 of PXA270M Processor Family Specification Update (April 19, 2010) explains that watchdog reset time is just 8us insead of 10ms in EMTS.
If SDRAM is not reset, it causes memory bus congestion and the device hangs.
We put SDRAM in selfresh mode before watchdog reset, removing potential freezes.
--- arch/arm/cpu/pxa/pxa2xx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/cpu/pxa/pxa2xx.c +1 -1
@@ -281,5 +281,5 @@ void reset_cpu(ulong ignored)writel (tmp,OSMR3 );for (;;) - ; +writel (MDREFR_SLFRSH ,MDREFR ); }
Signature · 1 line
1.8.4.2
PATCH 1/4 ARM: pxa: prevent PXA270 occasional reboot freezes
Quoted 20 lines · Sergei Ianovich
Erratum 71 of PXA270M Processor Family Specification Update (April 19, 2010) explains that watchdog reset time is just 8us insead of 10ms in EMTS.
If SDRAM is not reset, it causes memory bus congestion and the device hangs.
We put SDRAM in selfresh mode before watchdog reset, removing potential freezes.
Signed-off-by Sergei Ianovich <[email protected]>--- arch/arm/cpu/pxa/pxa2xx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/arm/cpu/pxa/pxa2xx.c +0
-0
arch/arm/cpu/pxa/pxa2xx.c void reset_cpu(ulong ignored) · line 284
Quoted 5 lines
arch/arm/cpu/pxa/pxa2xx.c +1
-1@@ -281,5 +281,5 @@ void reset_cpu(ulong ignored)writel (tmp,OSMR3 );for (;;) - ; +writel (MDREFR_SLFRSH ,MDREFR );
Do you need to write this register in an endless loop ?
arch/arm/cpu/pxa/pxa2xx.c void reset_cpu(ulong ignored) · line 285
Quoted 1 line
arch/arm/cpu/pxa/pxa2xx.c +0
-0}
Best regards,
Marek Vasut
PATCH 1/4 ARM: pxa: prevent PXA270 occasional reboot freezes
Quoted 23 lines · Marek Vasut
Quoted 22 lines · Sergei Ianovich
Erratum 71 of PXA270M Processor Family Specification Update (April 19, 2010) explains that watchdog reset time is just 8us insead of 10ms in EMTS.
If SDRAM is not reset, it causes memory bus congestion and the device hangs.
We put SDRAM in selfresh mode before watchdog reset, removing potential freezes.
Signed-off-by Sergei Ianovich <[email protected]>--- arch/arm/cpu/pxa/pxa2xx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/arm/cpu/pxa/pxa2xx.c +0
-0@@ -281,5 +281,5 @@ void reset_cpu(ulong ignored)writel (tmp,OSMR3 );
Quoted 5 lines
arch/arm/cpu/pxa/pxa2xx.c void reset_cpu(ulong ignored) · line 284
Quoted 3 lines
arch/arm/cpu/pxa/pxa2xx.c +1
-1for (;;) - ; +writel (MDREFR_SLFRSH ,MDREFR );Do you need to write this register in an endless loop ?
I didn't think this way. We need to have at least 3, but up to 5 cycles to put SDRAM in SLFRFRSH. It depends on the current state of SDRAM. There is no way to know.
It can probably work if we write just once. But if we have another thread doing something with SDRAM in between, we will still hang. I am not sure how likely is the situation, though.
PATCH 1/4 ARM: pxa: prevent PXA270 occasional reboot freezes
Quoted 28 lines · Sergei Ianovich
Quoted 27 lines · Marek Vasut
Quoted 26 lines · Sergei Ianovich
Erratum 71 of PXA270M Processor Family Specification Update (April 19, 2010) explains that watchdog reset time is just 8us insead of 10ms in EMTS.
If SDRAM is not reset, it causes memory bus congestion and the device hangs.
We put SDRAM in selfresh mode before watchdog reset, removing potential freezes.
Signed-off-by Sergei Ianovich <[email protected]>---
arch/arm/cpu/pxa/pxa2xx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/arm/cpu/pxa/pxa2xx.c +0
-0@@ -281,5 +281,5 @@ void reset_cpu(ulong ignored)writel (tmp,OSMR3 );for (;;)
Quoted 8 lines
Quoted 4 lines
arch/arm/cpu/pxa/pxa2xx.c void reset_cpu(ulong ignored) · line 284
Quoted 2 lines
arch/arm/cpu/pxa/pxa2xx.c +1
-1- ; +writel (MDREFR_SLFRSH ,MDREFR );Do you need to write this register in an endless loop ?
I didn't think this way. We need to have at least 3, but up to 5 cycles to put SDRAM in SLFRFRSH. It depends on the current state of SDRAM. There is no way to know.
OK, I seem to remember the uglinesses of the PXA DRAM controller, indeed :(
Quoted 2 lines
It can probably work if we write just once. But if we have another thread doing something with SDRAM in between, we will still hang.
U-Boot is single-threaded ;-)
Quoted 1 line
I am not sure how likely is the situation, though.
It cannot happen, really ;-)
BUT (!) I understand your intention. If writing the MDREFR multiple times won't be a problem, I am _not_ opposed to this patch. So please only make sure that's not a problem and if it's not, I won't block this patch.
Thank you very much for your efforts on the PXA front !
Best regards,
Marek Vasut
PATCH 1/4 ARM: pxa: prevent PXA270 occasional reboot freezes
Quoted 15 lines · Marek Vasut
Quoted 6 lines · Sergei Ianovich
Quoted 1 line · Marek Vasut
Do you need to write this register in an endless loop ?
I didn't think this way. We need to have at least 3, but up to 5 cycles to put SDRAM in SLFRFRSH. It depends on the current state of SDRAM. There is no way to know.
OK, I seem to remember the uglinesses of the PXA DRAM controller, indeed :(
Quoted 2 lines
It can probably work if we write just once. But if we have another thread doing something with SDRAM in between, we will still hang.
U-Boot is single-threaded ;-)
Quoted 7 lines
Quoted 1 line
I am not sure how likely is the situation, though.
It cannot happen, really ;-)
BUT (!) I understand your intention. If writing the MDREFR multiple times won't be a problem, I am _not_ opposed to this patch. So please only make sure that's not a problem and if it's not, I won't block this patch.
The relevant doc is [1, section 6.1.5.4]. Refresh rules are rather complex. However, clearing DRI and repeatedly writing to MDREFR should refresh. The refreshes should advance SDRAM state machine to "Self-refresh and Clock-stop". This is what we are trying to achieve.
I've run close to 1000 reboot of patched linux kernel. This mean several billions writes to MDREFR. If a write can cause a problem, it should have already shown up. So I think it is not a problem.
Nevertheless, I've put a patched U-Boot with a single write to MDREFR to test (reset every 2 sec). After several hours, it will be clear, if a single write works. Let's do it the right way.
1. http://www.marvell.com/application-processors/pxa-family/assets/pxa_27x_dev_man.pdf
PATCH 1/4 ARM: pxa: prevent PXA270 occasional reboot freezes
Quoted 26 lines · Sergei Ianovich
Quoted 16 lines · Marek Vasut
Quoted 6 lines · Sergei Ianovich
Quoted 1 line · Marek Vasut
Do you need to write this register in an endless loop ?
I didn't think this way. We need to have at least 3, but up to 5 cycles to put SDRAM in SLFRFRSH. It depends on the current state of SDRAM. There is no way to know.
OK, I seem to remember the uglinesses of the PXA DRAM controller, indeed :(
Quoted 2 lines
It can probably work if we write just once. But if we have another thread doing something with SDRAM in between, we will still hang.
U-Boot is single-threaded ;-)
Quoted 8 lines
Quoted 1 line
I am not sure how likely is the situation, though.
It cannot happen, really ;-)
BUT (!) I understand your intention. If writing the MDREFR multiple times won't be a problem, I am _not_ opposed to this patch. So please only make sure that's not a problem and if it's not, I won't block this patch.
Quoted 8 lines
The relevant doc is [1, section 6.1.5.4]. Refresh rules are rather complex. However, clearing DRI and repeatedly writing to MDREFR should refresh. The refreshes should advance SDRAM state machine to "Self-refresh and Clock-stop". This is what we are trying to achieve.
I've run close to 1000 reboot of patched linux kernel. This mean several billions writes to MDREFR. If a write can cause a problem, it should have already shown up. So I think it is not a problem.
I saw this kernel patch, yes.
Quoted 3 lines
Nevertheless, I've put a patched U-Boot with a single write to MDREFR to test (reset every 2 sec). After several hours, it will be clear, if a single write works. Let's do it the right way.
Thank you !
Quoted 3 lines
1.
http://www.marvell.com/application-processors/pxa-family/assets/pxa_27x_de
v_man.pdf
Best regards,
Marek Vasut
PATCH 1/4 ARM: pxa: prevent PXA270 occasional reboot freezes
Quoted 5 lines · Marek Vasut
Quoted 3 lines · Sergei Ianovich
Nevertheless, I've put a patched U-Boot with a single write to MDREFR to test (reset every 2 sec). After several hours, it will be clear, if a single write works. Let's do it the right way.
It works with a single write. I'll post v2 to the series.
Thanks for constructive reviewing.
PATCH 1/4 ARM: pxa: prevent PXA270 occasional reboot freezes
Quoted 9 lines · Sergei Ianovich
Quoted 4 lines · Marek Vasut
Quoted 3 lines · Sergei Ianovich
Nevertheless, I've put a patched U-Boot with a single write to MDREFR to test (reset every 2 sec). After several hours, it will be clear, if a single write works. Let's do it the right way.
It works with a single write. I'll post v2 to the series.
Thanks for constructive reviewing.
No, thank _you_ for the efforts!
Best regards,
Marek Vasut
PATCH 2/4 arm: pxa: always init ethaddr for LP-8x4x
In reply to Sergei IanovichI always used tftp in my test, so the first dm9000 on LP-8x4x was always properly initialized. However, if the boot doesn't include network related commands, linux will not find a valid MAC and will complain.
No longer.
--- board/icpdas/lp8x4x/lp8x4x.c | 8 ++++++++ 1 file changed, 8 insertions(+)
board/icpdas/lp8x4x/lp8x4x.c +8 -0
@@ -112,10 +112,18 @@ void usb_board_stop(void)#ifdef CONFIG_DRIVER_DM9000 void lp8x4x_eth1_mac_init (void ) { +u8 ethaddr[8 ];u8 eth1addr[8 ];int i;u8 reg; +eth_getenv_enetaddr_by_index ("eth" ,0 , ethaddr); +if (is_valid_ether_addr (ethaddr)) { +for (i =0 , reg =0x10 ; i <6 ; i++, reg++) { +writeb (reg, (u8 *)(DM9000_IO )); +writeb (ethaddr[i], (u8 *)(DM9000_DATA )); + } + }eth_getenv_enetaddr_by_index ("eth" ,1 , eth1addr);if (!is_valid_ether_addr (eth1addr))return ;
Signature · 1 line
1.8.4.2
PATCH 2/4 arm: pxa: always init ethaddr for LP-8x4x
Quoted 25 lines · Sergei Ianovich
I always used tftp in my test, so the first dm9000 on LP-8x4x was always properly initialized. However, if the boot doesn't include network related commands, linux will not find a valid MAC and will complain.
No longer.
Signed-off-by Sergei Ianovich <[email protected]>--- board/icpdas/lp8x4x/lp8x4x.c | 8 ++++++++ 1 file changed, 8 insertions(+)board/icpdas/lp8x4x/lp8x4x.c +1
-0@@ -112,10 +112,18 @@ void usb_board_stop(void)#ifdef CONFIG_DRIVER_DM9000 void lp8x4x_eth1_mac_init (void ) { +u8 ethaddr[8 ];u8 eth1addr[8 ];int i;u8 reg;
board/icpdas/lp8x4x/lp8x4x.c void usb_board_stop(void) · line 129
Quoted 10 lines
board/icpdas/lp8x4x/lp8x4x.c +7
-0+eth_getenv_enetaddr_by_index ("eth" ,0 , ethaddr); +if (is_valid_ether_addr (ethaddr)) { +for (i =0 , reg =0x10 ; i <6 ; i++, reg++) { +writeb (reg, (u8 *)(DM9000_IO )); +writeb (ethaddr[i], (u8 *)(DM9000_DATA )); + } + }eth_getenv_enetaddr_by_index ("eth" ,1 , eth1addr);if (!is_valid_ether_addr (eth1addr))return ;
Please pass the ethernet address via DT, will that not work for you ?
Best regards,
Marek Vasut
PATCH 2/4 arm: pxa: always init ethaddr for LP-8x4x
Quoted 7 lines · Marek Vasut
Quoted 5 lines · Sergei Ianovich
I always used tftp in my test, so the first dm9000 on LP-8x4x was always properly initialized. However, if the boot doesn't include network related commands, linux will not find a valid MAC and will complain.
Please pass the ethernet address via DT, will that not work for you ?
This will require a custom dtb object for every device recompiled every time kernel is upgraded. The current way is to set once per device in U-Boot environment variable, which doesn't need to change if kernel changes.
I strongly believe the current way is easier.
PATCH 2/4 arm: pxa: always init ethaddr for LP-8x4x
Quoted 7 lines · Sergei Ianovich
Quoted 6 lines · Marek Vasut
Quoted 4 lines · Sergei Ianovich
I always used tftp in my test, so the first dm9000 on LP-8x4x was always properly initialized. However, if the boot doesn't include network related commands, linux will not find a valid MAC and will complain.
Quoted 8 lines
Quoted 1 line
Please pass the ethernet address via DT, will that not work for you ?
This will require a custom dtb object for every device recompiled every time kernel is upgraded. The current way is to set once per device in U-Boot environment variable, which doesn't need to change if kernel changes.
I strongly believe the current way is easier.
I disagree :)
IF you set 'ethaddr' variable in U-Boot THEN
U-Boot will patch this 'ethaddr' value into your DT. The /aliases/ethernet0 node will be augmented with a new property 'local-mac-address', which will contain the MAC address from 'ethaddr' . The kernel will use this as the MAC address for that particular ethernet interface afterwards.
NOTE: It is very important to have the alias set, it has to point to your ethernet device. A good example in Linux's arch/arm/boot/dts/imx28.dtsi, which even has two ethernet interfaces. Notice each of them has an alias.
NOTE: If you have two interfaces, then 'eth1addr' is patches into /aliases/ethernet1 etc.
The only problem here is the non-DT kernel. Do you need to support that? Is there no other way to pass MAC address of an ethernet interface to Linux but programming it into the ethernet interface itself ?
Best regards,
Marek Vasut
PATCH 2/4 arm: pxa: always init ethaddr for LP-8x4x
Quoted 11 lines · Marek Vasut
Quoted 1 line · Sergei Ianovich
I strongly believe the current way is easier.
I disagree :)
IF you set 'ethaddr' variable in U-Boot THEN
U-Boot will patch this 'ethaddr' value into your DT. The /aliases/ethernet0 node will be augmented with a new property 'local-mac-address', which will contain the MAC address from 'ethaddr' . The kernel will use this as the MAC address for that particular ethernet interface afterwards.
Quoted 5 lines
NOTE: It is very important to have the alias set, it has to point to your ethernet device. A good example in Linux's
arch/arm/boot/dts/imx28.dtsi, which even has two ethernet interfaces. Notice each of them has an alias.
NOTE: If you have two interfaces, then 'eth1addr' is patches into /aliases/ethernet1 etc.
Thanks for explaining. It works. This is COOL!
Quoted 3 lines
The only problem here is the non-DT kernel. Do you need to support that? Is there no other way to pass MAC address of an ethernet interface to Linux but programming it into the ethernet interface itself ?
Hardware vendor uses U-Boot environment values to init MAC-addresses. I think it is even worse than what I was doing in the patch.
I don't think we need to support non-DT kernel. So we drop the patch.
PATCH 2/4 arm: pxa: always init ethaddr for LP-8x4x
Quoted 14 lines · Sergei Ianovich
Quoted 13 lines · Marek Vasut
Quoted 1 line · Sergei Ianovich
I strongly believe the current way is easier.
I disagree :)
IF you set 'ethaddr' variable in U-Boot THEN
U-Boot will patch this 'ethaddr' value into your DT. The /aliases/ethernet0 node will be augmented with a new property 'local-mac-address', which will contain the MAC address from 'ethaddr' . The kernel will use this as the MAC address for that particular ethernet interface afterwards.
Quoted 7 lines
Quoted 5 lines
NOTE: It is very important to have the alias set, it has to point to your ethernet device. A good example in Linux's
arch/arm/boot/dts/imx28.dtsi, which even has two ethernet interfaces. Notice each of them has an alias. NOTE: If you have two interfaces, then 'eth1addr' is patches into /aliases/ethernet1 etc.Thanks for explaining. It works. This is COOL!
Glad it helps :)
Quoted 9 lines
Quoted 3 lines
The only problem here is the non-DT kernel. Do you need to support that? Is there no other way to pass MAC address of an ethernet interface to Linux but programming it into the ethernet interface itself ?
Hardware vendor uses U-Boot environment values to init MAC-addresses. I think it is even worse than what I was doing in the patch.
I don't think we need to support non-DT kernel. So we drop the patch.
OK, that's nice :)
Best regards,
Marek Vasut
PATCH 2/4 arm: pxa: always init ethaddr for LP-8x4x
Quoted 4 lines · Marek Vasut
Quoted 2 lines
I don't think we need to support non-DT kernel. So we drop the patch.
OK, that's nice :)
It may even make sense to remove the code that initializes eth1, right?
PATCH 2/4 arm: pxa: always init ethaddr for LP-8x4x
Quoted 7 lines · Sergei Ianovich
Quoted 4 lines · Marek Vasut
Quoted 2 lines
I don't think we need to support non-DT kernel. So we drop the patch.
OK, that's nice :)
It may even make sense to remove the code that initializes eth1, right?
Which code?
Best regards,
Marek Vasut
PATCH 2/4 arm: pxa: always init ethaddr for LP-8x4x
Quoted 4 lines · Marek Vasut
Quoted 1 line · Sergei Ianovich
It may even make sense to remove the code that initializes eth1, right?
Which code?
I mean:
lp8x4x_eth1_mac_init() in board/icpdas/lp8x4x/lp8x4x.c
and its invocation in board_eth_init()
PATCH 2/4 arm: pxa: always init ethaddr for LP-8x4x
Quoted 11 lines · Sergei Ianovich
Quoted 4 lines · Marek Vasut
Quoted 1 line · Sergei Ianovich
It may even make sense to remove the code that initializes eth1, right?
Which code?
I mean:
lp8x4x_eth1_mac_init()inboard/icpdas/lp8x4x/lp8x4x.cand its invocation in
board_eth_init()
Heh, yes. The DT will solve it through the ethernet1 alias, just set the eth1addr and test it to make sure please.
Best regards,
Marek Vasut
PATCH 2/4 arm: pxa: always init ethaddr for LP-8x4x
Quoted 2 lines · Marek Vasut
Heh, yes. The DT will solve it through the ethernet1 alias, just set the eth1addr and test it to make sure please.
It works. I've updated the dts in kernel for next version of patch series.
I will update this patch for v2.
PATCH 3/4 arm: pxa: fix 2nd flash chip address on LP-8x4x
In reply to Sergei IanovichInitial configuration has worng address of the second chip. There is an alias for the 1st chip at 0x02000000 in earlier verions of LP-8x4x, so the boot normally.
However, new LP-8x4xs have a bigger 1st flash chip, and hang on boot without this patch.
--- include/configs/lp8x4x.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/configs/lp8x4x.h +1 -1
@@ -150,7 +150,7 @@#define CONFIG_ENV_SECT_SIZE 0x40000#define PHYS_FLASH_1 0x00000000/* Flash Bank #1 */ -#define PHYS_FLASH_2 0x02000000/* Flash Bank #2 */ +#define PHYS_FLASH_2 0x04000000/* Flash Bank #2 */ #define CONFIG_SYS_FLASH_CFI #define CONFIG_FLASH_CFI_DRIVER 1
Signature · 1 line
1.8.4.2
PATCH 4/4 arm: pxa: update LP-8x4x to boot DTS kernel
In reply to Sergei IanovichThe device has only 256 kiB for U-Boot binary.
Binary size exceeds 256 kiB after activating CONFIG_OF_LIBFDT, so we disable USB support which was not working anyway.
Disabled USD frees more space than libfdt requires, so activate long command line help.
--- include/configs/lp8x4x.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
include/configs/lp8x4x.h +5 -5
@@ -20,18 +20,18 @@#define CONFIG_SYS_MALLOC_LEN (128*1024)#define CONFIG_ARCH_CPU_INIT #define CONFIG_BOOTCOMMAND \ - "bootm 80000;" + "bootm 80000 - 240000;"#define CONFIG_BOOTARGS \ "console=ttySA0,115200 mem=128M root=/dev/mmcblk0p1 rw" \ - "init=/sbin/init rootfstype=ext3" + "init=/sbin/init rootfstype=ext4 rootwait"#define CONFIG_TIMESTAMP #define CONFIG_BOOTDELAY 2/* Autoboot delay */ #define CONFIG_CMDLINE_TAG #define CONFIG_SETUP_MEMORY_TAGS #define CONFIG_LZMA /* LZMA compression support */ -#undef CONFIG_OF_LIBFDT +#define CONFIG_OF_LIBFDT /* * Serial Console Configuration
@@ -50,7 +50,7 @@#define CONFIG_CMD_ENV #undef CONFIG_CMD_IMLS#define CONFIG_CMD_MMC -#define CONFIG_CMD_USB +#undef CONFIG_CMD_USB#undef CONFIG_LCD#undef CONFIG_CMD_IDE
@@ -101,7 +101,7 @@*/ #define CONFIG_SYS_HUSH_PARSER 1 -#undef CONFIG_SYS_LONGHELP +#define CONFIG_SYS_LONGHELP #ifdef CONFIG_SYS_HUSH_PARSER #define CONFIG_SYS_PROMPT "$ "#else
Signature · 1 line
1.8.4.2
PATCH 4/4 arm: pxa: update LP-8x4x to boot DTS kernel
Quoted 9 lines · Sergei Ianovich
The device has only 256 kiB for U-Boot binary.
Binary size exceeds 256 kiB after activating
CONFIG_OF_LIBFDT, so we disable USB support which was not working anyway.Disabled USD frees more space than libfdt requires, so activate long command line help.
Signed-off-by Sergei Ianovich <[email protected]>
Is this device not running from DRAM, which has about infinite (in the context of U-Boot) size ?
Quoted 40 lines
--- include/configs/lp8x4x.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)include/configs/lp8x4x.h +4
-4@@ -20,18 +20,18 @@#define CONFIG_SYS_MALLOC_LEN (128*1024)#define CONFIG_ARCH_CPU_INIT #define CONFIG_BOOTCOMMAND \ - "bootm 80000;" + "bootm 80000 - 240000;"#define CONFIG_BOOTARGS \ "console=ttySA0,115200 mem=128M root=/dev/mmcblk0p1 rw" \ - "init=/sbin/init rootfstype=ext3" + "init=/sbin/init rootfstype=ext4 rootwait"#define CONFIG_TIMESTAMP #define CONFIG_BOOTDELAY 2/* Autoboot delay */ #define CONFIG_CMDLINE_TAG #define CONFIG_SETUP_MEMORY_TAGS #define CONFIG_LZMA /* LZMA compression support */ -#undef CONFIG_OF_LIBFDT +#define CONFIG_OF_LIBFDT /* * Serial Console Configuration @@ -50,7 +50,7 @@#define CONFIG_CMD_ENV #undef CONFIG_CMD_IMLS#define CONFIG_CMD_MMC -#define CONFIG_CMD_USB +#undef CONFIG_CMD_USB#undef CONFIG_LCD#undef CONFIG_CMD_IDE
include/configs/lp8x4x.h line 107
Quoted 8 lines
include/configs/lp8x4x.h +1
-1@@ -101,7 +101,7 @@*/ #define CONFIG_SYS_HUSH_PARSER 1 -#undef CONFIG_SYS_LONGHELP +#define CONFIG_SYS_LONGHELP #ifdef CONFIG_SYS_HUSH_PARSER #define CONFIG_SYS_PROMPT "$ "#else
Best regards,
Marek Vasut
PATCH 4/4 arm: pxa: update LP-8x4x to boot DTS kernel
Quoted 6 lines · Marek Vasut
Quoted 5 lines · Sergei Ianovich
The device has only 256 kiB for U-Boot binary.
Binary size exceeds 256 kiB after activating
CONFIG_OF_LIBFDT, so we disable USB support which was not working anyway.
Quoted 7 lines
Quoted 4 lines
Disabled USD frees more space than libfdt requires, so activate long command line help.
Signed-off-by Sergei Ianovich <[email protected]>Is this device not running from DRAM, which has about infinite (in the context of U-Boot) size ?
Factory flash partition layout is just 256 kiB for the U-Boot. I am not associated with the producer, so I cannot fix this.
PATCH 4/4 arm: pxa: update LP-8x4x to boot DTS kernel
Quoted 10 lines · Sergei Ianovich
Quoted 9 lines · Marek Vasut
Quoted 8 lines · Sergei Ianovich
The device has only 256 kiB for U-Boot binary.
Binary size exceeds 256 kiB after activating
CONFIG_OF_LIBFDT, so we disable USB support which was not working anyway.Disabled USD frees more space than libfdt requires, so activate long command line help.
Quoted 7 lines
Quoted 4 lines
Quoted 1 line
Signed-off-by Sergei Ianovich <[email protected]>Is this device not running from DRAM, which has about infinite (in the context of U-Boot) size ?
Factory flash partition layout is just 256 kiB for the U-Boot. I am not associated with the producer, so I cannot fix this.
I see, understood. I won't bug you here, but you _might_ want to investigate if the U-Boot can't be for example compiled using THUMB instruction set and thus shrink it in size. But that'd be a long shot :)
Best regards,
Marek Vasut
PATCH 4/4 arm: pxa: update LP-8x4x to boot DTS kernel
Quoted 7 lines · Marek Vasut
Quoted 2 lines · Sergei Ianovich
Factory flash partition layout is just 256 kiB for the U-Boot. I am not associated with the producer, so I cannot fix this.
I see, understood. I won't bug you here, but you _might_ want to investigate if the U-Boot can't be for example compiled using THUMB instruction set and thus shrink it in size. But that'd be a long shot :)
After a clean rebuild, U-Boot with both OF_LIBFDT and CMD_USB, but without SYS_LONGHELP is under 256 kiB. I won't disable USB. Instead, I'll try to make it actually work.
Thanks for constructive reviewing.
PATCH 4/4 arm: pxa: update LP-8x4x to boot DTS kernel
Quoted 9 lines · Sergei Ianovich
Quoted 7 lines · Marek Vasut
Quoted 2 lines · Sergei Ianovich
Factory flash partition layout is just 256 kiB for the U-Boot. I am not associated with the producer, so I cannot fix this.
I see, understood. I won't bug you here, but you _might_ want to investigate if the U-Boot can't be for example compiled using THUMB instruction set and thus shrink it in size. But that'd be a long shot :)
Quoted 5 lines
After a clean rebuild, U-Boot with both
OF_LIBFDTandCMD_USB, but withoutSYS_LONGHELPis under 256 kiB. I won't disable USB. Instead, I'll try to make it actually work.Thanks for constructive reviewing.
Again, thank you for the effort! :)
Best regards,
Marek Vasut
PATCH 4/4 arm: pxa: update LP-8x4x to boot DTS kernel
Quoted 4 lines · Marek Vasut
Quoted 3 lines · Sergei Ianovich
After a clean rebuild, U-Boot with both
OF_LIBFDTandCMD_USB, but withoutSYS_LONGHELPis under 256 kiB. I won't disable USB. Instead, I'll try to make it actually work.
While testing, I've run into an issue with USB support. If I do
$ usb start
in U-Boot, not only it doesn't see an attached flash storage, but also it break USB in the kernel. If I just boot the kernel from flash or tftp, USB works in the kernel.
I've verified that my usb_board_init() is exactly the same sequence of commands, that the kernel uses to initialize the stack up to usb_add_hcd() at linux/drivers/usb/host/ohci-pxa27x.c:445
I suspect the issue is in U-Boot OHCI PXA driver. Are you aware of any?
It probably makes sense to disable USB at LP-8x4 for now.
PATCH 4/4 arm: pxa: update LP-8x4x to boot DTS kernel
Quoted 6 lines · Sergei Ianovich
Quoted 4 lines · Marek Vasut
Quoted 3 lines · Sergei Ianovich
After a clean rebuild, U-Boot with both
OF_LIBFDTandCMD_USB, but withoutSYS_LONGHELPis under 256 kiB. I won't disable USB. Instead, I'll try to make it actually work.
Quoted 7 lines
While testing, I've run into an issue with USB support. If I do
$ usb startin U-Boot, not only it doesn't see an attached flash storage, but also it break USB in the kernel. If I just boot the kernel from flash or tftp, USB works in the kernel.
The OHCI controller is not properly shut down before booting kernel, that's what I'd check first.
Quoted 5 lines
I've verified that my
usb_board_init()is exactly the same sequence of commands, that the kernel uses to initialize the stack up tousb_add_hcd()atlinux/drivers/usb/host/ohci-pxa27x.c:445I suspect the issue is in U-Boot OHCI PXA driver. Are you aware of any?
No, not really. I didn't use the OHCI stuff for a while.
Quoted 1 line
It probably makes sense to disable USB at LP-8x4 for now.
Can you maybe try debugging it please ?
Best regards,
Marek Vasut
PATCH 4/4 arm: pxa: update LP-8x4x to boot DTS kernel
Quoted 11 lines · Marek Vasut
Quoted 7 lines · Sergei Ianovich
While testing, I've run into an issue with USB support. If I do
$ usb startin U-Boot, not only it doesn't see an attached flash storage, but also it break USB in the kernel. If I just boot the kernel from flash or tftp, USB works in the kernel.
The OHCI controller is not properly shut down before booting kernel, that's what I'd check first.
Thanks for the tip. That was practically it. USB was started and stopped twice (first by board then by CPU code). The driver is fine.
v2 cover fix and update LP-8x4x to boot DT kernel
In reply to Sergei IanovichLinux kernel maintainers require new machnines to support device tree boot. The config for LP-8x4x needs updating.
In addition, there are a few fixes to board's configuration.
v2 fixes review comments made by Marek Vasut.
Sergei Ianovich (5):
ARM: pxa: prevent PXA270 occasional reboot freezes
arm: pxa: fix LP-8x4x USB support
arm: pxa: fix 2nd flash chip address on LP-8x4x
arm: pxa: update LP-8x4x to boot DT kernel
arm: pxa: init ethaddr for LP-8x4x using DT
arch/arm/cpu/pxa/pxa2xx.c | 1 + board/icpdas/lp8x4x/lp8x4x.c | 39 +++++++++++++-------------------------- include/configs/lp8x4x.h | 15 +++++++-------- 3 files changed, 21 insertions(+), 34 deletions(-)
Signature · 1 line
1.8.5.1
PATCH v2 1/5 ARM: pxa: prevent PXA270 occasional reboot freezes
Erratum 71 of PXA270M Processor Family Specification Update (April 19, 2010) explains that watchdog reset time is just 8us insead of 10ms in EMTS.
If SDRAM is not reset, it causes memory bus congestion and the device hangs.
We put SDRAM in selfresh mode before watchdog reset, removing potential freezes.
---
Changes v1..v2
* write to MDREFR once instead of in a cycle as suggested by Marek Vasut
arch/arm/cpu/pxa/pxa2xx.c | 1 + 1 file changed, 1 insertion(+)
arch/arm/cpu/pxa/pxa2xx.c +1 -0
@@ -279,6 +279,7 @@ void reset_cpu(ulong ignored) tmp =readl (OSCR ); tmp +=0x1000 ;writel (tmp,OSMR3 ); +writel (MDREFR_SLFRSH ,MDREFR );for (;;) ;
Signature · 1 line
1.8.5.1
PATCH v2 2/5 arm: pxa: fix LP-8x4x USB support
In reply to Sergei IanovichUSB was broken initially. Power polarity should be direct.
---
Changes v1..v2
* new patch
board/icpdas/lp8x4x/lp8x4x.c | 22 +++++++++++++--------- include/configs/lp8x4x.h | 3 +-- 2 files changed, 14 insertions(+), 11 deletions(-)
board/icpdas/lp8x4x/lp8x4x.c +13 -9
@@ -60,15 +60,21 @@ int board_mmc_init(bd_t *bis)#ifdef CONFIG_CMD_USB int usb_board_init (void ) { -writel ((UHCHR |UHCHR_PCPL |UHCHR_PSPL ) & - ~(UHCHR_SSEP0 |UHCHR_SSEP1 |UHCHR_SSEP2 |UHCHR_SSE ), -UHCHR ); +writel (readl (CKEN ) |CKEN10_USBHOST ,CKEN ); + +writel (readl (UHCHR ) |UHCHR_FHR ,UHCHR ); +udelay (11 ); +writel (readl (UHCHR ) & ~UHCHR_FHR ,UHCHR );writel (readl (UHCHR ) |UHCHR_FSBIR ,UHCHR );while (readl (UHCHR ) &UHCHR_FSBIR )continue ;/* required by checkpath.pl */ +writel (readl (UHCHR ) & ~UHCHR_SSEP0 ,UHCHR ); +writel (readl (UHCRHDA ) & ~(0x1000 ),UHCRHDA ); +writel (readl (UHCRHDA ) |0x800 ,UHCRHDA ); +writel (readl (UHCHR ) & ~UHCHR_SSE ,UHCHR );writel ((UHCHIE_UPRIE |UHCHIE_RWIE ),UHCHIE );
@@ -82,10 +88,6 @@ int usb_board_init(void)/* Set port power control mask bits, only 3 ports. */ writel (readl (UHCRHDB ) | (0x7 <<17 ),UHCRHDB ); -/* enable port 2 */ -writel (readl (UP2OCR ) |UP2OCR_HXOE |UP2OCR_HXS | -UP2OCR_DMPDE |UP2OCR_DPPDE ,UP2OCR ); -return 0 ; }
@@ -94,7 +96,7 @@ void usb_board_init_fail(void)return ; } -void usb_board_stop (void ) +int usb_board_stop (void ) {writel (readl (UHCHR ) |UHCHR_FHR ,UHCHR );udelay (11 );
@@ -103,9 +105,11 @@ void usb_board_stop(void)writel (readl (UHCCOMS ) |1 ,UHCCOMS );udelay (10 ); +writel (readl (UHCHR ) |UHCHR_SSEP0 |UHCHR_SSE ,UHCHR ); +writel (readl (CKEN ) & ~CKEN10_USBHOST ,CKEN ); - return; + return 0; }#endif
include/configs/lp8x4x.h +1 -2
@@ -190,7 +190,7 @@#define CONFIG_SYS_GAFR1_L_VAL 0x999a955a#define CONFIG_SYS_GAFR1_U_VAL 0xaaa5a00a#define CONFIG_SYS_GAFR2_L_VAL 0xaaaaaaaa -#define CONFIG_SYS_GAFR2_U_VAL 0x55f0a402 +#define CONFIG_SYS_GAFR2_U_VAL 0x55f9a402#define CONFIG_SYS_GAFR3_L_VAL 0x540a950c#define CONFIG_SYS_GAFR3_U_VAL 0x00001599
@@ -238,7 +238,6 @@*/ #ifdef CONFIG_CMD_USB #define CONFIG_USB_OHCI_NEW -#define CONFIG_SYS_USB_OHCI_CPU_INIT #define CONFIG_SYS_USB_OHCI_BOARD_INIT #define CONFIG_SYS_USB_OHCI_MAX_ROOT_PORTS 2#define CONFIG_SYS_USB_OHCI_REGS_BASE 0x4C000000
Signature · 1 line
1.8.5.1
PATCH v2 2/5 arm: pxa: fix LP-8x4x USB support
Quoted 4 lines · Sergei Ianovich
USB was broken initially. Power polarity should be direct.
Signed-off-by Sergei Ianovich <[email protected]>CC Marek Vasut <[email protected]>
I pushed new u-boot-pxa/master, can you please rebase this one patch and repost?
Best regards,
Marek Vasut
PATCH v3 1/1 arm: pxa: fix LP-8x4x USB support
In reply to Sergei Ianovich---
Changes v2..v3
* fixed merge conflict
* added checks for index and init type
Changes v1..v2
* new patch
board/icpdas/lp8x4x/lp8x4x.c | 38 ++++++++++++++++++++++++-------------- include/configs/lp8x4x.h | 3 +-- 2 files changed, 25 insertions(+), 16 deletions(-)
board/icpdas/lp8x4x/lp8x4x.c +24 -14
@@ -61,15 +61,24 @@ int board_mmc_init(bd_t *bis)#ifdef CONFIG_CMD_USB int board_usb_init (int index,enum usb_init_type init) { -writel ((UHCHR |UHCHR_PCPL |UHCHR_PSPL ) & - ~(UHCHR_SSEP0 |UHCHR_SSEP1 |UHCHR_SSEP2 |UHCHR_SSE ), -UHCHR ); +if (index !=0 || init !=USB_INIT_HOST ) +return -1 ; + +writel (readl (CKEN ) |CKEN10_USBHOST ,CKEN ); + +writel (readl (UHCHR ) |UHCHR_FHR ,UHCHR ); +udelay (11 ); +writel (readl (UHCHR ) & ~UHCHR_FHR ,UHCHR );writel (readl (UHCHR ) |UHCHR_FSBIR ,UHCHR );while (readl (UHCHR ) &UHCHR_FSBIR )continue ;/* required by checkpath.pl */ +writel (readl (UHCHR ) & ~UHCHR_SSEP0 ,UHCHR ); +writel (readl (UHCRHDA ) & ~(0x1000 ),UHCRHDA ); +writel (readl (UHCRHDA ) |0x800 ,UHCRHDA ); +writel (readl (UHCHR ) & ~UHCHR_SSE ,UHCHR );writel ((UHCHIE_UPRIE |UHCHIE_RWIE ),UHCHIE );
@@ -83,19 +92,10 @@ int board_usb_init(int index, enum usb_init_type init)/* Set port power control mask bits, only 3 ports. */ writel (readl (UHCRHDB ) | (0x7 <<17 ),UHCRHDB ); -/* enable port 2 */ -writel (readl (UP2OCR ) |UP2OCR_HXOE |UP2OCR_HXS | -UP2OCR_DMPDE |UP2OCR_DPPDE ,UP2OCR ); -return 0 ; } -int board_usb_cleanup (int index,enum usb_init_type init) -{ -return 0 ; -} - -void usb_board_stop (void ) +int usb_board_stop (void ) {writel (readl (UHCHR ) |UHCHR_FHR ,UHCHR );udelay (11 );
@@ -104,9 +104,19 @@ void usb_board_stop(void)writel (readl (UHCCOMS ) |1 ,UHCCOMS );udelay (10 ); +writel (readl (UHCHR ) |UHCHR_SSEP0 |UHCHR_SSE ,UHCHR ); +writel (readl (CKEN ) & ~CKEN10_USBHOST ,CKEN ); - return; + return 0; +} + +int board_usb_cleanup (int index,enum usb_init_type init) +{ +if (index !=0 || init !=USB_INIT_HOST ) +return -1 ; + +return usb_board_stop (); }#endif
include/configs/lp8x4x.h +1 -2
@@ -184,7 +184,7 @@#define CONFIG_SYS_GAFR1_L_VAL 0x999a955a#define CONFIG_SYS_GAFR1_U_VAL 0xaaa5a00a#define CONFIG_SYS_GAFR2_L_VAL 0xaaaaaaaa -#define CONFIG_SYS_GAFR2_U_VAL 0x55f0a402 +#define CONFIG_SYS_GAFR2_U_VAL 0x55f9a402#define CONFIG_SYS_GAFR3_L_VAL 0x540a950c#define CONFIG_SYS_GAFR3_U_VAL 0x00001599
@@ -232,7 +232,6 @@*/ #ifdef CONFIG_CMD_USB #define CONFIG_USB_OHCI_NEW -#define CONFIG_SYS_USB_OHCI_CPU_INIT #define CONFIG_SYS_USB_OHCI_BOARD_INIT #define CONFIG_SYS_USB_OHCI_MAX_ROOT_PORTS 2#define CONFIG_SYS_USB_OHCI_REGS_BASE 0x4C000000
Signature · 1 line
1.8.5.1
Marek Vasut
AppliedPATCH v3 1/1 arm: pxa: fix LP-8x4x USB support
Quoted 2 lines · Sergei Ianovich
Signed-off-by Sergei Ianovich <[email protected]>CC Marek Vasut <[email protected]>
Applied, thanks
Best regards,
Marek Vasut
PATCH v2 3/5 arm: pxa: fix 2nd flash chip address on LP-8x4x
In reply to Sergei IanovichInitial configuration has worng address of the second chip. There is an alias for the 1st chip at 0x02000000 in earlier verions of LP-8x4x, so the boot normally.
However, new LP-8x4xs have a bigger 1st flash chip, and hang on boot without this patch.
---
Changes v1..v2
* no changes
include/configs/lp8x4x.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/configs/lp8x4x.h +1 -1
@@ -150,7 +150,7 @@#define CONFIG_ENV_SECT_SIZE 0x40000#define PHYS_FLASH_1 0x00000000/* Flash Bank #1 */ -#define PHYS_FLASH_2 0x02000000/* Flash Bank #2 */ +#define PHYS_FLASH_2 0x04000000/* Flash Bank #2 */ #define CONFIG_SYS_FLASH_CFI #define CONFIG_FLASH_CFI_DRIVER 1
Signature · 1 line
1.8.5.1
PATCH v2 4/5 arm: pxa: update LP-8x4x to boot DT kernel
In reply to Sergei IanovichDT kernel requires CONFIG_OF_LIBFDT. 'bootm' needs to know DT location. In addition, fix kernel console device and enable U-Boot long help.
---
Changes v1..v2
* don't disable USB
* update serial console
include/configs/lp8x4x.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
include/configs/lp8x4x.h +5 -5
@@ -20,18 +20,18 @@#define CONFIG_SYS_MALLOC_LEN (128*1024)#define CONFIG_ARCH_CPU_INIT #define CONFIG_BOOTCOMMAND \ - "bootm 80000;" + "bootm 80000 - 240000;"#define CONFIG_BOOTARGS \ - "console=ttySA0,115200 mem=128M root=/dev/mmcblk0p1 rw" \ - "init=/sbin/init rootfstype=ext3" + "console=ttyS0,115200 mem=128M root=/dev/mmcblk0p1 rw" \ + "init=/sbin/init rootfstype=ext4 rootwait"#define CONFIG_TIMESTAMP #define CONFIG_BOOTDELAY 2/* Autoboot delay */ #define CONFIG_CMDLINE_TAG #define CONFIG_SETUP_MEMORY_TAGS #define CONFIG_LZMA /* LZMA compression support */ -#undef CONFIG_OF_LIBFDT +#define CONFIG_OF_LIBFDT /* * Serial Console Configuration
@@ -101,7 +101,7 @@*/ #define CONFIG_SYS_HUSH_PARSER 1 -#undef CONFIG_SYS_LONGHELP +#define CONFIG_SYS_LONGHELP #ifdef CONFIG_SYS_HUSH_PARSER #define CONFIG_SYS_PROMPT "$ "#else
Signature · 1 line
1.8.5.1
PATCH v2 5/5 arm: pxa: init ethaddr for LP-8x4x using DT
In reply to Sergei IanovichWhen DT define aliases for etherner0 and ethernet1, U-Boot automatically patched MAC addresses using ethaddr and eth1addr environment variables respectively.
Custom initialization is no longer needed.
---
Changes v1..v2
* use alias instead of manual updating as suggested by Marek Vasut
board/icpdas/lp8x4x/lp8x4x.c | 17 ----------------- 1 file changed, 17 deletions(-)
board/icpdas/lp8x4x/lp8x4x.c +0 -17
@@ -114,25 +114,8 @@ int usb_board_stop(void)#endif #ifdef CONFIG_DRIVER_DM9000 -void lp8x4x_eth1_mac_init (void ) -{ -u8 eth1addr[8 ]; -int i; -u8 reg; - -eth_getenv_enetaddr_by_index ("eth" ,1 , eth1addr); -if (!is_valid_ether_addr (eth1addr)) -return ; - -for (i =0 , reg =0x10 ; i <6 ; i++, reg++) { -writeb (reg, (u8 *)(DM9000_IO_2 )); -writeb (eth1addr[i], (u8 *)(DM9000_DATA_2 )); - } -} -int board_eth_init (bd_t *bis) { -lp8x4x_eth1_mac_init ();return dm9000_initialize (bis); }#endif
Signature · 1 line
1.8.5.1
v2 cover fix and update LP-8x4x to boot DT kernel
In reply to Sergei IanovichQuoted 14 lines · Sergei Ianovich
Linux kernel maintainers require new machnines to support device tree boot. The config for LP-8x4x needs updating.
In addition, there are a few fixes to board's configuration.
v2 fixes review comments made by Marek Vasut.
Sergei Ianovich (5):
ARM: pxa: prevent PXA270 occasional reboot freezes
arm: pxa: fix LP-8x4x USB support
arm: pxa: fix 2nd flash chip address on LP-8x4x
arm: pxa: update LP-8x4x to boot DT kernel
arm: pxa: init ethaddr for LP-8x4x using DT
Quoted 4 lines
arch/arm/cpu/pxa/pxa2xx.c | 1 + board/icpdas/lp8x4x/lp8x4x.c | 39 +++++++++++++-------------------------- include/configs/lp8x4x.h | 15 +++++++-------- 3 files changed, 21 insertions(+), 34 deletions(-)
Applied 1,3,4,5 , thanks!
2 doesn't apply so see my comment please.
Best regards,
Marek Vasut
v2 cover fix and update LP-8x4x to boot DT kernel
Quoted 1 line · Marek Vasut
Applied 1,3,4,5 , thanks!
Thanks for lighting speed.
Quoted 1 line
2 doesn't apply so see my comment please.
Reposted v3.