[dev][uart][pl011] first step moving pl011 driver out of qemu-virt-arm

No real functional change, but move the driver implementation out to a
separate place so it can be made to be platform independent.
This commit is contained in:
Travis Geiselbrecht
2024-06-30 23:16:58 -07:00
parent b236992933
commit 5fa540dd31
7 changed files with 26 additions and 10 deletions

View File

@@ -0,0 +1,15 @@
/*
* Copyright (c) 2024 Travis Geiselbrecht
*
* Use of this source code is governed by a MIT-style
* license that can be found in the LICENSE file or at
* https://opensource.org/licenses/MIT
*/
#pragma once
#include <dev/uart.h>
#define PL011_FLAG_DEBUG_UART (1u<<0)
void pl011_init_early(int port, uintptr_t base, uint32_t irq, uint32_t flag);
void pl011_init(int port);

7
dev/uart/pl011/rules.mk Normal file
View File

@@ -0,0 +1,7 @@
LOCAL_DIR := $(GET_LOCAL_DIR)
MODULE := $(LOCAL_DIR)
MODULE_SRCS += $(LOCAL_DIR)/uart.c
include make/module.mk

View File

@@ -7,13 +7,11 @@
*/
#include <stdarg.h>
#include <lk/reg.h>
#include <stdio.h>
#include <kernel/thread.h>
#include <dev/uart.h>
#include <platform/debug.h>
#include <platform/qemu-virt.h>
#include <target/debugconfig.h>
#include <lk/reg.h>
/* DEBUG_UART must be defined to 0 or 1 */
#if defined(DEBUG_UART) && DEBUG_UART == 0

View File

@@ -8,7 +8,6 @@
#include <platform/qemu-virt.h>
#include <arch.h>
#include <inttypes.h>
#include <lk/err.h>
#include <lk/debug.h>
#include <lk/trace.h>

View File

@@ -7,5 +7,3 @@
*/
#pragma once
void platform_init_timer(void);

View File

@@ -15,10 +15,8 @@ WITH_SMP ?= 1
LK_HEAP_IMPLEMENTATION ?= dlmalloc
MODULE_SRCS += \
$(LOCAL_DIR)/debug.c \
$(LOCAL_DIR)/platform.c \
$(LOCAL_DIR)/uart.c
MODULE_SRCS += $(LOCAL_DIR)/debug.c
MODULE_SRCS += $(LOCAL_DIR)/platform.c
MEMBASE := 0x40000000
MEMSIZE ?= 0x08000000 # 512MB
@@ -30,10 +28,11 @@ MODULE_DEPS += \
dev/interrupt/arm_gic \
dev/power/psci \
dev/timer/arm_generic \
dev/uart/pl011 \
dev/virtio/9p \
dev/virtio/block \
dev/virtio/gpu \
dev/virtio/net \
dev/virtio/9p \
lib/cbuf \
lib/fdtwalk \
lib/fs/9p \