]> git.karo-electronics.de Git - karo-tx-linux.git/log
karo-tx-linux.git
9 years agoENGR00331508-2 ARM: dts: i.mx6q/dl/sx: Add mag3110 device tree support.
Luwei Zhou [Tue, 16 Sep 2014 05:41:15 +0000 (13:41 +0800)]
ENGR00331508-2 ARM: dts: i.mx6q/dl/sx: Add mag3110 device tree support.

Add mag3110 sensor device tree support on i.MX6Q/DL/SX platform.

Signed-off-by: Luwei Zhou <b45643@freescale.com>
9 years agoENGR00331508-1 hwmon: mag3110: Add mag3110 driver support on i.MX6Q/DL/SX platform.
Luwei Zhou [Tue, 16 Sep 2014 05:05:41 +0000 (13:05 +0800)]
ENGR00331508-1 hwmon: mag3110: Add mag3110 driver support on i.MX6Q/DL/SX platform.

Add mag3110 driver support for i.MX6Q/DL/SX platform. The code derives from 3.10.y branch.

Signed-off-by: Luwei Zhou <b45643@freescale.com>
9 years agoENGR00317981 ARM: dts: imx: apply ENET IRQ workaround for sabresd board
Shawn Guo [Mon, 15 Sep 2014 03:32:40 +0000 (11:32 +0800)]
ENGR00317981 ARM: dts: imx: apply ENET IRQ workaround for sabresd board

This a forward porting of commit (ENGR00313685-15 ARM: dts: imx: apply
ENET IRQ workaround for sabresd board) from imx_3.10.y to imx_3.14.y.

Signed-off-by: Shawn Guo <shawn.guo@freescale.com>
9 years agoENGR00317981 net: fec: handle WAIT mode issue for imx6qdl
Shawn Guo [Mon, 15 Sep 2014 03:20:58 +0000 (11:20 +0800)]
ENGR00317981 net: fec: handle WAIT mode issue for imx6qdl

This is a combination of commits 919d46e37e04 (ENGR00265935 net: fec:
add pm_qos to avoid cpu enter to wait mode) and 8a12c90c9974
(ENGR00313685-14 net: fec: check workaround for FEC_QUIRK_BUG_WAITMODE)
from imx_3.10.y branch.  It's added for imx_3.14.y branch to work around
imx6qdl issue ERR006687 (ENET: Only the ENET wake-up interrupt request
can wake the system from Wait mode).

Signed-off-by: Shawn Guo <shawn.guo@freescale.com>
9 years agoENGR00331506-3 imx_v7_defconfig: enable mma8451 by default
luweizhou [Mon, 15 Sep 2014 08:36:32 +0000 (16:36 +0800)]
ENGR00331506-3 imx_v7_defconfig: enable mma8451 by default

Enable mma8451 by default.

Signed-off-by: Luwei Zhou <b45643@freescale.com>
9 years agoENGR00331506-2 ARM: dts: i.mx6q/dl/sx: Add mma8451 device tree support.
luweizhou [Mon, 15 Sep 2014 08:34:31 +0000 (16:34 +0800)]
ENGR00331506-2 ARM: dts: i.mx6q/dl/sx: Add mma8451 device tree support.

Add mma8451 sensor device tree support on i.MX6Q/DL/SX platform.

Signed-off-by: Luwei Zhou <b45643@freescale.com>
9 years agoENGR00331506-1 hwmon: mma8451: Add mma8451 driver support on i.MX6Q/DL/SX platform.
luweizhou [Mon, 15 Sep 2014 08:20:10 +0000 (16:20 +0800)]
ENGR00331506-1 hwmon: mma8451: Add mma8451 driver support on i.MX6Q/DL/SX platform.

Add mma8451 driver support for i.MX6Q/DL/SX platform. The code derives from 3.10.y branch.

Signed-off-by: Luwei Zhou <b45643@freescale.com>
9 years agoARM: dts: imx6sx: add multi-queue support enet
Frank Li [Fri, 12 Sep 2014 21:00:57 +0000 (05:00 +0800)]
ARM: dts: imx6sx: add multi-queue support enet

Enable 3 queues suppport for ethernet

Signed-off-by: Frank Li <Frank.Li@freescale.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agoARM: Documentation: Update fec dts binding doc
Frank Li [Fri, 12 Sep 2014 21:00:56 +0000 (05:00 +0800)]
ARM: Documentation: Update fec dts binding doc

    This patch update fec devicetree binding doc that add Optional
    properties "fsl,num-tx-queues" and "fsl,num-rx-queues".

Signed-off-by: Fugang Duan <B38611@freescale.com>
Signed-off-by: Frank Li <Frank.Li@freescale.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet: fec: init complete variable in early to avoid kernel dump
Fugang Duan [Fri, 12 Sep 2014 21:00:55 +0000 (05:00 +0800)]
net: fec: init complete variable in early to avoid kernel dump

Software clear the MDIO interrupt before MDIO bus access, but
MAC still generate MDIO interrupt. The issue only happen on
imx6slx chip.

CPU: 0 PID: 1 Comm: swapper/0 Not tainted 3.17.0-rc1-00399-g0bcad17 #315
Backtrace:
[<800121fc>] (dump_backtrace) from [<800124e0>] (show_stack+0x18/0x1c)
 r6:8096e534 r5:8096e534 r4:00000000 r3:00000000
