Skip to contentSkip to conversation

linux-sunxi/u-boot-sunxi is no longer supported, time to switch to upstream u-boot

U-Boot Hans de Goede 6 participants 11 messages Dec 20, 2014 – Jan 18, 2015

lore
Share & tools
lore
#0 lore raw

Hi All,

There are 3 topics which I would like to cover in this mail:

1) Switching over to upstream u-boot for the linux-sunxi project
2) How to build upstream u-boot for use with linux-sunxi sunxi-3.4 kernels
3) Adding more boards to upstream u-boot

1. Switching over to upstream u-boot for the linux-sunxi project
================================================================

Upstream u-boot has had sunxi support for a while now, and has slowly been gaining a lot of features over the linux-sunxi/u-boot-sunxi version at:
https://github.com/linux-sunxi/u-boot-sunxi/

Some of the new features supported upstream are booting from usb, booting from sata (ahci) and full sun6i (A31) support including SPL support. Also upstream u-boot supports using hdmi out + an usb keyboard as u-boot console, so that one does not need to solder a serial console to things like hdmi tv-dongles.

Upstream u-boot also has full sun8i (A23) support in the pipeline including SPL support.

One of the things which has stopped people from switching to upstream u-boot so far is that upstream u-boot did not work with the linux-sunxi sunxi-3.4 kernels, but current upstream u-boot git master:
http://git.denx.de/?p=u-boot.git;a=summary

Now also has support for booting older kernels, so it is time that we stop maintaining linux-sunxi/u-boot-sunxi and start focussing all our efforts on upstream u-boot.

2. How to build upstream u-boot for use with linux-sunxi sunxi-3.4 kernels
==========================================================================

Here are some example instructions on how to build upstream u-boot for the Cubietruck:

git clone git://git.denx.de/u-boot.git
cd u-boot
make -j4 CROSS_COMPILE=arm-linux-gnu- Cubietruck_defconfig
# If you want to use an upstream kernel the next steps can be skipped (*) make -j4 CROSS_COMPILE=arm-linux-gnu- menuconfig
# select "ARM architecture" -> "Enable workarounds for booting old kernels" # exit & save
make -j4 CROSS_COMPILE=arm-linux-gnu- spl/menuconfig
# select "ARM architecture" -> "Enable workarounds for booting old kernels" # exit & save

# skip to here if you're using an upstream kernel
make -j4 CROSS_COMPILE=arm-linux-gnu-

And now you will have a u-boot-sunxi-with-spl.bin to dd to your sdcard as usual.

If you look in the upstream configs directory you will already find defconfig files for a lot of popular boards there, replace Cubietruck_defconfig with the one for your board to build u-boot for your board.

See below for instructions on how to add a new board if your board is missing.

*) These steps can be skipped too when using sun4i (A10) or sun5i (A10s / A13) with a current linux-sunxi/stage/sunxi-3.4 kernel.

3. Adding more boards to upstream u-boot
========================================

If you own a board which is already supported in linux-sunxi/u-boot-sunxi, and is not yet upstream, please add support for it, there are 3 simple steps to add a new board to upstream u-boot, see below. If you've any trouble with this, but are willing to be listed as a contact person for this board let me know and I'll create a patch adding the board for you to test.

1) Add the dram_foo.c file for your board from linux-sunxi/u-boot-sunxi/board/sunxi to upstream u-boot/board/sunxi and add a line for it to u-boot/board/sunxi/Makefile, see existing lines there for how this should look.

2) Create a configs/foo_defconfig file for your board, take a look at configs/Cubietruck_defconfig for an example, typically all the options found in linux-sunxi/u-boot-sunxi/boards.cfg for the board go in the CONFIG_SYS_EXTRA_OPTIONS field, except for the boardname define, which gets replaced with a line like this:

+S:CONFIG_TARGET_CUBIETRUCK=y

