Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for UDC for Apollo4P family #79547

Merged
merged 4 commits into from
Nov 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions boards/ambiq/apollo4p_blue_kxr_evb/apollo4p_blue_kxr_evb.dts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/dts-v1/;
#include <ambiq/ambiq_apollo4p_blue.dtsi>
#include <zephyr/dt-bindings/input/input-event-codes.h>

#include "apollo4p_blue_kxr_evb-pinctrl.dtsi"

Expand Down Expand Up @@ -45,13 +46,18 @@

buttons {
compatible = "gpio-keys";
polling-mode;
button0: button_0 {
gpios = <&gpio0_31 17 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
label = "BTN0";
zephyr,code = <INPUT_KEY_0>;
status = "okay";
};
button1: button_1 {
gpios = <&gpio0_31 19 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
label = "BTN1";
zephyr,code = <INPUT_KEY_1>;
status = "okay";
jfischer-no marked this conversation as resolved.
Show resolved Hide resolved
};
};
};
Expand Down Expand Up @@ -131,6 +137,12 @@
status = "okay";
};

zephyr_udc0: &usb {
vddusb33-gpios = <&gpio0_31 13 (GPIO_PULL_UP)>;
vddusb0p9-gpios = <&gpio0_31 15 (GPIO_PULL_UP)>;
status = "okay";
};

&gpio0_31 {
status = "okay";
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ supported:
- i2c
- clock_control
- ble
- usbd
testing:
ignore_tags:
- net
Expand Down
12 changes: 12 additions & 0 deletions boards/ambiq/apollo4p_evb/apollo4p_evb.dts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/dts-v1/;
#include <ambiq/ambiq_apollo4p.dtsi>
#include <zephyr/dt-bindings/input/input-event-codes.h>

#include "apollo4p_evb-pinctrl.dtsi"

Expand Down Expand Up @@ -45,13 +46,18 @@

buttons {
compatible = "gpio-keys";
polling-mode;
button0: button_0 {
gpios = <&gpio0_31 18 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
label = "BTN0";
zephyr,code = <INPUT_KEY_0>;
status = "okay";
};
button1: button_1 {
gpios = <&gpio0_31 19 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
label = "BTN1";
zephyr,code = <INPUT_KEY_1>;
status = "okay";
};
};
};
Expand Down Expand Up @@ -137,6 +143,12 @@ compatible = "ambiq,adc";
};
};

zephyr_udc0: &usb {
vddusb33-gpios = <&gpio96_127 7 (GPIO_PULL_UP)>;
vddusb0p9-gpios = <&gpio96_127 5 (GPIO_PULL_UP)>;
status = "okay";
};

&gpio0_31 {
status = "okay";
};
Expand Down
1 change: 1 addition & 0 deletions boards/ambiq/apollo4p_evb/apollo4p_evb.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ supported:
- rtc
- adc
- hwinfo
- usbd
testing:
ignore_tags:
- net
Expand Down
1 change: 1 addition & 0 deletions drivers/usb/udc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ zephyr_library_sources_ifdef(CONFIG_UDC_NXP_EHCI udc_mcux_ehci.c)
zephyr_library_sources_ifdef(CONFIG_UDC_NXP_IP3511 udc_mcux_ip3511.c)
zephyr_library_sources_ifdef(CONFIG_UDC_NUMAKER udc_numaker.c)
zephyr_library_sources_ifdef(CONFIG_UDC_RPI_PICO udc_rpi_pico.c)
zephyr_library_sources_ifdef(CONFIG_UDC_AMBIQ udc_ambiq.c)
1 change: 1 addition & 0 deletions drivers/usb/udc/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -65,5 +65,6 @@ source "drivers/usb/udc/Kconfig.it82xx2"
source "drivers/usb/udc/Kconfig.mcux"
source "drivers/usb/udc/Kconfig.numaker"
source "drivers/usb/udc/Kconfig.rpi_pico"
source "drivers/usb/udc/Kconfig.ambiq"

endif # UDC_DRIVER
34 changes: 34 additions & 0 deletions drivers/usb/udc/Kconfig.ambiq
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Copyright (c) 2024 Ambiq Micro Inc.
# SPDX-License-Identifier: Apache-2.0

config UDC_AMBIQ
bool "USB device controller driver for ambiq devices"
default y
depends on DT_HAS_AMBIQ_USB_ENABLED
select GPIO
select AMBIQ_HAL
select AMBIQ_HAL_USE_USB
help
Enable USB Device Controller Driver.

config UDC_AMBIQ_STACK_SIZE
int "UDC AMBIQ driver internal thread stack size"
depends on UDC_AMBIQ
default 2048
help
AMBIQ driver internal thread stack size.

config UDC_AMBIQ_THREAD_PRIORITY
int "UDC AMBIQ driver thread priority"
depends on UDC_AMBIQ
default 8
help
AMBIQ driver thread priority.


config UDC_AMBIQ_MAX_QMESSAGES
int "UDC AMBIQ maximum number of ISR event messages"
range 4 64
default 8
help
AMBIQ maximum number of ISR event messages.
Loading
Loading