[<800124c8>] (show_stack) from [<806a4c60>] (dump_stack+0x8c/0xa4)
[<806a4bd4>] (dump_stack) from [<80060ab8>] (__lock_acquire+0x1814/0x1c40)
 r6:be078000 r5:be074000 r4:be03f6e4 r3:be078000
[<8005f2a4>] (__lock_acquire) from [<800616e0>] (lock_acquire+0x70/0x84)
 r10:809ada33 r9:be010600 r8:00000096 r7:00000001 r6:be074000 r5:00000000
 r4:60000193
[<80061670>] (lock_acquire) from [<806abb20>] (_raw_spin_lock_irqsave+0x40/0x54)
 r7:00000000 r6:8005a3f8 r5:00000193 r4:be03f6d4
[<806abae0>] (_raw_spin_lock_irqsave) from [<8005a3f8>] (complete+0x1c/0x4c)
 r6:80950904 r5:be03f6d0 r4:be03f6d4
[<8005a3dc>] (complete) from [<8041b4c0>] (fec_enet_interrupt+0x128/0x164)
 r6:80950904 r5:00800000 r4:be03f000 r3:00000000
[<8041b398>] (fec_enet_interrupt) from [<8006aeac>] (handle_irq_event_percpu+0x38/0x13c)
 r6:00000000 r5:be01065c r4:be399e00 r3:8041b398
[<8006ae74>] (handle_irq_event_percpu) from [<8006aff4>] (handle_irq_event+0x44/0x64)
 r10:be03f000 r9:80989fe0 r8:00000000 r7:00000096 r6:be399e00 r5:be01065c
 r4:be010600
[<8006afb0>] (handle_irq_event) from [<8006e3e8>] (handle_fasteoi_irq+0xc8/0x1bc)
 r6:8096e764 r5:be01065c r4:be010600 r3:00000000
[<8006e320>] (handle_fasteoi_irq) from [<8006a63c>] (generic_handle_irq+0x30/0x44)
 r6:be074010 r5:80945e4c r4:00000096 r3:8006e320
[<8006a60c>] (generic_handle_irq) from [<8000f218>] (handle_IRQ+0x54/0xbc)
 r4:80950d74 r3:00000180
[<8000f1c4>] (handle_IRQ) from [<800086cc>] (gic_handle_irq+0x30/0x68)
 r8:be3ab478 r7:c080e100 r6:be075bd8 r5:80950eec r4:c080e10c r3:000000a0
[<8000869c>] (gic_handle_irq) from [<80013064>] (__irq_svc+0x44/0x5c)

Signed-off-by: Fugang Duan <B38611@freescale.com>
Signed-off-by: Frank Li <Frank.Li@freescale.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet: fec: change FEC alignment according to i.mx6 sx requirement
Fugang Duan [Fri, 12 Sep 2014 21:00:54 +0000 (05:00 +0800)]
net: fec: change FEC alignment according to i.mx6 sx requirement

i.MX6 SX change FEC alignment requirement.
i.MX6 SX change internal bus from AHB to AXI.
It require RX buffer must be 64 bytes alignment.
And remove TX buffer alignment requirement.

Signed-off-by: Fugang Duan <B38611@freescale.com>
Signed-off-by: Frank Li <Frank.Li@freescale.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet:fec: Add fsl,imx6sx-fec compatible strings
Fugang Duan [Fri, 12 Sep 2014 21:00:53 +0000 (05:00 +0800)]
net:fec: Add fsl,imx6sx-fec compatible strings

Add compatible string "fsl,imx6sx-fec" for i.MX6SX.

Signed-off-by: Fugang Duan <B38611@freescale.com>
Signed-off-by: Frank Li <Frank.Li@freescale.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet: fec: add enet-avb IP support
Frank Li [Fri, 12 Sep 2014 21:00:52 +0000 (05:00 +0800)]
net: fec: add enet-avb IP support

i.MX6SX Enet-AVB support 3 tx queues, 3 rx queues.
For tx queues: ring 0 -> best effort
       ring 1 -> Class A
       ring 2 -> Class B
For rx queues:
       ring 0 -> best effort
       ring 1 -> receive VLAN packet with classification match
       ring 2 -> receive VLAN packet with classification match

Add enet-avb IP multiqueue support for the driver.

Signed-off-by: Fugang Duan <B38611@freescale.com>
Signed-off-by: Frank Li <Frank.Li@freescale.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet:fec: Disable enet-avb MAC instead of reset MAC
Fugang Duan [Fri, 12 Sep 2014 21:00:51 +0000 (05:00 +0800)]
net:fec: Disable enet-avb MAC instead of reset MAC

For i.MX6SX enet use AXI bus, reset MAC will make system bus dead
if ENET-AXI bus has pending access (AHB bus should not have such issue).
So, disable enet with AVB MAC instead of reset MAC itself.

Signed-off-by: Fugang Duan <B38611@freescale.com>
Signed-off-by: Frank Li <Frank.Li@freescale.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet: fec: init multi queue date structure
Frank Li [Fri, 12 Sep 2014 21:00:50 +0000 (05:00 +0800)]
net: fec: init multi queue date structure

initilized all queues according to queue number get from DT file.

