public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
From: Tony Lindgren <tony@atomide.com>
To: Benoit Cousson <b-cousson@ti.com>
Cc: linux-omap@vger.kernel.org, Paul Walmsley <paul@pwsan.com>,
	Kevin Hilman <khilman@deeprootsystems.com>,
	Santosh Shilimkar <santosh.shilimkar@ti.com>
Subject: Re: [PATCH 2/7] OMAP: mux: Add support for control module split in several partitions
Date: Mon, 15 Nov 2010 12:03:17 -0800	[thread overview]
Message-ID: <20101115200316.GK9264@atomide.com> (raw)
In-Reply-To: <1289511321-18532-3-git-send-email-b-cousson@ti.com>

* Benoit Cousson <b-cousson@ti.com> [101111 13:26]:
> Starting on OMAP4, the pin mux configuration is located in two
> different partitions of the control module (CODE_PAD and WKUP_PAD).
> The first one is inside the core power domain whereas the second
> one is inside the wakeup.
> - Add the capability to add any number of partition during board init
> time depending of Soc partitioning.
> - Add some init flags as well in order to avoid explicit Soc version
> check inside the mux core code.
> - Add a comment with mux0 mode on top of omap_mux/board/<partition>
> if the current mux mode is not the default one.

Here's one more patch that I'd like to merge into this patch to avoid
repeating the partition for each mux entry.

Assuming no more comments, I'll queue these for 2.6.38 merge window.

Regards,

Tony


From: Tony Lindgren <tony@atomide.com>
Date: Mon, 15 Nov 2010 11:52:20 -0800
Subject: [PATCH] omap: mux: Save memory for struct omap_mux

There's no need to repeat the partition for each mux entry.
We can look up the partition for debugfs.

Signed-off-by: Tony Lindgren <tony@atomide.com>

--- a/arch/arm/mach-omap2/mux.c
+++ b/arch/arm/mach-omap2/mux.c
@@ -348,14 +348,37 @@ static const struct file_operations omap_mux_dbg_board_fops = {
 	.release	= single_release,
 };
 
+static struct omap_mux_partition * omap_mux_get_partition(struct omap_mux *mux)
+{
+	struct omap_mux_partition *partition;
+
+	list_for_each_entry(partition, &mux_partitions, node) {
+		struct list_head *muxmodes = &partition->muxmodes;
+		struct omap_mux_entry *e;
+
+		list_for_each_entry(e, muxmodes, node) {
+			struct omap_mux *m = &e->mux;
+
+			if (m == mux)
+				return partition;
+		}
+	}
+
+	return NULL;
+}
+
 static int omap_mux_dbg_signal_show(struct seq_file *s, void *unused)
 {
 	struct omap_mux *m = s->private;
-	struct omap_mux_partition *partition = m->partition;
+	struct omap_mux_partition *partition;
 	const char *none = "NA";
 	u16 val;
 	int mode;
 
+	partition = omap_mux_get_partition(m);
+	if (!partition)
+		return 0;
+
 	val = omap_mux_read(partition, m->reg_offset);
 	mode = val & OMAP_MUX_MODE7;
 
@@ -391,6 +414,7 @@ static ssize_t omap_mux_dbg_signal_write(struct file *file,
 	struct omap_mux *m;
 	unsigned long val;
 	int buf_size, ret;
+	struct omap_mux_partition *partition;
 
 	if (count > OMAP_MUX_MAX_ARG_CHAR)
 		return -EINVAL;
@@ -411,7 +435,11 @@ static ssize_t omap_mux_dbg_signal_write(struct file *file,
 	seqf = file->private_data;
 	m = seqf->private;
 
-	omap_mux_write(m->partition, (u16)val, m->reg_offset);
+	partition = omap_mux_get_partition(m);
+	if (!partition)
+		return -ENODEV;
+
+	omap_mux_write(partition, (u16)val, m->reg_offset);
 	*ppos += count;
 
 	return count;
@@ -440,7 +468,6 @@ static void __init omap_mux_dbg_create_entry(
 
 	list_for_each_entry(e, &partition->muxmodes, node) {
 		struct omap_mux *m = &e->mux;
-		m->partition = partition;
 
 		(void)debugfs_create_file(m->muxnames[0], S_IWUGO, mux_dbg_dir,
 					  m, &omap_mux_dbg_signal_fops);
--- a/arch/arm/mach-omap2/mux.h
+++ b/arch/arm/mach-omap2/mux.h
@@ -121,7 +121,6 @@ struct omap_mux {
 	char	*muxnames[OMAP_MUX_NR_MODES];
 #ifdef CONFIG_DEBUG_FS
 	char	*balls[OMAP_MUX_NR_SIDES];
-	struct omap_mux_partition *partition;
 #endif
 #endif
 };

  reply	other threads:[~2010-11-15 20:03 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-11 21:35 [PATCH 0/7] OMAP4: mux: Add the OMAP4430 ES1.0 & ES2.x support Benoit Cousson
2010-11-11 21:35 ` [PATCH 1/7] OMAP: mux: Replace printk with pr_xxx macros Benoit Cousson
2010-11-11 21:35 ` [PATCH 2/7] OMAP: mux: Add support for control module split in several partitions Benoit Cousson
2010-11-15 20:03   ` Tony Lindgren [this message]
2010-11-15 21:46     ` Cousson, Benoit
2010-11-16 16:41       ` Tony Lindgren
2010-11-16 17:03         ` Cousson, Benoit
2010-11-16 17:37           ` Tony Lindgren
2010-11-16 18:37             ` Cousson, Benoit
2010-11-11 21:35 ` [PATCH 3/7] OMAP4: mux: Add CBL package data for OMAP4430 ES1 Benoit Cousson
2010-11-11 21:35 ` [PATCH 4/7] OMAP4: sdp4430: Select CBL package for ES1 and initialize mux Benoit Cousson
2010-11-11 21:35 ` [PATCH 5/7] OMAP4: mux: Add CBS package data for OMAP4430 ES2 Benoit Cousson
2010-11-11 21:35 ` [PATCH 6/7] OMAP4: sdp4430: Select CBS package for ES2 Benoit Cousson
2010-11-11 21:35 ` [PATCH 7/7] OMAP4: pandaboard: Select CBL & CBS package and initialize mux Benoit Cousson

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=20101115200316.GK9264@atomide.com \
    --to=tony@atomide.com \
    --cc=b-cousson@ti.com \
    --cc=khilman@deeprootsystems.com \
    --cc=linux-omap@vger.kernel.org \
    --cc=paul@pwsan.com \
    --cc=santosh.shilimkar@ti.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox