X-Git-Url: https://jxself.org/git/?a=blobdiff_plain;f=carlfw%2Fusb%2Fusb.c;h=12b487b278294b3e93e5901d6d2932c806ecdecd;hb=c97d09577cb82ffc5deda208163ecbee12f76037;hp=49852fb70611a318d4410cf66d1e3c9855c688f8;hpb=e72388a0aa23da8bc8e24a0cbe9d523c5a9ce294;p=carl9170fw.git diff --git a/carlfw/usb/usb.c b/carlfw/usb/usb.c index 49852fb..12b487b 100644 --- a/carlfw/usb/usb.c +++ b/carlfw/usb/usb.c @@ -184,6 +184,7 @@ static void usb_reset_eps(void) #ifdef CONFIG_CARL9170FW_USB_INIT_FIRMWARE static void usb_pta_init(void) { + unsigned int usb_dma_ctrl = 0; /* Set PTA mode to USB */ andl(AR9170_PTA_REG_DMA_MODE_CTRL, ~AR9170_PTA_DMA_MODE_CTRL_DISABLE_USB); @@ -197,44 +198,34 @@ static void usb_pta_init(void) fw.usb.cfg_desc = &usb_config_highspeed; /* 512 Byte DMA transfers */ - orl(AR9170_USB_REG_DMA_CTL, AR9170_DMA_CTL_HIGH_SPEED); + usb_dma_ctrl |= AR9170_USB_DMA_CTL_HIGH_SPEED; } else { fw.usb.cfg_desc = &usb_config_fullspeed; fw.usb.os_cfg_desc = &usb_config_highspeed; } #ifdef CONFIG_CARL9170FW_USB_UP_STREAM - /* Enable upload stream mode */ - andl(AR9170_USB_REG_DMA_CTL, ~AR9170_DMA_CTL_UP_PACKET_MODE); - - /* reset maximum transfer size */ - andl(AR9170_USB_REG_DMA_CTL, ~(AR9170_DMA_CTL_UP_STREAM_MASK)); - # if (CONFIG_CARL9170FW_RX_FRAME_LEN == 4096) - orl(AR9170_USB_REG_DMA_CTL, AR9170_DMA_CTL_UP_STREAM_4K); + usb_dma_ctrl |= AR9170_USB_DMA_CTL_UP_STREAM_4K; # elif (CONFIG_CARL9170FW_RX_FRAME_LEN == 8192) - orl(AR9170_USB_REG_DMA_CTL, AR9170_DMA_CTL_UP_STREAM_8K); + usb_dma_ctrl |= AR9170_USB_DMA_CTL_UP_STREAM_8K; # elif (CONFIG_CARL9170FW_RX_FRAME_LEN == 16384) - orl(AR9170_USB_REG_DMA_CTL, AR9170_DMA_CTL_UP_STREAM_16K); + usb_dma_ctrl |= AR9170_USB_DMA_CTL_UP_STREAM_16K; # elif (CONFIG_CARL9170FW_RX_FRAME_LEN == 32768) - orl(AR9170_USB_REG_DMA_CTL, AR9170_DMA_CTL_UP_STREAM_32K); + usb_dma_ctrl |= AR9170_USB_DMA_CTL_UP_STREAM_32K; # else # error "Invalid AR9170_RX_FRAME_LEN setting" # endif #else /* CONFIG_CARL9170FW_USB_UP_STREAM */ - orl(AR9170_USB_REG_DMA_CTL, AR9170_DMA_CTL_UP_PACKET_MODE); + usb_dma_ctrl |= AR9170_USB_DMA_CTL_UP_PACKET_MODE; #endif /* CONFIG_CARL9170FW_USB_UP_STREAM */ #ifdef CONFIG_CARL9170FW_USB_DOWN_STREAM /* Enable down stream mode */ - orl(AR9170_USB_REG_DMA_CTL, AR9170_DMA_CTL_DOWN_STREAM); + usb_dma_ctrl |= AR9170_USB_DMA_CTL_DOWN_STREAM; #endif /* CONFIG_CARL9170FW_USB_DOWN_STREAM */ - /* Enable up stream and down stream */ - orl(AR9170_USB_REG_DMA_CTL, AR9170_DMA_CTL_ENABLE_TO_DEVICE | - AR9170_DMA_CTL_ENABLE_FROM_DEVICE); - #ifdef CONFIG_CARL9170FW_USB_UP_STREAM /* Set the up stream mode maximum aggregate number */ set(AR9170_USB_REG_MAX_AGG_UPLOAD, 4); @@ -246,6 +237,11 @@ static void usb_pta_init(void) set(AR9170_USB_REG_UPLOAD_TIME_CTL, 0x80); #endif /* CONFIG_CARL9170FW_USB_UP_STREAM */ + /* Enable up stream and down stream */ + usb_dma_ctrl |= AR9170_USB_DMA_CTL_ENABLE_TO_DEVICE | + AR9170_USB_DMA_CTL_ENABLE_FROM_DEVICE; + + set(AR9170_USB_REG_DMA_CTL, usb_dma_ctrl); } #endif /* CONFIG_CARL9170FW_USB_INIT_FIRMWARE */