]> git.karo-electronics.de Git - karo-tx-linux.git/log
karo-tx-linux.git
9 years agoENGR00319455-1 can: m_can: add Bosch M_CAN controller support
Dong Aisheng [Thu, 19 Jun 2014 10:49:37 +0000 (18:49 +0800)]
ENGR00319455-1 can: m_can: add Bosch M_CAN controller support

The patch adds the basic CAN TX/RX function support for Bosch M_CAN controller.
For TX, only one dedicated tx buffer is used for sending data.
For RX, RXFIFO 0 is used for receiving data to avoid overflow.
Rx FIFO 1 and Rx Buffers are not used currently, as well as Tx Event FIFO.

Due to the message ram can be shared by multi m_can instances
and the fifo element is configurable which is SoC dependant,
the design is to parse the message ram related configuration data from device
tree rather than hardcode define it in driver which can make the message
ram using fully transparently to M_CAN controller driver,
then we can gain better driver maintainability and future features upgrade.

M_CAN also supports CANFD protocol features like data payload up to 64 bytes
and bitrate switch at runtime, however, this patch still does not add the
support for these features.

Signed-off-by: Dong Aisheng <b29396@freescale.com>
(cherry picked from commit a0dd1cb47d5792902eb380b70af292b4ba64d4b0)

9 years agoENGR00302227-8 dts: imx6sx-sdb: add flexcan support
Dong Aisheng [Thu, 6 Mar 2014 11:12:16 +0000 (19:12 +0800)]
ENGR00302227-8 dts: imx6sx-sdb: add flexcan support

Add flexcan support

Signed-off-by: Dong Aisheng <b29396@freescale.com>
(cherry picked from commit 88a15283025250835ca757f5ad61d2a78ca0dbd6)

9 years agoENGR00300439-6 dts: imx6sx: add flexcan stop mode support
Dong Aisheng [Mon, 24 Feb 2014 06:35:52 +0000 (14:35 +0800)]
ENGR00300439-6 dts: imx6sx: add flexcan stop mode support

Add flexcan stop mode support.
The driver does not use alias id now, so remove it too.

Signed-off-by: Dong Aisheng <b29396@freescale.com>
(cherry picked from commit 36ddf7fd96c5d05922f2241d38b0fe7305fdde02)

9 years agoENGR00300439-5 can: flexcan: parse stop mode control bits from device tree
Dong Aisheng [Mon, 24 Feb 2014 06:25:12 +0000 (14:25 +0800)]
ENGR00300439-5 can: flexcan: parse stop mode control bits from device tree

Starting from IMX6, the flexcan stop mode control bits is SoC specific,
move it out of IP driver and parse it from devicetree.
It's good from maintain perspective and can avoid adding too many SoC
specifi bits in driver but with no IP changes when the IMX SoC series
keep growing.

Signed-off-by: Dong Aisheng <b29396@freescale.com>
(cherry picked from commit 97b99b59c9f09d58ea35f3c0cf58665c20f2e292)

9 years agoENGR00300439-3 imx6sx: use auxdata for can transceiver setting
Dong Aisheng [Thu, 20 Feb 2014 08:48:05 +0000 (16:48 +0800)]
ENGR00300439-3 imx6sx: use auxdata for can transceiver setting

We still do not have a framework for can tranceiver settings.
Use audxdata as workaround as before.

Signed-off-by: Dong Aisheng <b29396@freescale.com>
(cherry picked from commit a6e475caedb096c631f853b33e7787f2f7caff17)

9 years agoENGR00258885 flexcan: fix errata ERR005829 that MB may fail to be sent
Dong Aisheng [Fri, 12 Apr 2013 10:49:36 +0000 (18:49 +0800)]
ENGR00258885 flexcan: fix errata ERR005829 that MB may fail to be sent

This is an issue from IC errata ERR005829 which is described as follows:
----------------------------------------------------------
FlexCAN does not transmit a message that is enabled to be transmitted
in a specific moment during the arbitration process. The following
conditions are necessary to have the issue.
- Only one MB is configured to be transmitted
- The write which enables the MB to be transmitted (write on Control status
  word) happens during a specific clock during the arbitration process.

After this arbitration process occurs, the bus goes to Idle state and no
new message is received on bus.

For example:
1) MB13 is deactivated on RxIntermission (write 0x0 on CODE field from Control
Status word) - First write on CODE
2) Reconfigure the ID and data fields
3) Enable the MB13 to be transmitted on BusIdle (write 0xC on Code
field) - Second write on code
4) CAN bus keeps in Idle state
5) No write on Control status from any MB happens.
During the second write on code (step 3), the write must happen one clock
before the current MB13 is to be scanned by arbitration process.
In this case, it does not detect the new code (0xC) and no new arbitration is
scheduled.

The suggested workaround which is implemented in this patch is:
The workaround consists of executing two extra steps:
6. Reserve the first valid mailbox as an inactive mailbox (CODE=0b1000).
If RX FIFO is disabled, this mailbox must be MB0. Otherwise, the first
valid mailbox can be found by using table "RX FIFO filters" on FlexCAN3 chapter.
7. Write twice INACTIVE code (0b1000) into the first valid mailbox.
Note: The first mailbox cannot be used for reception or transmission process.
-------------------------------------------------------------

Note: Although the currently flexcan driver does not have the step 1 to run,
it's also possible to meet this issue in theory because we can not predict
when the arbitration is scheduled.

With a modified can-utils/canfdttest tool simulating Pingpong test, we were
able to reproduce this issue after running a about one day.
After applying this patch, we ran six days and did not see the issue happen
again on two mx6q sabrelite boards.

Note: with a few minors change for new kernel and change errata id from
ERR005641 to ERR005829 which is the open one in freescale website.

Signed-off-by: Dong Aisheng <b29396@freescale.com>
(cherry picked from commit 872eb1691afb83a2760052c615ed410a7cfe71e0)
(cherry picked from commit 937d3353916eb589319e4567a3667b8ada5ca434)

9 years agoENGR00286724-11 imx_v7_defconfig: add flexcan support
Dong Aisheng [Thu, 7 Nov 2013 08:10:06 +0000 (16:10 +0800)]
ENGR00286724-11 imx_v7_defconfig: add flexcan support

Add flexcan support.

Signed-off-by: Dong Aisheng <b29396@freescale.com>
(cherry picked from commit 51e5917b44ca44112ef744c137f260d804ed131f)

9 years agoENGR00286724-10 dts: sabreauto: add new dts for flexcan1 support
Dong Aisheng [Wed, 6 Nov 2013 11:37:38 +0000 (19:37 +0800)]
ENGR00286724-10 dts: sabreauto: add new dts for flexcan1 support

The flexcan1 is pin conflict with fec. So we add a new dts file with
flexcan1 enabled with fec disabled for user to use.

Signed-off-by: Dong Aisheng <b29396@freescale.com>
(cherry picked from commit ce7e34bdf46deb88fd8db718ffbad47507465fc8)

9 years agoENGR00286724-9 dts: imx6qdl: add properties for flexcan to support wakeup
Dong Aisheng [Wed, 6 Nov 2013 11:14:08 +0000 (19:14 +0800)]
ENGR00286724-9 dts: imx6qdl: add properties for flexcan to support wakeup

According to binding doc, add missed properties for remote wakeup
support.

Signed-off-by: Dong Aisheng <b29396@freescale.com>
(cherry picked from commit 359b5a26f40200e8a9ed642d22e97d301f1c9d5c)

9 years agoENGR00286724-8 can: flexcan: add self wakeup support
Dong Aisheng [Wed, 6 Nov 2013 11:10:28 +0000 (19:10 +0800)]
ENGR00286724-8 can: flexcan: add self wakeup support

If wakeup is enabled, enter stop mode, else enter disabled mode.
Self wake can only work on stop mode.
For imx6q, the stop request has to be mannually assert on
IOMUX GPR13[28:29] register, we use syscon to control that bit.

Signed-off-by: Dong Aisheng <b29396@freescale.com>
(cherry picked from commit 7f8ef8eeb2bd93d75eb4c970bcaabcfd499d348d)

9 years agoENGR00286724-7 ARM: dts: sabreauto: add flexcan support
Dong Aisheng [Wed, 6 Nov 2013 02:50:09 +0000 (10:50 +0800)]
ENGR00286724-7 ARM: dts: sabreauto: add flexcan support

The flexcan1 is disabled by default since it's conflict with fec.

Signed-off-by: Dong Aisheng <b29396@freescale.com>
(cherry picked from commit 0f6cfd8708633ee2f924aa509b30bb17b185f84e)

9 years agoENGR00286724-6 ARM: imx6q: use auxdata to pass flexcan_switch function hook
Dong Aisheng [Wed, 6 Nov 2013 02:46:35 +0000 (10:46 +0800)]
ENGR00286724-6 ARM: imx6q: use auxdata to pass flexcan_switch function hook

Before we have a common can tranceiver binding to handle gpios
operations, we use auxdata to pass flexcan_switch function first.

Signed-off-by: Dong Aisheng <b29396@freescale.com>
(cherry picked from commit 79b20183df2e075faedbe2b0f90651d2ab2c4c9c)

