linux/arch/arm/mach-omap2/common-board-devices.c
Linus Torvalds f1d2c07d33 arm-soc: board specific updates
These changes are all for individual board files. In the long run, those
 files will largely go away, and the amount of changes appears to be
 continuously decreasing, which is a good sign. This time around, changes
 are focused on tegra, omap and samsung.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.11 (GNU/Linux)
 
 iQIVAwUAUA2dfmCrR//JCVInAQLsaw//az90mZ0Tub0UO01D0uIJORBwD9JsMTQM
 W3/L3FEByskB+ZbJ6HG6XEYIzbJZxN49RbXOl0DGOuqfAlAGO61jVMaSkOKsqMCz
 WoLxaMZFOB7UBCGD+dvJYriirnS3OwFbCJ0Zn1xvBnpsYC2qavhorpvIXcYHh/mK
 v1zBNuDWVeedKsjYQWEAI2O1kCRuFa0P91YlmdKA3pQ9kKoA/WORHVA2i8Ou+5Mc
 5Yu1JQCxfJPFA0HA612zdj8bbQbqanlKgGlm7dYJ9lLSZBnQolrVMnLhVhl5wf8d
 YWlJsDdSyrbIY/HFd2xul4kWGZSg1PoKDFNwBDHoBBzdR25kXmER92PuskpwBeDo
 Nv56W7Hx2q7tob1woG5kE1tZFlE1cCT/MCVoLGDwpZnFJE0pBA1Hua15mB829k2y
 2vnXjRIM3j020cMC9Qa9/6aFgQu5ojCvHTuKBEwFX4zxZGGrYStINhE8jg4MXI9Y
 NOaqo1MP2X84T7ONuWaiJv6MyluhdGofbzWyxVU7Af+im6N8M3Lezmw8mMfsXwiw
 URHHOKnBmbkQxAUKWq+G7xr+Ti5JxLkCSUrJffJSkXPOBojKnaAegRBxexM9NhTB
 Y6NPt0zKxiJqyFpW4WZ8+29GP6RbwRhoeUNyI88i3RQwa3pwHAOiExZ3q86no9rO
 ONQe3uLFr3k=
 =nKn1
 -----END PGP SIGNATURE-----

Merge tag 'boards' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc

Pull arm-soc board specific updates from Arnd Bergmann:
 "These changes are all for individual board files.  In the long run,
  those files will largely go away, and the amount of changes appears to
  be continuously decreasing, which is a good sign.  This time around,
  changes are focused on tegra, omap and samsung."

Fix conflicts in arch/arm/mach-{omap2/common-board-devices.c,tegra/Makefile.boot}
as per the 'for-linus' branch.

* tag 'boards' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc: (39 commits)
  ARM: EXYNOS: Add leds status1 and status2 on Origen board
  ARM: S3C64XX: Mark most Cragganmore initdata devinitdata
  ARM: EXYNOS: Add missing .reserve field to SMDKC210
  ARM: EXYNOS: Add DRM device to SMDK4X12 board
  ARM: S3C64XX: Clean up after SPI driver platform data updates
  ARM: SAMSUNG: no need to set the value for clk_xusbxti when it is 24Mhz
  ARM: EXYNOS: Add framebuffer support for SMDK4X12
  ARM: EXYNOS: Add HSOTG support to SMDK4X12
  ARM: S5PV210: Add audio platform device in Goni board
  ARM: S5PV210: Add audio platform device in Aquila board
  ARM: EXYNOS: Add audio platform device in SMDKV310 board
  ARM: S3C64XX: Don't specify an irq_base for WM1192-EV1 board
  ARM: OMAP3: Fix omap3evm randconfig error introduced by VBUS support
  ARM: OMAP: board-omap4panda: MUX configuration for sys_nirq2
  ARM: OMAP: board-4430sdp: MUX configuration for sys_nirq2
  ARM: OMAP3530evm: set pendown_state and debounce time for ads7846
  ARM: omap3evm: enable VBUS switch for EHCI tranceiver
  ARM: OMAP3EVM: Adding USB internal LDOs board file
  ARM: OMAP3EVM: Add NAND flash definition
  ARM: OMAP3: cm-t35: add tvp5150 decoder support
  ...
2012-07-23 17:34:48 -07:00

154 lines
4 KiB
C

