@@ -1044,6 +1044,18 @@ static int udc_rpi_pico_enable(const struct device *dev)
1044
1044
USB_USB_PWR_VBUS_DETECT_OVERRIDE_EN_BITS , (mm_reg_t )& base -> pwr );
1045
1045
}
1046
1046
1047
+ if (udc_ep_enable_internal (dev , USB_CONTROL_EP_OUT ,
1048
+ USB_EP_TYPE_CONTROL , 64 , 0 )) {
1049
+ LOG_ERR ("Failed to enable control endpoint" );
1050
+ return - EIO ;
1051
+ }
1052
+
1053
+ if (udc_ep_enable_internal (dev , USB_CONTROL_EP_IN ,
1054
+ USB_EP_TYPE_CONTROL , 64 , 0 )) {
1055
+ LOG_ERR ("Failed to enable control endpoint" );
1056
+ return - EIO ;
1057
+ }
1058
+
1047
1059
/* Enable an interrupt per EP0 transaction */
1048
1060
sys_write32 (USB_SIE_CTRL_EP0_INT_1BUF_BITS , (mm_reg_t )& base -> sie_ctrl );
1049
1061
@@ -1082,6 +1094,16 @@ static int udc_rpi_pico_disable(const struct device *dev)
1082
1094
{
1083
1095
const struct rpi_pico_config * config = dev -> config ;
1084
1096
1097
+ if (udc_ep_disable_internal (dev , USB_CONTROL_EP_OUT )) {
1098
+ LOG_ERR ("Failed to disable control endpoint" );
1099
+ return - EIO ;
1100
+ }
1101
+
1102
+ if (udc_ep_disable_internal (dev , USB_CONTROL_EP_IN )) {
1103
+ LOG_ERR ("Failed to disable control endpoint" );
1104
+ return - EIO ;
1105
+ }
1106
+
1085
1107
config -> irq_disable_func (dev );
1086
1108
LOG_DBG ("Disable device %p" , dev );
1087
1109
@@ -1094,18 +1116,6 @@ static int udc_rpi_pico_init(const struct device *dev)
1094
1116
const struct pinctrl_dev_config * const pcfg = config -> pcfg ;
1095
1117
int err ;
1096
1118
1097
- if (udc_ep_enable_internal (dev , USB_CONTROL_EP_OUT ,
1098
- USB_EP_TYPE_CONTROL , 64 , 0 )) {
1099
- LOG_ERR ("Failed to enable control endpoint" );
1100
- return - EIO ;
1101
- }
1102
-
1103
- if (udc_ep_enable_internal (dev , USB_CONTROL_EP_IN ,
1104
- USB_EP_TYPE_CONTROL , 64 , 0 )) {
1105
- LOG_ERR ("Failed to enable control endpoint" );
1106
- return - EIO ;
1107
- }
1108
-
1109
1119
if (pcfg != NULL ) {
1110
1120
err = pinctrl_apply_state (pcfg , PINCTRL_STATE_DEFAULT );
1111
1121
if (err ) {
@@ -1121,16 +1131,6 @@ static int udc_rpi_pico_shutdown(const struct device *dev)
1121
1131
{
1122
1132
const struct rpi_pico_config * config = dev -> config ;
1123
1133
1124
- if (udc_ep_disable_internal (dev , USB_CONTROL_EP_OUT )) {
1125
- LOG_ERR ("Failed to disable control endpoint" );
1126
- return - EIO ;
1127
- }
1128
-
1129
- if (udc_ep_disable_internal (dev , USB_CONTROL_EP_IN )) {
1130
- LOG_ERR ("Failed to disable control endpoint" );
1131
- return - EIO ;
1132
- }
1133
-
1134
1134
return clock_control_off (config -> clk_dev , config -> clk_sys );
1135
1135
}
1136
1136
0 commit comments