Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1614929 > unrolled thread

[PATCH linux-next v3 0/4] usb: gadget: udc: atmel: Endpoint allocation scheme fixes

Started by<cristian.birsan@microchip.com>
First post2017-04-03 09:30 +0200
Last post2017-04-07 18:10 +0200
Articles 5 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH linux-next v3 0/4] usb: gadget: udc: atmel: Endpoint allocation scheme fixes <cristian.birsan@microchip.com> - 2017-04-03 09:30 +0200
    [PATCH linux-next v3 1/4] usb: gadget: udc: atmel: Check fifo configuration values against device tree <cristian.birsan@microchip.com> - 2017-04-03 09:30 +0200
    [PATCH linux-next v3 2/4] usb: gadget: udc: atmel: Minor code cleanup <cristian.birsan@microchip.com> - 2017-04-03 09:30 +0200
      Re: [PATCH linux-next v3 2/4] usb: gadget: udc: atmel: Minor code cleanup Felipe Balbi <balbi@kernel.org> - 2017-04-05 14:40 +0200
        Re: [PATCH linux-next v3 2/4] usb: gadget: udc: atmel: Minor code  cleanup m91496 <Cristian.Birsan@microchip.com> - 2017-04-07 18:10 +0200

#1614929 — [PATCH linux-next v3 0/4] usb: gadget: udc: atmel: Endpoint allocation scheme fixes

From<cristian.birsan@microchip.com>
Date2017-04-03 09:30 +0200
Subject[PATCH linux-next v3 0/4] usb: gadget: udc: atmel: Endpoint allocation scheme fixes
Message-ID<ts4B4-3Mv-11@gated-at.bofh.it>
From: Cristian Birsan <cristian.birsan@microchip.com>

This patch series provides fixes, based on the feedback received on the mailing list, for
the following:
	- fifo table parameters validation against device tree values
	- coding style
	- message display for EP configuration error
	- Kconfig comments for fifo_mode=0

Changes since v1:
	- Removed static for usba_config_fifo_table() function from "Check fifo
	configuration values against device tree" patch

Changes since v2:
	- Use shorter warning message if the fifo table size is greather than device 
	tree value
	- replace dev_warn() with dev_err() for hardware fifo allocation error

Cristian Birsan (4):
  usb: gadget: udc: atmel: Check fifo configuration values against
    device tree
  usb: gadget: udc: atmel: Minor code cleanup
  usb: gadget: udc: atmel: Use dev_err() to display EP configuration
    error
  usb: gadget: udc: atmel: Update Kconfig help for fifo_mode = 0

 drivers/usb/gadget/udc/Kconfig          |  5 ++--
 drivers/usb/gadget/udc/atmel_usba_udc.c | 49 ++++++++++++++++++++++-----------
 2 files changed, 36 insertions(+), 18 deletions(-)

-- 
2.7.4

[toc] | [next] | [standalone]


#1614930 — [PATCH linux-next v3 1/4] usb: gadget: udc: atmel: Check fifo configuration values against device tree

From<cristian.birsan@microchip.com>
Date2017-04-03 09:30 +0200
Subject[PATCH linux-next v3 1/4] usb: gadget: udc: atmel: Check fifo configuration values against device tree
Message-ID<ts4B4-3Mv-21@gated-at.bofh.it>
In reply to#1614929
From: Cristian Birsan <cristian.birsan@microchip.com>

Check fifo configuration values against device tree values for endpoint fifo
in auto configuration mode (fifo_mode=0).

Signed-off-by: Cristian Birsan <cristian.birsan@microchip.com>
Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com>
---
 drivers/usb/gadget/udc/atmel_usba_udc.c | 24 ++++++++++++++++++++++--
 1 file changed, 22 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/gadget/udc/atmel_usba_udc.c b/drivers/usb/gadget/udc/atmel_usba_udc.c
index 2035906b..a98734a 100644
--- a/drivers/usb/gadget/udc/atmel_usba_udc.c
+++ b/drivers/usb/gadget/udc/atmel_usba_udc.c
@@ -2118,14 +2118,34 @@ static struct usba_ep * atmel_udc_of_init(struct platform_device *pdev,
 			dev_err(&pdev->dev, "of_probe: fifo-size error(%d)\n", ret);
 			goto err;
 		}
-		ep->fifo_size = fifo_mode ? udc->fifo_cfg[i].fifo_size : val;
+		if (fifo_mode) {
+			if (val < udc->fifo_cfg[i].fifo_size) {
+				dev_warn(&pdev->dev,
+					 "Using max fifo-size value from DT\n");
+				ep->fifo_size = val;
+			} else {
+				ep->fifo_size = udc->fifo_cfg[i].fifo_size;
+			}
+		} else {
+			ep->fifo_size = val;
+		}
 
 		ret = of_property_read_u32(pp, "atmel,nb-banks", &val);
 		if (ret) {
 			dev_err(&pdev->dev, "of_probe: nb-banks error(%d)\n", ret);
 			goto err;
 		}
-		ep->nr_banks = fifo_mode ? udc->fifo_cfg[i].nr_banks : val;
+		if (fifo_mode) {
+			if (val < udc->fifo_cfg[i].nr_banks) {
+				dev_warn(&pdev->dev,
+					 "Using max nb-banks value from DT\n");
+				ep->nr_banks = val;
+			} else {
+				ep->nr_banks = udc->fifo_cfg[i].nr_banks;
+			}
+		} else {
+			ep->nr_banks = val;
+		}
 
 		ep->can_dma = of_property_read_bool(pp, "atmel,can-dma");
 		ep->can_isoc = of_property_read_bool(pp, "atmel,can-isoc");
-- 
2.7.4