9 years agoENGR00286724-5 can: flexcan: add tranceiver gpios binding
Dong Aisheng [Mon, 10 Dec 2012 12:14:01 +0000 (20:14 +0800)]
ENGR00286724-5 can: flexcan: add tranceiver gpios binding

Add gpios for tranceiver control.

Before we have a common tranceiver binding, we use this way first.

Signed-off-by: Dong Aisheng <b29396@freescale.com>
(cherry picked from commit f50c22920fc26c6895afd3795dc1200235ca8cfd)

9 years agoENGR00286724-4 can: flexcan: add platform_data for transceiver_switch
Dong Aisheng [Wed, 10 Sep 2014 08:55:17 +0000 (16:55 +0800)]
ENGR00286724-4 can: flexcan: add platform_data for transceiver_switch

It's used for transceiver_switch.

NOTE: it's newly added since it's deleted by upstream before.
However, the driver is still using it, so have to add it.

Signed-off-by: Dong Aisheng <b29396@freescale.com>
9 years agoENGR00286724-3 ARM: dts: imx6q: change to generic name for flexcan
Dong Aisheng [Mon, 4 Nov 2013 09:22:43 +0000 (17:22 +0800)]
ENGR00286724-3 ARM: dts: imx6q: change to generic name for flexcan

As following the device tree naming rule, we change the device node
name to a more generic one and use phandle name specificly.

Signed-off-by: Dong Aisheng <b29396@freescale.com>
(cherry picked from commit 0b65c43167403b43bdc4c36b66ab592ce2d68c1a)

9 years agoata: libahci_platform: move port_map parameters into the AHCI structure
Antoine Ténart [Wed, 30 Jul 2014 18:13:56 +0000 (20:13 +0200)]
ata: libahci_platform: move port_map parameters into the AHCI structure

This patch moves force_port_map and mask_port_map into the
ahci_host_priv structure. This allows to modify them into the AHCI
framework. This is needed by the new dt bindings representing ports as
the port_map mask is computed automatically.

Parameters modifying force_port_map, mask_port_map and flags have been
removed from the ahci_platform_init_host() function, and inputs in the
ahci_host_priv structure are now directly filed.

Signed-off-by: Antoine Ténart <antoine.tenart@free-electrons.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
(cherry picked from commit 725c7b570fda4207e465ff8856c2c12c2645a685)

9 years agoahci: imx: add missing clk_disable_unprepare() on error in imx_sata_enable()
Wei Yongjun [Wed, 30 Jul 2014 00:54:07 +0000 (08:54 +0800)]
ahci: imx: add missing clk_disable_unprepare() on error in imx_sata_enable()

Add the missing clk_disable_unprepare() before return from
imx_sata_enable() in the phy reset error handling case.

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Acked-by: Shawn Guo <shawn.guo@freescale.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
(cherry picked from commit 19f5be0f40922717e2b6e39a9822e7e7f30fd81f)

9 years agoahci_xgene: Use correct OOB tunning parameters for APM X-Gene SoC AHCI SATA Host...
Suman Tripathi [Tue, 29 Jul 2014 06:54:51 +0000 (12:24 +0530)]
ahci_xgene: Use correct OOB tunning parameters for APM X-Gene SoC AHCI SATA Host controller driver.

APM X-Gene SoC AHCI SATA Host controller driver requires
some correction of Phy Control OOB timing for the
COMINIT/COMWAKE parameters to correctly interoperate with
different kinds of disks.

Signed-off-by: Loc Ho <lho@apm.com>
Signed-off-by: Suman Tripathi <stripathi@apm.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
(cherry picked from commit 0185b1b787962db38fdf74e1cab9b7a2619490a1)

9 years agoahci_xgene: Fix the watermark threshold for the APM X-Gene SATA host controller driver.
Suman Tripathi [Tue, 29 Jul 2014 06:54:49 +0000 (12:24 +0530)]
ahci_xgene: Fix the watermark threshold for the APM X-Gene SATA host controller driver.

As per SATA IO specification, when Host sends HOLD, the device takes
about 20DW latency to reply to HOLDA. In some case, device doesn't
response to HOLDA over 20DW and causes FIFO goes into over flow
condition. Due to this condition, device enumerations fails with
those devices. This patch adjust the watermark FIFO by increasing
the FIFO depth from 0x16(default) to 0x30 to address this issue.

Signed-off-by: Loc Ho <lho@apm.com>
Signed-off-by: Suman Tripathi <stripathi@apm.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
(cherry picked from commit aeae4dcac5a91de9546c42a3be09c96479bfc3ff)

9 years agoata: Add support for the Tegra124 SATA controller
Mikko Perttunen [Fri, 18 Jul 2014 07:12:30 +0000 (10:12 +0300)]
ata: Add support for the Tegra124 SATA controller

This adds support for the integrated AHCI-compliant Serial ATA
controller present on the NVIDIA Tegra124 system-on-chip.

Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
Acked-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
(cherry picked from commit ccfde50810ae916564765a2f8ee6d7163b025594)

9 years agoata: ahci_platform: Increase AHCI_MAX_CLKS to 4
Mikko Perttunen [Wed, 16 Jul 2014 08:54:21 +0000 (11:54 +0300)]
ata: ahci_platform: Increase AHCI_MAX_CLKS to 4

The Tegra124 SATA controller requires 4 clocks. Increase this constant
to be able to use them all.

Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
Acked-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
(cherry picked from commit 0e38699387fd2fd433618bb67612f3aae676fbae)

9 years agolibata: EH should handle AMNF error condition as a media error
Alexey Asemov [Tue, 15 Jul 2014 06:28:42 +0000 (10:28 +0400)]
libata: EH should handle AMNF error condition as a media error

libata-eh.c should handle AMNF error condition (error byte bit 0,
usually code 0x01) in libata-eh.c along with UNC as a media error so
SCSI stack can handle it properly (translation code 0x01 is already
present in libata-scsi.c) but was never passed down due to lack of
handling in EH.

While using linux-based machine (AMD 6550M-based notebook, PCI IDs for the
controller are 1022:7801 subsys 1025:059d) and ddrescue to salvage data
from failing hard drive (WD7500BPVT 2.5" 750G SATA2), I've found that pure
AMNF 0x01 error code generates generic "device error" that is retried
several times by SCSI stack instead of "media error" that is passed up to
software.

So we may assume deprecated AMNF error code is surely not dead yet, and
it's better for it to be handled properly. As we may see it is used by
modern enough devices, and used properly: drive returned AMNF only when IDs
for track cannot be read completely due to dying head or positioning,
otherwise it returned UNC(orrectables).

Not handling it causes wrong generic error code ("device error") reporting
down the stack, can damage failing drives further because of excessive
retries, and slows salvaging down a lot. Also, there is handling code in
libata-scsi.c for 0x01 AMNF error already.

https://bugzilla.kernel.org/show_bug.cgi?id=80031

tj: Shortened $SUBJ and moved its content to the first paragraph.

Signed-off-by: Alexey Asemov <alex@alex-at.ru>
Signed-off-by: Tejun Heo <tj@kernel.org>
(cherry picked from commit eec7e1c16d2b65e38137686dd9b7e102c2150905)

9 years agoahci_xgene: fix the dma state machine lockup for the IDENTIFY DEVICE PIO mode command.
Suman Tripathi [Mon, 7 Jul 2014 17:03:05 +0000 (22:33 +0530)]
ahci_xgene: fix the dma state machine lockup for the IDENTIFY DEVICE PIO mode command.

This patch fixes the dma state machine lockup due to the processing
of IDENTIFY DEVICE PIO mode command. The X-Gene AHCI controller
has an errata in which it cannot clear the BSY bit after the PIO setup
FIS. The dma state machine enters CMFatalErrorUpdate state and locks
up. This patch also removes the dma restart workaround from the read_id
function as the read_id function is only called by libata layer for
ATA_INTERNAL commands. But for some cases eg: PORT MULTIPLIER
and udev, the framework will enumerate using SCSI commands and it will
not call read_id function.

Signed-off-by: Loc Ho <lho@apm.com>
Signed-off-by: Suman Tripathi <stripathi@apm.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
(cherry picked from commit 2a0bdff6b958d1b2523d2754b6cd5e0ea4053016)

9 years agolibahci: export ahci_qc_issue() and ahci_start_fix_rx()
Suman Tripathi [Mon, 7 Jul 2014 17:03:04 +0000 (22:33 +0530)]
libahci: export ahci_qc_issue() and ahci_start_fix_rx()

The subsequent patch will make use of them.

Signed-off-by: Loc Ho <lho@apm.com>
Signed-off-by: Suman Tripathi <stripathi@apm.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
(cherry picked from commit 39e0ee9964b1245b79ec89f6b89d8ec4ef672524)

9 years agoata: ahci_imx: add disable for spread-spectrum
Russell King [Tue, 24 Jun 2014 10:19:47 +0000 (11:19 +0100)]
ata: ahci_imx: add disable for spread-spectrum

Spread-spectrum doesn't work with Cubox-i hardware, so we have to
disable this feature.  Add a DT property so that platforms can
indicate that this feature should not be enabled.

Having it as a negative property keeps existing DT files working.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Reviewed-by: Shawn Guo <shawn.guo@freescale.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
(cherry picked from commit a6e726244c78e04d0af754c625036be8f92a9afd)

9 years agoata: ahci_imx: allow hardware parameters to be specified in DT
Russell King [Tue, 24 Jun 2014 10:19:37 +0000 (11:19 +0100)]
ata: ahci_imx: allow hardware parameters to be specified in DT

Various SATA phy parameters are board specific, and therefore need to
be configured.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Reviewed-by: Shawn Guo <shawn.guo@freescale.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
(cherry picked from commit 29e69413666f085d9eb79b29ebfedb163e0e8ef2)

9 years agoata: pata_samsung_cf: removes s5pc100 related ata codes
Kukjin Kim [Mon, 30 Jun 2014 21:32:23 +0000 (06:32 +0900)]
ata: pata_samsung_cf: removes s5pc100 related ata codes

This patch removes support for s5pc100 ata because of no more support
S5PC100 SoC in mainline.

Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
(cherry picked from commit a1a6cc1d2ea9e3adf81faab87b834bc903856207)

9 years agoata: ahci_imx: warn when disabling ahci link
Russell King [Mon, 23 Jun 2014 11:59:08 +0000 (12:59 +0100)]
ata: ahci_imx: warn when disabling ahci link

When the AHCI link is disabled, it can't be re-enabled except by
resetting the entire SoC.  Rather than doing this silently print
some kernel messages to inform the user, along with how to avoid
this.

tj: Put a long printf format string on a single line.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Tejun Heo <tj@kernel.org>
(cherry picked from commit f118ae5901172dacc4f272acf5eccfba06e8d221)

9 years agoahci: disable ncq feature for hisilicon sata
Kefeng Wang [Tue, 24 Jun 2014 20:54:23 +0000 (16:54 -0400)]
ahci: disable ncq feature for hisilicon sata

NCQ feature is unsupported on hisilicon sata controller, so disable
it.  This version of IP is used by hip04 and hix5hd2 soc.

tj: "|=" was replaced with "=" for no reason.  Restored "|=".

Signed-off-by: Kefeng Wang <kefeng.wang@linaro.org>
Sigend-off-by: Tejun Heo <tj@kernel.org>
(cherry picked from commit 72cbaa3d2f563d7b48c9f8aef47ec9aa3a31adf2)

9 years agoahci: imx: manage only sata_ref_clk in imx_sata_enable[disable]
Shawn Guo [Wed, 28 May 2014 15:05:39 +0000 (23:05 +0800)]
ahci: imx: manage only sata_ref_clk in imx_sata_enable[disable]

Doing suspend/resume on imx6q and imx53 boards with no SATA disk
attached will trigger the following warning.

------------[ cut here ]------------
WARNING: CPU: 0 PID: 661 at drivers/ata/libahci.c:224 ahci_enable_ahci+0x74/0x8)
Modules linked in:
CPU: 0 PID: 661 Comm: sh Tainted: G        W     3.15.0-rc5-next-20140521-000027
Backtrace:
[<80011c90>] (dump_backtrace) from [<80011e2c>] (show_stack+0x18/0x1c)
 r6:803a22f4 r5:00000000 r4:00000000 r3:00000000
