X-Git-Url: https://jxself.org/git/?p=carl9170fw.git;a=blobdiff_plain;f=carlfw%2Fusb%2Fusb.c;h=aedf30d1404830bb989e9ba8caeb4a459aee5fc1;hp=0c66b8275b636e91d0a0c94e4070c32777ed6e68;hb=f99b6fd51bf8429eaad357ac9c7149a92f719628;hpb=656a71a36fc390a2b8e643f07ef88e9caf05a36f diff --git a/carlfw/usb/usb.c b/carlfw/usb/usb.c index 0c66b82..aedf30d 100644 --- a/carlfw/usb/usb.c +++ b/carlfw/usb/usb.c @@ -19,8 +19,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * with this program; If not, see . */ #include "carl9170.h" #include "usb.h" @@ -159,15 +158,14 @@ static struct ar9170_usb_config usb_config_fullspeed = { .bLength = USB_DT_ENDPOINT_SIZE, .bDescriptorType = USB_DT_ENDPOINT, .bEndpointAddress = USB_DIR_OUT | AR9170_USB_EP_CMD, - .bmAttributes = USB_ENDPOINT_XFER_INT, + .bmAttributes = USB_ENDPOINT_XFER_BULK, .wMaxPacketSize = cpu_to_le16(64), .bInterval = 1, }, }, }; -#ifdef CONFIG_CARL9170FW_USB_MODESWITCH -static void usb_reset_eps(void) +void usb_reset_eps(void) { unsigned int i; @@ -188,8 +186,6 @@ static void usb_reset_eps(void) usb_clear_output_ep_stall(i); } } -#endif /* CONFIG_CARL9170FW_USB_MODESWITCH */ - static void usb_pta_init(void) { @@ -503,7 +499,7 @@ static int usb_get_configuration(const struct usb_ctrlrequest *ctrl) if (USB_CHECK_REQTYPE(ctrl, USB_RECIP_DEVICE, USB_DIR_IN)) return -1; - return usb_ep0tx_data(&fw.usb.config, 1); + return usb_ep0tx_data(&fw.usb.config, fw.usb.config); } static int usb_set_configuration(const struct usb_ctrlrequest *ctrl) @@ -519,10 +515,11 @@ static int usb_set_configuration(const struct usb_ctrlrequest *ctrl) /* Disable Device */ andb(AR9170_USB_REG_DEVICE_ADDRESS, (uint8_t) ~(AR9170_USB_DEVICE_ADDRESS_CONFIGURE)); -#ifdef CONFIG_CARL9170FW_USB_MODESWITCH + /* fall through */ case 1: fw.usb.config = config; +#ifdef CONFIG_CARL9170FW_USB_MODESWITCH if (usb_detect_highspeed()) { /* High Speed Configuration */ usb_init_highspeed_fifo_cfg(); @@ -530,25 +527,20 @@ static int usb_set_configuration(const struct usb_ctrlrequest *ctrl) /* Full Speed Configuration */ usb_init_fullspeed_fifo_cfg(); } - break; + /* usb_pta_init() ? */ +#endif /* CONFIG_CARL9170FW_USB_MODESWITCH */ - default: - return -1; - } - /* usb_pta_init() ? */ + usb_reset_eps(); + orb(AR9170_USB_REG_DEVICE_ADDRESS, + (AR9170_USB_DEVICE_ADDRESS_CONFIGURE)); - usb_reset_eps(); - orb(AR9170_USB_REG_DEVICE_ADDRESS, - (AR9170_USB_DEVICE_ADDRESS_CONFIGURE)); + usb_enable_global_int(); + usb_trigger_out(); + return 1; - usb_enable_global_int(); - usb_trigger_out(); - return 1; -#else default: return -1; } -#endif /* CONFIG_CARL9170FW_USB_MODESWITCH */ } static int usb_set_address(const struct usb_ctrlrequest *ctrl)