]> git.karo-electronics.de Git - karo-tx-linux.git/log
karo-tx-linux.git
9 years agoENGR00318063-12: ARM: imx6: enable clocks only after all parent and rate are initialized
Shawn Guo [Mon, 15 Sep 2014 11:46:55 +0000 (19:46 +0800)]
ENGR00318063-12: ARM: imx6: enable clocks only after all parent and rate are initialized

This is a forward porting of commit ebf625e1a496 (ENGR00318063-12: ARM:
imx6: enable clocks only after all parent and rate are initialized) from
imx_3.10.y to imx_3.14.y.

Signed-off-by: Shawn Guo <shawn.guo@freescale.com>
9 years agoENGR00318063-11: ARM: imx6: add return check for clock calls
Shawn Guo [Mon, 15 Sep 2014 11:39:47 +0000 (19:39 +0800)]
ENGR00318063-11: ARM: imx6: add return check for clock calls

This is a forward porting of commit 580f8c84ae81 (ENGR00318063-11: ARM:
imx6: add return check for clock calls) from imx_3.10.y to imx_3.14.y.

Signed-off-by: Shawn Guo <shawn.guo@freescale.com>
9 years agoENGR00318063-9: clk: do not allow parent switching with another mux being child
Shawn Guo [Thu, 5 Jun 2014 08:54:31 +0000 (16:54 +0800)]
ENGR00318063-9: clk: do not allow parent switching with another mux being child

When switching parent clock with another basic mux clock being its
child, a glitch might be generated and propagated to downstream clocks
through this child mux.

The patch adds a flag CLK_IS_BASIC_MUX to identify the basic mux clocks,
and prohibit the parent switching when the clock itself is the parent of
any basic mux clock.  With this check, the parent switching of a clock
has to happen before the child mux switches to this clock path.

shawn.guo: cherry-pick commit 8df4202f6a46 from imx_3.10.y

Signed-off-by: Shawn Guo <shawn.guo@freescale.com>
9 years agoENGR00318063-7: ARM: imx6q: mmdc_ch_axi clock should be non-gateable
Shawn Guo [Mon, 15 Sep 2014 13:04:54 +0000 (21:04 +0800)]
ENGR00318063-7: ARM: imx6q: mmdc_ch_axi clock should be non-gateable

Per the updated CCM chapter, there is no gate for clock mmdc_ch1_axi.
And there is a gate for mmdc_ch0_axi, but the gate also controls FABRIC
clock, which means the gate cannot be gated anyway.  That said,
implementing these two clocks as gate does not make too much sense.

Remove these two gate clocks by pointing IMX6QDL_CLK_MMDC_CH0_AXI and
IMX6QDL_CLK_MMDC_CH1_AXI to the dividers.

Signed-off-by: Shawn Guo <shawn.guo@freescale.com>
9 years agoENGR00318063-6: ARM: imx6: add CLK_SET_RATE_GATE flag for PLL clocks
Shawn Guo [Wed, 28 May 2014 07:46:44 +0000 (15:46 +0800)]
ENGR00318063-6: ARM: imx6: add CLK_SET_RATE_GATE flag for PLL clocks

The i.MX6 Reference Manual requires PLLs to be powered down before
changing its rate.  Let's add flag CLK_SET_RATE_GATE for PLLs and
audio/video dividers to enforce the check at clock core level.  So any
clk_set_rate() call from clients on these clocks will fail if the clocks
are not disabled and unprepared.

shawn.guo: cherry-pick commit 763c47cb3684 from imx_3.10.y

Signed-off-by: Shawn Guo <shawn.guo@freescale.com>
9 years agoENGR00329450 ARM: imx: set CLK_SET_RATE_GATE for gate and divider clocks
Shawn Guo [Mon, 1 Sep 2014 02:52:56 +0000 (10:52 +0800)]
ENGR00329450 ARM: imx: set CLK_SET_RATE_GATE for gate and divider clocks

A recent QSPI boot failure (5% possibility) on i.MX6SX reminds us that
the peripheral clocks are still missing the check, rate cannot be
changed when the clock is enabled due to the glitchy multiplexers.

