Skip to contentSkip to conversation

Add allowance for extra IRQ space

PATCH In review Cory Maccarrone 1 participant 6 messages Jul 20, 2010

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 2/7 Add allowance for extra IRQ space

This change adds a configuration option that boards can specify that gives them an additional 64 or 128 IRQ lines to play with. This is most useful if there are external interrupt-producing devices connected to the board.

---
 arch/arm/plat-omap/Kconfig             |   18 ++++++++++++++++++
 arch/arm/plat-omap/include/plat/irqs.h |    6 +++++-
 2 files changed, 23 insertions(+), 1 deletions(-)
arch/arm/plat-omap/Kconfig +18 -0
index 5bc7a79..5ebbd91 100644
@@ -20,6 +20,24 @@ config OMAP_GPIO_EXTRA128
 	  Add an extra 128 gpio numbers to the available GPIO pool. This is
 	  available for boards that need extra gpios for external devices.
 
+config OMAP_IRQ_EXTRA
+	int
+	default 128 if OMAP_IRQ_EXTRA128
+	default 64 if OMAP_IRQ_EXTRA64
+	default 0
+
+config OMAP_IRQ_EXTRA64
+	bool
+	help
+	  Add an extra 64 irq numbers to the available IRQ pool. This is
+	  available for boards that need extra interrupts for external devices.
+
+config OMAP_IRQ_EXTRA128
+	bool
+	help
+	  Add an extra 128 irq numbers to the available IRQ pool. This is
+	  available for boards that need extra interrupts for external devices.
+
 config ARCH_OMAP_OTG
 	bool
 
arch/arm/plat-omap/include/plat/irqs.h +5 -1
index c01d9f0..2f14c78 100644
@@ -409,7 +409,11 @@
 #define TWL_IRQ_END		TWL6030_IRQ_END
 #endif
 
-#define NR_IRQS			TWL_IRQ_END
+/*
+ * Some boards require extra irq capacity to support external
+ * devices that generate interrupts.
+ */
+#define NR_IRQS			(TWL_IRQ_END + CONFIG_OMAP_IRQ_EXTRA)
 
 #define OMAP_IRQ_BIT(irq)	(1 << ((irq) % 32))
 
Signature · 1 line
1.7.0.4
#1 lore raw

PATCH 3/7 HTCHERALD: MMC, I2C, HTCPLD and related devices

This change adds in MMC and I2C support to the HTC Herald board, as well as adding the HTCPLD driver for the PLD used on this phone. It also adds in the gpio-keys entries for the front directional keys and selector and the cursor keys on the slide-out keyboard, and gpio-leds support for the LEDs attached to the htcpld.

The Kconfig was also modified to add 64 GPIOs and IRQs to the default maximum number of each for the HTC herald. This is needed because the HTCPLD chip on this board exposes an additional 32 gpios and 16 irqs that would not fit in the default limits.

---
 arch/arm/mach-omap1/Kconfig           |    2 +
 arch/arm/mach-omap1/board-htcherald.c |  288 ++++++++++++++++++++++++++++++++-
 2 files changed, 284 insertions(+), 6 deletions(-)
arch/arm/mach-omap1/Kconfig +2 -0
index 3b02d3b..94d5b52 100644
@@ -64,6 +64,8 @@ config MACH_OMAP_HTCWIZARD
 config MACH_HERALD
 	bool "HTC Herald"
 	depends on ARCH_OMAP850
+	select OMAP_GPIO_EXTRA64
+	select OMAP_IRQ_EXTRA64
 	help
 	  HTC Herald smartphone support (AKA T-Mobile Wing, ...)
 
arch/arm/mach-omap1/board-htcherald.c +282 -6

339 lines not on this page · raw message

Signature · 1 line
1.7.0.4
#2 lore raw

PATCH 4/7 htcherald: SPI register config, TSC2046 touchscreen

In reply to Cory Maccarrone

This change adds SPI bus support for the HTC Herald, and adds in support for the TSC2046-based touchscreen attached to this device (using the ADS7846 driver).

---
 arch/arm/mach-omap1/board-htcherald.c |   35 +++++++++++++++++++++++++++++++++
 1 files changed, 35 insertions(+), 0 deletions(-)
arch/arm/mach-omap1/board-htcherald.c +35 -0
index 2f0bb39..1b12b75 100644
@@ -35,6 +35,8 @@
 #include <linux/i2c-gpio.h>
 #include <linux/htcpld.h>
 #include <linux/leds.h>
