summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Ziswiler <marcel.ziswiler@toradex.com>2014-07-22 17:15:18 +0200
committerMarcel Ziswiler <marcel.ziswiler@toradex.com>2014-07-22 17:32:18 +0200
commit17714a865512ad8634bcc616c4e2e65f8fff2646 (patch)
tree8f1810b25de2f5f8fbb89eef5e0cc715b51e7703
parentbdf9e11d339ebc121e80e7ecdd44e0abcaf4ff38 (diff)
apalis/colibri t20/t30: fix/introduce spi device controller data
Fix (Colibri) resp. introduce (Apalis) SPI device controller data to properly use HW based chip select with one clock of setup and hold time each for both MCP2515 CAN controller(s) as well as spidev.
-rw-r--r--arch/arm/mach-tegra/board-apalis_t30.c36
-rw-r--r--arch/arm/mach-tegra/board-colibri_t20.c14
-rw-r--r--arch/arm/mach-tegra/board-colibri_t30.c12
3 files changed, 44 insertions, 18 deletions
diff --git a/arch/arm/mach-tegra/board-apalis_t30.c b/arch/arm/mach-tegra/board-apalis_t30.c
index d7e5396220e9..a10064ae73ca 100644
--- a/arch/arm/mach-tegra/board-apalis_t30.c
+++ b/arch/arm/mach-tegra/board-apalis_t30.c
@@ -278,6 +278,12 @@ static struct platform_device soc_camera_as0260soc = {
/* CAN */
#if defined(CONFIG_CAN_MCP251X) || defined(CONFIG_CAN_MCP251X_MODULE)
+static struct tegra_spi_device_controller_data mcp251x_controller_data = {
+ .cs_hold_clk_count = 1, /* at least 50 ns */
+ .cs_setup_clk_count = 1, /* at least 50 ns */
+ .is_hw_based_cs = 1,
+};
+
static struct mcp251x_platform_data can_pdata = {
.oscillator_frequency = 16000000,
.power_enable = NULL,
@@ -286,18 +292,20 @@ static struct mcp251x_platform_data can_pdata = {
static struct spi_board_info can_board_info[] = {
{
- .bus_num = 1, /* SPI2: CAN1 */
- .chip_select = 0,
- .max_speed_hz = 10000000,
- .modalias = "mcp2515",
- .platform_data = &can_pdata,
+ .bus_num = 1, /* SPI2: CAN1 */
+ .chip_select = 0,
+ .controller_data = &mcp251x_controller_data,
+ .max_speed_hz = 10000000,
+ .modalias = "mcp2515",
+ .platform_data = &can_pdata,
},
{
- .bus_num = 3, /* SPI4: CAN2 */
- .chip_select = 1,
- .max_speed_hz = 10000000,
- .modalias = "mcp2515",
- .platform_data = &can_pdata,
+ .bus_num = 3, /* SPI4: CAN2 */
+ .chip_select = 1,
+ .controller_data = &mcp251x_controller_data,
+ .max_speed_hz = 10000000,
+ .modalias = "mcp2515",
+ .platform_data = &can_pdata,
},
};
@@ -803,10 +811,17 @@ static void apalis_t30_sata_init(void) { }
/* SPI */
#if defined(CONFIG_SPI_TEGRA) && defined(CONFIG_SPI_SPIDEV)
+static struct tegra_spi_device_controller_data spidev_controller_data = {
+ .cs_hold_clk_count = 1,
+ .cs_setup_clk_count = 1,
+ .is_hw_based_cs = 1,
+};
+
static struct spi_board_info tegra_spi_devices[] __initdata = {
{
.bus_num = 0, /* SPI1: Apalis SPI1 */
.chip_select = 0,
+ .controller_data = &spidev_controller_data,
.irq = 0,
.max_speed_hz = 50000000,
.modalias = "spidev",
@@ -816,6 +831,7 @@ static struct spi_board_info tegra_spi_devices[] __initdata = {
{
.bus_num = 4, /* SPI5: Apalis SPI2 */
.chip_select = 2,
+ .controller_data = &spidev_controller_data,
.irq = 0,
.max_speed_hz = 50000000,
.modalias = "spidev",
diff --git a/arch/arm/mach-tegra/board-colibri_t20.c b/arch/arm/mach-tegra/board-colibri_t20.c
index 35e483e79653..05bcc5cbe883 100644
--- a/arch/arm/mach-tegra/board-colibri_t20.c
+++ b/arch/arm/mach-tegra/board-colibri_t20.c
@@ -293,7 +293,13 @@ static int __init colibri_t20_mcp2515_setup(struct spi_device *spi)
return 0;
}
-static struct tegra_spi_device_controller_data spi_controller_data;
+#ifndef MECS_TELLURIUM_XPOD2
+static struct tegra_spi_device_controller_data mcp251x_controller_data = {
+ .cs_hold_clk_count = 1, /* at least 50 ns */
+ .cs_setup_clk_count = 1, /* at least 50 ns */
+ .is_hw_based_cs = 1,
+};
+#endif /* MECS_TELLURIUM_XPOD2 */
static struct mcp251x_platform_data mcp251x_pdata = {
.board_specific_setup = colibri_t20_mcp2515_setup,
@@ -313,7 +319,7 @@ static struct spi_board_info mcp251x_board_info[] = {
#ifdef MECS_TELLURIUM_XPOD2
.controller_data = (void *) CAN_CS_GPIO,
#else
- .controller_data = &spi_controller_data,
+ .controller_data = &mcp251x_controller_data,
#endif
.max_speed_hz = 10000000,
.modalias = "mcp2515",
@@ -955,7 +961,7 @@ static struct platform_device xpod2_spi_device = {
#endif /* CONFIG_SPI_GPIO | CONFIG_SPI_GPIO_MODULE */
#if defined(CONFIG_SPI_TEGRA) && defined(CONFIG_SPI_SPIDEV)
-static struct tegra_spi_device_controller_data spi_controller_data = {
+static struct tegra_spi_device_controller_data spidev_controller_data = {
.cs_hold_clk_count = 1,
.cs_setup_clk_count = 1,
.is_hw_based_cs = 1,
@@ -969,7 +975,7 @@ static struct spi_board_info tegra_spi_devices[] __initdata = {
#else /* !CONFIG_CAN_MCP251X & !CONFIG_CAN_MCP251X_MODULE */
.chip_select = 1,
#endif /* !CONFIG_CAN_MCP251X & !CONFIG_CAN_MCP251X_MODULE */
- .controller_data = &spi_controller_data,
+ .controller_data = &spidev_controller_data,
.irq = 0,
.max_speed_hz = 50000000,
.modalias = "spidev",
diff --git a/arch/arm/mach-tegra/board-colibri_t30.c b/arch/arm/mach-tegra/board-colibri_t30.c
index 6e6df2afb004..e4cac4218f9c 100644
--- a/arch/arm/mach-tegra/board-colibri_t30.c
+++ b/arch/arm/mach-tegra/board-colibri_t30.c
@@ -260,7 +260,11 @@ static int __init colibri_t20_mcp2515_setup(struct spi_device *spi)
return 0;
}
-static struct tegra_spi_device_controller_data spi_controller_data;
+static struct tegra_spi_device_controller_data mcp251x_controller_data = {
+ .cs_hold_clk_count = 1, /* at least 50 ns */
+ .cs_setup_clk_count = 1, /* at least 50 ns */
+ .is_hw_based_cs = 1,
+};
static struct mcp251x_platform_data mcp251x_pdata = {
.board_specific_setup = colibri_t20_mcp2515_setup,
@@ -273,7 +277,7 @@ static struct spi_board_info mcp251x_board_info[] = {
{
.bus_num = 0,
.chip_select = 0,
- .controller_data = &spi_controller_data,
+ .controller_data = &mcp251x_controller_data,
.max_speed_hz = 10000000,
.modalias = "mcp2515",
.platform_data = &mcp251x_pdata,
@@ -780,7 +784,7 @@ static struct platform_device tegra_rtc_device = {
/* SPI */
#if defined(CONFIG_SPI_TEGRA) && defined(CONFIG_SPI_SPIDEV)
-static struct tegra_spi_device_controller_data spi_controller_data = {
+static struct tegra_spi_device_controller_data spidev_controller_data = {
.cs_hold_clk_count = 1,
.cs_setup_clk_count = 1,
.is_hw_based_cs = 1,
@@ -794,7 +798,7 @@ static struct spi_board_info tegra_spi_devices[] __initdata = {
#else /* !CONFIG_CAN_MCP251X & !CONFIG_CAN_MCP251X_MODULE */
.chip_select = 1,
#endif /* !CONFIG_CAN_MCP251X & !CONFIG_CAN_MCP251X_MODULE */
- .controller_data = &spi_controller_data,
+ .controller_data = &spidev_controller_data,
.irq = 0,
.max_speed_hz = 50000000,
.modalias = "spidev",