Re: Build regressions/improvements in v3.11-rc3

2013-07-30 Thread Geert Uytterhoeven
On Tue, 30 Jul 2013, Geert Uytterhoeven wrote:
 JFYI, when comparing v3.11-rc3 to v3.11-rc2[3], the summaries are:
   - build errors: +38/-14

  + arch/powerpc/kvm/book3s_emulate.c: error: 'bat' may be used uninitialized 
in this function [-Werror=uninitialized]:  = 349:2
  + arch/powerpc/kvm/book3s_pr_papr.c: error: 'H_ANDCOND' undeclared (first use 
in this function):  = 161:17, 86:16
  + arch/powerpc/kvm/book3s_pr_papr.c: error: 'H_AVPN' undeclared (first use in 
this function):  = 160:17, 85:16, 192:16
  + arch/powerpc/kvm/book3s_pr_papr.c: error: 'H_BULK_REMOVE' undeclared (first 
use in this function):  = 246:7
  + arch/powerpc/kvm/book3s_pr_papr.c: error: 'H_CEDE' undeclared (first use in 
this function):  = 250:7
  + arch/powerpc/kvm/book3s_pr_papr.c: error: 'H_CPPR' undeclared (first use in 
this function):  = 257:7
  + arch/powerpc/kvm/book3s_pr_papr.c: error: 'H_ENTER' undeclared (first use 
in this function):  = 240:7
  + arch/powerpc/kvm/book3s_pr_papr.c: error: 'H_EOI' undeclared (first use in 
this function):  = 258:7
  + arch/powerpc/kvm/book3s_pr_papr.c: error: 'H_EXACT' undeclared (first use 
in this function):  = 50:6
  + arch/powerpc/kvm/book3s_pr_papr.c: error: 'H_IPI' undeclared (first use in 
this function):  = 259:7
  + arch/powerpc/kvm/book3s_pr_papr.c: error: 'H_IPOLL' undeclared (first use 
in this function):  = 260:7
  + arch/powerpc/kvm/book3s_pr_papr.c: error: 'H_NOT_FOUND' undeclared (first 
use in this function):  = 193:27, 87:27
  + arch/powerpc/kvm/book3s_pr_papr.c: error: 'H_PARAMETER' undeclared (first 
use in this function):  = 138:10
  + arch/powerpc/kvm/book3s_pr_papr.c: error: 'H_PROTECT' undeclared (first use 
in this function):  = 244:7
  + arch/powerpc/kvm/book3s_pr_papr.c: error: 'H_PTEG_FULL' undeclared (first 
use in this function):  = 54:12
  + arch/powerpc/kvm/book3s_pr_papr.c: error: 'H_PUT_TCE' undeclared (first use 
in this function):  = 248:7
  + arch/powerpc/kvm/book3s_pr_papr.c: error: 'H_REMOVE' undeclared (first use 
in this function):  = 242:7
  + arch/powerpc/kvm/book3s_pr_papr.c: error: 'H_RTAS' undeclared (first use in 
this function):  = 265:7
  + arch/powerpc/kvm/book3s_pr_papr.c: error: 'H_SUCCESS' undeclared (first use 
in this function):  = 67:26, 96:26, 211:26, 125:12
  + arch/powerpc/kvm/book3s_pr_papr.c: error: 'H_TOO_HARD' undeclared (first 
use in this function):  = 224:12
  + arch/powerpc/kvm/book3s_pr_papr.c: error: 'H_XIRR' undeclared (first use in 
this function):  = 256:7
  + arch/powerpc/kvm/book3s_pr_papr.c: error: 'H_XIRR_X' undeclared (first use 
in this function):  = 261:7
  + arch/powerpc/platforms/pseries/hotplug-memory.c: error: 'SECTION_SIZE_BITS' 
undeclared (first use in this function):  = 24:31
  + mm/memory_hotplug.c: error: 'PAGES_PER_SECTION' undeclared (first use in 
this function):  = 1630:46
  + mm/memory_hotplug.c: error: implicit declaration of function 
'__nr_to_section' [-Werror=implicit-function-declaration]:  = 1635:3
  + mm/memory_hotplug.c: error: implicit declaration of function 
'find_memory_block_hinted' [-Werror=implicit-function-declaration]:  = 1642:3
  + mm/memory_hotplug.c: error: implicit declaration of function 
'pfn_to_section_nr' [-Werror=implicit-function-declaration]:  = 1631:3
  + mm/memory_hotplug.c: error: implicit declaration of function 
'present_section_nr' [-Werror=implicit-function-declaration]:  = 1632:3

powerpc-randconfig

  + drivers/md/dm-cache-policy-mq.c: error: conflicting types for 
'remove_mapping':  = 962:13

sparc-allmodconfig, not a regression (was hidden due to a sparc64/sparc32
mixup on kissb), patch submitted

  + error: usb_add_gadget_udc [drivers/usb/chipidea/ci_hdrc.ko] undefined!:  
= N/A
  + error: usb_del_gadget_udc [drivers/usb/chipidea/ci_hdrc.ko] undefined!:  
= N/A
  + error: usb_gadget_map_request [drivers/usb/chipidea/ci_hdrc.ko] 
undefined!:  = N/A
  + error: usb_gadget_unmap_request [drivers/usb/chipidea/ci_hdrc.ko] 
undefined!:  = N/A

x86_64-randconfig

 [1] http://kisskb.ellerman.id.au/kisskb/head/6490/ (all 120 configs)
 [3] http://kisskb.ellerman.id.au/kisskb/head/6461/ (all 120 configs)

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say programmer or something like that.
-- Linus Torvalds
--
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/4] usb: gadget: USB_FUSB300 should depend on HAS_DMA

2013-08-18 Thread Geert Uytterhoeven
If NO_DMA=y:

drivers/built-in.o: In function `fusb300_set_idma':
drivers/usb/gadget/fusb300_udc.c:946: undefined reference to 
`usb_gadget_map_request'
drivers/usb/gadget/fusb300_udc.c:958: undefined reference to 
`usb_gadget_unmap_request'

Signed-off-by: Geert Uytterhoeven ge...@linux-m68k.org
---
 drivers/usb/gadget/Kconfig |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig
index 8e93683..d2e6f4f 100644
--- a/drivers/usb/gadget/Kconfig
+++ b/drivers/usb/gadget/Kconfig
@@ -188,7 +188,7 @@ config USB_FSL_USB2
 
 config USB_FUSB300
tristate Faraday FUSB300 USB Peripheral Controller
-   depends on !PHYS_ADDR_T_64BIT
+   depends on !PHYS_ADDR_T_64BIT  HAS_DMA
help
   Faraday usb device controller FUSB300 driver
 
-- 
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 2/4] usb: gadget: USB_R8A66597 should depend on HAS_DMA

2013-08-18 Thread Geert Uytterhoeven
If NO_DMA=y:

drivers/built-in.o: In function `sudmac_free_channel':
drivers/usb/gadget/r8a66597-udc.c:676: undefined reference to 
`usb_gadget_unmap_request'
drivers/built-in.o: In function `sudmac_alloc_channel':
drivers/usb/gadget/r8a66597-udc.c:666: undefined reference to 
`usb_gadget_map_request'

Signed-off-by: Geert Uytterhoeven ge...@linux-m68k.org
---
 drivers/usb/gadget/Kconfig |1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig
index d2e6f4f..3c1cadd 100644
--- a/drivers/usb/gadget/Kconfig
+++ b/drivers/usb/gadget/Kconfig
@@ -246,6 +246,7 @@ config USB_PXA25X_SMALL
 
 config USB_R8A66597
tristate Renesas R8A66597 USB Peripheral Controller
+   depends on HAS_DMA
help
   R8A66597 is a discrete USB host and peripheral controller chip that
   supports both full and high speed USB 2.0 data transfers.
-- 
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 4/4] usb: chipidea: USB_CHIPIDEA should depend on HAS_DMA

2013-08-18 Thread Geert Uytterhoeven
If NO_DMA=y:

drivers/built-in.o: In function `dma_set_coherent_mask':
include/linux/dma-mapping.h:93: undefined reference to `dma_supported'

Signed-off-by: Geert Uytterhoeven ge...@linux-m68k.org
---
 drivers/usb/chipidea/Kconfig |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/chipidea/Kconfig b/drivers/usb/chipidea/Kconfig
index d1bd8ef..dbd5232 100644
--- a/drivers/usb/chipidea/Kconfig
+++ b/drivers/usb/chipidea/Kconfig
@@ -1,6 +1,6 @@
 config USB_CHIPIDEA
tristate ChipIdea Highspeed Dual Role Controller
-   depends on USB || USB_GADGET
+   depends on (USB || USB_GADGET)  HAS_DMA
help
  Say Y here if your system has a dual role high speed USB
  controller based on ChipIdea silicon IP. Currently, only the
-- 
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 3/4] usb: gadget: USB_NET2272_DMA should depend on HAS_DMA

2013-08-18 Thread Geert Uytterhoeven
If NO_DMA=y:

drivers/built-in.o: In function `net2272_done':
drivers/usb/gadget/net2272.c:386: undefined reference to 
`usb_gadget_unmap_request'
drivers/built-in.o: In function `net2272_queue':
drivers/usb/gadget/net2272.c:848: undefined reference to 
`usb_gadget_map_request'

Signed-off-by: Geert Uytterhoeven ge...@linux-m68k.org
---
 drivers/usb/gadget/Kconfig |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig
index 3c1cadd..324dc61 100644
--- a/drivers/usb/gadget/Kconfig
+++ b/drivers/usb/gadget/Kconfig
@@ -403,7 +403,7 @@ config USB_NET2272
 
 config USB_NET2272_DMA
boolean Support external DMA controller
-   depends on USB_NET2272
+   depends on USB_NET2272  HAS_DMA
help
  The NET2272 part can optionally support an external DMA
  controller, but your board has to have support in the
-- 
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: USB host support should depend on HAS_DMA

2013-08-18 Thread Geert Uytterhoeven
On Thu, Jul 11, 2013 at 1:12 AM, Arnd Bergmann a...@arndb.de wrote:
 On Wednesday 10 July 2013, Alan Stern wrote:
 This isn't right.  There are USB host controllers that use PIO, not
 DMA.  The HAS_DMA dependency should go with the controller driver, not
 the USB core.

 On the other hand, the USB core does call various routines like
 dma_unmap_single.  It ought to be possible to compile these calls even
 when DMA isn't enabled.  That is, they should be defined as do-nothing
 stubs.

 The asm-generic/dma-mapping-broken.h file intentionally causes link
 errors, but that could be changed.

 The better approach in my mind would be to replace code like


 if (hcd-self.uses_dma)

 with

 if (IS_ENABLED(CONFIG_HAS_DMA)  hcd-self.uses_dma) {

 which will reliably cause that reference to be omitted from object code,
 but not stop giving link errors for drivers that actually require
 DMA.

This can be done for drivers/usb/core/hcd.c.

But I'm a bit puzzled by drivers/usb/core/buffer.c. E.g.

void *hcd_buffer_alloc(...)
{

/* some USB hosts just use PIO */
if (!bus-controller-dma_mask 
!(hcd-driver-flags  HCD_LOCAL_MEM)) {
*dma = ~(dma_addr_t) 0;
return kmalloc(size, mem_flags);
}

for (i = 0; i  HCD_BUFFER_POOLS; i++) {
if (size = pool_max[i])
return dma_pool_alloc(hcd-pool[i], mem_flags, dma);
}
return dma_alloc_coherent(hcd-self.controller, size, dma, mem_flags);
}

which is called from usb_hcd_map_urb_for_dma():

if (hcd-self.uses_dma) {

} else if (hcd-driver-flags  HCD_LOCAL_MEM) {
ret = hcd_alloc_coherent(
urb-dev-bus, mem_flags,
urb-setup_dma,
(void **)urb-setup_packet,
sizeof(struct usb_ctrlrequest),
DMA_TO_DEVICE);
...
}

So if DMA is not used (!hcd-self.uses_dma, i.e. bus-controller-dma_mask
is zero), and HCD_LOCAL_MEM is set, we still end up calling dma_pool_alloc()?

(Naively, I'm not so familiar with the USB code) I'd expect it to use
kmalloc() instead?

So I would change it to

if (!IS_ENABLED(CONFIG_HAS_DMA) ||
(!bus-controller-dma_mask 
 !(hcd-driver-flags  HCD_LOCAL_MEM))) {
*dma = ~(dma_addr_t) 0;
return kmalloc(size, mem_flags);
}

Thanks for your clarification!

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say programmer or something like that.
-- Linus Torvalds
--
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 4/4] usb: chipidea: USB_CHIPIDEA should depend on HAS_DMA

2013-08-27 Thread Geert Uytterhoeven
On Tue, Aug 27, 2013 at 9:16 PM, Felipe Balbi ba...@ti.com wrote:
 On Mon, Aug 19, 2013 at 09:24:01AM +0800, Peter Chen wrote:
 On Sun, Aug 18, 2013 at 10:20:44PM +0200, Geert Uytterhoeven wrote:
  If NO_DMA=y:
 
  drivers/built-in.o: In function `dma_set_coherent_mask':
  include/linux/dma-mapping.h:93: undefined reference to `dma_supported'
 
  Signed-off-by: Geert Uytterhoeven ge...@linux-m68k.org
  ---
   drivers/usb/chipidea/Kconfig |2 +-
   1 file changed, 1 insertion(+), 1 deletion(-)
 
  diff --git a/drivers/usb/chipidea/Kconfig b/drivers/usb/chipidea/Kconfig
  index d1bd8ef..dbd5232 100644
  --- a/drivers/usb/chipidea/Kconfig
  +++ b/drivers/usb/chipidea/Kconfig
  @@ -1,6 +1,6 @@
   config USB_CHIPIDEA
  tristate ChipIdea Highspeed Dual Role Controller
  -   depends on USB || USB_GADGET
  +   depends on (USB || USB_GADGET)  HAS_DMA
  help
Say Y here if your system has a dual role high speed USB
controller based on ChipIdea silicon IP. Currently, only the

 I can't understand why the DMA can't be changed to fix this instead
 of changing every driver?

 I'm with you. It'd be nicer to just provide empty stubs when !HAS_DMA

That would give us drivers that compile but don't work.
Not having stubs is intentional, cfr. the comment at the top of
include/asm-generic/dma-mapping-broken.h:

/* define the dma api to allow compilation but not linking of
 * dma dependent code.  Code that depends on the dma-mapping
 * API needs to set 'depends on HAS_DMA' in its Kconfig
 */

and the comments in the commit that introduced it:

commit 1b0fac45878bb88759eec347c273285195649ff7
Author: Dan Williams dan.j.willi...@intel.com
Date:   Sun Jul 15 23:40:26 2007 -0700

dma-mapping: prevent dma dependent code from linking on !HAS_DMA archs

Continuing the work started in 411f0f3edc141a582190d3605cadd1d993abb6df ...

This enables code with a dma path, that compiles away, to build without
requiring additional code factoring.  It also prevents code that calls
dma_alloc_coherent and dma_free_coherent from linking whereas previously
the code would hit a BUG() at run time.  Finally, it allows archs that set
!HAS_DMA to delete their asm/dma-mapping.h file.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say programmer or something like that.
-- Linus Torvalds
--
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 12/12] usb: host: Remove superfluous name casts

2013-11-12 Thread Geert Uytterhoeven
device_driver.name is const char *

Signed-off-by: Geert Uytterhoeven ge...@linux-m68k.org
Cc: Greg Kroah-Hartman gre...@linuxfoundation.org
Cc: linux-usb@vger.kernel.org
---
 drivers/usb/host/imx21-hcd.c|2 +-
 drivers/usb/host/isp116x-hcd.c  |2 +-
 drivers/usb/host/isp1362-hcd.c  |2 +-
 drivers/usb/host/r8a66597-hcd.c |2 +-
 drivers/usb/host/u132-hcd.c |2 +-
 5 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/usb/host/imx21-hcd.c b/drivers/usb/host/imx21-hcd.c
index adb01d950a16..3fb2315dcb47 100644
--- a/drivers/usb/host/imx21-hcd.c
+++ b/drivers/usb/host/imx21-hcd.c
@@ -1926,7 +1926,7 @@ failed_request_mem:
 
 static struct platform_driver imx21_hcd_driver = {
.driver = {
-  .name = (char *)hcd_name,
+  .name = hcd_name,
   },
.probe = imx21_probe,
.remove = imx21_remove,
diff --git a/drivers/usb/host/isp116x-hcd.c b/drivers/usb/host/isp116x-hcd.c
index c06739705d24..ab536637842d 100644
--- a/drivers/usb/host/isp116x-hcd.c
+++ b/drivers/usb/host/isp116x-hcd.c
@@ -1775,7 +1775,7 @@ static struct platform_driver isp116x_driver = {
.suspend = isp116x_suspend,
.resume = isp116x_resume,
.driver = {
-   .name = (char *)hcd_name,
+   .name = hcd_name,
.owner  = THIS_MODULE,
},
 };
diff --git a/drivers/usb/host/isp1362-hcd.c b/drivers/usb/host/isp1362-hcd.c
index 935a2dd367a8..cd94b108b57f 100644
--- a/drivers/usb/host/isp1362-hcd.c
+++ b/drivers/usb/host/isp1362-hcd.c
@@ -2829,7 +2829,7 @@ static struct platform_driver isp1362_driver = {
.suspend = isp1362_suspend,
.resume = isp1362_resume,
.driver = {
-   .name = (char *)hcd_name,
+   .name = hcd_name,
.owner = THIS_MODULE,
},
 };
diff --git a/drivers/usb/host/r8a66597-hcd.c b/drivers/usb/host/r8a66597-hcd.c
index 2ad004ae747c..3bddfcfafb79 100644
--- a/drivers/usb/host/r8a66597-hcd.c
+++ b/drivers/usb/host/r8a66597-hcd.c
@@ -2534,7 +2534,7 @@ static struct platform_driver r8a66597_driver = {
.probe =r8a66597_probe,
.remove =   r8a66597_remove,
.driver = {
-   .name = (char *) hcd_name,
+   .name = hcd_name,
.owner  = THIS_MODULE,
.pm = R8A66597_DEV_PM_OPS,
},
diff --git a/drivers/usb/host/u132-hcd.c b/drivers/usb/host/u132-hcd.c
index e402beb5a069..46236e9fc87f 100644
--- a/drivers/usb/host/u132-hcd.c
+++ b/drivers/usb/host/u132-hcd.c
@@ -3217,7 +3217,7 @@ static struct platform_driver u132_platform_driver = {
.suspend = u132_suspend,
.resume = u132_resume,
.driver = {
-  .name = (char *)hcd_name,
+  .name = hcd_name,
   .owner = THIS_MODULE,
   },
 };
-- 
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] usb: gadget: multi: Mark {cdc,rndis}_config_register() __init

2013-04-24 Thread Geert Uytterhoeven
If gcc (e.g. 4.1.2) decides not to inline cdc_config_register() and
rndis_config_register(), this will cause section mismatch warnings:

WARNING: drivers/usb/gadget/g_multi.o(.text+0x32f6): Section mismatch in 
reference from the function cdc_config_register() to the function 
.init.text:cdc_do_config()
The function cdc_config_register() references
the function __init cdc_do_config().
This is often because cdc_config_register lacks a __init
annotation or the annotation of cdc_do_config is wrong.

WARNING: drivers/usb/gadget/g_multi.o(.text+0x3326): Section mismatch in 
reference from the function rndis_config_register() to the function 
.init.text:rndis_do_config()
The function rndis_config_register() references
the function __init rndis_do_config().
This is often because rndis_config_register lacks a __init
annotation or the annotation of rndis_do_config is wrong.

Fortunately they're harmless, as {cdc,rndis}_config_register() are only
called from multi_bind(), which is annotated with __ref.

Mark {cdc,rndis}_config_register() with the __init annotation to kill the
warning.

Signed-off-by: Geert Uytterhoeven ge...@linux-m68k.org
---
Note: I did not verify that multi_bind() is rightfully marked __ref.

 drivers/usb/gadget/multi.c |8 
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/usb/gadget/multi.c b/drivers/usb/gadget/multi.c
index 20bbbf9..db63d9e 100644
--- a/drivers/usb/gadget/multi.c
+++ b/drivers/usb/gadget/multi.c
@@ -177,7 +177,7 @@ err_func_acm:
return ret;
 }
 
-static int rndis_config_register(struct usb_composite_dev *cdev)
+static __init int rndis_config_register(struct usb_composite_dev *cdev)
 {
static struct usb_configuration config = {
.bConfigurationValue= MULTI_RNDIS_CONFIG_NUM,
@@ -192,7 +192,7 @@ static int rndis_config_register(struct usb_composite_dev 
*cdev)
 
 #else
 
-static int rndis_config_register(struct usb_composite_dev *cdev)
+static __init int rndis_config_register(struct usb_composite_dev *cdev)
 {
return 0;
 }
@@ -240,7 +240,7 @@ err_func_acm:
return ret;
 }
 
-static int cdc_config_register(struct usb_composite_dev *cdev)
+static __init int cdc_config_register(struct usb_composite_dev *cdev)
 {
static struct usb_configuration config = {
.bConfigurationValue= MULTI_CDC_CONFIG_NUM,
@@ -255,7 +255,7 @@ static int cdc_config_register(struct usb_composite_dev 
*cdev)
 
 #else
 
-static int cdc_config_register(struct usb_composite_dev *cdev)
+static __init int cdc_config_register(struct usb_composite_dev *cdev)
 {
return 0;
 }
-- 
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


Re: [PATCH 01/28] Remove CPU_MMP3

2014-02-11 Thread Geert Uytterhoeven
Cc Yu Xu y...@marvell.com

On Tue, Feb 11, 2014 at 11:01 PM, Paul Bolle pebo...@tiscali.nl wrote:
 On Tue, 2014-02-11 at 13:30 -0800, Greg Kroah-Hartman wrote:
 On Sun, Feb 09, 2014 at 07:47:39PM +0100, Richard Weinberger wrote:
  The symbol is an orphan, get rid of it.
 
  Signed-off-by: Richard Weinberger rich...@nod.at
  Acked-by: Paul Bolle pebo...@tiscali.nl
 
  ---
   drivers/usb/phy/Kconfig  | 1 -
   drivers/video/mmp/Kconfig| 2 +-
   drivers/video/mmp/hw/Kconfig | 2 +-
   3 files changed, 2 insertions(+), 3 deletions(-)
 
  diff --git a/drivers/usb/phy/Kconfig b/drivers/usb/phy/Kconfig
  index 7d1451d..b9b1c52 100644
  --- a/drivers/usb/phy/Kconfig
  +++ b/drivers/usb/phy/Kconfig
  @@ -61,7 +61,6 @@ config KEYSTONE_USB_PHY
 
   config MV_U3D_PHY
  bool Marvell USB 3.0 PHY controller Driver
  -   depends on CPU_MMP3
  select USB_PHY
  help
Enable this to support Marvell USB 3.0 phy controller for Marvell

 Do this and the driver breaks the build so it needs to depend on
 something:

 drivers/usb/phy/phy-mv-u3d-usb.c: In function ‘mv_u3d_phy_read’:
 drivers/usb/phy/phy-mv-u3d-usb.c:42:2: error: implicit declaration of 
 function ‘writel_relaxed’ [-Werror=implicit-function-declaration]

 This sort of proves that a driver that depends on an unknown Kconfig
 symbol gets no build coverage (and will bit rot).

 Sorry, I can't take this as-is.

 My mistake, I should have spotted this when looking a Richard's patch.

 Some background (which I quickly dug up): config MV_U3D_PHY got added in
 v3.7 through commit a67e76ac904c (usb: phy: mv_u3d: Add usb phy driver
 for mv_u3d). It then depended on USB_MV_U3D. And that symbol depended
 on CPU_MMP3 at that time. Ie, MV_U3D_PHY was unbuildable when it was
 added.

 In commit 60630c2eabd4 (usb: gadget: mv_u3d: drop ARCH dependency)
 MV_U3D_PHY was made depended directly on  CPU_MMP3. That kept it
 unbuildable, of course.

 Richard, assuming you agree with the above short history of MV_U3D_PHY,
 would you mind sending a v2 that removes this unbuildable driver?

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say programmer or something like that.
-- Linus Torvalds
--
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] USB2NET : SR9800 : Use %zu to format size_t

2014-02-17 Thread Geert Uytterhoeven
On 32-bit:

drivers/md/bcache/bset.c: In function ‘bch_dump_bset’:
drivers/md/bcache/bset.c:27: warning: format ‘%li’ expects type ‘long int’, but 
argument 3 has type ‘int’

Signed-off-by: Geert Uytterhoeven ge...@linux-m68k.org
---
 drivers/net/usb/sr9800.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/usb/sr9800.c b/drivers/net/usb/sr9800.c
index 4175eb9fdeca..801710883727 100644
--- a/drivers/net/usb/sr9800.c
+++ b/drivers/net/usb/sr9800.c
@@ -823,7 +823,7 @@ static int sr9800_bind(struct usbnet *dev, struct 
usb_interface *intf)
dev-rx_urb_size =
SR9800_BULKIN_SIZE[SR9800_MAX_BULKIN_2K].size;
}
-   netdev_dbg(dev-net, %s : setting rx_urb_size with : %ld\n, __func__,
+   netdev_dbg(dev-net, %s : setting rx_urb_size with : %zu\n, __func__,
   dev-rx_urb_size);
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


[PATCH] usb: musb: USB_MUSB_DUAL_ROLE/USB_MUSB_GADGET should depend on HAS_DMA

2014-02-21 Thread Geert Uytterhoeven
If NO_DMA=y:

drivers/built-in.o: In function `txstate':
musb_gadget.c:(.text+0x35955a): undefined reference to `dma_unmap_single'
musb_gadget.c:(.text+0x35957e): undefined reference to 
`dma_sync_single_for_cpu'
drivers/built-in.o: In function `musb_g_giveback':
(.text+0x359672): undefined reference to `dma_mapping_error'
drivers/built-in.o: In function `musb_g_giveback':
(.text+0x3596ba): undefined reference to `dma_unmap_single'
drivers/built-in.o: In function `musb_g_giveback':
(.text+0x3596e0): undefined reference to `dma_sync_single_for_cpu'
drivers/built-in.o: In function `rxstate':
musb_gadget.c:(.text+0x3599d0): undefined reference to `dma_unmap_single'
musb_gadget.c:(.text+0x3599f6): undefined reference to 
`dma_sync_single_for_cpu'
drivers/built-in.o: In function `musb_gadget_queue':
musb_gadget.c:(.text+0x35a8c0): undefined reference to `dma_map_single'
musb_gadget.c:(.text+0x35a8d0): undefined reference to `dma_mapping_error'
musb_gadget.c:(.text+0x35a906): undefined reference to 
`dma_sync_single_for_cpu'
musb_gadget.c:(.text+0x35a9a0): undefined reference to `dma_unmap_single'
musb_gadget.c:(.text+0x35a9c8): undefined reference to 
`dma_sync_single_for_cpu'

Signed-off-by: Geert Uytterhoeven ge...@linux-m68k.org
---
 drivers/usb/musb/Kconfig |2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/usb/musb/Kconfig b/drivers/usb/musb/Kconfig
index 688dc8bb192d..8b789792f6fa 100644
--- a/drivers/usb/musb/Kconfig
+++ b/drivers/usb/musb/Kconfig
@@ -43,6 +43,7 @@ config USB_MUSB_HOST
 config USB_MUSB_GADGET
bool Gadget only mode
depends on USB_GADGET=y || USB_GADGET=USB_MUSB_HDRC
+   depends on HAS_DMA
help
  Select this when you want to use MUSB in gadget mode only,
  thereby the host feature will be regressed.
@@ -50,6 +51,7 @@ config USB_MUSB_GADGET
 config USB_MUSB_DUAL_ROLE
bool Dual Role mode
depends on ((USB=y || USB=USB_MUSB_HDRC)  (USB_GADGET=y || 
USB_GADGET=USB_MUSB_HDRC))
+   depends on HAS_DMA
help
  This is the default mode of working of MUSB controller where
  both host and gadget features are enabled.
-- 
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: SPDX-License-Identifier

2014-02-25 Thread Geert Uytterhoeven
On Tue, Feb 25, 2014 at 1:10 PM, One Thousand Gnomes
gno...@lxorguk.ukuu.org.uk wrote:
 On Mon, 24 Feb 2014 06:26:52 -0800
 Greg Kroah-Hartman gre...@linuxfoundation.org wrote:

 On Mon, Feb 24, 2014 at 03:03:25PM +0100, Michal Simek wrote:
 
  BTW: Isn't this a good topic for kernel-summit? :-)

 No, lawyers don't go to the summit, developers do.

 More of a topic for the LF. Particularly as any attempt to touch license
 statements in existing drivers would end up needing the corporate lawyer
 of every rights holder on the planet for the file in question to be
 consulted, which is not I suspect going to happen!

That's gonna be a BIG Linux Lawyer Summit ;-)

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say programmer or something like that.
-- Linus Torvalds
--
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: [BUG] 2.6.24-git usb reset problems

2008-01-30 Thread Geert Uytterhoeven
On Tue, 29 Jan 2008, Jens Axboe wrote:
 On Tue, Jan 29 2008, Jens Axboe wrote:
  On Tue, Jan 29 2008, James Bottomley wrote:
   On Tue, 2008-01-29 at 11:10 -0800, Matthew Dharm wrote:
For some reason, usb_sg_init is boned during auto-sense.
   
   OK, that's implicating the scsi_eh_prep_cmnd() in the auto sense
   code ... that was also an update in 2.6.24
  
  yeah, already found the bug - it's assuming -request_buffer holds the
  sglist, oops. Preparing a fix.
 
 ok here goes, this saves and restores the sg table correctly. it also
 fixes the usb bug for me.

I can confirm this patch fixes the errors I was seeing with current
linux-2.6.git for the USB memory card readers in a Dell TFT connected to a PS3.

 diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
 index 547e85a..12770ef 100644
 --- a/drivers/scsi/scsi_error.c
 +++ b/drivers/scsi/scsi_error.c
 @@ -622,13 +622,15 @@ void scsi_eh_prep_cmnd(struct scsi_cmnd *scmd, struct 
 scsi_eh_save *ses,
   ses-use_sg = scmd-use_sg;
   ses-resid = scmd-resid;
   ses-result = scmd-result;
 + memcpy(ses-sense_sgl, scmd-sg_table, sizeof(ses-sense_sgl));
  
   if (sense_bytes) {
   scmd-request_bufflen = min_t(unsigned,
  SCSI_SENSE_BUFFERSIZE, sense_bytes);
   sg_init_one(ses-sense_sgl, scmd-sense_buffer,
  scmd-request_bufflen);
 - scmd-request_buffer = ses-sense_sgl;
 + scmd-sg_table.sgl = ses-sense_sgl;
 + scmd-sg_table.nents = scmd-sg_table.orig_nents = 1;
   scmd-sc_data_direction = DMA_FROM_DEVICE;
   scmd-use_sg = 1;
   memset(scmd-cmnd, 0, sizeof(scmd-cmnd));
 @@ -679,6 +681,7 @@ void scsi_eh_restore_cmnd(struct scsi_cmnd* scmd, struct 
 scsi_eh_save *ses)
   scmd-request_bufflen = ses-bufflen;
   scmd-request_buffer = ses-buffer;
   scmd-use_sg = ses-use_sg;
 + memcpy(scmd-sg_table, ses-sg_table, sizeof(scmd-sg_table));
   scmd-resid = ses-resid;
   scmd-result = ses-result;
  }
 diff --git a/include/scsi/scsi_eh.h b/include/scsi/scsi_eh.h
 index d21b891..d43dc83 100644
 --- a/include/scsi/scsi_eh.h
 +++ b/include/scsi/scsi_eh.h
 @@ -75,6 +75,7 @@ struct scsi_eh_save {
  
   void *buffer;
   unsigned bufflen;
 + struct sg_table sg_table;
   unsigned short use_sg;
   int resid;
  

With kind regards,

Geert Uytterhoeven
Software Architect

Sony Network and Software Technology Center Europe
The Corporate Village · Da Vincilaan 7-D1 · B-1935 Zaventem · Belgium

Phone:+32 (0)2 700 8453
Fax:  +32 (0)2 700 8622
E-mail:   [EMAIL PROTECTED]
Internet: http://www.sony-europe.com/

Sony Network and Software Technology Center Europe
A division of Sony Service Centre (Europe) N.V.
Registered office: Technologielaan 7 · B-1840 Londerzeel · Belgium
VAT BE 0413.825.160 · RPR Brussels
Fortis Bank Zaventem · Swift GEBABEBB08A · IBAN BE39001382358619

Re: Build regressions/improvements in v3.5

2012-08-03 Thread Geert Uytterhoeven
On Fri, Aug 3, 2012 at 4:06 PM, Geert Uytterhoeven ge...@linux-m68k.org wrote:
 JFYI, when comparing v3.5 to v3.5-rc7[3], the summaries are:
   - build errors: +6/-9
   - build warnings: +105/-5443

  + drivers/staging/ccg/../../usb/gadget/f_mass_storage.c: error:
implicit declaration of function 'get_ds'
[-Werror=implicit-function-declaration]:  = 2624:2
  + drivers/staging/ccg/../../usb/gadget/f_mass_storage.c: error:
implicit declaration of function 'set_fs'
[-Werror=implicit-function-declaration]:  = 2624:2
  + drivers/staging/ccg/../../usb/gadget/storage_common.c: error:
implicit declaration of function 'bdev_logical_block_size'
[-Werror=implicit-function-declaration]:  = 686:3
  + drivers/staging/ccg/../../usb/gadget/storage_common.c: error:
implicit declaration of function 'blksize_bits'
[-Werror=implicit-function-declaration]:  = 687:3

i386-randconfig, staging drivers including USB core sources?

  + error: No rule to make target
/scratch/kisskb/build/linus_sh-randconfig_sh4/usr/include/linux/kvm_para.h:
 = N/A

Known issue with kvm_para.h header export.

  + error: No rule to make target include/config/auto.conf:  = N/A

x86_64-randconfig

 [1] http://kisskb.ellerman.id.au/kisskb/head/5266/ (all 116 configs)

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say programmer or something like that.
-- Linus Torvalds
--
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] console/font: Refactor font support code selection logic

2013-05-15 Thread Geert Uytterhoeven
The current Makefile rules to build font support are messy and buggy.
Replace them by Kconfig rules:
  - Introduce CONFIG_FONT_SUPPORT, which controls the building of all font
code,
  - Select CONFIG_FONT_SUPPORT for all drivers that use fonts,
  - Select CONFIG_FONT_8x16 for all drivers that default to the VGA8x16
font,
  - Drop the bogus console dependency for CONFIG_VIDEO_VIVI.

This fixes (if CONFIG_SOLO6X10=y and there are no built-in console
drivers):

drivers/built-in.o: In function `solo_osd_print':
drivers/staging/media/solo6x10/solo6x10-enc.c:144: undefined reference to 
`.find_font'

Signed-off-by: Geert Uytterhoeven ge...@linux-m68k.org
---
 drivers/media/platform/Kconfig |2 +-
 drivers/staging/media/solo6x10/Kconfig |2 ++
 drivers/usb/misc/sisusbvga/Kconfig |1 +
 drivers/video/console/Kconfig  |   12 ++--
 drivers/video/console/Makefile |   14 +-
 5 files changed, 19 insertions(+), 12 deletions(-)

diff --git a/drivers/media/platform/Kconfig b/drivers/media/platform/Kconfig
index 0cbe1ff..c1f29d5 100644
--- a/drivers/media/platform/Kconfig
+++ b/drivers/media/platform/Kconfig
@@ -220,7 +220,7 @@ if V4L_TEST_DRIVERS
 config VIDEO_VIVI
tristate Virtual Video Driver
depends on VIDEO_DEV  VIDEO_V4L2  !SPARC32  !SPARC64
-   depends on FRAMEBUFFER_CONSOLE || STI_CONSOLE
+   select FONT_SUPPORT
select FONT_8x16
select VIDEOBUF2_VMALLOC
default n
diff --git a/drivers/staging/media/solo6x10/Kconfig 
b/drivers/staging/media/solo6x10/Kconfig
index ec32776..b34bb6c 100644
--- a/drivers/staging/media/solo6x10/Kconfig
+++ b/drivers/staging/media/solo6x10/Kconfig
@@ -1,6 +1,8 @@
 config SOLO6X10
tristate Softlogic 6x10 MPEG codec cards
depends on PCI  VIDEO_DEV  SND  I2C
+   select FONT_SUPPORT
+   select FONT_8x16
select VIDEOBUF2_DMA_SG
select VIDEOBUF2_DMA_CONTIG
select SND_PCM
diff --git a/drivers/usb/misc/sisusbvga/Kconfig 
b/drivers/usb/misc/sisusbvga/Kconfig
index 0d03a52..36bc28c 100644
--- a/drivers/usb/misc/sisusbvga/Kconfig
+++ b/drivers/usb/misc/sisusbvga/Kconfig
@@ -2,6 +2,7 @@
 config USB_SISUSBVGA
tristate USB 2.0 SVGA dongle support (Net2280/SiS315)
depends on (USB_MUSB_HDRC || USB_EHCI_HCD)
+   select FONT_SUPPORT if USB_SISUSBVGA_CON
 ---help---
  Say Y here if you intend to attach a USB2VGA dongle based on a
  Net2280 and a SiS315 chip.
diff --git a/drivers/video/console/Kconfig b/drivers/video/console/Kconfig
index bc922c4..baf27dc 100644
--- a/drivers/video/console/Kconfig
+++ b/drivers/video/console/Kconfig
@@ -62,6 +62,7 @@ config MDA_CONSOLE
 config SGI_NEWPORT_CONSOLE
 tristate SGI Newport Console support
 depends on SGI_IP22 
+select FONT_SUPPORT
 help
   Say Y here if you want the console on the Newport aka XL graphics
   card of your Indy.  Most people say Y here.
@@ -91,6 +92,7 @@ config FRAMEBUFFER_CONSOLE
tristate Framebuffer Console support
depends on FB
select CRC32
+   select FONT_SUPPORT
help
  Low-level framebuffer-based console driver.
 
@@ -123,12 +125,18 @@ config FRAMEBUFFER_CONSOLE_ROTATION
 config STI_CONSOLE
 bool STI text console
 depends on PARISC
+select FONT_SUPPORT
 default y
 help
   The STI console is the builtin display/keyboard on HP-PARISC
   machines.  Say Y here to build support for it into your kernel.
   The alternative is to use your primary serial port as a console.
 
+config FONT_SUPPORT
+   tristate
+
+if FONT_SUPPORT
+
 config FONTS
bool Select compiled-in fonts
depends on FRAMEBUFFER_CONSOLE || STI_CONSOLE
@@ -158,7 +166,6 @@ config FONT_8x8
 
 config FONT_8x16
bool VGA 8x16 font if FONTS
-   depends on FRAMEBUFFER_CONSOLE || SGI_NEWPORT_CONSOLE || STI_CONSOLE || 
USB_SISUSBVGA_CON
default y if !SPARC  !FONTS
help
  This is the high resolution font for the VGA frame buffer (the one
@@ -226,7 +233,6 @@ config FONT_10x18
 
 config FONT_AUTOSELECT
def_bool y
-   depends on FRAMEBUFFER_CONSOLE || SGI_NEWPORT_CONSOLE || STI_CONSOLE || 
USB_SISUSBVGA_CON
depends on !FONT_8x8
depends on !FONT_6x11
depends on !FONT_7x14
@@ -238,5 +244,7 @@ config FONT_AUTOSELECT
depends on !FONT_10x18
select FONT_8x16
 
+endif # FONT_SUPPORT
+
 endmenu
 
diff --git a/drivers/video/console/Makefile b/drivers/video/console/Makefile
index a862e91..3a11b63 100644
--- a/drivers/video/console/Makefile
+++ b/drivers/video/console/Makefile
@@ -18,14 +18,14 @@ font-objs-$(CONFIG_FONT_MINI_4x6)  += font_mini_4x6.o
 
 font-objs += $(font-objs-y)
 
-# Each configuration option enables a list of files.
+obj-$(CONFIG_FONT_SUPPORT) += font.o
 
 obj-$(CONFIG_DUMMY_CONSOLE)   += dummycon.o
-obj

[PATCH] usb: USB host support should depend on HAS_DMA

2013-07-10 Thread Geert Uytterhoeven
If NO_DMA=y:

drivers/built-in.o: In function `usb_hcd_unmap_urb_setup_for_dma':
drivers/usb/core/hcd.c:1361: undefined reference to `dma_unmap_single'
drivers/built-in.o: In function `usb_hcd_unmap_urb_for_dma':
drivers/usb/core/hcd.c:1393: undefined reference to `dma_unmap_sg'
drivers/usb/core/hcd.c:1398: undefined reference to `dma_unmap_page'
drivers/usb/core/hcd.c:1403: undefined reference to `dma_unmap_single'
drivers/built-in.o: In function `usb_hcd_map_urb_for_dma':
drivers/usb/core/hcd.c:1445: undefined reference to `dma_map_single'
drivers/usb/core/hcd.c:1450: undefined reference to `dma_mapping_error'
drivers/usb/core/hcd.c:1480: undefined reference to `dma_map_sg'
drivers/usb/core/hcd.c:1495: undefined reference to `dma_map_page'
drivers/usb/core/hcd.c:1501: undefined reference to `dma_mapping_error'
drivers/usb/core/hcd.c:1507: undefined reference to `dma_map_single'
drivers/usb/core/hcd.c:1512: undefined reference to `dma_mapping_error'
drivers/built-in.o: In function `hcd_buffer_free':
drivers/usb/core/buffer.c:146: undefined reference to `dma_pool_free'
drivers/usb/core/buffer.c:150: undefined reference to `dma_free_coherent'
drivers/built-in.o: In function `hcd_buffer_destroy':
drivers/usb/core/buffer.c:90: undefined reference to `dma_pool_destroy'
drivers/built-in.o: In function `hcd_buffer_create':
drivers/usb/core/buffer.c:65: undefined reference to `dma_pool_create'
drivers/built-in.o: In function `hcd_buffer_alloc':
drivers/usb/core/buffer.c:120: undefined reference to `dma_pool_alloc'
drivers/usb/core/buffer.c:122: undefined reference to `dma_alloc_coherent'
,,,

Commit d9ea21a779278da06d0cbe989594bf542ed213d7 (usb: host: make
USB_ARCH_HAS_?HCI obsolete) allowed to enable USB on platforms with
NO_DMA=y, and exposed several input and media USB drivers that just select
USB if USB_ARCH_HAS_HCD, without checking HAS_DMA.

Fix the former by making USB depend on HAS_DMA.

To fix the latter, instead of adding lots of depends on HAS_DMA, make
those drivers depend on USB, instead of depending on USB_ARCH_HAS_HCD and
selecting USB.  Drivers for other busses (e.g. MOUSE_SYNAPTICS_I2C) already
handle this in a similar way.

Signed-off-by: Geert Uytterhoeven ge...@linux-m68k.org
---
 drivers/input/joystick/Kconfig|3 +--
 drivers/input/misc/Kconfig|   15 +--
 drivers/input/mouse/Kconfig   |9 +++--
 drivers/input/tablet/Kconfig  |   15 +--
 drivers/input/touchscreen/Kconfig |3 +--
 drivers/media/rc/Kconfig  |   21 +++--
 drivers/usb/Kconfig   |2 +-
 7 files changed, 23 insertions(+), 45 deletions(-)

diff --git a/drivers/input/joystick/Kconfig b/drivers/input/joystick/Kconfig
index 56eb471..d7e36fb 100644
--- a/drivers/input/joystick/Kconfig
+++ b/drivers/input/joystick/Kconfig
@@ -278,8 +278,7 @@ config JOYSTICK_JOYDUMP
 
 config JOYSTICK_XPAD
tristate X-Box gamepad support
-   depends on USB_ARCH_HAS_HCD
-   select USB
+   depends on USB
help
  Say Y here if you want to use the X-Box pad with your computer.
  Make sure to say Y to Joystick support (CONFIG_INPUT_JOYDEV)
diff --git a/drivers/input/misc/Kconfig b/drivers/input/misc/Kconfig
index 0b541cd..00cdecb 100644
--- a/drivers/input/misc/Kconfig
+++ b/drivers/input/misc/Kconfig
@@ -286,8 +286,7 @@ config INPUT_ATLAS_BTNS
 
 config INPUT_ATI_REMOTE2
tristate ATI / Philips USB RF remote control
-   depends on USB_ARCH_HAS_HCD
-   select USB
+   depends on USB
help
  Say Y here if you want to use an ATI or Philips USB RF remote control.
  These are RF remotes with USB receivers.
@@ -301,8 +300,7 @@ config INPUT_ATI_REMOTE2
 
 config INPUT_KEYSPAN_REMOTE
tristate Keyspan DMR USB remote control
-   depends on USB_ARCH_HAS_HCD
-   select USB
+   depends on USB
help
  Say Y here if you want to use a Keyspan DMR USB remote control.
  Currently only the UIA-11 type of receiver has been tested.  The tag
@@ -333,8 +331,7 @@ config INPUT_KXTJ9_POLLED_MODE
 
 config INPUT_POWERMATE
tristate Griffin PowerMate and Contour Jog support
-   depends on USB_ARCH_HAS_HCD
-   select USB
+   depends on USB
help
  Say Y here if you want to use Griffin PowerMate or Contour Jog 
devices.
  These are aluminum dials which can measure clockwise and anticlockwise
@@ -349,8 +346,7 @@ config INPUT_POWERMATE
 
 config INPUT_YEALINK
tristate Yealink usb-p1k voip phone
-   depends on USB_ARCH_HAS_HCD
-   select USB
+   depends on USB
help
  Say Y here if you want to enable keyboard and LCD functions of the
  Yealink usb-p1k usb phones. The audio part is enabled by the generic
@@ -364,8 +360,7 @@ config INPUT_YEALINK
 
 config INPUT_CM109
tristate C-Media CM109 USB I/O Controller
-   depends on USB_ARCH_HAS_HCD
-   select USB
+   depends on USB

[PATCH] usb: gadget: fotg210-udc: Remove bogus __init/__exit annotations

2013-07-10 Thread Geert Uytterhoeven
When builtin (CONFIG_USB_FOTG210_UDC=y):

  LD  drivers/usb/gadget/built-in.o
WARNING: drivers/usb/gadget/built-in.o(.data+0xbf8): Section mismatch in 
reference from the variable fotg210_driver to the function 
.init.text:fotg210_udc_probe()
The variable fotg210_driver references
the function __init fotg210_udc_probe()
If the reference is valid then annotate the
variable with __init* or __refdata (see linux/init.h) or name the variable:
*_template, *_timer, *_sht, *_ops, *_probe, *_probe_one, *_console

  LD  drivers/usb/built-in.o
WARNING: drivers/usb/built-in.o(.data+0x14684): Section mismatch in reference 
from the variable fotg210_driver to the function .init.text:fotg210_udc_probe()
The variable fotg210_driver references
the function __init fotg210_udc_probe()
If the reference is valid then annotate the
variable with __init* or __refdata (see linux/init.h) or name the variable:
*_template, *_timer, *_sht, *_ops, *_probe, *_probe_one, *_console

  LD  drivers/built-in.o
WARNING: drivers/built-in.o(.data+0x8b0c8): Section mismatch in reference from 
the variable fotg210_driver to the function .init.text:fotg210_udc_probe()
The variable fotg210_driver references
the function __init fotg210_udc_probe()
If the reference is valid then annotate the
variable with __init* or __refdata (see linux/init.h) or name the variable:
*_template, *_timer, *_sht, *_ops, *_probe, *_probe_one, *_console

  CHK include/generated/uapi/linux/version.h
  LINKvmlinux
  LD  vmlinux.o
  MODPOST vmlinux.o
WARNING: vmlinux.o(.data+0xc6730): Section mismatch in reference from the 
variable fotg210_driver to the function .init.text:fotg210_udc_probe()
The variable fotg210_driver references
the function __init fotg210_udc_probe()
If the reference is valid then annotate the
variable with __init* or __refdata (see linux/init.h) or name the variable:
*_template, *_timer, *_sht, *_ops, *_probe, *_probe_one, *_console

  GEN .version
  CHK include/generated/compile.h
  UPD include/generated/compile.h
  CC  init/version.o
  LD  init/built-in.o
`.exit.text' referenced in section `.data' of drivers/built-in.o: defined in 
discarded section `.exit.text' of drivers/built-in.o
make[3]: *** [vmlinux] Error 1

Signed-off-by: Geert Uytterhoeven ge...@linux-m68k.org
---
 drivers/usb/gadget/fotg210-udc.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/gadget/fotg210-udc.c b/drivers/usb/gadget/fotg210-udc.c
index cce5535..10cd18d 100644
--- a/drivers/usb/gadget/fotg210-udc.c
+++ b/drivers/usb/gadget/fotg210-udc.c
@@ -1074,7 +1074,7 @@ static struct usb_gadget_ops fotg210_gadget_ops = {
.udc_stop   = fotg210_udc_stop,
 };
 
-static int __exit fotg210_udc_remove(struct platform_device *pdev)
+static int fotg210_udc_remove(struct platform_device *pdev)
 {
struct fotg210_udc *fotg210 = dev_get_drvdata(pdev-dev);
 
@@ -1088,7 +1088,7 @@ static int __exit fotg210_udc_remove(struct 
platform_device *pdev)
return 0;
 }
 
-static int __init fotg210_udc_probe(struct platform_device *pdev)
+static int fotg210_udc_probe(struct platform_device *pdev)
 {
struct resource *res, *ires;
struct fotg210_udc *fotg210 = 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] usb: gadget: fotg210-udc: Remove bogus __init/__exit annotations

2013-07-11 Thread Geert Uytterhoeven
On Wed, Jul 10, 2013 at 11:52 PM, Sergei Shtylyov
sergei.shtyl...@cogentembedded.com wrote:
 On 07/11/2013 01:45 AM, Geert Uytterhoeven wrote:

 When builtin (CONFIG_USB_FOTG210_UDC=y):

LD  drivers/usb/gadget/built-in.o
 WARNING: drivers/usb/gadget/built-in.o(.data+0xbf8): Section mismatch in
 reference from the variable fotg210_driver to the function
 .init.text:fotg210_udc_probe()
 The variable fotg210_driver references
 the function __init fotg210_udc_probe()
 If the reference is valid then annotate the
 variable with __init* or __refdata (see linux/init.h) or name the
 variable:
 *_template, *_timer, *_sht, *_ops, *_probe, *_probe_one, *_console

 diff --git a/drivers/usb/gadget/fotg210-udc.c
 b/drivers/usb/gadget/fotg210-udc.c
 index cce5535..10cd18d 100644
 --- a/drivers/usb/gadget/fotg210-udc.c
 +++ b/drivers/usb/gadget/fotg210-udc.c
 @@ -1074,7 +1074,7 @@ static struct usb_gadget_ops fotg210_gadget_ops = {
 .udc_stop   = fotg210_udc_stop,
   };

 -static int __exit fotg210_udc_remove(struct platform_device *pdev)
 +static int fotg210_udc_remove(struct platform_device *pdev)


I think you can leave __exit annotation here, if you enclose the
 reference in the driver structure in __exit_p()...

The driver is using module_platform_driver(), not
module_platform_driver_probe(),
so it expects the platform device to show up or disappear anytime.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say programmer or something like that.
-- Linus Torvalds
--
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: USB host support should depend on HAS_DMA

2013-07-11 Thread Geert Uytterhoeven
On Thu, Jul 11, 2013 at 3:01 AM, Alan Stern st...@rowland.harvard.edu wrote:
 On Thu, 11 Jul 2013, Arnd Bergmann wrote:

 On Wednesday 10 July 2013, Alan Stern wrote:
  This isn't right.  There are USB host controllers that use PIO, not
  DMA.  The HAS_DMA dependency should go with the controller driver, not
  the USB core.
 
  On the other hand, the USB core does call various routines like
  dma_unmap_single.  It ought to be possible to compile these calls even
  when DMA isn't enabled.  That is, they should be defined as do-nothing
  stubs.

 The asm-generic/dma-mapping-broken.h file intentionally causes link
 errors, but that could be changed.

 The better approach in my mind would be to replace code like


   if (hcd-self.uses_dma)

 with

   if (IS_ENABLED(CONFIG_HAS_DMA)  hcd-self.uses_dma) {

 which will reliably cause that reference to be omitted from object code,
 but not stop giving link errors for drivers that actually require
 DMA.

 How will it give link errors for drivers that require DMA?

It won't. Unless the host driver itself calls into the DMA API, too
(are there any that don't?).

 Besides, wouldn't it be better to get an error at config time rather
 than at link time?  Or even better still, not to be allowed to
 configure drivers that depend on DMA if DMA isn't available?

Indeed.

 If we add an explicit dependency for HAS_DMA to the Kconfig entries for
 these drivers, then your suggestion would be a good way to allow
 usbcore to be built independently of DMA support.

However, having the link errors helps when annotating the Kconfig files
with HAS_DMA dependencies.

Unfortunately the check for hcd-self.uses_dma (which boils down to
dev-dma_mask != NULL) isn't sufficient to cause breakage at compilation
time when a Kconfig entry incorrectly doesn't depend on HAS_DMA.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say programmer or something like that.
-- Linus Torvalds
--
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 3/6] usb: gadget: USB_MV_UDC should depend on HAS_DMA

2013-07-11 Thread Geert Uytterhoeven
If NO_DMA=y:

drivers/built-in.o: In function `done':
drivers/usb/gadget/mv_udc_core.c:239: undefined reference to `dma_pool_free'
drivers/built-in.o: In function `build_dtd':
drivers/usb/gadget/mv_udc_core.c:371: undefined reference to `dma_pool_alloc'
drivers/built-in.o: In function `udc_prime_status':
drivers/usb/gadget/mv_udc_core.c:1465: undefined reference to `dma_map_single'
drivers/built-in.o: In function `mv_udc_remove':
drivers/usb/gadget/mv_udc_core.c:2087: undefined reference to `dma_pool_destroy'
drivers/usb/gadget/mv_udc_core.c:2090: undefined reference to 
`dma_free_coherent'
drivers/built-in.o: In function `mv_udc_probe':
drivers/usb/gadget/mv_udc_core.c:2190: undefined reference to 
`dma_alloc_coherent'
drivers/usb/gadget/mv_udc_core.c:2201: undefined reference to `dma_pool_create'
drivers/usb/gadget/mv_udc_core.c:2315: undefined reference to `dma_pool_destroy'
drivers/usb/gadget/mv_udc_core.c:2317: undefined reference to 
`dma_free_coherent'

Signed-off-by: Geert Uytterhoeven ge...@linux-m68k.org
---
 drivers/usb/gadget/Kconfig |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig
index 62f6802..95375d1 100644
--- a/drivers/usb/gadget/Kconfig
+++ b/drivers/usb/gadget/Kconfig
@@ -328,7 +328,7 @@ config USB_S3C_HSUDC
 
 config USB_MV_UDC
tristate Marvell USB2.0 Device Controller
-   depends on GENERIC_HARDIRQS
+   depends on GENERIC_HARDIRQS  HAS_DMA
help
  Marvell Socs (including PXA and MMP series) include a high speed
  USB2.0 OTG controller, which can be configured as high speed or
-- 
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 6/6] [RFC] usb: gadget: USB_GADGET should depend on HAS_DMA

2013-07-11 Thread Geert Uytterhoeven
If NO_DMA=y:

drivers/built-in.o: In function `dma_set_coherent_mask':
include/linux/dma-mapping.h:93: undefined reference to `dma_supported'
include/linux/dma-mapping.h:93: undefined reference to `dma_supported'
drivers/built-in.o: In function `usb_gadget_unmap_request':
drivers/usb/gadget/udc-core.c:91: undefined reference to `dma_unmap_sg'
drivers/usb/gadget/udc-core.c:96: undefined reference to `dma_unmap_single'
drivers/built-in.o: In function `usb_gadget_map_request':
drivers/usb/gadget/udc-core.c:62: undefined reference to `dma_map_sg'
drivers/usb/gadget/udc-core.c:71: undefined reference to `dma_map_single'
drivers/usb/gadget/udc-core.c:74: undefined reference to `dma_mapping_error'

Signed-off-by: Geert Uytterhoeven ge...@linux-m68k.org
---
This one is very debatable: probably the parts using the DMA API should
be factored out, instead of disabling the whole USB gadget subsystem.

 drivers/usb/gadget/Kconfig |1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig
index 3f8df56..a88fc47 100644
--- a/drivers/usb/gadget/Kconfig
+++ b/drivers/usb/gadget/Kconfig
@@ -15,6 +15,7 @@
 
 menuconfig USB_GADGET
tristate USB Gadget Support
+   depends on HAS_DMA
select NLS
help
   USB is a master/slave protocol, organized with one master
-- 
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 1/6] usb: dwc3: USB_DWC3 should depend on HAS_DMA

2013-07-11 Thread Geert Uytterhoeven
If NO_DMA=y:

drivers/built-in.o: In function `dwc3_free_one_event_buffer':
drivers/usb/dwc3/core.c:132: undefined reference to `dma_free_coherent'
drivers/built-in.o: In function `dwc3_alloc_one_event_buffer':
drivers/usb/dwc3/core.c:154: undefined reference to `dma_alloc_coherent'
drivers/built-in.o: In function `dma_set_coherent_mask':
include/linux/dma-mapping.h:93: undefined reference to `dma_supported'
drivers/built-in.o: In function `dwc3_free_trb_pool':
drivers/usb/dwc3/gadget.c:407: undefined reference to `dma_free_coherent'
drivers/built-in.o: In function `dwc3_gadget_exit':
drivers/usb/dwc3/gadget.c:2693: undefined reference to `dma_free_coherent'
drivers/built-in.o: In function `dwc3_alloc_trb_pool':
drivers/usb/dwc3/gadget.c:391: undefined reference to `dma_alloc_coherent'
drivers/built-in.o: In function `dwc3_gadget_init':
drivers/usb/dwc3/gadget.c:2598: undefined reference to `dma_alloc_coherent'
drivers/usb/dwc3/gadget.c:2667: undefined reference to `dma_free_coherent'
drivers/usb/dwc3/gadget.c:2674: undefined reference to `dma_free_coherent'
drivers/usb/dwc3/gadget.c:2678: undefined reference to `dma_free_coherent'

