Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1580624 > unrolled thread
| Started by | <cristian.birsan@microchip.com> |
|---|---|
| First post | 2017-02-14 17:10 +0100 |
| Last post | 2017-02-15 10:10 +0100 |
| Articles | 6 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH 0/4 linux-next] usb: gadget: udc: atmel: Endpoint allocation scheme fixes <cristian.birsan@microchip.com> - 2017-02-14 17:10 +0100
[PATCH 2/4 linux-next] usb: gadget: udc: atmel: Minor code cleanup <cristian.birsan@microchip.com> - 2017-02-14 17:20 +0100
[PATCH 3/4 linux-next] usb: gadget: udc: atmel: Use dev_warn() to display EP configuration error <cristian.birsan@microchip.com> - 2017-02-14 17:20 +0100
[PATCH 1/4 linux-next] usb: gadget: udc: atmel: Check fifo configuration values against device tree <cristian.birsan@microchip.com> - 2017-02-14 17:20 +0100
[PATCH 4/4 linux-next] usb: gadget: udc: atmel: Update Kconfig help for fifo_mode = 0 <cristian.birsan@microchip.com> - 2017-02-14 17:20 +0100
Re: [PATCH 0/4 linux-next] usb: gadget: udc: atmel: Endpoint allocation scheme fixes Nicolas Ferre <nicolas.ferre@atmel.com> - 2017-02-15 10:10 +0100
| From | <cristian.birsan@microchip.com> |
|---|---|
| Date | 2017-02-14 17:10 +0100 |
| Subject | [PATCH 0/4 linux-next] usb: gadget: udc: atmel: Endpoint allocation scheme fixes |
| Message-ID | <taNPX-41e-5@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
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_warn() 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 | 47 ++++++++++++++++++++++-----------
2 files changed, 35 insertions(+), 17 deletions(-)
--
2.7.4
[toc] | [next] | [standalone]
| From | <cristian.birsan@microchip.com> |
|---|---|
| Date | 2017-02-14 17:20 +0100 |
| Subject | [PATCH 2/4 linux-next] usb: gadget: udc: atmel: Minor code cleanup |
| Message-ID | <taNZD-44x-1@gated-at.bofh.it> |
| In reply to | #1580624 |
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>
---
drivers/usb/gadget/udc/atmel_usba_udc.c | 15 ++++++---------
1 file changed, 6 insertions(+), 9 deletions(-)
diff --git a/drivers/usb/gadget/udc/atmel_usba_udc.c b/drivers/usb/gadget/udc/atmel_usba_udc.c
index ce8bf8b..3becb28 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");
@@ -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]
| From | <cristian.birsan@microchip.com> |
|---|---|
| Date | 2017-02-14 17:20 +0100 |
| Subject | [PATCH 3/4 linux-next] usb: gadget: udc: atmel: Use dev_warn() to display EP configuration error |
| Message-ID | <taNZD-44x-3@gated-at.bofh.it> |
| In reply to | #1580624 |
From: Cristian Birsan <cristian.birsan@microchip.com> Use dev_warn() to display EP configuration error to avoid silent failure. Signed-off-by: Cristian Birsan <cristian.birsan@microchip.com> --- drivers/usb/gadget/udc/atmel_usba_udc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/usb/gadget/udc/atmel_usba_udc.c b/drivers/usb/gadget/udc/atmel_usba_udc.c index 3becb28..50f018a 100644 --- a/drivers/usb/gadget/udc/atmel_usba_udc.c +++ b/drivers/usb/gadget/udc/atmel_usba_udc.c @@ -1851,7 +1851,7 @@ static irqreturn_t usba_udc_irq(int irq, void *devid) * but it's clearly harmless... */ if (!(usba_ep_readl(ep0, CFG) & USBA_EPT_MAPPED)) - dev_dbg(&udc->pdev->dev, + dev_warn(&udc->pdev->dev, "ODD: EP0 configuration is invalid!\n"); /* Preallocate other endpoints */ @@ -1860,8 +1860,8 @@ static irqreturn_t usba_udc_irq(int irq, void *devid) ep = &udc->usba_ep[i]; usba_ep_writel(ep, CFG, ep->ept_cfg); if (!(usba_ep_readl(ep, CFG) & USBA_EPT_MAPPED)) - dev_dbg(&udc->pdev->dev, - "ODD: EP%d configuration is invalid!\n", i); + dev_warn(&udc->pdev->dev, + "ODD: EP%d configuration is invalid!\n", i); } } -- 2.7.4
[toc] | [prev] | [next] | [standalone]
| From | <cristian.birsan@microchip.com> |
|---|---|
| Date | 2017-02-14 17:20 +0100 |
| Subject | [PATCH 1/4 linux-next] usb: gadget: udc: atmel: Check fifo configuration values against device tree |
| Message-ID | <taNZD-44x-15@gated-at.bofh.it> |
| In reply to | #1580624 |
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>
---
drivers/usb/gadget/udc/atmel_usba_udc.c | 26 +++++++++++++++++++++++---
1 file changed, 23 insertions(+), 3 deletions(-)
diff --git a/drivers/usb/gadget/udc/atmel_usba_udc.c b/drivers/usb/gadget/udc/atmel_usba_udc.c
index 11bbce2..ce8bf8b 100644
--- a/drivers/usb/gadget/udc/atmel_usba_udc.c
+++ b/drivers/usb/gadget/udc/atmel_usba_udc.c
@@ -371,7 +371,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;
@@ -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,
+ "of_probe: fifo-size table value not supported by HW, using DT value\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,
+ "of_probe: nb-banks table value not supported by HW, using DT value\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]
| From | <cristian.birsan@microchip.com> |
|---|---|
| Date | 2017-02-14 17:20 +0100 |
| Subject | [PATCH 4/4 linux-next] usb: gadget: udc: atmel: Update Kconfig help for fifo_mode = 0 |
| Message-ID | <taNZE-44x-23@gated-at.bofh.it> |
| In reply to | #1580624 |
From: Cristian Birsan <cristian.birsan@microchip.com> Update Kconfig help for fifo_mode = 0 to explain the behavior better. Signed-off-by: Cristian Birsan <cristian.birsan@microchip.com> --- drivers/usb/gadget/udc/Kconfig | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/usb/gadget/udc/Kconfig b/drivers/usb/gadget/udc/Kconfig index 4b69f28..be94eb9 100644 --- a/drivers/usb/gadget/udc/Kconfig +++ b/drivers/usb/gadget/udc/Kconfig @@ -62,8 +62,9 @@ config USB_ATMEL_USBA The fifo_mode parameter is used to select endpoint allocation mode. fifo_mode = 0 is used to let the driver autoconfigure the endpoints. - In this case 2 banks are allocated for isochronous endpoints and - only one bank is allocated for the rest of the endpoints. + In this case, for ep1 2 banks are allocated if it works in isochronous + mode and only 1 bank otherwise. For the rest of the endpoints + only 1 bank is allocated. fifo_mode = 1 is a generic maximum fifo size (1024 bytes) configuration allowing the usage of ep1 - ep6 -- 2.7.4
[toc] | [prev] | [next] | [standalone]
| From | Nicolas Ferre <nicolas.ferre@atmel.com> |
|---|---|
| Date | 2017-02-15 10:10 +0100 |
| Subject | Re: [PATCH 0/4 linux-next] usb: gadget: udc: atmel: Endpoint allocation scheme fixes |
| Message-ID | <tb3L3-6qS-5@gated-at.bofh.it> |
| In reply to | #1580624 |
Le 14/02/2017 à 17:09, cristian.birsan@microchip.com a écrit : > 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 > > 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_warn() 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 | 47 ++++++++++++++++++++++----------- > 2 files changed, 35 insertions(+), 17 deletions(-) I'm okay with the whole series: Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com> Thanks, regards, -- Nicolas Ferre
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web