1
0
mirror of https://git.yoctoproject.org/meta-ti synced 2026-05-08 12:30:16 +00:00

linux-ti33x-psp 3.1: remove an older outdated 3.1 kernel recipe for ti33x

Signed-off-by: Denys Dmytriyenko <denys@ti.com>
Acked-by: Chase Maupin <chase.maupin@ti.com>
This commit is contained in:
Denys Dmytriyenko
2013-03-18 14:39:09 -04:00
parent 2843ce6357
commit 900893454c
48 changed files with 0 additions and 21608 deletions
@@ -1,140 +0,0 @@
From 560f9d8e02d70e31e18f4f09c83d904d5e4595b5 Mon Sep 17 00:00:00 2001
From: Joel A Fernandes <joelagnel@ti.com>
Date: Fri, 28 Oct 2011 16:21:15 +0530
Subject: [PATCH 1/3] ARM:omap:am335x: BeagleBone version detection and support for old boards
* Have different dev_cfg structures and setup functions for new, old
beaglebone boards setup pin mux accordingly
* Fall back to older Bone boards if EEPROM reads are incorrect or empty
* Read version field of EEPROM config to call correct setup_beaglebone
function according to board version
While at it, clean-up a bad comment style in existing code.
Signed-off-by: Steve Kipisz <s-kipisz2@ti.com>
Signed-off-by: Joel A Fernandes <joelagnel@ti.com>
Signed-off-by: Sekhar Nori <nsekhar@ti.com>
---
arch/arm/mach-omap2/board-am335xevm.c | 54 +++++++++++++++++++++++++-------
1 files changed, 42 insertions(+), 12 deletions(-)
diff --git a/arch/arm/mach-omap2/board-am335xevm.c b/arch/arm/mach-omap2/board-am335xevm.c
index c84857e..ee936e0 100644
--- a/arch/arm/mach-omap2/board-am335xevm.c
+++ b/arch/arm/mach-omap2/board-am335xevm.c
@@ -288,7 +288,7 @@ static struct omap_board_config_kernel am335x_evm_config[] __initdata = {
struct am335x_evm_eeprom_config {
u32 header;
u8 name[8];
- u32 version;
+ char version[4];
u8 serial[12];
u8 opt[32];
};
@@ -1224,8 +1224,8 @@ static struct evm_dev_cfg ip_phn_evm_dev_cfg[] = {
{NULL, 0, 0},
};
-/* Beaglebone */
-static struct evm_dev_cfg beaglebone_dev_cfg[] = {
+/* Beaglebone < Rev A3 */
+static struct evm_dev_cfg beaglebone_old_dev_cfg[] = {
{rmii1_init, DEV_ON_BASEBOARD, PROFILE_NONE},
{usb0_init, DEV_ON_BASEBOARD, PROFILE_NONE},
{usb1_init, DEV_ON_BASEBOARD, PROFILE_NONE},
@@ -1233,6 +1233,15 @@ static struct evm_dev_cfg beaglebone_dev_cfg[] = {
{NULL, 0, 0},
};
+/* Beaglebone Rev A3 and after */
+static struct evm_dev_cfg beaglebone_dev_cfg[] = {
+ {mii1_init, DEV_ON_BASEBOARD, PROFILE_NONE},
+ {usb0_init, DEV_ON_BASEBOARD, PROFILE_NONE},
+ {usb1_init, DEV_ON_BASEBOARD, PROFILE_NONE},
+ {mmc0_init, DEV_ON_BASEBOARD, PROFILE_NONE},
+ {NULL, 0, 0},
+};
+
static void setup_low_cost_evm(void)
{
pr_info("The board is a AM335x Low Cost EVM.\n");
@@ -1282,19 +1291,32 @@ static void setup_ip_phone_evm(void)
_configure_device(IP_PHN_EVM, ip_phn_evm_dev_cfg, PROFILE_NONE);
}
-static void setup_beaglebone(void)
+/* BeagleBone < Rev A3 */
+static void setup_beaglebone_old(void)
{
- pr_info("The board is a AM335x Beaglebone.\n");
+ pr_info("The board is a AM335x Beaglebone < Rev A3.\n");
- /*Beagle Bone has Micro-SD slot which doesn't have Write Protect pin */
+ /* Beagle Bone has Micro-SD slot which doesn't have Write Protect pin */
am335x_mmc[0].gpio_wp = -EINVAL;
- _configure_device(LOW_COST_EVM, beaglebone_dev_cfg, PROFILE_NONE);
+ _configure_device(LOW_COST_EVM, beaglebone_old_dev_cfg, PROFILE_NONE);
phy_register_fixup_for_uid(BBB_PHY_ID, BBB_PHY_MASK,
beaglebone_phy_fixup);
}
+/* BeagleBone after Rev A3 */
+static void setup_beaglebone(void)
+{
+ pr_info("The board is a AM335x Beaglebone.\n");
+
+ /* Beagle Bone has Micro-SD slot which doesn't have Write Protect pin */
+ am335x_mmc[0].gpio_wp = -EINVAL;
+
+ _configure_device(LOW_COST_EVM, beaglebone_dev_cfg, PROFILE_NONE);
+}
+
+
static void am335x_setup_daughter_board(struct memory_accessor *m, void *c)
{
u8 tmp;
@@ -1353,11 +1375,18 @@ static void am335x_evm_setup(struct memory_accessor *mem_acc, void *context)
goto out;
}
- snprintf(tmp, sizeof(config.name), "%s", config.name);
+ snprintf(tmp, sizeof(config.name) + 1, "%s", config.name);
pr_info("Board name: %s\n", tmp);
+ snprintf(tmp, sizeof(config.version) + 1, "%s", config.version);
+ pr_info("Board version: %s\n", tmp);
+
if (!strncmp("A335BONE", config.name, 8)) {
daughter_brd_detected = false;
- setup_beaglebone();
+ if(!strncmp("00A1", config.version, 4) ||
+ !strncmp("00A2", config.version, 4))
+ setup_beaglebone_old();
+ else
+ setup_beaglebone();
} else {
/* only 6 characters of options string used for now */
snprintf(tmp, 7, "%s", config.opt);
@@ -1384,12 +1413,13 @@ static void am335x_evm_setup(struct memory_accessor *mem_acc, void *context)
out:
/*
* If the EEPROM hasn't been programed or an incorrect header
- * or board name are read, assume this is a beaglebone board.
+ * or board name are read, assume this is an old beaglebone board
+ * (< Rev A3)
*/
pr_err("Could not detect any board, falling back to: "
- "Beaglebone in profile 0 with no daughter card connected\n");
+ "Beaglebone (< Rev A3) with no daughter card connected\n");
daughter_brd_detected = false;
- setup_beaglebone();
+ setup_beaglebone_old();
/* Initialize cpsw after board detection is completed as board
* information is required for configuring phy address and hence
--
1.7.2.5
@@ -1,31 +0,0 @@
From 728dac2a525b9516ab22f78ec9c17d0862379085 Mon Sep 17 00:00:00 2001
From: Koen Kooi <koen@dominion.thruhere.net>
Date: Fri, 7 Oct 2011 15:29:28 +0200
Subject: [PATCH] f_rndis: HACK around undefined variables
Signed-off-by: Koen Kooi <koen@dominion.thruhere.net>
---
drivers/usb/gadget/f_rndis.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/usb/gadget/f_rndis.c b/drivers/usb/gadget/f_rndis.c
index 2d4e9eb..06114da 100644
--- a/drivers/usb/gadget/f_rndis.c
+++ b/drivers/usb/gadget/f_rndis.c
@@ -775,11 +775,11 @@ rndis_bind(struct usb_configuration *c, struct usb_function *f)
rndis_set_param_medium(rndis->config, NDIS_MEDIUM_802_3, 0);
rndis_set_host_mac(rndis->config, rndis->ethaddr);
-
+/*
if (rndis_set_param_vendor(rndis->config, vendorID,
manufacturer))
goto fail;
-
+*/
/* NOTE: all that is done without knowing or caring about
* the network link ... which is unavailable to this code
* until we're activated via set_alt().
--
1.6.6.1
@@ -1,263 +0,0 @@
From 29e73e40f5bda71f16ada687015545c79d005e34 Mon Sep 17 00:00:00 2001
From: Ajay Kumar Gupta <ajay.gupta@ti.com>
Date: Wed, 2 Nov 2011 11:15:40 +0530
Subject: [PATCH 1/5] usb: musb_core: kill all global and static variables
This needed for dual instances support.
Changes include:
- Move fifo_mode, orig_dma_mask, otg_timer, first to musb struct
- Killed option for use_dma
---
drivers/usb/musb/musb_core.c | 80 +++++++++++++-----------------------------
drivers/usb/musb/musb_core.h | 7 ++++
2 files changed, 32 insertions(+), 55 deletions(-)
diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index 16eec45..86232ae 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -399,8 +399,6 @@ void musb_otg_timer_func(unsigned long data)
spin_unlock_irqrestore(&musb->lock, flags);
}
-static DEFINE_TIMER(musb_otg_timer, musb_otg_timer_func, 0, 0);
-
/*
* Stops the B-device HNP state. Caller must take care of locking.
*/
@@ -664,8 +662,7 @@ static irqreturn_t musb_stage0_irq(struct musb *musb, u8 int_usb,
if (musb->is_active) {
musb->xceiv->state = OTG_STATE_B_WAIT_ACON;
dev_dbg(musb->controller, "HNP: Setting timer for b_ase0_brst\n");
- musb_otg_timer.data = (unsigned long)musb;
- mod_timer(&musb_otg_timer, jiffies
+ mod_timer(&musb->otg_timer, jiffies
+ msecs_to_jiffies(TB_ASE0_BRST));
}
break;
@@ -826,8 +823,7 @@ static irqreturn_t musb_stage0_irq(struct musb *musb, u8 int_usb,
case OTG_STATE_A_WAIT_BCON: /* OPT TD.4.7-900ms */
dev_dbg(musb->controller, "HNP: Setting timer as %s\n",
otg_state_string(musb->xceiv->state));
- musb_otg_timer.data = (unsigned long)musb;
- mod_timer(&musb_otg_timer, jiffies
+ mod_timer(&musb->otg_timer, jiffies
+ msecs_to_jiffies(100));
break;
case OTG_STATE_A_PERIPHERAL:
@@ -1024,22 +1020,6 @@ static void musb_shutdown(struct platform_device *pdev)
/*-------------------------------------------------------------------------*/
/*
- * The silicon either has hard-wired endpoint configurations, or else
- * "dynamic fifo" sizing. The driver has support for both, though at this
- * writing only the dynamic sizing is very well tested. Since we switched
- * away from compile-time hardware parameters, we can no longer rely on
- * dead code elimination to leave only the relevant one in the object file.
- *
- * We don't currently use dynamic fifo setup capability to do anything
- * more than selecting one of a bunch of predefined configurations.
- */
-static short __devinitdata fifo_mode = -1;
-
-/* "modprobe ... fifo_mode=1" etc */
-module_param(fifo_mode, short, 0);
-MODULE_PARM_DESC(fifo_mode, "initial endpoint configuration");
-
-/*
* tables defining fifo_mode values. define more if you like.
* for host side, make sure both halves of ep1 are set up.
*/
@@ -1253,7 +1233,7 @@ fifo_setup(struct musb *musb, struct musb_hw_ep *hw_ep,
return offset + (maxpacket << ((c_size & MUSB_FIFOSZ_DPB) ? 1 : 0));
}
- static struct musb_fifo_cfg __devinitdata ep0_cfg = {
+static struct musb_fifo_cfg __devinitdata ep0_cfg = {
.style = FIFO_RXTX, .maxpacket = 64,
};
@@ -1265,16 +1245,16 @@ static int __devinit ep_config_from_table(struct musb *musb)
struct musb_hw_ep *hw_ep = musb->endpoints;
if (musb->config->fifo_mode)
- fifo_mode = musb->config->fifo_mode;
+ musb->fifo_mode = musb->config->fifo_mode;
else if (musb->config->fifo_cfg) {
cfg = musb->config->fifo_cfg;
n = musb->config->fifo_cfg_size;
goto done;
}
- switch (fifo_mode) {
+ switch (musb->fifo_mode) {
default:
- fifo_mode = 0;
+ musb->fifo_mode = 0;
/* FALLTHROUGH */
case 0:
cfg = mode_0_cfg;
@@ -1307,7 +1287,7 @@ static int __devinit ep_config_from_table(struct musb *musb)
}
printk(KERN_DEBUG "%s: setup fifo_mode %d\n",
- musb_driver_name, fifo_mode);
+ musb_driver_name, musb->fifo_mode);
done:
@@ -1642,12 +1622,6 @@ irqreturn_t musb_interrupt(struct musb *musb)
EXPORT_SYMBOL_GPL(musb_interrupt);
#ifndef CONFIG_MUSB_PIO_ONLY
-static int __devinitdata use_dma = 1;
-
-/* "modprobe ... use_dma=0" etc */
-module_param(use_dma, bool, 0);
-MODULE_PARM_DESC(use_dma, "enable/disable use of DMA");
-
void musb_dma_completion(struct musb *musb, u8 epnum, u8 transmit)
{
u8 devctl = musb_readb(musb->mregs, MUSB_DEVCTL);
@@ -1686,9 +1660,6 @@ void musb_dma_completion(struct musb *musb, u8 epnum, u8 transmit)
}
}
EXPORT_SYMBOL_GPL(musb_dma_completion);
-
-#else
-#define use_dma 0
#endif
/*-------------------------------------------------------------------------*/
@@ -1813,10 +1784,9 @@ static const struct attribute_group musb_attr_group = {
static void musb_irq_work(struct work_struct *data)
{
struct musb *musb = container_of(data, struct musb, irq_work);
- static int old_state;
- if (musb->xceiv->state != old_state) {
- old_state = musb->xceiv->state;
+ if (musb->xceiv->state != musb->old_state) {
+ musb->old_state = musb->xceiv->state;
sysfs_notify(&musb->controller->kobj, NULL, "mode");
}
}
@@ -1895,6 +1865,8 @@ static void musb_free(struct musb *musb)
if (musb->gb_queue)
destroy_workqueue(musb->gb_queue);
+ del_timer_sync(&musb->otg_timer);
+
kfree(musb);
}
@@ -1943,10 +1915,13 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl,
musb->min_power = plat->min_power;
musb->ops = plat->platform_ops;
musb->id = pdev->id;
+ musb->first = 1;
- if (fifo_mode == -1)
- fifo_mode = musb->ops->fifo_mode;
+ musb->fifo_mode = musb->ops->fifo_mode;
+#ifndef CONFIG_MUSB_PIO_ONLY
+ musb->orig_dma_mask = dev->dma_mask;
+#endif
if (musb->ops->flags & MUSB_GLUE_TUSB_STYLE) {
musb_readb = __tusb_musb_readb;
musb_writeb = __tusb_musb_writeb;
@@ -1984,7 +1959,7 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl,
}
#ifndef CONFIG_MUSB_PIO_ONLY
- if (use_dma && dev->dma_mask) {
+ if (dev->dma_mask) {
struct dma_controller *c;
if (!musb->ops->dma_controller_create) {
@@ -2123,6 +2098,9 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl,
/* Init giveback workqueue */
INIT_WORK(&musb->gb_work, musb_gb_work);
+ /* setup otg_timer */
+ setup_timer(&musb->otg_timer, musb_otg_timer_func,
+ (unsigned long) musb);
return 0;
fail6:
@@ -2159,11 +2137,6 @@ fail0:
/* all implementations (PCI bridge to FPGA, VLYNQ, etc) should just
* bridge to a platform device; this driver then suffices.
*/
-
-#ifndef CONFIG_MUSB_PIO_ONLY
-static u64 *orig_dma_mask;
-#endif
-
static int __devinit musb_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
@@ -2196,10 +2169,6 @@ static int __devinit musb_probe(struct platform_device *pdev)
return -ENOMEM;
}
-#ifndef CONFIG_MUSB_PIO_ONLY
- /* clobbered by use_dma=n */
- orig_dma_mask = dev->dma_mask;
-#endif
status = musb_init_controller(dev, irq, base, iomem->start);
if (status < 0)
iounmap(base);
@@ -2229,7 +2198,7 @@ static int __exit musb_remove(struct platform_device *pdev)
iounmap(ctrl_base);
device_init_wakeup(&pdev->dev, 0);
#ifndef CONFIG_MUSB_PIO_ONLY
- pdev->dev.dma_mask = orig_dma_mask;
+ pdev->dev.dma_mask = musb->orig_dma_mask;
#endif
return 0;
}
@@ -2441,7 +2410,6 @@ static int musb_runtime_suspend(struct device *dev)
static int musb_runtime_resume(struct device *dev)
{
struct musb *musb = dev_to_musb(dev);
- static int first = 1;
/*
* When pm_runtime_get_sync called for the first time in driver
@@ -2452,9 +2420,11 @@ static int musb_runtime_resume(struct device *dev)
* Also context restore without save does not make
* any sense
*/
- if (!first)
+ if (musb->first)
+ musb->first = 0;
+ else
musb_restore_context(musb);
- first = 0;
+
return 0;
}
diff --git a/drivers/usb/musb/musb_core.h b/drivers/usb/musb/musb_core.h
index 919d43b..a34886f 100644
--- a/drivers/usb/musb/musb_core.h
+++ b/drivers/usb/musb/musb_core.h
@@ -464,6 +464,13 @@ struct musb {
u8 id;
struct timer_list otg_workaround;
unsigned long last_timer;
+ int first;
+ int old_state;
+ struct timer_list otg_timer;
+#ifndef CONFIG_MUSB_PIO_ONLY
+ u64 *orig_dma_mask;
+#endif
+ short fifo_mode;
};
static inline struct musb *gadget_to_musb(struct usb_gadget *g)
--
1.7.2.5
@@ -1,132 +0,0 @@
From 4df4ee83b31e09942932d67890d36ae116363ac1 Mon Sep 17 00:00:00 2001
From: Koen Kooi <koen@dominion.thruhere.net>
Date: Wed, 2 Nov 2011 09:11:59 +0100
Subject: [PATCH] ARM: OMAP2+: beaglebone: add LED support
Signed-off-by: Koen Kooi <koen@dominion.thruhere.net>
---
arch/arm/mach-omap2/board-am335xevm.c | 66 +++++++++++++++++++++++++++++++++
arch/arm/mach-omap2/mux33xx.c | 2 +-
2 files changed, 67 insertions(+), 1 deletions(-)
diff --git a/arch/arm/mach-omap2/board-am335xevm.c b/arch/arm/mach-omap2/board-am335xevm.c
index ee936e0..ecf4a76 100644
--- a/arch/arm/mach-omap2/board-am335xevm.c
+++ b/arch/arm/mach-omap2/board-am335xevm.c
@@ -18,6 +18,7 @@
#include <linux/i2c/at24.h>
#include <linux/phy.h>
#include <linux/gpio.h>
+#include <linux/leds.h>
#include <linux/spi/spi.h>
#include <linux/spi/flash.h>
#include <linux/mtd/mtd.h>
@@ -649,6 +650,60 @@ static struct pinmux_config usb1_pin_mux[] = {
{NULL, 0},
};
+/* LEDS - gpio1_21 -> gpio1_24 */
+
+#define BEAGLEBONE_USR1_LED GPIO_TO_PIN(1, 21)
+#define BEAGLEBONE_USR2_LED GPIO_TO_PIN(1, 22)
+#define BEAGLEBONE_USR3_LED GPIO_TO_PIN(1, 23)
+#define BEAGLEBONE_USR4_LED GPIO_TO_PIN(1, 24)
+
+#define BEAGLEBONEDVI_USR0_LED GPIO_TO_PIN(1, 18)
+#define BEAGLEBONEDVI_USR1_LED GPIO_TO_PIN(1, 19)
+
+static struct gpio_led gpio_leds[] = {
+ {
+ .name = "beaglebone::usr0",
+ .default_trigger = "heartbeat",
+ .gpio = BEAGLEBONE_USR1_LED,
+ },
+ {
+ .name = "beaglebone::usr1",
+ .default_trigger = "mmc0",
+ .gpio = BEAGLEBONE_USR2_LED,
+ },
+ {
+ .name = "beaglebone::usr2",
+ .gpio = BEAGLEBONE_USR3_LED,
+ },
+ {
+ .name = "beaglebone::usr3",
+ .gpio = BEAGLEBONE_USR4_LED,
+ },
+};
+
+static struct gpio_led_platform_data gpio_led_info = {
+ .leds = gpio_leds,
+ .num_leds = ARRAY_SIZE(gpio_leds),
+};
+
+static struct platform_device leds_gpio = {
+ .name = "leds-gpio",
+ .id = -1,
+ .dev = {
+ .platform_data = &gpio_led_info,
+ },
+};
+
+static struct pinmux_config bone_pin_mux[] = {
+ /* User LED gpios (gpio1_21 to gpio1_24) */
+ {"gpmc_a5.rgmii2_td0", OMAP_MUX_MODE7 | AM33XX_PIN_OUTPUT},
+ {"gpmc_a6.rgmii2_tclk", OMAP_MUX_MODE7 | AM33XX_PIN_OUTPUT},
+ {"gpmc_a7.rgmii2_rclk", OMAP_MUX_MODE7 | AM33XX_PIN_OUTPUT},
+ {"gpmc_a8.rgmii2_rd3", OMAP_MUX_MODE7 | AM33XX_PIN_OUTPUT},
+ /* Grounding gpio1_6 (pin 3 Conn A) signals bone tester to start diag tests */
+ {"gpmc_ad6.gpio1_6", OMAP_MUX_MODE7 | AM33XX_PIN_INPUT_PULLUP},
+};
+
/* Module pin mux for eCAP0 */
static struct pinmux_config ecap0_pin_mux[] = {
{"ecap0_in_pwm0_out.gpio0_7", AM33XX_PIN_OUTPUT},
@@ -757,6 +812,15 @@ static void tsc_init(int evm_id, int profile)
pr_err("failed to register touchscreen device\n");
}
+static void boneleds_init(int evm_id, int profile )
+{
+ int err;
+ setup_pin_mux(bone_pin_mux);
+ err = platform_device_register(&leds_gpio);
+ if (err)
+ pr_err("failed to register BeagleBone LEDS\n");
+}
+
static void rgmii1_init(int evm_id, int profile)
{
setup_pin_mux(rgmii1_pin_mux);
@@ -1230,6 +1294,7 @@ static struct evm_dev_cfg beaglebone_old_dev_cfg[] = {
{usb0_init, DEV_ON_BASEBOARD, PROFILE_NONE},
{usb1_init, DEV_ON_BASEBOARD, PROFILE_NONE},
{mmc0_init, DEV_ON_BASEBOARD, PROFILE_NONE},
+ {boneleds_init, DEV_ON_BASEBOARD, PROFILE_ALL},
{NULL, 0, 0},
};
@@ -1239,6 +1304,7 @@ static struct evm_dev_cfg beaglebone_dev_cfg[] = {
{usb0_init, DEV_ON_BASEBOARD, PROFILE_NONE},
{usb1_init, DEV_ON_BASEBOARD, PROFILE_NONE},
{mmc0_init, DEV_ON_BASEBOARD, PROFILE_NONE},
+ {boneleds_init, DEV_ON_BASEBOARD, PROFILE_ALL},
{NULL, 0, 0},
};
diff --git a/arch/arm/mach-omap2/mux33xx.c b/arch/arm/mach-omap2/mux33xx.c
index 0286c4f..f09e827 100644
--- a/arch/arm/mach-omap2/mux33xx.c
+++ b/arch/arm/mach-omap2/mux33xx.c
@@ -49,7 +49,7 @@ static struct omap_mux __initdata am33xx_muxmodes[] = {
NULL, NULL, NULL, NULL),
_AM33XX_MUXENTRY(GPMC_AD6, 0,
"gpmc_ad6", "mmc1_dat6", NULL, NULL,
- NULL, NULL, NULL, NULL),
+ NULL, NULL, NULL, "gpio1_6"),
_AM33XX_MUXENTRY(GPMC_AD7, 0,
"gpmc_ad7", "mmc1_dat7", NULL, NULL,
NULL, NULL, NULL, NULL),
--
1.7.4.1
@@ -1,28 +0,0 @@
From 1fff5fde3f5b2d167d5c51f9e7cf316fbd79886f Mon Sep 17 00:00:00 2001
From: Hebbar, Gururaja <gururaja.hebbar@ti.com>
Date: Tue, 8 Nov 2011 18:54:44 +0530
Subject: [PATCH 2/5] arm:omap:am335x: correct 32KHz clk rate
correct 32KHz clk (Divide down of PER PLL output) from 32678 to 32768
Signed-off-by: Hebbar, Gururaja <gururaja.hebbar@ti.com>
---
arch/arm/mach-omap2/clock33xx_data.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/arch/arm/mach-omap2/clock33xx_data.c b/arch/arm/mach-omap2/clock33xx_data.c
index 6763c59..f121196 100644
--- a/arch/arm/mach-omap2/clock33xx_data.c
+++ b/arch/arm/mach-omap2/clock33xx_data.c
@@ -44,7 +44,7 @@ void am33xx_init_timer_parent(struct clk *clk)
static struct clk clk_32768_ck = {
.name = "clk_32768_ck",
- .rate = 32678,
+ .rate = 32768,
.ops = &clkops_null,
};
--
1.7.2.5
@@ -1,165 +0,0 @@
From e3b1d8e6480879ecd533d8a3ac17bb7c4aa2baf0 Mon Sep 17 00:00:00 2001
From: Koen Kooi <koen@dominion.thruhere.net>
Date: Wed, 2 Nov 2011 09:14:29 +0100
Subject: [PATCH 3/3] ARM: OMAP2+: beaglebone: add DVI support (needs cleanup)
Signed-off-by: Koen Kooi <koen@dominion.thruhere.net>
---
arch/arm/mach-omap2/board-am335xevm.c | 106 +++++++++++++++++++++++++++++++++
1 files changed, 106 insertions(+), 0 deletions(-)
diff --git a/arch/arm/mach-omap2/board-am335xevm.c b/arch/arm/mach-omap2/board-am335xevm.c
index ecf4a76..6840422 100644
--- a/arch/arm/mach-omap2/board-am335xevm.c
+++ b/arch/arm/mach-omap2/board-am335xevm.c
@@ -144,6 +144,36 @@ struct da8xx_lcdc_platform_data TFC_S9700RTWV35TR_01B_pdata = {
.type = "TFC_S9700RTWV35TR_01B",
};
+static const struct display_panel dvi_panel = {
+ WVGA,
+ 16,
+ 16,
+ COLOR_ACTIVE,
+};
+
+static struct lcd_ctrl_config dvi_cfg = {
+ &dvi_panel,
+ .ac_bias = 255,
+ .ac_bias_intrpt = 0,
+ .dma_burst_sz = 16,
+ .bpp = 16,
+ .fdd = 0x80,
+ .tft_alt_mode = 0,
+ .stn_565_mode = 0,
+ .mono_8bit_mode = 0,
+ .invert_line_clock = 1,
+ .invert_frm_clock = 1,
+ .sync_edge = 0,
+ .sync_ctrl = 1,
+ .raster_order = 0,
+};
+
+struct da8xx_lcdc_platform_data dvi_pdata = {
+ .manu_name = "BBToys",
+ .controller_data = &dvi_cfg,
+ .type = "1024x768@60",
+};
+
/* TSc controller */
#include <linux/input/ti_tscadc.h>
@@ -369,6 +399,50 @@ static struct pinmux_config lcdc_pin_mux[] = {
{NULL, 0},
};
+/* Module pin mux for DVI board */
+static struct pinmux_config dvi_pin_mux[] = {
+ {"lcd_data0.lcd_data0", OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT
+ | AM33XX_PULL_DISA},
+ {"lcd_data1.lcd_data1", OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT
+ | AM33XX_PULL_DISA},
+ {"lcd_data2.lcd_data2", OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT
+ | AM33XX_PULL_DISA},
+ {"lcd_data3.lcd_data3", OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT
+ | AM33XX_PULL_DISA},
+ {"lcd_data4.lcd_data4", OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT
+ | AM33XX_PULL_DISA},
+ {"lcd_data5.lcd_data5", OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT
+ | AM33XX_PULL_DISA},
+ {"lcd_data6.lcd_data6", OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT
+ | AM33XX_PULL_DISA},
+ {"lcd_data7.lcd_data7", OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT
+ | AM33XX_PULL_DISA},
+ {"lcd_data8.lcd_data8", OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT
+ | AM33XX_PULL_DISA},
+ {"lcd_data9.lcd_data9", OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT
+ | AM33XX_PULL_DISA},
+ {"lcd_data10.lcd_data10", OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT
+ | AM33XX_PULL_DISA},
+ {"lcd_data11.lcd_data11", OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT
+ | AM33XX_PULL_DISA},
+ {"lcd_data12.lcd_data12", OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT
+ | AM33XX_PULL_DISA},
+ {"lcd_data13.lcd_data13", OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT
+ | AM33XX_PULL_DISA},
+ {"lcd_data14.lcd_data14", OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT
+ | AM33XX_PULL_DISA},
+ {"lcd_data15.lcd_data15", OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT
+ | AM33XX_PULL_DISA},
+ {"lcd_vsync.lcd_vsync", OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT},
+ {"lcd_hsync.lcd_hsync", OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT},
+ {"lcd_pclk.lcd_pclk", OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT},
+ {"lcd_ac_bias_en.lcd_ac_bias_en", OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT}, //DVIEN
+ {"gpmc_a2.rgmii2_td3", OMAP_MUX_MODE7 | AM33XX_PIN_OUTPUT}, // USR0 LED
+ {"gpmc_a3.rgmii2_td2", OMAP_MUX_MODE7 | AM33XX_PIN_OUTPUT}, // USR1 LED
+ {"gpmc_ad7.gpmc_ad7", OMAP_MUX_MODE7 | AM33XX_PIN_OUTPUT}, // DVI PDn
+ {NULL, 0},
+};
+
static struct pinmux_config tsc_pin_mux[] = {
{"ain0.ain0", OMAP_MUX_MODE0 | AM33XX_INPUT_EN},
{"ain1.ain1", OMAP_MUX_MODE0 | AM33XX_INPUT_EN},
@@ -679,6 +753,16 @@ static struct gpio_led gpio_leds[] = {
.name = "beaglebone::usr3",
.gpio = BEAGLEBONE_USR4_LED,
},
+ {
+ .name = "dvi::usr0",
+ .default_trigger = "heartbeat",
+ .gpio = BEAGLEBONEDVI_USR0_LED,
+ },
+ {
+ .name = "dvi::usr1",
+ .default_trigger = "mmc0",
+ .gpio = BEAGLEBONEDVI_USR1_LED,
+ },
};
static struct gpio_led_platform_data gpio_led_info = {
@@ -803,6 +887,26 @@ static void lcdc_init(int evm_id, int profile)
return;
}
+#define BEAGLEBONEDVI_PDn GPIO_TO_PIN(1, 7)
+
+static void dvi_init(int evm_id, int profile)
+{
+ setup_pin_mux(dvi_pin_mux);
+ gpio_request(BEAGLEBONEDVI_PDn, "DVI_PDn");
+ gpio_direction_output(BEAGLEBONEDVI_PDn, 1);
+
+ // we are being stupid and setting pixclock from here instead of da8xx-fb.c
+ if (conf_disp_pll(560000000)) {
+ pr_info("Failed to set pixclock to 56000000, not attempting to"
+ "register DVI adapter\n");
+ return;
+ }
+
+ if (am33xx_register_lcdc(&dvi_pdata))
+ pr_info("Failed to register BeagleBoardToys DVI adapter\n");
+ return;
+}
+
static void tsc_init(int evm_id, int profile)
{
int err;
@@ -1291,6 +1395,7 @@ static struct evm_dev_cfg ip_phn_evm_dev_cfg[] = {
/* Beaglebone < Rev A3 */
static struct evm_dev_cfg beaglebone_old_dev_cfg[] = {
{rmii1_init, DEV_ON_BASEBOARD, PROFILE_NONE},
+ {dvi_init, DEV_ON_BASEBOARD, PROFILE_ALL},
{usb0_init, DEV_ON_BASEBOARD, PROFILE_NONE},
{usb1_init, DEV_ON_BASEBOARD, PROFILE_NONE},
{mmc0_init, DEV_ON_BASEBOARD, PROFILE_NONE},
@@ -1301,6 +1406,7 @@ static struct evm_dev_cfg beaglebone_old_dev_cfg[] = {
/* Beaglebone Rev A3 and after */
static struct evm_dev_cfg beaglebone_dev_cfg[] = {
{mii1_init, DEV_ON_BASEBOARD, PROFILE_NONE},
+ {dvi_init, DEV_ON_BASEBOARD, PROFILE_ALL},
{usb0_init, DEV_ON_BASEBOARD, PROFILE_NONE},
{usb1_init, DEV_ON_BASEBOARD, PROFILE_NONE},
{mmc0_init, DEV_ON_BASEBOARD, PROFILE_NONE},
--
1.7.2.5
@@ -1,47 +0,0 @@
From c5b1ff5857e590f50b4276d4de8e34fbcdc4dfb9 Mon Sep 17 00:00:00 2001
From: Hebbar, Gururaja <gururaja.hebbar@ti.com>
Date: Mon, 24 Oct 2011 15:59:37 +0530
Subject: [PATCH 3/5] arm:omap:mcspi: correct memory range when requesting regions
Current McSPI driver 1st requests memory regions & later adds register
offset. This causes warning when during module removal as below.
root@arago-armv7:~# rmmod -v /lib/modules/3.1.0-rc8/spi-omap2-mcspi.ko
rmmod spi_omap2_mcspi, wait=no
[ 42.472810] Trying to free nonexistent resource
<00000000481a0100-00000000481a04ff>
[ 42.519178] Trying to free nonexistent resource
<0000000048030100-00000000480304ff>
This patch moves the register offset addition before request_mem_region
Signed-off-by: Hebbar, Gururaja <gururaja.hebbar@ti.com>
---
drivers/spi/spi-omap2-mcspi.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/spi/spi-omap2-mcspi.c b/drivers/spi/spi-omap2-mcspi.c
index 860651f..f757a8e 100644
--- a/drivers/spi/spi-omap2-mcspi.c
+++ b/drivers/spi/spi-omap2-mcspi.c
@@ -1136,14 +1136,15 @@ static int __init omap2_mcspi_probe(struct platform_device *pdev)
status = -ENODEV;
goto err1;
}
+
+ r->start += pdata->regs_offset;
+ r->end += pdata->regs_offset;
if (!request_mem_region(r->start, resource_size(r),
dev_name(&pdev->dev))) {
status = -EBUSY;
goto err1;
}
- r->start += pdata->regs_offset;
- r->end += pdata->regs_offset;
mcspi->phys = r->start;
mcspi->base = ioremap(r->start, resource_size(r));
if (!mcspi->base) {
--
1.7.2.5
@@ -1,44 +0,0 @@
From 0cd12bf08c6d08771e493342c704de60830785cf Mon Sep 17 00:00:00 2001
From: Hebbar, Gururaja <gururaja.hebbar@ti.com>
Date: Mon, 24 Oct 2011 15:50:27 +0530
Subject: [PATCH 4/5] arm:omap:mcspi: follow proper pm_runtime enable/disable sequence
omap mcspi probe() doesnt call pm_runtime put & disable functions
in case of failure. remove() doesnt call pm_runtime disable. This could
lead to warnings as below on subsequent insmod.
root@arago-armv7:~# insmod /lib/modules/3.1.0-rc8/spi-omap2-mcspi.ko
[ 255.383671] omap2_mcspi omap2_mcspi.1: Unbalanced pm_runtime_enable!
...
This patch adds the pm_runtime put() & disable() at aprropriate stages.
Signed-off-by: Hebbar, Gururaja <gururaja.hebbar@ti.com>
---
drivers/spi/spi-omap2-mcspi.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/drivers/spi/spi-omap2-mcspi.c b/drivers/spi/spi-omap2-mcspi.c
index f757a8e..7a8e19e 100644
--- a/drivers/spi/spi-omap2-mcspi.c
+++ b/drivers/spi/spi-omap2-mcspi.c
@@ -1209,6 +1209,8 @@ static int __init omap2_mcspi_probe(struct platform_device *pdev)
err4:
spi_master_put(master);
err3:
+ pm_runtime_put_sync(&pdev->dev);
+ pm_runtime_disable(&pdev->dev);
kfree(mcspi->dma_channels);
err2:
release_mem_region(r->start, resource_size(r));
@@ -1230,6 +1232,7 @@ static int __exit omap2_mcspi_remove(struct platform_device *pdev)
dma_channels = mcspi->dma_channels;
omap2_mcspi_disable_clocks(mcspi);
+ pm_runtime_disable(&pdev->dev);
r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
release_mem_region(r->start, resource_size(r));
--
1.7.2.5
@@ -1,38 +0,0 @@
From 27c26386a0152b7d0c2b4f173bcbe30805f42749 Mon Sep 17 00:00:00 2001
From: Koen Kooi <koen@dominion.thruhere.net>
Date: Thu, 3 Nov 2011 17:35:50 +0100
Subject: [PATCH 4/4] da8xx-fb: add DVI support for beaglebone
Signed-off-by: Koen Kooi <koen@dominion.thruhere.net>
---
drivers/video/da8xx-fb.c | 14 ++++++++++++++
1 files changed, 14 insertions(+), 0 deletions(-)
diff --git a/drivers/video/da8xx-fb.c b/drivers/video/da8xx-fb.c
index 4347421..9619518 100644
--- a/drivers/video/da8xx-fb.c
+++ b/drivers/video/da8xx-fb.c
@@ -266,6 +266,20 @@ static struct da8xx_panel known_lcd_panels[] = {
.pxl_clk = 30000000,
.invert_pxl_clk = 0,
},
+ [3] = {
+ /* 1024 x 768 @ 60 Hz Reduced blanking VESA CVT 0.79M3-R */
+ .name = "1024x768@60",
+ .width = 1024,
+ .height = 768,
+ .hfp = 48,
+ .hbp = 80,
+ .hsw = 32,
+ .vfp = 3,
+ .vbp = 15,
+ .vsw = 4,
+ .pxl_clk = 56000000,
+ .invert_pxl_clk = 0,
+ },
};
/* Enable the Raster Engine of the LCD Controller */
--
1.7.2.5
@@ -1,120 +0,0 @@
From 608b49748a1ebe4b71de460a343df7fe4ae74c2b Mon Sep 17 00:00:00 2001
From: Hebbar, Gururaja <gururaja.hebbar@ti.com>
Date: Mon, 24 Oct 2011 16:22:50 +0530
Subject: [PATCH 5/5] arm:omap:mcspi: follow proper probe() & remove() steps
Currently McSPI driver doesnt follow correct failure fallback steps
incase of probe & in case of remove() procedure.
This patch corrects label names to give meaningful labels & also
corrects fallback & removal procedure
Signed-off-by: Hebbar, Gururaja <gururaja.hebbar@ti.com>
---
drivers/spi/spi-omap2-mcspi.c | 37 +++++++++++++++++++++++--------------
1 files changed, 23 insertions(+), 14 deletions(-)
diff --git a/drivers/spi/spi-omap2-mcspi.c b/drivers/spi/spi-omap2-mcspi.c
index 7a8e19e..e433029 100644
--- a/drivers/spi/spi-omap2-mcspi.c
+++ b/drivers/spi/spi-omap2-mcspi.c
@@ -1134,7 +1134,7 @@ static int __init omap2_mcspi_probe(struct platform_device *pdev)
r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (r == NULL) {
status = -ENODEV;
- goto err1;
+ goto free_master;
}
r->start += pdata->regs_offset;
@@ -1142,7 +1142,7 @@ static int __init omap2_mcspi_probe(struct platform_device *pdev)
if (!request_mem_region(r->start, resource_size(r),
dev_name(&pdev->dev))) {
status = -EBUSY;
- goto err1;
+ goto free_master;
}
mcspi->phys = r->start;
@@ -1150,7 +1150,7 @@ static int __init omap2_mcspi_probe(struct platform_device *pdev)
if (!mcspi->base) {
dev_dbg(&pdev->dev, "can't ioremap MCSPI\n");
status = -ENOMEM;
- goto err2;
+ goto release_region;
}
mcspi->dev = &pdev->dev;
@@ -1165,7 +1165,7 @@ static int __init omap2_mcspi_probe(struct platform_device *pdev)
GFP_KERNEL);
if (mcspi->dma_channels == NULL)
- goto err2;
+ goto unmap_io;
for (i = 0; i < master->num_chipselect; i++) {
char dma_ch_name[14];
@@ -1195,27 +1195,34 @@ static int __init omap2_mcspi_probe(struct platform_device *pdev)
mcspi->dma_channels[i].dma_tx_sync_dev = dma_res->start;
}
+ if (status < 0)
+ goto dma_chnl_free;
+
pm_runtime_enable(&pdev->dev);
if (status || omap2_mcspi_master_setup(mcspi) < 0)
- goto err3;
+ goto diable_pm;
status = spi_register_master(master);
if (status < 0)
- goto err4;
+ goto err_spi_register;
return status;
-err4:
+err_spi_register:
spi_master_put(master);
-err3:
+diable_pm:
pm_runtime_put_sync(&pdev->dev);
pm_runtime_disable(&pdev->dev);
+dma_chnl_free:
kfree(mcspi->dma_channels);
-err2:
- release_mem_region(r->start, resource_size(r));
+unmap_io:
iounmap(mcspi->base);
-err1:
+release_region:
+ release_mem_region(r->start, resource_size(r));
+free_master:
+ kfree(master);
+ platform_set_drvdata(pdev, NULL);
return status;
}
@@ -1233,13 +1240,15 @@ static int __exit omap2_mcspi_remove(struct platform_device *pdev)
omap2_mcspi_disable_clocks(mcspi);
pm_runtime_disable(&pdev->dev);
+ kfree(dma_channels);
+ base = mcspi->base;
+ iounmap(base);
+
r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
release_mem_region(r->start, resource_size(r));
- base = mcspi->base;
spi_unregister_master(master);
- iounmap(base);
- kfree(dma_channels);
+ platform_set_drvdata(pdev, NULL);
return 0;
}
--
1.7.2.5
@@ -1,86 +0,0 @@
From c5a0664fa68a8541c1400bf7330a072581b12c38 Mon Sep 17 00:00:00 2001
From: Joel A Fernandes <joelagnel@ti.com>
Date: Sat, 12 Nov 2011 23:42:26 -0600
Subject: [PATCH v2] usb::musb::cppi41_dma: Check if scheduling is required after DMA
Even after TX DMA, data can still be in the FIFO and we would keep
rescheduling the worker thread in a polling fashion taking up a lot
of CPU if the controller was slow to respond. We check if rescheduling
is required and sleep if so.
This fixes high CPU load issue seen with g_mass_storage on a BeagleBone
and could potentially fix similar issues seen with other gadget drivers.
v2 changes:
Avoid rescheduling a "worker", this process involves a lot of workqueue
related crunching that is unnecessary. If we're polling, we might as well
do it with minimum overhead, and giving other processes CPU time at the
same time.
Signed-off-by: Joel A Fernandes <joelagnel@ti.com>
---
drivers/usb/musb/cppi41_dma.c | 30 ++++++++++++++++++------------
1 files changed, 18 insertions(+), 12 deletions(-)
diff --git a/drivers/usb/musb/cppi41_dma.c b/drivers/usb/musb/cppi41_dma.c
index a24707c..3ac58b1 100644
--- a/drivers/usb/musb/cppi41_dma.c
+++ b/drivers/usb/musb/cppi41_dma.c
@@ -1283,6 +1283,7 @@ void cppi41_check_fifo_empty(struct cppi41 *cppi)
for (index = 0; index < USB_CPPI41_NUM_CH; index++) {
void __iomem *epio;
u16 csr;
+ unsigned long flags;
tx_ch = &cppi->tx_cppi_ch[index];
if (tx_ch->tx_complete) {
@@ -1299,29 +1300,34 @@ void cppi41_check_fifo_empty(struct cppi41 *cppi)
epio = tx_ch->end_pt->regs;
csr = musb_readw(epio, MUSB_TXCSR);
- if (csr & (MUSB_TXCSR_TXPKTRDY |
- MUSB_TXCSR_FIFONOTEMPTY))
- resched = 1;
- else {
- tx_ch->tx_complete = 0;
- musb_dma_completion(musb, index+1, 1);
+ while (1) {
+ csr = musb_readw(epio, MUSB_TXCSR);
+ if(!(csr & (MUSB_TXCSR_TXPKTRDY |
+ MUSB_TXCSR_FIFONOTEMPTY)))
+ break;
+ cond_resched();
}
+ tx_ch->tx_complete = 0;
+ spin_lock_irqsave(&musb->lock, flags);
+ musb_dma_completion(musb, index+1, 1);
+ spin_unlock_irqrestore(&musb->lock, flags);
}
}
-
- if (resched)
- schedule_work(&cppi->txdma_work);
}
void txdma_completion_work(struct work_struct *data)
{
struct cppi41 *cppi = container_of(data, struct cppi41, txdma_work);
struct musb *musb = cppi->musb;
- unsigned long flags;
- spin_lock_irqsave(&musb->lock, flags);
+ /*
+ * txdma worker thread can call schedule_work on itself and cause
+ * itself to be scheduled immediately and because the data might still
+ * be in FIFO if it hasn't been pushed out after DMA, it is possible for
+ * the worker to consume lot of CPU when the controller is slow, so we
+ * reschedule if necessary.
+ */
cppi41_check_fifo_empty(cppi);
- spin_unlock_irqrestore(&musb->lock, flags);
}
/**
--
1.7.4.1
@@ -1,63 +0,0 @@
From 9365085cbe7061760f8ca4916b88b3c9c625f265 Mon Sep 17 00:00:00 2001
From: Koen Kooi <koen@dominion.thruhere.net>
Date: Tue, 27 Dec 2011 20:17:36 +0100
Subject: [PATCH 31/34] am335x-evm: add pdata for all cape EEPROM permutations
Signed-off-by: Koen Kooi <koen@dominion.thruhere.net>
---
arch/arm/mach-omap2/board-am335xevm.c | 35 +++++++++++++++++++++++++++++---
1 files changed, 31 insertions(+), 4 deletions(-)
diff --git a/arch/arm/mach-omap2/board-am335xevm.c b/arch/arm/mach-omap2/board-am335xevm.c
index 8e1521c..116089f 100644
--- a/arch/arm/mach-omap2/board-am335xevm.c
+++ b/arch/arm/mach-omap2/board-am335xevm.c
@@ -1148,14 +1148,41 @@ static struct i2c_board_info beaglebone_i2c_boardinfo2[] = {
},
};
+static struct at24_platform_data cape_eeprom_info = {
+ .byte_len = (256*1024) / 8,
+ .page_size = 64,
+ .flags = AT24_FLAG_ADDR16,
+ .context = (void *)NULL,
+};
+
+static struct i2c_board_info __initdata cape_i2c_boardinfo[] = {
+ {
+ I2C_BOARD_INFO("24c256", 0x54),
+ .platform_data = &cape_eeprom_info,
+ },
+ {
+ I2C_BOARD_INFO("24c256", 0x55),
+ .platform_data = &cape_eeprom_info,
+ },
+ {
+ I2C_BOARD_INFO("24c256", 0x56),
+ .platform_data = &cape_eeprom_info,
+ },
+ {
+ I2C_BOARD_INFO("24c256", 0x57),
+ .platform_data = &cape_eeprom_info,
+ },
+};
+
static void i2c2_init(int evm_id, int profile)
{
- setup_pin_mux(i2c2_pin_mux);
- omap_register_i2c_bus(3, 100, beaglebone_i2c_boardinfo2,
- ARRAY_SIZE(beaglebone_i2c_boardinfo2));
- return;
+ setup_pin_mux(i2c2_pin_mux);
+ omap_register_i2c_bus(3, 100, cape_i2c_boardinfo,
+ ARRAY_SIZE(cape_i2c_boardinfo));
+ return;
}
+
/* Setup McASP 1 */
static void mcasp1_init(int evm_id, int profile)
{
--
1.7.7.4
@@ -1,359 +0,0 @@
From cdd84fe3886d332e9e706940af2516559da92349 Mon Sep 17 00:00:00 2001
From: Koen Kooi <koen@dominion.thruhere.net>
Date: Thu, 5 Jan 2012 12:03:20 +0100
Subject: [PATCH 32/35] am335x: add support for 7" LCD cape, fix DVI entries
Using the EEPROMs!
Signed-off-by: Koen Kooi <koen@dominion.thruhere.net>
---
arch/arm/mach-omap2/board-am335xevm.c | 216 ++++++++++++++++++++++++++++++---
arch/arm/mach-omap2/mux33xx.c | 2 +-
2 files changed, 199 insertions(+), 19 deletions(-)
diff --git a/arch/arm/mach-omap2/board-am335xevm.c b/arch/arm/mach-omap2/board-am335xevm.c
index 116089f..6c19334 100644
--- a/arch/arm/mach-omap2/board-am335xevm.c
+++ b/arch/arm/mach-omap2/board-am335xevm.c
@@ -146,6 +146,36 @@ struct da8xx_lcdc_platform_data TFC_S9700RTWV35TR_01B_pdata = {
.type = "TFC_S9700RTWV35TR_01B",
};
+static const struct display_panel bbtoys7_panel = {
+ WVGA,
+ 16,
+ 16,
+ COLOR_ACTIVE,
+};
+
+static struct lcd_ctrl_config bbtoys7_cfg = {
+ &bbtoys7_panel,
+ .ac_bias = 255,
+ .ac_bias_intrpt = 0,
+ .dma_burst_sz = 16,
+ .bpp = 16,
+ .fdd = 0x80,
+ .tft_alt_mode = 0,
+ .stn_565_mode = 0,
+ .mono_8bit_mode = 0,
+ .invert_line_clock = 1,
+ .invert_frm_clock = 1,
+ .sync_edge = 0,
+ .sync_ctrl = 1,
+ .raster_order = 0,
+};
+
+struct da8xx_lcdc_platform_data bbtoys7_pdata = {
+ .manu_name = "ThreeFive",
+ .controller_data = &bbtoys7_cfg,
+ .type = "TFC_S9700RTWV35TR_01B",
+};
+
static const struct display_panel dvi_panel = {
WVGA,
16,
@@ -345,9 +375,34 @@ struct am335x_evm_eeprom_config {
static struct am335x_evm_eeprom_config config;
static bool daughter_brd_detected;
+struct beaglebone_cape_eeprom_config {
+ u32 header;
+ char format_revision[2];
+ char name[32];
+ char version[4];
+ char manufacturer[16];
+ char partnumber[16];
+ u16 numpins;
+ char serial[12];
+ u8 muxdata[170];
+ u16 current_3v3;
+ u16 current_vdd5v;
+ u16 current_sys5v;
+ u16 dc;
+};
+
+static struct beaglebone_cape_eeprom_config cape_config;
+static bool beaglebone_cape_detected;
+
+/* keep track of ADC pin usage */
+static int capecount = 0;
+static bool beaglebone_tsadcpins_free = 1;
+
+
#define GP_EVM_REV_IS_1_0A 0x1
#define GP_EVM_REV_IS_1_1A 0x2
#define GP_EVM_REV_IS_UNKNOWN 0xFF
+#define GP_EVM_ACTUALLY_BEAGLEBONE 0xBB
static unsigned int gp_evm_revision = GP_EVM_REV_IS_UNKNOWN;
#define EEPROM_MAC_ADDRESS_OFFSET 60 /* 4+8+4+12+32 */
@@ -422,7 +477,7 @@ static struct pinmux_config lcdc_pin_mux[] = {
{NULL, 0},
};
-/* Module pin mux for DVI board */
+/* Module pin mux for Beagleboardtoys DVI cape */
static struct pinmux_config dvi_pin_mux[] = {
{"lcd_data0.lcd_data0", OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT
| AM33XX_PULL_DISA},
@@ -459,13 +514,56 @@ static struct pinmux_config dvi_pin_mux[] = {
{"lcd_vsync.lcd_vsync", OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT},
{"lcd_hsync.lcd_hsync", OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT},
{"lcd_pclk.lcd_pclk", OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT},
- {"lcd_ac_bias_en.lcd_ac_bias_en", OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT}, //DVIEN
+ {"lcd_ac_bias_en.lcd_ac_bias_en", OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT},
{"gpmc_a2.rgmii2_td3", OMAP_MUX_MODE7 | AM33XX_PIN_OUTPUT}, // USR0 LED
{"gpmc_a3.rgmii2_td2", OMAP_MUX_MODE7 | AM33XX_PIN_OUTPUT}, // USR1 LED
{"gpmc_ad7.gpmc_ad7", OMAP_MUX_MODE7 | AM33XX_PIN_OUTPUT}, // DVI PDn
{NULL, 0},
};
+/* Module pin mux for Beagleboardtoys 7" LCD cape */
+static struct pinmux_config bbtoys7_pin_mux[] = {
+ {"lcd_data0.lcd_data0", OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT
+ | AM33XX_PULL_DISA},
+ {"lcd_data1.lcd_data1", OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT
+ | AM33XX_PULL_DISA},
+ {"lcd_data2.lcd_data2", OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT
+ | AM33XX_PULL_DISA},
+ {"lcd_data3.lcd_data3", OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT
+ | AM33XX_PULL_DISA},
+ {"lcd_data4.lcd_data4", OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT
+ | AM33XX_PULL_DISA},
+ {"lcd_data5.lcd_data5", OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT
+ | AM33XX_PULL_DISA},
+ {"lcd_data6.lcd_data6", OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT
+ | AM33XX_PULL_DISA},
+ {"lcd_data7.lcd_data7", OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT
+ | AM33XX_PULL_DISA},
+ {"lcd_data8.lcd_data8", OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT
+ | AM33XX_PULL_DISA},
+ {"lcd_data9.lcd_data9", OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT
+ | AM33XX_PULL_DISA},
+ {"lcd_data10.lcd_data10", OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT
+ | AM33XX_PULL_DISA},
+ {"lcd_data11.lcd_data11", OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT
+ | AM33XX_PULL_DISA},
+ {"lcd_data12.lcd_data12", OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT
+ | AM33XX_PULL_DISA},
+ {"lcd_data13.lcd_data13", OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT
+ | AM33XX_PULL_DISA},
+ {"lcd_data14.lcd_data14", OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT
+ | AM33XX_PULL_DISA},
+ {"lcd_data15.lcd_data15", OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT
+ | AM33XX_PULL_DISA},
+ {"lcd_vsync.lcd_vsync", OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT},
+ {"lcd_hsync.lcd_hsync", OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT},
+ {"lcd_pclk.lcd_pclk", OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT},
+ {"lcd_ac_bias_en.lcd_ac_bias_en", OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT},
+ {"gpmc_a2.gpio1_18", OMAP_MUX_MODE7 | AM33XX_PIN_OUTPUT}, // Backlight
+ {"ecap0_in_pwm0_out.gpio0_7", OMAP_MUX_MODE7 | AM33XX_PIN_OUTPUT}, // AVDD_EN
+ {NULL, 0},
+};
+
static struct pinmux_config tsc_pin_mux[] = {
{"ain0.ain0", OMAP_MUX_MODE0 | AM33XX_INPUT_EN},
{"ain1.ain1", OMAP_MUX_MODE0 | AM33XX_INPUT_EN},
@@ -771,16 +869,6 @@ static struct gpio_led gpio_leds[] = {
.name = "beaglebone::usr3",
.gpio = BEAGLEBONE_USR4_LED,
},
- {
- .name = "dvi::usr0",
- .default_trigger = "heartbeat",
- .gpio = BEAGLEBONEDVI_USR0_LED,
- },
- {
- .name = "dvi::usr1",
- .default_trigger = "mmc0",
- .gpio = BEAGLEBONEDVI_USR1_LED,
- },
};
static struct gpio_led_platform_data gpio_led_info = {
@@ -905,6 +993,31 @@ static void lcdc_init(int evm_id, int profile)
return;
}
+#define BEAGLEBONE_LCD_AVDD_EN GPIO_TO_PIN(0, 7)
+#define BEAGLEBONE_LCD_BL GPIO_TO_PIN(1, 18)
+
+static void bbtoys7lcd_init(int evm_id, int profile)
+{
+ setup_pin_mux(bbtoys7_pin_mux);
+
+ // we are being stupid and setting pixclock from here instead of da8xx-fb.c
+ if (conf_disp_pll(300000000)) {
+ pr_info("Failed to set pixclock to 300000000, not attempting to"
+ "register LCD cape\n");
+ return;
+ }
+
+ if (am33xx_register_lcdc(&bbtoys7_pdata))
+ pr_info("Failed to register Beagleboardtoys 7\" LCD cape device\n");
+
+ gpio_request(BEAGLEBONE_LCD_BL, "BONE_LCD_BL");
+ gpio_direction_output(BEAGLEBONE_LCD_BL, 1);
+ gpio_request(BEAGLEBONE_LCD_AVDD_EN, "BONE_LCD_AVDD_EN");
+ gpio_direction_output(BEAGLEBONE_LCD_AVDD_EN, 1);
+
+ return;
+}
+
#define BEAGLEBONEDVI_PDn GPIO_TO_PIN(1, 7)
static void dvi_init(int evm_id, int profile)
@@ -921,7 +1034,7 @@ static void dvi_init(int evm_id, int profile)
}
if (am33xx_register_lcdc(&dvi_pdata))
- pr_info("Failed to register BeagleBoardToys DVI adapter\n");
+ pr_info("Failed to register BeagleBoardToys DVI cape\n");
return;
}
@@ -932,10 +1045,15 @@ static void tsc_init(int evm_id, int profile)
if (gp_evm_revision == GP_EVM_REV_IS_1_1A) {
am335x_touchscreen_data.analog_input = 1;
pr_info("TSC connected to beta GP EVM\n");
- } else {
+ }
+ if (gp_evm_revision == GP_EVM_REV_IS_1_1A) {
am335x_touchscreen_data.analog_input = 0;
pr_info("TSC connected to alpha GP EVM\n");
}
+ if( gp_evm_revision == GP_EVM_ACTUALLY_BEAGLEBONE) {
+ am335x_touchscreen_data.analog_input = 1;
+ pr_info("TSC connected to BeagleBone\n");;
+ }
setup_pin_mux(tsc_pin_mux);
err = platform_device_register(&tsc_device);
if (err)
@@ -1148,11 +1266,76 @@ static struct i2c_board_info beaglebone_i2c_boardinfo2[] = {
},
};
+static void beaglebone_cape_setup(struct memory_accessor *mem_acc, void *context)
+{
+ capecount++;
+ int ret;
+ char tmp[32];
+ char name[32];
+ char manufacturer[32];
+
+ /* get cape specific data */
+ ret = mem_acc->read(mem_acc, (char *)&cape_config, 0, sizeof(cape_config));
+ if (ret != sizeof(cape_config)) {
+ pr_warning("BeagleBone cape EEPROM: could not read eeprom at address 0x%x\n", capecount + 0x53);
+ if ((capecount > 3) && (beaglebone_tsadcpins_free == 1)) {
+ pr_info("BeagleBone cape: exporting ADC pins to sysfs\n");
+ bone_tsc_init(0,0);
+ beaglebone_tsadcpins_free = 0;
+ }
+ return;
+ }
+
+ if (cape_config.header != AM335X_EEPROM_HEADER) {
+ pr_warning("BeagleBone Cape EEPROM: wrong header 0x%x, expected 0x%x\n",
+ cape_config.header, AM335X_EEPROM_HEADER);
+ goto out;
+ }
+
+ pr_info("BeagleBone cape EEPROM: found eeprom at address 0x%x\n", capecount + 0x53);
+ snprintf(name, sizeof(cape_config.name) + 1, "%s", cape_config.name);
+ snprintf(manufacturer, sizeof(cape_config.manufacturer) + 1, "%s", cape_config.manufacturer);
+ pr_info("BeagleBone cape: %s %s\n", manufacturer, name);
+ snprintf(tmp, sizeof(cape_config.partnumber) + 1, "%s", cape_config.partnumber);
+ pr_info("BeagleBone cape partnumber: %s\n", tmp);
+
+ if (!strncmp("DVI01", cape_config.partnumber, 5)) {
+ pr_info("BeagleBone cape: initializing DVI cape\n");
+ dvi_init(0,0);
+ }
+ if (!strncmp("LCD01", cape_config.partnumber, 5)) {
+ pr_info("BeagleBone cape: initializing LCD cape\n");
+ bbtoys7lcd_init(0,0);
+ pr_info("BeagleBone cape: initializing LCD cape touchscreen\n");
+ tsc_init(0,0);
+ beaglebone_tsadcpins_free = 0;
+ }
+
+
+ if ((capecount > 3) && (beaglebone_tsadcpins_free == 1)) {
+ pr_info("BeagleBone cape: exporting ADC pins to sysfs\n");
+ bone_tsc_init(0,0);
+ beaglebone_tsadcpins_free = 0;
+ }
+
+ return;
+out:
+ /*
+ * If the EEPROM hasn't been programed or an incorrect header
+ * or board name are read, assume this is an old beaglebone board
+ * (< Rev A3)
+ */
+ pr_err("Could not detect BeagleBone cape properly\n");
+ beaglebone_cape_detected = false;
+
+}
+
static struct at24_platform_data cape_eeprom_info = {
.byte_len = (256*1024) / 8,
.page_size = 64,
.flags = AT24_FLAG_ADDR16,
.context = (void *)NULL,
+ .setup = beaglebone_cape_setup,
};
static struct i2c_board_info __initdata cape_i2c_boardinfo[] = {
@@ -1587,26 +1770,22 @@ static struct evm_dev_cfg ip_phn_evm_dev_cfg[] = {
/* Beaglebone < Rev A3 */
static struct evm_dev_cfg beaglebone_old_dev_cfg[] = {
{rmii1_init, DEV_ON_BASEBOARD, PROFILE_NONE},
- {dvi_init, DEV_ON_BASEBOARD, PROFILE_ALL},
{usb0_init, DEV_ON_BASEBOARD, PROFILE_NONE},
{usb1_init, DEV_ON_BASEBOARD, PROFILE_NONE},
{i2c2_init, DEV_ON_BASEBOARD, PROFILE_NONE},
{mmc0_init, DEV_ON_BASEBOARD, PROFILE_NONE},
{boneleds_init, DEV_ON_BASEBOARD, PROFILE_ALL},
- {bone_tsc_init, DEV_ON_BASEBOARD, PROFILE_ALL},
{NULL, 0, 0},
};
/* Beaglebone Rev A3 and after */
static struct evm_dev_cfg beaglebone_dev_cfg[] = {
{mii1_init, DEV_ON_BASEBOARD, PROFILE_NONE},
- {dvi_init, DEV_ON_BASEBOARD, PROFILE_ALL},
{usb0_init, DEV_ON_BASEBOARD, PROFILE_NONE},
{usb1_init, DEV_ON_BASEBOARD, PROFILE_NONE},
{i2c2_init, DEV_ON_BASEBOARD, PROFILE_NONE},
{mmc0_init, DEV_ON_BASEBOARD, PROFILE_NONE},
{boneleds_init, DEV_ON_BASEBOARD, PROFILE_ALL},
- {bone_tsc_init, DEV_ON_BASEBOARD, PROFILE_ALL},
{NULL, 0, 0},
};
@@ -1689,6 +1868,7 @@ static void setup_beaglebone_old(void)
static void setup_beaglebone(void)
{
pr_info("The board is a AM335x Beaglebone.\n");
+ gp_evm_revision = GP_EVM_ACTUALLY_BEAGLEBONE;
/* Beagle Bone has Micro-SD slot which doesn't have Write Protect pin */
am335x_mmc[0].gpio_wp = -EINVAL;
diff --git a/arch/arm/mach-omap2/mux33xx.c b/arch/arm/mach-omap2/mux33xx.c
index 35986ca..da08e2e 100644
--- a/arch/arm/mach-omap2/mux33xx.c
+++ b/arch/arm/mach-omap2/mux33xx.c
@@ -85,7 +85,7 @@ static struct omap_mux __initdata am33xx_muxmodes[] = {
NULL, NULL, NULL, NULL),
_AM33XX_MUXENTRY(GPMC_A2, 0,
"gpmc_a2", "mii2_txd3", "rgmii2_td3", "mmc2_dat1",
- NULL, NULL, NULL, NULL),
+ NULL, NULL, NULL, "gpio1_18"),
_AM33XX_MUXENTRY(GPMC_A3, 0,
"gpmc_a3", "mii2_txd2", "rgmii2_td2", "mmc2_dat2",
NULL, NULL, NULL, NULL),
--
1.7.2.5
@@ -1,26 +0,0 @@
From 0ddfbfd5d5b6fdf84b9ea174e39b872cacaa8be5 Mon Sep 17 00:00:00 2001
From: Koen Kooi <koen@dominion.thruhere.net>
Date: Wed, 25 Jan 2012 09:56:14 +0100
Subject: [PATCH 33/35] beaglebone: update DVI cape partnumber
Signed-off-by: Koen Kooi <koen@dominion.thruhere.net>
---
arch/arm/mach-omap2/board-am335xevm.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/arch/arm/mach-omap2/board-am335xevm.c b/arch/arm/mach-omap2/board-am335xevm.c
index 6c19334..7c91ff8 100644
--- a/arch/arm/mach-omap2/board-am335xevm.c
+++ b/arch/arm/mach-omap2/board-am335xevm.c
@@ -1299,7 +1299,7 @@ static void beaglebone_cape_setup(struct memory_accessor *mem_acc, void *context
snprintf(tmp, sizeof(cape_config.partnumber) + 1, "%s", cape_config.partnumber);
pr_info("BeagleBone cape partnumber: %s\n", tmp);
- if (!strncmp("DVI01", cape_config.partnumber, 5)) {
+ if (!strncmp("BB-BONE-DVID-01", cape_config.partnumber, 5)) {
pr_info("BeagleBone cape: initializing DVI cape\n");
dvi_init(0,0);
}
--
1.7.2.5
@@ -1,29 +0,0 @@
From d8bf8cea10710285b5bc1759162bd18c81d8ea3a Mon Sep 17 00:00:00 2001
From: Koen Kooi <koen@dominion.thruhere.net>
Date: Wed, 25 Jan 2012 12:52:13 +0100
Subject: [PATCH 34/35] beaglebone: really enable i2c2 pullups, fixes timeouts on boot ~4 seconds less wasted
Signed-off-by: Koen Kooi <koen@dominion.thruhere.net>
---
arch/arm/mach-omap2/board-am335xevm.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/arm/mach-omap2/board-am335xevm.c b/arch/arm/mach-omap2/board-am335xevm.c
index 7c91ff8..9556736 100644
--- a/arch/arm/mach-omap2/board-am335xevm.c
+++ b/arch/arm/mach-omap2/board-am335xevm.c
@@ -707,9 +707,9 @@ static struct pinmux_config i2c1_pin_mux[] = {
static struct pinmux_config i2c2_pin_mux[] = {
{"uart1_ctsn.i2c2_sda", OMAP_MUX_MODE3 | AM33XX_SLEWCTRL_SLOW |
- AM33XX_PULL_ENBL | AM33XX_INPUT_EN},
+ AM33XX_PIN_INPUT_PULLUP},
{"uart1_rtsn.i2c2_scl", OMAP_MUX_MODE3 | AM33XX_SLEWCTRL_SLOW |
- AM33XX_PULL_ENBL | AM33XX_INPUT_EN},
+ AM33XX_PIN_INPUT_PULLUP},
{NULL, 0},
};
--
1.7.2.5
@@ -1,119 +0,0 @@
From f4d66b3ee9bbe36e17f9aaee2aedfa547e7bbb8c Mon Sep 17 00:00:00 2001
From: Koen Kooi <koen@dominion.thruhere.net>
Date: Wed, 25 Jan 2012 10:04:15 +0100
Subject: [PATCH 35/35] beaglebone: add structs for DVI cape LEDs
Signed-off-by: Koen Kooi <koen@dominion.thruhere.net>
---
arch/arm/mach-omap2/board-am335xevm.c | 67 +++++++++++++++++++++++++++++---
1 files changed, 60 insertions(+), 7 deletions(-)
diff --git a/arch/arm/mach-omap2/board-am335xevm.c b/arch/arm/mach-omap2/board-am335xevm.c
index 9556736..1b398c7 100644
--- a/arch/arm/mach-omap2/board-am335xevm.c
+++ b/arch/arm/mach-omap2/board-am335xevm.c
@@ -847,10 +847,45 @@ static struct pinmux_config usb1_pin_mux[] = {
#define BEAGLEBONE_USR3_LED GPIO_TO_PIN(1, 23)
#define BEAGLEBONE_USR4_LED GPIO_TO_PIN(1, 24)
+static struct gpio_led bone_gpio_leds[] = {
+ {
+ .name = "beaglebone::usr0",
+ .default_trigger = "heartbeat",
+ .gpio = BEAGLEBONE_USR1_LED,
+ },
+ {
+ .name = "beaglebone::usr1",
+ .default_trigger = "mmc0",
+ .gpio = BEAGLEBONE_USR2_LED,
+ },
+ {
+ .name = "beaglebone::usr2",
+ .gpio = BEAGLEBONE_USR3_LED,
+ },
+ {
+ .name = "beaglebone::usr3",
+ .gpio = BEAGLEBONE_USR4_LED,
+ },
+};
+
+static struct gpio_led_platform_data bone_gpio_led_info = {
+ .leds = bone_gpio_leds,
+ .num_leds = ARRAY_SIZE(bone_gpio_leds),
+};
+
+static struct platform_device bone_leds_gpio = {
+ .name = "leds-gpio",
+ .id = -1,
+ .dev = {
+ .platform_data = &bone_gpio_led_info,
+ },
+};
+
+
#define BEAGLEBONEDVI_USR0_LED GPIO_TO_PIN(1, 18)
#define BEAGLEBONEDVI_USR1_LED GPIO_TO_PIN(1, 19)
-static struct gpio_led gpio_leds[] = {
+static struct gpio_led dvi_gpio_leds[] = {
{
.name = "beaglebone::usr0",
.default_trigger = "heartbeat",
@@ -869,18 +904,28 @@ static struct gpio_led gpio_leds[] = {
.name = "beaglebone::usr3",
.gpio = BEAGLEBONE_USR4_LED,
},
+ {
+ .name = "dvi::usr0",
+ .default_trigger = "heartbeat",
+ .gpio = BEAGLEBONEDVI_USR0_LED,
+ },
+ {
+ .name = "dvi::usr1",
+ .default_trigger = "mmc0",
+ .gpio = BEAGLEBONEDVI_USR1_LED,
+ },
};
-static struct gpio_led_platform_data gpio_led_info = {
- .leds = gpio_leds,
- .num_leds = ARRAY_SIZE(gpio_leds),
+static struct gpio_led_platform_data dvi_gpio_led_info = {
+ .leds = dvi_gpio_leds,
+ .num_leds = ARRAY_SIZE(dvi_gpio_leds),
};
-static struct platform_device leds_gpio = {
+static struct platform_device dvi_leds_gpio = {
.name = "leds-gpio",
.id = -1,
.dev = {
- .platform_data = &gpio_led_info,
+ .platform_data = &dvi_gpio_led_info,
},
};
@@ -1074,11 +1119,19 @@ static void boneleds_init(int evm_id, int profile )
{
int err;
setup_pin_mux(bone_pin_mux);
- err = platform_device_register(&leds_gpio);
+ err = platform_device_register(&bone_leds_gpio);
if (err)
pr_err("failed to register BeagleBone LEDS\n");
}
+static void dvileds_init(int evm_id, int profile )
+{
+ int err;
+ err = platform_device_register(&dvi_leds_gpio);
+ if (err)
+ pr_err("failed to register BeagleBone DVI cape LEDS\n");
+}
+
static void rgmii1_init(int evm_id, int profile)
{
setup_pin_mux(rgmii1_pin_mux);
--
1.7.2.5
@@ -1,26 +0,0 @@
From 4089ed795fc26961e0e0ece07af2c628b96321de Mon Sep 17 00:00:00 2001
From: Koen Kooi <koen@dominion.thruhere.net>
Date: Wed, 25 Jan 2012 17:18:43 +0100
Subject: [PATCH 36/36] beaglebone: update LCD cape partnumber
Signed-off-by: Koen Kooi <koen@dominion.thruhere.net>
---
arch/arm/mach-omap2/board-am335xevm.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/arch/arm/mach-omap2/board-am335xevm.c b/arch/arm/mach-omap2/board-am335xevm.c
index 1b398c7..6a0ace9 100644
--- a/arch/arm/mach-omap2/board-am335xevm.c
+++ b/arch/arm/mach-omap2/board-am335xevm.c
@@ -1356,7 +1356,7 @@ static void beaglebone_cape_setup(struct memory_accessor *mem_acc, void *context
pr_info("BeagleBone cape: initializing DVI cape\n");
dvi_init(0,0);
}
- if (!strncmp("LCD01", cape_config.partnumber, 5)) {
+ if (!strncmp("BB-BONE-LCD7-01", cape_config.partnumber, 5)) {
pr_info("BeagleBone cape: initializing LCD cape\n");
bbtoys7lcd_init(0,0);
pr_info("BeagleBone cape: initializing LCD cape touchscreen\n");
--
1.7.7.5
@@ -1,45 +0,0 @@
From c97ae962c459f33b27800309b30f5ed8ebeba2c2 Mon Sep 17 00:00:00 2001
From: Koen Kooi <koen@dominion.thruhere.net>
Date: Thu, 26 Jan 2012 10:57:23 +0100
Subject: [PATCH 37/37] beaglebone: compare complete partnumber, not the first 5 chars when detecting capes
Otherwise it will init multiple capes when only one is present:
[ 0.456913] BeagleBone cape EEPROM: found eeprom at address 0x56
[ 0.456932] BeagleBone cape: Beagleboardtoys BeagleBone DVI-D CAPE
[ 0.456948] BeagleBone cape partnumber: BB-BONE-DVID-01
[ 0.456961] BeagleBone cape: initializing DVI cape
[ 0.492772] BeagleBone cape: initializing LCD cape
[ 0.502925] [<c0406e89>] (am33xx_register_lcdc+0xd/0x24) from [<c001c505>] (beaglebone_cape_setup+0x109/0x1dc)
[ 0.502965] [<c001c505>] (beaglebone_cape_setup+0x109/0x1dc) from [<c0168b3b>] (at24_probe+0x2b3/0x34c)
[ 0.503683] [<c0406e89>] (am33xx_register_lcdc+0xd/0x24) from [<c001c505>] (beaglebone_cape_setup+0x109/0x1dc)
[ 0.503715] [<c001c505>] (beaglebone_cape_setup+0x109/0x1dc) from [<c0168b3b>] (at24_probe+0x2b3/0x34c)
[ 0.509362] Failed to register Beagleboardtoys 7" LCD cape device
[ 0.509390] BeagleBone cape: initializing LCD cape touchscreen
Signed-off-by: Koen Kooi <koen@dominion.thruhere.net>
---
arch/arm/mach-omap2/board-am335xevm.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/arm/mach-omap2/board-am335xevm.c b/arch/arm/mach-omap2/board-am335xevm.c
index 6a0ace9..5c48d59 100644
--- a/arch/arm/mach-omap2/board-am335xevm.c
+++ b/arch/arm/mach-omap2/board-am335xevm.c
@@ -1352,11 +1352,11 @@ static void beaglebone_cape_setup(struct memory_accessor *mem_acc, void *context
snprintf(tmp, sizeof(cape_config.partnumber) + 1, "%s", cape_config.partnumber);
pr_info("BeagleBone cape partnumber: %s\n", tmp);
- if (!strncmp("BB-BONE-DVID-01", cape_config.partnumber, 5)) {
+ if (!strncmp("BB-BONE-DVID-01", cape_config.partnumber, 15)) {
pr_info("BeagleBone cape: initializing DVI cape\n");
dvi_init(0,0);
}
- if (!strncmp("BB-BONE-LCD7-01", cape_config.partnumber, 5)) {
+ if (!strncmp("BB-BONE-LCD7-01", cape_config.partnumber, 15)) {
pr_info("BeagleBone cape: initializing LCD cape\n");
bbtoys7lcd_init(0,0);
pr_info("BeagleBone cape: initializing LCD cape touchscreen\n");
--
1.7.2.5
@@ -1,34 +0,0 @@
From d12058d27dddf60b36f5b2142ee999e55bddfff6 Mon Sep 17 00:00:00 2001
From: Steve Sakoman <steve@sakoman.com>
Date: Mon, 18 Jul 2011 23:13:41 -0500
Subject: [PATCH 38/38] omap_hsmmc: Set dto to max value of 14 to avoid SD
Card timeouts
This fixes MMC errors due to timeouts on certain SD Cards following suggestions
to set dto to 14 by Jason Kridner and Steven Kipisz
Details of the issue:
http://talk.maemo.org/showthread.php?p=1000707#post1000707
This fix was originally proposed by Sukumar Ghoral of TI.
---
drivers/mmc/host/omap_hsmmc.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 35505bd..0be77ec 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -1574,6 +1574,9 @@ static void set_data_timeout(struct omap_hsmmc_host *host,
dto = 14;
}
+ /* Set dto to max value of 14 to avoid SD Card timeouts */
+ dto = 14;
+
reg &= ~DTO_MASK;
reg |= dto << DTO_SHIFT;
OMAP_HSMMC_WRITE(host->base, SYSCTL, reg);
--
1.7.7.5
@@ -1,219 +0,0 @@
From de1ae4c44093c7f62af58caf3bdba83bb9531295 Mon Sep 17 00:00:00 2001
From: Patil, Rachna <rachna@ti.com>
Date: Fri, 11 Nov 2011 18:03:27 +0530
Subject: [PATCH 1/9] AM335x: Add support for TSC on Beta GP EVM.
AN1 and AN2(analog inputs to analog front end) were swapped
on alpha EVM's. This change is IP dependent, hence changes are
made in the driver to support the beta EVM.
Signed-off-by: Patil, Rachna <rachna@ti.com>
---
arch/arm/mach-omap2/board-am335xevm.c | 8 +++
drivers/input/touchscreen/ti_tscadc.c | 83 ++++++++++++++++++++++-----------
include/linux/input/ti_tscadc.h | 10 ++++
3 files changed, 73 insertions(+), 28 deletions(-)
diff --git a/arch/arm/mach-omap2/board-am335xevm.c b/arch/arm/mach-omap2/board-am335xevm.c
index b27fb97..7f52de1 100644
--- a/arch/arm/mach-omap2/board-am335xevm.c
+++ b/arch/arm/mach-omap2/board-am335xevm.c
@@ -920,6 +920,14 @@ static void dvi_init(int evm_id, int profile)
static void tsc_init(int evm_id, int profile)
{
int err;
+
+ if (gp_evm_revision == GP_EVM_REV_IS_1_1A) {
+ am335x_touchscreen_data.analog_input = 1;
+ pr_info("TSC connected to beta GP EVM\n");
+ } else {
+ am335x_touchscreen_data.analog_input = 0;
+ pr_info("TSC connected to alpha GP EVM\n");
+ }
setup_pin_mux(tsc_pin_mux);
err = platform_device_register(&tsc_device);
if (err)
diff --git a/drivers/input/touchscreen/ti_tscadc.c b/drivers/input/touchscreen/ti_tscadc.c
index 1f4db8d..021db7f 100644
--- a/drivers/input/touchscreen/ti_tscadc.c
+++ b/drivers/input/touchscreen/ti_tscadc.c
@@ -65,13 +65,16 @@
#define TSCADC_STEPCONFIG_RFP (1 << 12)
#define TSCADC_STEPCONFIG_INM (1 << 18)
#define TSCADC_STEPCONFIG_INP_4 (1 << 19)
+#define TSCADC_STEPCONFIG_INP (1 << 20)
#define TSCADC_STEPCONFIG_INP_5 (1 << 21)
#define TSCADC_STEPCONFIG_FIFO1 (1 << 26)
#define TSCADC_STEPCONFIG_IDLE_INP (1 << 22)
#define TSCADC_STEPCONFIG_OPENDLY 0x018
#define TSCADC_STEPCONFIG_SAMPLEDLY 0x88
-#define TSCADC_STEPCHARGE_INM BIT(16)
-#define TSCADC_STEPCHARGE_INP BIT(20)
+#define TSCADC_STEPCHARGE_INM_SWAP BIT(16)
+#define TSCADC_STEPCHARGE_INM BIT(15)
+#define TSCADC_STEPCHARGE_INP_SWAP BIT(20)
+#define TSCADC_STEPCHARGE_INP BIT(19)
#define TSCADC_STEPCHARGE_RFM (1 << 23)
#define TSCADC_STEPCHARGE_DELAY 0x1
#define TSCADC_CNTRLREG_TSCSSENB BIT(0)
@@ -94,6 +97,7 @@ unsigned int bckup_x = 0, bckup_y = 0;
struct tscadc {
struct input_dev *input;
int wires;
+ int analog_input;
struct clk *clk;
int irq;
void __iomem *tsc_base;
@@ -121,21 +125,37 @@ static void tsc_step_config(struct tscadc *ts_dev)
delay = TSCADC_STEPCONFIG_SAMPLEDLY | TSCADC_STEPCONFIG_OPENDLY;
stepconfigx = TSCADC_STEPCONFIG_MODE_HWSYNC |
- TSCADC_STEPCONFIG_2SAMPLES_AVG | TSCADC_STEPCONFIG_XPP |
- TSCADC_STEPCONFIG_YPN;
+ TSCADC_STEPCONFIG_2SAMPLES_AVG | TSCADC_STEPCONFIG_XPP;
+
switch (ts_dev->wires) {
case 4:
- stepconfigx |= TSCADC_STEPCONFIG_INP_4;
+ if (ts_dev->analog_input == 0)
+ stepconfigx |= TSCADC_STEPCONFIG_INP_4 |
+ TSCADC_STEPCONFIG_YPN;
+ else
+ stepconfigx |= TSCADC_STEPCONFIG_INP |
+ TSCADC_STEPCONFIG_XNN;
break;
case 5:
- stepconfigx |= TSCADC_STEPCONFIG_YPP |
- TSCADC_STEPCONFIG_YNN |
+ stepconfigx |= TSCADC_STEPCONFIG_YNN |
TSCADC_STEPCONFIG_INP_5;
+ if (ts_dev->analog_input == 0)
+ stepconfigx |= TSCADC_STEPCONFIG_XNP |
+ TSCADC_STEPCONFIG_YPN;
+ else
+ stepconfigx |= TSCADC_STEPCONFIG_XNN |
+ TSCADC_STEPCONFIG_YPP;
break;
case 8:
- stepconfigx |= TSCADC_STEPCONFIG_INP_4;
+ if (ts_dev->analog_input == 0)
+ stepconfigx |= TSCADC_STEPCONFIG_INP_4 |
+ TSCADC_STEPCONFIG_YPN;
+ else
+ stepconfigx |= TSCADC_STEPCONFIG_INP |
+ TSCADC_STEPCONFIG_XNN;
break;
}
+
for (i = 1; i < 7; i++) {
tscadc_writel(ts_dev, TSCADC_REG_STEPCONFIG(i), stepconfigx);
tscadc_writel(ts_dev, TSCADC_REG_STEPDELAY(i), delay);
@@ -146,18 +166,28 @@ static void tsc_step_config(struct tscadc *ts_dev)
TSCADC_STEPCONFIG_INM | TSCADC_STEPCONFIG_FIFO1;
switch (ts_dev->wires) {
case 4:
- stepconfigy |= TSCADC_STEPCONFIG_XNP;
+ if (ts_dev->analog_input == 0)
+ stepconfigy |= TSCADC_STEPCONFIG_XNP;
+ else
+ stepconfigy |= TSCADC_STEPCONFIG_YPP;
break;
case 5:
- stepconfigy |= TSCADC_STEPCONFIG_XPP |
- TSCADC_STEPCONFIG_XNP |
- TSCADC_STEPCONFIG_YPN |
- TSCADC_STEPCONFIG_INP_5;
+ stepconfigy |= TSCADC_STEPCONFIG_XPP | TSCADC_STEPCONFIG_INP_5;
+ if (ts_dev->analog_input == 0)
+ stepconfigy |= TSCADC_STEPCONFIG_XNN |
+ TSCADC_STEPCONFIG_YPP;
+ else
+ stepconfigy |= TSCADC_STEPCONFIG_XNP |
+ TSCADC_STEPCONFIG_YPN;
break;
case 8:
- stepconfigy |= TSCADC_STEPCONFIG_XNP;
+ if (ts_dev->analog_input == 0)
+ stepconfigy |= TSCADC_STEPCONFIG_XNP;
+ else
+ stepconfigy |= TSCADC_STEPCONFIG_YPP;
break;
}
+
for (i = 7; i < 13; i++) {
tscadc_writel(ts_dev, TSCADC_REG_STEPCONFIG(i), stepconfigy);
tscadc_writel(ts_dev, TSCADC_REG_STEPDELAY(i), delay);
@@ -166,8 +196,12 @@ static void tsc_step_config(struct tscadc *ts_dev)
chargeconfig = TSCADC_STEPCONFIG_XPP |
TSCADC_STEPCONFIG_YNN |
TSCADC_STEPCONFIG_RFP |
- TSCADC_STEPCHARGE_INM | TSCADC_STEPCHARGE_INP |
TSCADC_STEPCHARGE_RFM;
+ if (ts_dev->analog_input == 0)
+ chargeconfig |= TSCADC_STEPCHARGE_INM_SWAP |
+ TSCADC_STEPCHARGE_INP_SWAP;
+ else
+ chargeconfig |= TSCADC_STEPCHARGE_INM | TSCADC_STEPCHARGE_INP;
tscadc_writel(ts_dev, TSCADC_REG_CHARGECONFIG, chargeconfig);
tscadc_writel(ts_dev, TSCADC_REG_CHARGEDELAY, TSCADC_STEPCHARGE_DELAY);
@@ -180,20 +214,12 @@ static void tsc_idle_config(struct tscadc *ts_config)
unsigned int idleconfig;
idleconfig = TSCADC_STEPCONFIG_YNN |
- TSCADC_STEPCONFIG_XNN |
- TSCADC_STEPCONFIG_INM;
+ TSCADC_STEPCONFIG_INM | TSCADC_STEPCONFIG_IDLE_INP;
+ if (ts_config->analog_input == 0)
+ idleconfig |= TSCADC_STEPCONFIG_XNN;
+ else
+ idleconfig |= TSCADC_STEPCONFIG_YPN;
- switch (ts_config->wires) {
- case 4:
- idleconfig |= TSCADC_STEPCONFIG_IDLE_INP;
- break;
- case 5:
- idleconfig |= TSCADC_STEPCONFIG_INP_5;
- break;
- case 8:
- idleconfig |= TSCADC_STEPCONFIG_INP_4;
- break;
- }
tscadc_writel(ts_config, TSCADC_REG_IDLECONFIG, idleconfig);
}
@@ -376,6 +402,7 @@ static int __devinit tscadc_probe(struct platform_device *pdev)
tscadc_writel(ts_dev, TSCADC_REG_IRQWAKEUP, TSCADC_IRQWKUP_ENB);
ts_dev->wires = pdata->wires;
+ ts_dev->analog_input = pdata->analog_input;
/* Set the control register bits */
ctrl = TSCADC_CNTRLREG_STEPCONFIGWRT |
diff --git a/include/linux/input/ti_tscadc.h b/include/linux/input/ti_tscadc.h
index 29f87db..b9d9a46 100644
--- a/include/linux/input/ti_tscadc.h
+++ b/include/linux/input/ti_tscadc.h
@@ -3,8 +3,18 @@
* @wires: Wires refer to application modes
* i.e. 4/5/8 wire touchscreen support
* on the platform
+ * @analog_input: Analog inputs refer to the order in which the
+ * connections are made to the AFE. If the connections
+ * are as : XPUL = AN0,XNUR = AN1,YPLL = AN2,
+ * YNLR = AN3, then this variable is set to 1.
+ * Else if the connections are as :
+ * XPUL = AN0,YPLL = AN1,XNUR = AN2,
+ * YNLR = AN3, then set this variable to
+ * 0.
*/
struct tsc_data {
int wires;
+ int analog_input;
+
};
--
1.7.2.5
@@ -1,122 +0,0 @@
From 0a88ddcef9bdd64f5857c2195c49365f3ef674a3 Mon Sep 17 00:00:00 2001
From: Patil, Rachna <rachna@ti.com>
Date: Fri, 11 Nov 2011 13:09:51 +0530
Subject: [PATCH 2/9] ARM: OMAP: AM335x: Add support for Beta GP EVM.
This patch adds support for BETA EVM.
BETA EVM is set as the default configuration.
Since the peripherals were supported only in profile 0 for
alpha EVM, It makes use of the exisiting GP EVM structure.
Changes have been made to MMC and audio.
Flag gp_evm_revision can be used to differentiate between the
revisions of the GP EVM.
Signed-off-by: Patil, Rachna <rachna@ti.com>
---
arch/arm/mach-omap2/board-am335xevm.c | 57 ++++++++++++---------------------
1 files changed, 21 insertions(+), 36 deletions(-)
diff --git a/arch/arm/mach-omap2/board-am335xevm.c b/arch/arm/mach-omap2/board-am335xevm.c
index 7f52de1..ecda26a 100644
--- a/arch/arm/mach-omap2/board-am335xevm.c
+++ b/arch/arm/mach-omap2/board-am335xevm.c
@@ -329,6 +329,11 @@ struct am335x_evm_eeprom_config {
static struct am335x_evm_eeprom_config config;
static bool daughter_brd_detected;
+#define GP_EVM_REV_IS_1_0A 0x1
+#define GP_EVM_REV_IS_1_1A 0x2
+#define GP_EVM_REV_IS_UNKNOWN 0xFF
+static unsigned int gp_evm_revision = GP_EVM_REV_IS_UNKNOWN;
+
#define EEPROM_MAC_ADDRESS_OFFSET 60 /* 4+8+4+12+32 */
#define EEPROM_NO_OF_MAC_ADDR 3
static char am335x_mac_addr[EEPROM_NO_OF_MAC_ADDR][ETH_ALEN];
@@ -637,25 +642,8 @@ static struct pinmux_config mmc1_pin_mux[] = {
{"gpmc_ad0.mmc1_dat0", OMAP_MUX_MODE1 | AM33XX_PIN_INPUT_PULLUP},
{"gpmc_csn1.mmc1_clk", OMAP_MUX_MODE2 | AM33XX_PIN_INPUT_PULLUP},
{"gpmc_csn2.mmc1_cmd", OMAP_MUX_MODE2 | AM33XX_PIN_INPUT_PULLUP},
- {"uart1_rxd.mmc1_sdwp", OMAP_MUX_MODE7 | AM33XX_PIN_INPUT_PULLUP},
- {"mcasp0_fsx.mmc1_sdcd", OMAP_MUX_MODE7 | AM33XX_PIN_INPUT_PULLUP},
- {NULL, 0},
-};
-
-/* Module pin mux for mmc2 */
-static struct pinmux_config mmc2_pin_mux[] = {
- {"gpmc_ad11.mmc2_dat7", OMAP_MUX_MODE3 | AM33XX_PIN_INPUT_PULLUP},
- {"gpmc_ad10.mmc2_dat6", OMAP_MUX_MODE3 | AM33XX_PIN_INPUT_PULLUP},
- {"gpmc_ad9.mmc2_dat5", OMAP_MUX_MODE3 | AM33XX_PIN_INPUT_PULLUP},
- {"gpmc_ad8.mmc2_dat4", OMAP_MUX_MODE3 | AM33XX_PIN_INPUT_PULLUP},
- {"gpmc_ad15.mmc2_dat3", OMAP_MUX_MODE3 | AM33XX_PIN_INPUT_PULLUP},
- {"gpmc_ad14.mmc2_dat2", OMAP_MUX_MODE3 | AM33XX_PIN_INPUT_PULLUP},
- {"gpmc_ad13.mmc2_dat1", OMAP_MUX_MODE3 | AM33XX_PIN_INPUT_PULLUP},
- {"gpmc_ad12.mmc2_dat0", OMAP_MUX_MODE3 | AM33XX_PIN_INPUT_PULLUP},
- {"gpmc_clk.mmc2_clk", OMAP_MUX_MODE3 | AM33XX_PIN_INPUT_PULLUP},
- {"gpmc_csn3.mmc2_cmd", OMAP_MUX_MODE3 | AM33XX_PIN_INPUT_PULLUP},
- {"spi0_cs0.mmc2_sdwp", OMAP_MUX_MODE7 | AM33XX_PIN_INPUT_PULLUP},
- {"mcasp0_axr0.mmc2_sdcd", OMAP_MUX_MODE7 | AM33XX_PIN_INPUT_PULLUP},
+ {"gpmc_csn0.mmc1_sdwp", OMAP_MUX_MODE7 | AM33XX_PIN_INPUT_PULLUP},
+ {"gpmc_advn_ale.mmc1_sdcd", OMAP_MUX_MODE7 | AM33XX_PIN_INPUT_PULLUP},
{NULL, 0},
};
@@ -1161,20 +1149,6 @@ static void mmc1_init(int evm_id, int profile)
return;
}
-static void mmc2_init(int evm_id, int profile)
-{
- setup_pin_mux(mmc2_pin_mux);
-
- am335x_mmc[1].mmc = 3;
- am335x_mmc[1].caps = MMC_CAP_4_BIT_DATA;
- am335x_mmc[1].gpio_cd = GPIO_TO_PIN(3, 16);
- am335x_mmc[1].gpio_wp = GPIO_TO_PIN(0, 5);
- am335x_mmc[1].ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34; /* 3V3 */
-
- /* mmc will be initialized when mmc0_init is called */
- return;
-}
-
static void mmc2_wl12xx_init(int evm_id, int profile)
{
setup_pin_mux(mmc2_wl12xx_pin_mux);
@@ -1511,9 +1485,8 @@ static struct evm_dev_cfg gen_purp_evm_dev_cfg[] = {
{evm_nand_init, DEV_ON_DGHTR_BRD,
(PROFILE_ALL & ~PROFILE_2 & ~PROFILE_3)},
{i2c1_init, DEV_ON_DGHTR_BRD, (PROFILE_0 | PROFILE_3 | PROFILE_7)},
- {mcasp1_init, DEV_ON_DGHTR_BRD, (PROFILE_0 | PROFILE_3) },
+ {mcasp1_init, DEV_ON_DGHTR_BRD, (PROFILE_0 | PROFILE_3 | PROFILE_7) },
{mmc1_init, DEV_ON_DGHTR_BRD, PROFILE_2},
- {mmc2_init, DEV_ON_DGHTR_BRD, PROFILE_4},
{mmc2_wl12xx_init, DEV_ON_BASEBOARD, (PROFILE_0 | PROFILE_3 |
PROFILE_5)},
{mmc0_init, DEV_ON_BASEBOARD, (PROFILE_ALL & ~PROFILE_5)},
@@ -1588,9 +1561,21 @@ static void setup_low_cost_evm(void)
static void setup_general_purpose_evm(void)
{
u32 prof_sel = am335x_get_profile_selection();
-
pr_info("The board is general purpose EVM in profile %d\n", prof_sel);
+ if (!strncmp("1.1A", config.version, 4)) {
+ pr_info("EVM version is %s\n", config.version);
+ gp_evm_revision = GP_EVM_REV_IS_1_1A;
+ }
+ else if (!strncmp("1.0A", config.version, 4)) {
+ pr_info("EVM version is %s\n", config.version);
+ gp_evm_revision = GP_EVM_REV_IS_1_0A;
+ }
+ else {
+ pr_err("EVM version read fail, falling back to Rev1.1A");
+ gp_evm_revision = GP_EVM_REV_IS_1_1A;
+ }
+
_configure_device(GEN_PURP_EVM, gen_purp_evm_dev_cfg, (1L << prof_sel));
}
--
1.7.2.5
@@ -1,219 +0,0 @@
From 4c5ada67509fc0a47941813900c03b842e6452d1 Mon Sep 17 00:00:00 2001
From: Patil, Rachna <rachna@ti.com>
Date: Fri, 11 Nov 2011 18:28:54 +0530
Subject: [PATCH 3/9] AM335x: Add support for pressure measurement on TSC.
This patch adds support for pressure measurement configurations
on TSC. Along with X and Y co-ordinates pressure is also reported to
the sub-system.
Signed-off-by: Patil, Rachna <rachna@ti.com>
---
arch/arm/mach-omap2/board-am335xevm.c | 1 +
drivers/input/touchscreen/ti_tscadc.c | 77 +++++++++++++++++++++++++++------
include/linux/input/ti_tscadc.h | 3 +-
3 files changed, 66 insertions(+), 15 deletions(-)
diff --git a/arch/arm/mach-omap2/board-am335xevm.c b/arch/arm/mach-omap2/board-am335xevm.c
index ecda26a..d7af6dd 100644
--- a/arch/arm/mach-omap2/board-am335xevm.c
+++ b/arch/arm/mach-omap2/board-am335xevm.c
@@ -194,6 +194,7 @@ static struct resource tsc_resources[] = {
static struct tsc_data am335x_touchscreen_data = {
.wires = 4,
+ .x_plate_resistance = 200,
};
static struct platform_device tsc_device = {
diff --git a/drivers/input/touchscreen/ti_tscadc.c b/drivers/input/touchscreen/ti_tscadc.c
index 021db7f..9783435 100644
--- a/drivers/input/touchscreen/ti_tscadc.c
+++ b/drivers/input/touchscreen/ti_tscadc.c
@@ -41,6 +41,10 @@
#define TSCADC_REG_CHARGEDELAY 0x060
#define TSCADC_REG_STEPCONFIG(n) (0x64 + ((n-1) * 8))
#define TSCADC_REG_STEPDELAY(n) (0x68 + ((n-1) * 8))
+#define TSCADC_REG_STEPCONFIG13 0x0C4
+#define TSCADC_REG_STEPDELAY13 0x0C8
+#define TSCADC_REG_STEPCONFIG14 0x0CC
+#define TSCADC_REG_STEPDELAY14 0x0D0
#define TSCADC_REG_FIFO0CNT 0xE4
#define TSCADC_REG_FIFO0THR 0xE8
#define TSCADC_REG_FIFO1CNT 0xF0
@@ -50,7 +54,7 @@
/* Register Bitfields */
#define TSCADC_IRQWKUP_ENB BIT(0)
-#define TSCADC_STPENB_STEPENB 0x1fFF
+#define TSCADC_STPENB_STEPENB 0x7FFF
#define TSCADC_IRQENB_FIFO0THRES BIT(2)
#define TSCADC_IRQENB_FIFO1THRES BIT(5)
#define TSCADC_IRQENB_PENUP BIT(9)
@@ -71,10 +75,11 @@
#define TSCADC_STEPCONFIG_IDLE_INP (1 << 22)
#define TSCADC_STEPCONFIG_OPENDLY 0x018
#define TSCADC_STEPCONFIG_SAMPLEDLY 0x88
-#define TSCADC_STEPCHARGE_INM_SWAP BIT(16)
-#define TSCADC_STEPCHARGE_INM BIT(15)
-#define TSCADC_STEPCHARGE_INP_SWAP BIT(20)
-#define TSCADC_STEPCHARGE_INP BIT(19)
+#define TSCADC_STEPCONFIG_Z1 (3 << 19)
+#define TSCADC_STEPCHARGE_INM_SWAP BIT(16)
+#define TSCADC_STEPCHARGE_INM BIT(15)
+#define TSCADC_STEPCHARGE_INP_SWAP BIT(20)
+#define TSCADC_STEPCHARGE_INP BIT(19)
#define TSCADC_STEPCHARGE_RFM (1 << 23)
#define TSCADC_STEPCHARGE_DELAY 0x1
#define TSCADC_CNTRLREG_TSCSSENB BIT(0)
@@ -98,6 +103,7 @@ struct tscadc {
struct input_dev *input;
int wires;
int analog_input;
+ int x_plate_resistance;
struct clk *clk;
int irq;
void __iomem *tsc_base;
@@ -118,6 +124,7 @@ static void tsc_step_config(struct tscadc *ts_dev)
{
unsigned int stepconfigx = 0, stepconfigy = 0;
unsigned int delay, chargeconfig = 0;
+ unsigned int stepconfigz1 = 0, stepconfigz2 = 0;
int i;
/* Configure the Step registers */
@@ -205,6 +212,18 @@ static void tsc_step_config(struct tscadc *ts_dev)
tscadc_writel(ts_dev, TSCADC_REG_CHARGECONFIG, chargeconfig);
tscadc_writel(ts_dev, TSCADC_REG_CHARGEDELAY, TSCADC_STEPCHARGE_DELAY);
+ /* Configure to calculate pressure */
+ stepconfigz1 = TSCADC_STEPCONFIG_MODE_HWSYNC |
+ TSCADC_STEPCONFIG_2SAMPLES_AVG |
+ TSCADC_STEPCONFIG_XNP |
+ TSCADC_STEPCONFIG_YPN | TSCADC_STEPCONFIG_INM;
+ stepconfigz2 = stepconfigz1 | TSCADC_STEPCONFIG_Z1 |
+ TSCADC_STEPCONFIG_FIFO1;
+ tscadc_writel(ts_dev, TSCADC_REG_STEPCONFIG13, stepconfigz1);
+ tscadc_writel(ts_dev, TSCADC_REG_STEPDELAY13, delay);
+ tscadc_writel(ts_dev, TSCADC_REG_STEPCONFIG14, stepconfigz2);
+ tscadc_writel(ts_dev, TSCADC_REG_STEPDELAY14, delay);
+
tscadc_writel(ts_dev, TSCADC_REG_SE, TSCADC_STPENB_STEPENB);
}
@@ -235,14 +254,14 @@ static irqreturn_t tscadc_interrupt(int irq, void *dev)
unsigned int prev_diff_x = ~0, prev_diff_y = ~0;
unsigned int cur_diff_x = 0, cur_diff_y = 0;
unsigned int val_x = 0, val_y = 0, diffx = 0, diffy = 0;
+ unsigned int z1 = 0, z2 = 0, z = 0;
status = tscadc_readl(ts_dev, TSCADC_REG_IRQSTATUS);
if (status & TSCADC_IRQENB_FIFO1THRES) {
fifo0count = tscadc_readl(ts_dev, TSCADC_REG_FIFO0CNT);
fifo1count = tscadc_readl(ts_dev, TSCADC_REG_FIFO1CNT);
-
- for (i = 0; i < fifo0count; i++) {
+ for (i = 0; i < (fifo0count-1); i++) {
readx1 = tscadc_readl(ts_dev, TSCADC_REG_FIFO0);
readx1 = readx1 & 0xfff;
if (readx1 > prev_val_x)
@@ -281,12 +300,39 @@ static irqreturn_t tscadc_interrupt(int irq, void *dev)
bckup_x = val_x;
bckup_y = val_y;
- if (pen == 0) {
- if ((diffx < 15) && (diffy < 15)) {
- input_report_abs(input_dev, ABS_X, val_x);
- input_report_abs(input_dev, ABS_Y, val_y);
- input_report_key(input_dev, BTN_TOUCH, 1);
- input_sync(input_dev);
+ z1 = ((tscadc_readl(ts_dev, TSCADC_REG_FIFO0)) & 0xfff);
+ z2 = ((tscadc_readl(ts_dev, TSCADC_REG_FIFO1)) & 0xfff);
+
+ if ((z1 != 0) && (z2 != 0)) {
+ /*
+ * cal pressure using formula
+ * Resistance(touch) = x plate resistance *
+ * x postion/4096 * ((z2 / z1) - 1)
+ */
+ z = z2 - z1;
+ z *= val_x;
+ z *= ts_dev->x_plate_resistance;
+ z /= z1;
+ z = (z + 2047) >> 12;
+
+ /*
+ * Sample found inconsistent by debouncing
+ * or pressure is beyond the maximum.
+ * Don't report it to user space.
+ */
+ if (pen == 0) {
+ if ((diffx < 15) && (diffy < 15)
+ && (z <= MAX_12BIT)) {
+ input_report_abs(input_dev, ABS_X,
+ val_x);
+ input_report_abs(input_dev, ABS_Y,
+ val_y);
+ input_report_abs(input_dev, ABS_PRESSURE,
+ z);
+ input_report_key(input_dev, BTN_TOUCH,
+ 1);
+ input_sync(input_dev);
+ }
}
}
irqclr |= TSCADC_IRQENB_FIFO1THRES;
@@ -303,6 +349,7 @@ static irqreturn_t tscadc_interrupt(int irq, void *dev)
bckup_x = 0;
bckup_y = 0;
input_report_key(input_dev, BTN_TOUCH, 0);
+ input_report_abs(input_dev, ABS_PRESSURE, 0);
input_sync(input_dev);
} else {
pen = 0;
@@ -403,6 +450,7 @@ static int __devinit tscadc_probe(struct platform_device *pdev)
ts_dev->wires = pdata->wires;
ts_dev->analog_input = pdata->analog_input;
+ ts_dev->x_plate_resistance = pdata->x_plate_resistance;
/* Set the control register bits */
ctrl = TSCADC_CNTRLREG_STEPCONFIGWRT |
@@ -430,7 +478,7 @@ static int __devinit tscadc_probe(struct platform_device *pdev)
tsc_step_config(ts_dev);
- tscadc_writel(ts_dev, TSCADC_REG_FIFO1THR, 5);
+ tscadc_writel(ts_dev, TSCADC_REG_FIFO1THR, 6);
ctrl |= TSCADC_CNTRLREG_TSCSSENB;
tscadc_writel(ts_dev, TSCADC_REG_CTRL, ctrl);
@@ -443,6 +491,7 @@ static int __devinit tscadc_probe(struct platform_device *pdev)
input_set_abs_params(input_dev, ABS_X, 0, MAX_12BIT, 0, 0);
input_set_abs_params(input_dev, ABS_Y, 0, MAX_12BIT, 0, 0);
+ input_set_abs_params(input_dev, ABS_PRESSURE, 0, MAX_12BIT, 0, 0);
/* register to the input system */
err = input_register_device(input_dev);
diff --git a/include/linux/input/ti_tscadc.h b/include/linux/input/ti_tscadc.h
index b9d9a46..2c547bb 100644
--- a/include/linux/input/ti_tscadc.h
+++ b/include/linux/input/ti_tscadc.h
@@ -11,10 +11,11 @@
* XPUL = AN0,YPLL = AN1,XNUR = AN2,
* YNLR = AN3, then set this variable to
* 0.
+ * @x_plate_resistance: X plate resistance.
*/
struct tsc_data {
int wires;
int analog_input;
-
+ int x_plate_resistance;
};
--
1.7.2.5
@@ -1,422 +0,0 @@
From d987e3ae4bf83e8a46702ad44e435e6cbea183dc Mon Sep 17 00:00:00 2001
From: Joel A Fernandes <joelagnel@ti.com>
Date: Wed, 30 Nov 2011 15:00:40 +0100
Subject: [PATCH 4/9] tscadc: Add general purpose mode, untested with touchscreen functionality
Signed-off-by: Joel A Fernandes <joelagnel@ti.com>
---
arch/arm/mach-omap2/board-am335xevm.c | 6 +
arch/arm/mach-omap2/mux33xx.c | 12 ++
arch/arm/mach-omap2/mux33xx.h | 4 +
drivers/input/touchscreen/ti_tscadc.c | 209 +++++++++++++++++++++++++--------
include/linux/input/ti_tscadc.h | 4 +
5 files changed, 183 insertions(+), 52 deletions(-)
diff --git a/arch/arm/mach-omap2/board-am335xevm.c b/arch/arm/mach-omap2/board-am335xevm.c
index d7af6dd..8221ba9 100644
--- a/arch/arm/mach-omap2/board-am335xevm.c
+++ b/arch/arm/mach-omap2/board-am335xevm.c
@@ -456,6 +456,10 @@ static struct pinmux_config tsc_pin_mux[] = {
{"ain1.ain1", OMAP_MUX_MODE0 | AM33XX_INPUT_EN},
{"ain2.ain2", OMAP_MUX_MODE0 | AM33XX_INPUT_EN},
{"ain3.ain3", OMAP_MUX_MODE0 | AM33XX_INPUT_EN},
+ {"ain4.ain4", OMAP_MUX_MODE0 | AM33XX_INPUT_EN},
+ {"ain5.ain5", OMAP_MUX_MODE0 | AM33XX_INPUT_EN},
+ {"ain6.ain6", OMAP_MUX_MODE0 | AM33XX_INPUT_EN},
+ {"ain7.ain7", OMAP_MUX_MODE0 | AM33XX_INPUT_EN},
{"vrefp.vrefp", OMAP_MUX_MODE0 | AM33XX_INPUT_EN},
{"vrefn.vrefn", OMAP_MUX_MODE0 | AM33XX_INPUT_EN},
{NULL, 0},
@@ -1537,6 +1541,7 @@ static struct evm_dev_cfg beaglebone_old_dev_cfg[] = {
{i2c2_init, DEV_ON_BASEBOARD, PROFILE_NONE},
{mmc0_init, DEV_ON_BASEBOARD, PROFILE_NONE},
{boneleds_init, DEV_ON_BASEBOARD, PROFILE_ALL},
+ {tsc_init, DEV_ON_BASEBOARD, PROFILE_ALL},
{NULL, 0, 0},
};
@@ -1549,6 +1554,7 @@ static struct evm_dev_cfg beaglebone_dev_cfg[] = {
{i2c2_init, DEV_ON_BASEBOARD, PROFILE_NONE},
{mmc0_init, DEV_ON_BASEBOARD, PROFILE_NONE},
{boneleds_init, DEV_ON_BASEBOARD, PROFILE_ALL},
+ {tsc_init, DEV_ON_BASEBOARD, PROFILE_ALL},
{NULL, 0, 0},
};
diff --git a/arch/arm/mach-omap2/mux33xx.c b/arch/arm/mach-omap2/mux33xx.c
index 06719df..35986ca 100644
--- a/arch/arm/mach-omap2/mux33xx.c
+++ b/arch/arm/mach-omap2/mux33xx.c
@@ -587,6 +587,18 @@ static struct omap_mux __initdata am33xx_muxmodes[] = {
_AM33XX_MUXENTRY(AIN3, 0,
"ain3", NULL, NULL, NULL,
NULL, NULL, NULL, NULL),
+ _AM33XX_MUXENTRY(AIN4, 0,
+ "ain4", NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL),
+ _AM33XX_MUXENTRY(AIN5, 0,
+ "ain5", NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL),
+ _AM33XX_MUXENTRY(AIN6, 0,
+ "ain6", NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL),
+ _AM33XX_MUXENTRY(AIN7, 0,
+ "ain7", NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL),
_AM33XX_MUXENTRY(VREFP, 0,
"vrefp", NULL, NULL, NULL,
NULL, NULL, NULL, NULL),
diff --git a/arch/arm/mach-omap2/mux33xx.h b/arch/arm/mach-omap2/mux33xx.h
index 70a3012..348c8e5 100644
--- a/arch/arm/mach-omap2/mux33xx.h
+++ b/arch/arm/mach-omap2/mux33xx.h
@@ -228,6 +228,10 @@
#define AM33XX_CONTROL_PADCONF_DDR_DQSN1_OFFSET 0x0AFC
#define AM33XX_CONTROL_PADCONF_DDR_VREF_OFFSET 0x0B00
#define AM33XX_CONTROL_PADCONF_DDR_VTP_OFFSET 0x0B04
+#define AM33XX_CONTROL_PADCONF_AIN7_OFFSET 0x0B10
+#define AM33XX_CONTROL_PADCONF_AIN6_OFFSET 0x0B14
+#define AM33XX_CONTROL_PADCONF_AIN5_OFFSET 0x0B18
+#define AM33XX_CONTROL_PADCONF_AIN4_OFFSET 0x0B1C
#define AM33XX_CONTROL_PADCONF_AIN3_OFFSET 0x0B20
#define AM33XX_CONTROL_PADCONF_AIN2_OFFSET 0x0B24
#define AM33XX_CONTROL_PADCONF_AIN1_OFFSET 0x0B28
diff --git a/drivers/input/touchscreen/ti_tscadc.c b/drivers/input/touchscreen/ti_tscadc.c
index 9783435..76fc7b6 100644
--- a/drivers/input/touchscreen/ti_tscadc.c
+++ b/drivers/input/touchscreen/ti_tscadc.c
@@ -27,6 +27,8 @@
#include <linux/input/ti_tscadc.h>
#include <linux/delay.h>
+/* Memory mapped registers here have incorrect offsets!
+ * Correct after referring TRM */
#define TSCADC_REG_IRQEOI 0x020
#define TSCADC_REG_RAWIRQSTATUS 0x024
#define TSCADC_REG_IRQSTATUS 0x028
@@ -54,12 +56,18 @@
/* Register Bitfields */
#define TSCADC_IRQWKUP_ENB BIT(0)
-#define TSCADC_STPENB_STEPENB 0x7FFF
+#define TSCADC_STPENB_STEPENB_TOUCHSCREEN 0x7FFF
+#define TSCADC_STPENB_STEPENB_GENERAL 0x0400
#define TSCADC_IRQENB_FIFO0THRES BIT(2)
+#define TSCADC_IRQENB_FIFO0OVERRUN BIT(3)
#define TSCADC_IRQENB_FIFO1THRES BIT(5)
+#define TSCADC_IRQENB_EOS BIT(1)
#define TSCADC_IRQENB_PENUP BIT(9)
-#define TSCADC_STEPCONFIG_MODE_HWSYNC 0x2
+#define TSCADC_STEPCONFIG_MODE_HWSYNC 0x2
+#define TSCADC_STEPCONFIG_MODE_SWCONT 0x1
+#define TSCADC_STEPCONFIG_MODE_SWONESHOT 0x0
#define TSCADC_STEPCONFIG_2SAMPLES_AVG (1 << 4)
+#define TSCADC_STEPCONFIG_NO_AVG 0
#define TSCADC_STEPCONFIG_XPP BIT(5)
#define TSCADC_STEPCONFIG_XNN BIT(6)
#define TSCADC_STEPCONFIG_YPP BIT(7)
@@ -72,7 +80,7 @@
#define TSCADC_STEPCONFIG_INP (1 << 20)
#define TSCADC_STEPCONFIG_INP_5 (1 << 21)
#define TSCADC_STEPCONFIG_FIFO1 (1 << 26)
-#define TSCADC_STEPCONFIG_IDLE_INP (1 << 22)
+#define TSCADC_STEPCONFIG_IDLE_INP 0x0000
#define TSCADC_STEPCONFIG_OPENDLY 0x018
#define TSCADC_STEPCONFIG_SAMPLEDLY 0x88
#define TSCADC_STEPCONFIG_Z1 (3 << 19)
@@ -104,6 +112,7 @@ struct tscadc {
int wires;
int analog_input;
int x_plate_resistance;
+ int mode;
struct clk *clk;
int irq;
void __iomem *tsc_base;
@@ -120,6 +129,86 @@ static void tscadc_writel(struct tscadc *tsc, unsigned int reg,
writel(val, tsc->tsc_base + reg);
}
+static void tsc_adc_step_config(struct tscadc *ts_dev)
+{
+ unsigned int stepconfig = 0, delay = 0, chargeconfig = 0;
+
+ /*
+ * Step Configuration
+ * software-enabled continous mode
+ * 2 sample averaging
+ * sample channel 1 (SEL_INP mux bits = 0)
+ */
+ stepconfig = TSCADC_STEPCONFIG_MODE_SWONESHOT |
+ TSCADC_STEPCONFIG_2SAMPLES_AVG |
+ (0x7 << 19);
+
+ delay = TSCADC_STEPCONFIG_SAMPLEDLY | TSCADC_STEPCONFIG_OPENDLY;
+
+ tscadc_writel(ts_dev, TSCADC_REG_STEPCONFIG(10), stepconfig);
+ tscadc_writel(ts_dev, TSCADC_REG_STEPDELAY(10), delay);
+
+ /* Get the ball rolling, this will trigger the FSM to step through
+ * as soon as TSC_ADC_SS is turned on */
+ tscadc_writel(ts_dev, TSCADC_REG_SE, TSCADC_STPENB_STEPENB_GENERAL);
+}
+
+static irqreturn_t tsc_adc_interrupt(int irq, void *dev)
+{
+ struct tscadc *ts_dev = (struct tscadc *)dev;
+ struct input_dev *input_dev = ts_dev->input;
+ unsigned int status, irqclr = 0;
+ int i;
+ int fsm = 0, fifo0count = 0, fifo1count = 0;
+ unsigned int read_sample = 0, ready1 = 0;
+ unsigned int prev_val_x = ~0, prev_val_y = ~0;
+ unsigned int prev_diff_x = ~0, prev_diff_y = ~0;
+ unsigned int cur_diff_x = 0, cur_diff_y = 0;
+ unsigned int val_x = 0, val_y = 0, diffx = 0, diffy = 0;
+
+ status = tscadc_readl(ts_dev, TSCADC_REG_IRQSTATUS);
+
+ printk("interrupt! status=%x\n", status);
+ // if (status & TSCADC_IRQENB_EOS) {
+ // irqclr |= TSCADC_IRQENB_EOS;
+ // }
+
+ if (status & TSCADC_IRQENB_FIFO0THRES) {
+ fifo1count = tscadc_readl(ts_dev, TSCADC_REG_FIFO0CNT);
+ printk("fifo 0 count = %d\n", fifo1count);
+
+ for (i = 0; i < fifo1count; i++) {
+ read_sample = tscadc_readl(ts_dev, TSCADC_REG_FIFO0);
+ printk("sample: %d: %x\n", i, read_sample);
+ }
+ irqclr |= TSCADC_IRQENB_FIFO0THRES;
+ }
+
+
+ if (status & TSCADC_IRQENB_FIFO1THRES) {
+ fifo1count = tscadc_readl(ts_dev, TSCADC_REG_FIFO1CNT);
+
+ for (i = 0; i < fifo1count; i++) {
+ read_sample = tscadc_readl(ts_dev, TSCADC_REG_FIFO1);
+ // read_sample = read_sample & 0xfff;
+ printk("sample: %d: %d\n", i, read_sample);
+ panic("sample read from fifo1!");
+ }
+ irqclr |= TSCADC_IRQENB_FIFO1THRES;
+ }
+
+ mdelay(500);
+
+ tscadc_writel(ts_dev, TSCADC_REG_IRQSTATUS, irqclr);
+
+ /* check pending interrupts */
+ tscadc_writel(ts_dev, TSCADC_REG_IRQEOI, 0x0);
+
+ /* Turn on Step 1 again */
+ tscadc_writel(ts_dev, TSCADC_REG_SE, TSCADC_STPENB_STEPENB_GENERAL);
+ return IRQ_HANDLED;
+}
+
static void tsc_step_config(struct tscadc *ts_dev)
{
unsigned int stepconfigx = 0, stepconfigy = 0;
@@ -224,7 +313,7 @@ static void tsc_step_config(struct tscadc *ts_dev)
tscadc_writel(ts_dev, TSCADC_REG_STEPCONFIG14, stepconfigz2);
tscadc_writel(ts_dev, TSCADC_REG_STEPDELAY14, delay);
- tscadc_writel(ts_dev, TSCADC_REG_SE, TSCADC_STPENB_STEPENB);
+ tscadc_writel(ts_dev, TSCADC_REG_SE, TSCADC_STPENB_STEPENB_TOUCHSCREEN);
}
static void tsc_idle_config(struct tscadc *ts_config)
@@ -242,7 +331,7 @@ static void tsc_idle_config(struct tscadc *ts_config)
tscadc_writel(ts_config, TSCADC_REG_IDLECONFIG, idleconfig);
}
-static irqreturn_t tscadc_interrupt(int irq, void *dev)
+static irqreturn_t tsc_interrupt(int irq, void *dev)
{
struct tscadc *ts_dev = (struct tscadc *)dev;
struct input_dev *input_dev = ts_dev->input;
@@ -362,7 +451,7 @@ static irqreturn_t tscadc_interrupt(int irq, void *dev)
/* check pending interrupts */
tscadc_writel(ts_dev, TSCADC_REG_IRQEOI, 0x0);
- tscadc_writel(ts_dev, TSCADC_REG_SE, TSCADC_STPENB_STEPENB);
+ tscadc_writel(ts_dev, TSCADC_REG_SE, TSCADC_STPENB_STEPENB_TOUCHSCREEN);
return IRQ_HANDLED;
}
@@ -400,13 +489,15 @@ static int __devinit tscadc_probe(struct platform_device *pdev)
return -ENODEV;
}
- input_dev = input_allocate_device();
- if (!input_dev) {
- dev_err(&pdev->dev, "failed to allocate input device.\n");
- err = -ENOMEM;
- goto err_free_mem;
+ if(pdata->mode == TI_TSCADC_TSCMODE) {
+ input_dev = input_allocate_device();
+ if (!input_dev) {
+ dev_err(&pdev->dev, "failed to allocate input device.\n");
+ err = -ENOMEM;
+ goto err_free_mem;
+ }
+ ts_dev->input = input_dev;
}
- ts_dev->input = input_dev;
ts_dev->tsc_base = ioremap(res->start, resource_size(res));
if (!ts_dev->tsc_base) {
@@ -415,8 +506,15 @@ static int __devinit tscadc_probe(struct platform_device *pdev)
goto err_release_mem;
}
- err = request_irq(ts_dev->irq, tscadc_interrupt, IRQF_DISABLED,
- pdev->dev.driver->name, ts_dev);
+ if(pdata->mode == TI_TSCADC_TSCMODE) {
+ err = request_irq(ts_dev->irq, tsc_interrupt, IRQF_DISABLED,
+ pdev->dev.driver->name, ts_dev);
+ }
+ else {
+ err = request_irq(ts_dev->irq, tsc_adc_interrupt, IRQF_DISABLED,
+ pdev->dev.driver->name, ts_dev);
+ }
+
if (err) {
dev_err(&pdev->dev, "failed to allocate irq.\n");
goto err_unmap_regs;
@@ -436,11 +534,15 @@ static int __devinit tscadc_probe(struct platform_device *pdev)
goto err_free_irq;
}
clock_rate = clk_get_rate(ts_dev->clk);
+
+ /* clk_value of atleast 21MHz required
+ * Clock verified on BeagleBone to be 24MHz */
clk_value = clock_rate / ADC_CLK;
if (clk_value < 7) {
dev_err(&pdev->dev, "clock input less than min clock requirement\n");
goto err_fail;
}
+
/* TSCADC_CLKDIV needs to be configured to the value minus 1 */
clk_value = clk_value - 1;
tscadc_writel(ts_dev, TSCADC_REG_CLKDIV, clk_value);
@@ -451,56 +553,59 @@ static int __devinit tscadc_probe(struct platform_device *pdev)
ts_dev->wires = pdata->wires;
ts_dev->analog_input = pdata->analog_input;
ts_dev->x_plate_resistance = pdata->x_plate_resistance;
+ ts_dev->mode = pdata->mode;
- /* Set the control register bits */
+ /* Set the control register bits - 12.5.44 TRM */
ctrl = TSCADC_CNTRLREG_STEPCONFIGWRT |
- TSCADC_CNTRLREG_TSCENB |
- TSCADC_CNTRLREG_STEPID;
- switch (ts_dev->wires) {
- case 4:
- ctrl |= TSCADC_CNTRLREG_4WIRE;
- break;
- case 5:
- ctrl |= TSCADC_CNTRLREG_5WIRE;
- break;
- case 8:
- ctrl |= TSCADC_CNTRLREG_8WIRE;
- break;
+ TSCADC_CNTRLREG_STEPID;
+ if(pdata->mode == TI_TSCADC_TSCMODE) {
+ ctrl |= TSCADC_CNTRLREG_TSCENB;
+ switch (ts_dev->wires) {
+ case 4:
+ ctrl |= TSCADC_CNTRLREG_4WIRE;
+ break;
+ case 5:
+ ctrl |= TSCADC_CNTRLREG_5WIRE;
+ break;
+ case 8:
+ ctrl |= TSCADC_CNTRLREG_8WIRE;
+ break;
+ }
}
tscadc_writel(ts_dev, TSCADC_REG_CTRL, ctrl);
- /* Set register bits for Idel Config Mode */
- tsc_idle_config(ts_dev);
-
- /* IRQ Enable */
- irqenable = TSCADC_IRQENB_FIFO1THRES;
+ /* Touch screen / ADC configuration */
+ if(pdata->mode == TI_TSCADC_TSCMODE) {
+ tsc_idle_config(ts_dev);
+ tsc_step_config(ts_dev);
+ tscadc_writel(ts_dev, TSCADC_REG_FIFO1THR, 6);
+ irqenable = TSCADC_IRQENB_FIFO1THRES;
+ /* Touch screen also needs an input_dev */
+ input_dev->name = "ti-tsc-adcc";
+ input_dev->dev.parent = &pdev->dev;
+ input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS);
+ input_dev->keybit[BIT_WORD(BTN_TOUCH)] = BIT_MASK(BTN_TOUCH);
+ input_set_abs_params(input_dev, ABS_X, 0, MAX_12BIT, 0, 0);
+ input_set_abs_params(input_dev, ABS_Y, 0, MAX_12BIT, 0, 0);
+ /* register to the input system */
+ err = input_register_device(input_dev);
+ if (err)
+ goto err_fail;
+ }
+ else {
+ tsc_adc_step_config(ts_dev);
+ tscadc_writel(ts_dev, TSCADC_REG_FIFO0THR, 0);
+ irqenable = TSCADC_IRQENB_FIFO0THRES;
+ }
tscadc_writel(ts_dev, TSCADC_REG_IRQENABLE, irqenable);
- tsc_step_config(ts_dev);
-
- tscadc_writel(ts_dev, TSCADC_REG_FIFO1THR, 6);
-
ctrl |= TSCADC_CNTRLREG_TSCSSENB;
- tscadc_writel(ts_dev, TSCADC_REG_CTRL, ctrl);
-
- input_dev->name = "ti-tsc-adcc";
- input_dev->dev.parent = &pdev->dev;
-
- input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS);
- input_dev->keybit[BIT_WORD(BTN_TOUCH)] = BIT_MASK(BTN_TOUCH);
-
- input_set_abs_params(input_dev, ABS_X, 0, MAX_12BIT, 0, 0);
- input_set_abs_params(input_dev, ABS_Y, 0, MAX_12BIT, 0, 0);
- input_set_abs_params(input_dev, ABS_PRESSURE, 0, MAX_12BIT, 0, 0);
-
- /* register to the input system */
- err = input_register_device(input_dev);
- if (err)
- goto err_fail;
+ tscadc_writel(ts_dev, TSCADC_REG_CTRL, ctrl); /* Turn on TSC_ADC */
return 0;
err_fail:
+ printk(KERN_ERR "Fatal error, shutting down TSC_ADC\n");
clk_disable(ts_dev->clk);
clk_put(ts_dev->clk);
err_free_irq:
diff --git a/include/linux/input/ti_tscadc.h b/include/linux/input/ti_tscadc.h
index 2c547bb..850cd4b 100644
--- a/include/linux/input/ti_tscadc.h
+++ b/include/linux/input/ti_tscadc.h
@@ -14,8 +14,12 @@
* @x_plate_resistance: X plate resistance.
*/
+#define TI_TSCADC_TSCMODE 0
+#define TI_TSCADC_GENMODE 1
+
struct tsc_data {
int wires;
int analog_input;
int x_plate_resistance;
+ int mode;
};
--
1.7.2.5
@@ -1,86 +0,0 @@
From 0d765160ef94e0ab6f30725b01e5102ca119449f Mon Sep 17 00:00:00 2001
From: Joel A Fernandes <joelagnel@ti.com>
Date: Wed, 30 Nov 2011 15:02:17 +0100
Subject: [PATCH 5/9] tscadc: Add board file mfd support, fix warning
Signed-off-by: Joel A Fernandes <joelagnel@ti.com>
---
arch/arm/mach-omap2/board-am335xevm.c | 27 ++++++++++++++++++++++++++-
drivers/input/touchscreen/ti_tscadc.c | 2 +-
2 files changed, 27 insertions(+), 2 deletions(-)
diff --git a/arch/arm/mach-omap2/board-am335xevm.c b/arch/arm/mach-omap2/board-am335xevm.c
index 8221ba9..30f23d7 100644
--- a/arch/arm/mach-omap2/board-am335xevm.c
+++ b/arch/arm/mach-omap2/board-am335xevm.c
@@ -195,6 +195,11 @@ static struct resource tsc_resources[] = {
static struct tsc_data am335x_touchscreen_data = {
.wires = 4,
.x_plate_resistance = 200,
+ .mode = TI_TSCADC_TSCMODE,
+};
+
+static struct tsc_data bone_touchscreen_data = {
+ .mode = TI_TSCADC_GENMODE,
};
static struct platform_device tsc_device = {
@@ -207,6 +212,16 @@ static struct platform_device tsc_device = {
.resource = tsc_resources,
};
+static struct platform_device bone_tsc_device = {
+ .name = "tsc",
+ .id = -1,
+ .dev = {
+ .platform_data = &bone_touchscreen_data,
+ },
+ .num_resources = ARRAY_SIZE(tsc_resources),
+ .resource = tsc_resources,
+};
+
static u8 am335x_iis_serializer_direction1[] = {
INACTIVE_MODE, INACTIVE_MODE, TX_MODE, RX_MODE,
INACTIVE_MODE, INACTIVE_MODE, INACTIVE_MODE, INACTIVE_MODE,
@@ -927,6 +942,16 @@ static void tsc_init(int evm_id, int profile)
pr_err("failed to register touchscreen device\n");
}
+static void bone_tsc_init(int evm_id, int profile)
+{
+ int err;
+ setup_pin_mux(tsc_pin_mux);
+ err = platform_device_register(&bone_tsc_device);
+ if (err)
+ pr_err("failed to register touchscreen device\n");
+}
+
+
static void boneleds_init(int evm_id, int profile )
{
int err;
@@ -1541,7 +1566,7 @@ static struct evm_dev_cfg beaglebone_old_dev_cfg[] = {
{i2c2_init, DEV_ON_BASEBOARD, PROFILE_NONE},
{mmc0_init, DEV_ON_BASEBOARD, PROFILE_NONE},
{boneleds_init, DEV_ON_BASEBOARD, PROFILE_ALL},
- {tsc_init, DEV_ON_BASEBOARD, PROFILE_ALL},
+ {bone_tsc_init, DEV_ON_BASEBOARD, PROFILE_ALL},
{NULL, 0, 0},
};
diff --git a/drivers/input/touchscreen/ti_tscadc.c b/drivers/input/touchscreen/ti_tscadc.c
index 76fc7b6..49a5a70 100644
--- a/drivers/input/touchscreen/ti_tscadc.c
+++ b/drivers/input/touchscreen/ti_tscadc.c
@@ -462,7 +462,7 @@ static irqreturn_t tsc_interrupt(int irq, void *dev)
static int __devinit tscadc_probe(struct platform_device *pdev)
{
struct tscadc *ts_dev;
- struct input_dev *input_dev;
+ struct input_dev *input_dev = NULL;
int err;
int clk_value;
int clock_rate, irqenable, ctrl;
--
1.7.2.5
@@ -1,26 +0,0 @@
From 42b8e841175da74cb583b91b8b18b3b6b89ea8f7 Mon Sep 17 00:00:00 2001
From: Joel A Fernandes <joelagnel@ti.com>
Date: Wed, 30 Nov 2011 15:03:59 +0100
Subject: [PATCH 6/9] AM335X: init tsc bone style for new boards
Signed-off-by: Joel A Fernandes <joelagnel@ti.com>
---
arch/arm/mach-omap2/board-am335xevm.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/arch/arm/mach-omap2/board-am335xevm.c b/arch/arm/mach-omap2/board-am335xevm.c
index 30f23d7..8e1521c 100644
--- a/arch/arm/mach-omap2/board-am335xevm.c
+++ b/arch/arm/mach-omap2/board-am335xevm.c
@@ -1579,7 +1579,7 @@ static struct evm_dev_cfg beaglebone_dev_cfg[] = {
{i2c2_init, DEV_ON_BASEBOARD, PROFILE_NONE},
{mmc0_init, DEV_ON_BASEBOARD, PROFILE_NONE},
{boneleds_init, DEV_ON_BASEBOARD, PROFILE_ALL},
- {tsc_init, DEV_ON_BASEBOARD, PROFILE_ALL},
+ {bone_tsc_init, DEV_ON_BASEBOARD, PROFILE_ALL},
{NULL, 0, 0},
};
--
1.7.2.5
@@ -1,46 +0,0 @@
From 26a77cf4dc71a322049fc619814a2a46ccdc31c9 Mon Sep 17 00:00:00 2001
From: Joel A Fernandes <joelagnel@ti.com>
Date: Mon, 28 Nov 2011 18:18:04 -0600
Subject: [PATCH 7/9] tscadc: make stepconfig channel-configurable
Signed-off-by: Joel A Fernandes <joelagnel@ti.com>
---
drivers/input/touchscreen/ti_tscadc.c | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/drivers/input/touchscreen/ti_tscadc.c b/drivers/input/touchscreen/ti_tscadc.c
index 49a5a70..638feb9 100644
--- a/drivers/input/touchscreen/ti_tscadc.c
+++ b/drivers/input/touchscreen/ti_tscadc.c
@@ -129,7 +129,9 @@ static void tscadc_writel(struct tscadc *tsc, unsigned int reg,
writel(val, tsc->tsc_base + reg);
}
-static void tsc_adc_step_config(struct tscadc *ts_dev)
+/* Configure ADC to sample on channel (1-8) */
+
+static void tsc_adc_step_config(struct tscadc *ts_dev, int channel)
{
unsigned int stepconfig = 0, delay = 0, chargeconfig = 0;
@@ -141,7 +143,7 @@ static void tsc_adc_step_config(struct tscadc *ts_dev)
*/
stepconfig = TSCADC_STEPCONFIG_MODE_SWONESHOT |
TSCADC_STEPCONFIG_2SAMPLES_AVG |
- (0x7 << 19);
+ ((channel-1) << 19);
delay = TSCADC_STEPCONFIG_SAMPLEDLY | TSCADC_STEPCONFIG_OPENDLY;
@@ -593,7 +595,7 @@ static int __devinit tscadc_probe(struct platform_device *pdev)
goto err_fail;
}
else {
- tsc_adc_step_config(ts_dev);
+ tsc_adc_step_config(ts_dev, 8);
tscadc_writel(ts_dev, TSCADC_REG_FIFO0THR, 0);
irqenable = TSCADC_IRQENB_FIFO0THRES;
}
--
1.7.2.5
@@ -1,151 +0,0 @@
From 57ce0ce446d8c4626b4ea01005a1173da36f095c Mon Sep 17 00:00:00 2001
From: Joel A Fernandes <joelagnel@ti.com>
Date: Mon, 28 Nov 2011 20:55:25 -0600
Subject: [PATCH 8/9] tscadc: Trigger through sysfs
Signed-off-by: Joel A Fernandes <joelagnel@ti.com>
---
drivers/input/touchscreen/ti_tscadc.c | 61 ++++++++++++++++++++++++++++++---
include/linux/input/ti_tscadc.h | 1 +
2 files changed, 57 insertions(+), 5 deletions(-)
diff --git a/drivers/input/touchscreen/ti_tscadc.c b/drivers/input/touchscreen/ti_tscadc.c
index 638feb9..0126219 100644
--- a/drivers/input/touchscreen/ti_tscadc.c
+++ b/drivers/input/touchscreen/ti_tscadc.c
@@ -26,6 +26,17 @@
#include <linux/io.h>
#include <linux/input/ti_tscadc.h>
#include <linux/delay.h>
+#include <linux/device.h>
+
+size_t do_adc_sample(struct kobject *, struct attribute *, char *);
+static DEVICE_ATTR(ain1, S_IRUGO, do_adc_sample, NULL);
+static DEVICE_ATTR(ain2, S_IRUGO, do_adc_sample, NULL);
+static DEVICE_ATTR(ain3, S_IRUGO, do_adc_sample, NULL);
+static DEVICE_ATTR(ain4, S_IRUGO, do_adc_sample, NULL);
+static DEVICE_ATTR(ain5, S_IRUGO, do_adc_sample, NULL);
+static DEVICE_ATTR(ain6, S_IRUGO, do_adc_sample, NULL);
+static DEVICE_ATTR(ain7, S_IRUGO, do_adc_sample, NULL);
+static DEVICE_ATTR(ain8, S_IRUGO, do_adc_sample, NULL);
/* Memory mapped registers here have incorrect offsets!
* Correct after referring TRM */
@@ -144,12 +155,12 @@ static void tsc_adc_step_config(struct tscadc *ts_dev, int channel)
stepconfig = TSCADC_STEPCONFIG_MODE_SWONESHOT |
TSCADC_STEPCONFIG_2SAMPLES_AVG |
((channel-1) << 19);
-
+
delay = TSCADC_STEPCONFIG_SAMPLEDLY | TSCADC_STEPCONFIG_OPENDLY;
tscadc_writel(ts_dev, TSCADC_REG_STEPCONFIG(10), stepconfig);
tscadc_writel(ts_dev, TSCADC_REG_STEPDELAY(10), delay);
-
+
/* Get the ball rolling, this will trigger the FSM to step through
* as soon as TSC_ADC_SS is turned on */
tscadc_writel(ts_dev, TSCADC_REG_SE, TSCADC_STPENB_STEPENB_GENERAL);
@@ -199,7 +210,7 @@ static irqreturn_t tsc_adc_interrupt(int irq, void *dev)
irqclr |= TSCADC_IRQENB_FIFO1THRES;
}
- mdelay(500);
+ // mdelay(500);
tscadc_writel(ts_dev, TSCADC_REG_IRQSTATUS, irqclr);
@@ -207,7 +218,7 @@ static irqreturn_t tsc_adc_interrupt(int irq, void *dev)
tscadc_writel(ts_dev, TSCADC_REG_IRQEOI, 0x0);
/* Turn on Step 1 again */
- tscadc_writel(ts_dev, TSCADC_REG_SE, TSCADC_STPENB_STEPENB_GENERAL);
+ // tscadc_writel(ts_dev, TSCADC_REG_SE, TSCADC_STPENB_STEPENB_GENERAL);
return IRQ_HANDLED;
}
@@ -461,6 +472,34 @@ static irqreturn_t tsc_interrupt(int irq, void *dev)
* The functions for inserting/removing driver as a module.
*/
+size_t do_adc_sample(struct kobject *kobj, struct attribute *attr, char *buf) {
+ struct platform_device *pdev;
+ struct device *dev;
+ struct tscadc *ts_dev;
+ int channel_num;
+
+ pdev = (struct platform_device *)container_of(kobj, struct device, kobj);
+ dev = &pdev->dev;
+
+ ts_dev = dev_get_drvdata(dev);
+
+ if(strncmp(attr->name, "ain", 3)) {
+ printk("Invalid ain num\n");
+ return -EINVAL;
+ }
+
+ channel_num = attr->name[3] - 0x30;
+ if(channel_num > 8 || channel_num < 1) {
+ printk("Invalid channel_num=%d\n", channel_num);
+ return -EINVAL;
+ }
+
+ tsc_adc_step_config(ts_dev, channel_num);
+
+ memcpy(buf, attr->name, strlen(attr->name)+1);
+ return strlen(attr->name);
+}
+
static int __devinit tscadc_probe(struct platform_device *pdev)
{
struct tscadc *ts_dev;
@@ -472,6 +511,18 @@ static int __devinit tscadc_probe(struct platform_device *pdev)
struct resource *res;
struct clk *tsc_ick;
+ printk("dev addr = %p\n", &pdev->dev);
+ printk("pdev addr = %p\n", pdev);
+
+ device_create_file(&pdev->dev, &dev_attr_ain1);
+ device_create_file(&pdev->dev, &dev_attr_ain2);
+ device_create_file(&pdev->dev, &dev_attr_ain3);
+ device_create_file(&pdev->dev, &dev_attr_ain4);
+ device_create_file(&pdev->dev, &dev_attr_ain5);
+ device_create_file(&pdev->dev, &dev_attr_ain6);
+ device_create_file(&pdev->dev, &dev_attr_ain7);
+ device_create_file(&pdev->dev, &dev_attr_ain8);
+
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!res) {
dev_err(&pdev->dev, "no memory resource defined.\n");
@@ -595,7 +646,6 @@ static int __devinit tscadc_probe(struct platform_device *pdev)
goto err_fail;
}
else {
- tsc_adc_step_config(ts_dev, 8);
tscadc_writel(ts_dev, TSCADC_REG_FIFO0THR, 0);
irqenable = TSCADC_IRQENB_FIFO0THRES;
}
@@ -604,6 +654,7 @@ static int __devinit tscadc_probe(struct platform_device *pdev)
ctrl |= TSCADC_CNTRLREG_TSCSSENB;
tscadc_writel(ts_dev, TSCADC_REG_CTRL, ctrl); /* Turn on TSC_ADC */
+ dev_set_drvdata(&pdev->dev, ts_dev);
return 0;
err_fail:
diff --git a/include/linux/input/ti_tscadc.h b/include/linux/input/ti_tscadc.h
index 850cd4b..fc239c6 100644
--- a/include/linux/input/ti_tscadc.h
+++ b/include/linux/input/ti_tscadc.h
@@ -13,6 +13,7 @@
* 0.
* @x_plate_resistance: X plate resistance.
*/
+#include <linux/device.h>
#define TI_TSCADC_TSCMODE 0
#define TI_TSCADC_GENMODE 1
--
1.7.2.5
@@ -1,34 +0,0 @@
From f4332fb1d88c6301ffca75e9fc9bea1e434b8986 Mon Sep 17 00:00:00 2001
From: Joel A Fernandes <joelagnel@ti.com>
Date: Mon, 28 Nov 2011 20:56:48 -0600
Subject: [PATCH 9/9] meta-ti: Remove debug messages for meta-ti
Signed-off-by: Joel A Fernandes <joelagnel@ti.com>
---
drivers/input/touchscreen/ti_tscadc.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/input/touchscreen/ti_tscadc.c b/drivers/input/touchscreen/ti_tscadc.c
index 0126219..182428b 100644
--- a/drivers/input/touchscreen/ti_tscadc.c
+++ b/drivers/input/touchscreen/ti_tscadc.c
@@ -181,14 +181,14 @@ static irqreturn_t tsc_adc_interrupt(int irq, void *dev)
status = tscadc_readl(ts_dev, TSCADC_REG_IRQSTATUS);
- printk("interrupt! status=%x\n", status);
+ // printk("interrupt! status=%x\n", status);
// if (status & TSCADC_IRQENB_EOS) {
// irqclr |= TSCADC_IRQENB_EOS;
// }
if (status & TSCADC_IRQENB_FIFO0THRES) {
fifo1count = tscadc_readl(ts_dev, TSCADC_REG_FIFO0CNT);
- printk("fifo 0 count = %d\n", fifo1count);
+ // printk("fifo 0 count = %d\n", fifo1count);
for (i = 0; i < fifo1count; i++) {
read_sample = tscadc_readl(ts_dev, TSCADC_REG_FIFO0);
--
1.7.2.5
@@ -1,54 +0,0 @@
From d0852fc8d96eedb709b964dacfa8ea71746f1872 Mon Sep 17 00:00:00 2001
From: Joel A Fernandes <joelagnel@ti.com>
Date: Tue, 29 Nov 2011 09:44:22 -0600
Subject: [PATCH 10/10] tscadc: switch to polling instead of interrupts
Signed-off-by: Joel A Fernandes <joelagnel@ti.com>
---
drivers/input/touchscreen/ti_tscadc.c | 16 ++++++++++++++--
1 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/drivers/input/touchscreen/ti_tscadc.c b/drivers/input/touchscreen/ti_tscadc.c
index 182428b..90cb5ed 100644
--- a/drivers/input/touchscreen/ti_tscadc.c
+++ b/drivers/input/touchscreen/ti_tscadc.c
@@ -477,6 +477,8 @@ size_t do_adc_sample(struct kobject *kobj, struct attribute *attr, char *buf) {
struct device *dev;
struct tscadc *ts_dev;
int channel_num;
+ int fifo0count = 0;
+ int read_sample = 0;
pdev = (struct platform_device *)container_of(kobj, struct device, kobj);
dev = &pdev->dev;
@@ -496,7 +498,17 @@ size_t do_adc_sample(struct kobject *kobj, struct attribute *attr, char *buf) {
tsc_adc_step_config(ts_dev, channel_num);
- memcpy(buf, attr->name, strlen(attr->name)+1);
+ do {
+ fifo0count = tscadc_readl(ts_dev, TSCADC_REG_FIFO0CNT);
+ }
+ while (!fifo0count);
+
+ while (fifo0count--) {
+ read_sample = tscadc_readl(ts_dev, TSCADC_REG_FIFO0) & 0xfff;
+ // printk("polling sample: %d: %x\n", fifo0count, read_sample);
+ }
+ sprintf(buf, "%d", read_sample);
+
return strlen(attr->name);
}
@@ -647,7 +659,7 @@ static int __devinit tscadc_probe(struct platform_device *pdev)
}
else {
tscadc_writel(ts_dev, TSCADC_REG_FIFO0THR, 0);
- irqenable = TSCADC_IRQENB_FIFO0THRES;
+ irqenable = 0; // TSCADC_IRQENB_FIFO0THRES;
}
tscadc_writel(ts_dev, TSCADC_REG_IRQENABLE, irqenable);
--
1.7.4.1
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -1,260 +0,0 @@
From f2da2b163827a075c98f1897801c90bf736784a3 Mon Sep 17 00:00:00 2001
From: Anil Kumar Ch <anilkumar@ti.com>
Date: Sun, 6 Nov 2011 02:46:12 +0530
Subject: [PATCH 2/7] can: d_can: Added platform data for am33xx device
This patch adds the platform data needed by the driver. Added the
resources to the difference d_can instances.
Initialization of message ram is necessary to read/write the message object
from/into the message RAM
Signed-off-by: Anil Kumar Ch <anilkumar@ti.com>
---
arch/arm/mach-omap2/board-am335xevm.c | 131 ++++++++++++++++++++++++++++++
arch/arm/mach-omap2/clock33xx_data.c | 18 ++++
arch/arm/mach-omap2/mux33xx.c | 8 +-
arch/arm/plat-omap/include/plat/am33xx.h | 3 +
4 files changed, 156 insertions(+), 4 deletions(-)
diff --git a/arch/arm/mach-omap2/board-am335xevm.c b/arch/arm/mach-omap2/board-am335xevm.c
index c84857e..6773f3b 100644
--- a/arch/arm/mach-omap2/board-am335xevm.c
+++ b/arch/arm/mach-omap2/board-am335xevm.c
@@ -24,6 +24,7 @@
#include <linux/mtd/nand.h>
#include <linux/mtd/partitions.h>
#include <linux/platform_device.h>
+#include <linux/can/platform/d_can.h>
#include <linux/clk.h>
#include <linux/err.h>
#include <linux/wl12xx.h>
@@ -50,6 +51,7 @@
/* LCD controller is similar to DA850 */
#include <video/da8xx-fb.h>
+#include "control.h"
#include "board-flash.h"
#include "mux.h"
#include "devices.h"
@@ -991,6 +993,133 @@ static void mmc2_wl12xx_init(int evm_id, int profile)
return;
}
+#define AM33XX_D_CAN_RAM_BASE 0x1000
+#define AM33XX_D_CAN_NUM_MSG_OBJS 64
+#define AM33XX_D_CAN_VERSION 0x1
+#define AM33XX_CTL_DCAN_RAMINIT_OFFSET 0x644
+#define AM33XX_D_CAN_RAMINIT_START(n) (0x1 << n)
+
+static void d_can_hw_raminit(unsigned int instance)
+{
+ u32 raminit_reg_val;
+
+ /* Read the value */
+ raminit_reg_val = __raw_readl(AM33XX_CTRL_REGADDR(
+ AM33XX_CTL_DCAN_RAMINIT_OFFSET));
+
+ /* Modify by setting "0" */
+ raminit_reg_val &= ~AM33XX_D_CAN_RAMINIT_START(instance);
+ __raw_writel(raminit_reg_val, AM33XX_CTRL_REGADDR(
+ AM33XX_CTL_DCAN_RAMINIT_OFFSET));
+
+ /* Reset to one */
+ raminit_reg_val |= AM33XX_D_CAN_RAMINIT_START(instance);
+ __raw_writel(raminit_reg_val, AM33XX_CTRL_REGADDR(
+ AM33XX_CTL_DCAN_RAMINIT_OFFSET));
+ udelay(10);
+}
+
+static struct d_can_platform_data am33xx_evm_d_can_pdata = {
+ .d_can_offset = 0,
+ .d_can_ram_offset = AM33XX_D_CAN_RAM_BASE,
+ .num_of_msg_objs = AM33XX_D_CAN_NUM_MSG_OBJS,
+ .dma_support = false,
+ .test_mode_enable = false,
+ .parity_check = false,
+ .version = AM33XX_D_CAN_VERSION,
+ .hw_raminit = d_can_hw_raminit,
+};
+
+static struct resource am33xx_d_can0_resources[] = {
+ {
+ .start = AM33XX_D_CAN0_BASE,
+ .end = AM33XX_D_CAN0_BASE + 0x3FFF,
+ .flags = IORESOURCE_MEM,
+ },
+ {
+ .name = "d_can_int0",
+ .start = AM33XX_IRQ_DCAN0_0,
+ .end = AM33XX_IRQ_DCAN0_0,
+ .flags = IORESOURCE_IRQ,
+ },
+ {
+ .name = "d_can_int1",
+ .start = AM33XX_IRQ_DCAN0_1,
+ .end = AM33XX_IRQ_DCAN0_1,
+ .flags = IORESOURCE_IRQ,
+ },
+};
+
+static struct platform_device am33xx_d_can0_device = {
+ .dev = {
+ .platform_data = &am33xx_evm_d_can_pdata,
+ },
+ .name = "d_can",
+ .id = 0,
+ .num_resources = ARRAY_SIZE(am33xx_d_can0_resources),
+ .resource = am33xx_d_can0_resources,
+};
+
+static struct pinmux_config d_can0_pin_mux[] = {
+ {"uart1_ctsn.d_can0_tx", OMAP_MUX_MODE2 | AM33XX_PULL_ENBL},
+ {"uart1_rtsn.d_can0_rx", OMAP_MUX_MODE2 | AM33XX_PIN_INPUT_PULLUP},
+ {NULL, 0},
+};
+
+static void d_can0_init(int evm_id, int profile)
+{
+ /* For instance 0 */
+ if (profile == PROFILE_1) {
+ setup_pin_mux(d_can0_pin_mux);
+ platform_device_register(&am33xx_d_can0_device);
+ }
+}
+
+/* DCAN instnace 1 specific resources */
+static struct resource am33xx_d_can1_resources[] = {
+ {
+ .start = AM33XX_D_CAN1_BASE,
+ .end = AM33XX_D_CAN1_BASE + 0x3FFF,
+ .flags = IORESOURCE_MEM,
+ },
+ {
+ .name = "d_can_int0",
+ .start = AM33XX_IRQ_DCAN1_0,
+ .end = AM33XX_IRQ_DCAN1_0,
+ .flags = IORESOURCE_IRQ,
+ },
+ {
+ .name = "d_can_int1",
+ .start = AM33XX_IRQ_DCAN1_1,
+ .end = AM33XX_IRQ_DCAN1_1,
+ .flags = IORESOURCE_IRQ,
+ },
+};
+
+static struct platform_device am33xx_d_can1_device = {
+ .dev = {
+ .platform_data = &am33xx_evm_d_can_pdata,
+ },
+ .name = "d_can",
+ .id = 1,
+ .num_resources = ARRAY_SIZE(am33xx_d_can1_resources),
+ .resource = am33xx_d_can1_resources,
+};
+
+static struct pinmux_config d_can1_pin_mux[] = {
+ {"uart1_rxd.d_can1_tx", OMAP_MUX_MODE2 | AM33XX_PULL_ENBL},
+ {"uart1_txd.d_can1_rx", OMAP_MUX_MODE2 | AM33XX_PIN_INPUT_PULLUP},
+ {NULL, 0},
+};
+
+static void d_can1_init(int evm_id, int profile)
+{
+ /* For instance 1 */
+ if (profile == PROFILE_4) {
+ setup_pin_mux(d_can1_pin_mux);
+ platform_device_register(&am33xx_d_can1_device);
+ }
+}
static void uart1_wl12xx_init(int evm_id, int profile)
{
setup_pin_mux(uart1_wl12xx_pin_mux);
@@ -1194,6 +1323,8 @@ static struct evm_dev_cfg gen_purp_evm_dev_cfg[] = {
{uart1_wl12xx_init, DEV_ON_BASEBOARD, (PROFILE_0 | PROFILE_3 |
PROFILE_5)},
{wl12xx_init, DEV_ON_BASEBOARD, (PROFILE_0 | PROFILE_3 | PROFILE_5)},
+ {d_can0_init, DEV_ON_BASEBOARD, PROFILE_1},
+ {d_can1_init, DEV_ON_BASEBOARD, PROFILE_4},
{NULL, 0, 0},
};
diff --git a/arch/arm/mach-omap2/clock33xx_data.c b/arch/arm/mach-omap2/clock33xx_data.c
index 6763c59..d8670f2 100644
--- a/arch/arm/mach-omap2/clock33xx_data.c
+++ b/arch/arm/mach-omap2/clock33xx_data.c
@@ -421,6 +421,22 @@ static struct clk dcan1_fck = {
.recalc = &followparent_recalc,
};
+static struct clk dcan0_ick = {
+ .name = "dcan0_ick",
+ .parent = &dpll_per_m2_ck ,
+ .ops = &clkops_null,
+ .clkdm_name = "l4ls_clkdm",
+ .recalc = &followparent_recalc,
+};
+
+static struct clk dcan1_ick = {
+ .name = "dcan1_ick",
+ .parent = &dpll_per_m2_ck ,
+ .ops = &clkops_null,
+ .clkdm_name = "l4ls_clkdm",
+ .recalc = &followparent_recalc,
+};
+
static struct clk debugss_fck = {
.name = "debugss_fck",
.ops = &clkops_omap2_dflt,
@@ -1771,6 +1787,8 @@ static struct omap_clk am33xx_clks[] = {
CLK("cpsw.0", NULL, &cpgmac0_fck, CK_AM33XX),
CLK(NULL, "dcan0_fck", &dcan0_fck, CK_AM33XX),
CLK(NULL, "dcan1_fck", &dcan1_fck, CK_AM33XX),
+ CLK(NULL, "dcan0_ick", &dcan0_ick, CK_AM33XX),
+ CLK(NULL, "dcan1_ick", &dcan1_ick, CK_AM33XX),
CLK(NULL, "debugss_fck", &debugss_fck, CK_AM33XX),
CLK(NULL, "elm_fck", &elm_fck, CK_AM33XX),
CLK(NULL, "emif_fck", &emif_fck, CK_AM33XX),
diff --git a/arch/arm/mach-omap2/mux33xx.c b/arch/arm/mach-omap2/mux33xx.c
index 0286c4f..8232b46 100644
--- a/arch/arm/mach-omap2/mux33xx.c
+++ b/arch/arm/mach-omap2/mux33xx.c
@@ -315,16 +315,16 @@ static struct omap_mux __initdata am33xx_muxmodes[] = {
"uart0_txd", "spi1_cs1", NULL, NULL,
NULL, NULL, NULL, NULL),
_AM33XX_MUXENTRY(UART1_CTSN, 0,
- "uart1_ctsn", NULL, NULL, NULL,
+ "uart1_ctsn", NULL, "d_can0_tx", NULL,
"spi1_cs0", NULL, NULL, NULL),
_AM33XX_MUXENTRY(UART1_RTSN, 0,
- "uart1_rtsn", NULL, NULL, NULL,
+ "uart1_rtsn", NULL, "d_can0_rx", NULL,
"spi1_cs1", NULL, NULL, NULL),
_AM33XX_MUXENTRY(UART1_RXD, 0,
- "uart1_rxd", "mmc1_sdwp", NULL, NULL,
+ "uart1_rxd", "mmc1_sdwp", "d_can1_tx", NULL,
NULL, NULL, NULL, NULL),
_AM33XX_MUXENTRY(UART1_TXD, 0,
- "uart1_txd", "mmc2_sdwp", NULL, NULL,
+ "uart1_txd", "mmc2_sdwp", "d_can1_rx", NULL,
NULL, NULL, NULL, NULL),
_AM33XX_MUXENTRY(I2C0_SDA, 0,
"i2c0_sda", NULL, NULL, NULL,
diff --git a/arch/arm/plat-omap/include/plat/am33xx.h b/arch/arm/plat-omap/include/plat/am33xx.h
index a77c38e..cfd1883 100644
--- a/arch/arm/plat-omap/include/plat/am33xx.h
+++ b/arch/arm/plat-omap/include/plat/am33xx.h
@@ -30,6 +30,9 @@
#define AM33XX_TSC_BASE 0x44E0D000
#define AM33XX_RTC_BASE 0x44E3E000
+#define AM33XX_D_CAN0_BASE 0x481CC000
+#define AM33XX_D_CAN1_BASE 0x481D0000
+
#define AM33XX_ASP0_BASE 0x48038000
#define AM33XX_ASP1_BASE 0x4803C000
--
1.7.2.5
@@ -1,57 +0,0 @@
From 68a9166b306c9b7a542a8ddcf31cc5fa738f52b3 Mon Sep 17 00:00:00 2001
From: Anil Kumar Ch <anilkumar@ti.com>
Date: Sun, 6 Nov 2011 10:44:26 +0530
Subject: [PATCH 3/7] can: d_can: DCAN config added to am335x_evm_defconfig
This patch adds the DCAN and dependent modules configurations
to am335x_evm_defconfig
Dependent modules are:
CONFIG_CAN_RAW
CONFIG_CAN_BCM
Signed-off-by: Anil Kumar Ch <anilkumar@ti.com>
---
arch/arm/configs/am335x_evm_defconfig | 26 +++++++++++++++++++++++++-
1 files changed, 25 insertions(+), 1 deletions(-)
diff --git a/arch/arm/configs/am335x_evm_defconfig b/arch/arm/configs/am335x_evm_defconfig
index 02ee0c3..a90dffd 100644
--- a/arch/arm/configs/am335x_evm_defconfig
+++ b/arch/arm/configs/am335x_evm_defconfig
@@ -658,7 +658,31 @@ CONFIG_DNS_RESOLVER=y
#
# CONFIG_NET_PKTGEN is not set
# CONFIG_HAMRADIO is not set
-# CONFIG_CAN is not set
+CONFIG_CAN=y
+CONFIG_CAN_RAW=y
+CONFIG_CAN_BCM=y
+
+#
+# CAN Device Drivers
+#
+# CONFIG_CAN_VCAN is not set
+# CONFIG_CAN_SLCAN is not set
+CONFIG_CAN_DEV=y
+CONFIG_CAN_CALC_BITTIMING=y
+# CONFIG_CAN_TI_HECC is not set
+# CONFIG_CAN_MCP251X is not set
+# CONFIG_CAN_SJA1000 is not set
+# CONFIG_CAN_C_CAN is not set
+CONFIG_CAN_D_CAN=y
+CONFIG_CAN_D_CAN_PLATFORM=y
+
+#
+# CAN USB interfaces
+#
+# CONFIG_CAN_EMS_USB is not set
+# CONFIG_CAN_ESD_USB2 is not set
+# CONFIG_CAN_SOFTING is not set
+# CONFIG_CAN_DEBUG_DEVICES is not set
# CONFIG_IRDA is not set
CONFIG_BT=y
CONFIG_BT_L2CAP=y
--
1.7.2.5
@@ -1,49 +0,0 @@
From 3788f8da920468db766e5e8ec03785d2fc2c8f12 Mon Sep 17 00:00:00 2001
From: Anil Kumar Ch <anilkumar@ti.com>
Date: Thu, 10 Nov 2011 12:36:12 +0530
Subject: [PATCH 4/7] can: d_can: fix for cansend loop issue
The specified number of packets are not transmitting with the
help of cansend --loop=10. This pacth fixes the issue and able
to transmit upto 32 packets. This limitation is because of no.
of objects availability on AM335X
Signed-off-by: Anil Kumar Ch <anilkumar@ti.com>
---
drivers/net/can/d_can/d_can.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/net/can/d_can/d_can.c b/drivers/net/can/d_can/d_can.c
index e001db0..d31b019 100644
--- a/drivers/net/can/d_can/d_can.c
+++ b/drivers/net/can/d_can/d_can.c
@@ -611,7 +611,7 @@ static inline int d_can_is_next_tx_obj_busy(struct d_can_priv *priv, int objno)
* message object n, we need to handle the same properly.
*/
if (d_can_read(priv, D_CAN_TXRQ(txrq_x_reg_val)) &
- (1 << (objno - 1)))
+ (1 << (objno - D_CAN_MSG_OBJ_TX_FIRST)))
return 1;
return 0;
@@ -858,7 +858,8 @@ static void d_can_do_tx(struct net_device *dev)
msg_obj_no = get_tx_echo_msg_obj(priv);
txrq_x_reg_val = D_CAN_GET_XREG_NUM(priv, D_CAN_TXRQ_X);
txrq_reg_val = d_can_read(priv, D_CAN_TXRQ(txrq_x_reg_val));
- if (!(txrq_reg_val & (1 << (msg_obj_no - 1)))) {
+ if (!(txrq_reg_val & (1 << (msg_obj_no -
+ D_CAN_MSG_OBJ_TX_FIRST)))) {
can_get_echo_skb(dev,
msg_obj_no - D_CAN_MSG_OBJ_TX_FIRST);
stats->tx_bytes += d_can_read(priv,
@@ -1124,7 +1125,6 @@ static int d_can_poll(struct napi_struct *napi, int quota)
struct net_device *dev = napi->dev;
struct d_can_priv *priv = netdev_priv(dev);
- priv->irqstatus = d_can_read(priv, D_CAN_INT);
if (!priv->irqstatus)
goto end;
--
1.7.2.5
@@ -1,60 +0,0 @@
From 332ec54d00463875532584604f364fc4347d918b Mon Sep 17 00:00:00 2001
From: Anil Kumar Ch <anilkumar@ti.com>
Date: Thu, 10 Nov 2011 17:59:16 +0530
Subject: [PATCH 5/7] can: d_can: fixes the rmmod crash
This patch fixes the rmmod crash while unloading the
DCAN driver from the kernel.
Signed-off-by: Anil Kumar Ch <anilkumar@ti.com>
---
drivers/net/can/d_can/d_can_platform.c | 11 +++++------
1 files changed, 5 insertions(+), 6 deletions(-)
diff --git a/drivers/net/can/d_can/d_can_platform.c b/drivers/net/can/d_can/d_can_platform.c
index b430a18..859756b 100644
--- a/drivers/net/can/d_can/d_can_platform.c
+++ b/drivers/net/can/d_can/d_can_platform.c
@@ -190,7 +190,6 @@ exit_iounmap:
exit_release_mem:
release_mem_region(mem->start, resource_size(mem));
exit_free_clks:
-#ifdef CONFIG_HAVE_CLK
clk_disable(priv->ick);
clk_put(priv->ick);
exit_free_fck:
@@ -199,7 +198,6 @@ exit_free_fck:
exit_free_ndev:
free_d_can_dev(ndev);
exit:
-#endif
dev_err(&pdev->dev, "probe failed\n");
return ret;
@@ -211,18 +209,19 @@ static int __devexit d_can_plat_remove(struct platform_device *pdev)
struct d_can_priv *priv = netdev_priv(ndev);
struct resource *mem;
+ unregister_d_can_dev(ndev);
+ platform_set_drvdata(pdev, NULL);
+
free_d_can_dev(ndev);
iounmap(priv->base);
+
mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
release_mem_region(mem->start, resource_size(mem));
-#ifdef CONFIG_HAVE_CLK
+
clk_disable(priv->ick);
clk_disable(priv->fck);
clk_put(priv->ick);
clk_put(priv->fck);
-#endif
- unregister_d_can_dev(ndev);
- platform_set_drvdata(pdev, NULL);
return 0;
}
--
1.7.2.5
@@ -1,47 +0,0 @@
From 0aea3e2629cd1681d8d8e6e0a4409959b31ea4e9 Mon Sep 17 00:00:00 2001
From: Anil Kumar Ch <anilkumar@ti.com>
Date: Thu, 10 Nov 2011 15:21:47 +0100
Subject: [PATCH 7/7] can: d_can: am335x profile modification for dcan0
This patch modifies the profile information of am335x device.
Profile reads of cpld_client from smbus gives an error leads to put
the device into default profile 0. So by default the board configured
to beaglebone even if we set the sw8 switch on daughter card to other
profiles.
This patch makes all the IO connecters are configured in profile 1.
Signed-off-by: Anil Kumar Ch <anilkumar@ti.com>
---
arch/arm/mach-omap2/board-am335xevm.c | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/arch/arm/mach-omap2/board-am335xevm.c b/arch/arm/mach-omap2/board-am335xevm.c
index 590c4ca..ac64fc7 100644
--- a/arch/arm/mach-omap2/board-am335xevm.c
+++ b/arch/arm/mach-omap2/board-am335xevm.c
@@ -340,6 +340,9 @@ static u32 am335x_get_profile_selection(void)
{
int val = 0;
+ /* FIXME: temporary fix */
+ return 1;
+
if (!cpld_client)
/* error checking is not done in func's calling this routine.
so return profile 0 on error */
@@ -1721,8 +1724,8 @@ out:
*/
pr_err("Could not detect any board, falling back to: "
"Beaglebone (< Rev A3) with no daughter card connected\n");
- daughter_brd_detected = false;
- setup_beaglebone_old();
+ daughter_brd_detected = true;
+ setup_general_purpose_evm();
/* Initialize cpsw after board detection is completed as board
* information is required for configuring phy address and hence
--
1.7.2.5
@@ -1,31 +0,0 @@
From cad762e20178949527118629d7cf1298e38658f2 Mon Sep 17 00:00:00 2001
From: Steve Kipisz <s-kipisz2@ti.com>
Date: Tue, 15 Nov 2011 10:47:40 -0600
Subject: [PATCH 1/3] arm:omap:mux33xx: Add i2c2 pin muix
Signed-off-by: Steve Kipisz <s-kipisz2@ti.com>
Signed-off-by: Koen Kooi <koen@dominion.thruhere.net>
---
arch/arm/mach-omap2/mux33xx.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/arm/mach-omap2/mux33xx.c b/arch/arm/mach-omap2/mux33xx.c
index 4399003..06719df 100644
--- a/arch/arm/mach-omap2/mux33xx.c
+++ b/arch/arm/mach-omap2/mux33xx.c
@@ -315,10 +315,10 @@ static struct omap_mux __initdata am33xx_muxmodes[] = {
"uart0_txd", "spi1_cs1", NULL, NULL,
NULL, NULL, NULL, NULL),
_AM33XX_MUXENTRY(UART1_CTSN, 0,
- "uart1_ctsn", NULL, "d_can0_tx", NULL,
+ "uart1_ctsn", NULL, "d_can0_tx", "i2c2_sda",
"spi1_cs0", NULL, NULL, NULL),
_AM33XX_MUXENTRY(UART1_RTSN, 0,
- "uart1_rtsn", NULL, "d_can0_rx", NULL,
+ "uart1_rtsn", NULL, "d_can0_rx", "i2c2_scl",
"spi1_cs1", NULL, NULL, NULL),
_AM33XX_MUXENTRY(UART1_RXD, 0,
"uart1_rxd", "mmc1_sdwp", "d_can1_tx", NULL,
--
1.7.2.5
@@ -1,89 +0,0 @@
From 9d84b7ca76f00fc71a2fb4e32f4a172b0dd95b0d Mon Sep 17 00:00:00 2001
From: Steve Kipisz <s-kipisz2@ti.com>
Date: Wed, 16 Nov 2011 07:23:37 -0600
Subject: [PATCH 2/3] omap:hwmod:33xx: Add support for third i2c bus
Signed-off-by: Steve Kipisz <s-kipisz2@ti.com>
Signed-off-by: Koen Kooi <koen@dominion.thruhere.net>
---
arch/arm/mach-omap2/omap_hwmod_33xx_data.c | 50 ++++++++++++++++++++++++++++
1 files changed, 50 insertions(+), 0 deletions(-)
diff --git a/arch/arm/mach-omap2/omap_hwmod_33xx_data.c b/arch/arm/mach-omap2/omap_hwmod_33xx_data.c
index cad59f0e..663bd26 100644
--- a/arch/arm/mach-omap2/omap_hwmod_33xx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_33xx_data.c
@@ -59,6 +59,7 @@ static struct omap_hwmod am33xx_gpio2_hwmod;
static struct omap_hwmod am33xx_gpio3_hwmod;
static struct omap_hwmod am33xx_i2c1_hwmod;
static struct omap_hwmod am33xx_i2c2_hwmod;
+static struct omap_hwmod am33xx_i2c3_hwmod;
static struct omap_hwmod am33xx_usbss_hwmod;
static struct omap_hwmod am33xx_mmc0_hwmod;
static struct omap_hwmod am33xx_mmc1_hwmod;
@@ -800,6 +801,54 @@ static struct omap_hwmod am33xx_i2c2_hwmod = {
.class = &i2c_class,
};
+/* i2c3 */
+/* l4 per -> i2c3 */
+static struct omap_hwmod_addr_space am33xx_i2c3_addr_space[] = {
+ {
+ .pa_start = 0x4819C000,
+ .pa_end = 0x4819C000 + SZ_4K - 1,
+ .flags = ADDR_MAP_ON_INIT | ADDR_TYPE_RT,
+ },
+};
+
+static struct omap_hwmod_ocp_if am335_l4_per_i2c3 = {
+ .master = &am33xx_l4per_hwmod,
+ .slave = &am33xx_i2c3_hwmod,
+ .addr = am33xx_i2c3_addr_space,
+ .user = OCP_USER_MPU,
+};
+
+static struct omap_hwmod_irq_info i2c3_mpu_irqs[] = {
+ { .irq = 30 },
+ { .irq = -1 }
+};
+
+static struct omap_hwmod_dma_info i2c3_edma_reqs[] = {
+ { .name = "tx", .dma_req = 0, },
+ { .name = "rx", .dma_req = 0, },
+};
+
+static struct omap_hwmod_ocp_if *am33xx_i2c3_slaves[] = {
+ &am335_l4_per_i2c3,
+};
+
+static struct omap_hwmod am33xx_i2c3_hwmod = {
+ .name = "i2c3",
+ .mpu_irqs = i2c3_mpu_irqs,
+ .sdma_reqs = i2c3_edma_reqs,
+ .main_clk = "i2c3_fck",
+ .clkdm_name = "l4ls_clkdm",
+ .prcm = {
+ .omap4 = {
+ .clkctrl_offs = AM33XX_CM_PER_I2C2_CLKCTRL_OFFSET,
+ .modulemode = MODULEMODE_SWCTRL,
+ },
+ },
+ .slaves = am33xx_i2c3_slaves,
+ .slaves_cnt = ARRAY_SIZE(am33xx_i2c3_slaves),
+ .class = &i2c_class,
+};
+
/* 'icss' class */
static struct omap_hwmod_class am33xx_icss_hwmod_class = {
.name = "icss",
@@ -2430,6 +2479,7 @@ static __initdata struct omap_hwmod *am33xx_hwmods[] = {
/* i2c class */
&am33xx_i2c1_hwmod,
&am33xx_i2c2_hwmod,
+ &am33xx_i2c3_hwmod,
/* icss class */
&am33xx_icss_hwmod,
/* ieee5000 class */
--
1.7.2.5
@@ -1,74 +0,0 @@
From 167a775857838679d6d9465587af8ba1bd8c97bd Mon Sep 17 00:00:00 2001
From: Steve Kipisz <s-kipisz2@ti.com>
Date: Wed, 16 Nov 2011 07:25:14 -0600
Subject: [PATCH 3/3] arm:omap:board: Add quick hack to get i2c2 bus support
* Only added aic address so that i2ctools can be used at runtime
to query eeprom and EDID, just to make sure i2c2 is working.
Signed-off-by: Steve Kipisz <s-kipisz2@ti.com>
Signed-off-by: Koen Kooi <koen@dominion.thruhere.net>
---
arch/arm/mach-omap2/board-am335xevm.c | 25 +++++++++++++++++++++++++
1 files changed, 25 insertions(+), 0 deletions(-)
diff --git a/arch/arm/mach-omap2/board-am335xevm.c b/arch/arm/mach-omap2/board-am335xevm.c
index 590c4ca..b27fb97 100644
--- a/arch/arm/mach-omap2/board-am335xevm.c
+++ b/arch/arm/mach-omap2/board-am335xevm.c
@@ -582,6 +582,14 @@ static struct pinmux_config i2c1_pin_mux[] = {
{NULL, 0},
};
+static struct pinmux_config i2c2_pin_mux[] = {
+ {"uart1_ctsn.i2c2_sda", OMAP_MUX_MODE3 | AM33XX_SLEWCTRL_SLOW |
+ AM33XX_PULL_ENBL | AM33XX_INPUT_EN},
+ {"uart1_rtsn.i2c2_scl", OMAP_MUX_MODE3 | AM33XX_SLEWCTRL_SLOW |
+ AM33XX_PULL_ENBL | AM33XX_INPUT_EN},
+ {NULL, 0},
+};
+
/* Module pin mux for mcasp1 */
static struct pinmux_config mcasp1_pin_mux[] = {
{"mii1_crs.mcasp1_aclkx", OMAP_MUX_MODE4 | AM33XX_PIN_INPUT_PULLDOWN},
@@ -1107,6 +1115,21 @@ static void i2c1_init(int evm_id, int profile)
return;
}
+/* There will be more additions to this board_info over time. */
+static struct i2c_board_info beaglebone_i2c_boardinfo2[] = {
+ {
+ I2C_BOARD_INFO("tlv320aic3x", 0x1b),
+ },
+};
+
+static void i2c2_init(int evm_id, int profile)
+{
+ setup_pin_mux(i2c2_pin_mux);
+ omap_register_i2c_bus(3, 100, beaglebone_i2c_boardinfo2,
+ ARRAY_SIZE(beaglebone_i2c_boardinfo2));
+ return;
+}
+
/* Setup McASP 1 */
static void mcasp1_init(int evm_id, int profile)
{
@@ -1529,6 +1552,7 @@ static struct evm_dev_cfg beaglebone_old_dev_cfg[] = {
{dvi_init, DEV_ON_BASEBOARD, PROFILE_ALL},
{usb0_init, DEV_ON_BASEBOARD, PROFILE_NONE},
{usb1_init, DEV_ON_BASEBOARD, PROFILE_NONE},
+ {i2c2_init, DEV_ON_BASEBOARD, PROFILE_NONE},
{mmc0_init, DEV_ON_BASEBOARD, PROFILE_NONE},
{boneleds_init, DEV_ON_BASEBOARD, PROFILE_ALL},
{NULL, 0, 0},
@@ -1540,6 +1564,7 @@ static struct evm_dev_cfg beaglebone_dev_cfg[] = {
{dvi_init, DEV_ON_BASEBOARD, PROFILE_ALL},
{usb0_init, DEV_ON_BASEBOARD, PROFILE_NONE},
{usb1_init, DEV_ON_BASEBOARD, PROFILE_NONE},
+ {i2c2_init, DEV_ON_BASEBOARD, PROFILE_NONE},
{mmc0_init, DEV_ON_BASEBOARD, PROFILE_NONE},
{boneleds_init, DEV_ON_BASEBOARD, PROFILE_ALL},
{NULL, 0, 0},
--
1.7.2.5
@@ -1,667 +0,0 @@
From a99fbc0639e6c42cd7c53c8d1d4852d04e9f8bb1 Mon Sep 17 00:00:00 2001
From: Matt Porter <mporter@ti.com>
Date: Mon, 21 Nov 2011 12:55:23 -0500
Subject: [PATCH 1/2] st7735fb: WIP framebuffer driver supporting Adafruit 1.8" SPI LCD
Signed-off-by: Matt Porter <mporter@ti.com>
Signed-off-by: Koen Kooi <koen@dominion.thruhere.net>
---
drivers/video/Kconfig | 11 +
drivers/video/Makefile | 1 +
drivers/video/st7735fb.c | 516 ++++++++++++++++++++++++++++++++++++++++++++++
include/video/st7735fb.h | 86 ++++++++
4 files changed, 614 insertions(+), 0 deletions(-)
create mode 100644 drivers/video/st7735fb.c
create mode 100644 include/video/st7735fb.h
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
index 792b7841..4ac5eb1 100644
--- a/drivers/video/Kconfig
+++ b/drivers/video/Kconfig
@@ -2394,6 +2394,17 @@ config FB_PUV3_UNIGFX
Choose this option if you want to use the Unigfx device as a
framebuffer device. Without the support of PCI & AGP.
+config FB_ST7735
+ tristate "ST7735 framebuffer support"
+ depends on FB && SPI
+ select FB_SYS_FILLRECT
+ select FB_SYS_COPYAREA
+ select FB_SYS_IMAGEBLIT
+ select FB_SYS_FOPS
+ select FB_DEFERRED_IO
+ help
+ Framebuffer support for the ST7735 display controller in SPI mode.
+
source "drivers/video/omap/Kconfig"
source "drivers/video/omap2/Kconfig"
diff --git a/drivers/video/Makefile b/drivers/video/Makefile
index 8b83129..6b67f05 100644
--- a/drivers/video/Makefile
+++ b/drivers/video/Makefile
@@ -141,6 +141,7 @@ obj-$(CONFIG_FB_MSM) += msm/
obj-$(CONFIG_FB_NUC900) += nuc900fb.o
obj-$(CONFIG_FB_JZ4740) += jz4740_fb.o
obj-$(CONFIG_FB_PUV3_UNIGFX) += fb-puv3.o
+obj-$(CONFIG_FB_ST7735) += st7735fb.o
# Platform or fallback drivers go here
obj-$(CONFIG_FB_UVESA) += uvesafb.o
diff --git a/drivers/video/st7735fb.c b/drivers/video/st7735fb.c
new file mode 100644
index 0000000..500cc88
--- /dev/null
+++ b/drivers/video/st7735fb.c
@@ -0,0 +1,516 @@
+/*
+ * linux/drivers/video/st7735fb.c -- FB driver for ST7735 LCD controller
+ * Layout is based on skeletonfb.c by James Simmons and Geert Uytterhoeven.
+ *
+ * Copyright (C) 2011, Matt Porter
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License. See the file COPYING in the main directory of this archive for
+ * more details.
+ */
+
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/errno.h>
+#include <linux/string.h>
+#include <linux/mm.h>
+#include <linux/vmalloc.h>
+#include <linux/slab.h>
+#include <linux/init.h>
+#include <linux/fb.h>
+#include <linux/gpio.h>
+#include <linux/spi/spi.h>
+#include <linux/delay.h>
+#include <linux/uaccess.h>
+
+#include <video/st7735fb.h>
+
+static struct st7735_function st7735_cfg_script[] = {
+ { ST7735_START, ST7735_START},
+ { ST7735_CMD, ST7735_SWRESET},
+ { ST7735_DELAY, 150},
+ { ST7735_CMD, ST7735_SLPOUT},
+ { ST7735_DELAY, 500},
+ { ST7735_CMD, ST7735_FRMCTR1},
+ { ST7735_DATA, 0x01},
+ { ST7735_DATA, 0x2c},
+ { ST7735_DATA, 0x2d},
+ { ST7735_CMD, ST7735_FRMCTR2},
+ { ST7735_DATA, 0x01},
+ { ST7735_DATA, 0x2c},
+ { ST7735_DATA, 0x2d},
+ { ST7735_CMD, ST7735_FRMCTR3},
+ { ST7735_DATA, 0x01},
+ { ST7735_DATA, 0x2c},
+ { ST7735_DATA, 0x2d},
+ { ST7735_DATA, 0x01},
+ { ST7735_DATA, 0x2c},
+ { ST7735_DATA, 0x2d},
+ { ST7735_CMD, ST7735_INVCTR},
+ { ST7735_DATA, 0x07},
+ { ST7735_CMD, ST7735_PWCTR1},
+ { ST7735_DATA, 0xa2},
+ { ST7735_DATA, 0x02},
+ { ST7735_DATA, 0x84},
+ { ST7735_CMD, ST7735_PWCTR2},
+ { ST7735_DATA, 0xc5},
+ { ST7735_CMD, ST7735_PWCTR3},
+ { ST7735_DATA, 0x0a},
+ { ST7735_DATA, 0x00},
+ { ST7735_CMD, ST7735_PWCTR4},
+ { ST7735_DATA, 0x8a},
+ { ST7735_DATA, 0x2a},
+ { ST7735_CMD, ST7735_PWCTR5},
+ { ST7735_DATA, 0x8a},
+ { ST7735_DATA, 0xee},
+ { ST7735_CMD, ST7735_VMCTR1},
+ { ST7735_DATA, 0x0e},
+ { ST7735_CMD, ST7735_INVOFF},
+ { ST7735_CMD, ST7735_MADCTL},
+ { ST7735_DATA, 0xc8},
+ { ST7735_CMD, ST7735_COLMOD},
+ { ST7735_DATA, 0x05},
+ { ST7735_CMD, ST7735_CASET},
+ { ST7735_DATA, 0x00},
+ { ST7735_DATA, 0x00},
+ { ST7735_DATA, 0x00},
+ { ST7735_DATA, 0x00},
+ { ST7735_DATA, 0x7f},
+ { ST7735_CMD, ST7735_RASET},
+ { ST7735_DATA, 0x00},
+ { ST7735_DATA, 0x00},
+ { ST7735_DATA, 0x00},
+ { ST7735_DATA, 0x00},
+ { ST7735_DATA, 0x9f},
+ { ST7735_CMD, ST7735_GMCTRP1},
+ { ST7735_DATA, 0x02},
+ { ST7735_DATA, 0x1c},
+ { ST7735_DATA, 0x07},
+ { ST7735_DATA, 0x12},
+ { ST7735_DATA, 0x37},
+ { ST7735_DATA, 0x32},
+ { ST7735_DATA, 0x29},
+ { ST7735_DATA, 0x2d},
+ { ST7735_DATA, 0x29},
+ { ST7735_DATA, 0x25},
+ { ST7735_DATA, 0x2b},
+ { ST7735_DATA, 0x39},
+ { ST7735_DATA, 0x00},
+ { ST7735_DATA, 0x01},
+ { ST7735_DATA, 0x03},
+ { ST7735_DATA, 0x10},
+ { ST7735_CMD, ST7735_GMCTRN1},
+ { ST7735_DATA, 0x03},
+ { ST7735_DATA, 0x1d},
+ { ST7735_DATA, 0x07},
+ { ST7735_DATA, 0x06},
+ { ST7735_DATA, 0x2e},
+ { ST7735_DATA, 0x2c},
+ { ST7735_DATA, 0x29},
+ { ST7735_DATA, 0x2d},
+ { ST7735_DATA, 0x2e},
+ { ST7735_DATA, 0x2e},
+ { ST7735_DATA, 0x37},
+ { ST7735_DATA, 0x3f},
+ { ST7735_DATA, 0x00},
+ { ST7735_DATA, 0x00},
+ { ST7735_DATA, 0x02},
+ { ST7735_DATA, 0x10},
+ { ST7735_CMD, ST7735_DISPON},
+ { ST7735_DELAY, 100},
+ { ST7735_CMD, ST7735_NORON},
+ { ST7735_DELAY, 10},
+ { ST7735_END, ST7735_END},
+};
+
+static struct fb_fix_screeninfo st7735fb_fix __devinitdata = {
+ .id = "ST7735",
+ .type = FB_TYPE_PACKED_PIXELS,
+ .visual = FB_VISUAL_PSEUDOCOLOR,
+ .xpanstep = 0,
+ .ypanstep = 0,
+ .ywrapstep = 0,
+ .line_length = WIDTH*BPP/8,
+ .accel = FB_ACCEL_NONE,
+};
+
+static struct fb_var_screeninfo st7735fb_var __devinitdata = {
+ .xres = WIDTH,
+ .yres = HEIGHT,
+ .xres_virtual = WIDTH,
+ .yres_virtual = HEIGHT,
+ .bits_per_pixel = BPP,
+ .nonstd = 1,
+};
+
+static int st7735_write(struct st7735fb_par *par, u8 data)
+{
+ u8 txbuf[2]; /* allocation from stack must go */
+
+ txbuf[0] = data;
+
+ return spi_write(par->spi, &txbuf[0], 1);
+}
+
+static void st7735_write_data(struct st7735fb_par *par, u8 data)
+{
+ int ret = 0;
+
+ /* Set data mode */
+ gpio_set_value(par->dc, 1);
+
+ ret = st7735_write(par, data);
+ if (ret < 0)
+ pr_err("%s: write data %02x failed with status %d\n",
+ par->info->fix.id, data, ret);
+}
+
+static int st7735_write_data_buf(struct st7735fb_par *par,
+ u8 *txbuf, int size)
+{
+ /* Set data mode */
+ gpio_set_value(par->dc, 1);
+
+ /* Write entire buffer */
+ return spi_write(par->spi, txbuf, size);
+}
+
+static void st7735_write_cmd(struct st7735fb_par *par, u8 data)
+{
+ int ret = 0;
+
+ /* Set command mode */
+ gpio_set_value(par->dc, 0);
+
+ ret = st7735_write(par, data);
+ if (ret < 0)
+ pr_err("%s: write command %02x failed with status %d\n",
+ par->info->fix.id, data, ret);
+}
+
+static void st7735_run_cfg_script(struct st7735fb_par *par)
+{
+ int i = 0;
+ int end_script = 0;
+
+ do {
+ switch (st7735_cfg_script[i].cmd)
+ {
+ case ST7735_START:
+ break;
+ case ST7735_CMD:
+ st7735_write_cmd(par,
+ st7735_cfg_script[i].data & 0xff);
+ break;
+ case ST7735_DATA:
+ st7735_write_data(par,
+ st7735_cfg_script[i].data & 0xff);
+ break;
+ case ST7735_DELAY:
+ mdelay(st7735_cfg_script[i].data);
+ break;
+ case ST7735_END:
+ end_script = 1;
+ }
+ i++;
+ } while (!end_script);
+}
+
+static void st7735_set_addr_win(struct st7735fb_par *par,
+ int xs, int ys, int xe, int ye)
+{
+ st7735_write_cmd(par, ST7735_CASET);
+ st7735_write_data(par, 0x00);
+ st7735_write_data(par, xs+2);
+ st7735_write_data(par, 0x00);
+ st7735_write_data(par, xe+2);
+ st7735_write_cmd(par, ST7735_RASET);
+ st7735_write_data(par, 0x00);
+ st7735_write_data(par, ys+1);
+ st7735_write_data(par, 0x00);
+ st7735_write_data(par, ye+1);
+}
+
+static void st7735_reset(struct st7735fb_par *par)
+{
+ /* Reset controller */
+ gpio_set_value(par->rst, 0);
+ udelay(10);
+ gpio_set_value(par->rst, 1);
+ mdelay(120);
+}
+
+static void st7735fb_update_display(struct st7735fb_par *par)
+{
+ int ret = 0;
+ u8 *vmem = par->info->screen_base;
+
+ /*
+ TODO:
+ Allow a subset of pages to be passed in
+ (for deferred I/O). Check pages against
+ pan display settings to see if they
+ should be updated.
+ */
+ /* For now, just write the full 40KiB on each update */
+
+ /* Set row/column data window */
+ st7735_set_addr_win(par, 0, 0, WIDTH-1, HEIGHT-1);
+
+ /* Internal RAM write command */
+ st7735_write_cmd(par, ST7735_RAMWR);
+
+ /* Blast framebuffer to ST7735 internal display RAM */
+ ret = st7735_write_data_buf(par, vmem, WIDTH*HEIGHT*BPP/8);
+ if (ret < 0)
+ pr_err("%s: spi_write failed to update display buffer\n",
+ par->info->fix.id);
+}
+
+static void st7735fb_deferred_io(struct fb_info *info,
+ struct list_head *pagelist)
+{
+ st7735fb_update_display(info->par);
+}
+
+static int st7735fb_init_display(struct st7735fb_par *par)
+{
+ /* TODO: Need some error checking on gpios */
+
+ /* Request GPIOs and initialize to default values */
+ gpio_request_one(par->rst, GPIOF_OUT_INIT_HIGH,
+ "ST7735 Reset Pin");
+ gpio_request_one(par->dc, GPIOF_OUT_INIT_LOW,
+ "ST7735 Data/Command Pin");
+
+ st7735_reset(par);
+
+ st7735_run_cfg_script(par);
+
+ return 0;
+}
+
+void st7735fb_fillrect(struct fb_info *info, const struct fb_fillrect *rect)
+{
+ struct st7735fb_par *par = info->par;
+
+ sys_fillrect(info, rect);
+
+ st7735fb_update_display(par);
+}
+
+void st7735fb_copyarea(struct fb_info *info, const struct fb_copyarea *area)
+{
+ struct st7735fb_par *par = info->par;
+
+ sys_copyarea(info, area);
+
+ st7735fb_update_display(par);
+}
+
+void st7735fb_imageblit(struct fb_info *info, const struct fb_image *image)
+{
+ struct st7735fb_par *par = info->par;
+
+ sys_imageblit(info, image);
+
+ st7735fb_update_display(par);
+}
+
+static ssize_t st7735fb_write(struct fb_info *info, const char __user *buf,
+ size_t count, loff_t *ppos)
+{
+ struct st7735fb_par *par = info->par;
+ unsigned long p = *ppos;
+ void *dst;
+ int err = 0;
+ unsigned long total_size;
+
+ if (info->state != FBINFO_STATE_RUNNING)
+ return -EPERM;
+
+ total_size = info->fix.smem_len;
+
+ if (p > total_size)
+ return -EFBIG;
+
+ if (count > total_size) {
+ err = -EFBIG;
+ count = total_size;
+ }
+
+ if (count + p > total_size) {
+ if (!err)
+ err = -ENOSPC;
+
+ count = total_size - p;
+ }
+
+ dst = (void __force *) (info->screen_base + p);
+
+ if (copy_from_user(dst, buf, count))
+ err = -EFAULT;
+
+ if (!err)
+ *ppos += count;
+
+ st7735fb_update_display(par);
+
+ return (err) ? err : count;
+}
+
+static struct fb_ops st7735fb_ops = {
+ .owner = THIS_MODULE,
+ .fb_read = fb_sys_read,
+ .fb_write = st7735fb_write,
+ .fb_fillrect = st7735fb_fillrect,
+ .fb_copyarea = st7735fb_copyarea,
+ .fb_imageblit = st7735fb_imageblit,
+};
+
+static struct fb_deferred_io st7735fb_defio = {
+ .delay = HZ,
+ .deferred_io = st7735fb_deferred_io,
+};
+
+static int __devinit st7735fb_probe (struct spi_device *spi)
+{
+ int chip = spi_get_device_id(spi)->driver_data;
+ struct st7735fb_platform_data *pdata = spi->dev.platform_data;
+ int vmem_size = WIDTH*HEIGHT*BPP/8;
+ u8 *vmem;
+ struct fb_info *info;
+ struct st7735fb_par *par;
+ int retval = -ENOMEM;
+
+ if (chip != ST7735_DISPLAY_AF_TFT18) {
+ pr_err("%s: only the %s device is supported\n", DRVNAME,
+ to_spi_driver(spi->dev.driver)->id_table->name);
+ return -EINVAL;
+ }
+
+ if (!pdata) {
+ pr_err("%s: platform data required for rst and dc info\n",
+ DRVNAME);
+ return -EINVAL;
+ }
+
+ vmem = vzalloc(vmem_size);
+ if (!vmem)
+ return retval;
+
+ info = framebuffer_alloc(sizeof(struct st7735fb_par), &spi->dev);
+ if (!info)
+ goto fballoc_fail;
+
+ info->screen_base = (u8 __force __iomem *)vmem;
+ info->fbops = &st7735fb_ops;
+ info->fix = st7735fb_fix;
+ info->fix.smem_len = vmem_size;
+ info->var = st7735fb_var;
+ /* Choose any packed pixel format as long as it's RGB565 */
+ info->var.red.offset = 11;
+ info->var.red.length = 5;
+ info->var.green.offset = 5;
+ info->var.green.length = 6;
+ info->var.blue.offset = 0;
+ info->var.blue.length = 5;
+ info->var.transp.offset = 0;
+ info->var.transp.length = 0;
+ info->flags = FBINFO_FLAG_DEFAULT |
+#ifdef __LITTLE_ENDIAN
+ FBINFO_FOREIGN_ENDIAN |
+#endif
+ FBINFO_VIRTFB;
+
+ info->fbdefio = &st7735fb_defio;
+ fb_deferred_io_init(info);
+
+ par = info->par;
+ par->info = info;
+ par->spi = spi;
+ par->rst = pdata->rst_gpio;
+ par->dc = pdata->dc_gpio;
+
+ retval = register_framebuffer(info);
+ if (retval < 0)
+ goto fbreg_fail;
+
+ spi_set_drvdata(spi, info);
+
+ retval = st7735fb_init_display(par);
+ if (retval < 0)
+ goto init_fail;
+
+ printk(KERN_INFO
+ "fb%d: %s frame buffer device,\n\tusing %d KiB of video memory\n",
+ info->node, info->fix.id, vmem_size);
+
+ return 0;
+
+
+ /* TODO: release gpios on fail */
+init_fail:
+ spi_set_drvdata(spi, NULL);
+
+fbreg_fail:
+ framebuffer_release(info);
+
+fballoc_fail:
+ vfree(vmem);
+
+ return retval;
+}
+
+static int __devexit st7735fb_remove(struct spi_device *spi)
+{
+ struct fb_info *info = spi_get_drvdata(spi);
+
+ spi_set_drvdata(spi, NULL);
+
+ if (info) {
+ unregister_framebuffer(info);
+ vfree(info->screen_base);
+ framebuffer_release(info);
+ }
+
+ /* TODO: release gpios */
+
+ return 0;
+}
+
+static const struct spi_device_id st7735fb_ids[] = {
+ { "adafruit_tft18", ST7735_DISPLAY_AF_TFT18 },
+ { },
+};
+
+MODULE_DEVICE_TABLE(spi, st7735fb_ids);
+
+static struct spi_driver st7735fb_driver = {
+ .driver = {
+ .name = "st7735fb",
+ .owner = THIS_MODULE,
+ },
+ .id_table = st7735fb_ids,
+ .probe = st7735fb_probe,
+ .remove = __devexit_p(st7735fb_remove),
+};
+
+static int __init st7735fb_init(void)
+{
+ return spi_register_driver(&st7735fb_driver);
+}
+
+static void __exit st7735fb_exit(void)
+{
+ spi_unregister_driver(&st7735fb_driver);
+}
+
+/* ------------------------------------------------------------------------- */
+
+module_init(st7735fb_init);
+module_exit(st7735fb_exit);
+
+MODULE_DESCRIPTION("FB driver for ST7735 display controller");
+MODULE_AUTHOR("Matt Porter");
+MODULE_LICENSE("GPL");
diff --git a/include/video/st7735fb.h b/include/video/st7735fb.h
new file mode 100644
index 0000000..250f036
--- /dev/null
+++ b/include/video/st7735fb.h
@@ -0,0 +1,86 @@
+/*
+ * linux/include/video/st7735fb.h -- FB driver for ST7735 LCD controller
+ *
+ * Copyright (C) 2011, Matt Porter
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License. See the file COPYING in the main directory of this archive for
+ * more details.
+ */
+
+#define DRVNAME "st7735fb"
+#define WIDTH 128
+#define HEIGHT 160
+#define BPP 16
+
+/* Supported display modules */
+#define ST7735_DISPLAY_AF_TFT18 0 /* Adafruit SPI TFT 1.8" */
+
+/* Init script function */
+struct st7735_function {
+ u16 cmd;
+ u16 data;
+};
+
+/* Init script commands */
+enum st7735_cmd {
+ ST7735_START,
+ ST7735_END,
+ ST7735_CMD,
+ ST7735_DATA,
+ ST7735_DELAY
+};
+
+struct st7735fb_par {
+ struct spi_device *spi;
+ struct fb_info *info;
+ int rst;
+ int dc;
+};
+
+struct st7735fb_platform_data {
+ int rst_gpio;
+ int dc_gpio;
+};
+
+/* ST7735 Commands */
+#define ST7735_NOP 0x0
+#define ST7735_SWRESET 0x01
+#define ST7735_RDDID 0x04
+#define ST7735_RDDST 0x09
+#define ST7735_SLPIN 0x10
+#define ST7735_SLPOUT 0x11
+#define ST7735_PTLON 0x12
+#define ST7735_NORON 0x13
+#define ST7735_INVOFF 0x20
+#define ST7735_INVON 0x21
+#define ST7735_DISPOFF 0x28
+#define ST7735_DISPON 0x29
+#define ST7735_CASET 0x2A
+#define ST7735_RASET 0x2B
+#define ST7735_RAMWR 0x2C
+#define ST7735_RAMRD 0x2E
+#define ST7735_COLMOD 0x3A
+#define ST7735_MADCTL 0x36
+#define ST7735_FRMCTR1 0xB1
+#define ST7735_FRMCTR2 0xB2
+#define ST7735_FRMCTR3 0xB3
+#define ST7735_INVCTR 0xB4
+#define ST7735_DISSET5 0xB6
+#define ST7735_PWCTR1 0xC0
+#define ST7735_PWCTR2 0xC1
+#define ST7735_PWCTR3 0xC2
+#define ST7735_PWCTR4 0xC3
+#define ST7735_PWCTR5 0xC4
+#define ST7735_VMCTR1 0xC5
+#define ST7735_RDID1 0xDA
+#define ST7735_RDID2 0xDB
+#define ST7735_RDID3 0xDC
+#define ST7735_RDID4 0xDD
+#define ST7735_GMCTRP1 0xE0
+#define ST7735_GMCTRN1 0xE1
+#define ST7735_PWCTR6 0xFC
+
+
+
+
--
1.7.2.5
@@ -1,73 +0,0 @@
From dd3f24640c209d8186010dbf2bbabe11f3eb52ce Mon Sep 17 00:00:00 2001
From: Matt Porter <mporter@ti.com>
Date: Mon, 21 Nov 2011 12:56:52 -0500
Subject: [PATCH 2/2] beaglebone: hack in support for the WIP st7735fb driver
Signed-off-by: Matt Porter <mporter@ti.com>
---
arch/arm/mach-omap2/board-am335xevm.c | 28 ++++++++++++++++++++++++++++
1 files changed, 28 insertions(+), 0 deletions(-)
diff --git a/arch/arm/mach-omap2/board-am335xevm.c b/arch/arm/mach-omap2/board-am335xevm.c
index b27fb97..f049aad 100644
--- a/arch/arm/mach-omap2/board-am335xevm.c
+++ b/arch/arm/mach-omap2/board-am335xevm.c
@@ -51,6 +51,7 @@
/* LCD controller is similar to DA850 */
#include <video/da8xx-fb.h>
+#include <video/st7735fb.h>
#include "control.h"
#include "board-flash.h"
@@ -1094,6 +1095,23 @@ static struct spi_board_info am335x_spi1_slave_info[] = {
},
};
+static const struct st7735fb_platform_data bone_st7735fb_data = {
+ .rst_gpio = GPIO_TO_PIN(3, 19),
+ .dc_gpio = GPIO_TO_PIN(3, 21),
+};
+
+static struct spi_board_info bone_spi1_slave_info[] = {
+ {
+ .modalias = "adafruit_tft18",
+ .platform_data = &bone_st7735fb_data,
+ .irq = -1,
+ .max_speed_hz = 8000000,
+ .bus_num = 2,
+ .chip_select = 0,
+ .mode = SPI_MODE_3,
+ },
+};
+
static void evm_nand_init(int evm_id, int profile)
{
setup_pin_mux(nand_pin_mux);
@@ -1410,6 +1428,14 @@ static void spi1_init(int evm_id, int profile)
return;
}
+/* setup bone spi1 */
+static void bone_spi1_init(int evm_id, int profile)
+{
+ setup_pin_mux(spi1_pin_mux);
+ spi_register_board_info(bone_spi1_slave_info,
+ ARRAY_SIZE(bone_spi1_slave_info));
+ return;
+}
static int beaglebone_phy_fixup(struct phy_device *phydev)
{
@@ -1567,6 +1593,8 @@ static struct evm_dev_cfg beaglebone_dev_cfg[] = {
{i2c2_init, DEV_ON_BASEBOARD, PROFILE_NONE},
{mmc0_init, DEV_ON_BASEBOARD, PROFILE_NONE},
{boneleds_init, DEV_ON_BASEBOARD, PROFILE_ALL},
+ /* HACK ALERT */
+ {bone_spi1_init, DEV_ON_BASEBOARD, PROFILE_NONE},
{NULL, 0, 0},
};
--
1.7.2.5
File diff suppressed because it is too large Load Diff
@@ -1,63 +0,0 @@
SECTION = "kernel"
DESCRIPTION = "Linux kernel for TI33x EVM from PSP, based on am335x-kernel"
LICENSE = "GPLv2"
KERNEL_IMAGETYPE = "uImage"
require multi-kernel.inc
require tipspkernel.inc
S = "${WORKDIR}/git"
MULTI_CONFIG_BASE_SUFFIX = ""
BRANCH = "v3.1-meta-ti-r1r+gitr1d84d8853fa30cf3db2571a5aec572accca4e29d"
SRCREV = "1d84d8853fa30cf3db2571a5aec572accca4e29d"
MACHINE_KERNEL_PR_append = "l+gitr${SRCREV}"
COMPATIBLE_MACHINE = "(ti33x)"
SRC_URI += "git://github.com/beagleboard/linux.git;branch=${BRANCH} \
file://defconfig"
PATCHES_OVER_PSP = " \
file://0001-f_rndis-HACK-around-undefined-variables.patch \
file://0001-ARM-omap-am335x-BeagleBone-version-detection-and-sup.patch \
file://0002-ARM-OMAP2-beaglebone-add-LED-support.patch \
file://0003-ARM-OMAP2-beaglebone-add-DVI-support-needs-cleanup.patch \
file://0004-da8xx-fb-add-DVI-support-for-beaglebone.patch \
file://0001-usb-musb_core-kill-all-global-and-static-variables.patch \
file://0002-arm-omap-am335x-correct-32KHz-clk-rate.patch \
file://0003-arm-omap-mcspi-correct-memory-range-when-requesting-.patch \
file://0004-arm-omap-mcspi-follow-proper-pm_runtime-enable-disab.patch \
file://0005-arm-omap-mcspi-follow-proper-probe-remove-steps.patch \
file://0006-usb-musb-cppi41_dma-Check-if-scheduling-is-required-.patch \
file://can/0001-can-d_can-Added-support-for-Bosch-D_CAN-controller.patch \
file://can/0002-can-d_can-Added-platform-data-for-am33xx-device.patch \
file://can/0003-can-d_can-DCAN-config-added-to-am335x_evm_defconfig.patch \
file://can/0004-can-d_can-fix-for-cansend-loop-issue.patch \
file://can/0005-can-d_can-fixes-the-rmmod-crash.patch \
file://i2c/0001-arm-omap-mux33xx-Add-i2c2-pin-muix.patch \
file://i2c/0002-omap-hwmod-33xx-Add-support-for-third-i2c-bus.patch \
file://i2c/0003-arm-omap-board-Add-quick-hack-to-get-i2c2-bus-suppor.patch \
file://adc/0001-AM335x-Add-support-for-TSC-on-Beta-GP-EVM.patch \
file://adc/0002-ARM-OMAP-AM335x-Add-support-for-Beta-GP-EVM.patch \
file://adc/0003-AM335x-Add-support-for-pressure-measurement-on-TSC.patch \
file://adc/0004-tscadc-Add-general-purpose-mode-untested-with-touchs.patch \
file://adc/0005-tscadc-Add-board-file-mfd-support-fix-warning.patch \
file://adc/0006-AM335X-init-tsc-bone-style-for-new-boards.patch \
file://adc/0007-tscadc-make-stepconfig-channel-configurable.patch \
file://adc/0008-tscadc-Trigger-through-sysfs.patch \
file://adc/0009-meta-ti-Remove-debug-messages-for-meta-ti.patch \
file://adc/0010-tscadc-switch-to-polling-instead-of-interrupts.patch \
file://st7735fb/0001-st7735fb-WIP-framebuffer-driver-supporting-Adafruit-.patch \
file://0031-am335x-evm-add-pdata-for-all-cape-EEPROM-permutation.patch \
file://0032-am335x-add-support-for-7-LCD-cape-fix-DVI-entries.patch \
file://0033-beaglebone-update-DVI-cape-partnumber.patch \
file://0034-beaglebone-really-enable-i2c2-pullups-fixes-timeouts.patch \
file://0035-beaglebone-add-structs-for-DVI-cape-LEDs.patch\
file://0036-beaglebone-update-LCD-cape-partnumber.patch \
file://0037-beaglebone-compare-complete-partnumber-not-the-first.patch \
file://0038-omap_hsmmc-Set-dto-to-max-value-of-14-to-avoid-SD-Ca.patch \
"
SRC_URI_append_beaglebone = " file://logo_linux_clut224.ppm"