Skip to content

Commit

Permalink
Merge branch 'devel-gpio' into omap-for-linus
Browse files Browse the repository at this point in the history
  • Loading branch information
Tony Lindgren committed Dec 10, 2010
2 parents b2d6fef + 5de62b8 commit 79b357c
Show file tree
Hide file tree
Showing 51 changed files with 2,175 additions and 538 deletions.
6 changes: 6 additions & 0 deletions arch/arm/mach-omap1/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ ifeq ($(CONFIG_ARCH_OMAP15XX),y)
obj-$(CONFIG_MACH_OMAP_INNOVATOR) += fpga.o
endif

# GPIO
obj-$(CONFIG_ARCH_OMAP730) += gpio7xx.o
obj-$(CONFIG_ARCH_OMAP850) += gpio7xx.o
obj-$(CONFIG_ARCH_OMAP15XX) += gpio15xx.o
obj-$(CONFIG_ARCH_OMAP16XX) += gpio16xx.o

# LEDs support
led-$(CONFIG_MACH_OMAP_H2) += leds-h2p2-debug.o
led-$(CONFIG_MACH_OMAP_H3) += leds-h2p2-debug.o
Expand Down
1 change: 0 additions & 1 deletion arch/arm/mach-omap1/board-ams-delta.c
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,6 @@ static void __init ams_delta_init_irq(void)
{
omap1_init_common_hw();
omap_init_irq();
omap_gpio_init();
}

static struct map_desc ams_delta_io_desc[] __initdata = {
Expand Down
22 changes: 11 additions & 11 deletions arch/arm/mach-omap1/board-fsample.c
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,15 @@ static struct resource smc91x_resources[] = {
},
};

static void __init fsample_init_smc91x(void)
{
fpga_write(1, H2P2_DBG_FPGA_LAN_RESET);
mdelay(50);
fpga_write(fpga_read(H2P2_DBG_FPGA_LAN_RESET) & ~1,
H2P2_DBG_FPGA_LAN_RESET);
mdelay(50);
}

