From 9fd0463aef1873ac11a4db70a568ae3c568d20cf Mon Sep 17 00:00:00 2001 From: Jeffrey Townsend Date: Wed, 21 Aug 2019 21:02:02 +0000 Subject: [PATCH] Cleanup patches. --- ...s-i2c-muxes-pca954x-deselect-on-exit.patch | 17 +- ...river-support-intel-igb-bcm5461S-phy.patch | 68 +++--- ...03-drivers-net-ethernet-broadcom-tg3.patch | 12 +- .../driver-hwmon-max6620-fix-rpm-calc.patch | 196 ------------------ .../patches/driver-hwmon-max6620-update.patch | 113 ---------- .../patches/driver-hwmon-max6620.patch | 152 ++++++-------- .../patches/driver-ixgbe-external-phy.patch | 18 +- .../base/any/kernels/4.19-lts/patches/series | 2 - 8 files changed, 112 insertions(+), 466 deletions(-) delete mode 100644 packages/base/any/kernels/4.19-lts/patches/driver-hwmon-max6620-fix-rpm-calc.patch delete mode 100644 packages/base/any/kernels/4.19-lts/patches/driver-hwmon-max6620-update.patch diff --git a/packages/base/any/kernels/4.19-lts/patches/0001-drivers-i2c-muxes-pca954x-deselect-on-exit.patch b/packages/base/any/kernels/4.19-lts/patches/0001-drivers-i2c-muxes-pca954x-deselect-on-exit.patch index 43cfa13f..aa2ec291 100644 --- a/packages/base/any/kernels/4.19-lts/patches/0001-drivers-i2c-muxes-pca954x-deselect-on-exit.patch +++ b/packages/base/any/kernels/4.19-lts/patches/0001-drivers-i2c-muxes-pca954x-deselect-on-exit.patch @@ -1,7 +1,6 @@ -diff --git a/drivers/i2c/muxes/Kconfig b/drivers/i2c/muxes/Kconfig -index 0f5c8fc..f93099c 100644 ---- a/drivers/i2c/muxes/Kconfig -+++ b/drivers/i2c/muxes/Kconfig +diff -urpN a/drivers/i2c/muxes/Kconfig b/drivers/i2c/muxes/Kconfig +--- a/drivers/i2c/muxes/Kconfig 2019-08-16 08:12:54.000000000 +0000 ++++ b/drivers/i2c/muxes/Kconfig 2019-08-21 17:52:53.157929606 +0000 @@ -73,6 +73,13 @@ config I2C_MUX_PCA954x This driver can also be built as a module. If so, the module will be called i2c-mux-pca954x. @@ -16,11 +15,10 @@ index 0f5c8fc..f93099c 100644 config I2C_MUX_PINCTRL tristate "pinctrl-based I2C multiplexer" depends on PINCTRL -diff --git a/drivers/i2c/muxes/i2c-mux-pca954x.c b/drivers/i2c/muxes/i2c-mux-pca954x.c -index 7b992db..bdca051 100644 ---- a/drivers/i2c/muxes/i2c-mux-pca954x.c -+++ b/drivers/i2c/muxes/i2c-mux-pca954x.c -@@ -218,8 +218,10 @@ static int pca954x_deselect_mux(struct i2c_mux_core *muxc, u32 chan) +diff -urpN a/drivers/i2c/muxes/i2c-mux-pca954x.c b/drivers/i2c/muxes/i2c-mux-pca954x.c +--- a/drivers/i2c/muxes/i2c-mux-pca954x.c 2019-08-16 08:12:54.000000000 +0000 ++++ b/drivers/i2c/muxes/i2c-mux-pca954x.c 2019-08-21 17:52:53.157929606 +0000 +@@ -255,8 +255,10 @@ static int pca954x_deselect_mux(struct i struct pca954x *data = i2c_mux_priv(muxc); struct i2c_client *client = data->client; @@ -31,4 +29,3 @@ index 7b992db..bdca051 100644 /* Deselect active channel */ data->last_chan = 0; - diff --git a/packages/base/any/kernels/4.19-lts/patches/0002-driver-support-intel-igb-bcm5461S-phy.patch b/packages/base/any/kernels/4.19-lts/patches/0002-driver-support-intel-igb-bcm5461S-phy.patch index 3e40e777..5dbd6fe2 100644 --- a/packages/base/any/kernels/4.19-lts/patches/0002-driver-support-intel-igb-bcm5461S-phy.patch +++ b/packages/base/any/kernels/4.19-lts/patches/0002-driver-support-intel-igb-bcm5461S-phy.patch @@ -1,8 +1,7 @@ -diff --git a/drivers/net/ethernet/intel/igb/e1000_82575.c b/drivers/net/ethernet/intel/igb/e1000_82575.c -index c37cc8b..41c0ff2 100644 ---- a/drivers/net/ethernet/intel/igb/e1000_82575.c -+++ b/drivers/net/ethernet/intel/igb/e1000_82575.c -@@ -340,6 +340,12 @@ static s32 igb_init_phy_params_82575(struct e1000_hw *hw) +diff -urpN a/drivers/net/ethernet/intel/igb/e1000_82575.c b/drivers/net/ethernet/intel/igb/e1000_82575.c +--- a/drivers/net/ethernet/intel/igb/e1000_82575.c 2019-08-16 08:12:54.000000000 +0000 ++++ b/drivers/net/ethernet/intel/igb/e1000_82575.c 2019-08-21 20:32:51.778678388 +0000 +@@ -308,6 +308,12 @@ static s32 igb_init_phy_params_82575(str phy->ops.set_d3_lplu_state = igb_set_d3_lplu_state_82580; phy->ops.force_speed_duplex = igb_phy_force_speed_duplex_m88; break; @@ -15,7 +14,7 @@ index c37cc8b..41c0ff2 100644 case BCM54616_E_PHY_ID: phy->type = e1000_phy_bcm54616; break; -@@ -902,6 +908,16 @@ static s32 igb_get_phy_id_82575(struct e1000_hw *hw) +@@ -870,6 +876,16 @@ static s32 igb_get_phy_id_82575(struct e goto out; } ret_val = igb_get_phy_id(hw); @@ -32,7 +31,7 @@ index c37cc8b..41c0ff2 100644 goto out; } -@@ -1289,6 +1305,9 @@ static s32 igb_get_cfg_done_82575(struct e1000_hw *hw) +@@ -1257,6 +1273,9 @@ static s32 igb_get_cfg_done_82575(struct (hw->phy.type == e1000_phy_igp_3)) igb_phy_init_script_igp3(hw); @@ -42,7 +41,7 @@ index c37cc8b..41c0ff2 100644 return 0; } -@@ -1618,6 +1637,7 @@ static s32 igb_setup_copper_link_82575(struct e1000_hw *hw) +@@ -1586,6 +1605,7 @@ static s32 igb_setup_copper_link_82575(s case e1000_i350: case e1000_i210: case e1000_i211: @@ -50,7 +49,7 @@ index c37cc8b..41c0ff2 100644 phpm_reg = rd32(E1000_82580_PHY_POWER_MGMT); phpm_reg &= ~E1000_82580_PM_GO_LINKD; wr32(E1000_82580_PHY_POWER_MGMT, phpm_reg); -@@ -1663,7 +1683,8 @@ static s32 igb_setup_copper_link_82575(struct e1000_hw *hw) +@@ -1631,7 +1651,8 @@ static s32 igb_setup_copper_link_82575(s ret_val = igb_copper_link_setup_82580(hw); break; case e1000_phy_bcm54616: @@ -60,11 +59,10 @@ index c37cc8b..41c0ff2 100644 break; default: ret_val = -E1000_ERR_PHY; -diff --git a/drivers/net/ethernet/intel/igb/e1000_defines.h b/drivers/net/ethernet/intel/igb/e1000_defines.h -index 1de82f2..0703c3e 100644 ---- a/drivers/net/ethernet/intel/igb/e1000_defines.h -+++ b/drivers/net/ethernet/intel/igb/e1000_defines.h -@@ -890,6 +890,7 @@ +diff -urpN a/drivers/net/ethernet/intel/igb/e1000_defines.h b/drivers/net/ethernet/intel/igb/e1000_defines.h +--- a/drivers/net/ethernet/intel/igb/e1000_defines.h 2019-08-16 08:12:54.000000000 +0000 ++++ b/drivers/net/ethernet/intel/igb/e1000_defines.h 2019-08-21 20:32:51.778678388 +0000 +@@ -885,6 +885,7 @@ #define M88E1543_E_PHY_ID 0x01410EA0 #define M88E1512_E_PHY_ID 0x01410DD0 #define BCM54616_E_PHY_ID 0x03625D10 @@ -72,11 +70,10 @@ index 1de82f2..0703c3e 100644 /* M88E1000 Specific Registers */ #define M88E1000_PHY_SPEC_CTRL 0x10 /* PHY Specific Control Register */ -diff --git a/drivers/net/ethernet/intel/igb/e1000_hw.h b/drivers/net/ethernet/intel/igb/e1000_hw.h -index 6c9485a..2a0b83b 100644 ---- a/drivers/net/ethernet/intel/igb/e1000_hw.h -+++ b/drivers/net/ethernet/intel/igb/e1000_hw.h -@@ -129,6 +129,7 @@ enum e1000_phy_type { +diff -urpN a/drivers/net/ethernet/intel/igb/e1000_hw.h b/drivers/net/ethernet/intel/igb/e1000_hw.h +--- a/drivers/net/ethernet/intel/igb/e1000_hw.h 2019-08-16 08:12:54.000000000 +0000 ++++ b/drivers/net/ethernet/intel/igb/e1000_hw.h 2019-08-21 20:32:51.778678388 +0000 +@@ -110,6 +110,7 @@ enum e1000_phy_type { e1000_phy_82580, e1000_phy_i210, e1000_phy_bcm54616, @@ -84,11 +81,10 @@ index 6c9485a..2a0b83b 100644 }; enum e1000_bus_type { -diff --git a/drivers/net/ethernet/intel/igb/e1000_phy.c b/drivers/net/ethernet/intel/igb/e1000_phy.c -index 413025b..4c2a5ff 100644 ---- a/drivers/net/ethernet/intel/igb/e1000_phy.c -+++ b/drivers/net/ethernet/intel/igb/e1000_phy.c -@@ -146,6 +146,13 @@ s32 igb_read_phy_reg_mdic(struct e1000_hw *hw, u32 offset, u16 *data) +diff -urpN a/drivers/net/ethernet/intel/igb/e1000_phy.c b/drivers/net/ethernet/intel/igb/e1000_phy.c +--- a/drivers/net/ethernet/intel/igb/e1000_phy.c 2019-08-16 08:12:54.000000000 +0000 ++++ b/drivers/net/ethernet/intel/igb/e1000_phy.c 2019-08-21 20:32:51.782678310 +0000 +@@ -126,6 +126,13 @@ s32 igb_read_phy_reg_mdic(struct e1000_h * Control register. The MAC will take care of interfacing with the * PHY to retrieve the desired data. */ @@ -102,7 +98,7 @@ index 413025b..4c2a5ff 100644 mdic = ((offset << E1000_MDIC_REG_SHIFT) | (phy->addr << E1000_MDIC_PHY_SHIFT) | (E1000_MDIC_OP_READ)); -@@ -202,6 +209,13 @@ s32 igb_write_phy_reg_mdic(struct e1000_hw *hw, u32 offset, u16 data) +@@ -182,6 +189,13 @@ s32 igb_write_phy_reg_mdic(struct e1000_ * Control register. The MAC will take care of interfacing with the * PHY to retrieve the desired data. */ @@ -116,7 +112,7 @@ index 413025b..4c2a5ff 100644 mdic = (((u32)data) | (offset << E1000_MDIC_REG_SHIFT) | (phy->addr << E1000_MDIC_PHY_SHIFT) | -@@ -1113,11 +1127,13 @@ s32 igb_setup_copper_link(struct e1000_hw *hw) +@@ -1094,11 +1108,13 @@ s32 igb_setup_copper_link(struct e1000_h * depending on user settings. */ hw_dbg("Forcing Speed and Duplex\n"); @@ -135,7 +131,7 @@ index 413025b..4c2a5ff 100644 } /* Check link status. Wait up to 100 microseconds for link to become -@@ -2647,3 +2663,66 @@ static s32 igb_set_master_slave_mode(struct e1000_hw *hw) +@@ -2628,3 +2644,66 @@ static s32 igb_set_master_slave_mode(str return hw->phy.ops.write_reg(hw, PHY_1000T_CTRL, phy_data); } @@ -202,11 +198,10 @@ index 413025b..4c2a5ff 100644 +out: + return ret_val; +} -diff --git a/drivers/net/ethernet/intel/igb/e1000_phy.h b/drivers/net/ethernet/intel/igb/e1000_phy.h -index 9b622b3..3b28873 100644 ---- a/drivers/net/ethernet/intel/igb/e1000_phy.h -+++ b/drivers/net/ethernet/intel/igb/e1000_phy.h -@@ -61,6 +61,8 @@ s32 igb_phy_has_link(struct e1000_hw *hw, u32 iterations, +diff -urpN a/drivers/net/ethernet/intel/igb/e1000_phy.h b/drivers/net/ethernet/intel/igb/e1000_phy.h +--- a/drivers/net/ethernet/intel/igb/e1000_phy.h 2019-08-16 08:12:54.000000000 +0000 ++++ b/drivers/net/ethernet/intel/igb/e1000_phy.h 2019-08-21 20:32:51.782678310 +0000 +@@ -41,6 +41,8 @@ s32 igb_phy_has_link(struct e1000_hw *h void igb_power_up_phy_copper(struct e1000_hw *hw); void igb_power_down_phy_copper(struct e1000_hw *hw); s32 igb_phy_init_script_igp3(struct e1000_hw *hw); @@ -215,11 +210,10 @@ index 9b622b3..3b28873 100644 s32 igb_initialize_M88E1512_phy(struct e1000_hw *hw); s32 igb_initialize_M88E1543_phy(struct e1000_hw *hw); s32 igb_read_phy_reg_mdic(struct e1000_hw *hw, u32 offset, u16 *data); -diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c -index d1a44a8..1399989 100644 ---- a/drivers/net/ethernet/intel/igb/igb_main.c -+++ b/drivers/net/ethernet/intel/igb/igb_main.c -@@ -7730,11 +7730,19 @@ static int igb_mii_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd) +diff -urpN a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c +--- a/drivers/net/ethernet/intel/igb/igb_main.c 2019-08-16 08:12:54.000000000 +0000 ++++ b/drivers/net/ethernet/intel/igb/igb_main.c 2019-08-21 20:32:51.782678310 +0000 +@@ -8554,11 +8554,19 @@ static int igb_mii_ioctl(struct net_devi data->phy_id = adapter->hw.phy.addr; break; case SIOCGMIIREG: diff --git a/packages/base/any/kernels/4.19-lts/patches/0003-drivers-net-ethernet-broadcom-tg3.patch b/packages/base/any/kernels/4.19-lts/patches/0003-drivers-net-ethernet-broadcom-tg3.patch index ddcedadb..4c419122 100644 --- a/packages/base/any/kernels/4.19-lts/patches/0003-drivers-net-ethernet-broadcom-tg3.patch +++ b/packages/base/any/kernels/4.19-lts/patches/0003-drivers-net-ethernet-broadcom-tg3.patch @@ -1,10 +1,10 @@ -diff -Naur a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c ---- a/drivers/net/ethernet/broadcom/tg3.c 2019-03-27 13:13:56.000000000 +0800 -+++ b/drivers/net/ethernet/broadcom/tg3.c 2019-04-26 11:08:20.307848693 +0800 -@@ -11734,6 +11734,12 @@ +diff -urpN a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c +--- a/drivers/net/ethernet/broadcom/tg3.c 2019-08-16 08:12:54.000000000 +0000 ++++ b/drivers/net/ethernet/broadcom/tg3.c 2019-08-21 20:35:43.091346979 +0000 +@@ -11765,6 +11765,12 @@ static int tg3_open(struct net_device *d pci_set_power_state(tp->pdev, PCI_D3hot); } - + + if (tg3_asic_rev(tp) == ASIC_REV_5720){ + /*Fixed ASIC_REV_5720 support 100M/10M feature */ + __tg3_writephy(tp, 0x8, 0x10, 0x1d0); @@ -13,4 +13,4 @@ diff -Naur a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom + return err; } - + diff --git a/packages/base/any/kernels/4.19-lts/patches/driver-hwmon-max6620-fix-rpm-calc.patch b/packages/base/any/kernels/4.19-lts/patches/driver-hwmon-max6620-fix-rpm-calc.patch deleted file mode 100644 index e5401626..00000000 --- a/packages/base/any/kernels/4.19-lts/patches/driver-hwmon-max6620-fix-rpm-calc.patch +++ /dev/null @@ -1,196 +0,0 @@ -MAX6620 fix rpm calculation accuracy - -From: Cumulus Networks - -The driver only fills the most significant 8 bits of the fan tach -count (11 bit value). Fixing the driver to use all of 11 bits for -more accuracy. ---- - drivers/hwmon/max6620.c | 105 +++++++++++++++++++++-------------------------- - 1 file changed, 46 insertions(+), 59 deletions(-) - -diff --git a/drivers/hwmon/max6620.c b/drivers/hwmon/max6620.c -index 3c337c7..76c1f7f 100644 ---- a/drivers/hwmon/max6620.c -+++ b/drivers/hwmon/max6620.c -@@ -46,6 +46,8 @@ - - /* clock: The clock frequency of the chip the driver should assume */ - static int clock = 8192; -+static u32 sr = 2; -+static u32 np = 2; - - module_param(clock, int, S_IRUGO); - -@@ -213,22 +215,22 @@ static ssize_t get_fan(struct device *dev, struct device_attribute *devattr, cha - - struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); - struct max6620_data *data = max6620_update_device(dev); -- int rpm; -- -- /* -- * Calculation details: -- * -- * Each tachometer counts over an interval given by the "count" -- * register (0.25, 0.5, 1 or 2 seconds). This module assumes -- * that the fans produce two pulses per revolution (this seems -- * to be the most common). -- */ -- if(data->tach[attr->index] == 0 || data->tach[attr->index] == 255) { -+ struct i2c_client *client = to_i2c_client(dev); -+ u32 rpm = 0; -+ u32 tach = 0; -+ u32 tach1 = 0; -+ u32 tach2 = 0; -+ -+ tach1 = i2c_smbus_read_byte_data(client, tach_reg[attr->index]); -+ tach1 = (tach1 << 3) & 0x7f8; -+ tach2 = i2c_smbus_read_byte_data(client, tach_reg[attr->index] + 1); -+ tach2 = (tach2 >> 5) & 0x7; -+ tach = tach1 | tach2; -+ if (tach == 0) { - rpm = 0; - } else { -- rpm = ((clock / (data->tach[attr->index] << 3)) * 30 * DIV_FROM_REG(data->fandyn[attr->index])); -+ rpm = (60 * sr * clock)/(tach * np); - } -- - return sprintf(buf, "%d\n", rpm); - } - -@@ -236,22 +238,21 @@ static ssize_t get_target(struct device *dev, struct device_attribute *devattr, - - struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); - struct max6620_data *data = max6620_update_device(dev); -- int kscale, ktach, rpm; -- -- /* -- * Use the datasheet equation: -- * -- * FanSpeed = KSCALE x fCLK / [256 x (KTACH + 1)] -- * -- * then multiply by 60 to give rpm. -- */ -- -- kscale = DIV_FROM_REG(data->fandyn[attr->index]); -- ktach = data->target[attr->index]; -- if(ktach == 0) { -+ struct i2c_client *client = to_i2c_client(dev); -+ u32 rpm; -+ u32 target; -+ u32 target1; -+ u32 target2; -+ -+ target1 = i2c_smbus_read_byte_data(client, target_reg[attr->index]); -+ target1 = (target1 << 3) & 0x7f8; -+ target2 = i2c_smbus_read_byte_data(client, target_reg[attr->index] + 1); -+ target2 = (target2 >> 5) & 0x7; -+ target = target1 | target2; -+ if (target == 0) { - rpm = 0; - } else { -- rpm = ((60 * kscale * clock) / (ktach << 3)); -+ rpm = (60 * sr * clock)/(target * np); - } - return sprintf(buf, "%d\n", rpm); - } -@@ -261,9 +262,11 @@ static ssize_t set_target(struct device *dev, struct device_attribute *devattr, - struct i2c_client *client = to_i2c_client(dev); - struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); - struct max6620_data *data = i2c_get_clientdata(client); -- int kscale, ktach; -- unsigned long rpm; -+ u32 rpm; - int err; -+ u32 target; -+ u32 target1; -+ u32 target2; - - err = kstrtoul(buf, 10, &rpm); - if (err) -@@ -271,25 +274,13 @@ static ssize_t set_target(struct device *dev, struct device_attribute *devattr, - - rpm = SENSORS_LIMIT(rpm, FAN_RPM_MIN, FAN_RPM_MAX); - -- /* -- * Divide the required speed by 60 to get from rpm to rps, then -- * use the datasheet equation: -- * -- * KTACH = [(fCLK x KSCALE) / (256 x FanSpeed)] - 1 -- */ -- - mutex_lock(&data->update_lock); - -- kscale = DIV_FROM_REG(data->fandyn[attr->index]); -- ktach = ((60 * kscale * clock) / rpm); -- if (ktach < 0) -- ktach = 0; -- if (ktach > 255) -- ktach = 255; -- data->target[attr->index] = ktach; -- -- i2c_smbus_write_byte_data(client, target_reg[attr->index], data->target[attr->index]); -- i2c_smbus_write_byte_data(client, target_reg[attr->index]+0x01, 0x00); -+ target = (60 * sr * 8192)/(rpm * np); -+ target1 = (target >> 3) & 0xff; -+ target2 = (target << 5) & 0xe0; -+ i2c_smbus_write_byte_data(client, target_reg[attr->index], target1); -+ i2c_smbus_write_byte_data(client, target_reg[attr->index] + 1, target2); - - mutex_unlock(&data->update_lock); - -@@ -609,8 +600,11 @@ static int max6620_init_client(struct i2c_client *client) { - } - - -- -- if (i2c_smbus_write_byte_data(client, MAX6620_REG_CONFIG, config)) { -+ /* -+ * Set bit 4, disable other fans from going full speed on a fail -+ * failure. -+ */ -+ if (i2c_smbus_write_byte_data(client, MAX6620_REG_CONFIG, config | 0x10)) { - dev_err(&client->dev, "Config write error, aborting.\n"); - return err; - } -@@ -618,28 +612,21 @@ static int max6620_init_client(struct i2c_client *client) { - data->config = config; - for (i = 0; i < 4; i++) { - data->fancfg[i] = i2c_smbus_read_byte_data(client, config_reg[i]); -- data->fancfg[i] |= 0x80; // enable TACH monitoring -+ data->fancfg[i] |= 0xa8; // enable TACH monitoring - i2c_smbus_write_byte_data(client, config_reg[i], data->fancfg[i]); - data->fandyn[i] = i2c_smbus_read_byte_data(client, dyn_reg[i]); -- data-> fandyn[i] |= 0x1C; -+ /* 2 counts (001) and Rate change 100 (0.125 secs) */ -+ data-> fandyn[i] = 0x30; - i2c_smbus_write_byte_data(client, dyn_reg[i], data->fandyn[i]); - data->tach[i] = i2c_smbus_read_byte_data(client, tach_reg[i]); - data->volt[i] = i2c_smbus_read_byte_data(client, volt_reg[i]); - data->target[i] = i2c_smbus_read_byte_data(client, target_reg[i]); - data->dac[i] = i2c_smbus_read_byte_data(client, dac_reg[i]); - -- -- - } -- -- -- - return 0; - } - -- -- -- - static struct max6620_data *max6620_update_device(struct device *dev) - { - int i; -@@ -678,7 +665,7 @@ static struct max6620_data *max6620_update_device(struct device *dev) - return data; - } - --module_i2c_driver(max6620_driver); -+// module_i2c_driver(max6620_driver); - - static int __init max6620_init(void) - { diff --git a/packages/base/any/kernels/4.19-lts/patches/driver-hwmon-max6620-update.patch b/packages/base/any/kernels/4.19-lts/patches/driver-hwmon-max6620-update.patch deleted file mode 100644 index b4cfe0cf..00000000 --- a/packages/base/any/kernels/4.19-lts/patches/driver-hwmon-max6620-update.patch +++ /dev/null @@ -1,113 +0,0 @@ -Update MAX6620 driver to support newer kernel version - -From: Shuotian Cheng - - ---- - drivers/hwmon/max6620.c | 25 +++++++++++-------------- - 1 file changed, 11 insertions(+), 14 deletions(-) - -diff --git a/drivers/hwmon/max6620.c b/drivers/hwmon/max6620.c -index 76c1f7f..fb49195 100644 ---- a/drivers/hwmon/max6620.c -+++ b/drivers/hwmon/max6620.c -@@ -183,7 +183,7 @@ static struct i2c_driver max6620_driver = { - .name = "max6620", - }, - .probe = max6620_probe, -- .remove = __devexit_p(max6620_remove), -+ .remove = max6620_remove, - .id_table = max6620_id, - .address_list = normal_i2c, - }; -@@ -231,6 +231,7 @@ static ssize_t get_fan(struct device *dev, struct device_attribute *devattr, cha - } else { - rpm = (60 * sr * clock)/(tach * np); - } -+ - return sprintf(buf, "%d\n", rpm); - } - -@@ -262,17 +263,17 @@ static ssize_t set_target(struct device *dev, struct device_attribute *devattr, - struct i2c_client *client = to_i2c_client(dev); - struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); - struct max6620_data *data = i2c_get_clientdata(client); -- u32 rpm; -+ unsigned long rpm; - int err; -- u32 target; -- u32 target1; -- u32 target2; -+ unsigned long target; -+ unsigned long target1; -+ unsigned long target2; - - err = kstrtoul(buf, 10, &rpm); - if (err) - return err; - -- rpm = SENSORS_LIMIT(rpm, FAN_RPM_MIN, FAN_RPM_MAX); -+ rpm = clamp_val(rpm, FAN_RPM_MIN, FAN_RPM_MAX); - - mutex_lock(&data->update_lock); - -@@ -326,7 +327,7 @@ static ssize_t set_pwm(struct device *dev, struct device_attribute *devattr, con - if (err) - return err; - -- pwm = SENSORS_LIMIT(pwm, 0, 255); -+ pwm = clamp_val(pwm, 0, 255); - - mutex_lock(&data->update_lock); - -@@ -534,7 +535,7 @@ static struct attribute_group max6620_attr_grp = { - * Real code - */ - --static int __devinit max6620_probe(struct i2c_client *client, const struct i2c_device_id *id) { -+static int max6620_probe(struct i2c_client *client, const struct i2c_device_id *id) { - - struct max6620_data *data; - int err; -@@ -575,7 +576,7 @@ dev_info(&client->dev, "Sysfs entries created\n"); - return err; - } - --static int __devexit max6620_remove(struct i2c_client *client) { -+static int max6620_remove(struct i2c_client *client) { - - struct max6620_data *data = i2c_get_clientdata(client); - -@@ -599,7 +600,6 @@ static int max6620_init_client(struct i2c_client *client) { - return err; - } - -- - /* - * Set bit 4, disable other fans from going full speed on a fail - * failure. -@@ -615,14 +615,13 @@ static int max6620_init_client(struct i2c_client *client) { - data->fancfg[i] |= 0xa8; // enable TACH monitoring - i2c_smbus_write_byte_data(client, config_reg[i], data->fancfg[i]); - data->fandyn[i] = i2c_smbus_read_byte_data(client, dyn_reg[i]); -- /* 2 counts (001) and Rate change 100 (0.125 secs) */ -+ /* 2 counts (001) and Rate change 100 (0.125 secs) */ - data-> fandyn[i] = 0x30; - i2c_smbus_write_byte_data(client, dyn_reg[i], data->fandyn[i]); - data->tach[i] = i2c_smbus_read_byte_data(client, tach_reg[i]); - data->volt[i] = i2c_smbus_read_byte_data(client, volt_reg[i]); - data->target[i] = i2c_smbus_read_byte_data(client, target_reg[i]); - data->dac[i] = i2c_smbus_read_byte_data(client, dac_reg[i]); -- - } - return 0; - } -@@ -665,8 +664,6 @@ static struct max6620_data *max6620_update_device(struct device *dev) - return data; - } - --// module_i2c_driver(max6620_driver); -- - static int __init max6620_init(void) - { - return i2c_add_driver(&max6620_driver); diff --git a/packages/base/any/kernels/4.19-lts/patches/driver-hwmon-max6620.patch b/packages/base/any/kernels/4.19-lts/patches/driver-hwmon-max6620.patch index 119c12ee..fd669512 100644 --- a/packages/base/any/kernels/4.19-lts/patches/driver-hwmon-max6620.patch +++ b/packages/base/any/kernels/4.19-lts/patches/driver-hwmon-max6620.patch @@ -1,20 +1,7 @@ -Driver for MAX6620 Fan sensor - -From: Cumulus Networks - - ---- - drivers/hwmon/Kconfig | 10 + - drivers/hwmon/Makefile | 1 - drivers/hwmon/max6620.c | 702 +++++++++++++++++++++++++++++++++++++++++++++++ - 3 files changed, 713 insertions(+) - create mode 100644 drivers/hwmon/max6620.c - -diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig -index 02d3d85..ca38e05 100644 ---- a/drivers/hwmon/Kconfig -+++ b/drivers/hwmon/Kconfig -@@ -784,6 +784,16 @@ config SENSORS_MAX6650 +diff -urpN a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig +--- a/drivers/hwmon/Kconfig 2019-08-16 08:12:54.000000000 +0000 ++++ b/drivers/hwmon/Kconfig 2019-08-21 20:40:03.434307483 +0000 +@@ -905,6 +905,16 @@ config SENSORS_MAX6650 This driver can also be built as a module. If so, the module will be called max6650. @@ -31,24 +18,21 @@ index 02d3d85..ca38e05 100644 config SENSORS_MAX6697 tristate "Maxim MAX6697 and compatibles" depends on I2C -diff --git a/drivers/hwmon/Makefile b/drivers/hwmon/Makefile -index 3dc0f02..8837a7b 100644 ---- a/drivers/hwmon/Makefile -+++ b/drivers/hwmon/Makefile -@@ -111,6 +111,7 @@ obj-$(CONFIG_SENSORS_MAX197) += max197.o +diff -urpN a/drivers/hwmon/Makefile b/drivers/hwmon/Makefile +--- a/drivers/hwmon/Makefile 2019-08-16 08:12:54.000000000 +0000 ++++ b/drivers/hwmon/Makefile 2019-08-21 20:40:03.434307483 +0000 +@@ -124,6 +124,7 @@ obj-$(CONFIG_SENSORS_MAX6621) += max6621 obj-$(CONFIG_SENSORS_MAX6639) += max6639.o obj-$(CONFIG_SENSORS_MAX6642) += max6642.o obj-$(CONFIG_SENSORS_MAX6650) += max6650.o +obj-$(CONFIG_SENSORS_MAX6620) += max6620.o obj-$(CONFIG_SENSORS_MAX6697) += max6697.o + obj-$(CONFIG_SENSORS_MAX31790) += max31790.o obj-$(CONFIG_SENSORS_MC13783_ADC)+= mc13783-adc.o - obj-$(CONFIG_SENSORS_MCP3021) += mcp3021.o -diff --git a/drivers/hwmon/max6620.c b/drivers/hwmon/max6620.c -new file mode 100644 -index 0000000..3c337c7 ---- /dev/null -+++ b/drivers/hwmon/max6620.c -@@ -0,0 +1,702 @@ +diff -urpN a/drivers/hwmon/max6620.c b/drivers/hwmon/max6620.c +--- a/drivers/hwmon/max6620.c 1970-01-01 00:00:00.000000000 +0000 ++++ b/drivers/hwmon/max6620.c 2019-08-21 20:40:03.438307405 +0000 +@@ -0,0 +1,686 @@ +/* + * max6620.c - Linux Kernel module for hardware monitoring. + * @@ -97,6 +81,8 @@ index 0000000..3c337c7 + +/* clock: The clock frequency of the chip the driver should assume */ +static int clock = 8192; ++static u32 sr = 2; ++static u32 np = 2; + +module_param(clock, int, S_IRUGO); + @@ -232,7 +218,7 @@ index 0000000..3c337c7 + .name = "max6620", + }, + .probe = max6620_probe, -+ .remove = __devexit_p(max6620_remove), ++ .remove = max6620_remove, + .id_table = max6620_id, + .address_list = normal_i2c, +}; @@ -264,20 +250,21 @@ index 0000000..3c337c7 + + struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); + struct max6620_data *data = max6620_update_device(dev); -+ int rpm; ++ struct i2c_client *client = to_i2c_client(dev); ++ u32 rpm = 0; ++ u32 tach = 0; ++ u32 tach1 = 0; ++ u32 tach2 = 0; + -+ /* -+ * Calculation details: -+ * -+ * Each tachometer counts over an interval given by the "count" -+ * register (0.25, 0.5, 1 or 2 seconds). This module assumes -+ * that the fans produce two pulses per revolution (this seems -+ * to be the most common). -+ */ -+ if(data->tach[attr->index] == 0 || data->tach[attr->index] == 255) { ++ tach1 = i2c_smbus_read_byte_data(client, tach_reg[attr->index]); ++ tach1 = (tach1 << 3) & 0x7f8; ++ tach2 = i2c_smbus_read_byte_data(client, tach_reg[attr->index] + 1); ++ tach2 = (tach2 >> 5) & 0x7; ++ tach = tach1 | tach2; ++ if (tach == 0) { + rpm = 0; + } else { -+ rpm = ((clock / (data->tach[attr->index] << 3)) * 30 * DIV_FROM_REG(data->fandyn[attr->index])); ++ rpm = (60 * sr * clock)/(tach * np); + } + + return sprintf(buf, "%d\n", rpm); @@ -287,22 +274,21 @@ index 0000000..3c337c7 + + struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); + struct max6620_data *data = max6620_update_device(dev); -+ int kscale, ktach, rpm; ++ struct i2c_client *client = to_i2c_client(dev); ++ u32 rpm; ++ u32 target; ++ u32 target1; ++ u32 target2; + -+ /* -+ * Use the datasheet equation: -+ * -+ * FanSpeed = KSCALE x fCLK / [256 x (KTACH + 1)] -+ * -+ * then multiply by 60 to give rpm. -+ */ -+ -+ kscale = DIV_FROM_REG(data->fandyn[attr->index]); -+ ktach = data->target[attr->index]; -+ if(ktach == 0) { ++ target1 = i2c_smbus_read_byte_data(client, target_reg[attr->index]); ++ target1 = (target1 << 3) & 0x7f8; ++ target2 = i2c_smbus_read_byte_data(client, target_reg[attr->index] + 1); ++ target2 = (target2 >> 5) & 0x7; ++ target = target1 | target2; ++ if (target == 0) { + rpm = 0; + } else { -+ rpm = ((60 * kscale * clock) / (ktach << 3)); ++ rpm = (60 * sr * clock)/(target * np); + } + return sprintf(buf, "%d\n", rpm); +} @@ -312,35 +298,25 @@ index 0000000..3c337c7 + struct i2c_client *client = to_i2c_client(dev); + struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); + struct max6620_data *data = i2c_get_clientdata(client); -+ int kscale, ktach; + unsigned long rpm; + int err; ++ unsigned long target; ++ unsigned long target1; ++ unsigned long target2; + + err = kstrtoul(buf, 10, &rpm); + if (err) + return err; + -+ rpm = SENSORS_LIMIT(rpm, FAN_RPM_MIN, FAN_RPM_MAX); -+ -+ /* -+ * Divide the required speed by 60 to get from rpm to rps, then -+ * use the datasheet equation: -+ * -+ * KTACH = [(fCLK x KSCALE) / (256 x FanSpeed)] - 1 -+ */ ++ rpm = clamp_val(rpm, FAN_RPM_MIN, FAN_RPM_MAX); + + mutex_lock(&data->update_lock); + -+ kscale = DIV_FROM_REG(data->fandyn[attr->index]); -+ ktach = ((60 * kscale * clock) / rpm); -+ if (ktach < 0) -+ ktach = 0; -+ if (ktach > 255) -+ ktach = 255; -+ data->target[attr->index] = ktach; -+ -+ i2c_smbus_write_byte_data(client, target_reg[attr->index], data->target[attr->index]); -+ i2c_smbus_write_byte_data(client, target_reg[attr->index]+0x01, 0x00); ++ target = (60 * sr * 8192)/(rpm * np); ++ target1 = (target >> 3) & 0xff; ++ target2 = (target << 5) & 0xe0; ++ i2c_smbus_write_byte_data(client, target_reg[attr->index], target1); ++ i2c_smbus_write_byte_data(client, target_reg[attr->index] + 1, target2); + + mutex_unlock(&data->update_lock); + @@ -386,7 +362,7 @@ index 0000000..3c337c7 + if (err) + return err; + -+ pwm = SENSORS_LIMIT(pwm, 0, 255); ++ pwm = clamp_val(pwm, 0, 255); + + mutex_lock(&data->update_lock); + @@ -594,7 +570,7 @@ index 0000000..3c337c7 + * Real code + */ + -+static int __devinit max6620_probe(struct i2c_client *client, const struct i2c_device_id *id) { ++static int max6620_probe(struct i2c_client *client, const struct i2c_device_id *id) { + + struct max6620_data *data; + int err; @@ -635,7 +611,7 @@ index 0000000..3c337c7 + return err; +} + -+static int __devexit max6620_remove(struct i2c_client *client) { ++static int max6620_remove(struct i2c_client *client) { + + struct max6620_data *data = i2c_get_clientdata(client); + @@ -659,9 +635,11 @@ index 0000000..3c337c7 + return err; + } + -+ -+ -+ if (i2c_smbus_write_byte_data(client, MAX6620_REG_CONFIG, config)) { ++ /* ++ * Set bit 4, disable other fans from going full speed on a fail ++ * failure. ++ */ ++ if (i2c_smbus_write_byte_data(client, MAX6620_REG_CONFIG, config | 0x10)) { + dev_err(&client->dev, "Config write error, aborting.\n"); + return err; + } @@ -669,28 +647,20 @@ index 0000000..3c337c7 + data->config = config; + for (i = 0; i < 4; i++) { + data->fancfg[i] = i2c_smbus_read_byte_data(client, config_reg[i]); -+ data->fancfg[i] |= 0x80; // enable TACH monitoring ++ data->fancfg[i] |= 0xa8; // enable TACH monitoring + i2c_smbus_write_byte_data(client, config_reg[i], data->fancfg[i]); + data->fandyn[i] = i2c_smbus_read_byte_data(client, dyn_reg[i]); -+ data-> fandyn[i] |= 0x1C; ++ /* 2 counts (001) and Rate change 100 (0.125 secs) */ ++ data-> fandyn[i] = 0x30; + i2c_smbus_write_byte_data(client, dyn_reg[i], data->fandyn[i]); + data->tach[i] = i2c_smbus_read_byte_data(client, tach_reg[i]); + data->volt[i] = i2c_smbus_read_byte_data(client, volt_reg[i]); + data->target[i] = i2c_smbus_read_byte_data(client, target_reg[i]); + data->dac[i] = i2c_smbus_read_byte_data(client, dac_reg[i]); -+ -+ -+ + } -+ -+ -+ + return 0; +} + -+ -+ -+ +static struct max6620_data *max6620_update_device(struct device *dev) +{ + int i; @@ -729,8 +699,6 @@ index 0000000..3c337c7 + return data; +} + -+module_i2c_driver(max6620_driver); -+ +static int __init max6620_init(void) +{ + return i2c_add_driver(&max6620_driver); diff --git a/packages/base/any/kernels/4.19-lts/patches/driver-ixgbe-external-phy.patch b/packages/base/any/kernels/4.19-lts/patches/driver-ixgbe-external-phy.patch index 5d069eaf..00b63628 100644 --- a/packages/base/any/kernels/4.19-lts/patches/driver-ixgbe-external-phy.patch +++ b/packages/base/any/kernels/4.19-lts/patches/driver-ixgbe-external-phy.patch @@ -1,8 +1,7 @@ -diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c -index 654a402..9714687 100644 ---- a/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c -+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c -@@ -404,6 +404,9 @@ static enum ixgbe_phy_type ixgbe_get_phy_type_from_id(u32 phy_id) +diff -urpN a/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c +--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c 2019-08-16 08:12:54.000000000 +0000 ++++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c 2019-08-21 20:37:39.221097032 +0000 +@@ -379,6 +379,9 @@ static enum ixgbe_phy_type ixgbe_get_phy case X557_PHY_ID2: phy_type = ixgbe_phy_x550em_ext_t; break; @@ -12,11 +11,10 @@ index 654a402..9714687 100644 default: phy_type = ixgbe_phy_unknown; break; -diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_type.h b/drivers/net/ethernet/intel/ixgbe/ixgbe_type.h -index ffa0ee5..fb89b2b 100644 ---- a/drivers/net/ethernet/intel/ixgbe/ixgbe_type.h -+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_type.h -@@ -1387,6 +1387,7 @@ struct ixgbe_thermal_sensor_data { +diff -urpN a/drivers/net/ethernet/intel/ixgbe/ixgbe_type.h b/drivers/net/ethernet/intel/ixgbe/ixgbe_type.h +--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_type.h 2019-08-16 08:12:54.000000000 +0000 ++++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_type.h 2019-08-21 20:37:39.225096955 +0000 +@@ -1403,6 +1403,7 @@ struct ixgbe_nvm_version { #define QT2022_PHY_ID 0x0043A400 #define ATH_PHY_ID 0x03429050 #define AQ_FW_REV 0x20 diff --git a/packages/base/any/kernels/4.19-lts/patches/series b/packages/base/any/kernels/4.19-lts/patches/series index 1d5ee7e9..e0cca5d4 100755 --- a/packages/base/any/kernels/4.19-lts/patches/series +++ b/packages/base/any/kernels/4.19-lts/patches/series @@ -3,5 +3,3 @@ 0003-drivers-net-ethernet-broadcom-tg3.patch driver-ixgbe-external-phy.patch driver-hwmon-max6620.patch -driver-hwmon-max6620-fix-rpm-calc.patch -driver-hwmon-max6620-update.patch