Signed-off-by: Geert Uytterhoeven ge...@linux-m68k.org
---
 drivers/usb/dwc3/Kconfig |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/dwc3/Kconfig b/drivers/usb/dwc3/Kconfig
index 757aa18..2378958 100644
--- a/drivers/usb/dwc3/Kconfig
+++ b/drivers/usb/dwc3/Kconfig
@@ -1,6 +1,6 @@
 config USB_DWC3
tristate DesignWare USB3 DRD Core Support
-   depends on (USB || USB_GADGET)  GENERIC_HARDIRQS
+   depends on (USB || USB_GADGET)  GENERIC_HARDIRQS  HAS_DMA
select USB_XHCI_PLATFORM if USB_SUPPORT  USB_XHCI_HCD
help
  Say Y or M here if your system has a Dual Role SuperSpeed
-- 
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 4/6] usb: gadget: USB_FOTG210_UDC should depend on HAS_DMA

2013-07-11 Thread Geert Uytterhoeven
If NO_DMA=y:

drivers/built-in.o: In function `fotg210_start_dma':
drivers/usb/gadget/fotg210-udc.c:354: undefined reference to `dma_map_single'
drivers/usb/gadget/fotg210-udc.c:357: undefined reference to `dma_mapping_error'
drivers/usb/gadget/fotg210-udc.c:362: undefined reference to 
`dma_sync_single_for_cpu'
drivers/usb/gadget/fotg210-udc.c:376: undefined reference to `dma_unmap_single'

Signed-off-by: Geert Uytterhoeven ge...@linux-m68k.org
---
 drivers/usb/gadget/Kconfig |1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig
index 95375d1..8743742 100644
--- a/drivers/usb/gadget/Kconfig
+++ b/drivers/usb/gadget/Kconfig
@@ -193,6 +193,7 @@ config USB_FUSB300
   Faraday usb device controller FUSB300 driver
 
 config USB_FOTG210_UDC
+   depends on HAS_DMA
tristate Faraday FOTG210 USB Peripheral Controller
help
   Faraday USB2.0 OTG controller which can be configured as
-- 
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 6/6] [RFC] usb: gadget: USB_GADGET should depend on HAS_DMA

2013-07-12 Thread Geert Uytterhoeven
Hi Alan,

On Thu, Jul 11, 2013 at 5:51 PM, Alan Stern st...@rowland.harvard.edu wrote:
 On Thu, 11 Jul 2013, Geert Uytterhoeven wrote:

 If NO_DMA=y:

 drivers/built-in.o: In function `dma_set_coherent_mask':
 include/linux/dma-mapping.h:93: undefined reference to `dma_supported'
 include/linux/dma-mapping.h:93: undefined reference to `dma_supported'
 drivers/built-in.o: In function `usb_gadget_unmap_request':
 drivers/usb/gadget/udc-core.c:91: undefined reference to `dma_unmap_sg'
 drivers/usb/gadget/udc-core.c:96: undefined reference to `dma_unmap_single'
 drivers/built-in.o: In function `usb_gadget_map_request':
 drivers/usb/gadget/udc-core.c:62: undefined reference to `dma_map_sg'
 drivers/usb/gadget/udc-core.c:71: undefined reference to `dma_map_single'
 drivers/usb/gadget/udc-core.c:74: undefined reference to `dma_mapping_error'

 Signed-off-by: Geert Uytterhoeven ge...@linux-m68k.org
 ---
 This one is very debatable: probably the parts using the DMA API should
 be factored out, instead of disabling the whole USB gadget subsystem.

 Indeed.  How does this look instead?

 Alan Stern



 Index: usb-3.10/drivers/usb/gadget/udc-core.c
 ===
 --- usb-3.10.orig/drivers/usb/gadget/udc-core.c
 +++ usb-3.10/drivers/usb/gadget/udc-core.c
 @@ -50,6 +50,8 @@ static DEFINE_MUTEX(udc_lock);

  /* - 
 */

 +#ifdef CONFIG_HAS_DMA
 +
  int usb_gadget_map_request(struct usb_gadget *gadget,
 struct usb_request *req, int is_in)
  {
 @@ -99,6 +101,8 @@ void usb_gadget_unmap_request(struct usb
  }
  EXPORT_SYMBOL_GPL(usb_gadget_unmap_request);

 +#endif /* CONFIG_HAS_DMA */
 +
  /* - 
 */

  void usb_gadget_set_state(struct usb_gadget *gadget,
 @@ -194,9 +198,11 @@ int usb_add_gadget_udc_release(struct de
 dev_set_name(gadget-dev, gadget);
 gadget-dev.parent = parent;

 +#ifdef CONFIG_HAS_DMA
 dma_set_coherent_mask(gadget-dev, parent-coherent_dma_mask);
 gadget-dev.dma_parms = parent-dma_parms;
 gadget-dev.dma_mask = parent-dma_mask;
 +#endif

 if (release)
 gadget-dev.release = release;

Thanks, that works!

(after adding a few more dependencies on HAS_DMA for drivers that call
into usb_gadget_{,un}map_request() and/or dma_set_coherent_mask(),
for which I'll send separate patches).

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say programmer or something like that.
-- Linus Torvalds
--
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/RFC] usb: gadget: CONFIG_USB_S3C_HSOTG should depend on HAS_DMA

2014-05-06 Thread Geert Uytterhoeven
If NO_DMA=y:

drivers/built-in.o: In function `s3c_hsotg_map_dma':
s3c-hsotg.c:(.text+0x375b2c): undefined reference to `usb_gadget_map_request'
drivers/built-in.o: In function `s3c_hsotg_unmap_dma':
s3c-hsotg.c:(.text+0x376a32): undefined reference to `usb_gadget_unmap_request'
make[3]: *** [vmlinux] Error 1

Note that all callers of s3c_hsotg_map_dma()/s3c_hsotg_unmap_dma() are
protected by a call into the using_dma() checking function:

static inline bool using_dma(struct s3c_hsotg *hsotg)
{
return false;   /* support is not complete */
}

but not all versions of gcc manage to optimize the check away, causing a
link error.

Signed-off-by: Geert Uytterhoeven ge...@linux-m68k.org
---
Perhaps the DMA code should be removed completely, as its unused, or be
protected by #ifdef CONFIG_HAS_DMA instead?

 drivers/usb/gadget/Kconfig |1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig
index 3557c7e5040d..0e9dead51a27 100644
--- a/drivers/usb/gadget/Kconfig
+++ b/drivers/usb/gadget/Kconfig
@@ -302,6 +302,7 @@ config USB_PXA27X
 
 config USB_S3C_HSOTG
tristate Designware/S3C HS/OtG USB Device controller
+   depends on HAS_DMA
help
  The Designware USB2.0 high-speed gadget controller
  integrated into many SoCs.
-- 
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/RFC] usb: gadget: CONFIG_USB_S3C_HSOTG should depend on HAS_DMA

2014-05-06 Thread Geert Uytterhoeven
Hi David,

On Tue, May 6, 2014 at 3:17 PM, David Laight david.lai...@aculab.com wrote:
 If NO_DMA=y:

 drivers/built-in.o: In function `s3c_hsotg_map_dma':
 s3c-hsotg.c:(.text+0x375b2c): undefined reference to `usb_gadget_map_request'
 drivers/built-in.o: In function `s3c_hsotg_unmap_dma':
 s3c-hsotg.c:(.text+0x376a32): undefined reference to 
 `usb_gadget_unmap_request'
 make[3]: *** [vmlinux] Error 1

 Note that all callers of s3c_hsotg_map_dma()/s3c_hsotg_unmap_dma() are
 protected by a call into the using_dma() checking function:

 static inline bool using_dma(struct s3c_hsotg *hsotg)
 {
 return false;   /* support is not complete */
 }

 but not all versions of gcc manage to optimize the check away, causing a
 link error.

 A have seen gcc optimise away a call, but leave the undefined symbol
 in the symbol table.
 That might be what is happening here.

Indeed, the unused functions s3c_hsotg_{,un}map_dma() are still there,
but the calls to them have been optimized away.

Marking s3c_hsotg_{,un}map_dma() inline fixes that. I'll send a new patch
doing that, as it's a bit silly to require depends on HAS_DMA for a driver
which has DMA disabled.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say programmer or something like that.
-- Linus Torvalds
--
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: host: xhci-plat: add support for the R-Car H2 and M2 xHCI controllers

2014-05-19 Thread Geert Uytterhoeven
Hi Shimoda-san,

On Mon, May 19, 2014 at 12:08 PM, Yoshihiro Shimoda
yoshihiro.shimoda...@renesas.com wrote:
 The R-Car H2 and M2 SoCs come with an xHCI controller that requires
 some specific initilization related to the firmware downloading and
 some specific registers. This patch adds the support for this special
 configuration as an xHCI quirk executed during probe and start.

Thanks for your patch!

 diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig
 index 9247ad2..229e968 100644
 --- a/drivers/usb/host/Kconfig
 +++ b/drivers/usb/host/Kconfig
 @@ -37,6 +37,14 @@ config USB_XHCI_MVEBU
   Say 'Y' to enable the support for the xHCI host controller
   found in Marvell Armada 375/38x ARM SOCs.

 +config USB_XHCI_RCAR
 +   tristate xHCI support for Renesas R-Car SoCs
 +   select USB_XHCI_PLATFORM
 +   depends on ARCH_SHMOBILE || COMPILE_TEST
 +   ---help---
 + Say 'Y' to enable the support for the xHCI host controller
 + found in Renesas R-Car ARM SoCs.

Does R-Car Gen1 also have xHCI, and is it compatible?
If not, you may want to call this driver USB_XHCI_RCAR2.

 diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c
 index 561d07e..3a2da1f 100644
 --- a/drivers/usb/host/xhci-plat.c
 +++ b/drivers/usb/host/xhci-plat.c

 @@ -39,6 +40,12 @@ static int xhci_plat_setup(struct usb_hcd *hcd)

  static int xhci_plat_start(struct usb_hcd *hcd)
  {
 +   struct device_node *of_node = hcd-self.controller-of_node;
 +
 +   if (of_device_is_compatible(of_node, renesas,r8a7790-xhci) ||
 +   of_device_is_compatible(of_node, renesas,r8a7790-xhci))

r8a7791, as Magnus already pointed out.

 +   xhci_rcar_start(hcd);

If CONFIG_USB_XHCI_RCAR is not defined, xhci_rcar_start() is a dummy
function, but the of_device_is_compatible() checks will still be compiled in.

Hence perhaps an #ifdef CONFIG_USB_XHCI_RCAR is warranted here,
possibly combined with inclusion of a C-source file, like is done in
drivers/usb/host/ohci-hcd.c? It's up to the USB maintainer to decide this,
though.

 +
 return xhci_run(hcd);
  }

 @@ -165,6 +172,15 @@ static int xhci_plat_probe(struct platform_device *pdev)
 goto unmap_registers;
 }

 +   if (of_device_is_compatible(pdev-dev.of_node,
 +   renesas,r8a7790-xhci) ||
 +   of_device_is_compatible(pdev-dev.of_node,
 +   renesas,r8a7791-xhci)) {
 +   ret = xhci_rcar_init_quirk(pdev);

Same here.

 +   if (ret)
 +   goto disable_clk;
 +   }
 +
 ret = usb_add_hcd(hcd, irq, IRQF_SHARED);
 if (ret)
 goto disable_clk;

 --- /dev/null
 +++ b/drivers/usb/host/xhci-rcar.c

 +/* USB3.0 Configuraion */

Configuration

 +static int xhci_rcar_download_firmware(struct device *dev, void __iomem 
 *regs)
 +{
 +   const struct firmware *fw;
 +   int retval, index, j, time;
 +   int timeout = 1;
 +   u32 data, val, temp;
 +
 +   /* request R-Car USB3.0 firmware */
 +   retval = request_firmware(fw, FIRMWARE_NAME, dev);
 +   if (retval)
 +   return retval;
 +
 +   /* download R-Car USB3.0 firmware */
 +   temp = readl(regs + RCAR_USB3_DL_CTRL);
 +   temp |= RCAR_USB3_DL_CTRL_ENABLE;
 +   writel(temp, regs + RCAR_USB3_DL_CTRL);
 +
 +   for (index = 0; index  fw-size; index += 4) {
 +   for (data = 0, j = 3; j = 0; j--) {
 +   if ((j + index) = fw-size)
 +   continue;
 +   data |= fw-data[index + j]  (8 * j);
 +   }

This is your custom get_unaligned_le32(), to avoid reading beyond the end
of the buffer if its size is not a multiple of 4 bytes?
Is there some way to just use get_unaligned_le32()?

If you want to keep it, I would rewrite it as

  for (data = 0, j = 3; j = 0; j--) {
  if ((j + index)  fw-size)
  data |= fw-data[index + j]  (8 * j);
  }

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say programmer or something like that.
-- Linus Torval
--
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] Documentation: dt-bindings: update xhci-platform DT binding for R-Car H2 and M2

2014-05-19 Thread Geert Uytterhoeven
On Mon, May 19, 2014 at 12:08 PM, Yoshihiro Shimoda
yoshihiro.shimoda...@renesas.com wrote:
 This commit extends the compatible string list of the xhci-platform
 binding with the new renesas,r8a7790-xhci and renesas,r8a7791-xhci
 compatible strings. It is used to describe the xHCI controller which
 is available in the R-Car H2 and M2 SoCs.
 Signed-off-by: Yoshihiro Shimoda yoshihiro.shimoda...@renesas.com

Acked-by: Geert Uytterhoeven ge...@linux-m68k.org

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say programmer or something like that.
-- Linus Torvalds
--
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 1/3] usb: host: xhci-plat: add xhci_plat_start()

2014-05-19 Thread Geert Uytterhoeven
On Mon, May 19, 2014 at 12:07 PM, Yoshihiro Shimoda
yoshihiro.shimoda...@renesas.com wrote:
 Some platforms (such as the Renesas R-Car) need to initialize some specific
 registers after xhci driver calls usb_add_hcd() and before the driver calls
 xhci_run(). So, this patch adds the xhci_plat_start() function.

 Signed-off-by: Yoshihiro Shimoda yoshihiro.shimoda...@renesas.com

Acked-by: Geert Uytterhoeven ge...@linux-m68k.org

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say programmer or something like that.
-- Linus Torvalds
--
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: host: xhci-plat: add support for the R-Car H2 and M2 xHCI controllers

2014-05-20 Thread Geert Uytterhoeven
Hi Shimoda-san,

On Tue, May 20, 2014 at 11:35 AM, Yoshihiro Shimoda
yoshihiro.shimoda...@renesas.com wrote:
 (2014/05/19 20:58), Geert Uytterhoeven wrote:
 On Mon, May 19, 2014 at 12:08 PM, Yoshihiro Shimoda
 yoshihiro.shimoda...@renesas.com wrote:
  snip 
 +config USB_XHCI_RCAR
 +   tristate xHCI support for Renesas R-Car SoCs
 +   select USB_XHCI_PLATFORM
 +   depends on ARCH_SHMOBILE || COMPILE_TEST
 +   ---help---
 + Say 'Y' to enable the support for the xHCI host controller
 + found in Renesas R-Car ARM SoCs.

 Does R-Car Gen1 also have xHCI, and is it compatible?
 If not, you may want to call this driver USB_XHCI_RCAR2.

 R-Car Gen1 doesn't have xHCI.
 However, next generation of R-Car may have xHCI. (But, I don't know it is 
 compatible.)
 If we call this driver USB_XHCI_RCAR2, should we also change filename to 
 xhci-rcar2.[ch]?

Iff you change the config symbol, please also change the filename.

But given the uncertainty about future version, you can leave it like it is.

 +   xhci_rcar_start(hcd);

 If CONFIG_USB_XHCI_RCAR is not defined, xhci_rcar_start() is a dummy
 function, but the of_device_is_compatible() checks will still be compiled in.

 Hence perhaps an #ifdef CONFIG_USB_XHCI_RCAR is warranted here,
 possibly combined with inclusion of a C-source file, like is done in
 drivers/usb/host/ohci-hcd.c? It's up to the USB maintainer to decide this,
 though.

 This implementation is similar with the following patch. And the patch 
 already got
 Acked-by from Mathias Nyman of USB XHCI DRIVER's maintainer.

 http://marc.info/?l=linux-usbm=140014933101775w=2

Fine. It can be fixed later by the maintainer, when the driver has gained too
many compatible checks ;-)

 +   for (index = 0; index  fw-size; index += 4) {
 +   for (data = 0, j = 3; j = 0; j--) {
 +   if ((j + index) = fw-size)
 +   continue;
 +   data |= fw-data[index + j]  (8 * j);
 +   }

 This is your custom get_unaligned_le32(), to avoid reading beyond the end
 of the buffer if its size is not a multiple of 4 bytes?

 Yes, I would like to avoid it.

 Is there some way to just use get_unaligned_le32()?

 Yes, I will remove the custom get_unaligned_le32() and add the following code.
 Do you think that this code is good?

 int i;
 u32 data;
 u8 buf[4];
  snip 
 for (i = 0; i  fw-size; i += 4) {
 memset(buf, 0, sizeof(buf));
 memcpy(buf, fw-data[i], min(sizeof(buf), fw-size - i));
 data = get_unaligned_le32(buf);

I'm sorry, but IMHO this looks worse.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say programmer or something like that.
-- Linus Torvalds
--
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: [Celinux-dev] PDF documentation

2012-10-17 Thread Geert Uytterhoeven
On Thu, Oct 18, 2012 at 12:29 AM, Russell King - ARM Linux
li...@arm.linux.org.uk wrote:
 Consider also, from their point of view, the issue of documentation
 control.  Notice that most companies don't provide download links for
 old documentation...

Yep. That's why I archive all datasheets I can get my hands on. They will
disappear from the web.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say programmer or something like that.
-- Linus Torvalds
--
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: usb5303: make use of uninitialized err variable

2014-06-11 Thread Geert Uytterhoeven
On Mon, Jun 2, 2014 at 7:45 PM, Emil Goode emilgo...@gmail.com wrote:
 The variable err is not initialized here, this patch uses it
 to store an eventual error value from devm_clk_get().

 Signed-off-by: Emil Goode emilgo...@gmail.com

Acked-by: Geert Uytterhoeven ge...@linux-m68k.org

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say programmer or something like that.
-- Linus Torvalds
--
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: usb5303: make use of uninitialized err variable

2014-07-10 Thread Geert Uytterhoeven
Hi Greg,

On Thu, Jul 10, 2014 at 12:46 AM, Greg Kroah-Hartman
gre...@linuxfoundation.org wrote:
 On Mon, Jun 02, 2014 at 07:45:25PM +0200, Emil Goode wrote:
 The variable err is not initialized here, this patch uses it
 to store an eventual error value from devm_clk_get().

 Signed-off-by: Emil Goode emilgo...@gmail.com
 Acked-by: Geert Uytterhoeven ge...@linux-m68k.org
 ---
  drivers/usb/misc/usb3503.c |   10 +++---
  1 file changed, 7 insertions(+), 3 deletions(-)

 This patch fails to apply to my tree :(

You've already applied
commit ec5734c41bee2ee7c938a8f34853d31cada7e67a
Author: Tushar Behera tusha...@samsung.com
Date:   Tue Jun 17 16:38:50 2014 +0530

usb: misc: usb3503: Update error code in print message

'err' is uninitialized, rather print the error code directly.

which fixes it slightly different.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say programmer or something like that.
-- Linus Torvalds
--
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: gadget: USB_RENESAS_USBHS_UDC should depend on HAS_DMA

2014-08-29 Thread Geert Uytterhoeven
If NO_DMA=y:

drivers/built-in.o: In function `usbhsg_dma_map_ctrl':
mod_gadget.c:(.text+0x53b226): undefined reference to `usb_gadget_map_request'
mod_gadget.c:(.text+0x53b242): undefined reference to `usb_gadget_unmap_request'

Signed-off-by: Geert Uytterhoeven ge...@linux-m68k.org
---
 drivers/usb/gadget/udc/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/gadget/udc/Kconfig b/drivers/usb/gadget/udc/Kconfig
index 5151f947a4f5..00171d436cf8 100644
--- a/drivers/usb/gadget/udc/Kconfig
+++ b/drivers/usb/gadget/udc/Kconfig
@@ -163,7 +163,7 @@ config USB_R8A66597
 
 config USB_RENESAS_USBHS_UDC
tristate 'Renesas USBHS controller'
-   depends on USB_RENESAS_USBHS
+   depends on USB_RENESAS_USBHS  HAS_DMA
help
   Renesas USBHS is a discrete USB host and peripheral controller chip
   that supports both full and high speed USB 2.0 data transfers.
