mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 0/2] mips: qemu-malta: add little-endian mode support
@ 2014-10-09 20:08 Antony Pavlov
  2014-10-09 20:08 ` [PATCH 1/2] " Antony Pavlov
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Antony Pavlov @ 2014-10-09 20:08 UTC (permalink / raw)
  To: barebox

Antony Pavlov (2):
  mips: qemu-malta: add little-endian mode support
  Documentation: mips: add little-endian qemu-malta HOWTO

 Documentation/boards/mips/qemu-malta.rst | 24 ++++++++++++++++++++++++
 arch/mips/Kconfig                        |  1 +
 arch/mips/include/asm/gt64120.h          |  7 +++++++
 3 files changed, 32 insertions(+)

-- 
2.1.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/2] mips: qemu-malta: add little-endian mode support
  2014-10-09 20:08 [PATCH 0/2] mips: qemu-malta: add little-endian mode support Antony Pavlov
@ 2014-10-09 20:08 ` Antony Pavlov
  2014-10-09 20:08 ` [PATCH 2/2] Documentation: mips: add little-endian qemu-malta HOWTO Antony Pavlov
  2014-10-10  6:38 ` [PATCH 0/2] mips: qemu-malta: add little-endian mode support Sascha Hauer
  2 siblings, 0 replies; 5+ messages in thread
From: Antony Pavlov @ 2014-10-09 20:08 UTC (permalink / raw)
  To: barebox

