| 1 | /* |
| 2 | * Microwatt FPGA-based SoC platform setup code. |
| 3 | * |
| 4 | * Copyright 2020 Paul Mackerras (paulus@ozlabs.org), IBM Corp. |
| 5 | */ |
| 6 | |
| 7 | #include <linux/types.h> |
| 8 | #include <linux/kernel.h> |
| 9 | #include <linux/stddef.h> |
| 10 | #include <linux/init.h> |
| 11 | #include <linux/of.h> |
| 12 | #include <linux/of_platform.h> |
| 13 | |
| 14 | #include <asm/machdep.h> |
| 15 | #include <asm/time.h> |
| 16 | #include <asm/xics.h> |
| 17 | #include <asm/udbg.h> |
| 18 | |
| 19 | #include "microwatt.h" |
| 20 | |
| 21 | static void __init microwatt_init_IRQ(void) |
| 22 | { |
| 23 | xics_init(); |
| 24 | } |
| 25 | |
| 26 | static int __init microwatt_populate(void) |
| 27 | { |
| 28 | return of_platform_default_populate(NULL, NULL, NULL); |
| 29 | } |
| 30 | machine_arch_initcall(microwatt, microwatt_populate); |
| 31 | |
| 32 | static int __init microwatt_probe(void) |
| 33 | { |
| 34 | /* Main reason for having this is to start the other CPU(s) */ |
| 35 | if (IS_ENABLED(CONFIG_SMP)) |
| 36 | microwatt_init_smp(); |
| 37 | return 1; |
| 38 | } |
| 39 | |
| 40 | static void __init microwatt_setup_arch(void) |
| 41 | { |
| 42 | microwatt_rng_init(); |
| 43 | } |
| 44 | |
| 45 | static void microwatt_idle(void) |
| 46 | { |
| 47 | if (!prep_irq_for_idle_irqsoff()) |
| 48 | return; |
| 49 | |
| 50 | __asm__ __volatile__ ("wait" ); |
| 51 | } |
| 52 | |
| 53 | define_machine(microwatt) { |
| 54 | .name = "microwatt" , |
| 55 | .compatible = "microwatt-soc" , |
| 56 | .probe = microwatt_probe, |
| 57 | .init_IRQ = microwatt_init_IRQ, |
| 58 | .setup_arch = microwatt_setup_arch, |
| 59 | .progress = udbg_progress, |
| 60 | .power_save = microwatt_idle, |
| 61 | }; |
| 62 | |