ipq40xx: add switch led blink support

This commit is contained in:
AmadeusGhost 2020-03-25 19:29:47 +08:00
parent 0b86dc8a1d
commit dab7b45e5f
8 changed files with 64 additions and 261 deletions

View File

@ -1,18 +1,18 @@
// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
#include "qcom-ipq4019-r619ac.dtsi"
/ {
model = "P&W R619AC 128M";
compatible = "p2w,r619ac-128m";
chosen {
bootargs-append = " root=/dev/ubiblock0_1 rootfstype=squashfs";
};
};
&rootfs_part1 {
reg = <0x0 0x8000000>;
};
/delete-node/ &rootfs_part2;
// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
#include "qcom-ipq4019-r619ac.dtsi"
/ {
model = "P&W R619AC 128M";
compatible = "p2w,r619ac-128m";
chosen {
bootargs-append = " root=/dev/ubiblock0_1 rootfstype=squashfs";
};
};
&rootfs_part1 {
reg = <0x0 0x8000000>;
};
/delete-node/ &rootfs_part2;

View File

@ -1,12 +1,12 @@
// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
#include "qcom-ipq4019-r619ac.dtsi"
/ {
model = "P&W R619AC";
compatible = "p2w,r619ac";
chosen {
bootargs-append = " root=/dev/ubiblock0_1 rootfstype=squashfs";
};
};
// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
#include "qcom-ipq4019-r619ac.dtsi"
/ {
model = "P&W R619AC";
compatible = "p2w,r619ac";
chosen {
bootargs-append = " root=/dev/ubiblock0_1 rootfstype=squashfs";
};
};

View File

@ -1,46 +0,0 @@
--- a/drivers/net/usb/qmi_wwan.c
+++ b/drivers/net/usb/qmi_wwan.c
@@ -1297,6 +1297,7 @@ static const struct usb_device_id products[] = {
{QMI_FIXED_INTF(0x03f0, 0x9d1d, 1)}, /* HP lt4120 Snapdragon X5 LTE */
{QMI_FIXED_INTF(0x22de, 0x9061, 3)}, /* WeTelecom WPD-600N */
{QMI_QUIRK_SET_DTR(0x1e0e, 0x9001, 5)}, /* SIMCom 7100E, 7230E, 7600E ++ */
+ {QMI_FIXED_INTF(0x1c9e, 0x9b3c, 4)}, /* LONGSUNG_U9300 */
{QMI_QUIRK_SET_DTR(0x2c7c, 0x0121, 4)}, /* Quectel EC21 Mini PCIe */
{QMI_QUIRK_SET_DTR(0x2c7c, 0x0191, 4)}, /* Quectel EG91 */
{QMI_FIXED_INTF(0x2c7c, 0x0296, 4)}, /* Quectel BG96 */
--- a/drivers/usb/serial/option.c
+++ b/drivers/usb/serial/option.c
@@ -381,6 +381,7 @@ static void option_instat_callback(struct urb *urb);
* Mobidata, etc sell under their own brand names.
*/
#define LONGCHEER_VENDOR_ID 0x1c9e
+#define LONGSUNG_U9300_PRODUCT_ID 0x9b3c
/* 4G Systems products */
/* This is the 4G XS Stick W14 a.k.a. Mobilcom Debitel Surf-Stick *
@@ -571,6 +572,16 @@ static void option_instat_callback(struct urb *urb);
/* Device needs ZLP */
#define ZLP BIT(17)
+struct option_blacklist_info {
+ /* bitfield of interface numbers for OPTION_BLACKLIST_SENDSETUP */
+ const unsigned long sendsetup;
+ /* bitfield of interface numbers for OPTION_BLACKLIST_RESERVED_IF */
+ const unsigned long reserved;
+};
+
+static const struct option_blacklist_info longsung_u9300_blacklist = {
+ .reserved = BIT(4),
+};
static const struct usb_device_id option_ids[] = {
{ USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COLT) },
@@ -605,6 +616,8 @@ static const struct usb_device_id option_ids[] = {
{ USB_DEVICE(QUANTA_VENDOR_ID, QUANTA_PRODUCT_GLE) },
{ USB_DEVICE(QUANTA_VENDOR_ID, 0xea42),
.driver_info = RSVD(4) },
+ { USB_DEVICE(LONGCHEER_VENDOR_ID,LONGSUNG_U9300_PRODUCT_ID),
+ .driver_info = (kernel_ulong_t)&longsung_u9300_blacklist},
{ USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0x1c05, USB_CLASS_COMM, 0x02, 0xff) },
{ USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0x1c1f, USB_CLASS_COMM, 0x02, 0xff) },
{ USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0x1c23, USB_CLASS_COMM, 0x02, 0xff) },