[toc] | [prev] | [next] | [standalone]


#1614931 — [PATCH linux-next v3 2/4] usb: gadget: udc: atmel: Minor code cleanup

From<cristian.birsan@microchip.com>
Date2017-04-03 09:30 +0200
Subject[PATCH linux-next v3 2/4] usb: gadget: udc: atmel: Minor code cleanup
Message-ID<ts4B4-3Mv-23@gated-at.bofh.it>
In reply to#1614929
From: Cristian Birsan <cristian.birsan@microchip.com>

Minor code cleanup based on feedback received on mailinglist.

Signed-off-by: Cristian Birsan <cristian.birsan@microchip.com>
Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com>
---
 drivers/usb/gadget/udc/atmel_usba_udc.c | 17 +++++++----------
 1 file changed, 7 insertions(+), 10 deletions(-)

diff --git a/drivers/usb/gadget/udc/atmel_usba_udc.c b/drivers/usb/gadget/udc/atmel_usba_udc.c
index a98734a..8bc0b52a 100644
--- a/drivers/usb/gadget/udc/atmel_usba_udc.c
+++ b/drivers/usb/gadget/udc/atmel_usba_udc.c
@@ -321,7 +321,6 @@ static inline void usba_cleanup_debugfs(struct usba_udc *udc)
 
 static ushort fifo_mode;
 
-/* "modprobe ... fifo_mode=1" etc */
 module_param(fifo_mode, ushort, 0x0);
 MODULE_PARM_DESC(fifo_mode, "Endpoint configuration mode");
 
@@ -371,7 +370,7 @@ static struct usba_fifo_cfg mode_4_cfg[] = {
 };
 /* Add additional configurations here */
 
-int usba_config_fifo_table(struct usba_udc *udc)
+static int usba_config_fifo_table(struct usba_udc *udc)
 {
 	int n;
 
@@ -1076,11 +1075,9 @@ static int atmel_usba_start(struct usb_gadget *gadget,
 		struct usb_gadget_driver *driver);
 static int atmel_usba_stop(struct usb_gadget *gadget);
 
-static struct usb_ep *atmel_usba_match_ep(
-		struct usb_gadget		*gadget,
-		struct usb_endpoint_descriptor	*desc,
-		struct usb_ss_ep_comp_descriptor *ep_comp
-)
+static struct usb_ep *atmel_usba_match_ep(struct usb_gadget *gadget,
+				struct usb_endpoint_descriptor	*desc,
+				struct usb_ss_ep_comp_descriptor *ep_comp)
 {
 	struct usb_ep	*_ep;
 	struct usba_ep *ep;
@@ -1100,7 +1097,6 @@ static struct usb_ep *atmel_usba_match_ep(
 		ep = to_usba_ep(_ep);
 
 		switch (usb_endpoint_type(desc)) {
-
 		case USB_ENDPOINT_XFER_CONTROL:
 			break;
 
@@ -1141,7 +1137,7 @@ static struct usb_ep *atmel_usba_match_ep(
 		ep->udc->configured_ep++;
 	}
 
-return _ep;
+	return _ep;
 }
 
 static const struct usb_gadget_ops usba_udc_ops = {
@@ -2089,8 +2085,9 @@ static struct usba_ep * atmel_udc_of_init(struct platform_device *pdev,
 		while ((pp = of_get_next_child(np, pp)))
 			udc->num_ep++;
 		udc->configured_ep = 1;
-	} else
+	} else {
 		udc->num_ep = usba_config_fifo_table(udc);
+	}
 
 	eps = devm_kzalloc(&pdev->dev, sizeof(struct usba_ep) * udc->num_ep,
 			   GFP_KERNEL);
-- 
2.7.4

[toc] | [prev] | [next] | [standalone]


#1616894 — Re: [PATCH linux-next v3 2/4] usb: gadget: udc: atmel: Minor code cleanup

FromFelipe Balbi <balbi@kernel.org>
Date2017-04-05 14:40 +0200
SubjectRe: [PATCH linux-next v3 2/4] usb: gadget: udc: atmel: Minor code cleanup
Message-ID<tsSoa-2BK-21@gated-at.bofh.it>
In reply to#1614931

[Multipart message — attachments visible in raw view] — view raw

Hi,

cristian.birsan@microchip.com writes:
> From: Cristian Birsan <cristian.birsan@microchip.com>
>
> Minor code cleanup based on feedback received on mailinglist.
>
> Signed-off-by: Cristian Birsan <cristian.birsan@microchip.com>
> Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com>

patch 1 applied fine, patch 2 didn't. Please rebase on testing/next

-- 
balbi

[toc] | [prev] | [next] | [standalone]


#1618929 — Re: [PATCH linux-next v3 2/4] usb: gadget: udc: atmel: Minor code cleanup

Fromm91496 <Cristian.Birsan@microchip.com>
Date2017-04-07 18:10 +0200
SubjectRe: [PATCH linux-next v3 2/4] usb: gadget: udc: atmel: Minor code cleanup
Message-ID<ttECt-13t-7@gated-at.bofh.it>
In reply to#1616894
Hi,

The patch 2 does not apply because it's already on testing/next.

I'll send a new patch series version that will apply clean on top of testing branch.

Regards,
Cristi

On 05.04.2017 15:33, Felipe Balbi wrote:
> 
> Hi,
> 
> cristian.birsan@microchip.com writes:
>> From: Cristian Birsan <cristian.birsan@microchip.com>
>>
>> Minor code cleanup based on feedback received on mailinglist.
>>
>> Signed-off-by: Cristian Birsan <cristian.birsan@microchip.com>
>> Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com>
> 
> patch 1 applied fine, patch 2 didn't. Please rebase on testing/next
> 

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web