bdb12fe
Bugzilla: 1012025
bdb12fe
Upstream-status: In beagle github repository https://github.com/beagleboard/kernel
bdb12fe
bdb12fe
From 82fe302f565e00cfde3e96c6132df93b39525e7b Mon Sep 17 00:00:00 2001
bdb12fe
From: Philipp Zabel <p.zabel@pengutronix.de>
bdb12fe
Date: Tue, 28 May 2013 17:06:15 +0200
bdb12fe
Subject: [PATCH] reset: Add driver for gpio-controlled reset pins
bdb12fe
bdb12fe
This driver implements a reset controller device that toggle a gpio
bdb12fe
connected to a reset pin of a peripheral IC. The delay between assertion
bdb12fe
and de-assertion of the reset signal can be configured via device tree.
bdb12fe
bdb12fe
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
bdb12fe
Reviewed-by: Stephen Warren <swarren@nvidia.com>
bdb12fe
---
bdb12fe
 .../devicetree/bindings/reset/gpio-reset.txt       |  35 +++++
bdb12fe
 drivers/reset/Kconfig                              |  11 ++
bdb12fe
 drivers/reset/Makefile                             |   1 +
bdb12fe
 drivers/reset/gpio-reset.c                         | 169 +++++++++++++++++++++
bdb12fe
 4 files changed, 216 insertions(+)
bdb12fe
 create mode 100644 Documentation/devicetree/bindings/reset/gpio-reset.txt
bdb12fe
 create mode 100644 drivers/reset/gpio-reset.c
bdb12fe
bdb12fe
diff --git a/Documentation/devicetree/bindings/reset/gpio-reset.txt b/Documentation/devicetree/bindings/reset/gpio-reset.txt
bdb12fe
new file mode 100644
bdb12fe
index 0000000..bca5348
bdb12fe
--- /dev/null
bdb12fe
+++ b/Documentation/devicetree/bindings/reset/gpio-reset.txt
bdb12fe
@@ -0,0 +1,35 @@
bdb12fe
+GPIO reset controller
bdb12fe
+=====================
bdb12fe
+
bdb12fe
+A GPIO reset controller controls a single GPIO that is connected to the reset
bdb12fe
+pin of a peripheral IC. Please also refer to reset.txt in this directory for
bdb12fe
+common reset controller binding usage.
bdb12fe
+
bdb12fe
+Required properties:
bdb12fe
+- compatible: Should be "gpio-reset"
bdb12fe
+- reset-gpios: A gpio used as reset line. The gpio specifier for this property
bdb12fe
+               depends on the gpio controller that provides the gpio.
bdb12fe
+- #reset-cells: 0, see below
bdb12fe
+
bdb12fe
+Optional properties:
bdb12fe
+- reset-delay-us: delay in microseconds. The gpio reset line will be asserted for
bdb12fe
+                  this duration to reset.
bdb12fe
+- initially-in-reset: boolean. If not set, the initial state should be a
bdb12fe
+                      deasserted reset line. If this property exists, the
bdb12fe
+                      reset line should be kept in reset.
bdb12fe
+
bdb12fe
+example:
bdb12fe
+
bdb12fe
+sii902x_reset: gpio-reset {
bdb12fe
+	compatible = "gpio-reset";
bdb12fe
+	reset-gpios = <&gpio5 0 GPIO_ACTIVE_LOW>;
bdb12fe
+	reset-delay-us = <10000>;
bdb12fe
+	initially-in-reset;
bdb12fe
+	#reset-cells = <0>;
bdb12fe
+};
bdb12fe
+
bdb12fe
+/* Device with nRESET pin connected to GPIO5_0 */
bdb12fe
+sii902x@39 {
bdb12fe
+	/* ... */
bdb12fe
+	resets = <&sii902x_reset>; /* active-low GPIO5_0, 10 ms delay */
bdb12fe
+};
bdb12fe
diff --git a/drivers/reset/Kconfig b/drivers/reset/Kconfig
bdb12fe
index c9d04f7..1a862df 100644
bdb12fe
--- a/drivers/reset/Kconfig
bdb12fe
+++ b/drivers/reset/Kconfig
bdb12fe
@@ -11,3 +11,14 @@ menuconfig RESET_CONTROLLER
bdb12fe
 	  via GPIOs or SoC-internal reset controller modules.
bdb12fe
 
bdb12fe
 	  If unsure, say no.
