Peter Chen [Fri, 12 Dec 2014 05:29:58 +0000 (13:29 +0800)]
MLK-10088-3 usb: chipidea: usbmisc_imx: delete clock information
All imx usb controller's non core registers uses the same clock gate with
core registers, the usbmisc_imx is the library for imx glue driver, the
glue keeps clock on when it calls usbmisc_imx API to change non-core register.
Besides, we will support runtime pm in the future, it also needs to
close this clock when the usb is not in use.
Philipp Zabel also verifies it at imx6q platform, see
http://www.spinics.net/lists/linux-usb/msg118491.html
Cc: Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by: Peter Chen <peter.chen@freescale.com>
Peter Chen [Wed, 10 Dec 2014 06:49:41 +0000 (14:49 +0800)]
MLK-10088-1 usb: chipidea: udc: return immediately if re-enable non-empty endpoint
Some gadget driver (like uac1) will try to enable endpoint again even
the ep is not empty, it will cause the ep reset again and may affect
the dTD list which has already queued.
It returns -EBUSY immediately, and indicate the endpoint is in use.
In this way, the ep's behavior will not be affected, and the gadget
driver is also notified.
Cc: Xuebing Wang <xbing6@gmail.com> Signed-off-by: Peter Chen <peter.chen@freescale.com>
Antoine Tenart [Wed, 26 Nov 2014 05:44:35 +0000 (13:44 +0800)]
usb: chipidea: fix phy handling
The generic plaftorm device for ChipIdea drivers is probed by calling
ci_hdrc_probe. The device structure used is not the one of the specific
ChipIdea driver but the one of the generic ChipIdea platform device.
This results in not being able to probe the PHYs as we're not using the
right device structure. Since all ChipIdea drivers are retrieving their
PHYs in their specific driver code, this didn't impact any of them yet.
Fixes it using the right device structure (dev->parent).
Signed-off-by: Antoine Tenart <antoine.tenart@free-electrons.com> Signed-off-by: Peter Chen <peter.chen@freescale.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 21a5b579cb63364b90e545e7e0a4bccb027711e8)
Peter Chen [Wed, 26 Nov 2014 05:44:33 +0000 (13:44 +0800)]
usb: chipidea: parameter 'mode' isn't needed for hw_device_reset
The hw_device_reset is dedicated to be used at device mode initializaiton,
so delete the parameter 'mode'. For host driver, the ehci driver will
handle all things.
Signed-off-by: Peter Chen <peter.chen@freescale.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 5b1573005a91dc448e6919d6bec076bedc7e1919)
Peter Chen [Wed, 26 Nov 2014 05:44:28 +0000 (13:44 +0800)]
usb: chipidea: add hw_wait_phy_stable for getting stable status
The phy needs some delay to output the stable status from low
power mode. And for OTGSC, the status inputs are debounced
using a 1 ms time constant, so, delay 2ms for controller to get
the stable status(like vbus and id) when the phy leaves low power.
Signed-off-by: Peter Chen <peter.chen@freescale.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit b82613cf09455d9a50fbb144ef07b68225f2b452)
Arjun Sreedharan [Thu, 20 Nov 2014 15:53:36 +0000 (21:23 +0530)]
usb: phy: propagate __of_usb_find_phy()'s error on failure
When __of_usb_find_phy() fails, it returns -ENODEV - its
error code has to be returned by devm_usb_get_phy_by_phandle().
Only when the former function succeeds and try_module_get()
fails should -EPROBE_DEFER be returned.
[ balbi@ti.com : remove trailing whitespace ]
Signed-off-by: Arjun Sreedharan <arjun024@gmail.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
(cherry picked from commit 1290a958d48e30d60262a33acb5f068e87834ce4)
Peter Chen [Tue, 4 Nov 2014 03:14:31 +0000 (11:14 +0800)]
usb: core: notify disconnection when core detects disconnect
It is safe to call notify disconnect when the usb core
thinks the device is disconnected.
This commit also fixes one bug found at below situation:
we have not enabled usb wakeup, we do system suspend when
there is an usb device at the port, after suspend, we plug out
the usb device, then plug in device again. At that time,
the nofity disconnect was not called at current code, as
the controller doesn't know the usb device was disconnected
during the suspend, but USB core knows the port has changed
during that periods.
So to fix this problem, and let the usb core call notify disconnect.
Cc: 3.17+ <stable@vger.kernel.org> Signed-off-by: Peter Chen <peter.chen@freescale.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit b2108f1e519e983e5dd5712b3a44f7366ab509e4)
Tony Zheng [Fri, 17 Oct 2014 11:43:02 +0000 (19:43 +0800)]
usb: core: need to call usb_phy_notify_connect after device setup
Since we notify disconnecting based on the usb device is existed
(port_dev->child, the child device at roothub is not NULL), we
need to notify connect after device has been registered.
This fixes a bug that do fast plug in/out test, and the notify_disconnect
is not called due to roothub child is NULL and the enumeration has failed.
Cc: v3.17+ <stable@vger.kernel.org> Signed-off-by: Tony Zheng <Tony.Zheng@freescale.com> Signed-off-by: Peter Chen <peter.chen@freescale.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 01ed67dc70834d00d62b6e754ee0f76301fbc140)
The current EHCI implementation is prepared to toggle the
PORT_POWER bit to enable or disable a USB-Port. In some
cases this port power can not be just toggled by the PORT_POWER
bit, and the gpio-regulator is needed to be toggled too.
This patch defines a port power control interface ehci_port_power for
ehci core use, it toggles PORT_POWER bit as well as calls platform
defined .port_power if it is defined.
Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de> Signed-off-by: Peter Chen <peter.chen@freescale.com> Acked-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 11a7e59405148c855e0a9d13588930ccec02c150)
Antoine Tenart [Thu, 30 Oct 2014 17:41:19 +0000 (18:41 +0100)]
usb: chipidea: add support to the generic PHY framework
This patch adds support of the PHY framework for ChipIdea drivers.
Changes are done in both the ChipIdea common code and in the drivers
accessing the PHY. This is done by adding a new PHY member in
ChipIdea's structures and by taking care of it in the code.
Signed-off-by: Antoine Tenart <antoine.tenart@free-electrons.com> Acked-by: Peter Chen <peter.chen@freescale.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
(cherry picked from commit 1e5e2d3d055436c114e2f16145b83339aed024ff)
Antoine Tenart [Thu, 30 Oct 2014 17:41:16 +0000 (18:41 +0100)]
usb: allow to supply the PHY in the drivers when using HCD
This patch modify the generic code handling PHYs to allow them to be
supplied from the drivers. This adds checks to ensure no PHY was already
there when looking for one in the generic code. This also makes sure we
do not modify its state in the generic HCD functions, it was provided by
the driver.
Signed-off-by: Antoine Tenart <antoine.tenart@free-electrons.com> Acked-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Felipe Balbi <balbi@ti.com>
(cherry picked from commit ef44cb4226d132146e44f8ea562a16b27ff61126)
Antoine Tenart [Thu, 30 Oct 2014 17:41:15 +0000 (18:41 +0100)]
usb: add support to the generic PHY framework in OTG
This patch adds support of the PHY framework in OTG and keeps the USB
PHY compatibility. Here the only modification is to add PHY member in
the OTG structure, along with the USB PHY one.
Signed-off-by: Antoine Tenart <antoine.tenart@free-electrons.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
(cherry picked from commit 48bcc18076df4e07ef86226ac6ce795f64c84f7f)
Antoine Tenart [Thu, 30 Oct 2014 17:41:14 +0000 (18:41 +0100)]
usb: rename phy to usb_phy in OTG
This patch prepares the introduction of the generic PHY support in the
USB OTG common functions. The USB PHY member of the OTG structure is
renamed to 'usb_phy' and modifications are done in all drivers accessing
it. Renaming this pointer will allow to keep the compatibility for USB
PHY drivers.
Signed-off-by: Antoine Tenart <antoine.tenart@free-electrons.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
(cherry picked from commit 19c1eac2685b62640ca2386a0a885ac2152668c8)
Antoine Tenart [Thu, 30 Oct 2014 17:41:13 +0000 (18:41 +0100)]
usb: move the OTG state from the USB PHY to the OTG structure
Before using the PHY framework instead of the USB PHY one, we need to
move the OTG state into another place, since it won't be available when
USB PHY isn't used. This patch moves the OTG state into the OTG
structure, and makes all the needed modifications in the drivers
using the OTG state.
[ balbi@ti.com : fix build regressions with phy-tahvo.c, musb_dsps.c,
phy-isp1301-omap, and chipidea's debug.c ]
Acked-by: Kishon Vijay Abraham I <kishon@ti.com> Acked-by: Peter Chen <peter.chen@freescale.com> Signed-off-by: Antoine Tenart <antoine.tenart@free-electrons.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
(cherry picked from commit e47d92545c2972bcf3711e7db80f481e402163c7)
Antoine Tenart [Wed, 24 Sep 2014 19:05:50 +0000 (23:05 +0400)]
usb: rename phy to usb_phy in HCD
The USB PHY member of the HCD structure is renamed to 'usb_phy' and
modifications are done in all drivers accessing it.
This is in preparation to adding the generic PHY support.
Signed-off-by: Antoine Tenart <antoine.tenart@free-electrons.com>
[Sergei: added missing 'drivers/usb/misc/lvstest.c' file, resolved rejects,
updated changelog.] Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> Acked-by: Alan Stern <stern@rowland.harvard.edu> Acked-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 3d46e73dfdb840f460e5b06416965d132570ec33)
Philipp Zabel [Thu, 27 Feb 2014 18:26:44 +0000 (19:26 +0100)]
PM / domains: Turn latency warning into debug message
If devices don't provide latency data, this warning can be quite noisy until
the pm domain was enabled and disabled a few times. Turn this warning into
a debug message.
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de> Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org> Acked-by: Pavel Machek <pavel@ucw.cz> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
(cherry picked from commit 7d1af287320b41909c070f68ffe1591060a32769)
Richard Zhu [Thu, 8 Jan 2015 06:53:05 +0000 (14:53 +0800)]
MLK-10078-03 mcc: tests: add mcc test and tty api
add mcc tests and tty api on imx_3.14.
note:
the device type of the tty device should be
TTY_DRIVER_TYPE_CONSOLE, otherwise the TTY_DRIVER_TYPE_PTY.
link layer stuffs are mandatory requried by
TTY_DRIVER_TYPE_PTY type devices.
Signed-off-by: Richard Zhu <Richard.Zhu@freescale.com>
Richard Zhu [Thu, 8 Jan 2015 07:09:38 +0000 (15:09 +0800)]
MLK-10078-02 arm: mcc: platform related codes changes
The platform related codes changes when enable mcc2.0
on imx_3.14 kernel, and tested on imx6sx sdb board.
- keep imx6sx soc related apis in mcc_imx6sx.c/h
- keep linux os related apis in mcc_linux.c/h
- add some new mcc callback in mu driver, since the
gie3 of mu is used as cpu2cpu interrupter in the mcc
implementation on imx6sx.
Signed-off-by: Richard Zhu <Richard.Zhu@freescale.com>
Richard Zhu [Thu, 8 Jan 2015 07:08:42 +0000 (15:08 +0800)]
MLK-10078-01 arm: mcc: platform related header changes
The platform related header changes when enable mcc2.0
on imx_3.14 kernel, and tested on imx6sx sdb board.
- keep imx6sx soc related apis in mcc_imx6sx.c/h
- keep linux os related apis in mcc_linux.c/h
- add some new mcc callback in mu driver, since the
gie3 of mu is used as cpu2cpu interrupter in the mcc
implementation on imx6sx.
Signed-off-by: Richard Zhu <Richard.Zhu@freescale.com>
Richard Zhu [Mon, 20 Oct 2014 07:09:11 +0000 (15:09 +0800)]
MLK-9707-3 arm: mcc: mcc 2.0 updates common codes changes
Common codes changes in the mcc 2.0 updates
- common definitions are moved from mcc_config.h to mcc_common.h
because that these definitions are common for the standalone mcc
stack, and shared by different platforms, such as Linux, MQX.
- re-define the common api _psp_core_num(), and _psp_node_num().
Let them to be no platform dependency.
- move the definition of the MCC_OS_USED in mcc_config.h
- new add on mcc_config_linux.h file, contained the platform
related macro definitions contained in mcc_config.h before.
- add the related linux modifications into mcc_api.c/mcc_common.c
when implement the mcc2.0 into linux BSP.
- fix one potential bug that all the share memory operations should
be protected by sema4.
Robin Gong [Thu, 18 Dec 2014 04:41:16 +0000 (12:41 +0800)]
MLK-9986-4 dma: imx-sdma: add new ecspi tx script
Current ecspi rom script didn't take care of rxfifo overflow risk. Add new
ecspi tx script to check the rxfifo status, if it is near to full(>=48 bytes),
do not copy data to txfifo which will trigger data push into rxfifo. Because
rx script may not read rxfifo in time, we have to consider it.
Charles Keepax [Mon, 17 Nov 2014 09:14:31 +0000 (09:14 +0000)]
spi: Fix mapping from vmalloc-ed buffer to scatter list
We can only use page_address on memory that has been mapped using kmap,
when the buffer passed to the SPI has been allocated by vmalloc the page
has not necessarily been mapped through kmap. This means sometimes
page_address will return NULL causing the pointer we pass to sg_set_buf
to be invalid.
As we only call page_address so that we can pass a virtual address to
sg_set_buf which will then immediately call virt_to_page on it, fix this
by calling sg_set_page directly rather then relying on the sg_set_buf
helper.
Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com> Signed-off-by: Mark Brown <broonie@kernel.org> Cc: stable@vger.kernel.org
(cherry picked from commit c1aefbdd050e1fb15e92bcaf34d95b17ea952097)
We set both wartermark of txfifo and rxfifo 32 as half of fifo length 64.
That will cause easy rxfifo overflow:
If there is 31 bytes in rxfifo, rx script will wait the next dma request
(the 32th data come into the rxfifo) and schedule out to tx script. Once
tx script start to run, the rx script need to wait tx script finish even
if its priority higher than tx. Meanwhile, spi slave device may input
data continous, plus the rx data which triggered by new tx script(32 bytes).
That will quickly consume whole 64 bytes fifo, so we keep 16bytes availbale
even in the worst case new tx script triggered during two rx transfer. That
may slow down tx slightly, but better than overflow and RX DMA timeout.
Robin Gong [Sat, 13 Dec 2014 13:55:25 +0000 (21:55 +0800)]
MLK-9986-2 spi: spi-imx: use pio mode for the tail data in DMA mode
Sometimes the tail data can't trigger SDMA to read from rxfifo, or
SDMA miss the last dma request, in this case, DMA report RX timeout
and the rest tail data kept in rxfifo. Whatever, use pio read for the
tail rx data.
Robin Gong [Thu, 11 Sep 2014 01:18:44 +0000 (09:18 +0800)]
spi: spi-imx: add DMA support
Enable DMA support on i.mx6. The read speed can increase from 600KB/s
to 1.2MB/s on i.mx6q. You can disable or enable dma function in dts.
If not set "dma-names" in dts, spi will use PIO mode. This patch only
validate on i.mx6, not i.mx5, but encourage ones to apply this patch
on i.mx5 since they share the same IP.
Note:
Sometime, there is a weid data in rxfifo after one full tx/rx
transfer finish by DMA on i.mx6dl, so we disable dma functhion on
i.mx6dl.
Signed-off-by: Frank Li <Frank.Li@freescale.com> Signed-off-by: Robin Gong <b38343@freescale.com> Acked-by: Marek Vasut <marex@denx.de> Signed-off-by: Mark Brown <broonie@kernel.org>
(cherry picked from commit f62caccd12c17e4cb516d43a6e4dd8a3abc1f7e0)
(cherry picked from commit b87c98a8944c76840ed1375ed4792ef608de5c01)
Paul Gortmaker [Tue, 21 Jan 2014 21:22:47 +0000 (16:22 -0500)]
spi: delete non-required instances of include <linux/init.h>
None of these files are actually using any __init type directives
and hence don't need to include <linux/init.h>. Most are just a
left over from __devinit and __cpuinit removal, or simply due to
code getting copied from one driver to the next.
According to Documentation/DMA-API.txt, dma_map_sg() returns 0 on failure.
As spi_map_buf() returns an error code, convert zero into -ENOMEM.
Keep the existing check for negative numbers just in case.
Rejecting unsupported values of spi-tx-bus-width and spi-rx-bus-width
may break compatibility with future DTs. Just ignore them, falling back
to Single SPI Transfers.
Mark Brown [Thu, 1 May 2014 17:47:52 +0000 (10:47 -0700)]
spi: core: Don't destroy master queue if we fail to create it
If we fail to create the master queue for some reason we should not attempt
to clean it up since attempting to stop a kthread that was not created will
hang and it's just generally bad practice. Unfortunately at present we call
spi_destroy_queue() even in cases where the creation fails.
Fix this by fixing the error handling in spi_master_initialize_queue() so
that we only flag the master as queued or destroy the queue if creation
succeeded. The change to the flag is done since the general master
cleanup uses this to destroy the queue.
spi: core: Protect DMA code by #ifdef CONFIG_HAS_DMA
If NO_DMA=y:
drivers/built-in.o: In function `spi_map_buf':
spi.c:(.text+0x21bc60): undefined reference to `dma_map_sg'
drivers/built-in.o: In function `spi_unmap_buf.isra.33':
spi.c:(.text+0x21c32e): undefined reference to `dma_unmap_sg'
make[3]: *** [vmlinux] Error 1
Protect the DMA code by #ifdef CONFIG_HAS_DMA to fix this:
- Extract __spi_map_msg() from spi_map_msg(),
- Provide dummy definitions of __spi_map_msg() and spi_unmap_msg() if
!CONFIG_HAS_DMA.
The existing timeout value in wait_for_completion_timeout is
calculated from the transfer length and speed with tolerance of 10msec.
This is too low because this is used for error conditions such as
hardware hang etc.
The xfer->speed_hz considered may not be the actual speed set
because the best clock divisor is chosen from a limited set such that
the actual speed <= requested speed. This will lead to timeout being
less than actual transfer time.
Considering acceptable latencies, this timeout can be set to a
value double the expected transfer plus 100 msecs.
This patch adds the same in the core.
Mark Brown [Sat, 29 Mar 2014 23:48:07 +0000 (23:48 +0000)]
spi: Fix handling of cs_change in core implementation
The core implementation of cs_change didn't follow the documentation
which says that cs_change in the middle of the transfer means to briefly
deassert chip select, instead it followed buggy drivers which change the
polarity of chip select. Use a delay of 10us between deassert and
reassert simply from pulling numbers out of a hat.
Mark Brown [Tue, 25 Mar 2014 19:28:22 +0000 (19:28 +0000)]
spi: Do not require a completion
There is no real reason why we require transfers to have a completion and
the only user of the completion now checks to see if one has been provided
before using it so stop enforcing this. This makes it more convenient for
drivers to chain multiple asynchronous transfers together.
Axel Lin [Mon, 17 Mar 2014 02:08:12 +0000 (10:08 +0800)]
spi: core: Use master->max_speed_hz as transfer speed when xfer->speed_hz > master->max_speed_hz
When xfer->speed_hz is greater than master->max_speed_hz, it's generally safe
to use master->max_speed_hz as transfer speed.
Thus use master->max_speed_hz as transfer speed rather than return error when
xfer->speed_hz > master->max_speed_hz.
Signed-off-by: Axel Lin <axel.lin@ingics.com> Tested-by: Guenter Roeck <linux@roeck-us.net> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit a6f87fad7b5132f026592729ccf65b995cdec35d)
(cherry picked from commit fe70982ad2c56031804d56ca8ed5e4f884c50c5b)
Atsushi Nemoto [Fri, 28 Feb 2014 14:03:16 +0000 (23:03 +0900)]
spi: core: make zero length transfer valid again
Zero length transfer becomes invalid since
"spi: core: Validate length of the transfers in message" commit,
but it should be valid to support an odd device, for example, which
requires long delay between chipselect and the first transfer, etc.
Axel Lin [Sun, 9 Feb 2014 16:08:05 +0000 (00:08 +0800)]
spi: core: Set max_speed_hz of spi_device default to max_speed_hz of controller
In __spi_validate(), xfer->speed_hz is set to be spi->max_speed_hz if it is not
set for this transfer. However, if spi->max_speed_hz is also not set,
xfer->speed_hz is 0. Some drivers (e.g. au1550, tegra114, tegra20-sflash,
tegra20-slink, etc.) then use below code to avoid setting xfer->speed_hz to 0.
/* Set speed to the spi max fequency if spi device has not set */
spi->max_speed_hz = spi->max_speed_hz ? : tspi->spi_max_frequency;
Let's handle it in spi core.
If spi->max_speed_hz is not set, make it default to spi->master->max_speed_hz.
So In __spi_validate() if both xfer->speed_hz and spi->max_speed_hz are not set,
xfer->speed_hz will be set to spi->master->max_speed_hz.
Mark Brown [Sun, 2 Feb 2014 13:47:47 +0000 (13:47 +0000)]
spi: Make core DMA mapping functions generate scatterlists
We cannot unconditionally use dma_map_single() to map data for use with
SPI since transfers may exceed a page and virtual addresses may not be
provided with physically contiguous pages. Further, addresses allocated
using vmalloc() need to be mapped differently to other addresses.
Currently only the MXS driver handles all this, a few drivers do handle
the possibility that buffers may not be physically contiguous which is
the main potential problem but many don't even do that. Factoring this
out into the core will make it easier for drivers to do a good job so if
the driver is using the core DMA code then generate a scatterlist
instead of mapping to a single address so do that.
This code is mainly based on a combination of the existing code in the MXS
and PXA2xx drivers. In future we should be able to extend it to allow the
core to concatenate adjacent transfers if they are compatible, improving
performance.
Currently for simplicity clients are not allowed to use the scatterlist
when they do DMA mapping, in the future the existing single address
mappings will be replaced with use of the scatterlist most likely as
part of pre-verifying transfers.
This change makes it mandatory to use scatterlists when using the core DMA
mapping so update the s3c64xx driver to do this when used with dmaengine.
Doing so makes the code more ugly but it is expected that the old s3c-dma
code can be removed very soon.
Mark Brown [Tue, 28 Jan 2014 20:17:03 +0000 (20:17 +0000)]
spi: Provide core support for full duplex devices
It is fairly common for SPI devices to require that one or both transfer
directions is always active. Currently drivers open code this in various
ways with varying degrees of efficiency. Start factoring this out by
providing flags SPI_MASTER_MUST_TX and SPI_MASTER_MUST_RX. These will cause
the core to provide buffers for the requested direction if none are
specified in the underlying transfer.
Currently this is fairly inefficient since we actually allocate a data
buffer which may get large, support for mapping transfers using a
scatterlist will allow us to avoid this for DMA based transfers.
Mark Brown [Thu, 16 Jan 2014 12:22:43 +0000 (12:22 +0000)]
spi: Provide core support for DMA mapping transfers
The process of DMA mapping buffers for SPI transfers does not vary between
devices so in order to save duplication of code in drivers this can be
factored out into the core, allowing it to be integrated with the work that
is being done on factoring out the common elements from the data path
including more sharing of dmaengine code.
In order to use this masters need to provide a can_dma() operation and while
the hardware is prepared they should ensure that DMA channels are provided
in tx_dma and rx_dma. The core will then ensure that the buffers are mapped
for DMA prior to calling transfer_one_message().
Currently the cleanup on error is not complete, this needs to be improved.
Fabio Estevam [Thu, 11 Dec 2014 15:14:22 +0000 (13:14 -0200)]
MLK-9987: Input: imx_keypad: Fix suspend/resume while keypad is pressed
Since commit commit 560a64749d1dd0ff ("ENGR00318936-2 input: keyboard: imx:
remove usless release interrupt enabled) the following problem happens:
- Keep any keypad key pressed
- Enter low power mode via "echo mem > /sys/power/state"
- Then we are no longer able to wake-up the system via the keypad
The reason for this behaviour is that the KRIE (Release Interrupt) is not
enabled.
In order to fix this problem, we should enable KRIE when a key is pressed
(KPKD bit is set) or enable KDIE when no key is pressed (KPKR is set).
This way we will always have a valid source of keypad interrupt no matter if
the system entered low power mode while a keypad key was pressed or not.
Bai Ping [Fri, 26 Dec 2014 13:40:40 +0000 (21:40 +0800)]
MLK-10018-02 thermal: imx: notify thermal driver in low_bus_freq_mode
As thermal sensor alarm function needs PLL3 to be always on, but low power
idle needs all PLLs to be off, they are exclusive. Low power idle is only enabled
when system staying at low bus mode which means the overall system power consumption
is NOT high, thermal alarm function can be disabled in this mode to allow low power
idle to be entered, and thermal sensor will still use polling mechanism to monitor
the system temperature. Add busfreq notify to achieve this goal.
Bai Ping [Fri, 26 Dec 2014 13:37:31 +0000 (21:37 +0800)]
MLK-10018-01 arm: imx: Implement busfreq notifier calls for busfreq
Implement busfreq notifier calls used when busfreq entering low_bus_freq_mode.
When the system lower the bus frequency, some modules can be affected by bus
frequency change. Adding notifier call chains that allow driver affected by bus
frequency can be notified before and after low_bus_freq_mode.
Bai Ping [Fri, 26 Dec 2014 17:36:42 +0000 (01:36 +0800)]
MLK-10007-03 arm: imx: fix ARM and IPG clk ratio in low_bus_freq_mode
On i.MX6SL, we must make sure ARM:IPG clock ratio is within 12:5 when entering
wait mode. If the system is in low_bus_freq_mode, the IPG is at 12MHz
according the busfreq code. So the max rate of ARM is 28.8MHz when entering
wait mode. As there is no way run at this clk rate, so set ARM to run from
24MHz OSC.
Bai Ping [Fri, 26 Dec 2014 17:00:58 +0000 (01:00 +0800)]
MLK-10007-02 arm: imx: enable pll1 when changing arm_podf value
Before changing the arm_podf, the pll1 must be output enabled according
to the hardware design.
Refer to the clk tree implementation code for i.MX6SL. pll1's output will
be disabled when no clk is sourced from it. In busfreq code, in order to
successfully change the arm_clk rate, we must make sure pll1's output is
enabled before changing this clk rate. add imx6sl_enable_pll_arm() calls
to fulfill this requirement.
Additionally, only a bypassed output clk is ok, so no need to make sure pll1
is powered up.
Bai Ping [Wed, 12 Nov 2014 16:44:24 +0000 (00:44 +0800)]
MLK-9826 arm: imx6: Add low power idle support for imx6sl
Enable low power idle for imx6sl. When the busfreq is either
in ultra_low_bus_freq mode or audio_bus_freq_mode, we Can save
more power by reducing the system frequency further in ldle.
At present, Only two idle(WFI and WAIT) are supported.
WFI --> normal ARM ilde (first level idle)
WAIT mode --> low power idle (second level idle)
When entered WAIT mode, change the DDR, AHB/AXI and ARM clk frequency
as below if the system is in:
1. ultra_low_bus_freq:
DDR freq to 1MHz,
AHB/AXI freq to 3MHz,
ARM freq to 3MHz.
2. audio_low_bus_mode:
DDR freq to 25Hz,
AHB freq to 8MHz,
ARM freq to 8MHz.
Anatop can be put in low power mode when all the PLLs are powered down.
We can enable the low power bandgap and disable the rugulator bandgap,
enable the weak 2p5 LDO and disable the 2p5 LDO.
Robin Gong [Wed, 17 Dec 2014 11:33:11 +0000 (19:33 +0800)]
MLK-9891: ARM: dts: imx6sx-sabreauto: use WDOG_B pin to reset whole board
For the QSPI byte address not aligned in ROM code and kernel, we have to reset
power cycle to workaroud this issue. Use WDOG_B pin to trigger PWRON of pfuze.
Robin Gong [Fri, 31 Oct 2014 01:36:28 +0000 (09:36 +0800)]
MLK-9819 ARM: imx6sx: Add WDOG_B reset for i.mx6sx boards.
QSPI-NOR reboot failed in case of larger flash size such as 256M used, because
kernel QSPI-NOR flash use 4-bytes-address mode to visit 16MB+ area but ROM code
use 3-bytes-address mode to access QSPI-NOR. Thus, we have to use WDOG_B to
reset QSPI-NOR flash to workaround this.
Note:
Please update the u-boot with the below u-boot patch, otherwise system will
reboot endless while kernel boot:
"MLK-9819: ARM: mx6sx: clear WDOG3 Power Down Enable bit for i.mx6sx"
Pfuze200 only provide one power supply for VDDARM_IN and VDDSOC_IN,
for ldo-bypass mode, we have to pretend they are different regulators
otherwise regulator famework will refuse update voltage.
Fugang Duan [Sun, 4 Jan 2015 05:38:26 +0000 (13:38 +0800)]
MLK-10072 ARM: dts: imx6sx: add uart5 dte pad set for imx6sx-sabreauto board
Add imx6sx-sdb baord uart5 DTE pad set. To avoid a flood of dts files,
there only comment out DTE pinctrl set. If user want to test DTE mode,
it needs to rebuild the DTB file.
Fugang Duan [Sun, 4 Jan 2015 02:19:40 +0000 (10:19 +0800)]
ARM: imx: add FEC sleep mode callback function
i.MX6q/dl, i.MX6SX SOCs enet support sleep mode that magic packet can
wake up system in suspend status. For different SOCs, there have some
SOC specifical GPR register to set sleep on/off mode. So add these to
callback function for driver.
Signed-off-by: Fugang Duan <B38611@freescale.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Fugang Duan [Sun, 4 Jan 2015 02:09:35 +0000 (10:09 +0800)]
net: fec: add Wake-on-LAN support
Support for Wake-on-LAN using Magic Packet. ENET IP supports sleep mode
in low power status, when system enter suspend status, Magic packet can
wake up system even if all SOC clocks are gate. The patch doing below things:
- flagging the device as a wakeup source for the system, as well as
its Wake-on-LAN interrupt
- prepare the hardware for entering WoL mode
- add standard ethtool WOL interface
- enable the ENET interrupt to wake us
Tested on i.MX6q/dl sabresd, sabreauto boards, i.MX6SX arm2 boards.
Signed-off-by: Fugang Duan <B38611@freescale.com> Signed-off-by: David S. Miller <davem@davemloft.net>