View File

@ -26,7 +26,7 @@
obj-$(CONFIG_BCM63XX_PHY) += bcm63xx.o
--- /dev/null
+++ b/drivers/net/phy/ar40xx.c
@@ -0,0 +1,2090 @@
@@ -0,0 +1,2123 @@
+/*
+ * Copyright (c) 2016, The Linux Foundation. All rights reserved.
+ *
@ -799,6 +799,37 @@
+ return 0;
+}
+
+static int
+ar40xx_sw_get_port_stats(struct switch_dev *dev, int port,
+ struct switch_port_stats *stats)
+{
+ struct ar40xx_priv *priv = swdev_to_ar40xx(dev);
+ u32 num_mibs = ARRAY_SIZE(ar40xx_mibs);
+ u64 *mib_stats;
+ int ret = 0;
+ static int last_port = AR40XX_NUM_PORTS - 1;
+
+ mutex_lock(&priv->mib_lock);
+
+ /* Avoid unnecessary capture */
+ if (last_port >= port) {
+ ret = ar40xx_mib_capture(priv);
+ if (ret)
+ goto unlock;
+ }
+ last_port = port;
+
+ ar40xx_mib_fetch_port_stat(priv, port, false);
+
+ mib_stats = &priv->mib_stats[port * num_mibs];
+ /* 15: TXBYTE, 31: RXGOODBYTE */
+ stats->tx_bytes = mib_stats[15];
+ stats->rx_bytes = mib_stats[31];
+unlock:
+ mutex_unlock(&priv->mib_lock);
+ return ret;
+}
+
+static const struct switch_attr ar40xx_sw_attr_globals[] = {
+ {
+ .type = SWITCH_TYPE_INT,
@ -1177,6 +1208,7 @@
+ /* disable phy internal loopback */
+ mdiobus_write(bus, 0x1f, 0x10, 0x6860);
+ mdiobus_write(bus, 0x1f, 0x0, 0x9040);
+ ar40xx_phy_mmd_write(priv, 0x1f, 7, 0x8076, 0x0670); /* 1000_LED_n */
+
+ for (phy = 0; phy < AR40XX_NUM_PORTS - 1; phy++) {
+ /* disable mac loop back */
@ -1788,6 +1820,7 @@
+ .apply_config = ar40xx_sw_hw_apply,
+ .reset_switch = ar40xx_sw_reset_switch,
+ .get_port_link = ar40xx_sw_get_port_link,
+ .get_port_stats = ar40xx_sw_get_port_stats,
+};
+
+/* Start of phy driver support */

View File

@ -1,46 +0,0 @@
--- a/drivers/net/usb/qmi_wwan.c
+++ b/drivers/net/usb/qmi_wwan.c
@@ -1292,6 +1292,7 @@ static const struct usb_device_id products[] = {
{QMI_FIXED_INTF(0x03f0, 0x9d1d, 1)}, /* HP lt4120 Snapdragon X5 LTE */
{QMI_FIXED_INTF(0x22de, 0x9061, 3)}, /* WeTelecom WPD-600N */
{QMI_QUIRK_SET_DTR(0x1e0e, 0x9001, 5)}, /* SIMCom 7100E, 7230E, 7600E ++ */
+ {QMI_FIXED_INTF(0x1c9e, 0x9b3c, 4)}, /* LONGSUNG_U9300 */
{QMI_QUIRK_SET_DTR(0x2c7c, 0x0121, 4)}, /* Quectel EC21 Mini PCIe */
{QMI_QUIRK_SET_DTR(0x2c7c, 0x0191, 4)}, /* Quectel EG91 */
{QMI_FIXED_INTF(0x2c7c, 0x0296, 4)}, /* Quectel BG96 */
--- a/drivers/usb/serial/option.c
+++ b/drivers/usb/serial/option.c
@@ -384,6 +384,7 @@ static void option_instat_callback(struct urb *urb);
* Mobidata, etc sell under their own brand names.
*/
#define LONGCHEER_VENDOR_ID 0x1c9e
+#define LONGSUNG_U9300_PRODUCT_ID 0x9b3c
/* 4G Systems products */
/* This is the 4G XS Stick W14 a.k.a. Mobilcom Debitel Surf-Stick *
@@ -574,6 +575,16 @@ static void option_instat_callback(struct urb *urb);
/* Device needs ZLP */
#define ZLP BIT(17)
+struct option_blacklist_info {
+ /* bitfield of interface numbers for OPTION_BLACKLIST_SENDSETUP */
+ const unsigned long sendsetup;
+ /* bitfield of interface numbers for OPTION_BLACKLIST_RESERVED_IF */
+ const unsigned long reserved;
+};
+
+static const struct option_blacklist_info longsung_u9300_blacklist = {
+ .reserved = BIT(4),
+};
static const struct usb_device_id option_ids[] = {
{ USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COLT) },
@@ -608,6 +619,8 @@ static const struct usb_device_id option_ids[] = {
{ USB_DEVICE(QUANTA_VENDOR_ID, QUANTA_PRODUCT_GLE) },
{ USB_DEVICE(QUANTA_VENDOR_ID, 0xea42),
.driver_info = RSVD(4) },
+ { USB_DEVICE(LONGCHEER_VENDOR_ID,LONGSUNG_U9300_PRODUCT_ID),
+ .driver_info = (kernel_ulong_t)&longsung_u9300_blacklist},
{ USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0x1c05, USB_CLASS_COMM, 0x02, 0xff) },
{ USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0x1c1f, USB_CLASS_COMM, 0x02, 0xff) },
{ USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0x1c23, USB_CLASS_COMM, 0x02, 0xff) },

View File

@ -1,46 +0,0 @@
--- a/drivers/net/usb/qmi_wwan.c
+++ b/drivers/net/usb/qmi_wwan.c
@@ -1292,6 +1292,7 @@ static const struct usb_device_id products[] = {
{QMI_FIXED_INTF(0x03f0, 0x9d1d, 1)}, /* HP lt4120 Snapdragon X5 LTE */
{QMI_FIXED_INTF(0x22de, 0x9061, 3)}, /* WeTelecom WPD-600N */
{QMI_QUIRK_SET_DTR(0x1e0e, 0x9001, 5)}, /* SIMCom 7100E, 7230E, 7600E ++ */
+ {QMI_FIXED_INTF(0x1c9e, 0x9b3c, 4)}, /* LONGSUNG_U9300 */
{QMI_QUIRK_SET_DTR(0x2c7c, 0x0121, 4)}, /* Quectel EC21 Mini PCIe */
{QMI_QUIRK_SET_DTR(0x2c7c, 0x0191, 4)}, /* Quectel EG91 */
{QMI_FIXED_INTF(0x2c7c, 0x0296, 4)}, /* Quectel BG96 */
--- a/drivers/usb/serial/option.c
+++ b/drivers/usb/serial/option.c
@@ -384,6 +384,7 @@ static void option_instat_callback(struct urb *urb);
* Mobidata, etc sell under their own brand names.
*/
#define LONGCHEER_VENDOR_ID 0x1c9e
+#define LONGSUNG_U9300_PRODUCT_ID 0x9b3c
/* 4G Systems products */
/* This is the 4G XS Stick W14 a.k.a. Mobilcom Debitel Surf-Stick *
@@ -574,6 +575,16 @@ static void option_instat_callback(struct urb *urb);
/* Device needs ZLP */
#define ZLP BIT(17)
+struct option_blacklist_info {
+ /* bitfield of interface numbers for OPTION_BLACKLIST_SENDSETUP */
+ const unsigned long sendsetup;
+ /* bitfield of interface numbers for OPTION_BLACKLIST_RESERVED_IF */
+ const unsigned long reserved;
+};
+
+static const struct option_blacklist_info longsung_u9300_blacklist = {
+ .reserved = BIT(4),
+};
static const struct usb_device_id option_ids[] = {
{ USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COLT) },
@@ -608,6 +619,8 @@ static const struct usb_device_id option_ids[] = {
{ USB_DEVICE(QUANTA_VENDOR_ID, QUANTA_PRODUCT_GLE) },
{ USB_DEVICE(QUANTA_VENDOR_ID, 0xea42),
.driver_info = RSVD(4) },
+ { USB_DEVICE(LONGCHEER_VENDOR_ID,LONGSUNG_U9300_PRODUCT_ID),
+ .driver_info = (kernel_ulong_t)&longsung_u9300_blacklist},
{ USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0x1c05, USB_CLASS_COMM, 0x02, 0xff) },
{ USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0x1c1f, USB_CLASS_COMM, 0x02, 0xff) },
{ USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0x1c23, USB_CLASS_COMM, 0x02, 0xff) },