bdb12fe
+
bdb12fe
+if RESET_CONTROLLER
bdb12fe
+
bdb12fe
+config RESET_GPIO
bdb12fe
+	tristate "GPIO reset controller support"
bdb12fe
+	depends on GPIOLIB && OF
bdb12fe
+	help
bdb12fe
+	  This driver provides support for reset lines that are controlled
bdb12fe
+	  directly by GPIOs.
bdb12fe
+
bdb12fe
+endif
bdb12fe
diff --git a/drivers/reset/Makefile b/drivers/reset/Makefile
bdb12fe
index 1e2d83f..b854f20 100644
bdb12fe
--- a/drivers/reset/Makefile
bdb12fe
+++ b/drivers/reset/Makefile
bdb12fe
@@ -1 +1,2 @@
bdb12fe
 obj-$(CONFIG_RESET_CONTROLLER) += core.o
bdb12fe
+obj-$(CONFIG_RESET_GPIO) += gpio-reset.o
bdb12fe
diff --git a/drivers/reset/gpio-reset.c b/drivers/reset/gpio-reset.c
bdb12fe
new file mode 100644
bdb12fe
index 0000000..acc1076
bdb12fe
--- /dev/null
bdb12fe
+++ b/drivers/reset/gpio-reset.c
bdb12fe
@@ -0,0 +1,169 @@
bdb12fe
+/*
bdb12fe
+ * GPIO Reset Controller driver
bdb12fe
+ *
bdb12fe
+ * Copyright 2013 Philipp Zabel, Pengutronix
bdb12fe
+ *
bdb12fe
+ * This program is free software; you can redistribute it and/or modify
bdb12fe
+ * it under the terms of the GNU General Public License as published by
bdb12fe
+ * the Free Software Foundation; either version 2 of the License, or
bdb12fe
+ * (at your option) any later version.
bdb12fe
+ */
bdb12fe
+#include <linux/delay.h>
bdb12fe
+#include <linux/err.h>
bdb12fe
+#include <linux/gpio.h>
bdb12fe
+#include <linux/module.h>
bdb12fe
+#include <linux/of_gpio.h>
bdb12fe
+#include <linux/platform_device.h>
bdb12fe
+#include <linux/reset-controller.h>
bdb12fe
+
bdb12fe
+struct gpio_reset_data {
bdb12fe
+	struct reset_controller_dev rcdev;
bdb12fe
+	unsigned int gpio;
bdb12fe
+	bool active_low;
bdb12fe
+	u32 delay_us;
bdb12fe
+};
bdb12fe
+
bdb12fe
+static void __gpio_reset_set(struct reset_controller_dev *rcdev, int asserted)
bdb12fe
+{
bdb12fe
+	struct gpio_reset_data *drvdata = container_of(rcdev,
bdb12fe
+			struct gpio_reset_data, rcdev);
bdb12fe
+	int value = asserted;
bdb12fe
+
bdb12fe
+	if (drvdata->active_low)
bdb12fe
+		value = !value;
bdb12fe
+
bdb12fe
+	gpio_set_value(drvdata->gpio, value);
bdb12fe
+}
bdb12fe
+
bdb12fe
+static int gpio_reset(struct reset_controller_dev *rcdev, unsigned long id)
bdb12fe
+{
bdb12fe
+	struct gpio_reset_data *drvdata = container_of(rcdev,
bdb12fe
+			struct gpio_reset_data, rcdev);
bdb12fe
+
bdb12fe
+	if (drvdata->delay_us < 0)
bdb12fe
+		return -ENOSYS;
bdb12fe
+
bdb12fe
+	__gpio_reset_set(rcdev, 1);
bdb12fe
+	udelay(drvdata->delay_us);
bdb12fe
+	__gpio_reset_set(rcdev, 0);
bdb12fe
+
bdb12fe
+	return 0;
bdb12fe
+}
bdb12fe
+
bdb12fe
+static int gpio_reset_assert(struct reset_controller_dev *rcdev,
bdb12fe
+		unsigned long id)
bdb12fe
+{
bdb12fe
+	__gpio_reset_set(rcdev, 1);
bdb12fe
+
bdb12fe
+	return 0;
bdb12fe
+}
bdb12fe
+
bdb12fe
+static int gpio_reset_deassert(struct reset_controller_dev *rcdev,
bdb12fe
+		unsigned long id)
bdb12fe
+{
bdb12fe
+	__gpio_reset_set(rcdev, 0);
bdb12fe
+
bdb12fe
+	return 0;
bdb12fe
+}
bdb12fe
+
bdb12fe
+static struct reset_control_ops gpio_reset_ops = {
bdb12fe
+	.reset = gpio_reset,
bdb12fe
+	.assert = gpio_reset_assert,
bdb12fe
+	.deassert = gpio_reset_deassert,
bdb12fe
+};
bdb12fe
+
bdb12fe
+static int of_gpio_reset_xlate(struct reset_controller_dev *rcdev,
bdb12fe
+			       const struct of_phandle_args *reset_spec)
bdb12fe
+{
bdb12fe
+	if (WARN_ON(reset_spec->args_count != 0))
bdb12fe
+		return -EINVAL;
bdb12fe
+
bdb12fe
+	return 0;
bdb12fe
+}
bdb12fe
+
bdb12fe
+static int gpio_reset_probe(struct platform_device *pdev)
bdb12fe
+{
bdb12fe
+	struct device_node *np = pdev->dev.of_node;
bdb12fe
+	struct gpio_reset_data *drvdata;
bdb12fe
+	enum of_gpio_flags flags;
bdb12fe
+	unsigned long gpio_flags;
bdb12fe
+	bool initially_in_reset;
bdb12fe
+	int ret;
bdb12fe
+
bdb12fe
+	drvdata = devm_kzalloc(&pdev->dev, sizeof(*drvdata), GFP_KERNEL);
bdb12fe
+	if (drvdata == NULL)
bdb12fe
+		return -ENOMEM;
bdb12fe
+
bdb12fe
+	if (of_gpio_named_count(np, "reset-gpios") != 1)
bdb12fe
+		return -EINVAL;
bdb12fe
+
bdb12fe
+	drvdata->gpio = of_get_named_gpio_flags(np, "reset-gpios", 0, &flags);
bdb12fe
+	if (drvdata->gpio == -EPROBE_DEFER) {
bdb12fe
+		return drvdata->gpio;
bdb12fe
+	} else if (!gpio_is_valid(drvdata->gpio)) {
bdb12fe
+		dev_err(&pdev->dev, "invalid reset gpio: %d\n", drvdata->gpio);
bdb12fe
+		return drvdata->gpio;
bdb12fe
+	}
bdb12fe
+
bdb12fe
+	drvdata->active_low = flags & OF_GPIO_ACTIVE_LOW;
bdb12fe
+
bdb12fe
+	ret = of_property_read_u32(np, "reset-delay-us", &drvdata->delay_us);
bdb12fe
+	if (ret < 0)
bdb12fe
+		return ret;
bdb12fe
+
bdb12fe
+	initially_in_reset = of_property_read_bool(np, "initially-in-reset");
bdb12fe
+	if (drvdata->active_low ^ initially_in_reset)
bdb12fe
+		gpio_flags = GPIOF_OUT_INIT_HIGH;
bdb12fe
+	else
bdb12fe
+		gpio_flags = GPIOF_OUT_INIT_LOW;
bdb12fe
+
bdb12fe
+	ret = devm_gpio_request_one(&pdev->dev, drvdata->gpio, gpio_flags, NULL);
bdb12fe
+	if (ret < 0) {
bdb12fe
+		dev_err(&pdev->dev, "failed to request gpio %d: %d\n",
bdb12fe
+			drvdata->gpio, ret);
bdb12fe
+		return ret;
bdb12fe
+	}
bdb12fe
+
bdb12fe
+	drvdata->rcdev.of_node = np;
bdb12fe
+	drvdata->rcdev.owner = THIS_MODULE;
bdb12fe
+	drvdata->rcdev.nr_resets = 1;
bdb12fe
+	drvdata->rcdev.ops = &gpio_reset_ops;
bdb12fe
+	drvdata->rcdev.of_xlate = of_gpio_reset_xlate;
bdb12fe
+	reset_controller_register(&drvdata->rcdev);
bdb12fe
+
bdb12fe
+	platform_set_drvdata(pdev, drvdata);
bdb12fe
+
bdb12fe
+	return 0;
bdb12fe
+}
bdb12fe
+
bdb12fe
+static int gpio_reset_remove(struct platform_device *pdev)
bdb12fe
+{
bdb12fe
+	struct gpio_reset_data *drvdata = platform_get_drvdata(pdev);
bdb12fe
+
bdb12fe
+	reset_controller_unregister(&drvdata->rcdev);
bdb12fe
+
bdb12fe
+	return 0;
bdb12fe
+}
bdb12fe
+
bdb12fe
+static struct of_device_id gpio_reset_dt_ids[] = {
bdb12fe
+	{ .compatible = "gpio-reset" },
bdb12fe
+	{ }
bdb12fe
+};
bdb12fe
+
bdb12fe
+static struct platform_driver gpio_reset_driver = {
bdb12fe
+	.probe = gpio_reset_probe,
bdb12fe
+	.remove = gpio_reset_remove,
bdb12fe
+	.driver = {
bdb12fe
+		.name = "gpio-reset",
bdb12fe
+		.owner = THIS_MODULE,
bdb12fe
+		.of_match_table = of_match_ptr(gpio_reset_dt_ids),
bdb12fe
+	},
bdb12fe
+};
bdb12fe
+
bdb12fe
+module_platform_driver(gpio_reset_driver);
bdb12fe
+
bdb12fe
+MODULE_AUTHOR("Philipp Zabel <p.zabel@pengutronix.de>");
bdb12fe
+MODULE_DESCRIPTION("gpio reset controller");
bdb12fe
+MODULE_LICENSE("GPL");
bdb12fe
+MODULE_ALIAS("platform:gpio-reset");
bdb12fe
+MODULE_DEVICE_TABLE(of, gpio_reset_dt_ids);
bdb12fe
-- 
bdb12fe
1.8.2.1
bdb12fe
bdb12fe
From 03664ac63b20b55af9522449bbad048476d259d5 Mon Sep 17 00:00:00 2001
bdb12fe
From: Joel Fernandes <joelf@ti.com>
bdb12fe
Date: Wed, 3 Jul 2013 17:29:44 -0500
bdb12fe
Subject: [PATCH 2/2] sound: soc: soc-dmaengine-pcm: Add support for new
bdb12fe
 DMAEngine request API
bdb12fe
bdb12fe
Formerly these resources were coming HWMOD on OMAP-like SoCs. With the
bdb12fe
impending removal of HWMOD data, drivers are being converted to use the
bdb12fe
"of-dma" method of requesting DMA channels which from DT and can be obtained
bdb12fe
using the dma_request_slave_channel API. Add support to the soc-dmaengine-pcm
bdb12fe
helpers so that we can fetch and open channels using this method.
bdb12fe
bdb12fe
Signed-off-by: Joel Fernandes <joelf@ti.com>
bdb12fe
---
bdb12fe
 sound/core/pcm_dmaengine.c | 22 ++++++++++++++++++++++
bdb12fe
 1 file changed, 22 insertions(+)
bdb12fe
bdb12fe
diff --git a/sound/core/pcm_dmaengine.c b/sound/core/pcm_dmaengine.c
bdb12fe
index aa924d9..461fe4f 100644
bdb12fe
--- a/sound/core/pcm_dmaengine.c
bdb12fe
+++ b/sound/core/pcm_dmaengine.c
bdb12fe
@@ -276,6 +276,16 @@ struct dma_chan *snd_dmaengine_pcm_request_channel(dma_filter_fn filter_fn,
bdb12fe
 }
bdb12fe
 EXPORT_SYMBOL_GPL(snd_dmaengine_pcm_request_channel);
bdb12fe
 
bdb12fe
+struct dma_chan *snd_dmaengine_pcm_request_slave_channel(
bdb12fe
+	struct snd_pcm_substream *substream, char *name)
bdb12fe
+{
bdb12fe
+	struct snd_soc_pcm_runtime *rtd = substream->private_data;
bdb12fe
+	struct device *dev = snd_soc_dai_get_drvdata(rtd->cpu_dai);
bdb12fe
+
bdb12fe
+	return dma_request_slave_channel(dev, name);
bdb12fe
+}
bdb12fe
+EXPORT_SYMBOL_GPL(snd_dmaengine_pcm_request_slave_channel);
bdb12fe
+
bdb12fe
 /**
bdb12fe
  * snd_dmaengine_pcm_open - Open a dmaengine based PCM substream
bdb12fe
  * @substream: PCM substream
bdb12fe
@@ -334,6 +344,18 @@ int snd_dmaengine_pcm_open_request_chan(struct snd_pcm_substream *substream,
bdb12fe
 }
bdb12fe
 EXPORT_SYMBOL_GPL(snd_dmaengine_pcm_open_request_chan);
bdb12fe
 
bdb12fe
+int snd_dmaengine_pcm_open_request_slave_chan(struct snd_pcm_substream *substream, char *name)
bdb12fe
+{
bdb12fe
+	if(substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
bdb12fe
+		return snd_dmaengine_pcm_open(substream,
bdb12fe
+			    snd_dmaengine_pcm_request_slave_channel(substream, "tx"));
bdb12fe
+	} else {
bdb12fe
+		return snd_dmaengine_pcm_open(substream,
bdb12fe
+			    snd_dmaengine_pcm_request_slave_channel(substream, "rx"));
bdb12fe
+	}
bdb12fe
+}
bdb12fe
+EXPORT_SYMBOL_GPL(snd_dmaengine_pcm_open_request_slave_chan);
bdb12fe
+
bdb12fe
 /**
bdb12fe
  * snd_dmaengine_pcm_close - Close a dmaengine based PCM substream
bdb12fe
  * @substream: PCM substream
bdb12fe
-- 
bdb12fe
1.8.4.rc3
bdb12fe
bdb12fe
From ae38683badc8c80b29ccc8aa4e059f900b603551 Mon Sep 17 00:00:00 2001
bdb12fe
From: Pantelis Antoniou <panto@antoniou-consulting.com>
bdb12fe
Date: Fri, 26 Oct 2012 15:48:00 +0300
bdb12fe
Subject: [PATCH 1/2] omap-hsmmc: Correct usage of of_find_node_by_name
bdb12fe
bdb12fe
of_find_node_by_name expect to have the parent node reference taken.
bdb12fe
---
bdb12fe
 drivers/mmc/host/omap_hsmmc.c | 10 ++++++++++
bdb12fe
 1 file changed, 10 insertions(+)
bdb12fe
bdb12fe
diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
bdb12fe
index 6ac63df..f5b660c 100644
bdb12fe
--- a/drivers/mmc/host/omap_hsmmc.c
bdb12fe
+++ b/drivers/mmc/host/omap_hsmmc.c
bdb12fe
@@ -1893,6 +1893,16 @@ static int omap_hsmmc_probe(struct platform_device *pdev)
bdb12fe
 	 * as we want. */
bdb12fe
 	mmc->max_segs = 1024;
bdb12fe
 
bdb12fe
+	/* Eventually we should get our max_segs limitation for EDMA by
bdb12fe
+	 * querying the dmaengine API */
bdb12fe
+	if (pdev->dev.of_node) {
bdb12fe
+		struct device_node *parent = of_node_get(pdev->dev.of_node->parent);
bdb12fe
+		struct device_node *node;
bdb12fe
+		node = of_find_node_by_name(parent, "edma");
bdb12fe
+		if (node)
bdb12fe
+			mmc->max_segs = 16;
bdb12fe
+	}
bdb12fe
+
bdb12fe
 	mmc->max_blk_size = 512;       /* Block Length at max can be 1024 */
bdb12fe
 	mmc->max_blk_count = 0xFFFF;    /* No. of Blocks is 16 bits */
bdb12fe
 	mmc->max_req_size = mmc->max_blk_size * mmc->max_blk_count;
bdb12fe
-- 
bdb12fe
1.8.2.1
bdb12fe
bdb12fe
From 5d93a65cfc4ff6aaf78ab49f71daa2a644ea2ace Mon Sep 17 00:00:00 2001
bdb12fe
From: Pantelis Antoniou <panto@antoniou-consulting.com>
bdb12fe
Date: Fri, 30 Nov 2012 12:18:16 +0200
bdb12fe
Subject: [PATCH 2/2] omap_hsmmc: Add reset gpio
bdb12fe
bdb12fe
Add a gpio property for controlling reset of the mmc device.
bdb12fe
eMMC on the beaglebone black requires it.
bdb12fe
bdb12fe
Signed-off-by: Pantelis Antoniou <panto@antoniou-consulting.com>
bdb12fe
---
bdb12fe
 drivers/mmc/host/omap_hsmmc.c          | 40 +++++++++++++++++++++++++++++++++-
bdb12fe
 include/linux/platform_data/mmc-omap.h |  3 +++
bdb12fe
 2 files changed, 42 insertions(+), 1 deletion(-)
bdb12fe
bdb12fe
diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
bdb12fe
index f5b660c..1bdb90f 100644
bdb12fe
--- a/drivers/mmc/host/omap_hsmmc.c
bdb12fe
+++ b/drivers/mmc/host/omap_hsmmc.c
bdb12fe
@@ -41,6 +41,8 @@
bdb12fe
 #include <linux/pinctrl/consumer.h>
bdb12fe
 #include <linux/pm_runtime.h>
bdb12fe
 #include <linux/platform_data/mmc-omap.h>
bdb12fe
+#include <linux/pinctrl/consumer.h>
bdb12fe
+#include <linux/err.h>
bdb12fe
 
bdb12fe
 /* OMAP HSMMC Host Controller Registers */
bdb12fe
 #define OMAP_HSMMC_SYSSTATUS	0x0014
bdb12fe
@@ -392,6 +394,7 @@ static inline int omap_hsmmc_have_reg(void)
bdb12fe
 static int omap_hsmmc_gpio_init(struct omap_mmc_platform_data *pdata)
bdb12fe
 {
bdb12fe
 	int ret;
bdb12fe
+	unsigned long flags;
bdb12fe
 
bdb12fe
 	if (gpio_is_valid(pdata->slots[0].switch_pin)) {
bdb12fe
 		if (pdata->slots[0].cover)
bdb12fe
@@ -421,6 +424,24 @@ static int omap_hsmmc_gpio_init(struct omap_mmc_platform_data *pdata)
bdb12fe
 	} else
bdb12fe
 		pdata->slots[0].gpio_wp = -EINVAL;
bdb12fe
 
bdb12fe
+	if (gpio_is_valid(pdata->slots[0].gpio_reset)) {
bdb12fe
+		flags = pdata->slots[0].gpio_reset_active_low ?
bdb12fe
+				GPIOF_OUT_INIT_LOW : GPIOF_OUT_INIT_HIGH;
bdb12fe
+		ret = gpio_request_one(pdata->slots[0].gpio_reset, flags,
bdb12fe
+				"mmc_reset");
bdb12fe
+		if (ret)
bdb12fe
+			goto err_free_wp;
bdb12fe
+
bdb12fe
+		/* hold reset */
bdb12fe
+		udelay(pdata->slots[0].gpio_reset_hold_us);
bdb12fe
+
bdb12fe
+		gpio_set_value(pdata->slots[0].gpio_reset,
bdb12fe
+				!pdata->slots[0].gpio_reset_active_low);
bdb12fe
+
bdb12fe
+	} else
bdb12fe
+		pdata->slots[0].gpio_reset = -EINVAL;
bdb12fe
+
bdb12fe
+
bdb12fe
 	return 0;
bdb12fe
 
bdb12fe
 err_free_wp:
bdb12fe
@@ -434,6 +455,8 @@ err_free_sp:
bdb12fe
 
bdb12fe
 static void omap_hsmmc_gpio_free(struct omap_mmc_platform_data *pdata)
bdb12fe
 {
bdb12fe
+	if (gpio_is_valid(pdata->slots[0].gpio_reset))
bdb12fe
+		gpio_free(pdata->slots[0].gpio_reset);
bdb12fe
 	if (gpio_is_valid(pdata->slots[0].gpio_wp))
bdb12fe
 		gpio_free(pdata->slots[0].gpio_wp);
bdb12fe
 	if (gpio_is_valid(pdata->slots[0].switch_pin))
bdb12fe
@@ -788,7 +811,7 @@ omap_hsmmc_start_command(struct omap_hsmmc_host *host, struct mmc_command *cmd,
bdb12fe
 	 * ac, bc, adtc, bcr. Only commands ending an open ended transfer need
bdb12fe
 	 * a val of 0x3, rest 0x0.
bdb12fe
 	 */
bdb12fe
-	if (cmd == host->mrq->stop)
bdb12fe
+	if (host->mrq && cmd == host->mrq->stop)
bdb12fe
 		cmdtype = 0x3;
bdb12fe
 
bdb12fe
 	cmdreg = (cmd->opcode << 24) | (resptype << 16) | (cmdtype << 22);
bdb12fe
@@ -830,6 +853,8 @@ static void omap_hsmmc_request_done(struct omap_hsmmc_host *host, struct mmc_req
bdb12fe
 	int dma_ch;
bdb12fe
 	unsigned long flags;
bdb12fe
 
bdb12fe
+	BUG_ON(mrq == NULL);
bdb12fe
+
bdb12fe
 	spin_lock_irqsave(&host->irq_lock, flags);
bdb12fe
 	host->req_in_progress = 0;
bdb12fe
 	dma_ch = host->dma_ch;
bdb12fe
@@ -1720,6 +1745,7 @@ static struct omap_mmc_platform_data *of_get_hsmmc_pdata(struct device *dev)
bdb12fe
 	struct device_node *np = dev->of_node;
bdb12fe
 	u32 bus_width, max_freq;
bdb12fe
 	int cd_gpio, wp_gpio;
bdb12fe
+	enum of_gpio_flags reset_flags;
bdb12fe
 
bdb12fe
 	cd_gpio = of_get_named_gpio(np, "cd-gpios", 0);
bdb12fe
 	wp_gpio = of_get_named_gpio(np, "wp-gpios", 0);
bdb12fe
@@ -1737,6 +1763,14 @@ static struct omap_mmc_platform_data *of_get_hsmmc_pdata(struct device *dev)
bdb12fe
 	pdata->nr_slots = 1;
bdb12fe
 	pdata->slots[0].switch_pin = cd_gpio;
bdb12fe
 	pdata->slots[0].gpio_wp = wp_gpio;
bdb12fe
+	reset_flags = 0;
bdb12fe
+	pdata->slots[0].gpio_reset = of_get_named_gpio_flags(np,
bdb12fe
+			"reset-gpios", 0, &reset_flags);
bdb12fe
+	pdata->slots[0].gpio_reset_active_low =
bdb12fe
+		(reset_flags & OF_GPIO_ACTIVE_LOW) != 0;
bdb12fe
+	pdata->slots[0].gpio_reset_hold_us = 100;	/* default */
bdb12fe
+	of_property_read_u32(np, "reset-gpio-hold-us",
bdb12fe
+			&pdata->slots[0].gpio_reset_hold_us);
bdb12fe
 
bdb12fe
 	if (of_find_property(np, "ti,non-removable", NULL)) {
bdb12fe
 		pdata->slots[0].nonremovable = true;
bdb12fe
@@ -1802,6 +1836,10 @@ static int omap_hsmmc_probe(struct platform_device *pdev)
bdb12fe
 		return -ENXIO;
bdb12fe
 	}
bdb12fe
 
bdb12fe
+	pinctrl = devm_pinctrl_get_select_default(&pdev->dev);
bdb12fe
+	if (IS_ERR(pinctrl))
bdb12fe
+		dev_warn(&pdev->dev, "unable to select pin group\n");
bdb12fe
+
bdb12fe
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
bdb12fe
 	irq = platform_get_irq(pdev, 0);
bdb12fe
 	if (res == NULL || irq < 0)
bdb12fe
diff --git a/include/linux/platform_data/mmc-omap.h b/include/linux/platform_data/mmc-omap.h
bdb12fe
index 2bf1b30..d548994 100644
bdb12fe
--- a/include/linux/platform_data/mmc-omap.h
bdb12fe
+++ b/include/linux/platform_data/mmc-omap.h
bdb12fe
@@ -115,6 +115,9 @@ struct omap_mmc_platform_data {
bdb12fe
 
bdb12fe
 		int switch_pin;			/* gpio (card detect) */
bdb12fe
 		int gpio_wp;			/* gpio (write protect) */
bdb12fe
+		int gpio_reset;			/* gpio (reset) */
bdb12fe
+		int gpio_reset_active_low;	/* 1 if reset is active low */
bdb12fe
+		u32 gpio_reset_hold_us;		/* time to hold in us */
bdb12fe
 
bdb12fe
 		int (*set_bus_mode)(struct device *dev, int slot, int bus_mode);
bdb12fe
 		int (*set_power)(struct device *dev, int slot,
bdb12fe
-- 
bdb12fe
1.8.2.1
bdb12fe
bdb12fe
From b45e4df71f07f2178db133db540e3f15e0b4ec05 Mon Sep 17 00:00:00 2001
bdb12fe
From: Pantelis Antoniou <panto@antoniou-consulting.com>
bdb12fe
Date: Sat, 15 Sep 2012 12:00:41 +0300
bdb12fe
Subject: [PATCH] pinctrl: pinctrl-single must be initialized early.
bdb12fe
bdb12fe
When using pinctrl-single to handle i2c initialization, it has
bdb12fe
to be done early. Whether this is the best way to do so, is an
bdb12fe
exercise left to the reader.
bdb12fe
---
bdb12fe
 drivers/pinctrl/pinctrl-single.c | 12 +++++++++++-
bdb12fe
 1 file changed, 11 insertions(+), 1 deletion(-)
bdb12fe
bdb12fe
diff --git a/drivers/pinctrl/pinctrl-single.c b/drivers/pinctrl/pinctrl-single.c
bdb12fe
index a82ace4..aeef35d 100644
bdb12fe
--- a/drivers/pinctrl/pinctrl-single.c
bdb12fe
+++ b/drivers/pinctrl/pinctrl-single.c
bdb12fe
@@ -1673,7 +1673,17 @@ static struct platform_driver pcs_driver = {
bdb12fe
 #endif
bdb12fe
 };
bdb12fe
 
bdb12fe
-module_platform_driver(pcs_driver);
bdb12fe
+static int __init pcs_init(void)
bdb12fe
+{
bdb12fe
+	return platform_driver_register(&pcs_driver);
bdb12fe
+}
bdb12fe
+postcore_initcall(pcs_init);
bdb12fe
+
bdb12fe
+static void __exit pcs_exit(void)
bdb12fe
+{
bdb12fe
+	platform_driver_unregister(&pcs_driver);
bdb12fe
+}
bdb12fe
+module_exit(pcs_exit);
bdb12fe
 
bdb12fe
 MODULE_AUTHOR("Tony Lindgren <tony@atomide.com>");
bdb12fe
 MODULE_DESCRIPTION("One-register-per-pin type device tree based pinctrl driver");
bdb12fe
-- 
bdb12fe
1.8.2.1
bdb12fe
bdb12fe
From e5e7abd2de7d8d4c74b5a1ccc6d47988250bd17d Mon Sep 17 00:00:00 2001
bdb12fe
From: Pantelis Antoniou <panto@antoniou-consulting.com>
bdb12fe
Date: Fri, 28 Jun 2013 18:39:55 +0300
bdb12fe
Subject: [PATCH 1/4] dts: beaglebone: Add I2C definitions for EEPROMs & capes
bdb12fe
bdb12fe
Add the I2C definitions for the EEPROM devices on the baseboard
bdb12fe
and on the possibly connected capes.
bdb12fe
bdb12fe
Signed-off-by: Pantelis Antoniou <panto@antoniou-consulting.com>
bdb12fe
---
bdb12fe
 arch/arm/boot/dts/am335x-bone-common.dtsi | 39 +++++++++++++++++++++++++++++++
bdb12fe
 1 file changed, 39 insertions(+)
bdb12fe
bdb12fe
diff --git a/arch/arm/boot/dts/am335x-bone-common.dtsi b/arch/arm/boot/dts/am335x-bone-common.dtsi
bdb12fe
index e3f27ec..2d12775 100644
bdb12fe
--- a/arch/arm/boot/dts/am335x-bone-common.dtsi
bdb12fe
+++ b/arch/arm/boot/dts/am335x-bone-common.dtsi
bdb12fe
@@ -84,6 +84,13 @@
bdb12fe
 		>;
bdb12fe
 	};
bdb12fe
 
bdb12fe
+	i2c2_pins: pinmux_i2c2_pins {
bdb12fe
+		pinctrl-single,pins = <
bdb12fe
+			0x178 0x73 	/* uart1_ctsn.i2c2_sda, SLEWCTRL_SLOW | INPUT_PULLUP | MODE3 */
bdb12fe
+			0x17c 0x73	/* uart1_rtsn.i2c2_scl, SLEWCTRL_SLOW | INPUT_PULLUP | MODE3 */
bdb12fe
+		>;
bdb12fe
+	};
bdb12fe
+
bdb12fe
 	uart0_pins: pinmux_uart0_pins {
bdb12fe
 		pinctrl-single,pins = <
bdb12fe
 			0x170 (PIN_INPUT_PULLUP | MUX_MODE0)	/* uart0_rxd.uart0_rxd */
bdb12fe
@@ -220,6 +227,38 @@
bdb12fe
 		reg = <0x24>;
bdb12fe
 	};
bdb12fe
 
bdb12fe
+	baseboard_eeprom: baseboard_eeprom@50 {
bdb12fe
+		compatible = "at,24c256";
bdb12fe
+		reg = <0x50>;
bdb12fe
+	};
bdb12fe
+};
bdb12fe
+
bdb12fe
+&i2c2 {
bdb12fe
+	pinctrl-names = "default";
bdb12fe
+	pinctrl-0 = <&i2c2_pins>;
bdb12fe
+
bdb12fe
+	status = "okay";
bdb12fe
+	clock-frequency = <100000>;
bdb12fe
+
bdb12fe
+	cape_eeprom0: cape_eeprom0@54 {
bdb12fe
+		compatible = "at,24c256";
bdb12fe
+		reg = <0x54>;
bdb12fe
+	};
bdb12fe
+
bdb12fe
+	cape_eeprom1: cape_eeprom1@55 {
bdb12fe
+		compatible = "at,24c256";
bdb12fe
+		reg = <0x55>;
bdb12fe
+	};
bdb12fe
+
bdb12fe
+	cape_eeprom2: cape_eeprom2@56 {
bdb12fe
+		compatible = "at,24c256";
bdb12fe
+		reg = <0x56>;
bdb12fe
+	};
bdb12fe
+
bdb12fe
+	cape_eeprom3: cape_eeprom3@57 {
bdb12fe
+		compatible = "at,24c256";
bdb12fe
+		reg = <0x57>;
bdb12fe
+	};
bdb12fe
 };
bdb12fe
 
bdb12fe
 /include/ "tps65217.dtsi"
bdb12fe
-- 
bdb12fe
1.8.4.rc3