static struct mtd_partition nor_partitions[] = {
/* bootloader (U-Boot, etc) in first sector */
{
Expand Down Expand Up @@ -285,6 +294,8 @@ static struct omap_board_config_kernel fsample_config[] = {

static void __init omap_fsample_init(void)
{
fsample_init_smc91x();

if (gpio_request(FSAMPLE_NAND_RB_GPIO_PIN, "NAND ready") < 0)
BUG();
gpio_direction_input(FSAMPLE_NAND_RB_GPIO_PIN);
Expand Down Expand Up @@ -312,21 +323,10 @@ static void __init omap_fsample_init(void)
omap_register_i2c_bus(1, 100, NULL, 0);
}

static void __init fsample_init_smc91x(void)
{
fpga_write(1, H2P2_DBG_FPGA_LAN_RESET);
mdelay(50);
fpga_write(fpga_read(H2P2_DBG_FPGA_LAN_RESET) & ~1,
H2P2_DBG_FPGA_LAN_RESET);
mdelay(50);
}

static void __init omap_fsample_init_irq(void)
{
omap1_init_common_hw();
omap_init_irq();
omap_gpio_init();
fsample_init_smc91x();
}

/* Only FPGA needs to be mapped here. All others are done with ioremap */
Expand Down
4 changes: 2 additions & 2 deletions arch/arm/mach-omap1/board-h2.c
Original file line number Diff line number Diff line change
Expand Up @@ -374,8 +374,6 @@ static void __init h2_init_irq(void)
{
omap1_init_common_hw();
omap_init_irq();
omap_gpio_init();
h2_init_smc91x();
}

static struct omap_usb_config h2_usb_config __initdata = {
Expand Down Expand Up @@ -403,6 +401,8 @@ static struct omap_board_config_kernel h2_config[] __initdata = {

static void __init h2_init(void)
{
h2_init_smc91x();

/* Here we assume the NOR boot config: NOR on CS3 (possibly swapped
* to address 0 by a dip switch), NAND on CS2B. The NAND driver will
* notice whether a NAND chip is enabled at probe time.
Expand Down
22 changes: 11 additions & 11 deletions arch/arm/mach-omap1/board-h3.c
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,15 @@ static struct platform_device smc91x_device = {
.resource = smc91x_resources,
};

static void __init h3_init_smc91x(void)
{
omap_cfg_reg(W15_1710_GPIO40);
if (gpio_request(40, "SMC91x irq") < 0) {
printk("Error requesting gpio 40 for smc91x irq\n");
return;
}
}

#define GPTIMER_BASE 0xFFFB1400
#define GPTIMER_REGS(x) (0xFFFB1400 + (x * 0x800))
#define GPTIMER_REGS_SIZE 0x46
Expand Down Expand Up @@ -376,6 +385,8 @@ static struct i2c_board_info __initdata h3_i2c_board_info[] = {

static void __init h3_init(void)
{
h3_init_smc91x();

/* Here we assume the NOR boot config: NOR on CS3 (possibly swapped
* to address 0 by a dip switch), NAND on CS2B. The NAND driver will
* notice whether a NAND chip is enabled at probe time.
Expand Down Expand Up @@ -422,21 +433,10 @@ static void __init h3_init(void)
h3_mmc_init();
}

static void __init h3_init_smc91x(void)
{
omap_cfg_reg(W15_1710_GPIO40);
if (gpio_request(40, "SMC91x irq") < 0) {
printk("Error requesting gpio 40 for smc91x irq\n");
return;
}
}

static void __init h3_init_irq(void)
{
omap1_init_common_hw();
omap_init_irq();
omap_gpio_init();
h3_init_smc91x();
}

static void __init h3_map_io(void)
Expand Down
2 changes: 0 additions & 2 deletions arch/arm/mach-omap1/board-htcherald.c
Original file line number Diff line number Diff line change
Expand Up @@ -577,8 +577,6 @@ static void __init htcherald_init(void)
printk(KERN_INFO "HTC Herald init.\n");

/* Do board initialization before we register all the devices */
omap_gpio_init();

omap_board_config = htcherald_config;
omap_board_config_size = ARRAY_SIZE(htcherald_config);
platform_add_devices(devices, ARRAY_SIZE(devices));
Expand Down
4 changes: 2 additions & 2 deletions arch/arm/mach-omap1/board-innovator.c
Original file line number Diff line number Diff line change
Expand Up @@ -290,13 +290,11 @@ static void __init innovator_init_irq(void)
{
omap1_init_common_hw();
omap_init_irq();
omap_gpio_init();
#ifdef CONFIG_ARCH_OMAP15XX
if (cpu_is_omap1510()) {
omap1510_fpga_init_irq();
}
#endif
innovator_init_smc91x();
}

#ifdef CONFIG_ARCH_OMAP15XX
Expand Down Expand Up @@ -387,6 +385,8 @@ static struct omap_board_config_kernel innovator_config[] = {

static void __init innovator_init(void)
{
innovator_init_smc91x();

#ifdef CONFIG_ARCH_OMAP15XX
if (cpu_is_omap1510()) {
unsigned char reg;
Expand Down
1 change: 0 additions & 1 deletion arch/arm/mach-omap1/board-nokia770.c
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,6 @@ static void __init omap_nokia770_init(void)
platform_add_devices(nokia770_devices, ARRAY_SIZE(nokia770_devices));
spi_register_board_info(nokia770_spi_board_info,
ARRAY_SIZE(nokia770_spi_board_info));
omap_gpio_init();
omap_serial_init();
omap_register_i2c_bus(1, 100, NULL, 0);
hwa742_dev_init();
Expand Down
6 changes: 3 additions & 3 deletions arch/arm/mach-omap1/board-osk.c
Original file line number Diff line number Diff line change
Expand Up @@ -283,9 +283,6 @@ static void __init osk_init_irq(void)
{
omap1_init_common_hw();
omap_init_irq();
omap_gpio_init();
osk_init_smc91x();
osk_init_cf();
}

static struct omap_usb_config osk_usb_config __initdata = {
Expand Down Expand Up @@ -541,6 +538,9 @@ static void __init osk_init(void)
{
u32 l;

osk_init_smc91x();
osk_init_cf();

/* Workaround for wrong CS3 (NOR flash) timing
* There are some U-Boot versions out there which configure
* wrong CS3 memory timings. This mainly leads to CRC
Expand Down
1 change: 0 additions & 1 deletion arch/arm/mach-omap1/board-palmte.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ static void __init omap_palmte_init_irq(void)
{
omap1_init_common_hw();
omap_init_irq();
omap_gpio_init();
}

static const int palmte_keymap[] = {
Expand Down
1 change: 0 additions & 1 deletion arch/arm/mach-omap1/board-palmz71.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ omap_palmz71_init_irq(void)
{
omap1_init_common_hw();
omap_init_irq();
omap_gpio_init();
}

static int palmz71_keymap[] = {
Expand Down
22 changes: 11 additions & 11 deletions arch/arm/mach-omap1/board-perseus2.c
Original file line number Diff line number Diff line change
Expand Up @@ -251,8 +251,19 @@ static struct omap_board_config_kernel perseus2_config[] __initdata = {
{ OMAP_TAG_LCD, &perseus2_lcd_config },
};

static void __init perseus2_init_smc91x(void)
{
fpga_write(1, H2P2_DBG_FPGA_LAN_RESET);
mdelay(50);
fpga_write(fpga_read(H2P2_DBG_FPGA_LAN_RESET) & ~1,
H2P2_DBG_FPGA_LAN_RESET);
mdelay(50);
}

static void __init omap_perseus2_init(void)
{
perseus2_init_smc91x();

if (gpio_request(P2_NAND_RB_GPIO_PIN, "NAND ready") < 0)
BUG();
gpio_direction_input(P2_NAND_RB_GPIO_PIN);
Expand Down Expand Up @@ -280,21 +291,10 @@ static void __init omap_perseus2_init(void)
omap_register_i2c_bus(1, 100, NULL, 0);
}

static void __init perseus2_init_smc91x(void)
{
fpga_write(1, H2P2_DBG_FPGA_LAN_RESET);
mdelay(50);
fpga_write(fpga_read(H2P2_DBG_FPGA_LAN_RESET) & ~1,
H2P2_DBG_FPGA_LAN_RESET);
mdelay(50);
}

static void __init omap_perseus2_init_irq(void)
{
omap1_init_common_hw();
omap_init_irq();
omap_gpio_init();
perseus2_init_smc91x();
}
/* Only FPGA needs to be mapped here. All others are done with ioremap */
static struct map_desc omap_perseus2_io_desc[] __initdata = {
Expand Down
1 change: 0 additions & 1 deletion arch/arm/mach-omap1/board-sx1.c
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,6 @@ static void __init omap_sx1_init_irq(void)
{
omap1_init_common_hw();
omap_init_irq();
omap_gpio_init();
}
/*----------------------------------------*/

Expand Down
1 change: 0 additions & 1 deletion arch/arm/mach-omap1/board-voiceblue.c
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,6 @@ static void __init voiceblue_init_irq(void)
{
omap1_init_common_hw();
omap_init_irq();
omap_gpio_init();
}

static void __init voiceblue_init(void)
Expand Down
4 changes: 2 additions & 2 deletions arch/arm/mach-omap1/clock_data.c
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ static struct arm_idlect1_clk armper_ck = {
* activation. [ GPIO code for 1510 ]
*/
static struct clk arm_gpio_ck = {
.name = "arm_gpio_ck",
.name = "ick",
.ops = &clkops_generic,
.parent = &ck_dpll1,
.flags = ENABLE_ON_INIT,
Expand Down Expand Up @@ -684,7 +684,7 @@ static struct omap_clk omap_clks[] = {
CLK(NULL, "ck_sossi", &sossi_ck, CK_16XX),
CLK(NULL, "arm_ck", &arm_ck, CK_16XX | CK_1510 | CK_310),
CLK(NULL, "armper_ck", &armper_ck.clk, CK_16XX | CK_1510 | CK_310),
CLK(NULL, "arm_gpio_ck", &arm_gpio_ck, CK_1510 | CK_310),
CLK("omap_gpio.0", "ick", &arm_gpio_ck, CK_1510 | CK_310),
CLK(NULL, "armxor_ck", &armxor_ck.clk, CK_16XX | CK_1510 | CK_310 | CK_7XX),
CLK(NULL, "armtim_ck", &armtim_ck.clk, CK_16XX | CK_1510 | CK_310),
CLK("omap_wdt", "fck", &armwdt_ck.clk, CK_16XX | CK_1510 | CK_310),
Expand Down
99 changes: 99 additions & 0 deletions arch/arm/mach-omap1/gpio15xx.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
/*
* OMAP15xx specific gpio init
*
* Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/
*
* Author:
* Charulatha V <charu@ti.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation version 2.
*
* This program is distributed "as is" WITHOUT ANY WARRANTY of any
* kind, whether express or implied; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/

#include <linux/gpio.h>

#define OMAP1_MPUIO_VBASE OMAP1_MPUIO_BASE
#define OMAP1510_GPIO_BASE 0xFFFCE000

/* gpio1 */
static struct __initdata resource omap15xx_mpu_gpio_resources[] = {
{
.start = OMAP1_MPUIO_VBASE,
.end = OMAP1_MPUIO_VBASE + SZ_2K - 1,
.flags = IORESOURCE_MEM,
},
{
.start = INT_MPUIO,
.flags = IORESOURCE_IRQ,
},
};

static struct __initdata omap_gpio_platform_data omap15xx_mpu_gpio_config = {
.virtual_irq_start = IH_MPUIO_BASE,
.bank_type = METHOD_MPUIO,
.bank_width = 16,
.bank_stride = 1,
};

static struct __initdata platform_device omap15xx_mpu_gpio = {
.name = "omap_gpio",
.id = 0,
.dev = {
.platform_data = &omap15xx_mpu_gpio_config,
},
.num_resources = ARRAY_SIZE(omap15xx_mpu_gpio_resources),
.resource = omap15xx_mpu_gpio_resources,
};

/* gpio2 */
static struct __initdata resource omap15xx_gpio_resources[] = {
{
.start = OMAP1510_GPIO_BASE,
.end = OMAP1510_GPIO_BASE + SZ_2K - 1,
.flags = IORESOURCE_MEM,
},
{
.start = INT_GPIO_BANK1,
.flags = IORESOURCE_IRQ,
},
};

static struct __initdata omap_gpio_platform_data omap15xx_gpio_config = {
.virtual_irq_start = IH_GPIO_BASE,
.bank_type = METHOD_GPIO_1510,
.bank_width = 16,
};

static struct __initdata platform_device omap15xx_gpio = {
.name = "omap_gpio",
.id = 1,
.dev = {
.platform_data = &omap15xx_gpio_config,
},
.num_resources = ARRAY_SIZE(omap15xx_gpio_resources),
.resource = omap15xx_gpio_resources,
};

/*
* omap15xx_gpio_init needs to be done before
* machine_init functions access gpio APIs.
* Hence omap15xx_gpio_init is a postcore_initcall.
*/
static int __init omap15xx_gpio_init(void)
{
if (!cpu_is_omap15xx())
return -EINVAL;

platform_device_register(&omap15xx_mpu_gpio);
platform_device_register(&omap15xx_gpio);

gpio_bank_count = 2;
return 0;
}
postcore_initcall(omap15xx_gpio_init);
Loading

0 comments on commit 79b357c

Please sign in to comment.