summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Shawcroft <[email protected]>2021-10-05 18:20:44 -0700
committerScott Shawcroft <[email protected]>2021-10-05 18:20:44 -0700
commit98ab8117d68f05bb36b9aeb857273e896199bc6a (patch)
tree6a18def74b954c9d5273be9fa48b6405526cfb62
parent0932d502c78796762a7d4ec7ee709707ede83dc8 (diff)
USB seems to init ok
-rw-r--r--.gitmodules4
-rw-r--r--hw/bsp/raspberrypi4/family.c18
-rw-r--r--hw/bsp/raspberrypi4/family.mk16
m---------hw/mcu/broadcom0
4 files changed, 25 insertions, 13 deletions
diff --git a/.gitmodules b/.gitmodules
index 4c86fd55c..95f35d270 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -127,3 +127,7 @@
[submodule "hw/mcu/gd/nuclei-sdk"]
path = hw/mcu/gd/nuclei-sdk
url = https://github.com/Nuclei-Software/nuclei-sdk.git
+[submodule "hw/mcu/broadcom"]
+ path = hw/mcu/broadcom
+ url = [email protected]:adafruit/broadcom-peripherals.git
+ branch = main-build
diff --git a/hw/bsp/raspberrypi4/family.c b/hw/bsp/raspberrypi4/family.c
index 6266d5a35..fe7e429d6 100644
--- a/hw/bsp/raspberrypi4/family.c
+++ b/hw/bsp/raspberrypi4/family.c
@@ -27,8 +27,9 @@
#include "bsp/board.h"
#include "board.h"
-#include "io.h"
-#include "mmu.h"
+#include "broadcom/io.h"
+#include "broadcom/mmu.h"
+#include "broadcom/vcmailbox.h"
//--------------------------------------------------------------------+
// Forward USB interrupt events to TinyUSB IRQ Handler
@@ -46,9 +47,8 @@ void OTG_FS_IRQHandler(void)
// Board porting API
//--------------------------------------------------------------------+
-void print(void) {
- const char* greeting2 = "hello from cm100\r\n";
- board_uart_write(greeting2, strlen(greeting2));
+void print(const char* str) {
+ board_uart_write(str, strlen(str));
}
void board_init(void)
@@ -83,7 +83,7 @@ void board_init(void)
board_uart_write(greeting, strlen(greeting));
// gpio_setPinOutputBool(24, false);
// gpio_setPinOutputBool(25, true);
- print();
+ // print();
// gpio_setPinOutputBool(25, false);
// while (true) {
// // for (size_t i = 0; i < 5; i++) {
@@ -97,6 +97,12 @@ void board_init(void)
// gpio_setPinOutputBool(42, false);
// }
// while (1) uart_update();
+
+ // Turn on USB peripheral.
+ print("Turning on USB power\r\n");
+
+ vcmailbox_set_power_state(VCMAILBOX_DEVICE_USB_HCD, true);
+ print("USB power on\r\n");
}
void board_led_write(bool state)
diff --git a/hw/bsp/raspberrypi4/family.mk b/hw/bsp/raspberrypi4/family.mk
index 1547beee1..b36a83b48 100644
--- a/hw/bsp/raspberrypi4/family.mk
+++ b/hw/bsp/raspberrypi4/family.mk
@@ -2,7 +2,7 @@ UF2_FAMILY_ID = 0x57755a57
include $(TOP)/$(BOARD_PATH)/board.mk
-MCU_DIR = hw/mcu/broadcom/bcm2711
+MCU_DIR = hw/mcu/broadcom
CC = clang
@@ -18,21 +18,23 @@ CFLAGS += \
SRC_C += \
src/portable/broadcom/synopsys/dcd_synopsys.c \
- $(MCU_DIR)/interrupts.c \
- $(MCU_DIR)/io.c \
- $(MCU_DIR)/mmu.c
+ $(MCU_DIR)/broadcom/interrupts.c \
+ $(MCU_DIR)/broadcom/io.c \
+ $(MCU_DIR)/broadcom/mmu.c \
+ $(MCU_DIR)/broadcom/vcmailbox.c
CROSS_COMPILE = aarch64-none-elf-
SKIP_NANOLIB = 1
-LD_FILE = $(MCU_DIR)/link.ld
+LD_FILE = $(MCU_DIR)/broadcom/link.ld
INC += \
$(TOP)/$(BOARD_PATH) \
- $(TOP)/$(MCU_DIR)
+ $(TOP)/$(MCU_DIR) \
+ $(TOP)/lib/CMSIS_5/CMSIS/Core_A/Include
-SRC_S += $(MCU_DIR)/boot.S
+SRC_S += $(MCU_DIR)/broadcom/boot.S
$(BUILD)/kernel8.img: $(BUILD)/$(PROJECT).elf
$(OBJCOPY) -O binary $^ $@
diff --git a/hw/mcu/broadcom b/hw/mcu/broadcom
new file mode 160000
+Subproject c24e8f6898d7cf8e2884eb70dbabd9748052645