-- 
1.9.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: [PATCH v2] usb: renesas_usbhs: fix driver dependencies

2014-09-01 Thread Geert Uytterhoeven
On Mon, Sep 1, 2014 at 4:24 PM, Bartlomiej Zolnierkiewicz
b.zolnier...@samsung.com wrote:
 Renesas USBHS controller support should be available only on
 Renesas ARM SoCs and SuperH architecture.

 Signed-off-by: Bartlomiej Zolnierkiewicz b.zolnier...@samsung.com
 Acked-by: Kyungmin Park kyungmin.p...@samsung.com
 Cc: Simon Horman ho...@verge.net.au
 Cc: Magnus Damm magnus.d...@gmail.com
 ---
 v2:
 - s/ARCH_SH/SUPERH/ (thanks to Sergei Shtylyov)

Acked-by: Geert Uytterhoeven geert+rene...@glider.be

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say programmer or something like that.
-- Linus Torvalds
--
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: [GIT PULL] USB changes for v3.18 merge window

2014-09-29 Thread Geert Uytterhoeven
On Wed, Sep 17, 2014 at 7:56 PM, Felipe Balbi ba...@ti.com wrote:
 Andrzej Pietrasiewicz (23):
   usb: gadget: uvc: rename functions to avoid conflicts with host uvc

It seems not everything got renamed:

drivers/usb/gadget/function/uvc_v4l2.c:363:23: error:
'uvcg_v4l2_get_unmapped_area' undeclared here (not in a function)
make[5]: *** [drivers/usb/gadget/function/uvc_v4l2.o] Error 1

http://kisskb.ellerman.id.au/kisskb/buildresult/12028115/

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say programmer or something like that.
-- Linus Torvalds
--
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: gadget: USB_GADGET_XILINX should depend on HAS_DMA

2014-10-09 Thread Geert Uytterhoeven
If NO_DMA=y:

drivers/built-in.o: In function `xudc_done':
udc-xilinx.c:(.text+0x54f4d2): undefined reference to `usb_gadget_unmap_request'
drivers/built-in.o: In function `xudc_dma_send':
udc-xilinx.c:(.text+0x54f9f8): undefined reference to `dma_sync_single_for_cpu'
drivers/built-in.o: In function `xudc_read_fifo':
udc-xilinx.c:(.text+0x54ff4a): undefined reference to `dma_sync_single_for_cpu'
drivers/built-in.o: In function `xudc_ep_queue':
udc-xilinx.c:(.text+0x550e7c): undefined reference to `usb_gadget_map_request'

Signed-off-by: Geert Uytterhoeven ge...@linux-m68k.org
---
 drivers/usb/gadget/udc/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/usb/gadget/udc/Kconfig b/drivers/usb/gadget/udc/Kconfig
index 3ea287b0e448a1e5..217365d35a2523e6 100644
--- a/drivers/usb/gadget/udc/Kconfig
+++ b/drivers/usb/gadget/udc/Kconfig
@@ -357,6 +357,7 @@ config USB_EG20T
 
 config USB_GADGET_XILINX
tristate Xilinx USB Driver
+   depends on HAS_DMA
depends on OF || COMPILE_TEST
help
  USB peripheral controller driver for Xilinx USB2 device.
-- 
1.9.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: [PATCH] usb: host: xhci-plat: fix suspend/resume on xhci-rcar

2014-10-10 Thread Geert Uytterhoeven
On Thu, Oct 9, 2014 at 4:14 PM, Felipe Balbi ba...@ti.com wrote:
 On Thu, Oct 09, 2014 at 01:45:47PM +0900, Yoshihiro Shimoda wrote:
 This patch fixes an issue that suspend/resume cannot work correctly
 on xhci-rcar because the xhci driver output the following log:

 xhci-hcd ee00.usb: WARN: xHC CMD_RUN timeout

 So, this patch adds to set the XHCI_SLOW_SUSPEND quirk if xhci-rcar.

 do you have erratum number confirming this is needed for your platform ?
 We really don't want to enable quirks just because they help, we need to
 be sure HW is quirky. For example, we triggered the same thing on DRA7xx
 (which uses dwc3) but after digging a little, it seems like we're having
 memory access latency issues, not a problem with XHCI.

FWIW, xhci_handshake() runs a tight loop around udelay(1) for up to 16 ms
(160 ms when the quirk is enabled --- not counting loop overhead),
which looks like an area for improvement.

As the individual udelay() calls wait for only 1 us, the __bad_udelay()
sanity check Use only for very small delays (  2 msec) doesn't kick in.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say programmer or something like that.
-- Linus Torvalds
--
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/TRIVIAL 4/4] uwb: Remove bogus colon after newline from debug message

2014-10-23 Thread Geert Uytterhoeven
Signed-off-by: Geert Uytterhoeven geert+rene...@glider.be
Cc: linux-usb@vger.kernel.org
---
 drivers/uwb/rsv.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/uwb/rsv.c b/drivers/uwb/rsv.c
index 0887ae982783b7df..536ad42b0a4b1d7e 100644
--- a/drivers/uwb/rsv.c
+++ b/drivers/uwb/rsv.c
@@ -213,7 +213,7 @@ void uwb_rsv_backoff_win_timer(unsigned long arg)
bow-total_expired = 0;
bow-window = UWB_DRP_BACKOFF_WIN_MIN  1;
}
-   dev_dbg(dev, backoff_win_timer total_expired=%d, n=%d\n: , 
bow-total_expired, bow-n);
+   dev_dbg(dev, backoff_win_timer total_expired=%d, n=%d\n, 
bow-total_expired, bow-n);
 
/* try to relocate all the to be moved relocations */
uwb_rsv_handle_drp_avail_change(rc);
@@ -234,7 +234,7 @@ void uwb_rsv_backoff_win_increment(struct uwb_rc *rc)
 
bow-window = 1;
bow-n = prandom_u32()  (bow-window - 1);
-   dev_dbg(dev, new_window=%d, n=%d\n: , bow-window, bow-n);
+   dev_dbg(dev, new_window=%d, n=%d\n, bow-window, bow-n);
 
/* reset the timer associated variables */
timeout_us = bow-n * UWB_SUPERFRAME_LENGTH_US;
-- 
1.9.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: [PATCH] extcon: add MAX3355 driver

2014-12-11 Thread Geert Uytterhoeven
On Thu, Dec 11, 2014 at 2:46 AM, Chanwoo Choi cw00.c...@samsung.com wrote:
 Could you send the datasheet of MAX3355E to me?

First Google hit:
http://datasheets.maximintegrated.com/en/ds/MAX3355E.pdf

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say programmer or something like that.
-- Linus Torvalds
--
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: usb: gadget: hid: add configfs support

2014-12-15 Thread Geert Uytterhoeven
On Mon, Dec 15, 2014 at 12:06 AM, Linux Kernel Mailing List
linux-ker...@vger.kernel.org wrote:
 Gitweb: 
 http://git.kernel.org/linus/;a=commit;h=21a9476a7ba847e413bf1c144d7c614532aed6dd
 Commit: 21a9476a7ba847e413bf1c144d7c614532aed6dd
 Parent: 5ca8d3ec9970f4798e68bd21a9d44db3d0ff4da7
 Refname:refs/heads/master
 Author: Andrzej Pietrasiewicz andrze...@samsung.com
 AuthorDate: Thu Nov 6 11:12:03 2014 +0100
 Committer:  Felipe Balbi ba...@ti.com
 CommitDate: Thu Nov 6 16:18:19 2014 -0600

 usb: gadget: hid: add configfs support

 Make the hid function available for gadgets composed with configfs.


 --- a/drivers/usb/gadget/function/f_hid.c
 +++ b/drivers/usb/gadget/function/f_hid.c

 +
 +#define F_HID_OPT(name, prec, limit)   \
 +static ssize_t f_hid_opts_##name##_show(struct f_hid_opts *opts, char *page)\
 +{  \
 +   int result; \
 +   \
 +   mutex_lock(opts-lock);\
 +   result = sprintf(page, %d\n, opts-name); \
 +   mutex_unlock(opts-lock);  \
 +   \
 +   return result;  \
 +}  \
 +   \
 +static ssize_t f_hid_opts_##name##_store(struct f_hid_opts *opts,  \
 +const char *page, size_t len)  \
 +{  \
 +   int ret;\
 +   u##prec num;\
 +   \
 +   mutex_lock(opts-lock);\
 +   if (opts-refcnt) { \
 +   ret = -EBUSY;   \
 +   goto end;   \
 +   }   \
 +   \
 +   ret = kstrtou##prec(page, 0, num); \
 +   if (ret)\
 +   goto end;   \
 +   \
 +   if (num  limit) {  \
 +   ret = -EINVAL;  \
 +   goto end;   \
 +   }   \
 +   opts-name = num;   \
 +   ret = len;  \
 +   \
 +end:   \
 +   mutex_unlock(opts-lock);  \
 +   return ret; \
 +}  \
 +   \
 +static struct f_hid_opts_attribute f_hid_opts_##name = \
 +   __CONFIGFS_ATTR(name, S_IRUGO | S_IWUSR, f_hid_opts_##name##_show,\
 +   f_hid_opts_##name##_store)
 +
 +F_HID_OPT(subclass, 8, 255);
 +F_HID_OPT(protocol, 8, 255);
 +F_HID_OPT(report_length, 16, 65536);

While all three of the above lines trigger a (false positive) compiler warning:

warning: comparison is always false due to limited range of data type

it's a bit sloppy to use 2^8-1 for the first two limits, and 2^16
(without -1) for
the third limit.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say programmer or something like that.
-- Linus Torvalds
--
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: hid: consistently use 2^n - 1 for max values

2014-12-15 Thread Geert Uytterhoeven
On Mon, Dec 15, 2014 at 1:50 PM, Andrzej Pietrasiewicz
andrze...@samsung.com wrote:
 A maximum value which fits in 16 bits, unsigned, is 65535.

 Signed-off-by: Andrzej Pietrasiewicz andrze...@samsung.com

Acked-by: Geert Uytterhoeven ge...@linux-m68k.org

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say programmer or something like that.
-- Linus Torvalds
--
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 4/4] PM: Eliminate CONFIG_PM_RUNTIME

2014-12-19 Thread Geert Uytterhoeven
On Fri, Dec 19, 2014 at 3:03 AM, Rafael J. Wysocki r...@rjwysocki.net wrote:
 --- linux-pm.orig/arch/mips/configs/lemote2f_defconfig
 +++ linux-pm/arch/mips/configs/lemote2f_defconfig
 @@ -37,7 +37,7 @@ CONFIG_MIPS32_N32=y
  CONFIG_PM=y
  ^^^
  CONFIG_HIBERNATION=y
  CONFIG_PM_STD_PARTITION=/dev/hda3
 -CONFIG_PM_RUNTIME=y
 +CONFIG_PM=y
   ^^^
Now we have two of them

  CONFIG_CPU_FREQ=y
  CONFIG_CPU_FREQ_DEBUG=y
  CONFIG_CPU_FREQ_STAT=m

Other defconfig files may be affected, too.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say programmer or something like that.
-- Linus Torvalds
--
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] renesas_usbhs: fix platform init error message

2015-01-05 Thread Geert Uytterhoeven
Hi Shimoda-san,

On Wed, Dec 24, 2014 at 11:02 AM, yoshihiro shimoda
yoshihiro.shimoda...@renesas.com wrote:
   Er, OK. Could you update MAINTAINERS?
  there is no entry for renesas driver in MAINTAINERS.
  Shimoda-san, care to send a patch adding yourself or Morimoto-san as
  maintainers for Renesas driver and pointing to my tree in kernel.org ?

 By the way, about a renesas_usbhs maintainer, I don't know clearly.
 If I do as a renesas_usbhs maintainer:
 - what should I do as the maintainer?
  - I think I should check patches of renesas_usbhs
  - And, do I just return  ACK or NACK to the patches?

As a maintainer, you review all patches for renesas_usbhs, and of these patches
will have to go through you.
There are three ways to achieve that:
  1. You collect all accepted patches, and forward them to GregKH with your
 Signed-off-by added,
  2. You collect all accepted ls -lpatches, publish them in a git tree, and
 ask GregKH to pull a branch or tag from your git tree,
  3. You ack all accepted patches, so GregKH knows which patches to apply.

Which way to choose depends on the volume of patches.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say programmer or something like that.
-- Linus Torvalds
--
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 1/4] usb: renesas_usbhs: fix spinlock recursion by usbhsf_dma_complete()

2015-02-10 Thread Geert Uytterhoeven
Hi Shimoda-san,

On Mon, Feb 9, 2015 at 9:16 AM, Yoshihiro Shimoda
yoshihiro.shimoda...@renesas.com wrote:
 The usbhsf_pkt_handler(pipe, USBHSF_PKT_DMA_DONE) in usbhsf_dma_complete()
 will call the complete function of a usb gadget driver finally.
 According to the gadget.h, The function will always be called with
 interrupts disabled.

 So, this patch adds a local_irq_save/local_irq_restore in the
 usbhsf_dma_complete() because a dmaengine driver may call this
 callback function when interrupts enabled (e.g. in tasklet).

 Signed-off-by: Yoshihiro Shimoda yoshihiro.shimoda...@renesas.com
 ---
  drivers/usb/renesas_usbhs/fifo.c |3 +++
  1 file changed, 3 insertions(+)

 diff --git a/drivers/usb/renesas_usbhs/fifo.c 
 b/drivers/usb/renesas_usbhs/fifo.c
 index d891bff..b1440d0 100644
 --- a/drivers/usb/renesas_usbhs/fifo.c
 +++ b/drivers/usb/renesas_usbhs/fifo.c
 @@ -1165,11 +1165,14 @@ static void usbhsf_dma_complete(void *arg)
 struct usbhs_priv *priv = usbhs_pipe_to_priv(pipe);
 struct device *dev = usbhs_priv_to_dev(priv);
 int ret;
 +   unsigned long flags;

 +   local_irq_save(flags);

Adding local_irq_save() without a spinlock is usually not correct.
I'm a bit confused here. usbhsf_pkt_handler() itself calls

usbhs_lock(priv, flags);

which is actually

spin_lock_irqsave(usbhs_priv_to_lock(priv), flags)

so it does disable interrupts internally?

Or is this about protecting the call to

pkt-done(priv, pkt);

at the end of usbhsf_pkt_handler(), which is done after releasing the
spinlock?

Still, that would need some better protection, as local_irq_save() disables
interrupts only on the CPU it's running on, not on other CPUs in a
multiprocessor system.

 ret = usbhsf_pkt_handler(pipe, USBHSF_PKT_DMA_DONE);
 if (ret  0)
 dev_err(dev, dma_complete run_error %d : %d\n,
 usbhs_pipe_number(pipe), ret);
 +   local_irq_restore(flags);
  }

  void usbhs_fifo_clear_dcp(struct usbhs_pipe *pipe)
 --
 1.7.9.5

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say programmer or something like that.
-- Linus Torvalds
--
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 4/4] usb: renesas_usbhs: add support for USB-DMAC

2015-02-10 Thread Geert Uytterhoeven
Hi Shimoda-san,

On Mon, Feb 9, 2015 at 9:16 AM, Yoshihiro Shimoda
yoshihiro.shimoda...@renesas.com wrote:
 Some Renesas SoCs have the USB-DMAC. It is able to terminate transfers
 when a short packet is received, even if less bytes than the transfer
 counter size have been received. Also, it is able to send a short
 packet even if the packet size is not multiples of 8bytes.

 Since the previous code has used the interruption of USBHS controller
 when receiving packets even if this driver has used a dmac, a lot of
 interruptions has happened. This patch will reduce such interruptions.

 This patch allows to use the USB-DMAC on R-Car H2 and M2.

 Signed-off-by: Yoshihiro Shimoda yoshihiro.shimoda...@renesas.com

 --- a/drivers/usb/renesas_usbhs/common.c
 +++ b/drivers/usb/renesas_usbhs/common.c

 @@ -487,6 +497,15 @@ static struct renesas_usbhs_platform_info 
 *usbhs_parse_dt(struct device *dev)
 if (gpio  0)
 dparam-enable_gpio = gpio;

 +   switch (dparam-type) {
 +   case USBHS_TYPE_R8A7790:
 +   case USBHS_TYPE_R8A7791:
 +   dparam-has_usb_dmac = 1;
 +   break;
 +   default:
 +   break;
 +   }
 +
 return info;
  }

  struct usbhs_priv *usbhs_pdev_to_priv(struct platform_device *pdev);
 diff --git a/drivers/usb/renesas_usbhs/fifo.c 
 b/drivers/usb/renesas_usbhs/fifo.c
 index 3b77a1b..1e7dc6e 100644
 --- a/drivers/usb/renesas_usbhs/fifo.c
 +++ b/drivers/usb/renesas_usbhs/fifo.c

 @@ -847,10 +849,13 @@ static int usbhsf_dma_prepare_push(struct usbhs_pkt 
 *pkt, int *is_done)
 usbhs_pipe_is_dcp(pipe))
 goto usbhsf_pio_prepare_push;

 -   if (len  0x7) /* 8byte alignment */
 +   /* default: 8byte alignment */
 +   if (!usbhs_get_dparam(priv, has_usb_dmac)  len  0x7)
 goto usbhsf_pio_prepare_push;

So the has_usb_dmac flags indicates that DMA addresses are not limited to
8-byte alignment.

Can't this be handled by looking at a dma_mask, as set by the DMAC?

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say programmer or something like that.
-- Linus Torvalds
--
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 1/4] usb: renesas_usbhs: fix spinlock suspected in a gadget complete function

2015-02-16 Thread Geert Uytterhoeven
Hi Shimoda-san,

On Mon, Feb 16, 2015 at 2:52 AM, Yoshihiro Shimoda
yoshihiro.shimoda...@renesas.com wrote:
 According to the gadget.h, a complete function will always be called
 with interrupts disabled. However, sometimes usbhsg_queue_pop() function
 is called with interrupts enabled. So, this function should calls
 local_irq_save() before this calls the usb_gadget_giveback_request().
 Otherwise, there is possible to cause a spinlock suspected in a gadget
 complete function.

I still feel uneasy about adding the call to local_irq_save(), as the need for
this is usually an indicator of another locking problem.

Unfortunately I know next to nothing about the USB gadget subsystem, so some
help from the USB gadget experts would be appreciated.

I had a look at other drivers, and it seems most drivers actually release
and reacquire a spinlock around the call to usb_gadget_giveback_request(),
i.e. they do:

spin_unlock(...);
usb_gadget_giveback_request(...);
spin_lock();

This means they had already acquired the spinlock (and disabled interrupts!)
before, which looks much healthier to me.

There's only one driver that uses local_irq_save() (pxa27x_udc).

 Signed-off-by: Yoshihiro Shimoda yoshihiro.shimoda...@renesas.com
 ---
  drivers/usb/renesas_usbhs/mod_gadget.c |   11 +++
  1 file changed, 11 insertions(+)

 diff --git a/drivers/usb/renesas_usbhs/mod_gadget.c 
 b/drivers/usb/renesas_usbhs/mod_gadget.c
 index e0384af..104bddf 100644
 --- a/drivers/usb/renesas_usbhs/mod_gadget.c
 +++ b/drivers/usb/renesas_usbhs/mod_gadget.c
 @@ -126,11 +126,22 @@ static void usbhsg_queue_pop(struct usbhsg_uep *uep,
 struct usbhsg_gpriv *gpriv = usbhsg_uep_to_gpriv(uep);
 struct usbhs_pipe *pipe = usbhsg_uep_to_pipe(uep);
 struct device *dev = usbhsg_gpriv_to_dev(gpriv);
 +   unsigned long flags;

 dev_dbg(dev, pipe %d : queue pop\n, usbhs_pipe_number(pipe));

 ureq-req.status = status;
 +   /*
 +* According to the gadget.h, a complete function will always be
 +* called with interrupts disabled. However, sometimes this function
 +* is called with interrupts enabled. (e.g. complete a DMAC transfer 
 or
 +* write data and done is set immediately when PIO.) So, this function
 +* should calls local_irq_save() before this calls the
 +* usb_gadget_giveback_request().
 +*/
 +   local_irq_save(flags);
 usb_gadget_giveback_request(uep-ep, ureq-req);
 +   local_irq_restore(flags);
  }

  static void usbhsg_queue_done(struct usbhs_priv *priv, struct usbhs_pkt *pkt)

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say programmer or something like that.
-- Linus Torvalds
--
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: renesas_usbhs: fix NULL pointer dereference in dma_release_channel()

2015-01-30 Thread Geert Uytterhoeven
Hi Shimoda-san,

On Fri, Jan 30, 2015 at 7:58 AM, Yoshihiro Shimoda
yoshihiro.shimoda...@renesas.com wrote:
 This patch fixes an issue that the following commit causes NULL
 pointer dereference in dma_release_channel().
  usb: renesas_usbhs: add support for requesting DT DMA
  (commit id abd2dbf6bb1b5f3a03a8c76b1a8879da1dd30caa)

Thanks for your patch!

 The usbhsf_dma_init_dt() should set fifo-{t,r}x_chan to NULL if
 dma_request_slave_channel_reason() returns IS_ERR value.
 Otherwise, usbhsf_dma_quit() will call dma_release_channel(), and then
 NULL pointer dereference happens.

I guess it also causes other problems?
The return value of usbhsf_dma_chan_get() is not checked for an error
code in many callsites.

 Reported-by: Simon Horman ho...@verge.net.au
 Signed-off-by: Yoshihiro Shimoda yoshihiro.shimoda...@renesas.com

Acked-by: Geert Uytterhoeven ge...@linux-m68k.org

 ---
 This patch is based on Felipe's usb.git / testing/next branch.
 (commit id =7db3990cb707ff91cd6507d53a0a730afe97)

  drivers/usb/renesas_usbhs/fifo.c |4 
  1 file changed, 4 insertions(+)

 diff --git a/drivers/usb/renesas_usbhs/fifo.c 
 b/drivers/usb/renesas_usbhs/fifo.c
 index 4c086b1..d891bff 100644
 --- a/drivers/usb/renesas_usbhs/fifo.c
 +++ b/drivers/usb/renesas_usbhs/fifo.c
 @@ -1072,7 +1072,11 @@ static void usbhsf_dma_init_pdev(struct usbhs_fifo 
 *fifo)
  static void usbhsf_dma_init_dt(struct device *dev, struct usbhs_fifo *fifo)
  {
 fifo-tx_chan = dma_request_slave_channel_reason(dev, tx);
 +   if (IS_ERR(fifo-tx_chan))
 +   fifo-tx_chan = NULL;
 fifo-rx_chan = dma_request_slave_channel_reason(dev, rx);
 +   if (IS_ERR(fifo-rx_chan))
 +   fifo-rx_chan = NULL;
  }

My first thought was: shouldn't it be handled in usbhsf_dma_init() instead,
so it applies to both the legacy platform data and the DT case?

But apparently dma_request_channel() returns NULL on failure, while
dma_request_slave_channel_reason() returns an error code. Oh well...

Remapping the error to NULL does mean the driver doesn't handle
-EPROBE_DEFER, but that's tricky with DMA engines anyway, cfr. commit
55f5f9862a31e2ac (i2c: sh_mobile: rework deferred probing)

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say programmer or something like that.
-- Linus Torvalds
--
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: phy: Remove the phy-rcar-gen2-usb driver

2015-04-28 Thread Geert Uytterhoeven
The phy-rcar-gen2-usb driver, which supports legacy platform data only,
is no longer used since commit a483dcbfa21f919c (ARM: shmobile: lager:
Remove legacy board support).

This driver was superseded by the DT-only phy-rcar-gen2 driver, which
was introduced in commit 1233f59f745b237d (phy: Renesas R-Car Gen2 PHY
driver).

Signed-off-by: Geert Uytterhoeven geert+rene...@glider.be
---
 drivers/usb/phy/Kconfig |  13 --
 drivers/usb/phy/Makefile|   1 -
 drivers/usb/phy/phy-rcar-gen2-usb.c | 246 
 include/linux/platform_data/usb-rcar-gen2-phy.h |  22 ---
 4 files changed, 282 deletions(-)
 delete mode 100644 drivers/usb/phy/phy-rcar-gen2-usb.c
 delete mode 100644 include/linux/platform_data/usb-rcar-gen2-phy.h

diff --git a/drivers/usb/phy/Kconfig b/drivers/usb/phy/Kconfig
index 2175678e674ebf44..3cd3bee54ca6f9b3 100644
--- a/drivers/usb/phy/Kconfig
+++ b/drivers/usb/phy/Kconfig
@@ -186,19 +186,6 @@ config USB_RCAR_PHY
  To compile this driver as a module, choose M here: the
  module will be called phy-rcar-usb.
 
-config USB_RCAR_GEN2_PHY
-   tristate Renesas R-Car Gen2 USB PHY support
-   depends on ARCH_R8A7790 || ARCH_R8A7791 || COMPILE_TEST
-   select USB_PHY
-   help
- Say Y here to add support for the Renesas R-Car Gen2 USB PHY driver.
- It is typically used to control internal USB PHY for USBHS,
- and to configure shared USB channels 0 and 2.
- This driver supports R8A7790 and R8A7791.
-
- To compile this driver as a module, choose M here: the
- module will be called phy-rcar-gen2-usb.
-
 config USB_ULPI
bool Generic ULPI Transceiver Driver
depends on ARM || ARM64
diff --git a/drivers/usb/phy/Makefile b/drivers/usb/phy/Makefile
index 75f2bba58c84c9d4..e36ab1d46d8b4fed 100644
--- a/drivers/usb/phy/Makefile
+++ b/drivers/usb/phy/Makefile
@@ -23,7 +23,6 @@ obj-$(CONFIG_USB_MSM_OTG) += phy-msm-usb.o
 obj-$(CONFIG_USB_MV_OTG)   += phy-mv-usb.o
 obj-$(CONFIG_USB_MXS_PHY)  += phy-mxs-usb.o
 obj-$(CONFIG_USB_RCAR_PHY) += phy-rcar-usb.o
-obj-$(CONFIG_USB_RCAR_GEN2_PHY)+= phy-rcar-gen2-usb.o
 obj-$(CONFIG_USB_ULPI) += phy-ulpi.o
 obj-$(CONFIG_USB_ULPI_VIEWPORT)+= phy-ulpi-viewport.o
 obj-$(CONFIG_KEYSTONE_USB_PHY) += phy-keystone.o
