[U-Boot] at91 family status

Hi all, I started to rework the netus board patch for a second submission. In the last few months a lot of changes have broken the entire at91 family boards according to MAKEALL at91 [1]. For a few boards, like mine, make fails with a segfault during final link; how to deal with this problem?
make[1]: uscita dalla directory «/home/claudyus/code/u-boot-git/board/acmesystems/netusg20» make -C /home/claudyus/code/u-boot-git/arch/arm/cpu/arm926ejs/ u-boot.lds make[1]: ingresso nella directory «/home/claudyus/code/u-boot-git/arch/arm/cpu/arm926ejs» make[1]: Nessuna operazione da eseguire per «u-boot.lds». make[1]: uscita dalla directory «/home/claudyus/code/u-boot-git/arch/arm/cpu/arm926ejs» /home/claudyus/code/openwrt-svn/trunk/staging_dir/toolchain-arm_v5te_gcc-4.3.3+cs_uClibc-0.9.31_eabi/bin/arm-openwrt-linux-gcc -E -g -Os -fno-common -ffixed-r8 -msoft-float -D__KERNEL__ -DCONFIG_SYS_TEXT_BASE=0x23f00000 -I/home/claudyus/code/u-boot-git/include -fno-builtin -ffreestanding -nostdinc -isystem /home/claudyus/code/openwrt-svn/trunk/staging_dir/toolchain-arm_v5te_gcc-4.3.3+cs_uClibc-0.9.31_eabi/lib/gcc/arm-openwrt-linux-uclibcgnueabi/4.3.3/include -pipe -DCONFIG_ARM -D__ARM__ -marm -mabi=aapcs-linux -mno-thumb-interwork -march=armv5te -include /home/claudyus/code/u-boot-git/include/u-boot/u-boot.lds.h -ansi -D__ASSEMBLY__ -P - </home/claudyus/code/u-boot-git/arch/arm/cpu/arm926ejs/u-boot.lds
u-boot.lds
UNDEF_SYM=`/home/claudyus/code/openwrt-svn/trunk/staging_dir/toolchain-arm_v5te_gcc-4.3.3+cs_uClibc-0.9.31_eabi/bin/arm-openwrt-linux-objdump -x board/acmesystems/netusg20/libnetusg20.a lib/libgeneric.a lib/lzma/liblzma.a lib/lzo/liblzo.a arch/arm/cpu/arm926ejs/libarm926ejs.a arch/arm/cpu/arm926ejs/at91/libat91.a arch/arm/lib/libarm.a fs/cramfs/libcramfs.a fs/fat/libfat.a fs/fdos/libfdos.a fs/jffs2/libjffs2.a fs/reiserfs/libreiserfs.a fs/ext2/libext2fs.a fs/yaffs2/libyaffs2.a fs/ubifs/libubifs.a net/libnet.a disk/libdisk.a drivers/bios_emulator/libatibiosemu.a drivers/block/libblock.a drivers/dma/libdma.a drivers/fpga/libfpga.a drivers/gpio/libgpio.a drivers/hwmon/libhwmon.a drivers/i2c/libi2c.a drivers/input/libinput.a drivers/misc/libmisc.a drivers/mmc/libmmc.a drivers/mtd/libmtd.a drivers/mtd/nand/libnand.a drivers/mtd/onenand/libonenand.a drivers/mtd/ubi/libubi.a drivers/mtd/spi/libspi_flash.a drivers/net/libnet.a drivers/net/phy/libphy.a drivers/pci/libpci.a drivers/pcmcia/libpcmcia.a drivers/power/libpower.a drivers/spi/libspi.a drivers/rtc/librtc.a drivers/serial/libserial.a drivers/twserial/libtws.a drivers/usb/gadget/libusb_gadget.a drivers/usb/host/libusb_host.a drivers/usb/musb/libusb_musb.a drivers/usb/phy/libusb_phy.a drivers/video/libvideo.a drivers/watchdog/libwatchdog.a common/libcommon.a lib/libfdt/libfdt.a api/libapi.a post/libpost.a | sed -n -e 's/.*(__u_boot_cmd_.*)/-u\1/p'|sort|uniq`; cd /home/claudyus/code/u-boot-git && /home/claudyus/code/openwrt-svn/trunk/staging_dir/toolchain-arm_v5te_gcc-4.3.3+cs_uClibc-0.9.31_eabi/bin/arm-openwrt-linux-ld -Bstatic -T u-boot.lds -pie -Ttext 0x23f00000 $UNDEF_SYM arch/arm/cpu/arm926ejs/start.o --start-group lib/libgeneric.a lib/lzma/liblzma.a lib/lzo/liblzo.a arch/arm/cpu/arm926ejs/libarm926ejs.a arch/arm/cpu/arm926ejs/at91/libat91.a arch/arm/lib/libarm.a fs/cramfs/libcramfs.a fs/fat/libfat.a fs/fdos/libfdos.a fs/jffs2/libjffs2.a fs/reiserfs/libreiserfs.a fs/ext2/libext2fs.a fs/yaffs2/libyaffs2.a fs/ubifs/libubifs.a net/libnet.a disk/libdisk.a drivers/bios_emulator/libatibiosemu.a drivers/block/libblock.a drivers/dma/libdma.a drivers/fpga/libfpga.a drivers/gpio/libgpio.a drivers/hwmon/libhwmon.a drivers/i2c/libi2c.a drivers/input/libinput.a drivers/misc/libmisc.a drivers/mmc/libmmc.a drivers/mtd/libmtd.a drivers/mtd/nand/libnand.a drivers/mtd/onenand/libonenand.a drivers/mtd/ubi/libubi.a drivers/mtd/spi/libspi_flash.a drivers/net/libnet.a drivers/net/phy/libphy.a drivers/pci/libpci.a drivers/pcmcia/libpcmcia.a drivers/power/libpower.a drivers/spi/libspi.a drivers/rtc/librtc.a drivers/serial/libserial.a drivers/twserial/libtws.a drivers/usb/gadget/libusb_gadget.a drivers/usb/host/libusb_host.a drivers/usb/musb/libusb_musb.a drivers/usb/phy/libusb_phy.a drivers/video/libvideo.a drivers/watchdog/libwatchdog.a common/libcommon.a lib/libfdt/libfdt.a api/libapi.a post/libpost.a board/acmesystems/netusg20/libnetusg20.a --end-group /home/claudyus/code/u-boot-git/arch/arm/lib/eabi_compat.o -L /home/claudyus/code/openwrt-svn/trunk/staging_dir/toolchain-arm_v5te_gcc-4.3.3+cs_uClibc-0.9.31_eabi/lib/gcc/arm-openwrt-linux-uclibcgnueabi/4.3.3 -lgcc -Map u-boot.map -o u-boot arch/arm/lib/libarm.a(board.o): In function `board_init_r': /home/claudyus/code/u-boot-git/arch/arm/lib/board.c:599: undefined reference to `reset_phy' drivers/spi/libspi.a(atmel_dataflash_spi.o): In function `AT91F_SpiWrite': /home/claudyus/code/u-boot-git/drivers/spi/atmel_dataflash_spi.c:161: undefined reference to `reset_timer_masked' /home/claudyus/code/u-boot-git/drivers/spi/atmel_dataflash_spi.c:165: undefined reference to `get_timer_masked' /home/claudyus/code/openwrt-svn/trunk/staging_dir/toolchain-arm_v5te_gcc-4.3.3+cs_uClibc-0.9.31_eabi/bin/arm-openwrt-linux-ld: BFD (GNU Binutils) 2.20.1 assertion fail elf32-arm.c:12195 /home/claudyus/code/openwrt-svn/trunk/staging_dir/toolchain-arm_v5te_gcc-4.3.3+cs_uClibc-0.9.31_eabi/bin/arm-openwrt-linux-ld: BFD (GNU Binutils) 2.20.1 assertion fail elf32-arm.c:12195 /home/claudyus/code/openwrt-svn/trunk/staging_dir/toolchain-arm_v5te_gcc-4.3.3+cs_uClibc-0.9.31_eabi/bin/arm-openwrt-linux-ld: BFD (GNU Binutils) 2.20.1 assertion fail elf32-arm.c:12195 /home/claudyus/code/openwrt-svn/trunk/staging_dir/toolchain-arm_v5te_gcc-4.3.3+cs_uClibc-0.9.31_eabi/bin/arm-openwrt-linux-ld: BFD (GNU Binutils) 2.20.1 assertion fail elf32-arm.c:12429 /bin/sh: riga 1: 32508 Segmentation fault /home/claudyus/code/openwrt-svn/trunk/staging_dir/toolchain-arm_v5te_gcc-4.3.3+cs_uClibc-0.9.31_eabi/bin/arm-openwrt-linux-ld -Bstatic -T u-boot.lds -pie -Ttext 0x23f00000 $UNDEF_SYM arch/arm/cpu/arm926ejs/start.o --start-group lib/libgeneric.a lib/lzma/liblzma.a lib/lzo/liblzo.a arch/arm/cpu/arm926ejs/libarm926ejs.a arch/arm/cpu/arm926ejs/at91/libat91.a arch/arm/lib/libarm.a fs/cramfs/libcramfs.a fs/fat/libfat.a fs/fdos/libfdos.a fs/jffs2/libjffs2.a fs/reiserfs/libreiserfs.a fs/ext2/libext2fs.a fs/yaffs2/libyaffs2.a fs/ubifs/libubifs.a net/libnet.a disk/libdisk.a drivers/bios_emulator/libatibiosemu.a drivers/block/libblock.a drivers/dma/libdma.a drivers/fpga/libfpga.a drivers/gpio/libgpio.a drivers/hwmon/libhwmon.a drivers/i2c/libi2c.a drivers/input/libinput.a drivers/misc/libmisc.a drivers/mmc/libmmc.a drivers/mtd/libmtd.a drivers/mtd/nand/libnand.a drivers/mtd/onenand/libonenand.a drivers/mtd/ubi/libubi.a drivers/mtd/spi/libspi_flash.a drivers/net/libnet.a drivers/net/phy/libphy.a drivers/pci/libpci.a drivers/pcmcia/libpcmcia.a drivers/power/libpower.a drivers/spi/libspi.a drivers/rtc/librtc.a drivers/serial/libserial.a drivers/twserial/libtws.a drivers/usb/gadget/libusb_gadget.a drivers/usb/host/libusb_host.a drivers/usb/musb/libusb_musb.a drivers/usb/phy/libusb_phy.a drivers/video/libvideo.a drivers/watchdog/libwatchdog.a common/libcommon.a lib/libfdt/libfdt.a api/libapi.a post/libpost.a board/acmesystems/netusg20/libnetusg20.a --end-group /home/claudyus/code/u-boot-git/arch/arm/lib/eabi_compat.o -L /home/claudyus/code/openwrt-svn/trunk/staging_dir/toolchain-arm_v5te_gcc-4.3.3+cs_uClibc-0.9.31_eabi/lib/gcc/arm-openwrt-linux-uclibcgnueabi/4.3.3 -lgcc -Map u-boot.map -o u-boot make: *** [u-boot] Errore 139 $
Best Regards