3) Add an entry for the board to board/sunxi/MAINTAINERS, with yourself as contact person for the board. For upstream u-boot we want to have a contact person for each supported board, so that users have someone to mail who owns the actual board in case of questions. This is also why we've not simply copied all the boards from linux-sunxi/u-boot-sunxi to upstream u-boot.

Regards,

Hans

#1 lore raw

Hi Hans,

El 20/12/14 a las 15:27, Hans de Goede escibi?:

Quoted 5 lines

Hi All,

There are 3 topics which I would like to cover in this mail:

1) Switching over to upstream u-boot for the linux-sunxi project

(...)

Quoted 15 lines

Here are some example instructions on how to build upstream u-boot for the Cubietruck:

git clone git://git.denx.de/u-boot.git
cd u-boot
make -j4 CROSS_COMPILE=arm-linux-gnu- Cubietruck_defconfig
# If you want to use an upstream kernel the next steps can be skipped (*) make -j4 CROSS_COMPILE=arm-linux-gnu- menuconfig
# select "ARM architecture" -> "Enable workarounds for booting old kernels"
# exit & save
make -j4 CROSS_COMPILE=arm-linux-gnu- spl/menuconfig
# select "ARM architecture" -> "Enable workarounds for booting old kernels"
# exit & save

Quoted 5 lines
# skip to here if you're using an upstream kernel
make -j4 CROSS_COMPILE=arm-linux-gnu-

And now you will have a u-boot-sunxi-with-spl.bin to dd to your sdcard as usual.

(...)

So I thought it'd be a good idea to move over to mainline uboot, but it doesn't seem to be working at all on Cubietruck. When applying power to the board, all I get is

U-Boot SPL 2015.01-rc3-00163-gd8bec60 (Dec 21 2014 - 16:43:41) DRAM:Timeout initialising DRAM

resetting ...

U-Boot SPL 2015.01-rc3-00163-gd8bec60 (Dec 21 2014 - 16:43:41) DRAM:Timeout initialising DRAM

resetting ...

...ad infinitum.

The hardware itself is fine, the NAND bootloader runs OK and I used the board with an old uboot-sunxi some days back. Any ideas on what may be going on?

Cheers!

Emilio

#2 lore raw
Quoted 43 lines · On Sun, 21 Dec 2014 17:00:46 -0300 Emilio L?pez <[email protected]> wrote:

Hi Hans,

El 20/12/14 a las 15:27, Hans de Goede escibi?:

Quoted 5 lines

Hi All,

There are 3 topics which I would like to cover in this mail:

1) Switching over to upstream u-boot for the linux-sunxi project

(...)

Quoted 15 lines

Here are some example instructions on how to build upstream u-boot for the Cubietruck:

git clone git://git.denx.de/u-boot.git
cd u-boot
make -j4 CROSS_COMPILE=arm-linux-gnu- Cubietruck_defconfig
# If you want to use an upstream kernel the next steps can be skipped (*) make -j4 CROSS_COMPILE=arm-linux-gnu- menuconfig
# select "ARM architecture" -> "Enable workarounds for booting old kernels"
# exit & save
make -j4 CROSS_COMPILE=arm-linux-gnu- spl/menuconfig
# select "ARM architecture" -> "Enable workarounds for booting old kernels"
# exit & save

Quoted 5 lines
# skip to here if you're using an upstream kernel
make -j4 CROSS_COMPILE=arm-linux-gnu-

And now you will have a u-boot-sunxi-with-spl.bin to dd to your sdcard as usual.

(...)

So I thought it'd be a good idea to move over to mainline uboot, but it doesn't seem to be working at all on Cubietruck. When applying power to the board, all I get is

U-Boot SPL 2015.01-rc3-00163-gd8bec60 (Dec 21 2014 - 16:43:41) DRAM:Timeout initialising DRAM

resetting ...

U-Boot SPL 2015.01-rc3-00163-gd8bec60 (Dec 21 2014 - 16:43:41) DRAM:Timeout initialising DRAM

Quoted 7 lines

resetting ...

...ad infinitum.

