Skip to contentSkip to conversation

Porting to Marvell 88F5182?

DISCUSSION Rogan Dawes 3 participants 11 messages Jul 30, 2010 – Aug 2, 2010

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

Hi folks,

I am trying to get a decent boot loader running on my DLink DNS323. It was shipped with a severely crippled version of U-Boot, forked from U-Boot 1.1.1, and heavily bastardized by Marvell.

Recently, Albert Aribaud has added support for this chipset in U-Boot master for his LaCie ED MiniV2, which is based on the same SoC, and I am now trying to get my DLink DNS323 to work as well.

I have managed to get just about everything to work, except for the flash part, a Spansion S29GL064M90TFIR4 device. Unfortunately, there seems to be some strange connections going on, and the standard U-Boot CFI code does not recognise it.

I see that there has been a lot of changes to the BareBox CFI code since it was forked from U-Boot 1.2.0, and I was wondering if maybe that code would be more successful.

So, the question then:

Given a working board definition in U-Boot master for an ARM926EJ-S based Soc, how difficult is it to port this to current BareBox master?

Thanks!

Rogan

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

#1 lore raw
Quoted 6 lines · Rogan Dawes

Hi folks,

I am trying to get a decent boot loader running on my DLink DNS323. It was shipped with a severely crippled version of U-Boot, forked from U-Boot 1.1.1, and heavily bastardized by Marvell.

[...]

Quoted 5 lines

I have managed to get just about everything to work, except for the flash part, a Spansion S29GL064M90TFIR4 device. Unfortunately, there seems to be some strange connections going on, and the standard U-Boot CFI code does not recognise it.

Since I'd be chainloading barebox from the existing U-Boot, which does support loadb and bootm, it probably makes the most sense initially to just skip the lowlevel init, and build a minimal ARM second stage, and wrap it in a u-boot image, I think.

I tried using the at91sam9263ek_defconfig, and unsetting CONFIG_MACH_DO_LOWLEVEL_INIT.

My CROSS_COMPILE env variable was set to:

CROSS_COMPILE=arm-linux-gnueabi-

I then made it into a uImage using:

mkimage -A arm -O u-boot -T kernel -C none -a 0x800000 -e 0x800000 -n "Barebox" -d barebox.bin uImage.bin

Unfortunately, it hung as soon as I tried to execute it in U-Boot:

Marvell> bootm
## Booting image at 00100000 ...

   Image Name:   Barebox
   Image Type:   ARM U-Boot Kernel Image (uncompressed)
   Data Size:    176100 Bytes = 172 kB

Load Address: 00800000
Entry Point: 00800000
Verifying Checksum ... OK
OK

Starting kernel ...

Any suggestions for a better (minimal?) defconfig to start from, or other things to try?

Many thanks!

Rogan

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

#2 lore raw

Hi Rogan,

Quoted 7 lines · Rogan Dawes

Since I'd be chainloading barebox from the existing U-Boot, which does support loadb and bootm, it probably makes the most sense initially to just skip the lowlevel init, and build a minimal ARM second stage, and wrap it in a u-boot image, I think.

I tried using the at91sam9263ek_defconfig, and unsetting CONFIG_MACH_DO_LOWLEVEL_INIT.

that won't work : you don't have the same memory mapping so barebox has little chance to be in ram on your platform and, even if it was in RAM as soon as it will poll for the serial port tx empty bit, you will stay blocked because your serial port is not the same as the at91sam9263.

Eric

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

#3 lore raw
Quoted 11 lines · Eric Bénard

Hi Rogan,

Quoted 7 lines · Rogan Dawes

Since I'd be chainloading barebox from the existing U-Boot, which does support loadb and bootm, it probably makes the most sense initially to just skip the lowlevel init, and build a minimal ARM second stage, and wrap it in a u-boot image, I think.

I tried using the at91sam9263ek_defconfig, and unsetting CONFIG_MACH_DO_LOWLEVEL_INIT.

