]> git.karo-electronics.de Git - karo-tx-linux.git/log
karo-tx-linux.git
9 years agonet: fec: optimize the clock management to save power
Nimrod Andy [Tue, 20 May 2014 05:22:51 +0000 (13:22 +0800)]
net: fec: optimize the clock management to save power

Add below clock management to save fec power:
- After probe, disable all clocks incluing ipg, ahb, enet_out, ptp clock.
- Open ethx interface enable necessary clocks.
  Close ethx interface disable all clocks.

The patch also encapsulates the all enet clocks enable/disable to
.fec_enet_clk_enable(), which can reduce the repetitional code in
driver.

Signed-off-by: Fugang Duan <B38611@freescale.com>
Acked-by: Frank Li <Frank.li@freescale.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet: fec: make sure to init MAC address
Lucas Stach [Sun, 30 Mar 2014 19:32:08 +0000 (21:32 +0200)]
net: fec: make sure to init MAC address

Though we made sure to acquire a valid MAC for
the netdevice we never actually programmed it
into the hardware.
So if the bootloader did not set the MAC,
network operation would only work if userspace
explicitly asked to transfer the MAC to hardware.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agofec: remove empty MDIO bus function
Florian Fainelli [Thu, 27 Mar 2014 01:07:18 +0000 (18:07 -0700)]
fec: remove empty MDIO bus function

fec_enet_mdio_reset() does nothing useful and is optional for the MDIO
bus code, so let's just remove it.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agofec: Call dev_kfree_skb_any instead of kfree_skb.
Eric W. Biederman [Sun, 16 Mar 2014 00:12:53 +0000 (17:12 -0700)]
fec: Call dev_kfree_skb_any instead of kfree_skb.

Replace kfree_skb with dev_kfree_skb_any in fec_enet_start_xmit that
can be called in hard irq and other contexts, when the packet is
dropped.

Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
9 years agonet: Add a software TSO helper API
Ezequiel Garcia [Mon, 19 May 2014 16:59:52 +0000 (13:59 -0300)]
net: Add a software TSO helper API

Although the implementation probably needs a lot of work, this initial API
allows to implement software TSO in mvneta and mv643xx_eth drivers in a not
so intrusive way.

Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet: fix circular dependency in of_mdio code
Daniel Mack [Fri, 27 Jun 2014 23:23:35 +0000 (01:23 +0200)]
net: fix circular dependency in of_mdio code

Commit 86f6cf4127 (net: of_mdio: add of_mdiobus_link_phydev()) introduced a
circular dependency between libphy and of_mdio.

depmod: ERROR: <modroot>/kernel/drivers/net/phy/libphy.ko in
dependency cycle!
depmod: ERROR: <modroot>/kernel/drivers/of/of_mdio.ko in dependency cycle!

The problem is that of_mdio.c references &mdio_bus_type and libphy now
references of_mdiobus_link_phydev.

Fix this by not exporting of_mdiobus_link_phydev() from of_mdio.ko.
Make it a static function in mdio_bus.c instead.

Signed-off-by: Daniel Mack <zonque@gmail.com>
Reported-by: Jeff Mahoney <jeffm@suse.com>
Fixes: 86f6cf4127 (net: of_mdio: add of_mdiobus_link_phydev())
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agoof: mdio: fixup of_phy_register_fixed_link parsing of new bindings
Richard Retanubun [Fri, 20 Jun 2014 14:11:07 +0000 (10:11 -0400)]
of: mdio: fixup of_phy_register_fixed_link parsing of new bindings

Fixes commit 3be2a49e5c08 ("of: provide a binding for fixed link PHYs")

Fix the parsing of the new fixed link dts bindings for duplex,
pause, and asym_pause by using the correct device node pointer.

Signed-off-by: Richard Retanubun <rretanubun.work@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agoof: of_mdio: export symbol of_mdiobus_link_phydev
Daniel Mack [Mon, 2 Jun 2014 11:32:46 +0000 (13:32 +0200)]
of: of_mdio: export symbol of_mdiobus_link_phydev