diff --git a/drivers/usb/phy/phy-rcar-gen2-usb.c 
b/drivers/usb/phy/phy-rcar-gen2-usb.c
deleted file mode 100644
index f81800b6562a46a8..
--- a/drivers/usb/phy/phy-rcar-gen2-usb.c
+++ /dev/null
@@ -1,246 +0,0 @@
-/*
- * Renesas R-Car Gen2 USB phy driver
- *
- * Copyright (C) 2013 Renesas Solutions Corp.
- * Copyright (C) 2013 Cogent Embedded, Inc.
- *
- * 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.
- */
-
-#include linux/clk.h
-#include linux/delay.h
-#include linux/io.h
-#include linux/module.h
-#include linux/platform_data/usb-rcar-gen2-phy.h
-#include linux/platform_device.h
-#include linux/spinlock.h
-#include linux/usb/otg.h
-
-struct rcar_gen2_usb_phy_priv {
-   struct usb_phy phy;
-   void __iomem *base;
-   struct clk *clk;
-   spinlock_t lock;
-   int usecount;
-   u32 ugctrl2;
-};
-
-#define usb_phy_to_priv(p) container_of(p, struct rcar_gen2_usb_phy_priv, phy)
-
-/* Low Power Status register */
-#define USBHS_LPSTS_REG0x02
-#define USBHS_LPSTS_SUSPM  (1  14)
-
-/* USB General control register */
-#define USBHS_UGCTRL_REG   0x80
-#define USBHS_UGCTRL_CONNECT   (1  2)
-#define USBHS_UGCTRL_PLLRESET  (1  0)
-
-/* USB General control register 2 */
-#define USBHS_UGCTRL2_REG  0x84
-#define USBHS_UGCTRL2_USB0_PCI (1  4)
-#define USBHS_UGCTRL2_USB0_HS  (3  4)
-#define USBHS_UGCTRL2_USB2_PCI (0  31)
-#define USBHS_UGCTRL2_USB2_SS  (1  31)
-
-/* USB General status register */
-#define USBHS_UGSTS_REG0x88
-#define USBHS_UGSTS_LOCK   (1  8)
-
-/* Enable USBHS internal phy */
-static int __rcar_gen2_usbhs_phy_enable(void __iomem *base)
-{
-   u32 val;
-   int i;
-
-   /* USBHS PHY power on */
-   val = ioread32(base + USBHS_UGCTRL_REG);
-   val = ~USBHS_UGCTRL_PLLRESET;
-   iowrite32(val, base + USBHS_UGCTRL_REG);
-
-   val = ioread16(base + USBHS_LPSTS_REG);
-   val |= USBHS_LPSTS_SUSPM;
-   iowrite16(val, base + USBHS_LPSTS_REG);
-
-   for (i = 0; i  20; i++) {
-   val = ioread32(base + USBHS_UGSTS_REG);
-   if ((val  USBHS_UGSTS_LOCK) == USBHS_UGSTS_LOCK) {
-   val = ioread32(base + USBHS_UGCTRL_REG);
-   val |= USBHS_UGCTRL_CONNECT;
-   iowrite32(val, base

Re: [PATCH] usb: phy: rcar-gen2-usb: Fix USBHS_UGSTS_LOCK value

2015-04-28 Thread Geert Uytterhoeven
Hi Shimoda-san,

On Tue, Apr 28, 2015 at 12:25 PM, Yoshihiro Shimoda
yoshihiro.shimoda...@renesas.com wrote:
 Sent: Tuesday, April 28, 2015 6:55 PM
 On Tue, Apr 28, 2015 at 3:36 AM, Yoshihiro Shimoda
 yoshihiro.shimoda...@renesas.com wrote:
  Sent: Tuesday, April 28, 2015 4:45 AM
  On Thu, Apr 02, 2015 at 08:22:34PM +0900, Yoshihiro Shimoda wrote:
   According to the technical update (No. TN-RCS-B011A/E), the UGSTS LOCK
   bit location is bit 8, not bits 9 and 8. So, this patch fixes the
   USBHS_UGSTS_LOCK value.
  
   Signed-off-by: Yoshihiro Shimoda yoshihiro.shimoda...@renesas.com
 
  this doesn't apply to v4.1-rc1, if it's still needed, please rebase.
 
  Thank you for the notice. I found that this patch has been already merged 
  in v4.1-rc1 by Greg.

 drivers/usb/phy/phy-rcar-gen2-usb.c (which supports legacy platform data 
 only)
 is unused since commit a483dcbfa21f919c (ARM: shmobile: lager: Remove
 legacy board support).

 It's my understanding this driver has been replaced by a new driver, which
 supports DT only (drivers/phy/phy-rcar-gen2.c).

 Yes. You are correct.

 That driver still has the wrong value:
 #define USBHS_UGSTS_LOCK0x0300 /* The manuals have 0x3 */

 So:
   1) Shouldn't drivers/phy/phy-rcar-gen2.c be fixed?

 I already submitted such a patch. However, the patch is not merged yet.
 (I should have sent a ping or something about this patch.)
 http://thread.gmane.org/gmane.linux.ports.sh.devel/45089

Right. Sorry, I forgot about that patch.

   2) Shouldn't drivers/usb/phy/phy-rcar-gen2-usb.c et al be removed?

 We should remove this code because legacy board codes were already removed.
 (In other words, nobody uses this code now.)

I'll remove it, while you can enjoy Golden Week...

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say programmer or something like that.
-- Linus Torvalds
--
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: phy: Remove the phy-rcar-gen2-usb driver

2015-04-28 Thread Geert Uytterhoeven
Hi Felipe,

On Tue, Apr 28, 2015 at 6:50 PM, Felipe Balbi ba...@ti.com wrote:
 On Tue, Apr 28, 2015 at 02:04:07PM +0200, Geert Uytterhoeven wrote:
 The phy-rcar-gen2-usb driver, which supports legacy platform data only,
 is no longer used since commit a483dcbfa21f919c (ARM: shmobile: lager:
 Remove legacy board support).

 This driver was superseded by the DT-only phy-rcar-gen2 driver, which
 was introduced in commit 1233f59f745b237d (phy: Renesas R-Car Gen2 PHY
 driver).

 Signed-off-by: Geert Uytterhoeven geert+rene...@glider.be
 ---
  drivers/usb/phy/Kconfig |  13 --
  drivers/usb/phy/Makefile|   1 -
  drivers/usb/phy/phy-rcar-gen2-usb.c | 246 
 
  include/linux/platform_data/usb-rcar-gen2-phy.h |  22 ---
  4 files changed, 282 deletions(-)
  delete mode 100644 drivers/usb/phy/phy-rcar-gen2-usb.c
  delete mode 100644 include/linux/platform_data/usb-rcar-gen2-phy.h

 diff --git a/drivers/usb/phy/Kconfig b/drivers/usb/phy/Kconfig
 index 2175678e674ebf44..3cd3bee54ca6f9b3 100644
 --- a/drivers/usb/phy/Kconfig
 +++ b/drivers/usb/phy/Kconfig
 @@ -186,19 +186,6 @@ config USB_RCAR_PHY
 To compile this driver as a module, choose M here: the
 module will be called phy-rcar-usb.

 -config USB_RCAR_GEN2_PHY

 $ git grep -e USB_RCAR_GEN2_PHY
 arch/arm/configs/multi_v7_defconfig:448:CONFIG_USB_RCAR_GEN2_PHY=m
 arch/arm/configs/shmobile_defconfig:163:CONFIG_USB_RCAR_GEN2_PHY=y

 Are you sending patches to fix both defconfigs ?

http://www.spinics.net/lists/arm-kernel/msg414542.html
http://www.spinics.net/lists/arm-kernel/msg414543.html

The driver doesn't work anyway in these (DT-only) configs, as it supports
platform data only.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say programmer or something like that.
-- Linus Torvalds
--
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: phy: rcar-gen2-usb: Fix USBHS_UGSTS_LOCK value

2015-04-28 Thread Geert Uytterhoeven
Hi Shimoda-san,

On Tue, Apr 28, 2015 at 3:36 AM, Yoshihiro Shimoda
yoshihiro.shimoda...@renesas.com wrote:
 Sent: Tuesday, April 28, 2015 4:45 AM
 On Thu, Apr 02, 2015 at 08:22:34PM +0900, Yoshihiro Shimoda wrote:
  According to the technical update (No. TN-RCS-B011A/E), the UGSTS LOCK
  bit location is bit 8, not bits 9 and 8. So, this patch fixes the
  USBHS_UGSTS_LOCK value.
 
  Signed-off-by: Yoshihiro Shimoda yoshihiro.shimoda...@renesas.com

 this doesn't apply to v4.1-rc1, if it's still needed, please rebase.

 Thank you for the notice. I found that this patch has been already merged in 
 v4.1-rc1 by Greg.

drivers/usb/phy/phy-rcar-gen2-usb.c (which supports legacy platform data only)
is unused since commit a483dcbfa21f919c (ARM: shmobile: lager: Remove
legacy board support).

It's my understanding this driver has been replaced by a new driver, which
supports DT only (drivers/phy/phy-rcar-gen2.c).
That driver still has the wrong value:
#define USBHS_UGSTS_LOCK0x0300 /* The manuals have 0x3 */

So:
  1) Shouldn't drivers/phy/phy-rcar-gen2.c be fixed?
  2) Shouldn't drivers/usb/phy/phy-rcar-gen2-usb.c et al be removed?

Thanks!

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say programmer or something like that.
-- Linus Torvalds
--
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: renesas_usbhs: Add support for R-Car E2

2015-05-18 Thread Geert Uytterhoeven
On Mon, May 18, 2015 at 1:04 PM, Yoshihiro Shimoda
yoshihiro.shimoda...@renesas.com wrote:
 This patch adds a compatible string to support for R-Car E2.

 Signed-off-by: Yoshihiro Shimoda yoshihiro.shimoda...@renesas.com
 Acked-by: Geert Uytterhoeven geert+rene...@glider.be in patch 2
 ---
  Remarks: Geert's Acked-by is for the DT binding part (renesas_usbhs.txt).

For the remaining part:
Acked-by: Geert Uytterhoeven geert+rene...@glider.be

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say programmer or something like that.
-- Linus Torvalds
--
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: renesas_usbhs: Revise the binding document about the dma-names

2015-04-09 Thread Geert Uytterhoeven
On Wed, Apr 8, 2015 at 12:42 PM, Yoshihiro Shimoda
yoshihiro.shimoda...@renesas.com wrote:
 Since the DT should describe the hardware (not the driver limitation),
 This patch revises the binding document about the dma-names to change
 simple numbering as ch%d instead of txn and rxn.

 Also this patch fixes the actual code of renesas_usbhs driver to handle
 the new dma-names.

 Signed-off-by: Yoshihiro Shimoda yoshihiro.shimoda...@renesas.com

Acked-by: Geert Uytterhoeven geert+rene...@glider.be

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say programmer or something like that.
-- Linus Torvalds
--
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] usb: phy: msm: Add D+/D- lines route control

2015-08-03 Thread Geert Uytterhoeven
On Tue, Jul 28, 2015 at 10:10 AM, Ivan T. Ivanov ivan.iva...@linaro.org wrote:
 --- a/Documentation/devicetree/bindings/usb/msm-hsusb.txt
 +++ b/Documentation/devicetree/bindings/usb/msm-hsusb.txt
 @@ -52,6 +52,10 @@ Required properties:
  Optional properties:
  - dr_mode:  One of host, peripheral or otg. Defaults to otg

 +- switch-gpio:  A phandle + gpio-specifier pair. Some boards are using Dual
 +SPDT USB Switch, witch is cotrolled by GPIO to de/multiplex

which is controlled

 +D+/D- USB lines between connectors.
 +
  - qcom,phy-init-sequence: PHY configuration sequence values. This is related 
 to Device
  Mode Eye Diagram test. Start address at which these values 
 will be
  written is ULPI_EXT_VENDOR_SPECIFIC. Value of -1 is reserved 
 as

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say programmer or something like that.
-- Linus Torvalds
--
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/RFC] usb: gadget: udc: core: Fix argument of dma_map_single for IOMMU

2015-07-13 Thread Geert Uytterhoeven
Hi Greg,

On Mon, Jul 13, 2015 at 6:19 PM, Greg KH gre...@linuxfoundation.org wrote:
 On Mon, Jul 13, 2015 at 06:10:05PM +0900, Yoshihiro Shimoda wrote:
 The dma_map_single and dma_unmap_single should set gadget-dev.parent
 instead of gadget-dev in the first argument because the parent has
 a udc controller's device pointer.
 Otherwise, iommu functions are not called in ARM environment.

 Signed-off-by: Yoshihiro Shimoda yoshihiro.shimoda...@renesas.com
 ---
  This patch is based on the Felipe's usb.git / testing/next branch.
  commit id = 298623983e74d935fc241d0eb1d0740cf4c32599

 Why send something that has already been accepted into Felipe's tree?

That commit ID does not refer to Shimoda-san's patch, but to the HEAD of
Felipe's testing/next branch.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say programmer or something like that.
-- Linus Torvalds
--
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: [GIT PULL] On-demand device probing

2015-10-24 Thread Geert Uytterhoeven
On Thu, Oct 22, 2015 at 8:53 PM, Frank Rowand <frowand.l...@gmail.com> wrote:
> I have been defaulting to the position that has been asserted by
> the device tree maintainters, that probe deferrals work just fine
> for at least the majority of cases (and is the message I have been
> sharing in my conference presentations about device tree).  But I
> suspect that there is at least a small minority of cases that are not
> well served by probe deferral.  (Not to be read as an endorsement of
> this specific patch series, just a generic observation.)

Yep, once in a while people still stumble on obscure subsystems and drivers
not supporting probe deferral. Usually they don't fail with a big bang, so
everything seems fine.

E.g. last week's "of_mdiobus_register_phy() and deferred probe"
(https://lkml.org/lkml/2015/10/22/377).

Gr{oetje,eeting}s,

    Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
--
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: [GIT PULL] On-demand device probing

2015-10-19 Thread Geert Uytterhoeven
Hi Russell,

On Mon, Oct 19, 2015 at 5:35 PM, Russell King - ARM Linux
<li...@arm.linux.org.uk> wrote:
>> > What you can do is print those devices which have failed to probe at
>> > late_initcall() time - possibly augmenting that with reports from
>> > subsystems showing what resources are not available, but that's only
>> > a guide, because of the "it might or might not be in a kernel module"
>> > problem.
>>
>> Well, adding those reports would give you a changelog similar to the
>> one in this series...
>
> I'm not sure about that, because what I was thinking of is adding
> a flag which would be set at late_initcall() time prior to running
> a final round of deferred device probing.

Which round is the final round?
That's the one which didn't manage to bind any new devices to drivers,
which is something you only know _after_ the round has been run.

So I think we need one extra round to handle this.

> This flag would then be used in a deferred_warn() printk function
> which would normally be silent, but when this flag is set, it would
> print the reason for the deferral - and this would replace (or be
> added) to the subsystems and drivers which return -EPROBE_DEFER.
>
> That has the effect of hiding all the deferrals up until just before
> launching into userspace, which should then acomplish two things -
> firstly, getting rid of the rather useless deferred messages up to
> that point, and secondly printing the reason why the remaining
> deferrals are happening.
>
> That should be a small number of new lines plus a one-line change
> in subsystems and drivers.

Apart from the extra round we probably can't get rid of, that sounds OK to me.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
--
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: [GIT PULL] On-demand device probing

2015-10-21 Thread Geert Uytterhoeven
Hi Rafael,

On Wed, Oct 21, 2015 at 1:34 AM, Rafael J. Wysocki <r...@rjwysocki.net> wrote:
> On Tuesday, October 20, 2015 09:15:01 AM Rob Herring wrote:
>> On Tue, Oct 20, 2015 at 2:56 AM, Rafael J. Wysocki <r...@rjwysocki.net> 
>> wrote:
>> > ACPI uses platform devices too.  In fact, ACPI device objects are 
>> > enumerated as
>> > platform devices by default now.
>>
>> Okay, I should have grepped for that:
>> drivers/base/platform.c:ACPI_COMPANION_SET(>dev, NULL);
>> drivers/base/platform.c:len = acpi_device_modalias(dev, buf,
>> PAGE_SIZE -1);
>> drivers/base/platform.c:rc = acpi_device_uevent_modalias(dev, env);
>> drivers/base/platform.c:/* Then try ACPI style match */
>> drivers/base/platform.c:if (acpi_driver_match_device(dev, drv))
>>
>> These are all cases which have DT version as well, so we're not really
>> all that different here. There's a few more for DT, but that probably
>> means you have just not hit the problems we have yet. For example,
>> what happens if you have an interrupt line in which the controller is
>> probed after the device connected to the interrupt line? That required
>> resolving irqs in platform_get_irq rather than using static resources
>> to support deferred probe.
>
> We don't have this particular problem, because the IRQ controllers are
> enumerated in a special way.

What does "in a special way" mean? Can you please be more specific?

Can you have interrupt controllers that depend on clocks, pin controllers,
and PM domains?

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
--
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 3/3] gpio: rcar: Remove obsolete platform data support

