Skip to content

Commit

Permalink
Cadence: initialize from device tree
Browse files Browse the repository at this point in the history
Add runtime map for Cadence UART

Signed-off-by: Stewart Hildebrand <[email protected]>
Message-Id: <[email protected]>
  • Loading branch information
stewdk authored and wkozaczuk committed Mar 14, 2021
1 parent d5aeb30 commit 3f09060
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
17 changes: 17 additions & 0 deletions arch/aarch64/arch-setup.cc
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,13 @@ void arch_setup_free_memory()
mmu::mattr::dev);
}

if (console::Cadence_Console::active) {
// linear_map [TTBR0 - UART]
addr = (mmu::phys)console::aarch64_console.cadence.get_base_addr();
mmu::linear_map((void *)addr, addr, 0x1000, mmu::page_size,
mmu::mattr::dev);
}

/* linear_map [TTBR0 - GIC DIST and GIC CPU] */
u64 dist, cpu;
size_t dist_len, cpu_len;
Expand Down Expand Up @@ -211,6 +218,16 @@ void arch_init_early_console()
return;
}

mmio_serial_address = dtb_get_cadence_uart(&irqid);
if (mmio_serial_address) {
new (&console::aarch64_console.cadence) console::Cadence_Console();
console::arch_early_console = console::aarch64_console.cadence;
console::aarch64_console.cadence.set_base_addr(mmio_serial_address);
console::aarch64_console.cadence.set_irqid(irqid);
console::Cadence_Console::active = true;
return;
}

new (&console::aarch64_console.pl011) console::PL011_Console();
console::arch_early_console = console::aarch64_console.pl011;
console::PL011_Console::active = true;
Expand Down
2 changes: 2 additions & 0 deletions arch/aarch64/early-console.hh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

#include <drivers/console-driver.hh>
#include <drivers/pl011.hh>
#include <drivers/cadence-uart.hh>
#include <drivers/xenconsole.hh>
#include <drivers/mmio-isa-serial.hh>

Expand All @@ -18,6 +19,7 @@ namespace console {

union AARCH64_Console {
PL011_Console pl011;
Cadence_Console cadence;
XEN_Console xen;
mmio_isa_serial_console isa_serial;

Expand Down

0 comments on commit 3f09060

Please sign in to comment.