-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branches 'spi-drivers' and 'spi-mxs' into spi-next
- Loading branch information
Showing
33 changed files
with
2,119 additions
and
609 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
* Freescale MX233/MX28 SSP/SPI | ||
|
||
Required properties: | ||
- compatible: Should be "fsl,<soc>-spi", where soc is "imx23" or "imx28" | ||
- reg: Offset and length of the register set for the device | ||
- interrupts: Should contain SSP interrupts (error irq first, dma irq second) | ||
- fsl,ssp-dma-channel: APBX DMA channel for the SSP | ||
|
||
Optional properties: | ||
- clock-frequency : Input clock frequency to the SPI block in Hz. | ||
Default is 160000000 Hz. | ||
|
||
Example: | ||
|
||
ssp0: ssp@80010000 { | ||
#address-cells = <1>; | ||
#size-cells = <0>; | ||
compatible = "fsl,imx28-spi"; | ||
reg = <0x80010000 0x2000>; | ||
interrupts = <96 82>; | ||
fsl,ssp-dma-channel = <0>; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
SPI-GPIO devicetree bindings | ||
|
||
Required properties: | ||
|
||
- compatible: should be set to "spi-gpio" | ||
- #address-cells: should be set to <0x1> | ||
- ranges | ||
- gpio-sck: GPIO spec for the SCK line to use | ||
- gpio-miso: GPIO spec for the MISO line to use | ||
- gpio-mosi: GPIO spec for the MOSI line to use | ||
- cs-gpios: GPIOs to use for chipselect lines | ||
- num-chipselects: number of chipselect lines | ||
|
||
Example: | ||
|
||
spi { | ||
compatible = "spi-gpio"; | ||
#address-cells = <0x1>; | ||
ranges; | ||
|
||
gpio-sck = <&gpio 95 0>; | ||
gpio-miso = <&gpio 98 0>; | ||
gpio-mosi = <&gpio 97 0>; | ||
cs-gpios = <&gpio 125 0>; | ||
num-chipselects = <1>; | ||
|
||
/* clients */ | ||
}; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
NXP SC18IS602/SCIS603 | ||
|
||
Required properties: | ||
- compatible : Should be one of | ||
"nxp,sc18is602" | ||
"nxp,sc18is602b" | ||
"nxp,sc18is603" | ||
- reg: I2C bus address | ||
|
||
Optional properties: | ||
- clock-frequency : external oscillator clock frequency. If not | ||
specified, the SC18IS602 default frequency (7372000) will be used. | ||
|
||
The clock-frequency property is relevant and needed only if the chip has an | ||
external oscillator (SC18IS603). | ||
|
||
Example: | ||
|
||
sc18is603@28 { | ||
compatible = "nxp,sc18is603"; | ||
reg = <0x28>; | ||
clock-frequency = <14744000>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
Kernel driver spi-sc18is602 | ||
=========================== | ||
|
||
Supported chips: | ||
* NXP SI18IS602/602B/603 | ||
Datasheet: http://www.nxp.com/documents/data_sheet/SC18IS602_602B_603.pdf | ||
|
||
Author: | ||
Guenter Roeck <linux@roeck-us.net> | ||
|
||
|
||
Description | ||
----------- | ||
|
||
This driver provides connects a NXP SC18IS602/603 I2C-bus to SPI bridge to the | ||
kernel's SPI core subsystem. | ||
|
||
The driver does not probe for supported chips, since the SI18IS602/603 does not | ||
support Chip ID registers. You will have to instantiate the devices explicitly. | ||
Please see Documentation/i2c/instantiating-devices for details. | ||
|
||
|
||
Usage Notes | ||
----------- | ||
|
||
This driver requires the I2C adapter driver to support raw I2C messages. I2C | ||
adapter drivers which can only handle the SMBus protocol are not supported. | ||
|
||
The maximum SPI message size supported by SC18IS602/603 is 200 bytes. Attempts | ||
to initiate longer transfers will fail with -EINVAL. EEPROM read operations and | ||
similar large accesses have to be split into multiple chunks of no more than | ||
200 bytes per SPI message (128 bytes of data per message is recommended). This | ||
means that programs such as "cp" or "od", which automatically use large block | ||
sizes to access a device, can not be used directly to read data from EEPROM. | ||
Programs such as dd, where the block size can be specified, should be used | ||
instead. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
/* | ||
* Copyright 2012 DENX Software Engineering, GmbH | ||
* | ||
* Pulled from code: | ||
* Portions copyright (C) 2003 Russell King, PXA MMCI Driver | ||
* Portions copyright (C) 2004-2005 Pierre Ossman, W83L51xD SD/MMC driver | ||
* | ||
* Copyright 2008 Embedded Alley Solutions, Inc. | ||
* Copyright 2009-2011 Freescale Semiconductor, Inc. | ||
* | ||
* The code contained herein is licensed under the GNU General Public | ||
* License. You may obtain a copy of the GNU General Public License | ||
* Version 2 or later at the following locations: | ||
* | ||
* http://www.opensource.org/licenses/gpl-license.html | ||
* http://www.gnu.org/copyleft/gpl.html | ||
*/ | ||
|
||
#include <linux/kernel.h> | ||
#include <linux/init.h> | ||
#include <linux/clk.h> | ||
#include <linux/module.h> | ||
#include <linux/device.h> | ||
#include <linux/io.h> | ||
#include <linux/spi/mxs-spi.h> | ||
|
||
void mxs_ssp_set_clk_rate(struct mxs_ssp *ssp, unsigned int rate) | ||
{ | ||
unsigned int ssp_clk, ssp_sck; | ||
u32 clock_divide, clock_rate; | ||
u32 val; | ||
|
||
ssp_clk = clk_get_rate(ssp->clk); | ||
|
||
for (clock_divide = 2; clock_divide <= 254; clock_divide += 2) { | ||
clock_rate = DIV_ROUND_UP(ssp_clk, rate * clock_divide); | ||
clock_rate = (clock_rate > 0) ? clock_rate - 1 : 0; | ||
if (clock_rate <= 255) | ||
break; | ||
} | ||
|
||
if (clock_divide > 254) { | ||
dev_err(ssp->dev, | ||
"%s: cannot set clock to %d\n", __func__, rate); | ||
return; | ||
} | ||
|
||
ssp_sck = ssp_clk / clock_divide / (1 + clock_rate); | ||
|
||
val = readl(ssp->base + HW_SSP_TIMING(ssp)); | ||
val &= ~(BM_SSP_TIMING_CLOCK_DIVIDE | BM_SSP_TIMING_CLOCK_RATE); | ||
val |= BF_SSP(clock_divide, TIMING_CLOCK_DIVIDE); | ||
val |= BF_SSP(clock_rate, TIMING_CLOCK_RATE); | ||
writel(val, ssp->base + HW_SSP_TIMING(ssp)); | ||
|
||
ssp->clk_rate = ssp_sck; | ||
|
||
dev_dbg(ssp->dev, | ||
"%s: clock_divide %d, clock_rate %d, ssp_clk %d, rate_actual %d, rate_requested %d\n", | ||
__func__, clock_divide, clock_rate, ssp_clk, ssp_sck, rate); | ||
} | ||
EXPORT_SYMBOL_GPL(mxs_ssp_set_clk_rate); |
Oops, something went wrong.