Dear Claudio,
Am 08.11.2010 um 19:33 schrieb Claudio:
Hi all, I started to rework the netus board patch for a second submission. In the last few months a lot of changes have broken the entire at91 family boards according to MAKEALL at91 [1].
almost all arm boards where broken ...
For a few boards, like mine, make fails with a segfault during final link; how to deal with this problem?
fix it ;)
There where some major changes regarding arm relocation. Some boards currently fixed but a lot not. Please see u-boot-atmel.git tree for a not yet submitted at91sam9 board called top9000. This could be a good starting point for you. AFAIR relocation on arm926ejs is working on that board so you may get your board fixed.
Some boards (e.g. at91rm9200ek) do have the mentioned linker segfault problem. We got it down to some undefined weak symbols which let the linker stumble. But a clean fix for that is not found til now. Sebastien Carlier tries to cleanup the linking stage, this may solves this issue.
regards
Andreas Bießmann

Le 08/11/2010 20:38, Andreas Bießmann a écrit :
AFAIR relocation on arm926ejs is working on that board so you may get your board fixed.
For arm926 boards, see and test my recent V4 patch. The more it gets tested, the more confident we can be that ARM ELF relocation now works well across the most frequently used toolchains; from there we can spread to other ARM cpus.
Amicalement,

Dear Andreas,
2010/11/8 Andreas Bießmann andreas.devel@googlemail.com:
There where some major changes regarding arm relocation. Some boards currently fixed but a lot not. Please see u-boot-atmel.git tree for a not yet submitted at91sam9 board called top9000. This could be a good starting point for you. AFAIR relocation on arm926ejs is working on that board so you may get your board fixed.
Thank you for point out this board I fix my board with this reference and also some generic api.
For your convenience I upload the single patches here http://test.ninux.org/~claudyus/patch/uboot/ or if you prefer to pick from git on http://test.ninux.org/~claudyus/git-php/index.php?p=uboot
This work is based on the top of atmel/at91avr32rework branch.
Best Regards

