RE: [PATCH 2/2] usb: phy: rename otg.c to phy.c

2012-09-17 Thread Chen Peter-B29397
 
 
 On Mon, Sep 17, 2012 at 12:18 AM, Peter Chen peter.c...@freescale.com
 wrote:
  The operations in current otg.c are actually for USB PHY's
  Move it from drivers/usb/otg/ to drivers/usb/phy/
 
  Signed-off-by: Peter Chen peter.c...@freescale.com
  ---
   drivers/usb/otg/Makefile |3 -
   drivers/usb/otg/otg.c|  239 --
 
   drivers/usb/phy/Makefile |3 +
   drivers/usb/phy/phy.c|  239
 ++
   4 files changed, 242 insertions(+), 242 deletions(-)
 
 You would better use git mv / git format -M to do the renames.
 

Thanks, I will send v2.


 Regards,
 
 Fabio Estevam
 --
 To unsubscribe from this list: send the line unsubscribe linux-usb in
 the body of a message to majord...@vger.kernel.org
 More majordomo info at  http://vger.kernel.org/majordomo-info.html



[PATCH 1/3] usb: gadget: composite: export usb_remove_config

2012-09-17 Thread Andrzej Pietrasiewicz
Enable calling usb_remove_config by gadgets.

Signed-off-by: Andrzej Pietrasiewicz andrze...@samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
---
 drivers/usb/gadget/composite.c |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c
index 957f973..d213cd3 100644
--- a/drivers/usb/gadget/composite.c
+++ b/drivers/usb/gadget/composite.c
@@ -783,6 +783,7 @@ static void remove_config(struct usb_composite_dev *cdev,
/* may free memory for c */
}
 }
+EXPORT_SYMBOL_GPL(usb_remove_config);
 
 /**
  * usb_remove_config() - remove a configuration from a device.
-- 
1.7.0.4

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/3] usb: gadget: Add USB functions gadget

2012-09-17 Thread Andrzej Pietrasiewicz
Add USB functions gadget configured entirely through configfs.
This is the base for adding USB functions to it. The next patch
in the series demonstrates how to add functions.

Signed-off-by: Andrzej Pietrasiewicz andrze...@samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
---
 drivers/usb/gadget/Kconfig |   12 +
 drivers/usb/gadget/Makefile|2 +
 drivers/usb/gadget/usb_functions.c |  780 
 3 files changed, 794 insertions(+), 0 deletions(-)
 create mode 100644 drivers/usb/gadget/usb_functions.c

diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig
index a53be32..0ccade5 100644
--- a/drivers/usb/gadget/Kconfig
+++ b/drivers/usb/gadget/Kconfig
@@ -521,6 +521,18 @@ choice
 
 # this first set of drivers all depend on bulk-capable hardware.
 
+config USB_FG
+   tristate USB Functions Gadget (EXPERIMENTAL)
+   select USB_LIBCOMPOSITE
+   depends on EXPERIMENTAL  CONFIGFS_FS
+   help
+ USB Functions Gadget is a device which aggregates a number of
+ USB functions. The gadget is composed by userspace through a
+ configfs interface, which enables specifying what USB
+ configurations the gadget is composed of, what USB functions
+ a USB configuration is composed of and enabling/disabling
+ the gadget.
+
 config USB_ZERO
tristate Gadget Zero (DEVELOPMENT)
select USB_LIBCOMPOSITE
diff --git a/drivers/usb/gadget/Makefile b/drivers/usb/gadget/Makefile
index 307be5f..0f8b421 100644
--- a/drivers/usb/gadget/Makefile
+++ b/drivers/usb/gadget/Makefile
@@ -38,6 +38,7 @@ obj-$(CONFIG_USB_MV_U3D)  += mv_u3d_core.o
 #
 # USB gadget drivers
 #
+g_usb_functions-y  := usb_functions.o
 g_zero-y   := zero.o
 g_audio-y  := audio.o
 g_ether-y  := ether.o
@@ -57,6 +58,7 @@ g_ncm-y   := ncm.o
 g_acm_ms-y := acm_ms.o
 g_tcm_usb_gadget-y := tcm_usb_gadget.o
 
+obj-$(CONFIG_USB_FG)   += g_usb_functions.o
 obj-$(CONFIG_USB_ZERO) += g_zero.o
 obj-$(CONFIG_USB_AUDIO)+= g_audio.o
 obj-$(CONFIG_USB_ETH)  += g_ether.o
diff --git a/drivers/usb/gadget/usb_functions.c 
b/drivers/usb/gadget/usb_functions.c
new file mode 100644
index 000..ae15719
--- /dev/null
+++ b/drivers/usb/gadget/usb_functions.c
@@ -0,0 +1,780 @@
+/*
+ * USB Functions Gadget
+ *
+ * Copyright (C) 2012 Samsung Electronics
+ * Author: Andrzej Pietrasiewicz andrze...@samsung.com
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#include linux/kernel.h
+#include linux/module.h
+#include linux/usb/ch9.h
+#include linux/configfs.h
+
+/*
+ * Supported functions
+ */
+
+/*-*/
+
+#define DRIVER_DESCUSB Functions Gadget
+#define DRIVER_VERSION Pawelek
+
+#define VENDOR_ID  0x1d6b /* Linux Foundation */
+#define PRODUCT_ID 0x0108
+#define BCD_DEVICE 0x
+
+USB_GADGET_COMPOSITE_OPTIONS();
+
+/*---  helper functions and macros for configfs support  --*/
+
+#define UFG_STR_LEN256
+
+#define UFG_SHOW_USHORT_ATTR(_name, _type, _member)\
+static ssize_t _type##_show_##_name(struct _type *grp, char *buf)  \
+{  \
+   return sprintf(buf, %d\n, grp-_member);  \
+}
+
+#define UFG_STORE_USHORT_ATTR(_name, _type, _member)   \
+static ssize_t _type##_store_##_name(struct _type *grp,
\
+const char *buf, size_t count) \
+{  \
+   grp-_member = (ushort)ufg_read_twobyte(buf);   \
+   grp-_member##_set = true;  \
+   \
+   return count;   \
+}
+
+#define UFG_SHOW_STR_ATTR(_name, _type, _member)   \
+static ssize_t _type##_show_##_name(struct _type *grp, char *buf)  \
+{  \
+   return strlcpy(buf, grp-_member, UFG_STR_LEN); \
+}
+
+#define UFG_STORE_STR_ATTR(_name, _type, _member)  \
+static ssize_t 

[PATCH 3/3] usb: gadget: port f_mass_storage to USB functions gadget

2012-09-17 Thread Andrzej Pietrasiewicz
An example port of a usb function to the USB functions gadget.

Signed-off-by: Andrzej Pietrasiewicz andrze...@samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
---
 drivers/usb/gadget/f_mass_storage.c |  658 +++
 drivers/usb/gadget/storage_common.c |  343 +++
 drivers/usb/gadget/usb_functions.c  |8 +
 3 files changed, 566 insertions(+), 443 deletions(-)

diff --git a/drivers/usb/gadget/f_mass_storage.c 
b/drivers/usb/gadget/f_mass_storage.c
index 3a7668b..b4de9ec 100644
--- a/drivers/usb/gadget/f_mass_storage.c
+++ b/drivers/usb/gadget/f_mass_storage.c
@@ -55,11 +55,6 @@
  *
  * nluns   Number of LUNs function have (anywhere from 1
  * to FSG_MAX_LUNS which is 8).
- * lunsAn array of LUN configuration values.  This
- * should be filled for each LUN that
- * function will include (ie. for nluns
- * LUNs).  Each element of the array has
- * the following fields:
  * -filename  The path to the backing file for the LUN.
  * Required if LUN is not marked as
  * removable.