Signed-off-by: Frank Li <Frank.Li@freescale.com>
Signed-off-by: Duan Fugang <B38611@freescale.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet: fec: parser max queue number from dt file
Fugang Duan [Fri, 12 Sep 2014 21:00:49 +0000 (05:00 +0800)]
net: fec: parser max queue number from dt file

By default, the tx/rx queue number is 1, user can config the queue number
at DTS file like this:
fsl,num-tx-queues=<3>;
fsl,num-rx-queues=<3>

Since i.MX6SX enet-AVB IP support multi queues, so use multi queues
interface to allocate and set up an Ethernet device.

Signed-off-by: Fugang Duan <B38611@freescale.com>
Signed-off-by: Frank Li <Frank.Li@freescale.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet: fec: change data structure to support multiqueue
Fugang Duan [Fri, 12 Sep 2014 21:00:48 +0000 (05:00 +0800)]
net: fec: change data structure to support multiqueue

This patch just change data structure to support multi-queue.
Only 1 queue enabled.

Ethernet multiqueue mechanism can improve performance in SMP system.
For single hw queue, multiqueue can balance cpu loading.
For multi hw queues, multiple cores can process network packets in parallel,
and refer the article for the detail advantage for multiqueue:
http://vger.kernel.org/~davem/davem_nyc09.pdf

Signed-off-by: Fugang Duan <B38611@freescale.com>
Signed-off-by: Frank Li <frank.li@freescale.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet:fec: add enet AVB feature macro define for imx6sx
Fugang Duan [Fri, 12 Sep 2014 21:00:47 +0000 (05:00 +0800)]
net:fec: add enet AVB feature macro define for imx6sx

Add enet AVB feature macro define for imx6sx.

Signed-off-by: Fugang Duan <B38611@freescale.com>
Signed-off-by: Frank Li <Frank.Li@freescale.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet:fec: add enet refrence clock for i.MX 6SX chip
Fugang Duan [Fri, 12 Sep 2014 21:00:46 +0000 (05:00 +0800)]
net:fec: add enet refrence clock for i.MX 6SX chip

i.MX6sx enet has below clocks for user config:
clk_ipg: ipg_clk_s, ipg_clk_mac0_s, 66Mhz
clk_ahb: enet system clock, it is enet AXI clock for imx6sx.
 For imx6sx, it alos is the clock source of interrupt coalescing.
 The clock range: 200Mhz ~ 266Mhz.
clk_ref: refrence clock for tx and rx. For imx6sx enet RGMII mode,
 the refrence clock is 125Mhz coming from internal PLL or external.
 In i.MX6sx-arm2 board, the clock is from internal PLL.
 clk_ref is optional, depends on board.
clk_enet_out: The clock can be output from internal PLL. It can supply 50Mhz
 clock for phy. clk_enet_out is optional, depends on chip and board.
clk_ptp: 1588 ts clock. It is optional, depends on chip.

The patch add clk_ref to distiguish the different clocks.

Signed-off-by: Fugang Duan <B38611@freescale.com>
Signed-off-by: Frank Li <Frank.Li@freescale.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet: fec: ptp: avoid register access when ipg clock is disabled
Nimrod Andy [Thu, 21 Aug 2014 09:09:38 +0000 (17:09 +0800)]
net: fec: ptp: avoid register access when ipg clock is disabled

The current kernel hang on i.MX6SX with rootfs mount from MMC.
The root cause is that ptp uses a periodic timer to access enet register
even if ipg clock is disabled.

FEC ptp driver start one period timer to read 1588 counter register in the
ptp init function that is called after FEC driver is probed.

To save power, after FEC probe finish, FEC driver disable all clocks including
ipg clock that is needed for register access.

i.MX5x, i.MX6q/dl/sl FEC register access don't cause system hang when ipg clock
is disabled, just return zero value. But for i.MX6sx SOC, it cause system hang.

To avoid the issue, we need to check ptp clock status before ptp timer count access.

Signed-off-by: Fugang Duan <B38611@freescale.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet: fec: Support phys probed from devicetree and fixed-link
Uwe Kleine-König [Mon, 11 Aug 2014 15:35:33 +0000 (17:35 +0200)]
net: fec: Support phys probed from devicetree and fixed-link

This adds support for specifying the phy to be used with the fec in the
devicetree using the standard phy-handle property and also supports
fixed-link.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agofec: Simplify the PM related hooks
Fabio Estevam [Thu, 24 Jul 2014 21:24:01 +0000 (18:24 -0300)]
fec: Simplify the PM related hooks

Get rid of the CONFIG_PM_SLEEP ifdef by annotating the suspend/resume functions
with '__maybe_unused' in order to keep the code simpler and shorter.

While at it, declare the suspend/resume functions in a single line.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet: fec: consolidate hwtstamp implementation
Russell King [Tue, 8 Jul 2014 12:02:09 +0000 (13:02 +0100)]
net: fec: consolidate hwtstamp implementation

Both transmit and receive use the same infrastructure for calculating
the packet timestamp.  Rather than duplicating the code, provide a
function to do this common work.  Model this function in the Intel
e1000e version which avoids calling ns_to_ktime() within the spinlock;
the spinlock is critical for timecounter_cyc2time() but not
ns_to_ktime().

