--- /dev/null
+From 10becdb402af4fd4808a0491a726b96128c41076 Mon Sep 17 00:00:00 2001
+From: Marek Vasut <marex@denx.de>
+Date: Mon, 25 Nov 2013 09:47:00 +0100
+Subject: ahci: imx: Explicitly clear IMX6Q_GPR13_SATA_MPLL_CLK_EN
+
+From: Marek Vasut <marex@denx.de>
+
+commit 10becdb402af4fd4808a0491a726b96128c41076 upstream.
+
+We must clear this IMX6Q_GPR13_SATA_MPLL_CLK_EN bit on i.MX6Q, otherwise
+Linux will fail to find the attached drive on some boards.
+
+This entire fix was:
+Reported-by: Eric Nelson <eric.nelson@boundarydevices.com>
+
+Signed-off-by: Marek Vasut <marex@denx.de>
+Reviewed-by: Shawn Guo <shawn.guo@linaro.org>
+Cc: Richard Zhu <r65037@freescale.com>
+Cc: Linux-IDE <linux-ide@vger.kernel.org>
+Signed-off-by: Tejun Heo <tj@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/ata/ahci_imx.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+--- a/drivers/ata/ahci_imx.c
++++ b/drivers/ata/ahci_imx.c
+@@ -60,7 +60,7 @@ static int imx6q_sata_init(struct device
+ /*
+ * set PHY Paremeters, two steps to configure the GPR13,
+ * one write for rest of parameters, mask of first write
+- * is 0x07fffffd, and the other one write for setting
++ * is 0x07ffffff, and the other one write for setting
+ * the mpll_clk_en.
+ */
+ regmap_update_bits(imxpriv->gpr, 0x34, IMX6Q_GPR13_SATA_RX_EQ_VAL_MASK
+@@ -71,6 +71,7 @@ static int imx6q_sata_init(struct device
+ | IMX6Q_GPR13_SATA_TX_ATTEN_MASK
+ | IMX6Q_GPR13_SATA_TX_BOOST_MASK
+ | IMX6Q_GPR13_SATA_TX_LVL_MASK
++ | IMX6Q_GPR13_SATA_MPLL_CLK_EN
+ | IMX6Q_GPR13_SATA_TX_EDGE_RATE
+ , IMX6Q_GPR13_SATA_RX_EQ_VAL_3_0_DB
+ | IMX6Q_GPR13_SATA_RX_LOS_LVL_SATA2M
--- /dev/null
+From 87809942d3fa60bafb7a58d0bdb1c79e90a6821d Mon Sep 17 00:00:00 2001
+From: Michele Baldessari <michele@acksyn.org>
+Date: Mon, 25 Nov 2013 19:00:14 +0000
+Subject: libata: add ATA_HORKAGE_BROKEN_FPDMA_AA quirk for Seagate Momentus SpinPoint M8
+
+From: Michele Baldessari <michele@acksyn.org>
+
+commit 87809942d3fa60bafb7a58d0bdb1c79e90a6821d upstream.
+
+We've received multiple reports in Fedora via (BZ 907193)
+that the Seagate Momentus SpinPoint M8 errors out when enabling AA:
+[ 2.555905] ata2.00: failed to enable AA (error_mask=0x1)
+[ 2.568482] ata2.00: failed to enable AA (error_mask=0x1)
+
+Add the ATA_HORKAGE_BROKEN_FPDMA_AA for this specific harddisk.
+
+Reported-by: Nicholas <arealityfarbetween@googlemail.com>
+Signed-off-by: Michele Baldessari <michele@acksyn.org>
+Tested-by: Nicholas <arealityfarbetween@googlemail.com>
+Acked-by: Alan Cox <gnomes@lxorguk.ukuu.org.uk>
+Signed-off-by: Tejun Heo <tj@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/ata/libata-core.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+--- a/drivers/ata/libata-core.c
++++ b/drivers/ata/libata-core.c
+@@ -4156,6 +4156,9 @@ static const struct ata_blacklist_entry
+ { "ST3320[68]13AS", "SD1[5-9]", ATA_HORKAGE_NONCQ |
+ ATA_HORKAGE_FIRMWARE_WARN },
+
++ /* Seagate Momentus SpinPoint M8 seem to have FPMDA_AA issues */
++ { "ST1000LM024 HN-M101MBB", "2AR10001", ATA_HORKAGE_BROKEN_FPDMA_AA },
++
+ /* Blacklist entries taken from Silicon Image 3124/3132
+ Windows driver .inf file - also several Linux problem reports */
+ { "HTS541060G9SA00", "MB3OC60D", ATA_HORKAGE_NONCQ, },
--- /dev/null
+From b8bd6dc36186fe99afa7b73e9e2d9a98ad5c4865 Mon Sep 17 00:00:00 2001
+From: "Robin H. Johnson" <robbat2@gentoo.org>
+Date: Mon, 16 Dec 2013 09:31:19 -0800
+Subject: libata: disable a disk via libata.force params
+
+From: "Robin H. Johnson" <robbat2@gentoo.org>
+
+commit b8bd6dc36186fe99afa7b73e9e2d9a98ad5c4865 upstream.
+
+A user on StackExchange had a failing SSD that's soldered directly
+onto the motherboard of his system. The BIOS does not give any option
+to disable it at all, so he can't just hide it from the OS via the
+BIOS.
+
+The old IDE layer had hdX=noprobe override for situations like this,
+but that was never ported to the libata layer.
+
+This patch implements a disable flag for libata.force.
+
+Example use:
+
+ libata.force=2.0:disable
+
+[v2 of the patch, removed the nodisable flag per Tejun Heo]
+
+Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
+Signed-off-by: Tejun Heo <tj@kernel.org>
+Link: http://unix.stackexchange.com/questions/102648/how-to-tell-linux-kernel-3-0-to-completely-ignore-a-failing-disk
+Link: http://askubuntu.com/questions/352836/how-can-i-tell-linux-kernel-to-completely-ignore-a-disk-as-if-it-was-not-even-co
+Link: http://superuser.com/questions/599333/how-to-disable-kernel-probing-for-drive
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ Documentation/kernel-parameters.txt | 2 ++
+ drivers/ata/libata-core.c | 1 +
+ 2 files changed, 3 insertions(+)
+
+--- a/Documentation/kernel-parameters.txt
++++ b/Documentation/kernel-parameters.txt
+@@ -1515,6 +1515,8 @@ bytes respectively. Such letter suffixes
+
+ * atapi_dmadir: Enable ATAPI DMADIR bridge support
+
++ * disable: Disable this device.
++
+ If there are multiple matching configurations changing
+ the same attribute, the last one is used.
+
+--- a/drivers/ata/libata-core.c
++++ b/drivers/ata/libata-core.c
+@@ -6523,6 +6523,7 @@ static int __init ata_parse_force_one(ch
+ { "norst", .lflags = ATA_LFLAG_NO_HRST | ATA_LFLAG_NO_SRST },
+ { "rstonce", .lflags = ATA_LFLAG_RST_ONCE },
+ { "atapi_dmadir", .horkage_on = ATA_HORKAGE_ATAPI_DMADIR },
++ { "disable", .horkage_on = ATA_HORKAGE_DISABLE },
+ };
+ char *start = *cur, *p = *cur;
+ char *id, *val, *endp;
--- /dev/null
+From 85fbd722ad0f5d64d1ad15888cd1eb2188bfb557 Mon Sep 17 00:00:00 2001
+From: Tejun Heo <tj@kernel.org>
+Date: Wed, 18 Dec 2013 07:07:32 -0500
+Subject: libata, freezer: avoid block device removal while system is frozen
+
+From: Tejun Heo <tj@kernel.org>
+
+commit 85fbd722ad0f5d64d1ad15888cd1eb2188bfb557 upstream.
+
+Freezable kthreads and workqueues are fundamentally problematic in
+that they effectively introduce a big kernel lock widely used in the
+kernel and have already been the culprit of several deadlock
+scenarios. This is the latest occurrence.
+
+During resume, libata rescans all the ports and revalidates all
+pre-existing devices. If it determines that a device has gone
+missing, the device is removed from the system which involves
+invalidating block device and flushing bdi while holding driver core
+layer locks. Unfortunately, this can race with the rest of device
+resume. Because freezable kthreads and workqueues are thawed after
+device resume is complete and block device removal depends on
+freezable workqueues and kthreads (e.g. bdi_wq, jbd2) to make
+progress, this can lead to deadlock - block device removal can't
+proceed because kthreads are frozen and kthreads can't be thawed
+because device resume is blocked behind block device removal.
+
+839a8e8660b6 ("writeback: replace custom worker pool implementation
+with unbound workqueue") made this particular deadlock scenario more
+visible but the underlying problem has always been there - the
+original forker task and jbd2 are freezable too. In fact, this is
+highly likely just one of many possible deadlock scenarios given that
+freezer behaves as a big kernel lock and we don't have any debug
+mechanism around it.
+
+I believe the right thing to do is getting rid of freezable kthreads
+and workqueues. This is something fundamentally broken. For now,
+implement a funny workaround in libata - just avoid doing block device
+hot[un]plug while the system is frozen. Kernel engineering at its
+finest. :(
+
+v2: Add EXPORT_SYMBOL_GPL(pm_freezing) for cases where libata is built
+ as a module.
+
+v3: Comment updated and polling interval changed to 10ms as suggested
+ by Rafael.
+
+v4: Add #ifdef CONFIG_FREEZER around the hack as pm_freezing is not
+ defined when FREEZER is not configured thus breaking build.
+ Reported by kbuild test robot.
+
+Signed-off-by: Tejun Heo <tj@kernel.org>
+Reported-by: Tomaž Šolc <tomaz.solc@tablix.org>
+Reviewed-by: "Rafael J. Wysocki" <rjw@rjwysocki.net>
+Link: https://bugzilla.kernel.org/show_bug.cgi?id=62801
+Link: http://lkml.kernel.org/r/20131213174932.GA27070@htj.dyndns.org
+Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Cc: Len Brown <len.brown@intel.com>
+Cc: Oleg Nesterov <oleg@redhat.com>
+Cc: kbuild test robot <fengguang.wu@intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/ata/libata-scsi.c | 21 +++++++++++++++++++++
+ kernel/freezer.c | 6 ++++++
+ 2 files changed, 27 insertions(+)
+
+--- a/drivers/ata/libata-scsi.c
++++ b/drivers/ata/libata-scsi.c
+@@ -3872,6 +3872,27 @@ void ata_scsi_hotplug(struct work_struct
+ return;
+ }
+
++ /*
++ * XXX - UGLY HACK
++ *
++ * The block layer suspend/resume path is fundamentally broken due
++ * to freezable kthreads and workqueue and may deadlock if a block
++ * device gets removed while resume is in progress. I don't know
++ * what the solution is short of removing freezable kthreads and
++ * workqueues altogether.
++ *
++ * The following is an ugly hack to avoid kicking off device
++ * removal while freezer is active. This is a joke but does avoid
++ * this particular deadlock scenario.
++ *
++ * https://bugzilla.kernel.org/show_bug.cgi?id=62801
++ * http://marc.info/?l=linux-kernel&m=138695698516487
++ */
++#ifdef CONFIG_FREEZER
++ while (pm_freezing)
++ msleep(10);
++#endif
++
+ DPRINTK("ENTER\n");
+ mutex_lock(&ap->scsi_scan_mutex);
+
+--- a/kernel/freezer.c
++++ b/kernel/freezer.c
+@@ -19,6 +19,12 @@ EXPORT_SYMBOL(system_freezing_cnt);
+ bool pm_freezing;
+ bool pm_nosig_freezing;
+
++/*
++ * Temporary export for the deadlock workaround in ata_scsi_hotplug().
++ * Remove once the hack becomes unnecessary.
++ */
++EXPORT_SYMBOL_GPL(pm_freezing);
++
+ /* protects freezing and frozen transitions */
+ static DEFINE_SPINLOCK(freezer_lock);
+
--- /dev/null
+From f78dea064c5f7de07de4912a6e5136dbc443d614 Mon Sep 17 00:00:00 2001
+From: Marc Carino <marc.ceeeee@gmail.com>
+Date: Mon, 16 Dec 2013 18:15:53 -0800
+Subject: libata: implement ATA_HORKAGE_NO_NCQ_TRIM and apply it to Micro M500 SSDs
+
+From: Marc Carino <marc.ceeeee@gmail.com>
+
+commit f78dea064c5f7de07de4912a6e5136dbc443d614 upstream.
+
+Certain drives cannot handle queued TRIM commands properly, even
+though support is indicated in the IDENTIFY DEVICE buffer. This patch
+allows for disabling the commands for the affected drives and apply it
+to the Micron/Crucial M500 SSDs which exhibit incorrect protocol
+behavior when issued queued TRIM commands, which could lead to silent
+data corruption.
+
+tj: Merged two unnecessarily split patches and made minor edits
+ including shortening horkage name.
+
+Signed-off-by: Marc Carino <marc.ceeeee@gmail.com>
+Signed-off-by: Tejun Heo <tj@kernel.org>
+Link: http://lkml.kernel.org/g/1387246554-7311-1-git-send-email-marc.ceeeee@gmail.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/ata/libata-core.c | 15 +++++++++++++--
+ include/linux/libata.h | 1 +
+ 2 files changed, 14 insertions(+), 2 deletions(-)
+
+--- a/drivers/ata/libata-core.c
++++ b/drivers/ata/libata-core.c
+@@ -2149,9 +2149,16 @@ static int ata_dev_config_ncq(struct ata
+ "failed to get NCQ Send/Recv Log Emask 0x%x\n",
+ err_mask);
+ } else {
++ u8 *cmds = dev->ncq_send_recv_cmds;
++
+ dev->flags |= ATA_DFLAG_NCQ_SEND_RECV;
+- memcpy(dev->ncq_send_recv_cmds, ap->sector_buf,
+- ATA_LOG_NCQ_SEND_RECV_SIZE);
++ memcpy(cmds, ap->sector_buf, ATA_LOG_NCQ_SEND_RECV_SIZE);
++
++ if (dev->horkage & ATA_HORKAGE_NO_NCQ_TRIM) {
++ ata_dev_dbg(dev, "disabling queued TRIM support\n");
++ cmds[ATA_LOG_NCQ_SEND_RECV_DSM_OFFSET] &=
++ ~ATA_LOG_NCQ_SEND_RECV_DSM_TRIM;
++ }
+ }
+ }
+
+@@ -4205,6 +4212,10 @@ static const struct ata_blacklist_entry
+ { "PIONEER DVD-RW DVR-212D", NULL, ATA_HORKAGE_NOSETXFER },
+ { "PIONEER DVD-RW DVR-216D", NULL, ATA_HORKAGE_NOSETXFER },
+
++ /* devices that don't properly handle queued TRIM commands */
++ { "Micron_M500*", NULL, ATA_HORKAGE_NO_NCQ_TRIM, },
++ { "Crucial_CT???M500SSD1", NULL, ATA_HORKAGE_NO_NCQ_TRIM, },
++
+ /* End Marker */
+ { }
+ };
+--- a/include/linux/libata.h
++++ b/include/linux/libata.h
+@@ -418,6 +418,7 @@ enum {
+ ATA_HORKAGE_DUMP_ID = (1 << 16), /* dump IDENTIFY data */
+ ATA_HORKAGE_MAX_SEC_LBA48 = (1 << 17), /* Set max sects to 65535 */
+ ATA_HORKAGE_ATAPI_DMADIR = (1 << 18), /* device requires dmadir */
++ ATA_HORKAGE_NO_NCQ_TRIM = (1 << 19), /* don't use queued TRIM */
+
+ /* DMA mask for user DMA control: User visible values; DO NOT
+ renumber */
cpupower-fix-segfault-due-to-incorrect-getopt_long-arugments.patch
power_supply-fix-oops-from-null-pointer-dereference-from-wakeup_source_activate.patch
drm-nouveau-only-runtime-suspend-by-default-in-optimus-configuration.patch
+ahci-imx-explicitly-clear-imx6q_gpr13_sata_mpll_clk_en.patch
+libata-add-ata_horkage_broken_fpdma_aa-quirk-for-seagate-momentus-spinpoint-m8.patch
+libata-disable-a-disk-via-libata.force-params.patch
+libata-implement-ata_horkage_no_ncq_trim-and-apply-it-to-micro-m500-ssds.patch
+libata-freezer-avoid-block-device-removal-while-system-is-frozen.patch