From: Peter Crosthwaite <crosthwaitepeter@gmail.com>
To: qemu-devel@nongnu.org
Cc: peter.maydell@linaro.org, robh@kernel.org,
Peter Crosthwaite <crosthwaite.peter@gmail.com>,
linux@roeck-us.net, alistair.francis@xilinx.com
Subject: [Qemu-devel] [PATCH for-2.5 v1 4/4] arm: xilinx_zynq: Add linux pre-boot
Date: Sun, 25 Oct 2015 16:13:03 -0700 [thread overview]
Message-ID: <e987432c3bcd60e043707f2b4657e4bee4db6e0a.1445814452.git.crosthwaite.peter@gmail.com> (raw)
In-Reply-To: <cover.1445814452.git.crosthwaite.peter@gmail.com>
In-Reply-To: <cover.1445814452.git.crosthwaite.peter@gmail.com>
Add a Linux-specific pre-boot routine that matches the device
specific bootloaders behaviour. This is needed for modern Linux that
expects the ARM PLL in SLCR to be a more even value (not 26).
Cc: Alistair Francis <alistair.francis@xilinx.com>
Signed-off-by: Peter Crosthwaite <crosthwaite.peter@gmail.com>
---
Changed since RFC:
Use bootloader callback to load blob.
Change "firmware" to "board-setup" for consistency.
hw/arm/xilinx_zynq.c | 40 +++++++++++++++++++++++++++++++++++++++-
1 file changed, 39 insertions(+), 1 deletion(-)
diff --git a/hw/arm/xilinx_zynq.c b/hw/arm/xilinx_zynq.c
index 9f89483..8c249e8 100644
--- a/hw/arm/xilinx_zynq.c
+++ b/hw/arm/xilinx_zynq.c
@@ -43,6 +43,41 @@ static const int dma_irqs[8] = {
46, 47, 48, 49, 72, 73, 74, 75
};
+#define BOARD_SETUP_ADDR 0x0
+#define LOAD_ADDR 0x1000
+
+#define SLCR_LOCK_OFFSET 0x004
+#define SLCR_UNLOCK_OFFSET 0x008
+#define SLCR_ARM_PLL_OFFSET 0x100
+
+#define SLCR_XILINX_UNLOCK_KEY 0xdf0d
+#define SLCR_XILINX_LOCK_KEY 0x767b
+
+#define SLCR_WRITE(addr, val) \
+ 0xe3a01000 + extract32((val), 0, 8), \
+ 0xe3811c00 + extract32((val), 8, 8), \
+ 0xe3811800 + extract32((val), 16, 8), \
+ 0xe3811400 + extract32((val), 24, 8), \
+ 0xe5801000 + (addr),
+
+static void zynq_write_board_setup(ARMCPU *cpu,
+ const struct arm_boot_info *info)
+{
+ int n;
+ uint32_t board_setup_blob[] = {
+ 0xe3a004f8, /* mov r0, #0xf8000000 */
+ SLCR_WRITE(SLCR_UNLOCK_OFFSET, SLCR_XILINX_UNLOCK_KEY)
+ SLCR_WRITE(SLCR_ARM_PLL_OFFSET, 0x00014008)
+ SLCR_WRITE(SLCR_LOCK_OFFSET, SLCR_XILINX_LOCK_KEY)
+ 0xe12fff1e, /* bx lr */
+ };
+ for (n = 0; n < ARRAY_SIZE(board_setup_blob); n++) {
+ board_setup_blob[n] = tswap32(board_setup_blob[n]);
+ }
+ rom_add_blob_fixed("board-setup", board_setup_blob,
+ sizeof(board_setup_blob), BOARD_SETUP_ADDR);
+}
+
static struct arm_boot_info zynq_binfo = {};
static void gem_init(NICInfo *nd, uint32_t base, qemu_irq irq)
@@ -251,7 +286,10 @@ static void zynq_init(MachineState *machine)
zynq_binfo.initrd_filename = initrd_filename;
zynq_binfo.nb_cpus = 1;
zynq_binfo.board_id = 0xd32;
- zynq_binfo.loader_start = 0;
+ zynq_binfo.loader_start = LOAD_ADDR;
+ zynq_binfo.board_setup_addr = BOARD_SETUP_ADDR;
+ zynq_binfo.write_board_setup = zynq_write_board_setup;
+
arm_load_kernel(ARM_CPU(first_cpu), &zynq_binfo);
}
--
1.9.1
next prev parent reply other threads:[~2015-10-25 23:13 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-25 23:12 [Qemu-devel] [PATCH for-2.5 v1 0/4] ARM: Machine specific boot blobs Peter Crosthwaite
2015-10-25 23:13 ` [Qemu-devel] [PATCH for-2.5 v1 1/4] arm: boot: Adjust indentation of FIXUP comments Peter Crosthwaite
2015-10-27 12:16 ` Peter Maydell
2015-10-25 23:13 ` [Qemu-devel] [PATCH for-2.5 v1 2/4] arm: boot: Add board specific setup code API Peter Crosthwaite
2015-10-27 12:19 ` Peter Maydell
2015-10-27 15:23 ` Peter Crosthwaite
2015-10-25 23:13 ` [Qemu-devel] [PATCH for-2.5 v1 3/4] arm: highbank: Implement PSCI and dummy monitor Peter Crosthwaite
2015-10-27 12:26 ` Peter Maydell
2015-10-27 15:11 ` Peter Crosthwaite
2015-10-27 15:32 ` Peter Maydell
2015-10-27 17:16 ` Peter Crosthwaite
2015-10-27 20:29 ` Rob Herring
2015-10-27 21:30 ` Peter Crosthwaite
2015-10-28 0:49 ` Rob Herring
2015-10-28 12:10 ` Peter Maydell
2015-10-28 16:35 ` Peter Crosthwaite
2015-10-28 16:41 ` Peter Maydell
2015-10-25 23:13 ` Peter Crosthwaite [this message]
2015-10-27 12:31 ` [Qemu-devel] [PATCH for-2.5 v1 4/4] arm: xilinx_zynq: Add linux pre-boot Peter Maydell
2015-10-27 15:21 ` Peter Crosthwaite
2015-10-27 15:37 ` Peter Maydell
2015-10-27 17:26 ` Peter Crosthwaite
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=e987432c3bcd60e043707f2b4657e4bee4db6e0a.1445814452.git.crosthwaite.peter@gmail.com \
--to=crosthwaitepeter@gmail.com \
--cc=alistair.francis@xilinx.com \
--cc=crosthwaite.peter@gmail.com \
--cc=linux@roeck-us.net \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=robh@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).