+#include <linux/spi/spi.h>
+#include <linux/spi/ads7846.h>
 
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
@@ -63,6 +65,9 @@
 #define HTCHERALD_GPIO_SLIDE 174
 #define HTCHERALD_GIRQ_BTNS 141
 
+/* GPIO definitions for the touchscreen */
+#define HTCHERALD_GPIO_TS 76
+
 /* HTCPLD definitions */
 
 /*
@@ -429,6 +434,33 @@ static struct platform_device *devices[] __initdata = {
 };
 
 /*
+ * Touchscreen
+ */
+static const struct ads7846_platform_data htcherald_ts_platform_data = {
+	.model			= 7846,
+	.keep_vref_on		= 1,
+	.x_plate_ohms		= 496,
+	.gpio_pendown		= HTCHERALD_GPIO_TS,
+	.pressure_max		= 100000,
+	.pressure_min		= 5000,
+	.x_min			= 528,
+	.x_max			= 3760,
+	.y_min			= 624,
+	.y_max			= 3760,
+};
+
+static struct spi_board_info __initdata htcherald_spi_board_info[] = {
+	{
+		.modalias		= "ads7846",
+		.platform_data		= &htcherald_ts_platform_data,
+		.irq			= OMAP_GPIO_IRQ(HTCHERALD_GPIO_TS),
+		.max_speed_hz		= 2500000,
+		.bus_num		= 2,
+		.chip_select		= 1,
+	}
+};
+
+/*
  * Init functions from here on
  */
 
@@ -558,6 +590,9 @@ static void __init htcherald_init(void)
 	htcherald_usb_enable();
 	omap1_usb_init(&htcherald_usb_config);
 
+	spi_register_board_info(htcherald_spi_board_info,
+		ARRAY_SIZE(htcherald_spi_board_info));
+
 	omap_register_i2c_bus(1, 100, NULL, 0);
 
 #if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE)
Signature · 1 line
1.7.0.4
#3 lore raw

PATCH 5/7 omap7xx clocks, mux, serial fixes

In reply to Cory Maccarrone

This change adds in the necessary clocks and mux pins for UART control on omap7xx devices. I also made a change in the serial code to only try and initialize two UARTs in omap_serial_init, as these devices don't have three.

---
 arch/arm/mach-omap1/clock_data.c      |   20 ++++++++++++++++++++
 arch/arm/mach-omap1/mux.c             |    4 ++++
 arch/arm/mach-omap1/serial.c          |    7 +++++++
 arch/arm/plat-omap/include/plat/mux.h |    4 ++++
 4 files changed, 35 insertions(+), 0 deletions(-)
arch/arm/mach-omap1/clock_data.c +20 -0
index ca4bd86..af54114 100644
@@ -551,6 +551,24 @@ static struct clk usb_dc_ck7xx = {
 	.enable_bit	= SOFT_USB_OTG_DPLL_REQ_SHIFT,
 };
 
