2015-09-07 09:39:30 +00:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2013 Jean-Christophe Dubois <jcd@tribudubois.net>
|
|
|
|
*
|
|
|
|
* i.MX25 SOC emulation.
|
|
|
|
*
|
|
|
|
* Based on hw/arm/xlnx-zynqmp.c
|
|
|
|
*
|
|
|
|
* Copyright (C) 2015 Xilinx Inc
|
|
|
|
* Written by Peter Crosthwaite <peter.crosthwaite@xilinx.com>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify it
|
|
|
|
* under the terms of the GNU General Public License as published by the
|
|
|
|
* Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
|
|
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
|
|
* for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program; if not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2015-12-07 16:23:45 +00:00
|
|
|
#include "qemu/osdep.h"
|
include/qemu/osdep.h: Don't include qapi/error.h
Commit 57cb38b included qapi/error.h into qemu/osdep.h to get the
Error typedef. Since then, we've moved to include qemu/osdep.h
everywhere. Its file comment explains: "To avoid getting into
possible circular include dependencies, this file should not include
any other QEMU headers, with the exceptions of config-host.h,
compiler.h, os-posix.h and os-win32.h, all of which are doing a
similar job to this file and are under similar constraints."
qapi/error.h doesn't do a similar job, and it doesn't adhere to
similar constraints: it includes qapi-types.h. That's in excess of
100KiB of crap most .c files don't actually need.
Add the typedef to qemu/typedefs.h, and include that instead of
qapi/error.h. Include qapi/error.h in .c files that need it and don't
get it now. Include qapi-types.h in qom/object.h for uint16List.
Update scripts/clean-includes accordingly. Update it further to match
reality: replace config.h by config-target.h, add sysemu/os-posix.h,
sysemu/os-win32.h. Update the list of includes in the qemu/osdep.h
comment quoted above similarly.
This reduces the number of objects depending on qapi/error.h from "all
of them" to less than a third. Unfortunately, the number depending on
qapi-types.h shrinks only a little. More work is needed for that one.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
[Fix compilation without the spice devel packages. - Paolo]
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2016-03-14 08:01:28 +00:00
|
|
|
#include "qapi/error.h"
|
2016-01-19 20:51:44 +00:00
|
|
|
#include "cpu.h"
|
2015-09-07 09:39:30 +00:00
|
|
|
#include "hw/arm/fsl-imx25.h"
|
|
|
|
#include "sysemu/sysemu.h"
|
|
|
|
#include "exec/address-spaces.h"
|
2019-08-12 05:23:51 +00:00
|
|
|
#include "hw/qdev-properties.h"
|
2017-01-26 13:19:46 +00:00
|
|
|
#include "chardev/char.h"
|
2015-09-07 09:39:30 +00:00
|
|
|
|
2020-03-10 21:51:45 +00:00
|
|
|
#define IMX25_ESDHC_CAPABILITIES 0x07e20000
|
|
|
|
|
2015-09-07 09:39:30 +00:00
|
|
|
static void fsl_imx25_init(Object *obj)
|
|
|
|
{
|
|
|
|
FslIMX25State *s = FSL_IMX25(obj);
|
|
|
|
int i;
|
|
|
|
|
qom: Less verbose object_initialize_child()
All users of object_initialize_child() pass the obvious child size
argument. Almost all pass &error_abort and no properties. Tiresome.
Rename object_initialize_child() to
object_initialize_child_with_props() to free the name. New
convenience wrapper object_initialize_child() automates the size
argument, and passes &error_abort and no properties.
Rename object_initialize_childv() to
object_initialize_child_with_propsv() for consistency.
Convert callers with this Coccinelle script:
@@
expression parent, propname, type;
expression child, size;
symbol error_abort;
@@
- object_initialize_child(parent, propname, OBJECT(child), size, type, &error_abort, NULL)
+ object_initialize_child(parent, propname, child, size, type, &error_abort, NULL)
@@
expression parent, propname, type;
expression child;
symbol error_abort;
@@
- object_initialize_child(parent, propname, child, sizeof(*child), type, &error_abort, NULL)
+ object_initialize_child(parent, propname, child, type)
@@
expression parent, propname, type;
expression child;
symbol error_abort;
@@
- object_initialize_child(parent, propname, &child, sizeof(child), type, &error_abort, NULL)
+ object_initialize_child(parent, propname, &child, type)
@@
expression parent, propname, type;
expression child, size, err;
expression list props;
@@
- object_initialize_child(parent, propname, child, size, type, err, props)
+ object_initialize_child_with_props(parent, propname, child, size, type, err, props)
Note that Coccinelle chokes on ARMSSE typedef vs. macro in
hw/arm/armsse.c. Worked around by temporarily renaming the macro for
the spatch run.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Acked-by: Alistair Francis <alistair.francis@wdc.com>
[Rebased: machine opentitan is new (commit fe0fe4735e7)]
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <20200610053247.1583243-37-armbru@redhat.com>
2020-06-10 05:32:25 +00:00
|
|
|
object_initialize_child(obj, "cpu", &s->cpu, ARM_CPU_TYPE_NAME("arm926"));
|
2015-09-07 09:39:30 +00:00
|
|
|
|
2018-07-16 12:59:27 +00:00
|
|
|
sysbus_init_child_obj(obj, "avic", &s->avic, sizeof(s->avic),
|
|
|
|
TYPE_IMX_AVIC);
|
2015-09-07 09:39:30 +00:00
|
|
|
|
2018-07-16 12:59:27 +00:00
|
|
|
sysbus_init_child_obj(obj, "ccm", &s->ccm, sizeof(s->ccm), TYPE_IMX25_CCM);
|
2015-09-07 09:39:30 +00:00
|
|
|
|
|
|
|
for (i = 0; i < FSL_IMX25_NUM_UARTS; i++) {
|
2018-07-16 12:59:27 +00:00
|
|
|
sysbus_init_child_obj(obj, "uart[*]", &s->uart[i], sizeof(s->uart[i]),
|
|
|
|
TYPE_IMX_SERIAL);
|
2015-09-07 09:39:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0; i < FSL_IMX25_NUM_GPTS; i++) {
|
2018-07-16 12:59:27 +00:00
|
|
|
sysbus_init_child_obj(obj, "gpt[*]", &s->gpt[i], sizeof(s->gpt[i]),
|
|
|
|
TYPE_IMX25_GPT);
|
2015-09-07 09:39:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0; i < FSL_IMX25_NUM_EPITS; i++) {
|
2018-07-16 12:59:27 +00:00
|
|
|
sysbus_init_child_obj(obj, "epit[*]", &s->epit[i], sizeof(s->epit[i]),
|
|
|
|
TYPE_IMX_EPIT);
|
2015-09-07 09:39:30 +00:00
|
|
|
}
|
|
|
|
|
2018-07-16 12:59:27 +00:00
|
|
|
sysbus_init_child_obj(obj, "fec", &s->fec, sizeof(s->fec), TYPE_IMX_FEC);
|
2015-09-07 09:39:30 +00:00
|
|
|
|
2020-01-17 14:09:31 +00:00
|
|
|
sysbus_init_child_obj(obj, "rngc", &s->rngc, sizeof(s->rngc),
|
|
|
|
TYPE_IMX_RNGC);
|
|
|
|
|
2015-09-07 09:39:30 +00:00
|
|
|
for (i = 0; i < FSL_IMX25_NUM_I2CS; i++) {
|
2018-07-16 12:59:27 +00:00
|
|
|
sysbus_init_child_obj(obj, "i2c[*]", &s->i2c[i], sizeof(s->i2c[i]),
|
|
|
|
TYPE_IMX_I2C);
|
2015-09-07 09:39:30 +00:00
|
|
|
}
|
2015-09-14 13:39:49 +00:00
|
|
|
|
|
|
|
for (i = 0; i < FSL_IMX25_NUM_GPIOS; i++) {
|
2018-07-16 12:59:27 +00:00
|
|
|
sysbus_init_child_obj(obj, "gpio[*]", &s->gpio[i], sizeof(s->gpio[i]),
|
|
|
|
TYPE_IMX_GPIO);
|
2015-09-14 13:39:49 +00:00
|
|
|
}
|
2020-03-10 21:51:45 +00:00
|
|
|
|
|
|
|
for (i = 0; i < FSL_IMX25_NUM_ESDHCS; i++) {
|
|
|
|
sysbus_init_child_obj(obj, "sdhc[*]", &s->esdhc[i], sizeof(s->esdhc[i]),
|
|
|
|
TYPE_IMX_USDHC);
|
|
|
|
}
|
2020-03-10 21:51:46 +00:00
|
|
|
|
|
|
|
for (i = 0; i < FSL_IMX25_NUM_USBS; i++) {
|
|
|
|
sysbus_init_child_obj(obj, "usb[*]", &s->usb[i], sizeof(s->usb[i]),
|
|
|
|
TYPE_CHIPIDEA);
|
|
|
|
}
|
|
|
|
|
2020-05-17 16:21:30 +00:00
|
|
|
sysbus_init_child_obj(obj, "wdt", &s->wdt, sizeof(s->wdt), TYPE_IMX2_WDT);
|
2015-09-07 09:39:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void fsl_imx25_realize(DeviceState *dev, Error **errp)
|
|
|
|
{
|
|
|
|
FslIMX25State *s = FSL_IMX25(dev);
|
|
|
|
uint8_t i;
|
|
|
|
Error *err = NULL;
|
|
|
|
|
|
|
|
object_property_set_bool(OBJECT(&s->cpu), true, "realized", &err);
|
|
|
|
if (err) {
|
|
|
|
error_propagate(errp, err);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
object_property_set_bool(OBJECT(&s->avic), true, "realized", &err);
|
|
|
|
if (err) {
|
|
|
|
error_propagate(errp, err);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
sysbus_mmio_map(SYS_BUS_DEVICE(&s->avic), 0, FSL_IMX25_AVIC_ADDR);
|
|
|
|
sysbus_connect_irq(SYS_BUS_DEVICE(&s->avic), 0,
|
|
|
|
qdev_get_gpio_in(DEVICE(&s->cpu), ARM_CPU_IRQ));
|
|
|
|
sysbus_connect_irq(SYS_BUS_DEVICE(&s->avic), 1,
|
|
|
|
qdev_get_gpio_in(DEVICE(&s->cpu), ARM_CPU_FIQ));
|
|
|
|
|
|
|
|
object_property_set_bool(OBJECT(&s->ccm), true, "realized", &err);
|
|
|
|
if (err) {
|
|
|
|
error_propagate(errp, err);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
sysbus_mmio_map(SYS_BUS_DEVICE(&s->ccm), 0, FSL_IMX25_CCM_ADDR);
|
|
|
|
|
|
|
|
/* Initialize all UARTs */
|
|
|
|
for (i = 0; i < FSL_IMX25_NUM_UARTS; i++) {
|
|
|
|
static const struct {
|
|
|
|
hwaddr addr;
|
|
|
|
unsigned int irq;
|
|
|
|
} serial_table[FSL_IMX25_NUM_UARTS] = {
|
|
|
|
{ FSL_IMX25_UART1_ADDR, FSL_IMX25_UART1_IRQ },
|
|
|
|
{ FSL_IMX25_UART2_ADDR, FSL_IMX25_UART2_IRQ },
|
|
|
|
{ FSL_IMX25_UART3_ADDR, FSL_IMX25_UART3_IRQ },
|
|
|
|
{ FSL_IMX25_UART4_ADDR, FSL_IMX25_UART4_IRQ },
|
|
|
|
{ FSL_IMX25_UART5_ADDR, FSL_IMX25_UART5_IRQ }
|
|
|
|
};
|
|
|
|
|
2018-04-20 14:52:44 +00:00
|
|
|
qdev_prop_set_chr(DEVICE(&s->uart[i]), "chardev", serial_hd(i));
|
2015-09-07 09:39:30 +00:00
|
|
|
|
|
|
|
object_property_set_bool(OBJECT(&s->uart[i]), true, "realized", &err);
|
|
|
|
if (err) {
|
|
|
|
error_propagate(errp, err);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
sysbus_mmio_map(SYS_BUS_DEVICE(&s->uart[i]), 0, serial_table[i].addr);
|
|
|
|
sysbus_connect_irq(SYS_BUS_DEVICE(&s->uart[i]), 0,
|
|
|
|
qdev_get_gpio_in(DEVICE(&s->avic),
|
|
|
|
serial_table[i].irq));
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Initialize all GPT timers */
|
|
|
|
for (i = 0; i < FSL_IMX25_NUM_GPTS; i++) {
|
|
|
|
static const struct {
|
|
|
|
hwaddr addr;
|
|
|
|
unsigned int irq;
|
|
|
|
} gpt_table[FSL_IMX25_NUM_GPTS] = {
|
|
|
|
{ FSL_IMX25_GPT1_ADDR, FSL_IMX25_GPT1_IRQ },
|
|
|
|
{ FSL_IMX25_GPT2_ADDR, FSL_IMX25_GPT2_IRQ },
|
|
|
|
{ FSL_IMX25_GPT3_ADDR, FSL_IMX25_GPT3_IRQ },
|
|
|
|
{ FSL_IMX25_GPT4_ADDR, FSL_IMX25_GPT4_IRQ }
|
|
|
|
};
|
|
|
|
|
2015-12-17 13:37:15 +00:00
|
|
|
s->gpt[i].ccm = IMX_CCM(&s->ccm);
|
2015-09-07 09:39:30 +00:00
|
|
|
|
|
|
|
object_property_set_bool(OBJECT(&s->gpt[i]), true, "realized", &err);
|
|
|
|
if (err) {
|
|
|
|
error_propagate(errp, err);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
sysbus_mmio_map(SYS_BUS_DEVICE(&s->gpt[i]), 0, gpt_table[i].addr);
|
|
|
|
sysbus_connect_irq(SYS_BUS_DEVICE(&s->gpt[i]), 0,
|
|
|
|
qdev_get_gpio_in(DEVICE(&s->avic),
|
|
|
|
gpt_table[i].irq));
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Initialize all EPIT timers */
|
|
|
|
for (i = 0; i < FSL_IMX25_NUM_EPITS; i++) {
|
|
|
|
static const struct {
|
|
|
|
hwaddr addr;
|
|
|
|
unsigned int irq;
|
|
|
|
} epit_table[FSL_IMX25_NUM_EPITS] = {
|
|
|
|
{ FSL_IMX25_EPIT1_ADDR, FSL_IMX25_EPIT1_IRQ },
|
|
|
|
{ FSL_IMX25_EPIT2_ADDR, FSL_IMX25_EPIT2_IRQ }
|
|
|
|
};
|
|
|
|
|
2015-12-17 13:37:15 +00:00
|
|
|
s->epit[i].ccm = IMX_CCM(&s->ccm);
|
2015-09-07 09:39:30 +00:00
|
|
|
|
|
|
|
object_property_set_bool(OBJECT(&s->epit[i]), true, "realized", &err);
|
|
|
|
if (err) {
|
|
|
|
error_propagate(errp, err);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
sysbus_mmio_map(SYS_BUS_DEVICE(&s->epit[i]), 0, epit_table[i].addr);
|
|
|
|
sysbus_connect_irq(SYS_BUS_DEVICE(&s->epit[i]), 0,
|
|
|
|
qdev_get_gpio_in(DEVICE(&s->avic),
|
|
|
|
epit_table[i].irq));
|
|
|
|
}
|
|
|
|
|
|
|
|
qdev_set_nic_properties(DEVICE(&s->fec), &nd_table[0]);
|
2016-05-30 17:26:10 +00:00
|
|
|
|
2015-09-07 09:39:30 +00:00
|
|
|
object_property_set_bool(OBJECT(&s->fec), true, "realized", &err);
|
|
|
|
if (err) {
|
|
|
|
error_propagate(errp, err);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
sysbus_mmio_map(SYS_BUS_DEVICE(&s->fec), 0, FSL_IMX25_FEC_ADDR);
|
|
|
|
sysbus_connect_irq(SYS_BUS_DEVICE(&s->fec), 0,
|
|
|
|
qdev_get_gpio_in(DEVICE(&s->avic), FSL_IMX25_FEC_IRQ));
|
|
|
|
|
2020-01-17 14:09:31 +00:00
|
|
|
object_property_set_bool(OBJECT(&s->rngc), true, "realized", &err);
|
|
|
|
if (err) {
|
|
|
|
error_propagate(errp, err);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
sysbus_mmio_map(SYS_BUS_DEVICE(&s->rngc), 0, FSL_IMX25_RNGC_ADDR);
|
|
|
|
sysbus_connect_irq(SYS_BUS_DEVICE(&s->rngc), 0,
|
|
|
|
qdev_get_gpio_in(DEVICE(&s->avic), FSL_IMX25_RNGC_IRQ));
|
2015-09-07 09:39:30 +00:00
|
|
|
|
|
|
|
/* Initialize all I2C */
|
|
|
|
for (i = 0; i < FSL_IMX25_NUM_I2CS; i++) {
|
|
|
|
static const struct {
|
|
|
|
hwaddr addr;
|
|
|
|
unsigned int irq;
|
|
|
|
} i2c_table[FSL_IMX25_NUM_I2CS] = {
|
|
|
|
{ FSL_IMX25_I2C1_ADDR, FSL_IMX25_I2C1_IRQ },
|
|
|
|
{ FSL_IMX25_I2C2_ADDR, FSL_IMX25_I2C2_IRQ },
|
|
|
|
{ FSL_IMX25_I2C3_ADDR, FSL_IMX25_I2C3_IRQ }
|
|
|
|
};
|
|
|
|
|
|
|
|
object_property_set_bool(OBJECT(&s->i2c[i]), true, "realized", &err);
|
|
|
|
if (err) {
|
|
|
|
error_propagate(errp, err);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
sysbus_mmio_map(SYS_BUS_DEVICE(&s->i2c[i]), 0, i2c_table[i].addr);
|
|
|
|
sysbus_connect_irq(SYS_BUS_DEVICE(&s->i2c[i]), 0,
|
|
|
|
qdev_get_gpio_in(DEVICE(&s->avic),
|
|
|
|
i2c_table[i].irq));
|
|
|
|
}
|
|
|
|
|
2015-09-14 13:39:49 +00:00
|
|
|
/* Initialize all GPIOs */
|
|
|
|
for (i = 0; i < FSL_IMX25_NUM_GPIOS; i++) {
|
|
|
|
static const struct {
|
|
|
|
hwaddr addr;
|
|
|
|
unsigned int irq;
|
|
|
|
} gpio_table[FSL_IMX25_NUM_GPIOS] = {
|
|
|
|
{ FSL_IMX25_GPIO1_ADDR, FSL_IMX25_GPIO1_IRQ },
|
|
|
|
{ FSL_IMX25_GPIO2_ADDR, FSL_IMX25_GPIO2_IRQ },
|
|
|
|
{ FSL_IMX25_GPIO3_ADDR, FSL_IMX25_GPIO3_IRQ },
|
|
|
|
{ FSL_IMX25_GPIO4_ADDR, FSL_IMX25_GPIO4_IRQ }
|
|
|
|
};
|
|
|
|
|
|
|
|
object_property_set_bool(OBJECT(&s->gpio[i]), true, "realized", &err);
|
|
|
|
if (err) {
|
|
|
|
error_propagate(errp, err);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
sysbus_mmio_map(SYS_BUS_DEVICE(&s->gpio[i]), 0, gpio_table[i].addr);
|
|
|
|
/* Connect GPIO IRQ to PIC */
|
|
|
|
sysbus_connect_irq(SYS_BUS_DEVICE(&s->gpio[i]), 0,
|
|
|
|
qdev_get_gpio_in(DEVICE(&s->avic),
|
|
|
|
gpio_table[i].irq));
|
|
|
|
}
|
|
|
|
|
2020-03-10 21:51:45 +00:00
|
|
|
/* Initialize all SDHC */
|
|
|
|
for (i = 0; i < FSL_IMX25_NUM_ESDHCS; i++) {
|
|
|
|
static const struct {
|
|
|
|
hwaddr addr;
|
|
|
|
unsigned int irq;
|
|
|
|
} esdhc_table[FSL_IMX25_NUM_ESDHCS] = {
|
|
|
|
{ FSL_IMX25_ESDHC1_ADDR, FSL_IMX25_ESDHC1_IRQ },
|
|
|
|
{ FSL_IMX25_ESDHC2_ADDR, FSL_IMX25_ESDHC2_IRQ },
|
|
|
|
};
|
|
|
|
|
|
|
|
object_property_set_uint(OBJECT(&s->esdhc[i]), 2, "sd-spec-version",
|
|
|
|
&err);
|
|
|
|
object_property_set_uint(OBJECT(&s->esdhc[i]), IMX25_ESDHC_CAPABILITIES,
|
|
|
|
"capareg", &err);
|
|
|
|
object_property_set_bool(OBJECT(&s->esdhc[i]), true, "realized", &err);
|
|
|
|
if (err) {
|
|
|
|
error_propagate(errp, err);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
sysbus_mmio_map(SYS_BUS_DEVICE(&s->esdhc[i]), 0, esdhc_table[i].addr);
|
|
|
|
sysbus_connect_irq(SYS_BUS_DEVICE(&s->esdhc[i]), 0,
|
|
|
|
qdev_get_gpio_in(DEVICE(&s->avic),
|
|
|
|
esdhc_table[i].irq));
|
|
|
|
}
|
|
|
|
|
2020-03-10 21:51:46 +00:00
|
|
|
/* USB */
|
|
|
|
for (i = 0; i < FSL_IMX25_NUM_USBS; i++) {
|
|
|
|
static const struct {
|
|
|
|
hwaddr addr;
|
|
|
|
unsigned int irq;
|
|
|
|
} usb_table[FSL_IMX25_NUM_USBS] = {
|
|
|
|
{ FSL_IMX25_USB1_ADDR, FSL_IMX25_USB1_IRQ },
|
|
|
|
{ FSL_IMX25_USB2_ADDR, FSL_IMX25_USB2_IRQ },
|
|
|
|
};
|
|
|
|
|
|
|
|
object_property_set_bool(OBJECT(&s->usb[i]), true, "realized",
|
|
|
|
&error_abort);
|
|
|
|
sysbus_mmio_map(SYS_BUS_DEVICE(&s->usb[i]), 0, usb_table[i].addr);
|
|
|
|
sysbus_connect_irq(SYS_BUS_DEVICE(&s->usb[i]), 0,
|
|
|
|
qdev_get_gpio_in(DEVICE(&s->avic),
|
|
|
|
usb_table[i].irq));
|
|
|
|
}
|
|
|
|
|
2020-05-17 16:21:30 +00:00
|
|
|
/* Watchdog */
|
|
|
|
object_property_set_bool(OBJECT(&s->wdt), true, "pretimeout-support",
|
|
|
|
&error_abort);
|
|
|
|
object_property_set_bool(OBJECT(&s->wdt), true, "realized", &error_abort);
|
|
|
|
sysbus_mmio_map(SYS_BUS_DEVICE(&s->wdt), 0, FSL_IMX25_WDT_ADDR);
|
|
|
|
sysbus_connect_irq(SYS_BUS_DEVICE(&s->wdt), 0,
|
|
|
|
qdev_get_gpio_in(DEVICE(&s->avic),
|
|
|
|
FSL_IMX25_WDT_IRQ));
|
|
|
|
|
2015-09-07 09:39:30 +00:00
|
|
|
/* initialize 2 x 16 KB ROM */
|
2020-02-24 17:32:23 +00:00
|
|
|
memory_region_init_rom(&s->rom[0], OBJECT(dev), "imx25.rom0",
|
|
|
|
FSL_IMX25_ROM0_SIZE, &err);
|
2015-09-07 09:39:30 +00:00
|
|
|
if (err) {
|
|
|
|
error_propagate(errp, err);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
memory_region_add_subregion(get_system_memory(), FSL_IMX25_ROM0_ADDR,
|
|
|
|
&s->rom[0]);
|
2020-02-24 17:32:23 +00:00
|
|
|
memory_region_init_rom(&s->rom[1], OBJECT(dev), "imx25.rom1",
|
|
|
|
FSL_IMX25_ROM1_SIZE, &err);
|
2015-09-07 09:39:30 +00:00
|
|
|
if (err) {
|
|
|
|
error_propagate(errp, err);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
memory_region_add_subregion(get_system_memory(), FSL_IMX25_ROM1_ADDR,
|
|
|
|
&s->rom[1]);
|
|
|
|
|
|
|
|
/* initialize internal RAM (128 KB) */
|
2017-07-07 14:42:53 +00:00
|
|
|
memory_region_init_ram(&s->iram, NULL, "imx25.iram", FSL_IMX25_IRAM_SIZE,
|
2015-09-07 09:39:30 +00:00
|
|
|
&err);
|
|
|
|
if (err) {
|
|
|
|
error_propagate(errp, err);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
memory_region_add_subregion(get_system_memory(), FSL_IMX25_IRAM_ADDR,
|
|
|
|
&s->iram);
|
|
|
|
|
|
|
|
/* internal RAM (128 KB) is aliased over 128 MB - 128 KB */
|
2020-02-24 17:32:23 +00:00
|
|
|
memory_region_init_alias(&s->iram_alias, OBJECT(dev), "imx25.iram_alias",
|
2015-09-07 09:39:30 +00:00
|
|
|
&s->iram, 0, FSL_IMX25_IRAM_ALIAS_SIZE);
|
|
|
|
memory_region_add_subregion(get_system_memory(), FSL_IMX25_IRAM_ALIAS_ADDR,
|
|
|
|
&s->iram_alias);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void fsl_imx25_class_init(ObjectClass *oc, void *data)
|
|
|
|
{
|
|
|
|
DeviceClass *dc = DEVICE_CLASS(oc);
|
|
|
|
|
|
|
|
dc->realize = fsl_imx25_realize;
|
2016-03-16 17:06:00 +00:00
|
|
|
dc->desc = "i.MX25 SOC";
|
2017-11-07 13:03:51 +00:00
|
|
|
/*
|
|
|
|
* Reason: uses serial_hds in realize and the imx25 board does not
|
|
|
|
* support multiple CPUs
|
|
|
|
*/
|
|
|
|
dc->user_creatable = false;
|
2015-09-07 09:39:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static const TypeInfo fsl_imx25_type_info = {
|
|
|
|
.name = TYPE_FSL_IMX25,
|
|
|
|
.parent = TYPE_DEVICE,
|
|
|
|
.instance_size = sizeof(FslIMX25State),
|
|
|
|
.instance_init = fsl_imx25_init,
|
|
|
|
.class_init = fsl_imx25_class_init,
|
|
|
|
};
|
|
|
|
|
|
|
|
static void fsl_imx25_register_types(void)
|
|
|
|
{
|
|
|
|
type_register_static(&fsl_imx25_type_info);
|
|
|
|
}
|
|
|
|
|
|
|
|
type_init(fsl_imx25_register_types)
|