mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-14 06:24:53 +08:00
fe1bd78bf1
The docs for the spi_imx platform data still refer to a -32 offset used to specify a native chip select. This was removed in commit602c8f4485
("spi: imx: fix use of native chip-selects with devicetree") and no longer works as documented. Update documentation. The macro MXC_SPI_CS() is no longer is needed. If a board uses all native chip selects, then it's not necessary to specify a chip select array at all, as all native is the default (this is how device-tree configured SPI masters work too). Most of the spi-imx platform data users have their chip select arrays removed by this patch. This patch also fixes a bug in mx31moboard introduced in the '602 commit. When that board was updated in commit901f26bce6
("ARM: imx: set correct chip_select in platform setup") to reflect the SPI change, only SPI bus 2 was updated and SPI bus 1 was left with non-sequential chip selects. The mc13783 spi device on bus 1 had its chip select updated as if it were on bus 2. CC: Sascha Hauer <kernel@pengutronix.de> CC: Fabio Estevam <fabio.estevam@nxp.com> Acked-by: Greg Ungerer <gerg@linux-m68k.org> Reviewed-by: Oleksij Rempel <o.rempel@pengutronix.de> Signed-off-by: Trent Piepho <tpiepho@impinj.com> Signed-off-by: Shawn Guo <shawnguo@kernel.org>
175 lines
4.0 KiB
C
175 lines
4.0 KiB
C
/*
|
|
* Copyright (C) 2009
|
|
* Guennadi Liakhovetski, DENX Software Engineering, <lg@denx.de>
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License version 2 as
|
|
* published by the Free Software Foundation.
|
|
*/
|
|
#include <linux/gpio.h>
|
|
#include <linux/input.h>
|
|
#include <linux/platform_device.h>
|
|
#include <linux/spi/spi.h>
|
|
|
|
#include <asm/mach-types.h>
|
|
|
|
#include "pcm037.h"
|
|
#include "common.h"
|
|
#include "devices-imx31.h"
|
|
#include "iomux-mx3.h"
|
|
|
|
static unsigned int pcm037_eet_pins[] = {
|
|
/* Reserve and hardwire GPIO 57 high - S6E63D6 chipselect */
|
|
IOMUX_MODE(MX31_PIN_KEY_COL7, IOMUX_CONFIG_GPIO),
|
|
/* GPIO keys */
|
|
IOMUX_MODE(MX31_PIN_GPIO1_0, IOMUX_CONFIG_GPIO), /* 0 */
|
|
IOMUX_MODE(MX31_PIN_GPIO1_1, IOMUX_CONFIG_GPIO), /* 1 */
|
|
IOMUX_MODE(MX31_PIN_GPIO1_2, IOMUX_CONFIG_GPIO), /* 2 */
|
|
IOMUX_MODE(MX31_PIN_GPIO1_3, IOMUX_CONFIG_GPIO), /* 3 */
|
|
IOMUX_MODE(MX31_PIN_SVEN0, IOMUX_CONFIG_GPIO), /* 32 */
|
|
IOMUX_MODE(MX31_PIN_STX0, IOMUX_CONFIG_GPIO), /* 33 */
|
|
IOMUX_MODE(MX31_PIN_SRX0, IOMUX_CONFIG_GPIO), /* 34 */
|
|
IOMUX_MODE(MX31_PIN_SIMPD0, IOMUX_CONFIG_GPIO), /* 35 */
|
|
IOMUX_MODE(MX31_PIN_RTS1, IOMUX_CONFIG_GPIO), /* 38 */
|
|
IOMUX_MODE(MX31_PIN_CTS1, IOMUX_CONFIG_GPIO), /* 39 */
|
|
IOMUX_MODE(MX31_PIN_KEY_ROW4, IOMUX_CONFIG_GPIO), /* 50 */
|
|
IOMUX_MODE(MX31_PIN_KEY_ROW5, IOMUX_CONFIG_GPIO), /* 51 */
|
|
IOMUX_MODE(MX31_PIN_KEY_ROW6, IOMUX_CONFIG_GPIO), /* 52 */
|
|
IOMUX_MODE(MX31_PIN_KEY_ROW7, IOMUX_CONFIG_GPIO), /* 53 */
|
|
|
|
/* LEDs */
|
|
IOMUX_MODE(MX31_PIN_DTR_DTE1, IOMUX_CONFIG_GPIO), /* 44 */
|
|
IOMUX_MODE(MX31_PIN_DSR_DTE1, IOMUX_CONFIG_GPIO), /* 45 */
|
|
IOMUX_MODE(MX31_PIN_KEY_COL5, IOMUX_CONFIG_GPIO), /* 55 */
|
|
IOMUX_MODE(MX31_PIN_KEY_COL6, IOMUX_CONFIG_GPIO), /* 56 */
|
|
};
|
|
|
|
/* SPI */
|
|
static struct spi_board_info pcm037_spi_dev[] = {
|
|
{
|
|
.modalias = "dac124s085",
|
|
.max_speed_hz = 400000,
|
|
.bus_num = 0,
|
|
.chip_select = 1, /* Index in pcm037_spi1_cs[] */
|
|
.mode = SPI_CPHA,
|
|
},
|
|
};
|
|
|
|
/* Platform Data for MXC CSPI */
|
|
static const struct spi_imx_master pcm037_spi1_pdata __initconst = {
|
|
.num_chipselect = 2,
|
|
};
|
|
|
|
/* GPIO-keys input device */
|
|
static struct gpio_keys_button pcm037_gpio_keys[] = {
|
|
{
|
|
.type = EV_KEY,
|
|
.code = KEY_L,
|
|
.gpio = 0,
|
|
.desc = "Wheel Manual",
|
|
.wakeup = 0,
|
|
}, {
|
|
.type = EV_KEY,
|
|
.code = KEY_A,
|
|
.gpio = 1,
|
|
.desc = "Wheel AF",
|
|
.wakeup = 0,
|
|
}, {
|
|
.type = EV_KEY,
|
|
.code = KEY_V,
|
|
.gpio = 2,
|
|
.desc = "Wheel View",
|
|
.wakeup = 0,
|
|
}, {
|
|
.type = EV_KEY,
|
|
.code = KEY_M,
|
|
.gpio = 3,
|
|
.desc = "Wheel Menu",
|
|
.wakeup = 0,
|
|
}, {
|
|
.type = EV_KEY,
|
|
.code = KEY_UP,
|
|
.gpio = 32,
|
|
.desc = "Nav Pad Up",
|
|
.wakeup = 0,
|
|
}, {
|
|
.type = EV_KEY,
|
|
.code = KEY_RIGHT,
|
|
.gpio = 33,
|
|
.desc = "Nav Pad Right",
|
|
.wakeup = 0,
|
|
}, {
|
|
.type = EV_KEY,
|
|
.code = KEY_DOWN,
|
|
.gpio = 34,
|
|
.desc = "Nav Pad Down",
|
|
.wakeup = 0,
|
|
}, {
|
|
.type = EV_KEY,
|
|
.code = KEY_LEFT,
|
|
.gpio = 35,
|
|
.desc = "Nav Pad Left",
|
|
.wakeup = 0,
|
|
}, {
|
|
.type = EV_KEY,
|
|
.code = KEY_ENTER,
|
|
.gpio = 38,
|
|
.desc = "Nav Pad Ok",
|
|
.wakeup = 0,
|
|
}, {
|
|
.type = EV_KEY,
|
|
.code = KEY_O,
|
|
.gpio = 39,
|
|
.desc = "Wheel Off",
|
|
.wakeup = 0,
|
|
}, {
|
|
.type = EV_KEY,
|
|
.code = BTN_FORWARD,
|
|
.gpio = 50,
|
|
.desc = "Focus Forward",
|
|
.wakeup = 0,
|
|
}, {
|
|
.type = EV_KEY,
|
|
.code = BTN_BACK,
|
|
.gpio = 51,
|
|
.desc = "Focus Backward",
|
|
.wakeup = 0,
|
|
}, {
|
|
.type = EV_KEY,
|
|
.code = BTN_MIDDLE,
|
|
.gpio = 52,
|
|
.desc = "Release Half",
|
|
.wakeup = 0,
|
|
}, {
|
|
.type = EV_KEY,
|
|
.code = BTN_EXTRA,
|
|
.gpio = 53,
|
|
.desc = "Release Full",
|
|
.wakeup = 0,
|
|
},
|
|
};
|
|
|
|
static const struct gpio_keys_platform_data
|
|
pcm037_gpio_keys_platform_data __initconst = {
|
|
.buttons = pcm037_gpio_keys,
|
|
.nbuttons = ARRAY_SIZE(pcm037_gpio_keys),
|
|
.rep = 0, /* No auto-repeat */
|
|
};
|
|
|
|
int __init pcm037_eet_init_devices(void)
|
|
{
|
|
if (pcm037_variant() != PCM037_EET)
|
|
return 0;
|
|
|
|
mxc_iomux_setup_multiple_pins(pcm037_eet_pins,
|
|
ARRAY_SIZE(pcm037_eet_pins), "pcm037_eet");
|
|
|
|
/* SPI */
|
|
spi_register_board_info(pcm037_spi_dev, ARRAY_SIZE(pcm037_spi_dev));
|
|
imx31_add_spi_imx0(&pcm037_spi1_pdata);
|
|
|
|
imx_add_gpio_keys(&pcm037_gpio_keys_platform_data);
|
|
|
|
return 0;
|
|
}
|