diff options
author | Daniel Schaeffer <daniel.schaeffer@timesys.com> | 2009-03-05 09:17:05 -0500 |
---|---|---|
committer | Daniel Schaeffer <daniel.schaeffer@timesys.com> | 2009-03-05 09:17:05 -0500 |
commit | a432aa7dcbd421770aab5a5d8db40f2a67195e50 (patch) | |
tree | e46dfa8fe439ae0eff43d4b5fbfb0d1ff45e87f3 /arch/arm | |
parent | 24d67a5dccaeb7739e37ef304fbeb2fee3a8c12a (diff) |
So, here is my second version of the generic SPI driver for i.MX. Changes
include:
* bugfix to make it work with i.MX31 (tested)
* supports multiple chip-selects (untested)
* pdata_exit-function now void
* check result of pdata_init-function
* spi_versions for i.MX35 and MX1 added
* fixing comments in a few places
Would be great, if you could give it a try...
Regards,
Wolfram
Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
Signed-off-by: Daniel Schaeffer <daniel.schaeffer@timesys.com>
Diffstat (limited to 'arch/arm')
-rw-r--r-- | arch/arm/plat-mxc/include/mach/spi_imx.h | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/arch/arm/plat-mxc/include/mach/spi_imx.h b/arch/arm/plat-mxc/include/mach/spi_imx.h new file mode 100644 index 000000000000..0d0f3bd677b1 --- /dev/null +++ b/arch/arm/plat-mxc/include/mach/spi_imx.h @@ -0,0 +1,72 @@ +/* + * arch/arm/plat-mxc/include/mach/spi_imx.h + * + * Copyright (C) 2006 SWAPP + * Andrea Paterniani <a.paterniani@swapp-eng.it> + * Copyright (C) 2009 Pengutronix + * Wolfram Sang <w.sang@pengutronix.de> + * + * Initial version inspired by: + * linux-2.6.17-rc3-mm1/arch/arm/mach-pxa/include/mach/pxa2xx_spi.h + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef SPI_IMX_H_ +#define SPI_IMX_H_ + +/*-------------------------------------------------------------------------*/ +/** + * struct spi_imx_master - device.platform_data for SPI controller devices. + * @num_chipselect: chipselects are used to distinguish individual + * SPI slaves, and are numbered from zero to num_chipselects - 1. + * each slave has a chipselect signal, but it's common that not + * every chipselect is connected to a slave. + * @enable_dma: if true enables DMA driven transfers. +*/ +struct spi_imx_master { + u8 num_chipselect; + u8 enable_dma:1; + int (*init)(struct platform_device *pdev); + void (*exit)(struct platform_device *pdev); +}; +/*-------------------------------------------------------------------------*/ + +/*-------------------------------------------------------------------------*/ +/** + * struct spi_imx_chip - spi_board_info.controller_data for SPI + * slave devices, copied to spi_device.controller_data. + * @enable_loopback : used for test purpouse to internally connect RX and TX + * sections. + * @enable_dma : enables dma transfer (provided that controller driver has + * dma enabled too). + * @ins_ss_pulse : enable /SS pulse insertion between SPI burst. + * @bclk_wait : number of bclk waits between each bits_per_word SPI burst. + * @cs_control : function pointer to board-specific function to assert/deassert + * I/O port to control HW generation of devices chip-select. +*/ +struct spi_imx_chip { + u8 enable_dma:1; + u8 ins_ss_pulse:1; + u16 bclk_wait:15; + void (*cs_control)(u32 control); +}; + +/* Chip-select state */ +#define SPI_CS_ASSERT (1 << 0) +#define SPI_CS_DEASSERT (1 << 1) +/*-------------------------------------------------------------------------*/ + +#endif /* SPI_IMX_H_*/ |