1
From 873e177ac1940ed27f6f1072f83381822a589263 Mon Sep 17 00:00:00 2001
2
From: Peter Maydell <peter.maydell@linaro.org>
3
Date: Mon, 18 Feb 2013 16:58:33 +0000
4
Subject: [PATCH 56/70] hw/beagle: Implement Beagle, Beagle XM machines
6
Implement the Beagleboard; which is the most common OMAP3
7
developer board. We provide both a Beagle C4 and a Beagle XM.
9
hw/arm/Makefile.objs | 2 +-
10
hw/arm/beagle.c | 125 +++++++++++++++++++++++++++++++++++++++++++++++++++
11
2 files changed, 126 insertions(+), 1 deletion(-)
12
create mode 100644 hw/arm/beagle.c
14
diff --git a/hw/arm/Makefile.objs b/hw/arm/Makefile.objs
15
index 0a3b0b1..555d89a 100644
16
--- a/hw/arm/Makefile.objs
17
+++ b/hw/arm/Makefile.objs
18
@@ -4,4 +4,4 @@ obj-y += omap_sx1.o palm.o realview.o spitz.o stellaris.o
19
obj-y += tosa.o versatilepb.o vexpress.o xilinx_zynq.o z2.o
21
obj-y += armv7m.o exynos4210.o pxa2xx.o pxa2xx_gpio.o pxa2xx_pic.o
22
-obj-y += omap1.o omap2.o omap3.o strongarm.o
23
+obj-y += omap1.o omap2.o omap3.o strongarm.o beagle.o
24
diff --git a/hw/arm/beagle.c b/hw/arm/beagle.c
26
index 0000000..5307ecb
31
+ * Beagle board emulation. http://beagleboard.org/
33
+ * Copyright (c) 2009 Nokia Corporation
35
+ * This program is free software; you can redistribute it and/or
36
+ * modify it under the terms of the GNU General Public License as
37
+ * published by the Free Software Foundation; either version 2 or
38
+ * (at your option) any later version of the License.
40
+ * This program is distributed in the hope that it will be useful,
41
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
42
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
43
+ * GNU General Public License for more details.
45
+ * You should have received a copy of the GNU General Public License
46
+ * along with this program; if not, write to the Free Software
47
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
51
+#include "qemu-common.h"
52
+#include "sysemu/sysemu.h"
53
+#include "hw/arm/omap.h"
54
+#include "hw/arm/arm.h"
55
+#include "hw/boards.h"
56
+#include "hw/i2c/i2c.h"
58
+#include "hw/block/flash.h"
59
+#include "hw/sysbus.h"
60
+#include "sysemu/blockdev.h"
61
+#include "exec/address-spaces.h"
63
+#define BEAGLE_NAND_CS 0
64
+#define BEAGLE_SMC_CS 1
65
+#define BEAGLE_NAND_PAGESIZE 0x800
66
+#define BEAGLE_SDRAM_SIZE (256 * 1024 * 1024) /* 256MB */
67
+#define BEAGLE_XM_SDRAM_SIZE (512 * 1024 * 1024) /* 512MB */
68
+/* GPIO ID pins are used to identify which beagle variant we have */
69
+#define BEAGLE_GPIO_ID1 171
70
+#define BEAGLE_GPIO_ID2 172
71
+#define BEAGLE_GPIO_ID3 173
73
+/* Beagle board support */
75
+ struct omap_mpu_state_s *cpu;
83
+static void beagle_common_init(QEMUMachineInitArgs *args,
84
+ ram_addr_t ram_size, int cpu_model)
86
+ MemoryRegion *sysmem = get_system_memory();
87
+ struct beagle_s *s = (struct beagle_s *) g_malloc0(sizeof(*s));
88
+ DriveInfo *dmtd = drive_get(IF_MTD, 0, 0);
89
+ DriveInfo *dsd = drive_get(IF_SD, 0, 0);
91
+ if (!dmtd && !dsd) {
92
+ hw_error("%s: SD or NAND image required", __FUNCTION__);
94
+#if MAX_SERIAL_PORTS < 1
95
+#error MAX_SERIAL_PORTS must be at least 1!
97
+ s->cpu = omap3_mpu_init(sysmem, cpu_model, ram_size,
98
+ NULL, NULL, serial_hds[0], NULL);
100
+ s->nand = nand_init(dmtd ? dmtd->bdrv : NULL, NAND_MFR_MICRON, 0xba);
101
+ nand_setpins(s->nand, 0, 0, 0, 1, 0); /* no write-protect */
102
+ omap_gpmc_attach_nand(s->cpu->gpmc, BEAGLE_NAND_CS, s->nand);
105
+ omap3_mmc_attach(s->cpu->omap3_mmc[0], dsd->bdrv, 0, 0);
108
+ s->twl4030 = twl4030_init(omap_i2c_bus(s->cpu->i2c[0]),
109
+ qdev_get_gpio_in(s->cpu->ih[0],
110
+ OMAP_INT_3XXX_SYS_NIRQ),
112
+ if (cpu_model == omap3430) {
113
+ qemu_set_irq(qdev_get_gpio_in(s->cpu->gpio, BEAGLE_GPIO_ID1),1);
114
+ qemu_set_irq(qdev_get_gpio_in(s->cpu->gpio, BEAGLE_GPIO_ID3),1);
117
+ /* Wire up an I2C slave which returns EDID monitor information;
118
+ * newer Linux kernels won't turn on the display unless they
119
+ * detect a monitor over DDC.
121
+ s->ddc = i2c_create_slave(omap_i2c_bus(s->cpu->i2c[2]), "i2c-ddc", 0x50);
123
+ omap_lcd_panel_attach(s->cpu->dss);
126
+static void beagle_xm_init(QEMUMachineInitArgs *args)
128
+ beagle_common_init(args, BEAGLE_XM_SDRAM_SIZE, omap3630);
130
+static void beagle_init(QEMUMachineInitArgs *args)
132
+ beagle_common_init(args, BEAGLE_SDRAM_SIZE, omap3430);
135
+QEMUMachine beagle_machine = {
137
+ .desc = "Beagle board (OMAP3530)",
138
+ .init = beagle_init,
141
+QEMUMachine beagle_xm_machine = {
142
+ .name = "beaglexm",
143
+ .desc = "Beagle board XM (OMAP3630)",
144
+ .init = beagle_xm_init,
148
+static void beagle_machine_init(void)
150
+ qemu_register_machine(&beagle_machine);
151
+ qemu_register_machine(&beagle_xm_machine);
154
+machine_init(beagle_machine_init);