]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
4.9-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 13 May 2022 08:28:02 +0000 (10:28 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 13 May 2022 08:28:02 +0000 (10:28 +0200)
added patches:
bluetooth-fix-the-creation-of-hdev-name.patch
mmc-rtsx-add-74-clocks-in-power-on-flow.patch

queue-4.9/bluetooth-fix-the-creation-of-hdev-name.patch [new file with mode: 0644]
queue-4.9/mmc-rtsx-add-74-clocks-in-power-on-flow.patch [new file with mode: 0644]
queue-4.9/series

diff --git a/queue-4.9/bluetooth-fix-the-creation-of-hdev-name.patch b/queue-4.9/bluetooth-fix-the-creation-of-hdev-name.patch
new file mode 100644 (file)
index 0000000..ea8f428
--- /dev/null
@@ -0,0 +1,65 @@
+From 103a2f3255a95991252f8f13375c3a96a75011cd Mon Sep 17 00:00:00 2001
+From: Itay Iellin <ieitayie@gmail.com>
+Date: Sat, 7 May 2022 08:32:48 -0400
+Subject: Bluetooth: Fix the creation of hdev->name
+
+From: Itay Iellin <ieitayie@gmail.com>
+
+commit 103a2f3255a95991252f8f13375c3a96a75011cd upstream.
+
+Set a size limit of 8 bytes of the written buffer to "hdev->name"
+including the terminating null byte, as the size of "hdev->name" is 8
+bytes. If an id value which is greater than 9999 is allocated,
+then the "snprintf(hdev->name, sizeof(hdev->name), "hci%d", id)"
+function call would lead to a truncation of the id value in decimal
+notation.
+
+Set an explicit maximum id parameter in the id allocation function call.
+The id allocation function defines the maximum allocated id value as the
+maximum id parameter value minus one. Therefore, HCI_MAX_ID is defined
+as 10000.
+
+Signed-off-by: Itay Iellin <ieitayie@gmail.com>
+Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ include/net/bluetooth/hci_core.h |    3 +++
+ net/bluetooth/hci_core.c         |    6 +++---
+ 2 files changed, 6 insertions(+), 3 deletions(-)
+
+--- a/include/net/bluetooth/hci_core.h
++++ b/include/net/bluetooth/hci_core.h
+@@ -32,6 +32,9 @@
+ /* HCI priority */
+ #define HCI_PRIO_MAX  7
++/* HCI maximum id value */
++#define HCI_MAX_ID 10000
++
+ /* HCI Core structures */
+ struct inquiry_data {
+       bdaddr_t        bdaddr;
+--- a/net/bluetooth/hci_core.c
++++ b/net/bluetooth/hci_core.c
+@@ -3064,10 +3064,10 @@ int hci_register_dev(struct hci_dev *hde
+        */
+       switch (hdev->dev_type) {
+       case HCI_PRIMARY:
+-              id = ida_simple_get(&hci_index_ida, 0, 0, GFP_KERNEL);
++              id = ida_simple_get(&hci_index_ida, 0, HCI_MAX_ID, GFP_KERNEL);
+               break;
+       case HCI_AMP:
+-              id = ida_simple_get(&hci_index_ida, 1, 0, GFP_KERNEL);
++              id = ida_simple_get(&hci_index_ida, 1, HCI_MAX_ID, GFP_KERNEL);
+               break;
+       default:
+               return -EINVAL;
+@@ -3076,7 +3076,7 @@ int hci_register_dev(struct hci_dev *hde
+       if (id < 0)
+               return id;
+-      sprintf(hdev->name, "hci%d", id);
++      snprintf(hdev->name, sizeof(hdev->name), "hci%d", id);
+       hdev->id = id;
+       BT_DBG("%p name %s bus %d", hdev, hdev->name, hdev->bus);
diff --git a/queue-4.9/mmc-rtsx-add-74-clocks-in-power-on-flow.patch b/queue-4.9/mmc-rtsx-add-74-clocks-in-power-on-flow.patch
new file mode 100644 (file)
index 0000000..734b948
--- /dev/null
@@ -0,0 +1,112 @@
+From 1f311c94aabdb419c28e3147bcc8ab89269f1a7e Mon Sep 17 00:00:00 2001
+From: Ricky WU <ricky_wu@realtek.com>
+Date: Wed, 2 Mar 2022 09:43:01 +0000
+Subject: mmc: rtsx: add 74 Clocks in power on flow
+
+From: Ricky WU <ricky_wu@realtek.com>
+
+commit 1f311c94aabdb419c28e3147bcc8ab89269f1a7e upstream.
+
+SD spec definition:
+"Host provides at least 74 Clocks before issuing first command"
+After 1ms for the voltage stable then start issuing the Clock signals
+
+if POWER STATE is
+MMC_POWER_OFF to MMC_POWER_UP to issue Clock signal to card
+MMC_POWER_UP to MMC_POWER_ON to stop issuing signal to card
+
+Signed-off-by: Ricky Wu <ricky_wu@realtek.com>
+Link: https://lore.kernel.org/r/1badf10aba764191a1a752edcbf90389@realtek.com
+Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
+Signed-off-by: Ricky Wu <ricky_wu@realtek.com>
+Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
+Signed-off-by: Christian Loehle <cloehle@hyperstone.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/mmc/host/rtsx_pci_sdmmc.c |   30 ++++++++++++++++++++----------
+ 1 file changed, 20 insertions(+), 10 deletions(-)
+
+--- a/drivers/mmc/host/rtsx_pci_sdmmc.c
++++ b/drivers/mmc/host/rtsx_pci_sdmmc.c
+@@ -49,10 +49,7 @@ struct realtek_pci_sdmmc {
+       bool                    double_clk;
+       bool                    eject;
+       bool                    initial_mode;
+-      int                     power_state;
+-#define SDMMC_POWER_ON                1
+-#define SDMMC_POWER_OFF               0
+-
++      int                     prev_power_state;
+       int                     sg_count;
+       s32                     cookie;
+       int                     cookie_sg_count;
+@@ -914,14 +911,21 @@ static int sd_set_bus_width(struct realt
+       return err;
+ }
+-static int sd_power_on(struct realtek_pci_sdmmc *host)
++static int sd_power_on(struct realtek_pci_sdmmc *host, unsigned char power_mode)
+ {
+       struct rtsx_pcr *pcr = host->pcr;
+       int err;
+-      if (host->power_state == SDMMC_POWER_ON)
++      if (host->prev_power_state == MMC_POWER_ON)
+               return 0;
++      if (host->prev_power_state == MMC_POWER_UP) {
++              rtsx_pci_write_register(pcr, SD_BUS_STAT, SD_CLK_TOGGLE_EN, 0);
++              goto finish;
++      }
++
++      msleep(100);
++
+       rtsx_pci_init_cmd(pcr);
+       rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, CARD_SELECT, 0x07, SD_MOD_SEL);
+       rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, CARD_SHARE_MODE,
+@@ -940,11 +944,17 @@ static int sd_power_on(struct realtek_pc
+       if (err < 0)
+               return err;
++      mdelay(1);
++
+       err = rtsx_pci_write_register(pcr, CARD_OE, SD_OUTPUT_EN, SD_OUTPUT_EN);
+       if (err < 0)
+               return err;
+-      host->power_state = SDMMC_POWER_ON;
++      /* send at least 74 clocks */
++      rtsx_pci_write_register(pcr, SD_BUS_STAT, SD_CLK_TOGGLE_EN, SD_CLK_TOGGLE_EN);
++
++finish:
++      host->prev_power_state = power_mode;
+       return 0;
+ }
+@@ -953,7 +963,7 @@ static int sd_power_off(struct realtek_p
+       struct rtsx_pcr *pcr = host->pcr;
+       int err;
+-      host->power_state = SDMMC_POWER_OFF;
++      host->prev_power_state = MMC_POWER_OFF;
+       rtsx_pci_init_cmd(pcr);
+@@ -979,7 +989,7 @@ static int sd_set_power_mode(struct real
+       if (power_mode == MMC_POWER_OFF)
+               err = sd_power_off(host);
+       else
+-              err = sd_power_on(host);
++              err = sd_power_on(host, power_mode);
+       return err;
+ }
+@@ -1417,7 +1427,7 @@ static int rtsx_pci_sdmmc_drv_probe(stru
+       host->mmc = mmc;
+       host->pdev = pdev;
+       host->cookie = -1;
+-      host->power_state = SDMMC_POWER_OFF;
++      host->prev_power_state = MMC_POWER_OFF;
+       INIT_WORK(&host->work, sd_request);
+       platform_set_drvdata(pdev, host);
+       pcr->slots[RTSX_SD_CARD].p_dev = pdev;
index 6b0f684d67186a1dea17494ba0ada2f1648b57ce..299b200b5aaddce1efb707c2b2c3572e5753b8b8 100644 (file)
@@ -2,3 +2,5 @@ mips-use-address-of-operator-on-section-symbols.patch
 block-drbd-drbd_nl-make-conversion-to-enum-drbd_ret_code-explicit.patch
 can-grcan-grcan_probe-fix-broken-system-id-check-for-errata-workaround-needs.patch
 can-grcan-only-use-the-napi-poll-budget-for-rx.patch
+bluetooth-fix-the-creation-of-hdev-name.patch
+mmc-rtsx-add-74-clocks-in-power-on-flow.patch