-
Notifications
You must be signed in to change notification settings - Fork 5.4k
[DM/PHYE] Support USB generic PHYE. #10997
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,232 @@ | ||||||||||||||||||
| /* | ||||||||||||||||||
|
||||||||||||||||||
| * Copyright (c) 2006-2022, RT-Thread Development Team | ||||||||||||||||||
| * | ||||||||||||||||||
| * SPDX-License-Identifier: Apache-2.0 | ||||||||||||||||||
| * | ||||||||||||||||||
| * Change Logs: | ||||||||||||||||||
| * Date Author Notes | ||||||||||||||||||
| * 2022-10-24 GuEe-GUI first version | ||||||||||||||||||
| */ | ||||||||||||||||||
|
|
||||||||||||||||||
| #include <rtdevice.h> | ||||||||||||||||||
| #include <rtthread.h> | ||||||||||||||||||
|
|
||||||||||||||||||
| #define DBG_TAG "phye.generic.usb" | ||||||||||||||||||
|
GuEe-GUI marked this conversation as resolved.
|
||||||||||||||||||
| #define DBG_LVL DBG_INFO | ||||||||||||||||||
| #include <rtdbg.h> | ||||||||||||||||||
|
|
||||||||||||||||||
| struct generic_usb_phy | ||||||||||||||||||
| { | ||||||||||||||||||
| struct rt_phye parent; | ||||||||||||||||||
|
|
||||||||||||||||||
| rt_base_t rst_pin; | ||||||||||||||||||
| rt_uint8_t rst_active_val; | ||||||||||||||||||
|
|
||||||||||||||||||
| struct rt_clk *clk; | ||||||||||||||||||
| struct rt_regulator *vcc; | ||||||||||||||||||
| struct rt_regulator *vbus; | ||||||||||||||||||
| }; | ||||||||||||||||||
|
|
||||||||||||||||||
| #define raw_to_generic_usb_phy(raw) rt_container_of(raw, struct generic_usb_phy, parent) | ||||||||||||||||||
|
|
||||||||||||||||||
| static rt_err_t generic_usb_phy_reset(struct rt_phye *phye) | ||||||||||||||||||
| { | ||||||||||||||||||
| struct generic_usb_phy *usb_phy = raw_to_generic_usb_phy(phye); | ||||||||||||||||||
|
|
||||||||||||||||||
| if (usb_phy->rst_pin == PIN_NONE) | ||||||||||||||||||
| { | ||||||||||||||||||
| return RT_EOK; | ||||||||||||||||||
| } | ||||||||||||||||||
|
|
||||||||||||||||||
| rt_pin_mode(usb_phy->rst_pin, PIN_MODE_OUTPUT); | ||||||||||||||||||
|
|
||||||||||||||||||
| rt_pin_write(usb_phy->rst_pin, usb_phy->rst_active_val); | ||||||||||||||||||
| rt_hw_us_delay(15000); | ||||||||||||||||||
|
|
||||||||||||||||||
|
GuEe-GUI marked this conversation as resolved.
|
||||||||||||||||||
| rt_pin_write(usb_phy->rst_pin, !usb_phy->rst_active_val); | ||||||||||||||||||
| rt_hw_us_delay(20000); | ||||||||||||||||||
|
Comment on lines
+44
to
+47
|
||||||||||||||||||
| rt_hw_us_delay(15000); | |
| rt_pin_write(nop->rst_pin, !nop->rst_active_val); | |
| rt_hw_us_delay(20000); | |
| rt_thread_mdelay(15); /* Use thread delay instead of busy-wait */ | |
| rt_pin_write(nop->rst_pin, !nop->rst_active_val); | |
| rt_thread_mdelay(20); |
Uh oh!
There was an error while loading. Please reload this page.