Dear Claudio,
Am 09.11.2010 um 00:12 schrieb Claudio:
For your convenience I upload the single patches here http://test.ninux.org/~claudyus/patch/uboot/ or if you prefer to pick from git on http://test.ninux.org/~claudyus/git-php/index.php?p=uboot
please send your patches to list for review
regards
Andreas Bießmann

Dear Claudio,
2010/11/8 Andreas Bießmannandreas.devel@googlemail.com:
There where some major changes regarding arm relocation. Some boards currently fixed but a lot not. Please see u-boot-atmel.git tree for a not yet submitted at91sam9 board called top9000. This could be a good starting point for you. AFAIR relocation on arm926ejs is working on that board so you may get your board fixed.
Thank you for point out this board I fix my board with this reference and also some generic api.
For your convenience I upload the single patches here http://test.ninux.org/~claudyus/patch/uboot/
It is not very convenient to comment on patches that did not come per eMail :) And others can not follow the discussion. However I will point out some things I noticed when I looked at the patches there:
Generally: We don't do #define SOMETHING 1 anymore when the define is for #ifdef use only. On occasion you have included at91sam9260.h instead of hardware.h.
0001-at91-add-support-for-NetusG20.patch 0002-AT91-re-work-netusg20-support-after-ARM-reloc.patch 0007-AT91-totally-reworks-the-netusg20-board-on-the-top-o.patch
You should squash those together, so the final result can be seen, instead of (for example) making config.mk appear (wrong anyway) and disappear later again. If you want to split your board support into two like top9000 currently is: One initially to be based on the AT91 branch (one to be mainlined soon) and one based on top of at91avr32rework (which is still moving fast, and I cannot guarantee it being mainline very soon)
0003-AT91-fix-compile-error-after-f5571dc9.patch
[at91sam9260_devices.c]
That include can not be necessary for your final board support! Note that your board config.h must define which SoC to use first, then include hardware.h to pull in the correct defines.
0004-AT91-define-the-mmci-base-address-for-at91sam9-20.patch
[at91sam9260.h]
Line 71 already has: #define ATMEL_BASE_MCI 0xfffa8000 If somewhere else MMCI is used that location must be fixed. We are using the naming introduced in the data sheets.
0005-AT91-replace-AT91_BASE_SPI-with-ATMEL_BASE_SPI0.patch
[atmel_dataflash_spi.c]
This is a separate patch for the rework of the *generic ATMEL* drivers. It should mention in the subject that it fixes the spi-dataflash driver. I can also squash that one into the "ATMEL: fix related common atmel driver files patch". However references to AT91 must be replaced by ATMEL throughout the driver. See atmel_spi.c! Maybe atmel_dataflash_spi.c can then be united with atmel_spi.c, in a later fixup?
0006-AT91-move-spi-generic-function-from-top9000-board-to.patch
[spi_cs* functions]
Those functions are not generic. They might be similar on most at91sam9260/9g20/9xe boards but the use of GPIO pins as SPI chip selects is truly board specific. Note that top9000 defines 2x SPI with 4 chip selects each and therefore allows pins to flicker that in other boards might be used for different purposes. You can duplicate the functions but zero out any chip selects that your board does not use. On any account, those functions never belong into the ATMEL generic SPI driver that is for *all* AVR32 and AT91 SoCs.
This work is based on the top of atmel/at91avr32rework branch.
One note to that branch (partly mentioned above): It sprang from the idea to cleanup the mess in the AT91 *.h hierarchy and also to align the AVR32 and AT91 architectures because they (due to the same IPs used) share several drivers. Currently I am collecting "cleanup" patches there and to verify the build(s) I am rebasing boards ports along the top of it.
Therefore it would help to have your board on the top as well.
I am (with low prio) working on the at91sam9260/9g20/9xe board.
Three boards working atop the reworks are a good base to mainline the rework itself...
Best Regards, Reinhard

