Skip to content

Commit cbbfb74

Browse files
author
Matt Rossouw
committed
Add support for Cheshire (CVA6), refactored Ariane to share CVA6
Added support for Cheshire (CVA6). Refactored Ariane and Cheshire to use a shared mach definition since they both implement the CVA6 core and have common code. Signed-off-by: Matt Rossouw <matthew.rossouw@unsw.edu.au>
1 parent f98dad1 commit cbbfb74

File tree

5 files changed

+107
-0
lines changed

5 files changed

+107
-0
lines changed

libplatsupport/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ config_choice(
3838
set(LibPlatSupportMach "")
3939
if(KernelPlatformRpi3 OR KernelPlatformRpi4)
4040
set(LibPlatSupportMach "bcm")
41+
elseif(KernelPlatformCheshire OR KernelPlatformAriane)
42+
set(LibPlatSupportMach "cva6")
4143
elseif(NOT ${KernelArmMach} STREQUAL "")
4244
# falling back to kernel settings is done to keep legacy compatibility
4345
set(LibPlatSupportMach "${KernelArmMach}")
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
/*
2+
* Copyright 2019, Data61, CSIRO (ABN 41 687 119 230)
3+
*
4+
* SPDX-License-Identifier: BSD-2-Clause
5+
*/
6+
7+
#pragma once
8+
9+
#include <platsupport/timer.h>
10+
11+
#include <utils/util.h>
12+
#include <stdint.h>
13+
#include <stdbool.h>
14+
15+
/* The input frequence is the CPU frequency which is 50MHz by default */
16+
#define APB_TIMER_INPUT_FREQ (50*1000*1000)
17+
#define APB_TIMER_PADDR 0x18000000
18+
19+
/* Multiple timers */
20+
#define APB_TIMER_DIST 0x10
21+
#define APB_TIMER_NUM 2
22+
#define APB_TIMER_BASE(n) APB_TIMER_DIST * n
23+
24+
#define CMP_WIDTH 32
25+
#define APB_TIMER_CTRL_ENABLE BIT(0);
26+
#define CMP_MASK MASK(CMP_WIDTH)
27+
28+
/* Timer IRQs */
29+
#define APB_TIMER_PLIC_BASE 4
30+
#define APB_TIMER_IRQ_OVF(n) APB_TIMER_PLIC_BASE + 2*n + 0x0
31+
#define APB_TIMER_IRQ_CMP(n) APB_TIMER_PLIC_BASE + 2*n + 0x1
32+
33+
typedef struct {
34+
/* vaddr apb_timer is mapped to */
35+
void *vaddr;
36+
} apb_timer_config_t;
37+
38+
typedef struct apb_timer {
39+
volatile struct apb_timer_map *apb_timer_map;
40+
uint64_t time_h;
41+
} apb_timer_t;
42+
43+
struct apb_timer_map {
44+
uint32_t time;
45+
uint32_t ctrl;
46+
uint32_t cmp;
47+
};
48+
49+
int apb_timer_start(apb_timer_t *apb_timer);
50+
int apb_timer_stop(apb_timer_t *apb_timer);
51+
uint64_t apb_timer_get_time(apb_timer_t *apb_timer);
52+
int apb_timer_set_timeout(apb_timer_t *apb_timer, uint64_t ns);
53+
int apb_timer_init(apb_timer_t *apb_timer, apb_timer_config_t config);
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/*
2+
* Copyright 2019, Data61, CSIRO (ABN 41 687 119 230)
3+
*
4+
* SPDX-License-Identifier: BSD-2-Clause
5+
*/
6+
7+
#pragma once
8+
#include <autoconf.h>
9+
10+
enum chardev_id {
11+
PS_SERIAL0,
12+
/* defaults */
13+
PS_SERIAL_DEFAULT = PS_SERIAL0
14+
};
15+
16+
#define PS_SERIAL_DEFAULT 0
17+
18+
#define DEFAULT_SERIAL_PADDR NULL
19+
#define DEFAULT_SERIAL_INTERRUPT 0
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/*
2+
* Copyright 2019, Data61, CSIRO (ABN 41 687 119 230)
3+
*
4+
* SPDX-License-Identifier: BSD-2-Clause
5+
*/
6+
7+
#include "../../chardev.h"
8+
#include "../../common.h"
9+
#include <utils/util.h>
10+
11+
struct ps_chardevice *
12+
ps_cdev_init(enum chardev_id id, const ps_io_ops_t *o, struct ps_chardevice *d)
13+
{
14+
return NULL;
15+
}
16+
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/*
2+
* Copyright 2019, Data61, CSIRO (ABN 41 687 119 230)
3+
*
4+
* SPDX-License-Identifier: BSD-2-Clause
5+
*/
6+
7+
#include <stdlib.h>
8+
#include <platsupport/serial.h>
9+
#include <platsupport/plat/serial.h>
10+
#include <string.h>
11+
12+
int uart_init(const struct dev_defn *defn,
13+
const ps_io_ops_t *ops,
14+
ps_chardevice_t *dev)
15+
{
16+
return 0;
17+
}

0 commit comments

Comments
 (0)