--- /dev/null
+From 8ad8e02c2fa70cfddc1ded53ba9001c9d444075d Mon Sep 17 00:00:00 2001
+From: Jan Kaisrlik <ja.kaisrlik@gmail.com>
+Date: Tue, 20 Aug 2019 13:42:29 +0200
+Subject: Revert "mmc: core: do not retry CMD6 in __mmc_switch()"
+
+From: Jan Kaisrlik <ja.kaisrlik@gmail.com>
+
+commit 8ad8e02c2fa70cfddc1ded53ba9001c9d444075d upstream.
+
+Turns out the commit 3a0681c7448b ("mmc: core: do not retry CMD6 in
+__mmc_switch()") breaks initialization of a Toshiba THGBMNG5 eMMC card,
+when using the meson-gx-mmc.c driver on a custom board based on Amlogic
+A113D.
+
+The CMD6 that switches the card into HS200 mode is then one that fails and
+according to the below printed messages from the log:
+
+[ 1.648951] mmc0: mmc_select_hs200 failed, error -84
+[ 1.648988] mmc0: error -84 whilst initialising MMC card
+
+After some analyze, it turns out that adding a delay of ~5ms inside
+mmc_select_bus_width() but after mmc_compare_ext_csds() has been executed,
+also fixes the problem. Adding yet some more debug code, trying to figure
+out if potentially the card could be in a busy state, both by using CMD13
+and ->card_busy() ops concluded that this was not the case.
+
+Therefore, let's simply revert the commit that dropped support for retrying
+of CMD6, as this also fixes the problem.
+
+Fixes: 3a0681c7448b ("mmc: core: do not retry CMD6 in __mmc_switch()")
+Cc: stable@vger.kernel.org
+Signed-off-by: Jan Kaisrlik <ja.kaisrlik@gmail.com>
+Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/mmc/core/mmc_ops.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/mmc/core/mmc_ops.c
++++ b/drivers/mmc/core/mmc_ops.c
+@@ -564,7 +564,7 @@ int __mmc_switch(struct mmc_card *card,
+ if (index == EXT_CSD_SANITIZE_START)
+ cmd.sanitize_busy = true;
+
+- err = mmc_wait_for_cmd(host, &cmd, 0);
++ err = mmc_wait_for_cmd(host, &cmd, MMC_CMD_RETRIES);
+ if (err)
+ goto out;
+
--- /dev/null
+From 29d9a0b50736768f042752070e5cdf4e4d4c00df Mon Sep 17 00:00:00 2001
+From: "John S. Gruber" <JohnSGruber@gmail.com>
+Date: Mon, 2 Sep 2019 00:00:54 +0200
+Subject: x86/boot: Preserve boot_params.secure_boot from sanitizing
+
+From: John S. Gruber <JohnSGruber@gmail.com>
+
+commit 29d9a0b50736768f042752070e5cdf4e4d4c00df upstream.
+
+Commit
+
+ a90118c445cc ("x86/boot: Save fields explicitly, zero out everything else")
+
+now zeroes the secure boot setting information (enabled/disabled/...)
+passed by the boot loader or by the kernel's EFI handover mechanism.
+
+The problem manifests itself with signed kernels using the EFI handoff
+protocol with grub and the kernel loses the information whether secure
+boot is enabled in the firmware, i.e., the log message "Secure boot
+enabled" becomes "Secure boot could not be determined".
+
+efi_main() arch/x86/boot/compressed/eboot.c sets this field early but it
+is subsequently zeroed by the above referenced commit.
+
+Include boot_params.secure_boot in the preserve field list.
+
+ [ bp: restructure commit message and massage. ]
+
+Fixes: a90118c445cc ("x86/boot: Save fields explicitly, zero out everything else")
+Signed-off-by: John S. Gruber <JohnSGruber@gmail.com>
+Signed-off-by: Borislav Petkov <bp@suse.de>
+Reviewed-by: John Hubbard <jhubbard@nvidia.com>
+Cc: "H. Peter Anvin" <hpa@zytor.com>
+Cc: Ingo Molnar <mingo@redhat.com>
+Cc: Juergen Gross <jgross@suse.com>
+Cc: Mark Brown <broonie@kernel.org>
+Cc: stable <stable@vger.kernel.org>
+Cc: Thomas Gleixner <tglx@linutronix.de>
+Cc: x86-ml <x86@kernel.org>
+Link: https://lkml.kernel.org/r/CAPotdmSPExAuQcy9iAHqX3js_fc4mMLQOTr5RBGvizyCOPcTQQ@mail.gmail.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/x86/include/asm/bootparam_utils.h | 1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/arch/x86/include/asm/bootparam_utils.h
++++ b/arch/x86/include/asm/bootparam_utils.h
+@@ -70,6 +70,7 @@ static void sanitize_boot_params(struct
+ BOOT_PARAM_PRESERVE(eddbuf_entries),
+ BOOT_PARAM_PRESERVE(edd_mbr_sig_buf_entries),
+ BOOT_PARAM_PRESERVE(edd_mbr_sig_buffer),
++ BOOT_PARAM_PRESERVE(secure_boot),
+ BOOT_PARAM_PRESERVE(hdr),
+ BOOT_PARAM_PRESERVE(e820_table),
+ BOOT_PARAM_PRESERVE(eddbuf),