mirror of
https://github.com/torvalds/linux.git
synced 2024-11-18 18:11:56 +00:00
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>
This commit is contained in:
parent
1494a1f62b
commit
6462cbd54d
@ -37,6 +37,7 @@
|
|||||||
#include <linux/usb/ch9.h>
|
#include <linux/usb/ch9.h>
|
||||||
#include <linux/usb/gadget.h>
|
#include <linux/usb/gadget.h>
|
||||||
|
|
||||||
|
#include "platform_data.h"
|
||||||
#include "core.h"
|
#include "core.h"
|
||||||
#include "gadget.h"
|
#include "gadget.h"
|
||||||
#include "io.h"
|
#include "io.h"
|
||||||
@ -350,6 +351,7 @@ static void dwc3_core_exit(struct dwc3 *dwc)
|
|||||||
|
|
||||||
static int dwc3_probe(struct platform_device *pdev)
|
static int dwc3_probe(struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
|
struct dwc3_platform_data *pdata = pdev->dev.platform_data;
|
||||||
struct device_node *node = pdev->dev.of_node;
|
struct device_node *node = pdev->dev.of_node;
|
||||||
struct resource *res;
|
struct resource *res;
|
||||||
struct dwc3 *dwc;
|
struct dwc3 *dwc;
|
||||||
@ -412,9 +414,13 @@ static int dwc3_probe(struct platform_device *pdev)
|
|||||||
if (node) {
|
if (node) {
|
||||||
dwc->usb2_phy = devm_usb_get_phy_by_phandle(dev, "usb-phy", 0);
|
dwc->usb2_phy = devm_usb_get_phy_by_phandle(dev, "usb-phy", 0);
|
||||||
dwc->usb3_phy = devm_usb_get_phy_by_phandle(dev, "usb-phy", 1);
|
dwc->usb3_phy = devm_usb_get_phy_by_phandle(dev, "usb-phy", 1);
|
||||||
|
|
||||||
|
dwc->needs_fifo_resize = of_property_read_bool(node, "tx-fifo-resize");
|
||||||
} else {
|
} else {
|
||||||
dwc->usb2_phy = devm_usb_get_phy(dev, USB_PHY_TYPE_USB2);
|
dwc->usb2_phy = devm_usb_get_phy(dev, USB_PHY_TYPE_USB2);
|
||||||
dwc->usb3_phy = devm_usb_get_phy(dev, USB_PHY_TYPE_USB3);
|
dwc->usb3_phy = devm_usb_get_phy(dev, USB_PHY_TYPE_USB3);
|
||||||
|
|
||||||
|
dwc->needs_fifo_resize = pdata->tx_fifo_resize;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IS_ERR(dwc->usb2_phy)) {
|
if (IS_ERR(dwc->usb2_phy)) {
|
||||||
@ -472,8 +478,6 @@ static int dwc3_probe(struct platform_device *pdev)
|
|||||||
else
|
else
|
||||||
dwc->maximum_speed = DWC3_DCFG_SUPERSPEED;
|
dwc->maximum_speed = DWC3_DCFG_SUPERSPEED;
|
||||||
|
|
||||||
dwc->needs_fifo_resize = of_property_read_bool(node, "tx-fifo-resize");
|
|
||||||
|
|
||||||
pm_runtime_enable(dev);
|
pm_runtime_enable(dev);
|
||||||
pm_runtime_get_sync(dev);
|
pm_runtime_get_sync(dev);
|
||||||
pm_runtime_forbid(dev);
|
pm_runtime_forbid(dev);
|
||||||
|
22
drivers/usb/dwc3/platform_data.h
Normal file
22
drivers/usb/dwc3/platform_data.h
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
/**
|
||||||
|
* platform_data.h - USB DWC3 Platform Data Support
|
||||||
|
*
|
||||||
|
* Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com
|
||||||
|
* Author: Felipe Balbi <balbi@ti.com>
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License version 2 of
|
||||||
|
* the License as published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
struct dwc3_platform_data {
|
||||||
|
bool tx_fifo_resize;
|
||||||
|
};
|
Loading…
Reference in New Issue
Block a user