Acked-by: Richard Cochran <richardcochran@gmail.com>
Acked-by: Fugang Duan <B38611@freescale.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet: fec: remove useless status check in tx reap path
Russell King [Tue, 8 Jul 2014 12:02:04 +0000 (13:02 +0100)]
net: fec: remove useless status check in tx reap path

Remove a useless status check in the transmit reap path - we have
already checked that the BD_ENET_TX_READY bit is clear, and as the
hardware only ever clears this bit, there is no way this test can ever
be true.

Acked-by: Fugang Duan <B38611@freescale.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet: fec: add support for dumping transmit ring on timeout
Russell King [Tue, 8 Jul 2014 12:01:59 +0000 (13:01 +0100)]
net: fec: add support for dumping transmit ring on timeout

When we timeout on transmit, it would be useful to dump the transmit
ring, so we can see the ring state.  This can be helpful to diagnose
the cause of transmit timeouts.

Acked-by: Fugang Duan <B38611@freescale.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet: fec: reorder ethtool ops to match order in struct declaration
Russell King [Tue, 8 Jul 2014 12:01:54 +0000 (13:01 +0100)]
net: fec: reorder ethtool ops to match order in struct declaration

This allows us to merge two separate preprocessor conditionals together.

Acked-by: Fugang Duan <B38611@freescale.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet: fec: clear receive interrupts before processing a packet
Russell King [Tue, 8 Jul 2014 12:01:49 +0000 (13:01 +0100)]
net: fec: clear receive interrupts before processing a packet

Clear any pending receive interrupt before we process a pending packet.
This helps to avoid any spurious interrupts being raised after we have
fully cleaned the receive ring, while still allowing an interrupt to be
raised if we receive another packet.

The position of this is critical: we must do this prior to reading the
next packet status to avoid potentially dropping an interrupt when a
packet is still pending.

Acked-by: Fugang Duan <B38611@freescale.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet: fec: replace delayed work with standard work
Russell King [Tue, 8 Jul 2014 12:01:44 +0000 (13:01 +0100)]
net: fec: replace delayed work with standard work

As of "better implementation of iMX6 ERR006358 quirk", we no longer have
a requirement for a delayed work.  Moreover, the work is now only used
for timeout purposes, so the timeout flag is also pointless - we set it
each time we queue the work, and the work clears it.

Replace the fec_enet_delayed_work struct with a standard work_struct,
resulting in simplified timeout handling code.

Acked-by: Fugang Duan <B38611@freescale.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet: fec: better implementation of iMX6 ERR006358 quirk
Russell King [Tue, 8 Jul 2014 12:01:38 +0000 (13:01 +0100)]
net: fec: better implementation of iMX6 ERR006358 quirk

Using a (delayed) workqueue for ERR006358 is not correct - a work queue
is a single-trigger device.  Once the work queue has been scheduled, it
can't be re-scheduled until it has been run.  This can cause problems -
with an appropriate packet timing, we can end up with packets queued,
but not sent by the hardware, resulting in the transmit timeout firing.

Re-implement this as per the workaround detailed in the ERR006358
documentation - if there are packets waiting to be sent when we service
the transmit ring, and we see that the transmitter is not running,
kick the transmitter to run the pending entries in the ring.

Testing here with a 10Mbit half duplex link sees the resulting iperf
TCP bandwidth increase from between 1 to 2Mbps to between 8 to 9Mbps.

Acked-by: Fugang Duan <B38611@freescale.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet: fec: clean up duplex mode handling
Russell King [Tue, 8 Jul 2014 11:40:43 +0000 (12:40 +0100)]
net: fec: clean up duplex mode handling

Many places call fec_restart() with the second parameter being some kind
of previously saved duplex value, but only two places call it with some
other setting.  This is at odds with how the other link settings are
handled, and used to be racy before the rtnl locks were added to
fec_restart()'s various call paths.

Clean this up so all link capabilities are handled in the same way -
saved into the fec_enet_private structure, and then fec_restart() acts
on those settings.

Acked-by: Fugang Duan <B38611@freescale.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet: fec: quiesce packet processing when taking link down in fec_enet_adjust_link()
Russell King [Tue, 8 Jul 2014 11:40:38 +0000 (12:40 +0100)]
net: fec: quiesce packet processing when taking link down in fec_enet_adjust_link()

When the link goes down, the adjust_link method will be called, but
there is no synchronisation to ensure that we won't be processing some
last remaining packets via the NAPI handlers while performing a reset of
the device.

Add the necessary synchronisation to ensure that packet processing
is complete before we stop and reset the FEC.

Acked-by: Fugang Duan <B38611@freescale.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet: fec: quiesce packet processing before changing features
Russell King [Tue, 8 Jul 2014 11:40:33 +0000 (12:40 +0100)]
net: fec: quiesce packet processing before changing features

Changing the features (receive checksumming) requires the hardware to be
reprogrammed, and also changes the checks in the receive packet
processing.

The current implementation has a race - fec_set_features() changes the
flags which alter the receive packet processing while the adapter is
active, and potentially receiving frames.  Only after we've modified
the software flag do we shutdown and reconfigure the hardware.

This can lead to packets being received and marked with a valid checksum
(via CHECKSUM_UNNECESSARY) when the hardware checksum validation has not
yet been enabled.

We must quiesce the device, then change the software configuration for
this feature, and then resume the device if it was previously running.

