Skip to contentSkip to conversation

HTCHERALD: MMC, I2C, HTCPLD, SPI, TSC2046

PATCH New Cory Maccarrone 4 participants 17 messages Aug 18, 2010 – Nov 25, 2010

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

PATCH 1/1 HTCHERALD: MMC, I2C, HTCPLD, SPI, TSC2046

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.

Additionally, SPI bus support (using the spi100k driver) and touchscreen support (using the ads7846 driver) were added.

---
 arch/arm/mach-omap1/board-htcherald.c |  322 ++++++++++++++++++++++++++++++++-
 1 files changed, 316 insertions(+), 6 deletions(-)

This submission is a merging of the two patches:

[OMAP] HTCHERALD: MMC, I2C, HTCPLD and related devices [OMAP] htcherald: SPI register config, TSC2046 touchscreen

arch/arm/mach-omap1/board-htcherald.c +316 -6
index 311899f..7ea75c1 100644
@@ -30,6 +30,13 @@
 #include <linux/input.h>
 #include <linux/io.h>
 #include <linux/gpio.h>
+#include <linux/gpio_keys.h>
+#include <linux/i2c.h>
+#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>
@@ -39,6 +46,7 @@
 #include <plat/board.h>
 #include <plat/keypad.h>
 #include <plat/usb.h>
+#include <plat/mmc.h>
 
 #include <mach/irqs.h>
 
@@ -52,13 +60,123 @@
 #define       OMAP_LCDC_CTRL_LCD_EN           (1 << 0)
 #define       OMAP_LCDC_STAT_DONE             (1 << 0)
 
-static struct omap_lcd_config htcherald_lcd_config __initdata = {
-	.ctrl_name	= "internal",
-};
+/* GPIO definitions for the power button and keyboard slide switch */
+#define HTCHERALD_GPIO_POWER 139
+#define HTCHERALD_GPIO_SLIDE 174
+#define HTCHERALD_GIRQ_BTNS 141
 
-static struct omap_board_config_kernel htcherald_config[] __initdata = {
-	{ OMAP_TAG_LCD, &htcherald_lcd_config },
-};
+/* GPIO definitions for the touchscreen */
+#define HTCHERALD_GPIO_TS 76
+
+/* HTCPLD definitions */
+
+/*
+ * CPLD Logic
+ *
+ * Chip 3 - 0x03
+ *
+ * Function            7 6 5 4  3 2 1 0
+ * ------------------------------------
+ * DPAD light          x x x x  x x x 1
+ * SoundDev            x x x x  1 x x x
+ * Screen white        1 x x x  x x x x
+ * MMC power on        x x x x  x 1 x x
+ * Happy times (n)     0 x x x  x 1 x x
+ *
+ * Chip 4 - 0x04
+ *
+ * Function            7 6 5 4  3 2 1 0
+ * ------------------------------------
+ * Keyboard light      x x x x  x x x 1
+ * LCD Bright (4)      x x x x  x 1 1 x
+ * LCD Bright (3)      x x x x  x 0 1 x
+ * LCD Bright (2)      x x x x  x 1 0 x
+ * LCD Bright (1)      x x x x  x 0 0 x
+ * LCD Off             x x x x  0 x x x
+ * LCD image (fb)      1 x x x  x x x x
+ * LCD image (white)   0 x x x  x x x x
+ * Caps lock LED       x x 1 x  x x x x
+ *
+ * Chip 5 - 0x05
+ *
+ * Function            7 6 5 4  3 2 1 0
+ * ------------------------------------
+ * Red (solid)         x x x x  x 1 x x
+ * Red (flash)         x x x x  x x 1 x
+ * Green (GSM flash)   x x x x  1 x x x
+ * Green (GSM solid)   x x x 1  x x x x
+ * Green (wifi flash)  x x 1 x  x x x x
+ * Blue (bt flash)     x 1 x x  x x x x
+ * DPAD Int Enable     1 x x x  x x x 0
+ *
+ * (Combinations of the above can be made for different colors.)
+ * The direction pad interrupt enable must be set each time the
+ * interrupt is handled.
+ *
+ * Chip 6 - 0x06
+ *
+ * Function            7 6 5 4  3 2 1 0
+ * ------------------------------------
+ * Vibrator            x x x x  1 x x x
+ * Alt LED             x x x 1  x x x x
+ * Screen white        1 x x x  x x x x
+ * Screen white        x x 1 x  x x x x
+ * Screen white        x 0 x x  x x x x
+ * Enable kbd dpad     x x x x  x x 0 x
+ * Happy Times         0 1 0 x  x x 0 x
+ */
+
+/*
+ * HTCPLD GPIO lines start 16 after OMAP_MAX_GPIO_LINES to account
+ * for the 16 MPUIO lines.
+ */
+#define HTCPLD_GPIO_START_OFFSET	(OMAP_MAX_GPIO_LINES + 16)
+#define HTCPLD_IRQ(chip, offset)	(OMAP_IRQ_END + 8 * (chip) + (offset))
+#define HTCPLD_BASE(chip, offset)	\
+	(HTCPLD_GPIO_START_OFFSET + 8 * (chip) + (offset))
+
+#define HTCPLD_GPIO_LED_DPAD		HTCPLD_BASE(0, 0)
+#define HTCPLD_GPIO_LED_KBD		HTCPLD_BASE(1, 0)
+#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)
+#define HTCPLD_GPIO_LED_GREEN_FLASH	HTCPLD_BASE(2, 3)
+#define HTCPLD_GPIO_LED_GREEN_SOLID	HTCPLD_BASE(2, 4)
+#define HTCPLD_GPIO_LED_WIFI		HTCPLD_BASE(2, 5)
+#define HTCPLD_GPIO_LED_BT		HTCPLD_BASE(2, 6)
+#define HTCPLD_GPIO_LED_VIBRATE		HTCPLD_BASE(3, 3)
+#define HTCPLD_GPIO_LED_ALT		HTCPLD_BASE(3, 4)
+
+#define HTCPLD_GPIO_RIGHT_KBD		HTCPLD_BASE(6, 7)
+#define HTCPLD_GPIO_UP_KBD		HTCPLD_BASE(6, 6)
+#define HTCPLD_GPIO_LEFT_KBD		HTCPLD_BASE(6, 5)
+#define HTCPLD_GPIO_DOWN_KBD		HTCPLD_BASE(6, 4)
+
+#define HTCPLD_GPIO_RIGHT_DPAD		HTCPLD_BASE(7, 7)
+#define HTCPLD_GPIO_UP_DPAD		HTCPLD_BASE(7, 6)
+#define HTCPLD_GPIO_LEFT_DPAD		HTCPLD_BASE(7, 5)
+#define HTCPLD_GPIO_DOWN_DPAD		HTCPLD_BASE(7, 4)
+#define HTCPLD_GPIO_ENTER_DPAD		HTCPLD_BASE(7, 3)
+
+/*
+ * The htcpld chip requires a gpio write to a specific line
+ * to re-enable interrupts after one has occurred.
+ */
+#define HTCPLD_GPIO_INT_RESET_HI	HTCPLD_BASE(2, 7)
+#define HTCPLD_GPIO_INT_RESET_LO	HTCPLD_BASE(2, 0)
+
+/* Chip 5 */
+#define HTCPLD_IRQ_RIGHT_KBD		HTCPLD_IRQ(0, 7)
+#define HTCPLD_IRQ_UP_KBD		HTCPLD_IRQ(0, 6)
+#define HTCPLD_IRQ_LEFT_KBD		HTCPLD_IRQ(0, 5)
+#define HTCPLD_IRQ_DOWN_KBD		HTCPLD_IRQ(0, 4)
+
+/* Chip 6 */
+#define HTCPLD_IRQ_RIGHT_DPAD		HTCPLD_IRQ(1, 7)
+#define HTCPLD_IRQ_UP_DPAD		HTCPLD_IRQ(1, 6)
+#define HTCPLD_IRQ_LEFT_DPAD		HTCPLD_IRQ(1, 5)
+#define HTCPLD_IRQ_DOWN_DPAD		HTCPLD_IRQ(1, 4)
+#define HTCPLD_IRQ_ENTER_DPAD		HTCPLD_IRQ(1, 3)
 
 /* Keyboard definition */
 
@@ -140,6 +258,129 @@ static struct platform_device kp_device = {
 	.resource	= kp_resources,
 };
 
+/* GPIO buttons for keyboard slide and power button */
+static struct gpio_keys_button herald_gpio_keys_table[] = {
+	{BTN_0,  HTCHERALD_GPIO_POWER, 1, "POWER", EV_KEY, 1, 20},
+	{SW_LID, HTCHERALD_GPIO_SLIDE, 0, "SLIDE", EV_SW,  1, 20},
+
+	{KEY_LEFT,  HTCPLD_GPIO_LEFT_KBD,  1, "LEFT",  EV_KEY, 1, 20},
+	{KEY_RIGHT, HTCPLD_GPIO_RIGHT_KBD, 1, "RIGHT", EV_KEY, 1, 20},
+	{KEY_UP,    HTCPLD_GPIO_UP_KBD,    1, "UP",    EV_KEY, 1, 20},
+	{KEY_DOWN,  HTCPLD_GPIO_DOWN_KBD,  1, "DOWN",  EV_KEY, 1, 20},
+
+	{KEY_LEFT,  HTCPLD_GPIO_LEFT_DPAD,   1, "DLEFT",  EV_KEY, 1, 20},
+	{KEY_RIGHT, HTCPLD_GPIO_RIGHT_DPAD,  1, "DRIGHT", EV_KEY, 1, 20},
+	{KEY_UP,    HTCPLD_GPIO_UP_DPAD,     1, "DUP",    EV_KEY, 1, 20},
+	{KEY_DOWN,  HTCPLD_GPIO_DOWN_DPAD,   1, "DDOWN",  EV_KEY, 1, 20},
+	{KEY_ENTER, HTCPLD_GPIO_ENTER_DPAD,  1, "DENTER", EV_KEY, 1, 20},
+};
+
+static struct gpio_keys_platform_data herald_gpio_keys_data = {
+	.buttons	= herald_gpio_keys_table,
+	.nbuttons	= ARRAY_SIZE(herald_gpio_keys_table),
+	.rep		= 1,
+};
+
+static struct platform_device herald_gpiokeys_device = {
+	.name      = "gpio-keys",
+	.id		= -1,
+	.dev = {
+		.platform_data = &herald_gpio_keys_data,
+	},
+};
+
+/* LEDs for the Herald.  These connect to the HTCPLD GPIO device. */
+static struct gpio_led gpio_leds[] = {
+	{"dpad",        NULL, HTCPLD_GPIO_LED_DPAD,        0, 0, LEDS_GPIO_DEFSTATE_OFF},
+	{"kbd",         NULL, HTCPLD_GPIO_LED_KBD,         0, 0, LEDS_GPIO_DEFSTATE_OFF},
+	{"vibrate",     NULL, HTCPLD_GPIO_LED_VIBRATE,     0, 0, LEDS_GPIO_DEFSTATE_OFF},
+	{"green_solid", NULL, HTCPLD_GPIO_LED_GREEN_SOLID, 0, 0, LEDS_GPIO_DEFSTATE_OFF},
+	{"green_flash", NULL, HTCPLD_GPIO_LED_GREEN_FLASH, 0, 0, LEDS_GPIO_DEFSTATE_OFF},
+	{"red_solid",   "mmc0", HTCPLD_GPIO_LED_RED_SOLID, 0, 0, LEDS_GPIO_DEFSTATE_OFF},
+	{"red_flash",   NULL, HTCPLD_GPIO_LED_RED_FLASH,   0, 0, LEDS_GPIO_DEFSTATE_OFF},
+	{"wifi",        NULL, HTCPLD_GPIO_LED_WIFI,        0, 0, LEDS_GPIO_DEFSTATE_OFF},
+	{"bt",          NULL, HTCPLD_GPIO_LED_BT,          0, 0, LEDS_GPIO_DEFSTATE_OFF},
+	{"caps",        NULL, HTCPLD_GPIO_LED_CAPS,        0, 0, LEDS_GPIO_DEFSTATE_OFF},
+	{"alt",         NULL, HTCPLD_GPIO_LED_ALT,         0, 0, LEDS_GPIO_DEFSTATE_OFF},
+};
+
+static struct gpio_led_platform_data gpio_leds_data = {
+	.leds		= gpio_leds,
+	.num_leds	= ARRAY_SIZE(gpio_leds),
+};
+
+static struct platform_device gpio_leds_device = {
+	.name		= "leds-gpio",
+	.id		= 0,
+	.dev	= {
+		.platform_data	= &gpio_leds_data,
+	},
+};
+
+/* HTC PLD chips */
+
+static struct resource htcpld_resources[] = {
+	[0] = {
+		.start  = OMAP_GPIO_IRQ(HTCHERALD_GIRQ_BTNS),
+		.end    = OMAP_GPIO_IRQ(HTCHERALD_GIRQ_BTNS),
+		.flags  = IORESOURCE_IRQ,
+	},
+};
+
+struct htcpld_chip_platform_data htcpld_chips[] = {
+	[0] = {
+		.addr		= 0x03,
+		.reset		= 0x04,
+		.num_gpios	= 8,
+		.gpio_out_base	= HTCPLD_BASE(0, 0),
+		.gpio_in_base	= HTCPLD_BASE(4, 0),
+	},
+	[1] = {
+		.addr		= 0x04,
+		.reset		= 0x8e,
+		.num_gpios	= 8,
+		.gpio_out_base	= HTCPLD_BASE(1, 0),
+		.gpio_in_base	= HTCPLD_BASE(5, 0),
+	},
+	[2] = {
+		.addr		= 0x05,
+		.reset		= 0x80,
+		.num_gpios	= 8,
+		.gpio_out_base	= HTCPLD_BASE(2, 0),
+		.gpio_in_base	= HTCPLD_BASE(6, 0),
+		.irq_base	= HTCPLD_IRQ(0, 0),
+		.num_irqs	= 8,
+	},
+	[3] = {
+		.addr		= 0x06,
+		.reset		= 0x40,
+		.num_gpios	= 8,
+		.gpio_out_base	= HTCPLD_BASE(3, 0),
+		.gpio_in_base	= HTCPLD_BASE(7, 0),
+		.irq_base	= HTCPLD_IRQ(1, 0),
+		.num_irqs	= 8,
+	},
+};
+
+struct htcpld_core_platform_data htcpld_pfdata = {
+	.int_reset_gpio_hi = HTCPLD_GPIO_INT_RESET_HI,
+	.int_reset_gpio_lo = HTCPLD_GPIO_INT_RESET_LO,
+	.i2c_adapter_id	   = 1,
+
+	.chip		   = htcpld_chips,
+	.num_chip	   = ARRAY_SIZE(htcpld_chips),
+};
+
+static struct platform_device htcpld_device = {
+	.name		= "i2c-htcpld",
+	.id		= -1,
+	.resource	= htcpld_resources,
+	.num_resources	= ARRAY_SIZE(htcpld_resources),
+	.dev	= {
+		.platform_data	= &htcpld_pfdata,
+	},
+};
+
 /* USB Device */
 static struct omap_usb_config htcherald_usb_config __initdata = {
 	.otg = 0,
@@ -150,14 +391,72 @@ static struct omap_usb_config htcherald_usb_config __initdata = {
 };
 
 /* LCD Device resources */
+static struct omap_lcd_config htcherald_lcd_config __initdata = {
+	.ctrl_name	= "internal",
+};
+
+static struct omap_board_config_kernel htcherald_config[] __initdata = {
+	{ OMAP_TAG_LCD, &htcherald_lcd_config },
+};
+
 static struct platform_device lcd_device = {
 	.name           = "lcd_htcherald",
 	.id             = -1,
 };
 
+/* MMC Card */
+#if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE)
+static struct omap_mmc_platform_data htc_mmc1_data = {
+	.nr_slots                       = 1,
+	.switch_slot                    = NULL,
+	.slots[0]       = {
+		.ocr_mask               = MMC_VDD_28_29 | MMC_VDD_30_31 |
+					  MMC_VDD_32_33 | MMC_VDD_33_34,
+		.name                   = "mmcblk",
+		.nomux                  = 1,
+		.wires                  = 4,
+		.switch_pin             = -1,
+	},
+};
+
+static struct omap_mmc_platform_data *htc_mmc_data[1];
+#endif
+
+
+/* Platform devices for the Herald */
 static struct platform_device *devices[] __initdata = {
 	&kp_device,
 	&lcd_device,
+	&htcpld_device,
+	&gpio_leds_device,
+	&herald_gpiokeys_device,
+};
+
+/*
+ * 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,
+	}
 };
 
 /*
@@ -278,6 +577,7 @@ 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;
@@ -288,6 +588,16 @@ 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)
+	htc_mmc_data[0] = &htc_mmc1_data;
+	omap1_init_mmc(htc_mmc_data, 1);
+#endif
 }
 
 static void __init htcherald_init_irq(void)
Signature · 1 line
1.7.0.4
#1 lore raw

PATCH 1/1 HTCHERALD: MMC, I2C, HTCPLD, SPI, TSC2046

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.

Additionally, SPI bus support (using the spi100k driver) and touchscreen support (using the ads7846 driver) were added.

---
 arch/arm/mach-omap1/board-htcherald.c |  322 ++++++++++++++++++++++++++++++++-
 1 files changed, 316 insertions(+), 6 deletions(-)

This submission is a merging of the two patches:

[OMAP] HTCHERALD: MMC, I2C, HTCPLD and related devices [OMAP] htcherald: SPI register config, TSC2046 touchscreen

arch/arm/mach-omap1/board-htcherald.c +316 -6
index 311899f..7ea75c1 100644
@@ -30,6 +30,13 @@
 #include <linux/input.h>
 #include <linux/io.h>
 #include <linux/gpio.h>
+#include <linux/gpio_keys.h>
+#include <linux/i2c.h>
+#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>
@@ -39,6 +46,7 @@
 #include <plat/board.h>
 #include <plat/keypad.h>
 #include <plat/usb.h>
+#include <plat/mmc.h>
 
 #include <mach/irqs.h>
 
@@ -52,13 +60,123 @@
 #define       OMAP_LCDC_CTRL_LCD_EN           (1 << 0)
 #define       OMAP_LCDC_STAT_DONE             (1 << 0)
 
-static struct omap_lcd_config htcherald_lcd_config __initdata = {
-	.ctrl_name	= "internal",
-};
+/* GPIO definitions for the power button and keyboard slide switch */
+#define HTCHERALD_GPIO_POWER 139
+#define HTCHERALD_GPIO_SLIDE 174
+#define HTCHERALD_GIRQ_BTNS 141
 
-static struct omap_board_config_kernel htcherald_config[] __initdata = {
-	{ OMAP_TAG_LCD, &htcherald_lcd_config },
-};
+/* GPIO definitions for the touchscreen */
+#define HTCHERALD_GPIO_TS 76
+
+/* HTCPLD definitions */
+
+/*
+ * CPLD Logic
+ *
+ * Chip 3 - 0x03
+ *
+ * Function            7 6 5 4  3 2 1 0
+ * ------------------------------------
+ * DPAD light          x x x x  x x x 1
+ * SoundDev            x x x x  1 x x x
+ * Screen white        1 x x x  x x x x
+ * MMC power on        x x x x  x 1 x x
+ * Happy times (n)     0 x x x  x 1 x x
+ *
+ * Chip 4 - 0x04
+ *
+ * Function            7 6 5 4  3 2 1 0
+ * ------------------------------------
+ * Keyboard light      x x x x  x x x 1
+ * LCD Bright (4)      x x x x  x 1 1 x
+ * LCD Bright (3)      x x x x  x 0 1 x
+ * LCD Bright (2)      x x x x  x 1 0 x
+ * LCD Bright (1)      x x x x  x 0 0 x
+ * LCD Off             x x x x  0 x x x
+ * LCD image (fb)      1 x x x  x x x x
+ * LCD image (white)   0 x x x  x x x x
+ * Caps lock LED       x x 1 x  x x x x
+ *
+ * Chip 5 - 0x05
+ *
+ * Function            7 6 5 4  3 2 1 0
+ * ------------------------------------
+ * Red (solid)         x x x x  x 1 x x
+ * Red (flash)         x x x x  x x 1 x
+ * Green (GSM flash)   x x x x  1 x x x
+ * Green (GSM solid)   x x x 1  x x x x
+ * Green (wifi flash)  x x 1 x  x x x x
+ * Blue (bt flash)     x 1 x x  x x x x
+ * DPAD Int Enable     1 x x x  x x x 0
+ *
+ * (Combinations of the above can be made for different colors.)
+ * The direction pad interrupt enable must be set each time the
+ * interrupt is handled.
+ *
+ * Chip 6 - 0x06
+ *
+ * Function            7 6 5 4  3 2 1 0
+ * ------------------------------------
+ * Vibrator            x x x x  1 x x x
+ * Alt LED             x x x 1  x x x x
+ * Screen white        1 x x x  x x x x
+ * Screen white        x x 1 x  x x x x
+ * Screen white        x 0 x x  x x x x
+ * Enable kbd dpad     x x x x  x x 0 x
+ * Happy Times         0 1 0 x  x x 0 x
+ */
+
+/*
+ * HTCPLD GPIO lines start 16 after OMAP_MAX_GPIO_LINES to account
+ * for the 16 MPUIO lines.
+ */
+#define HTCPLD_GPIO_START_OFFSET	(OMAP_MAX_GPIO_LINES + 16)
+#define HTCPLD_IRQ(chip, offset)	(OMAP_IRQ_END + 8 * (chip) + (offset))
+#define HTCPLD_BASE(chip, offset)	\
+	(HTCPLD_GPIO_START_OFFSET + 8 * (chip) + (offset))
+
+#define HTCPLD_GPIO_LED_DPAD		HTCPLD_BASE(0, 0)
+#define HTCPLD_GPIO_LED_KBD		HTCPLD_BASE(1, 0)
+#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)
+#define HTCPLD_GPIO_LED_GREEN_FLASH	HTCPLD_BASE(2, 3)
+#define HTCPLD_GPIO_LED_GREEN_SOLID	HTCPLD_BASE(2, 4)
+#define HTCPLD_GPIO_LED_WIFI		HTCPLD_BASE(2, 5)
+#define HTCPLD_GPIO_LED_BT		HTCPLD_BASE(2, 6)
+#define HTCPLD_GPIO_LED_VIBRATE		HTCPLD_BASE(3, 3)
+#define HTCPLD_GPIO_LED_ALT		HTCPLD_BASE(3, 4)
+
+#define HTCPLD_GPIO_RIGHT_KBD		HTCPLD_BASE(6, 7)
+#define HTCPLD_GPIO_UP_KBD		HTCPLD_BASE(6, 6)
+#define HTCPLD_GPIO_LEFT_KBD		HTCPLD_BASE(6, 5)
+#define HTCPLD_GPIO_DOWN_KBD		HTCPLD_BASE(6, 4)
+
+#define HTCPLD_GPIO_RIGHT_DPAD		HTCPLD_BASE(7, 7)
+#define HTCPLD_GPIO_UP_DPAD		HTCPLD_BASE(7, 6)
+#define HTCPLD_GPIO_LEFT_DPAD		HTCPLD_BASE(7, 5)
+#define HTCPLD_GPIO_DOWN_DPAD		HTCPLD_BASE(7, 4)
+#define HTCPLD_GPIO_ENTER_DPAD		HTCPLD_BASE(7, 3)
+
+/*
+ * The htcpld chip requires a gpio write to a specific line
+ * to re-enable interrupts after one has occurred.
+ */
+#define HTCPLD_GPIO_INT_RESET_HI	HTCPLD_BASE(2, 7)
+#define HTCPLD_GPIO_INT_RESET_LO	HTCPLD_BASE(2, 0)
+
+/* Chip 5 */
+#define HTCPLD_IRQ_RIGHT_KBD		HTCPLD_IRQ(0, 7)
+#define HTCPLD_IRQ_UP_KBD		HTCPLD_IRQ(0, 6)
+#define HTCPLD_IRQ_LEFT_KBD		HTCPLD_IRQ(0, 5)
+#define HTCPLD_IRQ_DOWN_KBD		HTCPLD_IRQ(0, 4)
+
+/* Chip 6 */
+#define HTCPLD_IRQ_RIGHT_DPAD		HTCPLD_IRQ(1, 7)
+#define HTCPLD_IRQ_UP_DPAD		HTCPLD_IRQ(1, 6)
+#define HTCPLD_IRQ_LEFT_DPAD		HTCPLD_IRQ(1, 5)
+#define HTCPLD_IRQ_DOWN_DPAD		HTCPLD_IRQ(1, 4)
+#define HTCPLD_IRQ_ENTER_DPAD		HTCPLD_IRQ(1, 3)
 
 /* Keyboard definition */
 
@@ -140,6 +258,129 @@ static struct platform_device kp_device = {
 	.resource	= kp_resources,
 };
 
+/* GPIO buttons for keyboard slide and power button */
+static struct gpio_keys_button herald_gpio_keys_table[] = {
+	{BTN_0,  HTCHERALD_GPIO_POWER, 1, "POWER", EV_KEY, 1, 20},
+	{SW_LID, HTCHERALD_GPIO_SLIDE, 0, "SLIDE", EV_SW,  1, 20},
+
+	{KEY_LEFT,  HTCPLD_GPIO_LEFT_KBD,  1, "LEFT",  EV_KEY, 1, 20},
+	{KEY_RIGHT, HTCPLD_GPIO_RIGHT_KBD, 1, "RIGHT", EV_KEY, 1, 20},
+	{KEY_UP,    HTCPLD_GPIO_UP_KBD,    1, "UP",    EV_KEY, 1, 20},
+	{KEY_DOWN,  HTCPLD_GPIO_DOWN_KBD,  1, "DOWN",  EV_KEY, 1, 20},
+
+	{KEY_LEFT,  HTCPLD_GPIO_LEFT_DPAD,   1, "DLEFT",  EV_KEY, 1, 20},
+	{KEY_RIGHT, HTCPLD_GPIO_RIGHT_DPAD,  1, "DRIGHT", EV_KEY, 1, 20},
+	{KEY_UP,    HTCPLD_GPIO_UP_DPAD,     1, "DUP",    EV_KEY, 1, 20},
+	{KEY_DOWN,  HTCPLD_GPIO_DOWN_DPAD,   1, "DDOWN",  EV_KEY, 1, 20},
+	{KEY_ENTER, HTCPLD_GPIO_ENTER_DPAD,  1, "DENTER", EV_KEY, 1, 20},
+};
+
+static struct gpio_keys_platform_data herald_gpio_keys_data = {
+	.buttons	= herald_gpio_keys_table,
+	.nbuttons	= ARRAY_SIZE(herald_gpio_keys_table),
+	.rep		= 1,
+};
+
+static struct platform_device herald_gpiokeys_device = {
+	.name      = "gpio-keys",
+	.id		= -1,
+	.dev = {
+		.platform_data = &herald_gpio_keys_data,
+	},
+};
+
+/* LEDs for the Herald.  These connect to the HTCPLD GPIO device. */
+static struct gpio_led gpio_leds[] = {
+	{"dpad",        NULL, HTCPLD_GPIO_LED_DPAD,        0, 0, LEDS_GPIO_DEFSTATE_OFF},
+	{"kbd",         NULL, HTCPLD_GPIO_LED_KBD,         0, 0, LEDS_GPIO_DEFSTATE_OFF},
+	{"vibrate",     NULL, HTCPLD_GPIO_LED_VIBRATE,     0, 0, LEDS_GPIO_DEFSTATE_OFF},
+	{"green_solid", NULL, HTCPLD_GPIO_LED_GREEN_SOLID, 0, 0, LEDS_GPIO_DEFSTATE_OFF},
+	{"green_flash", NULL, HTCPLD_GPIO_LED_GREEN_FLASH, 0, 0, LEDS_GPIO_DEFSTATE_OFF},
+	{"red_solid",   "mmc0", HTCPLD_GPIO_LED_RED_SOLID, 0, 0, LEDS_GPIO_DEFSTATE_OFF},
+	{"red_flash",   NULL, HTCPLD_GPIO_LED_RED_FLASH,   0, 0, LEDS_GPIO_DEFSTATE_OFF},
+	{"wifi",        NULL, HTCPLD_GPIO_LED_WIFI,        0, 0, LEDS_GPIO_DEFSTATE_OFF},
+	{"bt",          NULL, HTCPLD_GPIO_LED_BT,          0, 0, LEDS_GPIO_DEFSTATE_OFF},
+	{"caps",        NULL, HTCPLD_GPIO_LED_CAPS,        0, 0, LEDS_GPIO_DEFSTATE_OFF},
+	{"alt",         NULL, HTCPLD_GPIO_LED_ALT,         0, 0, LEDS_GPIO_DEFSTATE_OFF},
+};
+
+static struct gpio_led_platform_data gpio_leds_data = {
+	.leds		= gpio_leds,
+	.num_leds	= ARRAY_SIZE(gpio_leds),
+};
+
+static struct platform_device gpio_leds_device = {
+	.name		= "leds-gpio",
+	.id		= 0,
+	.dev	= {
+		.platform_data	= &gpio_leds_data,
+	},
+};
+
+/* HTC PLD chips */
+
+static struct resource htcpld_resources[] = {
+	[0] = {
+		.start  = OMAP_GPIO_IRQ(HTCHERALD_GIRQ_BTNS),
+		.end    = OMAP_GPIO_IRQ(HTCHERALD_GIRQ_BTNS),
+		.flags  = IORESOURCE_IRQ,
+	},
+};
+
+struct htcpld_chip_platform_data htcpld_chips[] = {
+	[0] = {
+		.addr		= 0x03,
+		.reset		= 0x04,
+		.num_gpios	= 8,
+		.gpio_out_base	= HTCPLD_BASE(0, 0),
+		.gpio_in_base	= HTCPLD_BASE(4, 0),
+	},
+	[1] = {
+		.addr		= 0x04,
+		.reset		= 0x8e,
+		.num_gpios	= 8,
+		.gpio_out_base	= HTCPLD_BASE(1, 0),
+		.gpio_in_base	= HTCPLD_BASE(5, 0),
+	},
+	[2] = {
+		.addr		= 0x05,
+		.reset		= 0x80,
+		.num_gpios	= 8,
+		.gpio_out_base	= HTCPLD_BASE(2, 0),
+		.gpio_in_base	= HTCPLD_BASE(6, 0),
+		.irq_base	= HTCPLD_IRQ(0, 0),
+		.num_irqs	= 8,
+	},
+	[3] = {
+		.addr		= 0x06,
+		.reset		= 0x40,
+		.num_gpios	= 8,
+		.gpio_out_base	= HTCPLD_BASE(3, 0),
+		.gpio_in_base	= HTCPLD_BASE(7, 0),
+		.irq_base	= HTCPLD_IRQ(1, 0),
+		.num_irqs	= 8,
+	},
+};
+
+struct htcpld_core_platform_data htcpld_pfdata = {
+	.int_reset_gpio_hi = HTCPLD_GPIO_INT_RESET_HI,
+	.int_reset_gpio_lo = HTCPLD_GPIO_INT_RESET_LO,
+	.i2c_adapter_id	   = 1,
+
+	.chip		   = htcpld_chips,
+	.num_chip	   = ARRAY_SIZE(htcpld_chips),
+};
+
+static struct platform_device htcpld_device = {
+	.name		= "i2c-htcpld",
+	.id		= -1,
+	.resource	= htcpld_resources,
+	.num_resources	= ARRAY_SIZE(htcpld_resources),
+	.dev	= {
+		.platform_data	= &htcpld_pfdata,
+	},
+};
+
 /* USB Device */
 static struct omap_usb_config htcherald_usb_config __initdata = {
 	.otg = 0,
@@ -150,14 +391,72 @@ static struct omap_usb_config htcherald_usb_config __initdata = {
 };
 
 /* LCD Device resources */
+static struct omap_lcd_config htcherald_lcd_config __initdata = {
+	.ctrl_name	= "internal",
+};
+
+static struct omap_board_config_kernel htcherald_config[] __initdata = {
+	{ OMAP_TAG_LCD, &htcherald_lcd_config },
+};
+
 static struct platform_device lcd_device = {
 	.name           = "lcd_htcherald",
 	.id             = -1,
 };
 
+/* MMC Card */
+#if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE)
+static struct omap_mmc_platform_data htc_mmc1_data = {
+	.nr_slots                       = 1,
+	.switch_slot                    = NULL,
+	.slots[0]       = {
+		.ocr_mask               = MMC_VDD_28_29 | MMC_VDD_30_31 |
+					  MMC_VDD_32_33 | MMC_VDD_33_34,
+		.name                   = "mmcblk",
+		.nomux                  = 1,
+		.wires                  = 4,
+		.switch_pin             = -1,
+	},
+};
+
+static struct omap_mmc_platform_data *htc_mmc_data[1];
+#endif
+
+
+/* Platform devices for the Herald */
 static struct platform_device *devices[] __initdata = {
 	&kp_device,
 	&lcd_device,
+	&htcpld_device,
+	&gpio_leds_device,
+	&herald_gpiokeys_device,
+};
+
+/*
+ * 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,
+	}
 };
 
 /*
@@ -278,6 +577,7 @@ 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;
@@ -288,6 +588,16 @@ 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)
+	htc_mmc_data[0] = &htc_mmc1_data;
+	omap1_init_mmc(htc_mmc_data, 1);
+#endif
 }
 
 static void __init htcherald_init_irq(void)
Signature · 1 line
1.7.0.4
maintainer
#2 lore raw

PATCH 1/1 HTCHERALD: MMC, I2C, HTCPLD, SPI, TSC2046

Quoted 8 lines · Cory Maccarrone

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.

Additionally, SPI bus support (using the spi100k driver) and touchscreen support (using the ads7846 driver) were added.

Thanks, I'll add this into omap-for-linus for the upcoming merge window. Cory, can you please check if you have other pending patches? I don't see others in patchwork.kernel.org, but thought there may be some that did not get merged last merge window?

Regards,

Tony

#3 lore raw

PATCH 1/1 HTCHERALD: MMC, I2C, HTCPLD, SPI, TSC2046

Quoted 7 lines · Tony Lindgren
Quoted 6 lines · Cory Maccarrone

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.

Quoted 8 lines
Quoted 2 lines

Additionally, SPI bus support (using the spi100k driver) and touchscreen support (using the ads7846 driver) were added.

Thanks, I'll add this into omap-for-linus for the upcoming merge window. Cory, can you please check if you have other pending patches? I don't see others in patchwork.kernel.org, but thought there may be some that did not get merged last merge window?

I believe you have everything. I had submitted a series of 5 patches that you commented on, and this one was the boiled down combination of all of those (minus one element which I'm still looking into). So, just this one should be pending.

Thanks
- Cory

maintainer
#4 lore raw

PATCH 1/1 HTCHERALD: MMC, I2C, HTCPLD, SPI, TSC2046

Quoted 17 lines · Cory Maccarrone
Quoted 7 lines · Tony Lindgren
Quoted 6 lines · Cory Maccarrone

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.

Quoted 8 lines
Quoted 2 lines

Additionally, SPI bus support (using the spi100k driver) and touchscreen support (using the ads7846 driver) were added.

Thanks, I'll add this into omap-for-linus for the upcoming merge window. Cory, can you please check if you have other pending patches? I don't see others in patchwork.kernel.org, but thought there may be some that did not get merged last merge window?

Quoted 4 lines

I believe you have everything. I had submitted a series of 5 patches that you commented on, and this one was the boiled down combination of all of those (minus one element which I'm still looking into). So, just this one should be pending.

OK thanks.

Tony

#5 lore raw

PATCH 1/1 HTCHERALD: MMC, I2C, HTCPLD, SPI, TSC2046

In reply to Cory Maccarrone

2010/8/18 Cory Maccarrone <[email protected]>:

Quoted 11 lines

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.

Additionally, SPI bus support (using the spi100k driver) and touchscreen support (using the ads7846 driver) were added.

---

[...]

Quoted 4 lines
(quoted diff) +4 -0
+/* MMC Card */
+#if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE)
+static struct omap_mmc_platform_data htc_mmc1_data = {
+ ? ? ? .nr_slots ? ? ? ? ? ? ? ? ? ? ? = 1,

Review

Quoted 10 lines
(quoted diff) +10 -0
+ ? ? ? .switch_slot ? ? ? ? ? ? ? ? ? ?= NULL,
+ ? ? ? .slots[0] ? ? ? = {
+ ? ? ? ? ? ? ? .ocr_mask ? ? ? ? ? ? ? = MMC_VDD_28_29 | MMC_VDD_30_31 |
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? MMC_VDD_32_33 | MMC_VDD_33_34,
+ ? ? ? ? ? ? ? .name ? ? ? ? ? ? ? ? ? = "mmcblk",
+ ? ? ? ? ? ? ? .nomux ? ? ? ? ? ? ? ? ?= 1,
+ ? ? ? ? ? ? ? .wires ? ? ? ? ? ? ? ? ?= 4,
+ ? ? ? ? ? ? ? .switch_pin ? ? ? ? ? ? = -1,
+ ? ? ? },
+};

[...]

What voltages can this MMC controller provide? That's a rather unusual OCR mask.

Best Regards,
Micha? Miros?aw

#6 lore raw

PATCH 1/1 HTCHERALD: MMC, I2C, HTCPLD, SPI, TSC2046

2010/9/24 Micha? Miros?aw <[email protected]>:

Quoted 29 lines

2010/8/18 Cory Maccarrone <[email protected]>:

Quoted 11 lines

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.

Additionally, SPI bus support (using the spi100k driver) and touchscreen support (using the ads7846 driver) were added.

---

[...]

Quoted 14 lines
(quoted diff) +14 -0
+/* MMC Card */
+#if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE)
+static struct omap_mmc_platform_data htc_mmc1_data = {
+ ? ? ? .nr_slots ? ? ? ? ? ? ? ? ? ? ? = 1,
+ ? ? ? .switch_slot ? ? ? ? ? ? ? ? ? ?= NULL,
+ ? ? ? .slots[0] ? ? ? = {
+ ? ? ? ? ? ? ? .ocr_mask ? ? ? ? ? ? ? = MMC_VDD_28_29 | MMC_VDD_30_31 |
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? MMC_VDD_32_33 | MMC_VDD_33_34,
+ ? ? ? ? ? ? ? .name ? ? ? ? ? ? ? ? ? = "mmcblk",
+ ? ? ? ? ? ? ? .nomux ? ? ? ? ? ? ? ? ?= 1,
+ ? ? ? ? ? ? ? .wires ? ? ? ? ? ? ? ? ?= 4,
+ ? ? ? ? ? ? ? .switch_pin ? ? ? ? ? ? = -1,
+ ? ? ? },
+};

[...]

Quoted 5 lines

What voltages can this MMC controller provide? That's a rather unusual OCR mask.

Best Regards,
Micha? Miros?aw

Not really sure, I wasn't the one who first came up with that mask. All I know is that it seems to work, and not just for my device, but lots of other HTC OMAP850 devices we've tried it on too.

I'm interested though, what in particular makes it unusual?

- Cory

#7 lore raw

PATCH 1/1 HTCHERALD: MMC, I2C, HTCPLD, SPI, TSC2046

Quoted 5 lines · Cory Maccarrone

Not really sure, I wasn't the one who first came up with that mask. All I know is that it seems to work, and not just for my device, but lots of other HTC OMAP850 devices we've tried it on too.

I'm interested though, what in particular makes it unusual?

It's normal to set all bits between the maximum and minimum voltages rather than alternate bits. So if you support voltages between 3.0 and 3.5 volts, all these should be used:

#define MMC_VDD_30_31           0x00040000      /* VDD voltage 3.0 ~ 3.1 */
#define MMC_VDD_31_32           0x00080000      /* VDD voltage 3.1 ~ 3.2 */
#define MMC_VDD_32_33           0x00100000      /* VDD voltage 3.2 ~ 3.3 */
#define MMC_VDD_33_34           0x00200000      /* VDD voltage 3.3 ~ 3.4 */
#define MMC_VDD_34_35           0x00400000      /* VDD voltage 3.4 ~ 3.5 */

rather than just MMC_VDD_30_31, MMC_VDD_32_33, MMC_VDD_34_35.

Note that if you support just one voltage, (eg, 3.3V) you should use the two which overlap this - MMC_VDD_32_33 and MMC_VDD_33_34. There are cards which go unresponsive if you supply just a single bit in the OCR mask.

#8 lore raw

PATCH 1/1 HTCHERALD: MMC, I2C, HTCPLD, SPI, TSC2046

In reply to Cory Maccarrone

W dniu 24 wrze?nia 2010 17:38 u?ytkownik Cory Maccarrone <[email protected]> napisa?:

Quoted 30 lines

2010/9/24 Micha? Miros?aw <[email protected]>:

Quoted 13 lines

2010/8/18 Cory Maccarrone <[email protected]>:

Quoted 11 lines

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.

Additionally, SPI bus support (using the spi100k driver) and touchscreen support (using the ads7846 driver) were added.

---

[...]

Quoted 16 lines
Quoted 4 lines
(quoted diff) +4 -0
+/* MMC Card */
+#if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE)
+static struct omap_mmc_platform_data htc_mmc1_data = {
+ ? ? ? .nr_slots ? ? ? ? ? ? ? ? ? ? ? = 1,

Review

Quoted 10 lines
(quoted diff) +10 -0
+ ? ? ? .switch_slot ? ? ? ? ? ? ? ? ? ?= NULL,
+ ? ? ? .slots[0] ? ? ? = {
+ ? ? ? ? ? ? ? .ocr_mask ? ? ? ? ? ? ? = MMC_VDD_28_29 | MMC_VDD_30_31 |
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? MMC_VDD_32_33 | MMC_VDD_33_34,
+ ? ? ? ? ? ? ? .name ? ? ? ? ? ? ? ? ? = "mmcblk",
+ ? ? ? ? ? ? ? .nomux ? ? ? ? ? ? ? ? ?= 1,
+ ? ? ? ? ? ? ? .wires ? ? ? ? ? ? ? ? ?= 4,
+ ? ? ? ? ? ? ? .switch_pin ? ? ? ? ? ? = -1,
+ ? ? ? },
+};

[...]
What voltages can this MMC controller provide? That's a rather unusual OCR mask.

Quoted 5 lines

Not really sure, I wasn't the one who first came up with that mask. All I know is that it seems to work, and not just for my device, but lots of other HTC OMAP850 devices we've tried it on too.

I'm interested though, what in particular makes it unusual?

It specifies, that device supports voltage ranges:
2.8V - 2.9V, 3.0V - 3.1V, 3.2V - 3.4V
(so: 2.9V - 3.0V and 3.1V - 3.2V are not available). Are there really 2.8V, 3.0V, 3.3V VDDs settable?

If the host supports only VDD = 3.3V for example, then correct OCR mask would be: MMC_VDD_32_33 | MMC_VDD_33_34 (or just one flag).

Best Regards,
Micha? Miros?aw

maintainer
#9 lore raw

PATCH 1/1 HTCHERALD: MMC, I2C, HTCPLD, SPI, TSC2046

Quoted 38 lines · Micha? Miros?aw

W dniu 24 wrze?nia 2010 17:38 u?ytkownik Cory Maccarrone <[email protected]> napisa?:

Quoted 30 lines

2010/9/24 Micha? Miros?aw <[email protected]>:

Quoted 13 lines

2010/8/18 Cory Maccarrone <[email protected]>:

Quoted 11 lines

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.

Additionally, SPI bus support (using the spi100k driver) and touchscreen support (using the ads7846 driver) were added.

---

[...]

Quoted 16 lines
Quoted 4 lines
(quoted diff) +4 -0
+/* MMC Card */
+#if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE)
+static struct omap_mmc_platform_data htc_mmc1_data = {
+ ? ? ? .nr_slots ? ? ? ? ? ? ? ? ? ? ? = 1,

Review

Quoted 10 lines
(quoted diff) +10 -0
+ ? ? ? .switch_slot ? ? ? ? ? ? ? ? ? ?= NULL,
+ ? ? ? .slots[0] ? ? ? = {
+ ? ? ? ? ? ? ? .ocr_mask ? ? ? ? ? ? ? = MMC_VDD_28_29 | MMC_VDD_30_31 |
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? MMC_VDD_32_33 | MMC_VDD_33_34,
+ ? ? ? ? ? ? ? .name ? ? ? ? ? ? ? ? ? = "mmcblk",
+ ? ? ? ? ? ? ? .nomux ? ? ? ? ? ? ? ? ?= 1,
+ ? ? ? ? ? ? ? .wires ? ? ? ? ? ? ? ? ?= 4,
+ ? ? ? ? ? ? ? .switch_pin ? ? ? ? ? ? = -1,
+ ? ? ? },
+};

[...]
What voltages can this MMC controller provide? That's a rather unusual OCR mask.

Quoted 5 lines

Not really sure, I wasn't the one who first came up with that mask. All I know is that it seems to work, and not just for my device, but lots of other HTC OMAP850 devices we've tried it on too.

I'm interested though, what in particular makes it unusual?

Quoted 7 lines

It specifies, that device supports voltage ranges:
2.8V - 2.9V, 3.0V - 3.1V, 3.2V - 3.4V
(so: 2.9V - 3.0V and 3.1V - 3.2V are not available). Are there really 2.8V, 3.0V, 3.3V VDDs settable?

If the host supports only VDD = 3.3V for example, then correct OCR mask would be: MMC_VDD_32_33 | MMC_VDD_33_34 (or just one flag).

Looks like also board-sx1-mmc.c and board-h[23]-mmc.c have the same spotty voltage range.

Cory, care to do a patch that fixes it for all of them?

Regards,

Tony

#10 lore raw

PATCH 1/1 HTCHERALD: MMC, I2C, HTCPLD, SPI, TSC2046

2010/9/24 Tony Lindgren <[email protected]>:

Quoted 44 lines · Micha? Miros?aw
Quoted 43 lines

W dniu 24 wrze?nia 2010 17:38 u?ytkownik Cory Maccarrone <[email protected]> napisa?:

Quoted 30 lines

2010/9/24 Micha? Miros?aw <[email protected]>:

Quoted 13 lines

2010/8/18 Cory Maccarrone <[email protected]>:

Quoted 11 lines

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.

Additionally, SPI bus support (using the spi100k driver) and touchscreen support (using the ads7846 driver) were added.

---

[...]

Quoted 16 lines
Quoted 4 lines
(quoted diff) +4 -0
+/* MMC Card */
+#if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE)
+static struct omap_mmc_platform_data htc_mmc1_data = {
+ ? ? ? .nr_slots ? ? ? ? ? ? ? ? ? ? ? = 1,

Review

Quoted 10 lines
(quoted diff) +10 -0
+ ? ? ? .switch_slot ? ? ? ? ? ? ? ? ? ?= NULL,
+ ? ? ? .slots[0] ? ? ? = {
+ ? ? ? ? ? ? ? .ocr_mask ? ? ? ? ? ? ? = MMC_VDD_28_29 | MMC_VDD_30_31 |
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? MMC_VDD_32_33 | MMC_VDD_33_34,
+ ? ? ? ? ? ? ? .name ? ? ? ? ? ? ? ? ? = "mmcblk",
+ ? ? ? ? ? ? ? .nomux ? ? ? ? ? ? ? ? ?= 1,
+ ? ? ? ? ? ? ? .wires ? ? ? ? ? ? ? ? ?= 4,
+ ? ? ? ? ? ? ? .switch_pin ? ? ? ? ? ? = -1,
+ ? ? ? },
+};

[...]
What voltages can this MMC controller provide? That's a rather unusual OCR mask.

Quoted 5 lines

Not really sure, I wasn't the one who first came up with that mask. All I know is that it seems to work, and not just for my device, but lots of other HTC OMAP850 devices we've tried it on too.

I'm interested though, what in particular makes it unusual?

It specifies, that device supports voltage ranges:
2.8V - 2.9V, 3.0V - 3.1V, 3.2V - 3.4V
(so: 2.9V - 3.0V and 3.1V - 3.2V are not available). Are there really 2.8V, 3.0V, 3.3V VDDs settable?

Quoted 8 lines
Quoted 2 lines

If the host supports only VDD = 3.3V for example, then correct OCR mask would be: MMC_VDD_32_33 | MMC_VDD_33_34 (or just one flag).

Looks like also board-sx1-mmc.c and board-h[23]-mmc.c have the same spotty voltage range.

Cory, care to do a patch that fixes it for all of them?

Yeah, I can do that. I'll resubmit this patch too with the fixed up ranges.

- Cory

maintainer
#11 lore raw

PATCH 1/1 HTCHERALD: MMC, I2C, HTCPLD, SPI, TSC2046

Quoted 8 lines · Cory Maccarrone
Quoted 6 lines

Looks like also board-sx1-mmc.c and board-h[23]-mmc.c have the same spotty voltage range.

Cory, care to do a patch that fixes it for all of them?

Yeah, I can do that. I'll resubmit this patch too with the fixed up ranges.

Turns out I already did it :) Care to test/ack this one?

Tony

From: Tony Lindgren <[email protected]>
Date: Thu, 30 Sep 2010 11:40:56 -0700
Subject: [PATCH] omap: Fix spotty MMC voltages

As noted by Micha? Miros?aw <[email protected]>, the voltages should cover the supported voltage range instead of missing some values within the range.

arch/arm/mach-omap1/board-h2-mmc.c +2 -1
index b30c499..50d9032 100644
@@ -58,7 +58,8 @@ static struct omap_mmc_platform_data mmc1_data = {
 	.dma_mask			= 0xffffffff,
 	.slots[0]       = {
 		.set_power              = mmc_set_power,
-		.ocr_mask               = MMC_VDD_28_29 | MMC_VDD_30_31 |
+		.ocr_mask               = MMC_VDD_28_29 | MMC_VDD_29_30 |
+					  MMC_VDD_30_31 | MMC_VDD_31_32 |
 					  MMC_VDD_32_33 | MMC_VDD_33_34,
 		.name                   = "mmcblk",
 	},
arch/arm/mach-omap1/board-h3-mmc.c +2 -1
index 54b0f06..9f073bf 100644
@@ -40,7 +40,8 @@ static struct omap_mmc_platform_data mmc1_data = {
 	.dma_mask			= 0xffffffff,
 	.slots[0]       = {
 		.set_power              = mmc_set_power,
-		.ocr_mask               = MMC_VDD_28_29 | MMC_VDD_30_31 |
+		.ocr_mask               = MMC_VDD_28_29 | MMC_VDD_29_30 |
+					  MMC_VDD_30_31 | MMC_VDD_31_32 |
 					  MMC_VDD_32_33 | MMC_VDD_33_34,
 		.name                   = "mmcblk",
 	},
arch/arm/mach-omap1/board-htcherald.c +2 -1
index 7ea75c1..909fdeb 100644
@@ -410,7 +410,8 @@ static struct omap_mmc_platform_data htc_mmc1_data = {
 	.nr_slots                       = 1,
 	.switch_slot                    = NULL,
 	.slots[0]       = {
-		.ocr_mask               = MMC_VDD_28_29 | MMC_VDD_30_31 |
+		.ocr_mask               = MMC_VDD_28_29 | MMC_VDD_29_30 |
+					  MMC_VDD_30_31 | MMC_VDD_31_32 |
 					  MMC_VDD_32_33 | MMC_VDD_33_34,
 		.name                   = "mmcblk",
 		.nomux                  = 1,
arch/arm/mach-omap1/board-sx1-mmc.c +2 -1
index 5b33ae8..be5a365 100644
@@ -44,7 +44,8 @@ static struct omap_mmc_platform_data mmc1_data = {
 	.nr_slots                       = 1,
 	.slots[0]       = {
 		.set_power              = mmc_set_power,
-		.ocr_mask               = MMC_VDD_28_29 | MMC_VDD_30_31 |
+		.ocr_mask               = MMC_VDD_28_29 | MMC_VDD_29_30 |
+					  MMC_VDD_30_31 | MMC_VDD_31_32 |
 					  MMC_VDD_32_33 | MMC_VDD_33_34,
 		.name                   = "mmcblk",
 	},
arch/arm/mach-omap2/board-n8x0.c +2 -1
index 7a93bd5..abd7e77 100644
@@ -493,7 +493,8 @@ static struct omap_mmc_platform_data mmc1_data = {
 		.set_bus_mode		= n8x0_mmc_set_bus_mode,
 		.get_cover_state	= n8x0_mmc_get_cover_state,
 		.ocr_mask		= MMC_VDD_165_195 | MMC_VDD_30_31 |
-						MMC_VDD_32_33   | MMC_VDD_33_34,
+						MMC_VDD_31_32 | MMC_VDD_32_33 |
+						MMC_VDD_33_34,
 		.name			= "internal",
 	},
 	.slots[1] = {
#12 lore raw

PATCH 1/1 HTCHERALD: MMC, I2C, HTCPLD, SPI, TSC2046

Quoted 88 lines · Tony Lindgren
Quoted 8 lines · Cory Maccarrone
Quoted 6 lines

Looks like also board-sx1-mmc.c and board-h[23]-mmc.c have the same spotty voltage range.

Cory, care to do a patch that fixes it for all of them?

Yeah, I can do that. ?I'll resubmit this patch too with the fixed up ranges.

Turns out I already did it :) Care to test/ack this one?

Tony

From: Tony Lindgren <[email protected]>
Date: Thu, 30 Sep 2010 11:40:56 -0700
Subject: [PATCH] omap: Fix spotty MMC voltages

As noted by Micha? Miros?aw <[email protected]>, the voltages should cover the supported voltage range instead of missing some values within the range.

arch/arm/mach-omap1/board-h2-mmc.c +2 -1
index b30c499..50d9032 100644
@@ -58,7 +58,8 @@ static struct omap_mmc_platform_data mmc1_data = {
 ? ? ? ?.dma_mask ? ? ? ? ? ? ? ? ? ? ? = 0xffffffff,
 ? ? ? ?.slots[0] ? ? ? = {
 ? ? ? ? ? ? ? ?.set_power ? ? ? ? ? ? ?= mmc_set_power,
- ? ? ? ? ? ? ? .ocr_mask ? ? ? ? ? ? ? = MMC_VDD_28_29 | MMC_VDD_30_31 |
+ ? ? ? ? ? ? ? .ocr_mask ? ? ? ? ? ? ? = MMC_VDD_28_29 | MMC_VDD_29_30 |
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? MMC_VDD_30_31 | MMC_VDD_31_32 |
 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?MMC_VDD_32_33 | MMC_VDD_33_34,
 ? ? ? ? ? ? ? ?.name ? ? ? ? ? ? ? ? ? = "mmcblk",
 ? ? ? ?},
arch/arm/mach-omap1/board-h3-mmc.c +2 -1
index 54b0f06..9f073bf 100644
@@ -40,7 +40,8 @@ static struct omap_mmc_platform_data mmc1_data = {
 ? ? ? ?.dma_mask ? ? ? ? ? ? ? ? ? ? ? = 0xffffffff,
 ? ? ? ?.slots[0] ? ? ? = {
 ? ? ? ? ? ? ? ?.set_power ? ? ? ? ? ? ?= mmc_set_power,
- ? ? ? ? ? ? ? .ocr_mask ? ? ? ? ? ? ? = MMC_VDD_28_29 | MMC_VDD_30_31 |
+ ? ? ? ? ? ? ? .ocr_mask ? ? ? ? ? ? ? = MMC_VDD_28_29 | MMC_VDD_29_30 |
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? MMC_VDD_30_31 | MMC_VDD_31_32 |
 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?MMC_VDD_32_33 | MMC_VDD_33_34,
 ? ? ? ? ? ? ? ?.name ? ? ? ? ? ? ? ? ? = "mmcblk",
 ? ? ? ?},
arch/arm/mach-omap1/board-htcherald.c +2 -1
index 7ea75c1..909fdeb 100644
@@ -410,7 +410,8 @@ static struct omap_mmc_platform_data htc_mmc1_data = {
 ? ? ? ?.nr_slots ? ? ? ? ? ? ? ? ? ? ? = 1,
 ? ? ? ?.switch_slot ? ? ? ? ? ? ? ? ? ?= NULL,
 ? ? ? ?.slots[0] ? ? ? = {
- ? ? ? ? ? ? ? .ocr_mask ? ? ? ? ? ? ? = MMC_VDD_28_29 | MMC_VDD_30_31 |
+ ? ? ? ? ? ? ? .ocr_mask ? ? ? ? ? ? ? = MMC_VDD_28_29 | MMC_VDD_29_30 |
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? MMC_VDD_30_31 | MMC_VDD_31_32 |
 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?MMC_VDD_32_33 | MMC_VDD_33_34,
 ? ? ? ? ? ? ? ?.name ? ? ? ? ? ? ? ? ? = "mmcblk",
 ? ? ? ? ? ? ? ?.nomux ? ? ? ? ? ? ? ? ?= 1,
arch/arm/mach-omap1/board-sx1-mmc.c +2 -1
index 5b33ae8..be5a365 100644
@@ -44,7 +44,8 @@ static struct omap_mmc_platform_data mmc1_data = {
 ? ? ? ?.nr_slots ? ? ? ? ? ? ? ? ? ? ? = 1,
 ? ? ? ?.slots[0] ? ? ? = {
 ? ? ? ? ? ? ? ?.set_power ? ? ? ? ? ? ?= mmc_set_power,
- ? ? ? ? ? ? ? .ocr_mask ? ? ? ? ? ? ? = MMC_VDD_28_29 | MMC_VDD_30_31 |
+ ? ? ? ? ? ? ? .ocr_mask ? ? ? ? ? ? ? = MMC_VDD_28_29 | MMC_VDD_29_30 |
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? MMC_VDD_30_31 | MMC_VDD_31_32 |
 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?MMC_VDD_32_33 | MMC_VDD_33_34,
 ? ? ? ? ? ? ? ?.name ? ? ? ? ? ? ? ? ? = "mmcblk",
 ? ? ? ?},
arch/arm/mach-omap2/board-n8x0.c +0 -0
index 7a93bd5..abd7e77 100644
@@ -493,7 +493,8 @@ static struct omap_mmc_platform_data mmc1_data = {
 ? ? ? ? ? ? ? ?.set_bus_mode ? ? ? ? ? = n8x0_mmc_set_bus_mode,
 ? ? ? ? ? ? ? ?.get_cover_state ? ? ? ?= n8x0_mmc_get_cover_state,
Quoted 8 lines

? ? ? ? ? ? ? ?.ocr_mask ? ? ? ? ? ? ? = MMC_VDD_165_195 | MMC_VDD_30_31 |
- ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? MMC_VDD_32_33 ? | MMC_VDD_33_34,
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? MMC_VDD_31_32 | MMC_VDD_32_33 |
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? MMC_VDD_33_34,
? ? ? ? ? ? ? ?.name ? ? ? ? ? ? ? ? ? = "internal",
? ? ? ?},
? ? ? ?.slots[1] = {

Sure thing, hopefully in the next day or two. :)

- Cory

#13 lore raw

PATCH 1/1 HTCHERALD: MMC, I2C, HTCPLD, SPI, TSC2046

In reply to Tony Lindgren

2010/9/30 Tony Lindgren <[email protected]>:

Quoted 6 lines · Cory Maccarrone
Quoted 4 lines
Quoted 3 lines

Looks like also board-sx1-mmc.c and board-h[23]-mmc.c have the same spotty voltage range.
Cory, care to do a patch that fixes it for all of them?

Yeah, I can do that. ?I'll resubmit this patch too with the fixed up ranges.

Turns out I already did it :) Care to test/ack this one?

[...]

Quoted 5 lines
arch/arm/mach-omap1/board-sx1-mmc.c +0 -0
index 5b33ae8..be5a365 100644

arch/arm/mach-omap1/board-sx1-mmc.c static struct omap_mmc_platform_data mmc1_data = { · line 51

Quoted 9 lines
arch/arm/mach-omap1/board-sx1-mmc.c +2 -1
@@ -44,7 +44,8 @@ static struct omap_mmc_platform_data mmc1_data = {
 ? ? ? ?.nr_slots ? ? ? ? ? ? ? ? ? ? ? = 1,
 ? ? ? ?.slots[0] ? ? ? = {
 ? ? ? ? ? ? ? ?.set_power ? ? ? ? ? ? ?= mmc_set_power,
- ? ? ? ? ? ? ? .ocr_mask ? ? ? ? ? ? ? = MMC_VDD_28_29 | MMC_VDD_30_31 |
+ ? ? ? ? ? ? ? .ocr_mask ? ? ? ? ? ? ? = MMC_VDD_28_29 | MMC_VDD_29_30 |
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? MMC_VDD_30_31 | MMC_VDD_31_32 |
 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?MMC_VDD_32_33 | MMC_VDD_33_34,
 ? ? ? ? ? ? ? ?.name ? ? ? ? ? ? ? ? ? = "mmcblk",
 ? ? ? ?},

[...]

Al least this one seems wrong (haven't checked others) as the mmc_set_power() ignores vdd parameter. This suggests that the board supports only one particular voltage, not the whole range.

Best Regards,
Micha? Miros?aw

maintainer
#14 lore raw

PATCH 1/1 HTCHERALD: MMC, I2C, HTCPLD, SPI, TSC2046

Quoted 25 lines · Micha? Miros?aw

2010/9/30 Tony Lindgren <[email protected]>:

Quoted 6 lines · Cory Maccarrone
Quoted 4 lines
Quoted 3 lines

Looks like also board-sx1-mmc.c and board-h[23]-mmc.c have the same spotty voltage range.
Cory, care to do a patch that fixes it for all of them?

Yeah, I can do that. ?I'll resubmit this patch too with the fixed up ranges.

Turns out I already did it :) Care to test/ack this one?

[...]

Quoted 14 lines
arch/arm/mach-omap1/board-sx1-mmc.c +2 -1
index 5b33ae8..be5a365 100644
@@ -44,7 +44,8 @@ static struct omap_mmc_platform_data mmc1_data = {
 ? ? ? ?.nr_slots ? ? ? ? ? ? ? ? ? ? ? = 1,
 ? ? ? ?.slots[0] ? ? ? = {
 ? ? ? ? ? ? ? ?.set_power ? ? ? ? ? ? ?= mmc_set_power,
- ? ? ? ? ? ? ? .ocr_mask ? ? ? ? ? ? ? = MMC_VDD_28_29 | MMC_VDD_30_31 |
+ ? ? ? ? ? ? ? .ocr_mask ? ? ? ? ? ? ? = MMC_VDD_28_29 | MMC_VDD_29_30 |
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? MMC_VDD_30_31 | MMC_VDD_31_32 |
 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?MMC_VDD_32_33 | MMC_VDD_33_34,
 ? ? ? ? ? ? ? ?.name ? ? ? ? ? ? ? ? ? = "mmcblk",
 ? ? ? ?},

[...]

Quoted 3 lines

Al least this one seems wrong (haven't checked others) as the mmc_set_power() ignores vdd parameter. This suggests that the board supports only one particular voltage, not the whole range.

Hmm yeah good catch. With the external power it's board specific.

Tony

maintainer
#15 lore raw

PATCH 1/1 HTCHERALD: MMC, I2C, HTCPLD, SPI, TSC2046

Quoted 26 lines · Tony Lindgren
Quoted 25 lines · Micha? Miros?aw

2010/9/30 Tony Lindgren <[email protected]>:

Quoted 6 lines · Cory Maccarrone
Quoted 4 lines
Quoted 3 lines

Looks like also board-sx1-mmc.c and board-h[23]-mmc.c have the same spotty voltage range.
Cory, care to do a patch that fixes it for all of them?

Yeah, I can do that. ?I'll resubmit this patch too with the fixed up ranges.

Turns out I already did it :) Care to test/ack this one?

[...]

Quoted 14 lines
arch/arm/mach-omap1/board-sx1-mmc.c +2 -1
index 5b33ae8..be5a365 100644
@@ -44,7 +44,8 @@ static struct omap_mmc_platform_data mmc1_data = {
 ? ? ? ?.nr_slots ? ? ? ? ? ? ? ? ? ? ? = 1,
 ? ? ? ?.slots[0] ? ? ? = {
 ? ? ? ? ? ? ? ?.set_power ? ? ? ? ? ? ?= mmc_set_power,
- ? ? ? ? ? ? ? .ocr_mask ? ? ? ? ? ? ? = MMC_VDD_28_29 | MMC_VDD_30_31 |
+ ? ? ? ? ? ? ? .ocr_mask ? ? ? ? ? ? ? = MMC_VDD_28_29 | MMC_VDD_29_30 |
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? MMC_VDD_30_31 | MMC_VDD_31_32 |
 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?MMC_VDD_32_33 | MMC_VDD_33_34,
 ? ? ? ? ? ? ? ?.name ? ? ? ? ? ? ? ? ? = "mmcblk",
 ? ? ? ?},

[...]

Quoted 5 lines
Quoted 3 lines

Al least this one seems wrong (haven't checked others) as the mmc_set_power() ignores vdd parameter. This suggests that the board supports only one particular voltage, not the whole range.

Hmm yeah good catch. With the external power it's board specific.

Most likely they all support only 3.3V cards except for n8x0. Not changing the n8x0 for what voltages it handles although it may be missing the MMC_VDD_27_28 voltage. Here's the updated patch.

Regards,

Tony

From: Tony Lindgren <[email protected]>
Subject: [PATCH] omap: Fix spotty MMC voltages

As noted by Micha? Miros?aw <[email protected]>, the voltages should cover the supported voltage range, or support only one voltage.

As all these boards are using a GPIO to enable the power, chances are that only 3.3V cards are supported on these boards.

arch/arm/mach-omap1/board-h2-mmc.c +1 -2
index b30c499..f2fc43d 100644
@@ -58,8 +58,7 @@ static struct omap_mmc_platform_data mmc1_data = {
 	.dma_mask			= 0xffffffff,
 	.slots[0]       = {
 		.set_power              = mmc_set_power,
-		.ocr_mask               = MMC_VDD_28_29 | MMC_VDD_30_31 |
-					  MMC_VDD_32_33 | MMC_VDD_33_34,
+		.ocr_mask               = MMC_VDD_32_33 | MMC_VDD_33_34,
 		.name                   = "mmcblk",
 	},
 };
arch/arm/mach-omap1/board-h3-mmc.c +1 -2
index 54b0f06..2098525 100644
@@ -40,8 +40,7 @@ static struct omap_mmc_platform_data mmc1_data = {
 	.dma_mask			= 0xffffffff,
 	.slots[0]       = {
 		.set_power              = mmc_set_power,
-		.ocr_mask               = MMC_VDD_28_29 | MMC_VDD_30_31 |
-					  MMC_VDD_32_33 | MMC_VDD_33_34,
+		.ocr_mask               = MMC_VDD_32_33 | MMC_VDD_33_34,
 		.name                   = "mmcblk",
 	},
 };
arch/arm/mach-omap1/board-htcherald.c +1 -2
index 7ea75c1..88c97e2 100644
@@ -410,8 +410,7 @@ static struct omap_mmc_platform_data htc_mmc1_data = {
 	.nr_slots                       = 1,
 	.switch_slot                    = NULL,
 	.slots[0]       = {
-		.ocr_mask               = MMC_VDD_28_29 | MMC_VDD_30_31 |
-					  MMC_VDD_32_33 | MMC_VDD_33_34,
+		.ocr_mask               = MMC_VDD_32_33 | MMC_VDD_33_34,
 		.name                   = "mmcblk",
 		.nomux                  = 1,
 		.wires                  = 4,
arch/arm/mach-omap1/board-sx1-mmc.c +1 -2
index 5b33ae8..e8ddd86 100644
@@ -44,8 +44,7 @@ static struct omap_mmc_platform_data mmc1_data = {
 	.nr_slots                       = 1,
 	.slots[0]       = {
 		.set_power              = mmc_set_power,
-		.ocr_mask               = MMC_VDD_28_29 | MMC_VDD_30_31 |
-					  MMC_VDD_32_33 | MMC_VDD_33_34,
+		.ocr_mask               = MMC_VDD_32_33 | MMC_VDD_33_34,
 		.name                   = "mmcblk",
 	},
 };
#16 lore raw

PATCH 1/1 HTCHERALD: MMC, I2C, HTCPLD, SPI, TSC2046

2010/9/30 Tony Lindgren <[email protected]>:

Quoted 37 lines · Tony Lindgren
Quoted 26 lines · Micha? Miros?aw
Quoted 25 lines

2010/9/30 Tony Lindgren <[email protected]>:

Quoted 6 lines · Cory Maccarrone
Quoted 4 lines
Quoted 3 lines

Looks like also board-sx1-mmc.c and board-h[23]-mmc.c have the same spotty voltage range.
Cory, care to do a patch that fixes it for all of them?

Yeah, I can do that. ?I'll resubmit this patch too with the fixed up ranges.

Turns out I already did it :) Care to test/ack this one?

[...]

Quoted 14 lines
arch/arm/mach-omap1/board-sx1-mmc.c +2 -1
index 5b33ae8..be5a365 100644
@@ -44,7 +44,8 @@ static struct omap_mmc_platform_data mmc1_data = {
 ? ? ? ?.nr_slots ? ? ? ? ? ? ? ? ? ? ? = 1,
 ? ? ? ?.slots[0] ? ? ? = {
 ? ? ? ? ? ? ? ?.set_power ? ? ? ? ? ? ?= mmc_set_power,
- ? ? ? ? ? ? ? .ocr_mask ? ? ? ? ? ? ? = MMC_VDD_28_29 | MMC_VDD_30_31 |
+ ? ? ? ? ? ? ? .ocr_mask ? ? ? ? ? ? ? = MMC_VDD_28_29 | MMC_VDD_29_30 |
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? MMC_VDD_30_31 | MMC_VDD_31_32 |
 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?MMC_VDD_32_33 | MMC_VDD_33_34,
 ? ? ? ? ? ? ? ?.name ? ? ? ? ? ? ? ? ? = "mmcblk",
 ? ? ? ?},

[...]

Quoted 5 lines
Quoted 3 lines

Al least this one seems wrong (haven't checked others) as the mmc_set_power() ignores vdd parameter. This suggests that the board supports only one particular voltage, not the whole range.

Hmm yeah good catch. With the external power it's board specific.

Most likely they all support only 3.3V cards except for n8x0. Not changing the n8x0 for what voltages it handles although it may be missing the MMC_VDD_27_28 voltage. Here's the updated patch.

Quoted 7 lines

Regards,

Tony

From: Tony Lindgren <[email protected]>
Subject: [PATCH] omap: Fix spotty MMC voltages
...

Finally got around to testing this, and it indeed works perfectly for me. I still get a bunch of weird CMD5 and CMD8 errors on init, but no ill effects were introduced by it, and the card works fine.

- Cory