View File

@ -1,46 +0,0 @@
--- a/drivers/net/usb/qmi_wwan.c
+++ b/drivers/net/usb/qmi_wwan.c
@@ -1297,6 +1297,7 @@ static const struct usb_device_id products[] = {
{QMI_FIXED_INTF(0x03f0, 0x9d1d, 1)}, /* HP lt4120 Snapdragon X5 LTE */
{QMI_FIXED_INTF(0x22de, 0x9061, 3)}, /* WeTelecom WPD-600N */
{QMI_QUIRK_SET_DTR(0x1e0e, 0x9001, 5)}, /* SIMCom 7100E, 7230E, 7600E ++ */
+ {QMI_FIXED_INTF(0x1c9e, 0x9b3c, 4)}, /* LONGSUNG_U9300 */
{QMI_QUIRK_SET_DTR(0x2c7c, 0x0121, 4)}, /* Quectel EC21 Mini PCIe */
{QMI_QUIRK_SET_DTR(0x2c7c, 0x0191, 4)}, /* Quectel EG91 */
{QMI_FIXED_INTF(0x2c7c, 0x0296, 4)}, /* Quectel BG96 */
--- a/drivers/usb/serial/option.c
+++ b/drivers/usb/serial/option.c
@@ -381,6 +381,7 @@ static void option_instat_callback(struct urb *urb);
* Mobidata, etc sell under their own brand names.
*/
#define LONGCHEER_VENDOR_ID 0x1c9e
+#define LONGSUNG_U9300_PRODUCT_ID 0x9b3c
/* 4G Systems products */
/* This is the 4G XS Stick W14 a.k.a. Mobilcom Debitel Surf-Stick *
@@ -571,6 +572,16 @@ static void option_instat_callback(struct urb *urb);
/* Device needs ZLP */
#define ZLP BIT(17)
+struct option_blacklist_info {
+ /* bitfield of interface numbers for OPTION_BLACKLIST_SENDSETUP */
+ const unsigned long sendsetup;
+ /* bitfield of interface numbers for OPTION_BLACKLIST_RESERVED_IF */
+ const unsigned long reserved;
+};
+
+static const struct option_blacklist_info longsung_u9300_blacklist = {
+ .reserved = BIT(4),
+};
static const struct usb_device_id option_ids[] = {
{ USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COLT) },
@@ -605,6 +616,8 @@ static const struct usb_device_id option_ids[] = {
{ USB_DEVICE(QUANTA_VENDOR_ID, QUANTA_PRODUCT_GLE) },
{ USB_DEVICE(QUANTA_VENDOR_ID, 0xea42),
.driver_info = RSVD(4) },
+ { USB_DEVICE(LONGCHEER_VENDOR_ID,LONGSUNG_U9300_PRODUCT_ID),
+ .driver_info = (kernel_ulong_t)&longsung_u9300_blacklist},
{ USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0x1c05, USB_CLASS_COMM, 0x02, 0xff) },
{ USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0x1c1f, USB_CLASS_COMM, 0x02, 0xff) },
{ USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0x1c23, USB_CLASS_COMM, 0x02, 0xff) },

