2 * Beagle board emulation. http://beagleboard.org/
4 * Original code Copyright (C) 2008 yajin(yajin@vm-kernel.org)
5 * Rewrite Copyright (C) 2009 Nokia Corporation
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License as
9 * published by the Free Software Foundation; either version 2 or
10 * (at your option) version 3 of the License.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
23 #include "qemu-common.h"
33 #define BEAGLE_NAND_CS 0
34 #define BEAGLE_SMC_CS 1
35 #define BEAGLE_NAND_PAGESIZE 0x800
36 #define BEAGLE_SDRAM_SIZE (128 * 1024 * 1024) /* 128MB */
38 /* Beagle board support */
40 struct omap_mpu_state_s *cpu;
43 struct omap3_lcd_panel_s *lcd_panel;
48 static void beagle_init(ram_addr_t ram_size,
49 const char *boot_device,
50 const char *kernel_filename,
51 const char *kernel_cmdline,
52 const char *initrd_filename,
53 const char *cpu_model)
55 struct beagle_s *s = (struct beagle_s *) qemu_mallocz(sizeof(*s));
58 if (drive_get_index(IF_SD, 0, 0) < 0 ||
59 drive_get_index(IF_MTD, 0, 0) < 0) {
60 hw_error("%s: missing SD or NAND device\n", __FUNCTION__);
62 s->cpu = omap3530_mpu_init(ram_size, NULL, NULL, serial_hds[0]);
64 s->nand = nand_init(NAND_MFR_MICRON, 0xba,
65 drives_table[drive_get_index(IF_MTD, 0, 0)].bdrv);
66 nand_setpins(s->nand, 0, 0, 0, 1, 0); /* no write-protect */
67 omap_gpmc_attach(s->cpu->gpmc, BEAGLE_NAND_CS, 0, NULL, NULL, s->nand, 2);
68 omap3_mmc_attach(s->cpu->omap3_mmc[0],
69 drives_table[drive_get_index(IF_SD, 0, 0)].bdrv);
71 s->i2c = omap_i2c_bus(s->cpu->i2c[0]);
72 s->twl4030 = twl4030_init(s->i2c, s->cpu->irq[0][OMAP_INT_3XXX_SYS_NIRQ]);
73 opaque = smc91c111_init_lite(&nd_table[0], /*0x08000000,*/
74 omap2_gpio_in_get(s->cpu->gpif, 54)[0]);
75 omap_gpmc_attach(s->cpu->gpmc, BEAGLE_SMC_CS, smc91c111_iomemtype(opaque),
76 NULL, NULL, opaque, 0);
78 s->lcd_panel = omap3_lcd_panel_init();
79 omap3_lcd_panel_attach(s->cpu->dss, 0, s->lcd_panel);
81 omap3_boot_rom_emu(s->cpu);
84 QEMUMachine beagle_machine = {
86 .desc = "Beagle board (OMAP3530)",
90 static void beagle_machine_init(void)
92 qemu_register_machine(&beagle_machine);
95 machine_init(beagle_machine_init);