aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/host
diff options
context:
space:
mode:
authorDavid Vrabel <david.vrabel@csr.com>2009-10-12 11:45:18 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2009-12-11 14:55:16 -0500
commitc3f22d92a1249665d4cd87a68a4078a56002c3ab (patch)
tree40aab1a3bd032835551bf6c97c21921294536960 /drivers/usb/host
parentd19fc291929aae528a40dd17c71a81f26254715d (diff)
USB: wusb: add wusb_phy_rate sysfs file to host controllers
Add the wusb_phy_rate sysfs file to Wireless USB host controllers. This sets the maximum PHY rate that will be used for all connected devices. Signed-off-by: David Vrabel <david.vrabel@csr.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/host')
-rw-r--r--drivers/usb/host/whci/qset.c24
-rw-r--r--drivers/usb/host/whci/whci-hc.h9
2 files changed, 22 insertions, 11 deletions
diff --git a/drivers/usb/host/whci/qset.c b/drivers/usb/host/whci/qset.c
index 08280869ed1c..39e855a55c63 100644
--- a/drivers/usb/host/whci/qset.c
+++ b/drivers/usb/host/whci/qset.c
@@ -49,11 +49,13 @@ struct whc_qset *qset_alloc(struct whc *whc, gfp_t mem_flags)
49 * state 49 * state
50 * @urb: an urb for a transfer to this endpoint 50 * @urb: an urb for a transfer to this endpoint
51 */ 51 */
52static void qset_fill_qh(struct whc_qset *qset, struct urb *urb) 52static void qset_fill_qh(struct whc *whc, struct whc_qset *qset, struct urb *urb)
53{ 53{
54 struct usb_device *usb_dev = urb->dev; 54 struct usb_device *usb_dev = urb->dev;
55 struct wusb_dev *wusb_dev = usb_dev->wusb_dev;
55 struct usb_wireless_ep_comp_descriptor *epcd; 56 struct usb_wireless_ep_comp_descriptor *epcd;
56 bool is_out; 57 bool is_out;
58 uint8_t phy_rate;
57 59
58 is_out = usb_pipeout(urb->pipe); 60 is_out = usb_pipeout(urb->pipe);
59 61
@@ -68,6 +70,22 @@ static void qset_fill_qh(struct whc_qset *qset, struct urb *urb)
68 qset->max_burst = 1; 70 qset->max_burst = 1;
69 } 71 }
70 72
73 /*
74 * Initial PHY rate is 53.3 Mbit/s for control endpoints or
75 * the maximum supported by the device for other endpoints
76 * (unless limited by the user).
77 */
78 if (usb_pipecontrol(urb->pipe))
79 phy_rate = UWB_PHY_RATE_53;
80 else {
81 uint16_t phy_rates;
82
83 phy_rates = le16_to_cpu(wusb_dev->wusb_cap_descr->wPHYRates);
84 phy_rate = fls(phy_rates) - 1;
85 if (phy_rate > whc->wusbhc.phy_rate)
86 phy_rate = whc->wusbhc.phy_rate;
87 }
88
71 qset->qh.info1 = cpu_to_le32( 89 qset->qh.info1 = cpu_to_le32(
72 QH_INFO1_EP(usb_pipeendpoint(urb->pipe)) 90 QH_INFO1_EP(usb_pipeendpoint(urb->pipe))
73 | (is_out ? QH_INFO1_DIR_OUT : QH_INFO1_DIR_IN) 91 | (is_out ? QH_INFO1_DIR_OUT : QH_INFO1_DIR_IN)
@@ -87,7 +105,7 @@ static void qset_fill_qh(struct whc_qset *qset, struct urb *urb)
87 * strength and can presumably guess the Tx power required 105 * strength and can presumably guess the Tx power required
88 * from that? */ 106 * from that? */
89 qset->qh.info3 = cpu_to_le32( 107 qset->qh.info3 = cpu_to_le32(
90 QH_INFO3_TX_RATE_53_3 108 QH_INFO3_TX_RATE(phy_rate)
91 | QH_INFO3_TX_PWR(0) /* 0 == max power */ 109 | QH_INFO3_TX_PWR(0) /* 0 == max power */
92 ); 110 );
93 111
@@ -149,7 +167,7 @@ struct whc_qset *get_qset(struct whc *whc, struct urb *urb,
149 167
150 qset->ep = urb->ep; 168 qset->ep = urb->ep;
151 urb->ep->hcpriv = qset; 169 urb->ep->hcpriv = qset;
152 qset_fill_qh(qset, urb); 170 qset_fill_qh(whc, qset, urb);
153 } 171 }
154 return qset; 172 return qset;
155} 173}
diff --git a/drivers/usb/host/whci/whci-hc.h b/drivers/usb/host/whci/whci-hc.h
index d5e5c3aacced..4d4cbc0730bf 100644
--- a/drivers/usb/host/whci/whci-hc.h
+++ b/drivers/usb/host/whci/whci-hc.h
@@ -172,14 +172,7 @@ struct whc_qhead {
172#define QH_INFO3_MAX_DELAY(d) ((d) << 0) /* maximum stream delay in 125 us units (isoc only) */ 172#define QH_INFO3_MAX_DELAY(d) ((d) << 0) /* maximum stream delay in 125 us units (isoc only) */
173#define QH_INFO3_INTERVAL(i) ((i) << 16) /* segment interval in 125 us units (isoc only) */ 173#define QH_INFO3_INTERVAL(i) ((i) << 16) /* segment interval in 125 us units (isoc only) */
174 174
175#define QH_INFO3_TX_RATE_53_3 (0 << 24) 175#define QH_INFO3_TX_RATE(r) ((r) << 24) /* PHY rate (see [ECMA-368] section 10.3.1.1) */
176#define QH_INFO3_TX_RATE_80 (1 << 24)
177#define QH_INFO3_TX_RATE_106_7 (2 << 24)
178#define QH_INFO3_TX_RATE_160 (3 << 24)
179#define QH_INFO3_TX_RATE_200 (4 << 24)
180#define QH_INFO3_TX_RATE_320 (5 << 24)
181#define QH_INFO3_TX_RATE_400 (6 << 24)
182#define QH_INFO3_TX_RATE_480 (7 << 24)
183#define QH_INFO3_TX_PWR(p) ((p) << 29) /* transmit power (see [WUSB] section 5.2.1.2) */ 176#define QH_INFO3_TX_PWR(p) ((p) << 29) /* transmit power (see [WUSB] section 5.2.1.2) */
184 177
185#define QH_STATUS_FLOW_CTRL (1 << 15) 178#define QH_STATUS_FLOW_CTRL (1 << 15)