The hardware itself is fine, the NAND bootloader runs OK and I used the board with an old uboot-sunxi some days back. Any ideas on what may be going on?

Thanks for reporting this.

First of all, please ensure that there is no obvious misconfiguration. For example, whether you have really configured u-boot for Cubietruck.

If everything is configured correctly, then it would help a lot to identify which of the await_bits_set() or await_bits_clear() calls is failing in 'arch/arm/cpu/armv7/sunxi/dram_sun4i.c' by adding some extra debugging prints.

Signature · 2 lines
Best regards,
Siarhei Siamashka
#3 lore raw

Hi,

El 21/12/14 a las 17:28, Siarhei Siamashka escibi?:

Quoted 50 lines
Quoted 47 lines · On Sun, 21 Dec 2014 17:00:46 -0300 Emilio L?pez <[email protected]> wrote:

Hi Hans,

El 20/12/14 a las 15:27, Hans de Goede escibi?:

Quoted 5 lines

Hi All,

There are 3 topics which I would like to cover in this mail:

1) Switching over to upstream u-boot for the linux-sunxi project

(...)

Quoted 15 lines

Here are some example instructions on how to build upstream u-boot for the Cubietruck:

git clone git://git.denx.de/u-boot.git
cd u-boot
make -j4 CROSS_COMPILE=arm-linux-gnu- Cubietruck_defconfig
# If you want to use an upstream kernel the next steps can be skipped (*) make -j4 CROSS_COMPILE=arm-linux-gnu- menuconfig
# select "ARM architecture" -> "Enable workarounds for booting old kernels"
# exit & save
make -j4 CROSS_COMPILE=arm-linux-gnu- spl/menuconfig
# select "ARM architecture" -> "Enable workarounds for booting old kernels"
# exit & save

Quoted 5 lines
# skip to here if you're using an upstream kernel
make -j4 CROSS_COMPILE=arm-linux-gnu-

And now you will have a u-boot-sunxi-with-spl.bin to dd to your sdcard as usual.

(...)

So I thought it'd be a good idea to move over to mainline uboot, but it doesn't seem to be working at all on Cubietruck. When applying power to the board, all I get is

U-Boot SPL 2015.01-rc3-00163-gd8bec60 (Dec 21 2014 - 16:43:41) DRAM:Timeout initialising DRAM

resetting ...

U-Boot SPL 2015.01-rc3-00163-gd8bec60 (Dec 21 2014 - 16:43:41) DRAM:Timeout initialising DRAM

resetting ...

...ad infinitum.

Quoted 8 lines
Quoted 3 lines

The hardware itself is fine, the NAND bootloader runs OK and I used the board with an old uboot-sunxi some days back. Any ideas on what may be going on?

Thanks for reporting this.

First of all, please ensure that there is no obvious misconfiguration. For example, whether you have really configured u-boot for Cubietruck.

Sorry for the noise, I messed up and was using the Cubieboard config instead of the Cubietruck one >.<

Seems to work fine other than this warning:

Error: dwmac.1c50000 address ab:cd:ef:ab:cd:ef illegal value

Cheers!

Emilio

#4 lore raw

Hi,

On 21-12-14 21:40, Emilio L?pez wrote:

<snip>

Quoted 5 lines

Sorry for the noise, I messed up and was using the Cubieboard config instead of the Cubietruck one >.<

Seems to work fine other than this warning:

Error: dwmac.1c50000 address ab:cd:ef:ab:cd:ef illegal value

Weird, try doing:

setenv ethaddr
saveenv

It seems you've a bogus ethaddr setting in your environment, or maybe in uEnv.txt ?

Or alternatively, nuke your environment so that you get the default one using:

sudo dd if=/dev/zero of=/dev/sdc bs=1024 seek=544 count=256

Replacing sdc with the block device for your sdcard reader, e.g. mmcblk0. Using the default env will get you closer to how most people will be using upstream u-boot, so running with the default env is preferred.

Regards,