[<80011e14>] (show_stack) from [<80661e60>] (dump_stack+0x88/0xa4)
[<80661dd8>] (dump_stack) from [<80028fdc>] (warn_slowpath_common+0x70/0x94)
 r5:00000009 r4:00000000
[<80028f6c>] (warn_slowpath_common) from [<80029024>] (warn_slowpath_null+0x24/)
 r8:808f68c4 r7:00000000 r6:00000000 r5:00000000 r4:e0810004
[<80029000>] (warn_slowpath_null) from [<803a22f4>] (ahci_enable_ahci+0x74/0x80)
[<803a2280>] (ahci_enable_ahci) from [<803a2324>] (ahci_reset_controller+0x24/0)
 r8:ddcd9410 r7:80351178 r6:ddcd9444 r5:dde8b850 r4:e0810000 r3:ddf35e90
[<803a2300>] (ahci_reset_controller) from [<803a2c68>] (ahci_platform_resume_ho)
 r7:80351178 r6:ddcd9444 r5:dde8b850 r4:ddcd9410
[<803a2c30>] (ahci_platform_resume_host) from [<803a38f0>] (imx_ahci_resume+0x2)
 r5:00000000 r4:ddcd9410
[<803a38c4>] (imx_ahci_resume) from [<803511ac>] (platform_pm_resume+0x34/0x54)
....

The reason is that the SATA controller has no working clock at this
point, and thus ahci_enable_ahci() fails to enable the controller.  In
case that there is no SATA disk attached, the imx_sata_disable() gets
called in ahci_imx_error_handler(), and both sata_clk and sata_ref_clk
will be disabled there.  Because all the imx_sata_enable() calls
afterward will return immediately due to imxpriv->no_device check, the
SATA controller working clock sata_clk will never get any chance to be
enabled again.

This is a regression caused by commit 90870d79d4f2 (ahci-imx: Port to
library-ised ahci_platform).  Before the commit, only sata_ref_clk is
managed by the driver in enable/disable function.  But after the commit,
all the clocks are enabled/disabled in a row by ahci platform helpers
ahci_platform_enable[disable]_clks.  Since ahb_clk is a bus clock which
does not have gate at all, and i.MX low-power hardware module already
manages sata_clk across suspend/resume cycle, the only clock that needs
to be managed by software is sata_ref_clk.

So instead of using ahci_platform_enable[disable]_clks to manage all
the clocks in a row from imx_sata_enable[disable], we should manage
only sata_ref_clk in there.

Reported-by: Fabio Estevam <fabio.estevam@freescale.com>
Fixes: 90870d79d4f2 (ahci-imx: Port to library-ised ahci_platform)
Signed-off-by: Shawn Guo <shawn.guo@freescale.com>
Acked-by: Hans de Goede <hdegoede@redhat.com>
(cherry picked from commit e6dd42a917e62d916c6e513dbf87a4dec8cf3a1c)

9 years agoahci/xgene: Remove logic to set 64-bit DMA mask
Suravee Suthikulpanit [Thu, 12 Jun 2014 17:40:24 +0000 (12:40 -0500)]
ahci/xgene: Remove logic to set 64-bit DMA mask

Instead of doing the check here, this should be handled
in the common AHCI platform code.

Signed-off-by: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>
Suggested-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Cc: Loc Ho <lho@apm.com>
Cc: Tuan Phan <tphan@apm.com>
Cc: Suman Triphati <stripathi@apm.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
(cherry picked from commit be64beb40df808385f7883d2e6f01ff7c79eeae4)

9 years agoahci: Check and set 64-bit DMA mask for platform AHCI driver
Suravee Suthikulpanit [Thu, 12 Jun 2014 17:40:23 +0000 (12:40 -0500)]
ahci: Check and set 64-bit DMA mask for platform AHCI driver

The current platform AHCI driver does not set the dma_mask correctly
for 64-bit DMA capable AHCI controller. This patch checks the AHCI
capability bit and set the dma_mask and coherent_dma_mask accordingly.

Signed-off-by: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>
Reviewed-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Tested-by: Hans de Goede <hdegoede@redhat.com>
Tested-by: Suman Tripathi <stripathi@apm.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
(cherry picked from commit cc7a9e27562cd78a1dc885504086fab24addce40)

9 years agolibahci_platform: Fail when PHY required but PHY support disabled
Mikko Perttunen [Tue, 17 Jun 2014 12:07:55 +0000 (15:07 +0300)]
libahci_platform: Fail when PHY required but PHY support disabled

ahci_platform_get_resources handles resource management for
platform AHCI drivers, including getting a possible PHY
from the device tree. Since not all drivers need a PHY, it
ignores -ENODEV and -ENOSYS from devm_get_phy. However, when
the PHY subsystem is mistakenly disabled, -ENOSYS can be
returned even when a PHY is needed.

This patch modifies the -ENOSYS case to check if a "phys"
device tree node exists. If it exists, then clearly the PHY
subsystem is mistakenly disabled and the driver cannot work,
ahci_platform_get_resources will fail and propagate the error.

Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
Acked-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
(cherry picked from commit acbd573354bb7b7b7a3891018a39f4b3976b0c43)

9 years agoata: Use dma_zalloc_coherent
Joe Perches [Sun, 15 Jun 2014 20:37:32 +0000 (13:37 -0700)]
ata: Use dma_zalloc_coherent

Use the zeroing function instead of dma_alloc_coherent & memset(,0,)

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
(cherry picked from commit 94463a9cadc7f72a70ec6ee801109c2f1e44a123)

9 years agoata: ep93xx: use dmaengine_prep_slave_sg api instead of internal callback
Barry Song [Sun, 25 May 2014 09:19:05 +0000 (17:19 +0800)]
ata: ep93xx: use dmaengine_prep_slave_sg api instead of internal callback

it is better to use generic api instead of calling an internal callback
like channel->device->device_prep_slave_sg().

Signed-off-by: Barry Song <Baohua.Song@csr.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
(cherry picked from commit 69493e0b0a8b5d4a0df7df82bad49ad07ae6921d)

9 years agosata_fsl: remove check for CONFIG_MPC8315_DS
Paul Bolle [Wed, 21 May 2014 19:35:37 +0000 (21:35 +0200)]
sata_fsl: remove check for CONFIG_MPC8315_DS