/*
* common-board-devices.c
*
* Copyright (C) 2011 CompuLab, Ltd.
* Author: Mike Rapoport <mike@compulab.co.il>
*
* 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.
*
* 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., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA
*
*/
#include <linux/gpio.h>
#include <linux/spi/spi.h>
#include <linux/spi/ads7846.h>
#include <plat/mcspi.h>
#include <plat/nand.h>
#include "common-board-devices.h"
#if defined(CONFIG_TOUCHSCREEN_ADS7846) || \
defined(CONFIG_TOUCHSCREEN_ADS7846_MODULE)
static struct omap2_mcspi_device_config ads7846_mcspi_config = {
.turbo_mode = 0,
};
/*
* ADS7846 driver maybe request a gpio according to the value
* of pdata->get_pendown_state, but we have done this. So set
* get_pendown_state to avoid twice gpio requesting.
*/
static int omap3_get_pendown_state(void)
{
return !gpio_get_value(OMAP3_EVM_TS_GPIO);
}
static struct ads7846_platform_data ads7846_config = {
.x_max = 0x0fff,
.y_max = 0x0fff,
.x_plate_ohms = 180,
.pressure_max = 255,
.debounce_max = 10,
.debounce_tol = 3,
.debounce_rep = 1,
.gpio_pendown = -EINVAL,
.keep_vref_on = 1,
.get_pendown_state = &omap3_get_pendown_state,
};
static struct spi_board_info ads7846_spi_board_info __initdata = {
.modalias = "ads7846",
.bus_num = -EINVAL,
.chip_select = 0,
.max_speed_hz = 1500000,
.controller_data = &ads7846_mcspi_config,
.irq = -EINVAL,
.platform_data = &ads7846_config,
};
void __init omap_ads7846_init(int bus_num, int gpio_pendown, int gpio_debounce,
struct ads7846_platform_data *board_pdata)
{
struct spi_board_info *spi_bi = &ads7846_spi_board_info;
int err;
err = gpio_request_one(gpio_pendown, GPIOF_IN, "TSPenDown");
if (err) {
pr_err("Couldn't obtain gpio for TSPenDown: %d\n", err);
return;
}
if (gpio_debounce)
gpio_set_debounce(gpio_pendown, gpio_debounce);
spi_bi->bus_num = bus_num;
spi_bi->irq = gpio_to_irq(gpio_pendown);
if (board_pdata) {
board_pdata->gpio_pendown = gpio_pendown;
spi_bi->platform_data = board_pdata;
if (board_pdata->get_pendown_state)
gpio_export(gpio_pendown, 0);
} else {
ads7846_config.gpio_pendown = gpio_pendown;
}
if (!board_pdata || (board_pdata && !board_pdata->get_pendown_state))
gpio_free(gpio_pendown);
spi_register_board_info(&ads7846_spi_board_info, 1);
}
#else
void __init omap_ads7846_init(int bus_num, int gpio_pendown, int gpio_debounce,
struct ads7846_platform_data *board_pdata)
{
}
#endif
#if defined(CONFIG_MTD_NAND_OMAP2) || defined(CONFIG_MTD_NAND_OMAP2_MODULE)
static struct omap_nand_platform_data nand_data;
void __init omap_nand_flash_init(int options, struct mtd_partition *parts,
int nr_parts)
{
u8 cs = 0;
u8 nandcs = GPMC_CS_NUM + 1;
/* find out the chip-select on which NAND exists */
while (cs < GPMC_CS_NUM) {
u32 ret = 0;
ret = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG1);
if ((ret & 0xC00) == 0x800) {
printk(KERN_INFO "Found NAND on CS%d\n", cs);
if (nandcs > GPMC_CS_NUM)
nandcs = cs;
}
cs++;
}
if (nandcs > GPMC_CS_NUM) {
printk(KERN_INFO "NAND: Unable to find configuration "
"in GPMC\n ");
return;
}
if (nandcs < GPMC_CS_NUM) {
nand_data.cs = nandcs;
nand_data.parts = parts;
nand_data.nr_parts = nr_parts;
nand_data.devsize = options;
printk(KERN_INFO "Registering NAND on CS%d\n", nandcs);
if (gpmc_nand_init(&nand_data) < 0)
printk(KERN_ERR "Unable to register NAND device\n");
}
}
#else
void __init omap_nand_flash_init(int options, struct mtd_partition *parts,
int nr_parts)
{
}
#endif