Hans

#5 lore raw
Quoted 4 lines · Hans de Goede

Or alternatively, nuke your environment so that you get the default one using:

sudo dd if=/dev/zero of=/dev/sdc bs=1024 seek=544 count=256

You can do this with the env command from the u-boot cmdline too. I forget the parameters, but they are in "help env".

Ian.

#6 lore raw
In reply to Hans de Goede
Quoted 23 lines · Hans de Goede

Hi All,

There are 3 topics which I would like to cover in this mail:

1) Switching over to upstream u-boot for the linux-sunxi project
2) How to build upstream u-boot for use with linux-sunxi sunxi-3.4 kernels
3) Adding more boards to upstream u-boot

1. Switching over to upstream u-boot for the linux-sunxi project
================================================================

Upstream u-boot has had sunxi support for a while now, and has slowly been gaining a lot of features over the linux-sunxi/u-boot-sunxi version at:
https://github.com/linux-sunxi/u-boot-sunxi/

Some of the new features supported upstream are booting from usb, booting from
sata (ahci) and full sun6i (A31) support including SPL support. Also upstream
u-boot supports using hdmi out + an usb keyboard as u-boot console, so that one does not need to solder a serial console to things like hdmi tv-dongles.

Quoted 2 lines

Upstream u-boot also has full sun8i (A23) support in the pipeline including SPL support.

Since we have sun8i memory support is there corresponding meminfo which can dump the timing?

Thanks

Michal

#7 lore raw

Hi,

Quoted 24 lines · Michal Suchanek
Quoted 23 lines · Hans de Goede

Hi All,

There are 3 topics which I would like to cover in this mail:

1) Switching over to upstream u-boot for the linux-sunxi project
2) How to build upstream u-boot for use with linux-sunxi sunxi-3.4 kernels
3) Adding more boards to upstream u-boot

1. Switching over to upstream u-boot for the linux-sunxi project
================================================================

Upstream u-boot has had sunxi support for a while now, and has slowly been gaining a lot of features over the linux-sunxi/u-boot-sunxi version at:
https://github.com/linux-sunxi/u-boot-sunxi/

Some of the new features supported upstream are booting from usb, booting from
sata (ahci) and full sun6i (A31) support including SPL support. Also upstream
u-boot supports using hdmi out + an usb keyboard as u-boot console, so that one does not need to solder a serial console to things like hdmi tv-dongles.

Quoted 5 lines
Quoted 2 lines

Upstream u-boot also has full sun8i (A23) support in the pipeline including SPL support.

Since we have sun8i memory support is there corresponding meminfo which can dump the timing?

No, just like with previous boards all boards seem to use the same timing (tpr) values so I've simply hardcoded them. The only 2 things which can be configured in the sun8i dram code or the dram-clk and the zq value, both of which (so far) have been filled in in the fex files, so there is no reason to read it back, moreover reading it back is impossible in the case of the zq value, as that does not end up 1:1 in a register.

Regards,

Hans

#8 lore raw
Quoted 33 lines · On Mon, 22 Dec 2014 14:50:09 +0100 Hans de Goede <[email protected]> wrote:

Hi,

Quoted 24 lines · Michal Suchanek
Quoted 23 lines · Hans de Goede

Hi All,

There are 3 topics which I would like to cover in this mail:

1) Switching over to upstream u-boot for the linux-sunxi project
2) How to build upstream u-boot for use with linux-sunxi sunxi-3.4 kernels
3) Adding more boards to upstream u-boot

1. Switching over to upstream u-boot for the linux-sunxi project
================================================================

Upstream u-boot has had sunxi support for a while now, and has slowly been gaining a lot of features over the linux-sunxi/u-boot-sunxi version at:
https://github.com/linux-sunxi/u-boot-sunxi/

Some of the new features supported upstream are booting from usb, booting from
sata (ahci) and full sun6i (A31) support including SPL support. Also upstream
u-boot supports using hdmi out + an usb keyboard as u-boot console, so that one does not need to solder a serial console to things like hdmi tv-dongles.

