[GIT PULL] usb: chipidea: changes for v4.19-rc1

2018-07-26 Thread Peter Chen
 The following changes since commit dc748b66dbfbbfa187044f007d42d9cc01e5ab11:

  dt-bindings: usb: new ehci-npcm7xx dt (2018-06-25 21:59:15 +0800)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/peter.chen/usb.git/ 
tags/usb-ci-v4.19-rc1

for you to fetch changes up to ba0ab35a81de1da15e1691142834eefd34e34a0e:

  usb: chipidea: tegra: Use aligned DMA on Tegra114/124 (2018-06-26 10:15:31 
+0800)


One patch to enable USB Ethernet gadget at Tegra platforms


Marcel Ziswiler (1):
  usb: chipidea: tegra: Use aligned DMA on Tegra114/124

 drivers/usb/chipidea/ci_hdrc_tegra.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--
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


[RFC PATCH] usb: gadget: mass_storage: Add GET_EVENT_STATUS_NOTIFICATION

2018-07-26 Thread Benjamin Herrenschmidt
This is just RFC at this stage, I was getting annoyed at the once-per-second
debug message about unsupported command when using f_mass_storage as a CDROM,
so I quickly hacked that up.

I'm not clearing the events per-se, I'm just sending events based on the
state of pending unit attentions, which seems to be enough to please Linux
on the other side, but definitely needs more testing or expert opinions.

If I find some spare cycle in the next few weeks I might add a few more
of the basic MMC commands so we at least support everything Linux throws
at us for a normal read-only CDROM.

Comments ?

Not-Yet-Signed-off-by: Benjamin Herrenschmidt 
---
 drivers/usb/gadget/function/f_mass_storage.c | 49 +++-
 1 file changed, 48 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/gadget/function/f_mass_storage.c 
b/drivers/usb/gadget/function/f_mass_storage.c
index 7b13928077c9..d8c83359f470 100644
--- a/drivers/usb/gadget/function/f_mass_storage.c
+++ b/drivers/usb/gadget/function/f_mass_storage.c
@@ -1390,6 +1390,42 @@ static int do_mode_select(struct fsg_common *common, 
struct fsg_buffhd *bh)
return -EINVAL;
 }
 
+static int do_get_event_status_notification(struct fsg_common *common,
+   struct fsg_buffhd *bh)
+{
+   struct fsg_lun  *curlun = common->curlun;
+   u8  *buf = (u8 *) bh->buf;
+   boolmedia_class;
+   u8  event;
+   int size;
+
+   /* We only support media class */
+   media_class = (common->cmnd[4] & 0x10) != 0;
+
+   /* We just mirror the unit attentions */
+   if (curlun->unit_attention_data == SS_NOT_READY_TO_READY_TRANSITION)
+   event = 2; /* New media */
+   else if (curlun->unit_attention_data == SS_MEDIUM_NOT_PRESENT)
+   event = 3;
+   else
+   event = 0;
+
+   /* Fill common header */
+   size = 4;
+   buf[3] = 0x10; /* Support classes: media */
+   if (media_class) {
+   buf[2] = 4; /* Return media event */
+   if (event == 0)
+   buf[2] |= 0x80; /* No Event Available */
+   size += 8;
+   buf[4] = event;
+   buf[5] = 1; /* Active */
+   buf[6] = buf[7] = 0;
+   } else {
+   buf[2] = 0; /* None of the req. classes supported */
+   }
+   return size;
+}
 
 /*-*/
 
@@ -1753,7 +1789,8 @@ static int check_command(struct fsg_common *common, int 
cmnd_size,
 */
if (curlun && curlun->unit_attention_data != SS_NO_SENSE &&
common->cmnd[0] != INQUIRY &&
-   common->cmnd[0] != REQUEST_SENSE) {
+   common->cmnd[0] != REQUEST_SENSE &&
+   common->cmnd[0] != GET_EVENT_STATUS_NOTIFICATION) {
curlun->sense_data = curlun->unit_attention_data;
curlun->unit_attention_data = SS_NO_SENSE;
return -EINVAL;
@@ -2025,6 +2062,16 @@ static int do_scsi_command(struct fsg_common *common)
reply = do_write(common);
break;
 
+   case GET_EVENT_STATUS_NOTIFICATION:
+   common->data_size_from_cmnd =
+   get_unaligned_be16(>cmnd[7]);
+   reply = check_command(common, 10, DATA_DIR_TO_HOST,
+ (1 << 1) | (1 << 4) | (3 << 7) | (1 << 9),
+ 0, "GET_EVENT_STATUS_NOTIFICATION");
+   if (reply == 0)
+   reply = do_get_event_status_notification(common, bh);
+   break;
+
/*
 * Some mandatory commands that we recognize but don't implement.
 * They don't mean much in this setting.  It's left as an exercise



--
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: dwc3: Set default mode for dwc_usb31

2018-07-26 Thread Thinh Nguyen
On 7/26/2018 2:59 PM, Thinh Nguyen wrote:
> On 7/26/2018 2:32 PM, Andy Shevchenko wrote:
>> On Thu, Jul 26, 2018 at 11:52 PM, Thinh Nguyen
>>  wrote:
>>> dwc_usb31 does not support OTG mode. If the controller supports DRD but
>>> the dr_mode is not specified or set to OTG, then set the mode to
>>> peripheral.
>>>
>>> Signed-off-by: Thinh Nguyen 
>>> ---
>>>  drivers/usb/dwc3/core.c | 8 
>>>  1 file changed, 8 insertions(+)
>>>
>>> diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
>>> index 21e4931d0cc0..64ba664d467c 100644
>>> --- a/drivers/usb/dwc3/core.c
>>> +++ b/drivers/usb/dwc3/core.c
>>> @@ -78,6 +78,14 @@ static int dwc3_get_dr_mode(struct dwc3 *dwc)
>>> mode = USB_DR_MODE_HOST;
>>> else if (IS_ENABLED(CONFIG_USB_DWC3_GADGET))
>>> mode = USB_DR_MODE_PERIPHERAL;
>>> +
>>> +   /*
>>> +* dwc_usb31 does not support OTG mode. If the controller
>>> +* supports DRD but the dr_mode is not specified or set to 
>>> OTG,
>>> +* then set the mode to peripheral.
>>> +*/
>>> +   if (mode == USB_DR_MODE_OTG && dwc3_is_usb31(dwc))
>> shouldn't be simple
>>
>> else if (dwc3_is_usb31(...))
>>
>> ?

Actually, no. We want to set the mode to peripheral _only_ when dr_mode
was not specified or set to OTG. Just checking for dwc3_is_usb31(...) is
not enough.

Thanks,

Thinh

--
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: dwc3: Set default mode for dwc_usb31

2018-07-26 Thread Thinh Nguyen
On 7/26/2018 2:32 PM, Andy Shevchenko wrote:
> On Thu, Jul 26, 2018 at 11:52 PM, Thinh Nguyen
>  wrote:
>> dwc_usb31 does not support OTG mode. If the controller supports DRD but
>> the dr_mode is not specified or set to OTG, then set the mode to
>> peripheral.
>>
>> Signed-off-by: Thinh Nguyen 
>> ---
>>  drivers/usb/dwc3/core.c | 8 
>>  1 file changed, 8 insertions(+)
>>
>> diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
>> index 21e4931d0cc0..64ba664d467c 100644
>> --- a/drivers/usb/dwc3/core.c
>> +++ b/drivers/usb/dwc3/core.c
>> @@ -78,6 +78,14 @@ static int dwc3_get_dr_mode(struct dwc3 *dwc)
>> mode = USB_DR_MODE_HOST;
>> else if (IS_ENABLED(CONFIG_USB_DWC3_GADGET))
>> mode = USB_DR_MODE_PERIPHERAL;
>> +
>> +   /*
>> +* dwc_usb31 does not support OTG mode. If the controller
>> +* supports DRD but the dr_mode is not specified or set to 
>> OTG,
>> +* then set the mode to peripheral.
>> +*/
>> +   if (mode == USB_DR_MODE_OTG && dwc3_is_usb31(dwc))
> shouldn't be simple
>
> else if (dwc3_is_usb31(...))
>
> ?

Yes you're right. :)

Thanks,
Thinh
--
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: dwc3: Set default mode for dwc_usb31

2018-07-26 Thread Andy Shevchenko
On Thu, Jul 26, 2018 at 11:52 PM, Thinh Nguyen
 wrote:
> dwc_usb31 does not support OTG mode. If the controller supports DRD but
> the dr_mode is not specified or set to OTG, then set the mode to
> peripheral.
>
> Signed-off-by: Thinh Nguyen 
> ---
>  drivers/usb/dwc3/core.c | 8 
>  1 file changed, 8 insertions(+)
>
> diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
> index 21e4931d0cc0..64ba664d467c 100644
> --- a/drivers/usb/dwc3/core.c
> +++ b/drivers/usb/dwc3/core.c
> @@ -78,6 +78,14 @@ static int dwc3_get_dr_mode(struct dwc3 *dwc)
> mode = USB_DR_MODE_HOST;
> else if (IS_ENABLED(CONFIG_USB_DWC3_GADGET))
> mode = USB_DR_MODE_PERIPHERAL;
> +
> +   /*
> +* dwc_usb31 does not support OTG mode. If the controller
> +* supports DRD but the dr_mode is not specified or set to 
> OTG,
> +* then set the mode to peripheral.
> +*/

> +   if (mode == USB_DR_MODE_OTG && dwc3_is_usb31(dwc))

shouldn't be simple

else if (dwc3_is_usb31(...))

?

> +   mode = USB_DR_MODE_PERIPHERAL;
> }
>
> if (mode != dwc->dr_mode) {
> --
> 2.11.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



-- 
With Best Regards,
Andy Shevchenko
--
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: dwc3: Set default mode for dwc_usb31

2018-07-26 Thread Thinh Nguyen
dwc_usb31 does not support OTG mode. If the controller supports DRD but
the dr_mode is not specified or set to OTG, then set the mode to
peripheral.

Signed-off-by: Thinh Nguyen 
---
 drivers/usb/dwc3/core.c | 8 
 1 file changed, 8 insertions(+)

diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
index 21e4931d0cc0..64ba664d467c 100644
--- a/drivers/usb/dwc3/core.c
+++ b/drivers/usb/dwc3/core.c
@@ -78,6 +78,14 @@ static int dwc3_get_dr_mode(struct dwc3 *dwc)
mode = USB_DR_MODE_HOST;
else if (IS_ENABLED(CONFIG_USB_DWC3_GADGET))
mode = USB_DR_MODE_PERIPHERAL;
+
+   /*
+* dwc_usb31 does not support OTG mode. If the controller
+* supports DRD but the dr_mode is not specified or set to OTG,
+* then set the mode to peripheral.
+*/
+   if (mode == USB_DR_MODE_OTG && dwc3_is_usb31(dwc))
+   mode = USB_DR_MODE_PERIPHERAL;
}
 
if (mode != dwc->dr_mode) {
-- 
2.11.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: [PATCH v2 3/3] usb: dwc2: Make dwc2_readl/writel functions endianness-agnostic.

2018-07-26 Thread Andy Shevchenko
On Thu, Jul 26, 2018 at 5:01 PM, Gevorg Sahakyan
 wrote:
> Declared dwc2_check_core_endianness() function for dynamicly check
> core endianness.
> Added needs_byte_swap flag to hsotg structure, and depending on
> flag swap value inside dwc2_readl/writel functions.

> +#define swap32(x) (\
> +   {typeof(x) x_ = (x); \
> +   (((u32)(x_) << 24) & (u32)0xFF00) | \
> +   (((u32)(x_) <<  8) & (u32)0x00FF) | \
> +   (((u32)(x_) >>  8) & (u32)0xFF00) | \
> +   (((u32)(x_) >> 24) & (u32)0x00FF); })

What's wrong with swab32() ?

-- 
With Best Regards,
Andy Shevchenko
--
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/3] usb: dwc2: replace ioread32/iowrite32_rep with dwc2_readl/writel_rep

