xref: /qemu/hw/arm/fsl-imx6ul.c (revision ff31cca71ef257f8da2d9bc647ddd53f080ce580)
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"
2317372bd8SGuenter Roeck #include "hw/usb/imx-usb-phy.h"
24cc7d44c2SLike Xu #include "hw/boards.h"
2531cbf933SJean-Christophe Dubois #include "sysemu/sysemu.h"
2631cbf933SJean-Christophe Dubois #include "qemu/error-report.h"
270b8fa32fSMarkus Armbruster #include "qemu/module.h"
2831cbf933SJean-Christophe Dubois 
2931cbf933SJean-Christophe Dubois #define NAME_SIZE 20
3031cbf933SJean-Christophe Dubois 
3131cbf933SJean-Christophe Dubois static void fsl_imx6ul_init(Object *obj)
3231cbf933SJean-Christophe Dubois {
3331cbf933SJean-Christophe Dubois     FslIMX6ULState *s = FSL_IMX6UL(obj);
3431cbf933SJean-Christophe Dubois     char name[NAME_SIZE];
3531cbf933SJean-Christophe Dubois     int i;
3631cbf933SJean-Christophe Dubois 
379fc7fc4dSMarkus Armbruster     object_initialize_child(obj, "cpu0", &s->cpu,
389fc7fc4dSMarkus Armbruster                             ARM_CPU_TYPE_NAME("cortex-a7"));
3931cbf933SJean-Christophe Dubois 
4031cbf933SJean-Christophe Dubois     /*
4131cbf933SJean-Christophe Dubois      * A7MPCORE
4231cbf933SJean-Christophe Dubois      */
43db873cc5SMarkus Armbruster     object_initialize_child(obj, "a7mpcore", &s->a7mpcore,
4431cbf933SJean-Christophe Dubois                             TYPE_A15MPCORE_PRIV);
4531cbf933SJean-Christophe Dubois 
4631cbf933SJean-Christophe Dubois     /*
4731cbf933SJean-Christophe Dubois      * CCM
4831cbf933SJean-Christophe Dubois      */
49db873cc5SMarkus Armbruster     object_initialize_child(obj, "ccm", &s->ccm, TYPE_IMX6UL_CCM);
5031cbf933SJean-Christophe Dubois 
5131cbf933SJean-Christophe Dubois     /*
5231cbf933SJean-Christophe Dubois      * SRC
5331cbf933SJean-Christophe Dubois      */
54db873cc5SMarkus Armbruster     object_initialize_child(obj, "src", &s->src, TYPE_IMX6_SRC);
5531cbf933SJean-Christophe Dubois 
5631cbf933SJean-Christophe Dubois     /*
5731cbf933SJean-Christophe Dubois      * GPCv2
5831cbf933SJean-Christophe Dubois      */
59db873cc5SMarkus Armbruster     object_initialize_child(obj, "gpcv2", &s->gpcv2, TYPE_IMX_GPCV2);
6031cbf933SJean-Christophe Dubois 
6131cbf933SJean-Christophe Dubois     /*
6231cbf933SJean-Christophe Dubois      * SNVS
6331cbf933SJean-Christophe Dubois      */
64db873cc5SMarkus Armbruster     object_initialize_child(obj, "snvs", &s->snvs, TYPE_IMX7_SNVS);
6531cbf933SJean-Christophe Dubois 
6631cbf933SJean-Christophe Dubois     /*
6731cbf933SJean-Christophe Dubois      * GPR
6831cbf933SJean-Christophe Dubois      */
69db873cc5SMarkus Armbruster     object_initialize_child(obj, "gpr", &s->gpr, TYPE_IMX7_GPR);
7031cbf933SJean-Christophe Dubois 
7131cbf933SJean-Christophe Dubois     /*
7231cbf933SJean-Christophe Dubois      * GPIOs 1 to 5
7331cbf933SJean-Christophe Dubois      */
7431cbf933SJean-Christophe Dubois     for (i = 0; i < FSL_IMX6UL_NUM_GPIOS; i++) {
7531cbf933SJean-Christophe Dubois         snprintf(name, NAME_SIZE, "gpio%d", i);
76db873cc5SMarkus Armbruster         object_initialize_child(obj, name, &s->gpio[i], TYPE_IMX_GPIO);
7731cbf933SJean-Christophe Dubois     }
7831cbf933SJean-Christophe Dubois 
7931cbf933SJean-Christophe Dubois     /*
8031cbf933SJean-Christophe Dubois      * GPT 1, 2
8131cbf933SJean-Christophe Dubois      */
8231cbf933SJean-Christophe Dubois     for (i = 0; i < FSL_IMX6UL_NUM_GPTS; i++) {
8331cbf933SJean-Christophe Dubois         snprintf(name, NAME_SIZE, "gpt%d", i);
84db873cc5SMarkus Armbruster         object_initialize_child(obj, name, &s->gpt[i], TYPE_IMX7_GPT);
8531cbf933SJean-Christophe Dubois     }
8631cbf933SJean-Christophe Dubois 
8731cbf933SJean-Christophe Dubois     /*
8831cbf933SJean-Christophe Dubois      * EPIT 1, 2
8931cbf933SJean-Christophe Dubois      */
9031cbf933SJean-Christophe Dubois     for (i = 0; i < FSL_IMX6UL_NUM_EPITS; i++) {
9131cbf933SJean-Christophe Dubois         snprintf(name, NAME_SIZE, "epit%d", i + 1);
92db873cc5SMarkus Armbruster         object_initialize_child(obj, name, &s->epit[i], TYPE_IMX_EPIT);
9331cbf933SJean-Christophe Dubois     }
9431cbf933SJean-Christophe Dubois 
9531cbf933SJean-Christophe Dubois     /*
9631cbf933SJean-Christophe Dubois      * eCSPI
9731cbf933SJean-Christophe Dubois      */
9831cbf933SJean-Christophe Dubois     for (i = 0; i < FSL_IMX6UL_NUM_ECSPIS; i++) {
9931cbf933SJean-Christophe Dubois         snprintf(name, NAME_SIZE, "spi%d", i + 1);
100db873cc5SMarkus Armbruster         object_initialize_child(obj, name, &s->spi[i], TYPE_IMX_SPI);
10131cbf933SJean-Christophe Dubois     }
10231cbf933SJean-Christophe Dubois 
10331cbf933SJean-Christophe Dubois     /*
10431cbf933SJean-Christophe Dubois      * I2C
10531cbf933SJean-Christophe Dubois      */
10631cbf933SJean-Christophe Dubois     for (i = 0; i < FSL_IMX6UL_NUM_I2CS; i++) {
10731cbf933SJean-Christophe Dubois         snprintf(name, NAME_SIZE, "i2c%d", i + 1);
108db873cc5SMarkus Armbruster         object_initialize_child(obj, name, &s->i2c[i], TYPE_IMX_I2C);
10931cbf933SJean-Christophe Dubois     }
11031cbf933SJean-Christophe Dubois 
11131cbf933SJean-Christophe Dubois     /*
11231cbf933SJean-Christophe Dubois      * UART
11331cbf933SJean-Christophe Dubois      */
11431cbf933SJean-Christophe Dubois     for (i = 0; i < FSL_IMX6UL_NUM_UARTS; i++) {
11531cbf933SJean-Christophe Dubois         snprintf(name, NAME_SIZE, "uart%d", i);
116db873cc5SMarkus Armbruster         object_initialize_child(obj, name, &s->uart[i], TYPE_IMX_SERIAL);
11731cbf933SJean-Christophe Dubois     }
11831cbf933SJean-Christophe Dubois 
11931cbf933SJean-Christophe Dubois     /*
12031cbf933SJean-Christophe Dubois      * Ethernet
12131cbf933SJean-Christophe Dubois      */
12231cbf933SJean-Christophe Dubois     for (i = 0; i < FSL_IMX6UL_NUM_ETHS; i++) {
12331cbf933SJean-Christophe Dubois         snprintf(name, NAME_SIZE, "eth%d", i);
124db873cc5SMarkus Armbruster         object_initialize_child(obj, name, &s->eth[i], TYPE_IMX_ENET);
12531cbf933SJean-Christophe Dubois     }
12631cbf933SJean-Christophe Dubois 
12717372bd8SGuenter Roeck     /* USB */
12817372bd8SGuenter Roeck     for (i = 0; i < FSL_IMX6UL_NUM_USB_PHYS; i++) {
12917372bd8SGuenter Roeck         snprintf(name, NAME_SIZE, "usbphy%d", i);
130db873cc5SMarkus Armbruster         object_initialize_child(obj, name, &s->usbphy[i], TYPE_IMX_USBPHY);
13117372bd8SGuenter Roeck     }
13217372bd8SGuenter Roeck     for (i = 0; i < FSL_IMX6UL_NUM_USBS; i++) {
13317372bd8SGuenter Roeck         snprintf(name, NAME_SIZE, "usb%d", i);
134db873cc5SMarkus Armbruster         object_initialize_child(obj, name, &s->usb[i], TYPE_CHIPIDEA);
13517372bd8SGuenter Roeck     }
13617372bd8SGuenter Roeck 
13731cbf933SJean-Christophe Dubois     /*
13831cbf933SJean-Christophe Dubois      * SDHCI
13931cbf933SJean-Christophe Dubois      */
14031cbf933SJean-Christophe Dubois     for (i = 0; i < FSL_IMX6UL_NUM_USDHCS; i++) {
14131cbf933SJean-Christophe Dubois         snprintf(name, NAME_SIZE, "usdhc%d", i);
142db873cc5SMarkus Armbruster         object_initialize_child(obj, name, &s->usdhc[i], TYPE_IMX_USDHC);
14331cbf933SJean-Christophe Dubois     }
14431cbf933SJean-Christophe Dubois 
14531cbf933SJean-Christophe Dubois     /*
14631cbf933SJean-Christophe Dubois      * Watchdog
14731cbf933SJean-Christophe Dubois      */
14831cbf933SJean-Christophe Dubois     for (i = 0; i < FSL_IMX6UL_NUM_WDTS; i++) {
14931cbf933SJean-Christophe Dubois         snprintf(name, NAME_SIZE, "wdt%d", i);
150db873cc5SMarkus Armbruster         object_initialize_child(obj, name, &s->wdt[i], TYPE_IMX2_WDT);
15131cbf933SJean-Christophe Dubois     }
15231cbf933SJean-Christophe Dubois }
15331cbf933SJean-Christophe Dubois 
15431cbf933SJean-Christophe Dubois static void fsl_imx6ul_realize(DeviceState *dev, Error **errp)
15531cbf933SJean-Christophe Dubois {
156cc7d44c2SLike Xu     MachineState *ms = MACHINE(qdev_get_machine());
15731cbf933SJean-Christophe Dubois     FslIMX6ULState *s = FSL_IMX6UL(dev);
15831cbf933SJean-Christophe Dubois     int i;
15931cbf933SJean-Christophe Dubois     char name[NAME_SIZE];
160bc8c2ecfSPeter Maydell     SysBusDevice *sbd;
161bc8c2ecfSPeter Maydell     DeviceState *d;
16231cbf933SJean-Christophe Dubois 
163bc8c2ecfSPeter Maydell     if (ms->smp.cpus > 1) {
164bc8c2ecfSPeter Maydell         error_setg(errp, "%s: Only a single CPU is supported (%d requested)",
165bc8c2ecfSPeter Maydell                    TYPE_FSL_IMX6UL, ms->smp.cpus);
16631cbf933SJean-Christophe Dubois         return;
16731cbf933SJean-Christophe Dubois     }
16831cbf933SJean-Christophe Dubois 
1695325cc34SMarkus Armbruster     object_property_set_int(OBJECT(&s->cpu), "psci-conduit",
1705325cc34SMarkus Armbruster                             QEMU_PSCI_CONDUIT_SMC, &error_abort);
171ce189ab2SMarkus Armbruster     qdev_realize(DEVICE(&s->cpu), NULL, &error_abort);
17231cbf933SJean-Christophe Dubois 
17331cbf933SJean-Christophe Dubois     /*
17431cbf933SJean-Christophe Dubois      * A7MPCORE
17531cbf933SJean-Christophe Dubois      */
1765325cc34SMarkus Armbruster     object_property_set_int(OBJECT(&s->a7mpcore), "num-cpu", 1, &error_abort);
1775325cc34SMarkus Armbruster     object_property_set_int(OBJECT(&s->a7mpcore), "num-irq",
1785325cc34SMarkus Armbruster                             FSL_IMX6UL_MAX_IRQ + GIC_INTERNAL, &error_abort);
179db873cc5SMarkus Armbruster     sysbus_realize(SYS_BUS_DEVICE(&s->a7mpcore), &error_abort);
18031cbf933SJean-Christophe Dubois     sysbus_mmio_map(SYS_BUS_DEVICE(&s->a7mpcore), 0, FSL_IMX6UL_A7MPCORE_ADDR);
18131cbf933SJean-Christophe Dubois 
182bc8c2ecfSPeter Maydell     sbd = SYS_BUS_DEVICE(&s->a7mpcore);
183bc8c2ecfSPeter Maydell     d = DEVICE(&s->cpu);
18431cbf933SJean-Christophe Dubois 
185bc8c2ecfSPeter Maydell     sysbus_connect_irq(sbd, 0, qdev_get_gpio_in(d, ARM_CPU_IRQ));
186bc8c2ecfSPeter Maydell     sysbus_connect_irq(sbd, 1, qdev_get_gpio_in(d, ARM_CPU_FIQ));
187bc8c2ecfSPeter Maydell     sysbus_connect_irq(sbd, 2, qdev_get_gpio_in(d, ARM_CPU_VIRQ));
188bc8c2ecfSPeter Maydell     sysbus_connect_irq(sbd, 3, qdev_get_gpio_in(d, ARM_CPU_VFIQ));
18931cbf933SJean-Christophe Dubois 
19031cbf933SJean-Christophe Dubois     /*
19131cbf933SJean-Christophe Dubois      * A7MPCORE DAP
19231cbf933SJean-Christophe Dubois      */
19331cbf933SJean-Christophe Dubois     create_unimplemented_device("a7mpcore-dap", FSL_IMX6UL_A7MPCORE_DAP_ADDR,
19431cbf933SJean-Christophe Dubois                                 0x100000);
19531cbf933SJean-Christophe Dubois 
19631cbf933SJean-Christophe Dubois     /*
19731cbf933SJean-Christophe Dubois      * GPT 1, 2
19831cbf933SJean-Christophe Dubois      */
19931cbf933SJean-Christophe Dubois     for (i = 0; i < FSL_IMX6UL_NUM_GPTS; i++) {
20031cbf933SJean-Christophe Dubois         static const hwaddr FSL_IMX6UL_GPTn_ADDR[FSL_IMX6UL_NUM_GPTS] = {
20131cbf933SJean-Christophe Dubois             FSL_IMX6UL_GPT1_ADDR,
20231cbf933SJean-Christophe Dubois             FSL_IMX6UL_GPT2_ADDR,
20331cbf933SJean-Christophe Dubois         };
20431cbf933SJean-Christophe Dubois 
20531cbf933SJean-Christophe Dubois         static const int FSL_IMX6UL_GPTn_IRQ[FSL_IMX6UL_NUM_GPTS] = {
20631cbf933SJean-Christophe Dubois             FSL_IMX6UL_GPT1_IRQ,
20731cbf933SJean-Christophe Dubois             FSL_IMX6UL_GPT2_IRQ,
20831cbf933SJean-Christophe Dubois         };
20931cbf933SJean-Christophe Dubois 
21031cbf933SJean-Christophe Dubois         s->gpt[i].ccm = IMX_CCM(&s->ccm);
211db873cc5SMarkus Armbruster         sysbus_realize(SYS_BUS_DEVICE(&s->gpt[i]), &error_abort);
21231cbf933SJean-Christophe Dubois 
21331cbf933SJean-Christophe Dubois         sysbus_mmio_map(SYS_BUS_DEVICE(&s->gpt[i]), 0,
21431cbf933SJean-Christophe Dubois                         FSL_IMX6UL_GPTn_ADDR[i]);
21531cbf933SJean-Christophe Dubois 
21631cbf933SJean-Christophe Dubois         sysbus_connect_irq(SYS_BUS_DEVICE(&s->gpt[i]), 0,
21731cbf933SJean-Christophe Dubois                            qdev_get_gpio_in(DEVICE(&s->a7mpcore),
21831cbf933SJean-Christophe Dubois                                             FSL_IMX6UL_GPTn_IRQ[i]));
21931cbf933SJean-Christophe Dubois     }
22031cbf933SJean-Christophe Dubois 
22131cbf933SJean-Christophe Dubois     /*
22231cbf933SJean-Christophe Dubois      * EPIT 1, 2
22331cbf933SJean-Christophe Dubois      */
22431cbf933SJean-Christophe Dubois     for (i = 0; i < FSL_IMX6UL_NUM_EPITS; i++) {
22531cbf933SJean-Christophe Dubois         static const hwaddr FSL_IMX6UL_EPITn_ADDR[FSL_IMX6UL_NUM_EPITS] = {
22631cbf933SJean-Christophe Dubois             FSL_IMX6UL_EPIT1_ADDR,
22731cbf933SJean-Christophe Dubois             FSL_IMX6UL_EPIT2_ADDR,
22831cbf933SJean-Christophe Dubois         };
22931cbf933SJean-Christophe Dubois 
23031cbf933SJean-Christophe Dubois         static const int FSL_IMX6UL_EPITn_IRQ[FSL_IMX6UL_NUM_EPITS] = {
23131cbf933SJean-Christophe Dubois             FSL_IMX6UL_EPIT1_IRQ,
23231cbf933SJean-Christophe Dubois             FSL_IMX6UL_EPIT2_IRQ,
23331cbf933SJean-Christophe Dubois         };
23431cbf933SJean-Christophe Dubois 
23531cbf933SJean-Christophe Dubois         s->epit[i].ccm = IMX_CCM(&s->ccm);
236db873cc5SMarkus Armbruster         sysbus_realize(SYS_BUS_DEVICE(&s->epit[i]), &error_abort);
23731cbf933SJean-Christophe Dubois 
23831cbf933SJean-Christophe Dubois         sysbus_mmio_map(SYS_BUS_DEVICE(&s->epit[i]), 0,
23931cbf933SJean-Christophe Dubois                         FSL_IMX6UL_EPITn_ADDR[i]);
24031cbf933SJean-Christophe Dubois 
24131cbf933SJean-Christophe Dubois         sysbus_connect_irq(SYS_BUS_DEVICE(&s->epit[i]), 0,
24231cbf933SJean-Christophe Dubois                            qdev_get_gpio_in(DEVICE(&s->a7mpcore),
24331cbf933SJean-Christophe Dubois                                             FSL_IMX6UL_EPITn_IRQ[i]));
24431cbf933SJean-Christophe Dubois     }
24531cbf933SJean-Christophe Dubois 
24631cbf933SJean-Christophe Dubois     /*
24731cbf933SJean-Christophe Dubois      * GPIO
24831cbf933SJean-Christophe Dubois      */
24931cbf933SJean-Christophe Dubois     for (i = 0; i < FSL_IMX6UL_NUM_GPIOS; i++) {
25031cbf933SJean-Christophe Dubois         static const hwaddr FSL_IMX6UL_GPIOn_ADDR[FSL_IMX6UL_NUM_GPIOS] = {
25131cbf933SJean-Christophe Dubois             FSL_IMX6UL_GPIO1_ADDR,
25231cbf933SJean-Christophe Dubois             FSL_IMX6UL_GPIO2_ADDR,
25331cbf933SJean-Christophe Dubois             FSL_IMX6UL_GPIO3_ADDR,
25431cbf933SJean-Christophe Dubois             FSL_IMX6UL_GPIO4_ADDR,
25531cbf933SJean-Christophe Dubois             FSL_IMX6UL_GPIO5_ADDR,
25631cbf933SJean-Christophe Dubois         };
25731cbf933SJean-Christophe Dubois 
25831cbf933SJean-Christophe Dubois         static const int FSL_IMX6UL_GPIOn_LOW_IRQ[FSL_IMX6UL_NUM_GPIOS] = {
25931cbf933SJean-Christophe Dubois             FSL_IMX6UL_GPIO1_LOW_IRQ,
26031cbf933SJean-Christophe Dubois             FSL_IMX6UL_GPIO2_LOW_IRQ,
26131cbf933SJean-Christophe Dubois             FSL_IMX6UL_GPIO3_LOW_IRQ,
26231cbf933SJean-Christophe Dubois             FSL_IMX6UL_GPIO4_LOW_IRQ,
26331cbf933SJean-Christophe Dubois             FSL_IMX6UL_GPIO5_LOW_IRQ,
26431cbf933SJean-Christophe Dubois         };
26531cbf933SJean-Christophe Dubois 
26631cbf933SJean-Christophe Dubois         static const int FSL_IMX6UL_GPIOn_HIGH_IRQ[FSL_IMX6UL_NUM_GPIOS] = {
26731cbf933SJean-Christophe Dubois             FSL_IMX6UL_GPIO1_HIGH_IRQ,
26831cbf933SJean-Christophe Dubois             FSL_IMX6UL_GPIO2_HIGH_IRQ,
26931cbf933SJean-Christophe Dubois             FSL_IMX6UL_GPIO3_HIGH_IRQ,
27031cbf933SJean-Christophe Dubois             FSL_IMX6UL_GPIO4_HIGH_IRQ,
27131cbf933SJean-Christophe Dubois             FSL_IMX6UL_GPIO5_HIGH_IRQ,
27231cbf933SJean-Christophe Dubois         };
27331cbf933SJean-Christophe Dubois 
274db873cc5SMarkus Armbruster         sysbus_realize(SYS_BUS_DEVICE(&s->gpio[i]), &error_abort);
27531cbf933SJean-Christophe Dubois 
27631cbf933SJean-Christophe Dubois         sysbus_mmio_map(SYS_BUS_DEVICE(&s->gpio[i]), 0,
27731cbf933SJean-Christophe Dubois                         FSL_IMX6UL_GPIOn_ADDR[i]);
27831cbf933SJean-Christophe Dubois 
27931cbf933SJean-Christophe Dubois         sysbus_connect_irq(SYS_BUS_DEVICE(&s->gpio[i]), 0,
28031cbf933SJean-Christophe Dubois                            qdev_get_gpio_in(DEVICE(&s->a7mpcore),
28131cbf933SJean-Christophe Dubois                                             FSL_IMX6UL_GPIOn_LOW_IRQ[i]));
28231cbf933SJean-Christophe Dubois 
28331cbf933SJean-Christophe Dubois         sysbus_connect_irq(SYS_BUS_DEVICE(&s->gpio[i]), 1,
28431cbf933SJean-Christophe Dubois                            qdev_get_gpio_in(DEVICE(&s->a7mpcore),
28531cbf933SJean-Christophe Dubois                                             FSL_IMX6UL_GPIOn_HIGH_IRQ[i]));
28631cbf933SJean-Christophe Dubois     }
28731cbf933SJean-Christophe Dubois 
28831cbf933SJean-Christophe Dubois     /*
28931cbf933SJean-Christophe Dubois      * IOMUXC and IOMUXC_GPR
29031cbf933SJean-Christophe Dubois      */
29131cbf933SJean-Christophe Dubois     for (i = 0; i < 1; i++) {
29231cbf933SJean-Christophe Dubois         static const hwaddr FSL_IMX6UL_IOMUXCn_ADDR[FSL_IMX6UL_NUM_IOMUXCS] = {
29331cbf933SJean-Christophe Dubois             FSL_IMX6UL_IOMUXC_ADDR,
29431cbf933SJean-Christophe Dubois             FSL_IMX6UL_IOMUXC_GPR_ADDR,
29531cbf933SJean-Christophe Dubois         };
29631cbf933SJean-Christophe Dubois 
29731cbf933SJean-Christophe Dubois         snprintf(name, NAME_SIZE, "iomuxc%d", i);
29831cbf933SJean-Christophe Dubois         create_unimplemented_device(name, FSL_IMX6UL_IOMUXCn_ADDR[i], 0x4000);
29931cbf933SJean-Christophe Dubois     }
30031cbf933SJean-Christophe Dubois 
30131cbf933SJean-Christophe Dubois     /*
30231cbf933SJean-Christophe Dubois      * CCM
30331cbf933SJean-Christophe Dubois      */
304db873cc5SMarkus Armbruster     sysbus_realize(SYS_BUS_DEVICE(&s->ccm), &error_abort);
30531cbf933SJean-Christophe Dubois     sysbus_mmio_map(SYS_BUS_DEVICE(&s->ccm), 0, FSL_IMX6UL_CCM_ADDR);
30631cbf933SJean-Christophe Dubois 
30731cbf933SJean-Christophe Dubois     /*
30831cbf933SJean-Christophe Dubois      * SRC
30931cbf933SJean-Christophe Dubois      */
310db873cc5SMarkus Armbruster     sysbus_realize(SYS_BUS_DEVICE(&s->src), &error_abort);
31131cbf933SJean-Christophe Dubois     sysbus_mmio_map(SYS_BUS_DEVICE(&s->src), 0, FSL_IMX6UL_SRC_ADDR);
31231cbf933SJean-Christophe Dubois 
31331cbf933SJean-Christophe Dubois     /*
31431cbf933SJean-Christophe Dubois      * GPCv2
31531cbf933SJean-Christophe Dubois      */
316db873cc5SMarkus Armbruster     sysbus_realize(SYS_BUS_DEVICE(&s->gpcv2), &error_abort);
31731cbf933SJean-Christophe Dubois     sysbus_mmio_map(SYS_BUS_DEVICE(&s->gpcv2), 0, FSL_IMX6UL_GPC_ADDR);
31831cbf933SJean-Christophe Dubois 
31931cbf933SJean-Christophe Dubois     /* Initialize all ECSPI */
32031cbf933SJean-Christophe Dubois     for (i = 0; i < FSL_IMX6UL_NUM_ECSPIS; i++) {
32131cbf933SJean-Christophe Dubois         static const hwaddr FSL_IMX6UL_SPIn_ADDR[FSL_IMX6UL_NUM_ECSPIS] = {
32231cbf933SJean-Christophe Dubois             FSL_IMX6UL_ECSPI1_ADDR,
32331cbf933SJean-Christophe Dubois             FSL_IMX6UL_ECSPI2_ADDR,
32431cbf933SJean-Christophe Dubois             FSL_IMX6UL_ECSPI3_ADDR,
32531cbf933SJean-Christophe Dubois             FSL_IMX6UL_ECSPI4_ADDR,
32631cbf933SJean-Christophe Dubois         };
32731cbf933SJean-Christophe Dubois 
32831cbf933SJean-Christophe Dubois         static const int FSL_IMX6UL_SPIn_IRQ[FSL_IMX6UL_NUM_ECSPIS] = {
32931cbf933SJean-Christophe Dubois             FSL_IMX6UL_ECSPI1_IRQ,
33031cbf933SJean-Christophe Dubois             FSL_IMX6UL_ECSPI2_IRQ,
33131cbf933SJean-Christophe Dubois             FSL_IMX6UL_ECSPI3_IRQ,
33231cbf933SJean-Christophe Dubois             FSL_IMX6UL_ECSPI4_IRQ,
33331cbf933SJean-Christophe Dubois         };
33431cbf933SJean-Christophe Dubois 
33531cbf933SJean-Christophe Dubois         /* Initialize the SPI */
336db873cc5SMarkus Armbruster         sysbus_realize(SYS_BUS_DEVICE(&s->spi[i]), &error_abort);
33731cbf933SJean-Christophe Dubois 
33831cbf933SJean-Christophe Dubois         sysbus_mmio_map(SYS_BUS_DEVICE(&s->spi[i]), 0,
33931cbf933SJean-Christophe Dubois                         FSL_IMX6UL_SPIn_ADDR[i]);
34031cbf933SJean-Christophe Dubois 
34131cbf933SJean-Christophe Dubois         sysbus_connect_irq(SYS_BUS_DEVICE(&s->spi[i]), 0,
34231cbf933SJean-Christophe Dubois                            qdev_get_gpio_in(DEVICE(&s->a7mpcore),
34331cbf933SJean-Christophe Dubois                                             FSL_IMX6UL_SPIn_IRQ[i]));
34431cbf933SJean-Christophe Dubois     }
34531cbf933SJean-Christophe Dubois 
34631cbf933SJean-Christophe Dubois     /*
34731cbf933SJean-Christophe Dubois      * I2C
34831cbf933SJean-Christophe Dubois      */
34931cbf933SJean-Christophe Dubois     for (i = 0; i < FSL_IMX6UL_NUM_I2CS; i++) {
35031cbf933SJean-Christophe Dubois         static const hwaddr FSL_IMX6UL_I2Cn_ADDR[FSL_IMX6UL_NUM_I2CS] = {
35131cbf933SJean-Christophe Dubois             FSL_IMX6UL_I2C1_ADDR,
35231cbf933SJean-Christophe Dubois             FSL_IMX6UL_I2C2_ADDR,
35331cbf933SJean-Christophe Dubois             FSL_IMX6UL_I2C3_ADDR,
35431cbf933SJean-Christophe Dubois             FSL_IMX6UL_I2C4_ADDR,
35531cbf933SJean-Christophe Dubois         };
35631cbf933SJean-Christophe Dubois 
35731cbf933SJean-Christophe Dubois         static const int FSL_IMX6UL_I2Cn_IRQ[FSL_IMX6UL_NUM_I2CS] = {
35831cbf933SJean-Christophe Dubois             FSL_IMX6UL_I2C1_IRQ,
35931cbf933SJean-Christophe Dubois             FSL_IMX6UL_I2C2_IRQ,
36031cbf933SJean-Christophe Dubois             FSL_IMX6UL_I2C3_IRQ,
36131cbf933SJean-Christophe Dubois             FSL_IMX6UL_I2C4_IRQ,
36231cbf933SJean-Christophe Dubois         };
36331cbf933SJean-Christophe Dubois 
364db873cc5SMarkus Armbruster         sysbus_realize(SYS_BUS_DEVICE(&s->i2c[i]), &error_abort);
36531cbf933SJean-Christophe Dubois         sysbus_mmio_map(SYS_BUS_DEVICE(&s->i2c[i]), 0, FSL_IMX6UL_I2Cn_ADDR[i]);
36631cbf933SJean-Christophe Dubois 
36731cbf933SJean-Christophe Dubois         sysbus_connect_irq(SYS_BUS_DEVICE(&s->i2c[i]), 0,
36831cbf933SJean-Christophe Dubois                            qdev_get_gpio_in(DEVICE(&s->a7mpcore),
36931cbf933SJean-Christophe Dubois                                             FSL_IMX6UL_I2Cn_IRQ[i]));
37031cbf933SJean-Christophe Dubois     }
37131cbf933SJean-Christophe Dubois 
37231cbf933SJean-Christophe Dubois     /*
37331cbf933SJean-Christophe Dubois      * UART
37431cbf933SJean-Christophe Dubois      */
37531cbf933SJean-Christophe Dubois     for (i = 0; i < FSL_IMX6UL_NUM_UARTS; i++) {
37631cbf933SJean-Christophe Dubois         static const hwaddr FSL_IMX6UL_UARTn_ADDR[FSL_IMX6UL_NUM_UARTS] = {
37731cbf933SJean-Christophe Dubois             FSL_IMX6UL_UART1_ADDR,
37831cbf933SJean-Christophe Dubois             FSL_IMX6UL_UART2_ADDR,
37931cbf933SJean-Christophe Dubois             FSL_IMX6UL_UART3_ADDR,
38031cbf933SJean-Christophe Dubois             FSL_IMX6UL_UART4_ADDR,
38131cbf933SJean-Christophe Dubois             FSL_IMX6UL_UART5_ADDR,
38231cbf933SJean-Christophe Dubois             FSL_IMX6UL_UART6_ADDR,
38331cbf933SJean-Christophe Dubois             FSL_IMX6UL_UART7_ADDR,
38431cbf933SJean-Christophe Dubois             FSL_IMX6UL_UART8_ADDR,
38531cbf933SJean-Christophe Dubois         };
38631cbf933SJean-Christophe Dubois 
38731cbf933SJean-Christophe Dubois         static const int FSL_IMX6UL_UARTn_IRQ[FSL_IMX6UL_NUM_UARTS] = {
38831cbf933SJean-Christophe Dubois             FSL_IMX6UL_UART1_IRQ,
38931cbf933SJean-Christophe Dubois             FSL_IMX6UL_UART2_IRQ,
39031cbf933SJean-Christophe Dubois             FSL_IMX6UL_UART3_IRQ,
39131cbf933SJean-Christophe Dubois             FSL_IMX6UL_UART4_IRQ,
39231cbf933SJean-Christophe Dubois             FSL_IMX6UL_UART5_IRQ,
39331cbf933SJean-Christophe Dubois             FSL_IMX6UL_UART6_IRQ,
39431cbf933SJean-Christophe Dubois             FSL_IMX6UL_UART7_IRQ,
39531cbf933SJean-Christophe Dubois             FSL_IMX6UL_UART8_IRQ,
39631cbf933SJean-Christophe Dubois         };
39731cbf933SJean-Christophe Dubois 
39831cbf933SJean-Christophe Dubois         qdev_prop_set_chr(DEVICE(&s->uart[i]), "chardev", serial_hd(i));
39931cbf933SJean-Christophe Dubois 
400db873cc5SMarkus Armbruster         sysbus_realize(SYS_BUS_DEVICE(&s->uart[i]), &error_abort);
40131cbf933SJean-Christophe Dubois 
40231cbf933SJean-Christophe Dubois         sysbus_mmio_map(SYS_BUS_DEVICE(&s->uart[i]), 0,
40331cbf933SJean-Christophe Dubois                         FSL_IMX6UL_UARTn_ADDR[i]);
40431cbf933SJean-Christophe Dubois 
40531cbf933SJean-Christophe Dubois         sysbus_connect_irq(SYS_BUS_DEVICE(&s->uart[i]), 0,
40631cbf933SJean-Christophe Dubois                            qdev_get_gpio_in(DEVICE(&s->a7mpcore),
40731cbf933SJean-Christophe Dubois                                             FSL_IMX6UL_UARTn_IRQ[i]));
40831cbf933SJean-Christophe Dubois     }
40931cbf933SJean-Christophe Dubois 
41031cbf933SJean-Christophe Dubois     /*
41131cbf933SJean-Christophe Dubois      * Ethernet
41231cbf933SJean-Christophe Dubois      */
41331cbf933SJean-Christophe Dubois     for (i = 0; i < FSL_IMX6UL_NUM_ETHS; i++) {
41431cbf933SJean-Christophe Dubois         static const hwaddr FSL_IMX6UL_ENETn_ADDR[FSL_IMX6UL_NUM_ETHS] = {
41531cbf933SJean-Christophe Dubois             FSL_IMX6UL_ENET1_ADDR,
41631cbf933SJean-Christophe Dubois             FSL_IMX6UL_ENET2_ADDR,
41731cbf933SJean-Christophe Dubois         };
41831cbf933SJean-Christophe Dubois 
41931cbf933SJean-Christophe Dubois         static const int FSL_IMX6UL_ENETn_IRQ[FSL_IMX6UL_NUM_ETHS] = {
42031cbf933SJean-Christophe Dubois             FSL_IMX6UL_ENET1_IRQ,
42131cbf933SJean-Christophe Dubois             FSL_IMX6UL_ENET2_IRQ,
42231cbf933SJean-Christophe Dubois         };
42331cbf933SJean-Christophe Dubois 
42431cbf933SJean-Christophe Dubois         static const int FSL_IMX6UL_ENETn_TIMER_IRQ[FSL_IMX6UL_NUM_ETHS] = {
42531cbf933SJean-Christophe Dubois             FSL_IMX6UL_ENET1_TIMER_IRQ,
42631cbf933SJean-Christophe Dubois             FSL_IMX6UL_ENET2_TIMER_IRQ,
42731cbf933SJean-Christophe Dubois         };
42831cbf933SJean-Christophe Dubois 
4295325cc34SMarkus Armbruster         object_property_set_uint(OBJECT(&s->eth[i]), "phy-num",
4305325cc34SMarkus Armbruster                                  s->phy_num[i], &error_abort);
4315325cc34SMarkus Armbruster         object_property_set_uint(OBJECT(&s->eth[i]), "tx-ring-num",
4325325cc34SMarkus Armbruster                                  FSL_IMX6UL_ETH_NUM_TX_RINGS, &error_abort);
43331cbf933SJean-Christophe Dubois         qdev_set_nic_properties(DEVICE(&s->eth[i]), &nd_table[i]);
434db873cc5SMarkus Armbruster         sysbus_realize(SYS_BUS_DEVICE(&s->eth[i]), &error_abort);
43531cbf933SJean-Christophe Dubois 
43631cbf933SJean-Christophe Dubois         sysbus_mmio_map(SYS_BUS_DEVICE(&s->eth[i]), 0,
43731cbf933SJean-Christophe Dubois                         FSL_IMX6UL_ENETn_ADDR[i]);
43831cbf933SJean-Christophe Dubois 
43931cbf933SJean-Christophe Dubois         sysbus_connect_irq(SYS_BUS_DEVICE(&s->eth[i]), 0,
44031cbf933SJean-Christophe Dubois                            qdev_get_gpio_in(DEVICE(&s->a7mpcore),
44131cbf933SJean-Christophe Dubois                                             FSL_IMX6UL_ENETn_IRQ[i]));
44231cbf933SJean-Christophe Dubois 
44331cbf933SJean-Christophe Dubois         sysbus_connect_irq(SYS_BUS_DEVICE(&s->eth[i]), 1,
44431cbf933SJean-Christophe Dubois                            qdev_get_gpio_in(DEVICE(&s->a7mpcore),
44531cbf933SJean-Christophe Dubois                                             FSL_IMX6UL_ENETn_TIMER_IRQ[i]));
44631cbf933SJean-Christophe Dubois     }
44731cbf933SJean-Christophe Dubois 
44817372bd8SGuenter Roeck     /* USB */
44917372bd8SGuenter Roeck     for (i = 0; i < FSL_IMX6UL_NUM_USB_PHYS; i++) {
450db873cc5SMarkus Armbruster         sysbus_realize(SYS_BUS_DEVICE(&s->usbphy[i]), &error_abort);
45117372bd8SGuenter Roeck         sysbus_mmio_map(SYS_BUS_DEVICE(&s->usbphy[i]), 0,
45217372bd8SGuenter Roeck                         FSL_IMX6UL_USBPHY1_ADDR + i * 0x1000);
45317372bd8SGuenter Roeck     }
45417372bd8SGuenter Roeck 
45517372bd8SGuenter Roeck     for (i = 0; i < FSL_IMX6UL_NUM_USBS; i++) {
45617372bd8SGuenter Roeck         static const int FSL_IMX6UL_USBn_IRQ[] = {
45717372bd8SGuenter Roeck             FSL_IMX6UL_USB1_IRQ,
45817372bd8SGuenter Roeck             FSL_IMX6UL_USB2_IRQ,
45917372bd8SGuenter Roeck         };
460db873cc5SMarkus Armbruster         sysbus_realize(SYS_BUS_DEVICE(&s->usb[i]), &error_abort);
46117372bd8SGuenter Roeck         sysbus_mmio_map(SYS_BUS_DEVICE(&s->usb[i]), 0,
46217372bd8SGuenter Roeck                         FSL_IMX6UL_USBO2_USB_ADDR + i * 0x200);
46317372bd8SGuenter Roeck         sysbus_connect_irq(SYS_BUS_DEVICE(&s->usb[i]), 0,
46417372bd8SGuenter Roeck                            qdev_get_gpio_in(DEVICE(&s->a7mpcore),
46517372bd8SGuenter Roeck                                             FSL_IMX6UL_USBn_IRQ[i]));
46617372bd8SGuenter Roeck     }
46717372bd8SGuenter Roeck 
46831cbf933SJean-Christophe Dubois     /*
46931cbf933SJean-Christophe Dubois      * USDHC
47031cbf933SJean-Christophe Dubois      */
47131cbf933SJean-Christophe Dubois     for (i = 0; i < FSL_IMX6UL_NUM_USDHCS; i++) {
47231cbf933SJean-Christophe Dubois         static const hwaddr FSL_IMX6UL_USDHCn_ADDR[FSL_IMX6UL_NUM_USDHCS] = {
47331cbf933SJean-Christophe Dubois             FSL_IMX6UL_USDHC1_ADDR,
47431cbf933SJean-Christophe Dubois             FSL_IMX6UL_USDHC2_ADDR,
47531cbf933SJean-Christophe Dubois         };
47631cbf933SJean-Christophe Dubois 
47731cbf933SJean-Christophe Dubois         static const int FSL_IMX6UL_USDHCn_IRQ[FSL_IMX6UL_NUM_USDHCS] = {
47831cbf933SJean-Christophe Dubois             FSL_IMX6UL_USDHC1_IRQ,
47931cbf933SJean-Christophe Dubois             FSL_IMX6UL_USDHC2_IRQ,
48031cbf933SJean-Christophe Dubois         };
48131cbf933SJean-Christophe Dubois 
4825325cc34SMarkus Armbruster         object_property_set_uint(OBJECT(&s->usdhc[i]), "vendor",
4835325cc34SMarkus Armbruster                                  SDHCI_VENDOR_IMX, &error_abort);
484db873cc5SMarkus Armbruster         sysbus_realize(SYS_BUS_DEVICE(&s->usdhc[i]), &error_abort);
48531cbf933SJean-Christophe Dubois 
48631cbf933SJean-Christophe Dubois         sysbus_mmio_map(SYS_BUS_DEVICE(&s->usdhc[i]), 0,
48731cbf933SJean-Christophe Dubois                         FSL_IMX6UL_USDHCn_ADDR[i]);
48831cbf933SJean-Christophe Dubois 
48931cbf933SJean-Christophe Dubois         sysbus_connect_irq(SYS_BUS_DEVICE(&s->usdhc[i]), 0,
49031cbf933SJean-Christophe Dubois                            qdev_get_gpio_in(DEVICE(&s->a7mpcore),
49131cbf933SJean-Christophe Dubois                                             FSL_IMX6UL_USDHCn_IRQ[i]));
49231cbf933SJean-Christophe Dubois     }
49331cbf933SJean-Christophe Dubois 
49431cbf933SJean-Christophe Dubois     /*
49531cbf933SJean-Christophe Dubois      * SNVS
49631cbf933SJean-Christophe Dubois      */
497db873cc5SMarkus Armbruster     sysbus_realize(SYS_BUS_DEVICE(&s->snvs), &error_abort);
49831cbf933SJean-Christophe Dubois     sysbus_mmio_map(SYS_BUS_DEVICE(&s->snvs), 0, FSL_IMX6UL_SNVS_HP_ADDR);
49931cbf933SJean-Christophe Dubois 
50031cbf933SJean-Christophe Dubois     /*
50131cbf933SJean-Christophe Dubois      * Watchdog
50231cbf933SJean-Christophe Dubois      */
50331cbf933SJean-Christophe Dubois     for (i = 0; i < FSL_IMX6UL_NUM_WDTS; i++) {
50431cbf933SJean-Christophe Dubois         static const hwaddr FSL_IMX6UL_WDOGn_ADDR[FSL_IMX6UL_NUM_WDTS] = {
50531cbf933SJean-Christophe Dubois             FSL_IMX6UL_WDOG1_ADDR,
50631cbf933SJean-Christophe Dubois             FSL_IMX6UL_WDOG2_ADDR,
50731cbf933SJean-Christophe Dubois             FSL_IMX6UL_WDOG3_ADDR,
50831cbf933SJean-Christophe Dubois         };
5095671e960SGuenter Roeck         static const int FSL_IMX6UL_WDOGn_IRQ[FSL_IMX6UL_NUM_WDTS] = {
5105671e960SGuenter Roeck             FSL_IMX6UL_WDOG1_IRQ,
5115671e960SGuenter Roeck             FSL_IMX6UL_WDOG2_IRQ,
5125671e960SGuenter Roeck             FSL_IMX6UL_WDOG3_IRQ,
5135671e960SGuenter Roeck         };
51431cbf933SJean-Christophe Dubois 
5155325cc34SMarkus Armbruster         object_property_set_bool(OBJECT(&s->wdt[i]), "pretimeout-support",
5165325cc34SMarkus Armbruster                                  true, &error_abort);
517db873cc5SMarkus Armbruster         sysbus_realize(SYS_BUS_DEVICE(&s->wdt[i]), &error_abort);
51831cbf933SJean-Christophe Dubois 
51931cbf933SJean-Christophe Dubois         sysbus_mmio_map(SYS_BUS_DEVICE(&s->wdt[i]), 0,
52031cbf933SJean-Christophe Dubois                         FSL_IMX6UL_WDOGn_ADDR[i]);
5215671e960SGuenter Roeck         sysbus_connect_irq(SYS_BUS_DEVICE(&s->wdt[i]), 0,
5225671e960SGuenter Roeck                            qdev_get_gpio_in(DEVICE(&s->a7mpcore),
5235671e960SGuenter Roeck                                             FSL_IMX6UL_WDOGn_IRQ[i]));
52431cbf933SJean-Christophe Dubois     }
52531cbf933SJean-Christophe Dubois 
52631cbf933SJean-Christophe Dubois     /*
52731cbf933SJean-Christophe Dubois      * GPR
52831cbf933SJean-Christophe Dubois      */
529db873cc5SMarkus Armbruster     sysbus_realize(SYS_BUS_DEVICE(&s->gpr), &error_abort);
53031cbf933SJean-Christophe Dubois     sysbus_mmio_map(SYS_BUS_DEVICE(&s->gpr), 0, FSL_IMX6UL_IOMUXC_GPR_ADDR);
53131cbf933SJean-Christophe Dubois 
53231cbf933SJean-Christophe Dubois     /*
53331cbf933SJean-Christophe Dubois      * SDMA
53431cbf933SJean-Christophe Dubois      */
53531cbf933SJean-Christophe Dubois     create_unimplemented_device("sdma", FSL_IMX6UL_SDMA_ADDR, 0x4000);
53631cbf933SJean-Christophe Dubois 
53731cbf933SJean-Christophe Dubois     /*
538*ff31cca7SGuenter Roeck      * SAI (Audio SSI (Synchronous Serial Interface))
539*ff31cca7SGuenter Roeck      */
540*ff31cca7SGuenter Roeck     create_unimplemented_device("sai1", FSL_IMX6UL_SAI1_ADDR, 0x4000);
541*ff31cca7SGuenter Roeck     create_unimplemented_device("sai2", FSL_IMX6UL_SAI2_ADDR, 0x4000);
542*ff31cca7SGuenter Roeck     create_unimplemented_device("sai3", FSL_IMX6UL_SAI3_ADDR, 0x4000);
543*ff31cca7SGuenter Roeck 
544*ff31cca7SGuenter Roeck     /*
5458e0c1585SGuenter Roeck      * PWM
5468e0c1585SGuenter Roeck      */
5478e0c1585SGuenter Roeck     create_unimplemented_device("pwm1", FSL_IMX6UL_PWM1_ADDR, 0x4000);
5488e0c1585SGuenter Roeck     create_unimplemented_device("pwm2", FSL_IMX6UL_PWM2_ADDR, 0x4000);
5498e0c1585SGuenter Roeck     create_unimplemented_device("pwm3", FSL_IMX6UL_PWM3_ADDR, 0x4000);
5508e0c1585SGuenter Roeck     create_unimplemented_device("pwm4", FSL_IMX6UL_PWM4_ADDR, 0x4000);
5518e0c1585SGuenter Roeck 
5528e0c1585SGuenter Roeck     /*
553*ff31cca7SGuenter Roeck      * Audio ASRC (asynchronous sample rate converter)
554*ff31cca7SGuenter Roeck      */
555*ff31cca7SGuenter Roeck     create_unimplemented_device("asrc", FSL_IMX6UL_ASRC_ADDR, 0x4000);
556*ff31cca7SGuenter Roeck 
557*ff31cca7SGuenter Roeck     /*
5588e0c1585SGuenter Roeck      * CAN
5598e0c1585SGuenter Roeck      */
5608e0c1585SGuenter Roeck     create_unimplemented_device("can1", FSL_IMX6UL_CAN1_ADDR, 0x4000);
5618e0c1585SGuenter Roeck     create_unimplemented_device("can2", FSL_IMX6UL_CAN2_ADDR, 0x4000);
5628e0c1585SGuenter Roeck 
5638e0c1585SGuenter Roeck     /*
56431cbf933SJean-Christophe Dubois      * APHB_DMA
56531cbf933SJean-Christophe Dubois      */
56631cbf933SJean-Christophe Dubois     create_unimplemented_device("aphb_dma", FSL_IMX6UL_APBH_DMA_ADDR,
56731cbf933SJean-Christophe Dubois                                 FSL_IMX6UL_APBH_DMA_SIZE);
56831cbf933SJean-Christophe Dubois 
56931cbf933SJean-Christophe Dubois     /*
57031cbf933SJean-Christophe Dubois      * ADCs
57131cbf933SJean-Christophe Dubois      */
57231cbf933SJean-Christophe Dubois     for (i = 0; i < FSL_IMX6UL_NUM_ADCS; i++) {
57331cbf933SJean-Christophe Dubois         static const hwaddr FSL_IMX6UL_ADCn_ADDR[FSL_IMX6UL_NUM_ADCS] = {
57431cbf933SJean-Christophe Dubois             FSL_IMX6UL_ADC1_ADDR,
57531cbf933SJean-Christophe Dubois             FSL_IMX6UL_ADC2_ADDR,
57631cbf933SJean-Christophe Dubois         };
57731cbf933SJean-Christophe Dubois 
57831cbf933SJean-Christophe Dubois         snprintf(name, NAME_SIZE, "adc%d", i);
57931cbf933SJean-Christophe Dubois         create_unimplemented_device(name, FSL_IMX6UL_ADCn_ADDR[i], 0x4000);
58031cbf933SJean-Christophe Dubois     }
58131cbf933SJean-Christophe Dubois 
58231cbf933SJean-Christophe Dubois     /*
58331cbf933SJean-Christophe Dubois      * LCD
58431cbf933SJean-Christophe Dubois      */
58531cbf933SJean-Christophe Dubois     create_unimplemented_device("lcdif", FSL_IMX6UL_LCDIF_ADDR, 0x4000);
58631cbf933SJean-Christophe Dubois 
58731cbf933SJean-Christophe Dubois     /*
58831cbf933SJean-Christophe Dubois      * ROM memory
58931cbf933SJean-Christophe Dubois      */
59032b9523aSPhilippe Mathieu-Daudé     memory_region_init_rom(&s->rom, OBJECT(dev), "imx6ul.rom",
59131cbf933SJean-Christophe Dubois                            FSL_IMX6UL_ROM_SIZE, &error_abort);
59231cbf933SJean-Christophe Dubois     memory_region_add_subregion(get_system_memory(), FSL_IMX6UL_ROM_ADDR,
59331cbf933SJean-Christophe Dubois                                 &s->rom);
59431cbf933SJean-Christophe Dubois 
59531cbf933SJean-Christophe Dubois     /*
59631cbf933SJean-Christophe Dubois      * CAAM memory
59731cbf933SJean-Christophe Dubois      */
59832b9523aSPhilippe Mathieu-Daudé     memory_region_init_rom(&s->caam, OBJECT(dev), "imx6ul.caam",
59931cbf933SJean-Christophe Dubois                            FSL_IMX6UL_CAAM_MEM_SIZE, &error_abort);
60031cbf933SJean-Christophe Dubois     memory_region_add_subregion(get_system_memory(), FSL_IMX6UL_CAAM_MEM_ADDR,
60131cbf933SJean-Christophe Dubois                                 &s->caam);
60231cbf933SJean-Christophe Dubois 
60331cbf933SJean-Christophe Dubois     /*
60431cbf933SJean-Christophe Dubois      * OCRAM memory
60531cbf933SJean-Christophe Dubois      */
60631cbf933SJean-Christophe Dubois     memory_region_init_ram(&s->ocram, NULL, "imx6ul.ocram",
60731cbf933SJean-Christophe Dubois                            FSL_IMX6UL_OCRAM_MEM_SIZE,
60831cbf933SJean-Christophe Dubois                            &error_abort);
60931cbf933SJean-Christophe Dubois     memory_region_add_subregion(get_system_memory(), FSL_IMX6UL_OCRAM_MEM_ADDR,
61031cbf933SJean-Christophe Dubois                                 &s->ocram);
61131cbf933SJean-Christophe Dubois 
61231cbf933SJean-Christophe Dubois     /*
61331cbf933SJean-Christophe Dubois      * internal OCRAM (128 KB) is aliased over 512 KB
61431cbf933SJean-Christophe Dubois      */
61532b9523aSPhilippe Mathieu-Daudé     memory_region_init_alias(&s->ocram_alias, OBJECT(dev),
61632b9523aSPhilippe Mathieu-Daudé                              "imx6ul.ocram_alias", &s->ocram, 0,
61732b9523aSPhilippe Mathieu-Daudé                              FSL_IMX6UL_OCRAM_ALIAS_SIZE);
61831cbf933SJean-Christophe Dubois     memory_region_add_subregion(get_system_memory(),
61931cbf933SJean-Christophe Dubois                                 FSL_IMX6UL_OCRAM_ALIAS_ADDR, &s->ocram_alias);
62031cbf933SJean-Christophe Dubois }
62131cbf933SJean-Christophe Dubois 
622456914afSJean-Christophe Dubois static Property fsl_imx6ul_properties[] = {
623456914afSJean-Christophe Dubois     DEFINE_PROP_UINT32("fec1-phy-num", FslIMX6ULState, phy_num[0], 0),
624456914afSJean-Christophe Dubois     DEFINE_PROP_UINT32("fec2-phy-num", FslIMX6ULState, phy_num[1], 1),
625456914afSJean-Christophe Dubois     DEFINE_PROP_END_OF_LIST(),
626456914afSJean-Christophe Dubois };
627456914afSJean-Christophe Dubois 
62831cbf933SJean-Christophe Dubois static void fsl_imx6ul_class_init(ObjectClass *oc, void *data)
62931cbf933SJean-Christophe Dubois {
63031cbf933SJean-Christophe Dubois     DeviceClass *dc = DEVICE_CLASS(oc);
63131cbf933SJean-Christophe Dubois 
632456914afSJean-Christophe Dubois     device_class_set_props(dc, fsl_imx6ul_properties);
63331cbf933SJean-Christophe Dubois     dc->realize = fsl_imx6ul_realize;
63431cbf933SJean-Christophe Dubois     dc->desc = "i.MX6UL SOC";
63531cbf933SJean-Christophe Dubois     /* Reason: Uses serial_hds and nd_table in realize() directly */
63631cbf933SJean-Christophe Dubois     dc->user_creatable = false;
63731cbf933SJean-Christophe Dubois }
63831cbf933SJean-Christophe Dubois 
63931cbf933SJean-Christophe Dubois static const TypeInfo fsl_imx6ul_type_info = {
64031cbf933SJean-Christophe Dubois     .name = TYPE_FSL_IMX6UL,
64131cbf933SJean-Christophe Dubois     .parent = TYPE_DEVICE,
64231cbf933SJean-Christophe Dubois     .instance_size = sizeof(FslIMX6ULState),
64331cbf933SJean-Christophe Dubois     .instance_init = fsl_imx6ul_init,
64431cbf933SJean-Christophe Dubois     .class_init = fsl_imx6ul_class_init,
64531cbf933SJean-Christophe Dubois };
64631cbf933SJean-Christophe Dubois 
64731cbf933SJean-Christophe Dubois static void fsl_imx6ul_register_types(void)
64831cbf933SJean-Christophe Dubois {
64931cbf933SJean-Christophe Dubois     type_register_static(&fsl_imx6ul_type_info);
65031cbf933SJean-Christophe Dubois }
65131cbf933SJean-Christophe Dubois type_init(fsl_imx6ul_register_types)
652