Quoted 6 lines

that won't work : you don't have the same memory mapping so barebox has little chance to be in ram on your platform and, even if it was in RAM as soon as it will poll for the serial port tx empty bit, you will stay blocked because your serial port is not the same as the at91sam9263.

Eric

Hi Eric,

Ok, that makes sense, I guess. So the bare minimum I absolutely have to do is set up the serial port.

But won't the second stage loader simply use the existing memory map? I suppose I could tell it what it actually is, if it can't figure it out. I'm a little surprised it doesn't "just work", because I am currently booting using an old U-boot, chaining to a newly compiled U-Boot, and it "just works" (apart from the flash).

Regards,

Rogan

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

#4 lore raw
Quoted 3 lines · Rogan Dawes

Ok, that makes sense, I guess. So the bare minimum I absolutely have to do is set up the serial port.

and also memory mapping + timer

Quoted 6 lines

But won't the second stage loader simply use the existing memory map? I suppose I could tell it what it actually is, if it can't figure it out. I'm a little surprised it doesn't "just work", because I am currently booting using an old U-boot, chaining to a newly compiled U-Boot, and it "just works" (apart from the flash).

yes but the new u-boot has all the necessary low level access for your hardware !

Eric

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

#5 lore raw
Quoted 5 lines · Eric Bénard
Quoted 3 lines · Rogan Dawes

Ok, that makes sense, I guess. So the bare minimum I absolutely have to do is set up the serial port.

and also memory mapping + timer

Ok.

Quoted 8 lines
Quoted 6 lines

But won't the second stage loader simply use the existing memory map? I suppose I could tell it what it actually is, if it can't figure it out. I'm a little surprised it doesn't "just work", because I am currently booting using an old U-boot, chaining to a newly compiled U-Boot, and it "just works" (apart from the flash).

yes but the new u-boot has all the necessary low level access for your hardware !

Well, the new U-Boot also skips the lowlevel init code, so . . .

What that actually means in practice, I'm not 100% sure.

Regards,

Rogan

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

#6 lore raw
Quoted 11 lines · Rogan Dawes
Quoted 8 lines
Quoted 6 lines

But won't the second stage loader simply use the existing memory map? I suppose I could tell it what it actually is, if it can't figure it out. I'm a little surprised it doesn't "just work", because I am currently booting using an old U-boot, chaining to a newly compiled U-Boot, and it "just works" (apart from the flash).

yes but the new u-boot has all the necessary low level access for your hardware !

Well, the new U-Boot also skips the lowlevel init code, so . . .

what it skips is "only" sdram and pll setup, not serial drivers or timer functions.

Eric

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

#7 lore raw
Quoted 11 lines · Eric Bénard
Quoted 10 lines · Rogan Dawes
Quoted 9 lines
Quoted 7 lines

But won't the second stage loader simply use the existing memory map? I suppose I could tell it what it actually is, if it can't figure it out. I'm a little surprised it doesn't "just work", because I am currently booting using an old U-boot, chaining to a newly compiled U-Boot, and it
"just works" (apart from the flash).

yes but the new u-boot has all the necessary low level access for your hardware !

Quoted 6 lines
Quoted 2 lines

Well, the new U-Boot also skips the lowlevel init code, so . . .

what it skips is "only" sdram and pll setup, not serial drivers or timer functions.

Eric

Ok, cool. Which is the simplest ARM board for me to use as a template?

I'm not much of a coder, more a "copy and paste monkey", I'm afraid, so I dunno how well I'll do :-) But I'm willing to give it a shot!

I've looked at the arch/arm/mach-s3c24xx directory, which *seems* to be the simplest (in terms of fewest files :-) ). Would this be a reasonable place to start?

Rogan

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

#8 lore raw
Quoted 2 lines · Rogan Dawes

Ok, cool. Which is the simplest ARM board for me to use as a template?