2015-10-07 Thread Geert Uytterhoeven
Since commit 4baadb9e05c68962 ("ARM: shmobile: r8a7778: remove obsolete
setup code"), Renesas R-Car SoCs are only supported in generic DT-only
ARM multi-platform builds.  The driver doesn't need to use platform data
anymore, hence remove platform data configuration.

Move gpio_rcar_priv.irq_parent down while we're at it, to prevent gaps
on 64-bit.

Signed-off-by: Geert Uytterhoeven <geert+rene...@glider.be>
---
Commit 4baadb9e05c68962 is now in arm-soc/for-next.
---
 drivers/gpio/gpio-rcar.c| 77 +++--
 include/linux/platform_data/gpio-rcar.h | 29 -
 2 files changed, 26 insertions(+), 80 deletions(-)
 delete mode 100644 include/linux/platform_data/gpio-rcar.h

diff --git a/drivers/gpio/gpio-rcar.c b/drivers/gpio/gpio-rcar.c
index 2a8122444614..bb6e363d5178 100644
--- a/drivers/gpio/gpio-rcar.c
+++ b/drivers/gpio/gpio-rcar.c
@@ -25,7 +25,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -34,12 +33,12 @@
 struct gpio_rcar_priv {
void __iomem *base;
spinlock_t lock;
-   struct gpio_rcar_config config;
struct platform_device *pdev;
struct gpio_chip gpio_chip;
struct irq_chip irq_chip;
-   unsigned int irq_parent;
struct clk *clk;
+   unsigned int irq_parent;
+   unsigned has_both_edge_trigger:1;
 };
 
 #define IOINTSEL 0x00  /* General IO/Interrupt Switching Register */
@@ -121,7 +120,7 @@ static void gpio_rcar_config_interrupt_input_mode(struct 
gpio_rcar_priv *p,
gpio_rcar_modify_bit(p, EDGLEVEL, hwirq, !level_trigger);
 
/* Select one edge or both edges in BOTHEDGE */
-   if (p->config.has_both_edge_trigger)
+   if (p->has_both_edge_trigger)
gpio_rcar_modify_bit(p, BOTHEDGE, hwirq, both);
 
/* Select "Interrupt Input Mode" in IOINTSEL */
@@ -161,7 +160,7 @@ static int gpio_rcar_irq_set_type(struct irq_data *d, 
unsigned int type)
  false);
break;
case IRQ_TYPE_EDGE_BOTH:
-   if (!p->config.has_both_edge_trigger)
+   if (!p->has_both_edge_trigger)
return -EINVAL;
gpio_rcar_config_interrupt_input_mode(p, hwirq, true, false,
  true);
@@ -355,39 +354,29 @@ static const struct of_device_id gpio_rcar_of_table[] = {
 
 MODULE_DEVICE_TABLE(of, gpio_rcar_of_table);
 
-static int gpio_rcar_parse_pdata(struct gpio_rcar_priv *p)
+static int gpio_rcar_parse_dt(struct gpio_rcar_priv *p, unsigned int *npins)
 {
-   struct gpio_rcar_config *pdata = dev_get_platdata(>pdev->dev);
struct device_node *np = p->pdev->dev.of_node;
+   const struct of_device_id *match;
+   const struct gpio_rcar_info *info;
struct of_phandle_args args;
int ret;
 
-   if (pdata) {
-   p->config = *pdata;
-   } else if (IS_ENABLED(CONFIG_OF) && np) {
-   const struct of_device_id *match;
-   const struct gpio_rcar_info *info;
-
-   match = of_match_node(gpio_rcar_of_table, np);
-   if (!match)
-   return -EINVAL;
+   match = of_match_node(gpio_rcar_of_table, np);
+   if (!match)
+   return -EINVAL;
 
-   info = match->data;
+   info = match->data;
 
-   ret = of_parse_phandle_with_fixed_args(np, "gpio-ranges", 3, 0,
-  );
-   p->config.number_of_pins = ret == 0 ? args.args[2]
-: RCAR_MAX_GPIO_PER_BANK;
-   p->config.gpio_base = -1;
-   p->config.has_both_edge_trigger = info->has_both_edge_trigger;
-   }
+   ret = of_parse_phandle_with_fixed_args(np, "gpio-ranges", 3, 0, );
+   *npins = ret == 0 ? args.args[2] : RCAR_MAX_GPIO_PER_BANK;
+   p->has_both_edge_trigger = info->has_both_edge_trigger;
 
-   if (p->config.number_of_pins == 0 ||
-   p->config.number_of_pins > RCAR_MAX_GPIO_PER_BANK) {
+   if (*npins == 0 || *npins > RCAR_MAX_GPIO_PER_BANK) {
dev_warn(>pdev->dev,
-"Invalid number of gpio lines %u, using %u\n",
-p->config.number_of_pins, RCAR_MAX_GPIO_PER_BANK);
-   p->config.number_of_pins = RCAR_MAX_GPIO_PER_BANK;
+"Invalid number of gpio lines %u, using %u\n", *npins,
+RCAR_MAX_GPIO_PER_BANK);
+   *npins = RCAR_MAX_GPIO_PER_BANK;
}
 
return 0;
@@ -401,6 +390,7 @@ static int gpio_rcar_probe(struct platform_device *pdev)
struct irq_chip *irq_chip;
struct device *dev = >dev;
const char *name = dev_name(de

[PATCH 0/3] gpio: rcar: Remove obsolete platform data support

2015-10-07 Thread Geert Uytterhoeven
Hi Greg, Linus, Alexandre,

Since commit 4baadb9e05c68962 ("ARM: shmobile: r8a7778: remove obsolete
setup code"), which is now in arm-soc/for-next, Renesas R-Car SoCs are
only supported in generic DT-only ARM multi-platform builds.  The driver
doesn't need to use platform data anymore, hence this driver removes
platform data configuration.

Unfortunately the platform data header file is used in a few other
places, so we have to fix these first to avoid breaking the build.

Thanks!

Geert Uytterhoeven (3):
  usb: renesas_usbhs: Remove unneeded #include

  pinctrl: sh-pfc: Stop including 
  gpio: rcar: Remove obsolete platform data support

 drivers/gpio/gpio-rcar.c| 77 +++--
 drivers/pinctrl/sh-pfc/pfc-r8a7778.c|  1 -
 drivers/pinctrl/sh-pfc/pfc-r8a7779.c|  1 -
 drivers/pinctrl/sh-pfc/pfc-r8a7790.c|  1 -
 drivers/pinctrl/sh-pfc/pfc-r8a7791.c|  1 -
 drivers/pinctrl/sh-pfc/pfc-r8a7794.c|  1 -
 drivers/pinctrl/sh-pfc/pfc-r8a7795.c|  1 -
 drivers/pinctrl/sh-pfc/sh_pfc.h |  5 +++
 drivers/usb/renesas_usbhs/rcar2.c   |  1 -
 include/linux/platform_data/gpio-rcar.h | 29 -
 10 files changed, 31 insertions(+), 87 deletions(-)
 delete mode 100644 include/linux/platform_data/gpio-rcar.h

-- 
1.9.1

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
--
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: renesas_usbhs: Remove unneeded #include

2015-10-07 Thread Geert Uytterhoeven
This header file will be removed soon.

Signed-off-by: Geert Uytterhoeven <geert+rene...@glider.be>
---
Please schedule for v4.3, or provide an Ack, so it can go in through the
GPIO tree. Thanks!
---
 drivers/usb/renesas_usbhs/rcar2.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/usb/renesas_usbhs/rcar2.c 
b/drivers/usb/renesas_usbhs/rcar2.c
index 8fc15c0ba339..277160bc6f25 100644
--- a/drivers/usb/renesas_usbhs/rcar2.c
+++ b/drivers/usb/renesas_usbhs/rcar2.c
@@ -13,7 +13,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include "common.h"
 #include "rcar2.h"
-- 
1.9.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 2/3] pinctrl: sh-pfc: Stop including

2015-10-07 Thread Geert Uytterhoeven
This header file will be removed soon.

Copy the helper macro RCAR_GP_PIN(), which is used by the pinctrl
drivers only, to sh_pfc.h, and drop the #include.

Signed-off-by: Geert Uytterhoeven <geert+rene...@glider.be>
---
 drivers/pinctrl/sh-pfc/pfc-r8a7778.c | 1 -
 drivers/pinctrl/sh-pfc/pfc-r8a7779.c | 1 -
 drivers/pinctrl/sh-pfc/pfc-r8a7790.c | 1 -
 drivers/pinctrl/sh-pfc/pfc-r8a7791.c | 1 -
 drivers/pinctrl/sh-pfc/pfc-r8a7794.c | 1 -
 drivers/pinctrl/sh-pfc/pfc-r8a7795.c | 1 -
 drivers/pinctrl/sh-pfc/sh_pfc.h  | 5 +
 7 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/drivers/pinctrl/sh-pfc/pfc-r8a7778.c 
b/drivers/pinctrl/sh-pfc/pfc-r8a7778.c
index 581d3c44aa4a..ff0077d7869b 100644
--- a/drivers/pinctrl/sh-pfc/pfc-r8a7778.c
+++ b/drivers/pinctrl/sh-pfc/pfc-r8a7778.c
@@ -23,7 +23,6 @@
 #include 
 #include 
 #include 
-#include 
 #include "core.h"
 #include "sh_pfc.h"
 
diff --git a/drivers/pinctrl/sh-pfc/pfc-r8a7779.c 
b/drivers/pinctrl/sh-pfc/pfc-r8a7779.c
index 4be082e6a02e..63e22303b934 100644
--- a/drivers/pinctrl/sh-pfc/pfc-r8a7779.c
+++ b/drivers/pinctrl/sh-pfc/pfc-r8a7779.c
@@ -20,7 +20,6 @@
  */
 
 #include 
-#include 
 
 #include "sh_pfc.h"
 
diff --git a/drivers/pinctrl/sh-pfc/pfc-r8a7790.c 
b/drivers/pinctrl/sh-pfc/pfc-r8a7790.c
index 8e45e30252bc..79b08ecc10be 100644
--- a/drivers/pinctrl/sh-pfc/pfc-r8a7790.c
+++ b/drivers/pinctrl/sh-pfc/pfc-r8a7790.c
@@ -22,7 +22,6 @@
  */
 
 #include 
-#include 
 
 #include "core.h"
 #include "sh_pfc.h"
diff --git a/drivers/pinctrl/sh-pfc/pfc-r8a7791.c 
b/drivers/pinctrl/sh-pfc/pfc-r8a7791.c
index a58a0dec6994..e67f82a44b95 100644
--- a/drivers/pinctrl/sh-pfc/pfc-r8a7791.c
+++ b/drivers/pinctrl/sh-pfc/pfc-r8a7791.c
@@ -9,7 +9,6 @@
  */
 
 #include 
-#include 
 
 #include "core.h"
 #include "sh_pfc.h"
diff --git a/drivers/pinctrl/sh-pfc/pfc-r8a7794.c 
b/drivers/pinctrl/sh-pfc/pfc-r8a7794.c
index 185554e15099..bc570d72285e 100644
--- a/drivers/pinctrl/sh-pfc/pfc-r8a7794.c
+++ b/drivers/pinctrl/sh-pfc/pfc-r8a7794.c
@@ -11,7 +11,6 @@
  */
 
 #include 
-#include 
 
 #include "core.h"
 #include "sh_pfc.h"
diff --git a/drivers/pinctrl/sh-pfc/pfc-r8a7795.c 
b/drivers/pinctrl/sh-pfc/pfc-r8a7795.c
index dce06ed02090..446a37d900c8 100644
--- a/drivers/pinctrl/sh-pfc/pfc-r8a7795.c
+++ b/drivers/pinctrl/sh-pfc/pfc-r8a7795.c
@@ -9,7 +9,6 @@
  */
 
 #include 
-#include 
 
 #include "core.h"
 #include "sh_pfc.h"
diff --git a/drivers/pinctrl/sh-pfc/sh_pfc.h b/drivers/pinctrl/sh-pfc/sh_pfc.h
index 12bfb706845e..a6c9bf23371f 100644
--- a/drivers/pinctrl/sh-pfc/sh_pfc.h
+++ b/drivers/pinctrl/sh-pfc/sh_pfc.h
@@ -341,4 +341,9 @@ struct sh_pfc_soc_info {
}   \
}
 
+/*
+ * GPIO number helper macro for R-Car
+ */
+#define RCAR_GP_PIN(bank, pin) (((bank) * 32) + (pin))
+
 #endif /* __SH_PFC_H */
-- 
1.9.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] lan78xx: Fix ladv/radv error handling in lan78xx_link_reset()

2015-09-04 Thread Geert Uytterhoeven
net/usb/lan78xx.c: In function ‘lan78xx_link_reset’:
net/usb/lan78xx.c:1107: warning: comparison is always false due to limited 
range of data type
net/usb/lan78xx.c:: warning: comparison is always false due to limited 
range of data type

Assigning return values that can be negative error codes to "u16"
variables makes them positive, ignoring the errors.  Hence use "int"
instead.

Drop the "unlikely"s (unlikely considered harmful) and propagate the
actual error values instead of overriding them to -EIO while we're at
it.

Signed-off-by: Geert Uytterhoeven <ge...@linux-m68k.org>
---
Compile-tested only.

Many more overridden or plainly ignored errors, and lots of unlikely()
abuse to fix...
---
 drivers/net/usb/lan78xx.c | 11 +--
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/drivers/net/usb/lan78xx.c b/drivers/net/usb/lan78xx.c
index 39364a45af404388..a39518fc93aadf82 100644
--- a/drivers/net/usb/lan78xx.c
+++ b/drivers/net/usb/lan78xx.c
@@ -1049,8 +1049,7 @@ static int lan78xx_link_reset(struct lan78xx_net *dev)
 {
struct mii_if_info *mii = >mii;
struct ethtool_cmd ecmd = { .cmd = ETHTOOL_GSET };
-   u16 ladv, radv;
-   int ret;
+   int ladv, radv, ret;
u32 buf;
 
/* clear PHY interrupt status */
@@ -1104,12 +1103,12 @@ static int lan78xx_link_reset(struct lan78xx_net *dev)
}
 
ladv = lan78xx_mdio_read(dev->net, mii->phy_id, MII_ADVERTISE);
-   if (unlikely(ladv < 0))
-   return -EIO;
+   if (ladv < 0)
+   return ladv;
 
radv = lan78xx_mdio_read(dev->net, mii->phy_id, MII_LPA);
-   if (unlikely(radv < 0))
-   return -EIO;
+   if (radv < 0)
+   return radv;
 
netif_dbg(dev, link, dev->net,
  "speed: %u duplex: %d anadv: 0x%04x anlpa: 0x%04x",
-- 
1.9.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: [PATCH v2 2/2] usb: renesas_usbhs: Add support for R-Car H3

2015-09-29 Thread Geert Uytterhoeven
On Tue, Sep 29, 2015 at 11:21 AM, Yoshihiro Shimoda
<yoshihiro.shimoda...@renesas.com> wrote:
> This patch adds a compatible string to support for R-Car H3.
>
> Since the HS-USB controller of R-Car H3 is almost the same specification
> with R-Car Gen2 (these have 16 pipes and usb-dmac), this patch
> sets the "type" of renesas_usbhs_driver_param to USBHS_TYPE_RCAR_GEN2.
>
> Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda...@renesas.com>

Acked-by: Geert Uytterhoeven <geert+rene...@glider.be>

Gr{oetje,eeting}s,

    Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
--
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 1/4] usb: host: xhci-rcar: add xhci_rcar_is_compatible() function

2015-10-05 Thread Geert Uytterhoeven
Hi Shimoda-san,

On Mon, Oct 5, 2015 at 2:06 PM, Yoshihiro Shimoda
<yoshihiro.shimoda...@renesas.com> wrote:
> +bool xhci_rcar_is_compatible(struct usb_hcd *hcd)
> +{
> +   struct device_node *of_node = hcd->self.controller->of_node;
> +
> +   if (of_device_is_compatible(of_node, "renesas,xhci-r8a7790") ||
> +   of_device_is_compatible(of_node, "renesas,xhci-r8a7791"))
> +   return true;

If you want to match against multiple compatible values, you may be better
off with of_match_node().
This may also simplify the code to match specific firmware paths to the
various compatible entries.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
--
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: phy: Remove unused Renesas R-Car (Gen1) USB PHY driveer

2015-12-04 Thread Geert Uytterhoeven
As of commit 3d7608e4c169af03 ("ARM: shmobile: bockw: remove legacy
board file and config"), the Renesas R-Car (Gen1) USB PHY driver is no
longer used.
In theory it could still be used on R-Car Gen1 SoCs, but that would
require adding DT support to the driver. Instead, a new driver using the
generic PHY framework should be written, as was done for R-Car Gen2.

Remove the driver for good.

Signed-off-by: Geert Uytterhoeven <geert+rene...@glider.be>
---
 drivers/usb/phy/Kconfig|  13 --
 drivers/usb/phy/Makefile   |   1 -
 drivers/usb/phy/phy-rcar-usb.c | 247 -
 include/linux/platform_data/usb-rcar-phy.h |  28 
 4 files changed, 289 deletions(-)
 delete mode 100644 drivers/usb/phy/phy-rcar-usb.c
 delete mode 100644 include/linux/platform_data/usb-rcar-phy.h

diff --git a/drivers/usb/phy/Kconfig b/drivers/usb/phy/Kconfig
index 22e8ecb6bfbd2822..155694c1a5366215 100644
--- a/drivers/usb/phy/Kconfig
+++ b/drivers/usb/phy/Kconfig
@@ -186,19 +186,6 @@ config USB_MXS_PHY
 
  MXS Phy is used by some of the i.MX SoCs, for example imx23/28/6x.
 
-config USB_RCAR_PHY
-   tristate "Renesas R-Car USB PHY support"
-   depends on USB || USB_GADGET
-   depends on ARCH_R8A7778 || ARCH_R8A7779 || COMPILE_TEST
-   select USB_PHY
-   help
- Say Y here to add support for the Renesas R-Car USB common PHY driver.
- This chip is typically used as USB PHY for USB host, gadget.
- This driver supports R8A7778 and R8A7779.
-
- To compile this driver as a module, choose M here: the
- module will be called phy-rcar-usb.
-
 config USB_ULPI
bool "Generic ULPI Transceiver Driver"
depends on ARM || ARM64
diff --git a/drivers/usb/phy/Makefile b/drivers/usb/phy/Makefile
index 19c0dccbb1161b11..b433e5d89be4bdda 100644
--- a/drivers/usb/phy/Makefile
+++ b/drivers/usb/phy/Makefile
@@ -23,7 +23,6 @@ obj-$(CONFIG_USB_MSM_OTG) += phy-msm-usb.o
 obj-$(CONFIG_USB_QCOM_8X16_PHY)+= phy-qcom-8x16-usb.o
 obj-$(CONFIG_USB_MV_OTG)   += phy-mv-usb.o
 obj-$(CONFIG_USB_MXS_PHY)  += phy-mxs-usb.o
-obj-$(CONFIG_USB_RCAR_PHY) += phy-rcar-usb.o
 obj-$(CONFIG_USB_ULPI) += phy-ulpi.o
 obj-$(CONFIG_USB_ULPI_VIEWPORT)+= phy-ulpi-viewport.o
 obj-$(CONFIG_KEYSTONE_USB_PHY) += phy-keystone.o
diff --git a/drivers/usb/phy/phy-rcar-usb.c b/drivers/usb/phy/phy-rcar-usb.c
deleted file mode 100644
index 1e09b83778853829..
--- a/drivers/usb/phy/phy-rcar-usb.c
+++ /dev/null
@@ -1,247 +0,0 @@
-/*
- * Renesas R-Car USB phy driver
- *
- * Copyright (C) 2012-2013 Renesas Solutions Corp.
- * Kuninori Morimoto <kuninori.morimoto...@renesas.com>
- * Copyright (C) 2013 Cogent Embedded, Inc.
- *
- * 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.
- */
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-/* REGS block */
-#define USBPCTRL0  0x00
-#define USBPCTRL1  0x04
-#define USBST  0x08
-#define USBEH0 0x0C
-#define USBOH0 0x1C
-#define USBCTL00x58
-
-/* High-speed signal quality characteristic control registers (R8A7778 only) */
-#define HSQCTL10x24
-#define HSQCTL20x28
-
-/* USBPCTRL0 */
-#define OVC2   (1 << 10) /* (R8A7779 only) */
-   /* Switches the OVC input pin for port 2: */
-   /* 1: USB_OVC2, 0: OVC2 */
-#define OVC1_VBUS1 (1 << 9) /* Switches the OVC input pin for port 1: */
-   /* 1: USB_OVC1, 0: OVC1/VBUS1   */
-   /* Function mode: set to 0  */
-#define OVC0   (1 << 8) /* Switches the OVC input pin for port 0: */
-   /* 1: USB_OVC0 pin, 0: OVC0 */
-#define OVC2_ACT   (1 << 6) /* (R8A7779 only)  */
-   /* Host mode: OVC2 polarity:*/
-   /* 1: active-high, 0: active-low*/
-#define PENC   (1 << 4) /* Function mode: output level of PENC1 pin: */
-   /* 1: high, 0: low  */
-#define OVC0_ACT   (1 << 3) /* Host mode: OVC0 polarity:   */
-   /* 1: active-high, 0: active-low*/
-#define OVC1_ACT   (1 << 1) /* Host mode: OVC1 polarity:   */
-   /* 1: active-high, 0: active-low*/
-   /* Function mode: be sure to set to 1   */
-#define PORT1  (1 << 0) /* Sele

Re: [PATCH v2 2/2] usb: renesas_usbhs: add device tree support for r8a779[23]

2015-12-10 Thread Geert Uytterhoeven
Hi Simon,

On Thu, Dec 10, 2015 at 6:40 AM, Simon Horman
<horms+rene...@verge.net.au> wrote:
> Simply document new compatibility string.
> As a previous patch adds a generic R-Car Gen2 compatibility string
> there appears to be no need for a driver updates.
>
> Signed-off-by: Simon Horman <horms+rene...@verge.net.au>
> Acked-by: Rob Herring <r...@kernel.org>
> ---
>  Documentation/devicetree/bindings/usb/renesas_usbhs.txt | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/usb/renesas_usbhs.txt 
> b/Documentation/devicetree/bindings/usb/renesas_usbhs.txt
> index b959059826cd..efb3199a2a80 100644
> --- a/Documentation/devicetree/bindings/usb/renesas_usbhs.txt
> +++ b/Documentation/devicetree/bindings/usb/renesas_usbhs.txt
> @@ -5,6 +5,8 @@ Required properties:
>
> - "renesas,usbhs-r8a7790" for r8a7790 (R-Car H2) compatible device
> - "renesas,usbhs-r8a7791" for r8a7791 (R-Car M2-W) compatible device
> +   - "renesas,usbhs-r8a7792" for r8a7792 (R-Car V2H) compatible device
> +   - "renesas,usbhs-r8a7793" for r8a7793 (R-Car M2-N) compatible device
> - "renesas,usbhs-r8a7794" for r8a7794 (R-Car E2) compatible device
> - "renesas,usbhs-r8a7795" for r8a7795 (R-Car H3) compatible device
> - "renesas,rcar-gen2-usbhs" for R-Car Gen2 compatibile device

I see a possible issue here:

Old r8a7791 dtsi just has "renesas,usbhs-r8a7791", so it works with the current
driver, as the driver matches against "renesas,usbhs-r8a7791".

Existing (out-of-tree) r8a7792 dtsi may have followed existing practices,
and just have "renesas,usbhs-r8a7792".
This won't work with the new driver, as the driver doesn't match again
"renesas,usbhs-r8a7792". The same applies to r8a7793.

Do we care about this
  - in upstream? Probably not.
  - in the BSP? It seems to have r8a7790/r8a7791 usbhs only, though.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
--
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] extcon: add Maxim MAX3355 driver

2015-12-15 Thread Geert Uytterhoeven
Hi Sergei,

On Tue, Dec 15, 2015 at 12:54 PM, Sergei Shtylyov
<sergei.shtyl...@cogentembedded.com> wrote:
> On 12/15/2015 2:28 PM, Geert Uytterhoeven wrote:
>>>> You are mixing 2 and 1 spaces between words, don't do that.
>>>
>>> Care to just explain why?
>>
>> It makes the text difficult to read.
>
>Are you serious? :-)

Yes. No accidentally forgotten smileys on my side.

Spasiba! Da svidanja...

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
--
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 2/3] usb: renesas_usbhs: add fallback compatibility strings

2015-12-15 Thread Geert Uytterhoeven
On Tue, Dec 15, 2015 at 7:41 AM, Simon Horman <ho...@verge.net.au> wrote:
>> >diff --git a/Documentation/devicetree/bindings/usb/renesas_usbhs.txt 
>> >b/Documentation/devicetree/bindings/usb/renesas_usbhs.txt
>> >index a14c0bb561d5..c55cf77006d0 100644
>> >--- a/Documentation/devicetree/bindings/usb/renesas_usbhs.txt
>> >+++ b/Documentation/devicetree/bindings/usb/renesas_usbhs.txt
>> >@@ -2,10 +2,18 @@ Renesas Electronics USBHS driver
>> >
>> >  Required properties:
>> >- compatible: Must contain one of the following:
>>
>>Really?
>
> Would "...one or more of the following" help?

+1

>> >+
>> > - "renesas,usbhs-r8a7790" for r8a7790 (R-Car H2) compatible device
>> > - "renesas,usbhs-r8a7791" for r8a7791 (R-Car M2-W) compatible device
>> > - "renesas,usbhs-r8a7794" for r8a7794 (R-Car E2) compatible device
>> > - "renesas,usbhs-r8a7795" for r8a7795 (R-Car H3) compatible device
>> >+- "renesas,rcar-gen2-usbhs" for R-Car Gen2 compatible device
>> >+- "renesas,rcar-gen3-usbhs" for R-Car Gen3 compatible device
>> >+
>> >+When compatible with the generic version, nodes must list the
>> >+SoC-specific version corresponding to the platform first followed
>> >+by the generic version.
>> >+
>>
>>This kinda contradicts the above claim.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
--
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] extcon: add Maxim MAX3355 driver

2015-12-15 Thread Geert Uytterhoeven
Hi Sergei,

On Tue, Dec 15, 2015 at 12:24 PM, Sergei Shtylyov
<sergei.shtyl...@cogentembedded.com> wrote:
>>>> "So
>>>> what" and "I'd like to keep my spacing as is" aren't valid reasons.
>>>> Fix it, then I'll look at the rest again.
>>>
>>>
>>> I'll consider doing that if you care to explain what's the problem
>>> with
>>> my spacing. TIA.
>>
>>
>> You are mixing 2 and 1 spaces between words, don't do that.
>
>    Care to just explain why?

It makes the text difficult to read.

Thanks!

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
--
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: [uml-devel] [PATCH 1/2] usb: support building without CONFIG_HAS_DMA

2016-02-15 Thread Geert Uytterhoeven
Hi Vegard,