View File

@ -1,46 +0,0 @@
--- a/drivers/net/usb/qmi_wwan.c
+++ b/drivers/net/usb/qmi_wwan.c
@@ -1297,6 +1297,7 @@ static const struct usb_device_id products[] = {
{QMI_FIXED_INTF(0x03f0, 0x9d1d, 1)}, /* HP lt4120 Snapdragon X5 LTE */
{QMI_FIXED_INTF(0x22de, 0x9061, 3)}, /* WeTelecom WPD-600N */
{QMI_QUIRK_SET_DTR(0x1e0e, 0x9001, 5)}, /* SIMCom 7100E, 7230E, 7600E ++ */
+ {QMI_FIXED_INTF(0x1c9e, 0x9b3c, 4)}, /* LONGSUNG_U9300 */
{QMI_QUIRK_SET_DTR(0x2c7c, 0x0121, 4)}, /* Quectel EC21 Mini PCIe */
{QMI_QUIRK_SET_DTR(0x2c7c, 0x0191, 4)}, /* Quectel EG91 */
{QMI_FIXED_INTF(0x2c7c, 0x0296, 4)}, /* Quectel BG96 */
--- a/drivers/usb/serial/option.c
+++ b/drivers/usb/serial/option.c
@@ -381,6 +381,7 @@ static void option_instat_callback(struct urb *urb);
* Mobidata, etc sell under their own brand names.
*/
#define LONGCHEER_VENDOR_ID 0x1c9e
+#define LONGSUNG_U9300_PRODUCT_ID 0x9b3c
/* 4G Systems products */
/* This is the 4G XS Stick W14 a.k.a. Mobilcom Debitel Surf-Stick *
@@ -571,6 +572,16 @@ static void option_instat_callback(struct urb *urb);
/* Device needs ZLP */
#define ZLP BIT(17)
+struct option_blacklist_info {
+ /* bitfield of interface numbers for OPTION_BLACKLIST_SENDSETUP */
+ const unsigned long sendsetup;
+ /* bitfield of interface numbers for OPTION_BLACKLIST_RESERVED_IF */
+ const unsigned long reserved;
+};
+
+static const struct option_blacklist_info longsung_u9300_blacklist = {
+ .reserved = BIT(4),
+};
static const struct usb_device_id option_ids[] = {
{ USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COLT) },
@@ -605,6 +616,8 @@ static const struct usb_device_id option_ids[] = {
{ USB_DEVICE(QUANTA_VENDOR_ID, QUANTA_PRODUCT_GLE) },
{ USB_DEVICE(QUANTA_VENDOR_ID, 0xea42),
.driver_info = RSVD(4) },
+ { USB_DEVICE(LONGCHEER_VENDOR_ID,LONGSUNG_U9300_PRODUCT_ID),
+ .driver_info = (kernel_ulong_t)&longsung_u9300_blacklist},
{ USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0x1c05, USB_CLASS_COMM, 0x02, 0xff) },
{ USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0x1c1f, USB_CLASS_COMM, 0x02, 0xff) },
{ USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0x1c23, USB_CLASS_COMM, 0x02, 0xff) },