#include <linux/input.h>
#include <linux/i2c/tps65010.h>
#include <linux/workqueue.h>
-#include <linux/spi/spi.h>
-#include <linux/spi/tsc2101.h>
#include <linux/clk.h>
#include <mach/hardware.h>
#include <asm/mach/flash.h>
#include <asm/mach/map.h>
+#include <mach/dma.h>
#include <mach/gpio.h>
#include <mach/gpio-switch.h>
#include <mach/mux.h>
#include <mach/usb.h>
#include <mach/keypad.h>
#include <mach/common.h>
-#include <mach/mcbsp.h>
-#include <mach/omap-alsa.h>
static int h2_keymap[] = {
KEY(0, 0, KEY_LEFT),
#if defined(CONFIG_OMAP_IR) || defined(CONFIG_OMAP_IR_MODULE)
static int h2_transceiver_mode(struct device *dev, int state)
{
- if (state & IR_SIRMODE)
- omap_set_gpio_dataout(H2_IRDA_FIRSEL_GPIO_PIN, 0);
- else /* MIR/FIR */
- omap_set_gpio_dataout(H2_IRDA_FIRSEL_GPIO_PIN, 1);
-
+ /* SIR when low, else MIR/FIR when HIGH */
+ gpio_set_value(H2_IRDA_FIRSEL_GPIO_PIN, !(state & IR_SIRMODE));
return 0;
}
#endif
.id = -1,
};
-struct {
- struct clk *mclk;
- int initialized;
-} h2_tsc2101;
-
-#define TSC2101_MUX_MCLK_ON R10_1610_MCLK_ON
-#define TSC2101_MUX_MCLK_OFF R10_1610_MCLK_OFF
-
-static void h2_lcd_dev_init(struct spi_device *tsc2101)
-{
- /* The LCD is connected to the GPIO pins of the TSC2101, so
- * we have to tie them here. We can also register the LCD driver
- * first only here, where we know that the TSC driver is ready.
- */
-
- h2_lcd_device.dev.platform_data = tsc2101;
- platform_device_register(&h2_lcd_device);
-}
-
-static struct omap_mcbsp_reg_cfg mcbsp_regs = {
- .spcr2 = FREE | FRST | GRST | XRST | XINTM(3),
- .spcr1 = RINTM(3) | RRST,
- .rcr2 = RPHASE | RFRLEN2(OMAP_MCBSP_WORD_8) |
- RWDLEN2(OMAP_MCBSP_WORD_16) | RDATDLY(1),
- .rcr1 = RFRLEN1(OMAP_MCBSP_WORD_8) | RWDLEN1(OMAP_MCBSP_WORD_16),
- .xcr2 = XPHASE | XFRLEN2(OMAP_MCBSP_WORD_8) |
- XWDLEN2(OMAP_MCBSP_WORD_16) | XDATDLY(1) | XFIG,
- .xcr1 = XFRLEN1(OMAP_MCBSP_WORD_8) | XWDLEN1(OMAP_MCBSP_WORD_16),
- .srgr1 = FWID(15),
- .srgr2 = GSYNC | CLKSP | FSGM | FPER(31),
- .pcr0 = CLKXM | CLKRM | FSXP | FSRP | CLKXP | CLKRP,
- /*.pcr0 = CLKXP | CLKRP,*/ /* mcbsp: slave */
-};
-
-static struct omap_alsa_codec_config alsa_config = {
- .name = "H2 TSC2101",
- .mcbsp_regs_alsa = &mcbsp_regs,
-};
-
-static struct platform_device h2_mcbsp1_device = {
- .name = "omap_alsa_mcbsp",
- .id = 1,
- .dev = {
- .platform_data = &alsa_config,
- },
-};
-
-static void h2_audio_dev_init(struct spi_device *tsc2101)
-{
- h2_mcbsp1_device.dev.platform_data = tsc2101;
- platform_device_register(&h2_mcbsp1_device);
-}
-
-static int h2_tsc2101_init(struct spi_device *spi)
-{
- int r;
-
- if (h2_tsc2101.initialized) {
- printk(KERN_ERR "tsc2101: already initialized\n");
- return -ENODEV;
- }
-
- /* Get the MCLK */
- h2_tsc2101.mclk = clk_get(&spi->dev, "mclk");
- if (IS_ERR(h2_tsc2101.mclk)) {
- dev_err(&spi->dev, "unable to get the clock MCLK\n");
- return PTR_ERR(h2_tsc2101.mclk);
- }
- if ((r = clk_set_rate(h2_tsc2101.mclk, 12000000)) < 0) {
- dev_err(&spi->dev, "unable to set rate to the MCLK\n");
- goto err;
- }
-
- omap_cfg_reg(TSC2101_MUX_MCLK_OFF);
- omap_cfg_reg(N15_1610_UWIRE_CS1);
-
- h2_lcd_dev_init(spi);
- h2_audio_dev_init(spi);
-
- return 0;
-err:
- clk_put(h2_tsc2101.mclk);
- return r;
-}
-
-static void h2_tsc2101_cleanup(struct spi_device *spi)
-{
- clk_put(h2_tsc2101.mclk);
- omap_cfg_reg(TSC2101_MUX_MCLK_OFF);
-}
-
-static void h2_tsc2101_enable_mclk(struct spi_device *spi)
-{
- omap_cfg_reg(TSC2101_MUX_MCLK_ON);
- clk_enable(h2_tsc2101.mclk);
-}
-
-static void h2_tsc2101_disable_mclk(struct spi_device *spi)
-{
- clk_disable(h2_tsc2101.mclk);
- omap_cfg_reg(R10_1610_MCLK_OFF);
-}
-
-static struct tsc2101_platform_data h2_tsc2101_platform_data = {
- .init = h2_tsc2101_init,
- .cleanup = h2_tsc2101_cleanup,
- .enable_mclk = h2_tsc2101_enable_mclk,
- .disable_mclk = h2_tsc2101_disable_mclk,
-};
-
-static struct spi_board_info h2_spi_board_info[] __initdata = {
- [0] = {
- .modalias = "tsc2101",
- .bus_num = 2,
- .chip_select = 1,
- .max_speed_hz = 16000000,
- .platform_data = &h2_tsc2101_platform_data,
- },
-};
-
static struct platform_device *h2_devices[] __initdata = {
&h2_nor_device,
&h2_nand_device,
&h2_smc91x_device,
&h2_irda_device,
&h2_kp_device,
+ &h2_lcd_device,
};
static void __init h2_init_smc91x(void)
{
- if ((omap_request_gpio(0)) < 0) {
+ if (gpio_request(0, "SMC91x irq") < 0) {
printk("Error requesting gpio 0 for smc91x irq\n");
return;
}
}
+static int tps_setup(struct i2c_client *client, void *context)
+{
+ tps65010_config_vregs1(TPS_LDO2_ENABLE | TPS_VLDO2_3_0V |
+ TPS_LDO1_ENABLE | TPS_VLDO1_3_0V);
+
+ return 0;
+}
+
+static struct tps65010_board tps_board = {
+ .base = H2_TPS_GPIO_BASE,
+ .outmask = 0x0f,
+ .setup = tps_setup,
+};
+
static struct i2c_board_info __initdata h2_i2c_board_info[] = {
{
I2C_BOARD_INFO("tps65010", 0x48),
.irq = OMAP_GPIO_IRQ(58),
+ .platform_data = &tps_board,
}, {
I2C_BOARD_INFO("isp1301_omap", 0x2d),
.irq = OMAP_GPIO_IRQ(2),
{ OMAP_TAG_LCD, &h2_lcd_config },
};
-static struct omap_gpio_switch h2_gpio_switches[] __initdata = {
- {
- .name = "mmc_slot",
- .gpio = OMAP_MPUIO(1),
- .type = OMAP_GPIO_SWITCH_TYPE_COVER,
- .debounce_rising = 100,
- .debounce_falling = 0,
- .notify = h2_mmc_slot_cover_handler,
- .notify_data = NULL,
- },
-};
-
#define H2_NAND_RB_GPIO_PIN 62
static int h2_nand_dev_ready(struct omap_nand_platform_data *data)
{
- return omap_get_gpio_datain(H2_NAND_RB_GPIO_PIN);
+ return gpio_get_value(H2_NAND_RB_GPIO_PIN);
}
static void __init h2_init(void)
h2_nand_resource.end = h2_nand_resource.start = OMAP_CS2B_PHYS;
h2_nand_resource.end += SZ_4K - 1;
- if (!(omap_request_gpio(H2_NAND_RB_GPIO_PIN)))
- h2_nand_data.dev_ready = h2_nand_dev_ready;
+ if (gpio_request(H2_NAND_RB_GPIO_PIN, "NAND ready") < 0)
+ BUG();
+ gpio_direction_input(H2_NAND_RB_GPIO_PIN);
omap_cfg_reg(L3_1610_FLASH_CS2B_OE);
omap_cfg_reg(M8_1610_FLASH_CS2B_WE);
/* Irda */
#if defined(CONFIG_OMAP_IR) || defined(CONFIG_OMAP_IR_MODULE)
omap_writel(omap_readl(FUNC_MUX_CTRL_A) | 7, FUNC_MUX_CTRL_A);
- if (!(omap_request_gpio(H2_IRDA_FIRSEL_GPIO_PIN))) {
- omap_set_gpio_direction(H2_IRDA_FIRSEL_GPIO_PIN, 0);
+ if (!(gpio_request(H2_IRDA_FIRSEL_GPIO_PIN, "irda firsel"))) {
+ gpio_direction_output(H2_IRDA_FIRSEL_GPIO_PIN);
h2_irda_data.transceiver_mode = h2_transceiver_mode;
}
#endif
platform_add_devices(h2_devices, ARRAY_SIZE(h2_devices));
- spi_register_board_info(h2_spi_board_info,
- ARRAY_SIZE(h2_spi_board_info));
omap_board_config = h2_config;
omap_board_config_size = ARRAY_SIZE(h2_config);
omap_serial_init();
omap_register_i2c_bus(1, 100, h2_i2c_board_info,
ARRAY_SIZE(h2_i2c_board_info));
h2_mmc_init();
- omap_register_gpio_switches(h2_gpio_switches,
- ARRAY_SIZE(h2_gpio_switches));
}
static void __init h2_map_io(void)