I don't know which is the simplest, you will have to wait for Sascha's answer as he is the best person who can answer to this question.

Quoted 3 lines

I'm not much of a coder, more a "copy and paste monkey", I'm afraid, so I dunno how well I'll do :-) But I'm willing to give it a shot!

before copy and pasting things, maybe you should look how a same board is supported under barebox & u-boot and then you will be able to port u-boot support of your cpu & board to barebox.

You may also find some hints in Documentation/porting.txt

Quoted 4 lines

I've looked at the arch/arm/mach-s3c24xx directory, which *seems* to be the simplest (in terms of fewest files :-) ). Would this be a reasonable place to start?

You also need to look (at least) in drivers/serial.

Eric

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

#9 lore raw
Quoted 6 lines · Eric Bénard
Quoted 2 lines · Rogan Dawes

Ok, cool. Which is the simplest ARM board for me to use as a template?

I don't know which is the simplest, you will have to wait for Sascha's answer as he is the best person who can answer to this question.

Quoted 8 lines
Quoted 3 lines

I'm not much of a coder, more a "copy and paste monkey", I'm afraid, so I dunno how well I'll do :-) But I'm willing to give it a shot!

before copy and pasting things, maybe you should look how a same board is supported under barebox & u-boot and then you will be able to port u-boot support of your cpu & board to barebox.

You may also find some hints in Documentation/porting.txt

That's good advice. Thanks!

Quoted 7 lines
Quoted 4 lines

I've looked at the arch/arm/mach-s3c24xx directory, which *seems* to be the simplest (in terms of fewest files :-) ). Would this be a reasonable place to start?

You also need to look (at least) in drivers/serial.

Eric

Thanks for your help!

Rogan

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

#10 lore raw
In reply to Rogan Dawes

Hi Rogan,

Quoted 15 lines · Rogan Dawes

Hi folks,

I am trying to get a decent boot loader running on my DLink DNS323. It was shipped with a severely crippled version of U-Boot, forked from U-Boot 1.1.1, and heavily bastardized by Marvell.

Recently, Albert Aribaud has added support for this chipset in U-Boot master for his LaCie ED MiniV2, which is based on the same SoC, and I am now trying to get my DLink DNS323 to work as well.

I have managed to get just about everything to work, except for the flash part, a Spansion S29GL064M90TFIR4 device. Unfortunately, there seems to be some strange connections going on, and the standard U-Boot CFI code does not recognise it.

Quoted 8 lines

I see that there has been a lot of changes to the BareBox CFI code since it was forked from U-Boot 1.2.0, and I was wondering if maybe that code would be more successful.

So, the question then:

Given a working board definition in U-Boot master for an ARM926EJ-S based Soc, how difficult is it to port this to current BareBox master?

The simplest port I can think of is the following patch which adds minimal support for the pxa270. It supports 2nd stage only, so this should be a good start for you. For getting this to run it's a good idea to determine the tx register of your serial port under U-Boot. Just try to do a 'mw <txreg> <0x55> under U-Boot. When you see a capital 'U' you got it. You can then add

#include <asm/io.h>

	writel(0x55, txreg);

in the startup code in barebox to see if you get there.

Other what Eric suggested I recommend to just use the barebox.bin file. You can start it with the 'go' command in U-Boot.

The patch is a bit out of date, so it probably won't apply directly.

Hope that helps

Sascha

commit aed89d7f0294039b623f7ce68276e5e9ab026b00

Author: Sascha Hauer <[email protected]>
Date:   Sat Oct 10 17:45:10 2009 +0200

pxa minimal port

arch/arm/Kconfig +13 -0
index 441dfb6..6883f7e 100644
@@ -21,6 +21,7 @@ config ARCH_TEXT_BASE
 	default 0x33fc0000 if MACH_A9M2440
 	default 0x23f00000 if MACH_MMCCPU
 	default 0xa0000000 if MACH_EUKREA_CPUIMX27
