diff options
author | Cristian Birsan <cristian.birsan@microchip.com> | 2017-04-03 10:19:51 +0300 |
---|---|---|
committer | Felipe Balbi <felipe.balbi@linux.intel.com> | 2017-04-11 10:58:27 +0300 |
commit | b378e3bc3bd3e570293e1b99c6a82d62f1a2c563 (patch) | |
tree | dff66b87a95c27dee09b31816b5c90a5e6ec9fed /drivers/usb | |
parent | d7b2bff161cfa3fd53209b6a93d25e544aad8cc0 (diff) | |
download | op-kernel-dev-b378e3bc3bd3e570293e1b99c6a82d62f1a2c563.zip op-kernel-dev-b378e3bc3bd3e570293e1b99c6a82d62f1a2c563.tar.gz |
usb: gadget: udc: atmel: Check fifo configuration values against device tree
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>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Diffstat (limited to 'drivers/usb')
-rw-r--r-- | drivers/usb/gadget/udc/atmel_usba_udc.c | 24 |
1 files 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 750c046..8bc0b52a 100644 --- a/drivers/usb/gadget/udc/atmel_usba_udc.c +++ b/drivers/usb/gadget/udc/atmel_usba_udc.c @@ -2115,14 +2115,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"); |