The resulting code structure also allows us to add other configuration
features in this path without having to quiesce and resume the network
interface and device.

Acked-by: Fugang Duan <B38611@freescale.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet: fec: quiesce packet processing before stopping device in fec_set_features()
Russell King [Tue, 8 Jul 2014 11:40:28 +0000 (12:40 +0100)]
net: fec: quiesce packet processing before stopping device in fec_set_features()

fec_set_features() calls fec_stop() to stop the transmit ring while the
transmit queue is still active.  This can lead to the transmit ring
being restarted by an intervening packet queued for transmission, or
by the tx quirk timer expiring.

Fix this by disabling NAPI (which ensures that the NAPI handlers are
not running), and then take the transmit lock while we stop and
restart the adapter (which prevents new packets being queued).

Acked-by: Fugang Duan <B38611@freescale.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet: fec: quiesce packet processing before stopping device in fec_suspend()
Russell King [Tue, 8 Jul 2014 11:40:23 +0000 (12:40 +0100)]
net: fec: quiesce packet processing before stopping device in fec_suspend()

fec_suspend() calls fec_stop() to stop the transmit ring while the
transmit packet processing is still active.  This can lead to the
transmit queue being restarted by an intervening packet queued for
transmission, or by the tx quirk timer expiring.

Fix this by disabling NAPI first, which will ensure that the NAPI
handlers are not running.  Then, take the transmit lock before
detaching the netif device.  This ensures that there are no races
with the transmit path - and also ensures that the watchdog won't
fire.

We can then safely stop the ethernet device itself, knowing that the
rest of the driver is safely shut down.

On resume, we bring the device back up in reverse order - we restart
the device, reattach the device (under the tx lock), and then enable
the NAPI handlers.

We also need to adjust the close function to cope with this new
sequence, so that it's possible to cleanly close down the driver
after the hardware fails to resume (eg, due to the regulator_enable()
or pinctrl calls in the resume path returning an error.)

Acked-by: Fugang Duan <B38611@freescale.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet: fec: remove inappropriate calls around fec_restart()
Russell King [Tue, 8 Jul 2014 11:40:18 +0000 (12:40 +0100)]
net: fec: remove inappropriate calls around fec_restart()

This is the second stage to "move calls to quiesce/resume packet
processing out of fec_restart()", where we remove calls which are not
appropriate to the call site.

In the majority of cases, there is no need to detach and reattach the
interface as we are holding the queue xmit lock across the reset.  The
exception to that is in fec_resume(), where we are already detached by
the suspend function.  Here, we can remove the call to detach the
interface.

We also do not need to stop the transmit queue.  Holding the xmit lock
is enough to ensure that the transmit packet processing is not running
while we perform our task.  However, since fec_restart() always cleans
the rings, we call netif_wake_queue() (or netif_device_attach() in the
case of resume) just before dropping the xmit lock.  This prevents the
watchdog firing.

Lastly, always call napi_enable() after the device has been reattached
in the resume path so that we know that the transmit packet processing
is already in an enabled state, so we don't call netif_wake_queue()
while detached.

Acked-by: Fugang Duan <B38611@freescale.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet: fec: move calls to quiesce/resume packet processing out of fec_restart()
Russell King [Tue, 8 Jul 2014 11:40:12 +0000 (12:40 +0100)]
net: fec: move calls to quiesce/resume packet processing out of fec_restart()

Move the calls to quiesce and resume packet processing out of
fec_restart() to its call sites.  This is the first step in a two stage
clean up of this code, where we just move the calls out of fec_restart()
without changing them.  Not everywhere needs to issue these calls, and
not everywhere needs all of these calls to be issued.

Acked-by: Fugang Duan <B38611@freescale.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet: fec: only restart or stop the device if it is present and running
Russell King [Tue, 8 Jul 2014 11:40:07 +0000 (12:40 +0100)]
net: fec: only restart or stop the device if it is present and running

Avoid calling fec_restart() or fec_stop() while the device is down
or not present (iow suspended.)

Although the ndo_timeout method will only be called if the device is
present and running, we defer this to a work queue.  The work queue
can run independently, and so needs to repeat these checks to ensure
that a restart doesn't occur after the device has been taken down or
detached for suspend.  In this case, we call fec_restart() in the
resume path, so nothing is lost.

For fec_set_features, we add a call to fec_restart() in fec_enet_open()
to ensure that the hardware is appropriate programmed when the interface
is opened.  fec_set_features() call should not occur while we're
suspended, so we don't have to worry about that case.

The adjust_link needs similar treatment - this also is called from a
work queue, which may be run independently after we have taken the
device down and detached it.  In this case, we just mark the link
down and take no further action.  We will reset things appropriately
once the device is up and running again, at which point we will receive
another adjust_link callback.

Acked-by: Fugang Duan <B38611@freescale.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet: fec: ensure fec_enet_close() copes with resume failure
Russell King [Tue, 8 Jul 2014 11:40:02 +0000 (12:40 +0100)]
net: fec: ensure fec_enet_close() copes with resume failure

When the FEC is suspended, the device is detached.  Upon resume failure,
the device is left in detached mode, possibly with some of the required
clocks not running.  We don't want to be poking the device in that state
because as it may cause bus errors.

If the device is marked detached, avoid calling fec_stop().