2018-07-26 Thread Andy Shevchenko
On Thu, Jul 26, 2018 at 5:00 PM, Gevorg Sahakyan
 wrote:
> dwc2_readl_rep/dwc2_writel_rep functions using readl/writel in a
> loop.

Why this is better? Any regression or what?

-- 
With Best Regards,
Andy Shevchenko
--
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/4] usb: dwc2: Modify dwc2_readl/writel functions prototype

2018-07-26 Thread Grigor Tovmasyan
On 7/26/2018 16:10, Felipe Balbi wrote:
> 
> Hi,
> 
> Grigor Tovmasyan  writes:
 Added hsotg argument to dwc2_readl/writel function prototype,
 and also instead of address pass offset of register.
 hsotg will contain flag field for endianness.

 Also customized dwc2_set_bit and dwc2_clear_bit function for
 dwc2_readl/writel functions.

 Signed-off-by: Gevorg Sahakyan 
>>>
>>> sorry for the delay. I've been super busy with an internal task.
>>>
>>> Anyway, this doesn't apply to testing/next. Give me a couple hours for
>>> me to go through the other patches, then I'll push testing/next so you
>>> can rebase.
>>>
>>> checking file drivers/usb/dwc2/core.c
>>> checking file drivers/usb/dwc2/core.h
>>> Hunk #1 succeeded at 1172 (offset 3 lines).
>>> Hunk #2 succeeded at 1184 (offset 3 lines).
>>> Hunk #3 succeeded at 1195 (offset 3 lines).
>>> Hunk #4 succeeded at 1321 (offset 3 lines).
>>> checking file drivers/usb/dwc2/core_intr.c
>>> checking file drivers/usb/dwc2/debugfs.c
>>> checking file drivers/usb/dwc2/gadget.c
>>> Hunk #11 succeeded at 916 (offset 6 lines).
>>> Hunk #12 succeeded at 968 (offset 6 lines).
>>> Hunk #13 succeeded at 1065 (offset 6 lines).
>>> Hunk #14 succeeded at 1079 (offset 6 lines).
>>> Hunk #15 succeeded at 1105 (offset 6 lines).
>>> Hunk #16 succeeded at 1128 (offset 6 lines).
>>> Hunk #17 succeeded at 1467 (offset 6 lines).
>>> Hunk #18 succeeded at 1481 (offset 6 lines).
>>> Hunk #19 succeeded at 1635 (offset 6 lines).
>>> Hunk #20 succeeded at 1774 (offset 6 lines).
>>> Hunk #21 succeeded at 1826 (offset 6 lines).
>>> Hunk #22 succeeded at 1956 (offset 6 lines).
>>> Hunk #23 succeeded at 2125 (offset 6 lines).
>>> Hunk #24 succeeded at 2139 (offset 6 lines).
>>> Hunk #25 succeeded at 2169 (offset 6 lines).
>>> Hunk #26 succeeded at 2199 (offset 6 lines).
>>> Hunk #27 succeeded at 2248 (offset 6 lines).
>>> Hunk #28 succeeded at 2344 (offset 6 lines).
>>> Hunk #29 succeeded at 2375 (offset 6 lines).
>>> Hunk #30 succeeded at 2393 (offset 6 lines).
>>> Hunk #31 succeeded at 2447 (offset 6 lines).
>>> Hunk #32 succeeded at 2472 (offset 6 lines).
>>> Hunk #33 succeeded at 2496 (offset 6 lines).
>>> Hunk #34 succeeded at 2550 (offset 6 lines).
>>> Hunk #35 succeeded at 2654 (offset 6 lines).
>>> Hunk #36 succeeded at 2684 (offset 6 lines).
>>> Hunk #37 succeeded at 2699 (offset 6 lines).
>>> Hunk #38 succeeded at 2775 (offset 4 lines).
>>> Hunk #39 succeeded at 2829 (offset 1 line).
>>> Hunk #40 succeeded at 2866 (offset 1 line).
>>> Hunk #41 succeeded at 2897 (offset 1 line).
>>> Hunk #42 succeeded at 3016 (offset 1 line).
>>> Hunk #43 succeeded at 3087 (offset 1 line).
>>> Hunk #44 succeeded at 3115 (offset 1 line).
>>> Hunk #45 succeeded at 3216 (offset 1 line).
>>> Hunk #46 succeeded at 3231 (offset 1 line).
>>> Hunk #47 succeeded at 3257 (offset 1 line).
>>> Hunk #48 succeeded at 3277 (offset 1 line).
>>> Hunk #49 succeeded at 3301 (offset 1 line).
>>> Hunk #50 succeeded at 3345 (offset 1 line).
>>> Hunk #51 succeeded at 3358 (offset 1 line).
>>> Hunk #52 succeeded at 3387 (offset 1 line).
>>> Hunk #53 succeeded at 3425 (offset 1 line).
>>> Hunk #54 succeeded at 3433 (offset 1 line).
>>> Hunk #55 succeeded at 3470 (offset 1 line).
>>> Hunk #56 succeeded at 3479 (offset 1 line).
>>> Hunk #57 succeeded at 3516 (offset 1 line).
>>> Hunk #58 succeeded at 3527 (offset 1 line).
>>> Hunk #59 succeeded at 3537 (offset 1 line).
>>> Hunk #60 succeeded at 3623 (offset 1 line).
>>> Hunk #61 succeeded at 3639 (offset 1 line).
>>> Hunk #62 succeeded at 3653 (offset 1 line).
>>> Hunk #63 succeeded at 3668 (offset 1 line).
>>> Hunk #64 succeeded at 3708 (offset 1 line).
>>> Hunk #65 succeeded at 3716 (offset 1 line).
>>> Hunk #66 succeeded at 3725 (offset 1 line).
>>> Hunk #67 succeeded at 3736 (offset 1 line).
>>> Hunk #68 succeeded at 3744 (offset 1 line).
>>> Hunk #69 succeeded at 3759 (offset 1 line).
>>> Hunk #70 succeeded at 3831 (offset 1 line).
>>> Hunk #71 succeeded at 3879 (offset 1 line).
>>> Hunk #72 succeeded at 3920 (offset 1 line).
>>> Hunk #73 succeeded at 3958 (offset 1 line).
>>> Hunk #74 succeeded at 3970 (offset 1 line).
>>> Hunk #75 succeeded at 4021 (offset 1 line).
>>> Hunk #76 succeeded at 4031 (offset 1 line).
>>> Hunk #77 succeeded at 4138 (offset 1 line).
>>> Hunk #78 succeeded at 4151 (offset 1 line).
>>> Hunk #79 succeeded at 4165 (offset 1 line).
>>> Hunk #80 succeeded at 4213 (offset 1 line).
>>> Hunk #81 succeeded at 4243 (offset 1 line).
>>> Hunk #82 succeeded at 4536 (offset 1 line).
>>> Hunk #83 succeeded at 4607 (offset 1 line).
>>> Hunk #84 succeeded at 4632 (offset 1 line).
>>> Hunk #85 succeeded at 4834 (offset 4 lines).
>>> Hunk #86 succeeded at 4850 (offset 4 lines).
>>> Hunk #87 succeeded at 4862 (offset 4 lines).
>>> Hunk #88 succeeded at 4897 (offset 4 lines).
>>> Hunk #89 succeeded at 4916 (offset 4 lines).
>>> Hunk #90 succeeded at 4928 (offset 4 lines).
>>> Hunk #91 succeeded at 4953 (offset 4 lines).
>>> Hunk #92 

[PATCH v2 3/3] usb: dwc2: Make dwc2_readl/writel functions endianness-agnostic.

2018-07-26 Thread Gevorg Sahakyan
Declared dwc2_check_core_endianness() function for dynamicly check
core endianness.
Added needs_byte_swap flag to hsotg structure, and depending on
flag swap value inside dwc2_readl/writel functions.

Signed-off-by: Gevorg Sahakyan 
---
 drivers/usb/dwc2/core.h | 22 --
 drivers/usb/dwc2/platform.c | 19 +++
 2 files changed, 39 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/dwc2/core.h b/drivers/usb/dwc2/core.h
index ae8534b..b8a0beb 100644
--- a/drivers/usb/dwc2/core.h
+++ b/drivers/usb/dwc2/core.h
@@ -96,6 +96,13 @@ static const char * const dwc2_hsotg_supply_names[] = {
  */
 #define EP0_MPS_LIMIT   64
 
+#define swap32(x) (\
+   {typeof(x) x_ = (x); \
+   (((u32)(x_) << 24) & (u32)0xFF00) | \
+   (((u32)(x_) <<  8) & (u32)0x00FF) | \
+   (((u32)(x_) >>  8) & (u32)0xFF00) | \
+   (((u32)(x_) >> 24) & (u32)0x00FF); })
+
 struct dwc2_hsotg;
 struct dwc2_hsotg_req;
 