Commit a63839445ad3 (ENGR00325423: ARM: imx: pllv3 can only be
configured when it's powered off) adds the check for PLL clocks but
misses the peripheral clocks.  The patch uses the help from clock
framework to check the condition with flag CLK_SET_RATE_GATE.

We adds flag CLK_SET_RATE_GATE for i.MX gate and divider clocks on
which the client drivers usually make clk_set_rate() call, so that the
call will fail when clock is still on instead of standing the risk of
running into glitch issue.

shawn.guo: cherry-pick commit 6487168bc783 from imx_3.10.y

Signed-off-by: Shawn Guo <shawn.guo@freescale.com>
9 years agoENGR00318063-5: ARM: imx: set CLK_SET_PARENT_GATE flag for glitchy mux clocks
Shawn Guo [Mon, 26 May 2014 08:37:25 +0000 (16:37 +0800)]
ENGR00318063-5: ARM: imx: set CLK_SET_PARENT_GATE flag for glitchy mux clocks

The mux clocks found on imx6 SoCs are all glitchy ones except
pll1_sw_clk_sel, axi_sel, periph_clk_sel and periph2_clk_sel.  When
switching parent clock of a glitchy mux without gating, a glitch could
be generated and propagated into the downstream divider, and hence locks
up the divider and results in no clock output.

To avoid the situation, the parent switching should happen only when
the clock is gated.  Add CLK_SET_PARENT_GATE flag for i.MX mux clocks,
so that clock core will make that check during clk_set_parent() call.

Since glitchless clocks do not need this flag, we create
imx_clk_mux_glitchless() without this flag for them.  The periph_clk_sel
and periph2_clk_sel are registered by imx_clk_busy_mux() which does not
set this flag anyway, so they need no change.

shawn.guo: cherry-pick commit 10bae51219b3 from imx_3.10.y

Signed-off-by: Shawn Guo <shawn.guo@freescale.com>
9 years agoENGR00318063-3: ARM: imx6sx: fix ocram_sels mux setting
Shawn Guo [Wed, 28 May 2014 05:26:33 +0000 (13:26 +0800)]
ENGR00318063-3: ARM: imx6sx: fix ocram_sels mux setting

The current imx6sx clock driver combines two mux clocks ocram_alt_sel
and ocram_sel into one, while ocram_alt_sel is a glitchy mux and
ocram_sel is a glitchless one.  Fix it to match the clock tree in
Reference Manual.

One thing clk API clients need to take care is that clk_set_parent()
can be called on glitchy ocram_alt_sel only when ocram_sel selects the
other path, i.e. periph.  Otherwise, a glitch could be generated on
ocram_alt_sel and get propagated into the divider ocram_podf.  In that
case, ocram_podf gets locked up and ocram clock has no output.

shawn.guo: cherry-pick commit a3b6793d21d9 from imx_3.10.y

Signed-off-by: Shawn Guo <shawn.guo@freescale.com>
9 years agoENGR00318063-2: ARM: imx6q: fix axi_sels mux setting
Shawn Guo [Mon, 15 Sep 2014 08:07:04 +0000 (16:07 +0800)]
ENGR00318063-2: ARM: imx6q: fix axi_sels mux setting

The current imx6q clock driver combines two mux clocks axi_alt_sel and
axi_sel into one, while axi_alt_sel is a glitchy mux and axi_sel is a
glitchless one.  Fix it to match the clock tree in Reference Manual.

shawn.guo: cherry-pick commit 973abca21604 from imx_3.10.y

Signed-off-by: Shawn Guo <shawn.guo@freescale.com>
9 years agoENGR00318063-1: ARM: imx6sl: fix clock name in ocram_sels
Shawn Guo [Wed, 28 May 2014 02:20:55 +0000 (10:20 +0800)]
ENGR00318063-1: ARM: imx6sl: fix clock name in ocram_sels

The clock IMX6SL_CLK_OCRAM_ALT_SEL is registered with name
"ocram_alt_sel", so the name in ocram_sels should be "ocram_alt_sel"
than "ocram_alt_sels".

shawn.guo: cherry-pick commit 4e8da832fd92 from imx_3.10.y

Signed-off-by: Shawn Guo <shawn.guo@freescale.com>
9 years agoARM: imx: fix shared gate clock
Shawn Guo [Mon, 7 Jul 2014 02:53:51 +0000 (10:53 +0800)]
ARM: imx: fix shared gate clock

Let's say clock A and B are two gate clocks that share the same register
bit in hardware.  Therefore they are registered as shared gate clocks
with imx_clk_gate2_shared().

In a scenario that only clock A is enabled by clk_enable(A) while B is
not used, the shared gate will be unexpectedly disabled in hardware.
It happens because clk_enable(A) increments the share_count from 0 to 1,
while clock B is unused to clock core, and therefore the core function
will just disable B by calling clk->ops->disable() directly.  The
consequence of that call is share_count is decremented to 0 and the gate
is disabled in hardware, even though clock A is still in use.

The patch fixes the issue by initializing the share_count per hardware
state and returns enable state per share_count from .is_enabled() hook,
in case it's a shared gate.

While at it, add a check in clk_gate2_disable() to ensure it's never
called with a zero share_count.

Reported-by: Fabio Estevam <fabio.estevam@freescale.com>
Fixes: f9f28cdf2167 ("ARM: imx: add shared gate clock support")
Signed-off-by: Shawn Guo <shawn.guo@freescale.com>
Tested-by: Fabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: Olof Johansson <olof@lixom.net>
[shawn.guo: cherry-pick commit 63288b721a80 from upstream]
Signed-off-by: Shawn Guo <shawn.guo@freescale.com>
9 years agoENGR00269945: ARM: enable FSL_OTP in imx_v7_defconfig
Shawn Guo [Mon, 2 Sep 2013 06:08:55 +0000 (14:08 +0800)]
ENGR00269945: ARM: enable FSL_OTP in imx_v7_defconfig

It enables FSL_OTP device driver support in imx_v7_defconfig.

Signed-off-by: Shawn Guo <shawn.guo@freescale.com>
9 years agoENGR00269945: ARM: dts: imx6: add ocotp fuse node
Shawn Guo [Mon, 2 Sep 2013 05:52:52 +0000 (13:52 +0800)]
ENGR00269945: ARM: dts: imx6: add ocotp fuse node

The ocotp also plays as a fuse device beside the system controller we
already have in device tree.  Let's add a device node for the fuse
device for imx6qdl and imx6sl.

While at it, the patch also drops "fsl,imx6q-ocotp" and
"fsl,imx6sl-ocotp" from system controller compatible string, since
it's not used, and use node name ocotp-ctrl and ocotp-fuse for system
controller and fuse device respectively.

shawn.guo: cherry-pick commit 1a8c2aef633c from imx_3.10.y, and add the
same change for imx6sx.

Signed-off-by: Shawn Guo <shawn.guo@freescale.com>
9 years agoENGR00269945: char: add fsl_otp deivce driver
Shawn Guo [Mon, 2 Sep 2013 02:20:05 +0000 (10:20 +0800)]
ENGR00269945: char: add fsl_otp deivce driver

This is a porting of fsl_otp driver from 3.0.35 kernel to 3.10.  It
cleans up the driver a little bit and adds device tree probe support.

shawn.guo: cherry-pick commit 850237dccde7 from imx_3.10.y.

Signed-off-by: Shawn Guo <shawn.guo@freescale.com>
9 years agoARM: i.MX6: add more chip revision support
Jason Liu [Tue, 5 Nov 2013 04:03:18 +0000 (12:03 +0800)]
ARM: i.MX6: add more chip revision support

Add more revision support for the new i.MX6DQ tape-out (TO1.5).  This
TO1.5 is the Rev 1.3 as documented in i.MX6DQ data sheet, because TO1.3
and TO1.4 are never revealed.

Signed-off-by: Jason Liu <r64343@freescale.com>
Signed-off-by: Shawn Guo <shawn.guo@freescale.com>
Acked-by: Sascha Hauer <s.hauer@pengutronix.de>
9 years agoENGR00277955-2 rtc: rtc-snvs: support wakeup system from freeze mode
Anson Huang [Wed, 4 Sep 2013 01:46:47 +0000 (21:46 -0400)]
ENGR00277955-2 rtc: rtc-snvs: support wakeup system from freeze mode

To support wakeup system from freeze mode of suspend,
device's irq can NOT be disabled during devices suspend,
so we need to add IRQF_NO_SUSPEND flag to irqflags.

Signed-off-by: Anson Huang <b20788@freescale.com>
[shawn.guo: cherry-pick commit 3498d807290c from imx_3.10.y]
Signed-off-by: Shawn Guo <shawn.guo@freescale.com>
9 years agoENGR00277955-1 keyboard: gpio_keys: support wakeup system from freeze mode
Anson Huang [Wed, 4 Sep 2013 01:43:48 +0000 (21:43 -0400)]
ENGR00277955-1 keyboard: gpio_keys: support wakeup system from freeze mode

To support wakeup system from freeze mode of suspend,
device's irq can NOT be disabled during devices suspend,
so we need to add IRQF_NO_SUSPEND flag to irqflags.

Signed-off-by: Anson Huang <b20788@freescale.com>
[shawn.guo: cherry-pick commit 1eb907e9e5d9 from imx_3.10.y]
Signed-off-by: Shawn Guo <shawn.guo@freescale.com>
9 years agoENGR00281813 input: mma8450: evbug module will keep print message.
Luwei Zhou [Fri, 20 Dec 2013 02:23:39 +0000 (10:23 +0800)]
ENGR00281813 input: mma8450: evbug module will keep print message.

evbug will open the mma8450 on i.MX6SL_EVK and mma8450 will work in 2G mode by default.
That is the reason why mma8450 logs will be printed out. The main changes is below:

 * Remove the open(), close() hook out of the drivers. The open() and close()
   hook in input framwork is defined as void type. It isn't strictly safe in
   logic when some error happends. So remove them out.
 * Modify the mma8450 to standby mode by default. It will be more power saving
   and there would be no log printing out after booting up.
 * Provide the sys interface to modify the mma8450 work modes. Then the higher
   layer can modify the the mma8450 work mode via the interface. It would be
   much safer.There would be a sclaemode interface in the folder of
   /sys/devices/soc0/soc.1/2100000.aips-bus/21a0000.i2c/i2c-0/0-001c/scalemode
   User can use cat to read the current scalemode and echo to write. The mode
   is defined as: MODE_STANDBY: 0  MODE_2G:1  MODE_4G:2  MODE_8G:3
 * Add mutex to protect and some error handling.

Signed-off-by: Luwei Zhou <b45643@freescale.com>
(cherry picked from commit c51a786078fd569ce95eb6dcf09c76d1b3c0f172)

9 years agoENGR00277864 input: mma8450: Add chip id check in probe
Luwei Zhou [Tue, 3 Sep 2013 09:32:55 +0000 (17:32 +0800)]
ENGR00277864 input: mma8450: Add chip id check in probe

Add chip ID check in probe function. The mma8450 is
on the E-INK daughter board. When the daughter board
is not pluged, there would be polling error log
continuously. Add the check to avoid this.

Signed-off-by: Luwei Zhou <b45643@freescale.com>
(cherry picked from commit e9f2c4cf673dee1527925f30a9f3fd137d9799ad)

9 years agoENGR00321358-2 dts: imx6sx: change m_can message ram to a small size
Dong Aisheng [Fri, 4 Jul 2014 14:01:55 +0000 (22:01 +0800)]
ENGR00321358-2 dts: imx6sx: change m_can message ram to a small size

We met an issue that access the 0x2600 offset of message ram
does not work although the mx6sx spec claims a 16KB size.
The reason is still unkown.
Change the RAM size to a small size to use the first 2K
to avoid such issue.

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

9 years agoENGR00321358-1 can: m_can: fix incorrect buffer offset
Dong Aisheng [Fri, 4 Jul 2014 13:59:40 +0000 (21:59 +0800)]
ENGR00321358-1 can: m_can: fix incorrect buffer offset

Each buffer offset already contains the mram_off, so do not
need add mram_off again.

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

9 years agoENGR00320354-2 can: m_can: add loopback and monitor mode support
Dong Aisheng [Thu, 26 Jun 2014 09:27:58 +0000 (17:27 +0800)]
ENGR00320354-2 can: m_can: add loopback and monitor mode support

add loopback and monitor mode support.

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

9 years agoENGR00320354-1 can: m_can: add bus error handling
Dong Aisheng [Wed, 25 Jun 2014 12:05:19 +0000 (20:05 +0800)]
ENGR00320354-1 can: m_can: add bus error handling

Add bus error, state change, lost message handling mechanism.

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

9 years agoENGR00319455-4 imx_v7_defconfig: enable canfd by default
Dong Aisheng [Thu, 19 Jun 2014 11:19:44 +0000 (19:19 +0800)]
ENGR00319455-4 imx_v7_defconfig: enable canfd by default

enable canfd by default.
The defconfig is generated by make ARCH=arm savedefconfig
which got the uneeded CONFIG_USB_PHY removed.

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

9 years agoENGR00319455-3 dts: imx6sx-sdb: add canfd support
Dong Aisheng [Thu, 19 Jun 2014 11:16:51 +0000 (19:16 +0800)]
ENGR00319455-3 dts: imx6sx-sdb: add canfd support

Introduce a new dtb imx6sx-sdb-canfd.dtb due to pin conflict with flexcan.

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

9 years agoENGR00319455-2 imx6sx: enable can transceiver by default for canfd
Dong Aisheng [Thu, 19 Jun 2014 11:15:34 +0000 (19:15 +0800)]
ENGR00319455-2 imx6sx: enable can transceiver by default for canfd

Switch on the transceiver by default for board with canfd enabled
since canfd driver does not handle it.
Two CAN instances share the same switch.

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

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)