This depends upon: "net:fec: improve safety of suspend/resume paths"

Acked-by: Fugang Duan <B38611@freescale.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet: fec: improve safety of suspend/resume/transmit timeout paths
Russell King [Tue, 8 Jul 2014 11:39:57 +0000 (12:39 +0100)]
net: fec: improve safety of suspend/resume/transmit timeout paths

We should hold the rtnl lock while suspending, resuming or processing
the transmit timeout to ensure that nothing will interfere while we
bring up, take down or restart the hardware.  The transmit timeout
could run if we're preempted during suspend.

Acked-by: Fugang Duan <B38611@freescale.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet: fec: fix missing kmalloc() failure check in fec_enet_alloc_buffers()
Russell King [Mon, 7 Jul 2014 23:23:30 +0000 (00:23 +0100)]
net: fec: fix missing kmalloc() failure check in fec_enet_alloc_buffers()

fec_enet_alloc_buffers() assumes that kmalloc() will never fail, which
is an invalid assumption.  Fix this by implementing a common error
cleanup path, and use it to also clean up after failed bounce buffer
allocation.

Acked-by: Fugang Duan <B38611@freescale.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet: fec: ensure fec_enet_free_buffers() properly cleans the rings
Russell King [Mon, 7 Jul 2014 23:23:25 +0000 (00:23 +0100)]
net: fec: ensure fec_enet_free_buffers() properly cleans the rings

Ensure that we do not double-free any allocations, and that any transmit
skbuffs are properly freed when we clean up the rings.

Acked-by: Fugang Duan <B38611@freescale.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet: fec: clean up transmit descriptor setup
Russell King [Mon, 7 Jul 2014 23:23:19 +0000 (00:23 +0100)]
net: fec: clean up transmit descriptor setup

Avoid writing any state until we're certain we can proceed with the
transmission: this avoids writing mapping error address values to the
descriptors, or setting the skbuff pointer until we have successfully
mapped the skb.

Acked-by: Fugang Duan <B38611@freescale.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet: fec: make rx skb handling more robust
Russell King [Mon, 7 Jul 2014 23:23:14 +0000 (00:23 +0100)]
net: fec: make rx skb handling more robust

Allocate, and then map the receive skb before writing any data to the
ring descriptor or storing the skb.  When freeing the receive ring
entries, unmap and free the skb, and then clear the stored skb pointer.

This means we have ring data and skb pointer in one of two states:
either both fully setup, or nothing setup.

This simplifies the cleanup, as we can use just the skb pointer to
indicate whether the descriptor is setup, and thus avoids potentially
calling dma_unmap_single() on a DMA error value.

Acked-by: Fugang Duan <B38611@freescale.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet: fec: remove useless fep->opened
Russell King [Mon, 7 Jul 2014 23:23:09 +0000 (00:23 +0100)]
net: fec: remove useless fep->opened

napi_disable() waits until the NAPI processing has completed, and then
prevents any further polls.  At this point, the driver then clears
fep->opened.  The NAPI poll function uses this to stop processing in
the receive path.  Hence, it will never see this variable cleared,
because the NAPI poll has to complete before it will be cleared.

Therefore, this variable serves no purpose, so let's remove it.

Acked-by: Fugang Duan <B38611@freescale.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet: fec: stop the phy before shutting down the MAC
Russell King [Mon, 7 Jul 2014 23:23:04 +0000 (00:23 +0100)]
net: fec: stop the phy before shutting down the MAC

When the network interface goes down, stop the phy to prevent further
link up status changes before taking the MAC or netif sections down.
This prevents further reception of link up events which could
potentially call fec_restart().

Since phy_stop() takes the mutex which adjust_link() runs under, we
also ensure that adjust_link() will not already be processing a link
up event.

We also need to do this when suspending as well - we don't want a
mis-timed phy state change to restart the MAC after we have stopped
it for suspend, and thus need to restart the phy when resuming.

Acked-by: Fugang Duan <B38611@freescale.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet: fec: ensure that a disconnected phy isn't configured
Russell King [Mon, 7 Jul 2014 23:22:59 +0000 (00:22 +0100)]
net: fec: ensure that a disconnected phy isn't configured

When we disconnect from a phy, we should forget our pointer to it so we
don't accidentally try to configure it.  We handle a NULL phy pointer
correctly in most places, except fec_enet_set_pauseparam().  Fix this
too.

Acked-by: Fugang Duan <B38611@freescale.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet: fec: remove checking for NULL phy_dev in fec_enet_close()
Russell King [Mon, 7 Jul 2014 23:22:54 +0000 (00:22 +0100)]
net: fec: remove checking for NULL phy_dev in fec_enet_close()

fep->phy_dev can not be NULL here for two reasons:
- fec_enet_open() will have successfully connected the phy, or will have
  failed.
- fec_enet_open() will have called phy_start(fep->phy_dev), which
  unconditionally dereferences this pointer.

If it were to be NULL here, then fec_enet_open() will have already
oopsed.

Acked-by: Fugang Duan <B38611@freescale.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet: fec: use netif_tx_disable() rather than netif_stop_queue()
Russell King [Mon, 7 Jul 2014 23:22:49 +0000 (00:22 +0100)]
net: fec: use netif_tx_disable() rather than netif_stop_queue()