Make of_mdiobus_link_phydev externally available.
This fixes CONFIG_OF_MDIO=m.

Signed-off-by: Daniel Mack <zonque@gmail.com>
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Fixes: 86f6cf41272 ("net: of_mdio: add of_mdiobus_link_phydev()")
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet: of_mdio: use int type for address variable
Daniel Mack [Mon, 2 Jun 2014 11:32:45 +0000 (13:32 +0200)]
net: of_mdio: use int type for address variable

Use int rather than u32 to fix the following warning:

drivers/of/of_mdio.c:147 of_mdiobus_register() warn: unsigned 'addr' is
never less than zero.

Signed-off-by: Daniel Mack <zonque@gmail.com>
Fixes: 8f8382888cba ("net: of_mdio: factor out code to parse a phy's 'reg' property")
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet: of_mdio: don't store the length of a property if we don't need to
Daniel Mack [Sat, 24 May 2014 07:34:27 +0000 (09:34 +0200)]
net: of_mdio: don't store the length of a property if we don't need to

of_get_property() can be called with NULL as 2nd argument if the caller
is not interested in the length of a property. Use that here so we can
get rid of a variable.

Signed-off-by: Daniel Mack <zonque@gmail.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet: of_mdio: add of_mdiobus_link_phydev()
Daniel Mack [Sat, 24 May 2014 07:34:26 +0000 (09:34 +0200)]
net: of_mdio: add of_mdiobus_link_phydev()

Add a function to walk the list of subnodes of a mdio bus and look for
a node that matches the phy's address with its 'reg' property. If found,
set the of_node pointer for the phy. This allows auto-probed pyh
devices to be augmented by information passed in via DT.

Signed-off-by: Daniel Mack <zonque@gmail.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet: of_mdio: factor out code to parse a phy's 'reg' property
Daniel Mack [Sat, 24 May 2014 07:34:25 +0000 (09:34 +0200)]
net: of_mdio: factor out code to parse a phy's 'reg' property

Factor out some logic into of_mdio_parse_addr() so it can be reused
later. While at it, use of_property_read_u32() rather than open-coding
the same logic again.

Signed-off-by: Daniel Mack <zonque@gmail.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agoof: mdio: fix compile warning in of_mdiobus_register_phy()
Christian Engelmayer [Fri, 23 May 2014 21:33:55 +0000 (23:33 +0200)]
of: mdio: fix compile warning in of_mdiobus_register_phy()

Commit de906af1 (net: phy: make of_set_phy_supported work with genphy driver)
removed the last user of variable 'max_speed' in function
of_mdiobus_register_phy(), leading to compile warning "unused variable
‘max_speed’ [-Wunused-variable]". Thus remove it.

Signed-off-by: Christian Engelmayer <cengelma@gmx.at>
Acked-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet: phy: make of_set_phy_supported work with genphy driver
Sascha Hauer [Wed, 21 May 2014 13:29:45 +0000 (15:29 +0200)]
net: phy: make of_set_phy_supported work with genphy driver

of_set_phy_supported allows overwiting hardware capabilities of
a phy with values from the devicetree. of_set_phy_supported is
called right after phy_device_register in the assumption that
phy_probe is called from phy_device_register and the features
of the phy are already initialized. For the genphy driver this
is not true, here phy_probe is called later during phy_connect
time. phy_probe will then overwrite all settings done from
of_set_phy_supported
Fix this by moving of_set_phy_supported to the core phy code
and calling it from phy_probe.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agoof: mdio: remove of_phy_connect_fixed_link
Florian Fainelli [Thu, 22 May 2014 16:47:50 +0000 (09:47 -0700)]
of: mdio: remove of_phy_connect_fixed_link

All in-tree drivers have been converted to use the new pair of
functions: of_is_fixed_phy_link() plus of_phy_register_fixed_link(), we
can now safely remove of_phy_connect_fixed_link.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agoof: provide a binding for fixed link PHYs
Thomas Petazzoni [Fri, 16 May 2014 14:14:05 +0000 (16:14 +0200)]
of: provide a binding for fixed link PHYs