On Mon, Feb 15, 2016 at 11:41 AM, Vegard Nossum
<vegard.nos...@oracle.com> wrote:
> Some platforms don't have DMA, but we should still be able to build
> USB drivers for these platforms. They could still be used through
> vhci_hcd, usbip_host, or maybe something like USB passthrough in UML
> from a capable host.
>
> This is admittedly ugly with the #ifdefs, but those are necessary to
> get around linker errors like these:
>
> drivers/built-in.o: In function `dma_unmap_sg_attrs':
> include/linux/dma-mapping.h:183: undefined reference to `bad_dma_ops'
> drivers/built-in.o: In function `dma_unmap_single_attrs':
> include/linux/dma-mapping.h:148: undefined reference to `bad_dma_ops'
> drivers/built-in.o: In function `dma_map_sg_attrs':
> include/linux/dma-mapping.h:168: undefined reference to `bad_dma_ops'
> drivers/built-in.o: In function `dma_map_page':
> include/linux/dma-mapping.h:196: undefined reference to `bad_dma_ops'
> drivers/built-in.o: In function `dma_mapping_error':
> include/linux/dma-mapping.h:430: undefined reference to `bad_dma_ops'
> drivers/built-in.o:include/linux/dma-mapping.h:131: more undefined references 
> to `bad_dma_ops' follow
>
> Greg KG suggested just defining these for UML [1] but according to
> Richard Weinberger this has come up before and it was decided not to
> do that just for the sake of making drivers build [2].
>
> [1]: http://www.spinics.net/lists/linux-usb/msg136306.html
> [2]: http://www.spinics.net/lists/linux-usb/msg136308.html
>
> If any of the new warnings trigger, the correct solution is almost
> certainly to add a CONFIG_HAS_DMA dependency in the Kconfig menu for
> the responsible driver -- that driver's functions will hopefully
> appear somewhere in the stack trace.
>
> v2: Reduce the number of #ifdefs by moving code out into helpers.
>
> Signed-off-by: Vegard Nossum <vegard.nos...@oracle.com>

I have an even smaller patch that I've been updating over the years to
compile allmodconfig/allyesconfig kernels for m68k/Sun-3.

I'll clean it up and send it...

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
--
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 3/3] usb: dwc2: USB_DWC2 should depend on HAS_DMA

2016-02-15 Thread Geert Uytterhoeven
If NO_DMA=y:

ERROR: "usb_gadget_map_request" [drivers/usb/dwc2/dwc2.ko] undefined!
ERROR: "usb_gadget_unmap_request" [drivers/usb/dwc2/dwc2.ko] undefined!
ERROR: "bad_dma_ops" [drivers/usb/dwc2/dwc2.ko] undefined!

Add a dependency on HAS_DMA to fix this.

Signed-off-by: Geert Uytterhoeven <ge...@linux-m68k.org>
---
 drivers/usb/dwc2/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/usb/dwc2/Kconfig b/drivers/usb/dwc2/Kconfig
index fd95ba6ec317fdac..f0decc0d69b5197d 100644
--- a/drivers/usb/dwc2/Kconfig
+++ b/drivers/usb/dwc2/Kconfig
@@ -1,5 +1,6 @@
 config USB_DWC2
tristate "DesignWare USB2 DRD Core Support"
+   depends on HAS_DMA
depends on USB || USB_GADGET
help
  Say Y here if your system has a Dual Role Hi-Speed USB
-- 
1.9.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 1/3] usb: core: Allow compilation on platforms where NO_DMA=y

2016-02-15 Thread Geert Uytterhoeven
If NO_DMA=y:

ERROR: "dma_pool_destroy" [drivers/usb/core/usbcore.ko] undefined!
ERROR: "bad_dma_ops" [drivers/usb/core/usbcore.ko] undefined!
ERROR: "dma_pool_free" [drivers/usb/core/usbcore.ko] undefined!
ERROR: "dma_pool_alloc" [drivers/usb/core/usbcore.ko] undefined!
ERROR: "dma_pool_create" [drivers/usb/core/usbcore.ko] undefined!

Add a few checks for CONFIG_HAS_DMA to fix this.

Signed-off-by: Geert Uytterhoeven <ge...@linux-m68k.org>
---
 drivers/usb/core/buffer.c | 18 --
 drivers/usb/core/hcd.c| 14 ++
 2 files changed, 22 insertions(+), 10 deletions(-)

diff --git a/drivers/usb/core/buffer.c b/drivers/usb/core/buffer.c
index 89f2e7765093955b..2741566ee4f25849 100644
--- a/drivers/usb/core/buffer.c
+++ b/drivers/usb/core/buffer.c
@@ -62,8 +62,9 @@ int hcd_buffer_create(struct usb_hcd *hcd)
charname[16];
int i, size;
 
-   if (!hcd->self.controller->dma_mask &&
-   !(hcd->driver->flags & HCD_LOCAL_MEM))
+   if (!IS_ENABLED(CONFIG_HAS_DMA) ||
+   (!hcd->self.controller->dma_mask &&
+!(hcd->driver->flags & HCD_LOCAL_MEM)))
return 0;
 
for (i = 0; i < HCD_BUFFER_POOLS; i++) {
@@ -93,6 +94,9 @@ void hcd_buffer_destroy(struct usb_hcd *hcd)
 {
int i;
 
+   if (!IS_ENABLED(CONFIG_HAS_DMA))
+   return;
+
for (i = 0; i < HCD_BUFFER_POOLS; i++) {
struct dma_pool *pool = hcd->pool[i];
 
@@ -119,8 +123,9 @@ void *hcd_buffer_alloc(
int i;
 
/* some USB hosts just use PIO */
-   if (!bus->controller->dma_mask &&
-   !(hcd->driver->flags & HCD_LOCAL_MEM)) {
+   if (!IS_ENABLED(CONFIG_HAS_DMA) ||
+   (!bus->controller->dma_mask &&
+!(hcd->driver->flags & HCD_LOCAL_MEM))) {
*dma = ~(dma_addr_t) 0;
return kmalloc(size, mem_flags);
}
@@ -145,8 +150,9 @@ void hcd_buffer_free(
if (!addr)
return;
 
-   if (!bus->controller->dma_mask &&
-   !(hcd->driver->flags & HCD_LOCAL_MEM)) {
+   if (!IS_ENABLED(CONFIG_HAS_DMA) ||
+   (!bus->controller->dma_mask &&
+!(hcd->driver->flags & HCD_LOCAL_MEM))) {
kfree(addr);
return;
}
diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
index df0e3b92533a745f..f6caa7ba6f05655b 100644
--- a/drivers/usb/core/hcd.c
+++ b/drivers/usb/core/hcd.c
@@ -1408,12 +1408,15 @@ static void hcd_free_coherent(struct usb_bus *bus, 
dma_addr_t *dma_handle,
 
 void usb_hcd_unmap_urb_setup_for_dma(struct usb_hcd *hcd, struct urb *urb)
 {
+#ifdef CONFIG_HAS_DMA
if (urb->transfer_flags & URB_SETUP_MAP_SINGLE)
dma_unmap_single(hcd->self.controller,
urb->setup_dma,
sizeof(struct usb_ctrlrequest),
DMA_TO_DEVICE);
-   else if (urb->transfer_flags & URB_SETUP_MAP_LOCAL)
+   else
+#endif /* CONFIG_HAS_DMA */
+   if (urb->transfer_flags & URB_SETUP_MAP_LOCAL)
hcd_free_coherent(urb->dev->bus,
>setup_dma,
(void **) >setup_packet,
@@ -1440,6 +1443,7 @@ void usb_hcd_unmap_urb_for_dma(struct usb_hcd *hcd, 
struct urb *urb)
usb_hcd_unmap_urb_setup_for_dma(hcd, urb);
 
dir = usb_urb_dir_in(urb) ? DMA_FROM_DEVICE : DMA_TO_DEVICE;
+#ifdef CONFIG_HAS_DMA
if (urb->transfer_flags & URB_DMA_MAP_SG)
dma_unmap_sg(hcd->self.controller,
urb->sg,
@@ -1455,7 +1459,9 @@ void usb_hcd_unmap_urb_for_dma(struct usb_hcd *hcd, 
struct urb *urb)
urb->transfer_dma,
urb->transfer_buffer_length,
dir);
-   else if (urb->transfer_flags & URB_MAP_LOCAL)
+   else
+#endif /* CONFIG_HAS_DMA */
+   if (urb->transfer_flags & URB_MAP_LOCAL)
hcd_free_coherent(urb->dev->bus,
>transfer_dma,
>transfer_buffer,
@@ -1492,7 +1498,7 @@ int usb_hcd_map_urb_for_dma(struct usb_hcd *hcd, struct 
urb *urb,
if (usb_endpoint_xfer_control(>ep->desc)) {
if (hcd->self.uses_pio_for_control)
return ret;
-   if (hcd->self.uses_dma) {
+   if (IS_ENABLED(CONFIG_HAS_DMA) && hcd->self.uses_dma) {
urb->setup_dma = dma_map_single(
hcd->self.controller,
  

[PATCH 2/3] usb: host: Some host drivers should depend on HAS_DMA

2016-02-15 Thread Geert Uytterhoeven
If NO_DMA=y:

ERROR: "bad_dma_ops" [drivers/usb/host/xhci-plat-hcd.ko] undefined!
ERROR: "bad_dma_ops" [drivers/usb/host/xhci-mtk.ko] undefined!
ERROR: "dma_pool_destroy" [drivers/usb/host/xhci-hcd.ko] undefined!
ERROR: "bad_dma_ops" [drivers/usb/host/xhci-hcd.ko] undefined!
ERROR: "dma_pool_free" [drivers/usb/host/xhci-hcd.ko] undefined!
ERROR: "dma_pool_alloc" [drivers/usb/host/xhci-hcd.ko] undefined!
ERROR: "dma_pool_create" [drivers/usb/host/xhci-hcd.ko] undefined!
ERROR: "bad_dma_ops" [drivers/usb/host/ohci-platform.ko] undefined!
ERROR: "dma_pool_destroy" [drivers/usb/host/ohci-hcd.ko] undefined!
ERROR: "bad_dma_ops" [drivers/usb/host/ohci-hcd.ko] undefined!
ERROR: "dma_pool_free" [drivers/usb/host/ohci-hcd.ko] undefined!
ERROR: "dma_pool_alloc" [drivers/usb/host/ohci-hcd.ko] undefined!
ERROR: "dma_pool_create" [drivers/usb/host/ohci-hcd.ko] undefined!
ERROR: "dma_pool_create" [drivers/usb/host/fotg210-hcd.ko] undefined!
ERROR: "bad_dma_ops" [drivers/usb/host/fotg210-hcd.ko] undefined!
ERROR: "dma_pool_destroy" [drivers/usb/host/fotg210-hcd.ko] undefined!
ERROR: "dma_pool_alloc" [drivers/usb/host/fotg210-hcd.ko] undefined!
ERROR: "dma_pool_free" [drivers/usb/host/fotg210-hcd.ko] undefined!
ERROR: "bad_dma_ops" [drivers/usb/host/ehci-platform.ko] undefined!
ERROR: "dma_pool_destroy" [drivers/usb/host/ehci-hcd.ko] undefined!
ERROR: "bad_dma_ops" [drivers/usb/host/ehci-hcd.ko] undefined!
ERROR: "dma_pool_free" [drivers/usb/host/ehci-hcd.ko] undefined!
ERROR: "dma_pool_alloc" [drivers/usb/host/ehci-hcd.ko] undefined!
ERROR: "dma_pool_create" [drivers/usb/host/ehci-hcd.ko] undefined!

Add dependencies on HAS_DMA to fix this.

Signed-off-by: Geert Uytterhoeven <ge...@linux-m68k.org>
---
 drivers/usb/host/Kconfig | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig
index 1f117c360ebbba33..573789698474ad8d 100644
--- a/drivers/usb/host/Kconfig
+++ b/drivers/usb/host/Kconfig
@@ -17,6 +17,7 @@ config USB_C67X00_HCD
 
 config USB_XHCI_HCD
tristate "xHCI HCD (USB 3.0) support"
+   depends on HAS_DMA
---help---
  The eXtensible Host Controller Interface (xHCI) is standard for USB 
3.0
  "SuperSpeed" host controller hardware.
@@ -70,6 +71,7 @@ endif # USB_XHCI_HCD
 
 config USB_EHCI_HCD
tristate "EHCI HCD (USB 2.0) support"
+   depends on HAS_DMA
---help---
  The Enhanced Host Controller Interface (EHCI) is standard for USB 2.0
  "high speed" (480 Mbit/sec, 60 Mbyte/sec) host controller hardware.
@@ -361,7 +363,7 @@ config USB_ISP1362_HCD
 
 config USB_FOTG210_HCD
tristate "FOTG210 HCD support"
-   depends on USB
+   depends on USB && HAS_DMA
---help---
  Faraday FOTG210 is an OTG controller which can be configured as
  an USB2.0 host. It is designed to meet USB2.0 EHCI specification
@@ -383,6 +385,7 @@ config USB_MAX3421_HCD
 
 config USB_OHCI_HCD
tristate "OHCI HCD (USB 1.1) support"
+   depends on HAS_DMA
---help---
  The Open Host Controller Interface (OHCI) is a standard for accessing
  USB 1.1 host controller hardware.  It does more in hardware than 
Intel's
-- 
1.9.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 0/3] usb: Allow compilation on platforms where NO_DMA=y

2016-02-15 Thread Geert Uytterhoeven
This patch series allows to compile USB on platforms where NO_DMA=y.
I've been using it for quite a while to make allmodconfig/allyesconfig
build for m68k/sun3.

Thanks for your comments!

Geert Uytterhoeven (3):
  usb: core: Allow compilation on platforms where NO_DMA=y
  usb: host: Some host drivers should depend on HAS_DMA
  usb: dwc2: USB_DWC2 should depend on HAS_DMA

 drivers/usb/core/buffer.c | 18 --
 drivers/usb/core/hcd.c| 14 ++
 drivers/usb/dwc2/Kconfig  |  1 +
 drivers/usb/host/Kconfig  |  5 -
 4 files changed, 27 insertions(+), 11 deletions(-)

-- 
1.9.1

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
--
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 1/3] usb: core: Allow compilation on platforms where NO_DMA=y

2016-02-15 Thread Geert Uytterhoeven
Hi Vegard,

On Mon, Feb 15, 2016 at 12:49 PM, Vegard Nossum
<vegard.nos...@oracle.com> wrote:
> On 02/15/2016 12:21 PM, Geert Uytterhoeven wrote:
>> If NO_DMA=y:
>>
>>  ERROR: "dma_pool_destroy" [drivers/usb/core/usbcore.ko] undefined!
>>  ERROR: "bad_dma_ops" [drivers/usb/core/usbcore.ko] undefined!
>>  ERROR: "dma_pool_free" [drivers/usb/core/usbcore.ko] undefined!
>>  ERROR: "dma_pool_alloc" [drivers/usb/core/usbcore.ko] undefined!
>>  ERROR: "dma_pool_create" [drivers/usb/core/usbcore.ko] undefined!
>>
>> Add a few checks for CONFIG_HAS_DMA to fix this.
>>
>> Signed-off-by: Geert Uytterhoeven <ge...@linux-m68k.org>
>> ---
>>   drivers/usb/core/buffer.c | 18 --
>>   drivers/usb/core/hcd.c| 14 ++
>>   2 files changed, 22 insertions(+), 10 deletions(-)
>>
>
> This does look nicer than my patch.

I'm happy you like it ;-)

>> --- a/drivers/usb/core/hcd.c
>> +++ b/drivers/usb/core/hcd.c
>> @@ -1408,12 +1408,15 @@ static void hcd_free_coherent(struct usb_bus *bus,
>> dma_addr_t *dma_handle,
>>
>>   void usb_hcd_unmap_urb_setup_for_dma(struct usb_hcd *hcd, struct urb
>> *urb)
>>   {
>> +#ifdef CONFIG_HAS_DMA
>> if (urb->transfer_flags & URB_SETUP_MAP_SINGLE)
>> dma_unmap_single(hcd->self.controller,
>> urb->setup_dma,
>> sizeof(struct usb_ctrlrequest),
>> DMA_TO_DEVICE);
>> -   else if (urb->transfer_flags & URB_SETUP_MAP_LOCAL)
>> +   else
>> +#endif /* CONFIG_HAS_DMA */
>> +   if (urb->transfer_flags & URB_SETUP_MAP_LOCAL)
>
>
> Why not use IS_ENABLED() here as well instead of the ifdef?

This used to be needed, else the calls to e.g. dma_unmap_single() would
still cause link errors.

This no longer seems to be the case (I told you this was a patch set I started
a while ago ;-), probably due to the recent dma_map_ops conversion.
Will update.

> Assuming this still lets the platform actually run USB drivers (which it
> looks like it does -- I still have to test it), then I'm all for it. You

Please give it a try and let me know, as I'm not in a position to test-run
this on Sun-3.

> may want to steal parts of the commit description for my last patch to
> include that this actually allows using USB on UML and the references to
> the discussion.

Thanks, will do!

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
--
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 0/3] usb: Allow compilation on platforms where NO_DMA=y

2016-02-16 Thread Geert Uytterhoeven
Hi Greg,

Some platforms don't have DMA, but we should still be able to build USB
drivers for these platforms. They could still be used through vhci_hcd,
usbip_host, or maybe something like USB passthrough in UML from a
capable host.

This patch series allows to compile USB on platforms where NO_DMA=y.
I've been using it for quite a while to make allmodconfig/allyesconfig
build for m68k/sun3.
Vegard used this on UML to read a USB flash drive plugged into the host
machine using USB-over-IP.

Changes compared to v1:
  - Replace remaining #ifdefs by IS_ENABLED() checks,
  - Add to patch description that this actually allows using USB on UML,
  - Add Acked-by.

Thanks!

Geert Uytterhoeven (3):
  usb: core: Allow compilation on platforms where NO_DMA=y
  usb: host: Host drivers relying on DMA should depend on HAS_DMA
  usb: dwc2: USB_DWC2 should depend on HAS_DMA

 drivers/usb/core/buffer.c | 18 --
 drivers/usb/core/hcd.c| 16 ++--
 drivers/usb/dwc2/Kconfig  |  1 +
 drivers/usb/host/Kconfig  |  5 -
 4 files changed, 27 insertions(+), 13 deletions(-)

-- 
1.9.1

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
--
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 1/3] usb: core: Allow compilation on platforms where NO_DMA=y

2016-02-16 Thread Geert Uytterhoeven
Some platforms don't have DMA, but we should still be able to build USB
drivers for these platforms. They could still be used through vhci_hcd,
usbip_host, or maybe something like USB passthrough in UML from a
capable host.

If NO_DMA=y:

ERROR: "dma_pool_destroy" [drivers/usb/core/usbcore.ko] undefined!
ERROR: "bad_dma_ops" [drivers/usb/core/usbcore.ko] undefined!
ERROR: "dma_pool_free" [drivers/usb/core/usbcore.ko] undefined!
ERROR: "dma_pool_alloc" [drivers/usb/core/usbcore.ko] undefined!
ERROR: "dma_pool_create" [drivers/usb/core/usbcore.ko] undefined!

Add a few checks for CONFIG_HAS_DMA to fix this.

Signed-off-by: Geert Uytterhoeven <ge...@linux-m68k.org>
Acked-by: Vegard Nossum <vegard.nos...@oracle.com>
---
v2:
  - Replace remaining #ifdefs by IS_ENABLED() checks,
  - Add to patch description that this actually allows using USB on UML,
  - Add Acked-by.
---
 drivers/usb/core/buffer.c | 18 --
 drivers/usb/core/hcd.c| 16 ++--
 2 files changed, 22 insertions(+), 12 deletions(-)

diff --git a/drivers/usb/core/buffer.c b/drivers/usb/core/buffer.c
index 89f2e7765093955b..2741566ee4f25849 100644
--- a/drivers/usb/core/buffer.c
+++ b/drivers/usb/core/buffer.c
@@ -62,8 +62,9 @@ int hcd_buffer_create(struct usb_hcd *hcd)
charname[16];
int i, size;
 
-   if (!hcd->self.controller->dma_mask &&
-   !(hcd->driver->flags & HCD_LOCAL_MEM))
+   if (!IS_ENABLED(CONFIG_HAS_DMA) ||
+   (!hcd->self.controller->dma_mask &&
+!(hcd->driver->flags & HCD_LOCAL_MEM)))
return 0;
 
for (i = 0; i < HCD_BUFFER_POOLS; i++) {
@@ -93,6 +94,9 @@ void hcd_buffer_destroy(struct usb_hcd *hcd)
 {
int i;
 
+   if (!IS_ENABLED(CONFIG_HAS_DMA))
+   return;
+
for (i = 0; i < HCD_BUFFER_POOLS; i++) {
struct dma_pool *pool = hcd->pool[i];
 
@@ -119,8 +123,9 @@ void *hcd_buffer_alloc(
int i;
 
/* some USB hosts just use PIO */
-   if (!bus->controller->dma_mask &&
-   !(hcd->driver->flags & HCD_LOCAL_MEM)) {
+   if (!IS_ENABLED(CONFIG_HAS_DMA) ||
+   (!bus->controller->dma_mask &&
+!(hcd->driver->flags & HCD_LOCAL_MEM))) {
*dma = ~(dma_addr_t) 0;
return kmalloc(size, mem_flags);
}
@@ -145,8 +150,9 @@ void hcd_buffer_free(
if (!addr)
return;
 
-   if (!bus->controller->dma_mask &&
-   !(hcd->driver->flags & HCD_LOCAL_MEM)) {
+   if (!IS_ENABLED(CONFIG_HAS_DMA) ||
+   (!bus->controller->dma_mask &&
+!(hcd->driver->flags & HCD_LOCAL_MEM))) {
kfree(addr);
return;
}
diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
index df0e3b92533a745f..b277977cada2b382 100644
--- a/drivers/usb/core/hcd.c
+++ b/drivers/usb/core/hcd.c
@@ -1408,7 +1408,8 @@ static void hcd_free_coherent(struct usb_bus *bus, 
dma_addr_t *dma_handle,
 
 void usb_hcd_unmap_urb_setup_for_dma(struct usb_hcd *hcd, struct urb *urb)
 {
-   if (urb->transfer_flags & URB_SETUP_MAP_SINGLE)
+   if (IS_ENABLED(CONFIG_HAS_DMA) &&
+   (urb->transfer_flags & URB_SETUP_MAP_SINGLE))
dma_unmap_single(hcd->self.controller,
urb->setup_dma,
sizeof(struct usb_ctrlrequest),
@@ -1440,17 +1441,20 @@ void usb_hcd_unmap_urb_for_dma(struct usb_hcd *hcd, 
struct urb *urb)
usb_hcd_unmap_urb_setup_for_dma(hcd, urb);
 
dir = usb_urb_dir_in(urb) ? DMA_FROM_DEVICE : DMA_TO_DEVICE;
-   if (urb->transfer_flags & URB_DMA_MAP_SG)
+   if (IS_ENABLED(CONFIG_HAS_DMA) &&
+   (urb->transfer_flags & URB_DMA_MAP_SG))
dma_unmap_sg(hcd->self.controller,
urb->sg,
urb->num_sgs,
dir);
-   else if (urb->transfer_flags & URB_DMA_MAP_PAGE)
+   else if (IS_ENABLED(CONFIG_HAS_DMA) &&
+(urb->transfer_flags & URB_DMA_MAP_PAGE))
dma_unmap_page(hcd->self.controller,
urb->transfer_dma,
urb->transfer_buffer_length,
dir);
-   else if (urb->transfer_flags & URB_DMA_MAP_SINGLE)
+   else if (IS_ENABLED(CONFIG_HAS_DMA) &&
+(urb->transfer_flags & URB_DMA_MAP_SINGLE))
dma_unmap_single(hcd->self.controller,
urb->transfer_dma,
 

[PATCH v2 2/3] usb: host: Host drivers relying on DMA should depend on HAS_DMA

2016-02-16 Thread Geert Uytterhoeven
If NO_DMA=y:

ERROR: "bad_dma_ops" [drivers/usb/host/xhci-plat-hcd.ko] undefined!
ERROR: "bad_dma_ops" [drivers/usb/host/xhci-mtk.ko] undefined!
ERROR: "dma_pool_destroy" [drivers/usb/host/xhci-hcd.ko] undefined!
ERROR: "bad_dma_ops" [drivers/usb/host/xhci-hcd.ko] undefined!
ERROR: "dma_pool_free" [drivers/usb/host/xhci-hcd.ko] undefined!
ERROR: "dma_pool_alloc" [drivers/usb/host/xhci-hcd.ko] undefined!
ERROR: "dma_pool_create" [drivers/usb/host/xhci-hcd.ko] undefined!
ERROR: "bad_dma_ops" [drivers/usb/host/ohci-platform.ko] undefined!
ERROR: "dma_pool_destroy" [drivers/usb/host/ohci-hcd.ko] undefined!
ERROR: "bad_dma_ops" [drivers/usb/host/ohci-hcd.ko] undefined!
ERROR: "dma_pool_free" [drivers/usb/host/ohci-hcd.ko] undefined!
ERROR: "dma_pool_alloc" [drivers/usb/host/ohci-hcd.ko] undefined!
ERROR: "dma_pool_create" [drivers/usb/host/ohci-hcd.ko] undefined!
ERROR: "dma_pool_create" [drivers/usb/host/fotg210-hcd.ko] undefined!
ERROR: "bad_dma_ops" [drivers/usb/host/fotg210-hcd.ko] undefined!
ERROR: "dma_pool_destroy" [drivers/usb/host/fotg210-hcd.ko] undefined!
ERROR: "dma_pool_alloc" [drivers/usb/host/fotg210-hcd.ko] undefined!
ERROR: "dma_pool_free" [drivers/usb/host/fotg210-hcd.ko] undefined!
ERROR: "bad_dma_ops" [drivers/usb/host/ehci-platform.ko] undefined!
ERROR: "dma_pool_destroy" [drivers/usb/host/ehci-hcd.ko] undefined!
ERROR: "bad_dma_ops" [drivers/usb/host/ehci-hcd.ko] undefined!
ERROR: "dma_pool_free" [drivers/usb/host/ehci-hcd.ko] undefined!
ERROR: "dma_pool_alloc" [drivers/usb/host/ehci-hcd.ko] undefined!
ERROR: "dma_pool_create" [drivers/usb/host/ehci-hcd.ko] undefined!

Add dependencies on HAS_DMA to fix this.

Signed-off-by: Geert Uytterhoeven <ge...@linux-m68k.org>
---
v2:
  - Reword one-line summary.
---
 drivers/usb/host/Kconfig | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig
index 1f117c360ebbba33..573789698474ad8d 100644
--- a/drivers/usb/host/Kconfig
+++ b/drivers/usb/host/Kconfig
@@ -17,6 +17,7 @@ config USB_C67X00_HCD
 
 config USB_XHCI_HCD
tristate "xHCI HCD (USB 3.0) support"
+   depends on HAS_DMA
---help---
  The eXtensible Host Controller Interface (xHCI) is standard for USB 
3.0
  "SuperSpeed" host controller hardware.
@@ -70,6 +71,7 @@ endif # USB_XHCI_HCD
 
 config USB_EHCI_HCD
tristate "EHCI HCD (USB 2.0) support"
+   depends on HAS_DMA
---help---
  The Enhanced Host Controller Interface (EHCI) is standard for USB 2.0
  "high speed" (480 Mbit/sec, 60 Mbyte/sec) host controller hardware.
@@ -361,7 +363,7 @@ config USB_ISP1362_HCD
 
 config USB_FOTG210_HCD
tristate "FOTG210 HCD support"
-   depends on USB
+   depends on USB && HAS_DMA
---help---
  Faraday FOTG210 is an OTG controller which can be configured as
  an USB2.0 host. It is designed to meet USB2.0 EHCI specification
@@ -383,6 +385,7 @@ config USB_MAX3421_HCD
 
 config USB_OHCI_HCD
tristate "OHCI HCD (USB 1.1) support"
+   depends on HAS_DMA
---help---
  The Open Host Controller Interface (OHCI) is a standard for accessing
  USB 1.1 host controller hardware.  It does more in hardware than 
Intel's
-- 
1.9.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 v2 3/3] usb: dwc2: USB_DWC2 should depend on HAS_DMA

2016-02-16 Thread Geert Uytterhoeven
If NO_DMA=y:

ERROR: "usb_gadget_map_request" [drivers/usb/dwc2/dwc2.ko] undefined!
ERROR: "usb_gadget_unmap_request" [drivers/usb/dwc2/dwc2.ko] undefined!
ERROR: "bad_dma_ops" [drivers/usb/dwc2/dwc2.ko] undefined!

Add a dependency on HAS_DMA to fix this.

Signed-off-by: Geert Uytterhoeven <ge...@linux-m68k.org>
Acked-by: John Youn <johny...@synopsys.com>
---
v2:
  - Add Acked-by.
---
 drivers/usb/dwc2/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/usb/dwc2/Kconfig b/drivers/usb/dwc2/Kconfig
index fd95ba6ec317fdac..f0decc0d69b5197d 100644
--- a/drivers/usb/dwc2/Kconfig
+++ b/drivers/usb/dwc2/Kconfig
@@ -1,5 +1,6 @@
 config USB_DWC2
tristate "DesignWare USB2 DRD Core Support"
+   depends on HAS_DMA
depends on USB || USB_GADGET
help
  Say Y here if your system has a Dual Role Hi-Speed USB
-- 
1.9.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: [PATCH v2 1/3] usb: core: Allow compilation on platforms where NO_DMA=y

2016-02-21 Thread Geert Uytterhoeven
Hi Greg,

On Sun, Feb 21, 2016 at 5:23 AM, Greg Kroah-Hartman
<gre...@linuxfoundation.org> wrote:
> On Tue, Feb 16, 2016 at 04:10:57PM +0100, Geert Uytterhoeven wrote:
>> Some platforms don't have DMA, but we should still be able to build USB
>> drivers for these platforms. They could still be used through vhci_hcd,
>> usbip_host, or maybe something like USB passthrough in UML from a
>> capable host.
>>
>> If NO_DMA=y:
>>
>> ERROR: "dma_pool_destroy" [drivers/usb/core/usbcore.ko] undefined!
>> ERROR: "bad_dma_ops" [drivers/usb/core/usbcore.ko] undefined!
>> ERROR: "dma_pool_free" [drivers/usb/core/usbcore.ko] undefined!
>> ERROR: "dma_pool_alloc" [drivers/usb/core/usbcore.ko] undefined!
>> ERROR: "dma_pool_create" [drivers/usb/core/usbcore.ko] undefined!
>>
>> Add a few checks for CONFIG_HAS_DMA to fix this.
>>
>> Signed-off-by: Geert Uytterhoeven <ge...@linux-m68k.org>
>> Acked-by: Vegard Nossum <vegard.nos...@oracle.com>
>> ---
>> v2:
>>   - Replace remaining #ifdefs by IS_ENABLED() checks,
>>   - Add to patch description that this actually allows using USB on UML,
>>   - Add Acked-by.
>
> This patch didn't apply to my tree, can you rebase it against usb-next
> of usb.git and resend?

Are you sure it's this one that didn't apply? It's already in usb-testing?

"[2/3] usb: host: Host drivers relying on DMA should depend on HAS_DMA"
doesn't apply, as your tree gained some HAS_IOMEM dependencies, so I'll
resend.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
--
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: host: Host drivers relying on DMA should depend on HAS_DMA

2016-02-22 Thread Geert Uytterhoeven
If NO_DMA=y:

ERROR: "bad_dma_ops" [drivers/usb/host/xhci-plat-hcd.ko] undefined!
ERROR: "bad_dma_ops" [drivers/usb/host/xhci-mtk.ko] undefined!
ERROR: "dma_pool_destroy" [drivers/usb/host/xhci-hcd.ko] undefined!
ERROR: "bad_dma_ops" [drivers/usb/host/xhci-hcd.ko] undefined!
ERROR: "dma_pool_free" [drivers/usb/host/xhci-hcd.ko] undefined!
ERROR: "dma_pool_alloc" [drivers/usb/host/xhci-hcd.ko] undefined!
ERROR: "dma_pool_create" [drivers/usb/host/xhci-hcd.ko] undefined!
ERROR: "bad_dma_ops" [drivers/usb/host/ohci-platform.ko] undefined!
ERROR: "dma_pool_destroy" [drivers/usb/host/ohci-hcd.ko] undefined!
ERROR: "bad_dma_ops" [drivers/usb/host/ohci-hcd.ko] undefined!
ERROR: "dma_pool_free" [drivers/usb/host/ohci-hcd.ko] undefined!
ERROR: "dma_pool_alloc" [drivers/usb/host/ohci-hcd.ko] undefined!
ERROR: "dma_pool_create" [drivers/usb/host/ohci-hcd.ko] undefined!
ERROR: "dma_pool_create" [drivers/usb/host/fotg210-hcd.ko] undefined!
ERROR: "bad_dma_ops" [drivers/usb/host/fotg210-hcd.ko] undefined!
ERROR: "dma_pool_destroy" [drivers/usb/host/fotg210-hcd.ko] undefined!
ERROR: "dma_pool_alloc" [drivers/usb/host/fotg210-hcd.ko] undefined!
ERROR: "dma_pool_free" [drivers/usb/host/fotg210-hcd.ko] undefined!
ERROR: "bad_dma_ops" [drivers/usb/host/ehci-platform.ko] undefined!
ERROR: "dma_pool_destroy" [drivers/usb/host/ehci-hcd.ko] undefined!
ERROR: "bad_dma_ops" [drivers/usb/host/ehci-hcd.ko] undefined!
ERROR: "dma_pool_free" [drivers/usb/host/ehci-hcd.ko] undefined!
ERROR: "dma_pool_alloc" [drivers/usb/host/ehci-hcd.ko] undefined!
ERROR: "dma_pool_create" [drivers/usb/host/ehci-hcd.ko] undefined!

Add dependencies on HAS_DMA to fix this.

Signed-off-by: Geert Uytterhoeven <ge...@linux-m68k.org>
---
v3:
  - Rebased against usb-next of usb.git,

v2:
  - Reword one-line summary.
---
 drivers/usb/host/Kconfig | 9 -
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig
index 438dcf6289b08f82..81bb7d471f4eb51b 100644
--- a/drivers/usb/host/Kconfig
+++ b/drivers/usb/host/Kconfig
@@ -18,7 +18,7 @@ config USB_C67X00_HCD
 
 config USB_XHCI_HCD
tristate "xHCI HCD (USB 3.0) support"
-   depends on HAS_IOMEM
+   depends on HAS_DMA && HAS_IOMEM
---help---
  The eXtensible Host Controller Interface (xHCI) is standard for USB 
3.0
  "SuperSpeed" host controller hardware.
@@ -73,7 +73,7 @@ endif # USB_XHCI_HCD
 
 config USB_EHCI_HCD
tristate "EHCI HCD (USB 2.0) support"
-   depends on HAS_IOMEM
+   depends on HAS_DMA && HAS_IOMEM
---help---
  The Enhanced Host Controller Interface (EHCI) is standard for USB 2.0
  "high speed" (480 Mbit/sec, 60 Mbyte/sec) host controller hardware.
@@ -368,8 +368,7 @@ config USB_ISP1362_HCD
 
 config USB_FOTG210_HCD
tristate "FOTG210 HCD support"
-   depends on USB
-   depends on HAS_IOMEM
+   depends on USB && HAS_DMA && HAS_IOMEM
---help---
  Faraday FOTG210 is an OTG controller which can be configured as
  an USB2.0 host. It is designed to meet USB2.0 EHCI specification
@@ -391,7 +390,7 @@ config USB_MAX3421_HCD
 
 config USB_OHCI_HCD
tristate "OHCI HCD (USB 1.1) support"
-   depends on HAS_IOMEM
+   depends on HAS_DMA && HAS_IOMEM
---help---
  The Open Host Controller Interface (OHCI) is a standard for accessing
  USB 1.1 host controller hardware.  It does more in hardware than 
Intel's
-- 
1.9.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: [PATCH] usb: host: xhci-plat: add firmware for the R-Car M3 xHCI controllers

2016-04-12 Thread Geert Uytterhoeven
Hi Shimoda-san,

On Tue, Apr 12, 2016 at 8:42 AM, Yoshihiro Shimoda
<yoshihiro.shimoda...@renesas.com> wrote:
> This patch adds a firmware for the USB 3.0 host controllers of Renesas
> R-Car M3 SoC.

I guess you mean "R-Car M3-W"?

Gr{oetje,eeting}s,

    Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
--
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] lan78xx: Protect runtime_auto check by #ifdef CONFIG_PM

2016-03-20 Thread Geert Uytterhoeven
If CONFIG_PM=n:

drivers/net/usb/lan78xx.c: In function ‘lan78xx_get_stats64’:
drivers/net/usb/lan78xx.c:3274: error: ‘struct dev_pm_info’ has no member 
named ‘runtime_auto’

If PM is disabled, the runtime_auto flag is not available, but auto
suspend is not enabled anyway.  Hence protect the check for runtime_auto
by #ifdef CONFIG_PM to fix this.

Fixes: a59f8c5b048dc938 ("lan78xx: add ndo_get_stats64")
Reported-by: Guenter Roeck <li...@roeck-us.net>
Signed-off-by: Geert Uytterhoeven <ge...@linux-m68k.org>
---
Alternatively, we can add a dev_pm_runtime_auto_is_enabled() wrapper to
include/linux/pm.h, which always return false if CONFIG_PM is disabled.

The only other user in non-core code (drivers/usb/core/sysfs.c) has a
big #ifdef CONFIG_PM check around all PM-related code.

Thoughts?
---
 drivers/net/usb/lan78xx.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/usb/lan78xx.c b/drivers/net/usb/lan78xx.c
index d36d5ebf37f355f2..7b9ac47b2ecf9905 100644
--- a/drivers/net/usb/lan78xx.c
+++ b/drivers/net/usb/lan78xx.c
@@ -3271,7 +3271,9 @@ struct rtnl_link_stats64 *lan78xx_get_stats64(struct 
net_device *netdev,
 * periodic reading from HW will prevent from entering USB auto suspend.
 * if autosuspend is disabled, read from HW.
 */
+#ifdef CONFIG_PM
if (!dev->udev->dev.power.runtime_auto)
+#endif
lan78xx_update_stats(dev);
 
mutex_lock(>stats.access_lock);
-- 
1.9.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: [PATCH v8 4/4] power: wm831x_power: Support USB charger current limit management

2016-03-27 Thread Geert Uytterhoeven
On Thu, Mar 24, 2016 at 1:35 PM, Baolin Wang <baolin.w...@linaro.org> wrote:
> --- a/drivers/power/wm831x_power.c
> +++ b/drivers/power/wm831x_power.c
> @@ -13,6 +13,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>
>  #include 
>  #include 
> @@ -31,6 +32,8 @@ struct wm831x_power {
> char usb_name[20];
> char battery_name[20];
> bool have_battery;
> +   struct usb_charger *usb_charger;
> +   struct notifier_block usb_notify;
>  };
>
>  static int wm831x_power_check_online(struct wm831x *wm831x, int supply,
> @@ -125,6 +128,43 @@ static enum power_supply_property wm831x_usb_props[] = {
> POWER_SUPPLY_PROP_VOLTAGE_NOW,
>  };
>
> +/* In milliamps */
> +static unsigned int wm831x_usb_limits[] = {

const

> +   0,
> +   2,
> +   100,
> +   500,
> +   900,
> +   1500,
> +   1800,
> +   550,
> +};
> +
> +static int wm831x_usb_limit_change(struct notifier_block *nb,
> +  unsigned long limit, void *data)
> +{
> +   struct wm831x_power *wm831x_power = container_of(nb,
> +struct wm831x_power,
> +usb_notify);
> +   int i, best;

unsigned int

> +
> +   /* Find the highest supported limit */
> +   best = 0;
> +   for (i = 0; i < ARRAY_SIZE(wm831x_usb_limits); i++) {
> +   if (limit >= wm831x_usb_limits[i] &&
> +   wm831x_usb_limits[best] < wm831x_usb_limits[i])
> +   best = i;
> +   }
> +
> +       dev_dbg(wm831x_power->wm831x->dev,
> +   "Limiting USB current to %dmA", wm831x_usb_limits[best]);

%u

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
--
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 08/15] rtc: at91sam9: Add missing MFD_SYSCON dependency on HAS_IOMEM

2016-03-03 Thread Geert Uytterhoeven
On Thu, Mar 3, 2016 at 11:55 AM, Arnd Bergmann <a...@arndb.de> wrote:
> On Thursday 03 March 2016 17:03:34 Krzysztof Kozlowski wrote:
>> index 0da40e2e4280..5c530b6b125d 100644
>> --- a/drivers/rtc/Kconfig
>> +++ b/drivers/rtc/Kconfig
>> @@ -1302,6 +1302,7 @@ config RTC_DRV_AT91RM9200
>>  config RTC_DRV_AT91SAM9
>> tristate "AT91SAM9 RTT as RTC"
>> depends on ARCH_AT91 || COMPILE_TEST
>> +   depends on HAS_IOMEM# For MFD_SYSCON
>> select MFD_SYSCON
>> help
>>   Some AT91SAM9 SoCs provide an RTT (Real Time Timer) block which
>>
>
> This is technically correct, but the entire RTC menu is hidden
> inside of 'depends on !UML && !S390', so we won't ever get there
> on any configuration that does not use HAS_IOMEM.
>
> If we did, all other RTC drivers would also fail.

So UML has no RTC. Should/can it use RTC_DRV_GENERIC?

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
--
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 09/15] media: platform: Add missing MFD_SYSCON dependency on HAS_IOMEM

2016-03-03 Thread Geert Uytterhoeven
On Thu, Mar 3, 2016 at 11:57 AM, Arnd Bergmann <a...@arndb.de> wrote:
>> --- a/drivers/media/platform/exynos4-is/Kconfig
>> +++ b/drivers/media/platform/exynos4-is/Kconfig
>> @@ -17,6 +17,7 @@ config VIDEO_S5P_FIMC
>> tristate "S5P/EXYNOS4 FIMC/CAMIF camera interface driver"
>> depends on I2C
>> depends on HAS_DMA
>> +   depends on HAS_IOMEM# For MFD_SYSCON
>> select VIDEOBUF2_DMA_CONTIG
>> select V4L2_MEM2MEM_DEV
>
> This  is guarded by HAS_DMA, which implies HAS_IOMEM afaik.

No systems around with HV-based DMA?

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
--
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: renesas_usb3: Use ARCH_RENESAS

2016-03-02 Thread Geert Uytterhoeven
On Wed, Mar 2, 2016 at 3:17 AM, Simon Horman <horms+rene...@verge.net.au> wrote:
> Make use of ARCH_RENESAS in place of ARCH_SHMOBILE.
>
> This is part of an ongoing process to migrate from ARCH_SHMOBILE to
> ARCH_RENESAS the motivation for which being that RENESAS seems to be a more
> appropriate name than SHMOBILE for the majority of Renesas ARM based SoCs.
>
> Signed-off-by: Simon Horman <horms+rene...@verge.net.au>

Acked-by: Geert Uytterhoeven <geert+rene...@glider.be>

Gr{oetje,eeting}s,

    Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
--
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: host: xhci-rcar: Avoid long wait in xhci_reset()

2016-04-25 Thread Geert Uytterhoeven
Hi Shimoda-san,

On Thu, Apr 21, 2016 at 2:57 PM, Geert Uytterhoeven
<ge...@linux-m68k.org> wrote:
> On Thu, Apr 21, 2016 at 12:27 PM, Yoshihiro Shimoda
> <yoshihiro.shimoda...@renesas.com> wrote:
>>> > [1.565605] xhci-hcd ee00.usb: xHCI Host Controller
>>> > [1.570636] xhci-hcd ee00.usb: new USB bus registered, assigned 
>>> > bus number 5
>>> > [   22.270160] xhci-hcd ee00.usb: can't setup: -110
>>> > [   22.274931] xhci-hcd ee00.usb: USB bus 5 deregistered
>>> > [   22.280158] xhci-hcd: probe of ee00.usb failed with error -110
>>> >
>>> > The timestamp is strange to me. But, logs of R-Car H3 (ES1.0) and
>>> > R-Car H2 were the same.
>>>
>>> yeah, seems like your system timer is counting twice for each tick.
>>
>> Yes, I will investigate this later.
>
> The main clock crystal on Salvator-X is half of the expected value. But
> despite the correct value being in the DTS, there's some timer code that
> doesn't take this into account.

It's fixed by upgrading to bootloader v270:

-Architected cp15 timer(s) running at 16.66MHz (virt).
+Architected cp15 timer(s) running at 8.33MHz (virt).

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
--
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] usb: host: xhci-rcar: Avoid long wait in xhci_reset()

2016-04-25 Thread Geert Uytterhoeven
Hi Shimoda-san,

On Mon, Apr 25, 2016 at 4:10 AM, Yoshihiro Shimoda
<yoshihiro.shimoda...@renesas.com> wrote:
>> From: Rob Herring
>> Sent: Friday, April 22, 2016 10:29 PM
>> On Fri, Apr 22, 2016 at 4:36 AM, Felipe Balbi
>> <felipe.ba...@linux.intel.com> wrote:
>> > Yoshihiro Shimoda <yoshihiro.shimoda...@renesas.com> writes:
>> >> The firmware of R-Car USB 3.0 host controller will control the reset.
>> >> So, if the xhci driver doesn't do firmware downloading (e.g. kernel
>> >> configuration is CONFIG_USB_XHCI_PLATFORM=y and CONFIG_USB_XHCI_RCAR
>> >> is not set), the reset of USB 3.0 host controller doesn't work
>> >> correctly. Then, the host controller will cause long wait in
>> >> xhci_reset() because the CMD_RESET bit of op_regs->command is not
>> >> cleared for 10 seconds.
>> >>
>> >> So, this patch modifies the xhci_rcar_init_quirk() in xhci-rcar.h
>> >> to exit the probe function immediately.
>> >>
>> >> Fixes: 4ac8918f3a7 (usb: host: xhci-plat: add support for the R-Car H2 
>> >> and M2 xHCI controllers)
>> >> Cc: <sta...@vger.kernel.org> # v3.17+
>> >> Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda...@renesas.com>
>> >> ---
>> >>  Changes from v1:
>> >>   - Revise the commit log.
>> >> (http://www.spinics.net/lists/stable/msg130007.html)
>> >>
>> >>  drivers/usb/host/xhci-rcar.h | 6 +-
>> >>  1 file changed, 5 insertions(+), 1 deletion(-)
>> >>
>> >> diff --git a/drivers/usb/host/xhci-rcar.h b/drivers/usb/host/xhci-rcar.h
>> >> index 2941a25..2afed68 100644
>> >> --- a/drivers/usb/host/xhci-rcar.h
>> >> +++ b/drivers/usb/host/xhci-rcar.h
>> >> @@ -24,7 +24,11 @@ static inline void xhci_rcar_start(struct usb_hcd *hcd)
>> >>
>> >>  static inline int xhci_rcar_init_quirk(struct usb_hcd *hcd)
>> >>  {
>> >> - return 0;
>> >> + /*
>> >> +  * To avoid wait and timeout in xhci_reset() if CONFIG_XHCI_RCAR is
>> >> +  * disabled, this function fails.
>> >> +  */
>> >> + return -ENODEV;
>> >
>> > okay, if I understood correctly the thing is that you have a kernel
>> > built with XHCI platform support but without XHCI RCAR support. Then, if
>> > you run this kernel on RCAR board, you see this CMD_RESET problem,
>> > right?

[...]

>> We should fix this in kconfig to always enable the option when RCAR is
>> enabled IMO.
>
> I could fix this in kconfig like the followings:
>
> diff --git a/arch/arm/mach-shmobile/Kconfig b/arch/arm/mach-shmobile/Kconfig
> index f2bc5c3..905d1d2 100644
> --- a/arch/arm/mach-shmobile/Kconfig
> +++ b/arch/arm/mach-shmobile/Kconfig
> @@ -46,6 +46,7 @@ menuconfig ARCH_RENESAS
> select PINCTRL
> select ARCH_REQUIRE_GPIOLIB
> select ZONE_DMA if ARM_LPAE
> +   select USB_XHCI_RCAR if USB_XHCI_HCD
>
>  if ARCH_RENESAS
>
> diff --git a/arch/arm64/Kconfig.platforms b/arch/arm64/Kconfig.platforms
> index efa77c1..010d2b7 100644
> --- a/arch/arm64/Kconfig.platforms
> +++ b/arch/arm64/Kconfig.platforms
> @@ -105,6 +105,7 @@ config ARCH_RENESAS
> select PM
> select PM_GENERIC_DOMAINS
> select RENESAS_IRQC
> +   select USB_XHCI_RCAR if USB_XHCI_HCD
> help
>   This enables support for the ARMv8 based Renesas SoCs.
>
> If this is acceptable, I will send each patch to arm / arm64.

What about enforcing this in a single place instead, i.e. in
drivers/usb/host/Kconfig?

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
--
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 49/54] MAINTAINERS: Add file patterns for usb device tree bindings

2016-05-22 Thread Geert Uytterhoeven
Submitters of device tree binding documentation may forget to CC
the subsystem maintainer if this is missing.

Signed-off-by: Geert Uytterhoeven <ge...@linux-m68k.org>
Cc: Greg Kroah-Hartman <gre...@linuxfoundation.org>
Cc: linux-usb@vger.kernel.org
---
Please apply this patch directly if you want to be involved in device
tree binding documentation for your subsystem.
---
 MAINTAINERS | 1 +
 1 file changed, 1 insertion(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index 4f8c1a45fead33af..d79cedf604642ee4 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -11994,6 +11994,7 @@ L:  linux-usb@vger.kernel.org
 W: http://www.linux-usb.org
 T: git git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git
 S: Supported
+F: Documentation/devicetree/bindings/usb/
 F: Documentation/usb/
 F: drivers/usb/
 F: include/linux/usb.h
-- 
1.9.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: [PATCH] usb: host: xhci-rcar: Avoid long wait in xhci_reset()

2016-04-21 Thread Geert Uytterhoeven
On Thu, Apr 21, 2016 at 12:27 PM, Yoshihiro Shimoda
<yoshihiro.shimoda...@renesas.com> wrote:
>> > [1.565605] xhci-hcd ee00.usb: xHCI Host Controller
>> > [1.570636] xhci-hcd ee00.usb: new USB bus registered, assigned bus 
>> > number 5
>> > [   22.270160] xhci-hcd ee00.usb: can't setup: -110
>> > [   22.274931] xhci-hcd ee00.usb: USB bus 5 deregistered
>> > [   22.280158] xhci-hcd: probe of ee00.usb failed with error -110
>> >
>> > The timestamp is strange to me. But, logs of R-Car H3 (ES1.0) and
>> > R-Car H2 were the same.
>>
>> yeah, seems like your system timer is counting twice for each tick.
>
> Yes, I will investigate this later.

The main clock crystal on Salvator-X is half of the expected value. But
despite the correct value being in the DTS, there's some timer code that
doesn't take this into account.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
--
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: renesas_usbhs: add a compatible string for r8a7796

2016-08-25 Thread Geert Uytterhoeven
On Wed, Aug 24, 2016 at 9:39 AM, Yoshihiro Shimoda
<yoshihiro.shimoda...@renesas.com> wrote:
> This patch adds support for r8a7796 (R-Car M3-W).
>
> Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda...@renesas.com>

Acked-by: Geert Uytterhoeven <geert+rene...@glider.be>

Gr{oetje,eeting}s,

        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
--
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/26] constify local structures

2016-09-12 Thread Geert Uytterhoeven
On Mon, Sep 12, 2016 at 3:43 PM, Felipe Balbi
<felipe.ba...@linux.intel.com> wrote:
> Jarkko Sakkinen <jarkko.sakki...@linux.intel.com> writes:
>> On Mon, Sep 12, 2016 at 10:54:07AM +0200, Julia Lawall wrote:
>>> On Sun, 11 Sep 2016, Jarkko Sakkinen wrote:
>>> > On Sun, Sep 11, 2016 at 03:05:42PM +0200, Julia Lawall wrote:
>>> > > Constify local structures.
>>> > >
>>> > > The semantic patch that makes this change is as follows:
>>> > > (http://coccinelle.lip6.fr/)
>>> >
>>> > Just my two cents but:
>>> >
>>> > 1. You *can* use a static analysis too to find bugs or other issues.
>>> > 2. However, you should manually do the commits and proper commit
>>> >messages to subsystems based on your findings. And I generally think
>>> >that if one contributes code one should also at least smoke test 
>>> > changes
>>> >somehow.
>>> >
>>> > I don't know if I'm alone with my opinion. I just think that one should
>>> > also do the analysis part and not blindly create and submit patches.
>>>
>>> All of the patches are compile tested.  And the individual patches are
>>
>> Compile-testing is not testing. If you are not able to test a commit,
>> you should explain why.
>
> Dude, Julia has been doing semantic patching for years already and
> nobody has raised any concerns so far. There's already an expectation
> that Coccinelle *works* and Julia's sematic patches are sound.

+1

> Besides, adding 'const' is something that causes virtually no functional
> changes to the point that build-testing is really all you need. Any
> problems caused by adding 'const' to a definition will be seen by build
> errors or warnings.

Unfortunately in this particular case they could lead to failures that can only
be detected at runtime, when failing o write to a read-only piece of memory,
due to the casting away of the constness of the pointers later.
Fortunately this was detected during code review (doh...).

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
--
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: musb: mark PM functions as __maybe_unused

2016-11-28 Thread Geert Uytterhoeven
On Tue, Nov 22, 2016 at 3:30 PM, Arnd Bergmann <a...@arndb.de> wrote:
> Building without CONFIG_PM causes a harmless warning:
>
> drivers/usb/musb/musb_core.c:2041:12: error: ‘musb_run_resume_work’ defined 
> but not used [-Werror=unused-function]
>
> Removing the #ifdef around the PM code and instead marking the suspend/resume
> functions as __maybe_unused will do the right thing without warning.
>
> Fixes: ea2f35c01d5e ("usb: musb: Fix sleeping function called from invalid 
> context for hdrc glue")
> Signed-off-by: Arnd Bergmann <a...@arndb.de>

linux-m68k-allmodconfig$ bloat-o-meter drivers/usb/musb/musb_core.o{.orig,}
add/remove: 8/0 grow/shrink: 0/0 up/down: 2344/0 (2344)
function old new   delta
musb_restore_context   - 892+892
musb_save_context  - 690+690
musb_run_resume_work   - 190+190
musb_resume- 182+182
musb_runtime_resume- 148+148
musb_suspend   - 114+114
musb_dev_pm_ops-  92 +92
musb_runtime_suspend   -  36 +36
Total: Before=13091, After=15435, chg +17.91%

Doh...

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
--
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: musb: mark PM functions as __maybe_unused

2016-11-28 Thread Geert Uytterhoeven
Hi Arnd,

On Mon, Nov 28, 2016 at 11:54 AM, Arnd Bergmann <a...@arndb.de> wrote:
> On Monday, November 28, 2016 11:51:37 AM CET Geert Uytterhoeven wrote:
>> On Tue, Nov 22, 2016 at 3:30 PM, Arnd Bergmann <a...@arndb.de> wrote:
>> > Building without CONFIG_PM causes a harmless warning:
>> >
>> > drivers/usb/musb/musb_core.c:2041:12: error: ‘musb_run_resume_work’ 
>> > defined but not used [-Werror=unused-function]
>> >
>> > Removing the #ifdef around the PM code and instead marking the 
>> > suspend/resume
>> > functions as __maybe_unused will do the right thing without warning.
>> >
>> > Fixes: ea2f35c01d5e ("usb: musb: Fix sleeping function called from invalid 
>> > context for hdrc glue")
>> > Signed-off-by: Arnd Bergmann <a...@arndb.de>
>>
>> linux-m68k-allmodconfig$ bloat-o-meter drivers/usb/musb/musb_core.o{.orig,}
>> add/remove: 8/0 grow/shrink: 0/0 up/down: 2344/0 (2344)
>> function old new   delta
>> musb_restore_context   - 892+892
>> musb_save_context  - 690+690
>> musb_run_resume_work   - 190+190
>> musb_resume- 182+182
>> musb_runtime_resume- 148+148
>> musb_suspend   - 114+114
>> musb_dev_pm_ops-  92 +92
>> musb_runtime_suspend   -  36 +36
>> Total: Before=13091, After=15435, chg +17.91%
>
> Well, in allmodconfig, you have CONFIG_PM enabled, so this is not
> dead code but actually does what was intended (though possibly
> not written as efficiently as it could have been).

M68k does not have CONFIG_PM.

> In a configuration without CONFIG_PM, there should ideally be
> no added code.

Apparently not :-(

BTW, same result for allyesconfig.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
--
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: serial: cp210x: Use tcflag_t to fix incompatible pointer type

2016-11-21 Thread Geert Uytterhoeven
On sparc32, tcflag_t is unsigned long, unlike all other architectures:

drivers/usb/serial/cp210x.c: In function 'cp210x_get_termios':
drivers/usb/serial/cp210x.c:717:3: warning: passing argument 2 of 
'cp210x_get_termios_port' from incompatible pointer type
   cp210x_get_termios_port(tty->driver_data,
   ^
drivers/usb/serial/cp210x.c:35:13: note: expected 'unsigned int *' but 
argument is of type 'tcflag_t *'
 static void cp210x_get_termios_port(struct usb_serial_port *port,
 ^

Consistently use tcflag_t to fix this.

Signed-off-by: Geert Uytterhoeven <ge...@linux-m68k.org>
---
 drivers/usb/serial/cp210x.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c
index f61477bed3a8d3b1..e138decfc844dff8 100644
--- a/drivers/usb/serial/cp210x.c
+++ b/drivers/usb/serial/cp210x.c
@@ -33,7 +33,7 @@
 static void cp210x_close(struct usb_serial_port *);
 static void cp210x_get_termios(struct tty_struct *, struct usb_serial_port *);
 static void cp210x_get_termios_port(struct usb_serial_port *port,
-   unsigned int *cflagp, unsigned int *baudp);
+   tcflag_t *cflagp, unsigned int *baudp);
 static void cp210x_change_speed(struct tty_struct *, struct usb_serial_port *,
struct ktermios *);
 static void cp210x_set_termios(struct tty_struct *, struct usb_serial_port *,
@@ -718,7 +718,7 @@ static void cp210x_get_termios(struct tty_struct *tty,
>termios.c_cflag, );
tty_encode_baud_rate(tty, baud, baud);
} else {
-   unsigned int cflag;
+   tcflag_t cflag;
cflag = 0;
cp210x_get_termios_port(port, , );
}
@@ -729,10 +729,10 @@ static void cp210x_get_termios(struct tty_struct *tty,
  * This is the heart of cp210x_get_termios which always uses a 
_serial_port.
  */
 static void cp210x_get_termios_port(struct usb_serial_port *port,
-   unsigned int *cflagp, unsigned int *baudp)
+   tcflag_t *cflagp, unsigned int *baudp)
 {
struct device *dev = >dev;
-   unsigned int cflag;
+   tcflag_t cflag;
struct cp210x_flow_ctl flow_ctl;
u32 baud;
u16 bits;
-- 
1.9.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] USB: serial: f81534: Detect errors from f81534_logic_to_phy_port()

2016-12-14 Thread Geert Uytterhoeven
With gcc 4.1.2:

drivers/usb/serial/f81534.c: In function ‘f81534_port_probe’:
drivers/usb/serial/f81534.c:1250: warning: comparison is always false due 
to limited range of data type

f81534_logic_to_phy_port() may return a negative error value, which is
ignored by assigning it to u8 f81534_port_private.phy_num.

Use an intermediate variable of type int to fix this.
While at it, forward the actual error code instead of converting it to
-ENODEV.

Fixes: 0c9bd6004d258d46 ("USB: serial: add Fintek F81532/534 driver")
Signed-off-by: Geert Uytterhoeven <ge...@linux-m68k.org>
---
 drivers/usb/serial/f81534.c | 9 +++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/serial/f81534.c b/drivers/usb/serial/f81534.c
index 8282a6a18fee83f6..2acad268f9d15f43 100644
--- a/drivers/usb/serial/f81534.c
+++ b/drivers/usb/serial/f81534.c
@@ -1237,6 +1237,7 @@ static int f81534_attach(struct usb_serial *serial)
 static int f81534_port_probe(struct usb_serial_port *port)
 {
struct f81534_port_private *port_priv;
+   int ret;
 
port_priv = devm_kzalloc(>dev, sizeof(*port_priv), GFP_KERNEL);
if (!port_priv)
@@ -1246,10 +1247,14 @@ static int f81534_port_probe(struct usb_serial_port 
*port)
mutex_init(_priv->mcr_mutex);
 
/* Assign logic-to-phy mapping */
-   port_priv->phy_num = f81534_logic_to_phy_port(port->serial, port);
-   if (port_priv->phy_num < 0 || port_priv->phy_num >= F81534_NUM_PORT)
+   ret = f81534_logic_to_phy_port(port->serial, port);
+   if (ret < 0)
+   return ret;
+
+   if (ret >= F81534_NUM_PORT)
return -ENODEV;
 
+   port_priv->phy_num = ret;
usb_set_serial_port_data(port, port_priv);
dev_dbg(>dev, "%s: port_number: %d, phy_num: %d\n", __func__,
port->port_number, port_priv->phy_num);
-- 
1.9.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


  1   2   3   >