mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-25 00:11:13 +00:00
58acb1dd2c
This adds a bunch of patches for the v6.1 Gemini kernel. For v5.15 this was down to a single upstream patch, but for kernel v6.2 I reworked the USB code for FOTG210, so instead of carrying over the half-baked and incomplete patch from v5.15 I just backported all the v6.2 patches, 31 in total, as it creates full device USB mode for e.g. D-Link DNS-313. Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
69 lines
1.8 KiB
Diff
69 lines
1.8 KiB
Diff
From 7c0b661926097e935f2711857596fc2277b2304a Mon Sep 17 00:00:00 2001
|
|
From: Linus Walleij <linus.walleij@linaro.org>
|
|
Date: Sun, 23 Oct 2022 16:47:08 +0200
|
|
Subject: [PATCH 04/29] usb: fotg210: Select subdriver by mode
|
|
|
|
Check which mode the hardware is in, and selecte the peripheral
|
|
driver if the hardware is in explicit peripheral mode, otherwise
|
|
select host mode.
|
|
|
|
This should solve the immediate problem that both subdrivers
|
|
can get probed.
|
|
|
|
Cc: Fabian Vogt <fabian@ritter-vogt.de>
|
|
Cc: Yuan-Hsin Chen <yhchen@faraday-tech.com>
|
|
Cc: Felipe Balbi <balbi@kernel.org>
|
|
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
|
|
Link: https://lore.kernel.org/r/20221023144708.3596563-3-linus.walleij@linaro.org
|
|
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
|
---
|
|
--- a/drivers/usb/fotg210/fotg210-core.c
|
|
+++ b/drivers/usb/fotg210/fotg210-core.c
|
|
@@ -10,30 +10,37 @@
|
|
#include <linux/of.h>
|
|
#include <linux/platform_device.h>
|
|
#include <linux/usb.h>
|
|
+#include <linux/usb/otg.h>
|
|
|
|
#include "fotg210.h"
|
|
|
|
static int fotg210_probe(struct platform_device *pdev)
|
|
{
|
|
+ struct device *dev = &pdev->dev;
|
|
+ enum usb_dr_mode mode;
|
|
int ret;
|
|
|
|
- if (IS_ENABLED(CONFIG_USB_FOTG210_HCD)) {
|
|
- ret = fotg210_hcd_probe(pdev);
|
|
- if (ret)
|
|
- return ret;
|
|
- }
|
|
- if (IS_ENABLED(CONFIG_USB_FOTG210_UDC))
|
|
+ mode = usb_get_dr_mode(dev);
|
|
+
|
|
+ if (mode == USB_DR_MODE_PERIPHERAL)
|
|
ret = fotg210_udc_probe(pdev);
|
|
+ else
|
|
+ ret = fotg210_hcd_probe(pdev);
|
|
|
|
return ret;
|
|
}
|
|
|
|
static int fotg210_remove(struct platform_device *pdev)
|
|
{
|
|
- if (IS_ENABLED(CONFIG_USB_FOTG210_HCD))
|
|
- fotg210_hcd_remove(pdev);
|
|
- if (IS_ENABLED(CONFIG_USB_FOTG210_UDC))
|
|
+ struct device *dev = &pdev->dev;
|
|
+ enum usb_dr_mode mode;
|
|
+
|
|
+ mode = usb_get_dr_mode(dev);
|
|
+
|
|
+ if (mode == USB_DR_MODE_PERIPHERAL)
|
|
fotg210_udc_remove(pdev);
|
|
+ else
|
|
+ fotg210_hcd_remove(pdev);
|
|
|
|
return 0;
|
|
}
|