Quoted 5 lines
Quoted 2 lines

Upstream u-boot also has full sun8i (A23) support in the pipeline including SPL support.

Since we have sun8i memory support is there corresponding meminfo which can dump the timing?

Quoted 6 lines

No, just like with previous boards all boards seem to use the same timing (tpr) values so I've simply hardcoded them. The only 2 things which can be configured in the sun8i dram code or the dram-clk and the zq value, both of which (so far) have been filled in in the fex files, so there is no reason to read it back, moreover reading it back is impossible in the case of the zq value, as that does not end up 1:1 in a register.

It still makes a lot of sense having a tool, which recovers as much of the 'dram_para' struct as possible. At least this can provide a way to verify the correctness of the sun8i dram code in u-boot, if compared with the same results obtained on a system with the allwinner boot0 bootloader. And also compared with the settings from FEX.

Hans, do you remember your recent screw-up with the axp152 regulators?

    http://lists.denx.de/pipermail/u-boot/2014-October/191528.html

You noticed the problem only several months after introducing this regression. This could be discovered because you were playing with the sunxi-3.4 kernel, and thankfully it was able to report the voltage, originally set by the bootloader. Had you thought about a way to test your axp152 tweaks at the time when you had initially implemented them, this regression could have been avoided altogether.

Exactly the same applies here. The sun8i dram code contains some weird dram parameters scrambling before they are written to the registers among other things. How can we be sure that you have really correctly transplanted all of the boot0 logic into your C code without any typo or missing anything in the process? Especially considering that you are not disclosing any details about the way you have done this, or the exact boot0 binary that was used to borrow this logic from.

Reading back from the hardware registers via /dev/mem and comparing this data with the expected values could definitely help. And no, it's not something that some other person could maybe do in some distant future. This is a necessary action to ensure the sun8i dram code quality, which is better to be done right now.

Signature · 2 lines
Best regards,
Siarhei Siamashka
#9 lore raw
In reply to Hans de Goede

Hello

How could run u-boot with lcd with Cubieboard2 + DVK-521 using Kernke 3.19rc3 u-boot-wip with HDMI is already running not get to do the LCD picture

Configuration it would be LCD e toud

fex

[disp_init]
disp_init_enable = 1
disp_mode = 0
screen0_output_type = 1
screen0_output_mode = 4
screen1_output_type = 0
screen1_output_mode = 4
fb0_width = 1024
fb0_height = 768
fb0_framebuffer_num = 2
fb0_format = 10
fb0_pixel_sequence = 0
fb0_scaler_mode_enable = 0
fb1_width = 1024
fb1_height = 768
fb1_framebuffer_num = 2
fb1_format = 10
fb1_pixel_sequence = 0
fb1_scaler_mode_enable = 0
lcd0_backlight = 197
lcd1_backlight = 197
lcd0_bright = 50
lcd0_contrast = 50
lcd0_saturation = 57
lcd0_hue = 50
lcd1_bright = 50
lcd1_contrast = 50
lcd1_saturation = 57
lcd1_hue = 50