+	default 0xa3f00000 if MACH_PCM027
 
 config BOARDINFO
 	default "Synertronixx scb9328" if MACH_SCB9328
@@ -39,6 +40,7 @@ config BOARDINFO
 	default "Phytec phyCard-i.MX27" if MACH_PCA100
 	default "Bucyrus MMC-CPU" if MACH_MMCCPU
 	default "Eukrea CPUIMX27" if MACH_EUKREA_CPUIMX27
+	default "Phytec phyCORE-PXA270" if MACH_PCM027
 
 config BOARD_LINKER_SCRIPT
 	bool
@@ -90,6 +92,9 @@ config ARCH_AT91SAM9263
 	select ARCH_AT91SAM9
 	select MACH_HAS_LOWLEVEL_INIT
 
+config ARCH_PXA
+	bool
+
 choice
 	prompt "Select your board"
 
@@ -257,6 +262,14 @@ config MACH_EUKREA_CPUIMX27
 	  Say Y here if you are using Eukrea's CPUIMX27 equipped
 	  with a Freescale i.MX27 Processor
 
+config MACH_PCM027
+	bool "Phytec phyCORE-PXA270"
+	select HAS_CFI
+	select ARCH_PXA
+	help
+	  Say Y here if you are using a Phytec phyCORE PXA270
+	  board
+
 endchoice
 
 source arch/arm/mach-imx/Kconfig
arch/arm/Makefile +2 -0
index 83fe532..ae2de97 100644
@@ -8,6 +8,7 @@ machine-$(CONFIG_ARCH_AT91RM9200)  := at91rm9200
 machine-$(CONFIG_ARCH_OMAP)        := omap
 machine-$(CONFIG_ARCH_AT91SAM9)    := at91sam9
 machine-$(CONFIG_ARCH_S3C24xx)     := s3c24xx
+machine-$(CONFIG_ARCH_PXA)         := pxa
 board-$(CONFIG_MACH_MX1ADS)	   := mx1ads
 board-$(CONFIG_MACH_ECO920)	   := eco920
 board-$(CONFIG_MACH_SCB9328)	   := scb9328
@@ -27,6 +28,7 @@ board-$(CONFIG_MACH_PCA100)        := phycard-i.MX27
 board-$(CONFIG_MACH_MMCCPU)        := mmccpu
 board-$(CONFIG_MACH_A9M2440)       := a9m2440
 board-$(CONFIG_MACH_EUKREA_CPUIMX27) := eukrea_cpuimx27
+board-$(CONFIG_MACH_PCM027)        := pcm027
 
 # FIXME "cpu-y" never used on ARM!
 cpu-$(CONFIG_ARM920T)              := arm920t
arch/arm/cpu/Makefile +1 -0
index 3b6a6d7..c7e522e 100644
@@ -9,6 +9,7 @@ obj-$(CONFIG_ARM926EJS) += start-arm.o
 obj-$(CONFIG_ARMCORTEXA8) += start-arm.o
 obj-$(CONFIG_ARCH_IMX31) += start-arm.o
 obj-$(CONFIG_ARCH_IMX35) += start-arm.o
+obj-$(CONFIG_ARCH_PXA) += start-arm.o
 obj-$(CONFIG_CMD_ARM_CPUINFO) += cpuinfo.o
 obj-$(CONFIG_MMU) += mmu.o
 obj-$(CONFIG_MMU) += cache.o
arch/arm/mach-pxa/Makefile new file +1 -0
new file mode 100644
index 0000000..9b82b6d
@@ -0,0 +1 @@
+obj-y	+= common.o clocksource.o
arch/arm/mach-pxa/clocksource.c new file +50 -0

50 lines not on this page · raw message

