2 * Copyright (c) 2018 Jean-Christophe Dubois <jcd@tribudubois.net>
4 * i.MX6UL SOC emulation.
6 * Based on hw/arm/fsl-imx7.c
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
19 #include "qemu/osdep.h"
20 #include "qapi/error.h"
21 #include "hw/arm/fsl-imx6ul.h"
22 #include "hw/misc/unimp.h"
23 #include "hw/usb/imx-usb-phy.h"
24 #include "hw/boards.h"
25 #include "sysemu/sysemu.h"
26 #include "qemu/error-report.h"
27 #include "qemu/module.h"
31 static void fsl_imx6ul_init(Object
*obj
)
33 FslIMX6ULState
*s
= FSL_IMX6UL(obj
);
37 object_initialize_child(obj
, "cpu0", &s
->cpu
,
38 ARM_CPU_TYPE_NAME("cortex-a7"));
43 object_initialize_child(obj
, "a7mpcore", &s
->a7mpcore
,
49 object_initialize_child(obj
, "ccm", &s
->ccm
, TYPE_IMX6UL_CCM
);
54 object_initialize_child(obj
, "src", &s
->src
, TYPE_IMX6_SRC
);
59 object_initialize_child(obj
, "gpcv2", &s
->gpcv2
, TYPE_IMX_GPCV2
);
64 object_initialize_child(obj
, "snvs", &s
->snvs
, TYPE_IMX7_SNVS
);
69 object_initialize_child(obj
, "gpr", &s
->gpr
, TYPE_IMX7_GPR
);
74 for (i
= 0; i
< FSL_IMX6UL_NUM_GPIOS
; i
++) {
75 snprintf(name
, NAME_SIZE
, "gpio%d", i
);
76 object_initialize_child(obj
, name
, &s
->gpio
[i
], TYPE_IMX_GPIO
);
82 for (i
= 0; i
< FSL_IMX6UL_NUM_GPTS
; i
++) {
83 snprintf(name
, NAME_SIZE
, "gpt%d", i
);
84 object_initialize_child(obj
, name
, &s
->gpt
[i
], TYPE_IMX7_GPT
);
90 for (i
= 0; i
< FSL_IMX6UL_NUM_EPITS
; i
++) {
91 snprintf(name
, NAME_SIZE
, "epit%d", i
+ 1);
92 object_initialize_child(obj
, name
, &s
->epit
[i
], TYPE_IMX_EPIT
);
98 for (i
= 0; i
< FSL_IMX6UL_NUM_ECSPIS
; i
++) {
99 snprintf(name
, NAME_SIZE
, "spi%d", i
+ 1);
100 object_initialize_child(obj
, name
, &s
->spi
[i
], TYPE_IMX_SPI
);
106 for (i
= 0; i
< FSL_IMX6UL_NUM_I2CS
; i
++) {
107 snprintf(name
, NAME_SIZE
, "i2c%d", i
+ 1);
108 object_initialize_child(obj
, name
, &s
->i2c
[i
], TYPE_IMX_I2C
);
114 for (i
= 0; i
< FSL_IMX6UL_NUM_UARTS
; i
++) {
115 snprintf(name
, NAME_SIZE
, "uart%d", i
);
116 object_initialize_child(obj
, name
, &s
->uart
[i
], TYPE_IMX_SERIAL
);
122 for (i
= 0; i
< FSL_IMX6UL_NUM_ETHS
; i
++) {
123 snprintf(name
, NAME_SIZE
, "eth%d", i
);
124 object_initialize_child(obj
, name
, &s
->eth
[i
], TYPE_IMX_ENET
);
128 for (i
= 0; i
< FSL_IMX6UL_NUM_USB_PHYS
; i
++) {
129 snprintf(name
, NAME_SIZE
, "usbphy%d", i
);
130 object_initialize_child(obj
, name
, &s
->usbphy
[i
], TYPE_IMX_USBPHY
);
132 for (i
= 0; i
< FSL_IMX6UL_NUM_USBS
; i
++) {
133 snprintf(name
, NAME_SIZE
, "usb%d", i
);
134 object_initialize_child(obj
, name
, &s
->usb
[i
], TYPE_CHIPIDEA
);
140 for (i
= 0; i
< FSL_IMX6UL_NUM_USDHCS
; i
++) {
141 snprintf(name
, NAME_SIZE
, "usdhc%d", i
);
142 object_initialize_child(obj
, name
, &s
->usdhc
[i
], TYPE_IMX_USDHC
);
148 for (i
= 0; i
< FSL_IMX6UL_NUM_WDTS
; i
++) {
149 snprintf(name
, NAME_SIZE
, "wdt%d", i
);
150 object_initialize_child(obj
, name
, &s
->wdt
[i
], TYPE_IMX2_WDT
);
154 static void fsl_imx6ul_realize(DeviceState
*dev
, Error
**errp
)
156 MachineState
*ms
= MACHINE(qdev_get_machine());
157 FslIMX6ULState
*s
= FSL_IMX6UL(dev
);
159 char name
[NAME_SIZE
];
163 if (ms
->smp
.cpus
> 1) {
164 error_setg(errp
, "%s: Only a single CPU is supported (%d requested)",
165 TYPE_FSL_IMX6UL
, ms
->smp
.cpus
);
169 object_property_set_int(OBJECT(&s
->cpu
), "psci-conduit",
170 QEMU_PSCI_CONDUIT_SMC
, &error_abort
);
171 qdev_realize(DEVICE(&s
->cpu
), NULL
, &error_abort
);
176 object_property_set_int(OBJECT(&s
->a7mpcore
), "num-cpu", 1, &error_abort
);
177 object_property_set_int(OBJECT(&s
->a7mpcore
), "num-irq",
178 FSL_IMX6UL_MAX_IRQ
+ GIC_INTERNAL
, &error_abort
);
179 sysbus_realize(SYS_BUS_DEVICE(&s
->a7mpcore
), &error_abort
);
180 sysbus_mmio_map(SYS_BUS_DEVICE(&s
->a7mpcore
), 0, FSL_IMX6UL_A7MPCORE_ADDR
);
182 sbd
= SYS_BUS_DEVICE(&s
->a7mpcore
);
185 sysbus_connect_irq(sbd
, 0, qdev_get_gpio_in(d
, ARM_CPU_IRQ
));
186 sysbus_connect_irq(sbd
, 1, qdev_get_gpio_in(d
, ARM_CPU_FIQ
));
187 sysbus_connect_irq(sbd
, 2, qdev_get_gpio_in(d
, ARM_CPU_VIRQ
));
188 sysbus_connect_irq(sbd
, 3, qdev_get_gpio_in(d
, ARM_CPU_VFIQ
));
193 create_unimplemented_device("a7mpcore-dap", FSL_IMX6UL_A7MPCORE_DAP_ADDR
,
199 for (i
= 0; i
< FSL_IMX6UL_NUM_GPTS
; i
++) {
200 static const hwaddr FSL_IMX6UL_GPTn_ADDR
[FSL_IMX6UL_NUM_GPTS
] = {
201 FSL_IMX6UL_GPT1_ADDR
,
202 FSL_IMX6UL_GPT2_ADDR
,
205 static const int FSL_IMX6UL_GPTn_IRQ
[FSL_IMX6UL_NUM_GPTS
] = {
210 s
->gpt
[i
].ccm
= IMX_CCM(&s
->ccm
);
211 sysbus_realize(SYS_BUS_DEVICE(&s
->gpt
[i
]), &error_abort
);
213 sysbus_mmio_map(SYS_BUS_DEVICE(&s
->gpt
[i
]), 0,
214 FSL_IMX6UL_GPTn_ADDR
[i
]);
216 sysbus_connect_irq(SYS_BUS_DEVICE(&s
->gpt
[i
]), 0,
217 qdev_get_gpio_in(DEVICE(&s
->a7mpcore
),
218 FSL_IMX6UL_GPTn_IRQ
[i
]));
224 for (i
= 0; i
< FSL_IMX6UL_NUM_EPITS
; i
++) {
225 static const hwaddr FSL_IMX6UL_EPITn_ADDR
[FSL_IMX6UL_NUM_EPITS
] = {
226 FSL_IMX6UL_EPIT1_ADDR
,
227 FSL_IMX6UL_EPIT2_ADDR
,
230 static const int FSL_IMX6UL_EPITn_IRQ
[FSL_IMX6UL_NUM_EPITS
] = {
231 FSL_IMX6UL_EPIT1_IRQ
,
232 FSL_IMX6UL_EPIT2_IRQ
,
235 s
->epit
[i
].ccm
= IMX_CCM(&s
->ccm
);
236 sysbus_realize(SYS_BUS_DEVICE(&s
->epit
[i
]), &error_abort
);
238 sysbus_mmio_map(SYS_BUS_DEVICE(&s
->epit
[i
]), 0,
239 FSL_IMX6UL_EPITn_ADDR
[i
]);
241 sysbus_connect_irq(SYS_BUS_DEVICE(&s
->epit
[i
]), 0,
242 qdev_get_gpio_in(DEVICE(&s
->a7mpcore
),
243 FSL_IMX6UL_EPITn_IRQ
[i
]));
249 for (i
= 0; i
< FSL_IMX6UL_NUM_GPIOS
; i
++) {
250 static const hwaddr FSL_IMX6UL_GPIOn_ADDR
[FSL_IMX6UL_NUM_GPIOS
] = {
251 FSL_IMX6UL_GPIO1_ADDR
,
252 FSL_IMX6UL_GPIO2_ADDR
,
253 FSL_IMX6UL_GPIO3_ADDR
,
254 FSL_IMX6UL_GPIO4_ADDR
,
255 FSL_IMX6UL_GPIO5_ADDR
,
258 static const int FSL_IMX6UL_GPIOn_LOW_IRQ
[FSL_IMX6UL_NUM_GPIOS
] = {
259 FSL_IMX6UL_GPIO1_LOW_IRQ
,
260 FSL_IMX6UL_GPIO2_LOW_IRQ
,
261 FSL_IMX6UL_GPIO3_LOW_IRQ
,
262 FSL_IMX6UL_GPIO4_LOW_IRQ
,
263 FSL_IMX6UL_GPIO5_LOW_IRQ
,
266 static const int FSL_IMX6UL_GPIOn_HIGH_IRQ
[FSL_IMX6UL_NUM_GPIOS
] = {
267 FSL_IMX6UL_GPIO1_HIGH_IRQ
,
268 FSL_IMX6UL_GPIO2_HIGH_IRQ
,
269 FSL_IMX6UL_GPIO3_HIGH_IRQ
,
270 FSL_IMX6UL_GPIO4_HIGH_IRQ
,
271 FSL_IMX6UL_GPIO5_HIGH_IRQ
,
274 sysbus_realize(SYS_BUS_DEVICE(&s
->gpio
[i
]), &error_abort
);
276 sysbus_mmio_map(SYS_BUS_DEVICE(&s
->gpio
[i
]), 0,
277 FSL_IMX6UL_GPIOn_ADDR
[i
]);
279 sysbus_connect_irq(SYS_BUS_DEVICE(&s
->gpio
[i
]), 0,
280 qdev_get_gpio_in(DEVICE(&s
->a7mpcore
),
281 FSL_IMX6UL_GPIOn_LOW_IRQ
[i
]));
283 sysbus_connect_irq(SYS_BUS_DEVICE(&s
->gpio
[i
]), 1,
284 qdev_get_gpio_in(DEVICE(&s
->a7mpcore
),
285 FSL_IMX6UL_GPIOn_HIGH_IRQ
[i
]));
289 * IOMUXC and IOMUXC_GPR
291 for (i
= 0; i
< 1; i
++) {
292 static const hwaddr FSL_IMX6UL_IOMUXCn_ADDR
[FSL_IMX6UL_NUM_IOMUXCS
] = {
293 FSL_IMX6UL_IOMUXC_ADDR
,
294 FSL_IMX6UL_IOMUXC_GPR_ADDR
,
297 snprintf(name
, NAME_SIZE
, "iomuxc%d", i
);
298 create_unimplemented_device(name
, FSL_IMX6UL_IOMUXCn_ADDR
[i
], 0x4000);
304 sysbus_realize(SYS_BUS_DEVICE(&s
->ccm
), &error_abort
);
305 sysbus_mmio_map(SYS_BUS_DEVICE(&s
->ccm
), 0, FSL_IMX6UL_CCM_ADDR
);
310 sysbus_realize(SYS_BUS_DEVICE(&s
->src
), &error_abort
);
311 sysbus_mmio_map(SYS_BUS_DEVICE(&s
->src
), 0, FSL_IMX6UL_SRC_ADDR
);
316 sysbus_realize(SYS_BUS_DEVICE(&s
->gpcv2
), &error_abort
);
317 sysbus_mmio_map(SYS_BUS_DEVICE(&s
->gpcv2
), 0, FSL_IMX6UL_GPC_ADDR
);
319 /* Initialize all ECSPI */
320 for (i
= 0; i
< FSL_IMX6UL_NUM_ECSPIS
; i
++) {
321 static const hwaddr FSL_IMX6UL_SPIn_ADDR
[FSL_IMX6UL_NUM_ECSPIS
] = {
322 FSL_IMX6UL_ECSPI1_ADDR
,
323 FSL_IMX6UL_ECSPI2_ADDR
,
324 FSL_IMX6UL_ECSPI3_ADDR
,
325 FSL_IMX6UL_ECSPI4_ADDR
,
328 static const int FSL_IMX6UL_SPIn_IRQ
[FSL_IMX6UL_NUM_ECSPIS
] = {
329 FSL_IMX6UL_ECSPI1_IRQ
,
330 FSL_IMX6UL_ECSPI2_IRQ
,
331 FSL_IMX6UL_ECSPI3_IRQ
,
332 FSL_IMX6UL_ECSPI4_IRQ
,
335 /* Initialize the SPI */
336 sysbus_realize(SYS_BUS_DEVICE(&s
->spi
[i
]), &error_abort
);
338 sysbus_mmio_map(SYS_BUS_DEVICE(&s
->spi
[i
]), 0,
339 FSL_IMX6UL_SPIn_ADDR
[i
]);
341 sysbus_connect_irq(SYS_BUS_DEVICE(&s
->spi
[i
]), 0,
342 qdev_get_gpio_in(DEVICE(&s
->a7mpcore
),
343 FSL_IMX6UL_SPIn_IRQ
[i
]));
349 for (i
= 0; i
< FSL_IMX6UL_NUM_I2CS
; i
++) {
350 static const hwaddr FSL_IMX6UL_I2Cn_ADDR
[FSL_IMX6UL_NUM_I2CS
] = {
351 FSL_IMX6UL_I2C1_ADDR
,
352 FSL_IMX6UL_I2C2_ADDR
,
353 FSL_IMX6UL_I2C3_ADDR
,
354 FSL_IMX6UL_I2C4_ADDR
,
357 static const int FSL_IMX6UL_I2Cn_IRQ
[FSL_IMX6UL_NUM_I2CS
] = {
364 sysbus_realize(SYS_BUS_DEVICE(&s
->i2c
[i
]), &error_abort
);
365 sysbus_mmio_map(SYS_BUS_DEVICE(&s
->i2c
[i
]), 0, FSL_IMX6UL_I2Cn_ADDR
[i
]);
367 sysbus_connect_irq(SYS_BUS_DEVICE(&s
->i2c
[i
]), 0,
368 qdev_get_gpio_in(DEVICE(&s
->a7mpcore
),
369 FSL_IMX6UL_I2Cn_IRQ
[i
]));
375 for (i
= 0; i
< FSL_IMX6UL_NUM_UARTS
; i
++) {
376 static const hwaddr FSL_IMX6UL_UARTn_ADDR
[FSL_IMX6UL_NUM_UARTS
] = {
377 FSL_IMX6UL_UART1_ADDR
,
378 FSL_IMX6UL_UART2_ADDR
,
379 FSL_IMX6UL_UART3_ADDR
,
380 FSL_IMX6UL_UART4_ADDR
,
381 FSL_IMX6UL_UART5_ADDR
,
382 FSL_IMX6UL_UART6_ADDR
,
383 FSL_IMX6UL_UART7_ADDR
,
384 FSL_IMX6UL_UART8_ADDR
,
387 static const int FSL_IMX6UL_UARTn_IRQ
[FSL_IMX6UL_NUM_UARTS
] = {
388 FSL_IMX6UL_UART1_IRQ
,
389 FSL_IMX6UL_UART2_IRQ
,
390 FSL_IMX6UL_UART3_IRQ
,
391 FSL_IMX6UL_UART4_IRQ
,
392 FSL_IMX6UL_UART5_IRQ
,
393 FSL_IMX6UL_UART6_IRQ
,
394 FSL_IMX6UL_UART7_IRQ
,
395 FSL_IMX6UL_UART8_IRQ
,
398 qdev_prop_set_chr(DEVICE(&s
->uart
[i
]), "chardev", serial_hd(i
));
400 sysbus_realize(SYS_BUS_DEVICE(&s
->uart
[i
]), &error_abort
);
402 sysbus_mmio_map(SYS_BUS_DEVICE(&s
->uart
[i
]), 0,
403 FSL_IMX6UL_UARTn_ADDR
[i
]);
405 sysbus_connect_irq(SYS_BUS_DEVICE(&s
->uart
[i
]), 0,
406 qdev_get_gpio_in(DEVICE(&s
->a7mpcore
),
407 FSL_IMX6UL_UARTn_IRQ
[i
]));
413 for (i
= 0; i
< FSL_IMX6UL_NUM_ETHS
; i
++) {
414 static const hwaddr FSL_IMX6UL_ENETn_ADDR
[FSL_IMX6UL_NUM_ETHS
] = {
415 FSL_IMX6UL_ENET1_ADDR
,
416 FSL_IMX6UL_ENET2_ADDR
,
419 static const int FSL_IMX6UL_ENETn_IRQ
[FSL_IMX6UL_NUM_ETHS
] = {
420 FSL_IMX6UL_ENET1_IRQ
,
421 FSL_IMX6UL_ENET2_IRQ
,
424 static const int FSL_IMX6UL_ENETn_TIMER_IRQ
[FSL_IMX6UL_NUM_ETHS
] = {
425 FSL_IMX6UL_ENET1_TIMER_IRQ
,
426 FSL_IMX6UL_ENET2_TIMER_IRQ
,
429 object_property_set_uint(OBJECT(&s
->eth
[i
]), "phy-num",
430 s
->phy_num
[i
], &error_abort
);
431 object_property_set_uint(OBJECT(&s
->eth
[i
]), "tx-ring-num",
432 FSL_IMX6UL_ETH_NUM_TX_RINGS
, &error_abort
);
433 qdev_set_nic_properties(DEVICE(&s
->eth
[i
]), &nd_table
[i
]);
434 sysbus_realize(SYS_BUS_DEVICE(&s
->eth
[i
]), &error_abort
);
436 sysbus_mmio_map(SYS_BUS_DEVICE(&s
->eth
[i
]), 0,
437 FSL_IMX6UL_ENETn_ADDR
[i
]);
439 sysbus_connect_irq(SYS_BUS_DEVICE(&s
->eth
[i
]), 0,
440 qdev_get_gpio_in(DEVICE(&s
->a7mpcore
),
441 FSL_IMX6UL_ENETn_IRQ
[i
]));
443 sysbus_connect_irq(SYS_BUS_DEVICE(&s
->eth
[i
]), 1,
444 qdev_get_gpio_in(DEVICE(&s
->a7mpcore
),
445 FSL_IMX6UL_ENETn_TIMER_IRQ
[i
]));
449 for (i
= 0; i
< FSL_IMX6UL_NUM_USB_PHYS
; i
++) {
450 sysbus_realize(SYS_BUS_DEVICE(&s
->usbphy
[i
]), &error_abort
);
451 sysbus_mmio_map(SYS_BUS_DEVICE(&s
->usbphy
[i
]), 0,
452 FSL_IMX6UL_USBPHY1_ADDR
+ i
* 0x1000);
455 for (i
= 0; i
< FSL_IMX6UL_NUM_USBS
; i
++) {
456 static const int FSL_IMX6UL_USBn_IRQ
[] = {
460 sysbus_realize(SYS_BUS_DEVICE(&s
->usb
[i
]), &error_abort
);
461 sysbus_mmio_map(SYS_BUS_DEVICE(&s
->usb
[i
]), 0,
462 FSL_IMX6UL_USBO2_USB_ADDR
+ i
* 0x200);
463 sysbus_connect_irq(SYS_BUS_DEVICE(&s
->usb
[i
]), 0,
464 qdev_get_gpio_in(DEVICE(&s
->a7mpcore
),
465 FSL_IMX6UL_USBn_IRQ
[i
]));
471 for (i
= 0; i
< FSL_IMX6UL_NUM_USDHCS
; i
++) {
472 static const hwaddr FSL_IMX6UL_USDHCn_ADDR
[FSL_IMX6UL_NUM_USDHCS
] = {
473 FSL_IMX6UL_USDHC1_ADDR
,
474 FSL_IMX6UL_USDHC2_ADDR
,
477 static const int FSL_IMX6UL_USDHCn_IRQ
[FSL_IMX6UL_NUM_USDHCS
] = {
478 FSL_IMX6UL_USDHC1_IRQ
,
479 FSL_IMX6UL_USDHC2_IRQ
,
482 object_property_set_uint(OBJECT(&s
->usdhc
[i
]), "vendor",
483 SDHCI_VENDOR_IMX
, &error_abort
);
484 sysbus_realize(SYS_BUS_DEVICE(&s
->usdhc
[i
]), &error_abort
);
486 sysbus_mmio_map(SYS_BUS_DEVICE(&s
->usdhc
[i
]), 0,
487 FSL_IMX6UL_USDHCn_ADDR
[i
]);
489 sysbus_connect_irq(SYS_BUS_DEVICE(&s
->usdhc
[i
]), 0,
490 qdev_get_gpio_in(DEVICE(&s
->a7mpcore
),
491 FSL_IMX6UL_USDHCn_IRQ
[i
]));
497 sysbus_realize(SYS_BUS_DEVICE(&s
->snvs
), &error_abort
);
498 sysbus_mmio_map(SYS_BUS_DEVICE(&s
->snvs
), 0, FSL_IMX6UL_SNVS_HP_ADDR
);
503 for (i
= 0; i
< FSL_IMX6UL_NUM_WDTS
; i
++) {
504 static const hwaddr FSL_IMX6UL_WDOGn_ADDR
[FSL_IMX6UL_NUM_WDTS
] = {
505 FSL_IMX6UL_WDOG1_ADDR
,
506 FSL_IMX6UL_WDOG2_ADDR
,
507 FSL_IMX6UL_WDOG3_ADDR
,
509 static const int FSL_IMX6UL_WDOGn_IRQ
[FSL_IMX6UL_NUM_WDTS
] = {
510 FSL_IMX6UL_WDOG1_IRQ
,
511 FSL_IMX6UL_WDOG2_IRQ
,
512 FSL_IMX6UL_WDOG3_IRQ
,
515 object_property_set_bool(OBJECT(&s
->wdt
[i
]), "pretimeout-support",
517 sysbus_realize(SYS_BUS_DEVICE(&s
->wdt
[i
]), &error_abort
);
519 sysbus_mmio_map(SYS_BUS_DEVICE(&s
->wdt
[i
]), 0,
520 FSL_IMX6UL_WDOGn_ADDR
[i
]);
521 sysbus_connect_irq(SYS_BUS_DEVICE(&s
->wdt
[i
]), 0,
522 qdev_get_gpio_in(DEVICE(&s
->a7mpcore
),
523 FSL_IMX6UL_WDOGn_IRQ
[i
]));
529 sysbus_realize(SYS_BUS_DEVICE(&s
->gpr
), &error_abort
);
530 sysbus_mmio_map(SYS_BUS_DEVICE(&s
->gpr
), 0, FSL_IMX6UL_IOMUXC_GPR_ADDR
);
535 create_unimplemented_device("sdma", FSL_IMX6UL_SDMA_ADDR
, 0x4000);
540 create_unimplemented_device("pwm1", FSL_IMX6UL_PWM1_ADDR
, 0x4000);
541 create_unimplemented_device("pwm2", FSL_IMX6UL_PWM2_ADDR
, 0x4000);
542 create_unimplemented_device("pwm3", FSL_IMX6UL_PWM3_ADDR
, 0x4000);
543 create_unimplemented_device("pwm4", FSL_IMX6UL_PWM4_ADDR
, 0x4000);
548 create_unimplemented_device("can1", FSL_IMX6UL_CAN1_ADDR
, 0x4000);
549 create_unimplemented_device("can2", FSL_IMX6UL_CAN2_ADDR
, 0x4000);
554 create_unimplemented_device("aphb_dma", FSL_IMX6UL_APBH_DMA_ADDR
,
555 FSL_IMX6UL_APBH_DMA_SIZE
);
560 for (i
= 0; i
< FSL_IMX6UL_NUM_ADCS
; i
++) {
561 static const hwaddr FSL_IMX6UL_ADCn_ADDR
[FSL_IMX6UL_NUM_ADCS
] = {
562 FSL_IMX6UL_ADC1_ADDR
,
563 FSL_IMX6UL_ADC2_ADDR
,
566 snprintf(name
, NAME_SIZE
, "adc%d", i
);
567 create_unimplemented_device(name
, FSL_IMX6UL_ADCn_ADDR
[i
], 0x4000);
573 create_unimplemented_device("lcdif", FSL_IMX6UL_LCDIF_ADDR
, 0x4000);
578 memory_region_init_rom(&s
->rom
, OBJECT(dev
), "imx6ul.rom",
579 FSL_IMX6UL_ROM_SIZE
, &error_abort
);
580 memory_region_add_subregion(get_system_memory(), FSL_IMX6UL_ROM_ADDR
,
586 memory_region_init_rom(&s
->caam
, OBJECT(dev
), "imx6ul.caam",
587 FSL_IMX6UL_CAAM_MEM_SIZE
, &error_abort
);
588 memory_region_add_subregion(get_system_memory(), FSL_IMX6UL_CAAM_MEM_ADDR
,
594 memory_region_init_ram(&s
->ocram
, NULL
, "imx6ul.ocram",
595 FSL_IMX6UL_OCRAM_MEM_SIZE
,
597 memory_region_add_subregion(get_system_memory(), FSL_IMX6UL_OCRAM_MEM_ADDR
,
601 * internal OCRAM (128 KB) is aliased over 512 KB
603 memory_region_init_alias(&s
->ocram_alias
, OBJECT(dev
),
604 "imx6ul.ocram_alias", &s
->ocram
, 0,
605 FSL_IMX6UL_OCRAM_ALIAS_SIZE
);
606 memory_region_add_subregion(get_system_memory(),
607 FSL_IMX6UL_OCRAM_ALIAS_ADDR
, &s
->ocram_alias
);
610 static Property fsl_imx6ul_properties
[] = {
611 DEFINE_PROP_UINT32("fec1-phy-num", FslIMX6ULState
, phy_num
[0], 0),
612 DEFINE_PROP_UINT32("fec2-phy-num", FslIMX6ULState
, phy_num
[1], 1),
613 DEFINE_PROP_END_OF_LIST(),
616 static void fsl_imx6ul_class_init(ObjectClass
*oc
, void *data
)
618 DeviceClass
*dc
= DEVICE_CLASS(oc
);
620 device_class_set_props(dc
, fsl_imx6ul_properties
);
621 dc
->realize
= fsl_imx6ul_realize
;
622 dc
->desc
= "i.MX6UL SOC";
623 /* Reason: Uses serial_hds and nd_table in realize() directly */
624 dc
->user_creatable
= false;
627 static const TypeInfo fsl_imx6ul_type_info
= {
628 .name
= TYPE_FSL_IMX6UL
,
629 .parent
= TYPE_DEVICE
,
630 .instance_size
= sizeof(FslIMX6ULState
),
631 .instance_init
= fsl_imx6ul_init
,
632 .class_init
= fsl_imx6ul_class_init
,
635 static void fsl_imx6ul_register_types(void)
637 type_register_static(&fsl_imx6ul_type_info
);
639 type_init(fsl_imx6ul_register_types
)