Re: [PATCH] usb: xhci: Add quirk for Certain failing HP keyboard on reset after resume

2017-07-31 Thread Greg KH

A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?

A: No.
Q: Should I include quotations after my reply?


http://daringfireball.net/2007/07/on_top


On Mon, Jul 31, 2017 at 12:10:08PM +0530, Sandeep Singh wrote:
> Hi Greg,
> 
> Thanks for review. Apart from pci_ids.h, I see only 3 options, add this id as 
> macro in pci_quirks.c
> or pci_quirks.h or just hardcode it.
> 
> please suggest what will good option as per your view.

As you only use it in one place, why not just hardcode it there?

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] HID: add ALWAYS_POLL quirk for Logitech 0xc077

2017-07-31 Thread Jiri Kosina
On Mon, 31 Jul 2017, Oliver Neukum wrote:

> > > Cc: Oliver Neukum 
> > > Signed-off-by: Kyle Roarty 
> > > Signed-off-by: Aaron Sierra 
> > > ---
> > > Note: It is unknown to me if the typo is in the name of the original
> > >   USB_DEVICE_ID_LOGITECH_C077 define or in the value assigned to
> > >   it (0xc007).
> > 
> > This is something for Oliver to figure out -- Oliver, that appeared 
> > through your commit a415457733b5f; are you able to still find out the 
> > details?
> 
> IIRC the patch was tested, so the numerical ID is correct.

Ok, so the renaming performed by Kyle's patch is correct and I'm keeping 
it.

> And I must say I fail to see a value in defining a name that basically 
> just spells out the ID number.

Yeah, well, the symbolic names don't necessarily have to be used if the 
device doesn't have any real recognizable branding name ... 

-- 
Jiri Kosina
SUSE Labs

--
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] HID: add ALWAYS_POLL quirk for Logitech 0xc077

2017-07-31 Thread Oliver Neukum
Am Montag, den 31.07.2017, 14:01 +0200 schrieb Jiri Kosina:
> On Fri, 28 Jul 2017, Aaron Sierra wrote:
> 
> > 
> > From: Kyle Roarty 
> > 
> > Without a quirk or the X Window System, this device disconnects every
> > 60 seconds. This patch also renames the define associated with the
> > Logitech 0xc007 product ID, which appeared to have a conflicting typo.
> 
> Applied, thanks.
> 
> > 
> > 
> > Cc: Oliver Neukum 
> > Signed-off-by: Kyle Roarty 
> > Signed-off-by: Aaron Sierra 
> > ---
> > Note: It is unknown to me if the typo is in the name of the original
> >   USB_DEVICE_ID_LOGITECH_C077 define or in the value assigned to
> >   it (0xc007).
> 
> This is something for Oliver to figure out -- Oliver, that appeared 
> through your commit a415457733b5f; are you able to still find out the 
> details?

IIRC the patch was tested, so the numerical ID is correct.
And I must say I fail to see a value in defining a name that
basically just spells out the ID number.

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: [PATCH] HID: add ALWAYS_POLL quirk for Logitech 0xc077

2017-07-31 Thread Jiri Kosina
On Fri, 28 Jul 2017, Aaron Sierra wrote:

> From: Kyle Roarty 
> 
> Without a quirk or the X Window System, this device disconnects every
> 60 seconds. This patch also renames the define associated with the
> Logitech 0xc007 product ID, which appeared to have a conflicting typo.

Applied, thanks.

> 
> Cc: Oliver Neukum 
> Signed-off-by: Kyle Roarty 
> Signed-off-by: Aaron Sierra 
> ---
> Note: It is unknown to me if the typo is in the name of the original
>   USB_DEVICE_ID_LOGITECH_C077 define or in the value assigned to
>   it (0xc007).

This is something for Oliver to figure out -- Oliver, that appeared 
through your commit a415457733b5f; are you able to still find out the 
details?

Thanks,

-- 
Jiri Kosina
SUSE Labs

--
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: chipidea: Hook into mux framework to toggle usb switch