We use netif_stop_queue() in several places where we want to ensure that
the start_xmit function is not running.  netif_stop_queue() is not
sufficient to achieve that - it merely sets a flag to indicate that the
transmit queue(s) should not be run.

netif_tx_disable() gives this guarantee, since it takes the transmit
queue lock while marking the queue stopped.  This will wait for the
transmit function to complete before returning.

Acked-by: Fugang Duan <B38611@freescale.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet: fec: fix interrupt handling races
Russell King [Mon, 7 Jul 2014 23:22:44 +0000 (00:22 +0100)]
net: fec: fix interrupt handling races

While running: while :; do iperf -c <HOST> -P 4; done, transmit timeouts
are regularly reported.  With the tx ring dumping in place, we can see
that all entries are in use, and the hardware has finished transmitting
these packets.  However, the driver has not reclaimed these ring
entries.

This can occur if the interrupt handler is invoked at the wrong moment -
eg:

CPU0 CPU1
fec_enet_tx()
interrupt, IEVENT = FEC_ENET_TXF
FEC_ENET_TXF cleared
napi_schedule_prep()
napi_complete()

The result is that we clear the transmit interrupt, but we don't trigger
any cleaning of the transmit ring.  Instead, use a different strategy:

- When receiving a transmit or receive interrupt, disable both tx and rx
  interrupts, but do not acknowledge them.  Schedule a napi poll.  Don't
  loop.

- When we are polled, read IEVENT, acknowledging the pending transmit
  and receive interrupts, before then going on to process the
  appropriate rings.

This allows us to avoid the race, and has a number of other advantages:
- we cut down on the number of transmit interrupts we have to process.
- we only look at the rings which have pending events.
- we gain additional throughput: the iperf total bandwidth increases
  from about 180Mbps to 240Mbps:

[  3]  0.0-10.0 sec  68.1 MBytes  57.0 Mbits/sec
[  5]  0.0-10.0 sec  72.4 MBytes  60.5 Mbits/sec
[  4]  0.0-10.1 sec  76.1 MBytes  63.5 Mbits/sec
[  6]  0.0-10.1 sec  71.9 MBytes  59.9 Mbits/sec
[SUM]  0.0-10.1 sec   288 MBytes   241 Mbits/sec

Acked-by: Fugang Duan <B38611@freescale.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet: fec: fix ethtool set_pauseparam duplex bug
Russell King [Mon, 7 Jul 2014 23:22:39 +0000 (00:22 +0100)]
net: fec: fix ethtool set_pauseparam duplex bug

Setting the pause parameters causes a running network interface to be
restarted.  However, the restart forces the FEC into half-duplex mode,
whether or not the remote end is in half-duplex mode.  Misconfigured
duplex mode is a known source of problems on a link.

Fix this by always preserving the duplex mode on configuration changes.

Acked-by: Fugang Duan <B38611@freescale.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet: fec: iMX6 FEC does not support half-duplex gigabit
Russell King [Mon, 7 Jul 2014 23:22:34 +0000 (00:22 +0100)]
net: fec: iMX6 FEC does not support half-duplex gigabit

The iMX6 gigabit FEC does not support half-duplex gigabit operation.
Phys attacked to the FEC may support this, and we currently do nothing
to disable this feature.  This may result in an invalid configuration.
Mask out phy support for gigabit half-duplex operation.

Acked-by: Fugang Duan <B38611@freescale.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet: fec: Don't clear IPV6 header checksum field when IP accelerator enable
Fugang Duan [Wed, 18 Jun 2014 00:33:52 +0000 (08:33 +0800)]
net: fec: Don't clear IPV6 header checksum field when IP accelerator enable

The commit 96c50caa5148 (net: fec: Enable IP header hardware checksum)
enable HW IP header checksum for IPV4 and IPV6, which causes IPV6 TCP/UDP
cannot work. (The issue is reported by Russell King)

For FEC IP header checksum function: Insert IP header checksum. This "IINS"
bit is written by the user. If set, IP accelerator calculates the IP header
checksum and overwrites the IINS corresponding header field with the calculated
value. The checksum field must be cleared by user, otherwise the checksum
always is 0xFFFF.

So the previous patch clear IP header checksum field regardless of IP frame
type.

In fact, IP HW detect the packet as IPV6 type, even if the "IINS" bit is set,
the IP accelerator is not triggered to calculates IPV6 header checksum because
IPV6 frame format don't have checksum.

So this results in the IPV6 frame being corrupted.

The patch just add software detect the current packet type, if it is IPV6
frame, it don't clear IP header checksum field.

Cc: Russell King <linux@arm.linux.org.uk>
Reported-and-tested-by: Russell King <linux@arm.linux.org.uk>
Signed-off-by: Fugang Duan <B38611@freescale.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet: fec: Add software TSO support
Nimrod Andy [Thu, 12 Jun 2014 00:16:23 +0000 (08:16 +0800)]
net: fec: Add software TSO support

Add software TSO support for FEC.
This feature allows to improve outbound throughput performance.

Tested on imx6dl sabresd board, running iperf tcp tests shows:
- 16.2% improvement comparing with FEC SG patch
- 82% improvement comparing with NO SG & TSO patch

$ ethtool -K eth0 tso on
$ iperf -c 10.192.242.167 -t 3 &
[  3] local 10.192.242.108 port 35388 connected with 10.192.242.167 port 5001
[ ID] Interval       Transfer     Bandwidth
[  3]  0.0- 3.0 sec   181 MBytes   506 Mbits/sec