[lcd0_para]
lcd_used = 1
lcd_x = 800
lcd_y = 480
lcd_dclk_freq = 33
lcd_pwm_not_used = 0
lcd_pwm_ch = 0
lcd_pwm_freq = 10000
lcd_pwm_pol = 0
lcd_max_bright = 240
lcd_min_bright = 64
lcd_if = 0
lcd_hbp = 215
lcd_ht = 1055
lcd_vbp = 34
lcd_vt = 1050
lcd_vspw = 3
lcd_hspw = 20
lcd_hv_if = 0
lcd_hv_smode = 0
lcd_hv_s888_if = 0
lcd_hv_syuv_if = 0
lcd_lvds_ch = 0
lcd_lvds_mode = 0
lcd_lvds_bitwidth = 0
lcd_lvds_io_cross = 0
lcd_cpu_if = 0
lcd_frm = 1
lcd_io_cfg0 = 0
lcd_gamma_correction_en = 0 lcd_gamma_tbl_0 = 0x0
lcd_gamma_tbl_1 = 0x10101 lcd_gamma_tbl_255 = 0xffffff lcd_bl_en_used = 1
lcd_bl_en = port:PH07<1><0><default><1> lcd_power_used = 1
lcd_power = port:PH08<1><0><default><1> lcd_pwm_used = 1
lcd_pwm = port:PB02<2><0><default><default> lcd_gpio_0 = port:PH15<0><0><default><default> lcd_gpio_1 =
lcd_gpio_2 =
lcd_gpio_3 =
lcdd0 = port:PD00<2><0><default><default> lcdd1 = port:PD01<2><0><default><default> lcdd2 = port:PD02<2><0><default><default> lcdd3 = port:PD03<2><0><default><default> lcdd4 = port:PD04<2><0><default><default> lcdd5 = port:PD05<2><0><default><default> lcdd6 = port:PD06<2><0><default><default> lcdd7 = port:PD07<2><0><default><default> lcdd8 = port:PD08<2><0><default><default> lcdd9 = port:PD09<2><0><default><default> lcdd10 = port:PD10<2><0><default><default> lcdd11 = port:PD11<2><0><default><default> lcdd12 = port:PD12<2><0><default><default> lcdd13 = port:PD13<2><0><default><default> lcdd14 = port:PD14<2><0><default><default> lcdd15 = port:PD15<2><0><default><default> lcdd16 = port:PD16<2><0><default><default> lcdd17 = port:PD17<2><0><default><default> lcdd18 = port:PD18<2><0><default><default> lcdd19 = port:PD19<2><0><default><default> lcdd20 = port:PD20<2><0><default><default> lcdd21 = port:PD21<2><0><default><default> lcdd22 = port:PD22<2><0><default><default> lcdd23 = port:PD23<2><0><default><default> lcdclk = port:PD24<2><0><default><default> lcdde = port:PD25<2><0><default><default> lcdhsync = port:PD26<2><0><default><default> lcdvsync = port:PD27<2><0><default><default>

[ctp_para]

ctp_used = 1
ctp_name = "ft5x_ts"
ctp_twi_id = 1
ctp_twi_addr = 0x38
ctp_screen_max_x = 800
ctp_screen_max_y = 480 ctp_revert_x_flag = 0
ctp_revert_y_flag = 1 ctp_exchange_x_y_flag = 0
ctp_firm = 1
ctp_wakeup = port:PB13<1><default><default><1>

[ctp_list_para]
ctp_det_used = 1
ft5x_ts = 1
gt82x = 0
gslX680 = 0
gt9xx_ts = 0
gt811 = 0

[gpio_para]
gpio_pin_3 = port:PH07<6><default><default><default>

#10 lore raw
Quoted 10 lines · On Sun, 18 Jan 2015 11:38:06 -0800 (PST) Ezaul Zillmer…

Hello

How could run u-boot with lcd with Cubieboard2 + DVK-521 using Kernke 3.19rc3 u-boot-wip with HDMI is already running not get to do the LCD picture

Configuration it would be LCD e toud

fex

[...]

There are several options:

1. If you can ensure that your fex file is available in the sunxi-boards repository, then you will get your LCD settings available on the
http://linux-sunxi.org/LCD wiki page after the next round of automatic conversion.

2. If you are really impatient, then you can go to
http://linux-sunxi.org/LCD#Script_for_automated_conversion
Then copy/paste this script into some file with *.rb extension and run it on your fex file to get the CONFIG_VIDEO_LCD_MODE line for your board.

This is currently work in progress and will definitely change in the near future. There is no reason why we can't get complete u-boot defconfigs (not just LCD settings alone) generated from fex files automatically. Along with dts/dtb files for the kernel. Stay tuned.

Signature · 2 lines
Best regards,
Siarhei Siamashka