Dear Reinhard thank you for your review. I know that post the patches on an webserver isn't the common path but this time this was really a wip work...
2010/11/9 Reinhard Meyer u-boot@emk-elektronik.de:
Dear Claudio,
2010/11/8 Andreas Bießmannandreas.devel@googlemail.com:
There where some major changes regarding arm relocation. Some boards currently fixed but a lot not. Please see u-boot-atmel.git tree for a not yet submitted at91sam9 board called top9000. This could be a good starting point for you. AFAIR relocation on arm926ejs is working on that board so you may get your board fixed.
Thank you for point out this board I fix my board with this reference and also some generic api.
For your convenience I upload the single patches here http://test.ninux.org/~claudyus/patch/uboot/
It is not very convenient to comment on patches that did not come per eMail :) And others can not follow the discussion. However I will point out some things I noticed when I looked at the patches there:
Generally: We don't do #define SOMETHING 1 anymore when the define is for #ifdef use only. On occasion you have included at91sam9260.h instead of hardware.h.
0001-at91-add-support-for-NetusG20.patch 0002-AT91-re-work-netusg20-support-after-ARM-reloc.patch 0007-AT91-totally-reworks-the-netusg20-board-on-the-top-o.patch
You should squash those together, so the final result can be seen, instead of (for example) making config.mk appear (wrong anyway) and disappear later again. If you want to split your board support into two like top9000 currently is: One initially to be based on the AT91 branch (one to be mainlined soon) and one based on top of at91avr32rework (which is still moving fast, and I cannot guarantee it being mainline very soon)
0003-AT91-fix-compile-error-after-f5571dc9.patch
[at91sam9260_devices.c]
That include can not be necessary for your final board support! Note that your board config.h must define which SoC to use first, then include hardware.h to pull in the correct defines.
Inside the board config.h, before the include of hardware.h, I have the appropriate #define AT91SAM9G20 but build fails anyway due to undefined ATMEL_PIO_PORTS.
0004-AT91-define-the-mmci-base-address-for-at91sam9-20.patch
[at91sam9260.h]
Line 71 already has: #define ATMEL_BASE_MCI 0xfffa8000 If somewhere else MMCI is used that location must be fixed. We are using the naming introduced in the data sheets.
So the following should be converted: $ grep -inr 'ATMEL_BASE_MMCI' * arch/avr32/include/asm/arch-at32ap700x/hardware.h:78:#define ATMEL_BASE_MMCI 0xFFF02400 drivers/mmc/atmel_mci.h:241: readl((void *)ATMEL_BASE_MMCI + MMCI_##reg) drivers/mmc/atmel_mci.h:243: writel((value), (void *)ATMEL_BASE_MMCI + MMCI_##reg)
0005-AT91-replace-AT91_BASE_SPI-with-ATMEL_BASE_SPI0.patch
[atmel_dataflash_spi.c]
This is a separate patch for the rework of the *generic ATMEL* drivers. It should mention in the subject that it fixes the spi-dataflash driver. I can also squash that one into the "ATMEL: fix related common atmel driver files patch". However
feel free to do so if is convenient for you
0006-AT91-move-spi-generic-function-from-top9000-board-to.patch
[spi_cs* functions]
Those functions are not generic. They might be similar on most at91sam9260/9g20/9xe boards but the use of GPIO pins as SPI chip selects is truly board specific. Note that top9000 defines 2x SPI with 4 chip selects each and therefore allows pins to flicker that in other boards might be used for different purposes. You can duplicate the functions but
That not true, I found that those 8 chip select are defined in **exactly** the same way inside at91sm9g20 datasheet. Finally I don't understand WHY those function are used to enable/disable CS when this function should be managed in hw... What do you suggest? I should replicate this code or keep a shared file for at91sam9260/9g20/9xe boards and leave avr32 in a separate file?
Best Regards

