Lines Matching +full:- +full:- +full:enable +full:- +full:fdt
5 * Copyright (c) 2016-2019 BALATON Zoltan
17 #include "qemu/error-report.h"
23 #include "system/block-backend.h"
24 #include "exec/page-protection.h"
29 #include "hw/pci-host/ppc4xx.h"
34 #include "hw/char/serial-mm.h"
38 #include "hw/usb/hcd-ehci.h"
39 #include "hw/ppc/fdt.h"
40 #include "hw/qdev-properties.h"
41 #include "hw/intc/ppc-uic.h"
46 #define UBOOT_FILENAME "u-boot-sam460-20100605.bin"
47 /* to extract the official U-Boot bin from the updater: */
48 /* dd bs=1 skip=$(($(stat -c '%s' updater/updater-460) - 0x80000)) \
49 if=updater/updater-460 of=u-boot-sam460-20100605.bin */
54 /* from Sam460 U-Boot include/configs/Sam460ex.h */
62 /* from U-Boot */
93 * the 32-bit address space (0xFFF00000..0xFFFFFFFF). in sam460ex_load_uboot()
100 * initialized from u-boot-sam460-20100605.bin. in sam460ex_load_uboot()
123 " using default u-boot image");*/ in sam460ex_load_uboot()
126 -1); in sam460ex_load_uboot()
137 uint32_t mem_reg_property[] = { 0, 0, cpu_to_be32(machine->ram_size) }; in sam460ex_load_device_tree()
140 void *fdt; in sam460ex_load_device_tree() local
150 fdt = load_device_tree(filename, &fdt_size); in sam460ex_load_device_tree()
151 if (!fdt) { in sam460ex_load_device_tree()
160 qemu_fdt_setprop(fdt, "/memory", "reg", mem_reg_property, in sam460ex_load_device_tree()
163 /* default FDT doesn't have a /chosen node... */ in sam460ex_load_device_tree()
164 qemu_fdt_add_subnode(fdt, "/chosen"); in sam460ex_load_device_tree()
166 qemu_fdt_setprop_cell(fdt, "/chosen", "linux,initrd-start", initrd_base); in sam460ex_load_device_tree()
168 qemu_fdt_setprop_cell(fdt, "/chosen", "linux,initrd-end", in sam460ex_load_device_tree()
171 qemu_fdt_setprop_string(fdt, "/chosen", "bootargs", in sam460ex_load_device_tree()
172 machine->kernel_cmdline); in sam460ex_load_device_tree()
182 qemu_fdt_setprop_cell(fdt, "/cpus/cpu@0", "clock-frequency", in sam460ex_load_device_tree()
184 qemu_fdt_setprop_cell(fdt, "/cpus/cpu@0", "timebase-frequency", in sam460ex_load_device_tree()
188 offset = fdt_path_offset(fdt, "/cpm"); in sam460ex_load_device_tree()
190 _FDT(fdt_nop_node(fdt, offset)); in sam460ex_load_device_tree()
194 offset = fdt_node_offset_by_compatible(fdt, -1, "ns16550"); in sam460ex_load_device_tree()
196 _FDT(fdt_setprop_cell(fdt, offset, "clock-frequency", UART_FREQ)); in sam460ex_load_device_tree()
197 offset = fdt_node_offset_by_compatible(fdt, offset, "ns16550"); in sam460ex_load_device_tree()
201 qemu_fdt_setprop_cell(fdt, "/plb", "clock-frequency", in sam460ex_load_device_tree()
203 qemu_fdt_setprop_cell(fdt, "/plb/opb", "clock-frequency", in sam460ex_load_device_tree()
205 qemu_fdt_setprop_cell(fdt, "/plb/opb/ebc", "clock-frequency", in sam460ex_load_device_tree()
208 rom_add_blob_fixed(BINARY_DEVICE_TREE_FILE, fdt, fdt_size, addr); in sam460ex_load_device_tree()
210 /* Set machine->fdt for 'dumpdtb' QMP/HMP command */ in sam460ex_load_device_tree()
211 machine->fdt = fdt; in sam460ex_load_device_tree()
219 CPUPPCState *env = &cpu->env; in main_cpu_reset()
220 struct boot_info *bi = env->load_info; in main_cpu_reset()
226 * don't implement them we need to use the same values U-Boot in main_cpu_reset()
228 * either we have a kernel to boot or we jump to U-Boot in main_cpu_reset()
230 if (bi->entry != UBOOT_ENTRY) { in main_cpu_reset()
231 env->gpr[1] = (16 * MiB) - 8; in main_cpu_reset()
232 env->gpr[3] = FDT_ADDR; in main_cpu_reset()
233 env->nip = bi->entry; in main_cpu_reset()
236 booke_set_tlb(&env->tlb.tlbe[0], 0, 0, 1 << 31); in main_cpu_reset()
237 env->gpr[6] = EPAPR_MAGIC; in main_cpu_reset()
238 env->gpr[7] = (16 * MiB) - 8; /* bi->ima_size; */ in main_cpu_reset()
241 env->nip = UBOOT_ENTRY; in main_cpu_reset()
242 /* Create a mapping for U-Boot. */ in main_cpu_reset()
243 booke_set_tlb(&env->tlb.tlbe[0], 0xf0000000, 0xf0000000, 0x10000000); in main_cpu_reset()
244 env->tlb.tlbe[0].RPN |= 4; in main_cpu_reset()
266 cpu = POWERPC_CPU(cpu_create(machine->cpu_type)); in sam460ex_init()
267 env = &cpu->env; in sam460ex_init()
268 if (env->mmu_model != POWERPC_MMU_BOOKE) { in sam460ex_init()
275 env->load_info = boot_info; in sam460ex_init()
295 const int input_ints[] = { -1, 30, 10, 16 }; in sam460ex_init()
298 qdev_prop_set_uint32(uic[i], "dcr-base", 0xc0 + i * 0x10); in sam460ex_init()
318 if (machine->ram_size > 2 * GiB) { in sam460ex_init()
323 if (machine->ram_size < 64 * MiB) { in sam460ex_init()
328 object_property_set_link(OBJECT(dev), "dram", OBJECT(machine->ram), in sam460ex_init()
338 /* Enable SDRAM memory regions as we may boot without firmware */ in sam460ex_init()
344 i2c = PPC4xx_I2C(dev)->bus; in sam460ex_init()
346 spd_data = spd_data_generate(machine->ram_size < 128 * MiB ? DDR : DDR2, in sam460ex_init()
347 machine->ram_size); in sam460ex_init()
348 spd_data[20] = 4; /* SO-DIMM module */ in sam460ex_init()
372 qdev_prop_set_uint8(dev, "txc-num", 4); in sam460ex_init()
373 qdev_prop_set_uint8(dev, "rxc-num", 16); in sam460ex_init()
377 for (i = 0; i < ARRAY_SIZE(PPC4xx_MAL(dev)->irqs); i++) { in sam460ex_init()
395 dev = qdev_new("sysbus-ohci"); in sam460ex_init()
396 qdev_prop_set_string(dev, "masterbus", "usb-bus.0"); in sam460ex_init()
397 qdev_prop_set_uint32(dev, "num-ports", 6); in sam460ex_init()
404 usb_create_simple(usb_bus, "usb-kbd"); in sam460ex_init()
405 usb_create_simple(usb_bus, "usb-mouse"); in sam460ex_init()
410 qdev_prop_set_int32(dev, "dcrn-base", PCIE0_DCRN_BASE); in sam460ex_init()
416 qdev_prop_set_int32(dev, "dcrn-base", PCIE1_DCRN_BASE); in sam460ex_init()
435 PCIIDEState *s = PCI_IDE(pci_create_simple(pci_bus, -1, "sii3112")); in sam460ex_init()
440 ide_bus_create_drive(&s->bus[0], 0, di); in sam460ex_init()
442 /* Use index 2 only if 1 does not exist, this allows -cdrom */ in sam460ex_init()
445 ide_bus_create_drive(&s->bus[1], 0, di); in sam460ex_init()
449 /* SoC has 4 UARTs but board has only one wired and two described in fdt */ in sam460ex_init()
463 /* Load U-Boot image. */ in sam460ex_init()
464 if (!machine->kernel_filename) { in sam460ex_init()
473 if (machine->kernel_filename) { in sam460ex_init()
475 success = load_uimage(machine->kernel_filename, &entry, &loadaddr, in sam460ex_init()
480 success = load_elf(machine->kernel_filename, NULL, NULL, NULL, in sam460ex_init()
488 machine->kernel_filename); in sam460ex_init()
494 if (machine->initrd_filename) { in sam460ex_init()
495 initrd_size = load_image_targphys(machine->initrd_filename, in sam460ex_init()
497 machine->ram_size - RAMDISK_ADDR); in sam460ex_init()
500 machine->initrd_filename, RAMDISK_ADDR); in sam460ex_init()
506 if (machine->kernel_filename) { in sam460ex_init()
512 boot_info->dt_base = FDT_ADDR; in sam460ex_init()
513 boot_info->dt_size = dt_size; in sam460ex_init()
516 boot_info->entry = entry; in sam460ex_init()
521 mc->desc = "aCube Sam460ex"; in sam460ex_machine_init()
522 mc->init = sam460ex_init; in sam460ex_machine_init()
523 mc->block_default_type = IF_IDE; in sam460ex_machine_init()
524 mc->default_cpu_type = POWERPC_CPU_TYPE_NAME("460exb"); in sam460ex_machine_init()
525 mc->default_ram_size = 512 * MiB; in sam460ex_machine_init()
526 mc->default_ram_id = "ppc4xx.sdram"; in sam460ex_machine_init()