aboutsummaryrefslogtreecommitdiffstats
path: root/usb
diff options
authorGreg Kroah-Hartman <gregkh@suse.de>2009-10-26 16:56:47 -0700
committerGreg Kroah-Hartman <gregkh@suse.de>2009-10-26 16:56:47 -0700
commitd93ada0e086cc8b5de957b5dfaeb1247489f1717 (patch)
tree8cf9190742b3f65908582f829ec69e94be4fb77c /usb
parent8900d1017b45890db769237176dec16a05e2fc8b (diff)
downloadpatches-d93ada0e086cc8b5de957b5dfaeb1247489f1717.tar.gz
lots more staging and other patches
Diffstat (limited to 'usb')
-rw-r--r--usb/usb-whci-hcd-decode-more-qhead-fields-in-the-debug-files.patch55
-rw-r--r--usb/usb-wusb-add-wusb_phy_rate-sysfs-file-to-host-controllers.patch180
2 files changed, 235 insertions, 0 deletions
diff --git a/usb/usb-whci-hcd-decode-more-qhead-fields-in-the-debug-files.patch b/usb/usb-whci-hcd-decode-more-qhead-fields-in-the-debug-files.patch
new file mode 100644
index 00000000000000..3791730a30161f
--- /dev/null
+++ b/usb/usb-whci-hcd-decode-more-qhead-fields-in-the-debug-files.patch
@@ -0,0 +1,55 @@
+From david.vrabel@csr.com Mon Oct 26 16:27:30 2009
+From: David Vrabel <david.vrabel@csr.com>
+Date: Mon, 12 Oct 2009 15:45:17 +0000
+Subject: usb: whci-hcd: decode more QHead fields in the debug files
+To: Greg KH <gregkh@suse.de>
+Cc: linux-usb@vger.kernel.org, David Vrabel <david.vrabel@csr.com>
+Message-ID: <1255362318-10226-6-git-send-email-david.vrabel@csr.com>
+
+
+Print ep number, direction and type; and current window in asl and pzl
+debugfs files.
+
+Signed-off-by: David Vrabel <david.vrabel@csr.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/usb/host/whci/debug.c | 20 ++++++++++++++++----
+ 1 file changed, 16 insertions(+), 4 deletions(-)
+
+--- a/drivers/usb/host/whci/debug.c
++++ b/drivers/usb/host/whci/debug.c
+@@ -31,17 +31,29 @@ struct whc_dbg {
+
+ void qset_print(struct seq_file *s, struct whc_qset *qset)
+ {
++ static const char *qh_type[] = {
++ "ctrl", "isoc", "bulk", "intr", "rsvd", "rsvd", "rsvd", "lpintr", };
+ struct whc_std *std;
+ struct urb *urb = NULL;
+ int i;
+
+- seq_printf(s, "qset %08x\n", (u32)qset->qset_dma);
++ seq_printf(s, "qset %08x", (u32)qset->qset_dma);
++ if (&qset->list_node == qset->whc->async_list.prev) {
++ seq_printf(s, " (dummy)\n");
++ } else {
++ seq_printf(s, " ep%d%s-%s maxpkt: %d\n",
++ qset->qh.info1 & 0x0f,
++ (qset->qh.info1 >> 4) & 0x1 ? "in" : "out",
++ qh_type[(qset->qh.info1 >> 5) & 0x7],
++ (qset->qh.info1 >> 16) & 0xffff);
++ }
+ seq_printf(s, " -> %08x\n", (u32)qset->qh.link);
+ seq_printf(s, " info: %08x %08x %08x\n",
+- qset->qh.info1, qset->qh.info2, qset->qh.info3);
+- seq_printf(s, " sts: %04x errs: %d\n", qset->qh.status, qset->qh.err_count);
++ qset->qh.info1, qset->qh.info2, qset->qh.info3);
++ seq_printf(s, " sts: %04x errs: %d curwin: %08x\n",
++ qset->qh.status, qset->qh.err_count, qset->qh.cur_window);
+ seq_printf(s, " TD: sts: %08x opts: %08x\n",
+- qset->qh.overlay.qtd.status, qset->qh.overlay.qtd.options);
++ qset->qh.overlay.qtd.status, qset->qh.overlay.qtd.options);
+
+ for (i = 0; i < WHCI_QSET_TD_MAX; i++) {
+ seq_printf(s, " %c%c TD[%d]: sts: %08x opts: %08x ptr: %08x\n",
diff --git a/usb/usb-wusb-add-wusb_phy_rate-sysfs-file-to-host-controllers.patch b/usb/usb-wusb-add-wusb_phy_rate-sysfs-file-to-host-controllers.patch
new file mode 100644
index 00000000000000..d6820566615d76
--- /dev/null
+++ b/usb/usb-wusb-add-wusb_phy_rate-sysfs-file-to-host-controllers.patch
@@ -0,0 +1,180 @@
+From david.vrabel@csr.com Mon Oct 26 16:27:41 2009
+From: David Vrabel <david.vrabel@csr.com>
+Date: Mon, 12 Oct 2009 15:45:18 +0000
+Subject: USB: wusb: add wusb_phy_rate sysfs file to host controllers
+To: Greg KH <gregkh@suse.de>
+Cc: linux-usb@vger.kernel.org, David Vrabel <david.vrabel@csr.com>
+Message-ID: <1255362318-10226-7-git-send-email-david.vrabel@csr.com>
+
+
+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>
+
+---
+ Documentation/ABI/testing/sysfs-class-uwb_rc-wusbhc | 13 ++++++++
+ drivers/usb/host/whci/qset.c | 24 +++++++++++++--
+ drivers/usb/host/whci/whci-hc.h | 9 -----
+ drivers/usb/wusbcore/wusbhc.c | 32 ++++++++++++++++++++
+ drivers/usb/wusbcore/wusbhc.h | 1
+ 5 files changed, 68 insertions(+), 11 deletions(-)
+
+--- a/Documentation/ABI/testing/sysfs-class-uwb_rc-wusbhc
++++ b/Documentation/ABI/testing/sysfs-class-uwb_rc-wusbhc
+@@ -23,3 +23,16 @@ Description:
+ Since this relates to security (specifically, the
+ lifetime of PTKs and GTKs) it should not be changed
+ from the default.
++
++What: /sys/class/uwb_rc/uwbN/wusbhc/wusb_phy_rate
++Date: August 2009
++KernelVersion: 2.6.32
++Contact: David Vrabel <david.vrabel@csr.com>
++Description:
++ The maximum PHY rate to use for all connected devices.
++ This is only of limited use for testing and
++ development as the hardware's automatic rate
++ adaptation is better then this simple control.
++
++ Refer to [ECMA-368] section 10.3.1.1 for the value to
++ use.
+--- 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 *
+ * state
+ * @urb: an urb for a transfer to this endpoint
+ */
+-static void qset_fill_qh(struct whc_qset *qset, struct urb *urb)
++static void qset_fill_qh(struct whc *whc, struct whc_qset *qset, struct urb *urb)
+ {
+ struct usb_device *usb_dev = urb->dev;
++ struct wusb_dev *wusb_dev = usb_dev->wusb_dev;
+ struct usb_wireless_ep_comp_descriptor *epcd;
+ bool is_out;
++ uint8_t phy_rate;
+
+ is_out = usb_pipeout(urb->pipe);
+
+@@ -68,6 +70,22 @@ static void qset_fill_qh(struct whc_qset
+ qset->max_burst = 1;
+ }
+
++ /*
++ * Initial PHY rate is 53.3 Mbit/s for control endpoints or
++ * the maximum supported by the device for other endpoints
++ * (unless limited by the user).
++ */
++ if (usb_pipecontrol(urb->pipe))
++ phy_rate = UWB_PHY_RATE_53;
++ else {
++ uint16_t phy_rates;
++
++ phy_rates = le16_to_cpu(wusb_dev->wusb_cap_descr->wPHYRates);
++ phy_rate = fls(phy_rates) - 1;
++ if (phy_rate > whc->wusbhc.phy_rate)
++ phy_rate = whc->wusbhc.phy_rate;
++ }
++
+ qset->qh.info1 = cpu_to_le32(
+ QH_INFO1_EP(usb_pipeendpoint(urb->pipe))
+ | (is_out ? QH_INFO1_DIR_OUT : QH_INFO1_DIR_IN)
+@@ -87,7 +105,7 @@ static void qset_fill_qh(struct whc_qset
+ * strength and can presumably guess the Tx power required
+ * from that? */
+ qset->qh.info3 = cpu_to_le32(
+- QH_INFO3_TX_RATE_53_3
++ QH_INFO3_TX_RATE(phy_rate)
+ | QH_INFO3_TX_PWR(0) /* 0 == max power */
+ );
+
+@@ -149,7 +167,7 @@ struct whc_qset *get_qset(struct whc *wh
+
+ qset->ep = urb->ep;
+ urb->ep->hcpriv = qset;
+- qset_fill_qh(qset, urb);
++ qset_fill_qh(whc, qset, urb);
+ }
+ return qset;
+ }
+--- a/drivers/usb/host/whci/whci-hc.h
++++ b/drivers/usb/host/whci/whci-hc.h
+@@ -172,14 +172,7 @@ struct whc_qhead {
+ #define QH_INFO3_MAX_DELAY(d) ((d) << 0) /* maximum stream delay in 125 us units (isoc only) */
+ #define QH_INFO3_INTERVAL(i) ((i) << 16) /* segment interval in 125 us units (isoc only) */
+
+-#define QH_INFO3_TX_RATE_53_3 (0 << 24)
+-#define QH_INFO3_TX_RATE_80 (1 << 24)
+-#define QH_INFO3_TX_RATE_106_7 (2 << 24)
+-#define QH_INFO3_TX_RATE_160 (3 << 24)
+-#define QH_INFO3_TX_RATE_200 (4 << 24)
+-#define QH_INFO3_TX_RATE_320 (5 << 24)
+-#define QH_INFO3_TX_RATE_400 (6 << 24)
+-#define QH_INFO3_TX_RATE_480 (7 << 24)
++#define QH_INFO3_TX_RATE(r) ((r) << 24) /* PHY rate (see [ECMA-368] section 10.3.1.1) */
+ #define QH_INFO3_TX_PWR(p) ((p) << 29) /* transmit power (see [WUSB] section 5.2.1.2) */
+
+ #define QH_STATUS_FLOW_CTRL (1 << 15)
+--- a/drivers/usb/wusbcore/wusbhc.c
++++ b/drivers/usb/wusbcore/wusbhc.c
+@@ -147,10 +147,40 @@ static ssize_t wusb_chid_store(struct de
+ }
+ static DEVICE_ATTR(wusb_chid, 0644, wusb_chid_show, wusb_chid_store);
+
++
++static ssize_t wusb_phy_rate_show(struct device *dev,
++ struct device_attribute *attr,
++ char *buf)
++{
++ struct wusbhc *wusbhc = usbhc_dev_to_wusbhc(dev);
++
++ return sprintf(buf, "%d\n", wusbhc->phy_rate);
++}
++
++static ssize_t wusb_phy_rate_store(struct device *dev,
++ struct device_attribute *attr,
++ const char *buf, size_t size)
++{
++ struct wusbhc *wusbhc = usbhc_dev_to_wusbhc(dev);
++ uint8_t phy_rate;
++ ssize_t result;
++
++ result = sscanf(buf, "%hhu", &phy_rate);
++ if (result != 1)
++ return -EINVAL;
++ if (phy_rate >= UWB_PHY_RATE_INVALID)
++ return -EINVAL;
++
++ wusbhc->phy_rate = phy_rate;
++ return size;
++}
++static DEVICE_ATTR(wusb_phy_rate, 0644, wusb_phy_rate_show, wusb_phy_rate_store);
++
+ /* Group all the WUSBHC attributes */
+ static struct attribute *wusbhc_attrs[] = {
+ &dev_attr_wusb_trust_timeout.attr,
+ &dev_attr_wusb_chid.attr,
++ &dev_attr_wusb_phy_rate.attr,
+ NULL,
+ };
+
+@@ -177,6 +207,8 @@ int wusbhc_create(struct wusbhc *wusbhc)
+ int result = 0;
+
+ wusbhc->trust_timeout = WUSB_TRUST_TIMEOUT_MS;
++ wusbhc->phy_rate = UWB_PHY_RATE_INVALID - 1;
++
+ mutex_init(&wusbhc->mutex);
+ result = wusbhc_mmcie_create(wusbhc);
+ if (result < 0)
+--- a/drivers/usb/wusbcore/wusbhc.h
++++ b/drivers/usb/wusbcore/wusbhc.h
+@@ -253,6 +253,7 @@ struct wusbhc {
+
+ unsigned trust_timeout; /* in jiffies */
+ struct wusb_ckhdid chid;
++ uint8_t phy_rate;
+ struct wuie_host_info *wuie_host_info;
+
+ struct mutex mutex; /* locks everything else */