During the testing, CPU loading is 30%.
Since imx6dl FEC Bandwidth is limited to SOC system bus bandwidth, the
performance with SW TSO is a milestone.

CC: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
CC: Eric Dumazet <eric.dumazet@gmail.com>
CC: David Laight <David.Laight@ACULAB.COM>
CC: Li Frank <B20596@freescale.com>
Signed-off-by: Fugang Duan <B38611@freescale.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet: fec: Add Scatter/gather support
Nimrod Andy [Thu, 12 Jun 2014 00:16:22 +0000 (08:16 +0800)]
net: fec: Add Scatter/gather support

Add Scatter/gather support for FEC.
This feature allows to improve outbound throughput performance.

Tested on imx6dl sabresd board:
Running iperf tests shows a 55.4% improvement.

$ ethtool -K eth0 sg off
$ iperf -c 10.192.242.167 -t 3 &
[  3] local 10.192.242.108 port 52618 connected with 10.192.242.167 port 5001
[ ID] Interval       Transfer     Bandwidth
[  3]  0.0- 3.0 sec  99.5 MBytes   278 Mbits/sec

$ ethtool -K eth0 sg on
$ iperf -c 10.192.242.167 -t 3 &
[  3] local 10.192.242.108 port 52617 connected with 10.192.242.167 port 5001
[ ID] Interval       Transfer     Bandwidth
[  3]  0.0- 3.0 sec   154 MBytes   432 Mbits/sec

CC: Li Frank <B20596@freescale.com>
Signed-off-by: Fugang Duan <B38611@freescale.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet: fec: Increase buffer descriptor entry number
Nimrod Andy [Thu, 12 Jun 2014 00:16:21 +0000 (08:16 +0800)]
net: fec: Increase buffer descriptor entry number

In order to support SG, software TSO, let's increase BD entry number.

CC: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
CC: Eric Dumazet <eric.dumazet@gmail.com>
CC: David Laight <David.Laight@ACULAB.COM>
Signed-off-by: Fugang Duan <B38611@freescale.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet: fec: Factorize feature setting
Nimrod Andy [Thu, 12 Jun 2014 00:16:20 +0000 (08:16 +0800)]
net: fec: Factorize feature setting

In order to enhance the code readable, let's factorize the
feature list.

Signed-off-by: Fugang Duan <B38611@freescale.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet: fec: Enable IP header hardware checksum
Nimrod Andy [Thu, 12 Jun 2014 00:16:19 +0000 (08:16 +0800)]
net: fec: Enable IP header hardware checksum

IP header checksum is calcalated by network layer in default.
To support software TSO, it is better to use HW calculate the
IP header checksum.

FEC hw checksum feature request the checksum field in frame
is zero, otherwise the calculative CRC is not correct.

For segmentated TCP packet, HW calculate the IP header checksum again,
it doesn't bring any impact. For SW TSO, HW calculated checksum bring
better performance.

Signed-off-by: Fugang Duan <B38611@freescale.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet: fec: Factorize the .xmit transmit function
Nimrod Andy [Thu, 12 Jun 2014 00:16:18 +0000 (08:16 +0800)]
net: fec: Factorize the .xmit transmit function

Make the code more readable and easy to support other features like
SG, TSO, moving the common transmit function to one api.

And the patch also factorize the getting BD index to it own function.

CC: David Laight <David.Laight@ACULAB.COM>
Signed-off-by: Fugang Duan <B38611@freescale.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agofec: Include pinctrl header file
Fabio Estevam [Mon, 2 Jun 2014 18:44:30 +0000 (15:44 -0300)]
fec: Include pinctrl header file

Commit 5bbde4d2ec ("net: fec: use pinctrl PM helpers") caused the following
build error on m68k:

drivers/net/ethernet/freescale/fec_main.c: In function 'fec_enet_open':
drivers/net/ethernet/freescale/fec_main.c:1819:2: error: implicit declaration of function 'pinctrl_pm_select_default_state' [-Werror=implicit-function-declaration]
drivers/net/ethernet/freescale/fec_main.c: In function 'fec_enet_close':
drivers/net/ethernet/freescale/fec_main.c:1863:2: error: implicit declaration of function 'pinctrl_pm_select_sleep_state' [-Werror=implicit-function-declaration]

In order to fix the build error, include the linux/pinctrl/consumer.h header
file.

Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet: fec: use pinctrl PM helpers
Nimrod Andy [Tue, 27 May 2014 07:51:08 +0000 (15:51 +0800)]
net: fec: use pinctrl PM helpers

when system suspend, need to set pins to low power state to
save IO power consumption, there are three states of pinctrl:
"default", "idle" and "sleep". Currently enet supports default
and sleep state.

Signed-off-by: Fugang Duan <B38611@freescale.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet: fec: correct the MDIO clock source
Nimrod Andy [Tue, 20 May 2014 05:23:09 +0000 (13:23 +0800)]
net: fec: correct the MDIO clock source

Since imx serials FEC/ENET MDIO clock source is internal ipg clock,
and "ahb" clock is defined as FEC/ENET bus clock, so the patch just
correct the fec driver MDIO clock source.

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: 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)