Dear Claudio,
Dear Reinhard thank you for your review. I know that post the patches on an webserver isn't the common path but this time this was really a wip work...
0003-AT91-fix-compile-error-after-f5571dc9.patch
[at91sam9260_devices.c]
That include can not be necessary for your final board support! Note that your board config.h must define which SoC to use first, then include hardware.h to pull in the correct defines.
Inside the board config.h, before the include of hardware.h, I have the appropriate #define AT91SAM9G20 but build fails anyway due to undefined ATMEL_PIO_PORTS.
Have a look at at91avr32rework-2, I pushed the rework for at91sam9260/9g20/9xe-ek there. It compiles with a few warnings and runs.
dataflash still needs some cleanup work to be "nice". And gpio still partially needs legacy defined.
0004-AT91-define-the-mmci-base-address-for-at91sam9-20.patch
[at91sam9260.h]
Line 71 already has: #define ATMEL_BASE_MCI 0xfffa8000 If somewhere else MMCI is used that location must be fixed. We are using the naming introduced in the data sheets.
So the following should be converted: $ grep -inr 'ATMEL_BASE_MMCI' * arch/avr32/include/asm/arch-at32ap700x/hardware.h:78:#define ATMEL_BASE_MMCI 0xFFF02400 drivers/mmc/atmel_mci.h:241: readl((void *)ATMEL_BASE_MMCI + MMCI_##reg) drivers/mmc/atmel_mci.h:243: writel((value), (void *)ATMEL_BASE_MMCI + MMCI_##reg)
Correct. However atmel_mci is the "old" driver, at at91 we are using the common mmc driver gen_atmel_mci. This one should work for avr32 as well (not tested).
0005-AT91-replace-AT91_BASE_SPI-with-ATMEL_BASE_SPI0.patch
[atmel_dataflash_spi.c]
This is a separate patch for the rework of the *generic ATMEL* drivers. It should mention in the subject that it fixes the spi-dataflash driver. I can also squash that one into the "ATMEL: fix related common atmel driver files patch". However
feel free to do so if is convenient for you
For the at91sam9*ek port I had to convert dataflash_spi as well, and fixed the timeout loops to use the correct way. It would be good if you tested that on your board as well.
0006-AT91-move-spi-generic-function-from-top9000-board-to.patch
[spi_cs* functions]
Those functions are not generic. They might be similar on most at91sam9260/9g20/9xe boards but the use of GPIO pins as SPI chip selects is truly board specific. Note that top9000 defines 2x SPI with 4 chip selects each and therefore allows pins to flicker that in other boards might be used for different purposes. You can duplicate the functions but
That not true, I found that those 8 chip select are defined in **exactly** the same way inside at91sm9g20 datasheet. Finally I don't understand WHY those function are used to enable/disable CS when this function should be managed in hw...
According to comments in atmel_spi.c the hardware method is either broken or not flexible enough to hold CS active between individual calls to spi_transfers.
What do you suggest? I should replicate this code or keep a shared file for at91sam9260/9g20/9xe boards and leave avr32 in a separate file?
Not entirely true. Only *IF* you use the (supposedly broken) hardware assertion of the CS lines you are bound to exact those Pins (and above functions could be empty anyway). If you use software methods to assert CS lines (like those functions implement) you are free to use any GPIO pin or even pins at other devices to select an SPI peripheral.
Again: those functions spi_cs_* do not belong into the common SPI driver. You should also see that other AT91 chips and of course AVR32 use different hardware-assigned pins for SPI CS. They do belong in your board port.
Best Regards, Reinhard

