131cbf933SJean-Christophe Dubois /* 231cbf933SJean-Christophe Dubois * Copyright (c) 2018 Jean-Christophe Dubois <jcd@tribudubois.net> 331cbf933SJean-Christophe Dubois * 431cbf933SJean-Christophe Dubois * i.MX6UL SOC emulation. 531cbf933SJean-Christophe Dubois * 631cbf933SJean-Christophe Dubois * Based on hw/arm/fsl-imx7.c 731cbf933SJean-Christophe Dubois * 831cbf933SJean-Christophe Dubois * This program is free software; you can redistribute it and/or modify 931cbf933SJean-Christophe Dubois * it under the terms of the GNU General Public License as published by 1031cbf933SJean-Christophe Dubois * the Free Software Foundation; either version 2 of the License, or 1131cbf933SJean-Christophe Dubois * (at your option) any later version. 1231cbf933SJean-Christophe Dubois * 1331cbf933SJean-Christophe Dubois * This program is distributed in the hope that it will be useful, 1431cbf933SJean-Christophe Dubois * but WITHOUT ANY WARRANTY; without even the implied warranty of 1531cbf933SJean-Christophe Dubois * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1631cbf933SJean-Christophe Dubois * GNU General Public License for more details. 1731cbf933SJean-Christophe Dubois */ 1831cbf933SJean-Christophe Dubois 1931cbf933SJean-Christophe Dubois #include "qemu/osdep.h" 2031cbf933SJean-Christophe Dubois #include "qapi/error.h" 2131cbf933SJean-Christophe Dubois #include "hw/arm/fsl-imx6ul.h" 2231cbf933SJean-Christophe Dubois #include "hw/misc/unimp.h" 2331cbf933SJean-Christophe Dubois #include "sysemu/sysemu.h" 2431cbf933SJean-Christophe Dubois #include "qemu/error-report.h" 25*0b8fa32fSMarkus Armbruster #include "qemu/module.h" 2631cbf933SJean-Christophe Dubois 2731cbf933SJean-Christophe Dubois #define NAME_SIZE 20 2831cbf933SJean-Christophe Dubois 2931cbf933SJean-Christophe Dubois static void fsl_imx6ul_init(Object *obj) 3031cbf933SJean-Christophe Dubois { 3131cbf933SJean-Christophe Dubois FslIMX6ULState *s = FSL_IMX6UL(obj); 3231cbf933SJean-Christophe Dubois char name[NAME_SIZE]; 3331cbf933SJean-Christophe Dubois int i; 3431cbf933SJean-Christophe Dubois 3531cbf933SJean-Christophe Dubois for (i = 0; i < MIN(smp_cpus, FSL_IMX6UL_NUM_CPUS); i++) { 3631cbf933SJean-Christophe Dubois snprintf(name, NAME_SIZE, "cpu%d", i); 3731cbf933SJean-Christophe Dubois object_initialize_child(obj, name, &s->cpu[i], sizeof(s->cpu[i]), 3831cbf933SJean-Christophe Dubois "cortex-a7-" TYPE_ARM_CPU, &error_abort, NULL); 3931cbf933SJean-Christophe Dubois } 4031cbf933SJean-Christophe Dubois 4131cbf933SJean-Christophe Dubois /* 4231cbf933SJean-Christophe Dubois * A7MPCORE 4331cbf933SJean-Christophe Dubois */ 4431cbf933SJean-Christophe Dubois sysbus_init_child_obj(obj, "a7mpcore", &s->a7mpcore, sizeof(s->a7mpcore), 4531cbf933SJean-Christophe Dubois TYPE_A15MPCORE_PRIV); 4631cbf933SJean-Christophe Dubois 4731cbf933SJean-Christophe Dubois /* 4831cbf933SJean-Christophe Dubois * CCM 4931cbf933SJean-Christophe Dubois */ 5031cbf933SJean-Christophe Dubois sysbus_init_child_obj(obj, "ccm", &s->ccm, sizeof(s->ccm), TYPE_IMX6UL_CCM); 5131cbf933SJean-Christophe Dubois 5231cbf933SJean-Christophe Dubois /* 5331cbf933SJean-Christophe Dubois * SRC 5431cbf933SJean-Christophe Dubois */ 5531cbf933SJean-Christophe Dubois sysbus_init_child_obj(obj, "src", &s->src, sizeof(s->src), TYPE_IMX6_SRC); 5631cbf933SJean-Christophe Dubois 5731cbf933SJean-Christophe Dubois /* 5831cbf933SJean-Christophe Dubois * GPCv2 5931cbf933SJean-Christophe Dubois */ 6031cbf933SJean-Christophe Dubois sysbus_init_child_obj(obj, "gpcv2", &s->gpcv2, sizeof(s->gpcv2), 6131cbf933SJean-Christophe Dubois TYPE_IMX_GPCV2); 6231cbf933SJean-Christophe Dubois 6331cbf933SJean-Christophe Dubois /* 6431cbf933SJean-Christophe Dubois * SNVS 6531cbf933SJean-Christophe Dubois */ 6631cbf933SJean-Christophe Dubois sysbus_init_child_obj(obj, "snvs", &s->snvs, sizeof(s->snvs), 6731cbf933SJean-Christophe Dubois TYPE_IMX7_SNVS); 6831cbf933SJean-Christophe Dubois 6931cbf933SJean-Christophe Dubois /* 7031cbf933SJean-Christophe Dubois * GPR 7131cbf933SJean-Christophe Dubois */ 7231cbf933SJean-Christophe Dubois sysbus_init_child_obj(obj, "gpr", &s->gpr, sizeof(s->gpr), 7331cbf933SJean-Christophe Dubois TYPE_IMX7_GPR); 7431cbf933SJean-Christophe Dubois 7531cbf933SJean-Christophe Dubois /* 7631cbf933SJean-Christophe Dubois * GPIOs 1 to 5 7731cbf933SJean-Christophe Dubois */ 7831cbf933SJean-Christophe Dubois for (i = 0; i < FSL_IMX6UL_NUM_GPIOS; i++) { 7931cbf933SJean-Christophe Dubois snprintf(name, NAME_SIZE, "gpio%d", i); 8031cbf933SJean-Christophe Dubois sysbus_init_child_obj(obj, name, &s->gpio[i], sizeof(s->gpio[i]), 8131cbf933SJean-Christophe Dubois TYPE_IMX_GPIO); 8231cbf933SJean-Christophe Dubois } 8331cbf933SJean-Christophe Dubois 8431cbf933SJean-Christophe Dubois /* 8531cbf933SJean-Christophe Dubois * GPT 1, 2 8631cbf933SJean-Christophe Dubois */ 8731cbf933SJean-Christophe Dubois for (i = 0; i < FSL_IMX6UL_NUM_GPTS; i++) { 8831cbf933SJean-Christophe Dubois snprintf(name, NAME_SIZE, "gpt%d", i); 8931cbf933SJean-Christophe Dubois sysbus_init_child_obj(obj, name, &s->gpt[i], sizeof(s->gpt[i]), 9031cbf933SJean-Christophe Dubois TYPE_IMX7_GPT); 9131cbf933SJean-Christophe Dubois } 9231cbf933SJean-Christophe Dubois 9331cbf933SJean-Christophe Dubois /* 9431cbf933SJean-Christophe Dubois * EPIT 1, 2 9531cbf933SJean-Christophe Dubois */ 9631cbf933SJean-Christophe Dubois for (i = 0; i < FSL_IMX6UL_NUM_EPITS; i++) { 9731cbf933SJean-Christophe Dubois snprintf(name, NAME_SIZE, "epit%d", i + 1); 9831cbf933SJean-Christophe Dubois sysbus_init_child_obj(obj, name, &s->epit[i], sizeof(s->epit[i]), 9931cbf933SJean-Christophe Dubois TYPE_IMX_EPIT); 10031cbf933SJean-Christophe Dubois } 10131cbf933SJean-Christophe Dubois 10231cbf933SJean-Christophe Dubois /* 10331cbf933SJean-Christophe Dubois * eCSPI 10431cbf933SJean-Christophe Dubois */ 10531cbf933SJean-Christophe Dubois for (i = 0; i < FSL_IMX6UL_NUM_ECSPIS; i++) { 10631cbf933SJean-Christophe Dubois snprintf(name, NAME_SIZE, "spi%d", i + 1); 10731cbf933SJean-Christophe Dubois sysbus_init_child_obj(obj, name, &s->spi[i], sizeof(s->spi[i]), 10831cbf933SJean-Christophe Dubois TYPE_IMX_SPI); 10931cbf933SJean-Christophe Dubois } 11031cbf933SJean-Christophe Dubois 11131cbf933SJean-Christophe Dubois /* 11231cbf933SJean-Christophe Dubois * I2C 11331cbf933SJean-Christophe Dubois */ 11431cbf933SJean-Christophe Dubois for (i = 0; i < FSL_IMX6UL_NUM_I2CS; i++) { 11531cbf933SJean-Christophe Dubois snprintf(name, NAME_SIZE, "i2c%d", i + 1); 11631cbf933SJean-Christophe Dubois sysbus_init_child_obj(obj, name, &s->i2c[i], sizeof(s->i2c[i]), 11731cbf933SJean-Christophe Dubois TYPE_IMX_I2C); 11831cbf933SJean-Christophe Dubois } 11931cbf933SJean-Christophe Dubois 12031cbf933SJean-Christophe Dubois /* 12131cbf933SJean-Christophe Dubois * UART 12231cbf933SJean-Christophe Dubois */ 12331cbf933SJean-Christophe Dubois for (i = 0; i < FSL_IMX6UL_NUM_UARTS; i++) { 12431cbf933SJean-Christophe Dubois snprintf(name, NAME_SIZE, "uart%d", i); 12531cbf933SJean-Christophe Dubois sysbus_init_child_obj(obj, name, &s->uart[i], sizeof(s->uart[i]), 12631cbf933SJean-Christophe Dubois TYPE_IMX_SERIAL); 12731cbf933SJean-Christophe Dubois } 12831cbf933SJean-Christophe Dubois 12931cbf933SJean-Christophe Dubois /* 13031cbf933SJean-Christophe Dubois * Ethernet 13131cbf933SJean-Christophe Dubois */ 13231cbf933SJean-Christophe Dubois for (i = 0; i < FSL_IMX6UL_NUM_ETHS; i++) { 13331cbf933SJean-Christophe Dubois snprintf(name, NAME_SIZE, "eth%d", i); 13431cbf933SJean-Christophe Dubois sysbus_init_child_obj(obj, name, &s->eth[i], sizeof(s->eth[i]), 13531cbf933SJean-Christophe Dubois TYPE_IMX_ENET); 13631cbf933SJean-Christophe Dubois } 13731cbf933SJean-Christophe Dubois 13831cbf933SJean-Christophe Dubois /* 13931cbf933SJean-Christophe Dubois * SDHCI 14031cbf933SJean-Christophe Dubois */ 14131cbf933SJean-Christophe Dubois for (i = 0; i < FSL_IMX6UL_NUM_USDHCS; i++) { 14231cbf933SJean-Christophe Dubois snprintf(name, NAME_SIZE, "usdhc%d", i); 14331cbf933SJean-Christophe Dubois sysbus_init_child_obj(obj, name, &s->usdhc[i], sizeof(s->usdhc[i]), 14431cbf933SJean-Christophe Dubois TYPE_IMX_USDHC); 14531cbf933SJean-Christophe Dubois } 14631cbf933SJean-Christophe Dubois 14731cbf933SJean-Christophe Dubois /* 14831cbf933SJean-Christophe Dubois * Watchdog 14931cbf933SJean-Christophe Dubois */ 15031cbf933SJean-Christophe Dubois for (i = 0; i < FSL_IMX6UL_NUM_WDTS; i++) { 15131cbf933SJean-Christophe Dubois snprintf(name, NAME_SIZE, "wdt%d", i); 15231cbf933SJean-Christophe Dubois sysbus_init_child_obj(obj, name, &s->wdt[i], sizeof(s->wdt[i]), 15331cbf933SJean-Christophe Dubois TYPE_IMX2_WDT); 15431cbf933SJean-Christophe Dubois } 15531cbf933SJean-Christophe Dubois } 15631cbf933SJean-Christophe Dubois 15731cbf933SJean-Christophe Dubois static void fsl_imx6ul_realize(DeviceState *dev, Error **errp) 15831cbf933SJean-Christophe Dubois { 15931cbf933SJean-Christophe Dubois FslIMX6ULState *s = FSL_IMX6UL(dev); 16031cbf933SJean-Christophe Dubois int i; 16131cbf933SJean-Christophe Dubois qemu_irq irq; 16231cbf933SJean-Christophe Dubois char name[NAME_SIZE]; 16331cbf933SJean-Christophe Dubois 16431cbf933SJean-Christophe Dubois if (smp_cpus > FSL_IMX6UL_NUM_CPUS) { 16531cbf933SJean-Christophe Dubois error_setg(errp, "%s: Only %d CPUs are supported (%d requested)", 16631cbf933SJean-Christophe Dubois TYPE_FSL_IMX6UL, FSL_IMX6UL_NUM_CPUS, smp_cpus); 16731cbf933SJean-Christophe Dubois return; 16831cbf933SJean-Christophe Dubois } 16931cbf933SJean-Christophe Dubois 17031cbf933SJean-Christophe Dubois for (i = 0; i < smp_cpus; i++) { 17131cbf933SJean-Christophe Dubois Object *o = OBJECT(&s->cpu[i]); 17231cbf933SJean-Christophe Dubois 17331cbf933SJean-Christophe Dubois object_property_set_int(o, QEMU_PSCI_CONDUIT_SMC, 17431cbf933SJean-Christophe Dubois "psci-conduit", &error_abort); 17531cbf933SJean-Christophe Dubois 17631cbf933SJean-Christophe Dubois /* On uniprocessor, the CBAR is set to 0 */ 17731cbf933SJean-Christophe Dubois if (smp_cpus > 1) { 17831cbf933SJean-Christophe Dubois object_property_set_int(o, FSL_IMX6UL_A7MPCORE_ADDR, 17931cbf933SJean-Christophe Dubois "reset-cbar", &error_abort); 18031cbf933SJean-Christophe Dubois } 18131cbf933SJean-Christophe Dubois 18231cbf933SJean-Christophe Dubois if (i) { 18331cbf933SJean-Christophe Dubois /* Secondary CPUs start in PSCI powered-down state */ 18431cbf933SJean-Christophe Dubois object_property_set_bool(o, true, 18531cbf933SJean-Christophe Dubois "start-powered-off", &error_abort); 18631cbf933SJean-Christophe Dubois } 18731cbf933SJean-Christophe Dubois 18831cbf933SJean-Christophe Dubois object_property_set_bool(o, true, "realized", &error_abort); 18931cbf933SJean-Christophe Dubois } 19031cbf933SJean-Christophe Dubois 19131cbf933SJean-Christophe Dubois /* 19231cbf933SJean-Christophe Dubois * A7MPCORE 19331cbf933SJean-Christophe Dubois */ 19431cbf933SJean-Christophe Dubois object_property_set_int(OBJECT(&s->a7mpcore), smp_cpus, "num-cpu", 19531cbf933SJean-Christophe Dubois &error_abort); 19631cbf933SJean-Christophe Dubois object_property_set_int(OBJECT(&s->a7mpcore), 19731cbf933SJean-Christophe Dubois FSL_IMX6UL_MAX_IRQ + GIC_INTERNAL, 19831cbf933SJean-Christophe Dubois "num-irq", &error_abort); 19931cbf933SJean-Christophe Dubois object_property_set_bool(OBJECT(&s->a7mpcore), true, "realized", 20031cbf933SJean-Christophe Dubois &error_abort); 20131cbf933SJean-Christophe Dubois sysbus_mmio_map(SYS_BUS_DEVICE(&s->a7mpcore), 0, FSL_IMX6UL_A7MPCORE_ADDR); 20231cbf933SJean-Christophe Dubois 20331cbf933SJean-Christophe Dubois for (i = 0; i < smp_cpus; i++) { 20431cbf933SJean-Christophe Dubois SysBusDevice *sbd = SYS_BUS_DEVICE(&s->a7mpcore); 20531cbf933SJean-Christophe Dubois DeviceState *d = DEVICE(qemu_get_cpu(i)); 20631cbf933SJean-Christophe Dubois 20731cbf933SJean-Christophe Dubois irq = qdev_get_gpio_in(d, ARM_CPU_IRQ); 20831cbf933SJean-Christophe Dubois sysbus_connect_irq(sbd, i, irq); 20931cbf933SJean-Christophe Dubois sysbus_connect_irq(sbd, i + smp_cpus, qdev_get_gpio_in(d, ARM_CPU_FIQ)); 210256d3e21SPeter Maydell sysbus_connect_irq(sbd, i + 2 * smp_cpus, 211256d3e21SPeter Maydell qdev_get_gpio_in(d, ARM_CPU_VIRQ)); 212256d3e21SPeter Maydell sysbus_connect_irq(sbd, i + 3 * smp_cpus, 213256d3e21SPeter Maydell qdev_get_gpio_in(d, ARM_CPU_VFIQ)); 21431cbf933SJean-Christophe Dubois } 21531cbf933SJean-Christophe Dubois 21631cbf933SJean-Christophe Dubois /* 21731cbf933SJean-Christophe Dubois * A7MPCORE DAP 21831cbf933SJean-Christophe Dubois */ 21931cbf933SJean-Christophe Dubois create_unimplemented_device("a7mpcore-dap", FSL_IMX6UL_A7MPCORE_DAP_ADDR, 22031cbf933SJean-Christophe Dubois 0x100000); 22131cbf933SJean-Christophe Dubois 22231cbf933SJean-Christophe Dubois /* 22331cbf933SJean-Christophe Dubois * GPT 1, 2 22431cbf933SJean-Christophe Dubois */ 22531cbf933SJean-Christophe Dubois for (i = 0; i < FSL_IMX6UL_NUM_GPTS; i++) { 22631cbf933SJean-Christophe Dubois static const hwaddr FSL_IMX6UL_GPTn_ADDR[FSL_IMX6UL_NUM_GPTS] = { 22731cbf933SJean-Christophe Dubois FSL_IMX6UL_GPT1_ADDR, 22831cbf933SJean-Christophe Dubois FSL_IMX6UL_GPT2_ADDR, 22931cbf933SJean-Christophe Dubois }; 23031cbf933SJean-Christophe Dubois 23131cbf933SJean-Christophe Dubois static const int FSL_IMX6UL_GPTn_IRQ[FSL_IMX6UL_NUM_GPTS] = { 23231cbf933SJean-Christophe Dubois FSL_IMX6UL_GPT1_IRQ, 23331cbf933SJean-Christophe Dubois FSL_IMX6UL_GPT2_IRQ, 23431cbf933SJean-Christophe Dubois }; 23531cbf933SJean-Christophe Dubois 23631cbf933SJean-Christophe Dubois s->gpt[i].ccm = IMX_CCM(&s->ccm); 23731cbf933SJean-Christophe Dubois object_property_set_bool(OBJECT(&s->gpt[i]), true, "realized", 23831cbf933SJean-Christophe Dubois &error_abort); 23931cbf933SJean-Christophe Dubois 24031cbf933SJean-Christophe Dubois sysbus_mmio_map(SYS_BUS_DEVICE(&s->gpt[i]), 0, 24131cbf933SJean-Christophe Dubois FSL_IMX6UL_GPTn_ADDR[i]); 24231cbf933SJean-Christophe Dubois 24331cbf933SJean-Christophe Dubois sysbus_connect_irq(SYS_BUS_DEVICE(&s->gpt[i]), 0, 24431cbf933SJean-Christophe Dubois qdev_get_gpio_in(DEVICE(&s->a7mpcore), 24531cbf933SJean-Christophe Dubois FSL_IMX6UL_GPTn_IRQ[i])); 24631cbf933SJean-Christophe Dubois } 24731cbf933SJean-Christophe Dubois 24831cbf933SJean-Christophe Dubois /* 24931cbf933SJean-Christophe Dubois * EPIT 1, 2 25031cbf933SJean-Christophe Dubois */ 25131cbf933SJean-Christophe Dubois for (i = 0; i < FSL_IMX6UL_NUM_EPITS; i++) { 25231cbf933SJean-Christophe Dubois static const hwaddr FSL_IMX6UL_EPITn_ADDR[FSL_IMX6UL_NUM_EPITS] = { 25331cbf933SJean-Christophe Dubois FSL_IMX6UL_EPIT1_ADDR, 25431cbf933SJean-Christophe Dubois FSL_IMX6UL_EPIT2_ADDR, 25531cbf933SJean-Christophe Dubois }; 25631cbf933SJean-Christophe Dubois 25731cbf933SJean-Christophe Dubois static const int FSL_IMX6UL_EPITn_IRQ[FSL_IMX6UL_NUM_EPITS] = { 25831cbf933SJean-Christophe Dubois FSL_IMX6UL_EPIT1_IRQ, 25931cbf933SJean-Christophe Dubois FSL_IMX6UL_EPIT2_IRQ, 26031cbf933SJean-Christophe Dubois }; 26131cbf933SJean-Christophe Dubois 26231cbf933SJean-Christophe Dubois s->epit[i].ccm = IMX_CCM(&s->ccm); 26331cbf933SJean-Christophe Dubois object_property_set_bool(OBJECT(&s->epit[i]), true, "realized", 26431cbf933SJean-Christophe Dubois &error_abort); 26531cbf933SJean-Christophe Dubois 26631cbf933SJean-Christophe Dubois sysbus_mmio_map(SYS_BUS_DEVICE(&s->epit[i]), 0, 26731cbf933SJean-Christophe Dubois FSL_IMX6UL_EPITn_ADDR[i]); 26831cbf933SJean-Christophe Dubois 26931cbf933SJean-Christophe Dubois sysbus_connect_irq(SYS_BUS_DEVICE(&s->epit[i]), 0, 27031cbf933SJean-Christophe Dubois qdev_get_gpio_in(DEVICE(&s->a7mpcore), 27131cbf933SJean-Christophe Dubois FSL_IMX6UL_EPITn_IRQ[i])); 27231cbf933SJean-Christophe Dubois } 27331cbf933SJean-Christophe Dubois 27431cbf933SJean-Christophe Dubois /* 27531cbf933SJean-Christophe Dubois * GPIO 27631cbf933SJean-Christophe Dubois */ 27731cbf933SJean-Christophe Dubois for (i = 0; i < FSL_IMX6UL_NUM_GPIOS; i++) { 27831cbf933SJean-Christophe Dubois static const hwaddr FSL_IMX6UL_GPIOn_ADDR[FSL_IMX6UL_NUM_GPIOS] = { 27931cbf933SJean-Christophe Dubois FSL_IMX6UL_GPIO1_ADDR, 28031cbf933SJean-Christophe Dubois FSL_IMX6UL_GPIO2_ADDR, 28131cbf933SJean-Christophe Dubois FSL_IMX6UL_GPIO3_ADDR, 28231cbf933SJean-Christophe Dubois FSL_IMX6UL_GPIO4_ADDR, 28331cbf933SJean-Christophe Dubois FSL_IMX6UL_GPIO5_ADDR, 28431cbf933SJean-Christophe Dubois }; 28531cbf933SJean-Christophe Dubois 28631cbf933SJean-Christophe Dubois static const int FSL_IMX6UL_GPIOn_LOW_IRQ[FSL_IMX6UL_NUM_GPIOS] = { 28731cbf933SJean-Christophe Dubois FSL_IMX6UL_GPIO1_LOW_IRQ, 28831cbf933SJean-Christophe Dubois FSL_IMX6UL_GPIO2_LOW_IRQ, 28931cbf933SJean-Christophe Dubois FSL_IMX6UL_GPIO3_LOW_IRQ, 29031cbf933SJean-Christophe Dubois FSL_IMX6UL_GPIO4_LOW_IRQ, 29131cbf933SJean-Christophe Dubois FSL_IMX6UL_GPIO5_LOW_IRQ, 29231cbf933SJean-Christophe Dubois }; 29331cbf933SJean-Christophe Dubois 29431cbf933SJean-Christophe Dubois static const int FSL_IMX6UL_GPIOn_HIGH_IRQ[FSL_IMX6UL_NUM_GPIOS] = { 29531cbf933SJean-Christophe Dubois FSL_IMX6UL_GPIO1_HIGH_IRQ, 29631cbf933SJean-Christophe Dubois FSL_IMX6UL_GPIO2_HIGH_IRQ, 29731cbf933SJean-Christophe Dubois FSL_IMX6UL_GPIO3_HIGH_IRQ, 29831cbf933SJean-Christophe Dubois FSL_IMX6UL_GPIO4_HIGH_IRQ, 29931cbf933SJean-Christophe Dubois FSL_IMX6UL_GPIO5_HIGH_IRQ, 30031cbf933SJean-Christophe Dubois }; 30131cbf933SJean-Christophe Dubois 30231cbf933SJean-Christophe Dubois object_property_set_bool(OBJECT(&s->gpio[i]), true, "realized", 30331cbf933SJean-Christophe Dubois &error_abort); 30431cbf933SJean-Christophe Dubois 30531cbf933SJean-Christophe Dubois sysbus_mmio_map(SYS_BUS_DEVICE(&s->gpio[i]), 0, 30631cbf933SJean-Christophe Dubois FSL_IMX6UL_GPIOn_ADDR[i]); 30731cbf933SJean-Christophe Dubois 30831cbf933SJean-Christophe Dubois sysbus_connect_irq(SYS_BUS_DEVICE(&s->gpio[i]), 0, 30931cbf933SJean-Christophe Dubois qdev_get_gpio_in(DEVICE(&s->a7mpcore), 31031cbf933SJean-Christophe Dubois FSL_IMX6UL_GPIOn_LOW_IRQ[i])); 31131cbf933SJean-Christophe Dubois 31231cbf933SJean-Christophe Dubois sysbus_connect_irq(SYS_BUS_DEVICE(&s->gpio[i]), 1, 31331cbf933SJean-Christophe Dubois qdev_get_gpio_in(DEVICE(&s->a7mpcore), 31431cbf933SJean-Christophe Dubois FSL_IMX6UL_GPIOn_HIGH_IRQ[i])); 31531cbf933SJean-Christophe Dubois } 31631cbf933SJean-Christophe Dubois 31731cbf933SJean-Christophe Dubois /* 31831cbf933SJean-Christophe Dubois * IOMUXC and IOMUXC_GPR 31931cbf933SJean-Christophe Dubois */ 32031cbf933SJean-Christophe Dubois for (i = 0; i < 1; i++) { 32131cbf933SJean-Christophe Dubois static const hwaddr FSL_IMX6UL_IOMUXCn_ADDR[FSL_IMX6UL_NUM_IOMUXCS] = { 32231cbf933SJean-Christophe Dubois FSL_IMX6UL_IOMUXC_ADDR, 32331cbf933SJean-Christophe Dubois FSL_IMX6UL_IOMUXC_GPR_ADDR, 32431cbf933SJean-Christophe Dubois }; 32531cbf933SJean-Christophe Dubois 32631cbf933SJean-Christophe Dubois snprintf(name, NAME_SIZE, "iomuxc%d", i); 32731cbf933SJean-Christophe Dubois create_unimplemented_device(name, FSL_IMX6UL_IOMUXCn_ADDR[i], 0x4000); 32831cbf933SJean-Christophe Dubois } 32931cbf933SJean-Christophe Dubois 33031cbf933SJean-Christophe Dubois /* 33131cbf933SJean-Christophe Dubois * CCM 33231cbf933SJean-Christophe Dubois */ 33331cbf933SJean-Christophe Dubois object_property_set_bool(OBJECT(&s->ccm), true, "realized", &error_abort); 33431cbf933SJean-Christophe Dubois sysbus_mmio_map(SYS_BUS_DEVICE(&s->ccm), 0, FSL_IMX6UL_CCM_ADDR); 33531cbf933SJean-Christophe Dubois 33631cbf933SJean-Christophe Dubois /* 33731cbf933SJean-Christophe Dubois * SRC 33831cbf933SJean-Christophe Dubois */ 33931cbf933SJean-Christophe Dubois object_property_set_bool(OBJECT(&s->src), true, "realized", &error_abort); 34031cbf933SJean-Christophe Dubois sysbus_mmio_map(SYS_BUS_DEVICE(&s->src), 0, FSL_IMX6UL_SRC_ADDR); 34131cbf933SJean-Christophe Dubois 34231cbf933SJean-Christophe Dubois /* 34331cbf933SJean-Christophe Dubois * GPCv2 34431cbf933SJean-Christophe Dubois */ 34531cbf933SJean-Christophe Dubois object_property_set_bool(OBJECT(&s->gpcv2), true, 34631cbf933SJean-Christophe Dubois "realized", &error_abort); 34731cbf933SJean-Christophe Dubois sysbus_mmio_map(SYS_BUS_DEVICE(&s->gpcv2), 0, FSL_IMX6UL_GPC_ADDR); 34831cbf933SJean-Christophe Dubois 34931cbf933SJean-Christophe Dubois /* Initialize all ECSPI */ 35031cbf933SJean-Christophe Dubois for (i = 0; i < FSL_IMX6UL_NUM_ECSPIS; i++) { 35131cbf933SJean-Christophe Dubois static const hwaddr FSL_IMX6UL_SPIn_ADDR[FSL_IMX6UL_NUM_ECSPIS] = { 35231cbf933SJean-Christophe Dubois FSL_IMX6UL_ECSPI1_ADDR, 35331cbf933SJean-Christophe Dubois FSL_IMX6UL_ECSPI2_ADDR, 35431cbf933SJean-Christophe Dubois FSL_IMX6UL_ECSPI3_ADDR, 35531cbf933SJean-Christophe Dubois FSL_IMX6UL_ECSPI4_ADDR, 35631cbf933SJean-Christophe Dubois }; 35731cbf933SJean-Christophe Dubois 35831cbf933SJean-Christophe Dubois static const int FSL_IMX6UL_SPIn_IRQ[FSL_IMX6UL_NUM_ECSPIS] = { 35931cbf933SJean-Christophe Dubois FSL_IMX6UL_ECSPI1_IRQ, 36031cbf933SJean-Christophe Dubois FSL_IMX6UL_ECSPI2_IRQ, 36131cbf933SJean-Christophe Dubois FSL_IMX6UL_ECSPI3_IRQ, 36231cbf933SJean-Christophe Dubois FSL_IMX6UL_ECSPI4_IRQ, 36331cbf933SJean-Christophe Dubois }; 36431cbf933SJean-Christophe Dubois 36531cbf933SJean-Christophe Dubois /* Initialize the SPI */ 36631cbf933SJean-Christophe Dubois object_property_set_bool(OBJECT(&s->spi[i]), true, "realized", 36731cbf933SJean-Christophe Dubois &error_abort); 36831cbf933SJean-Christophe Dubois 36931cbf933SJean-Christophe Dubois sysbus_mmio_map(SYS_BUS_DEVICE(&s->spi[i]), 0, 37031cbf933SJean-Christophe Dubois FSL_IMX6UL_SPIn_ADDR[i]); 37131cbf933SJean-Christophe Dubois 37231cbf933SJean-Christophe Dubois sysbus_connect_irq(SYS_BUS_DEVICE(&s->spi[i]), 0, 37331cbf933SJean-Christophe Dubois qdev_get_gpio_in(DEVICE(&s->a7mpcore), 37431cbf933SJean-Christophe Dubois FSL_IMX6UL_SPIn_IRQ[i])); 37531cbf933SJean-Christophe Dubois } 37631cbf933SJean-Christophe Dubois 37731cbf933SJean-Christophe Dubois /* 37831cbf933SJean-Christophe Dubois * I2C 37931cbf933SJean-Christophe Dubois */ 38031cbf933SJean-Christophe Dubois for (i = 0; i < FSL_IMX6UL_NUM_I2CS; i++) { 38131cbf933SJean-Christophe Dubois static const hwaddr FSL_IMX6UL_I2Cn_ADDR[FSL_IMX6UL_NUM_I2CS] = { 38231cbf933SJean-Christophe Dubois FSL_IMX6UL_I2C1_ADDR, 38331cbf933SJean-Christophe Dubois FSL_IMX6UL_I2C2_ADDR, 38431cbf933SJean-Christophe Dubois FSL_IMX6UL_I2C3_ADDR, 38531cbf933SJean-Christophe Dubois FSL_IMX6UL_I2C4_ADDR, 38631cbf933SJean-Christophe Dubois }; 38731cbf933SJean-Christophe Dubois 38831cbf933SJean-Christophe Dubois static const int FSL_IMX6UL_I2Cn_IRQ[FSL_IMX6UL_NUM_I2CS] = { 38931cbf933SJean-Christophe Dubois FSL_IMX6UL_I2C1_IRQ, 39031cbf933SJean-Christophe Dubois FSL_IMX6UL_I2C2_IRQ, 39131cbf933SJean-Christophe Dubois FSL_IMX6UL_I2C3_IRQ, 39231cbf933SJean-Christophe Dubois FSL_IMX6UL_I2C4_IRQ, 39331cbf933SJean-Christophe Dubois }; 39431cbf933SJean-Christophe Dubois 39531cbf933SJean-Christophe Dubois object_property_set_bool(OBJECT(&s->i2c[i]), true, "realized", 39631cbf933SJean-Christophe Dubois &error_abort); 39731cbf933SJean-Christophe Dubois sysbus_mmio_map(SYS_BUS_DEVICE(&s->i2c[i]), 0, FSL_IMX6UL_I2Cn_ADDR[i]); 39831cbf933SJean-Christophe Dubois 39931cbf933SJean-Christophe Dubois sysbus_connect_irq(SYS_BUS_DEVICE(&s->i2c[i]), 0, 40031cbf933SJean-Christophe Dubois qdev_get_gpio_in(DEVICE(&s->a7mpcore), 40131cbf933SJean-Christophe Dubois FSL_IMX6UL_I2Cn_IRQ[i])); 40231cbf933SJean-Christophe Dubois } 40331cbf933SJean-Christophe Dubois 40431cbf933SJean-Christophe Dubois /* 40531cbf933SJean-Christophe Dubois * UART 40631cbf933SJean-Christophe Dubois */ 40731cbf933SJean-Christophe Dubois for (i = 0; i < FSL_IMX6UL_NUM_UARTS; i++) { 40831cbf933SJean-Christophe Dubois static const hwaddr FSL_IMX6UL_UARTn_ADDR[FSL_IMX6UL_NUM_UARTS] = { 40931cbf933SJean-Christophe Dubois FSL_IMX6UL_UART1_ADDR, 41031cbf933SJean-Christophe Dubois FSL_IMX6UL_UART2_ADDR, 41131cbf933SJean-Christophe Dubois FSL_IMX6UL_UART3_ADDR, 41231cbf933SJean-Christophe Dubois FSL_IMX6UL_UART4_ADDR, 41331cbf933SJean-Christophe Dubois FSL_IMX6UL_UART5_ADDR, 41431cbf933SJean-Christophe Dubois FSL_IMX6UL_UART6_ADDR, 41531cbf933SJean-Christophe Dubois FSL_IMX6UL_UART7_ADDR, 41631cbf933SJean-Christophe Dubois FSL_IMX6UL_UART8_ADDR, 41731cbf933SJean-Christophe Dubois }; 41831cbf933SJean-Christophe Dubois 41931cbf933SJean-Christophe Dubois static const int FSL_IMX6UL_UARTn_IRQ[FSL_IMX6UL_NUM_UARTS] = { 42031cbf933SJean-Christophe Dubois FSL_IMX6UL_UART1_IRQ, 42131cbf933SJean-Christophe Dubois FSL_IMX6UL_UART2_IRQ, 42231cbf933SJean-Christophe Dubois FSL_IMX6UL_UART3_IRQ, 42331cbf933SJean-Christophe Dubois FSL_IMX6UL_UART4_IRQ, 42431cbf933SJean-Christophe Dubois FSL_IMX6UL_UART5_IRQ, 42531cbf933SJean-Christophe Dubois FSL_IMX6UL_UART6_IRQ, 42631cbf933SJean-Christophe Dubois FSL_IMX6UL_UART7_IRQ, 42731cbf933SJean-Christophe Dubois FSL_IMX6UL_UART8_IRQ, 42831cbf933SJean-Christophe Dubois }; 42931cbf933SJean-Christophe Dubois 43031cbf933SJean-Christophe Dubois qdev_prop_set_chr(DEVICE(&s->uart[i]), "chardev", serial_hd(i)); 43131cbf933SJean-Christophe Dubois 43231cbf933SJean-Christophe Dubois object_property_set_bool(OBJECT(&s->uart[i]), true, "realized", 43331cbf933SJean-Christophe Dubois &error_abort); 43431cbf933SJean-Christophe Dubois 43531cbf933SJean-Christophe Dubois sysbus_mmio_map(SYS_BUS_DEVICE(&s->uart[i]), 0, 43631cbf933SJean-Christophe Dubois FSL_IMX6UL_UARTn_ADDR[i]); 43731cbf933SJean-Christophe Dubois 43831cbf933SJean-Christophe Dubois sysbus_connect_irq(SYS_BUS_DEVICE(&s->uart[i]), 0, 43931cbf933SJean-Christophe Dubois qdev_get_gpio_in(DEVICE(&s->a7mpcore), 44031cbf933SJean-Christophe Dubois FSL_IMX6UL_UARTn_IRQ[i])); 44131cbf933SJean-Christophe Dubois } 44231cbf933SJean-Christophe Dubois 44331cbf933SJean-Christophe Dubois /* 44431cbf933SJean-Christophe Dubois * Ethernet 44531cbf933SJean-Christophe Dubois */ 44631cbf933SJean-Christophe Dubois for (i = 0; i < FSL_IMX6UL_NUM_ETHS; i++) { 44731cbf933SJean-Christophe Dubois static const hwaddr FSL_IMX6UL_ENETn_ADDR[FSL_IMX6UL_NUM_ETHS] = { 44831cbf933SJean-Christophe Dubois FSL_IMX6UL_ENET1_ADDR, 44931cbf933SJean-Christophe Dubois FSL_IMX6UL_ENET2_ADDR, 45031cbf933SJean-Christophe Dubois }; 45131cbf933SJean-Christophe Dubois 45231cbf933SJean-Christophe Dubois static const int FSL_IMX6UL_ENETn_IRQ[FSL_IMX6UL_NUM_ETHS] = { 45331cbf933SJean-Christophe Dubois FSL_IMX6UL_ENET1_IRQ, 45431cbf933SJean-Christophe Dubois FSL_IMX6UL_ENET2_IRQ, 45531cbf933SJean-Christophe Dubois }; 45631cbf933SJean-Christophe Dubois 45731cbf933SJean-Christophe Dubois static const int FSL_IMX6UL_ENETn_TIMER_IRQ[FSL_IMX6UL_NUM_ETHS] = { 45831cbf933SJean-Christophe Dubois FSL_IMX6UL_ENET1_TIMER_IRQ, 45931cbf933SJean-Christophe Dubois FSL_IMX6UL_ENET2_TIMER_IRQ, 46031cbf933SJean-Christophe Dubois }; 46131cbf933SJean-Christophe Dubois 46231cbf933SJean-Christophe Dubois object_property_set_uint(OBJECT(&s->eth[i]), 46331cbf933SJean-Christophe Dubois FSL_IMX6UL_ETH_NUM_TX_RINGS, 46431cbf933SJean-Christophe Dubois "tx-ring-num", &error_abort); 46531cbf933SJean-Christophe Dubois qdev_set_nic_properties(DEVICE(&s->eth[i]), &nd_table[i]); 46631cbf933SJean-Christophe Dubois object_property_set_bool(OBJECT(&s->eth[i]), true, "realized", 46731cbf933SJean-Christophe Dubois &error_abort); 46831cbf933SJean-Christophe Dubois 46931cbf933SJean-Christophe Dubois sysbus_mmio_map(SYS_BUS_DEVICE(&s->eth[i]), 0, 47031cbf933SJean-Christophe Dubois FSL_IMX6UL_ENETn_ADDR[i]); 47131cbf933SJean-Christophe Dubois 47231cbf933SJean-Christophe Dubois sysbus_connect_irq(SYS_BUS_DEVICE(&s->eth[i]), 0, 47331cbf933SJean-Christophe Dubois qdev_get_gpio_in(DEVICE(&s->a7mpcore), 47431cbf933SJean-Christophe Dubois FSL_IMX6UL_ENETn_IRQ[i])); 47531cbf933SJean-Christophe Dubois 47631cbf933SJean-Christophe Dubois sysbus_connect_irq(SYS_BUS_DEVICE(&s->eth[i]), 1, 47731cbf933SJean-Christophe Dubois qdev_get_gpio_in(DEVICE(&s->a7mpcore), 47831cbf933SJean-Christophe Dubois FSL_IMX6UL_ENETn_TIMER_IRQ[i])); 47931cbf933SJean-Christophe Dubois } 48031cbf933SJean-Christophe Dubois 48131cbf933SJean-Christophe Dubois /* 48231cbf933SJean-Christophe Dubois * USDHC 48331cbf933SJean-Christophe Dubois */ 48431cbf933SJean-Christophe Dubois for (i = 0; i < FSL_IMX6UL_NUM_USDHCS; i++) { 48531cbf933SJean-Christophe Dubois static const hwaddr FSL_IMX6UL_USDHCn_ADDR[FSL_IMX6UL_NUM_USDHCS] = { 48631cbf933SJean-Christophe Dubois FSL_IMX6UL_USDHC1_ADDR, 48731cbf933SJean-Christophe Dubois FSL_IMX6UL_USDHC2_ADDR, 48831cbf933SJean-Christophe Dubois }; 48931cbf933SJean-Christophe Dubois 49031cbf933SJean-Christophe Dubois static const int FSL_IMX6UL_USDHCn_IRQ[FSL_IMX6UL_NUM_USDHCS] = { 49131cbf933SJean-Christophe Dubois FSL_IMX6UL_USDHC1_IRQ, 49231cbf933SJean-Christophe Dubois FSL_IMX6UL_USDHC2_IRQ, 49331cbf933SJean-Christophe Dubois }; 49431cbf933SJean-Christophe Dubois 49531cbf933SJean-Christophe Dubois object_property_set_bool(OBJECT(&s->usdhc[i]), true, "realized", 49631cbf933SJean-Christophe Dubois &error_abort); 49731cbf933SJean-Christophe Dubois 49831cbf933SJean-Christophe Dubois sysbus_mmio_map(SYS_BUS_DEVICE(&s->usdhc[i]), 0, 49931cbf933SJean-Christophe Dubois FSL_IMX6UL_USDHCn_ADDR[i]); 50031cbf933SJean-Christophe Dubois 50131cbf933SJean-Christophe Dubois sysbus_connect_irq(SYS_BUS_DEVICE(&s->usdhc[i]), 0, 50231cbf933SJean-Christophe Dubois qdev_get_gpio_in(DEVICE(&s->a7mpcore), 50331cbf933SJean-Christophe Dubois FSL_IMX6UL_USDHCn_IRQ[i])); 50431cbf933SJean-Christophe Dubois } 50531cbf933SJean-Christophe Dubois 50631cbf933SJean-Christophe Dubois /* 50731cbf933SJean-Christophe Dubois * SNVS 50831cbf933SJean-Christophe Dubois */ 50931cbf933SJean-Christophe Dubois object_property_set_bool(OBJECT(&s->snvs), true, "realized", &error_abort); 51031cbf933SJean-Christophe Dubois sysbus_mmio_map(SYS_BUS_DEVICE(&s->snvs), 0, FSL_IMX6UL_SNVS_HP_ADDR); 51131cbf933SJean-Christophe Dubois 51231cbf933SJean-Christophe Dubois /* 51331cbf933SJean-Christophe Dubois * Watchdog 51431cbf933SJean-Christophe Dubois */ 51531cbf933SJean-Christophe Dubois for (i = 0; i < FSL_IMX6UL_NUM_WDTS; i++) { 51631cbf933SJean-Christophe Dubois static const hwaddr FSL_IMX6UL_WDOGn_ADDR[FSL_IMX6UL_NUM_WDTS] = { 51731cbf933SJean-Christophe Dubois FSL_IMX6UL_WDOG1_ADDR, 51831cbf933SJean-Christophe Dubois FSL_IMX6UL_WDOG2_ADDR, 51931cbf933SJean-Christophe Dubois FSL_IMX6UL_WDOG3_ADDR, 52031cbf933SJean-Christophe Dubois }; 52131cbf933SJean-Christophe Dubois 52231cbf933SJean-Christophe Dubois object_property_set_bool(OBJECT(&s->wdt[i]), true, "realized", 52331cbf933SJean-Christophe Dubois &error_abort); 52431cbf933SJean-Christophe Dubois 52531cbf933SJean-Christophe Dubois sysbus_mmio_map(SYS_BUS_DEVICE(&s->wdt[i]), 0, 52631cbf933SJean-Christophe Dubois FSL_IMX6UL_WDOGn_ADDR[i]); 52731cbf933SJean-Christophe Dubois } 52831cbf933SJean-Christophe Dubois 52931cbf933SJean-Christophe Dubois /* 53031cbf933SJean-Christophe Dubois * GPR 53131cbf933SJean-Christophe Dubois */ 53231cbf933SJean-Christophe Dubois object_property_set_bool(OBJECT(&s->gpr), true, "realized", 53331cbf933SJean-Christophe Dubois &error_abort); 53431cbf933SJean-Christophe Dubois sysbus_mmio_map(SYS_BUS_DEVICE(&s->gpr), 0, FSL_IMX6UL_IOMUXC_GPR_ADDR); 53531cbf933SJean-Christophe Dubois 53631cbf933SJean-Christophe Dubois /* 53731cbf933SJean-Christophe Dubois * SDMA 53831cbf933SJean-Christophe Dubois */ 53931cbf933SJean-Christophe Dubois create_unimplemented_device("sdma", FSL_IMX6UL_SDMA_ADDR, 0x4000); 54031cbf933SJean-Christophe Dubois 54131cbf933SJean-Christophe Dubois /* 54231cbf933SJean-Christophe Dubois * APHB_DMA 54331cbf933SJean-Christophe Dubois */ 54431cbf933SJean-Christophe Dubois create_unimplemented_device("aphb_dma", FSL_IMX6UL_APBH_DMA_ADDR, 54531cbf933SJean-Christophe Dubois FSL_IMX6UL_APBH_DMA_SIZE); 54631cbf933SJean-Christophe Dubois 54731cbf933SJean-Christophe Dubois /* 54831cbf933SJean-Christophe Dubois * ADCs 54931cbf933SJean-Christophe Dubois */ 55031cbf933SJean-Christophe Dubois for (i = 0; i < FSL_IMX6UL_NUM_ADCS; i++) { 55131cbf933SJean-Christophe Dubois static const hwaddr FSL_IMX6UL_ADCn_ADDR[FSL_IMX6UL_NUM_ADCS] = { 55231cbf933SJean-Christophe Dubois FSL_IMX6UL_ADC1_ADDR, 55331cbf933SJean-Christophe Dubois FSL_IMX6UL_ADC2_ADDR, 55431cbf933SJean-Christophe Dubois }; 55531cbf933SJean-Christophe Dubois 55631cbf933SJean-Christophe Dubois snprintf(name, NAME_SIZE, "adc%d", i); 55731cbf933SJean-Christophe Dubois create_unimplemented_device(name, FSL_IMX6UL_ADCn_ADDR[i], 0x4000); 55831cbf933SJean-Christophe Dubois } 55931cbf933SJean-Christophe Dubois 56031cbf933SJean-Christophe Dubois /* 56131cbf933SJean-Christophe Dubois * LCD 56231cbf933SJean-Christophe Dubois */ 56331cbf933SJean-Christophe Dubois create_unimplemented_device("lcdif", FSL_IMX6UL_LCDIF_ADDR, 0x4000); 56431cbf933SJean-Christophe Dubois 56531cbf933SJean-Christophe Dubois /* 56631cbf933SJean-Christophe Dubois * ROM memory 56731cbf933SJean-Christophe Dubois */ 56831cbf933SJean-Christophe Dubois memory_region_init_rom(&s->rom, NULL, "imx6ul.rom", 56931cbf933SJean-Christophe Dubois FSL_IMX6UL_ROM_SIZE, &error_abort); 57031cbf933SJean-Christophe Dubois memory_region_add_subregion(get_system_memory(), FSL_IMX6UL_ROM_ADDR, 57131cbf933SJean-Christophe Dubois &s->rom); 57231cbf933SJean-Christophe Dubois 57331cbf933SJean-Christophe Dubois /* 57431cbf933SJean-Christophe Dubois * CAAM memory 57531cbf933SJean-Christophe Dubois */ 57631cbf933SJean-Christophe Dubois memory_region_init_rom(&s->caam, NULL, "imx6ul.caam", 57731cbf933SJean-Christophe Dubois FSL_IMX6UL_CAAM_MEM_SIZE, &error_abort); 57831cbf933SJean-Christophe Dubois memory_region_add_subregion(get_system_memory(), FSL_IMX6UL_CAAM_MEM_ADDR, 57931cbf933SJean-Christophe Dubois &s->caam); 58031cbf933SJean-Christophe Dubois 58131cbf933SJean-Christophe Dubois /* 58231cbf933SJean-Christophe Dubois * OCRAM memory 58331cbf933SJean-Christophe Dubois */ 58431cbf933SJean-Christophe Dubois memory_region_init_ram(&s->ocram, NULL, "imx6ul.ocram", 58531cbf933SJean-Christophe Dubois FSL_IMX6UL_OCRAM_MEM_SIZE, 58631cbf933SJean-Christophe Dubois &error_abort); 58731cbf933SJean-Christophe Dubois memory_region_add_subregion(get_system_memory(), FSL_IMX6UL_OCRAM_MEM_ADDR, 58831cbf933SJean-Christophe Dubois &s->ocram); 58931cbf933SJean-Christophe Dubois 59031cbf933SJean-Christophe Dubois /* 59131cbf933SJean-Christophe Dubois * internal OCRAM (128 KB) is aliased over 512 KB 59231cbf933SJean-Christophe Dubois */ 59331cbf933SJean-Christophe Dubois memory_region_init_alias(&s->ocram_alias, NULL, "imx6ul.ocram_alias", 59431cbf933SJean-Christophe Dubois &s->ocram, 0, FSL_IMX6UL_OCRAM_ALIAS_SIZE); 59531cbf933SJean-Christophe Dubois memory_region_add_subregion(get_system_memory(), 59631cbf933SJean-Christophe Dubois FSL_IMX6UL_OCRAM_ALIAS_ADDR, &s->ocram_alias); 59731cbf933SJean-Christophe Dubois } 59831cbf933SJean-Christophe Dubois 59931cbf933SJean-Christophe Dubois static void fsl_imx6ul_class_init(ObjectClass *oc, void *data) 60031cbf933SJean-Christophe Dubois { 60131cbf933SJean-Christophe Dubois DeviceClass *dc = DEVICE_CLASS(oc); 60231cbf933SJean-Christophe Dubois 60331cbf933SJean-Christophe Dubois dc->realize = fsl_imx6ul_realize; 60431cbf933SJean-Christophe Dubois dc->desc = "i.MX6UL SOC"; 60531cbf933SJean-Christophe Dubois /* Reason: Uses serial_hds and nd_table in realize() directly */ 60631cbf933SJean-Christophe Dubois dc->user_creatable = false; 60731cbf933SJean-Christophe Dubois } 60831cbf933SJean-Christophe Dubois 60931cbf933SJean-Christophe Dubois static const TypeInfo fsl_imx6ul_type_info = { 61031cbf933SJean-Christophe Dubois .name = TYPE_FSL_IMX6UL, 61131cbf933SJean-Christophe Dubois .parent = TYPE_DEVICE, 61231cbf933SJean-Christophe Dubois .instance_size = sizeof(FslIMX6ULState), 61331cbf933SJean-Christophe Dubois .instance_init = fsl_imx6ul_init, 61431cbf933SJean-Christophe Dubois .class_init = fsl_imx6ul_class_init, 61531cbf933SJean-Christophe Dubois }; 61631cbf933SJean-Christophe Dubois 61731cbf933SJean-Christophe Dubois static void fsl_imx6ul_register_types(void) 61831cbf933SJean-Christophe Dubois { 61931cbf933SJean-Christophe Dubois type_register_static(&fsl_imx6ul_type_info); 62031cbf933SJean-Christophe Dubois } 62131cbf933SJean-Christophe Dubois type_init(fsl_imx6ul_register_types) 622