arch/arm/mach-pxa/common.c new file +20 -0
new file mode 100644
index 0000000..3653109
@@ -0,0 +1,20 @@
+#include <common.h>
+#include <asm/io.h>
+
+#define OSMR3	0x40A0000C
+#define OSCR	0x40A00010
+#define OSSR	0x40A00014
+#define OWER	0x40A00018
+
+#define OWER_WME	(1 << 0)	/* Watch-dog Match Enable */
+#define OSSR_M3		(1 << 3)	/* Match status channel 3 */
+
+void reset_cpu(ulong addr)
+{
+	/* Initialize the watchdog and let it fire */
+	writel(OWER_WME, OWER);
+	writel(OSSR_M3, OSSR);
+	writel(readl(OSCR) + 368640, OSMR3);  /* ... in 100 ms */
+
+	while(1);
+}
board/pcm027/Makefile new file +1 -0
new file mode 100644
index 0000000..dcfc293
@@ -0,0 +1 @@
+obj-y += board.o
board/pcm027/board.c new file +86 -0

86 lines not on this page · raw message

board/pcm027/config.h new file +0 -0
new file mode 100644
index 0000000..e69de29
board/pcm027/env/bin/_update new file +36 -0
new file mode 100644
index 0000000..fb7cbe8
@@ -0,0 +1,36 @@
+#!/bin/sh
+
+if [ -z "$part" -o -z "$image" ]; then
+	echo "define \$part and \$image"
+	exit 1
+fi
+
+if [ \! -e "$part" ]; then
+	echo "Partition $part does not exist"
+	exit 1
+fi
+
+if [ $# = 1 ]; then
+	image=$1
+fi
+
+if [ x$ip = xdhcp ]; then
+	dhcp
+fi
+
+ping $eth0.serverip
+if [ $? -ne 0 ] ; then
+	echo "update aborted"
+	exit 1
+fi
+
+unprotect $part
+
+echo
+echo "erasing partition $part"
+erase $part
+
+echo
+echo "flashing $image to $part"
+echo
+tftp $image $part
board/pcm027/env/bin/boot new file +40 -0
new file mode 100644
index 0000000..6d87838
@@ -0,0 +1,40 @@
+#!/bin/sh
+
+. /env/config
+
+if [ x$1 = xnet ]; then
+	root=net
+	kernel=net
+fi
+
+if [ x$1 = xnor ]; then
+	root=nor
+	kernel=nor
+fi
+
+if [ x$ip = xdhcp ]; then
+	bootargs="$bootargs ip=dhcp"
+else
+	bootargs="$bootargs ip=$eth0.ipaddr:$eth0.serverip:$eth0.gateway:$eth0.netmask:::"
+fi
+
+if [ x$root = xnor ]; then
+	bootargs="$bootargs root=$rootpart_nor rootfstype=jffs2"
+else
+	bootargs="$bootargs root=/dev/nfs nfsroot=$eth0.serverip:$nfsroot,v3,tcp"
+fi
+
+bootargs="$bootargs mtdparts=physmap-flash.0:$nor_parts"
+
+if [ $kernel = net ]; then
+	if [ x$ip = xdhcp ]; then
+		dhcp
+	fi
+	tftp $uimage uImage || exit 1
+	bootm uImage
+elif [ $kernel = nor ]; then
+	bootm /dev/nor0.kernel
+else
+	echo "please set kernel to either net or nor"
+fi
+
board/pcm027/env/bin/hush_hack new file +1 -0
new file mode 100644
index 0000000..5fffa92
@@ -0,0 +1 @@
+nand -a /dev/nand0.*
board/pcm027/env/bin/init new file +37 -0
new file mode 100644
index 0000000..5a1ded6
@@ -0,0 +1,37 @@
+#!/bin/sh
+
+PATH=/env/bin
+export PATH
+
+. /env/config
+if [ -e /dev/nor0 ]; then
+	addpart /dev/nor0 $nor_parts
+fi
+
+if [ -e /dev/nand0 ]; then
+	addpart /dev/nand0 $nand_parts
+
+	# Uh, oh, hush first expands wildcards and then starts executing
+	# commands. What a bug!
+	source /env/bin/hush_hack
+fi
+
+if [ -z $eth0.ethaddr ]; then
+	while [ -z $eth0.ethaddr ]; do
+		readline "no MAC address set for eth0. please enter the one found on your board: " eth0.ethaddr
+	done
+	echo -a /env/config "eth0.ethaddr=$eth0.ethaddr"
+fi
+
+echo
+echo -n "Hit any key to stop autoboot: "
+timeout -a $autoboot_timeout
+if [ $? != 0 ]; then
+	echo
+	echo "type update_kernel nand|nor [<imagename>] to update kernel into flash"
+	echo "type update_root nand|nor [<imagename>] to update rootfs into flash"
+	echo
+	exit
+fi
+
+boot
board/pcm027/env/bin/update_kernel new file +15 -0
new file mode 100644
index 0000000..05c822d
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+. /env/config
+
+image=$uimage
+if [ x$1 = xnand ]; then
+	part=/dev/nand0.kernel.bb
+elif [ x$1 = xnor ]; then
+	part=/dev/nor0.kernel
+else
+	echo "usage: $0 nor|nand [imagename]"
+	exit 1
+fi
+
+. /env/bin/_update $2
board/pcm027/env/bin/update_root new file +16 -0
new file mode 100644
index 0000000..eaf36eb
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+. /env/config
+
+image=$uimage
+if [ x$1 = xnand ]; then
+	part=/dev/nand0.root.bb
+elif [ x$1 = xnor ]; then
+	part=/dev/nor0.root
+else
+	echo "usage: $0 nor|nand [imagename]"
+	exit 1
+fi
+
+. /env/bin/_update $2
+
board/pcm027/env/config new file +25 -0
new file mode 100644
index 0000000..d5412a1
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+# can be either 'net', 'nor' or 'nand''
+kernel=net
+root=net
+
+uimage=uImage-pcm027
+jffs2=root-pcm037.jffs2
+
+autoboot_timeout=3
+
+nfsroot="/tmp"
+bootargs="console=ttyS0,115200"
+
+nor_parts="256k(uboot)ro,128k(ubootenv),1536k(kernel),-(root)"
+rootpart_nor="/dev/mtdblock3"
+
+# use 'dhcp' to do dhcp in uboot and in kernel
+ip=dhcp
+
+# or set your networking parameters here
+#eth0.ipaddr=a.b.c.d
+#eth0.netmask=a.b.c.d
+#eth0.gateway=a.b.c.d
+#eth0.serverip=a.b.c.d
drivers/serial/Kconfig +4 -0
index 6acce19..bac3f23 100644
@@ -57,4 +57,8 @@ config DRIVER_SERIAL_S3C24X0_AUTOSYNC
 	  Say Y here if you want to use the auto flow feature of this
 	  UART. RTS and CTS will be handled by the hardware when enabled.
 
+config DRIVER_SERIAL_PXA
+	bool "PXA serial driver"
+	depends on ARCH_PXA
+
 endmenu
drivers/serial/Makefile +1 -0
index 3bc965c..2005254 100644
@@ -13,3 +13,4 @@ obj-$(CONFIG_DRIVER_SERIAL_MPC5XXX)		+= serial_mpc5xxx.o
 obj-$(CONFIG_DRIVER_SERIAL_BLACKFIN)		+= serial_blackfin.o
 obj-$(CONFIG_DRIVER_SERIAL_NS16550)		+= serial_ns16550.o
 obj-$(CONFIG_DRIVER_SERIAL_S3C24X0)		+= serial_s3c24x0.o
+obj-$(CONFIG_DRIVER_SERIAL_PXA)			+= serial_pxa.o
drivers/serial/serial_pxa.c new file +179 -0

179 lines not on this page · raw message

Signature · 9 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox