[U-Boot] [PATCH v3 10/10] MIPS: start.S: emulate REVISION register for qemu-malta

Gabor Juhos juhosg at openwrt.org
Wed May 22 15:57:46 CEST 2013


On the origial Malta boards the REVISION register is
accessible at the 0x1fc00010 address. The contents of
this register gives information about the revision
of the Malta and Core Boards.

This register is used by the Linux kernel to identify
the actual board it is running on. However the register
is not emulated properly by Qemu, so put a hardcoded
value into the flash to make Linux work.

Signed-off-by: Gabor Juhos <juhosg at openwrt.org>
Cc: Daniel Schwierzeck <daniel.schwierzeck at googlemail.com>
---
Changes since v2:
 - rebased against the master branch of git.denx.de/u-boot.git

Changes since v1:
 - rebased against mips/testing

Changes since RFC: ---

Screenshot:

  U-Boot 2013.04-00246-gd93f756 (May 22 2013 - 14:18:54)

  Board: MIPS Malta CoreLV (Qemu)
  DRAM:  256 MiB
  pflash_write: Unimplemented flash cmd sequence (offset 0000000000000000, wcycle 0x0 cmd 0x0 value 0xf0)
  Flash: 4 MiB
  Using default environment

  In:    serial
  Out:   serial
  Err:   serial
  Net:   pcnet#0
  qemu-maltael # setenv ethaddr 00:11:22:33:44:55
  qemu-maltael # setenv ipaddr 10.0.2.1
  qemu-maltael # setenv serverip 10.0.2.2
  qemu-maltael # tftp openwrt-malta-le-uImage-gzip
  Using pcnet#0 device
  TFTP from server 10.0.2.2; our IP address is 10.0.2.1
  Filename 'openwrt-malta-le-uImage-gzip'.
  Load address: 0x81000000
  Loading:
           #################################################################
           #################################################################
           #################################################################
           #################################################################
           #################################################################
           #################################################################
           #################################################################
           ######################################################
           52.8 MiB/s
  done
  Bytes transferred = 2935968 (2ccca0 hex)
  qemu-maltael # bootm
  ## Booting kernel from Legacy Image at 81000000 ...
     Image Name:   MIPS OpenWrt Linux-3.8.13
     Image Type:   MIPS Linux Kernel Image (gzip compressed)
     Data Size:    2935904 Bytes = 2.8 MiB
     Load Address: 80100000
     Entry Point:  80104a90
     Verifying Checksum ... OK
     Uncompressing Kernel Image ... OK

  Starting kernel ...

  [    0.000000] Linux version 3.8.13 (juhosg at mag2) (gcc version 4.6.4 20121210 (prerelease) (Linaro GCC 4.6-2012.12) ) #1 SMP Wed May 22 14:13:27 CEST 2013
  [    0.000000] Config serial console: console=ttyS0,38400n8r
  [    0.000000] bootconsole [early0] enabled
  [    0.000000] CPU revision is: 00019300 (MIPS 24Kc)
  [    0.000000] FPU revision is: 00739300
  [    0.000000] Determined physical RAM map:
  [    0.000000]  memory: 00001000 @ 00000000 (reserved)
  [    0.000000]  memory: 000ef000 @ 00001000 (ROM data)
  [    0.000000]  memory: 00676000 @ 000f0000 (reserved)
  [    0.000000]  memory: 0f89a000 @ 00766000 (usable)
  [    0.000000] Wasting 60608 bytes for tracking 1894 unused pages
  [    0.000000] Initrd not found or empty - disabling initrd
  [    0.000000] Zone ranges:
  [    0.000000]   DMA      [mem 0x00000000-0x00ffffff]
  [    0.000000]   Normal   [mem 0x01000000-0x0fffffff]
  [    0.000000] Movable zone start for each node
  [    0.000000] Early memory node ranges
  [    0.000000]   node   0: [mem 0x00000000-0x0fffffff]
  [    0.000000] Primary instruction cache 2kB, VIPT, 2-way, linesize 16 bytes.
  [    0.000000] Primary data cache 2kB, 2-way, VIPT, no aliases, linesize 16 bytes
  [    0.000000] PERCPU: Embedded 7 pages/cpu @81203000 s6464 r8192 d14016 u32768
  [    0.000000] Built 1 zonelists in Zone order, mobility grouping on. Total pages: 65024
  [    0.000000] Kernel command line:  console=ttyS0,38400n8r
  [    0.000000] PID hash table entries: 1024 (order: 0, 4096 bytes)
  [    0.000000] Dentry cache hash table entries: 32768 (order: 5, 131072 bytes)
  [    0.000000] Inode-cache hash table entries: 16384 (order: 4, 65536 bytes)
  [    0.000000] __ex_table already sorted, skipping sort
  [    0.000000] Writing ErrCtl register=00000000
  [    0.000000] Readback ErrCtl register=00000000
  [    0.000000] Memory: 252260k/254568k available (2517k kernel code, 2308k reserved, 624k data, 3320k init, 0k highmem)
  [    0.000000] Hierarchical RCU implementation.
  [    0.000000]  RCU restricting CPUs from NR_CPUS=2 to nr_cpu_ids=1.
  [    0.000000] NR_IRQS:256
  [    0.000000] CPU frequency 199.93 MHz
  [    0.000000] Console: colour dummy device 80x25
  [    0.000000] Calibrating delay loop... 1168.17 BogoMIPS (lpj=5840896)
  [    0.120000] pid_max: default: 32768 minimum: 301
  [    0.120000] Mount-cache hash table entries: 512
  [    0.130000] Brought up 1 CPUs
  [    0.140000] NET: Registered protocol family 16
  [    0.180000] bio: create slab <bio-0> at 0
  [    0.190000] SCSI subsystem initialized
  [    0.190000] PCI host bridge to bus 0000:00
  [    0.190000] pci_bus 0000:00: root bus resource [mem 0x10000000-0x17ffffff]
  [    0.190000] pci_bus 0000:00: root bus resource [io 0x2000-0x1fffff]
  [    0.190000] pci_bus 0000:00: No busn resource found for root bus, will use [bus 00-ff]
  [    0.200000] pci 0000:00:0a.3: no compatible bridge window for [io 0x1100-0x110f]
  [    0.200000] pci 0000:00:0a.3: BAR 8: [io  0x1100-0x110f] has bogus alignment
  [    0.200000] pci 0000:00:0a.2: BAR 4: assigned [io  0x2000-0x201f]
  [    0.200000] pci 0000:00:0b.0: BAR 0: assigned [io  0x2020-0x203f]
  [    0.200000] pci 0000:00:0b.0: BAR 1: assigned [mem 0x10000000-0x1000001f]
  [    0.210000] pci 0000:00:0a.1: BAR 4: assigned [io  0x2040-0x204f]
  [    0.210000] Switching to clocksource MIPS
  [    0.240000] NET: Registered protocol family 2
  [    0.240000] TCP established hash table entries: 2048 (order: 2, 16384 bytes)
  [    0.250000] TCP bind hash table entries: 2048 (order: 2, 16384 bytes)
  [    0.250000] TCP: Hash tables configured (established 2048 bind 2048)
  [    0.250000] TCP: reno registered
  [    0.250000] UDP hash table entries: 256 (order: 1, 8192 bytes)
  [    0.250000] UDP-Lite hash table entries: 256 (order: 1, 8192 bytes)
  [    0.250000] NET: Registered protocol family 1
  [    0.350000] VFS: Disk quotas dquot_6.5.2
  [    0.360000] Dquot-cache hash table entries: 1024 (order 0, 4096 bytes)
  [    0.360000] squashfs: version 4.0 (2009/01/31) Phillip Lougher
  [    0.360000] jffs2: version 2.2 (NAND) (LZMA) (RTIME) (CMODE_PRIORITY) (c) 2001-2006 Red Hat, Inc.
  [    0.360000] msgmni has been set to 492
  [    0.360000] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 253)
  [    0.360000] io scheduler noop registered
  [    0.360000] io scheduler deadline registered (default)
  [    0.560000] Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
  [    0.590000] serial8250.0: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A
  [    0.590000] console [ttyS0] enabled, bootconsole disabled
  [    0.590000] console [ttyS0] enabled, bootconsole disabled
  [    0.610000] serial8250.0: ttyS1 at I/O 0x2f8 (irq = 3) is a 16550A
  [    0.640000] serial8250.0: ttyS2 at MMIO 0x1f000900 (irq = 20) is a 16550A
  [    0.660000] brd: module loaded
  [    0.660000] physmap platform flash device: 00400000 at 1e000000
  pflash_write: Unimplemented flash cmd sequence (offset 0000000000000000, wcycle 0x0 cmd 0x0 value 0xf000f0)
  [    0.660000] physmap-flash.0: Found 1 x32 devices at 0x0 in 32-bit bank. Manufacturer ID 0x000000 Chip ID 0x000000
  [    0.670000] Intel/Sharp Extended Query Table at 0x0031
  pflash_write: Unimplemented flash cmd sequence (offset 0000000000000000, wcycle 0x0 cmd 0x0 value 0xf0)
  [    0.670000] Using buffer write method
  [    0.670000] Creating 3 MTD partitions on "physmap-flash.0":
  [    0.670000] 0x000000000000-0x000000100000 : "YAMON"
  [    0.680000] 0x000000100000-0x0000003e0000 : "User FS"
  [    0.680000] 0x0000003e0000-0x000000400000 : "Board Config"
  [    0.680000] mousedev: PS/2 mouse device common for all mice
  [    0.680000] rtc_cmos rtc_cmos: rtc core: registered rtc_cmos as rtc0
  [    0.690000] rtc0: alarms up to one day, 242 bytes nvram
  [    0.690000] TCP: cubic registered
  [    0.690000] NET: Registered protocol family 17
  [    0.690000] 8021q: 802.1Q VLAN Support v1.8
  [    0.690000] rtc_cmos rtc_cmos: setting system clock to 2013-05-22 12:20:16 UTC (1369225216)
  [    0.690000] Please be patient, while OpenWrt loads ...
  [    0.700000] Freeing prom memory: 956k freed
  [    0.710000] Freeing unused kernel memory: 3320k freed
  - preinit -
  Press the [f] key and hit [enter] to enter failsafe mode
  - regular preinit -
  - init -

  Please press Enter to activate this console.
  [    7.310000] compat-drivers backport release: compat-drivers-2013-03-28-5
  [    7.310000] Backport based on wireless-testing.git master-2013-04-16
  [    7.310000] compat.git: wireless-testing.git
  [    7.360000] cfg80211: Calling CRDA to update world regulatory domain
  [    7.360000] cfg80211: World regulatory domain updated:
  [    7.360000] cfg80211:   (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp)
  [    7.360000] cfg80211:   (2402000 KHz - 2472000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
  [    7.360000] cfg80211:   (2457000 KHz - 2482000 KHz @ 20000 KHz), (300 mBi, 2000 mBm)
  [    7.360000] cfg80211:   (2474000 KHz - 2494000 KHz @ 20000 KHz), (300 mBi, 2000 mBm)
  [    7.360000] cfg80211:   (5170000 KHz - 5250000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
  [    7.360000] cfg80211:   (5735000 KHz - 5835000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
  [    7.550000] pcnet32: pcnet32.c:v1.35 21.Apr.2008 tsbogend at alpha.franken.de
  [    7.550000] PCI: Enabling device 0000:00:0b.0 (0005 -> 0007)
  [    7.550000] pcnet32: PCnet/PCI II 79C970A at 0x2020, 52:54:00:12:34:56 assigned IRQ 10
  [    7.550000] pcnet32: eth0: registered as PCnet/PCI II 79C970A
  [    7.550000] pcnet32: 1 cards_found
  [    7.610000] mac80211_hwsim: initializing netlink
  [   12.820000] pcnet32 0000:00:0b.0 eth0: link up
  [   12.840000] device eth0 entered promiscuous mode
  [   12.840000] br-lan: port 1(eth0) entered forwarding state
  [   12.840000] br-lan: port 1(eth0) entered forwarding state
  [   14.840000] br-lan: port 1(eth0) entered forwarding state

  BusyBox v1.19.4 (2013-05-22 14:04:57 CEST) built-in shell (ash)
  Enter 'help' for a list of built-in commands.

    _______                     ________        __
   |       |.-----.-----.-----.|  |  |  |.----.|  |_
   |   -   ||  _  |  -__|     ||  |  |  ||   _||   _|
   |_______||   __|_____|__|__||________||__|  |____|
            |__| W I R E L E S S   F R E E D O M
   -----------------------------------------------------
   BARRIER BREAKER (Bleeding Edge, r36689)
   -----------------------------------------------------
    * 1/2 oz Galliano         Pour all ingredients into
    * 4 oz cold Coffee        an irish coffee mug filled
    * 1 1/2 oz Dark Rum       with crushed ice. Stir.
    * 2 tsp. Creme de Cacao
   -----------------------------------------------------
  root at OpenWrt:/# uname -a
  Linux OpenWrt 3.8.13 #1 SMP Wed May 22 14:13:27 CEST 2013 mips GNU/Linux
  root at OpenWrt:/# cat /proc/cpuinfo
  system type             : MIPS Malta
  processor               : 0
  cpu model               : MIPS 24Kc V0.0  FPU V0.0
  BogoMIPS                : 1168.17
  wait instruction        : yes
  microsecond timers      : yes
  tlb_entries             : 16
  extra interrupt vector  : yes
  hardware watchpoint     : yes, count: 1, address/irw mask: [0x0ff8]
  ASEs implemented        : mips16
  shadow register sets    : 1
  kscratch registers      : 0
  core                    : 0
  VCED exceptions         : not available
  VCEI exceptions         : not available

  root at OpenWrt:/#
---
 arch/mips/cpu/mips32/start.S |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/arch/mips/cpu/mips32/start.S b/arch/mips/cpu/mips32/start.S
index 76abbaa..a448f9f 100644
--- a/arch/mips/cpu/mips32/start.S
+++ b/arch/mips/cpu/mips32/start.S
@@ -57,7 +57,7 @@ _start:
 	 nop
 
 	.org 0x10
-#ifdef CONFIG_SYS_XWAY_EBU_BOOTCFG
+#if defined(CONFIG_SYS_XWAY_EBU_BOOTCFG)
 	/*
 	 * Almost all Lantiq XWAY SoC devices have an external bus unit (EBU) to
 	 * access external NOR flashes. If the board boots from NOR flash the
@@ -67,6 +67,12 @@ _start:
 	 */
 	.word CONFIG_SYS_XWAY_EBU_BOOTCFG
 	.word 0x0
+#elif defined(CONFIG_QEMU_MALTA)
+	/*
+	 * Linux expects the Board ID here.
+	 */
+	.word 0x00000420	# 0x420 (Malta Board with CoreLV)
+	.word 0x00000000
 #endif
 
 	.org 0x200
-- 
1.7.10



More information about the U-Boot mailing list