Dear Reinhard,
2010/11/10 Reinhard Meyer u-boot@emk-elektronik.de:
Correct. However atmel_mci is the "old" driver, at at91 we are using the common mmc driver gen_atmel_mci. This one should work for avr32 as well (not tested).
Thanks for all your comments, now I finished to do some tests using my board definition over the atmel/at91avr32rework-3 branch and now I have only one issue.
The problem is related to the new MMC driver, simple the mmc driver don't recognize my cards and also "mmc info" returns no info.
As doc/README.atmel_mci suggest I add the appropriate code to .h and board init.
Here the boot log:
U-Boot 2010.12-rc1-00054-gb535a8c (Nov 13 2010 - 18:07:19)
CPU: AT91SAM9G20 Crystal frequency: 18.432 MHz CPU clock : 396.288 MHz Master clock : 132.096 MHz DRAM: 64 MiB MMC: DataFlash:AT45DB642 Nb pages: 8192
Page Size: 1056 Size= 8650752 bytes Logical address: 0xD0000000 Area 0: D0000000 to D00041FF (RO) Bootstrap Area 1: D0004200 to D00083FF Environment Area 2: D0008400 to D0041FFF (RO) U-Boot Area 3: D0042000 to D0251FFF Kernel Area 4: D0252000 to D083FFFF FS *** Warning - bad CRC, using default environment
In: serial Out: serial Err: serial Net: macb0 Hit any key to stop autoboot: 0 MMC Device 0 not found ** Block device mmc 0 not supported ## Executing script at 20000000 Wrong image format for "source" command
Here the board definition: [PATCH] AT91: Add support for NetusG20
Add support for the NetusG20 board by Acmesystems srl. This board is based on AT91SAM9G20 SoC.
Signed-off-by: Claudio Mignanti c.mignanti@gmail.com --- MAINTAINERS | 5 + board/acmesystems/netusg20/Makefile | 55 ++++++++++ board/acmesystems/netusg20/netusg20.c | 130 ++++++++++++++++++++++++ board/acmesystems/netusg20/partition.c | 39 +++++++ boards.cfg | 1 + include/configs/netusg20.h | 173 ++++++++++++++++++++++++++++++++ 6 files changed, 403 insertions(+), 0 deletions(-) create mode 100644 board/acmesystems/netusg20/Makefile create mode 100644 board/acmesystems/netusg20/netusg20.c create mode 100644 board/acmesystems/netusg20/partition.c create mode 100644 include/configs/netusg20.h
diff --git a/MAINTAINERS b/MAINTAINERS index ccece74..7ce96b5 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -852,6 +852,11 @@ Alex Z lart SA1100 dnp1110 SA1110
+ +Claudio Mignanti c.mignanti@gmail.com + + netusg20 ARM926EJS (AT91SAM9G20 SoC) + -------------------------------------------------------------------------
Unknown / orphaned boards: diff --git a/board/acmesystems/netusg20/Makefile b/board/acmesystems/netusg20/Makefile new file mode 100644 index 0000000..09e6695 --- /dev/null +++ b/board/acmesystems/netusg20/Makefile @@ -0,0 +1,55 @@ +# +# (C) Copyright 2003-2008 +# Wolfgang Denk, DENX Software Engineering, wd@denx.de. +# +# (C) Copyright 2008 +# Stelian Pop stelian.pop@leadtechdesign.com +# Lead Tech Design <www.leadtechdesign.com> +# +# See file CREDITS for list of people who contributed to this +# project. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of +# the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, +# MA 02111-1307 USA +# + +include $(TOPDIR)/config.mk + +LIB = $(obj)lib$(BOARD).a + +COBJS-$(CONFIG_NETUSG20) += netusg20.o +COBJS-y += partition.o + +SRCS := $(SOBJS:.o=.S) $(COBJS-y:.o=.c) +OBJS := $(addprefix $(obj),$(COBJS-y)) +SOBJS := $(addprefix $(obj),$(SOBJS)) + +$(LIB): $(obj).depend $(OBJS) $(SOBJS) + $(AR) $(ARFLAGS) $@ $(OBJS) $(SOBJS) + +clean: + rm -f $(SOBJS) $(OBJS) + +distclean: clean + rm -f $(LIB) core *.bak $(obj).depend + +######################################################################### + +# defines $(obj).depend target +include $(SRCTREE)/rules.mk + +sinclude $(obj).depend + +######################################################################### diff --git a/board/acmesystems/netusg20/netusg20.c b/board/acmesystems/netusg20/netusg20.c new file mode 100644 index 0000000..7190f41 --- /dev/null +++ b/board/acmesystems/netusg20/netusg20.c @@ -0,0 +1,130 @@ +/* + * (C) Copyright 2007-2008 + * Stelian Pop stelian.pop@leadtechdesign.com + * Lead Tech Design <www.leadtechdesign.com> + * + * (C) Copyright 2010 + * Reinhard Meyer, EMK Elektronik, reinhard.meyer@emk-elektronik.de + * Claudio Mignanti c.mignanti@gmail.com + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ +#include <common.h> +#include <net.h> +#include <netdev.h> +#include <mmc.h> +#include <i2c.h> +#include <spi.h> +#include <asm/io.h> +#include <asm/arch/hardware.h> +#include <asm/arch/at91sam9260_matrix.h> +#include <asm/arch/at91sam9260.h> +#include <asm/arch/at91_common.h> +#include <asm/arch/at91_pmc.h> +#include <asm/arch/at91_rstc.h> +#include <asm/arch/gpio.h> + +DECLARE_GLOBAL_DATA_PTR; + +/* ------------------------------------------------------------------------- */ +/* + * Miscellaneous platform dependent initialisations + */ +#ifdef CONFIG_MACB +static void netus_macb_init(void) +{ + struct at91_pmc *pmc = (struct at91_pmc *)ATMEL_BASE_PMC; + + /* Enable EMAC clock */ + writel(1 << ATMEL_ID_EMAC0, &pmc->pcer); + + /* Initialize EMAC=MACB hardware */ + at91_macb_hw_init(); +} + +int board_eth_init(bd_t *bis) +{ + int rc = 0; + rc = macb_eth_initialize(0, (void *)ATMEL_BASE_EMAC0, 0x00); + return rc; +} +#else +/* code is more readable if #directive are around the function + * and not in the middle */ +void netus_macb_init(void) {} /* define of dummy function */ +int board_eth_init(bd_t *bis) { return 0;} +#endif + +int board_early_init_f(void) +{ + struct at91_pmc *pmc = (struct at91_pmc *)ATMEL_BASE_PMC; + + /* Enable clocks for all PIOs */ + writel( (1 << ATMEL_ID_PIOA) | (1 << ATMEL_ID_PIOB) | + (1 << ATMEL_ID_PIOC), + &pmc->pcer); + + return 0; +} + +#ifdef CONFIG_GENERIC_ATMEL_MCI +int netus_mmc_init(void) +{ + struct at91_pmc *pmc = (struct at91_pmc *)ATMEL_BASE_PMC; + + /* Enable MCI clock */ + writel(1 << ATMEL_ID_MCI, &pmc->pcer); + at91_mci_hw_init(); + + /* This calls the atmel_mmc_init in gen_atmel_mci.c */ + return atmel_mci_init((void *)ATMEL_BASE_MCI); +} + +/* this is a weak define that we are overriding */ +int board_mmc_getcd(u8 *cd, struct mmc *mmc) +{ + /* + *return *cs = TRUE if card is NOT detected + */ + *cs = 0; + return 0; +} +#else +void netus_mmc_init(void) {} +#endif + +int board_init (void) { + + gd->bd->bi_arch_number = 3129; //MACH_TYPE_ACMENETUSFOXG20 + /* adress of boot parameters */ + gd->bd->bi_boot_params = CONFIG_SYS_SDRAM_BASE + 0x100; + + netus_macb_init(); + netus_mmc_init(); + return 0; +} + +int dram_init(void) +{ + gd->ram_size = get_ram_size( + (void *)CONFIG_SYS_SDRAM_BASE, + CONFIG_SYS_SDRAM_SIZE); + return 0; +} + diff --git a/board/acmesystems/netusg20/partition.c b/board/acmesystems/netusg20/partition.c new file mode 100644 index 0000000..7d79e53 --- /dev/null +++ b/board/acmesystems/netusg20/partition.c @@ -0,0 +1,39 @@ +/* + * (C) Copyright 2008 + * Ulf Samuelsson ulf@atmel.com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + */ +#include <common.h> +#include <config.h> +#include <asm/hardware.h> +#include <dataflash.h> + +AT91S_DATAFLASH_INFO dataflash_info[CONFIG_SYS_MAX_DATAFLASH_BANKS]; + +struct dataflash_addr cs[CONFIG_SYS_MAX_DATAFLASH_BANKS] = { + {CONFIG_SYS_DATAFLASH_LOGIC_ADDR_CS1, 1} +}; + +/*define the area offsets*/ +dataflash_protect_t area_list[NB_DATAFLASH_AREA] = { + {0x00000000, 0x000041FF, FLAG_PROTECT_SET, 0, "Bootstrap"}, + {0x00004200, 0x000083FF, FLAG_PROTECT_CLEAR, 0, "Environment"}, + {0x00008400, 0x00041FFF, FLAG_PROTECT_SET, 0, "U-Boot"}, + {0x00042000, 0x00251FFF, FLAG_PROTECT_CLEAR, 0, "Kernel"}, + {0x00252000, 0xFFFFFFFF, FLAG_PROTECT_CLEAR, 0, "FS"}, +}; diff --git a/boards.cfg b/boards.cfg index 648603d..97382f2 100644 --- a/boards.cfg +++ b/boards.cfg @@ -377,6 +377,7 @@ smdk2400 arm arm920t - samsung s3c24x0 smdk2410 arm arm920t - samsung s3c24x0 voiceblue arm arm925t omap1510inn arm arm925t - ti +netusg20 arm arm926ejs - acmesystems at91 afeb9260 arm arm926ejs - - at91 at91cap9adk arm arm926ejs - atmel at91 davinci_dvevm arm arm926ejs dvevm davinci davinci diff --git a/include/configs/netusg20.h b/include/configs/netusg20.h new file mode 100644 index 0000000..74a9371 --- /dev/null +++ b/include/configs/netusg20.h @@ -0,0 +1,173 @@ +/* + * (C) Copyright 2009-2010 + * Reinhard Meyer, EMK Elektronik, reinhard.meyer@emk-elektronik.de + * Claudio Mignanti c.mignanti@gmail.com + * + * Configuation settings for the NetusG20 boards. + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +#ifndef __CONFIG_H +#define __CONFIG_H + + +#define CONFIG_AT91SAM9G20 +#define CONFIG_NETUSG20 +#include <asm/hardware.h> + +#define CONFIG_SYS_TEXT_BASE 0x23f00000 + +/* ARM asynchronous clock */ +#define CONFIG_SYS_AT91_SLOW_CLOCK 32768 +#define CONFIG_SYS_AT91_MAIN_CLOCK 18432000 /* 18.432 MHz */ +#define CONFIG_SYS_HZ 1000 + +/* Misc CPU related */ +#define CONFIG_ARCH_CPU_INIT +#undef CONFIG_USE_IRQ /* we don't need IRQ/FIQ stuff */ +#define CONFIG_CMDLINE_TAG /* enable passing of ATAGs */ +#define CONFIG_SETUP_MEMORY_TAGS +#define CONFIG_INITRD_TAG +#define CONFIG_SKIP_LOWLEVEL_INIT +#define CONFIG_BOARD_EARLY_INIT_F +#define CONFIG_DISPLAY_CPUINFO + +/* General purpose I/O */ +#define CONFIG_ATMEL_LEGACY /* required until (g)pio is fixed */ +#define CONFIG_AT91_GPIO +#define CONFIG_AT91_GPIO_PULLUP 1 /* keep pullups on peripheral pins */ + +/* Serial console */ +#define CONFIG_ATMEL_USART +#define CONFIG_USART_BASE ATMEL_BASE_DBGU +#define CONFIG_USART_ID ATMEL_ID_SYS +#define CONFIG_BAUDRATE 115200 +#define CONFIG_SYS_BAUDRATE_TABLE {115200 , 19200, 38400, 57600, 9600 } +#define CONFIG_BOARD_EARLY_INIT_F +#define CONFIG_BOOTDELAY 3 + +/* + * BOOTP options + */ +#define CONFIG_BOOTP_BOOTFILESIZE 1 +#define CONFIG_BOOTP_BOOTPATH 1 +#define CONFIG_BOOTP_GATEWAY 1 +#define CONFIG_BOOTP_HOSTNAME 1 + +/* + * Command line configuration. + */ +#include <config_cmd_default.h> +#undef CONFIG_CMD_FPGA +#undef CONFIG_CMD_IMLS /* related to flash support, so uneeded */ + +#define CONFIG_CMD_DHCP 1 +#define CONFIG_CMD_USB 1 +#define CONFIG_CMD_PING 1 + +/* SDRAM */ +#define CONFIG_NR_DRAM_BANKS 1 +#define CONFIG_SYS_SDRAM_BASE ATMEL_BASE_CS1 +#define CONFIG_SYS_SDRAM_SIZE 0x04000000 + +# define CONFIG_SYS_INIT_SP_ADDR \ + (ATMEL_BASE_SRAM1 + 0x1000 - GENERATED_GBL_DATA_SIZE) + +/* DataFlash */ +#define CONFIG_ATMEL_DATAFLASH_SPI +#define CONFIG_HAS_DATAFLASH 1 +#define CONFIG_SYS_SPI_WRITE_TOUT (5*CONFIG_SYS_HZ) +#define CONFIG_SYS_MAX_DATAFLASH_BANKS 1 +#define CONFIG_SYS_DATAFLASH_LOGIC_ADDR_CS1 0xD0000000 /* CS1 */ +#define AT91_SPI_CLK 15000000 + +#define DATAFLASH_TCSS (0x22 << 16) +#define DATAFLASH_TCHS (0x1 << 24) + +/* no NAND flash on this board*/ +#define CONFIG_SYS_NO_FLASH + +/* Ethernet */ +#define CONFIG_MACB 1 +#define CONFIG_RMII 1 +#define CONFIG_NET_MULTI 1 +#define CONFIG_NET_RETRY_COUNT 20 + +/* MMC */ +#define CONFIG_MMC +#define CONFIG_GENERIC_MMC +#define CONFIG_GENERIC_ATMEL_MCI + +/* USB */ +#define CONFIG_USB_ATMEL +#define CONFIG_USB_OHCI_NEW 1 +#define CONFIG_DOS_PARTITION 1 +#define CONFIG_SYS_USB_OHCI_CPU_INIT 1 +#define CONFIG_SYS_USB_OHCI_REGS_BASE 0x00500000 +#define CONFIG_SYS_USB_OHCI_SLOT_NAME "at91sam9260" +#define CONFIG_SYS_USB_OHCI_MAX_ROOT_PORTS 2 +#define CONFIG_USB_STORAGE 1 + +#define CONFIG_SYS_LOAD_ADDR 0x22000000 /* load address */ + +#define CONFIG_SYS_MEMTEST_START CONFIG_SYS_SDRAM_BASE +#define CONFIG_SYS_MEMTEST_END 0x23e00000 + +/* Filesystem */ +#define CONFIG_CMD_FAT 1 +#define CONFIG_CMD_EXT2 1 +#define CONFIG_CMD_MMC 1 + +/* bootstrap + u-boot + env + linux in dataflash on CS1 */ +#define CONFIG_ENV_IS_IN_DATAFLASH 1 +#define CONFIG_SYS_MONITOR_BASE (CONFIG_SYS_DATAFLASH_LOGIC_ADDR_CS1 + 0x8400) +#define CONFIG_ENV_OFFSET 0x4200 +#define CONFIG_ENV_ADDR \ + (CONFIG_SYS_DATAFLASH_LOGIC_ADDR_CS1 + CONFIG_ENV_OFFSET) +#define CONFIG_ENV_SIZE 0x4200 +#define CONFIG_BOOTCOMMAND "mmc init; sleep 1; " \ + "ext2load mmc 0 0x20000000 uImage; " \ + "source 0x20000000" +#define CONFIG_BOOTARGS "mem=64M console=ttyS0,115200 " \ + "root=/dev/mmcblk0p1 rootwait" + +#define CONFIG_BAUDRATE 115200 +#define CONFIG_SYS_BAUDRATE_TABLE {115200 , 19200, 38400, 57600, 9600 } + +#define CONFIG_SYS_PROMPT "U-Boot> " +#define CONFIG_SYS_CBSIZE 256 +#define CONFIG_SYS_MAXARGS 16 +#define CONFIG_SYS_PBSIZE \ + (CONFIG_SYS_CBSIZE + sizeof(CONFIG_SYS_PROMPT) + 16) +#define CONFIG_SYS_LONGHELP 1 +#define CONFIG_CMDLINE_EDITING 1 + +/* + * Size of malloc() pool + */ +#define CONFIG_SYS_MALLOC_LEN ROUND(3 * CONFIG_ENV_SIZE + 128*1024, 0x1000) + +#define CONFIG_STACKSIZE (32*1024) /* regular stack */ + +#ifdef CONFIG_USE_IRQ +#error CONFIG_USE_IRQ not supported +#endif + +#endif

