mirror of
https://github.com/torvalds/linux.git
synced 2024-11-20 11:01:38 +00:00
3c101c41fb
These changes fix some of the more meaningful warnings that smatch returns for the OMAP subarch code, and unwraps strings that are wrapped at the 80-column boundary, to conform with the current practice. Basic build, boot, and PM logs are available here: http://www.pwsan.com/omap/testlogs/warnings_a_cleanup_3.7/20120912025927/ -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) iQIcBAABAgAGBQJQUKL1AAoJEMePsQ0LvSpL+a8QAJlJR9uwqUKu60GfbQEeegce k6pr0xXYvHEmbro/v6O4ezs2o716EBgwBWnId97oOZvVnwhPbEHR87UH8FFOIWOQ +/ui5MxXtYWNjYcDOzdF95reFM1szAAxQu8k9wXg+WBtZ4zCkhknpoftShRbOdg0 BgO0r1iY/wuoFaYgGFKSNdObPVgSTENjbtg/LVvB/V3PQjYmUBosJVH0tPO/LQio pWhozfFuiWbARYxPg6dMOn8yQ5mCeWErpv4WZjM+dgcrkLYyPdI2uUS3Ka8F7Az2 ImC+k0gU6WwkjyKqv/SG2wg5+3Sh8ZZsX0EKXwq0gQEmLWacENS1ELRT3+HcxGru HoAhE46URb4NGzBt7rkIkGg0HcajfORDtZSrGfsEclDmrVV5+JgUzC+PEDiwSxVU LqpJIZ8lxjqBNPSlmXqtEgTG32M6E9fDII8JdGC64vUv+vXzuhpJCXF78I8+A+Hv oSBbTOCzYGz1xp06G6Hzadpo5I1LocBRemsnhw2O9oNDdUZxiGo/qJcWfk2wpMQ6 4c/kHbYEsJ6/7eVe5kNtdkeptAXp1AFO5XIhQpSAs1O1Rr++nDNahaUJA56xev8x GoEZCYLGMGpQnINW6g0Srzwp8n1ywSgt3Gt2fbDTAP+Q02DPT3IIWWs4LlIDIrjZ w0q1kAp1+In5is3pxJvT =ythb -----END PGP SIGNATURE----- Merge tag 'omap-cleanup-b-for-3.7' of git://git.kernel.org/pub/scm/linux/kernel/git/pjw/omap-pending into cleanup-makefile-sparse smatch and string-wrapping cleanups for the OMAP subarch code. These changes fix some of the more meaningful warnings that smatch returns for the OMAP subarch code, and unwraps strings that are wrapped at the 80-column boundary, to conform with the current practice. Basic build, boot, and PM logs are available here: http://www.pwsan.com/omap/testlogs/warnings_a_cleanup_3.7/20120912025927/
144 lines
3.7 KiB
C
144 lines
3.7 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.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,
|
|
};
|
|
|
|
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,
|
|
};
|
|
|
|
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) {
|
|
pr_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
|