A check for CONFIG_MPC8315_DS was added in v2.6.24. But the related
Kconfig symbol was never added to the tree. So the code behind this
check has effectively been dead for over six years. Remove it.

Signed-off-by: Paul Bolle <pebolle@tiscali.nl>
Signed-off-by: Tejun Heo <tj@kernel.org>
(cherry picked from commit d0f5aa9cf6a479884cda95018363ba9ed31d9cbd)

9 years agoahci: imx: PLL clock needs 100us to settle down
Shawn Guo [Sat, 17 May 2014 12:46:01 +0000 (20:46 +0800)]
ahci: imx: PLL clock needs 100us to settle down

The commit e783c51 (ahci: imx: software workaround for phy reset issue
in resume) calls imx_sata_phy_reset() to reset phy immediately after
SATA MPLL is enabled.  It seems working fine mostly, but fails in some
case as below.

...
ahci-imx 2200000.sata: failed to reset phy: -110
ahci-imx: probe of 2200000.sata failed with error -110

After talking to the designer, we learnt that when enabling i.MX6Q SATA
MPLL, we need to wait 100us for it to settle down for safety.  Add this
required delay to fix above failure.

Signed-off-by: Shawn Guo <shawn.guo@freescale.com>
Tested-by: Fabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
(cherry picked from commit 3685f2516116c5f3b9d498d531955ad70216ad84)

9 years agoahci: add support for Hisilicon sata
Kefeng Wang [Wed, 14 May 2014 06:13:42 +0000 (14:13 +0800)]
ahci: add support for Hisilicon sata

The hip04 SoC of hisilicon has an AHCI compliant SATA controller,
and it is compliant with the ahci 1.3 and sata 3.0 specification.

There is a wrong bit in HOST_CAP of hip04 sata controller, which
enable unsupported feature of FBS, use AHCI_HFLAG_NO_FBS hflag to
disable it.

Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Kefeng Wang <kefeng.wang@linaro.org>
Signed-off-by: Tejun Heo <tj@kernel.org>
(cherry picked from commit a1a205df6ee224f62c6d21cedebcb723db17fe0d)

9 years agolibahci_platform: add host_flags parameter in ahci_platform_init_host()
Kefeng Wang [Wed, 14 May 2014 06:13:41 +0000 (14:13 +0800)]
libahci_platform: add host_flags parameter in ahci_platform_init_host()

Add a dynamic host_flags argument to make ahci_platform_init_host more flexible,
then remove the AHCI_HFLAGS(...) argument from some driver's ata_port_info,
and pass that in as the new argument.

Cc: Hans de Geode <hdegoede@redhat.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Kefeng Wang <kefeng.wang@linaro.org>
Signed-off-by: Tejun Heo <tj@kernel.org>
(cherry picked from commit f9f36917903b57c571b1ddcfc6bc794ca4dd8232)

9 years agoata: ahci: append new hflag AHCI_HFLAG_NO_FBS
Kefeng Wang [Wed, 14 May 2014 06:13:40 +0000 (14:13 +0800)]
ata: ahci: append new hflag AHCI_HFLAG_NO_FBS

Append AHCI_HFLAG_NO_FBS to force turning off FBS flag.

Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org>
Signed-off-by: Kefeng Wang <kefeng.wang@linaro.org>
Signed-off-by: Tejun Heo <tj@kernel.org>
(cherry picked from commit 888d91a08fa8e2be4cb0eef1e5736ef68b8f77f0)

9 years agoata: use CONFIG_PM_SLEEP instead of CONFIG_PM where applicable in host drivers
Bartlomiej Zolnierkiewicz [Wed, 7 May 2014 15:17:44 +0000 (17:17 +0200)]
ata: use CONFIG_PM_SLEEP instead of CONFIG_PM where applicable in host drivers

This patch fixes host drivers to use CONFIG_PM_SLEEP instead of CONFIG_PM
where applicable.  Benefits of this change:

* unused code is not being compiled in for CONFIG_PM=y, CONFIG_PM_SLEEP=n
  and CONFIG_PM_RUNTIME=y configurations

* easier transition to use struct dev_pm_ops and SIMPLE_DEV_PM_OPS() in
  the future

* more consistent code (there are host drivers which are using the correct
  CONFIG_PM_SLEEP checks already)

The patch leaves the core libata code and ->port_[suspend,resume] support
in sata_[inic162x,nv,sil24].c alone for now.

Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
(cherry picked from commit 58eb8cd565af4a104395e3c10443951c1f73dafe)

9 years agoata: pata_at91 only works on sam9
Arnd Bergmann [Thu, 8 May 2014 14:56:21 +0000 (16:56 +0200)]
ata: pata_at91 only works on sam9

The smc driver used by pata_at91 is at91sam9 specific, so building
this driver on another at91 platform results in this error:

ERROR: "sam9_smc_configure" [drivers/ata/pata_at91.ko] undefined!
ERROR: "sam9_smc_write_mode" [drivers/ata/pata_at91.ko] undefined!
ERROR: "sam9_smc_read_mode" [drivers/ata/pata_at91.ko] undefined!

This patch changes the Kconfig dependency to ensure it always works.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: linux-ide@vger.kernel.org
Cc: Jean-Christophe Plagniol-Villard <plagnioj@jcrosoft.com>
Cc: Nicolas Ferre <nicolas.ferre@atmel.com>
(cherry picked from commit 2af89a3cde1beb88a2c65e0558d828c1a9e4677f)

9 years agoata: ahci_mvebu: new driver for Marvell Armada 380 AHCI interfaces
Thomas Petazzoni [Tue, 15 Apr 2014 15:00:03 +0000 (17:00 +0200)]
ata: ahci_mvebu: new driver for Marvell Armada 380 AHCI interfaces

The Marvell Armada 380 SoC includes two AHCI compatible
interfaces. However, like all DMA-capable Marvell interface, they
require special handling to configure MBus windows. Therefore, this
commit adds a new ahci_mvebu driver, which relies on the
libahci_platform.c code recently introduced.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Acked-by: Jason Cooper <jason@lakedaemon.net>
Signed-off-by: Tejun Heo <tj@kernel.org>
(cherry picked from commit a3464ed2f14d19ba923930f7c0c284499d64eb5b)

9 years agoDocumentation: dt-bindings: reformat and order list of ahci-platform compatibles
Thomas Petazzoni [Tue, 15 Apr 2014 15:00:02 +0000 (17:00 +0200)]
Documentation: dt-bindings: reformat and order list of ahci-platform compatibles

The ahci-platform.txt Device Tree binding documentation is gaining a
growing number of compatible strings, and it will gain one more with
the addition of the Marvell Armada 380 AHCI support. It is therefore
time to reformat this list into a proper bullet list, and more
importantly order it alphabetically;

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Acked-by: Andrew Lunn <andrew@lunn.ch>
Acked-by: Jason Cooper <jason@lakedaemon.net>
Signed-off-by: Tejun Heo <tj@kernel.org>
(cherry picked from commit 5799d6d4cf86c11503aee909a1ec555453c7f22a)

9 years agoata: ahci_platform: Update DT compatible list
Roger Quadros [Sat, 22 Feb 2014 15:53:39 +0000 (16:53 +0100)]
ata: ahci_platform: Update DT compatible list

The ahci_platform driver supports "snps,dwc-ahci".
Add this to the DT binding information.

Signed-off-by: Roger Quadros <rogerq@ti.com>
Reviewed-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
(cherry picked from commit 42a7f53ba0f2baa2ea23cd830511cea7f8612dd2)

9 years agoahci: imx: software workaround for phy reset issue in resume
Shawn Guo [Sun, 4 May 2014 13:48:06 +0000 (21:48 +0800)]
ahci: imx: software workaround for phy reset issue in resume

When suspending imx6q systems which have rootfs on SATA, the following
error will likely be seen in resume.  The SATA link will fail to come
up, and it results in an unusable system across the suspend/resume
cycle.

$ echo mem > /sys/power/state
PM: Syncing filesystems ... done.
PM: Preparing system for mem sleep
Freezing user space processes ... (elapsed 0.002 seconds) done.
Freezing remaining freezable tasks ... (elapsed 0.002 seconds) done.
PM: Entering mem sleep
sd 0:0:0:0: [sda] Synchronizing SCSI cache
sd 0:0:0:0: [sda] Stopping disk
PM: suspend of devices complete after 61.914 msecs
PM: suspend devices took 0.070 seconds
PM: late suspend of devices complete after 4.906 msecs
PM: noirq suspend of devices complete after 4.521 msecs
Disabling non-boot CPUs ...
CPU1: shutdown
CPU2: shutdown
CPU3: shutdown
Enabling non-boot CPUs ...
CPU1: Booted secondary processor
CPU1 is up
CPU2: Booted secondary processor
CPU2 is up
CPU3: Booted secondary processor
CPU3 is up
PM: noirq resume of devices complete after 10.486 msecs
PM: early resume of devices complete after 4.679 msecs
sd 0:0:0:0: [sda] Starting disk
PM: resume of devices complete after 22.674 msecs
PM: resume devices took 0.030 seconds
PM: Finishing wakeup.
Restarting tasks ... done.
$ ata1: SATA link down (SStatus 1 SControl 300)
ata1: SATA link down (SStatus 1 SControl 300)
ata1: limiting SATA link speed to 1.5 Gbps
ata1: SATA link down (SStatus 1 SControl 310)
ata1.00: disabled
ata1: exception Emask 0x10 SAct 0x0 SErr 0x4040000 action 0xe frozen t4
ata1: irq_stat 0x00000040, connection status changed
ata1: SError: { CommWake DevExch }
ata1: hard resetting link
sd 0:0:0:0: rejecting I/O to offline device
sd 0:0:0:0: killing request
sd 0:0:0:0: rejecting I/O to offline device
Aborting journal on device sda2-8.
sd 0:0:0:0: rejecting I/O to offline device
EXT4-fs warning (device sda2): ext4_end_bio:317: I/O error writing to inode 132577 (offset 0 size 0 starting block 26235)
Buffer I/O error on device sda2, logical block 10169
...

