aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mmc/core/pwrseq_simple.c
diff options
context:
space:
mode:
authorUlf Hansson <ulf.hansson@linaro.org>2014-12-05 14:36:58 +0100
committerUlf Hansson <ulf.hansson@linaro.org>2015-01-28 12:32:07 +0100
commit8c96f89c62ecc8334d06820bff62ecf81be97c2b (patch)
tree8feac978c3df53147199f59b5fa7976de5218a0e /drivers/mmc/core/pwrseq_simple.c
parentmmc: pwrseq: Document DT bindings for the simple MMC power sequence (diff)
downloadlinux-dev-8c96f89c62ecc8334d06820bff62ecf81be97c2b.tar.xz
linux-dev-8c96f89c62ecc8334d06820bff62ecf81be97c2b.zip
mmc: pwrseq: Initial support for the simple MMC power sequence provider
To add the core part for the MMC power sequence, let's start by adding initial support for the simple MMC power sequence provider. In this initial step, the MMC power sequence node are fetched and the compatible string for the simple MMC power sequence provider are verified. At this point we don't parse the node for any properties, but instead that will be handled from following patches. Since there are no properties supported yet, let's just implement the ->alloc() and the ->free() callbacks. Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> Tested-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk> Reviewed-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk>
Diffstat (limited to 'drivers/mmc/core/pwrseq_simple.c')
-rw-r--r--drivers/mmc/core/pwrseq_simple.c48
1 files changed, 48 insertions, 0 deletions
diff --git a/drivers/mmc/core/pwrseq_simple.c b/drivers/mmc/core/pwrseq_simple.c
new file mode 100644
index 000000000000..61c991e4009d
--- /dev/null
+++ b/drivers/mmc/core/pwrseq_simple.c
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2014 Linaro Ltd
+ *
+ * Author: Ulf Hansson <ulf.hansson@linaro.org>
+ *
+ * License terms: GNU General Public License (GPL) version 2
+ *
+ * Simple MMC power sequence management
+ */
+#include <linux/kernel.h>
+#include <linux/slab.h>
+#include <linux/device.h>
+#include <linux/err.h>
+
+#include <linux/mmc/host.h>
+
+#include "pwrseq.h"
+
+struct mmc_pwrseq_simple {
+ struct mmc_pwrseq pwrseq;
+};
+
+static void mmc_pwrseq_simple_free(struct mmc_host *host)
+{
+ struct mmc_pwrseq_simple *pwrseq = container_of(host->pwrseq,
+ struct mmc_pwrseq_simple, pwrseq);
+
+ kfree(pwrseq);
+ host->pwrseq = NULL;
+}
+
+static struct mmc_pwrseq_ops mmc_pwrseq_simple_ops = {
+ .free = mmc_pwrseq_simple_free,
+};
+
+int mmc_pwrseq_simple_alloc(struct mmc_host *host, struct device *dev)
+{
+ struct mmc_pwrseq_simple *pwrseq;
+
+ pwrseq = kzalloc(sizeof(struct mmc_pwrseq_simple), GFP_KERNEL);
+ if (!pwrseq)
+ return -ENOMEM;
+
+ pwrseq->pwrseq.ops = &mmc_pwrseq_simple_ops;
+ host->pwrseq = &pwrseq->pwrseq;
+
+ return 0;
+}