@@ -292,7 +287,6 @@ struct fsg_common {
 
unsigned intnluns;
unsigned intlun;
-   struct fsg_lun  *luns;
struct fsg_lun  *curlun;
 
unsigned intbulk_out_maxpacket;
@@ -307,7 +301,6 @@ struct fsg_common {
u32 usb_amount_left;
 
unsigned intcan_stall:1;
-   unsigned intfree_storage_on_release:1;
unsigned intphase_error:1;
unsigned intshort_packet_received:1;
unsigned intbad_lun_okay:1;
@@ -329,6 +322,10 @@ struct fsg_common {
char inquiry_string[8 + 16 + 4 + 1];
 
struct kref ref;
+
+   const char  *lun_name_format;
+
+   struct config_group group;
 };
 
 struct fsg_config {
@@ -341,6 +338,8 @@ struct fsg_config {
char nofua;
} luns[FSG_MAX_LUNS];
 
+   const char  *lun_name_format;
+
/* Callback functions. */
const struct fsg_operations *ops;
/* Gadget's private data. */
@@ -350,6 +349,10 @@ struct fsg_config {
const char *product_name;   /* 16 characters or less */
 
charcan_stall;
+   struct usb_configuration *usb_config;
+
+   /* configfs-related */
+   struct config_group group;
 };
 
 struct fsg_dev {
@@ -566,7 +569,7 @@ static int fsg_setup(struct usb_function *f,
*(u8 *)req-buf = fsg-common-nluns - 1;
 
/* Respond with data/status */
-   req-length = min((u16)1, w_length);
+   req-length = min_t(u16, 1, w_length);
return ep0_queue(fsg-common);
}
 
@@ -1126,7 +1129,7 @@ static int do_inquiry(struct fsg_common *common, struct 
fsg_buffhd *bh)
buf[5] = 0; /* No special options */
buf[6] = 0;
buf[7] = 0;
-   memcpy(buf + 8, common-inquiry_string, sizeof common-inquiry_string);
+   memcpy(buf + 8, common-inquiry_string, sizeof(common-inquiry_string));
return 36;
 }
 
@@ -1380,8 +1383,7 @@ static int do_start_stop(struct fsg_common *common)
 
/* Simulate an unload/eject */
if (common-ops  common-ops-pre_eject) {
-   int r = common-ops-pre_eject(common, curlun,
-  curlun - common-luns);
+   int r = common-ops-pre_eject(common, curlun, curlun-n_lun);
if (unlikely(r  0))
return r;
else if (r)
@@ -1395,8 +1397,7 @@ static int do_start_stop(struct fsg_common *common)
down_read(common-filesem);
 
return common-ops  common-ops-post_eject
-   ? min(0, common-ops-post_eject(common, curlun,
-curlun - common-luns))
+   ? min(0, common-ops-post_eject(common, curlun, curlun-n_lun))
: 0;
 }
 
@@ -2125,7 +2126,7 @@ unknown_cmnd:
if (reply == -EINVAL)
reply = 0;  /* Error reply length */
if (reply = 0  common-data_dir == DATA_DIR_TO_HOST) {
-   reply = min((u32)reply, common-data_size_from_cmnd);
+   reply = min_t(u32, reply, common-data_size_from_cmnd);
bh-inreq-length = reply;
bh-state = BUF_STATE_FULL;
common-residue -= reply;
@@ -2175,8 +2176,7 @@ static int received_cbw(struct fsg_dev *fsg, struct 
fsg_buffhd *bh)
if (cbw-Lun = FSG_MAX_LUNS || cbw-Flags  ~US_BULK_FLAG_IN ||
cbw-Length = 0 || cbw-Length  MAX_COMMAND_SIZE) {
DBG(fsg, 

Re: [PATCH 1/8] usb/gadget: add some error recovery in afunc_bind()

2012-09-17 Thread Sebastian Andrzej Siewior

On 09/17/2012 08:02 AM, Jassi Brar wrote:


Though better would be to not refuse IN transfers if an OUT ep isn't
available and vice versa - the sound card might support only either
Playback or Capture, it doesn't have to always support both. The rbuf
should have been allocated only for ep that exists. So I think, while
this patch prevents potential null-pointer dereferencing it also weeds
out the simplex capability of the driver.


But if you have on out ep or only in ep you have to update your
descriptors and this has not been done.


Thanks.


Sebastian
--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 00/34] i.MX multi-platform support

2012-09-17 Thread Sascha Hauer
Hi Shawn,

On Mon, Sep 17, 2012 at 01:34:29PM +0800, Shawn Guo wrote:
 The series enables multi-platform support for imx.  Since the required
 frameworks (clk, pwm) and spare_irq have already been adopted on imx,
 the series is all about cleaning up mach/* headers.  Along with the
 changes, arch/arm/plat-mxc gets merged into arch/arm/mach-imx.
 
 It's based on a bunch of branches (works from others), Rob's initial
 multi-platform series, Arnd's platform-data and smp_ops (Marc's) and
 imx 3.7 material (Sascha and myself).
 
 It's available on branch below.
 
   git://git.linaro.org/people/shawnguo/linux-2.6.git imx/multi-platform
 
 It's been tested on imx5 and imx6, and only compile-tested on imx2 and
 imx3, so testing on imx2/3 are appreciated.

Great work! This really pushes the i.MX architecture one step closer to
a clean code base.

I gave it a test on i.MX1, i.MX27, i.MX31 and i.MX35. All run fine, but
the last patch breaks the imx_v4_v5_defconfig: Somehow it now defaults
to ARMv7 based machines. I haven't looked into it, just reenabled
ARMv4/ARMv5 and the boards again - works. The config should be updated
with the last patch.

I'm fine with the changes to mx2-camera, but Javier should give his ok
to it, he has worked on it quite a lot recently.

One other issue related to imx-dma, see comment to that patch.

Otherwise:

Acked-by: Sascha Hauer s.ha...@pengutronix.de
Tested-by: Sascha Hauer s.ha...@pengutronix.de

Thanks
 Sascha

-- 
Pengutronix e.K.   | |
Industrial Linux Solutions | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |
--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFC PATCH 0/3] usbnet: support runtime PM triggered by link change

2012-09-17 Thread Oliver Neukum
On Sunday 16 September 2012 01:48:16 Ming Lei wrote:

Hi,

 Currently only very few usbnet devices support the traffic based
 runtime PM, eg. wake up devices if there are packets to be transmitted.
 
 For the below situation, it should make sense to runtime suspend usbnet
 device to save power:
 
 - after network link becomes down

Basically cool design, but it raises two fundamental questions
and some detail questions.

 This patch implements the runtime PM triggered by network link change
 event, and it works basically on asix usbnet device after a simple
 runtime PM test.

1) Does it actually save power? You are constantly waking up a CPU.
From that perspective it is possible that leaving on the ethernet is actually
better in terms of power. Only measurements can answer that question.

2) Do we have many devices that would be serviced with this approach?

Regards
Oliver

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFC PATCH 0/3] usbnet: support runtime PM triggered by link change

2012-09-17 Thread Ming Lei
On Mon, Sep 17, 2012 at 4:04 PM, Oliver Neukum oneu...@suse.de wrote:
 On Sunday 16 September 2012 01:48:16 Ming Lei wrote:

 Hi,

 Currently only very few usbnet devices support the traffic based
 runtime PM, eg. wake up devices if there are packets to be transmitted.

 For the below situation, it should make sense to runtime suspend usbnet
 device to save power:

 - after network link becomes down

 Basically cool design, but it raises two fundamental questions
 and some detail questions.

 This patch implements the runtime PM triggered by network link change
 event, and it works basically on asix usbnet device after a simple
 runtime PM test.

 1) Does it actually save power? You are constantly waking up a CPU.

Of course, it does. I don't know it will save how much power just on
usbnet device, but it may save power from usb hub and usb host
controller in the bus at least.

Anyway we don't need to waste power if the link of usbnet is down.

It just wake up CPU one time each 3sec. In modern linux distribution,
the CPU will be wakup tens times per second, so it shouldn't be a
big problem.

 From that perspective it is possible that leaving on the ethernet is actually
 better in terms of power. Only measurements can answer that question.

You know it is a bit difficult to test power save for this situation. And
most of runtime PM patches didn't provide power save data. In fact,
I'd like to do it, but I have not some equipment to measure it, :-(.


 2) Do we have many devices that would be serviced with this approach?

At least I found asix can be serviced by this approach. Considered asix
is quite popular, it is worthy of the effort. Also the below devices can be
serviced by the patch in theory:

   dm9601.c / mcs7830.c / sierra_net.c

In fact, it might be used by other non-usbnet devices too.

Thanks,
--
Ming Lei
--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] USB: chipidea: use OTGSC_BSV to detect vbus valid

2012-09-17 Thread Richard Zhao
OTGSC_AVVIS cannot be set when vbus voltage goes valid or invalid on
imx, so convert to use OTGSC_BSV.

OTGSC_BSVIE and OTGSC_BSVIS is not cleared when hw_device_reset, so we
don't need to call hw_enable_vbus_intr after hw_device_reset.

Signed-off-by: Richard Zhao richard.z...@freescale.com
---
 drivers/usb/chipidea/udc.c |   17 -
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c
index 2f45bba..b158a04 100644
--- a/drivers/usb/chipidea/udc.c
+++ b/drivers/usb/chipidea/udc.c
@@ -307,14 +307,13 @@ static u32 hw_test_and_clear_intr_active(struct ci13xxx 
*ci)
 
 static void hw_enable_vbus_intr(struct ci13xxx *ci)
 {
-   hw_write(ci, OP_OTGSC, OTGSC_AVVIS, OTGSC_AVVIS);
-   hw_write(ci, OP_OTGSC, OTGSC_AVVIE, OTGSC_AVVIE);
-   queue_work(ci-wq, ci-vbus_work);
+   hw_write(ci, OP_OTGSC, OTGSC_BSVIS, OTGSC_BSVIS);
+   hw_write(ci, OP_OTGSC, OTGSC_BSVIE, OTGSC_BSVIE);
 }
 
 static void hw_disable_vbus_intr(struct ci13xxx *ci)
 {
-   hw_write(ci, OP_OTGSC, OTGSC_AVVIE, 0);
+   hw_write(ci, OP_OTGSC, OTGSC_BSVIE, 0);
 }
 
 /**
@@ -387,7 +386,7 @@ static void vbus_work(struct work_struct *work)
 {
struct ci13xxx *ci = container_of(work, struct ci13xxx, vbus_work);
 
-   if (hw_read(ci, OP_OTGSC, OTGSC_AVV))
+   if (hw_read(ci, OP_OTGSC, OTGSC_BSV))
usb_gadget_vbus_connect(ci-gadget);
else
usb_gadget_vbus_disconnect(ci-gadget);
@@ -1392,7 +1391,6 @@ static int ci13xxx_vbus_session(struct usb_gadget 
*_gadget, int is_active)
if (is_active) {
pm_runtime_get_sync(_gadget-dev);
hw_device_reset(ci, USBMODE_CM_DC);
-   hw_enable_vbus_intr(ci);
hw_device_state(ci, ci-ep0out-qh.dma);
} else {
hw_device_state(ci, 0);
@@ -1569,7 +1567,6 @@ static int ci13xxx_start(struct usb_gadget *gadget,
if (ci-vbus_active) {
if (ci-platdata-flags  CI13XXX_REGS_SHARED) {
hw_device_reset(ci, USBMODE_CM_DC);
-   hw_enable_vbus_intr(ci);
}
} else {
pm_runtime_put_sync(ci-gadget.dev);
@@ -1680,7 +1677,7 @@ static irqreturn_t udc_irq(struct ci13xxx *ci)
intr = hw_read(ci, OP_OTGSC, ~0);
hw_write(ci, OP_OTGSC, ~0, intr);
 
-   if (intr  (OTGSC_AVVIE  OTGSC_AVVIS))
+   if ((intr  OTGSC_BSVIE)  (intr  OTGSC_BSVIS))
queue_work(ci-wq, ci-vbus_work);
 
spin_unlock(ci-lock);
@@ -1758,7 +1755,6 @@ static int udc_start(struct ci13xxx *ci)
retval = hw_device_reset(ci, USBMODE_CM_DC);
if (retval)
goto put_transceiver;
-   hw_enable_vbus_intr(ci);
}
 
retval = device_register(ci-gadget.dev);
@@ -1782,6 +1778,9 @@ static int udc_start(struct ci13xxx *ci)
if (retval)
goto remove_trans;
 
+   queue_work(ci-wq, ci-vbus_work);
+   hw_enable_vbus_intr(ci);
+
pm_runtime_no_callbacks(ci-gadget.dev);
pm_runtime_enable(ci-gadget.dev);
 
-- 
1.7.9.5


--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFC PATCH 3/3] usbnet: support runtime PM triggered by link change

2012-09-17 Thread Oliver Neukum
On Sunday 16 September 2012 01:48:19 Ming Lei wrote:

 
 +void usbnet_link_updated(struct usbnet *dev)
 +{
 + complete(dev-link_update_completion);
 +}
 +EXPORT_SYMBOL_GPL(usbnet_link_updated);

Isn't that a bit too trivial to get the _GPL version?

 +#define usbnet_link_suspend(dev) do { \
 + dev_dbg(dev-intf-dev, %s:link suspend, __func__); \
 + usb_autopm_put_interface_async(dev-intf); \
 +} while(0)
 +
 +#define usbnet_link_resume(dev) do { \
 + dev_dbg(dev-intf-dev, %s:link resume, __func__); \
 + usb_autopm_get_interface_async(dev-intf); \
 +} while(0)

Why macros?


[..]
 +/* called by usbnet_open */
 +static void enable_link_runtime_pm(struct usbnet *dev)
 +{
 + dev-link_rpm_enabled = 1;
 +
 + if (!dev-link_remote_wakeup) {
 + dev-old_autosuspend_delay =
 + dev-udev-dev.power.autosuspend_delay;
 + pm_runtime_set_autosuspend_delay(dev-udev-dev, 1);

This is a problem. Suppose the user changes the autosuspend timeout.
You cannot assume that the old value remains valid.

 + }
 +
 + if (!netif_carrier_ok(dev-net)) {
 + dev-link_open_suspend = 1;
 + usbnet_link_suspend(dev);
 + }
 +}

 +static void update_link_state(struct usbnet *dev)
 +{
 + char*buf = NULL;
 + unsignedpipe = 0;
 + unsignedmaxp;
 + int ret, act_len, timeout;
 + struct urb  urb;
 +
 + pipe = usb_rcvintpipe(dev-udev,
 +   dev-status-desc.bEndpointAddress
 +  USB_ENDPOINT_NUMBER_MASK);
 + maxp = usb_maxpacket(dev-udev, pipe, 0);
 +
 + /*
 +  * Take default timeout as 2 times of period.
 +  * It is observed that asix device can update its link
 +  * state duing one period(128ms). Low level driver can set
 +  * its default update link time in bind() callback.
 +  */
 + if (!dev-link_update_timeout) {
 + timeout = max((int) dev-status-desc.bInterval,
 + (dev-udev-speed == USB_SPEED_HIGH) ? 7 : 3);
 + timeout = 1  timeout;
 + if (dev-udev-speed == USB_SPEED_HIGH)
 + timeout /= 8;
 + if (timeout  128)
 + timeout = 128;
 + } else
 + timeout = dev-link_update_timeout;
 +
 + buf = kmalloc(maxp, GFP_KERNEL);
 + if (!buf)
 + return;
 +
 + dev_dbg(dev-intf-dev, %s: timeout %dms\n, __func__, timeout);
 + ret = usb_interrupt_msg(dev-udev, pipe, buf, maxp,
 + act_len, timeout);
 + if (!ret) {
 + urb.status = 0;
 + urb.actual_length = act_len;
 + urb.transfer_buffer = buf;
 + urb.transfer_buffer_length = maxp;
 + dev-driver_info-status(dev, urb);
 + if (dev-driver_info-flags 
 + FLAG_LINK_UPDATE_BY_DRIVER)
 + wait_for_completion(dev-link_update_completion);

If a driver calls usbnet_link_updated() from the same workqueue this
will deadlock.

 + dev_dbg(dev-intf-dev, %s: link updated\n, __func__);
 + } else
 + dev_dbg(dev-intf-dev, %s: link update failed %d\n,
 + __func__, ret);
 + kfree(buf);
 +}

[..]
 @@ -795,6 +977,9 @@ int usbnet_open (struct net_device *net)
   if (retval  0)
   goto done_manage_power_error;
   usb_autopm_put_interface(dev-intf);
 + } else {
 + if (need_link_runtime_pm(dev))
 + enable_link_runtime_pm(dev);
   }
   return retval;
  
 @@ -1489,6 +1674,8 @@ usbnet_probe (struct usb_interface *udev, const struct 
 usb_device_id *prod)
   if (dev-driver_info-flags  FLAG_LINK_INTR)
   usbnet_link_change(dev, 0, 0);
  
 + init_link_rpm(dev);
 +
   return 0;
  
  out4:
 @@ -1538,6 +1725,9 @@ int usbnet_suspend (struct usb_interface *intf, 
 pm_message_t message)
* wake the device
*/
   netif_device_attach (dev-net);
 +
 + if (PMSG_IS_AUTO(message))
 + start_link_detect(dev);

What happens if the device is autosuspended, then the system is suspended
and the work is executed while the suspension is underway?

   }
   return 0;
  }
 @@ -1552,8 +1742,10 @@ int usbnet_resume (struct usb_interface *intf)
  
   if (!--dev-suspend_count) {
   /* resume interrupt URBs */
 - if (dev-interrupt  test_bit(EVENT_DEV_OPEN, dev-flags))
 - usb_submit_urb(dev-interrupt, GFP_NOIO);
 + if (dev-interrupt  test_bit(EVENT_DEV_OPEN, dev-flags)) {
 + if (!dev-link_checking)

That is impossible. If the device is resumed the interrupt URB must
be restarted in every case (if it exists).
You cannot assume that its only function is checking the link state.
And it introduces a race with the workqueue.

 +  

RE: [PATCH] USB: chipidea: use OTGSC_BSV to detect vbus valid

2012-09-17 Thread Chen Peter-B29397
 

 
 
 OTGSC_AVVIS cannot be set when vbus voltage goes valid or invalid on
 imx, so convert to use OTGSC_BSV.
 

Not just on imx, from the IC guys, it is chipidea's feature.
the AVVIS will not go to 1 when the vbus goes to high if ID = 1.

 OTGSC_BSVIE and OTGSC_BSVIS is not cleared when hw_device_reset, so we
 don't need to call hw_enable_vbus_intr after hw_device_reset.
 
 Signed-off-by: Richard Zhao richard.z...@freescale.com
 ---
  drivers/usb/chipidea/udc.c |   17 -
  1 file changed, 8 insertions(+), 9 deletions(-)
 
 diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c
 index 2f45bba..b158a04 100644
 --- a/drivers/usb/chipidea/udc.c
 +++ b/drivers/usb/chipidea/udc.c
 @@ -307,14 +307,13 @@ static u32 hw_test_and_clear_intr_active(struct
 ci13xxx *ci)
 
  static void hw_enable_vbus_intr(struct ci13xxx *ci)
  {
 - hw_write(ci, OP_OTGSC, OTGSC_AVVIS, OTGSC_AVVIS);
 - hw_write(ci, OP_OTGSC, OTGSC_AVVIE, OTGSC_AVVIE);
 - queue_work(ci-wq, ci-vbus_work);
 + hw_write(ci, OP_OTGSC, OTGSC_BSVIS, OTGSC_BSVIS);
 + hw_write(ci, OP_OTGSC, OTGSC_BSVIE, OTGSC_BSVIE);
  }
 
  static void hw_disable_vbus_intr(struct ci13xxx *ci)
  {
 - hw_write(ci, OP_OTGSC, OTGSC_AVVIE, 0);
 + hw_write(ci, OP_OTGSC, OTGSC_BSVIE, 0);
  }
 
  /**
 @@ -387,7 +386,7 @@ static void vbus_work(struct work_struct *work)
  {
   struct ci13xxx *ci = container_of(work, struct ci13xxx, vbus_work);
 
 - if (hw_read(ci, OP_OTGSC, OTGSC_AVV))
 + if (hw_read(ci, OP_OTGSC, OTGSC_BSV))
   usb_gadget_vbus_connect(ci-gadget);
   else
   usb_gadget_vbus_disconnect(ci-gadget);
 @@ -1392,7 +1391,6 @@ static int ci13xxx_vbus_session(struct usb_gadget
 *_gadget, int is_active)
   if (is_active) {
   pm_runtime_get_sync(_gadget-dev);
   hw_device_reset(ci, USBMODE_CM_DC);
 - hw_enable_vbus_intr(ci);
   hw_device_state(ci, ci-ep0out-qh.dma);
   } else {
   hw_device_state(ci, 0);
 @@ -1569,7 +1567,6 @@ static int ci13xxx_start(struct usb_gadget *gadget,
   if (ci-vbus_active) {
   if (ci-platdata-flags  CI13XXX_REGS_SHARED) {
   hw_device_reset(ci, USBMODE_CM_DC);
 - hw_enable_vbus_intr(ci);
   }
   } else {
   pm_runtime_put_sync(ci-gadget.dev);
 @@ -1680,7 +1677,7 @@ static irqreturn_t udc_irq(struct ci13xxx *ci)
   intr = hw_read(ci, OP_OTGSC, ~0);
   hw_write(ci, OP_OTGSC, ~0, intr);
 
 - if (intr  (OTGSC_AVVIE  OTGSC_AVVIS))
 + if ((intr  OTGSC_BSVIE)  (intr  OTGSC_BSVIS))
   queue_work(ci-wq, ci-vbus_work);
 
   spin_unlock(ci-lock);
 @@ -1758,7 +1755,6 @@ static int udc_start(struct ci13xxx *ci)
   retval = hw_device_reset(ci, USBMODE_CM_DC);
   if (retval)
   goto put_transceiver;
 - hw_enable_vbus_intr(ci);
   }
 
   retval = device_register(ci-gadget.dev);
 @@ -1782,6 +1778,9 @@ static int udc_start(struct ci13xxx *ci)
   if (retval)
   goto remove_trans;
 
 + queue_work(ci-wq, ci-vbus_work);
 + hw_enable_vbus_intr(ci);
 +
   pm_runtime_no_callbacks(ci-gadget.dev);
   pm_runtime_enable(ci-gadget.dev);
 
 --
 1.7.9.5


--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v3] USB: mxs-phy: add basic otg support

2012-09-17 Thread Richard Zhao
Signed-off-by: Richard Zhao richard.z...@freescale.com
Acked-by: Felipe Balbi ba...@ti.com
---
Changes from v2:
 - assign host/gadget in mxs_phy_set_host/mxs_phy_set_peripheral

 drivers/usb/otg/mxs-phy.c |   25 +
 1 file changed, 25 insertions(+)

diff --git a/drivers/usb/otg/mxs-phy.c b/drivers/usb/otg/mxs-phy.c
index 88db976..3255112 100644
--- a/drivers/usb/otg/mxs-phy.c
+++ b/drivers/usb/otg/mxs-phy.c
@@ -129,12 +129,28 @@ static int mxs_phy_on_disconnect(struct usb_phy *phy, int 
port)
return 0;
 }
 
+static int mxs_phy_set_host(struct usb_otg *otg, struct usb_bus *host)
+{
+   otg-host = host;
+
+   return 0;
+}
+
+static int mxs_phy_set_peripheral(struct usb_otg *otg,
+   struct usb_gadget *gadget)
+{
+   otg-gadget = gadget;
+
+   return 0;
+}
+
 static int mxs_phy_probe(struct platform_device *pdev)
 {
struct resource *res;
void __iomem *base;
struct clk *clk;
struct mxs_phy *mxs_phy;
+   struct usb_otg *otg;
 
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!res) {
@@ -171,6 +187,15 @@ static int mxs_phy_probe(struct platform_device *pdev)
 
mxs_phy-clk = clk;
 
+   otg = devm_kzalloc(pdev-dev, sizeof(struct usb_otg), GFP_KERNEL);
+   if (!otg)
+   return -ENOMEM;
+   otg-phy = mxs_phy-phy;
+   otg-set_host = mxs_phy_set_host;
+   otg-set_peripheral = mxs_phy_set_peripheral;
+
+   mxs_phy-phy.otg = otg;
+
platform_set_drvdata(pdev, mxs_phy-phy);
 
return 0;
-- 
1.7.9.5


--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] usb: gadget: lpc32xx_udc: Fix compatibility with STOTG04

2012-09-17 Thread Roland Stigge
On 09/12/2012 10:30 PM, Alexandre Pereira da Silva wrote:
 The STOTG04 is an replacement for ISP1301.
 
 Most of the registers on STOTG04 are the same as on ISP1301, but the
 register ISP1301_I2C_OTG_CONTROL_2 (address 0x10) doesn't exist on the
 ST part.
 
 This is a work around for this by using the interrupt source register that
 should behave the same on both parts and has the needed information.
 
 Signed-off-by: Alexandre Pereira da Silva aletes@gmail.com

Tested-by: Roland Stigge sti...@antcom.de

 ---
  drivers/usb/gadget/lpc32xx_udc.c |4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
 
 diff --git a/drivers/usb/gadget/lpc32xx_udc.c 
 b/drivers/usb/gadget/lpc32xx_udc.c
 index f696fb9..21a9861 100644
 --- a/drivers/usb/gadget/lpc32xx_udc.c
 +++ b/drivers/usb/gadget/lpc32xx_udc.c
 @@ -2930,10 +2930,10 @@ static void vbus_work(struct work_struct *work)
  
   /* Get the VBUS status from the transceiver */
   value = i2c_smbus_read_byte_data(udc-isp1301_i2c_client,
 -  ISP1301_I2C_OTG_CONTROL_2);
 +  ISP1301_I2C_INTERRUPT_SOURCE);
  
   /* VBUS on or off? */
 - if (value  OTG_B_SESS_VLD)
 + if (value  INT_SESS_VLD)
   udc-vbus = 1;
   else
   udc-vbus = 0;

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [RFC PATCH 3/3] usbnet: support runtime PM triggered by link change

2012-09-17 Thread David Laight
  +void usbnet_link_updated(struct usbnet *dev)
  +{
  +   complete(dev-link_update_completion);
  +}
  +EXPORT_SYMBOL_GPL(usbnet_link_updated);
 
 Isn't that a bit too trivial to get the _GPL version?

Particularly if the usb infrastructure (that I presume this
is part of) might be reasonably usable by non-gpl drivers.

A few years back the function to release a reference on
the kernel 'pid' structure was added as GPL - making
it impossible for non-GPL to hold the reference.

David
 


--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFC PATCH] drivers: phy: add generic PHY framework

2012-09-17 Thread Marc Kleine-Budde
On 09/14/2012 03:06 PM, ABRAHAM, KISHON VIJAY wrote:

[...]

 diff --git a/drivers/phy/phy-core.c b/drivers/phy/phy-core.c
 new file mode 100644
 index 000..c55446a
 --- /dev/null
 +++ b/drivers/phy/phy-core.c
 @@ -0,0 +1,437 @@
 +/*
 + * phy-core.c  --  Generic Phy framework.
 + *
 + * Copyright (C) 2012 Texas Instruments
 + *
 + * Author: Kishon Vijay Abraham I kis...@ti.com
 + *
 + * This program is free software; you can redistribute  it and/or modify it
 + * under  the terms of  the GNU General  Public License as published by the
 + * Free Software Foundation;  either version 2 of the  License, or (at your
 + * option) any later version.
 + *
 + * This program is distributed in the hope that it will be useful,
 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 + * 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, see http://www.gnu.org/licenses/.
 + */
 +
 +#include linux/kernel.h
 +#include linux/export.h
 +#include linux/module.h
 +#include linux/err.h
 +#include linux/device.h
 +#include linux/slab.h
 +#include linux/of.h
 +#include linux/phy/phy.h
 +
 +static struct class *phy_class;
 +static LIST_HEAD(phy_list);
 +static DEFINE_MUTEX(phy_list_mutex);
 +static LIST_HEAD(phy_bind_list);
 +
 +static void devm_phy_release(struct device *dev, void *res)
 +{
 + struct phy *phy = *(struct phy **)res;

 What about adding a struct phy_res, doing so,m you don't need these
 casts, and it's easier to add more pointers if needed.
 
 Wont we still need to do the cast since you get only a void pointer.
 Maybe I'm not getting you.

As res is a void pointer, no need to hast to to a struct phy_res
pointer, if you think that's unclean code, you can still cast it. But
IMHO the code is far more readable.

 +
 + phy_put(phy);
 +}
 +
 +static int devm_phy_match(struct device *dev, void *res, void *match_data)
 +{
 + return res == match_data;
 +}
 +
 +static struct phy *phy_lookup(struct device *dev, u8 index)
 +{
 + struct phy_bind *phy_bind = NULL;
 +
 + list_for_each_entry(phy_bind, phy_bind_list, list) {
 + if (!(strcmp(phy_bind-dev_name, dev_name(dev))) 
 + phy_bind-index == index)
 + return phy_bind-phy;
 + }
 +
 + return ERR_PTR(-ENODEV);
 +}
 +
 +static struct phy *of_phy_lookup(struct device *dev, struct device_node 
 *node)
 +{
 + int index = 0;
 + struct phy  *phy;
   ^^

 Please remove that stray space.
 
 Sure.

 + struct phy_bind *phy_map = NULL;
 +
 + list_for_each_entry(phy_map, phy_bind_list, list)
 + if (!(strcmp(phy_map-dev_name, dev_name(dev
 + index++;
 +
 + list_for_each_entry(phy, phy_list, head) {
 + if (node != phy-desc-of_node)
 + continue;
 +
 + phy_map = phy_bind(dev_name(dev), index, dev_name(phy-dev));
 + if (!IS_ERR(phy_map)) {
 + phy_map-phy = phy;
 + phy_map-auto_bind = true;
 + }
 +
 + return phy;
 + }
 +
 + return ERR_PTR(-ENODEV);
 +}
 +
 +/**
 + * devm_phy_get - lookup and obtain a reference to a phy.
 + * @dev: device that requests this phy
 + * @index: the index of the phy
 + *
 + * Gets the phy using phy_get(), and associates a device with it using
 + * devres. On driver detach, release function is invoked on the devres 
 data,
 + * then, devres data is freed.
 + */
 +struct phy *devm_phy_get(struct device *dev, u8 index)
 +{
 + struct phy **ptr, *phy;
 +
 + ptr = devres_alloc(devm_phy_release, sizeof(*ptr), GFP_KERNEL);
 + if (!ptr)
 + return NULL;
 +
 + phy = phy_get(dev, index);
 + if (!IS_ERR(phy)) {
 + *ptr = phy;
 + devres_add(dev, ptr);
 + } else
 + devres_free(ptr);

 nitpick: when when if has { }, else should have, too.
 
 Sure.

 +
 + return phy;
 +}
 +EXPORT_SYMBOL_GPL(devm_phy_get);
 +
 +/**
 + * devm_phy_put - release the PHY
 + * @dev: device that wants to release this phy
 + * @phy: the phy returned by devm_phy_get()
 + *
 + * destroys the devres associated with this phy and invokes phy_put
 + * to release the phy.
 + */
 +void devm_phy_put(struct device *dev, struct phy *phy)
 +{
 + int r;
 +
 + r = devres_destroy(dev, devm_phy_release, devm_phy_match, phy);
 + dev_WARN_ONCE(dev, r, couldn't find PHY resource\n);
 +}
 +EXPORT_SYMBOL_GPL(devm_phy_put);
 +
 +/**
 + * devm_of_phy_get - lookup and obtain a reference to a phy by phandle
 + * @dev: device that requests this phy
 + * @phandle: name of the property holding the phy phandle value
 + *
 + * Returns the phy driver associated with the given phandle value,
 + * after getting a refcount to it or -ENODEV if there is no such phy.
 + * While at that, 

About OTG operation for chipidea driver

2012-09-17 Thread Chen Peter-B29397
Hi Alex,

At current chipidea driver, we have not implemented struct usb_otg,
so when udc calls otg_set_peripheral, it will fail.
(udc_start at drivers/usb/chipidea/udc.c). 

In fact, if both host and device use chipidea driver, we do not
need to call otg_set_peripheral at all at current chipidea framework.

To fix it, a better solution is to add otg.c to implement 
struct usb_otg, but we also need to consider qualcomm (msm)'s driver,
which also uses chipidea, but has its own host and otg driver.

What's your opinion? 

Best regards,
Peter Chen

MAD Linux BSP Team
Freescale Semiconductor Ltd.


--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v3] USB: mxs-phy: add basic otg support

2012-09-17 Thread Alexander Shishkin
Richard Zhao richard.z...@freescale.com writes:

 Signed-off-by: Richard Zhao richard.z...@freescale.com
 Acked-by: Felipe Balbi ba...@ti.com

Felipe said, 

 if you add a commit log you can add my:
 
 Acked-by: Felipe Balbi ba...@ti.com

but the commit message is still totally missing. I would like to ask you
to pay attention to the commit messages in the patches that you
submit. They should explain the problem that your patch is solving, how
you are solving it and why, so that anyone immediately knows what the
patch is about without digging up mailing list conversations. There's
also a nice blog entry [1] on how to write good commit messages.

[1] http://who-t.blogspot.com/2009/12/on-commit-messages.html

 ---
 Changes from v2:
  - assign host/gadget in mxs_phy_set_host/mxs_phy_set_peripheral

  drivers/usb/otg/mxs-phy.c |   25 +
  1 file changed, 25 insertions(+)

 diff --git a/drivers/usb/otg/mxs-phy.c b/drivers/usb/otg/mxs-phy.c
 index 88db976..3255112 100644
 --- a/drivers/usb/otg/mxs-phy.c
 +++ b/drivers/usb/otg/mxs-phy.c
 @@ -129,12 +129,28 @@ static int mxs_phy_on_disconnect(struct usb_phy *phy, 
 int port)
   return 0;
  }
  
 +static int mxs_phy_set_host(struct usb_otg *otg, struct usb_bus *host)
 +{
 + otg-host = host;
 +
 + return 0;
 +}
 +
 +static int mxs_phy_set_peripheral(struct usb_otg *otg,
 + struct usb_gadget *gadget)
 +{
 + otg-gadget = gadget;
 +
 + return 0;
 +}
 +
  static int mxs_phy_probe(struct platform_device *pdev)
  {
   struct resource *res;
   void __iomem *base;
   struct clk *clk;
   struct mxs_phy *mxs_phy;
 + struct usb_otg *otg;
  
   res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
   if (!res) {
 @@ -171,6 +187,15 @@ static int mxs_phy_probe(struct platform_device *pdev)
  
   mxs_phy-clk = clk;
  
 + otg = devm_kzalloc(pdev-dev, sizeof(struct usb_otg), GFP_KERNEL);
 + if (!otg)
 + return -ENOMEM;
 + otg-phy = mxs_phy-phy;
 + otg-set_host = mxs_phy_set_host;
 + otg-set_peripheral = mxs_phy_set_peripheral;
 +
 + mxs_phy-phy.otg = otg;
 +
   platform_set_drvdata(pdev, mxs_phy-phy);
  
   return 0;
 -- 
 1.7.9.5
--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [PATCH v3] USB: mxs-phy: add basic otg support

2012-09-17 Thread Chen Peter-B29397

The purpose for this patch is to have set_peripheral implementation,
but in current chipidea code, we don't need to know gadget at all,
as when id switch occurs, the core code know its role (device or host)
very well, and will call related stop/start function.

We have already many code bind struct otg with struct phy, we'd better
split them at later code.
 
A better approach to fix this problem is to either not call set_peripheral
if both device and host use chipidea driver, or implement otg struct
at chipidea driver.


 Changes from v2:
  - assign host/gadget in mxs_phy_set_host/mxs_phy_set_peripheral
 
  drivers/usb/otg/mxs-phy.c |   25 +
  1 file changed, 25 insertions(+)
 
 diff --git a/drivers/usb/otg/mxs-phy.c b/drivers/usb/otg/mxs-phy.c
 index 88db976..3255112 100644
 --- a/drivers/usb/otg/mxs-phy.c
 +++ b/drivers/usb/otg/mxs-phy.c
 @@ -129,12 +129,28 @@ static int mxs_phy_on_disconnect(struct usb_phy
 *phy, int port)
   return 0;
  }
 
 +static int mxs_phy_set_host(struct usb_otg *otg, struct usb_bus *host)
 +{
 + otg-host = host;
 +
 + return 0;
 +}
 +
 +static int mxs_phy_set_peripheral(struct usb_otg *otg,
 + struct usb_gadget *gadget)
 +{
 + otg-gadget = gadget;
 +
 + return 0;
 +}
 +
  static int mxs_phy_probe(struct platform_device *pdev)
  {
   struct resource *res;
   void __iomem *base;
   struct clk *clk;
   struct mxs_phy *mxs_phy;
 + struct usb_otg *otg;
 
   res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
   if (!res) {
 @@ -171,6 +187,15 @@ static int mxs_phy_probe(struct platform_device
 *pdev)
 
   mxs_phy-clk = clk;
 
 + otg = devm_kzalloc(pdev-dev, sizeof(struct usb_otg), GFP_KERNEL);
 + if (!otg)
 + return -ENOMEM;
 + otg-phy = mxs_phy-phy;
 + otg-set_host = mxs_phy_set_host;
 + otg-set_peripheral = mxs_phy_set_peripheral;
 +
 + mxs_phy-phy.otg = otg;
 +
   platform_set_drvdata(pdev, mxs_phy-phy);
 
   return 0;
 --
 1.7.9.5


--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [PATCH v3] USB: mxs-phy: add basic otg support

2012-09-17 Thread Alexander Shishkin
Chen Peter-B29397 b29...@freescale.com writes:

 The purpose for this patch is to have set_peripheral implementation,
 but in current chipidea code, we don't need to know gadget at all,
 as when id switch occurs, the core code know its role (device or host)
 very well, and will call related stop/start function.

 We have already many code bind struct otg with struct phy, we'd better
 split them at later code.
  
 A better approach to fix this problem is to either not call set_peripheral
 if both device and host use chipidea driver, or implement otg struct
 at chipidea driver.

Yes, I think the otg driver should be part of the chipidea driver, the
only concern is the msm, although it can probably be converted once we
have an otg driver. I'll have a look at it soon unless someone beats me
to it.

The bigger plan was to implement a generic otg framework and base the
chipidea's otg driver on that, instead of dragging in one more state
machine and whatnot.

Regards,
--
Alex
--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 8/8] usb/gadget: always update HS/SS descriptors and create a copy of them

2012-09-17 Thread Michal Nazarewicz
On Sun, Sep 16 2012, Sebastian Andrzej Siewior bige...@linutronix.de wrote:
 HS and SS descriptors are staticaly created. They are updated during the
 bind process with the endpoint address, string id or interface numbers.
 After that, the descriptor chain is linked to struct usb_function which
 is used by composite in order to serve the GET_DESCRIPTOR requests,
 number of available configs and so on.
 There is no need to assign the HS descriptor only if the UDC supports
 HS speed because composite won't report those to the Host if HS support
 has not been reached. The same goes for SS.
 This patch makes sure each functions updates HS/SS descriptors
 unconditionally and uses the newly introcued helper function to create a
 copy the descriptors for the speed which is supported by the UDC.

For changes in composite.c, config.c, f_fs.c and f_mass_storage.c:

Acked-by: Michal Nazarewicz min...@mina86.com

 Signed-off-by: Sebastian Andrzej Siewior bige...@linutronix.de

-- 
Best regards, _ _
.o. | Liege of Serenely Enlightened Majesty of  o' \,=./ `o
..o | Computer Science,  Michał “mina86” Nazarewicz(o o)
ooo +email/xmpp: m...@google.com--ooO--(_)--Ooo--

pgpKyBQlzeAt7.pgp
Description: PGP signature


Re: [RFC PATCH 3/3] usbnet: support runtime PM triggered by link change

2012-09-17 Thread Greg Kroah-Hartman
On Mon, Sep 17, 2012 at 10:02:27AM +0100, David Laight wrote:
   +void usbnet_link_updated(struct usbnet *dev)
   +{
   + complete(dev-link_update_completion);
   +}
   +EXPORT_SYMBOL_GPL(usbnet_link_updated);
  
  Isn't that a bit too trivial to get the _GPL version?
 
 Particularly if the usb infrastructure (that I presume this
 is part of) might be reasonably usable by non-gpl drivers.

It can not be, and has not been able to, for quite a number of years now
(since the 2.6.15 kernel release or so I think.)  So this should not be
an issue.

greg k-h
--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 17/34] usb: ehci-mxc: remove unneeded mach/hardware.h inclusion

2012-09-17 Thread Greg Kroah-Hartman
On Mon, Sep 17, 2012 at 01:34:46PM +0800, Shawn Guo wrote:
 The inclusion of mach/hardware.h is not used by the driver at all.
 Remove it.
 
 Signed-off-by: Shawn Guo shawn@linaro.org
 Cc: Greg Kroah-Hartman gre...@linuxfoundation.org
 Cc: linux-usb@vger.kernel.org

Acked-by: Greg Kroah-Hartman gre...@linuxfoundation.org
--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 6/8] usb/gadget: free requests in pn_bind()'s error path

2012-09-17 Thread Sergei Shtylyov

Hello.

On 16-09-2012 23:58, Sebastian Andrzej Siewior wrote:


Signed-off-by: Sebastian Andrzej Siewior bige...@linutronix.de
---
  drivers/usb/gadget/f_phonet.c |8 ++--
  1 file changed, 6 insertions(+), 2 deletions(-)



diff --git a/drivers/usb/gadget/f_phonet.c b/drivers/usb/gadget/f_phonet.c
index 8ee9268..a6c19a4 100644
--- a/drivers/usb/gadget/f_phonet.c
+++ b/drivers/usb/gadget/f_phonet.c

[...]

@@ -540,14 +540,18 @@ int pn_bind(struct usb_configuration *c, struct 
usb_function *f)
/* Outgoing USB requests */
fp-in_req = usb_ep_alloc_request(fp-in_ep, GFP_KERNEL);
if (!fp-in_req)
-   goto err;
+   goto err_req;

INFO(cdev, USB CDC Phonet function\n);
INFO(cdev, using %s, OUT %s, IN %s\n, cdev-gadget-name,
fp-out_ep-name, fp-in_ep-name);
return 0;

+err_req:
+   for (i = 0; i  phonet_rxq_size  fp-out_reqv[i]; i++)
+   usb_ep_free_request(fp-out_ep, fp-out_reqv[i]);
  err:
+


   Why empty line here?


if (fp-out_ep)
fp-out_ep-driver_data = NULL;
if (fp-in_ep)


WBR, Sergei

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 3/8] usb/gadget: remove c-highpseed = true from f_mini and uac1

2012-09-17 Thread Sergei Shtylyov

Hello.

On 16-09-2012 23:58, Sebastian Andrzej Siewior wrote:


Whether highspeed configuration is valid or not is something that
composite decides and not the gadget. That gadget can only provide the
required descriptors for it.



Signed-off-by: Sebastian Andrzej Siewior bige...@linutronix.de
---
  drivers/usb/gadget/f_midi.c |1 -
  drivers/usb/gadget/f_uac1.c |1 -
  2 files changed, 2 deletions(-)


[...]


diff --git a/drivers/usb/gadget/f_uac1.c b/drivers/usb/gadget/f_uac1.c
index 1a5dcd5..c8ed41b 100644
--- a/drivers/usb/gadget/f_uac1.c
+++ b/drivers/usb/gadget/f_uac1.c
@@ -667,7 +667,6 @@ f_audio_bind(struct usb_configuration *c, struct 
usb_function *f)
 * both speeds
 */
if (gadget_is_dualspeed(c-cdev-gadget)) {
-   c-highspeed = true;
f-hs_descriptors = usb_copy_descriptors(f_audio_desc);
}


   Should have removed {} as well. Doesn't checkpatch.pl warn about them?

WBR, Sergei

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 00/34] i.MX multi-platform support

2012-09-17 Thread Arnd Bergmann
On Monday 17 September 2012, Sascha Hauer wrote:
 On Mon, Sep 17, 2012 at 01:34:29PM +0800, Shawn Guo wrote:
  The series enables multi-platform support for imx.  Since the required
  frameworks (clk, pwm) and spare_irq have already been adopted on imx,
  the series is all about cleaning up mach/* headers.  Along with the
  changes, arch/arm/plat-mxc gets merged into arch/arm/mach-imx.
  
  It's based on a bunch of branches (works from others), Rob's initial
  multi-platform series, Arnd's platform-data and smp_ops (Marc's) and
  imx 3.7 material (Sascha and myself).
  
  It's available on branch below.
  
git://git.linaro.org/people/shawnguo/linux-2.6.git imx/multi-platform
  
  It's been tested on imx5 and imx6, and only compile-tested on imx2 and
  imx3, so testing on imx2/3 are appreciated.
 
 Great work! This really pushes the i.MX architecture one step closer to
 a clean code base.

I agree, this series is wonderful, I thought it would take much longer
to get this far.

Two small comments on the last two patches from me, but overall I really
love it.

Acked-by: Arnd Bergmann a...@arndb.de
--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] staging: usbip: stub_dev: Fixed oops during removal of usbip_host

2012-09-17 Thread Greg KH
On Fri, Sep 14, 2012 at 03:23:23PM +0530, navin patidar wrote:
 ---
 
 This e-mail is for the sole use of the intended recipient(s) and may
 contain confidential and privileged information. If you are not the
 intended recipient, please contact the sender by reply e-mail and destroy
 all copies and the original message. Any unauthorized review, use,
 disclosure, dissemination, forwarding, printing or copying of this email
 is strictly prohibited and appropriate legal action will be taken.
 ---

As others have pointed out, I can not accept patches sent with this type
of wording in them, sorry.  Please fix your email system and try again.

greg k-h
--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v6 0/5] usb: phy: samsung: Introducing usb phy driver for samsung SoCs

2012-09-17 Thread Praveen Paneri
Changes from v5:
Moved clk_get() to driver's probe function. Now reference clock frequency
selection value is stored in samsung_usbphy structure for later use. Used
IS_ENABLED() instead of #ifdef in samsung_usbphy_get_driver_data().

Changes from v4:
Moved header file contents to driver's source file
Removed unnecessary print message from driver's probe function
Dropped the Free Software Foundation address from the header
Changed the platform data code to use __initdata

Changes from v3:
Replaced susbsys_initcall()/module_exit() by module_platform_driver().
Accordingly in the hsotg driver returned -EPROBE_DEFER until phy driver
is registered
Removed unnecessary devm_usb_put_phy() call from the hsotg driver remove.

Changes from v2:
Changed the driver filenames to samsung-usbphy
Changed 's3c' to 'samsung' for platform device as well as platform data
Moved platform data structure to a separate file
Rectified coding style related errors

Changes from v1:
Rebased patches to latest usb-next branch
Changed the name 'sec_usbphy' to 'samsung_usbphy'

This patch set introduces a phy driver for samsung SoCs. It uses the existing
transceiver infrastructure to provide phy control functions. Use of this driver
can be extended for usb host phy as well. Over the period of time all the phy
related code for most of the samsung SoCs can be integrated here.
Removing the existing phy code from mach-s3c64xx. Same can be done for other 
SoCs
when they start supporting this phy driver. 
This driver is tested with smdk6410 and Exynos4210(with DT).

Praveen Paneri (5):
  usb: phy: samsung: Introducing usb phy driver for hsotg
  usb: s3c-hsotg: Adding phy driver support
  ARM: S3C64XX: Removing old phy setup code
  ARM: S3C64XX: Enabling samsung-usbphy driver
  ARM: Exynos4210: Enabling samsung-usbphy driver

 .../devicetree/bindings/usb/samsung-usbphy.txt |9 +
 arch/arm/boot/dts/exynos4210.dtsi  |5 +
 arch/arm/mach-exynos/include/mach/map.h|1 +
 arch/arm/mach-exynos/mach-exynos4-dt.c |8 +
 arch/arm/mach-exynos/setup-usb-phy.c   |   13 +
 arch/arm/mach-s3c64xx/include/mach/map.h   |2 +
 arch/arm/mach-s3c64xx/mach-crag6410.c  |   10 +-
 arch/arm/mach-s3c64xx/mach-smartq.c|   11 +-
 arch/arm/mach-s3c64xx/mach-smdk6410.c  |   10 +-
 arch/arm/mach-s3c64xx/setup-usb-phy.c  |   79 +
 arch/arm/plat-samsung/devs.c   |   28 ++
 arch/arm/plat-samsung/include/plat/devs.h  |1 +
 arch/arm/plat-samsung/include/plat/usb-phy.h   |1 +
 drivers/usb/gadget/s3c-hsotg.c |   37 ++-
 drivers/usb/phy/Kconfig|8 +
 drivers/usb/phy/Makefile   |1 +
 drivers/usb/phy/samsung-usbphy.c   |  360 
 include/linux/platform_data/samsung-usbphy.h   |   27 ++
 18 files changed, 520 insertions(+), 91 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/usb/samsung-usbphy.txt
 create mode 100644 drivers/usb/phy/samsung-usbphy.c
 create mode 100644 include/linux/platform_data/samsung-usbphy.h

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v6 1/5] usb: phy: samsung: Introducing usb phy driver for hsotg

2012-09-17 Thread Praveen Paneri
This driver uses usb_phy interface to interact with s3c-hsotg. Supports
phy_init and phy_shutdown functions to enable/disable phy. Tested with
smdk6410 and smdkv310. More SoCs can be brought under later.

Signed-off-by: Praveen Paneri p.pan...@samsung.com
Acked-by: Heiko Stuebner he...@sntech.de
---
 .../devicetree/bindings/usb/samsung-usbphy.txt |9 +
 drivers/usb/phy/Kconfig|8 +
 drivers/usb/phy/Makefile   |1 +
 drivers/usb/phy/samsung-usbphy.c   |  360 
 include/linux/platform_data/samsung-usbphy.h   |   27 ++
 5 files changed, 405 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/usb/samsung-usbphy.txt
 create mode 100644 drivers/usb/phy/samsung-usbphy.c
 create mode 100644 include/linux/platform_data/samsung-usbphy.h

diff --git a/Documentation/devicetree/bindings/usb/samsung-usbphy.txt 
b/Documentation/devicetree/bindings/usb/samsung-usbphy.txt
new file mode 100644
index 000..fefd9c8
--- /dev/null
+++ b/Documentation/devicetree/bindings/usb/samsung-usbphy.txt
@@ -0,0 +1,9 @@
+* Samsung's usb phy transceiver
+
+The Samsung's phy transceiver is used for controlling usb otg phy for
+s3c-hsotg usb device controller.
+
+Required properties:
+- compatible : should be samsung,exynos4210-usbphy
+- reg : base physical address of the phy registers and length of memory mapped
+   region.
diff --git a/drivers/usb/phy/Kconfig b/drivers/usb/phy/Kconfig
index 63c339b..313685f 100644
--- a/drivers/usb/phy/Kconfig
+++ b/drivers/usb/phy/Kconfig
@@ -32,3 +32,11 @@ config MV_U3D_PHY
help
  Enable this to support Marvell USB 3.0 phy controller for Marvell
  SoC.
+
+config SAMSUNG_USBPHY
+   bool Samsung USB PHY controller Driver
+   depends on USB_S3C_HSOTG
+   select USB_OTG_UTILS
+   help
+ Enable this to support Samsung USB phy controller for samsung
+ SoCs.
diff --git a/drivers/usb/phy/Makefile b/drivers/usb/phy/Makefile
index b069f29..55dcfc1 100644
--- a/drivers/usb/phy/Makefile
+++ b/drivers/usb/phy/Makefile
@@ -8,3 +8,4 @@ obj-$(CONFIG_OMAP_USB2) += omap-usb2.o
 obj-$(CONFIG_USB_ISP1301)  += isp1301.o
 obj-$(CONFIG_MV_U3D_PHY)   += mv_u3d_phy.o
 obj-$(CONFIG_USB_EHCI_TEGRA)   += tegra_usb_phy.o
+obj-$(CONFIG_SAMSUNG_USBPHY)   += samsung-usbphy.o
diff --git a/drivers/usb/phy/samsung-usbphy.c b/drivers/usb/phy/samsung-usbphy.c
new file mode 100644
index 000..95ec4d0
--- /dev/null
+++ b/drivers/usb/phy/samsung-usbphy.c
@@ -0,0 +1,360 @@
+/* linux/drivers/usb/phy/samsung-usbphy.c
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd.
+ *  http://www.samsung.com
+ *
+ * Author: Praveen Paneri p.pan...@samsung.com
+ *
+ * Samsung USB2.0 High-speed OTG transceiver, talks to S3C HS OTG controller
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include linux/module.h
+#include linux/platform_device.h
+#include linux/clk.h
+#include linux/delay.h
+#include linux/err.h
+#include linux/io.h
+#include linux/of.h
+#include linux/usb/otg.h
+#include linux/platform_data/samsung-usbphy.h
+
+/* Register definitions */
+
+#define S3C_PHYPWR (0x00)
+
+#define S3C_PHYPWR_NORMAL_MASK (0x19  0)
+#define S3C_PHYPWR_OTG_DISABLE (1  4)
+#define S3C_PHYPWR_ANALOG_POWERDOWN(1  3)
+#define S3C_PHYPWR_FORCE_SUSPEND   (1  1)
+/* For Exynos4 */
+#define EXYNOS4_PHYPWR_NORMAL_MASK (0x39  0)
+#define EXYNOS4_PHYPWR_SLEEP   (1  5)
+
+#define S3C_PHYCLK (0x04)
+
+#define S3C_PHYCLK_MODE_SERIAL (1  6)
+#define S3C_PHYCLK_EXT_OSC (1  5)
+#define S3C_PHYCLK_COMMON_ON_N (1  4)
+#define S3C_PHYCLK_ID_PULL (1  2)
+#define S3C_PHYCLK_CLKSEL_MASK (0x3  0)
+#define S3C_PHYCLK_CLKSEL_SHIFT(0)
+#define S3C_PHYCLK_CLKSEL_48M  (0x0  0)
+#define S3C_PHYCLK_CLKSEL_12M  (0x2  0)
+#define S3C_PHYCLK_CLKSEL_24M  (0x3  0)
+
+#define S3C_RSTCON (0x08)
+
+#define S3C_RSTCON_PHYCLK  (1  2)
+#define S3C_RSTCON_HCLK(1  1)
+#define S3C_RSTCON_PHY (1  0)
+
+#ifndef MHZ
+#define MHZ (1000*1000)
+#endif
+
+enum samsung_cpu_type {
+   TYPE_S3C64XX,
+   TYPE_EXYNOS4210,
+};
+
+/*
+ * struct samsung_usbphy 

[PATCH v6 2/5] usb: s3c-hsotg: Adding phy driver support

2012-09-17 Thread Praveen Paneri
Adding the transceiver to hsotg driver. Keeping the platform data
for continuing the smooth operation for boards which still uses it

Signed-off-by: Praveen Paneri p.pan...@samsung.com
---
 drivers/usb/gadget/s3c-hsotg.c |   37 +++--
 1 files changed, 27 insertions(+), 10 deletions(-)

diff --git a/drivers/usb/gadget/s3c-hsotg.c b/drivers/usb/gadget/s3c-hsotg.c
index 6f696ee..29815b9 100644
--- a/drivers/usb/gadget/s3c-hsotg.c
+++ b/drivers/usb/gadget/s3c-hsotg.c
@@ -32,6 +32,7 @@
 
 #include linux/usb/ch9.h
 #include linux/usb/gadget.h
+#include linux/usb/otg.h
 #include linux/platform_data/s3c-hsotg.h
 
 #include mach/map.h
@@ -133,7 +134,9 @@ struct s3c_hsotg_ep {
  * struct s3c_hsotg - driver state.
  * @dev: The parent device supplied to the probe function
  * @driver: USB gadget driver
- * @plat: The platform specific configuration data.
+ * @phy: The otg phy transceiver structure for phy control.
+ * @plat: The platform specific configuration data. This can be removed once
+ * all SoCs support usb transceiver.
  * @regs: The memory area mapped for accessing registers.
  * @irq: The IRQ number we are using
  * @supplies: Definition of USB power supplies
@@ -153,6 +156,7 @@ struct s3c_hsotg_ep {
 struct s3c_hsotg {
struct device*dev;
struct usb_gadget_driver *driver;
+   struct usb_phy  *phy;
struct s3c_hsotg_plat*plat;
 
spinlock_t  lock;
@@ -2854,7 +2858,10 @@ static void s3c_hsotg_phy_enable(struct s3c_hsotg *hsotg)
struct platform_device *pdev = to_platform_device(hsotg-dev);
 
dev_dbg(hsotg-dev, pdev 0x%p\n, pdev);
-   if (hsotg-plat-phy_init)
+
+   if (hsotg-phy)
+   usb_phy_init(hsotg-phy);
+   else if (hsotg-plat-phy_init)
hsotg-plat-phy_init(pdev, hsotg-plat-phy_type);
 }
 
@@ -2869,7 +2876,9 @@ static void s3c_hsotg_phy_disable(struct s3c_hsotg *hsotg)
 {
struct platform_device *pdev = to_platform_device(hsotg-dev);
 
-   if (hsotg-plat-phy_exit)
+   if (hsotg-phy)
+   usb_phy_shutdown(hsotg-phy);
+   else if (hsotg-plat-phy_exit)
hsotg-plat-phy_exit(pdev, hsotg-plat-phy_type);
 }
 
@@ -3493,6 +3502,7 @@ static void s3c_hsotg_release(struct device *dev)
 static int __devinit s3c_hsotg_probe(struct platform_device *pdev)
 {
struct s3c_hsotg_plat *plat = pdev-dev.platform_data;
+   struct usb_phy *phy;
struct device *dev = pdev-dev;
struct s3c_hsotg_ep *eps;
struct s3c_hsotg *hsotg;
@@ -3501,20 +3511,27 @@ static int __devinit s3c_hsotg_probe(struct 
platform_device *pdev)
int ret;
int i;
 
-   plat = pdev-dev.platform_data;
-   if (!plat) {
-   dev_err(pdev-dev, no platform data defined\n);
-   return -EINVAL;
-   }
-
hsotg = devm_kzalloc(pdev-dev, sizeof(struct s3c_hsotg), GFP_KERNEL);
if (!hsotg) {
dev_err(dev, cannot get memory\n);
return -ENOMEM;
}
 
+   plat = pdev-dev.platform_data;
+   if (!plat) {
+   /* Fallback for transceiver */
+   phy = devm_usb_get_phy(dev, USB_PHY_TYPE_USB2);
+   if (IS_ERR_OR_NULL(phy)) {
+   dev_err(pdev-dev, no platform data or transceiver 
defined\n);
+   return -EPROBE_DEFER;
+   } else {
+   hsotg-phy = phy;
+   }
+   } else {
+   hsotg-plat = plat;
+   }
+
hsotg-dev = dev;
-   hsotg-plat = plat;
 
hsotg-clk = devm_clk_get(pdev-dev, otg);
if (IS_ERR(hsotg-clk)) {
-- 
1.7.1

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v6 3/5] ARM: S3C64XX: Removing old phy setup code

2012-09-17 Thread Praveen Paneri
This patch removes old phy code from platform side. 'setup-usb-phy.c'
will be used for providing transceiver platform data in next
patch. Not all of the platform data code is removed as there are others
making use of platform_data defined for hsotg. That can be removed once
all the SoCs start using the new transceiver for usb phy setup.

Signed-off-by: Praveen Paneri p.pan...@samsung.com
---
 arch/arm/mach-s3c64xx/mach-crag6410.c |3 -
 arch/arm/mach-s3c64xx/mach-smartq.c   |3 -
 arch/arm/mach-s3c64xx/mach-smdk6410.c |3 -
 arch/arm/mach-s3c64xx/setup-usb-phy.c |   79 -
 4 files changed, 0 insertions(+), 88 deletions(-)

diff --git a/arch/arm/mach-s3c64xx/mach-crag6410.c 
b/arch/arm/mach-s3c64xx/mach-crag6410.c
index 09cd812..b0f5baf 100644
--- a/arch/arm/mach-s3c64xx/mach-crag6410.c
+++ b/arch/arm/mach-s3c64xx/mach-crag6410.c
@@ -31,7 +31,6 @@
 #include linux/spi/spi.h
 
 #include linux/i2c/pca953x.h
-#include linux/platform_data/s3c-hsotg.h
 
 #include video/platform_lcd.h
 
@@ -766,7 +765,6 @@ static const struct gpio_led_platform_data gpio_leds_pdata 
= {
.num_leds = ARRAY_SIZE(gpio_leds),
 };
 
-static struct s3c_hsotg_plat crag6410_hsotg_pdata;
 
 static void __init crag6410_machine_init(void)
 {
@@ -792,7 +790,6 @@ static void __init crag6410_machine_init(void)
s3c_i2c0_set_platdata(i2c0_pdata);
s3c_i2c1_set_platdata(i2c1_pdata);
s3c_fb_set_platdata(crag6410_lcd_pdata);
-   s3c_hsotg_set_platdata(crag6410_hsotg_pdata);
 
i2c_register_board_info(0, i2c_devs0, ARRAY_SIZE(i2c_devs0));
i2c_register_board_info(1, i2c_devs1, ARRAY_SIZE(i2c_devs1));
diff --git a/arch/arm/mach-s3c64xx/mach-smartq.c 
b/arch/arm/mach-s3c64xx/mach-smartq.c
index ceeb1de..7400da1 100644
--- a/arch/arm/mach-s3c64xx/mach-smartq.c
+++ b/arch/arm/mach-s3c64xx/mach-smartq.c
@@ -18,7 +18,6 @@
 #include linux/serial_core.h
 #include linux/spi/spi_gpio.h
 #include linux/usb/gpio_vbus.h
-#include linux/platform_data/s3c-hsotg.h
 
 #include asm/mach-types.h
 #include asm/mach/map.h
@@ -187,7 +186,6 @@ static struct s3c_hwmon_pdata smartq_hwmon_pdata __initdata 
= {
},
 };
 
-static struct s3c_hsotg_plat smartq_hsotg_pdata;
 
 static int __init smartq_lcd_setup_gpio(void)
 {
@@ -385,7 +383,6 @@ void __init smartq_map_io(void)
 void __init smartq_machine_init(void)
 {
s3c_i2c0_set_platdata(NULL);
-   s3c_hsotg_set_platdata(smartq_hsotg_pdata);
s3c_hwmon_set_platdata(smartq_hwmon_pdata);
s3c_sdhci1_set_platdata(smartq_internal_hsmmc_pdata);
s3c_sdhci2_set_platdata(smartq_internal_hsmmc_pdata);
diff --git a/arch/arm/mach-s3c64xx/mach-smdk6410.c 
b/arch/arm/mach-s3c64xx/mach-smdk6410.c
index 0fe4f15..cbdc91b 100644
--- a/arch/arm/mach-s3c64xx/mach-smdk6410.c
+++ b/arch/arm/mach-s3c64xx/mach-smdk6410.c
@@ -30,7 +30,6 @@
 #include linux/regulator/fixed.h
 #include linux/regulator/machine.h
 #include linux/pwm_backlight.h
-#include linux/platform_data/s3c-hsotg.h
 
 #ifdef CONFIG_SMDK6410_WM1190_EV1
 #include linux/mfd/wm8350/core.h
@@ -627,7 +626,6 @@ static struct platform_pwm_backlight_data smdk6410_bl_data 
= {
.pwm_id = 1,
 };
 
-static struct s3c_hsotg_plat smdk6410_hsotg_pdata;
 
 static void __init smdk6410_map_io(void)
 {
@@ -657,7 +655,6 @@ static void __init smdk6410_machine_init(void)
s3c_i2c0_set_platdata(NULL);
s3c_i2c1_set_platdata(NULL);
s3c_fb_set_platdata(smdk6410_lcd_pdata);
-   s3c_hsotg_set_platdata(smdk6410_hsotg_pdata);
 
samsung_keypad_set_platdata(smdk6410_keypad_data);
 
diff --git a/arch/arm/mach-s3c64xx/setup-usb-phy.c 
b/arch/arm/mach-s3c64xx/setup-usb-phy.c
index f6757e0..7a09553 100644
--- a/arch/arm/mach-s3c64xx/setup-usb-phy.c
+++ b/arch/arm/mach-s3c64xx/setup-usb-phy.c
@@ -9,82 +9,3 @@
  *
  */
 
-#include linux/clk.h
-#include linux/delay.h
-#include linux/err.h
-#include linux/io.h
-#include linux/platform_device.h
-#include mach/map.h
-#include mach/regs-sys.h
-#include plat/cpu.h
-#include plat/regs-usb-hsotg-phy.h
-#include plat/usb-phy.h
-
-static int s3c_usb_otgphy_init(struct platform_device *pdev)
-{
-   struct clk *xusbxti;
-   u32 phyclk;
-
-   writel(readl(S3C64XX_OTHERS) | S3C64XX_OTHERS_USBMASK, S3C64XX_OTHERS);
-
-   /* set clock frequency for PLL */
-   phyclk = readl(S3C_PHYCLK)  ~S3C_PHYCLK_CLKSEL_MASK;
-
-   xusbxti = clk_get(pdev-dev, xusbxti);
-   if (xusbxti  !IS_ERR(xusbxti)) {
-   switch (clk_get_rate(xusbxti)) {
-   case 12 * MHZ:
-   phyclk |= S3C_PHYCLK_CLKSEL_12M;
-   break;
-   case 24 * MHZ:
-   phyclk |= S3C_PHYCLK_CLKSEL_24M;
-   break;
-   default:
-   case 48 * MHZ:
-   /* default reference clock */
-   break;
-   }
-   clk_put(xusbxti);
-   }
-
-   /* TODO: 

[PATCH v6 4/5] ARM: S3C64XX: Enabling samsung-usbphy driver

2012-09-17 Thread Praveen Paneri
Adding platform device for samsung-usbphy driver. Enabling it for
s3c64xx based machines using s3c-hsotg.

Signed-off-by: Praveen Paneri p.pan...@samsung.com
---
 arch/arm/mach-s3c64xx/include/mach/map.h |2 +
 arch/arm/mach-s3c64xx/mach-crag6410.c|7 ++
 arch/arm/mach-s3c64xx/mach-smartq.c  |8 +++
 arch/arm/mach-s3c64xx/mach-smdk6410.c|7 ++
 arch/arm/mach-s3c64xx/setup-usb-phy.c|   14 +
 arch/arm/plat-samsung/devs.c |   28 ++
 arch/arm/plat-samsung/include/plat/devs.h|1 +
 arch/arm/plat-samsung/include/plat/usb-phy.h |1 +
 8 files changed, 68 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-s3c64xx/include/mach/map.h 
b/arch/arm/mach-s3c64xx/include/mach/map.h
index 8e2097b..dc482bb 100644
--- a/arch/arm/mach-s3c64xx/include/mach/map.h
+++ b/arch/arm/mach-s3c64xx/include/mach/map.h
@@ -65,6 +65,7 @@
 
 #define S3C64XX_PA_NAND(0x7020)
 #define S3C64XX_PA_FB  (0x7710)
+#define S3C64XX_PA_USB_HSPHY   (0x7C10)
 #define S3C64XX_PA_USB_HSOTG   (0x7C00)
 #define S3C64XX_PA_WATCHDOG(0x7E004000)
 #define S3C64XX_PA_RTC (0x7E005000)
@@ -113,6 +114,7 @@
 #define S3C_PA_FB  S3C64XX_PA_FB
 #define S3C_PA_USBHOST S3C64XX_PA_USBHOST
 #define S3C_PA_USB_HSOTG   S3C64XX_PA_USB_HSOTG
+#define S3C_PA_USB_PHY S3C64XX_PA_USB_HSPHY
 #define S3C_PA_RTC S3C64XX_PA_RTC
 #define S3C_PA_WDT S3C64XX_PA_WATCHDOG
 #define S3C_PA_SPI0S3C64XX_PA_SPI0
diff --git a/arch/arm/mach-s3c64xx/mach-crag6410.c 
b/arch/arm/mach-s3c64xx/mach-crag6410.c
index b0f5baf..adc2e15 100644
--- a/arch/arm/mach-s3c64xx/mach-crag6410.c
+++ b/arch/arm/mach-s3c64xx/mach-crag6410.c
@@ -31,6 +31,7 @@
 #include linux/spi/spi.h
 
 #include linux/i2c/pca953x.h
+#include linux/platform_data/samsung-usbphy.h
 
 #include video/platform_lcd.h
 
@@ -69,6 +70,7 @@
 #include plat/adc.h
 #include plat/iic.h
 #include plat/pm.h
+#include plat/usb-phy.h
 
 #include common.h
 
@@ -336,6 +338,7 @@ static struct platform_device wallvdd_device = {
 };
 
 static struct platform_device *crag6410_devices[] __initdata = {
+   samsung_device_usbphy,
s3c_device_hsmmc0,
s3c_device_hsmmc2,
s3c_device_i2c0,
@@ -765,6 +768,9 @@ static const struct gpio_led_platform_data gpio_leds_pdata 
= {
.num_leds = ARRAY_SIZE(gpio_leds),
 };
 
+static struct samsung_usbphy_data crag6410_usbphy_pdata __initdata = {
+   .pmu_isolation = s5p_usb_phy_pmu_isolation,
+};
 
 static void __init crag6410_machine_init(void)
 {
@@ -790,6 +796,7 @@ static void __init crag6410_machine_init(void)
s3c_i2c0_set_platdata(i2c0_pdata);
s3c_i2c1_set_platdata(i2c1_pdata);
s3c_fb_set_platdata(crag6410_lcd_pdata);
+   samsung_usbphy_set_pdata(crag6410_usbphy_pdata);
 
i2c_register_board_info(0, i2c_devs0, ARRAY_SIZE(i2c_devs0));
i2c_register_board_info(1, i2c_devs1, ARRAY_SIZE(i2c_devs1));
diff --git a/arch/arm/mach-s3c64xx/mach-smartq.c 
b/arch/arm/mach-s3c64xx/mach-smartq.c
index 7400da1..90dc821 100644
--- a/arch/arm/mach-s3c64xx/mach-smartq.c
+++ b/arch/arm/mach-s3c64xx/mach-smartq.c
@@ -18,6 +18,7 @@
 #include linux/serial_core.h
 #include linux/spi/spi_gpio.h
 #include linux/usb/gpio_vbus.h
+#include linux/platform_data/samsung-usbphy.h
 
 #include asm/mach-types.h
 #include asm/mach/map.h
@@ -36,6 +37,7 @@
 #include plat/usb-control.h
 #include plat/sdhci.h
 #include plat/ts.h
+#include plat/usb-phy.h
 
 #include video/platform_lcd.h
 
@@ -234,6 +236,7 @@ static struct i2c_board_info smartq_i2c_devs[] __initdata = 
{
 };
 
 static struct platform_device *smartq_devices[] __initdata = {
+   samsung_device_usbphy,
s3c_device_hsmmc1, /* Init iNAND first, ... */
s3c_device_hsmmc0, /* ... then the external SD card */
s3c_device_hsmmc2,
@@ -380,9 +383,14 @@ void __init smartq_map_io(void)
smartq_lcd_mode_set();
 }
 
+static struct samsung_usbphy_data smartq_usbphy_pdata __initdata = {
+   .pmu_isolation = s5p_usb_phy_pmu_isolation,
+};
+
 void __init smartq_machine_init(void)
 {
s3c_i2c0_set_platdata(NULL);
+   samsung_usbphy_set_pdata(smartq_usbphy_pdata);
s3c_hwmon_set_platdata(smartq_hwmon_pdata);
s3c_sdhci1_set_platdata(smartq_internal_hsmmc_pdata);
s3c_sdhci2_set_platdata(smartq_internal_hsmmc_pdata);
diff --git a/arch/arm/mach-s3c64xx/mach-smdk6410.c 
b/arch/arm/mach-s3c64xx/mach-smdk6410.c
index cbdc91b..4cf1252 100644
--- a/arch/arm/mach-s3c64xx/mach-smdk6410.c
+++ b/arch/arm/mach-s3c64xx/mach-smdk6410.c
@@ -30,6 +30,7 @@
 #include linux/regulator/fixed.h
 #include linux/regulator/machine.h
 #include linux/pwm_backlight.h
+#include linux/platform_data/samsung-usbphy.h
 
 #ifdef CONFIG_SMDK6410_WM1190_EV1
 #include linux/mfd/wm8350/core.h
@@ -72,6 +73,7 @@
 #include plat/keypad.h
 #include 

[PATCH v6 5/5] ARM: Exynos4210: Enabling samsung-usbphy driver

2012-09-17 Thread Praveen Paneri
Adding usbphy node for Exynos4210 along with the platform data.

Signed-off-by: Praveen Paneri p.pan...@samsung.com
---
 arch/arm/boot/dts/exynos4210.dtsi   |5 +
 arch/arm/mach-exynos/include/mach/map.h |1 +
 arch/arm/mach-exynos/mach-exynos4-dt.c  |8 
 arch/arm/mach-exynos/setup-usb-phy.c|   13 +
 4 files changed, 27 insertions(+), 0 deletions(-)

diff --git a/arch/arm/boot/dts/exynos4210.dtsi 
b/arch/arm/boot/dts/exynos4210.dtsi
index 02891fe..e28cf10 100644
--- a/arch/arm/boot/dts/exynos4210.dtsi
+++ b/arch/arm/boot/dts/exynos4210.dtsi
@@ -62,6 +62,11 @@
interrupts = 0 44 0, 0 45 0;
};
 
+   usbphy@125B {
+   compatible = samsung,exynos4210-usbphy;
+   reg = 0x125B 0x100;
+   };
+
keypad@100A {
compatible = samsung,s5pv210-keypad;
reg = 0x100A 0x100;
diff --git a/arch/arm/mach-exynos/include/mach/map.h 
b/arch/arm/mach-exynos/include/mach/map.h
index c72b675..0625c0a 100644
--- a/arch/arm/mach-exynos/include/mach/map.h
+++ b/arch/arm/mach-exynos/include/mach/map.h
@@ -234,6 +234,7 @@
 #define S3C_PA_SPI1EXYNOS4_PA_SPI1
 #define S3C_PA_SPI2EXYNOS4_PA_SPI2
 #define S3C_PA_USB_HSOTG   EXYNOS4_PA_HSOTG
+#define S3C_PA_USB_PHY EXYNOS4_PA_HSPHY
 
 #define S5P_PA_EHCIEXYNOS4_PA_EHCI
 #define S5P_PA_FIMC0   EXYNOS4_PA_FIMC0
diff --git a/arch/arm/mach-exynos/mach-exynos4-dt.c 
b/arch/arm/mach-exynos/mach-exynos4-dt.c
index b2b5d5f..0739be8 100644
--- a/arch/arm/mach-exynos/mach-exynos4-dt.c
+++ b/arch/arm/mach-exynos/mach-exynos4-dt.c
@@ -13,6 +13,7 @@
 
 #include linux/of_platform.h
 #include linux/serial_core.h
+#include linux/platform_data/samsung-usbphy.h
 
 #include asm/mach/arch.h
 #include asm/hardware/gic.h
@@ -20,9 +21,14 @@
 
 #include plat/cpu.h
 #include plat/regs-serial.h
+#include plat/usb-phy.h
 
 #include common.h
 
+static struct samsung_usbphy_data exynos4_usbphy_pdata = {
+   .pmu_isolation = s5p_usb_phy_pmu_isolation,
+};
+
 /*
  * The following lookup table is used to override device names when devices
  * are registered from device tree. This is temporarily added to enable
@@ -63,6 +69,8 @@ static const struct of_dev_auxdata 
exynos4210_auxdata_lookup[] __initconst = {
exynos4210-spi.2, NULL),
OF_DEV_AUXDATA(arm,pl330, EXYNOS4_PA_PDMA0, dma-pl330.0, NULL),
OF_DEV_AUXDATA(arm,pl330, EXYNOS4_PA_PDMA1, dma-pl330.1, NULL),
+   OF_DEV_AUXDATA(samsung,exynos4210-usbphy, EXYNOS4_PA_HSPHY,
+   s3c-usbphy, exynos4_usbphy_pdata),
{},
 };
 
diff --git a/arch/arm/mach-exynos/setup-usb-phy.c 
b/arch/arm/mach-exynos/setup-usb-phy.c
index b81cc56..1c62d20 100644
--- a/arch/arm/mach-exynos/setup-usb-phy.c
+++ b/arch/arm/mach-exynos/setup-usb-phy.c
@@ -221,3 +221,16 @@ int s5p_usb_phy_exit(struct platform_device *pdev, int 
type)
 
return -EINVAL;
 }
+
+void s5p_usb_phy_pmu_isolation(int on)
+{
+   if (on) {
+   writel(readl(S5P_USBDEVICE_PHY_CONTROL)
+~S5P_USBDEVICE_PHY_ENABLE,
+   S5P_USBDEVICE_PHY_CONTROL);
+   } else {
+   writel(readl(S5P_USBDEVICE_PHY_CONTROL)
+   | S5P_USBDEVICE_PHY_ENABLE,
+   S5P_USBDEVICE_PHY_CONTROL);
+   }
+}
-- 
1.7.1

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFC PATCH 3/3] usbnet: support runtime PM triggered by link change

2012-09-17 Thread Ming Lei
On Mon, Sep 17, 2012 at 4:50 PM, Oliver Neukum oneu...@suse.de wrote:
 On Sunday 16 September 2012 01:48:19 Ming Lei wrote:


 +void usbnet_link_updated(struct usbnet *dev)
 +{
 + complete(dev-link_update_completion);
 +}
 +EXPORT_SYMBOL_GPL(usbnet_link_updated);

 Isn't that a bit too trivial to get the _GPL version?

OK, will use the non GPL version.


 +#define usbnet_link_suspend(dev) do { \
 + dev_dbg(dev-intf-dev, %s:link suspend, __func__); \
 + usb_autopm_put_interface_async(dev-intf); \
 +} while(0)
 +
 +#define usbnet_link_resume(dev) do { \
 + dev_dbg(dev-intf-dev, %s:link resume, __func__); \
 + usb_autopm_get_interface_async(dev-intf); \
 +} while(0)

 Why macros?

Just for easy debug by dumping the caller function name.



 [..]
 +/* called by usbnet_open */
 +static void enable_link_runtime_pm(struct usbnet *dev)
 +{
 + dev-link_rpm_enabled = 1;
 +
 + if (!dev-link_remote_wakeup) {
 + dev-old_autosuspend_delay =
 + dev-udev-dev.power.autosuspend_delay;
 + pm_runtime_set_autosuspend_delay(dev-udev-dev, 1);

 This is a problem. Suppose the user changes the autosuspend timeout.
 You cannot assume that the old value remains valid.

Good catch, I will fix it in -v1 by reading again the timeout value in
disable_link_runtime_pm().

 + }
 +
 + if (!netif_carrier_ok(dev-net)) {
 + dev-link_open_suspend = 1;
 + usbnet_link_suspend(dev);
 + }
 +}

 +static void update_link_state(struct usbnet *dev)
 +{
 + char*buf = NULL;
 + unsignedpipe = 0;
 + unsignedmaxp;
 + int ret, act_len, timeout;
 + struct urb  urb;
 +
 + pipe = usb_rcvintpipe(dev-udev,
 +   dev-status-desc.bEndpointAddress
 +  USB_ENDPOINT_NUMBER_MASK);
 + maxp = usb_maxpacket(dev-udev, pipe, 0);
 +
 + /*
 +  * Take default timeout as 2 times of period.
 +  * It is observed that asix device can update its link
 +  * state duing one period(128ms). Low level driver can set
 +  * its default update link time in bind() callback.
 +  */
 + if (!dev-link_update_timeout) {
 + timeout = max((int) dev-status-desc.bInterval,
 + (dev-udev-speed == USB_SPEED_HIGH) ? 7 : 3);
 + timeout = 1  timeout;
 + if (dev-udev-speed == USB_SPEED_HIGH)
 + timeout /= 8;
 + if (timeout  128)
 + timeout = 128;
 + } else
 + timeout = dev-link_update_timeout;
 +
 + buf = kmalloc(maxp, GFP_KERNEL);
 + if (!buf)
 + return;
 +
 + dev_dbg(dev-intf-dev, %s: timeout %dms\n, __func__, timeout);
 + ret = usb_interrupt_msg(dev-udev, pipe, buf, maxp,
 + act_len, timeout);
 + if (!ret) {
 + urb.status = 0;
 + urb.actual_length = act_len;
 + urb.transfer_buffer = buf;
 + urb.transfer_buffer_length = maxp;
 + dev-driver_info-status(dev, urb);
 + if (dev-driver_info-flags 
 + FLAG_LINK_UPDATE_BY_DRIVER)
 + wait_for_completion(dev-link_update_completion);

 If a driver calls usbnet_link_updated() from the same workqueue this
 will deadlock.

Good catch, I will fix it in -v1 by using system_freezable_wq.


 + dev_dbg(dev-intf-dev, %s: link updated\n, __func__);
 + } else
 + dev_dbg(dev-intf-dev, %s: link update failed %d\n,
 + __func__, ret);
 + kfree(buf);
 +}

 [..]
 @@ -795,6 +977,9 @@ int usbnet_open (struct net_device *net)
   if (retval  0)
   goto done_manage_power_error;
   usb_autopm_put_interface(dev-intf);
 + } else {
 + if (need_link_runtime_pm(dev))
 + enable_link_runtime_pm(dev);
   }
   return retval;

 @@ -1489,6 +1674,8 @@ usbnet_probe (struct usb_interface *udev, const struct 
 usb_device_id *prod)
   if (dev-driver_info-flags  FLAG_LINK_INTR)
   usbnet_link_change(dev, 0, 0);

 + init_link_rpm(dev);
 +
   return 0;

  out4:
 @@ -1538,6 +1725,9 @@ int usbnet_suspend (struct usb_interface *intf, 
 pm_message_t message)
* wake the device
*/
   netif_device_attach (dev-net);
 +
 + if (PMSG_IS_AUTO(message))
 + start_link_detect(dev);

 What happens if the device is autosuspended, then the system is suspended
 and the work is executed while the suspension is underway?

IMO we can avoid the problem by scheduling 'link_detect_work' on the
workqueue of 'system_freezable_wq', which will be introduced in -v1.


   }
   return 0;
  }
 @@ -1552,8 +1742,10 @@ int usbnet_resume (struct usb_interface *intf)

   if (!--dev-suspend_count) {
   /* resume interrupt URBs */
 - 

Re: [RFC PATCH] drivers: phy: add generic PHY framework

2012-09-17 Thread Felipe Balbi
On Mon, Sep 17, 2012 at 11:19:53AM +0530, ABRAHAM, KISHON VIJAY wrote:
 Hi,
 
 On Mon, Sep 17, 2012 at 6:50 AM, Chen Peter-B29397 b29...@freescale.com 
 wrote:
 
 
  The PHY framework provides a set of API's for the PHY drivers to
  create/remove a PHY and the PHY users to obtain a reference to the PHY
  using or without using phandle. If the PHY users has to obtain a
  reference to
  the PHY without using phandle, the platform specfic intialization code
  (say
  from board file) should have already called phy_bind with the binding
  information. The binding information consists of phy's device name, phy
  user device name and an index. The index is used when the same phy user
  binds to mulitple phys.
 
 
  What's an example of the same phy user binds to multiple phys?
 
 Single controller using multiple phys..

to be more specific here: any usb3 controller needs a USB2 PHY and USB3
PHY.

-- 
balbi


signature.asc
Description: Digital signature


Re: Question regarding kernel 3.5 dropping support for usbfs

2012-09-17 Thread Unknown
(trimmed out some of the older details)

On Sun, 2012-09-16 at 16:43 -0700, Greg KH wrote:
 On Sun, Sep 16, 2012 at 01:38:56PM -0400, Unknown wrote:
  
  To clarify, manually running the fxload command myself is not desirable,
  I'd like the firmware to load when I plugin the device.
 
 I agree, it should just work, and udev should handle it just fine.  What
 changed to cause it to break?  Your udev rule?  If so, what distro are
 you using that doesn't handle devtmpfs properly?
 

I am using Gentoo Linux. When I moved to the 3.5.0 kernel, the firmware
loading for this one device stopped working. The device is a m-audio
midisport 2x2, the firmware and udev rule came from a very old download
- I have been carrying it forward with my systems for the past 5 or 6
years. To my knowledge the midisport firmware is not a part of any
distribution.

  
  If using devtmpfs is the  go-forward solution then should I research how
  to  pass the devtmpfs path to the udev rule?
 
 It should already be working with the default set of udev rules, right?
 

I am only a novice at udev rules, as they normally just work so I
haven't had to modify them. But my guess is that without the usbfs the
path to my device is not being passed to the udev RUN command. From my
limited reading, I think the device path is set in an environment
variable. Maybe there is some simple tweak to the udev rule to make it
work?

It sounds like this is the next logical line of inquiry for me. In case
anyone here can help, below is the udev rule for my device. I will
search more on this udev rule topic later today.

Thanks again for the insights.

# midisport-firmware.rules - udev rules for loading firmware into
MidiSport devices

# DEVPATH==/*.0 selects interface 0 only
# (some udev versions don't work with SYSFS{bInterfaceNumber})

# MidiSport 2x2
ACTION==add, SUBSYSTEM==usb, DEVPATH==/*.0,
ENV{PRODUCT}==763/1001/*, RUN+=/sbin/fxload
-s /usr/local/share/usb/maudio/MidiSportLoader.ihx
-I /usr/local/share/usb/maudio/MidiSport2x2.ihx


-Andrew




--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Samsung SCX-3205 scanner does not work with Toshiba Satellite L855

2012-09-17 Thread Michal Nowak
On 09/13/2012 06:24 PM, Michal Nowak wrote:
 On 09/12/2012 07:24 PM, Michal Nowak wrote:
 From https://bugzilla.kernel.org/show_bug.cgi?id=47421:

 I have problems with Samsung SCX-3205 scanner on Toshiba Satellite L855.
 When is scanner connected to the notebook (via USB) I can see it via
 `scanimage -L` on first attempt but on any other attempt I can't see it
 any more, unless I turn the scanner off and on.

 Currently using 3.5.3-1.fc17.x86_64 kernel (but it also happens with
 3.6.0-0.rc4.git2.1.fc18). The latest working kernel is 2.6.39-1.fc16 on
 that hardware (2.6.40 which was in fact 3.0, I guess, does not work).

 That scanner with identical OS - Fedora 17 - worked well on Lenovo T510
 (Sandy Bridge -- USB 2.0 only), the new Toshiba L855 (Ivy Bridge with
 USB 3.0 -- xHCI) fails here.

 I somehow think it's related to the xhci driver, hence Cc-ing Sarah. Is
 there a way how to disable xhci driver in favor of ehci (xhci and ehci
 are both compiled-in), so I can try with ehci?
 
 Just to confirm it's xhci driver. I just compiled out xhci driver and
 scanner works with ehci just fine.
 

 lspci  lsusb logs in the kernel.org Bugzilla.

 Keep me Cc-ed, I am not in the m-l.

 Thanks,
 Michal


Temporary fixed by disabling USB 3.0 in BIOS.
--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] USB: remove CONFIG_EXPERIMENTAL dependancies

2012-09-17 Thread Felipe Balbi
On Fri, Sep 14, 2012 at 09:15:50PM -0700, Greg Kroah-Hartman wrote:
 From: Greg Kroah-Hartman gre...@linuxfoundation.org
 
 As discussed at the kernel summit this year, CONFIG_EXPERIMENTAL means
 nothing, so let's get rid of it.
 
 Cc: Kees Cook keesc...@chromium.org
 Cc: Felipe Balbi ba...@ti.com
 Cc: David Herrmann dh.herrm...@googlemail.com
 Cc: Hauke Mehrtens ha...@hauke-m.de
 Cc: Alan Stern st...@rowland.harvard.edu
 Cc: Neil Zhang zhan...@marvell.com
 Cc: Randy Dunlap rdun...@xenotime.net
 Cc: Fabio Estevam fabio.este...@freescale.com
 Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org

For drivers/usb/gadget:

Acked-by: Felipe Balbi ba...@ti.com

 ---
  drivers/usb/core/Kconfig |2 +-
  drivers/usb/gadget/Kconfig   |   17 ++---
  drivers/usb/host/Kconfig |   22 ++
  drivers/usb/wusbcore/Kconfig |3 +--
  4 files changed, 18 insertions(+), 26 deletions(-)
 
 Any objections to me applying this patch to the usb-next branch?
 
 diff --git a/drivers/usb/core/Kconfig b/drivers/usb/core/Kconfig
 index 9981984..f70c1a1 100644
 --- a/drivers/usb/core/Kconfig
 +++ b/drivers/usb/core/Kconfig
 @@ -56,7 +56,7 @@ config USB_SUSPEND
  
  config USB_OTG
   bool OTG support
 - depends on USB  EXPERIMENTAL
 + depends on USB
   depends on USB_SUSPEND
   default n
   help
 diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig
 index a53be32..dfb51a4 100644
 --- a/drivers/usb/gadget/Kconfig
 +++ b/drivers/usb/gadget/Kconfig
 @@ -557,7 +557,7 @@ config USB_ZERO_HNPTEST
 one serve as the USB host instead (in the B-Host role).
  
  config USB_AUDIO
 - tristate Audio Gadget (EXPERIMENTAL)
 + tristate Audio Gadget
   depends on SND
   select USB_LIBCOMPOSITE
   select SND_PCM
 @@ -672,8 +672,7 @@ config USB_G_NCM
 dynamically linked module called g_ncm.
  
  config USB_GADGETFS
 - tristate Gadget Filesystem (EXPERIMENTAL)
 - depends on EXPERIMENTAL
 + tristate Gadget Filesystem
   help
 This driver provides a filesystem based API that lets user mode
 programs implement a single-configuration USB device, including
 @@ -681,15 +680,11 @@ config USB_GADGETFS
 All endpoints, transfer speeds, and transfer types supported by
 the hardware are available, through read() and write() calls.
  
 -   Currently, this option is still labelled as EXPERIMENTAL because
 -   of existing race conditions in the underlying in-kernel AIO core.
 -
 Say y to link the driver statically, or m to build a
 dynamically linked module called gadgetfs.
  
  config USB_FUNCTIONFS
 - tristate Function Filesystem (EXPERIMENTAL)
 - depends on EXPERIMENTAL
 + tristate Function Filesystem
   select USB_LIBCOMPOSITE
   select USB_FUNCTIONFS_GENERIC if !(USB_FUNCTIONFS_ETH || 
 USB_FUNCTIONFS_RNDIS)
   help
 @@ -799,8 +794,8 @@ config USB_G_SERIAL
 make MS-Windows work with CDC ACM.
  
  config USB_MIDI_GADGET
 - tristate MIDI Gadget (EXPERIMENTAL)
 - depends on SND  EXPERIMENTAL
 + tristate MIDI Gadget
 + depends on SND
   select USB_LIBCOMPOSITE
   select SND_RAWMIDI
   help
 @@ -867,7 +862,7 @@ config USB_G_ACM_MS
 dynamically linked module called g_acm_ms.
  
  config USB_G_MULTI
 - tristate Multifunction Composite Gadget (EXPERIMENTAL)
 + tristate Multifunction Composite Gadget
   depends on BLOCK  NET
   select USB_G_MULTI_CDC if !USB_G_MULTI_RNDIS
   select USB_LIBCOMPOSITE
 diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig
 index 13cd6d5..b1deb0f 100644
 --- a/drivers/usb/host/Kconfig
 +++ b/drivers/usb/host/Kconfig
 @@ -18,8 +18,8 @@ config USB_C67X00_HCD
 module will be called c67x00.
  
  config USB_XHCI_HCD
 - tristate xHCI HCD (USB 3.0) support (EXPERIMENTAL)
 - depends on USB  USB_ARCH_HAS_XHCI  EXPERIMENTAL
 + tristate xHCI HCD (USB 3.0) support
 + depends on USB  USB_ARCH_HAS_XHCI
   ---help---
 The eXtensible Host Controller Interface (xHCI) is standard for USB 
 3.0
 SuperSpeed host controller hardware.
 @@ -262,7 +262,7 @@ config USB_ISP116X_HCD
  
  config USB_ISP1760_HCD
   tristate ISP 1760 HCD support
 - depends on USB  EXPERIMENTAL
 + depends on USB
   ---help---
 The ISP1760 chip is a USB 2.0 host controller.
  
 @@ -376,7 +376,7 @@ config USB_OHCI_HCD_PCI
  
  config USB_OHCI_HCD_SSB
   bool OHCI support for Broadcom SSB OHCI core (DEPRECATED)
 - depends on USB_OHCI_HCD  (SSB = y || SSB = USB_OHCI_HCD)  
 EXPERIMENTAL
 + depends on USB_OHCI_HCD  (SSB = y || SSB = USB_OHCI_HCD)
   select USB_HCD_SSB
   select USB_OHCI_HCD_PLATFORM
   default n
 @@ -414,7 +414,7 @@ config USB_CNS3XXX_OHCI
  
  config USB_OHCI_HCD_PLATFORM
   bool Generic OHCI driver for a platform device
 - depends on USB_OHCI_HCD  EXPERIMENTAL
 + depends on USB_OHCI_HCD

Re: Question regarding kernel 3.5 dropping support for usbfs

2012-09-17 Thread Greg KH
On Mon, Sep 17, 2012 at 09:40:15AM -0400, Unknown wrote:
 (trimmed out some of the older details)
 
 On Sun, 2012-09-16 at 16:43 -0700, Greg KH wrote:
  On Sun, Sep 16, 2012 at 01:38:56PM -0400, Unknown wrote:
   
   To clarify, manually running the fxload command myself is not desirable,
   I'd like the firmware to load when I plugin the device.
  
  I agree, it should just work, and udev should handle it just fine.  What
  changed to cause it to break?  Your udev rule?  If so, what distro are
  you using that doesn't handle devtmpfs properly?
  
 
 I am using Gentoo Linux. When I moved to the 3.5.0 kernel, the firmware
 loading for this one device stopped working. The device is a m-audio
 midisport 2x2, the firmware and udev rule came from a very old download
 - I have been carrying it forward with my systems for the past 5 or 6
 years. To my knowledge the midisport firmware is not a part of any
 distribution.

That's not good that is isn't a part of the distro, why not submit it so
it will be properly supported?  That will fix up the problem so that it
works for everyone.

The Gentoo developers can help you out with this, if it's needed.  Odds
are, you probably should just put the firmware into the lib/firmware
directory and then the default firmware udev loading rule will kick in
and handle it properly.

Hope this helps,

greg k-h
--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 3/8] usb/gadget: remove c-highpseed = true from f_mini and uac1

2012-09-17 Thread Sebastian Andrzej Siewior

On 09/17/2012 01:37 PM, Sergei Shtylyov wrote:

--- a/drivers/usb/gadget/f_uac1.c
+++ b/drivers/usb/gadget/f_uac1.c
@@ -667,7 +667,6 @@ f_audio_bind(struct usb_configuration *c, struct
usb_function *f)
* both speeds
*/
if (gadget_is_dualspeed(c-cdev-gadget)) {
- c-highspeed = true;
f-hs_descriptors = usb_copy_descriptors(f_audio_desc);
}


Should have removed {} as well. Doesn't checkpatch.pl warn about them?


I have no idea. This chunk however is removed in 8/8 so I don't see the
point in removing the braces here no matter what checkpach says.



WBR, Sergei



Sebastian
--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 6/8] usb/gadget: free requests in pn_bind()'s error path

2012-09-17 Thread Sebastian Andrzej Siewior

On 09/17/2012 01:34 PM, Sergei Shtylyov wrote:

--- a/drivers/usb/gadget/f_phonet.c
+++ b/drivers/usb/gadget/f_phonet.c

[...]

@@ -540,14 +540,18 @@ int pn_bind(struct usb_configuration *c, struct

snip


+err_req:
+ for (i = 0; i  phonet_rxq_size  fp-out_reqv[i]; i++)
+ usb_ep_free_request(fp-out_ep, fp-out_reqv[i]);
err:
+


Why empty line here?


It got probably that way while merging and splitting patches and git
did auto merging or something.
Unless you insists in removing that one I would keep that patch as it
because it gets removed/replaced in 8/8 so there is no empty line.


if (fp-out_ep)
fp-out_ep-driver_data = NULL;
if (fp-in_ep)


WBR, Sergei


Sebastian
--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 8/8] usb/gadget: always update HS/SS descriptors and create a copy of them

2012-09-17 Thread Sebastian Andrzej Siewior

On 09/17/2012 12:31 PM, Michal Nazarewicz wrote:

For changes in composite.c, config.c, f_fs.c and f_mass_storage.c:

Acked-by: Michal Nazarewiczmin...@mina86.com


Thank you.

Sebastian
--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 3/3] usb: gadget: port f_mass_storage to USB functions gadget

2012-09-17 Thread Sebastian Andrzej Siewior
* Andrzej Pietrasiewicz | 2012-09-17 09:10:00 [+0200]:

--- a/drivers/usb/gadget/f_mass_storage.c
+++ b/drivers/usb/gadget/f_mass_storage.c
@@ -2694,65 +2848,69 @@ static struct fsg_common *fsg_common_init(struct 
fsg_common *common,
   fsg_intf_desc.iInterface = rc;
   }
 
+  /* Prepare inquiryString */
+  /*if (cfg-release != 0x) {
+  i = cfg-release;
+  } else */{

What is this? 

+  i = get_default_bcdDevice();
+  if (i = 0) {
+  i = 0x0300 + i;
+  } else {
+  WARNING(common, controller '%s' not recognized\n,
+  gadget-name);
+  i = 0x0399;
+  }
+  }

Please merge properly It does not look that way, that 0x0399 got removed
while I added get_default_bcdDevice().

@@ -2994,26 +3121,41 @@ static struct usb_gadget_strings *fsg_strings_array[] 
= {
snip

-  fsg-function.name= FSG_DRIVER_DESC;
-  fsg-function.strings = fsg_strings_array;
-  fsg-function.bind= fsg_bind;
-  fsg-function.unbind  = fsg_unbind;
-  fsg-function.setup   = fsg_setup;
-  fsg-function.set_alt = fsg_set_alt;
-  fsg-function.disable = fsg_disable;
+  fsg-function.name  = FSG_DRIVER_DESC;
+  fsg-function.strings   = fsg_strings_array;
+  fsg-function.bind  = fsg_bind;
+  fsg-function.unbind= fsg_unbind;
+  fsg-function.setup = fsg_setup;
+  fsg-function.set_alt   = fsg_set_alt;
+  fsg-function.disable   = fsg_disable;

This is just cosmetic right?

--- a/drivers/usb/gadget/storage_common.c
+++ b/drivers/usb/gadget/storage_common.c
@@ -321,7 +507,7 @@ enum {
 #ifndef FSG_NO_OTG
 static struct usb_otg_descriptor
 fsg_otg_desc = {
-  .bLength =  sizeof fsg_otg_desc,
+  .bLength =  sizeof(fsg_otg_desc),
   .bDescriptorType =  USB_DT_OTG,
 
   .bmAttributes = USB_OTG_SRP,

and this coding style fixup which does not belong in here as well.
Please remove that nonsense from your patch before posting.

This patch ends with 
|+#include f_mass_storage.c

This is no good. I'm going to remove that include statement from current
gadgets in tree. But don't complain because I'm going to make the life
easier for you and this patch even smaller :) What you will get from me
is a function which gives you pointer to something that describes a function
and maybe something that configures it (including luns and ...). Not
sure yet.

Sebastian
--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 2/3] usb: gadget: Add USB functions gadget

2012-09-17 Thread Sebastian Andrzej Siewior
* Andrzej Pietrasiewicz | 2012-09-17 09:09:59 [+0200]:

Add USB functions gadget configured entirely through configfs.
This is the base for adding USB functions to it. The next patch
in the series demonstrates how to add functions.

Not looking at code. Can you give a few bash lines which setup the
gadget? Please make it work with mass storage (which is ported in 3/3)
and something else like serial or ncm (or $your_favorite) which
(ofcourse) does not work (because not yet available) but it shows the
way you plan it to behave.
What I would like to see how you add config descriptor, functions,
descrptor attributes (VID/ iSerialNUmber, iInterfce, ...) and function's
properties.

Signed-off-by: Andrzej Pietrasiewicz andrze...@samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com

Sebastian
--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 3/3] usb: gadget: port f_mass_storage to USB functions gadget

2012-09-17 Thread Sebastian Andrzej Siewior

On 09/17/2012 09:10 AM, Andrzej Pietrasiewicz wrote:

--- a/drivers/usb/gadget/f_mass_storage.c
+++ b/drivers/usb/gadget/f_mass_storage.c
@@ -2994,26 +3121,41 @@ static struct usb_gadget_strings *fsg_strings_array[] = 
{


snip


-   fsg-function.name= FSG_DRIVER_DESC;
-   fsg-function.strings = fsg_strings_array;
-   fsg-function.bind= fsg_bind;
-   fsg-function.unbind  = fsg_unbind;
-   fsg-function.setup   = fsg_setup;
-   fsg-function.set_alt = fsg_set_alt;
-   fsg-function.disable = fsg_disable;
+   fsg-function.name   = FSG_DRIVER_DESC;
+   fsg-function.strings= fsg_strings_array;
+   fsg-function.bind   = fsg_bind;
+   fsg-function.unbind = fsg_unbind;
+   fsg-function.setup  = fsg_setup;
+   fsg-function.set_alt= fsg_set_alt;
+   fsg-function.disable= fsg_disable;
+   fsg-common  = common;


Nothing happend here right? You just shifted it for no reason right? 
This and coding style fixes like



@@ -321,7 +507,7 @@ enum {
  #ifndef FSG_NO_OTG
  static struct usb_otg_descriptor
  fsg_otg_desc = {
-   .bLength =  sizeof fsg_otg_desc,
+   .bLength =  sizeof(fsg_otg_desc),
.bDescriptorType =  USB_DT_OTG,

.bmAttributes = USB_OTG_SRP,


is something I don't want see because it is not part of the actual
patch but random noise that makes me crazy.


@@ -639,6 +826,8 @@ static int fsg_lun_open(struct fsg_lun *curlun, const char 
*filename)
unsigned intblkbits;
unsigned intblksize;

+   configfs_depend_item(curlun-item.ci_group-cg_subsys,curlun-item);
+
/* R/W if we can, R/O if we must */
ro = curlun-initially_ro;
if (!ro) {
@@ -722,6 +911,9 @@ static int fsg_lun_open(struct fsg_lun *curlun, const char 
*filename)

  out:
fput(filp);
+   if (rc)
+   configfs_undepend_item(curlun-item.ci_group-cg_subsys,
+   curlun-item);
return rc;
  }

@@ -762,132 +954,3 @@ static void store_cdrom_address(u8 *dest, int msf, u32 
addr)

  /*-*/

-
-static ssize_t fsg_show_ro(struct device *dev, struct device_attribute *attr,
-  char *buf)
-{
-   struct fsg_lun  *curlun = fsg_lun_from_dev(dev);
-
-   return sprintf(buf, %d\n, fsg_lun_is_open(curlun)
- ? curlun-ro
- : curlun-initially_ro);
-}
-
-static ssize_t fsg_show_nofua(struct device *dev, struct device_attribute 
*attr,
- char *buf)
-{
-   struct fsg_lun  *curlun = fsg_lun_from_dev(dev);
-
-   return sprintf(buf, %u\n, curlun-nofua);
-}
-
-static ssize_t fsg_show_file(struct device *dev, struct device_attribute *attr,
-char *buf)
-{
-   struct fsg_lun  *curlun = fsg_lun_from_dev(dev);
-   struct rw_semaphore *filesem = dev_get_drvdata(dev);
-   char*p;
-   ssize_t rc;
-
-   down_read(filesem);
-   if (fsg_lun_is_open(curlun)) {  /* Get the complete pathname */
-   p = d_path(curlun-filp-f_path, buf, PAGE_SIZE - 1);
-   if (IS_ERR(p))
-   rc = PTR_ERR(p);
-   else {
-   rc = strlen(p);
-   memmove(buf, p, rc);
-   buf[rc] = '\n'; /* Add a newline */
-   buf[++rc] = 0;
-   }
-   } else {/* No file, return 0 bytes */
-   *buf = 0;
-   rc = 0;
-   }
-   up_read(filesem);
-   return rc;
-}
-
-
-static ssize_t fsg_store_ro(struct device *dev, struct device_attribute *attr,
-   const char *buf, size_t count)
-{
-   ssize_t rc;
-   struct fsg_lun  *curlun = fsg_lun_from_dev(dev);
-   struct rw_semaphore *filesem = dev_get_drvdata(dev);
-   unsignedro;
-
-   rc = kstrtouint(buf, 2,ro);
-   if (rc)
-   return rc;
-
-   /*
-* Allow the write-enable status to change only while the
-* backing file is closed.
-*/
-   down_read(filesem);
-   if (fsg_lun_is_open(curlun)) {
-   LDBG(curlun, read-only status change prevented\n);
-   rc = -EBUSY;
-   } else {
-   curlun-ro = ro;
-   curlun-initially_ro = ro;
-   LDBG(curlun, read-only status set to %d\n, curlun-ro);
-   rc = count;
-   }
-   up_read(filesem);
-   return rc;
-}
-
-static ssize_t fsg_store_nofua(struct device *dev,
-  struct device_attribute *attr,
-  const char *buf, size_t count)
-{
-   struct fsg_lun  *curlun = fsg_lun_from_dev(dev);
-  

Re: [PATCH 3/3] usb: gadget: port f_mass_storage to USB functions gadget

2012-09-17 Thread Sebastian Andrzej Siewior
On Mon, Sep 17, 2012 at 06:23:15PM +0200, Sebastian Andrzej Siewior wrote:

I'm sorry, this was the same thing from the other client which I planed to
cancel.

Sebastian
--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Lifetime of descriptors in f_fs

2012-09-17 Thread Sebastian Andrzej Siewior
On Sat, Sep 15, 2012 at 01:56:32AM +0200, Michal Nazarewicz wrote:
 static int __ffs_data_got_descs(struct ffs_data *ffs,
   char *const _data, size_t len)
 {
 …
 
   ffs-raw_fs_descs_length = fs_len;
   ffs-raw_descs_length= fs_len + ret;
   ffs-raw_descs   = _data;
 
 Saved for later.
 
   ffs-fs_descs_count  = fs_count;
   ffs-hs_descs_count  = hs_count;
 
   return 0;
 
 einval:
   ret = -EINVAL;
 error:
   kfree(_data);
 
 Freed on error path.
 
   return ret;
 }
Okay so it is not symetrical.

 static int __ffs_data_got_strings(struct ffs_data *ffs,
 char *const _data, size_t len)
 {
 …
 
   /*
* If we don't need any strings just return and free all
* memory.
*/
   if (!needed_count) {
   kfree(_data);
 
 Freed on quick exit.
 
   return 0;
   }
 
 …
 
   /* Done! */
   ffs-stringtabs = stringtabs;
   ffs-raw_strings = _data;
 
 Saved for later.
 
   return 0;
 
 error_free:
   kfree(stringtabs);
 error:
   kfree(_data);
 
 Freed on error path.
 
   return -EINVAL;
 }

same here.

 And later:
 
 static void ffs_data_clear(struct ffs_data *ffs)
 {
   ENTER();
 
   if (test_and_clear_bit(FFS_FL_CALL_CLOSED_CALLBACK, ffs-flags))
   functionfs_closed_callback(ffs);
 
   BUG_ON(ffs-gadget);
 
   if (ffs-epfiles)
   ffs_epfiles_destroy(ffs-epfiles, ffs-eps_count);
 
   kfree(ffs-raw_descs);
 
 Free descs saved for later.
 
   kfree(ffs-raw_strings);
 
 Free strings saved for later.
 
   kfree(ffs-stringtabs);
 }

Okay. Thanks for the update.

Sebastian
--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] usb: serial: ftdi_sio: option to hide selected interfaces of multiple interfaces convertes

2012-09-17 Thread Sebastian Andrzej Siewior
On Fri, Sep 14, 2012 at 10:08:56PM +, Robert Ryszard Paciorek wrote:
 Maybe this is a better solution, especially considering aversion to do this
 by the module parameters.
 
 Or maybe it is better to give support for I2C, SPI to ftdi_sio module and use 
 sysfs to switch betwen uart/ic2c/spi ...

If can do this on interface basis per-device it looks better.

  However back to the SPI/I2C 
  thingy. You ignore one uart port and decide to use it as SPI host right? So
  you should get a reference somehow to this port so you can register a SPI
  host to the system right? How do you do this?
 
 I plan do this with other kernel module, matching to the same device, but 
 serving other interface. I haven't complete module yet, but in first tests 
 this concept works ok.

How generic is this? I mean is this SPI mode something the chip supports or is
this just SPI over UART since you enough wires?

 Robert

Sebastian
--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] usb/core: Fix race condition when removing EHCI PCI devices

2012-09-17 Thread Don Zickus
On Thu, Sep 13, 2012 at 04:31:34PM -0400, Alan Stern wrote:
 On Thu, 13 Sep 2012, Don Zickus wrote:
 
  Hi Alan,
  
  I adapted your patch to our 2.6.32 tree and the customer tested it without
  success.  The output panic is attached below.  I will work on getting a
  machine with the latest kernel to reproduce this problem so I don't waste
  your time chasing something that might be fixed upstream.
  
  But if you could take a quick glance at the panic below to see if anything
  comes to mind I would appreciate it.
 
  The test failed on the first surprise removal of PCI devices.  Last gasp
  from the console is posted below.  I would guess the faulting process was
  reading a file under /proc/bus/usb.  I should have a dump if more info is
  needed.
 
  ehci_hcd :2c:00.0: HC died; cleaning up
  ehci_hcd :2c:00.0: force halt; handhake c9654024 4000
  4000 - -19
  ehci_hcd :2c:00.0: HC died; cleaning up
  ehci_hcd :2c:00.0: remove, state 0
  usb usb1: USB disconnect, device number 1
  usb 1-1: USB disconnect, device number 2
  usb 1-1.1: USB disconnect, device number 3
  hub 4-1:1.0: unable to enumerate USB device on port 3
  usb 1-1.3: USB disconnect, device number 4
  usb 1-1.6: USB disconnect, device number 5
  usb 1-1.6.1: USB disconnect, device number 6
  ehci_hcd :2c:00.0: USB bus 1 deregistered
  hub 4-1:1.0: unable to enumerate USB device on port 3
  general protection fault:  [#1] SMP 
  last sysfs file:
  /sys/devices/pci:00/:00:01.0/:01:00.0/:02:01.0/:3d:00.0/:3e:01.0/:66:00.0/usb3/3-1/3-1.6/3-1.6.1/3-1.6.1:1.2/input/input12/event12/uevent
  CPU 0 
  Modules linked in: autofs4 sunrpc configfs cachefiles fscache(T) bonding
  8021q garp stp llc vhost_net macvtap macvlan tun uinput ipmi_devintf
  ftmod(P)(U) ipmi_msghandler sg matroxfb(U) fosil(U) ext4 mbcache jbd2
  raid1 sr_mod cdrom sd_mod(U) crc_t10dif usb_storage mpt2sas(U)
  scsi_hbas(U) scsi_transport_sas raid_class igb(U) dca dm_mirror
  dm_region_hash dm_log dm_mod ipv6 cxgb4 cxgb3 mdio libiscsi_tcp libiscsi
  scsi_transport_iscsi [last unloaded: scsi_wait_scan]
  
  Pid: 32752, comm: cat Tainted: P   ---  T
  2.6.32-279.el6.bz849188.test01.x86_64 #1 Stratus ftServer 2700/G7LAY
  RIP: 0010:[813b8167]  [813b8167] 
  usb_device_dump+0x87/0xa70
 
 It would help to know what source statement that memory address
 corresponds to.  Offhand I can't see any remaining races between
 usb_device_dump() and usb_disconnect().

I have added some in-depth analysis from our customer.


The problem is that the failing routine was called with a pointer to usbdev in
memory that has already been freed and overwritten with the pool poison pattern.
This causes an access violation on line 502:

470 /* This is a recursive function. Parameters:
471  * buffer - the user-space buffer to write data into
472  * nbytes - the maximum number of bytes to write
473  * skip_bytes - the number of bytes to skip before writing anything
474  * file_offset - the offset into the devices file on completion
475  * The caller must own the device lock.
476  */
477 static ssize_t usb_device_dump(char __user **buffer, size_t *nbytes,
478loff_t *skip_bytes, loff_t *file_offset,
479struct usb_device *usbdev, struct usb_bus 
*bus,
480int level, int index, int count)
481 {
482 int chix;
483 int ret, cnt = 0;
484 int parent_devnum = 0;
485 char *pages_start, *data_end, *speed;
486 unsigned int length;
487 ssize_t total_written = 0;
488 
489 /* don't bother with anything else if we're not writing any data */
490 if (*nbytes = 0)
491 return 0;
492 
493 if (level  MAX_TOPO_LEVEL)
494 return 0;
495 /* allocate 2^1 pages = 8K (on i386);
496  * should be more than enough for one device */
497 pages_start = (char *)__get_free_pages(GFP_NOIO, 1);
498 if (!pages_start)
499 return -ENOMEM;
500 
501 if (usbdev-parent  usbdev-parent-devnum != -1)
502 parent_devnum = usbdev-parent-devnum;
503 /*
504  * So the root hub's parent is 0 and any device that is
505  * plugged into the root hub has a parent of 0.
506  */
507 switch (usbdev-speed) {

crash hex
output radix: 16 (hex)
crash sym 813b8167
813b8167 (t) usb_device_dump+0x87 
../debug/kernel-2.6.32-279.el6/linux-2.6.32-279.el6.bz849188.test01.x86_64/drivers/usb/core/devices.c:
 501

crash struct -o usb_device | grep parent
   [0x38] struct usb_device *parent;

Annotated listing...
crash dis usb_device_dump | cut -f 2- -d' '
usb_device_dump:  push   %rbp
usb_device_dump+0x1:  mov%rsp,%rbp
usb_device_dump+0x4:  push   %r15
usb_device_dump+0x6:  push   %r14
usb_device_dump+0x8:  push   %r13
usb_device_dump+0xa:  push   %r12

Re: [PATCH] asix: Support DLink DUB-E100 H/W Ver C1

2012-09-17 Thread David Miller
From: Søren Holm s...@sgh.dk
Date: Thu, 13 Sep 2012 15:45:40 +0200

 Signed-off-by: Søren Holm s...@sgh.dk
 Cc: sta...@vger.kernel.org

Networking patches should be submitted to net...@vger.kernel.org
--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: XHCI: URB not cancelled during disconnect of a MSC device

2012-09-17 Thread Sarah Sharp
On Fri, Sep 14, 2012 at 04:30:15PM -0400, Alan Stern wrote:
 On Fri, 14 Sep 2012, Sarah Sharp wrote:
 
  On Fri, Sep 14, 2012 at 09:41:12AM -0400, Alan Stern wrote:
   On Fri, 14 Sep 2012, Ajay Gupta wrote:
   
Aborting URBs from within HCD after device disconnect is appropriate. 
right?
   
   Not really.  The HCD shouldn't need to pay attention to the connect
   status while handling URBs.
   
   Instead, the HCD should abort URBs when they fail because the device 
   doesn't send any packets.  This could happen because of a disconnect, 
   or it could happen because the device's firmware has crashed.  The 
   cause doesn't matter.
  
  Alan, by HCD, do you mean host controller driver, or the host hardware?
  I'm getting a bit confused here. :)
 
 Well, both really.  The hardware should get a low-level error when the 
 device fails to respond, and when the driver sees the error it should 
 complete the URB accordingly.  I don't know if abort is the right 
 word; maybe fault or exception would be better.
 
 Whatever you call it, the end result should be that when the device is 
 unplugged, any URBs in flight should complete very quickly.

Right, the host should start returning TDs with a protocol error as soon
as the device violates the three strikes rule for a scheduled transfer.
I've never seen these 30 second delays on any hosts I've tested under,
so I'm wondering if it's a host hardware issue.

  What exactly would you have me do in the xHCI driver that's different
  from its current behavior?
 
 I don't know what changes xhci-hcd needs.  But earlier in this thread
 Ajay posted a log that seemed to show an URB being submitted right
 around the same time the device was unplugged (maybe a little before,
 maybe a little after), and 30 seconds later the URB was still in
 progress.  Here's what he wrote:
 
  === Non Working case 
  [ 2971.576389] Port Status Change Event for port 2
  [ 2971.576487] [E.f2d0c480.   === URB submitted but no error.
  [ 2971.585007] get port status, actual port 1 status = 0x4202c0
  [ 2971.585079] Get port status returned 0x4102c0
  [ 2971.585178] clear port connect change, actual port 1 status = 0x4002c0
  [ 2971.585213] clear port link state change, actual port 1 status = 0x2c0
  [ 2971.640030] get port status, actual port 1 status = 0x2d1
  [ 2971.640031] Get port status returned 0x2d1
  [ 2971.696029] get port status, actual port 1 status = 0x2d1
  [ 2971.696031] Get port status returned 0x2d1
  [ 2971.900031] get port status, actual port 1 status = 0x2d1
  [ 2971.900034] Get port status returned 0x2d1
  [ 2972.060480] Port Status Change Event for port 2
  [ 2972.104039] get port status, actual port 1 status = 0x2802a0
  [ 2972.104041] Get port status returned 0x3002a0
  [ 2972.104079] clear port reset change, actual port 1 status = 0x802a0
  [ 2972.104108] clear port warm(BH) reset change, actual port 1 status = 
  0x2a0
  [ 2972.104138] clear port link state change, actual port 1 status = 0x2a0
  [ 2972.104144] usb 6-2: USB disconnect, device number 6
  
  === 30 seconds gap  
  
  [ 3002.080058] Cancel URB f2d0c480, dev 2, ep 0x81, starting at offset
  0x337ad060   == SCSI layer cancelling URB after 30 seconds
  [ 3002.080063]// Ding dong!
  [ 2972.060569] Stopped on Transfer TRB
  [ 3002.080817] Removing canceled TD starting at 0x337ad060 (dma).
  [ 3002.080820] Finding segment containing stopped TRB.
  [ 3002.080822] Finding endpoint context
  [ 3002.080823] Finding segment containing last TRB in TD.
  [ 3002.080825] Cycle state = 0x0
  [ 3002.080827] New dequeue segment = f71628f0 (virtual)
  [ 3002.080828] New dequeue pointer = 0x337ad070 (DMA)
  [ 3002.080831] Set TR Deq Ptr cmd, new deq seg = f71628f0 (0x337ad000
  dma), new deq ptr = f37ad070 (0x337ad070 dma), new cycle = 0
  
  =
 
 That doesn't seem right.

Yes, I'll agree that seems odd.

Ok, working backwards here:

  [ 2972.104144] usb 6-2: USB disconnect, device number 6

This means usb_disconnect() in drivers/usb/core/hub.c is called.
However, I don't see the unregistering device printk, or the
unregistering interface printk.  Ajay, did you run `sudo dmesg -n 8`
to make sure you captured all debugging levels?  Can you please send me
the full log, for both the working case and the non-working case?

Sarah Sharp
--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] Increase XHCI suspend timeout to 16ms

2012-09-17 Thread Sarah Sharp
On Fri, Sep 14, 2012 at 01:05:49PM -0400, Michael Spang wrote:
 The Intel XHCI specification says that after clearing the run/stop bit
 the controller may take up to 16ms to halt. We've seen a device take
 14ms, which with the current timeout of 10ms causes the kernel to
 abort the suspend. Increasing the timeout to the recommended value
 fixes the problem.

Thanks for tracking this down, Michael.  I'll queue this to Greg in a
couple days.

 
 Signed-off-by: Michael Spang sp...@chromium.org
 ---
  drivers/usb/host/xhci.c |2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)
 
 diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
 index c59d5b5..7710ccf 100644
 --- a/drivers/usb/host/xhci.c
 +++ b/drivers/usb/host/xhci.c
 @@ -785,7 +785,7 @@ int xhci_suspend(struct xhci_hcd *xhci)
   command = ~CMD_RUN;
   xhci_writel(xhci, command, xhci-op_regs-command);
   if (handshake(xhci, xhci-op_regs-status,
 -   STS_HALT, STS_HALT, 100*100)) {
 +   STS_HALT, STS_HALT, XHCI_MAX_HALT_USEC)) {
   xhci_warn(xhci, WARN: xHC CMD_RUN timeout\n);
   spin_unlock_irq(xhci-lock);
   return -ETIMEDOUT;
 -- 
 1.7.7.3
 
--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] asix: Support DLink DUB-E100 H/W Ver C1

2012-09-17 Thread Søren Holm
 
 Networking patches should be submitted to net...@vger.kernel.org

Thanks. I will resend the patch then.

-- 
Søren Holm
--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Linux USB Serial

2012-09-17 Thread Steven J. Ackerman
Hello-

Looking to provide support under Linux for our device which implements
a USB virtual  serial port using the Communications Device Class.

The device enumerates and communicates correctly under Windows XP, 
and shows up under lsusb -v command as:

Bus 005 Device 005: ID 0c6a:0005  
Device Descriptor:
  bLength18
  bDescriptorType 1
  bcdUSB   2.00
  bDeviceClass2 Communications
  bDeviceSubClass 0 
  bDeviceProtocol 0 
  bMaxPacketSize064
  idVendor   0x0c6a 
  idProduct  0x0005 
  bcdDevice1.00
  iManufacturer   1 ACS
  iProduct2 ACS-LCD-Color-320x240
  iSerial 3 1.0
  bNumConfigurations  1
  Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength   67
bNumInterfaces  2
bConfigurationValue 1
iConfiguration  0 
bmAttributes 0xc0
  Self Powered
MaxPower  100mA
Interface Descriptor:
  bLength 9
  bDescriptorType 4
  bInterfaceNumber0
  bAlternateSetting   0
  bNumEndpoints   1
  bInterfaceClass 2 Communications
  bInterfaceSubClass 32 
  bInterfaceProtocol  0 
  iInterface  0 
  CDC Header:
bcdCDC   1.10
  CDC ACM:
bmCapabilities   0x02
  line coding and serial state
  CDC Union:
bMasterInterface0
bSlaveInterface 1 
  CDC Call Management:
bmCapabilities   0x00
bDataInterface  1
  Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x83  EP 3 IN
bmAttributes3
  Transfer TypeInterrupt
  Synch Type   None
  Usage Type   Data
wMaxPacketSize 0x0008  1x 8 bytes
bInterval 255
Interface Descriptor:
  bLength 9
  bDescriptorType 4
  bInterfaceNumber1
  bAlternateSetting   0
  bNumEndpoints   2
  bInterfaceClass10 CDC Data
  bInterfaceSubClass  0 Unused
  bInterfaceProtocol  0 
  iInterface  0 
  Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x01  EP 1 OUT
bmAttributes2
  Transfer TypeBulk
  Synch Type   None
  Usage Type   Data
wMaxPacketSize 0x0040  1x 64 bytes
bInterval   0
  Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x82  EP 2 IN
bmAttributes2
  Transfer TypeBulk
  Synch Type   None
  Usage Type   Data
wMaxPacketSize 0x0040  1x 64 bytes
bInterval   0
Device Status: 0x
  (Bus Powered)

However it does not show up without the -verbose option.

Trying to load the usbserial module to activate the device results in the 
following error:

FATAL: Module vendor=0x0c6a not found.

Can anyone provide assistance in how to troubleshoot why Linux is 
not happy with this USB device ?

Thank you,

Steven J. Ackerman, Consultant
ACS, Sarasota, FL
http://www.acscontrol.com
mailto:st...@acscontrol.com




--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] usbhid: call report_fixup before comparing descriptors

2012-09-17 Thread Kevin Daughtridge

hid_post_reset checks the stored report descriptor against what is currently
returned by the device. An HID driver's report_fixup method may have 
changed the
stored descriptor, however, creating false positives. These leave some 
devices
nonfunctional after a resume, with a reset_resume error 1 reported. 
This patch
passes the new descriptor to the driver's report_fixup method, if any, 
before it

is compared to the stored one.

BugLink: http://bugs.launchpad.net/bugs/1049623
Signed-off-by: Kevin Daughtridge ke...@kdau.com
---
--- a/drivers/hid/usbhid/hid-core.c2012-08-20 10:17:09.0 -0700
+++ b/drivers/hid/usbhid/hid-core.c2012-09-16 18:51:45.381868737 -0700
@@ -1436,6 +1436,10 @@ static int hid_post_reset(struct usb_int
 kfree(rdesc);
 return 1;
 }
+
+if (hid-driver  hid-driver-report_fixup)
+rdesc = hid-driver-report_fixup(hid, rdesc, status);
+
 status = memcmp(rdesc, hid-rdesc, hid-rsize);
 kfree(rdesc);
 if (status != 0) {
--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Linux USB Serial

2012-09-17 Thread Bjørn Mork
Steven J. Ackerman st...@acscontrol.com writes:

 Interface Descriptor:
   bLength 9
   bDescriptorType 4
   bInterfaceNumber0
   bAlternateSetting   0
   bNumEndpoints   1
   bInterfaceClass 2 Communications
   bInterfaceSubClass 32 

Looks like your bInterfaceSubClass is nibble swapped.  It should be 0x02
for ACM, not 0x20.


Bjørn
--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] usb/core: Fix race condition when removing EHCI PCI devices

2012-09-17 Thread Alan Stern
On Mon, 17 Sep 2012, Don Zickus wrote:

 I have added some in-depth analysis from our customer.
 
 
 The problem is that the failing routine was called with a pointer to usbdev in
 memory that has already been freed and overwritten with the pool poison 
 pattern.
 This causes an access violation on line 502:

The stack trace shows that the failure occurred in usb_device_dump(), 
which was called from usb_device_read().  Since it wasn't a recursive 
call, the usbdev argument must have pointed to the root-hub device.

I don't see how this could have happened if the kernel included the 
patch I sent earlier.  usb_device_read() holds the usb_bus_list_lock 
mutex throughout, and it tests that the root hub's devnum field is not 
equal to 0 before calling usb_dump_device().

Meanwhile, usb_remove_hcd() sets hcd-self.bus.root_hub-devnum to 0
while holding usb_bus_list_lock, and it doesn't deallocate the root hub
device until after the mutex is dropped.

Are you certain that the test was conducted with the patch in place?

If you want to track down what's going wrong, you'll have to add some 
debugging code to usb_device_read() and usb_remove_hcd().  By the time 
usb_device_dump() starts running, it's already too late.

Alan Stern

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: Linux USB Serial

2012-09-17 Thread Steven J. Ackerman
Greg-

Thanks for your response.

Not sure if I need the cdc-acm functionality or not.

This is a color lcd display that supports a usb serial interface to
interact. I really 
just need to be able to send and receive characters and NAK the pipe back 
temporarily when my input buffer is full.

The descriptors were supplied by the chip vendor - Renesas - as part of a 
CDC demo application. The VID/PID is ours. The device works great under 
Windows XP with the descriptors as shown previously - even with the 
Communications bInterfaceSubClass value wrong.

Doing the modprobe, etc. was based upon some blog posts that purported
to show how to add support for an unknown usb serial device.

Looking at the descriptor for a FTDI USB serial to TTL cable it seems a lot
simpler,
but it does indicate vendor specific class, subclass and protocol - which
means 
that it requires a custom driver - ftdi_sio - right ?  I don't really want
to have to 
develop and support that.

I don't think that I have enough Linux experience to be able to test a patch

and rebuild of the kernel, and I don't think that I can ask my customers to
do 
that it order to use our product as a simple serial display.  

I'm running Ubuntu 10.10.

Any additional pointers and/or ideas would be greatly appreciated.

Thank you again,

Steven J. Ackerman, Consultant
ACS, Sarasota, FL
http://www.acscontrol.com
mailto:st...@acscontrol.com


 -Original Message-
 From: Greg KH [mailto:gre...@linuxfoundation.org]
 Sent: Monday, September 17, 2012 5:42 PM
 To: Steven J. Ackerman
 Cc: 'Bjørn Mork'; linux-usb@vger.kernel.org; linux-ser...@vger.kernel.org
 Subject: Re: Linux USB Serial
 
 On Mon, Sep 17, 2012 at 05:07:26PM -0400, Steven J. Ackerman wrote:
  Bjrn-
 
  Thank you for your response.
 
  This change gets me closer. I can now successfully execute the modprobe
  without error, but the device still doesn't show up in /dev/ttyUSB? .
 
  sja@UBUNTU-10:~$ sudo modprobe usbserial vendor=0x0c6a
 product=0x0005
 
 Eeek, no, never do that with a device you actually want to use.  This
 should be controlled by the cdc-acm driver, not the usbserial driver.
 That driver should be auto-loaded for this device, but it looks like the
 descriptor is wrong, so it's not binding to it.
 
 Are you able to test a patch and rebuild the kernel to see if we can get
 this to work properly?
 
 thanks,
 
 greg k-h


--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: Linux USB Serial

2012-09-17 Thread Steven J. Ackerman
 That's fine, the cdc-acm interface will work for that.
 
 But is your device really a CDC ACM device?  Or is it something else?

The device is a 3.5 color LCD display with touchscreen that can act as a
serial 
terminal. It just needs to be able to send and receive characters over an
USB
serial port.

 You wouldn't, if you use the ftdi serial chip in your device.  Which
 begs me to ask, what type of usb to serial chip is in your device?  What
 protocol does it use to talk to the host?

The device is based upon a Renesas RX62N processor which has a USB interface

in it.  The protocol is supposedly based upon the CDC - a control endpoint
and 
two bulk endpoints. The software was derived from a demo supplied by the 
manufacturer - and it does work under Windows. The device enumerates as 
a COM port and you can interact with the display using a program or a
terminal 
emulator.  Unfortunately the chip vendor doesn't have any support for Linux.

 They shouldn't have to do that, once we get it working, they get the
 update automatically from their distro.  But if you can't test any
 changes we make to try to get this to work, there's not much we can do
 here, right?
 

I guess that I'm operating under the assumption that there is something 
wrong on my end - an incorrectly configured descriptor for example. It
appears 
the other USB serial devices work OK under Linux - even without custom 
drivers. I'm hoping that I can find an error message somewhere that will 
tell me what I'm doing wrong - or that somebody who has been down that 
path before can't point to something obvious - like Bjrn did.

 Oh, and fix that descriptor up in your firmware, that might solve
 everything :)

Going through the USB CDC documentation between e-mails. Other than 
the incorrect bInterfaceSubClass value - which I have corrected - nothing 
else seems wrong.

 
 Hope this helps,
 
 greg k-h

Always appreciate your assistance - thank you!


Steven J. Ackerman, Consultant
ACS, Sarasota, FL
http://www.acscontrol.com
mailto:st...@acscontrol.com






--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [PATCH v3] USB: mxs-phy: add basic otg support

2012-09-17 Thread Chen Peter-B29397
 
 
  The purpose for this patch is to have set_peripheral implementation,
  but in current chipidea code, we don't need to know gadget at all,
  as when id switch occurs, the core code know its role (device or host)
  very well, and will call related stop/start function.
 
  We have already many code bind struct otg with struct phy, we'd better
  split them at later code.
 
  A better approach to fix this problem is to either not call
 set_peripheral
  if both device and host use chipidea driver, or implement otg struct
  at chipidea driver.
 
 Yes, I think the otg driver should be part of the chipidea driver, the
 only concern is the msm, although it can probably be converted once we
 have an otg driver. I'll have a look at it soon unless someone beats me
 to it.

Currently, we still have no auto-suspend and wakeup support, but msm supports
them, it may need much effort to move msm to current whole chipidea framework.
As it affects we go on implement id-switch function and other usb functions 
at chipidea, I hope we can have it soon, thanks. I also would like to help it
if you are busy on other things. 

 
 The bigger plan was to implement a generic otg framework and base the
 chipidea's otg driver on that, instead of dragging in one more state
 machine and whatnot.
 

Yes, we can transfer it to use generic otg framework once it is ready, but
first, it is better has own otg driver at chipidea.

 Regards,
 --
 Alex


--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: XHCI Bug discovered in 3.6-RC6 (solution included)

2012-09-17 Thread Sebastian Gottschall (DD-WRT)
this following function is missing a important NULL check. if DMI is not 
available or not enabled in the kernel config (which is common in my 
case, since its a ARM Platform with XHCI support)
the xhci-hcd driver will crash due nullpointer access since 
dmi_get_system_info returns always NULL if DMI support is not enabled.


static bool compliance_mode_recovery_timer_quirk_check(void)
{
const char *dmi_product_name, *dmi_sys_vendor;

dmi_product_name = dmi_get_system_info(DMI_PRODUCT_NAME);
dmi_sys_vendor = dmi_get_system_info(DMI_SYS_VENDOR);

if (!(strstr(dmi_sys_vendor, Hewlett-Packard)))
return false;

if (strstr(dmi_product_name, Z420) ||
strstr(dmi_product_name, Z620) ||
strstr(dmi_product_name, Z820))
return true;

return false;
}

proposed patch: simply add

 if (!dmi_sys_vendor || !dmi_product_name)
return false;

even better. disable the whole quirk handling for this case if 
CONFIG_DMI is not set




--
Mit freundlichen Grüssen / Regards

Sebastian Gottschall / CTO

NewMedia-NET GmbH - DD-WRT
Firmensitz:  Berliner Ring 101, 64625 Bensheim
Registergericht: Amtsgericht Darmstadt, HRB 25473
Geschäftsführer: Peter Steinhäuser, Christian Scheele
http://www.dd-wrt.com
email: s.gottsch...@dd-wrt.com
Tel.: +496251-582650 / Fax: +496251-5826565

--
Mit freundlichen Grüssen / Regards

Sebastian Gottschall / CTO

NewMedia-NET GmbH - DD-WRT
Firmensitz:  Berliner Ring 101, 64625 Bensheim
Registergericht: Amtsgericht Darmstadt, HRB 25473
Geschäftsführer: Peter Steinhäuser, Christian Scheele
http://www.dd-wrt.com
email:s.gottsch...@dd-wrt.com
Tel.: +496251-582650 / Fax: +496251-5826565

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 2/2] usb: phy: rename otg.c to phy.c

2012-09-17 Thread Fabio Estevam
On Mon, Sep 17, 2012 at 10:38 PM, Peter Chen peter.c...@freescale.com wrote:
 The operations in current otg.c are actually for USB PHY's.
 Move it from drivers/usb/otg/ to drivers/usb/phy/

 Signed-off-by: Peter Chen peter.c...@freescale.com
 ---
  drivers/usb/otg/Makefile |3 ---
  drivers/usb/phy/Makefile |3 +++
  drivers/usb/{otg/otg.c = phy/phy.c} |2 +-
  3 files changed, 4 insertions(+), 4 deletions(-)

Ok, you did the rename correctly here, but you can also do the same
for drivers/usb/otg/Makefile = drivers/usb/phy/Makefile.

Regards,

Fabio Estevam
--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 2/2] usb: phy: rename otg.c to phy.c

2012-09-17 Thread Peter Chen
On Tue, Sep 18, 2012 at 12:31:19AM -0300, Fabio Estevam wrote:
 On Mon, Sep 17, 2012 at 10:38 PM, Peter Chen peter.c...@freescale.com wrote:
  The operations in current otg.c are actually for USB PHY's.
  Move it from drivers/usb/otg/ to drivers/usb/phy/
 
  Signed-off-by: Peter Chen peter.c...@freescale.com
  ---
   drivers/usb/otg/Makefile |3 ---
   drivers/usb/phy/Makefile |3 +++
   drivers/usb/{otg/otg.c = phy/phy.c} |2 +-
   3 files changed, 4 insertions(+), 4 deletions(-)
 
 Ok, you did the rename correctly here, but you can also do the same
 for drivers/usb/otg/Makefile = drivers/usb/phy/Makefile.

Why I need to do it? There are just some changes for Makefile, but really
rename.

 
 Regards,
 
 Fabio Estevam
 

-- 

Best Regards,
Peter Chen

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 2/2] usb: phy: rename otg.c to phy.c

2012-09-17 Thread Fabio Estevam
On Tue, Sep 18, 2012 at 12:34 AM, Peter Chen peter.c...@freescale.com wrote:

 Why I need to do it? There are just some changes for Makefile, but really
 rename.

Yes, you are right. It looks fine then.

Regards,

Fabio Estevam
--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] staging: usbip: stub_dev: Fixed oops during removal of usbip_host

2012-09-17 Thread navin patidar
stub_device_reset should set kernel thread pointers to NULL.
so that at the time of usbip_host removal stub_shoutdown_connection
doesn't try to kill kernel threads which are already killed.

Signed-off-by: navin patidar nav...@cdac.in
---
 drivers/staging/usbip/stub_dev.c |7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/usbip/stub_dev.c b/drivers/staging/usbip/stub_dev.c
index 92ced35..447a98c 100644
--- a/drivers/staging/usbip/stub_dev.c
+++ b/drivers/staging/usbip/stub_dev.c
@@ -198,10 +198,8 @@ static void stub_shutdown_connection(struct usbip_device 
*ud)
 * tcp_socket is freed after threads are killed so that usbip_xmit does
 * not touch NULL socket.
 */
-   if (ud-tcp_socket) {
+   if (ud-tcp_socket)
sock_release(ud-tcp_socket);
-   ud-tcp_socket = NULL;
-   }
 
/* 3. free used data */
stub_device_cleanup_urbs(sdev);
@@ -233,6 +231,9 @@ static void stub_device_reset(struct usbip_device *ud)
 
dev_dbg(udev-dev, device reset);
 
+   ud-tcp_socket = NULL;
+   ud-tcp_rx = NULL;
+   ud-tcp_tx = NULL;
ret = usb_lock_device_for_reset(udev, sdev-interface);
if (ret  0) {
dev_err(udev-dev, lock for reset\n);
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] staging: usbip: vhci_hcd: Fixed oops during removal of vhci_hcd

2012-09-17 Thread navin patidar
In response to usbip detach -p [port_number] user 
command,vhci_shoutdown_connection gets
executed which kills tcp_tx,tcp_rx kernel threads and then vhci_device_reset 
resets
all usb_device struct variables except kernel thread pointers.

so, at the time of vhci_hcd removal vhci_shoutdown_connection tries to kill 
kernel threads
which are already killed.

Signed-off-by: navin patidar nav...@cdac.in
---
 drivers/staging/usbip/vhci_hcd.c |2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/staging/usbip/vhci_hcd.c b/drivers/staging/usbip/vhci_hcd.c
index 12a9a5f..eea8298 100644
--- a/drivers/staging/usbip/vhci_hcd.c
+++ b/drivers/staging/usbip/vhci_hcd.c
@@ -859,6 +859,8 @@ static void vhci_device_reset(struct usbip_device *ud)
usb_put_dev(vdev-udev);
vdev-udev = NULL;
 
+   ud-tcp_rx = NULL;
+   ud-tcp_tx = NULL;
ud-tcp_socket = NULL;
ud-status = VDEV_ST_NULL;
 
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2] powerpc/usb: fix bug of CPU hang when missing USB PHY clock