It's caused by a silicon issue that SATA phy does not get reset by
controller when coming back from LPM.  The patch adds a software
workaround for this issue.  It enforces a software reset on SATA phy
in imx_sata_enable() function, so that we can ensure SATA link will
come up properly in both power-on and resume.

The software reset is implemented by writing phy reset register through
the phy control register bus interface.  Functions
imx_phy_reg_[addressing|write|read]() implement this bus interface, while
imx_sata_phy_reset() performs the actually reset operation.

Signed-off-by: Richard Zhu <r65037@freescale.com>
Signed-off-by: Shawn Guo <shawn.guo@freescale.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
(cherry picked from commit e783c51cce94521c10e599e991acdcfd9a996c4a)

9 years agoahci: imx: add namespace for register enums
Shawn Guo [Sun, 4 May 2014 13:48:05 +0000 (21:48 +0800)]
ahci: imx: add namespace for register enums

Update register enums a little bit to add proper namespace prefix, and
have the names match i.MX reference manual.

Signed-off-by: Shawn Guo <shawn.guo@freescale.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
(cherry picked from commit 24a9ad5b82929cdeaff70018d82263de0c34c45d)

9 years agolibata-sff: remove dead code
Paul Bolle [Sun, 4 May 2014 11:50:29 +0000 (13:50 +0200)]
libata-sff: remove dead code

Ever since v2.6.19 the code contains a check for CONFIG_NO_ATA_LEGACY.
But that macro has never been defined. Apparently no one ran into
problems on platforms that do not support compatibility mode. So remove
this code that has been dead for over seven years.

Signed-off-by: Paul Bolle <pebolle@tiscali.nl>
Signed-off-by: Tejun Heo <tj@kernel.org>
(cherry picked from commit 8612b4b4f964b935029c3388c8484a66e41bf71e)

9 years agoata: SATL compliance for Inquiry Product Revision
Keith Busch [Thu, 1 May 2014 17:12:03 +0000 (11:12 -0600)]
ata: SATL compliance for Inquiry Product Revision

The SCSI-to-ATA Translation standard says to use data words 25 and 26
unless they are spaces. For devices that use these words in the firmware
field, they are generally more useful anyway.

Signed-off-by: Keith Busch <keith.busch@intel.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
(cherry picked from commit c49a6bf5eecd31f335df1a3700c92be1a824c6f0)

9 years agoahci: Ensure "MSI Revert to Single Message" mode is not enforced
Alexander Gordeev [Thu, 17 Apr 2014 12:13:49 +0000 (14:13 +0200)]
ahci: Ensure "MSI Revert to Single Message" mode is not enforced

The AHCI specification allows hardware to choose to revert to
single MSI mode when fewer messages are allocated than requested.
Yet, at least ICH10 chipset reverts to single MSI mode even when
enough messages are allocated in some cases (see below).

This update forces the driver to not rely on initialization of
multiple MSIs mode alone and always check if "MSI Revert to
Single Message" (MRSM) mode was enforced by the controller and
fallback to the single MSI mode in case it did.

That prevents a situation when the driver configured multiple
per-port IRQ handlers, but the controller sends all port's
interrupts to a single IRQ, which could easily screw up the
interrupt handling and lead to delays and possibly crashes.

The fix was tested on a 6-port controller that successfully
reverted to the single MSI mode:

00:1f.2 SATA controller: Intel Corporation 82801JI (ICH10 Family) SATA
AHCI Controller (prog-if 01 [AHCI 1.0])
Subsystem: Super Micro Computer Inc Device 10a7
Flags: bus master, 66MHz, medium devsel, latency 0, IRQ 101
I/O ports at f110 [size=8]
I/O ports at f100 [size=4]
I/O ports at f0f0 [size=8]
I/O ports at f0e0 [size=4]
I/O ports at f020 [size=32]
Memory at fbf00000 (32-bit, non-prefetchable) [size=2K]
Capabilities: [80] MSI: Enable+ Count=1/16 Maskable- 64bit-
Capabilities: [70] Power Management version 3
Capabilities: [a8] SATA HBA v1.0
Capabilities: [b0] PCI Advanced Features
Kernel driver in use: ahci

With 6 ports just 8 MSI vectors should be enough, but the adapter
enforces the MRSM mode when less than 16 vectors are written to
the Multiple Messages Enable PCI register. I instigated MRSM mode
by forcing @nvec to 8 in ahci_init_interrupts().

Signed-off-by: Alexander Gordeev <agordeev@redhat.com>
Cc: linux-ide@vger.kernel.org
Cc: stable@vger.kernel.org
Signed-off-by: Tejun Heo <tj@kernel.org>
(cherry picked from commit ab0f9e78b97f5193dd38b3757b42b6fbded05fb7)

9 years agoata: fix i.MX AHCI driver dependencies
Jean Delvare [Tue, 8 Apr 2014 09:06:26 +0000 (11:06 +0200)]
ata: fix i.MX AHCI driver dependencies

The ahci_imx driver is only needed on Freescale i.MX platforms so
don't let it be built on other platforms, except for build test
purpose.

Signed-off-by: Jean Delvare <jdelvare@suse.de>
Cc: Tejun Heo <tj@kernel.org>
Cc: Richard Zhu <r65037@freescale.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
(cherry picked from commit f5f85ee065f2e243f4165d7dd7d1a4a95daa1801)

9 years agolibata: make AHCI_XGENE depend on PHY_XGENE
Tejun Heo [Wed, 2 Apr 2014 16:41:59 +0000 (12:41 -0400)]
libata: make AHCI_XGENE depend on PHY_XGENE

AHCI_XGENE is only applicable on ARM64 but it can also be enabled for
compile testing; however, AHCI_XGENE selects PHY_XGENE which has other
arch specific dependencies.  This leads to the following warning when
enabling it on other archs for compile testing.

  warning: (AHCI_XGENE) selects PHY_XGENE which has unmet direct
  dependencies (HAS_IOMEM && OF && (ARM64 || COMPILE_TEST))

Selecting a config option which itself has dependencies can easily
lead to broken configurations.  For now, let's just make AHCI_XGENE
depend on PHY_XGENE which has all the necessary dependencies already.

Signed-off-by: Tejun Heo <tj@kernel.org>
Reported-by: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Loc Ho <lho@apm.com>
Cc: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Cc: Kishon Vijay Abraham I <kishon@ti.com>
(cherry picked from commit 74c03eb63061c834893e7ebf8d298573bdccfd08)

9 years agoata: fix ARASAN CompactFlash PATA driver dependencies
Bartlomiej Zolnierkiewicz [Wed, 26 Mar 2014 14:33:37 +0000 (15:33 +0100)]
ata: fix ARASAN CompactFlash PATA driver dependencies

Make pata_arasan_cf host driver depend on ARCH_SPEAR13XX config
option as ARASAN CompactFlash PATA support is specific to ST
SPEAr13xx SoCs and the driver to work requires suitable device
tree node (or platform device) to be defined.  Additionally
allow the driver build if COMPILE_TEST config option is set.

Cc: Viresh Kumar <viresh.linux@gmail.com>
Cc: Shiraz Hashim <shiraz.hashim@st.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
(cherry picked from commit e638433b5021f59aacbfe15597beca1e706773fb)

9 years agoata: remove superfluous casts
Joe Perches [Wed, 26 Mar 2014 16:34:49 +0000 (09:34 -0700)]
ata: remove superfluous casts

Unreferenced casts of void * types are unnecessary so remove them.

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
(cherry picked from commit d5185d655c1fc4dfd467303f45ba4496ad84ddf9)

9 years agoata: fix Calxeda Highbank SATA driver dependencies
Bartlomiej Zolnierkiewicz [Wed, 26 Mar 2014 15:39:50 +0000 (16:39 +0100)]
ata: fix Calxeda Highbank SATA driver dependencies

Make sata_highbank host driver depend on ARCH_HIGHBANK config option
as Calxeda Highbank SATA support is specific to Calxeda Highbank
SoCs and the driver to work requires suitable device tree node to
be defined.  Additionally allow the driver build if COMPILE_TEST
config option is set.

Cc: Mark Langsdorf <mark.langsdorf@calxeda.com>
Cc: Rob Herring <robh@kernel.org>
Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
(cherry picked from commit 0b99f8648eb1814d787db3981ad93e6bc343b3f6)

