summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorKyle Manna2023-03-05 18:06:25 -0600
committerKyle Manna2023-03-05 18:20:27 -0600
commit2326cf8da1d3f7040a06fc415b0e233b751d33bd (patch)
tree5fe4a5b70b7358621f1dfbb54634938269d9370f
downloadaur-2326cf8da1d3f7040a06fc415b0e233b751d33bd.tar.gz
pkgrel: Add initial version v6.2.2
* Simple patch with alternative name.
-rw-r--r--.SRCINFO22
-rw-r--r--.gitignore6
-rw-r--r--PKGBUILD83
-rw-r--r--bnx2x_warpcore+8727_2_5g_sgmii_arch.patch168
-rw-r--r--dkms.conf6
5 files changed, 285 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 000000000000..7dc8643aa877
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,22 @@
+pkgbase = bnx2x-2500m-dkms
+ pkgdesc = Broadcom bnx2x driver with 2500 Mbps HSGMII patch
+ pkgver = 6.2.2.arch1
+ pkgrel = 1
+ url = https://github.com/archlinux/linux/commits/v6.2.2-arch1
+ arch = x86_64
+ license = GPL2
+ makedepends = git
+ depends = dkms
+ depends = linux-firmware-bnx2x
+ source = archlinux-linux::git+https://github.com/archlinux/linux?signed#tag=v6.2.2-arch1
+ source = bnx2x_warpcore+8727_2_5g_sgmii_arch.patch
+ source = dkms.conf
+ validpgpkeys = ABAF11C65A2970B130ABE3C479BE3E4300411886
+ validpgpkeys = 647F28654894E3BD457199BE38DBBDC86092693E
+ validpgpkeys = A2FF3A36AAA56654109064AB19802F8B0D70FC30
+ validpgpkeys = C7E7849466FE2358343588377258734B41C31549
+ sha256sums = SKIP
+ sha256sums = d655669179109ae8e801a259c35dbe442ca67a49b9ceb6ca3ef0e56f48149a7d
+ sha256sums = 9e8de01f4f7d7ed966cd979bc4e41bee95f37398327a094cc705d7e590c06f2a
+
+pkgname = bnx2x-2500m-dkms
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 000000000000..2a81572f9b01
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,6 @@
+/*.log
+/*.tar.zst
+/arch-package
+/archlinux-linux
+/pkg
+/src
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 000000000000..41306c36fd45
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,83 @@
+#
+# Maintainer: Kyle Manna <kyle[at]kylemanna[d0t]com>
+#
+# Inspired by AUR package "linux-bnx2x-2.5g" from
+# Charles Leclerc <charles[at]la-mouette[d0t]net>
+#
+# Usage:
+# rmmod bnx2x; modprobe bnx2x-2500m
+
+_pkgbase=bnx2x-2500m
+pkgname="$_pkgbase-dkms"
+# Don't need to update unless there's an upstream change!
+pkgver=6.2.2.arch1
+pkgrel=1
+pkgdesc='Broadcom bnx2x driver with 2500 Mbps HSGMII patch'
+_srctag=v${pkgver%.*}-${pkgver##*.}
+url="https://github.com/archlinux/linux/commits/$_srctag"
+arch=(x86_64)
+license=(GPL2)
+
+makedepends=('git')
+depends=('dkms' 'linux-firmware-bnx2x')
+
+_ksrcname=archlinux-linux
+source=(
+ "$_ksrcname::git+https://github.com/archlinux/linux?signed#tag=$_srctag"
+ "bnx2x_warpcore+8727_2_5g_sgmii_arch.patch"
+ "dkms.conf"
+)
+validpgpkeys=(
+ 'ABAF11C65A2970B130ABE3C479BE3E4300411886' # Linus Torvalds
+ '647F28654894E3BD457199BE38DBBDC86092693E' # Greg Kroah-Hartman
+ 'A2FF3A36AAA56654109064AB19802F8B0D70FC30' # Jan Alexander Steffens (heftig)
+ 'C7E7849466FE2358343588377258734B41C31549' # David Runge <dvzrv@archlinux.org>
+)
+sha256sums=('SKIP'
+ 'd655669179109ae8e801a259c35dbe442ca67a49b9ceb6ca3ef0e56f48149a7d'
+ '9e8de01f4f7d7ed966cd979bc4e41bee95f37398327a094cc705d7e590c06f2a')
+
+export KBUILD_BUILD_HOST=archlinux
+export KBUILD_BUILD_USER=$_pkgbase
+export KBUILD_BUILD_TIMESTAMP="$(date -Ru${SOURCE_DATE_EPOCH:+d @$SOURCE_DATE_EPOCH})"
+
+_dkms_name=$_pkgbase-$pkgver
+
+prepare() {
+ cd $_ksrcname
+
+ # Apply patches here instead of complicating with patching at dkms build time.
+ local src
+ for src in "${source[@]}"; do
+ src="${src%%::*}"
+ src="${src##*/}"
+ [[ $src = *.patch ]] || continue
+ echo "Applying patch $src..."
+ patch -Np1 < "../$src"
+ done
+}
+
+package() {
+ mkdir -p "$pkgdir/usr/src/$_dkms_name/"
+ cd "$pkgdir/usr/src/$_dkms_name/"
+
+ # Create dkms compatible kernel module dir
+ cp -a "$srcdir/$_ksrcname/drivers/net/ethernet/broadcom/cnic"* \
+ "$srcdir/$_ksrcname/drivers/net/ethernet/broadcom/bnx2x" \
+ .
+
+ # Rename module bnx2x -> bnx2x-2500m, this seems like the least hacky way to
+ # do this.
+ sed -i -e "s:\(${_pkgbase%-*}\):${_pkgbase}:" bnx2x/Makefile
+
+ echo 'obj-$(CONFIG_BNX2X) += bnx2x/' > "Makefile"
+
+ sed -e "s/@_PKGBASE@/${_pkgbase}/" \
+ -e "s/@_PKGVER@/${pkgver}/" \
+ "$srcdir/dkms.conf" > dkms.conf
+
+ mkdir -p "${pkgdir}/usr/lib/modprobe.d/"
+ echo blacklist bnx2x > "${pkgdir}/usr/lib/modprobe.d/${pkgname}.conf"
+}
+
+# vim:set ts=8 sts=2 sw=2 et:
diff --git a/bnx2x_warpcore+8727_2_5g_sgmii_arch.patch b/bnx2x_warpcore+8727_2_5g_sgmii_arch.patch
new file mode 100644
index 000000000000..897f8082da80
--- /dev/null
+++ b/bnx2x_warpcore+8727_2_5g_sgmii_arch.patch
@@ -0,0 +1,168 @@
+diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c
+index 4e85e7dbc2be..717dbb42cf0d 100644
+--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c
++++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c
+@@ -151,6 +151,7 @@ typedef int (*read_sfp_module_eeprom_func_p)(struct bnx2x_phy *phy,
+
+ #define SFP_EEPROM_CON_TYPE_ADDR 0x2
+ #define SFP_EEPROM_CON_TYPE_VAL_UNKNOWN 0x0
++ #define SFP_EEPROM_CON_TYPE_VAL_SC 0x1
+ #define SFP_EEPROM_CON_TYPE_VAL_LC 0x7
+ #define SFP_EEPROM_CON_TYPE_VAL_COPPER 0x21
+ #define SFP_EEPROM_CON_TYPE_VAL_RJ45 0x22
+@@ -4210,6 +4211,16 @@ static void bnx2x_warpcore_set_sgmii_speed(struct bnx2x_phy *phy,
+ 0x1000);
+ DP(NETIF_MSG_LINK, "set SGMII AUTONEG\n");
+ } else {
++ /* Note that 2.5G works only when used with 1G advertisment */
++ if (fiber_mode && (phy->req_line_speed == SPEED_2500) &&
++ (phy->speed_cap_mask &
++ (PORT_HW_CFG_SPEED_CAPABILITY_D0_1G |
++ PORT_HW_CFG_SPEED_CAPABILITY_D0_2_5G))) {
++ bnx2x_cl45_write(bp, phy, MDIO_WC_DEVAD,
++ MDIO_WC_REG_SERDESDIGITAL_MISC1,
++ 0x6010);
++ }
++
+ bnx2x_cl45_read(bp, phy, MDIO_WC_DEVAD,
+ MDIO_WC_REG_COMBO_IEEE0_MIICTRL, &val16);
+ val16 &= 0xcebf;
+@@ -4220,6 +4231,7 @@ static void bnx2x_warpcore_set_sgmii_speed(struct bnx2x_phy *phy,
+ val16 |= 0x2000;
+ break;
+ case SPEED_1000:
++ case SPEED_2500:
+ val16 |= 0x0040;
+ break;
+ default:
+@@ -8172,6 +8184,7 @@ static int bnx2x_get_edc_mode(struct bnx2x_phy *phy,
+ break;
+ }
+ case SFP_EEPROM_CON_TYPE_VAL_UNKNOWN:
++ case SFP_EEPROM_CON_TYPE_VAL_SC:
+ case SFP_EEPROM_CON_TYPE_VAL_LC:
+ case SFP_EEPROM_CON_TYPE_VAL_RJ45:
+ check_limiting_mode = 1;
+@@ -8182,7 +8195,8 @@ static int bnx2x_get_edc_mode(struct bnx2x_phy *phy,
+ (val[SFP_EEPROM_1G_COMP_CODE_ADDR] != 0)) {
+ DP(NETIF_MSG_LINK, "1G SFP module detected\n");
+ phy->media_type = ETH_PHY_SFP_1G_FIBER;
+- if (phy->req_line_speed != SPEED_1000) {
++ if ((phy->req_line_speed != SPEED_1000) &&
++ (phy->req_line_speed != SPEED_2500)) {
+ u8 gport = params->port;
+ phy->req_line_speed = SPEED_1000;
+ if (!CHIP_IS_E1x(bp)) {
+@@ -9236,6 +9250,7 @@ static void bnx2x_8727_config_speed(struct bnx2x_phy *phy,
+ u16 tmp1, val;
+ /* Set option 1G speed */
+ if ((phy->req_line_speed == SPEED_1000) ||
++ (phy->req_line_speed == SPEED_2500) ||
+ (phy->media_type == ETH_PHY_SFP_1G_FIBER)) {
+ DP(NETIF_MSG_LINK, "Setting 1G force\n");
+ bnx2x_cl45_write(bp, phy,
+@@ -9245,6 +9260,22 @@ static void bnx2x_8727_config_speed(struct bnx2x_phy *phy,
+ bnx2x_cl45_read(bp, phy,
+ MDIO_PMA_DEVAD, MDIO_PMA_REG_10G_CTRL2, &tmp1);
+ DP(NETIF_MSG_LINK, "1.7 = 0x%x\n", tmp1);
++ if ((phy->req_line_speed == SPEED_2500) &&
++ (phy->speed_cap_mask &
++ (PORT_HW_CFG_SPEED_CAPABILITY_D0_1G |
++ PORT_HW_CFG_SPEED_CAPABILITY_D0_2_5G))) {
++ bnx2x_cl45_read_and_write(bp, phy,
++ MDIO_AN_DEVAD,
++ MDIO_AN_REG_8727_MISC_CTRL2,
++ ~(1<<5));
++ bnx2x_cl45_write(bp, phy,
++ MDIO_AN_DEVAD,
++ MDIO_AN_REG_8727_MISC_CTRL1, 0x0010);
++ } else {
++ bnx2x_cl45_write(bp, phy,
++ MDIO_AN_DEVAD,
++ MDIO_AN_REG_8727_MISC_CTRL1, 0x001C);
++ }
+ /* Power down the XAUI until link is up in case of dual-media
+ * and 1G
+ */
+@@ -9266,7 +9297,7 @@ static void bnx2x_8727_config_speed(struct bnx2x_phy *phy,
+
+ DP(NETIF_MSG_LINK, "Setting 1G clause37\n");
+ bnx2x_cl45_write(bp, phy,
+- MDIO_AN_DEVAD, MDIO_AN_REG_8727_MISC_CTRL, 0);
++ MDIO_AN_DEVAD, MDIO_AN_REG_8727_MISC_CTRL2, 0);
+ bnx2x_cl45_write(bp, phy,
+ MDIO_AN_DEVAD, MDIO_AN_REG_CL37_AN, 0x1300);
+ } else {
+@@ -9274,8 +9305,11 @@ static void bnx2x_8727_config_speed(struct bnx2x_phy *phy,
+ * registers although it is default
+ */
+ bnx2x_cl45_write(bp, phy,
+- MDIO_AN_DEVAD, MDIO_AN_REG_8727_MISC_CTRL,
++ MDIO_AN_DEVAD, MDIO_AN_REG_8727_MISC_CTRL2,
+ 0x0020);
++ bnx2x_cl45_write(bp, phy,
++ MDIO_AN_DEVAD, MDIO_AN_REG_8727_MISC_CTRL1,
++ 0x001C);
+ bnx2x_cl45_write(bp, phy,
+ MDIO_AN_DEVAD, MDIO_AN_REG_CL37_AN, 0x0100);
+ bnx2x_cl45_write(bp, phy,
+@@ -9565,6 +9599,11 @@ static u8 bnx2x_8727_read_status(struct bnx2x_phy *phy,
+ vars->line_speed = SPEED_10000;
+ DP(NETIF_MSG_LINK, "port %x: External link up in 10G\n",
+ params->port);
++ } else if ((link_status & (1<<1)) && (!(link_status & (1<<14)))) {
++ link_up = 1;
++ vars->line_speed = SPEED_2500;
++ DP(NETIF_MSG_LINK, "port %x: External link up in 2.5G\n",
++ params->port);
+ } else if ((link_status & (1<<0)) && (!(link_status & (1<<13)))) {
+ link_up = 1;
+ vars->line_speed = SPEED_1000;
+@@ -9596,7 +9635,8 @@ static u8 bnx2x_8727_read_status(struct bnx2x_phy *phy,
+ }
+
+ if ((DUAL_MEDIA(params)) &&
+- (phy->req_line_speed == SPEED_1000)) {
++ ((phy->req_line_speed == SPEED_1000) ||
++ (phy->req_line_speed == SPEED_2500))) {
+ bnx2x_cl45_read(bp, phy,
+ MDIO_PMA_DEVAD,
+ MDIO_PMA_REG_8727_PCS_GP, &val1);
+@@ -11720,6 +11760,7 @@ static const struct bnx2x_phy phy_warpcore = {
+ SUPPORTED_100baseT_Full |
+ SUPPORTED_1000baseT_Full |
+ SUPPORTED_1000baseKX_Full |
++ SUPPORTED_2500baseX_Full |
+ SUPPORTED_10000baseT_Full |
+ SUPPORTED_10000baseKR_Full |
+ SUPPORTED_20000baseKR2_Full |
+@@ -11906,6 +11947,7 @@ static const struct bnx2x_phy phy_8727 = {
+ .tx_preemphasis = {0xffff, 0xffff, 0xffff, 0xffff},
+ .mdio_ctrl = 0,
+ .supported = (SUPPORTED_10000baseT_Full |
++ SUPPORTED_2500baseX_Full |
+ SUPPORTED_1000baseT_Full |
+ SUPPORTED_FIBRE |
+ SUPPORTED_Pause |
+@@ -12253,6 +12295,7 @@ static int bnx2x_populate_int_phy(struct bnx2x *bp, u32 shmem_base, u8 port,
+ break;
+ case PORT_HW_CFG_NET_SERDES_IF_SFI:
+ phy->supported &= (SUPPORTED_1000baseT_Full |
++ SUPPORTED_2500baseX_Full |
+ SUPPORTED_10000baseT_Full |
+ SUPPORTED_FIBRE |
+ SUPPORTED_Pause |
+diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_reg.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_reg.h
+index 5caa75b41b73..eaeaf4d90b68 100644
+--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_reg.h
++++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_reg.h
+@@ -7169,7 +7169,8 @@ Theotherbitsarereservedandshouldbezero*/
+ #define MDIO_PMA_REG_8727_PCS_GP 0xc842
+ #define MDIO_PMA_REG_8727_OPT_CFG_REG 0xc8e4
+
+-#define MDIO_AN_REG_8727_MISC_CTRL 0x8309
++#define MDIO_AN_REG_8727_MISC_CTRL1 0x8308
++#define MDIO_AN_REG_8727_MISC_CTRL2 0x8309
+
+ #define MDIO_PMA_REG_8073_CHIP_REV 0xc801
+ #define MDIO_PMA_REG_8073_SPEED_LINK_STATUS 0xc820
diff --git a/dkms.conf b/dkms.conf
new file mode 100644
index 000000000000..8383b3666bdf
--- /dev/null
+++ b/dkms.conf
@@ -0,0 +1,6 @@
+PACKAGE_NAME="@_PKGBASE@"
+PACKAGE_VERSION="@_PKGVER@"
+BUILT_MODULE_NAME[0]="@_PKGBASE@"
+DEST_MODULE_LOCATION[0]="/updates/dkms"
+BUILT_MODULE_LOCATION[0]="bnx2x"
+AUTOINSTALL="yes"