~ubuntu-branches/ubuntu/trusty/qemu/trusty

« back to all changes in this revision

Viewing changes to debian/patches/linaro/0056-hw-beagle-Implement-Beagle-Beagle-XM-machines.patch

  • Committer: Package Import Robot
  • Author(s): Serge Hallyn
  • Date: 2014-02-04 12:13:08 UTC
  • mfrom: (10.1.45 sid)
  • Revision ID: package-import@ubuntu.com-20140204121308-1xq92lrfs75agw2g
Tags: 1.7.0+dfsg-3ubuntu1~ppa1
* Merge 1.7.0+dfsg-3 from debian.  Remaining changes:
  - debian/patches/ubuntu:
    * expose-vmx_qemu64cpu.patch
    * linaro (omap3) and arm64 patches
    * ubuntu/target-ppc-add-stubs-for-kvm-breakpoints: fix FTBFS
      on ppc
    * ubuntu/CVE-2013-4377.patch: fix denial of service via virtio
  - debian/qemu-system-x86.modprobe: set kvm_intel nested=1 options
  - debian/control:
    * add arm64 to Architectures
    * add qemu-common and qemu-system-aarch64 packages
  - debian/qemu-system-common.install: add debian/tmp/usr/lib
  - debian/qemu-system-common.preinst: add kvm group
  - debian/qemu-system-common.postinst: remove acl placed by udev,
    and add udevadm trigger.
  - qemu-system-x86.links: add eepro100.rom, remove pxe-virtio,
    pxe-e1000 and pxe-rtl8139.
  - add qemu-system-x86.qemu-kvm.upstart and .default
  - qemu-user-static.postinst-in: remove arm64 binfmt
  - debian/rules:
    * allow parallel build
    * add aarch64 to system_targets and sys_systems
    * add qemu-kvm-spice links
    * install qemu-system-x86.modprobe
  - add debian/qemu-system-common.links for OVMF.fd link
* Remove kvm-img, kvm-nbd, kvm-ifup and kvm-ifdown symlinks.

Show diffs side-by-side

added added

removed removed

Lines of Context:
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
5
 
 
6
 
Implement the Beagleboard; which is the most common OMAP3
7
 
developer board. We provide both a Beagle C4 and a Beagle XM.
8
 
---
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
13
 
 
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
20
 
 
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
25
 
new file mode 100644
26
 
index 0000000..5307ecb
27
 
--- /dev/null
28
 
+++ b/hw/arm/beagle.c
29
 
@@ -0,0 +1,125 @@
30
 
+/*
31
 
+ * Beagle board emulation. http://beagleboard.org/
32
 
+ *
33
 
+ * Copyright (c) 2009 Nokia Corporation
34
 
+ *
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.
39
 
+ *
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.
44
 
+ *
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,
48
 
+ * MA 02111-1307 USA
49
 
+ */
50
 
+
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"
57
 
+#include "net/net.h"
58
 
+#include "hw/block/flash.h"
59
 
+#include "hw/sysbus.h"
60
 
+#include "sysemu/blockdev.h"
61
 
+#include "exec/address-spaces.h"
62
 
+
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
72
 
+
73
 
+/* Beagle board support */
74
 
+struct beagle_s {
75
 
+    struct omap_mpu_state_s *cpu;
76
 
+
77
 
+    DeviceState *nand;
78
 
+    void *twl4030;
79
 
+    DeviceState *smc;
80
 
+    DeviceState *ddc;
81
 
+};
82
 
+
83
 
+static void beagle_common_init(QEMUMachineInitArgs *args,
84
 
+                               ram_addr_t ram_size, int cpu_model)
85
 
+{
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);
90
 
+
91
 
+    if (!dmtd && !dsd) {
92
 
+        hw_error("%s: SD or NAND image required", __FUNCTION__);
93
 
+    }
94
 
+#if MAX_SERIAL_PORTS < 1
95
 
+#error MAX_SERIAL_PORTS must be at least 1!
96
 
+#endif
97
 
+    s->cpu = omap3_mpu_init(sysmem, cpu_model, ram_size,
98
 
+                            NULL, NULL, serial_hds[0], NULL);
99
 
+
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);
103
 
+
104
 
+    if (dsd) {
105
 
+        omap3_mmc_attach(s->cpu->omap3_mmc[0], dsd->bdrv, 0, 0);
106
 
+    }
107
 
+
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),
111
 
+                              NULL, NULL);
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);
115
 
+    }
116
 
+
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.
120
 
+     */
121
 
+    s->ddc = i2c_create_slave(omap_i2c_bus(s->cpu->i2c[2]), "i2c-ddc", 0x50);
122
 
+
123
 
+    omap_lcd_panel_attach(s->cpu->dss);
124
 
+}
125
 
+
126
 
+static void beagle_xm_init(QEMUMachineInitArgs *args)
127
 
+{
128
 
+    beagle_common_init(args, BEAGLE_XM_SDRAM_SIZE, omap3630);
129
 
+}
130
 
+static void beagle_init(QEMUMachineInitArgs *args)
131
 
+{
132
 
+    beagle_common_init(args, BEAGLE_SDRAM_SIZE, omap3430);
133
 
+}
134
 
+
135
 
+QEMUMachine beagle_machine = {
136
 
+    .name =        "beagle",
137
 
+    .desc =        "Beagle board (OMAP3530)",
138
 
+    .init =        beagle_init,
139
 
+};
140
 
+
141
 
+QEMUMachine beagle_xm_machine = {
142
 
+    .name =        "beaglexm",
143
 
+    .desc =        "Beagle board XM (OMAP3630)",
144
 
+    .init =        beagle_xm_init,
145
 
+};
146
 
+
147
 
+
148
 
+static void beagle_machine_init(void)
149
 
+{
150
 
+    qemu_register_machine(&beagle_machine);
151
 
+    qemu_register_machine(&beagle_xm_machine);
152
 
+}
153
 
+
154
 
+machine_init(beagle_machine_init);
155
 
1.8.5.2
156