9 years agoata: fix R-Car SATA driver dependencies
Bartlomiej Zolnierkiewicz [Wed, 26 Mar 2014 14:19:23 +0000 (15:19 +0100)]
ata: fix R-Car SATA driver dependencies

Make sata_rcar host driver depend on ARCH_SHMOBILE config option as
Renesas R-Car SATA support is specific to Renesas SoCs and the driver
to work requires suitable device tree node (or platform device) to be
defined.  Additionally allow the driver build if COMPILE_TEST config
option is set.

Cc: Simon Horman <horms@verge.net.au>
Cc: Magnus Damm <magnus.damm@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
(cherry picked from commit 7596d93d8dfa7a508ca52c7d9b7db763eb5b0715)

9 years agoata: add new-style AHCI platform driver for DaVinci DA850 AHCI controller
Bartlomiej Zolnierkiewicz [Tue, 25 Mar 2014 18:51:40 +0000 (19:51 +0100)]
ata: add new-style AHCI platform driver for DaVinci DA850 AHCI controller

Add the new ahci_da850 host driver.

Platform changes needed to make DaVinci DA850 SATA AHCI support
fully functional are in the separate "ARM: davinci: da850: update
SATA AHCI support" commit.

Please note that this driver doesn't have the superfluous clock
control code as clock is already handled by the generic AHCI
platform library code.

Cc: Sekhar Nori <nsekhar@ti.com>
Cc: Kevin Hilman <khilman@deeprootsystems.com>
Cc: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
(cherry picked from commit ae8723f8a9c8e804c2b906074d7d5f1265a385bb)

9 years agoata: move library code from ahci_platform.c to libahci_platform.c
Bartlomiej Zolnierkiewicz [Tue, 25 Mar 2014 18:51:39 +0000 (19:51 +0100)]
ata: move library code from ahci_platform.c to libahci_platform.c

Move AHCI platform library code from ahci_platform.c to
libahci_platform.c and fix dependencies for ahci_st,
ahci_imx and ahci_sunxi drivers.

Acked-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
(cherry picked from commit fd990556f0fa25446c6bfa9cf4c9e49d387d4472)

9 years agoata: delete non-required instances of include <linux/init.h>
Paul Gortmaker [Tue, 21 Jan 2014 21:22:51 +0000 (16:22 -0500)]
ata: delete non-required instances of include <linux/init.h>

None of these files are actually using any __init type directives
and hence don't need to include <linux/init.h>.  Most are just a
left over from __devinit and __cpuinit removal, or simply due to
code getting copied from one driver to the next.

Cc: linux-ide@vger.kernel.org
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
(cherry picked from commit 1bc18086231c130895b87ec049be8ddcdab552b8)

9 years agoata: ahci_platform: fix ahci_platform_data->suspend method handling
Bartlomiej Zolnierkiewicz [Tue, 25 Mar 2014 18:51:38 +0000 (19:51 +0100)]
ata: ahci_platform: fix ahci_platform_data->suspend method handling

Looking at ST SPEAr1340 AHCI code (the only user of the deprecated
pdata->suspend and pdata->resume) it is obvious the we should return
after calling pdata->suspend() only if the function have returned
non-zero return value.  The code has been broken since commit 1e70c2
("ata/ahci_platform: Add clock framework support").  Fix it.

Cc: Viresh Kumar <viresh.linux@gmail.com>
Cc: Shiraz Hashim <shiraz.hashim@st.com>
Acked-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
(cherry picked from commit 83b03fd67b9b3fa3795871169f3c08c35b3d6ea8)

9 years agolibata: async resume
Todd Brandt [Fri, 14 Mar 2014 20:52:54 +0000 (13:52 -0700)]
libata: async resume

Improve overall system resume time by making libata link recovery
actions asynchronous relative to other resume events.

Link resume operations are performed using the scsi_eh thread, so
commands, particularly the sd resume start/stop command, will be held
off until the device exits error handling.  Libata already flushes eh
with ata_port_wait_eh() in the port teardown paths, so there are no
concerns with async operation colliding with the end-of-life of the
ata_port object.  Also, libata-core is already careful to flush
in-flight pm operations before another round of pm starts on the given
ata_port.

Reference: https://01.org/suspendresume/blogs/tebrandt/2013/hard-disk-resume-optimization-simpler-approach

Cc: Len Brown <len.brown@intel.com>
Cc: Phillip Susi <psusi@ubuntu.com>
Cc: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Todd Brandt <todd.e.brandt@linux.intel.com>
[djbw: rebase on cleanup patch, changelog wordsmithing]
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
(cherry picked from commit 200421a80f6e0a9e39d698944cc35cba103eb6ce)

9 years agolibata, libsas: kill pm_result and related cleanup
Dan Williams [Fri, 14 Mar 2014 20:52:48 +0000 (13:52 -0700)]
libata, libsas: kill pm_result and related cleanup