Some Ethernet MACs have a "fixed link", and are not connected to a
normal MDIO-managed PHY device. For those situations, a Device Tree
binding allows to describe a "fixed link" using a special PHY node.

This patch adds:

 * A documentation for the fixed PHY Device Tree binding.

 * An of_phy_is_fixed_link() function that an Ethernet driver can call
   on its PHY phandle to find out whether it's a fixed link PHY or
   not. It should typically be used to know if
   of_phy_register_fixed_link() should be called.

 * An of_phy_register_fixed_link() function that instantiates the
   fixed PHY into the PHY subsystem, so that when the driver calls
   of_phy_connect(), the PHY device associated to the OF node will be
   found.

These two additional functions also support the old fixed-link Device
Tree binding used on PowerPC platforms, so that ultimately, the
network device drivers for those platforms could be converted to use
of_phy_is_fixed_link() and of_phy_register_fixed_link() instead of
of_phy_connect_fixed_link(), while keeping compatibility with their
respective Device Tree bindings.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Tested-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agoof_mdio: Allow the DT to specify the phy ID and avoid autoprobing
Jason Gunthorpe [Wed, 19 Mar 2014 22:15:24 +0000 (16:15 -0600)]
of_mdio: Allow the DT to specify the phy ID and avoid autoprobing

This makes the generic of_mdiobus_register parse the DT compatible string for
the pattern ethernet-phy-idAAAA.BBBB. If present it should be a value that
matches the phy-id register normally readable through MDIO.

When the ID is given the phy autoprobing is defeated and the phy is
created directly.

This is necessary to support phy's that cannot be autoprobed when
of_mdiobus_register is called. Specifically, my case has the phy in reset at
of_mdiobus_register, the reset is only released once the ethernet driver
starts, before it attaches to the phy.

Tested on ARM Kirkwood with phy id 0x01410e90 (Marvell 88E1318)

Signed-off-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
Acked-by: Florian Fainelli <f.fainelli@gmail.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agoENGR00278504-5 imx_v7_defconfig: enable CONFIG_LOCALVERSION_AUTO
Dong Aisheng [Fri, 6 Sep 2013 03:30:44 +0000 (11:30 +0800)]
ENGR00278504-5 imx_v7_defconfig: enable CONFIG_LOCALVERSION_AUTO

Used for uniquely identify a kernel version.

Signed-off-by: Dong Aisheng <b29396@freescale.com>
[shawn.guo: cherry-pick commit 299d71ff7241 from imx_3.10.y]
Signed-off-by: Shawn Guo <shawn.guo@freescale.com>
9 years agoENGR00318063-14: ARM: imx6sx: set pll2_bus as the default parent of QSPI clock
Shawn Guo [Fri, 27 Jun 2014 08:32:46 +0000 (16:32 +0800)]
ENGR00318063-14: ARM: imx6sx: set pll2_bus as the default parent of QSPI clock

We already know that pll2_bus is the best parent of QSPI clock.  Let's
set it up in clock initialization as the default, so that we can save
those implicit parent switching and rate changing calls from clock
framework.

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

Signed-off-by: Shawn Guo <shawn.guo@freescale.com>
9 years agoENGR00318063-13: ARM: imx: do not reparent during clk_set_rate
Shawn Guo [Fri, 27 Jun 2014 04:39:54 +0000 (12:39 +0800)]
ENGR00318063-13: ARM: imx: do not reparent during clk_set_rate

Without flag CLK_SET_RATE_NO_REPARENT, during clk_set_rate call, clock
framework will spontaneously switch parent if there is another parent
clock which can provide a better rate.  Such implicit clock reparent
sometimes results in unexpected clock tree topology change.  Also, with
flag CLK_SET_PARENT_GATE in place, the clk_set_rate() can fail due to
this spontaneous clock switch.  So let's stop clock framework from doing
this spontaneous reparent by adding flag CLK_SET_RATE_NO_REPARENT for
mux clocks.

While at it, adds the missing CLK_SET_PARENT_GATE flag for the fixup mux
clock also.

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

Signed-off-by: Shawn Guo <shawn.guo@freescale.com>
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)