@@ -857,6 +864,7 @@ struct dwc2_hregs_backup {
  * @gr_backup: Backup of global registers during suspend
  * @dr_backup: Backup of device registers during suspend
  * @hr_backup: Backup of host registers during suspend
+ * @needs_byte_swap:   Specifies whether the opposite endianness.
  *
  * These are for host mode:
  *
@@ -1046,6 +1054,7 @@ struct dwc2_hsotg {
 
struct dentry *debug_root;
struct debugfs_regset32 *regset;
+   bool needs_byte_swap;
 
/* DWC OTG HW Release versions */
 #define DWC2_CORE_REV_2_71a0x4f54271a
@@ -1164,12 +1173,21 @@ struct dwc2_hsotg {
 /* Normal architectures just use readl/write */
 static inline u32 dwc2_readl(struct dwc2_hsotg *hsotg, u32 offset)
 {
-   return readl(hsotg->regs + offset);
+   u32 val;
+
+   val = readl(hsotg->regs + offset);
+   if (hsotg->needs_byte_swap)
+   return swap32(val);
+   else
+   return val;
 }
 
 static inline void dwc2_writel(struct dwc2_hsotg *hsotg, u32 value, u32 offset)
 {
-   writel(value, hsotg->regs + offset);
+   if (hsotg->needs_byte_swap)
+   writel(swap32(value), hsotg->regs + offset);
+   else
+   writel(value, hsotg->regs + offset);
 
 #ifdef DWC2_LOG_WRITES
pr_info("info:: wrote %08x to %p\n", value, hsotg->regs + offset);
diff --git a/drivers/usb/dwc2/platform.c b/drivers/usb/dwc2/platform.c
index 4c08195..9a53a58 100644
--- a/drivers/usb/dwc2/platform.c
+++ b/drivers/usb/dwc2/platform.c
@@ -353,6 +353,23 @@ static void dwc2_driver_shutdown(struct platform_device 
*dev)
 }
 
 /**
+ * dwc2_check_core_endianness() - Returns true if core and AHB have
+ * opposite endianness.
+ * @hsotg: Programming view of the DWC_otg controller.
+ */
+static bool dwc2_check_core_endianness(struct dwc2_hsotg *hsotg)
+{
+   u32 snpsid;
+
+   snpsid = ioread32(hsotg->regs + GSNPSID);
+   if ((snpsid & GSNPSID_ID_MASK) == DWC2_OTG_ID ||
+   (snpsid & GSNPSID_ID_MASK) == DWC2_FS_IOT_ID ||
+   (snpsid & GSNPSID_ID_MASK) == DWC2_HS_IOT_ID)
+   return false;
+   return true;
+}
+
+/**
  * dwc2_driver_probe() - Called when the DWC_otg core is bound to the DWC_otg
  * driver
  *
@@ -395,6 +412,8 @@ static int dwc2_driver_probe(struct platform_device *dev)
dev_dbg(>dev, "mapped PA %08lx to VA %p\n",
(unsigned long)res->start, hsotg->regs);
 
+   hsotg->needs_byte_swap = dwc2_check_core_endianness(hsotg);
+
retval = dwc2_lowlevel_hw_init(hsotg);
if (retval)
return retval;
-- 
2.7.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 v2 2/3] usb: dwc2: replace ioread32/iowrite32_rep with dwc2_readl/writel_rep

2018-07-26 Thread Gevorg Sahakyan
dwc2_readl_rep/dwc2_writel_rep functions using readl/writel in a
loop.

Signed-off-by: Gevorg Sahakyan 
---
 drivers/usb/dwc2/core.h   | 61 ++-
 drivers/usb/dwc2/gadget.c |  6 ++---
 2 files changed, 26 insertions(+), 41 deletions(-)

diff --git a/drivers/usb/dwc2/core.h b/drivers/usb/dwc2/core.h
index bca8463..ae8534b 100644
--- a/drivers/usb/dwc2/core.h
+++ b/drivers/usb/dwc2/core.h
@@ -1161,60 +1161,45 @@ struct dwc2_hsotg {
 #endif /* CONFIG_USB_DWC2_PERIPHERAL || CONFIG_USB_DWC2_DUAL_ROLE */
 };
 
-#ifdef CONFIG_MIPS
-/*
- * There are some MIPS machines that can run in either big-endian
- * or little-endian mode and that use the dwc2 register without
- * a byteswap in both ways.
- * Unlike other architectures, MIPS apparently does not require a
- * barrier before the __raw_writel() to synchronize with DMA but does
- * require the barrier after the __raw_writel() to serialize a set of
- * writes. This set of operations was added specifically for MIPS and
- * should only be used there.
- */
+/* Normal architectures just use readl/write */
 static inline u32 dwc2_readl(struct dwc2_hsotg *hsotg, u32 offset)
 {
-   u32 value = __raw_readl(hsotg->regs + offset);
-
-   /* In order to preserve endianness __raw_* operation is used. Therefore
-* a barrier is needed to ensure IO access is not re-ordered across
-* reads or writes
-*/
-   mb();
-   return value;
+   return readl(hsotg->regs + offset);
 }
 
 static inline void dwc2_writel(struct dwc2_hsotg *hsotg, u32 value, u32 offset)
 {
-   __raw_writel(value, hsotg->regs + offset);
-
-   /*
-* In order to preserve endianness __raw_* operation is used. Therefore
-* a barrier is needed to ensure IO access is not re-ordered across
-* reads or writes
-*/
-   mb();
+   writel(value, hsotg->regs + offset);
+
 #ifdef DWC2_LOG_WRITES
-   pr_info("INFO:: wrote %08x to %p\n", value, hsotg->regs + offset);
+   pr_info("info:: wrote %08x to %p\n", value, hsotg->regs + offset);
 #endif
 }
-#else
 
-/* Normal architectures just use readl/write */
-static inline u32 dwc2_readl(struct dwc2_hsotg *hsotg, u32 offset)
+static inline void dwc2_readl_rep(struct dwc2_hsotg *hsotg, u32 offset,
+ void *buffer, unsigned int count)
 {
-   return readl(hsotg->regs + offset);
+   if (count) {
+   u32 *buf = buffer;
+
+   do {
+   u32 x = dwc2_readl(hsotg, offset);
+   *buf++ = x;
+   } while (--count);
+   }
 }
 
-static inline void dwc2_writel(struct dwc2_hsotg *hsotg, u32 value, u32 offset)
+static inline void dwc2_writel_rep(struct dwc2_hsotg *hsotg, u32 offset,
+  const void *buffer, unsigned int count)
 {
-   writel(value, hsotg->regs + offset);
+   if (count) {
+   const u32 *buf = buffer;
 
-#ifdef DWC2_LOG_WRITES
-   pr_info("info:: wrote %08x to %p\n", value, hsotg->regs + offset);
-#endif
+   do {
+   dwc2_writel(hsotg, *buf++, offset);
+   } while (--count);
+   }
 }
-#endif
 
 /* Reasons for halting a host channel */
 enum dwc2_halt_status {
diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c
index 50f94f2..26fdb4b 100644
--- a/drivers/usb/dwc2/gadget.c
+++ b/drivers/usb/dwc2/gadget.c
@@ -599,7 +599,7 @@ static int dwc2_hsotg_write_fifo(struct dwc2_hsotg *hsotg,
to_write = DIV_ROUND_UP(to_write, 4);
data = hs_req->req.buf + buf_pos;
 
-   iowrite32_rep(hsotg->regs + EPFIFO(hs_ep->index), data, to_write);
+   dwc2_writel_rep(hsotg, EPFIFO(hs_ep->index), data, to_write);
 
return (to_write >= can_write) ? -ENOSPC : 0;
 }
@@ -2169,8 +2169,8 @@ static void dwc2_hsotg_rx_data(struct dwc2_hsotg *hsotg, 
int ep_idx, int size)
 * note, we might over-write the buffer end by 3 bytes depending on
 * alignment of the data.
 */
-   ioread32_rep(hsotg->regs + EPFIFO(ep_idx),
-hs_req->req.buf + read_ptr, to_read);
+   dwc2_readl_rep(hsotg, EPFIFO(ep_idx),
+  hs_req->req.buf + read_ptr, to_read);
 }
 
 /**
-- 
2.7.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] Fix memory issue in non-DMA mode for MUSB gadget

2018-07-26 Thread Alexey Spirkov
dma_mapping_error function unable to works in PowerPC arch
when MUSB do not use DMA (illegal memory access). Proposed
patch replace its usage to usual define for checking DMA mapping.

Signed-off-by: Alexey Spirkov 
---
 drivers/usb/musb/musb_gadget.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c
index eae8b1b..3bc7c25 100644
--- a/drivers/usb/musb/musb_gadget.c
+++ b/drivers/usb/musb/musb_gadget.c
@@ -140,7 +140,7 @@ __acquires(ep->musb->lock)
ep->busy = 1;
spin_unlock(>lock);
 
-   if (!dma_mapping_error(>g.dev, request->dma))
+   if (req && is_buffer_mapped(req))
unmap_dma_buffer(req, musb);
 
trace_musb_req_gb(req);
-- 
2.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] Fix big-endian application issue for MUSB gadget

2018-07-26 Thread Alexey Spirkov
Existing code is not applicable to big-endian machines
ctrlrequest fields received in USB endian - i.e. in little-endian
and should be converted to cpu endianness before usage.

Signed-off-by: Alexey Spirkov 
---
 drivers/usb/musb/musb_gadget_ep0.c | 33 -
 1 file changed, 20 insertions(+), 13 deletions(-)

diff --git a/drivers/usb/musb/musb_gadget_ep0.c 
b/drivers/usb/musb/musb_gadget_ep0.c
index 91a5027..5d5c933 100644
--- a/drivers/usb/musb/musb_gadget_ep0.c
+++ b/drivers/usb/musb/musb_gadget_ep0.c
@@ -82,7 +82,7 @@ static int service_tx_status_request(
u16 tmp;
void __iomem*regs;
 
-   epnum = (u8) ctrlrequest->wIndex;
+   epnum = (u8) le16_to_cpu(ctrlrequest->wIndex);
if (!epnum) {
result[0] = 0;
break;
@@ -217,14 +217,15 @@ __acquires(musb->lock)
case USB_REQ_SET_ADDRESS:
/* change it after the status stage */
musb->set_address = true;
-   musb->address = (u8) (ctrlrequest->wValue & 0x7f);
+   musb->address = (u8) (le16_to_cpu(ctrlrequest->wValue) &
+   0x7f);
handled = 1;
break;
 
case USB_REQ_CLEAR_FEATURE:
switch (recip) {
case USB_RECIP_DEVICE:
-   if (ctrlrequest->wValue
+   if (le16_to_cpu(ctrlrequest->wValue)
!= USB_DEVICE_REMOTE_WAKEUP)
break;
musb->may_wakeup = 0;
@@ -234,7 +235,7 @@ __acquires(musb->lock)
break;
case USB_RECIP_ENDPOINT:{
const u8epnum =
-   ctrlrequest->wIndex & 0x0f;
+   le16_to_cpu(ctrlrequest->wIndex) & 0x0f;
struct musb_ep  *musb_ep;
struct musb_hw_ep   *ep;
struct musb_request *request;
@@ -243,12 +244,14 @@ __acquires(musb->lock)
u16 csr;
 
if (epnum == 0 || epnum >= MUSB_C_NUM_EPS ||
-   ctrlrequest->wValue != USB_ENDPOINT_HALT)
+   le16_to_cpu(ctrlrequest->wValue)
+   != USB_ENDPOINT_HALT)
break;
 
ep = musb->endpoints + epnum;
regs = ep->regs;
-   is_in = ctrlrequest->wIndex & USB_DIR_IN;
+   is_in = le16_to_cpu(ctrlrequest->wIndex) &
+   USB_DIR_IN;
if (is_in)
musb_ep = >ep_in;
else
@@ -300,17 +303,19 @@ __acquires(musb->lock)
switch (recip) {
case USB_RECIP_DEVICE:
handled = 1;
-   switch (ctrlrequest->wValue) {
+   switch (le16_to_cpu(ctrlrequest->wValue)) {
case USB_DEVICE_REMOTE_WAKEUP:
musb->may_wakeup = 1;
break;
case USB_DEVICE_TEST_MODE:
if (musb->g.speed != USB_SPEED_HIGH)
goto stall;
-   if (ctrlrequest->wIndex & 0xff)
+   if (le16_to_cpu(ctrlrequest->wIndex) &
+   0xff)
goto stall;
 
-   switch (ctrlrequest->wIndex >> 8) {
+   switch (le16_to_cpu(ctrlrequest->wIndex)
+>> 8) {
case 1:
pr_debug("TEST_J\n");
/* TEST_J */
@@ -399,7 +404,7 @@ __acquires(musb->lock)
 
case USB_RECIP_ENDPOINT:{
const u8epnum =
-   ctrlrequest->wIndex & 0x0f;
+   le16_to_cpu(ctrlrequest->wIndex) & 0x0f;
  

Re: [PATCH v2 2/4] usb: dwc2: Modify dwc2_readl/writel functions prototype

2018-07-26 Thread Felipe Balbi

Hi,

Grigor Tovmasyan  writes:
>>> Added hsotg argument to dwc2_readl/writel function prototype,
>>> and also instead of address pass offset of register.
>>> hsotg will contain flag field for endianness.
>>>
>>> Also customized dwc2_set_bit and dwc2_clear_bit function for
>>> dwc2_readl/writel functions.
>>>
>>> Signed-off-by: Gevorg Sahakyan 
>> 
>> sorry for the delay. I've been super busy with an internal task.
>> 
>> Anyway, this doesn't apply to testing/next. Give me a couple hours for
>> me to go through the other patches, then I'll push testing/next so you
>> can rebase.
>> 
>> checking file drivers/usb/dwc2/core.c
>> checking file drivers/usb/dwc2/core.h
>> Hunk #1 succeeded at 1172 (offset 3 lines).
>> Hunk #2 succeeded at 1184 (offset 3 lines).
>> Hunk #3 succeeded at 1195 (offset 3 lines).
>> Hunk #4 succeeded at 1321 (offset 3 lines).
>> checking file drivers/usb/dwc2/core_intr.c
>> checking file drivers/usb/dwc2/debugfs.c
>> checking file drivers/usb/dwc2/gadget.c
>> Hunk #11 succeeded at 916 (offset 6 lines).
>> Hunk #12 succeeded at 968 (offset 6 lines).
>> Hunk #13 succeeded at 1065 (offset 6 lines).
>> Hunk #14 succeeded at 1079 (offset 6 lines).
>> Hunk #15 succeeded at 1105 (offset 6 lines).
>> Hunk #16 succeeded at 1128 (offset 6 lines).
>> Hunk #17 succeeded at 1467 (offset 6 lines).
>> Hunk #18 succeeded at 1481 (offset 6 lines).
>> Hunk #19 succeeded at 1635 (offset 6 lines).
>> Hunk #20 succeeded at 1774 (offset 6 lines).
>> Hunk #21 succeeded at 1826 (offset 6 lines).
>> Hunk #22 succeeded at 1956 (offset 6 lines).
>> Hunk #23 succeeded at 2125 (offset 6 lines).
>> Hunk #24 succeeded at 2139 (offset 6 lines).
>> Hunk #25 succeeded at 2169 (offset 6 lines).
>> Hunk #26 succeeded at 2199 (offset 6 lines).
>> Hunk #27 succeeded at 2248 (offset 6 lines).
>> Hunk #28 succeeded at 2344 (offset 6 lines).
>> Hunk #29 succeeded at 2375 (offset 6 lines).
>> Hunk #30 succeeded at 2393 (offset 6 lines).
>> Hunk #31 succeeded at 2447 (offset 6 lines).
>> Hunk #32 succeeded at 2472 (offset 6 lines).
>> Hunk #33 succeeded at 2496 (offset 6 lines).
>> Hunk #34 succeeded at 2550 (offset 6 lines).
>> Hunk #35 succeeded at 2654 (offset 6 lines).
>> Hunk #36 succeeded at 2684 (offset 6 lines).
>> Hunk #37 succeeded at 2699 (offset 6 lines).
>> Hunk #38 succeeded at 2775 (offset 4 lines).
>> Hunk #39 succeeded at 2829 (offset 1 line).
>> Hunk #40 succeeded at 2866 (offset 1 line).
>> Hunk #41 succeeded at 2897 (offset 1 line).
>> Hunk #42 succeeded at 3016 (offset 1 line).
>> Hunk #43 succeeded at 3087 (offset 1 line).
>> Hunk #44 succeeded at 3115 (offset 1 line).
>> Hunk #45 succeeded at 3216 (offset 1 line).
>> Hunk #46 succeeded at 3231 (offset 1 line).
>> Hunk #47 succeeded at 3257 (offset 1 line).
>> Hunk #48 succeeded at 3277 (offset 1 line).
>> Hunk #49 succeeded at 3301 (offset 1 line).
>> Hunk #50 succeeded at 3345 (offset 1 line).
>> Hunk #51 succeeded at 3358 (offset 1 line).
>> Hunk #52 succeeded at 3387 (offset 1 line).
>> Hunk #53 succeeded at 3425 (offset 1 line).
>> Hunk #54 succeeded at 3433 (offset 1 line).
>> Hunk #55 succeeded at 3470 (offset 1 line).
>> Hunk #56 succeeded at 3479 (offset 1 line).
>> Hunk #57 succeeded at 3516 (offset 1 line).
>> Hunk #58 succeeded at 3527 (offset 1 line).
>> Hunk #59 succeeded at 3537 (offset 1 line).
>> Hunk #60 succeeded at 3623 (offset 1 line).
>> Hunk #61 succeeded at 3639 (offset 1 line).
>> Hunk #62 succeeded at 3653 (offset 1 line).
>> Hunk #63 succeeded at 3668 (offset 1 line).
>> Hunk #64 succeeded at 3708 (offset 1 line).
>> Hunk #65 succeeded at 3716 (offset 1 line).
>> Hunk #66 succeeded at 3725 (offset 1 line).
>> Hunk #67 succeeded at 3736 (offset 1 line).
>> Hunk #68 succeeded at 3744 (offset 1 line).
>> Hunk #69 succeeded at 3759 (offset 1 line).
>> Hunk #70 succeeded at 3831 (offset 1 line).
>> Hunk #71 succeeded at 3879 (offset 1 line).
>> Hunk #72 succeeded at 3920 (offset 1 line).
>> Hunk #73 succeeded at 3958 (offset 1 line).
>> Hunk #74 succeeded at 3970 (offset 1 line).
>> Hunk #75 succeeded at 4021 (offset 1 line).
>> Hunk #76 succeeded at 4031 (offset 1 line).
>> Hunk #77 succeeded at 4138 (offset 1 line).
>> Hunk #78 succeeded at 4151 (offset 1 line).
>> Hunk #79 succeeded at 4165 (offset 1 line).
>> Hunk #80 succeeded at 4213 (offset 1 line).
>> Hunk #81 succeeded at 4243 (offset 1 line).
>> Hunk #82 succeeded at 4536 (offset 1 line).
>> Hunk #83 succeeded at 4607 (offset 1 line).
>> Hunk #84 succeeded at 4632 (offset 1 line).
>> Hunk #85 succeeded at 4834 (offset 4 lines).
>> Hunk #86 succeeded at 4850 (offset 4 lines).
>> Hunk #87 succeeded at 4862 (offset 4 lines).
>> Hunk #88 succeeded at 4897 (offset 4 lines).
>> Hunk #89 succeeded at 4916 (offset 4 lines).
>> Hunk #90 succeeded at 4928 (offset 4 lines).
>> Hunk #91 succeeded at 4953 (offset 4 lines).
>> Hunk #92 succeeded at 4987 (offset 4 lines).
>> Hunk #93 succeeded at 5062 (offset 4 lines).
>> Hunk #94 succeeded at 5121 (offset 4 lines).
>> checking file 

Re: [PATCH v3 1/2] usb: dwc3: pci: Supply device properties via driver data

2018-07-26 Thread Andy Shevchenko
On Thu, 2018-07-26 at 14:50 +0300, Felipe Balbi wrote:
> Andy Shevchenko  writes:
> 
> > For now all PCI enumerated dwc3 devices require some properties
> > to be present. This allows us to unconditionally append them and
> > supply
> > via driver_data.
> > 
> > No functional change intended.
> > 
> > Signed-off-by: Andy Shevchenko 
> 
> both applied,

Thanks!

>  but I removed your macro below since that only adds
> obfuscation and breaks the simple use-case of navigating with the help
> of ctags/etags.

No hard feelings!

-- 
Andy Shevchenko 
Intel Finland Oy
--
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 1/2] usb: dwc3: pci: Supply device properties via driver data

2018-07-26 Thread Felipe Balbi
Andy Shevchenko  writes:

> For now all PCI enumerated dwc3 devices require some properties
> to be present. This allows us to unconditionally append them and supply
> via driver_data.
>
> No functional change intended.
>
> Signed-off-by: Andy Shevchenko 

both applied, but I removed your macro below since that only adds
obfuscation and breaks the simple use-case of navigating with the help
of ctags/etags.

-- 
balbi


signature.asc
Description: PGP signature


Re: [PATCH v2 2/4] usb: dwc2: Modify dwc2_readl/writel functions prototype

2018-07-26 Thread Grigor Tovmasyan
Hi Felipe,

On 7/26/2018 14:43, Felipe Balbi wrote:
> Gevorg Sahakyan  writes:
> 
>> Added hsotg argument to dwc2_readl/writel function prototype,
>> and also instead of address pass offset of register.
>> hsotg will contain flag field for endianness.
>>
>> Also customized dwc2_set_bit and dwc2_clear_bit function for
>> dwc2_readl/writel functions.
>>
>> Signed-off-by: Gevorg Sahakyan 
> 
> sorry for the delay. I've been super busy with an internal task.
> 
> Anyway, this doesn't apply to testing/next. Give me a couple hours for
> me to go through the other patches, then I'll push testing/next so you
> can rebase.
> 
> checking file drivers/usb/dwc2/core.c
> checking file drivers/usb/dwc2/core.h
> Hunk #1 succeeded at 1172 (offset 3 lines).
> Hunk #2 succeeded at 1184 (offset 3 lines).
> Hunk #3 succeeded at 1195 (offset 3 lines).
> Hunk #4 succeeded at 1321 (offset 3 lines).
> checking file drivers/usb/dwc2/core_intr.c
> checking file drivers/usb/dwc2/debugfs.c
> checking file drivers/usb/dwc2/gadget.c
> Hunk #11 succeeded at 916 (offset 6 lines).
> Hunk #12 succeeded at 968 (offset 6 lines).
> Hunk #13 succeeded at 1065 (offset 6 lines).
> Hunk #14 succeeded at 1079 (offset 6 lines).
> Hunk #15 succeeded at 1105 (offset 6 lines).
> Hunk #16 succeeded at 1128 (offset 6 lines).
> Hunk #17 succeeded at 1467 (offset 6 lines).
> Hunk #18 succeeded at 1481 (offset 6 lines).
> Hunk #19 succeeded at 1635 (offset 6 lines).
> Hunk #20 succeeded at 1774 (offset 6 lines).
> Hunk #21 succeeded at 1826 (offset 6 lines).
> Hunk #22 succeeded at 1956 (offset 6 lines).
> Hunk #23 succeeded at 2125 (offset 6 lines).
> Hunk #24 succeeded at 2139 (offset 6 lines).
> Hunk #25 succeeded at 2169 (offset 6 lines).
> Hunk #26 succeeded at 2199 (offset 6 lines).
> Hunk #27 succeeded at 2248 (offset 6 lines).
> Hunk #28 succeeded at 2344 (offset 6 lines).
> Hunk #29 succeeded at 2375 (offset 6 lines).
> Hunk #30 succeeded at 2393 (offset 6 lines).
> Hunk #31 succeeded at 2447 (offset 6 lines).
> Hunk #32 succeeded at 2472 (offset 6 lines).
> Hunk #33 succeeded at 2496 (offset 6 lines).
> Hunk #34 succeeded at 2550 (offset 6 lines).
> Hunk #35 succeeded at 2654 (offset 6 lines).
> Hunk #36 succeeded at 2684 (offset 6 lines).
> Hunk #37 succeeded at 2699 (offset 6 lines).
> Hunk #38 succeeded at 2775 (offset 4 lines).
> Hunk #39 succeeded at 2829 (offset 1 line).
> Hunk #40 succeeded at 2866 (offset 1 line).
> Hunk #41 succeeded at 2897 (offset 1 line).
> Hunk #42 succeeded at 3016 (offset 1 line).
> Hunk #43 succeeded at 3087 (offset 1 line).
> Hunk #44 succeeded at 3115 (offset 1 line).
> Hunk #45 succeeded at 3216 (offset 1 line).
> Hunk #46 succeeded at 3231 (offset 1 line).
> Hunk #47 succeeded at 3257 (offset 1 line).
> Hunk #48 succeeded at 3277 (offset 1 line).
> Hunk #49 succeeded at 3301 (offset 1 line).
> Hunk #50 succeeded at 3345 (offset 1 line).
> Hunk #51 succeeded at 3358 (offset 1 line).
> Hunk #52 succeeded at 3387 (offset 1 line).
> Hunk #53 succeeded at 3425 (offset 1 line).
> Hunk #54 succeeded at 3433 (offset 1 line).
> Hunk #55 succeeded at 3470 (offset 1 line).
> Hunk #56 succeeded at 3479 (offset 1 line).
> Hunk #57 succeeded at 3516 (offset 1 line).
> Hunk #58 succeeded at 3527 (offset 1 line).
> Hunk #59 succeeded at 3537 (offset 1 line).
> Hunk #60 succeeded at 3623 (offset 1 line).
> Hunk #61 succeeded at 3639 (offset 1 line).
> Hunk #62 succeeded at 3653 (offset 1 line).
> Hunk #63 succeeded at 3668 (offset 1 line).
> Hunk #64 succeeded at 3708 (offset 1 line).
> Hunk #65 succeeded at 3716 (offset 1 line).
> Hunk #66 succeeded at 3725 (offset 1 line).
> Hunk #67 succeeded at 3736 (offset 1 line).
> Hunk #68 succeeded at 3744 (offset 1 line).
> Hunk #69 succeeded at 3759 (offset 1 line).
> Hunk #70 succeeded at 3831 (offset 1 line).
> Hunk #71 succeeded at 3879 (offset 1 line).
> Hunk #72 succeeded at 3920 (offset 1 line).
> Hunk #73 succeeded at 3958 (offset 1 line).
> Hunk #74 succeeded at 3970 (offset 1 line).
> Hunk #75 succeeded at 4021 (offset 1 line).
> Hunk #76 succeeded at 4031 (offset 1 line).
> Hunk #77 succeeded at 4138 (offset 1 line).
> Hunk #78 succeeded at 4151 (offset 1 line).
> Hunk #79 succeeded at 4165 (offset 1 line).
> Hunk #80 succeeded at 4213 (offset 1 line).
> Hunk #81 succeeded at 4243 (offset 1 line).
> Hunk #82 succeeded at 4536 (offset 1 line).
> Hunk #83 succeeded at 4607 (offset 1 line).
> Hunk #84 succeeded at 4632 (offset 1 line).
> Hunk #85 succeeded at 4834 (offset 4 lines).
> Hunk #86 succeeded at 4850 (offset 4 lines).
> Hunk #87 succeeded at 4862 (offset 4 lines).
> Hunk #88 succeeded at 4897 (offset 4 lines).
> Hunk #89 succeeded at 4916 (offset 4 lines).
> Hunk #90 succeeded at 4928 (offset 4 lines).
> Hunk #91 succeeded at 4953 (offset 4 lines).
> Hunk #92 succeeded at 4987 (offset 4 lines).
> Hunk #93 succeeded at 5062 (offset 4 lines).
> Hunk #94 succeeded at 5121 (offset 4 lines).
> checking file drivers/usb/dwc2/hcd.c
> Hunk #40 FAILED at 1566.
> Hunk #41 

[PATCH v3 2/2] usb: dwc3: pci: Intel Merrifield can be host

2018-07-26 Thread Andy Shevchenko
On Intel Edison board the OTG function is enabled, thus,
USB can switch to the host mode.

Allow that by changing dr_mode property to "otg" for Intel Merrifield.

Signed-off-by: Andy Shevchenko 
---
 drivers/usb/dwc3/dwc3-pci.c | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/dwc3/dwc3-pci.c b/drivers/usb/dwc3/dwc3-pci.c
index cc4db9a06505..88b800ab6419 100644
--- a/drivers/usb/dwc3/dwc3-pci.c
+++ b/drivers/usb/dwc3/dwc3-pci.c
@@ -107,6 +107,12 @@ static const struct property_entry 
dwc3_pci_intel_properties[] = {
{}
 };
 
+static const struct property_entry dwc3_pci_mrfld_properties[] = {
+   PROPERTY_ENTRY_STRING("dr_mode", "otg"),
+   PROPERTY_ENTRY_BOOL("linux,sysdev_is_parent"),
+   {}
+};
+
 static const struct property_entry dwc3_pci_amd_properties[] = {
PROPERTY_ENTRY_BOOL("snps,has-lpm-erratum"),
PROPERTY_ENTRY_U8("snps,lpm-nyet-threshold", 0xf),
@@ -293,7 +299,7 @@ static void dwc3_pci_remove(struct pci_dev *pci)
 static const struct pci_device_id dwc3_pci_id_table[] = {
DWC3_PCI_DEV(INTEL, INTEL_BSW,  dwc3_pci_intel_properties),
DWC3_PCI_DEV(INTEL, INTEL_BYT,  dwc3_pci_intel_properties),
-   DWC3_PCI_DEV(INTEL, INTEL_MRFLD,dwc3_pci_intel_properties),
+   DWC3_PCI_DEV(INTEL, INTEL_MRFLD,dwc3_pci_mrfld_properties),
DWC3_PCI_DEV(INTEL, INTEL_SPTLP,dwc3_pci_intel_properties),
DWC3_PCI_DEV(INTEL, INTEL_SPTH, dwc3_pci_intel_properties),
DWC3_PCI_DEV(INTEL, INTEL_BXT,  dwc3_pci_intel_properties),
-- 
2.18.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


[PATCH v3 1/2] usb: dwc3: pci: Supply device properties via driver data

2018-07-26 Thread Andy Shevchenko
For now all PCI enumerated dwc3 devices require some properties
to be present. This allows us to unconditionally append them and supply
via driver_data.

No functional change intended.

Signed-off-by: Andy Shevchenko 
---
 drivers/usb/dwc3/dwc3-pci.c | 107 +---
 1 file changed, 50 insertions(+), 57 deletions(-)

diff --git a/drivers/usb/dwc3/dwc3-pci.c b/drivers/usb/dwc3/dwc3-pci.c
index b29f031dfc23..cc4db9a06505 100644
--- a/drivers/usb/dwc3/dwc3-pci.c
+++ b/drivers/usb/dwc3/dwc3-pci.c
@@ -101,52 +101,37 @@ static int dwc3_byt_enable_ulpi_refclock(struct pci_dev 
*pci)
return 0;
 }
 
+static const struct property_entry dwc3_pci_intel_properties[] = {
+   PROPERTY_ENTRY_STRING("dr_mode", "peripheral"),
+   PROPERTY_ENTRY_BOOL("linux,sysdev_is_parent"),
+   {}
+};
+
+static const struct property_entry dwc3_pci_amd_properties[] = {
+   PROPERTY_ENTRY_BOOL("snps,has-lpm-erratum"),
+   PROPERTY_ENTRY_U8("snps,lpm-nyet-threshold", 0xf),
+   PROPERTY_ENTRY_BOOL("snps,u2exit_lfps_quirk"),
+   PROPERTY_ENTRY_BOOL("snps,u2ss_inp3_quirk"),
+   PROPERTY_ENTRY_BOOL("snps,req_p1p2p3_quirk"),
+   PROPERTY_ENTRY_BOOL("snps,del_p1p2p3_quirk"),
+   PROPERTY_ENTRY_BOOL("snps,del_phy_power_chg_quirk"),
+   PROPERTY_ENTRY_BOOL("snps,lfps_filter_quirk"),
+   PROPERTY_ENTRY_BOOL("snps,rx_detect_poll_quirk"),
+   PROPERTY_ENTRY_BOOL("snps,tx_de_emphasis_quirk"),
+   PROPERTY_ENTRY_U8("snps,tx_de_emphasis", 1),
+   /* FIXME these quirks should be removed when AMD NL tapes out */
+   PROPERTY_ENTRY_BOOL("snps,disable_scramble_quirk"),
+   PROPERTY_ENTRY_BOOL("snps,dis_u3_susphy_quirk"),
+   PROPERTY_ENTRY_BOOL("snps,dis_u2_susphy_quirk"),
+   PROPERTY_ENTRY_BOOL("linux,sysdev_is_parent"),
+   {}
+};
+
 static int dwc3_pci_quirks(struct dwc3_pci *dwc)
 {
-   struct platform_device  *dwc3 = dwc->dwc3;
struct pci_dev  *pdev = dwc->pci;
 
-   if (pdev->vendor == PCI_VENDOR_ID_AMD &&
-   pdev->device == PCI_DEVICE_ID_AMD_NL_USB) {
-   struct property_entry properties[] = {
-   PROPERTY_ENTRY_BOOL("snps,has-lpm-erratum"),
-   PROPERTY_ENTRY_U8("snps,lpm-nyet-threshold", 0xf),
-   PROPERTY_ENTRY_BOOL("snps,u2exit_lfps_quirk"),
-   PROPERTY_ENTRY_BOOL("snps,u2ss_inp3_quirk"),
-   PROPERTY_ENTRY_BOOL("snps,req_p1p2p3_quirk"),
-   PROPERTY_ENTRY_BOOL("snps,del_p1p2p3_quirk"),
-   PROPERTY_ENTRY_BOOL("snps,del_phy_power_chg_quirk"),
-   PROPERTY_ENTRY_BOOL("snps,lfps_filter_quirk"),
-   PROPERTY_ENTRY_BOOL("snps,rx_detect_poll_quirk"),
-   PROPERTY_ENTRY_BOOL("snps,tx_de_emphasis_quirk"),
-   PROPERTY_ENTRY_U8("snps,tx_de_emphasis", 1),
-   /*
-* FIXME these quirks should be removed when AMD NL
-* tapes out
-*/
-   PROPERTY_ENTRY_BOOL("snps,disable_scramble_quirk"),
-   PROPERTY_ENTRY_BOOL("snps,dis_u3_susphy_quirk"),
-   PROPERTY_ENTRY_BOOL("snps,dis_u2_susphy_quirk"),
-   PROPERTY_ENTRY_BOOL("linux,sysdev_is_parent"),
-   { },
-   };
-
-   return platform_device_add_properties(dwc3, properties);
-   }
-
if (pdev->vendor == PCI_VENDOR_ID_INTEL) {
-   int ret;
-
-   struct property_entry properties[] = {
-   PROPERTY_ENTRY_STRING("dr_mode", "peripheral"),
-   PROPERTY_ENTRY_BOOL("linux,sysdev_is_parent"),
-   { }
-   };
-
-   ret = platform_device_add_properties(dwc3, properties);
-   if (ret < 0)
-   return ret;
-
if (pdev->device == PCI_DEVICE_ID_INTEL_BXT ||
pdev->device == PCI_DEVICE_ID_INTEL_BXT_M) {
guid_parse(PCI_INTEL_BXT_DSM_GUID, >guid);
@@ -155,6 +140,7 @@ static int dwc3_pci_quirks(struct dwc3_pci *dwc)
 
if (pdev->device == PCI_DEVICE_ID_INTEL_BYT) {
struct gpio_desc *gpio;
+   int ret;
 
/* On BYT the FW does not always enable the refclock */
ret = dwc3_byt_enable_ulpi_refclock(pdev);
@@ -216,9 +202,9 @@ static void dwc3_pci_resume_work(struct work_struct *work)
 }
 #endif
 
-static int dwc3_pci_probe(struct pci_dev *pci,
-   const struct pci_device_id *id)
+static int dwc3_pci_probe(struct pci_dev *pci, const struct pci_device_id *id)
 {
+   struct property_entry *p = (struct property_entry *)id->driver_data;
struct dwc3_pci *dwc;
struct resource 

Re: [PATCH] usb: dwc2: gadget: ISOC's starting flow improvement

2018-07-26 Thread Felipe Balbi

No top posting ;)

Minas Harutyunyan  writes:

> Hi Felipe,
>
> This patch should be applied after follow patch from Artur Petrosyan:
>
> "[PATCH] usb: dwc2: Change reading of current frame number flow."

Hasn't this been part of mainline for a while already?

commit c7c24e7a047652c558e7aa4b0f54aae3a61aacc4
Author: Artur Petrosyan 
Date:   Sat May 5 09:46:26 2018 -0400

usb: dwc2: Change reading of current frame number flow.

The current frame_number is read from core for both
device and host modes. Reading of the current frame
number needs to be performed ASAP due to IRQ latency's.
This is why, it is moved to common interrupt handler.

Accordingly updated dwc2_gadget_target_frame_elapsed()
function which uses stored frame_number instead of
reading frame number.

In cases when target frame value is incremented
the frame_number is required to read again.

Signed-off-by: Artur Petrosyan 
Signed-off-by: Felipe Balbi 

-- 
balbi


signature.asc
Description: PGP signature


Re: [PATCH] usb: dwc2: gadget: ISOC's starting flow improvement

2018-07-26 Thread Minas Harutyunyan
Hi Felipe,

This patch should be applied after follow patch from Artur Petrosyan:

"[PATCH] usb: dwc2: Change reading of current frame number flow."

Thanks,
Minas

On 7/26/2018 2:45 PM, Felipe Balbi wrote:
> Minas Harutyunyan  writes:
> 
>> To start ISOC transfers in handlers dwc2_gadget_handle_nak() and
>> dwc2_gadget_handle_out_token_ep_disabled() driver reads current frame
>> number, based on which, set target frame number to start first ISOC
>> transfer.
>>
>> In case if system's high IRQ latency and multiple EP's asserted
>> interrupt in same frame, there are high probability that when reading
>> current frame number in EP's handlers, actual frame number can be
>> increased. As result for bInterval > 1, starting target frame
>> will be set wrongly and all ISOC packets will be dropped.
>>
>> In patch "usb: dwc2: Change reading of current frame number flow"
>> reading of current frame number done ASAP in common interrupt handler.
>> This frame number stored in frame_number variable which used as
>> starting frame number for ISOC EP's in above mentioned handlers.
>>
>> Signed-off-by: Minas Harutyunyan 
> 
> please rebase on top of testing/next after a couple hours:
> 
> checking file drivers/usb/dwc2/gadget.c
> Hunk #1 FAILED at 2749.
> Hunk #2 succeeded at 2772 (offset -1 lines).
> Hunk #3 FAILED at 2811.
> 2 out of 3 hunks FAILED
> 

--
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 3/3] dwc3: Intel Merrifield can be host

2018-07-26 Thread Felipe Balbi
Andy Shevchenko  writes:

> On Intel Edison board the OTG function is enabled, thus,
> USB can switch to the host mode.
>
> Allow that by changing dr_mode property to "otg" for Intel Merrifield.
>
> Signed-off-by: Andy Shevchenko 

this will need rebasing too

-- 
balbi


signature.asc
Description: PGP signature


Re: [PATCH v1 2/2] dwc3: Supply device properties via driver data

2018-07-26 Thread Felipe Balbi
Andy Shevchenko  writes:

> For now all PCI enumerated dwc3 devices require some properties
> to be present. This allows us to unconditionally append them and supply
> via driver_data.
>
> No functional change intended.
>
> Signed-off-by: Andy Shevchenko 

Doesn't apply. Please rebase on testing/next in a couple hours after I
push it.

checking file drivers/usb/dwc3/dwc3-pci.c
Hunk #1 succeeded at 101 with fuzz 2 (offset 33 lines).
Hunk #2 succeeded at 148 with fuzz 2 (offset 33 lines).
Hunk #3 FAILED at 146.
Hunk #4 succeeded at 210 (offset 30 lines).
Hunk #5 succeeded at 255 (offset 30 lines).
Hunk #6 FAILED at 264.
2 out of 6 hunks FAILED

-- 
balbi


signature.asc
Description: PGP signature


Re: [RFC PATCH] usb: gadget: mass_storage: Add GET_EVENT_STATUS_NOTIFICATION

2018-07-26 Thread Felipe Balbi

Hi,

Benjamin Herrenschmidt  writes:
> This is just RFC at this stage, I was getting annoyed at the 
> once-per-seconddebug message about unsupported command when using 
> f_mass_storage as a CDROM,so I quickly hacked that up.
> I'm not clearing the events per-se, I'm just sending events based on thestate 
> of pending unit attentions, which seems to be enough to please Linuxon the 
> other side, but definitely needs more testing or expert opinions.
> If I find some spare cycle in the next few weeks I might add a few moreof the 
> basic MMC commands so we at least support everything Linux throwsat us for a 
> normal read-only CDROM.
> Comments ?
> Not-Yet-Signed-off-by: Benjamin Herrenschmidt --- 
> drivers/usb/gadget/function/f_mass_storage.c | 49 +++- 1 file 
> changed, 48 insertions(+), 1 deletion(-)
> diff --git a/drivers/usb/gadget/function/f_mass_storage.c 
> b/drivers/usb/gadget/function/f_mass_storage.cindex 
> 7b13928077c9..d8c83359f470 100644--- 
> a/drivers/usb/gadget/function/f_mass_storage.c+++ 
> b/drivers/usb/gadget/function/f_mass_storage.c@@ -1390,6 +1390,42 @@ static 
> int do_mode_select(struct fsg_common *common, struct fsg_buffhd *bh) 
> return -EINVAL; } +static int do_get_event_status_notification(struct 
> fsg_common *common,+  struct 
> fsg_buffhd *bh)+{+   struct fsg_lun  *curlun = common->curlun;+  u8   
>*buf = (u8 *) bh->buf;+ boolmedia_class;+   u8 
>  event;+ int size;++ /* We only support media class */+  
> media_class = (common->cmnd[4] & 0x10) != 0;++  /* We just mirror the unit 
> attentions */+   if (curlun->unit_attention_data == 
> SS_NOT_READY_TO_READY_TRANSITION)+   event = 2; /* New media */+ 
> else if (curlun->unit_attention_data == SS_MEDIUM_NOT_PRESENT)+ event 
> = 3;+ else+   event = 0;++/* Fill common header */+   
> size = 4;+  buf[3] = 0x10; /* Support classes: media */+if 
> (media_class) {+ buf[2] = 4; /* Return media event */+   
> if (event == 0)+buf[2] |= 0x80; /* No Event Available 
> */+   size += 8;+ buf[4] = event;+
> buf[5] = 1; /* Active */+   buf[6] = buf[7] = 0;+   } else {+ 
>   buf[2] = 0; /* None of the req. classes supported */+   }+  
> return size;+}  
> /*-*/ 
> @@ -1753,7 +1789,8 @@ static int check_command(struct fsg_common *common, int 
> cmnd_size,   */ if (curlun && curlun->unit_attention_data != SS_NO_SENSE 
> && common->cmnd[0] != INQUIRY &&-  common->cmnd[0] != 
> REQUEST_SENSE) {+common->cmnd[0] != REQUEST_SENSE &&+
> common->cmnd[0] != GET_EVENT_STATUS_NOTIFICATION) { 
> curlun->sense_data = curlun->unit_attention_data;   
> curlun->unit_attention_data = SS_NO_SENSE;  return -EINVAL;@@ 
> -2025,6 +2062,16 @@ static int do_scsi_command(struct fsg_common *common) 
> reply = do_write(common);   break; +case 
> GET_EVENT_STATUS_NOTIFICATION:+common->data_size_from_cmnd =+ 
>  get_unaligned_be16(>cmnd[7]);+  reply = 
> check_command(common, 10, DATA_DIR_TO_HOST,+  
> (1 << 1) | (1 << 4) | (3 << 7) | (1 << 9),+   
>   0, "GET_EVENT_STATUS_NOTIFICATION");+ if (reply == 0)+  
>   reply = do_get_event_status_notification(common, bh);+  
> break;+ /*   * Some mandatory commands that we recognize but 
> don't implement.* They don't mean much in this setting.  It's left as 
> an exercise

html + plain text? C'mon Ben :)

-- 
balbi


signature.asc
Description: PGP signature


Re: [PATCH v3 1/3] usb: dwc3: pci: Add GPIO lookup table on platforms without ACPI GPIO resources

2018-07-26 Thread Felipe Balbi
Hans de Goede  writes:

> Hi,
>
> On 10-06-18 16:01, Hans de Goede wrote:
>> Bay Trail / BYT SoCs do not have a builtin device-mode phy, instead
>> they require an external ULPI phy for device-mode.
>> 
>> Only some BYT devices have an external phy, but even on those devices
>> device-mode is not working because the dwc3 does not see the phy.
>> 
>> The problem is that the ACPI fwnode for the dwc3 does not contain the
>> expected GPIO resources for the GPIOs connected to the chip-select and
>> reset pins of the phy.
>> 
>> I've found the workaround which some Android x86 kernels use for this:
>> https://github.com/BORETS24/Kernel-for-Asus-Zenfone-2/blob/master/arch/x86/platform/intel-mid/device_libs/pci/platform_usb_otg.c
>> Which boils down to hardcoding the GPIOs for these devices.
>> 
>> The good news it that all boards (*) use the same GPIOs.
>> 
>> This commit fixes the ULPI phy not woring by adding a gpiod_lookup_table
>> call which adds a hardcoded mapping for BYT devices. Note that the mapping
>> added by gpiod_add_lookup_table is a fallback mapping, so boards which
>> properly provide GPIO resources in the ACPI firmware-node resources
>> will not use this.
>> 
>> *) Except for the first revision of the evalulation-kit, which normal users
>> don't have
>> 
>> Signed-off-by: Hans de Goede 
>> ---
>> Changes in v3:
>> -Add the mapping with gpiod_add_lookup_table() unconditionally on BYT
>>   devices, as they are only used after checking for GPIO resources in ACPI
>
> Ping? AFAIK this series is ready for merging now and it is necessary to
> make gadget mode work on all Bay Trail devices which support gadget
> mode.

now queued for v4.19

-- 
balbi


signature.asc
Description: PGP signature


Re: [PATCH] Driver for MaxLinear/Exar USB (UART) Serial Adapters

2018-07-26 Thread Greg KH
On Tue, Jul 24, 2018 at 03:36:36PM -0700, Patong Yang wrote:
> The original driver/patch was submitted on April 4, 2018.  This is the
> second version based on the feedback received on the original patch.
> 
> v2: Removed custom IOCTLs, as suggested by Greg KH
> Using standard Linux GPIO APIs, as suggested by Greg KH
> Removed file reads/writes as suggested by Greg KH
> 
> Signed-off-by: Patong Yang 
> ---
>  drivers/usb/serial/xrusb_serial.c | 2380 +
>  drivers/usb/serial/xrusb_serial.h |  234 +++

Why do you need a .h file for a single driver?  Please just put it all
into one file.

But there is a bigger problem here:

> + xrusb_tty_driver = alloc_tty_driver(XRUSB_TTY_MINORS);
> + if (!xrusb_tty_driver)
> + return -ENOMEM;

Why are you not using the usb serial core here?  You need to do that,
not try to provide your own custom tty driver.  That way userspace
programs will "just work" with your new device, no changes needed as
your major/minor number and device name would be custom only for your
device, which is not acceptable.

By doing that, your code will also be much smaller, always a good
benefit as well.

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: [PATCH 6/7] usb: gadget: f_uac2: disable IN/OUT ep if unused

2018-07-26 Thread Felipe Balbi
Eugeniu Rosca  writes:

> From: Andreas Pape 
>
> Via p_chmask/c_chmask the user can define whether uac2 shall support
> playback and/or capture. This has only effect on the created ALSA device,
> but not on the USB descriptor. This patch adds playback/capture descriptors
> dependent on that parameter.
>
> Signed-off-by: Andreas Pape 
> Signed-off-by: Eugeniu Rosca 

unfortunately doesn't apply:

checking file drivers/usb/gadget/function/f_uac2.c
Hunk #13 FAILED at 678.
1 out of 14 hunks FAILED

Please rebase on testing/next after a couple hours

-- 
balbi


signature.asc
Description: PGP signature


Re: [PATCH v7] usb: gadget: uvc: configfs: Add bFrameIndex attributes

2018-07-26 Thread Felipe Balbi
Laurent Pinchart  writes:

> From: Joel Pepper 
>
> - Add bFrameIndex as a UVCG_FRAME_ATTR_RO for each frame size.
> - Automatically assign ascending bFrameIndex to each frame in a format.
>
> Before all "bFrameindex" attributes were set to "1" with no way to
> configure the gadget otherwise. This resulted in the host always
> negotiating for bFrameIndex 1 (i.e. the first framesize of the gadget).
> After the negotiation the host driver will set the user or application
> selected framesize, while the gadget is actually set to the first
> framesize.
>
> Now, when the containing format is linked into the streaming header,
> iterate over all child frame descriptors and assign ascending indices.
> The automatically assigned indices can be read from the new read only
> bFrameIndex configsfs attribute in each frame descriptor item.
>
> Signed-off-by: Joel Pepper 
> [Simplified documentation, renamed function, blank space update]
> Signed-off-by: Laurent Pinchart 

please rebase on testing/next, but give me a couple hours to go through
the rest of my inbox first ;)

checking file Documentation/ABI/testing/configfs-usb-gadget-uvc
Hunk #1 succeeded at 177 (offset -4 lines).
Hunk #2 succeeded at 228 (offset -8 lines).
checking file drivers/usb/gadget/function/uvc_configfs.c
Hunk #1 succeeded at 720 (offset -121 lines).
Hunk #2 succeeded at 757 (offset -133 lines).
Hunk #3 succeeded at 996 (offset -137 lines).
Hunk #4 succeeded at 1179 (offset -137 lines).
Hunk #5 FAILED at 1395.
1 out of 5 hunks FAILED

-- 
balbi


signature.asc
Description: PGP signature


Re: [PATCH 1/3] usb: gadget: f_fs: Only return delayed status when len is 0

2018-07-26 Thread Felipe Balbi

Hi,

Jerry Zhang  writes:
> Hi Felipe,
>
> I noticed this wasn't queued up for 4.18. Do you think there is
> anything I need to do to get this patch set into 4.19? Also, can we at
> least add just this patch ('usb: gadget: f_fs: Only return delayed
> status when len is 0') to 4.18 as functionfs control requests won't
> work without it?

patch 1 is now queued for next merge window. What should I do with
patches 2 and 3?

-- 
balbi


signature.asc
Description: PGP signature


Re: [PATCH] usb: dwc2: gadget: ISOC's starting flow improvement

2018-07-26 Thread Felipe Balbi
Minas Harutyunyan  writes:

> To start ISOC transfers in handlers dwc2_gadget_handle_nak() and
> dwc2_gadget_handle_out_token_ep_disabled() driver reads current frame
> number, based on which, set target frame number to start first ISOC
> transfer.
>
> In case if system's high IRQ latency and multiple EP's asserted
> interrupt in same frame, there are high probability that when reading
> current frame number in EP's handlers, actual frame number can be
> increased. As result for bInterval > 1, starting target frame
> will be set wrongly and all ISOC packets will be dropped.
>
> In patch "usb: dwc2: Change reading of current frame number flow"
> reading of current frame number done ASAP in common interrupt handler.
> This frame number stored in frame_number variable which used as
> starting frame number for ISOC EP's in above mentioned handlers.
>
> Signed-off-by: Minas Harutyunyan 

please rebase on top of testing/next after a couple hours:

checking file drivers/usb/dwc2/gadget.c
Hunk #1 FAILED at 2749.
Hunk #2 succeeded at 2772 (offset -1 lines).
Hunk #3 FAILED at 2811.
2 out of 3 hunks FAILED

-- 
balbi


signature.asc
Description: PGP signature


Re: [PATCH v2 2/4] usb: dwc2: Modify dwc2_readl/writel functions prototype

2018-07-26 Thread Felipe Balbi
Gevorg Sahakyan  writes:

> Added hsotg argument to dwc2_readl/writel function prototype,
> and also instead of address pass offset of register.
> hsotg will contain flag field for endianness.
>
> Also customized dwc2_set_bit and dwc2_clear_bit function for
> dwc2_readl/writel functions.
>
> Signed-off-by: Gevorg Sahakyan 

sorry for the delay. I've been super busy with an internal task.

Anyway, this doesn't apply to testing/next. Give me a couple hours for
me to go through the other patches, then I'll push testing/next so you
can rebase.

checking file drivers/usb/dwc2/core.c
checking file drivers/usb/dwc2/core.h
Hunk #1 succeeded at 1172 (offset 3 lines).
Hunk #2 succeeded at 1184 (offset 3 lines).
Hunk #3 succeeded at 1195 (offset 3 lines).
Hunk #4 succeeded at 1321 (offset 3 lines).
checking file drivers/usb/dwc2/core_intr.c
checking file drivers/usb/dwc2/debugfs.c
checking file drivers/usb/dwc2/gadget.c
Hunk #11 succeeded at 916 (offset 6 lines).
Hunk #12 succeeded at 968 (offset 6 lines).
Hunk #13 succeeded at 1065 (offset 6 lines).
Hunk #14 succeeded at 1079 (offset 6 lines).
Hunk #15 succeeded at 1105 (offset 6 lines).
Hunk #16 succeeded at 1128 (offset 6 lines).
Hunk #17 succeeded at 1467 (offset 6 lines).
Hunk #18 succeeded at 1481 (offset 6 lines).
Hunk #19 succeeded at 1635 (offset 6 lines).
Hunk #20 succeeded at 1774 (offset 6 lines).
Hunk #21 succeeded at 1826 (offset 6 lines).
Hunk #22 succeeded at 1956 (offset 6 lines).
Hunk #23 succeeded at 2125 (offset 6 lines).
Hunk #24 succeeded at 2139 (offset 6 lines).
Hunk #25 succeeded at 2169 (offset 6 lines).
Hunk #26 succeeded at 2199 (offset 6 lines).
Hunk #27 succeeded at 2248 (offset 6 lines).
Hunk #28 succeeded at 2344 (offset 6 lines).
Hunk #29 succeeded at 2375 (offset 6 lines).
Hunk #30 succeeded at 2393 (offset 6 lines).
Hunk #31 succeeded at 2447 (offset 6 lines).
Hunk #32 succeeded at 2472 (offset 6 lines).
Hunk #33 succeeded at 2496 (offset 6 lines).
Hunk #34 succeeded at 2550 (offset 6 lines).
Hunk #35 succeeded at 2654 (offset 6 lines).
Hunk #36 succeeded at 2684 (offset 6 lines).
Hunk #37 succeeded at 2699 (offset 6 lines).
Hunk #38 succeeded at 2775 (offset 4 lines).
Hunk #39 succeeded at 2829 (offset 1 line).
Hunk #40 succeeded at 2866 (offset 1 line).
Hunk #41 succeeded at 2897 (offset 1 line).
Hunk #42 succeeded at 3016 (offset 1 line).
Hunk #43 succeeded at 3087 (offset 1 line).
Hunk #44 succeeded at 3115 (offset 1 line).
Hunk #45 succeeded at 3216 (offset 1 line).
Hunk #46 succeeded at 3231 (offset 1 line).
Hunk #47 succeeded at 3257 (offset 1 line).
Hunk #48 succeeded at 3277 (offset 1 line).
Hunk #49 succeeded at 3301 (offset 1 line).
Hunk #50 succeeded at 3345 (offset 1 line).
Hunk #51 succeeded at 3358 (offset 1 line).
Hunk #52 succeeded at 3387 (offset 1 line).
Hunk #53 succeeded at 3425 (offset 1 line).
Hunk #54 succeeded at 3433 (offset 1 line).
Hunk #55 succeeded at 3470 (offset 1 line).
Hunk #56 succeeded at 3479 (offset 1 line).
Hunk #57 succeeded at 3516 (offset 1 line).
Hunk #58 succeeded at 3527 (offset 1 line).
Hunk #59 succeeded at 3537 (offset 1 line).
Hunk #60 succeeded at 3623 (offset 1 line).
Hunk #61 succeeded at 3639 (offset 1 line).
Hunk #62 succeeded at 3653 (offset 1 line).
Hunk #63 succeeded at 3668 (offset 1 line).
Hunk #64 succeeded at 3708 (offset 1 line).
Hunk #65 succeeded at 3716 (offset 1 line).
Hunk #66 succeeded at 3725 (offset 1 line).
Hunk #67 succeeded at 3736 (offset 1 line).
Hunk #68 succeeded at 3744 (offset 1 line).
Hunk #69 succeeded at 3759 (offset 1 line).
Hunk #70 succeeded at 3831 (offset 1 line).
Hunk #71 succeeded at 3879 (offset 1 line).
Hunk #72 succeeded at 3920 (offset 1 line).
Hunk #73 succeeded at 3958 (offset 1 line).
Hunk #74 succeeded at 3970 (offset 1 line).
Hunk #75 succeeded at 4021 (offset 1 line).
Hunk #76 succeeded at 4031 (offset 1 line).
Hunk #77 succeeded at 4138 (offset 1 line).
Hunk #78 succeeded at 4151 (offset 1 line).
Hunk #79 succeeded at 4165 (offset 1 line).
Hunk #80 succeeded at 4213 (offset 1 line).
Hunk #81 succeeded at 4243 (offset 1 line).
Hunk #82 succeeded at 4536 (offset 1 line).
Hunk #83 succeeded at 4607 (offset 1 line).
Hunk #84 succeeded at 4632 (offset 1 line).
Hunk #85 succeeded at 4834 (offset 4 lines).
Hunk #86 succeeded at 4850 (offset 4 lines).
Hunk #87 succeeded at 4862 (offset 4 lines).
Hunk #88 succeeded at 4897 (offset 4 lines).
Hunk #89 succeeded at 4916 (offset 4 lines).
Hunk #90 succeeded at 4928 (offset 4 lines).
Hunk #91 succeeded at 4953 (offset 4 lines).
Hunk #92 succeeded at 4987 (offset 4 lines).
Hunk #93 succeeded at 5062 (offset 4 lines).
Hunk #94 succeeded at 5121 (offset 4 lines).
checking file drivers/usb/dwc2/hcd.c
Hunk #40 FAILED at 1566.
Hunk #41 succeeded at 1584 (offset 9 lines).
Hunk #42 succeeded at 1609 (offset 9 lines).
Hunk #43 succeeded at 1667 (offset 9 lines).
Hunk #44 succeeded at 1697 (offset 9 lines).
Hunk #45 succeeded at 1754 (offset 9 lines).
Hunk #46 succeeded at 1762 (offset 9 lines).
Hunk #47 

Re: [PATCH] usbip: Fix misuse of strncpy()

2018-07-26 Thread Ben Hutchings
On Tue, 2018-07-24 at 11:04 -0600, Shuah Khan wrote:
> On 07/20/2018 08:12 PM, Ben Hutchings wrote:
> > gcc 8 reports:
> > 
> > usbip_device_driver.c: In function ‘read_usb_vudc_device’:
> > usbip_device_driver.c:106:2: error: ‘strncpy’ specified bound 256 equals 
> > destination size [-Werror=stringop-truncation]
> >   strncpy(dev->path, path, SYSFS_PATH_MAX);
> >   ^~~~
> > usbip_device_driver.c:125:2: error: ‘strncpy’ specified bound 32 equals 
> > destination size [-Werror=stringop-truncation]
> >   strncpy(dev->busid, name, SYSFS_BUS_ID_SIZE);
> >   ^~~~
> > 
> > I'm not convinced it makes sense to truncate the copied strings here,
> > but since we're already doing so let's ensure they're still null-
> > terminated.  We can't easily use strlcpy() here, so use snprintf().
> > 
> > usbip_common.c has the same problem.
> > 
> > Signed-off-by: Ben Hutchings 
> > Cc: sta...@vger.kernel.org
> > ---
> >  tools/usb/usbip/libsrc/usbip_common.c|4 ++--
> >  tools/usb/usbip/libsrc/usbip_device_driver.c |4 ++--
> >  2 files changed, 4 insertions(+), 4 deletions(-)
> > 
> > --- a/tools/usb/usbip/libsrc/usbip_common.c
> > +++ b/tools/usb/usbip/libsrc/usbip_common.c
> > @@ -226,8 +226,8 @@ int read_usb_device(struct udev_device *
> > path = udev_device_get_syspath(sdev);
> > name = udev_device_get_sysname(sdev);
> >  
> > -   strncpy(udev->path,  path,  SYSFS_PATH_MAX);
> > -   strncpy(udev->busid, name, SYSFS_BUS_ID_SIZE);
> > +   snprintf(udev->path, SYSFS_PATH_MAX, "%s", path);
> > +   snprintf(udev->busid, SYSFS_BUS_ID_SIZE, "%s", name);
> 
> I am okay with the change to use snprintf(). Please add check for
> return to avoid GCC 7 -Wformat-overflow wanrs on snprintf instances
> that don't check return.
[...]

I've tried running:

./autogen.sh
CC=gcc-7 CFLAGS=-Wformat-overflow ./configure 
make

but this didn't produce any warnings.  How did you get the warning?

Ben.

-- 
Ben Hutchings
Tomorrow will be cancelled due to lack of interest.



signature.asc
Description: This is a digitally signed message part