Tejun says:
  "At least for libata, worrying about suspend/resume failures don't make
   whole lot of sense.  If suspend failed, just proceed with suspend.  If
   the device can't be woken up afterwards, that's that.  There isn't
   anything we could have done differently anyway.  The same for resume, if
   spinup fails, the device is dud and the following commands will invoke
   EH actions and will eventually fail.  Again, there really isn't any
   *choice* to make.  Just making sure the errors are handled gracefully
   (ie. don't crash) and the following commands are handled correctly
   should be enough."

The only libata user that actually cares about the result from a suspend
operation is libsas.  However, it only cares about whether queuing a new
operation collides with an in-flight one.  All libsas does with the
error is retry, but we can just let libata wait for the previous
operation before continuing.

Other cleanups include:
1/ Unifying all ata port pm operations on an ata_port_pm_ prefix
2/ Marking all ata port pm helper routines as returning void, only
   ata_port_pm_ entry points need to fake a 0 return value.
3/ Killing ata_port_{suspend|resume}_common() in favor of calling
   ata_port_request_pm() directly
4/ Killing the wrappers that just do a to_ata_port() conversion
5/ Clearly marking the entry points that do async operations with an
  _async suffix.

Reference: http://marc.info/?l=linux-scsi&m=138995409532286&w=2

Cc: Phillip Susi <psusi@ubuntu.com>
Cc: Alan Stern <stern@rowland.harvard.edu>
Suggested-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Todd Brandt <todd.e.brandt@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
(cherry picked from commit bc6e7c4b0d1a1f742d96556f63d68f17f4e232c3)

9 years agoata: Fix compiler warning with APM X-Gene host controller driver
Loc Ho [Tue, 18 Mar 2014 18:14:37 +0000 (12:14 -0600)]
ata: Fix compiler warning with APM X-Gene host controller driver

This patch fixes an compiler warning with APM X-Gene host controller
driver when compiled with DEBUG enabled.

Signed-off-by: Loc Ho <lho@apm.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
(cherry picked from commit 6a96918a6aa7b434d15710fc9e06589c6c8bd3a6)

9 years agoata: Add APM X-Gene SoC AHCI SATA host controller driver
Loc Ho [Fri, 14 Mar 2014 23:53:20 +0000 (17:53 -0600)]
ata: Add APM X-Gene SoC AHCI SATA host controller driver

This patch adds support for the APM X-Gene SoC AHCI SATA host controller
driver. It requires the corresponding APM X-Gene SoC PHY driver. This
initial version only supports Gen3 speed.

Signed-off-by: Loc Ho <lho@apm.com>
Signed-off-by: Tuan Phan <tphan@apm.com>
Signed-off-by: Suman Tripathi <stripathi@apm.com>
Reviewed-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
(cherry picked from commit 81d01bfa51300d14191e0013856a7b25f809468f)

9 years agoata: ahci_sunxi: fix code formatting
Bartlomiej Zolnierkiewicz [Mon, 17 Mar 2014 13:08:12 +0000 (14:08 +0100)]
ata: ahci_sunxi: fix code formatting

Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
Acked-by: Hans de Goede <hdegoede@redhat.com>
(cherry picked from commit cdf457a4fe30980f7c15a894af2f954f85cd71d2)

9 years agoata: ahci_sunxi: make ahci_sunxi_resume() static
Bartlomiej Zolnierkiewicz [Mon, 17 Mar 2014 13:06:57 +0000 (14:06 +0100)]
ata: ahci_sunxi: make ahci_sunxi_resume() static

Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
Acked-by: Hans de Goede <hdegoede@redhat.com>
(cherry picked from commit 1bf9d885658cbee1bc8e4324d0e27b02b1540d58)

9 years agoata: ahci_platform: fix devm_ioremap_resource() return value checking
Bartlomiej Zolnierkiewicz [Fri, 14 Mar 2014 17:22:09 +0000 (18:22 +0100)]
ata: ahci_platform: fix devm_ioremap_resource() return value checking

devm_ioremap_resource() returns a pointer to the remapped memory or
an ERR_PTR() encoded error code on failure.  Fix the check inside
ahci_platform_get_resources() accordingly.

Also while at it remove a needless line break.

Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
(cherry picked from commit 5434b203156ef245b7847128c446c5b54f12a6d4)

9 years agoata: ahci_st: remove deprecated struct ahci_platform_data usage
Bartlomiej Zolnierkiewicz [Fri, 14 Mar 2014 18:21:59 +0000 (19:21 +0100)]
ata: ahci_st: remove deprecated struct ahci_platform_data usage

struct ahci_platform_data is deprecated (please see comments in
<linux/ahci_platform.h> for details).  Convert ahci_st driver to
use custom ->host_stop method instead.

Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
(cherry picked from commit b032378b4c3ffba86d2c78699b385ae646397938)

9 years agoata: ahci_st: build fixes
Bartlomiej Zolnierkiewicz [Fri, 14 Mar 2014 18:20:58 +0000 (19:20 +0100)]
ata: ahci_st: build fixes

* The config option for ahci_st driver was renamed from
  CONFIG_SATA_AHCI_ST to CONFIG_AHCI_ST but Makefile was
  not updated.  Fix it (also while at it move the ahci_st
  driver entry below ahci_imx and ahci_sunxi ones).

* Fix a few build issues in the ahci_st driver itself.

Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
(cherry picked from commit 33081b34681742add8d8c1e49fc93045415e5a18)

9 years agolibata: zpodd: eliminate odd_can_poweroff
Aaron Lu [Fri, 14 Mar 2014 05:46:10 +0000 (13:46 +0800)]
libata: zpodd: eliminate odd_can_poweroff

Now that we can directly get the ACPI device conterpart of the physical
ATA transport device, the odd_can_poweroff can be eliminated.

Signed-off-by: Aaron Lu <aaron.lu@intel.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
(cherry picked from commit d920203695029558ef16925182f89cf6302b50b0)

9 years agolibata: acpi: avoid passing NULL to ACPI evaluation method
Aaron Lu [Fri, 14 Mar 2014 05:46:09 +0000 (13:46 +0800)]
libata: acpi: avoid passing NULL to ACPI evaluation method

If ACPI handle for an ATA device is NULL, we shouldn't call
ata_dev_get_GTF as that function will use handle to do some ACPI
evaluation.

Signed-off-by: Aaron Lu <aaron.lu@intel.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
(cherry picked from commit c75da205e02dda3b79ca057e558f97f3d61c855d)

9 years agolibata: zpodd: should depend on PM_RUNTIME
Aaron Lu [Fri, 14 Mar 2014 05:46:08 +0000 (13:46 +0800)]
libata: zpodd: should depend on PM_RUNTIME

ZPODD is built on top of runtime PM functionality, it doesn't make sense
to have it in a kernel that doesn't have CONFIG_PM_RUNTIME set.

Signed-off-by: Aaron Lu <aaron.lu@intel.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
(cherry picked from commit 20e64fa42965a6ec6f0ae4c5d4fda0ccf6c94ff6)

9 years agoata: Fix SC1200 dependencies
Jean Delvare [Fri, 14 Mar 2014 14:41:31 +0000 (15:41 +0100)]
ata: Fix SC1200 dependencies

The SC1200 is a SoC based on the Geode GX1 32-bit x86 processor, so
its drivers are only needed on this architecture, except for build
testing purpose.

Signed-off-by: Jean Delvare <jdelvare@suse.de>
Signed-off-by: Tejun Heo <tj@kernel.org>
(cherry picked from commit 840aa78782f02d5d442fae9af425118ed0ce8cba)

9 years agoahci: st: Invoke AHCI Platform Suspend/Resume
Lee Jones [Wed, 12 Mar 2014 12:39:42 +0000 (12:39 +0000)]
ahci: st: Invoke AHCI Platform Suspend/Resume

This is where we disable IRQs on suspend and update the internal
power state during suspend/resume.

Suggested-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Tejun Heo <tj@kernel.org>
(cherry picked from commit 761a8c2765df17ac5296e2631a16ec08d1a0cb1c)

9 years agoahci: st: Only build for ST-Micro h/w
Lee Jones [Wed, 12 Mar 2014 12:39:41 +0000 (12:39 +0000)]
ahci: st: Only build for ST-Micro h/w

This device is designed specifically to run on ST-Microelectronics'
hardware. To ensure no attempts are made to run on anything incompatible
we add a dependency on ST architecture

Suggested-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Tejun Heo <tj@kernel.org>
(cherry picked from commit 48c54df1305c4287cf8d8a344de6b70b1d56e234)

9 years agoahci: st: Utilise ata_platform_remove_one() call
Lee Jones [Wed, 12 Mar 2014 12:39:40 +0000 (12:39 +0000)]
ahci: st: Utilise ata_platform_remove_one() call

ata_platform_remove_one() allows us to specify our own exit function
via platform data then goes off and removes ATA Host and Port in
preparation for device removal.

Suggested-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Tejun Heo <tj@kernel.org>
(cherry picked from commit a82370842834875c81b482181af280353aa6be05)

9 years agoahci: st: Remove legacy dependencies on PHY
Lee Jones [Wed, 12 Mar 2014 12:39:39 +0000 (12:39 +0000)]
ahci: st: Remove legacy dependencies on PHY

Suggested-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Tejun Heo <tj@kernel.org>
(cherry picked from commit c51a848973da8b347191c0e317da3b912c2cdb6a)

9 years agoahci: st: Standardise naming conventions
Lee Jones [Wed, 12 Mar 2014 12:39:38 +0000 (12:39 +0000)]
ahci: st: Standardise naming conventions

Other devices have adopted similar naming conventions which have been
accepted as the standard. This patch brings any mention of the the ST
AHCI driver into line with them.

Suggested-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Tejun Heo <tj@kernel.org>
(cherry picked from commit 4a2e51234038fb8b24963a2f32e8b55980085a23)

9 years agoahci: st: Add support for ST's SATA IP
Lee Jones [Wed, 26 Feb 2014 14:47:21 +0000 (14:47 +0000)]
ahci: st: Add support for ST's SATA IP

Acked-by: Alexandre Torgue <alexandre.torgue@st.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Tejun Heo <tj@kernel.org>
(cherry picked from commit 76884cb2f7da5282019bf5c90e8f804429150742)

9 years agopata_legacy: Remove dead code
Silvan Jegen [Mon, 10 Mar 2014 21:33:50 +0000 (22:33 +0100)]
pata_legacy: Remove dead code

The current flow of control prevents this function from being
called. Let's remove the call.

Signed-off-by: Silvan Jegen <s.jegen@gmail.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
(cherry picked from commit e853a4e01ffd0962a197f61e792178b458ae4763)

9 years agoata: Fix CS55xx dependencies
Jean Delvare [Tue, 11 Mar 2014 11:55:24 +0000 (12:55 +0100)]
ata: Fix CS55xx dependencies

As far as I know, the CS5520 and CS5530 chipsets were only used with
32-bit x86 Geode processors, so I think their drivers are only needed
on this architecture, except for build testing purpose.

While we're here, simplify the dependencies for the CS5535 driver.

The CS5536 was used with the Geode processors, but also on MIPS
Loongson/Lemote 2 systems, so let its driver be built for these two
architectures only, except for build testing purpose.

Signed-off-by: Jean Delvare <jdelvare@suse.de>
Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Ralf Baechle <ralf@linux-mips.org>
(cherry picked from commit 9236a76d9e978aaa7709b8ff3f03c1a8b66d9ea7)

9 years agolibata: end the r-word
Dan Williams [Fri, 7 Mar 2014 22:22:48 +0000 (14:22 -0800)]
libata: end the r-word

Prompted by the social effort in the US to discourage usage of the
adjective "retarded".

In this case we needlessly anthropomorphize hard drives.  The
implication is that due to design deficiencies in the device reset
recovery time is negatively impacted.  We can simply clearly state that
fact.  "Exceptional devices cause outliers in reset recovery time." This
steers clear of any unintended comparison of such devices to humans with
cognitive disabilities.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
(cherry picked from commit 35bf88212b5e5d1f9145481bc15e8c1801da58dc)

9 years agoahci_imx: Put #ifdef CONFIG_PM_SLEEP around suspend / resume functions
Hans de Goede [Wed, 5 Mar 2014 19:17:49 +0000 (20:17 +0100)]
ahci_imx: Put #ifdef CONFIG_PM_SLEEP around suspend / resume functions

This fixes the following warnings when CONFIG_PM_SLEEP is not set:

drivers/ata/ahci_imx.c:284:12: warning: ‘imx_ahci_suspend’ defined but not used [-Wunused-function]
drivers/ata/ahci_imx.c:299:12: warning: ‘imx_ahci_resume’ defined but not used [-Wunused-function]

Reported-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Cc: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
(cherry picked from commit 46ce6b74fdec1a8a8e9b45597e6c7989441682bf)

9 years agoahci_sunxi: Use msleep instead of mdelay
Hans de Goede [Sun, 23 Feb 2014 11:52:41 +0000 (12:52 +0100)]
ahci_sunxi: Use msleep instead of mdelay

ahci_sunxi_phy_init is called from the probe and resume code paths, and
sleeping is safe in both, so use msleep instead of mdelay.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
(cherry picked from commit d2ec147a76d0e051db19d378cac3ee7721877717)

9 years agoahci_platform: Drop unused ahci_platform_data members
Hans de Goede [Sat, 22 Feb 2014 16:22:55 +0000 (17:22 +0100)]
ahci_platform: Drop unused ahci_platform_data members

These members are not used anywhere, and in the future we want
ahci_platform_data to go away entirely so there is no reason to keep these
around.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
(cherry picked from commit 6ef95e87763fd69889655f4f14e499377a54d066)

9 years agoahci_platform: Drop support for imx53-ahci platform device type
Hans de Goede [Sat, 22 Feb 2014 16:22:54 +0000 (17:22 +0100)]
ahci_platform: Drop support for imx53-ahci platform device type

Since the 3.13 release the ahci_imx driver has proper devicetree enabled
support for ahci on imx53 and that is used instead of the old board file
created imx53-ahci platform device.

Note this patch also complete drops the id-table, an id-table is not needed
for a single id platform driver, the name field in the driver struct suffices.

And the code already has an explicit "MODULE_ALIAS("platform:ahci");" so the
id-table is not needed for that either.

Cc: Marek Vasut <marex@denx.de>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
(cherry picked from commit c093e1d36e317c5ac2dc788f407119259fc260fe)

9 years agoahci_platform: Drop support for ahci-strict platform device type
Hans de Goede [Sat, 22 Feb 2014 16:22:53 +0000 (17:22 +0100)]
ahci_platform: Drop support for ahci-strict platform device type

I've done a grep over the entire kernel tree and nothing is using this
(anymore?).

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
(cherry picked from commit f1df8641e27b7edb978bdc7aaf50c235bc9e8be9)

9 years agoata: ahci_platform: runtime resume the device before use
Roger Quadros [Sat, 22 Feb 2014 15:53:41 +0000 (16:53 +0100)]
ata: ahci_platform: runtime resume the device before use

On OMAP platforms the device needs to be runtime resumed before it can
be accessed. The OMAP HWMOD framework takes care of enabling the
module and its resources based on the device's runtime PM state.

In this patch we runtime resume during .probe() and runtime suspend
after .remove().

We also update the runtime PM state during .resume().

CC: Balaji T K <balajitk@ti.com>
Signed-off-by: Roger Quadros <rogerq@ti.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
(cherry picked from commit e708e46edac8ab2f31e7ee991aa3c5b87638e658)

9 years agoata: ahci_platform: Manage SATA PHY
Roger Quadros [Sat, 22 Feb 2014 15:53:40 +0000 (16:53 +0100)]
ata: ahci_platform: Manage SATA PHY

Some platforms have a PHY hooked up to the SATA controller. The PHY
needs to be initialized and powered up for SATA to work. We do that
using the PHY framework.

tj: Minor comment formatting updates.

CC: Balaji T K <balajitk@ti.com>
Signed-off-by: Roger Quadros <rogerq@ti.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Tejun Heo<tj@kernel.org>
(cherry picked from commit 21b5faeec229d4f70a7f60a7b0b065c98198f491)

9 years agoata: ahci_platform: Add DT compatible for Synopsis DWC AHCI controller
Roger Quadros [Sat, 22 Feb 2014 15:53:38 +0000 (16:53 +0100)]
ata: ahci_platform: Add DT compatible for Synopsis DWC AHCI controller

Add compatible string "snps,dwc-ahci", which should be used
for Synopsis Designware SATA cores. e.g. on TI OMAP5 and DRA7 platforms.

Signed-off-by: Roger Quadros <rogerq@ti.com>
Reviewed-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
(cherry picked from commit c431147184c05849f1d7e14f8fd6254e1026319d)

9 years agoahci-imx: Port to library-ised ahci_platform
Hans de Goede [Sat, 22 Feb 2014 15:53:37 +0000 (16:53 +0100)]
ahci-imx: Port to library-ised ahci_platform

This avoids the ugliness of creating a nested platform device from probe.

While moving it around anyways, move the mk6q phy init code from probe
to imx_sata_enable, as the phy needs to be re-initialized on resume too,
otherwise the drive won't be recognized after resume.

Tested on a wandboard i.mx6 quad.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
(cherry picked from commit 90870d79d4f28711610dd2e72d8fa616c922d110)

9 years agoARM: sunxi: Add support for Allwinner SUNXi SoCs sata to ahci_platform
Olliver Schinagl [Sat, 22 Feb 2014 15:53:36 +0000 (16:53 +0100)]
ARM: sunxi: Add support for Allwinner SUNXi SoCs sata to ahci_platform

This patch adds support for the ahci sata controler found on Allwinner A10
and A20 SoCs to the ahci_platform driver.

Orignally written by Olliver Schinagl using the approach of having a platform
device which probe method creates a new child platform device which gets
driven by ahci_platform.c, as done by ahci_imx.c .

Refactored by Hans de Goede to add most of the non sunxi specific functionality
to ahci_platform.c and use a platform_data pointer from of_device_id for the
sunxi specific bits.

Signed-off-by: Olliver Schinagl <oliver@schinagl.nl>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
(cherry picked from commit c5754b5220f01e8722799d35c04a76e82c62d7d8)

9 years agoahci-platform: "Library-ise" suspend / resume functionality
Hans de Goede [Sat, 22 Feb 2014 15:53:35 +0000 (16:53 +0100)]
ahci-platform: "Library-ise" suspend / resume functionality

Split suspend / resume code into host suspend / resume functionality and
resource enable / disabling phases, and export the new suspend_ / resume_host
functions.

tj: Minor comment formatting updates.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
(cherry picked from commit 648cb6fd83b97f0f772db783a280af300fa9f2bc)

9 years agoahci-platform: "Library-ise" ahci_probe functionality
Hans de Goede [Sat, 22 Feb 2014 15:53:34 +0000 (16:53 +0100)]
ahci-platform: "Library-ise" ahci_probe functionality

ahci_probe consists of 3 steps:
1) Get resources (get mmio, clks, regulator)
2) Enable resources, handled by ahci_platform_enable_resouces
3) The more or less standard ahci-host controller init sequence