We can't just enable SYS_SUPPORTS_LITTLE_ENDIAN for successful
little-endian qemu-malta barebox build. Some byte swapping-related
macros are missed, e.g.:

    arch/mips/mach-malta/pci.c: In function 'pcibios_init':
    arch/mips/mach-malta/pci.c:218:28: error: 'GT_PCI0_CMD_MBYTESWAP_BIT'
    undeclared (first use in this function)
    GT_WRITE(GT_PCI0_CMD_OFS, GT_PCI0_CMD_MBYTESWAP_BIT |
                              ^

This patch adds necessary macros definition.

Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
---
 arch/mips/Kconfig               | 1 +
 arch/mips/include/asm/gt64120.h | 7 +++++++
 2 files changed, 8 insertions(+)

diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 40d5d83..ed6e1ab 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -43,6 +43,7 @@ config MACH_MIPS_MALTA
 	select SYS_HAS_CPU_MIPS32_R2
 	select SYS_SUPPORTS_32BIT_KERNEL
 	select SYS_SUPPORTS_BIG_ENDIAN
+	select SYS_SUPPORTS_LITTLE_ENDIAN
 	select HAS_DEBUG_LL
 	select GPIOLIB
 	select HW_HAS_PCI
diff --git a/arch/mips/include/asm/gt64120.h b/arch/mips/include/asm/gt64120.h
index 7e783c8..88fa1fa 100644
--- a/arch/mips/include/asm/gt64120.h
+++ b/arch/mips/include/asm/gt64120.h
@@ -76,6 +76,13 @@
 #define GT_PCI0_CFGADDR_CONFIGEN_MSK	(MSK(1) << GT_PCI0_CFGADDR_CONFIGEN_SHF)
 #define GT_PCI0_CFGADDR_CONFIGEN_BIT	GT_PCI0_CFGADDR_CONFIGEN_MSK
 
+#define GT_PCI0_CMD_MBYTESWAP_SHF       0
+#define GT_PCI0_CMD_MBYTESWAP_MSK       (MSK(1) << GT_PCI0_CMD_MBYTESWAP_SHF)
+#define GT_PCI0_CMD_MBYTESWAP_BIT       GT_PCI0_CMD_MBYTESWAP_MSK
+#define GT_PCI0_CMD_SBYTESWAP_SHF       16
+#define GT_PCI0_CMD_SBYTESWAP_MSK       (MSK(1) << GT_PCI0_CMD_SBYTESWAP_SHF)
+#define GT_PCI0_CMD_SBYTESWAP_BIT       GT_PCI0_CMD_SBYTESWAP_MSK
+
 /*
  * Because of an error/peculiarity in the Galileo chip, we need to swap the
  * bytes when running bigendian.  We also provide non-swapping versions.
-- 
2.1.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 2/2] Documentation: mips: add little-endian qemu-malta HOWTO
  2014-10-09 20:08 [PATCH 0/2] mips: qemu-malta: add little-endian mode support Antony Pavlov
  2014-10-09 20:08 ` [PATCH 1/2] " Antony Pavlov
@ 2014-10-09 20:08 ` Antony Pavlov
  2014-10-10  6:38 ` [PATCH 0/2] mips: qemu-malta: add little-endian mode support Sascha Hauer
  2 siblings, 0 replies; 5+ messages in thread
From: Antony Pavlov @ 2014-10-09 20:08 UTC (permalink / raw)
  To: barebox

Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
---
 Documentation/boards/mips/qemu-malta.rst | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/Documentation/boards/mips/qemu-malta.rst b/Documentation/boards/mips/qemu-malta.rst
index be89ae3..22da600 100644
--- a/Documentation/boards/mips/qemu-malta.rst
+++ b/Documentation/boards/mips/qemu-malta.rst
@@ -1,6 +1,9 @@
 QEMU Malta
 ==========
 
+Big-endian mode
+---------------
+
 QEMU run string::
 
   qemu-system-mips -nodefaults -M malta -m 256 \
@@ -11,6 +14,27 @@ Also you can use GXemul::
 
   gxemul -Q -x -e maltabe -M 256 0xbfc00000:barebox-flash-image
 
+
+Little-endian mode
+------------------
+
+Running little-endian Malta is a bit tricky.
+In little-endian mode the 32bit words in the boot flash image are swapped,
+a neat trick which allows bi-endian firmware.
+
+You have to swap words of ``zbarebox.bin`` image, e.g.::
+
+  echo arch/mips/pbl/zbarebox.bin \
+      | cpio --create \
+      | cpio --extract --swap --unconditional
+
+QEMU run string::
+
+  qemu-system-mipsel -nodefaults -M malta -m 256 \
+      -nographic -serial stdio -monitor null \
+      -bios barebox-flash-image
+
+
 Links
 -----
 
-- 
2.1.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 0/2] mips: qemu-malta: add little-endian mode support
  2014-10-09 20:08 [PATCH 0/2] mips: qemu-malta: add little-endian mode support Antony Pavlov
  2014-10-09 20:08 ` [PATCH 1/2] " Antony Pavlov
  2014-10-09 20:08 ` [PATCH 2/2] Documentation: mips: add little-endian qemu-malta HOWTO Antony Pavlov
@ 2014-10-10  6:38 ` Sascha Hauer
  2014-10-10  8:43   ` Antony Pavlov
  2 siblings, 1 reply; 5+ messages in thread
From: Sascha Hauer @ 2014-10-10  6:38 UTC (permalink / raw)
  To: Antony Pavlov; +Cc: barebox

On Fri, Oct 10, 2014 at 12:08:55AM +0400, Antony Pavlov wrote:
> Antony Pavlov (2):
>   mips: qemu-malta: add little-endian mode support
>   Documentation: mips: add little-endian qemu-malta HOWTO

Hm, nice. Adding big endian support to Arm would not be that simple.

Applied, thanks

Sascha

> 
>  Documentation/boards/mips/qemu-malta.rst | 24 ++++++++++++++++++++++++
>  arch/mips/Kconfig                        |  1 +
>  arch/mips/include/asm/gt64120.h          |  7 +++++++
>  3 files changed, 32 insertions(+)
> 
> -- 
> 2.1.1
> 
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
> 

-- 
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
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 0/2] mips: qemu-malta: add little-endian mode support
  2014-10-10  6:38 ` [PATCH 0/2] mips: qemu-malta: add little-endian mode support Sascha Hauer
@ 2014-10-10  8:43   ` Antony Pavlov
  0 siblings, 0 replies; 5+ messages in thread
From: Antony Pavlov @ 2014-10-10  8:43 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: barebox

On Fri, 10 Oct 2014 08:38:21 +0200
Sascha Hauer <s.hauer@pengutronix.de> wrote:

> On Fri, Oct 10, 2014 at 12:08:55AM +0400, Antony Pavlov wrote:
> > Antony Pavlov (2):
> >   mips: qemu-malta: add little-endian mode support
> >   Documentation: mips: add little-endian qemu-malta HOWTO
> 
> Hm, nice. Adding big endian support to Arm would not be that simple.

Actually most of mips chips supported by barebox are little-endian only
(bcm47xx, loongson, xburst). So all little-endian support work was
already done before.

Malta is bi-endian but I suppose little-endian mode is more popular
so it is handy to have real working little-endian qemu-malta support.
Nevertheless I prefer to use big-endian qemu-malta most of the time
as it does not need this odd boot image file byte swapping (see
Documentation-related second patch in this series).


> > 
> >  Documentation/boards/mips/qemu-malta.rst | 24 ++++++++++++++++++++++++
> >  arch/mips/Kconfig                        |  1 +
> >  arch/mips/include/asm/gt64120.h          |  7 +++++++
> >  3 files changed, 32 insertions(+)
> > 
> > -- 
> > 2.1.1
> > 
> > 
> > _______________________________________________
> > barebox mailing list
> > barebox@lists.infradead.org
> > http://lists.infradead.org/mailman/listinfo/barebox
> > 
> 
> -- 
> 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 |


-- 
-- 
Best regards,
  Antony Pavlov

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-10-10  8:50 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-09 20:08 [PATCH 0/2] mips: qemu-malta: add little-endian mode support Antony Pavlov
2014-10-09 20:08 ` [PATCH 1/2] " Antony Pavlov
2014-10-09 20:08 ` [PATCH 2/2] Documentation: mips: add little-endian qemu-malta HOWTO Antony Pavlov
2014-10-10  6:38 ` [PATCH 0/2] mips: qemu-malta: add little-endian mode support Sascha Hauer
2014-10-10  8:43   ` Antony Pavlov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox