1
0
mirror of https://git.yoctoproject.org/meta-ti synced 2026-06-05 10:21:52 +00:00

linux-omapl138: import 2.6.37 PSP kernel from Arago

* The latest PSP release is 03.21.00.04
* Apply WiFi, BT, pruss patches
* DISTRO_FEATURES="tipspkernel" uses unpatched PSP version and defconfig

Signed-off-by: Denys Dmytriyenko <denys@ti.com>
Signed-off-by: Koen Kooi <koen@dominion.thruhere.net>
This commit is contained in:
Denys Dmytriyenko
2011-08-10 19:57:39 -04:00
committed by Koen Kooi
parent 9c3a8de11e
commit 234cab508a
12 changed files with 9148 additions and 0 deletions
@@ -0,0 +1,616 @@
From 303bd9e5876970a970aa8a90b2f1836a3374ab39 Mon Sep 17 00:00:00 2001
From: Nisim Peled <nisimp@ti.com>
Date: Wed, 18 May 2011 22:34:29 +0300
Subject: [PATCH] TI-WL12xx MMC patches 03.21.00.04
Enables a second MMC (mmc1) which is actually the TI-WL12xx module connection to the board.
Signed-off-by: Nisim Peled <nisimp@ti.com>
---
arch/arm/mach-davinci/Kconfig | 1 +
arch/arm/mach-davinci/board-da850-evm.c | 102 +++++++++++++++++++++++++--
arch/arm/mach-davinci/da850.c | 16 +++++
arch/arm/mach-davinci/devices-da8xx.c | 1 +
arch/arm/mach-davinci/dma.c | 6 ++
arch/arm/mach-davinci/include/mach/da8xx.h | 1 +
arch/arm/mach-davinci/include/mach/mmc.h | 3 +
arch/arm/mach-davinci/include/mach/mux.h | 10 +++
drivers/mmc/core/core.c | 24 ++++++-
drivers/mmc/core/sdio.c | 16 ++++-
drivers/mmc/core/sdio_bus.c | 32 ---------
drivers/mmc/host/davinci_mmc.c | 18 +++++
drivers/net/wireless/wl12xx/Kconfig | 1 -
drivers/net/wireless/wl12xx/wl1271_boot.c | 10 +--
include/linux/mmc/host.h | 5 ++
include/linux/wl12xx.h | 27 +++++++
16 files changed, 221 insertions(+), 52 deletions(-)
diff --git a/arch/arm/mach-davinci/Kconfig b/arch/arm/mach-davinci/Kconfig
index c4c207e..ece78c6 100644
--- a/arch/arm/mach-davinci/Kconfig
+++ b/arch/arm/mach-davinci/Kconfig
@@ -40,6 +40,7 @@ config ARCH_DAVINCI_DA850
select CP_INTC
select ARCH_DAVINCI_DA8XX
select ARCH_HAS_CPUFREQ
+ select WL12XX_PLATFORM_DATA
config DAVINCI_UART1_AFE
bool "Enable UART1 flow control"
diff --git a/arch/arm/mach-davinci/board-da850-evm.c b/arch/arm/mach-davinci/board-da850-evm.c
index 80710f1..4b4d78b 100644
--- a/arch/arm/mach-davinci/board-da850-evm.c
+++ b/arch/arm/mach-davinci/board-da850-evm.c
@@ -34,6 +34,7 @@
#include <linux/delay.h>
#include <linux/i2c-gpio.h>
#include <linux/pwm_backlight.h>
+#include <linux/wl12xx.h>
#include <asm/mach-types.h>
#include <asm/mach/arch.h>
@@ -62,6 +63,9 @@
#define DA850_SD_ENABLE_PIN GPIO_TO_PIN(0, 11)
+#define DA850_WLAN_EN GPIO_TO_PIN(6, 9)
+#define DA850_WLAN_IRQ GPIO_TO_PIN(6, 10)
+
#define DAVINCI_BACKLIGHT_MAX_BRIGHTNESS 250
#define DAVINVI_BACKLIGHT_DEFAULT_BRIGHTNESS 250
#define DAVINCI_PWM_PERIOD_NANO_SECONDS (10000 * 10)
@@ -1038,13 +1042,50 @@ static int da850_evm_mmc_get_cd(int index)
return !gpio_get_value(DA850_MMCSD_CD_PIN);
}
-static struct davinci_mmc_config da850_mmc_config = {
- .get_ro = da850_evm_mmc_get_ro,
- .get_cd = da850_evm_mmc_get_cd,
- .wires = 4,
- .max_freq = 50000000,
- .caps = MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED,
- .version = MMC_CTLR_VERSION_2,
+static int wl12xx_set_power(int slot, int power_on)
+{
+ static int power_state;
+
+ pr_debug("Powering %s wifi", (power_on ? "on" : "off"));
+
+ if (power_on == power_state)
+ return 0;
+ power_state = power_on;
+
+ if (power_on) {
+ gpio_set_value(DA850_WLAN_EN, 1);
+ mdelay(15);
+ gpio_set_value(DA850_WLAN_EN, 0);
+ mdelay(1);
+ gpio_set_value(DA850_WLAN_EN, 1);
+ mdelay(70);
+ } else {
+ gpio_set_value(DA850_WLAN_EN, 0);
+ }
+
+ return 0;
+}
+
+static struct davinci_mmc_config da850_mmc_config[] = {
+ {
+ .get_ro = da850_evm_mmc_get_ro,
+ .get_cd = da850_evm_mmc_get_cd,
+ .wires = 4,
+ .max_freq = 50000000,
+ .caps = MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED,
+ .version = MMC_CTLR_VERSION_2,
+ },
+ {
+ .get_ro = NULL,
+ .get_cd = NULL,
+ .set_power = wl12xx_set_power,
+ .wires = 4,
+ .max_freq = 25000000,
+ .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_NONREMOVABLE |
+ MMC_CAP_POWER_OFF_CARD,
+ .version = MMC_CTLR_VERSION_2,
+ },
+ {} /* Terminator */
};
static void da850_panel_power_ctrl(int val)
@@ -1765,6 +1806,40 @@ static struct vpif_display_config da850_vpif_display_config = {
#define HAS_LCD 0
#endif
+#ifdef CONFIG_WL12XX_PLATFORM_DATA
+
+static struct wl12xx_platform_data da850_wl12xx_wlan_data __initdata = {
+ .irq = -1,
+ .board_ref_clock = WL12XX_REFCLOCK_38,
+ .platform_quirks = WL12XX_PLATFORM_QUIRK_EDGE_IRQ,
+};
+
+static void da850_wl12xx_set_platform_data(void)
+{
+ da850_wl12xx_wlan_data.irq = gpio_to_irq(DA850_WLAN_IRQ);
+ if (wl12xx_set_platform_data(&da850_wl12xx_wlan_data))
+ pr_err("Error setting wl12xx data\n");
+}
+
+#else
+
+static void da850_wl12xx_set_platform_data(void) { }
+
+#endif
+
+static void da850_wl12xx_init(void)
+{
+ if (gpio_request(DA850_WLAN_EN, "wl12xx") ||
+ gpio_direction_output(DA850_WLAN_EN, 0))
+ pr_err("Error initializing the wl12xx enable gpio\n");
+
+ if (gpio_request(DA850_WLAN_IRQ, "wl12xx_irq") ||
+ gpio_direction_input(DA850_WLAN_IRQ))
+ pr_err("Error initializing the wl12xx irq gpio\n");
+
+ da850_wl12xx_set_platform_data();
+}
+
static __init void da850_evm_init(void)
{
int ret;
@@ -1806,6 +1881,11 @@ static __init void da850_evm_init(void)
pr_warning("da850_evm_init: mmcsd0 mux setup failed:"
" %d\n", ret);
+ ret = davinci_cfg_reg_list(da850_mmcsd1_pins);
+ if (ret)
+ pr_warning("da850_evm_init: mmcsd1 mux setup failed:"
+ " %d\n", ret);
+
ret = gpio_request(DA850_MMCSD_CD_PIN, "MMC CD\n");
if (ret)
pr_warning("da850_evm_init: can not open GPIO %d\n",
@@ -1818,10 +1898,16 @@ static __init void da850_evm_init(void)
DA850_MMCSD_WP_PIN);
gpio_direction_input(DA850_MMCSD_WP_PIN);
- ret = da8xx_register_mmcsd0(&da850_mmc_config);
+ ret = da8xx_register_mmcsd0(&da850_mmc_config[0]);
if (ret)
pr_warning("da850_evm_init: mmcsd0 registration failed:"
" %d\n", ret);
+ ret = da850_register_mmcsd1(&da850_mmc_config[1]);
+ if (ret)
+ pr_warning("da850_evm_init: mmcsd0 registration failed:"
+ " %d\n", ret);
+
+ da850_wl12xx_init();
}
davinci_serial_init(&da850_evm_uart_config);
diff --git a/arch/arm/mach-davinci/da850.c b/arch/arm/mach-davinci/da850.c
index 5e13f88..bc52ec4 100644
--- a/arch/arm/mach-davinci/da850.c
+++ b/arch/arm/mach-davinci/da850.c
@@ -580,6 +580,13 @@ static const struct mux_config da850_pins[] = {
MUX_CFG(DA850, MMCSD0_DAT_3, 10, 20, 15, 2, false)
MUX_CFG(DA850, MMCSD0_CLK, 10, 0, 15, 2, false)
MUX_CFG(DA850, MMCSD0_CMD, 10, 4, 15, 2, false)
+ /* MMC/SD1 function */
+ MUX_CFG(DA850, MMCSD1_DAT_0, 18, 8, 15, 2, false)
+ MUX_CFG(DA850, MMCSD1_DAT_1, 19, 16, 15, 2, false)
+ MUX_CFG(DA850, MMCSD1_DAT_2, 19, 12, 15, 2, false)
+ MUX_CFG(DA850, MMCSD1_DAT_3, 19, 8, 15, 2, false)
+ MUX_CFG(DA850, MMCSD1_CLK, 18, 12, 15, 2, false)
+ MUX_CFG(DA850, MMCSD1_CMD, 18, 16, 15, 2, false)
/* EMIF2.5/EMIFA function */
MUX_CFG(DA850, EMA_D_7, 9, 0, 15, 1, false)
MUX_CFG(DA850, EMA_D_6, 9, 4, 15, 1, false)
@@ -642,6 +649,8 @@ static const struct mux_config da850_pins[] = {
MUX_CFG(DA850, GPIO6_13, 13, 8, 15, 8, false)
MUX_CFG(DA850, RTC_ALARM, 0, 28, 15, 2, false)
MUX_CFG(DA850, GPIO7_4, 17, 20, 15, 8, false)
+ MUX_CFG(DA850, GPIO6_9, 13, 24, 15, 8, false)
+ MUX_CFG(DA850, GPIO6_10, 13, 20, 15, 8, false)
/* McBSP0 function */
MUX_CFG(DA850, MCBSP0_CLKR, 2, 4, 15, 2, false)
MUX_CFG(DA850, MCBSP0_CLKX, 2, 8, 15, 2, false)
@@ -778,6 +787,13 @@ const short da850_mmcsd0_pins[] __initdata = {
-1
};
+const short da850_mmcsd1_pins[] __initdata = {
+ DA850_MMCSD1_DAT_0, DA850_MMCSD1_DAT_1, DA850_MMCSD1_DAT_2,
+ DA850_MMCSD1_DAT_3, DA850_MMCSD1_CLK, DA850_MMCSD1_CMD,
+ DA850_GPIO6_9, DA850_GPIO6_10,
+ -1
+};
+
const short da850_ehrpwm0_pins[] __initdata = {
DA850_EHRPWM0_A, DA850_EHRPWM0_B, DA850_EHRPWM0_TZ,
-1
diff --git a/arch/arm/mach-davinci/devices-da8xx.c b/arch/arm/mach-davinci/devices-da8xx.c
index 70aa9f8..dd62e44 100644
--- a/arch/arm/mach-davinci/devices-da8xx.c
+++ b/arch/arm/mach-davinci/devices-da8xx.c
@@ -124,6 +124,7 @@ static struct edma_soc_info da830_edma_cc0_info = {
.n_cc = 1,
.queue_tc_mapping = da8xx_queue_tc_mapping,
.queue_priority_mapping = da8xx_queue_priority_mapping,
+ .default_queue = EVENTQ_0,
};
static struct edma_soc_info *da830_edma_info[EDMA_MAX_CC] = {
diff --git a/arch/arm/mach-davinci/dma.c b/arch/arm/mach-davinci/dma.c
index 6b96698..6152f69 100644
--- a/arch/arm/mach-davinci/dma.c
+++ b/arch/arm/mach-davinci/dma.c
@@ -1450,8 +1450,10 @@ static int __init edma_probe(struct platform_device *pdev)
EDMA_MAX_CC);
edma_cc[j]->default_queue = info[j]->default_queue;
+#if 0
if (!edma_cc[j]->default_queue)
edma_cc[j]->default_queue = EVENTQ_1;
+#endif
dev_dbg(&pdev->dev, "DMA REG BASE ADDR=%p\n",
edmacc_regs_base[j]);
@@ -1516,7 +1518,11 @@ static int __init edma_probe(struct platform_device *pdev)
* started by the codec engine will not cause audio defects.
*/
for (i = 0; i < edma_cc[j]->num_channels; i++)
+#if 0
map_dmach_queue(j, i, EVENTQ_1);
+#else
+ map_dmach_queue(j, i, edma_cc[j]->default_queue);
+#endif
queue_tc_mapping = info[j]->queue_tc_mapping;
queue_priority_mapping = info[j]->queue_priority_mapping;
diff --git a/arch/arm/mach-davinci/include/mach/da8xx.h b/arch/arm/mach-davinci/include/mach/da8xx.h
index 1053485..d67d502 100644
--- a/arch/arm/mach-davinci/include/mach/da8xx.h
+++ b/arch/arm/mach-davinci/include/mach/da8xx.h
@@ -150,6 +150,7 @@ extern const short da850_cpgmac_pins[];
extern const short da850_mcasp_pins[];
extern const short da850_lcdcntl_pins[];
extern const short da850_mmcsd0_pins[];
+extern const short da850_mmcsd1_pins[];
extern const short da850_emif25_pins[];
extern const short da850_mcbsp0_pins[];
extern const short da850_mcbsp1_pins[];
diff --git a/arch/arm/mach-davinci/include/mach/mmc.h b/arch/arm/mach-davinci/include/mach/mmc.h
index d4f1e96..e64d636 100644
--- a/arch/arm/mach-davinci/include/mach/mmc.h
+++ b/arch/arm/mach-davinci/include/mach/mmc.h
@@ -12,6 +12,9 @@ struct davinci_mmc_config {
/* get_cd()/get_wp() may sleep */
int (*get_cd)(int module);
int (*get_ro)(int module);
+
+ int (*set_power)(int module, int on);
+
/* wires == 0 is equivalent to wires == 4 (4-bit parallel) */
u8 wires;
diff --git a/arch/arm/mach-davinci/include/mach/mux.h b/arch/arm/mach-davinci/include/mach/mux.h
index 8bea8fb..b8b00bc 100644
--- a/arch/arm/mach-davinci/include/mach/mux.h
+++ b/arch/arm/mach-davinci/include/mach/mux.h
@@ -860,6 +860,14 @@ enum davinci_da850_index {
DA850_MMCSD0_CLK,
DA850_MMCSD0_CMD,
+ /* MMC/SD1 function */
+ DA850_MMCSD1_DAT_0,
+ DA850_MMCSD1_DAT_1,
+ DA850_MMCSD1_DAT_2,
+ DA850_MMCSD1_DAT_3,
+ DA850_MMCSD1_CLK,
+ DA850_MMCSD1_CMD,
+
/* EMIF2.5/EMIFA function */
DA850_EMA_D_7,
DA850_EMA_D_6,
@@ -923,6 +931,8 @@ enum davinci_da850_index {
DA850_GPIO6_13,
DA850_RTC_ALARM,
DA850_GPIO7_4,
+ DA850_GPIO6_9,
+ DA850_GPIO6_10,
/* McBSP0 function */
DA850_MCBSP0_CLKR,
diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index 57dcf8f..add09c3 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -22,6 +22,7 @@
#include <linux/scatterlist.h>
#include <linux/log2.h>
#include <linux/regulator/consumer.h>
+#include <linux/pm_runtime.h>
#include <linux/mmc/card.h>
#include <linux/mmc/host.h>
@@ -1446,8 +1447,12 @@ void mmc_rescan(struct work_struct *work)
mmc_bus_get(host);
- /* if there is a card registered, check whether it is still present */
- if ((host->bus_ops != NULL) && host->bus_ops->detect && !host->bus_dead)
+ /*
+ * if there is a _removable_ card registered, check whether it is
+ * still present
+ */
+ if (host->bus_ops && host->bus_ops->detect && !host->bus_dead
+ && mmc_card_is_removable(host))
host->bus_ops->detect(host);
mmc_bus_put(host);
@@ -1538,7 +1543,8 @@ out_fail:
mmc_power_off(host);
}
out:
- if (host->caps & MMC_CAP_NEEDS_POLL)
+ if (host->caps & MMC_CAP_NEEDS_POLL &&
+ !(host->caps & MMC_CAP_NONREMOVABLE))
mmc_schedule_delayed_work(&host->detect, HZ);
}
@@ -1721,6 +1727,18 @@ int mmc_resume_host(struct mmc_host *host)
if (!(host->pm_flags & MMC_PM_KEEP_POWER)) {
mmc_power_up(host);
mmc_select_voltage(host, host->ocr);
+ /*
+ * Tell runtime PM core we just powered up the card,
+ * since it still believes the card is powered off.
+ * Note that currently runtime PM is only enabled
+ * for SDIO cards that are MMC_CAP_POWER_OFF_CARD
+ */
+ if (mmc_card_sdio(host->card) &&
+ (host->caps & MMC_CAP_POWER_OFF_CARD)) {
+ pm_runtime_disable(&host->card->dev);
+ pm_runtime_set_active(&host->card->dev);
+ pm_runtime_enable(&host->card->dev);
+ }
}
BUG_ON(!host->bus_ops->resume);
err = host->bus_ops->resume(host);
diff --git a/drivers/mmc/core/sdio.c b/drivers/mmc/core/sdio.c
index efef5f9..b424fbe 100644
--- a/drivers/mmc/core/sdio.c
+++ b/drivers/mmc/core/sdio.c
@@ -627,15 +627,27 @@ static int mmc_sdio_suspend(struct mmc_host *host)
static int mmc_sdio_resume(struct mmc_host *host)
{
- int i, err;
+ int i, err = 0;
BUG_ON(!host);
BUG_ON(!host->card);
/* Basic card reinitialization. */
mmc_claim_host(host);
- err = mmc_sdio_init_card(host, host->ocr, host->card,
+
+ /* No need to reinitialize powered-resumed nonremovable cards */
+ if (mmc_card_is_removable(host) || !mmc_card_is_powered_resumed(host))
+ err = mmc_sdio_init_card(host, host->ocr, host->card,
(host->pm_flags & MMC_PM_KEEP_POWER));
+ else if (mmc_card_is_powered_resumed(host)) {
+ /* We may have switched to 1-bit mode during suspend */
+ err = sdio_enable_4bit_bus(host->card);
+ if (err > 0) {
+ mmc_set_bus_width(host, MMC_BUS_WIDTH_4);
+ err = 0;
+ }
+ }
+
if (!err && host->sdio_irqs)
mmc_signal_sdio_irq(host);
mmc_release_host(host);
diff --git a/drivers/mmc/core/sdio_bus.c b/drivers/mmc/core/sdio_bus.c
index 203da44..d29b9c3 100644
--- a/drivers/mmc/core/sdio_bus.c
+++ b/drivers/mmc/core/sdio_bus.c
@@ -197,44 +197,12 @@ out:
#ifdef CONFIG_PM_RUNTIME
-static int sdio_bus_pm_prepare(struct device *dev)
-{
- struct sdio_func *func = dev_to_sdio_func(dev);
-
- /*
- * Resume an SDIO device which was suspended at run time at this
- * point, in order to allow standard SDIO suspend/resume paths
- * to keep working as usual.
- *
- * Ultimately, the SDIO driver itself will decide (in its
- * suspend handler, or lack thereof) whether the card should be
- * removed or kept, and if kept, at what power state.
- *
- * At this point, PM core have increased our use count, so it's
- * safe to directly resume the device. After system is resumed
- * again, PM core will drop back its runtime PM use count, and if
- * needed device will be suspended again.
- *
- * The end result is guaranteed to be a power state that is
- * coherent with the device's runtime PM use count.
- *
- * The return value of pm_runtime_resume is deliberately unchecked
- * since there is little point in failing system suspend if a
- * device can't be resumed.
- */
- if (func->card->host->caps & MMC_CAP_POWER_OFF_CARD)
- pm_runtime_resume(dev);
-
- return 0;
-}
-
static const struct dev_pm_ops sdio_bus_pm_ops = {
SET_RUNTIME_PM_OPS(
pm_generic_runtime_suspend,
pm_generic_runtime_resume,
pm_generic_runtime_idle
)
- .prepare = sdio_bus_pm_prepare,
};
#define SDIO_PM_OPS_PTR (&sdio_bus_pm_ops)
diff --git a/drivers/mmc/host/davinci_mmc.c b/drivers/mmc/host/davinci_mmc.c
index e15547c..2e9b507 100644
--- a/drivers/mmc/host/davinci_mmc.c
+++ b/drivers/mmc/host/davinci_mmc.c
@@ -208,6 +208,8 @@ struct mmc_davinci_host {
#ifdef CONFIG_CPU_FREQ
struct notifier_block freq_transition;
#endif
+
+ unsigned char power_mode;
};
@@ -798,12 +800,28 @@ static void calculate_clk_divider(struct mmc_host *mmc, struct mmc_ios *ios)
static void mmc_davinci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
{
struct mmc_davinci_host *host = mmc_priv(mmc);
+ struct platform_device *pdev = to_platform_device(mmc->parent);
+ struct davinci_mmc_config *config = pdev->dev.platform_data;
dev_dbg(mmc_dev(host->mmc),
"clock %dHz busmode %d powermode %d Vdd %04x\n",
ios->clock, ios->bus_mode, ios->power_mode,
ios->vdd);
+ if (ios->power_mode != host->power_mode) {
+ switch (ios->power_mode) {
+ case MMC_POWER_OFF:
+ if (config && config->set_power)
+ config->set_power(pdev->id, 0);
+ break;
+ case MMC_POWER_UP:
+ if (config && config->set_power)
+ config->set_power(pdev->id, 1);
+ break;
+ }
+ host->power_mode = ios->power_mode;
+ }
+
switch (ios->bus_width) {
case MMC_BUS_WIDTH_8:
dev_dbg(mmc_dev(host->mmc), "Enabling 8 bit mode\n");
diff --git a/drivers/net/wireless/wl12xx/Kconfig b/drivers/net/wireless/wl12xx/Kconfig
index b447559..441aaf6 100644
--- a/drivers/net/wireless/wl12xx/Kconfig
+++ b/drivers/net/wireless/wl12xx/Kconfig
@@ -42,5 +42,4 @@ config WL1271_SDIO
config WL12XX_PLATFORM_DATA
bool
- depends on WL1271_SDIO != n
default y
diff --git a/drivers/net/wireless/wl12xx/wl1271_boot.c b/drivers/net/wireless/wl12xx/wl1271_boot.c
index b910212..5b19072 100644
--- a/drivers/net/wireless/wl12xx/wl1271_boot.c
+++ b/drivers/net/wireless/wl12xx/wl1271_boot.c
@@ -471,20 +471,19 @@ int wl1271_boot(struct wl1271 *wl)
{
int ret = 0;
u32 tmp, clk, pause;
- int ref_clock = wl->ref_clock;
wl1271_boot_hw_version(wl);
- if (ref_clock == 0 || ref_clock == 2 || ref_clock == 4)
+ if (wl->ref_clock == 0 || wl->ref_clock == 2 || wl->ref_clock == 4)
/* ref clk: 19.2/38.4/38.4-XTAL */
clk = 0x3;
- else if (ref_clock == 1 || ref_clock == 3)
+ else if (wl->ref_clock == 1 || wl->ref_clock == 3)
/* ref clk: 26/52 */
clk = 0x5;
else
return -EINVAL;
- if (ref_clock != 0) {
+ if (wl->ref_clock != 0) {
u16 val;
/* Set clock type (open drain) */
val = wl1271_top_reg_read(wl, OCP_REG_CLK_TYPE);
@@ -529,8 +528,7 @@ int wl1271_boot(struct wl1271 *wl)
wl1271_debug(DEBUG_BOOT, "clk2 0x%x", clk);
- /* 2 */
- clk |= (ref_clock << 1) << 4;
+ clk |= (wl->ref_clock << 1) << 4;
wl1271_write32(wl, DRPW_SCRATCH_START, clk);
wl1271_set_partition(wl, &part_table[PART_WORK]);
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
index 30f6fad..86d74a5 100644
--- a/include/linux/mmc/host.h
+++ b/include/linux/mmc/host.h
@@ -307,5 +307,10 @@ static inline int mmc_card_is_removable(struct mmc_host *host)
return !(host->caps & MMC_CAP_NONREMOVABLE) && mmc_assume_removable;
}
+static inline int mmc_card_is_powered_resumed(struct mmc_host *host)
+{
+ return host->pm_flags & MMC_PM_KEEP_POWER;
+}
+
#endif
diff --git a/include/linux/wl12xx.h b/include/linux/wl12xx.h
index 4f902e1..4b69739 100644
--- a/include/linux/wl12xx.h
+++ b/include/linux/wl12xx.h
@@ -24,14 +24,41 @@
#ifndef _LINUX_WL12XX_H
#define _LINUX_WL12XX_H
+/* Reference clock values */
+enum {
+ WL12XX_REFCLOCK_19 = 0, /* 19.2 MHz */
+ WL12XX_REFCLOCK_26 = 1, /* 26 MHz */
+ WL12XX_REFCLOCK_38 = 2, /* 38.4 MHz */
+ WL12XX_REFCLOCK_52 = 3, /* 52 MHz */
+ WL12XX_REFCLOCK_38_XTAL = 4, /* 38.4 MHz, XTAL */
+ WL12XX_REFCLOCK_26_XTAL = 5, /* 26 MHz, XTAL */
+};
+
+/* TCXO clock values */
+enum {
+ WL12XX_TCXOCLOCK_19_2 = 0, /* 19.2MHz */
+ WL12XX_TCXOCLOCK_26 = 1, /* 26 MHz */
+ WL12XX_TCXOCLOCK_38_4 = 2, /* 38.4MHz */
+ WL12XX_TCXOCLOCK_52 = 3, /* 52 MHz */
+ WL12XX_TCXOCLOCK_16_368 = 4, /* 16.368 MHz */
+ WL12XX_TCXOCLOCK_32_736 = 5, /* 32.736 MHz */
+ WL12XX_TCXOCLOCK_16_8 = 6, /* 16.8 MHz */
+ WL12XX_TCXOCLOCK_33_6 = 7, /* 33.6 MHz */
+};
+
struct wl12xx_platform_data {
void (*set_power)(bool enable);
/* SDIO only: IRQ number if WLAN_IRQ line is used, 0 for SDIO IRQs */
int irq;
bool use_eeprom;
int board_ref_clock;
+ int board_tcxo_clock;
+ unsigned long platform_quirks;
};
+/* Platform does not support level trigger interrupts */
+#define WL12XX_PLATFORM_QUIRK_EDGE_IRQ BIT(0)
+
#ifdef CONFIG_WL12XX_PLATFORM_DATA
int wl12xx_set_platform_data(const struct wl12xx_platform_data *data);
--
1.7.0.4
@@ -0,0 +1,28 @@
From 47ec4ffa87e353bf1913f8f4de31e1fd5928b52f Mon Sep 17 00:00:00 2001
From: Nisim Peled <nisimp@ti.com>
Date: Wed, 18 May 2011 22:57:56 +0300
Subject: [PATCH] da850 Set maximum OPP frequency to 456MHz
extends the CPU rate limit to maximum of 456MHz and enables a better performance.
The default rate stays the same (300MHz).
Signed-off-by: Nisim Peled <nisimp@ti.com>
---
arch/arm/mach-davinci/da850.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/arch/arm/mach-davinci/da850.c b/arch/arm/mach-davinci/da850.c
index bc52ec4..d11854c 100644
--- a/arch/arm/mach-davinci/da850.c
+++ b/arch/arm/mach-davinci/da850.c
@@ -1194,7 +1194,7 @@ static struct platform_device da850_cpufreq_device = {
.id = -1,
};
-unsigned int da850_max_speed = 300000;
+unsigned int da850_max_speed = 456000;
static void da850_set_pll0_bypass_src(bool pll1_sysclk3)
{
--
1.7.0.4
@@ -0,0 +1,114 @@
From da8fc5330246e7242945646306ea062e6aca3214 Mon Sep 17 00:00:00 2001
From: Nisim Peled <nisimp@ti.com>
Date: Wed, 18 May 2011 21:56:03 +0300
Subject: [PATCH] AM18xx WL1271 Enable BT Manage a GPIO enable/disable (DA850_GPIO0_15) to enable the Bluetooth functionality.
Signed-off-by: Nisim Peled <nisimp@ti.com>
---
arch/arm/mach-davinci/board-da850-evm.c | 27 ++++++++++++++++++++++++++-
arch/arm/mach-davinci/da850.c | 6 ++++++
arch/arm/mach-davinci/include/mach/da8xx.h | 1 +
arch/arm/mach-davinci/include/mach/mux.h | 1 +
4 files changed, 34 insertions(+), 1 deletions(-)
diff --git a/arch/arm/mach-davinci/board-da850-evm.c b/arch/arm/mach-davinci/board-da850-evm.c
index 4b4d78b..7414331 100644
--- a/arch/arm/mach-davinci/board-da850-evm.c
+++ b/arch/arm/mach-davinci/board-da850-evm.c
@@ -72,6 +72,20 @@
#define PWM_DEVICE_ID "ehrpwm.1"
+
+/* Enabling GPIO for WL1271's Bluetooth */
+#define WL1271_BT_EN_GPIO GPIO_TO_PIN(0, 15)
+
+/* Enabling GPIOs for WL1271's BT, FM, GPS respectively (-1 if not used) */
+static int gpios[] = { WL1271_BT_EN_GPIO, -1, -1};
+
+static struct platform_device wl1271_device = {
+ .name = "kim",
+ .id = -1,
+ .dev.platform_data = &gpios,
+};
+
+
static struct platform_pwm_backlight_data da850evm_backlight_data = {
.pwm_id = PWM_DEVICE_ID,
.ch = 0,
@@ -1836,6 +1850,9 @@ static void da850_wl12xx_init(void)
if (gpio_request(DA850_WLAN_IRQ, "wl12xx_irq") ||
gpio_direction_input(DA850_WLAN_IRQ))
pr_err("Error initializing the wl12xx irq gpio\n");
+ if (gpio_request(WL1271_BT_EN_GPIO, "wl1271 BT Enable") ||
+ gpio_direction_output(WL1271_BT_EN_GPIO,0))
+ pr_err("Failed to request BT_EN GPIO\n");
da850_wl12xx_set_platform_data();
}
@@ -2109,7 +2126,15 @@ static __init void da850_evm_init(void)
if (ret)
pr_warning("da850_evm_init: eCAP registration failed: %d\n",
ret);
-
+ ret = davinci_cfg_reg_list(da850_wl1271_pins);
+ if (ret)
+ pr_warning("da850_evm_init: wl1271 mux setup failed:"
+ "%d\n", ret);
+
+ ret = platform_device_register(&wl1271_device);
+ if (ret)
+ pr_warning("da850_evm_init: wl1271 device registration"
+ " failed: %d\n", ret);
/* initilaize usb module */
da850_evm_usb_init();
}
diff --git a/arch/arm/mach-davinci/da850.c b/arch/arm/mach-davinci/da850.c
index d11854c..884c88c 100644
--- a/arch/arm/mach-davinci/da850.c
+++ b/arch/arm/mach-davinci/da850.c
@@ -649,6 +649,7 @@ static const struct mux_config da850_pins[] = {
MUX_CFG(DA850, GPIO6_13, 13, 8, 15, 8, false)
MUX_CFG(DA850, RTC_ALARM, 0, 28, 15, 2, false)
MUX_CFG(DA850, GPIO7_4, 17, 20, 15, 8, false)
+ MUX_CFG(DA850, GPIO0_15, 0, 0, 15, 8, false)
MUX_CFG(DA850, GPIO6_9, 13, 24, 15, 8, false)
MUX_CFG(DA850, GPIO6_10, 13, 20, 15, 8, false)
/* McBSP0 function */
@@ -804,6 +805,11 @@ const short da850_ehrpwm1_pins[] __initdata = {
-1
};
+const short da850_wl1271_pins[] __initdata = {
+ DA850_GPIO0_15,
+ -1
+};
+
const short da850_emif25_pins[] __initdata = {
DA850_EMA_BA_1, DA850_EMA_CLK, DA850_EMA_WAIT_1, DA850_NEMA_CS_2,
DA850_NEMA_CS_3, DA850_NEMA_CS_4, DA850_NEMA_WE, DA850_NEMA_OE,
diff --git a/arch/arm/mach-davinci/include/mach/da8xx.h b/arch/arm/mach-davinci/include/mach/da8xx.h
index d67d502..f9b70c4 100644
--- a/arch/arm/mach-davinci/include/mach/da8xx.h
+++ b/arch/arm/mach-davinci/include/mach/da8xx.h
@@ -158,4 +158,5 @@ extern const short da850_vpif_capture_pins[];
extern const short da850_vpif_display_pins[];
extern const short da850_ehrpwm0_pins[];
extern const short da850_ehrpwm1_pins[];
+extern const short da850_wl1271_pins[];
#endif /* __ASM_ARCH_DAVINCI_DA8XX_H */
diff --git a/arch/arm/mach-davinci/include/mach/mux.h b/arch/arm/mach-davinci/include/mach/mux.h
index b8b00bc..b7333bb 100644
--- a/arch/arm/mach-davinci/include/mach/mux.h
+++ b/arch/arm/mach-davinci/include/mach/mux.h
@@ -931,6 +931,7 @@ enum davinci_da850_index {
DA850_GPIO6_13,
DA850_RTC_ALARM,
DA850_GPIO7_4,
+ DA850_GPIO0_15,
DA850_GPIO6_9,
DA850_GPIO6_10,
--
1.7.0.4
@@ -0,0 +1,25 @@
From 5be065dd4c8711b530c69c9ab5b998f404a0be5f Mon Sep 17 00:00:00 2001
From: Nisim Peled <nisimp@ti.com>
Date: Tue, 17 May 2011 23:14:02 +0300
Subject: [PATCH] PSP03.21.00.04.sdk: activate wireless extensions interface used by iwconfig
Signed-off-by: Nisim Peled <nisimp@ti.com>
---
arch/arm/mach-davinci/Kconfig | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/arch/arm/mach-davinci/Kconfig b/arch/arm/mach-davinci/Kconfig
index ece78c6..287bd51 100644
--- a/arch/arm/mach-davinci/Kconfig
+++ b/arch/arm/mach-davinci/Kconfig
@@ -41,6 +41,7 @@ config ARCH_DAVINCI_DA850
select ARCH_DAVINCI_DA8XX
select ARCH_HAS_CPUFREQ
select WL12XX_PLATFORM_DATA
+ select WIRELESS_EXT
config DAVINCI_UART1_AFE
bool "Enable UART1 flow control"
--
1.7.0.4
@@ -0,0 +1,77 @@
From 332bbf93e2b5366cb5dae5eb413b8f212cd4fdac Mon Sep 17 00:00:00 2001
From: Nisim Peled <nisimp@ti.com>
Date: Mon, 23 May 2011 15:52:08 +0300
Subject: [PATCH] Davinci da850 Add Mistral WL12XX config support to change ref clock
Add config flag to support different clock rates needed by WL12XX modules.
Different front-end modules has different clock rate.
Signed-off-by: Nisim Peled <nisimp@ti.com>
---
arch/arm/mach-davinci/Kconfig | 24 +++++++++++++++++++++++-
arch/arm/mach-davinci/board-da850-evm.c | 4 ++--
2 files changed, 25 insertions(+), 3 deletions(-)
diff --git a/arch/arm/mach-davinci/Kconfig b/arch/arm/mach-davinci/Kconfig
index 287bd51..ec68c5e 100644
--- a/arch/arm/mach-davinci/Kconfig
+++ b/arch/arm/mach-davinci/Kconfig
@@ -40,7 +40,6 @@ config ARCH_DAVINCI_DA850
select CP_INTC
select ARCH_DAVINCI_DA8XX
select ARCH_HAS_CPUFREQ
- select WL12XX_PLATFORM_DATA
select WIRELESS_EXT
config DAVINCI_UART1_AFE
@@ -310,6 +309,29 @@ config DAVINCI_MCBSP1
depends on DAVINCI_MCBSP
default n
+config DA850_MISTRAL_WL12XX
+ bool "Enable Mistral daughter board support"
+ depends on ARCH_DAVINCI_DA850
+ help
+ Support for the Mistral daughter board.
+ This extension board which supports both WLAN and Bluetooth.
+ Specifically, for WL1271, more info can be found at
+ http://processors.wiki.ti.com/index.php/AM18x_%2B_WL1271
+
+config DA850_MISTRAL_WL12XX_REFCLOCK
+ int "Ref clock value"
+ range 0 5
+ depends on DA850_MISTRAL_WL12XX
+ default 2
+ help
+ Set ref clock value for the Mistral WL12XX daughter board.
+ Select 0 for 19.2 MHz.
+ Select 1 for 26 MHz.
+ Select 2 for 38.4 MHz.
+ Select 3 for 52 MHz.
+ Select 4 for 38.4 MHz, XTAL.
+ Select 5 for 26 MHz, XTAL.
+
endmenu
endif
diff --git a/arch/arm/mach-davinci/board-da850-evm.c b/arch/arm/mach-davinci/board-da850-evm.c
index 7414331..3c5be76 100644
--- a/arch/arm/mach-davinci/board-da850-evm.c
+++ b/arch/arm/mach-davinci/board-da850-evm.c
@@ -1820,11 +1820,11 @@ static struct vpif_display_config da850_vpif_display_config = {
#define HAS_LCD 0
#endif
-#ifdef CONFIG_WL12XX_PLATFORM_DATA
+#ifdef CONFIG_DA850_MISTRAL_WL12XX
static struct wl12xx_platform_data da850_wl12xx_wlan_data __initdata = {
.irq = -1,
- .board_ref_clock = WL12XX_REFCLOCK_38,
+ .board_ref_clock = CONFIG_DA850_MISTRAL_WL12XX_REFCLOCK,
.platform_quirks = WL12XX_PLATFORM_QUIRK_EDGE_IRQ,
};
--
1.7.0.4
@@ -0,0 +1,210 @@
From bfda3fc5f88ab21395a18f8073ae38d867883917 Mon Sep 17 00:00:00 2001
From: Nisim Peled <nisimp@ti.com>
Date: Mon, 27 Jun 2011 18:46:18 +0300
Subject: [PATCH] Add wlan and BT config switches.
Signed-off-by: Nisim Peled <nisimp@ti.com>
---
arch/arm/configs/da850_omapl138_defconfig | 75 +++++++++++++++++++++--------
1 files changed, 54 insertions(+), 21 deletions(-)
diff --git a/arch/arm/configs/da850_omapl138_defconfig b/arch/arm/configs/da850_omapl138_defconfig
index 646c477..3528214 100755
--- a/arch/arm/configs/da850_omapl138_defconfig
+++ b/arch/arm/configs/da850_omapl138_defconfig
@@ -255,7 +255,7 @@ CONFIG_CP_INTC=y
# CONFIG_ARCH_DAVINCI_DM646x is not set
# CONFIG_ARCH_DAVINCI_DA830 is not set
CONFIG_ARCH_DAVINCI_DA850=y
-# CONFIG_DAVINCI_UART1_AFE is not set
+CONFIG_DAVINCI_UART1_AFE=y
CONFIG_ARCH_DAVINCI_DA8XX=y
# CONFIG_ARCH_DAVINCI_DM365 is not set
# CONFIG_ARCH_DAVINCI_TNETV107X is not set
@@ -280,6 +280,8 @@ CONFIG_DAVINCI_RESET_CLOCKS=y
CONFIG_DAVINCI_MCBSP=y
# CONFIG_DAVINCI_MCBSP0 is not set
CONFIG_DAVINCI_MCBSP1=y
+CONFIG_DA850_MISTRAL_WL12XX=y
+CONFIG_DA850_MISTRAL_WL12XX_REFCLOCK=2
#
# Processor Type
@@ -416,7 +418,7 @@ CONFIG_SUSPEND_NVS=y
CONFIG_SUSPEND=y
CONFIG_SUSPEND_FREEZER=y
# CONFIG_APM_EMULATION is not set
-# CONFIG_PM_RUNTIME is not set
+CONFIG_PM_RUNTIME=y
CONFIG_PM_OPS=y
CONFIG_ARCH_SUSPEND_POSSIBLE=y
CONFIG_NET=y
@@ -490,16 +492,23 @@ CONFIG_NETFILTER_ADVANCED=y
#
# CONFIG_NETFILTER_NETLINK_QUEUE is not set
# CONFIG_NETFILTER_NETLINK_LOG is not set
-# CONFIG_NF_CONNTRACK is not set
-# CONFIG_NETFILTER_XTABLES is not set
+CONFIG_NF_CONNTRACK=y
+CONFIG_NF_CONNTRACK_IPV4=y
+CONFIG_NF_CONNTRACK_PROC_COMPAT=y
+CONFIG_NETFILTER_XTABLES=y
# CONFIG_IP_VS is not set
#
# IP: Netfilter Configuration
#
-# CONFIG_NF_DEFRAG_IPV4 is not set
+CONFIG_NF_DEFRAG_IPV4=y
# CONFIG_IP_NF_QUEUE is not set
-# CONFIG_IP_NF_IPTABLES is not set
+CONFIG_IP_NF_FILTER=y
+CONFIG_IP_NF_TARGET_LOG=y
+CONFIG_NF_NAT=y
+CONFIG_NF_NAT_NEEDED=y
+CONFIG_IP_NF_TARGET_MASQUERADE=y
+CONFIG_IP_NF_IPTABLES=y
# CONFIG_IP_NF_ARPTABLES is not set
#
@@ -537,9 +546,30 @@ CONFIG_NETFILTER_ADVANCED=y
# CONFIG_HAMRADIO is not set
# CONFIG_CAN is not set
# CONFIG_IRDA is not set
-# CONFIG_BT is not set
+CONFIG_BT=y
+CONFIG_BT_L2CAP=y
+CONFIG_BT_SCO=y
+CONFIG_BT_RFCOMM=y
+CONFIG_BT_RFCOMM_TTY=y
+CONFIG_BT_BNEP=y
+CONFIG_BT_BNEP_MC_FILTER=y
+CONFIG_BT_BNEP_PROTO_FILTER=y
+CONFIG_BT_HIDP=y
+
+#
+# Bluetooth device drivers
+#
+CONFIG_BT_HCIUART=y
+CONFIG_BT_HCIUART_H4=y
+CONFIG_BT_HCIUART_LL=y
+
# CONFIG_AF_RXRPC is not set
CONFIG_WIRELESS=y
+CONFIG_WIRELESS_EXT=y
+CONFIG_WEXT_CORE=y
+CONFIG_WEXT_PROC=y
+CONFIG_WEXT_SPY=y
+CONFIG_WEXT_PRIV=y
# CONFIG_CFG80211 is not set
# CONFIG_LIB80211 is not set
@@ -551,7 +581,7 @@ CONFIG_WIRELESS=y
# Some wireless drivers require a rate control algorithm
#
# CONFIG_WIMAX is not set
-# CONFIG_RFKILL is not set
+CONFIG_RFKILL=y
# CONFIG_NET_9P is not set
# CONFIG_CAIF is not set
# CONFIG_CEPH_LIB is not set
@@ -567,7 +597,9 @@ CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
# CONFIG_DEVTMPFS is not set
CONFIG_STANDALONE=y
CONFIG_PREVENT_FIRMWARE_BUILD=y
-# CONFIG_FW_LOADER is not set
+CONFIG_FW_LOADER=y
+CONFIG_FIRMWARE_IN_KERNEL=y
+CONFIG_EXTRA_FIRMWARE=""
# CONFIG_SYS_HYPERVISOR is not set
# CONFIG_CONNECTOR is not set
CONFIG_MTD=y
@@ -807,8 +839,9 @@ CONFIG_TI_DAVINCI_CPDMA=y
# CONFIG_NETDEV_1000 is not set
# CONFIG_NETDEV_10000 is not set
CONFIG_WLAN=y
-# CONFIG_USB_ZD1201 is not set
# CONFIG_HOSTAP is not set
+# CONFIG_HOSTAP_FIRMWARE is not set
+CONFIG_WL12XX_PLATFORM_DATA=y
#
# Enable WiMAX (Networking options) to see the WiMAX drivers
@@ -1421,7 +1454,7 @@ CONFIG_USB_OTG_UTILS=y
CONFIG_NOP_USB_XCEIV=y
CONFIG_MMC=y
# CONFIG_MMC_DEBUG is not set
-# CONFIG_MMC_UNSAFE_RESUME is not set
+CONFIG_MMC_UNSAFE_RESUME=y
#
# MMC/SD/SDIO Card Drivers
@@ -1745,9 +1778,9 @@ CONFIG_HAVE_ARCH_KGDB=y
#
# Security options
#
-# CONFIG_KEYS is not set
+CONFIG_KEYS=y
# CONFIG_SECURITY_DMESG_RESTRICT is not set
-# CONFIG_SECURITY is not set
+CONFIG_SECURITY=y
# CONFIG_SECURITYFS is not set
CONFIG_DEFAULT_SECURITY_DAC=y
CONFIG_DEFAULT_SECURITY=""
@@ -1777,7 +1810,7 @@ CONFIG_CRYPTO=y
# CONFIG_CRYPTO_CBC is not set
# CONFIG_CRYPTO_CTR is not set
# CONFIG_CRYPTO_CTS is not set
-# CONFIG_CRYPTO_ECB is not set
+CONFIG_CRYPTO_ECB=y
# CONFIG_CRYPTO_LRW is not set
# CONFIG_CRYPTO_PCBC is not set
# CONFIG_CRYPTO_XTS is not set
@@ -1792,11 +1825,11 @@ CONFIG_CRYPTO=y
#
# Digest
#
-# CONFIG_CRYPTO_CRC32C is not set
+CONFIG_CRYPTO_CRC32C=y
# CONFIG_CRYPTO_GHASH is not set
# CONFIG_CRYPTO_MD4 is not set
-# CONFIG_CRYPTO_MD5 is not set
-# CONFIG_CRYPTO_MICHAEL_MIC is not set
+CONFIG_CRYPTO_MD5=y
+CONFIG_CRYPTO_MICHAEL_MIC=y
# CONFIG_CRYPTO_RMD128 is not set
# CONFIG_CRYPTO_RMD160 is not set
# CONFIG_CRYPTO_RMD256 is not set
@@ -1810,9 +1843,9 @@ CONFIG_CRYPTO=y
#
# Ciphers
#
-# CONFIG_CRYPTO_AES is not set
+CONFIG_CRYPTO_AES=y
# CONFIG_CRYPTO_ANUBIS is not set
-# CONFIG_CRYPTO_ARC4 is not set
+CONFIG_CRYPTO_ARC4=y
# CONFIG_CRYPTO_BLOWFISH is not set
# CONFIG_CRYPTO_CAMELLIA is not set
# CONFIG_CRYPTO_CAST5 is not set
@@ -1837,7 +1870,7 @@ CONFIG_CRYPTO=y
# Random Number Generation
#
# CONFIG_CRYPTO_ANSI_CPRNG is not set
-# CONFIG_CRYPTO_HW is not set
+CONFIG_CRYPTO_HW=y
# CONFIG_BINARY_PRINTF is not set
#
@@ -1850,7 +1883,7 @@ CONFIG_CRC_CCITT=m
CONFIG_CRC_T10DIF=m
# CONFIG_CRC_ITU_T is not set
CONFIG_CRC32=y
-# CONFIG_CRC7 is not set
+CONFIG_CRC7=y
# CONFIG_LIBCRC32C is not set
CONFIG_ZLIB_INFLATE=y
CONFIG_ZLIB_DEFLATE=y
--
1.7.0.4
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
@@ -0,0 +1,539 @@
From 15a3ca5868a7ba5b0526a566605675b77c45d40d Mon Sep 17 00:00:00 2001
From: Melissa Watkins <m-watkins@ti.com>
Date: Tue, 14 Jun 2011 09:32:53 -0500
Subject: [PATCH] uio_pruss
Signed-off-by: Melissa Watkins <m-watkins@ti.com>
---
arch/arm/configs/da850_omapl138_defconfig | 7 +-
arch/arm/mach-davinci/board-da850-evm.c | 3 +
arch/arm/mach-davinci/da850.c | 40 ++++-
arch/arm/mach-davinci/devices-da8xx.c | 75 ++++++++
arch/arm/mach-davinci/include/mach/da8xx.h | 4 +
drivers/uio/Kconfig | 10 +
drivers/uio/Makefile | 1 +
drivers/uio/uio_pru.c | 274 ++++++++++++++++++++++++++++
8 files changed, 406 insertions(+), 8 deletions(-)
create mode 100644 drivers/uio/uio_pru.c
diff --git a/arch/arm/configs/da850_omapl138_defconfig b/arch/arm/configs/da850_omapl138_defconfig
index 73af1fc..646c477 100644
--- a/arch/arm/configs/da850_omapl138_defconfig
+++ b/arch/arm/configs/da850_omapl138_defconfig
@@ -1513,7 +1513,12 @@ CONFIG_RTC_INTF_DEV=y
CONFIG_RTC_DRV_OMAP=y
# CONFIG_DMADEVICES is not set
# CONFIG_AUXDISPLAY is not set
-# CONFIG_UIO is not set
+CONFIG_UIO=y
+# CONFIG_UIO_PDRV is not set
+# CONFIG_UIO_PDRV_GENIRQ is not set
+# CONFIG_UIO_SMX is not set
+# CONFIG_UIO_SERCOS3 is not set
+CONFIG_UIO_PRUSS=m
# CONFIG_STAGING is not set
#
diff --git a/arch/arm/mach-davinci/board-da850-evm.c b/arch/arm/mach-davinci/board-da850-evm.c
index 80745f6..5efd814 100644
--- a/arch/arm/mach-davinci/board-da850-evm.c
+++ b/arch/arm/mach-davinci/board-da850-evm.c
@@ -1876,6 +1876,9 @@ static __init void da850_evm_init(void)
platform_device_register(&da850_gpio_i2c);
+ /* Register PRUSS device */
+ da8xx_register_pruss();
+
ret = da8xx_register_watchdog();
if (ret)
pr_warning("da830_evm_init: watchdog registration failed: %d\n",
diff --git a/arch/arm/mach-davinci/da850.c b/arch/arm/mach-davinci/da850.c
index 884c88c..6fefd50 100644
--- a/arch/arm/mach-davinci/da850.c
+++ b/arch/arm/mach-davinci/da850.c
@@ -241,6 +241,13 @@ static struct clk tptc2_clk = {
.flags = ALWAYS_ENABLED,
};
+static struct clk pruss_clk = {
+ .name = "pruss",
+ .parent = &pll0_sysclk2,
+ .lpsc = DA8XX_LPSC0_DMAX,
+ .flags = ALWAYS_ENABLED,
+};
+
static struct clk uart0_clk = {
.name = "uart0",
.parent = &pll0_sysclk2,
@@ -398,12 +405,28 @@ static struct clk ehrpwm_clk = {
.flags = DA850_CLK_ASYNC3,
};
-static struct clk ecap_clk = {
- .name = "ecap",
- .parent = &pll0_sysclk2,
- .lpsc = DA8XX_LPSC1_ECAP,
- .gpsc = 1,
- .flags = DA850_CLK_ASYNC3,
+static struct clk ecap0_clk = {
+ .name = "ecap0",
+ .parent = &pll0_sysclk2,
+ .lpsc = DA8XX_LPSC1_ECAP,
+ .flags = DA850_CLK_ASYNC3,
+ .gpsc = 1,
+};
+
+static struct clk ecap1_clk = {
+ .name = "ecap1",
+ .parent = &pll0_sysclk2,
+ .lpsc = DA8XX_LPSC1_ECAP,
+ .flags = DA850_CLK_ASYNC3,
+ .gpsc = 1,
+};
+
+static struct clk ecap2_clk = {
+ .name = "ecap2",
+ .parent = &pll0_sysclk2,
+ .lpsc = DA8XX_LPSC1_ECAP,
+ .flags = DA850_CLK_ASYNC3,
+ .gpsc = 1,
};
static struct clk usb11_clk = {
@@ -447,6 +470,7 @@ static struct clk_lookup da850_clks[] = {
CLK(NULL, "tptc1", &tptc1_clk),
CLK(NULL, "tpcc1", &tpcc1_clk),
CLK(NULL, "tptc2", &tptc2_clk),
+ CLK(NULL, "pruss", &pruss_clk),
CLK(NULL, "uart0", &uart0_clk),
CLK(NULL, "uart1", &uart1_clk),
CLK(NULL, "uart2", &uart2_clk),
@@ -469,7 +493,9 @@ static struct clk_lookup da850_clks[] = {
CLK("davinci-mcbsp.1", NULL, &mcbsp1_clk),
CLK(NULL, "vpif", &vpif_clk),
CLK(NULL, "ehrpwm", &ehrpwm_clk),
- CLK(NULL, "ecap", &ecap_clk),
+ CLK(NULL, "ecap0", &ecap0_clk),
+ CLK(NULL, "ecap1", &ecap1_clk),
+ CLK(NULL, "ecap2", &ecap2_clk),
CLK(NULL, "usb11", &usb11_clk),
CLK(NULL, "usb20", &usb20_clk),
CLK(NULL, NULL, NULL),
diff --git a/arch/arm/mach-davinci/devices-da8xx.c b/arch/arm/mach-davinci/devices-da8xx.c
index dd62e44..08f6dfa 100644
--- a/arch/arm/mach-davinci/devices-da8xx.c
+++ b/arch/arm/mach-davinci/devices-da8xx.c
@@ -1064,3 +1064,78 @@ int __init da850_register_sata(unsigned long refclkpn)
return platform_device_register(&da850_sata_device);
}
+
+static struct resource pruss_resources[] = {
+ [0] = {
+ .start = DA8XX_PRUSS_BASE,
+ .end = DA8XX_PRUSS_BASE + SZ_64K - 1,
+ .flags = IORESOURCE_MEM,
+ },
+ [1] = {
+ .start = DA8XX_L3RAM_BASE,
+ .end = DA8XX_L3RAM_BASE + SZ_128K - 1,
+ .flags = IORESOURCE_MEM,
+ },
+ [2] = {
+ .start = 0,
+ .end = SZ_256K - 1,
+ .flags = IORESOURCE_MEM,
+ },
+
+ [3] = {
+ .start = IRQ_DA8XX_EVTOUT0,
+ .end = IRQ_DA8XX_EVTOUT0,
+ .flags = IORESOURCE_IRQ,
+ },
+ [4] = {
+ .start = IRQ_DA8XX_EVTOUT1,
+ .end = IRQ_DA8XX_EVTOUT1,
+ .flags = IORESOURCE_IRQ,
+ },
+ [5] = {
+ .start = IRQ_DA8XX_EVTOUT2,
+ .end = IRQ_DA8XX_EVTOUT2,
+ .flags = IORESOURCE_IRQ,
+ },
+ [6] = {
+ .start = IRQ_DA8XX_EVTOUT3,
+ .end = IRQ_DA8XX_EVTOUT3,
+ .flags = IORESOURCE_IRQ,
+ },
+ [7] = {
+ .start = IRQ_DA8XX_EVTOUT4,
+ .end = IRQ_DA8XX_EVTOUT4,
+ .flags = IORESOURCE_IRQ,
+ },
+ [8] = {
+ .start = IRQ_DA8XX_EVTOUT5,
+ .end = IRQ_DA8XX_EVTOUT5,
+ .flags = IORESOURCE_IRQ,
+ },
+ [9] = {
+ .start = IRQ_DA8XX_EVTOUT6,
+ .end = IRQ_DA8XX_EVTOUT6,
+ .flags = IORESOURCE_IRQ,
+ },
+ [10] = {
+ .start = IRQ_DA8XX_EVTOUT7,
+ .end = IRQ_DA8XX_EVTOUT7,
+ .flags = IORESOURCE_IRQ,
+ },
+};
+
+static struct platform_device pruss_device = {
+ .name = "pruss",
+ .id = 0,
+ .num_resources = ARRAY_SIZE(pruss_resources),
+ .resource = pruss_resources,
+ .dev = {
+ .coherent_dma_mask = 0xffffffff,
+ }
+
+};
+
+int __init da8xx_register_pruss()
+{
+ return platform_device_register(&pruss_device);
+}
diff --git a/arch/arm/mach-davinci/include/mach/da8xx.h b/arch/arm/mach-davinci/include/mach/da8xx.h
index f9b70c4..ad0474f 100644
--- a/arch/arm/mach-davinci/include/mach/da8xx.h
+++ b/arch/arm/mach-davinci/include/mach/da8xx.h
@@ -78,6 +78,9 @@ extern unsigned int da850_max_speed;
#define DA8XX_DDR2_CTL_BASE 0xb0000000
#define DA8XX_ARM_RAM_BASE 0xffff0000
#define DA8XX_VPIF_BASE 0x01e17000
+#define DA8XX_PRUSS_BASE 0x01C30000
+#define DA8XX_L3RAM_BASE 0x80000000
+
void __init da830_init(void);
void __init da850_init(void);
@@ -108,6 +111,7 @@ int __init da850_register_vpif_capture(struct vpif_capture_config
int __init da850_register_sata(unsigned long refclkpn);
void __init da850_register_ehrpwm(char);
int __init da850_register_ecap(char);
+int da8xx_register_pruss(void);
extern struct platform_device da8xx_serial_device;
extern struct emac_platform_data da8xx_emac_pdata;
diff --git a/drivers/uio/Kconfig b/drivers/uio/Kconfig
index bb44079..4a26486 100644
--- a/drivers/uio/Kconfig
+++ b/drivers/uio/Kconfig
@@ -94,4 +94,14 @@ config UIO_NETX
To compile this driver as a module, choose M here; the module
will be called uio_netx.
+config UIO_PRUSS
+ tristate "Texas Instruments PRUSS driver"
+ depends on ARCH_DAVINCI_DA850
+ default n
+ help
+ PRUSS driver for OMAPL13X/DA8XX/AM17XX/AM18XX devices
+ PRUSS driver requires user space components
+ To compile this driver as a module, choose M here: the module
+ will be called uio_pruss.
+
endif
diff --git a/drivers/uio/Makefile b/drivers/uio/Makefile
index 18fd818..948d587 100644
--- a/drivers/uio/Makefile
+++ b/drivers/uio/Makefile
@@ -5,4 +5,5 @@ obj-$(CONFIG_UIO_PDRV_GENIRQ) += uio_pdrv_genirq.o
obj-$(CONFIG_UIO_AEC) += uio_aec.o
obj-$(CONFIG_UIO_SERCOS3) += uio_sercos3.o
obj-$(CONFIG_UIO_PCI_GENERIC) += uio_pci_generic.o
+obj-$(CONFIG_UIO_PRUSS) += uio_pru.o
obj-$(CONFIG_UIO_NETX) += uio_netx.o
diff --git a/drivers/uio/uio_pru.c b/drivers/uio/uio_pru.c
new file mode 100644
index 0000000..88af0a2
--- /dev/null
+++ b/drivers/uio/uio_pru.c
@@ -0,0 +1,274 @@
+/*
+ * UIO TI Programmable Real-Time Unit (PRU) driver.
+ *
+ * (C) 2010 Amit Chatterjee <amit.chatterjee@ti.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ */
+
+#include <linux/device.h>
+#include <linux/module.h>
+#include <linux/platform_device.h>
+#include <linux/uio_driver.h>
+#include <linux/io.h>
+#include <linux/clk.h>
+#include <linux/dma-mapping.h>
+#include <linux/slab.h>
+
+#define DRV_NAME "pruss"
+#define DRV_VERSION "0.01"
+
+/*
+0x01C30000 - 0x01C301FF Data RAM 0
+0x01C30200 - 0x01C31FFF Reserved
+0x01C32000 - 0x01C321FF Data RAM 1
+0x01C32200 - 0x01C33FFF Reserved
+0x01C34000 - 0x01C36FFF INTC Registers
+0x01C37000 - 0x01C373FF PRU0 Control Registers
+0x01C37400 - 0x01C377FF PRU0 Debug Registers
+0x01C37800 - 0x01C37BFF PRU1 Control Registers
+0x01C37C00 - 0x01C37FFF PRU1 Debug Registers
+0x01C38000 - 0x01C38FFF PRU0 Instruction RAM
+0x01C39000 - 0x01C3BFFF Reserved
+0x01C3C000 - 0x01C3CFFF PRU1 Instruction RAM
+0x01C3D000 - 0x01C3FFFF Reserved
+*/
+/*
+ * 3 PRU_EVTOUT0 PRUSS Interrupt
+ * 4 PRU_EVTOUT1 PRUSS Interrupt
+ * 5 PRU_EVTOUT2 PRUSS Interrupt
+ * 6 PRU_EVTOUT3 PRUSS Interrupt
+ * 7 PRU_EVTOUT4 PRUSS Interrupt
+ * 8 PRU_EVTOUT5 PRUSS Interrupt
+ * 9 PRU_EVTOUT6 PRUSS Interrupt
+ * 10 PRU_EVTOUT7 PRUSS Interrupt
+*/
+
+#define PRUSS_INSTANCE (8)
+
+static struct clk *pruss_clk = NULL, *ecap0_clk = NULL;
+static struct uio_info *info[PRUSS_INSTANCE];
+static void *ddr_virt_addr;
+static dma_addr_t ddr_phy_addr;
+
+
+
+static irqreturn_t pruss_handler(int irq, struct uio_info *dev_info)
+{
+ return IRQ_HANDLED;
+}
+
+static int __devinit pruss_probe(struct platform_device *dev)
+{
+ int ret = -ENODEV;
+ int count = 0;
+ struct resource *regs_pruram, *regs_l3ram, *regs_ddr;
+ char *string;
+
+ /* Power on PRU in case its not done as part of boot-loader */
+ pruss_clk = clk_get(&dev->dev, "pruss");
+ if (IS_ERR(pruss_clk)) {
+ dev_err(&dev->dev, "no pruss clock available\n");
+ ret = PTR_ERR(pruss_clk);
+ pruss_clk = NULL;
+ return ret;
+ } else {
+ clk_enable (pruss_clk);
+ }
+
+ ecap0_clk = clk_get(&dev->dev, "ecap0");
+ if (IS_ERR(ecap0_clk)) {
+ dev_err(&dev->dev, "no ecap0 clock available\n");
+ ret = PTR_ERR(ecap0_clk);
+ ecap0_clk = NULL;
+ return ret;
+ } else {
+ clk_enable (ecap0_clk);
+ }
+
+
+
+ for (count = 0; count < PRUSS_INSTANCE; count ++) {
+ info[count] = (struct uio_info *)kzalloc(sizeof (struct uio_info), GFP_KERNEL);
+ if (!info[count])
+ return -ENOMEM;
+
+ }
+
+ regs_pruram = platform_get_resource(dev, IORESOURCE_MEM, 0);
+ if (!regs_pruram) {
+ dev_err(&dev->dev, "No memory resource specified\n");
+ goto out_free;
+ }
+
+ regs_l3ram = platform_get_resource(dev, IORESOURCE_MEM, 1);
+ if (!regs_l3ram) {
+ dev_err(&dev->dev, "No memory resource specified\n");
+ goto out_free;
+ }
+
+ regs_ddr = platform_get_resource(dev, IORESOURCE_MEM, 2);
+ if (!regs_ddr) {
+ dev_err(&dev->dev, "No memory resource specified\n");
+ goto out_free;
+ }
+ ddr_virt_addr = dma_alloc_coherent (&dev->dev, regs_ddr->end-regs_ddr->start+1, &ddr_phy_addr, GFP_KERNEL|GFP_DMA);
+
+
+ for (count = 0; count < PRUSS_INSTANCE; count ++) {
+ info[count]->mem[0].addr = regs_pruram->start;
+ if (!info[count]->mem[0].addr) {
+ dev_err(&dev->dev, "Invalid memory resource\n");
+ break;
+ }
+
+ info[count]->mem[0].size = regs_pruram->end - regs_pruram->start + 1;
+ info[count]->mem[0].internal_addr = ioremap(regs_pruram->start, info[count]->mem[0].size);
+
+ if (!info[count]->mem[0].internal_addr) {
+ dev_err(&dev->dev, "Can't remap memory address range\n");
+ break;
+ }
+ info[count]->mem[0].memtype = UIO_MEM_PHYS;
+
+
+ info[count]->mem[1].addr = regs_l3ram->start;
+ if (!info[count]->mem[1].addr) {
+ dev_err(&dev->dev, "Invalid memory resource\n");
+ break;
+ }
+
+ info[count]->mem[1].size = regs_l3ram->end - regs_l3ram->start + 1;
+ info[count]->mem[1].internal_addr = ioremap(regs_l3ram->start, info[count]->mem[1].size);
+
+ if (!info[count]->mem[1].internal_addr) {
+ dev_err(&dev->dev, "Can't remap memory address range\n");
+ break;
+ }
+ info[count]->mem[1].memtype = UIO_MEM_PHYS;
+
+
+ info[count]->mem[2].size = regs_ddr->end - regs_ddr->start + 1;
+ if (!(info[count]->mem[2].size-1)) {
+ dev_err(&dev->dev, "Invalid memory resource\n");
+ break;
+ }
+
+
+ info[count]->mem[2].internal_addr = ddr_virt_addr;
+
+ if (!info[count]->mem[2].internal_addr) {
+ dev_err(&dev->dev, "Can't remap memory address range\n");
+ break;
+ }
+ info[count]->mem[2].addr = ddr_phy_addr;
+ info[count]->mem[2].memtype = UIO_MEM_PHYS;
+
+
+ string = kzalloc(20, GFP_KERNEL);
+ sprintf (string, "pruss_evt%d", count);
+ info[count]->name = string;
+ info[count]->version = "0.01";
+
+ /* Register PRUSS IRQ lines */
+ info[count]->irq = IRQ_DA8XX_EVTOUT0+count;
+
+ info[count]->irq_flags = IRQF_SHARED;
+ info[count]->handler = pruss_handler;
+
+ ret = uio_register_device(&dev->dev, info[count]);
+
+ if (ret < 0)
+ break;
+ }
+
+ platform_set_drvdata(dev, info);
+
+ if (ret < 0) {
+ if (ddr_virt_addr)
+ dma_free_coherent (&dev->dev, regs_ddr->end - regs_ddr->start + 1, ddr_virt_addr, ddr_phy_addr);
+ while (count --) {
+ uio_unregister_device (info[count]);
+ if (info[count]->name)
+ kfree (info[count]->name);
+ iounmap(info[count]->mem[0].internal_addr);
+ }
+ } else {
+ return 0;
+ }
+
+out_free:
+ for (count = 0; count < PRUSS_INSTANCE; count ++) {
+ if (info[count])
+ kfree(info[count]);
+ }
+
+ if(pruss_clk != NULL)
+ clk_put(pruss_clk);
+ if (ecap0_clk != NULL)
+ clk_put (ecap0_clk);
+
+ return ret;
+}
+
+static int __devexit pruss_remove(struct platform_device *dev)
+{
+ int count = 0;
+ struct uio_info **info;
+
+ info = (struct uio_info **)platform_get_drvdata(dev);
+
+ for (count = 0; count < PRUSS_INSTANCE; count ++) {
+ uio_unregister_device(info[count]);
+ if (info[count]->name)
+ kfree (info[count]->name);
+
+ }
+ iounmap(info[0]->mem[0].internal_addr);
+ iounmap(info[0]->mem[1].internal_addr);
+ if (ddr_virt_addr)
+ dma_free_coherent (&dev->dev, info[0]->mem[2].size, info[0]->mem[2].internal_addr, info[0]->mem[2].addr );
+
+ for (count = 0; count < PRUSS_INSTANCE; count ++) {
+ if (info[count])
+ kfree(info[count]);
+ }
+
+ platform_set_drvdata(dev, NULL);
+
+ if(pruss_clk != NULL)
+ clk_put(pruss_clk);
+ if (ecap0_clk != NULL)
+ clk_put (ecap0_clk);
+
+
+ return 0;
+}
+
+static struct platform_driver pruss_driver = {
+ .probe = pruss_probe,
+ .remove = __devexit_p(pruss_remove),
+ .driver = {
+ .name = DRV_NAME,
+ .owner = THIS_MODULE,
+ },
+};
+
+static int __init pruss_init_module(void)
+{
+ return platform_driver_register(&pruss_driver);
+}
+module_init(pruss_init_module);
+
+static void __exit pruss_exit_module(void)
+{
+ platform_driver_unregister(&pruss_driver);
+}
+module_exit(pruss_exit_module);
+
+MODULE_LICENSE("GPL v2");
+MODULE_VERSION(DRV_VERSION);
+MODULE_AUTHOR("Amit Chatterjee <amit.chatterjee@ti.com>");
--
1.7.0.4
@@ -0,0 +1,36 @@
SECTION = "kernel"
DESCRIPTION = "Linux kernel for DaVinci EVM from PSP, based on linux-davinci kernel"
LICENSE = "GPLv2"
KERNEL_IMAGETYPE = "uImage"
require multi-kernel.inc
S = "${WORKDIR}/git"
MULTI_CONFIG_BASE_SUFFIX = ""
BRANCH = "03.21.00.03"
SRCREV = "v2.6.37_DAVINCIPSP_03.21.00.04"
COMPATIBLE_MACHINE = "(omapl138)"
THISDIR := "${@os.path.dirname(bb.data.getVar('FILE', d, True))}"
CONFIGS_PSP = "${@base_set_filespath(["${THISDIR}/${PN}-${PV}/tipspkernel"], d)}:\
${@base_set_filespath(["${THISDIR}/${PN}/tipspkernel"], d)}:\
${@base_set_filespath(["${THISDIR}/files/tipspkernel"], d)}:"
FILESPATH =. "${@base_contains('DISTRO_FEATURES', 'tipspkernel', "${CONFIGS_PSP}", "", d)}"
SRC_URI += "git://arago-project.org/git/projects/linux-davinci.git;protocol=git;branch=${BRANCH} \
file://defconfig"
PATCHES_OVER_PSP = " \
file://0001-TI-WL12xx-MMC-patches-03.21.00.04.patch \
file://0002-da850-Set-maximum-OPP-frequency-to-456MHz.patch \
file://0003-AM18xx-WL1271-Enable-BT.patch \
file://0004-PSP03.21.00.04.sdk-activate-wireless-extensions.patch \
file://0005-Davinci-da850-Add-Mistral-WL12XX-config-support-to.patch \
file://0006-Add-wlan-and-BT-config-switches.patch \
file://uio_pruss.patch \
"
SRC_URI += "${@base_contains('DISTRO_FEATURES', 'tipspkernel', "", "${PATCHES_OVER_PSP}", d)}"