2017-07-31 Thread Peter Rosin
On 2017-07-14 23:40, Stephen Boyd wrote:
> On the db410c 96boards platform we have a TC7USB40MU on the board
> to mux the D+/D- lines coming from the controller between a micro
> usb "device" port and a USB hub for "host" roles[1]. During a
> role switch, we need to toggle this mux to forward the D+/D-
> lines to either the port or the hub. Add the necessary code to do
> the role switch in chipidea core via the generic mux framework.
> Board configurations like on db410c are expected to change roles
> via the sysfs API described in
> Documentation/ABI/testing/sysfs-platform-chipidea-usb2.
> 
> [1] 
> https://github.com/96boards/documentation/raw/master/ConsumerEdition/DragonBoard-410c/HardwareDocs/Schematics_DragonBoard.pdf
> 
> Cc: Peter Rosin 
> Cc: Peter Chen 
> Cc: Greg Kroah-Hartman 
> Cc: 
> Signed-off-by: Stephen Boyd 
> ---
>  Documentation/devicetree/bindings/usb/ci-hdrc-usb2.txt |  6 ++
>  drivers/usb/chipidea/Kconfig   |  1 +
>  drivers/usb/chipidea/core.c|  5 +
>  drivers/usb/chipidea/host.c|  7 +++
>  drivers/usb/chipidea/udc.c | 13 -
>  include/linux/usb/chipidea.h   |  2 ++
>  6 files changed, 33 insertions(+), 1 deletion(-)
> 
> diff --git a/Documentation/devicetree/bindings/usb/ci-hdrc-usb2.txt 
> b/Documentation/devicetree/bindings/usb/ci-hdrc-usb2.txt
> index 0e03344e2e8b..2e9318151df7 100644
> --- a/Documentation/devicetree/bindings/usb/ci-hdrc-usb2.txt
> +++ b/Documentation/devicetree/bindings/usb/ci-hdrc-usb2.txt
> @@ -76,6 +76,10 @@ Optional properties:
>needs to make sure it does not send more than 90%
>maximum_periodic_data_per_frame. The use case is multiple transactions, but
>less frame rate.
> +- mux-controls: The mux control for toggling host/device output of this
> +  controller. It's expected that a mux state of 0 indicates device mode and a
> +  mux state of 1 indicates host mode.
> +- mux-control-names: Shall be "usb_switch" if mux-controls is specified.
>  
>  i.mx specific properties
>  - fsl,usbmisc: phandler of non-core register device, with one
> @@ -102,4 +106,6 @@ Example:
>   rx-burst-size-dword = <0x10>;
>   extcon = <0>, <_id>;
>   phy-clkgate-delay-us = <400>;
> + mux-controls = <_switch>;
> + mux-control-names = "usb_switch";
>   };
> diff --git a/drivers/usb/chipidea/Kconfig b/drivers/usb/chipidea/Kconfig
> index 51f4157bbecf..3798e0e69d57 100644
> --- a/drivers/usb/chipidea/Kconfig
> +++ b/drivers/usb/chipidea/Kconfig
> @@ -3,6 +3,7 @@ config USB_CHIPIDEA
>   depends on ((USB_EHCI_HCD && USB_GADGET) || (USB_EHCI_HCD && 
> !USB_GADGET) || (!USB_EHCI_HCD && USB_GADGET)) && HAS_DMA
>   select EXTCON
>   select RESET_CONTROLLER
> + select MULTIPLEXER
>   help
> Say Y here if your system has a dual role high speed USB
> controller based on ChipIdea silicon IP. It supports:
> diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c
> index b17ed3a9a304..d088c262ebb8 100644
> --- a/drivers/usb/chipidea/core.c
> +++ b/drivers/usb/chipidea/core.c
> @@ -64,6 +64,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  
>  #include "ci.h"
>  #include "udc.h"
> @@ -690,6 +691,10 @@ static int ci_get_platdata(struct device *dev,
>   if (of_find_property(dev->of_node, "non-zero-ttctrl-ttha", NULL))
>   platdata->flags |= CI_HDRC_SET_NON_ZERO_TTHA;
>  
> + platdata->usb_switch = devm_mux_control_get_optional(dev, "usb_switch");
> + if (IS_ERR(platdata->usb_switch))
> + return PTR_ERR(platdata->usb_switch);
> +
>   ext_id = ERR_PTR(-ENODEV);
>   ext_vbus = ERR_PTR(-ENODEV);
>   if (of_property_read_bool(dev->of_node, "extcon")) {
> diff --git a/drivers/usb/chipidea/host.c b/drivers/usb/chipidea/host.c
> index 18cb8e46262d..9ef3ecf27ad3 100644
> --- a/drivers/usb/chipidea/host.c
> +++ b/drivers/usb/chipidea/host.c
> @@ -25,6 +25,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  
>  #include "../host/ehci.h"
>  
> @@ -175,6 +176,10 @@ static int host_start(struct ci_hdrc *ci)
>   if (ci_otg_is_fsm_mode(ci)) {
>   otg->host = >self;
>   hcd->self.otg_port = 1;
> + } else {
> + ret = mux_control_select(ci->platdata->usb_switch, 1);
> + if (ret)
> + goto disable_reg;
>   }
>   }
>  
> @@ -195,6 +200,8 @@ static void host_stop(struct ci_hdrc *ci)
>   struct usb_hcd *hcd = ci->hcd;
>  
>   if (hcd) {
> + if (!ci_otg_is_fsm_mode(ci))
> + mux_control_deselect(ci->platdata->usb_switch);
>   if (ci->platdata->notify_event)
>  

Re: [PATCH v2 3/8] usb: chipidea: Add support for Tegra20/30/114/124

2017-07-31 Thread Dmitry Osipenko
On 31.07.2017 04:14, Peter Chen wrote:
> On Fri, Jul 28, 2017 at 05:51:16PM +0200, Michał Mirosław wrote:
>> On Fri, Jul 28, 2017 at 01:00:32PM +0300, Dmitry Osipenko wrote:
>>> On 28.07.2017 01:32, Michał Mirosław wrote:
 On Thu, Jul 27, 2017 at 07:46:07PM +0300, Dmitry Osipenko wrote:
> From: Thierry Reding 
>
> All of these Tegra SoC generations have a ChipIdea UDC IP block that can
> be used for device mode communication with a host. Implement rudimentary
> support that doesn't allow switching between host and device modes.
>
> Signed-off-by: Thierry Reding 
> [dig...@gmail.com: rebased patches and added DMA alignment quirk for 
> Tegra20]
> Signed-off-by: Dmitry Osipenko 
> Acked-by: Peter Chen 

 This works on my Asus TF300T (Tegra3 device). Minor nit below.

 Tested-by: Michał Mirosław  (on tf300t)

>>>
>>> Nice, thank you!
>>>
 [...]
> diff --git a/drivers/usb/chipidea/ci_hdrc_tegra.c 
> b/drivers/usb/chipidea/ci_hdrc_tegra.c
> new file mode 100644
> index ..7814500e71fa
> --- /dev/null
> +++ b/drivers/usb/chipidea/ci_hdrc_tegra.c
> @@ -0,0 +1,160 @@
 [...]
> +struct tegra_udc_soc_info {
> + bool supports_unaligned_dma;
> +};
 [...]
> +static const struct tegra_udc_soc_info tegra20_udc_soc_info = {
> + .supports_unaligned_dma = false,
> +};
> +
> +static const struct tegra_udc_soc_info tegra30_udc_soc_info = {
> + .supports_unaligned_dma = true,
> +};
> +
> +static const struct tegra_udc_soc_info tegra114_udc_soc_info = {
> + .supports_unaligned_dma = true,
> +};
> +
> +static const struct tegra_udc_soc_info tegra124_udc_soc_info = {
> + .supports_unaligned_dma = true,
> +};
> +
> +static const struct of_device_id tegra_udc_of_match[] = {
> + {
> + .compatible = "nvidia,tegra20-udc",
> + .data = _udc_soc_info,
> + }, {
> + .compatible = "nvidia,tegra30-udc",
> + .data = _udc_soc_info,
> + }, {
> + .compatible = "nvidia,tegra114-udc",
> + .data = _udc_soc_info,
> + }, {
> + .compatible = "nvidia,tegra124-udc",
> + .data = _udc_soc_info,
> + }, {
> + /* sentinel */
> + }
> +};
> +MODULE_DEVICE_TABLE(of, tegra_udc_of_match);
 [...]
> +static int tegra_udc_probe(struct platform_device *pdev)
> +{
 [...]
> + /* setup device specific quirks */
> + soc = id->data;
> +
> + if (!soc->supports_unaligned_dma)
> + udc->data.flags |= CI_HDRC_REQUIRES_ALIGNED_DMA;
 [...]

 Some lines would be saved if this was just:

 udc->data.flags |= id->data;

> 
> I prefer this way too, and add CI_HDRC_REQUIRES_ALIGNED_DMA as
> platform flags for necessary SoCs.
> 

Okay, please let me know if there are any other nitpicks.

-- 
Dmitry
--
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/12] constify mmc_host_ops structures

2017-07-31 Thread Ulf Hansson
On 29 July 2017 at 07:59, Julia Lawall  wrote:
>
> The mmc_host_ops structure is only stored in the ops field of an
> mmc_host structure, which is declared as const.  Thus the mmc_host_ops
> structure itself can be const.
>
> Done with the help of Coccinelle.
>
> ---
>
>  drivers/mmc/host/bcm2835.c |2 +-
>  drivers/mmc/host/davinci_mmc.c |2 +-
>  drivers/mmc/host/moxart-mmc.c  |2 +-
>  drivers/mmc/host/mtk-sd.c  |2 +-
>  drivers/mmc/host/s3cmci.c  |2 +-
>  drivers/mmc/host/sdricoh_cs.c  |2 +-
>  drivers/mmc/host/sh_mmcif.c|2 +-
>  drivers/mmc/host/sunxi-mmc.c   |2 +-
>  drivers/mmc/host/toshsd.c  |2 +-
>  drivers/mmc/host/usdhi6rol0.c  |2 +-
>  drivers/mmc/host/vub300.c  |2 +-
>  drivers/mmc/host/wmt-sdmmc.c   |2 +-
>  12 files changed, 12 insertions(+), 12 deletions(-)


Thanks, applied for next!

Kind regards
Uffe
--
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] powerpc/asm/cacheflush: Cleanup cacheflush function params

2017-07-31 Thread Christophe LEROY



Le 20/07/2017 à 08:28, Matt Brown a écrit :

The cacheflush prototypes currently use start and stop values and each
call requires typecasting the address to an unsigned long.
This patch changes the cacheflush prototypes to follow the x86 style of
using a base and size values, with base being a void pointer.

All callers of the cacheflush functions, including drivers, have been
modified to conform to the new prototypes.

The 64 bit cacheflush functions which were implemented in assembly code
(flush_dcache_range, flush_inval_dcache_range) have been translated into
C for readability and coherence.

Signed-off-by: Matt Brown 
---
  arch/powerpc/include/asm/cacheflush.h| 47 +
  arch/powerpc/kernel/misc_64.S| 52 
  arch/powerpc/mm/dma-noncoherent.c| 15 
  arch/powerpc/platforms/512x/mpc512x_shared.c | 10 +++---
  arch/powerpc/platforms/85xx/smp.c|  6 ++--
  arch/powerpc/sysdev/dart_iommu.c |  5 +--
  drivers/ata/pata_bf54x.c |  3 +-
  drivers/char/agp/uninorth-agp.c  |  6 ++--
  drivers/gpu/drm/drm_cache.c  |  3 +-
  drivers/macintosh/smu.c  | 15 
  drivers/mmc/host/bfin_sdh.c  |  3 +-
  drivers/mtd/nand/bf5xx_nand.c|  6 ++--
  drivers/soc/fsl/qbman/dpaa_sys.h |  2 +-
  drivers/soc/fsl/qbman/qman_ccsr.c|  3 +-
  drivers/spi/spi-bfin5xx.c| 10 +++---
  drivers/tty/serial/mpsc.c| 46 
  drivers/usb/musb/blackfin.c  |  6 ++--
  17 files changed, 86 insertions(+), 152 deletions(-)



[...]


diff --git a/arch/powerpc/mm/dma-noncoherent.c 
b/arch/powerpc/mm/dma-noncoherent.c
index 3825284..5fd3171 100644
--- a/arch/powerpc/mm/dma-noncoherent.c
+++ b/arch/powerpc/mm/dma-noncoherent.c
@@ -204,9 +204,9 @@ __dma_alloc_coherent(struct device *dev, size_t size, 
dma_addr_t *handle, gfp_t
 * kernel direct-mapped region for device DMA.
 */
{
-   unsigned long kaddr = (unsigned long)page_address(page);
+   void *kaddr = page_address(page);
memset(page_address(page), 0, size);
-   flush_dcache_range(kaddr, kaddr + size);
+   flush_dcache_range(kaddr, size);
}
  
  	/*

@@ -316,9 +316,6 @@ EXPORT_SYMBOL(__dma_free_coherent);
   */
  void __dma_sync(void *vaddr, size_t size, int direction)
  {
-   unsigned long start = (unsigned long)vaddr;
-   unsigned long end   = start + size;
-
switch (direction) {
case DMA_NONE:
BUG();
@@ -328,15 +325,15 @@ void __dma_sync(void *vaddr, size_t size, int direction)
 * the potential for discarding uncommitted data from the cache
 */
if ((start | end) & (L1_CACHE_BYTES - 1))


How can the above compile when 'start' and 'end' are removed ?
Shouldn't it be replaced by

if ((vaddr | size) & (L1_CACHE_BYTES - 1))


-   flush_dcache_range(start, end);
+   flush_dcache_range(vaddr, size);
else
-   invalidate_dcache_range(start, end);
+   invalidate_dcache_range(vaddr, size);
break;
case DMA_TO_DEVICE: /* writeback only */
-   clean_dcache_range(start, end);
+   clean_dcache_range(vaddr, size);
break;
case DMA_BIDIRECTIONAL: /* writeback and invalidate */
-   flush_dcache_range(start, end);
+   flush_dcache_range(vaddr, size);
break;
}
  }


[...]

Christophe
--
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/1] usb: xhci: Free the right ring in xhci_add_endpoint()

2017-07-31 Thread Lu Baolu
In the xhci_add_endpoint(), a new ring was allocated and saved at
xhci_virt_ep->new_ring. Hence, when error happens, we need to free
the allocated ring before returning error.

Current code frees xhci_virt_ep->ring instead of the new_ring. This
patch fixes this.

Signed-off-by: Lu Baolu 
---
 drivers/usb/host/xhci.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index b2ff1ff..ee198ea 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -1703,7 +1703,8 @@ static int xhci_add_endpoint(struct usb_hcd *hcd, struct 
usb_device *udev,
if (xhci->quirks & XHCI_MTK_HOST) {
ret = xhci_mtk_add_ep_quirk(hcd, udev, ep);
if (ret < 0) {
-   xhci_free_endpoint_ring(xhci, virt_dev, ep_index);
+   xhci_ring_free(xhci, virt_dev->eps[ep_index].new_ring);
+   virt_dev->eps[ep_index].new_ring = NULL;
return ret;
}
}
-- 
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


RE: [PATCH 06/11] usb: renesas_usbhs: constify hc_driver structures

2017-07-31 Thread Yoshihiro Shimoda
Hi,

> From: Julia Lawall
> Sent: Saturday, July 29, 2017 5:42 AM
> 
> The hc_driver structure is only passed as the first argument to
> usb_create_hcd, which is declared as const.  Thus the hc_driver structure
> itself can be const.
> 
> Done with the help of Coccinelle.
> 
> Signed-off-by: Julia Lawall 

Thank you for the patch!

Acked-by: Yoshihiro Shimoda 

Best regards,
Yoshihiro Shimoda

--
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: xhci: Add quirk for Certain failing HP keyboard on reset after resume

2017-07-31 Thread Sandeep Singh
Hi Greg,

Thanks for review. Apart from pci_ids.h, I see only 3 options, add this id as 
macro in pci_quirks.c
or pci_quirks.h or just hardcode it.

please suggest what will good option as per your view.

Regards
Sandeep

On 7/30/2017 7:41 PM, Greg KH wrote:
> On Thu, Jul 27, 2017 at 02:05:09PM +0530, Sandeep Singh wrote:
>> diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
>> index c71e532..d3f2296 100644
>> --- a/include/linux/pci_ids.h
>> +++ b/include/linux/pci_ids.h
>> @@ -583,6 +583,7 @@
>>  #define PCI_DEVICE_ID_AMD_HUDSON2_SMBUS 0x780b
>>  #define PCI_DEVICE_ID_AMD_HUDSON2_IDE   0x780c
>>  #define PCI_DEVICE_ID_AMD_KERNCZ_SMBUS  0x790b
>> +#define PCI_DEVICE_ID_AMD_TAISHAN   0x145c
>>  
>>  #define PCI_VENDOR_ID_TRIDENT   0x1023
>>  #define PCI_DEVICE_ID_TRIDENT_4DWAVE_DX 0x2000
> 
> Please read the top of this file for why you shouldn't be adding new ids
> to it.
> 
> thnaks,
> 
> 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