Skip to content

Commit 3336413

Browse files
committed
drivers: udc_ambiq: Implemented UDC driver for apollo4p_blue
Added implementation for udc_ambiq with its dependencies: - udc_ambiq driver, along with required Kconfig and CMakeList updates - created ambiq,usb.yaml for dts binding - added usb node for apollo4p_blue mcu and apollo4p_blue_kxr_evb baord. Signed-off-by: Chew Zeh Yang <[email protected]>
1 parent 318b495 commit 3336413

File tree

9 files changed

+1022
-0
lines changed

9 files changed

+1022
-0
lines changed

boards/ambiq/apollo4p_blue_kxr_evb/apollo4p_blue_kxr_evb.dts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/dts-v1/;
22
#include <ambiq/ambiq_apollo4p_blue.dtsi>
3+
#include <zephyr/dt-bindings/input/input-event-codes.h>
34

45
#include "apollo4p_blue_kxr_evb-pinctrl.dtsi"
56

@@ -45,13 +46,18 @@
4546

4647
buttons {
4748
compatible = "gpio-keys";
49+
polling-mode;
4850
button0: button_0 {
4951
gpios = <&gpio0_31 17 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
5052
label = "BTN0";
53+
zephyr,code = <INPUT_KEY_0>;
54+
status = "okay";
5155
};
5256
button1: button_1 {
5357
gpios = <&gpio0_31 19 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
5458
label = "BTN1";
59+
zephyr,code = <INPUT_KEY_1>;
60+
status = "okay";
5561
};
5662
};
5763
};
@@ -129,6 +135,12 @@
129135
status = "okay";
130136
};
131137

138+
zephyr_udc0: &usb {
139+
vddusb33-gpios = <&gpio0_31 13 (GPIO_PULL_UP)>;
140+
vddusb0p9-gpios = <&gpio0_31 15 (GPIO_PULL_UP)>;
141+
status = "okay";
142+
};
143+
132144
&gpio0_31 {
133145
status = "okay";
134146
};

boards/ambiq/apollo4p_evb/apollo4p_evb.dts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/dts-v1/;
22
#include <ambiq/ambiq_apollo4p.dtsi>
3+
#include <zephyr/dt-bindings/input/input-event-codes.h>
34

45
#include "apollo4p_evb-pinctrl.dtsi"
56

@@ -45,13 +46,18 @@
4546

4647
buttons {
4748
compatible = "gpio-keys";
49+
polling-mode;
4850
button0: button_0 {
4951
gpios = <&gpio0_31 18 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
5052
label = "BTN0";
53+
zephyr,code = <INPUT_KEY_0>;
54+
status = "okay";
5155
};
5256
button1: button_1 {
5357
gpios = <&gpio0_31 19 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
5458
label = "BTN1";
59+
zephyr,code = <INPUT_KEY_1>;
60+
status = "okay";
5561
};
5662
};
5763
};

drivers/usb/udc/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,4 @@ zephyr_library_sources_ifdef(CONFIG_UDC_NXP_EHCI udc_mcux_ehci.c)
1717
zephyr_library_sources_ifdef(CONFIG_UDC_NXP_IP3511 udc_mcux_ip3511.c)
1818
zephyr_library_sources_ifdef(CONFIG_UDC_NUMAKER udc_numaker.c)
1919
zephyr_library_sources_ifdef(CONFIG_UDC_RPI_PICO udc_rpi_pico.c)
20+
zephyr_library_sources_ifdef(CONFIG_UDC_AMBIQ udc_ambiq.c)

drivers/usb/udc/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,5 +64,6 @@ source "drivers/usb/udc/Kconfig.it82xx2"
6464
source "drivers/usb/udc/Kconfig.mcux"
6565
source "drivers/usb/udc/Kconfig.numaker"
6666
source "drivers/usb/udc/Kconfig.rpi_pico"
67+
source "drivers/usb/udc/Kconfig.ambiq"
6768

6869
endif # UDC_DRIVER

drivers/usb/udc/Kconfig.ambiq

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Copyright (c) 2024 Ambiq Micro Inc.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
config UDC_AMBIQ
5+
bool "USB device controller driver for ambiq devices"
6+
default y
7+
depends on DT_HAS_AMBIQ_USB_ENABLED
8+
select GPIO
9+
select AMBIQ_HAL
10+
select AMBIQ_HAL_USE_USB
11+
help
12+
Enable USB Device Controller Driver.
13+
14+
config UDC_AMBIQ_STACK_SIZE
15+
int "UDC AMBIQ driver internal thread stack size"
16+
depends on UDC_AMBIQ
17+
default 2048
18+
help
19+
AMBIQ driver internal thread stack size.
20+
21+
config UDC_AMBIQ_THREAD_PRIORITY
22+
int "UDC AMBIQ driver thread priority"
23+
depends on UDC_AMBIQ
24+
default 8
25+
help
26+
AMBIQ driver thread priority.
27+
28+
29+
config UDC_AMBIQ_MAX_QMESSAGES
30+
int "UDC AMBIQ maximum number of ISR event messages"
31+
range 4 64
32+
default 8
33+
help
34+
AMBIQ maximum number of ISR event messages.

0 commit comments

Comments
 (0)