This commit refactors step 1 and 3 into separate functions, so the platform
drivers for AHCI implementations which need a specific order in step 2,
and / or need to do some custom register poking at some time, can re-use
ahci-platform.c code without needing to copy and paste it.

Note that ahci_platform_init_host's prototype takes the 3 non function
members of ahci_platform_data as arguments, the idea is that drivers using
the new exported utility functions will not use ahci_platform_data at all,
and hopefully in the future ahci_platform_data can go away entirely.

tj: Minor comment formatting updates.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
(cherry picked from commit 23b07d4cb3c0c850055cf968af44019b8da185fb)

9 years agoahci-platform: Add enable_ / disable_resources helper functions
Hans de Goede [Sat, 22 Feb 2014 15:53:33 +0000 (16:53 +0100)]
ahci-platform: Add enable_ / disable_resources helper functions

tj: Minor comment formatting updates.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
(cherry picked from commit 96a01ba52c60fdd74dd6e8cf06645d06515b1396)

9 years agoahci-platform: Add support for an optional regulator for sata-target power
Hans de Goede [Sat, 22 Feb 2014 15:53:32 +0000 (16:53 +0100)]
ahci-platform: Add support for an optional regulator for sata-target power

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
(cherry picked from commit 4b3e603a298db26c6c37e8b08adcce24d014df13)

9 years agoahci-platform: Add support for devices with more then 1 clock
Hans de Goede [Sat, 22 Feb 2014 15:53:31 +0000 (16:53 +0100)]
ahci-platform: Add support for devices with more then 1 clock

The allwinner-sun4i AHCI controller needs 2 clocks to be enabled and the
imx AHCI controller needs 3 clocks to be enabled.

tj: Minor comment formatting updates.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
(cherry picked from commit 156c5887948cd191417f18026aab9ce26e5a95da)

9 years agolibahci: Allow drivers to override start_engine
Hans de Goede [Sat, 22 Feb 2014 15:53:30 +0000 (16:53 +0100)]
libahci: Allow drivers to override start_engine

Allwinner A10 and A20 ARM SoCs have an AHCI sata controller which needs a
special register to be poked before starting the DMA engine.

This register gets reset on an ahci_stop_engine call, so there is no other
place then ahci_start_engine where this poking can be done.

This commit allows drivers to override ahci_start_engine behavior for use by
the Allwinner AHCI driver (and potentially other drivers in the future).

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
(cherry picked from commit 039ece38da45f5e6a94be3aa7611cf3634bc2461)

9 years agoARM: imx: fix register offset of pll7_usb_host gate clock
Shawn Guo [Fri, 12 Sep 2014 02:40:28 +0000 (10:40 +0800)]
ARM: imx: fix register offset of pll7_usb_host gate clock

There is a copy&paste error on register offset of pll7_usb_host gate
clock introduced by i.MX6 PLL bypass support patches.  The error breaks
the ENET function, because it overwrites the pll6_enet gate bit.

Correct the offset for all i.MX6 clock drivers.

Thanks to Fugang for spotting the error.

Signed-off-by: Shawn Guo <shawn.guo@freescale.com>
9 years agoARM: dts: imx6sl: add baud clock and clock-names for ssi
Shengjiu Wang [Tue, 9 Sep 2014 05:48:20 +0000 (13:48 +0800)]
ARM: dts: imx6sl: add baud clock and clock-names for ssi

Baud clock is used for bit clock generation in master mode. Ipg clock
is peripheral clock and peripheral access clock.

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
Signed-off-by: Shawn Guo <shawn.guo@freescale.com>
(cherry picked from commit 3269ddcbd8307fcbaf1e6bfffe65e288cc5faadb)