Dear Claudio Mignanti,
The problem is related to the new MMC driver, simple the mmc driver don't recognize my cards and also "mmc info" returns no info.
Just a blind shot: is your MCI on port B (like it is on the at91sam9xxx-ek)? Then define CONFIG_ATMEL_MCI_PORTB.
Best Regards, Reinhard

Dear Reinhard Meyer
2010/11/13 Reinhard Meyer u-boot@emk-elektronik.de:
The problem is related to the new MMC driver, simple the mmc driver don't recognize my cards and also "mmc info" returns no info.
Just a blind shot: is your MCI on port B (like it is on the at91sam9xxx-ek)? Then define CONFIG_ATMEL_MCI_PORTB.
Yes, my board is based on at91sam9g20-ek but also define CONFIG_ATMEL_MCI_PORTB don't help.

Dear Claudio Mignanti,
2010/11/13 Reinhard Meyer u-boot@emk-elektronik.de:
The problem is related to the new MMC driver, simple the mmc driver don't recognize my cards and also "mmc info" returns no info.
Just a blind shot: is your MCI on port B (like it is on the at91sam9xxx-ek)? Then define CONFIG_ATMEL_MCI_PORTB.
Yes, my board is based on at91sam9g20-ek but also define CONFIG_ATMEL_MCI_PORTB don't help.
Did it work with the old driver? What #defines were used then?
Can you #define DEBUG 1 in gen_atmel_mci.c and see what is printed?
Best Regards, Reinhard
participants (5)
-
Albert ARIBAUD
-
Andreas Bießmann
-
Claudio
-
Claudio Mignanti
-
Reinhard Meyer