10c80f50fSYoshinori Sato /*
20c80f50fSYoshinori Sato * RX62N Microcontroller
30c80f50fSYoshinori Sato *
40c80f50fSYoshinori Sato * Datasheet: RX62N Group, RX621 Group User's Manual: Hardware
50c80f50fSYoshinori Sato * (Rev.1.40 R01UH0033EJ0140)
60c80f50fSYoshinori Sato *
70c80f50fSYoshinori Sato * Copyright (c) 2019 Yoshinori Sato
81db2086eSPhilippe Mathieu-Daudé * Copyright (c) 2020 Philippe Mathieu-Daudé
90c80f50fSYoshinori Sato *
100c80f50fSYoshinori Sato * This program is free software; you can redistribute it and/or modify it
110c80f50fSYoshinori Sato * under the terms and conditions of the GNU General Public License,
120c80f50fSYoshinori Sato * version 2 or later, as published by the Free Software Foundation.
130c80f50fSYoshinori Sato *
140c80f50fSYoshinori Sato * This program is distributed in the hope it will be useful, but WITHOUT
150c80f50fSYoshinori Sato * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
160c80f50fSYoshinori Sato * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
170c80f50fSYoshinori Sato * more details.
180c80f50fSYoshinori Sato *
190c80f50fSYoshinori Sato * You should have received a copy of the GNU General Public License along with
200c80f50fSYoshinori Sato * this program. If not, see <http://www.gnu.org/licenses/>.
210c80f50fSYoshinori Sato */
220c80f50fSYoshinori Sato
230c80f50fSYoshinori Sato #include "qemu/osdep.h"
240c80f50fSYoshinori Sato #include "qapi/error.h"
257d272cb4SRichard Henderson #include "qemu/error-report.h"
267188dfcdSPhilippe Mathieu-Daudé #include "qemu/units.h"
270c80f50fSYoshinori Sato #include "hw/rx/rx62n.h"
280c80f50fSYoshinori Sato #include "hw/loader.h"
290c80f50fSYoshinori Sato #include "hw/sysbus.h"
300c80f50fSYoshinori Sato #include "hw/qdev-properties.h"
310c80f50fSYoshinori Sato #include "sysemu/sysemu.h"
32670581f9SKevin Wolf #include "qapi/qmp/qlist.h"
33db1015e9SEduardo Habkost #include "qom/object.h"
340c80f50fSYoshinori Sato
350c80f50fSYoshinori Sato /*
360c80f50fSYoshinori Sato * RX62N Internal Memory
370c80f50fSYoshinori Sato */
380c80f50fSYoshinori Sato #define RX62N_IRAM_BASE 0x00000000
390c80f50fSYoshinori Sato #define RX62N_DFLASH_BASE 0x00100000
400c80f50fSYoshinori Sato #define RX62N_CFLASH_BASE 0xfff80000
410c80f50fSYoshinori Sato
420c80f50fSYoshinori Sato /*
430c80f50fSYoshinori Sato * RX62N Peripheral Address
440c80f50fSYoshinori Sato * See users manual section 5
450c80f50fSYoshinori Sato */
460c80f50fSYoshinori Sato #define RX62N_ICU_BASE 0x00087000
470c80f50fSYoshinori Sato #define RX62N_TMR_BASE 0x00088200
480c80f50fSYoshinori Sato #define RX62N_CMT_BASE 0x00088000
490c80f50fSYoshinori Sato #define RX62N_SCI_BASE 0x00088240
500c80f50fSYoshinori Sato
510c80f50fSYoshinori Sato /*
520c80f50fSYoshinori Sato * RX62N Peripheral IRQ
530c80f50fSYoshinori Sato * See users manual section 11
540c80f50fSYoshinori Sato */
550c80f50fSYoshinori Sato #define RX62N_TMR_IRQ 174
560c80f50fSYoshinori Sato #define RX62N_CMT_IRQ 28
570c80f50fSYoshinori Sato #define RX62N_SCI_IRQ 214
580c80f50fSYoshinori Sato
591db2086eSPhilippe Mathieu-Daudé #define RX62N_XTAL_MIN_HZ (8 * 1000 * 1000)
601db2086eSPhilippe Mathieu-Daudé #define RX62N_XTAL_MAX_HZ (14 * 1000 * 1000)
611db2086eSPhilippe Mathieu-Daudé #define RX62N_PCLK_MAX_HZ (50 * 1000 * 1000)
621db2086eSPhilippe Mathieu-Daudé
63db1015e9SEduardo Habkost struct RX62NClass {
641db2086eSPhilippe Mathieu-Daudé /*< private >*/
651db2086eSPhilippe Mathieu-Daudé DeviceClass parent_class;
661db2086eSPhilippe Mathieu-Daudé /*< public >*/
671db2086eSPhilippe Mathieu-Daudé const char *name;
681db2086eSPhilippe Mathieu-Daudé uint64_t ram_size;
691db2086eSPhilippe Mathieu-Daudé uint64_t rom_flash_size;
701db2086eSPhilippe Mathieu-Daudé uint64_t data_flash_size;
71db1015e9SEduardo Habkost };
72db1015e9SEduardo Habkost typedef struct RX62NClass RX62NClass;
731db2086eSPhilippe Mathieu-Daudé
748110fa1dSEduardo Habkost DECLARE_CLASS_CHECKERS(RX62NClass, RX62N_MCU,
758110fa1dSEduardo Habkost TYPE_RX62N_MCU)
761db2086eSPhilippe Mathieu-Daudé
770c80f50fSYoshinori Sato /*
780c80f50fSYoshinori Sato * IRQ -> IPR mapping table
790c80f50fSYoshinori Sato * 0x00 - 0x91: IPR no (IPR00 to IPR91)
800c80f50fSYoshinori Sato * 0xff: IPR not assigned
810c80f50fSYoshinori Sato * See "11.3.1 Interrupt Vector Table" in hardware manual.
820c80f50fSYoshinori Sato */
830c80f50fSYoshinori Sato static const uint8_t ipr_table[NR_IRQS] = {
840c80f50fSYoshinori Sato 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
850c80f50fSYoshinori Sato 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* 15 */
860c80f50fSYoshinori Sato 0x00, 0xff, 0xff, 0xff, 0xff, 0x01, 0xff, 0x02,
870c80f50fSYoshinori Sato 0xff, 0xff, 0xff, 0x03, 0x04, 0x05, 0x06, 0x07, /* 31 */
880c80f50fSYoshinori Sato 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
890c80f50fSYoshinori Sato 0x10, 0x11, 0x12, 0x13, 0x14, 0x14, 0x14, 0x14, /* 47 */
900c80f50fSYoshinori Sato 0x15, 0x15, 0x15, 0x15, 0xff, 0xff, 0xff, 0xff,
910c80f50fSYoshinori Sato 0x18, 0x18, 0x18, 0x18, 0x18, 0x1d, 0x1e, 0x1f, /* 63 */
920c80f50fSYoshinori Sato 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27,
930c80f50fSYoshinori Sato 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, /* 79 */
940c80f50fSYoshinori Sato 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
950c80f50fSYoshinori Sato 0xff, 0xff, 0x3a, 0x3b, 0x3c, 0xff, 0xff, 0xff, /* 95 */
960c80f50fSYoshinori Sato 0x40, 0xff, 0x44, 0x45, 0xff, 0xff, 0x48, 0xff,
970c80f50fSYoshinori Sato 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* 111 */
980c80f50fSYoshinori Sato 0xff, 0xff, 0x51, 0x51, 0x51, 0x51, 0x52, 0x52,
990c80f50fSYoshinori Sato 0x52, 0x53, 0x53, 0x54, 0x54, 0x55, 0x55, 0x56, /* 127 */
1000c80f50fSYoshinori Sato 0x56, 0x57, 0x57, 0x57, 0x57, 0x58, 0x59, 0x59,
1010c80f50fSYoshinori Sato 0x59, 0x59, 0x5a, 0x5b, 0x5b, 0x5b, 0x5c, 0x5c, /* 143 */
1020c80f50fSYoshinori Sato 0x5c, 0x5c, 0x5d, 0x5d, 0x5d, 0x5e, 0x5e, 0x5f,
1030c80f50fSYoshinori Sato 0x5f, 0x60, 0x60, 0x61, 0x61, 0x62, 0x62, 0x62, /* 159 */
1040c80f50fSYoshinori Sato 0x62, 0x63, 0x64, 0x64, 0x64, 0x64, 0x65, 0x66,
1050c80f50fSYoshinori Sato 0x66, 0x66, 0x67, 0x67, 0x67, 0x67, 0x68, 0x68, /* 175 */
1060c80f50fSYoshinori Sato 0x68, 0x69, 0x69, 0x69, 0x6a, 0x6a, 0x6a, 0x6b,
1070c80f50fSYoshinori Sato 0x6b, 0x6b, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* 191 */
1080c80f50fSYoshinori Sato 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x70, 0x71,
1090c80f50fSYoshinori Sato 0x72, 0x73, 0x74, 0x75, 0xff, 0xff, 0xff, 0xff, /* 207 */
1100c80f50fSYoshinori Sato 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x80, 0x80,
1110c80f50fSYoshinori Sato 0x80, 0x80, 0x81, 0x81, 0x81, 0x81, 0x82, 0x82, /* 223 */
1120c80f50fSYoshinori Sato 0x82, 0x82, 0x83, 0x83, 0x83, 0x83, 0xff, 0xff,
1130c80f50fSYoshinori Sato 0xff, 0xff, 0x85, 0x85, 0x85, 0x85, 0x86, 0x86, /* 239 */
1140c80f50fSYoshinori Sato 0x86, 0x86, 0xff, 0xff, 0xff, 0xff, 0x88, 0x89,
1150c80f50fSYoshinori Sato 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, 0x90, 0x91, /* 255 */
1160c80f50fSYoshinori Sato };
1170c80f50fSYoshinori Sato
1180c80f50fSYoshinori Sato /*
1199b4b4e51SMichael Tokarev * Level triggered IRQ list
1200c80f50fSYoshinori Sato * Not listed IRQ is Edge trigger.
1210c80f50fSYoshinori Sato * See "11.3.1 Interrupt Vector Table" in hardware manual.
1220c80f50fSYoshinori Sato */
1230c80f50fSYoshinori Sato static const uint8_t levelirq[] = {
1240c80f50fSYoshinori Sato 16, 21, 32, 44, 47, 48, 51, 64, 65, 66,
1250c80f50fSYoshinori Sato 67, 68, 69, 70, 71, 72, 73, 74, 75, 76,
1260c80f50fSYoshinori Sato 77, 78, 79, 90, 91, 170, 171, 172, 173, 214,
1270c80f50fSYoshinori Sato 217, 218, 221, 222, 225, 226, 229, 234, 237, 238,
1280c80f50fSYoshinori Sato 241, 246, 249, 250, 253,
1290c80f50fSYoshinori Sato };
1300c80f50fSYoshinori Sato
register_icu(RX62NState * s)1310c80f50fSYoshinori Sato static void register_icu(RX62NState *s)
1320c80f50fSYoshinori Sato {
1330c80f50fSYoshinori Sato int i;
1340c80f50fSYoshinori Sato SysBusDevice *icu;
135670581f9SKevin Wolf QList *ipr_map, *trigger_level;
1360c80f50fSYoshinori Sato
1370c80f50fSYoshinori Sato object_initialize_child(OBJECT(s), "icu", &s->icu, TYPE_RX_ICU);
1380c80f50fSYoshinori Sato icu = SYS_BUS_DEVICE(&s->icu);
139670581f9SKevin Wolf
140670581f9SKevin Wolf ipr_map = qlist_new();
1410c80f50fSYoshinori Sato for (i = 0; i < NR_IRQS; i++) {
142670581f9SKevin Wolf qlist_append_int(ipr_map, ipr_table[i]);
1430c80f50fSYoshinori Sato }
144670581f9SKevin Wolf qdev_prop_set_array(DEVICE(icu), "ipr-map", ipr_map);
145670581f9SKevin Wolf
146670581f9SKevin Wolf trigger_level = qlist_new();
1470c80f50fSYoshinori Sato for (i = 0; i < ARRAY_SIZE(levelirq); i++) {
148670581f9SKevin Wolf qlist_append_int(trigger_level, levelirq[i]);
1490c80f50fSYoshinori Sato }
150670581f9SKevin Wolf qdev_prop_set_array(DEVICE(icu), "trigger-level", trigger_level);
1510c80f50fSYoshinori Sato sysbus_realize(icu, &error_abort);
152*2e0b925aSPhilippe Mathieu-Daudé
1530c80f50fSYoshinori Sato sysbus_connect_irq(icu, 0, qdev_get_gpio_in(DEVICE(&s->cpu), RX_CPU_IRQ));
1540c80f50fSYoshinori Sato sysbus_connect_irq(icu, 1, qdev_get_gpio_in(DEVICE(&s->cpu), RX_CPU_FIR));
155*2e0b925aSPhilippe Mathieu-Daudé sysbus_connect_irq(icu, 2, qdev_get_gpio_in(DEVICE(&s->icu), SWI));
1567d5b0d68SPhilippe Mathieu-Daudé sysbus_mmio_map(icu, 0, RX62N_ICU_BASE);
1570c80f50fSYoshinori Sato }
1580c80f50fSYoshinori Sato
register_tmr(RX62NState * s,int unit)1590c80f50fSYoshinori Sato static void register_tmr(RX62NState *s, int unit)
1600c80f50fSYoshinori Sato {
1610c80f50fSYoshinori Sato SysBusDevice *tmr;
1620c80f50fSYoshinori Sato int i, irqbase;
1630c80f50fSYoshinori Sato
1640c80f50fSYoshinori Sato object_initialize_child(OBJECT(s), "tmr[*]",
1650c80f50fSYoshinori Sato &s->tmr[unit], TYPE_RENESAS_TMR);
1660c80f50fSYoshinori Sato tmr = SYS_BUS_DEVICE(&s->tmr[unit]);
1671db2086eSPhilippe Mathieu-Daudé qdev_prop_set_uint64(DEVICE(tmr), "input-freq", s->pclk_freq_hz);
1680c80f50fSYoshinori Sato sysbus_realize(tmr, &error_abort);
1690c80f50fSYoshinori Sato
1700c80f50fSYoshinori Sato irqbase = RX62N_TMR_IRQ + TMR_NR_IRQ * unit;
1710c80f50fSYoshinori Sato for (i = 0; i < TMR_NR_IRQ; i++) {
172*2e0b925aSPhilippe Mathieu-Daudé sysbus_connect_irq(tmr, i,
173*2e0b925aSPhilippe Mathieu-Daudé qdev_get_gpio_in(DEVICE(&s->icu), irqbase + i));
1740c80f50fSYoshinori Sato }
1750c80f50fSYoshinori Sato sysbus_mmio_map(tmr, 0, RX62N_TMR_BASE + unit * 0x10);
1760c80f50fSYoshinori Sato }
1770c80f50fSYoshinori Sato
register_cmt(RX62NState * s,int unit)1780c80f50fSYoshinori Sato static void register_cmt(RX62NState *s, int unit)
1790c80f50fSYoshinori Sato {
1800c80f50fSYoshinori Sato SysBusDevice *cmt;
1810c80f50fSYoshinori Sato int i, irqbase;
1820c80f50fSYoshinori Sato
1830c80f50fSYoshinori Sato object_initialize_child(OBJECT(s), "cmt[*]",
1840c80f50fSYoshinori Sato &s->cmt[unit], TYPE_RENESAS_CMT);
1850c80f50fSYoshinori Sato cmt = SYS_BUS_DEVICE(&s->cmt[unit]);
1861db2086eSPhilippe Mathieu-Daudé qdev_prop_set_uint64(DEVICE(cmt), "input-freq", s->pclk_freq_hz);
1870c80f50fSYoshinori Sato sysbus_realize(cmt, &error_abort);
1880c80f50fSYoshinori Sato
1890c80f50fSYoshinori Sato irqbase = RX62N_CMT_IRQ + CMT_NR_IRQ * unit;
1900c80f50fSYoshinori Sato for (i = 0; i < CMT_NR_IRQ; i++) {
191*2e0b925aSPhilippe Mathieu-Daudé sysbus_connect_irq(cmt, i,
192*2e0b925aSPhilippe Mathieu-Daudé qdev_get_gpio_in(DEVICE(&s->icu), irqbase + i));
1930c80f50fSYoshinori Sato }
1940c80f50fSYoshinori Sato sysbus_mmio_map(cmt, 0, RX62N_CMT_BASE + unit * 0x10);
1950c80f50fSYoshinori Sato }
1960c80f50fSYoshinori Sato
register_sci(RX62NState * s,int unit)1970c80f50fSYoshinori Sato static void register_sci(RX62NState *s, int unit)
1980c80f50fSYoshinori Sato {
1990c80f50fSYoshinori Sato SysBusDevice *sci;
2000c80f50fSYoshinori Sato int i, irqbase;
2010c80f50fSYoshinori Sato
2020c80f50fSYoshinori Sato object_initialize_child(OBJECT(s), "sci[*]",
2030c80f50fSYoshinori Sato &s->sci[unit], TYPE_RENESAS_SCI);
2040c80f50fSYoshinori Sato sci = SYS_BUS_DEVICE(&s->sci[unit]);
2050c80f50fSYoshinori Sato qdev_prop_set_chr(DEVICE(sci), "chardev", serial_hd(unit));
2061db2086eSPhilippe Mathieu-Daudé qdev_prop_set_uint64(DEVICE(sci), "input-freq", s->pclk_freq_hz);
2070c80f50fSYoshinori Sato sysbus_realize(sci, &error_abort);
2080c80f50fSYoshinori Sato
2090c80f50fSYoshinori Sato irqbase = RX62N_SCI_IRQ + SCI_NR_IRQ * unit;
2100c80f50fSYoshinori Sato for (i = 0; i < SCI_NR_IRQ; i++) {
211*2e0b925aSPhilippe Mathieu-Daudé sysbus_connect_irq(sci, i,
212*2e0b925aSPhilippe Mathieu-Daudé qdev_get_gpio_in(DEVICE(&s->icu), irqbase + i));
2130c80f50fSYoshinori Sato }
2140c80f50fSYoshinori Sato sysbus_mmio_map(sci, 0, RX62N_SCI_BASE + unit * 0x08);
2150c80f50fSYoshinori Sato }
2160c80f50fSYoshinori Sato
rx62n_realize(DeviceState * dev,Error ** errp)2170c80f50fSYoshinori Sato static void rx62n_realize(DeviceState *dev, Error **errp)
2180c80f50fSYoshinori Sato {
2190c80f50fSYoshinori Sato RX62NState *s = RX62N_MCU(dev);
2201db2086eSPhilippe Mathieu-Daudé RX62NClass *rxc = RX62N_MCU_GET_CLASS(dev);
2211db2086eSPhilippe Mathieu-Daudé
2221db2086eSPhilippe Mathieu-Daudé if (s->xtal_freq_hz == 0) {
2231db2086eSPhilippe Mathieu-Daudé error_setg(errp, "\"xtal-frequency-hz\" property must be provided.");
2241db2086eSPhilippe Mathieu-Daudé return;
2251db2086eSPhilippe Mathieu-Daudé }
2261db2086eSPhilippe Mathieu-Daudé /* XTAL range: 8-14 MHz */
2271db2086eSPhilippe Mathieu-Daudé if (s->xtal_freq_hz < RX62N_XTAL_MIN_HZ
2281db2086eSPhilippe Mathieu-Daudé || s->xtal_freq_hz > RX62N_XTAL_MAX_HZ) {
2291db2086eSPhilippe Mathieu-Daudé error_setg(errp, "\"xtal-frequency-hz\" property in incorrect range.");
2301db2086eSPhilippe Mathieu-Daudé return;
2311db2086eSPhilippe Mathieu-Daudé }
2321db2086eSPhilippe Mathieu-Daudé /* Use a 4x fixed multiplier */
2331db2086eSPhilippe Mathieu-Daudé s->pclk_freq_hz = 4 * s->xtal_freq_hz;
2341db2086eSPhilippe Mathieu-Daudé /* PCLK range: 8-50 MHz */
2351db2086eSPhilippe Mathieu-Daudé assert(s->pclk_freq_hz <= RX62N_PCLK_MAX_HZ);
2360c80f50fSYoshinori Sato
2370c80f50fSYoshinori Sato memory_region_init_ram(&s->iram, OBJECT(dev), "iram",
2381db2086eSPhilippe Mathieu-Daudé rxc->ram_size, &error_abort);
2390c80f50fSYoshinori Sato memory_region_add_subregion(s->sysmem, RX62N_IRAM_BASE, &s->iram);
2400c80f50fSYoshinori Sato memory_region_init_rom(&s->d_flash, OBJECT(dev), "flash-data",
2411db2086eSPhilippe Mathieu-Daudé rxc->data_flash_size, &error_abort);
2420c80f50fSYoshinori Sato memory_region_add_subregion(s->sysmem, RX62N_DFLASH_BASE, &s->d_flash);
2430c80f50fSYoshinori Sato memory_region_init_rom(&s->c_flash, OBJECT(dev), "flash-code",
2441db2086eSPhilippe Mathieu-Daudé rxc->rom_flash_size, &error_abort);
2450c80f50fSYoshinori Sato memory_region_add_subregion(s->sysmem, RX62N_CFLASH_BASE, &s->c_flash);
2460c80f50fSYoshinori Sato
2470c80f50fSYoshinori Sato /* Initialize CPU */
2480c80f50fSYoshinori Sato object_initialize_child(OBJECT(s), "cpu", &s->cpu, TYPE_RX62N_CPU);
2490c80f50fSYoshinori Sato qdev_realize(DEVICE(&s->cpu), NULL, &error_abort);
2500c80f50fSYoshinori Sato
2510c80f50fSYoshinori Sato register_icu(s);
2520c80f50fSYoshinori Sato s->cpu.env.ack = qdev_get_gpio_in_named(DEVICE(&s->icu), "ack", 0);
2530c80f50fSYoshinori Sato register_tmr(s, 0);
2540c80f50fSYoshinori Sato register_tmr(s, 1);
2550c80f50fSYoshinori Sato register_cmt(s, 0);
2560c80f50fSYoshinori Sato register_cmt(s, 1);
2570c80f50fSYoshinori Sato register_sci(s, 0);
2580c80f50fSYoshinori Sato }
2590c80f50fSYoshinori Sato
2600c80f50fSYoshinori Sato static Property rx62n_properties[] = {
2610c80f50fSYoshinori Sato DEFINE_PROP_LINK("main-bus", RX62NState, sysmem, TYPE_MEMORY_REGION,
2620c80f50fSYoshinori Sato MemoryRegion *),
2630c80f50fSYoshinori Sato DEFINE_PROP_BOOL("load-kernel", RX62NState, kernel, false),
2641db2086eSPhilippe Mathieu-Daudé DEFINE_PROP_UINT32("xtal-frequency-hz", RX62NState, xtal_freq_hz, 0),
2650c80f50fSYoshinori Sato DEFINE_PROP_END_OF_LIST(),
2660c80f50fSYoshinori Sato };
2670c80f50fSYoshinori Sato
rx62n_class_init(ObjectClass * klass,void * data)2680c80f50fSYoshinori Sato static void rx62n_class_init(ObjectClass *klass, void *data)
2690c80f50fSYoshinori Sato {
2700c80f50fSYoshinori Sato DeviceClass *dc = DEVICE_CLASS(klass);
2710c80f50fSYoshinori Sato
2720c80f50fSYoshinori Sato dc->realize = rx62n_realize;
2730c80f50fSYoshinori Sato device_class_set_props(dc, rx62n_properties);
2740c80f50fSYoshinori Sato }
2750c80f50fSYoshinori Sato
r5f562n7_class_init(ObjectClass * oc,void * data)2761db2086eSPhilippe Mathieu-Daudé static void r5f562n7_class_init(ObjectClass *oc, void *data)
2771db2086eSPhilippe Mathieu-Daudé {
2781db2086eSPhilippe Mathieu-Daudé RX62NClass *rxc = RX62N_MCU_CLASS(oc);
2791db2086eSPhilippe Mathieu-Daudé
2801db2086eSPhilippe Mathieu-Daudé rxc->ram_size = 64 * KiB;
2811db2086eSPhilippe Mathieu-Daudé rxc->rom_flash_size = 384 * KiB;
2821db2086eSPhilippe Mathieu-Daudé rxc->data_flash_size = 32 * KiB;
2831db2086eSPhilippe Mathieu-Daudé };
2841db2086eSPhilippe Mathieu-Daudé
r5f562n8_class_init(ObjectClass * oc,void * data)2851db2086eSPhilippe Mathieu-Daudé static void r5f562n8_class_init(ObjectClass *oc, void *data)
2861db2086eSPhilippe Mathieu-Daudé {
2871db2086eSPhilippe Mathieu-Daudé RX62NClass *rxc = RX62N_MCU_CLASS(oc);
2881db2086eSPhilippe Mathieu-Daudé
2891db2086eSPhilippe Mathieu-Daudé rxc->ram_size = 96 * KiB;
2901db2086eSPhilippe Mathieu-Daudé rxc->rom_flash_size = 512 * KiB;
2911db2086eSPhilippe Mathieu-Daudé rxc->data_flash_size = 32 * KiB;
2921db2086eSPhilippe Mathieu-Daudé };
2931db2086eSPhilippe Mathieu-Daudé
2941db2086eSPhilippe Mathieu-Daudé static const TypeInfo rx62n_types[] = {
2951db2086eSPhilippe Mathieu-Daudé {
2961db2086eSPhilippe Mathieu-Daudé .name = TYPE_R5F562N7_MCU,
2971db2086eSPhilippe Mathieu-Daudé .parent = TYPE_RX62N_MCU,
2981db2086eSPhilippe Mathieu-Daudé .class_init = r5f562n7_class_init,
2991db2086eSPhilippe Mathieu-Daudé }, {
3001db2086eSPhilippe Mathieu-Daudé .name = TYPE_R5F562N8_MCU,
3011db2086eSPhilippe Mathieu-Daudé .parent = TYPE_RX62N_MCU,
3021db2086eSPhilippe Mathieu-Daudé .class_init = r5f562n8_class_init,
3031db2086eSPhilippe Mathieu-Daudé }, {
3040c80f50fSYoshinori Sato .name = TYPE_RX62N_MCU,
3050c80f50fSYoshinori Sato .parent = TYPE_DEVICE,
3060c80f50fSYoshinori Sato .instance_size = sizeof(RX62NState),
3071db2086eSPhilippe Mathieu-Daudé .class_size = sizeof(RX62NClass),
3080c80f50fSYoshinori Sato .class_init = rx62n_class_init,
3091db2086eSPhilippe Mathieu-Daudé .abstract = true,
3101db2086eSPhilippe Mathieu-Daudé }
3110c80f50fSYoshinori Sato };
3120c80f50fSYoshinori Sato
3131db2086eSPhilippe Mathieu-Daudé DEFINE_TYPES(rx62n_types)
314