aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/dwc3
diff options
context:
space:
mode:
authorFelipe Balbi <balbi@ti.com>2013-06-30 07:19:33 -0400
committerFelipe Balbi <balbi@ti.com>2013-07-29 06:56:46 -0400
commit6462cbd54d2fa649b27633267d8ddf835705e47a (patch)
treee1f6634558af44b76f2b81308b44a6878406bedc /drivers/usb/dwc3
parent1494a1f62bf7cf57345e9282c8189fe2a21fab64 (diff)
usb: dwc3: let non-DT platforms pass tx-fifo-resize flag;
in case we're not in a DT boot, we should still be able to tell the driver how to behave. In order to be able to pass flags to the driver, we introduce platform_data structure which the core driver should use. Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/dwc3')
-rw-r--r--drivers/usb/dwc3/core.c8
-rw-r--r--drivers/usb/dwc3/platform_data.h22
2 files changed, 28 insertions, 2 deletions
diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
index f69e45a50039..cb1eb37c6d6c 100644
--- a/drivers/usb/dwc3/core.c
+++ b/drivers/usb/dwc3/core.c
@@ -37,6 +37,7 @@
37#include <linux/usb/ch9.h> 37#include <linux/usb/ch9.h>
38#include <linux/usb/gadget.h> 38#include <linux/usb/gadget.h>
39 39
40#include "platform_data.h"
40#include "core.h" 41#include "core.h"
41#include "gadget.h" 42#include "gadget.h"
42#include "io.h" 43#include "io.h"
@@ -350,6 +351,7 @@ static void dwc3_core_exit(struct dwc3 *dwc)
350 351
351static int dwc3_probe(struct platform_device *pdev) 352static int dwc3_probe(struct platform_device *pdev)
352{ 353{
354 struct dwc3_platform_data *pdata = pdev->dev.platform_data;
353 struct device_node *node = pdev->dev.of_node; 355 struct device_node *node = pdev->dev.of_node;
354 struct resource *res; 356 struct resource *res;
355 struct dwc3 *dwc; 357 struct dwc3 *dwc;
@@ -412,9 +414,13 @@ static int dwc3_probe(struct platform_device *pdev)
412 if (node) { 414 if (node) {
413 dwc->usb2_phy = devm_usb_get_phy_by_phandle(dev, "usb-phy", 0); 415 dwc->usb2_phy = devm_usb_get_phy_by_phandle(dev, "usb-phy", 0);
414 dwc->usb3_phy = devm_usb_get_phy_by_phandle(dev, "usb-phy", 1); 416 dwc->usb3_phy = devm_usb_get_phy_by_phandle(dev, "usb-phy", 1);
417
418 dwc->needs_fifo_resize = of_property_read_bool(node, "tx-fifo-resize");
415 } else { 419 } else {
416 dwc->usb2_phy = devm_usb_get_phy(dev, USB_PHY_TYPE_USB2); 420 dwc->usb2_phy = devm_usb_get_phy(dev, USB_PHY_TYPE_USB2);
417 dwc->usb3_phy = devm_usb_get_phy(dev, USB_PHY_TYPE_USB3); 421 dwc->usb3_phy = devm_usb_get_phy(dev, USB_PHY_TYPE_USB3);
422
423 dwc->needs_fifo_resize = pdata->tx_fifo_resize;
418 } 424 }
419 425
420 if (IS_ERR(dwc->usb2_phy)) { 426 if (IS_ERR(dwc->usb2_phy)) {
@@ -472,8 +478,6 @@ static int dwc3_probe(struct platform_device *pdev)
472 else 478 else
473 dwc->maximum_speed = DWC3_DCFG_SUPERSPEED; 479 dwc->maximum_speed = DWC3_DCFG_SUPERSPEED;
474 480
475 dwc->needs_fifo_resize = of_property_read_bool(node, "tx-fifo-resize");
476
477 pm_runtime_enable(dev); 481 pm_runtime_enable(dev);
478 pm_runtime_get_sync(dev); 482 pm_runtime_get_sync(dev);
479 pm_runtime_forbid(dev); 483 pm_runtime_forbid(dev);
diff --git a/drivers/usb/dwc3/platform_data.h b/drivers/usb/dwc3/platform_data.h
new file mode 100644
index 000000000000..038516489539
--- /dev/null
+++ b/drivers/usb/dwc3/platform_data.h
@@ -0,0 +1,22 @@
1/**
2 * platform_data.h - USB DWC3 Platform Data Support
3 *
4 * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com
5 * Author: Felipe Balbi <balbi@ti.com>
6 *
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 of
9 * the License as published by the Free Software Foundation.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20struct dwc3_platform_data {
21 bool tx_fifo_resize;
22};