+static struct clk uart1_7xx = {
+	.name		= "uart1_ck",
+	.ops		= &clkops_generic,
+	/* Direct from ULPD, no parent */
+	.rate		= 12000000,
+	.enable_reg	= OMAP1_IO_ADDRESS(SOFT_REQ_REG),
+	.enable_bit	= 9,
+};
+
+static struct clk uart2_7xx = {
+	.name		= "uart2_ck",
+	.ops		= &clkops_generic,
+	/* Direct from ULPD, no parent */
+	.rate		= 12000000,
+	.enable_reg	= OMAP1_IO_ADDRESS(SOFT_REQ_REG),
+	.enable_bit	= 11,
+};
+
 static struct clk mclk_1510 = {
 	.name		= "mclk",
 	.ops		= &clkops_generic,
@@ -697,7 +715,9 @@ static struct omap_clk omap_clks[] = {
 	/* ULPD clocks */
 	CLK(NULL,	"uart1_ck",	&uart1_1510,	CK_1510 | CK_310),
 	CLK(NULL,	"uart1_ck",	&uart1_16xx.clk, CK_16XX),
+	CLK(NULL,	"uart1_ck",	&uart1_7xx,	CK_7XX),
 	CLK(NULL,	"uart2_ck",	&uart2_ck,	CK_16XX | CK_1510 | CK_310),
+	CLK(NULL,	"uart2_ck",	&uart2_7xx,	CK_7XX),
 	CLK(NULL,	"uart3_ck",	&uart3_1510,	CK_1510 | CK_310),
 	CLK(NULL,	"uart3_ck",	&uart3_16xx.clk, CK_16XX),
 	CLK(NULL,	"usb_clko",	&usb_clko,	CK_16XX | CK_1510 | CK_310),
arch/arm/mach-omap1/mux.c +4 -0
index 3e98835..7835add 100644
@@ -70,6 +70,10 @@ MUX_CFG_7XX("SPI_7XX_3",           6,   13,    4,   12,   1, 0)
 MUX_CFG_7XX("SPI_7XX_4",           6,   17,    4,   16,   1, 0)
 MUX_CFG_7XX("SPI_7XX_5",           8,   25,    0,   24,   0, 0)
 MUX_CFG_7XX("SPI_7XX_6",           9,    5,    0,    4,   0, 0)
+
+/* UART pins */
+MUX_CFG_7XX("UART_7XX_1",          3,   21,    0,   20,   0, 0)
+MUX_CFG_7XX("UART_7XX_2",          8,    1,    6,    0,   0, 0)
 };
 #define OMAP7XX_PINS_SZ		ARRAY_SIZE(omap7xx_pins)
 #else
arch/arm/mach-omap1/serial.c +7 -0
index 349de90..b78d074 100644
@@ -122,6 +122,13 @@ void __init omap_serial_init(void)
 
 	for (i = 0; i < ARRAY_SIZE(serial_platform_data) - 1; i++) {
 
+		/* Don't look at UARTs higher than 2 for omap7xx */
+		if (cpu_is_omap7xx() && i > 1) {
+			serial_platform_data[i].membase = NULL;
+			serial_platform_data[i].mapbase = 0;
+			continue;
+		}
+
 		/* Static mapping, never released */
 		serial_platform_data[i].membase =
 			ioremap(serial_platform_data[i].mapbase, SZ_2K);
arch/arm/plat-omap/include/plat/mux.h +4 -0
index e1da7b1..aeba717 100644
@@ -173,6 +173,10 @@ enum omap7xx_index {
 	SPI_7XX_4,
 	SPI_7XX_5,
 	SPI_7XX_6,
+
+	/* UART */
+	UART_7XX_1,
+	UART_7XX_2,
 };
 
 enum omap1xxx_index {
Signature · 1 line
1.7.0.4
#4 lore raw

PATCH 6/7 Bluetooth device code common to HTC smartphones

In reply to Cory Maccarrone

This change adds in a bluetooth controld driver/rfkill interface to the serial bluetooth controller found on many HTC smartphones such as the HTC Herald and HTC Wizard.

---
 arch/arm/mach-omap1/htc-bt.c              |  183 +++++++++++++++++++++++++++++
 arch/arm/mach-omap1/include/mach/htc-bt.h |   22 ++++
 2 files changed, 205 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/mach-omap1/htc-bt.c
 create mode 100644 arch/arm/mach-omap1/include/mach/htc-bt.h
arch/arm/mach-omap1/htc-bt.c new file +183 -0
new file mode 100644
index 0000000..aca7b97
@@ -0,0 +1,183 @@
+/*
+ * Bluetooth built-in chip control
+ *
+ * Copyright (c) 2010 Cory Maccarrone
+ * Based on tosa-bt.c copyright (c) 2008 Dmitry Baryshkov
+ *
+ * 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/kernel.h>
+#include <linux/module.h>
+#include <linux/platform_device.h>
+#include <linux/gpio.h>
+#include <linux/delay.h>
+#include <linux/rfkill.h>
+#include <linux/clk.h>
+
+#include <plat/mux.h>
+
+#include <mach/htc-bt.h>
+
+static struct clk *uart_ck;
+
+static void htc_bt_on(struct htc_bt_data *data)
+{
+	gpio_set_value(data->gpio_pwr, 1);
+
+	if (uart_ck)
+		clk_enable(uart_ck);
+
+	msleep(1000);
+
+	if (data->gpio_enable)
+		gpio_set_value(data->gpio_enable, 1);
+}
+
+static void htc_bt_off(struct htc_bt_data *data)
+{
+	gpio_set_value(data->gpio_pwr, 0);
+
+	if (uart_ck)
+		clk_disable(uart_ck);
+
+	msleep(1000);
+
+	if (data->gpio_enable)
+		gpio_set_value(data->gpio_enable, 0);
+}
+
+static int htc_bt_set_block(void *data, bool blocked)
+{
+	if (!blocked)
+		htc_bt_on(data);
+	else
+		htc_bt_off(data);
+
+	return 0;
+}
+
+static const struct rfkill_ops htc_bt_rfkill_ops = {
+	.set_block = htc_bt_set_block,
+};
+
+static int htc_bt_probe(struct platform_device *dev)
+{
+	int rc;
+	struct rfkill *rfk;
+
+	struct htc_bt_data *data = dev->dev.platform_data;
+
+	/* Configure the GPIOs */
+	if (data->gpio_enable) {
+		rc = gpio_request(data->gpio_enable, "Bluetooth enable");
+		if (rc)
+			goto err_enable;
+		rc = gpio_direction_output(data->gpio_enable, 0);
+		if (rc)
+			goto err_enable_dir;
+	}
+
+	rc = gpio_request(data->gpio_pwr, "Bluetooth power");
+	if (rc)
+		goto err_pwr;
+	rc = gpio_direction_output(data->gpio_pwr, 0);
+	if (rc)
+		goto err_pwr_dir;
+
+	/* Get the clocks */
+	if (data->uart_clock != NULL) {
+		uart_ck = clk_get(NULL, data->uart_clock);
+		if (IS_ERR(uart_ck)) {
+			pr_warn("htc-bt: Could not get uart clock\n");
+			uart_ck = NULL;
+		} else
+			clk_disable(uart_ck);
+	} else
+		uart_ck = NULL;
+
+	/* MUX pins for UART */
+	omap_cfg_reg(UART_7XX_1);
+	omap_cfg_reg(UART_7XX_2);
+
+	/* Configure RFKill */
+	rfk = rfkill_alloc("htc-bt", &dev->dev, RFKILL_TYPE_BLUETOOTH,
+			   &htc_bt_rfkill_ops, data);
+	if (!rfk) {
+		rc = -ENOMEM;
+		goto err_rfk_alloc;
+	}
+
+	rfkill_set_led_trigger_name(rfk, "htc-bt");
+
+	rc = rfkill_register(rfk);
+	if (rc)
+		goto err_rfkill;
+
+	platform_set_drvdata(dev, rfk);
+
+	return 0;
+
+err_rfkill:
+	rfkill_destroy(rfk);
+err_rfk_alloc:
+	htc_bt_off(data);
+err_pwr_dir:
+	gpio_free(data->gpio_pwr);
+err_pwr:
+err_enable_dir:
+	if (data->gpio_enable)
+		gpio_free(data->gpio_enable);
+err_enable:
+	return rc;
+}
+
+static int __devexit htc_bt_remove(struct platform_device *dev)
+{
+	struct htc_bt_data *data = dev->dev.platform_data;
+	struct rfkill *rfk = platform_get_drvdata(dev);
+
+	platform_set_drvdata(dev, NULL);
+
+	if (rfk) {
+		rfkill_unregister(rfk);
+		rfkill_destroy(rfk);
+	}
+	rfk = NULL;
+
+	htc_bt_off(data);
+
+	gpio_free(data->gpio_pwr);
+	if (data->gpio_enable)
+		gpio_free(data->gpio_enable);
+
+	return 0;
+}
+
+static struct platform_driver htc_bt_driver = {
+	.probe = htc_bt_probe,
+	.remove = __devexit_p(htc_bt_remove),
+
+	.driver = {
+		.name = "htc-bt",
+		.owner = THIS_MODULE,
+	},
+};
+
+
+static int __init htc_bt_init(void)
+{
+	return platform_driver_register(&htc_bt_driver);
+}
+
+static void __exit htc_bt_exit(void)
+{
+	platform_driver_unregister(&htc_bt_driver);
+}
+
+late_initcall(htc_bt_init);
+module_exit(htc_bt_exit);
+
arch/arm/mach-omap1/include/mach/htc-bt.h new file +22 -0
new file mode 100644
index 0000000..843ec45
@@ -0,0 +1,22 @@
+/*
+ * HTC bluetooth built-in chip control.
+ *
+ * Copyright (C) 2010 Cory Maccarrone
+ * Based on tosa_bt.h copyright (c) 2008 Dmitry Baryshkov
+ *
+ * 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.
+ *
+ */
+#ifndef HTC_BT_H
+#define HTC_BT_H
+
+struct htc_bt_data {
+	const char	*uart_clock;
+	int		gpio_pwr;
+	int		gpio_enable;
+};
+
+#endif
+
Signature · 1 line
1.7.0.4
#5 lore raw

PATCH 7/7 Add board support for UARTs, bluetooth

In reply to Cory Maccarrone

This change adds bluetooth and UART initialization support to the HTC Herald board driver. This allows use of the serial bluetooth adapter attached to UART1 using hciattach.

---
 arch/arm/mach-omap1/Makefile          |    2 +-
 arch/arm/mach-omap1/board-htcherald.c |   23 +++++++++++++++++++++++
 2 files changed, 24 insertions(+), 1 deletions(-)
arch/arm/mach-omap1/Makefile +1 -1
index facfaeb..0b8cb18 100644
@@ -42,7 +42,7 @@ obj-$(CONFIG_MACH_NOKIA770)		+= board-nokia770.o
 obj-$(CONFIG_MACH_AMS_DELTA)		+= board-ams-delta.o
 obj-$(CONFIG_AMS_DELTA_FIQ)		+= ams-delta-fiq.o ams-delta-fiq-handler.o
 obj-$(CONFIG_MACH_SX1)			+= board-sx1.o board-sx1-mmc.o
-obj-$(CONFIG_MACH_HERALD)		+= board-htcherald.o
+obj-$(CONFIG_MACH_HERALD)		+= board-htcherald.o htc-bt.o
 
 ifeq ($(CONFIG_ARCH_OMAP15XX),y)
 # Innovator-1510 FPGA
arch/arm/mach-omap1/board-htcherald.c +23 -0
index 1b12b75..cf4b908 100644
@@ -47,8 +47,10 @@
 #include <plat/keypad.h>
 #include <plat/usb.h>
 #include <plat/mmc.h>
+#include <plat/mux.h>
 
 #include <mach/irqs.h>
+#include <mach/htc-bt.h>
 
 #include <linux/delay.h>
 
@@ -138,6 +140,7 @@ Happy Times         0 1 0 x  x x 0 x
 
 #define HTCPLD_GPIO_LED_DPAD		HTCPLD_BASE(0, 0)
 #define HTCPLD_GPIO_LED_KBD		HTCPLD_BASE(1, 0)
+#define HTCPLD_GPIO_BT_POWER		HTCPLD_BASE(1, 4)
 #define HTCPLD_GPIO_LED_CAPS		HTCPLD_BASE(1, 5)
 #define HTCPLD_GPIO_LED_RED_FLASH	HTCPLD_BASE(2, 1)
 #define HTCPLD_GPIO_LED_RED_SOLID	HTCPLD_BASE(2, 2)
@@ -423,6 +426,22 @@ static struct omap_mmc_platform_data htc_mmc1_data = {
 static struct omap_mmc_platform_data *htc_mmc_data[1];
 #endif
 
+/* Bluetooth */
+#define HTCHERALD_GPIO_BT_ENABLE 125
+
+static struct htc_bt_data htcherald_bt_data = {
+	.uart_clock	= "uart1_ck",
+	.gpio_pwr	= HTCPLD_GPIO_BT_POWER,
+	.gpio_enable	= HTCHERALD_GPIO_BT_ENABLE,
+};
+
+static struct platform_device bt_device = {
+	.name		= "htc-bt",
+	.id		= -1,
+	.dev = {
+		.platform_data = &htcherald_bt_data,
+	},
+};
 
 /* Platform devices for the Herald */
 static struct platform_device *devices[] __initdata = {
@@ -431,6 +450,7 @@ static struct platform_device *devices[] __initdata = {
 	&htcpld_device,
 	&gpio_leds_device,
 	&herald_gpiokeys_device,
+	&bt_device,
 };
 
 /*
@@ -574,6 +594,7 @@ done:
 	printk(KERN_INFO "USB setup complete.\n");
 }
 
+
 static void __init htcherald_init(void)
 {
 	printk(KERN_INFO "HTC Herald init.\n");
@@ -595,6 +616,8 @@ static void __init htcherald_init(void)
 
 	omap_register_i2c_bus(1, 100, NULL, 0);
 
+	omap_serial_init();
+
 #if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE)
 	htc_mmc_data[0] = &htc_mmc1_data;
 	omap1_init_mmc(htc_mmc_data, 1);
Signature · 1 line
1.7.0.4