Add Odroid-C2 support

Add support for the Hardkernel Odroid-C2 board.

Co-Authored-By: Anna Lyons <Anna.Lyons@data61.csiro.au>
This commit is contained in:
James Ye 2019-03-29 11:58:34 +11:00
parent 1f6e43cac7
commit a16cc57e21
7 changed files with 117 additions and 0 deletions

View file

@ -25,6 +25,7 @@ Upcoming release: BREAKING
* Support for generating ARM machine header files (memory regions and interrupts) based on a device tree.
* Support added for ARM kernel serial driver to be linked in at build time based on the device tree compatibility string.
* Support added for compiling verified configurations of the kernel with Clang 7.
* Support added for Hardkernel ODROID-C2.
## Upgrade Notes
---

View file

@ -0,0 +1,29 @@
/*
* Copyright 2019, Data61
* Commonwealth Scientific and Industrial Research Organisation (CSIRO)
* ABN 41 687 119 230.
*
* This software may be distributed and modified according to the terms of
* the BSD 2-Clause license. Note that NO WARRANTY is provided.
* See "LICENSE_BSD2.txt" for details.
*
* @TAG(DATA61_BSD)
*/
#ifndef __LIBSEL4_SEL4_PLAT_API_CONSTANTS_H_
#define __LIBSEL4_SEL4_PLAT_API_CONSTANTS_H_
#ifdef HAVE_AUTOCONF
#include <autoconf.h>
#endif
/* Cortex A53 manual, section 11.6.1 */
#define seL4_NumHWBreakpoints (10)
#define seL4_NumExclusiveBreakpoints (6)
#define seL4_NumExclusiveWatchpoints (4)
#ifdef CONFIG_HARDWARE_DEBUG_API
#define seL4_FirstWatchpoint (6)
#define seL4_NumDualFunctionMonitors (0)
#endif
#endif /* __LIBSEL4_SEL4_PLAT_API_CONSTANTS_H_ */

View file

@ -45,6 +45,7 @@ config_choice(
"rpi3;KernelPlatformRpi3;PLAT_BCM2837;KernelArchARM"
"tx1;KernelPlatformTx1;PLAT_TX1;KernelSel4ArchAarch64"
"tx2;KernelPlatformTx2;PLAT_TX2;KernelSel4ArchAarch64"
"odroidc2;KernelPlatformOdroidc2;PLAT_ODROIDC2;KernelSel4ArchAarch64"
)
if(KernelArchARM)
@ -117,6 +118,7 @@ include(src/plat/tx1/config.cmake)
include(src/plat/tx2/config.cmake)
include(src/plat/zynq7000/config.cmake)
include(src/plat/zynqmp/config.cmake)
include(src/plat/odroidc2/config.cmake)
if(DEFINED KernelDTSList)
set(KernelDTSIntermediate "${CMAKE_CURRENT_BINARY_DIR}/kernel.dts")

View file

@ -39,3 +39,8 @@ register_driver(
CFILES "msm-uartdm.c"
)
register_driver(compatibility_strings "xlnx,xuartps" PREFIX src/drivers/serial CFILES "xuartps.c")
register_driver(
compatibility_strings "amlogic,meson-gx-uart"
PREFIX src/drivers/serial
CFILES "meson-gx-uart.c"
)

View file

@ -0,0 +1,44 @@
/*
* Copyright 2019, Data61
* Commonwealth Scientific and Industrial Research Organisation (CSIRO)
* ABN 41 687 119 230.
*
* This software may be distributed and modified according to the terms of
* the GNU General Public License version 2. Note that NO WARRANTY is provided.
* See "LICENSE_GPLv2.txt" for details.
*
* @TAG(DATA61_GPL)
*/
#include <config.h>
#include <stdint.h>
#include <util.h>
#include <machine/io.h>
#include <plat/machine/devices_gen.h>
#define UART_WFIFO 0x0
#define UART_RFIFO 0x4
#define UART_STATUS 0xC
#define UART_TX_FULL BIT(21)
#define UART_RX_EMPTY BIT(20)
#define UART_REG(x) ((volatile uint32_t *)(UART_PPTR + (x)))
#if defined(CONFIG_DEBUG_BUILD) || defined(CONFIG_PRINTING)
void putDebugChar(unsigned char c)
{
while ((*UART_REG(UART_STATUS) & UART_TX_FULL));
/* Add character to the buffer. */
*UART_REG(UART_WFIFO) = c;
}
#endif
#ifdef CONFIG_DEBUG_BUILD
unsigned char getDebugChar(void)
{
while ((*UART_REG(UART_STATUS) & UART_RX_EMPTY));
return *UART_REG(UART_RFIFO);
}
#endif /* CONFIG_DEBUG_BUILD */

View file

@ -0,0 +1,35 @@
#
# Copyright 2019, Data61
# Commonwealth Scientific and Industrial Research Organisation (CSIRO)
# ABN 41 687 119 230.
#
# This software may be distributed and modified according to the terms of
# the GNU General Public License version 2. Note that NO WARRANTY is provided.
# See "LICENSE_GPLv2.txt" for details.
#
# @TAG(DATA61_GPL)
#
cmake_minimum_required(VERSION 3.7.2)
if(KernelPlatformOdroidc2)
set(KernelArmCortexA53 ON)
set(KernelArchArmV8a ON)
config_set(KernelPlatform PLAT "odroidc2")
set(KernelArmMachFeatureModifiers "+crc" CACHE INTERNAL "")
if(KernelSel4ArchAarch64)
set(KernelHaveFPU ON)
endif()
list(APPEND KernelDTSList "tools/dts/odroidc2.dts")
declare_default_headers(
TIMER_FREQUENCY 24000000llu
MAX_IRQ 250
TIMER drivers/timer/arm_generic.h
INTERRUPT_CONTROLLER arch/machine/gic_pl390.h
)
endif()
add_sources(
DEP "KernelPlatformOdroidc2"
CFILES src/arch/arm/machine/gic_pl390.c src/arch/arm/machine/l2c_nop.c
)

View file

@ -215,6 +215,7 @@ devices:
user: true
# various serial consoles (`grep <compatible> serial/*`)
- compatible:
- amlogic,meson-gx-uart
- arm,pl011
- brcm,bcm2835-aux-uart
- fsl,imx31-uart