All of lore.kernel.org
 help / color / mirror / Atom feed
From: Philipp Zabel <philipp.zabel@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: Samuel Ortiz <sameo@openedhand.com>,
	Philipp Zabel <philipp.zabel@gmail.com>
Subject: [PATCH 1/7] MFD: ASIC3: add API for EXTCF and SDHWCTRL register manipulation
Date: Thu,  4 Jun 2009 20:36:10 +0200	[thread overview]
Message-ID: <1244140576-18006-2-git-send-email-philipp.zabel@gmail.com> (raw)
In-Reply-To: <1244140576-18006-1-git-send-email-philipp.zabel@gmail.com>

Those registers are needed for PCMCIA and MMC/SDIO operation as
well as for the DS1WM.

Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
---
 drivers/mfd/asic3.c       |   48 +++++++++++++++++++++++++++++++++++++++++++++
 include/linux/mfd/asic3.h |   13 +++++++----
 2 files changed, 56 insertions(+), 5 deletions(-)

diff --git a/drivers/mfd/asic3.c b/drivers/mfd/asic3.c
index 9e48545..8e1653a 100644
--- a/drivers/mfd/asic3.c
+++ b/drivers/mfd/asic3.c
@@ -52,6 +52,54 @@ static inline u32 asic3_read_register(struct asic3 *asic,
 			(reg >> asic->bus_shift));
 }
 
+void asic3_set_extcf_select(struct device *dev, u32 bits, int value)
+{
+	struct asic3 *asic = dev->driver_data;
+	unsigned long flags;
+	u32 v;
+
+	spin_lock_irqsave(&asic->lock, flags);
+	v = asic3_read_register(asic, ASIC3_OFFSET(EXTCF, SELECT));
+	if (value)
+		v |= bits;
+	else
+		v &= ~bits;
+	asic3_write_register(asic, ASIC3_OFFSET(EXTCF, SELECT), v);
+	spin_unlock_irqrestore(&asic->lock, flags);
+}
+EXPORT_SYMBOL(asic3_set_extcf_select);
+
+void asic3_set_extcf_reset(struct device *dev, u32 bits, int value)
+{
+	struct asic3 *asic = dev->driver_data;
+	unsigned long flags;
+	u32 v;
+
+	spin_lock_irqsave(&asic->lock, flags);
+	v = asic3_read_register(asic, ASIC3_OFFSET(EXTCF, RESET));
+	if (value)
+		v |= bits;
+	else
+		v &= ~bits;
+	asic3_write_register(asic, ASIC3_OFFSET(EXTCF, RESET), v);
+	spin_unlock_irqrestore(&asic->lock, flags);
+}
+
+void asic3_set_sdhwctrl(struct asic3 *asic, u32 bits, int value)
+{
+	unsigned long flags;
+	u32 v;
+
+	spin_lock_irqsave(&asic->lock, flags);
+	v = asic3_read_register(asic, ASIC3_OFFSET(SDHWCTRL, SDCONF));
+	if (value)
+		v |= bits;
+	else
+		v &= ~bits;
+	asic3_write_register(asic, ASIC3_OFFSET(SDHWCTRL, SDCONF), v);
+	spin_unlock_irqrestore(&asic->lock, flags);
+}
+
 /* IRQs */
 #define MAX_ASIC_ISR_LOOPS    20
 #define ASIC3_GPIO_BASE_INCR \
diff --git a/include/linux/mfd/asic3.h b/include/linux/mfd/asic3.h
index 322cd6d..cd02d20 100644
--- a/include/linux/mfd/asic3.h
+++ b/include/linux/mfd/asic3.h
@@ -16,6 +16,9 @@
 
 #include <linux/types.h>
 
+/* for PCMCIA */
+extern void asic3_set_extcf_select(struct device *dev, u32 bits, int value);
+
 struct asic3_platform_data {
 	u16 *gpio_config;
 	unsigned int gpio_config_num;
@@ -227,8 +230,8 @@ struct asic3_platform_data {
 
 
 /* Basic control of the SD ASIC */
-#define ASIC3_SDHWCTRL_Base	0x0E00
-#define ASIC3_SDHWCTRL_SDConf    0x00
+#define ASIC3_SDHWCTRL_BASE     0x0E00
+#define ASIC3_SDHWCTRL_SDCONF     0x00
 
 #define ASIC3_SDHWCTRL_SUSPEND    (1 << 0)  /* 1=suspend all SD operations */
 #define ASIC3_SDHWCTRL_CLKSEL     (1 << 1)  /* 1=SDICK, 0=HCLK */
@@ -242,10 +245,10 @@ struct asic3_platform_data {
 /* SD card power supply ctrl 1=enable */
 #define ASIC3_SDHWCTRL_SDPWR      (1 << 6)
 
-#define ASIC3_EXTCF_Base		0x1100
+#define ASIC3_EXTCF_BASE        0x1100
 
-#define ASIC3_EXTCF_Select         0x00
-#define ASIC3_EXTCF_Reset          0x04
+#define ASIC3_EXTCF_SELECT        0x00
+#define ASIC3_EXTCF_RESET         0x04
 
 #define ASIC3_EXTCF_SMOD0	         (1 << 0)  /* slot number of mode 0 */
 #define ASIC3_EXTCF_SMOD1	         (1 << 1)  /* slot number of mode 1 */
-- 
1.6.3.1


  reply	other threads:[~2009-06-04 18:36 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-04 18:36 [PATCH 0/7] ASIC3 updates Philipp Zabel
2009-06-04 18:36 ` Philipp Zabel [this message]
2009-06-04 23:46   ` [PATCH 1/7] MFD: ASIC3: add API for EXTCF and SDHWCTRL register manipulation Samuel Ortiz
2009-06-05 16:25     ` pHilipp Zabel
2009-06-04 18:36 ` [PATCH 2/7] MFD: ASIC3: add clock handling for MFD cells Philipp Zabel
2009-06-04 23:49   ` Samuel Ortiz
2009-06-05 16:27     ` pHilipp Zabel
2009-06-05 16:58       ` Samuel Ortiz
2009-06-04 18:36 ` [PATCH 3/7] MFD: ASIC3: add ASIC3 IRQ numbers Philipp Zabel
2009-06-04 18:36 ` [PATCH 4/7] MFD: ASIC3: use resource_size macro instead of local variable Philipp Zabel
2009-06-04 18:36 ` [PATCH 5/7] MFD: ASIC3: remove SD/SDIO controller register definitions Philipp Zabel
2009-06-04 18:36 ` [PATCH 6/7] MFD: ASIC3: enable DS1WM cell Philipp Zabel
2009-06-04 18:36 ` [PATCH 7/7] MFD: ASIC3: enable SD/SDIO cell Philipp Zabel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1244140576-18006-2-git-send-email-philipp.zabel@gmail.com \
    --to=philipp.zabel@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sameo@openedhand.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.