2012-09-17 Thread Kumar Gala

On Aug 22, 2012, at 5:17 AM, Shengzhou Liu wrote:

 when missing USB PHY clock, kernel booting up will hang during USB
 initialization. We should check USBGP[PHY_CLK_VALID] bit to avoid
 CPU hanging in this case.
 
 Signed-off-by: Shengzhou Liu shengzhou@freescale.com
 ---
 v2 changes: use spin_event_timeout() instead.
 
 drivers/usb/host/ehci-fsl.c |   58 +-
 drivers/usb/host/ehci-fsl.h |1 +
 include/linux/fsl_devices.h |1 +
 3 files changed, 42 insertions(+), 18 deletions(-)

Greg,

Any issues picking this fix up for v3.6 inclusion?

- k

 
 diff --git a/drivers/usb/host/ehci-fsl.c b/drivers/usb/host/ehci-fsl.c
 index b7451b2..11ff4b4 100644
 --- a/drivers/usb/host/ehci-fsl.c
 +++ b/drivers/usb/host/ehci-fsl.c
 @@ -210,11 +210,11 @@ static void usb_hcd_fsl_remove(struct usb_hcd *hcd,
   usb_put_hcd(hcd);
 }
 
 -static void ehci_fsl_setup_phy(struct usb_hcd *hcd,
 +static int ehci_fsl_setup_phy(struct usb_hcd *hcd,
  enum fsl_usb2_phy_modes phy_mode,
  unsigned int port_offset)
 {
 - u32 portsc, temp;
 + u32 portsc;
   struct ehci_hcd *ehci = hcd_to_ehci(hcd);
   void __iomem *non_ehci = hcd-regs;
   struct device *dev = hcd-self.controller;
 @@ -232,9 +232,15 @@ static void ehci_fsl_setup_phy(struct usb_hcd *hcd,
   case FSL_USB2_PHY_ULPI:
   if (pdata-controller_ver) {
   /* controller version 1.6 or above */
 - temp = in_be32(non_ehci + FSL_SOC_USB_CTRL);
 - out_be32(non_ehci + FSL_SOC_USB_CTRL, temp |
 - USB_CTRL_USB_EN | ULPI_PHY_CLK_SEL);
 + setbits32(non_ehci + FSL_SOC_USB_CTRL,
 + ULPI_PHY_CLK_SEL);
 + /*
 +  * Due to controller issue of PHY_CLK_VALID in ULPI
 +  * mode, we set USB_CTRL_USB_EN before checking
 +  * PHY_CLK_VALID, otherwise PHY_CLK_VALID doesn't work.
 +  */
 + clrsetbits_be32(non_ehci + FSL_SOC_USB_CTRL,
 + UTMI_PHY_EN, USB_CTRL_USB_EN);
   }
   portsc |= PORT_PTS_ULPI;
   break;
 @@ -247,9 +253,7 @@ static void ehci_fsl_setup_phy(struct usb_hcd *hcd,
   case FSL_USB2_PHY_UTMI:
   if (pdata-controller_ver) {
   /* controller version 1.6 or above */
 - temp = in_be32(non_ehci + FSL_SOC_USB_CTRL);
 - out_be32(non_ehci + FSL_SOC_USB_CTRL, temp |
 - UTMI_PHY_EN | USB_CTRL_USB_EN);
 + setbits32(non_ehci + FSL_SOC_USB_CTRL, UTMI_PHY_EN);
   mdelay(FSL_UTMI_PHY_DLY);  /* Delay for UTMI PHY CLK to
   become stable - 10ms*/
   }
 @@ -262,23 +266,34 @@ static void ehci_fsl_setup_phy(struct usb_hcd *hcd,
   case FSL_USB2_PHY_NONE:
   break;
   }
 +
 + if ((pdata-controller_ver)  ((phy_mode == FSL_USB2_PHY_ULPI) ||
 + (phy_mode == FSL_USB2_PHY_UTMI))) {
 + /* check PHY_CLK_VALID to get phy clk valid */
 + if (!spin_event_timeout(in_be32(non_ehci + FSL_SOC_USB_CTRL) 
 + PHY_CLK_VALID, FSL_USB_PHY_CLK_TIMEOUT, 0)) {
 + printk(KERN_WARNING fsl-ehci: USB PHY clock 
 invalid\n);
 + return -EINVAL;
 + }
 + }
 +
   ehci_writel(ehci, portsc, ehci-regs-port_status[port_offset]);
 +
 + if (phy_mode != FSL_USB2_PHY_ULPI)
 + setbits32(non_ehci + FSL_SOC_USB_CTRL, USB_CTRL_USB_EN);
 +
 + return 0;
 }
 
 -static void ehci_fsl_usb_setup(struct ehci_hcd *ehci)
 +static int ehci_fsl_usb_setup(struct ehci_hcd *ehci)
 {
   struct usb_hcd *hcd = ehci_to_hcd(ehci);
   struct fsl_usb2_platform_data *pdata;
   void __iomem *non_ehci = hcd-regs;
 - u32 temp;
 
   pdata = hcd-self.controller-platform_data;
 
 - /* Enable PHY interface in the control reg. */
   if (pdata-have_sysif_regs) {
 - temp = in_be32(non_ehci + FSL_SOC_USB_CTRL);
 - out_be32(non_ehci + FSL_SOC_USB_CTRL, temp | 0x0004);
 -
   /*
   * Turn on cache snooping hardware, since some PowerPC platforms
   * wholly rely on hardware to deal with cache coherent
 @@ -293,7 +308,8 @@ static void ehci_fsl_usb_setup(struct ehci_hcd *ehci)
 
   if ((pdata-operating_mode == FSL_USB2_DR_HOST) ||
   (pdata-operating_mode == FSL_USB2_DR_OTG))
 - ehci_fsl_setup_phy(hcd, pdata-phy_mode, 0);
 + if (ehci_fsl_setup_phy(hcd, pdata-phy_mode, 0))
 + return -EINVAL;
 
   if (pdata-operating_mode == FSL_USB2_MPH_HOST) {
   unsigned int chip, rev, svr;
 @@