File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -10,11 +10,11 @@ static enum handler_return timer0_irq(void *arg);
1010
1111lk_bigtime_t current_time_hires (void ) {
1212 //TODO, deal with rollover
13- return ( ((lk_bigtime_t )* REG32 (ST_CHI )) << 32 ) | * REG32 (ST_CLO );
13+ return (( ((lk_bigtime_t )* REG32 (ST_CHI )) << 32 ) | * REG32 (ST_CLO )) / 1000 ;
1414}
1515
1616lk_time_t current_time (void ) {
17- return * REG32 ( ST_CLO );
17+ return current_time_hires ( );
1818}
1919
2020static platform_timer_callback timer_cb = 0 ;;
Original file line number Diff line number Diff line change 1+ // based on drivers/net/ethernet/broadcom/genet/bcmgenet.c from linux
2+ // for PHY control, look at the cmd_bits variable in drivers/net/ethernet/broadcom/genet/bcmmii.c
3+
4+ #include <lk/reg.h>
5+ #include <stdio.h>
6+ #include <lk/console_cmd.h>
7+ #include <platform/bcm28xx.h>
8+ #include <lk/debug.h>
9+
10+ static int cmd_genet_dump (int argc , const cmd_args * argv );
11+
12+ STATIC_COMMAND_START
13+ STATIC_COMMAND ("dump_genet" , "print genet information" , & cmd_genet_dump )
14+ STATIC_COMMAND_END (genet );
15+
16+ #define SYS_REV_CTRL (GENET_BASE + 0x0)
17+
18+ static int cmd_genet_dump (int argc , const cmd_args * argv ) {
19+ uint32_t reg = * REG32 (SYS_REV_CTRL );
20+ uint8_t major = (reg >> 24 & 0x0f );
21+ if (major == 6 ) major = 5 ;
22+ else if (major == 5 ) major = 4 ;
23+ else if (major == 0 ) major = 1 ;
24+
25+ dprintf (INFO , "found GENET controller version %d\n" , major );
26+ return 0 ;
27+ }
Original file line number Diff line number Diff line change 5555#define SMI_BASE (BCM_PERIPH_BASE_VIRT + 0x600000)
5656#define BSC1_BASE (BCM_PERIPH_BASE_VIRT + 0x804000)
5757#define USB_BASE (BCM_PERIPH_BASE_VIRT + 0x980000)
58+ #define GENET_BASE (0x7d580000) // TODO, this is before the normal BCM_PERIPH_BASE_VIRT bank
5859#define MCORE_BASE (BCM_PERIPH_BASE_VIRT + 0x0000)
5960
6061#define ST_CS (ST_BASE + 0x0)
7071#define IC0_SRC0 (IC0_BASE + 0x8)
7172#define IC0_SRC1 (IC0_BASE + 0xc)
7273#define IC0_VADDR (IC0_BASE + 0x30)
74+ #define IC0_WAKEUP (IC0_BASE + 0x34)
7375
7476#define IC1_C (IC1_BASE + 0x0)
7577#define IC1_S (IC1_BASE + 0x4)
7678#define IC1_SRC0 (IC1_BASE + 0x8)
7779#define IC1_SRC1 (IC1_BASE + 0xc)
7880#define IC1_VADDR (IC1_BASE + 0x30)
81+ #define IC1_WAKEUP (IC1_BASE + 0x34)
7982
8083#define PM_PASSWORD 0x5a000000
8184#define PM_RSTC (PM_BASE + 0x1c)
Original file line number Diff line number Diff line change @@ -5,12 +5,28 @@ MODULE := $(LOCAL_DIR)
55WITH_SMP := 1
66# LK_HEAP_IMPLEMENTATION ?= dlmalloc
77
8- ifeq ($(ARCJ ) ,arm)
9- MODULE_DEPS := \
8+ # 1st pass to set arch
9+ ifeq ($(TARGET ) ,rpi2)
10+ ARCH := arm
11+ ARM_CPU := cortex-a7
12+ GLOBAL_DEFINES += CRYSTAL=19200000
13+ else ifeq ($(TARGET),rpi3)
14+ ARCH := arm64
15+ ARM_CPU := cortex-a53
16+ GLOBAL_DEFINES += CRYSTAL=19200000
17+ else ifeq ($(TARGET),rpi4-vpu)
18+ ARCH ?= vc4
19+ GLOBAL_DEFINES += CRYSTAL=54000000
20+ endif
21+
22+
23+ ifeq ($(ARCH ) ,arm)
24+ MODULE_DEPS += \
1025 dev/timer/arm_generic \
1126 lib/cbuf
12- MODULE_SRCS +=
27+ MODULE_SRCS += \
1328 $(LOCAL_DIR ) /mailbox.c \
29+ $(LOCAL_DIR ) /intc.c \
1430
1531endif
1632
2440MODULE_SRCS += \
2541 $(LOCAL_DIR ) /gpio.c \
2642 $(LOCAL_DIR ) /platform.c \
27- # $(LOCAL_DIR)/intc.c \
2843
2944
3045MEMBASE := 0x00000000
@@ -36,8 +51,6 @@ LINKER_SCRIPT += \
3651 $(BUILDDIR ) /system-onesegment.ld
3752
3853ifeq ($(TARGET ) ,rpi2)
39- ARCH := arm
40- ARM_CPU := cortex-a7
4154# put our kernel at 0x80000000
4255KERNEL_BASE = 0x80000000
4356KERNEL_LOAD_OFFSET := 0x00008000
@@ -50,8 +63,6 @@ MODULE_SRCS += \
5063 $(LOCAL_DIR ) /uart.c
5164
5265else ifeq ($(TARGET),rpi3)
53- ARCH := arm64
54- ARM_CPU := cortex-a53
5566
5667KERNEL_LOAD_OFFSET := 0x00080000
5768MEMSIZE ?= 0x40000000 # 1GB
@@ -70,18 +81,17 @@ MODULE_DEPS += \
7081 app/tests \
7182 lib/fdt
7283else ifeq ($(TARGET),rpi4-vpu)
73- ARCH ?= vc4
7484MEMSIZE ?= 0x1400000 # 20MB
7585MEMBASE ?= 0
7686GLOBAL_DEFINES += \
7787 BCM2XXX_VPU=1 SMP_MAX_CPUS=1 \
7888 MEMSIZE=$(MEMSIZE ) \
7989 MEMBASE=$(MEMBASE ) \
80- CRYSTAL=54000000 \
8190
8291MODULE_SRCS += \
8392 $(LOCAL_DIR ) /uart.c \
8493 $(LOCAL_DIR ) /pll_read.c \
94+ $(LOCAL_DIR ) /genet.c \
8595
8696endif
8797
Original file line number Diff line number Diff line change @@ -102,7 +102,6 @@ void uart_init(void) {
102102 // assumes interrupts are contiguous
103103 register_int_handler (INTERRUPT_VC_UART + i , & uart_irq , (void * )i );
104104 uint32_t divisor = calculate_baud_divisor (115200 );
105- dprintf (INFO , "changing divisor to %d\n" , divisor );
106105
107106 uart_flush (i );
108107
You can’t perform that action at this time.
0 commit comments