* [PATCH] Add debobs Kconfig item
2008-09-16 9:51 ` [PATCH] Debobs and ETK padconf implementation Peter 'p2' De Schrijver
@ 2008-09-16 9:51 ` Peter 'p2' De Schrijver
0 siblings, 0 replies; 15+ messages in thread
From: Peter 'p2' De Schrijver @ 2008-09-16 9:51 UTC (permalink / raw)
To: linux-omap; +Cc: Peter 'p2' De Schrijver
Signed-off-by: Peter 'p2' De Schrijver <peter.de-schrijver@nokia.com>
---
arch/arm/mach-omap2/Kconfig | 10 +++++++++-
arch/arm/mach-omap2/Makefile | 3 +++
2 files changed, 12 insertions(+), 1 deletions(-)
diff --git a/arch/arm/mach-omap2/Kconfig b/arch/arm/mach-omap2/Kconfig
index 43a679f..9d2f837 100644
--- a/arch/arm/mach-omap2/Kconfig
+++ b/arch/arm/mach-omap2/Kconfig
@@ -147,4 +147,12 @@ config OMAP3_OFF_MODE
depends on ARCH_OMAP3
default n
help
- Use off mode for powerdomains.
\ No newline at end of file
+ Use off mode for powerdomains.
+
+config OMAP3_DEBOBS
+ bool "OMAP 3430 Debug observability support"
+ depends on ARCH_OMAP3 && DEBUG_FS
+ default n
+ help
+ Use ETK pads for debug observability
+
diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
index 398a872..828f834 100644
--- a/arch/arm/mach-omap2/Makefile
+++ b/arch/arm/mach-omap2/Makefile
@@ -41,6 +41,9 @@ obj-$(CONFIG_OMAP_MBOX_FWK) += mailbox_mach.o
mailbox_mach-objs := mailbox.o
mmu_mach-objs := mmu.o
+# Debobs
+obj-$(CONFIG_OMAP3_DEBOBS) += debobs.o
+
# Specific board support
obj-$(CONFIG_MACH_OMAP_GENERIC) += board-generic.o
obj-$(CONFIG_MACH_OMAP_H4) += board-h4.o board-h4-mmc.o
--
1.5.6.3
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH] debobs support for OMAP3430.
@ 2008-09-17 15:02 Peter 'p2' De Schrijver
2008-09-17 15:02 ` [PATCH] Add definitions for ETK pads and debobs registers Peter 'p2' De Schrijver
0 siblings, 1 reply; 15+ messages in thread
From: Peter 'p2' De Schrijver @ 2008-09-17 15:02 UTC (permalink / raw)
To: linux-omap; +Cc: Peter 'p2' De Schrijver
This patch adds support for debug observability on OMAP3430 using the ETK lines. Fixes some potential issues with the OMAP343X_CONTROL_DEBOBS, OMAP343X_PADCONF_ETK and OMAP343X_CONTROL_WKUP_DEBOBSMUX macros.
Peter 'p2' De Schrijver (3):
Add definitions for ETK pads and debobs registers
Debobs and ETK padconf implementation
Add debobs Kconfig item
arch/arm/mach-omap2/Kconfig | 10 ++-
arch/arm/mach-omap2/Makefile | 3 +
arch/arm/mach-omap2/debobs.c | 214 +++++++++++++++++++++++++++++
arch/arm/plat-omap/include/mach/control.h | 34 +++++
4 files changed, 260 insertions(+), 1 deletions(-)
create mode 100644 arch/arm/mach-omap2/debobs.c
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH] Add definitions for ETK pads and debobs registers
2008-09-17 15:02 [PATCH] debobs support for OMAP3430 Peter 'p2' De Schrijver
@ 2008-09-17 15:02 ` Peter 'p2' De Schrijver
2008-09-17 15:02 ` [PATCH] Debobs and ETK padconf implementation Peter 'p2' De Schrijver
0 siblings, 1 reply; 15+ messages in thread
From: Peter 'p2' De Schrijver @ 2008-09-17 15:02 UTC (permalink / raw)
To: linux-omap; +Cc: Peter 'p2' De Schrijver
Signed-off-by: Peter 'p2' De Schrijver <peter.de-schrijver@nokia.com>
---
arch/arm/plat-omap/include/mach/control.h | 34 +++++++++++++++++++++++++++++
1 files changed, 34 insertions(+), 0 deletions(-)
diff --git a/arch/arm/plat-omap/include/mach/control.h b/arch/arm/plat-omap/include/mach/control.h
index ef8cf12..19addae 100644
--- a/arch/arm/plat-omap/include/mach/control.h
+++ b/arch/arm/plat-omap/include/mach/control.h
@@ -149,6 +149,8 @@
#define OMAP343X_CONTROL_FUSE_SR (OMAP2_CONTROL_GENERAL + 0x0130)
#define OMAP343X_CONTROL_IVA2_BOOTADDR (OMAP2_CONTROL_GENERAL + 0x0190)
#define OMAP343X_CONTROL_IVA2_BOOTMOD (OMAP2_CONTROL_GENERAL + 0x0194)
+#define OMAP343X_CONTROL_DEBOBS(i) (OMAP2_CONTROL_GENERAL + 0x01B0 \
+ + ((i) >> 1) * 4 + (!(i) & 1) * 2)
#define OMAP343X_CONTROL_DEBOBS_0 (OMAP2_CONTROL_GENERAL + 0x01B0)
#define OMAP343X_CONTROL_DEBOBS_1 (OMAP2_CONTROL_GENERAL + 0x01B4)
#define OMAP343X_CONTROL_DEBOBS_2 (OMAP2_CONTROL_GENERAL + 0x01B8)
@@ -170,6 +172,38 @@
#define OMAP343X_CONTROL_SRAMLDO5 (OMAP2_CONTROL_GENERAL + 0x02C0)
#define OMAP343X_CONTROL_CSI (OMAP2_CONTROL_GENERAL + 0x02b4)
+/* 34xx PADCONF register offsets */
+
+#define OMAP343X_PADCONF_ETK(i) (OMAP2_CONTROL_PADCONFS + 0x5a8 + \
+ (i)*2)
+#define OMAP343X_PADCONF_ETK_CLK OMAP343X_PADCONF_ETK(0)
+#define OMAP343X_PADCONF_ETK_CTL OMAP343X_PADCONF_ETK(1)
+#define OMAP343X_PADCONF_ETK_D0 OMAP343X_PADCONF_ETK(2)
+#define OMAP343X_PADCONF_ETK_D1 OMAP343X_PADCONF_ETK(3)
+#define OMAP343X_PADCONF_ETK_D2 OMAP343X_PADCONF_ETK(4)
+#define OMAP343X_PADCONF_ETK_D3 OMAP343X_PADCONF_ETK(5)
+#define OMAP343X_PADCONF_ETK_D4 OMAP343X_PADCONF_ETK(6)
+#define OMAP343X_PADCONF_ETK_D5 OMAP343X_PADCONF_ETK(7)
+#define OMAP343X_PADCONF_ETK_D6 OMAP343X_PADCONF_ETK(8)
+#define OMAP343X_PADCONF_ETK_D7 OMAP343X_PADCONF_ETK(9)
+#define OMAP343X_PADCONF_ETK_D8 OMAP343X_PADCONF_ETK(10)
+#define OMAP343X_PADCONF_ETK_D9 OMAP343X_PADCONF_ETK(11)
+#define OMAP343X_PADCONF_ETK_D10 OMAP343X_PADCONF_ETK(12)
+#define OMAP343X_PADCONF_ETK_D11 OMAP343X_PADCONF_ETK(13)
+#define OMAP343X_PADCONF_ETK_D12 OMAP343X_PADCONF_ETK(14)
+#define OMAP343X_PADCONF_ETK_D13 OMAP343X_PADCONF_ETK(15)
+#define OMAP343X_PADCONF_ETK_D14 OMAP343X_PADCONF_ETK(16)
+#define OMAP343X_PADCONF_ETK_D15 OMAP343X_PADCONF_ETK(17)
+
+/* 34xx GENERAL_WKUP regist offsets */
+
+#define OMAP343X_CONTROL_WKUP_DEBOBSMUX(i) (OMAP343X_CONTROL_GENERAL_WKUP + \
+ 0x008 + (i))
+#define OMAP343X_CONTROL_WKUP_DEBOBS0 (OMAP343X_CONTROL_GENERAL_WKUP + 0x008)
+#define OMAP343X_CONTROL_WKUP_DEBOBS1 (OMAP343X_CONTROL_GENERAL_WKUP + 0x00C)
+#define OMAP343X_CONTROL_WKUP_DEBOBS2 (OMAP343X_CONTROL_GENERAL_WKUP + 0x010)
+#define OMAP343X_CONTROL_WKUP_DEBOBS3 (OMAP343X_CONTROL_GENERAL_WKUP + 0x014)
+#define OMAP343X_CONTROL_WKUP_DEBOBS4 (OMAP343X_CONTROL_GENERAL_WKUP + 0x018)
/*
* REVISIT: This list of registers is not comprehensive - there are more
--
1.5.6.3
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH] Debobs and ETK padconf implementation
2008-09-17 15:02 ` [PATCH] Add definitions for ETK pads and debobs registers Peter 'p2' De Schrijver
@ 2008-09-17 15:02 ` Peter 'p2' De Schrijver
2008-09-17 15:02 ` [PATCH] Add debobs Kconfig item Peter 'p2' De Schrijver
2008-09-25 8:56 ` [PATCH] Debobs and ETK padconf implementation Kevin Hilman
0 siblings, 2 replies; 15+ messages in thread
From: Peter 'p2' De Schrijver @ 2008-09-17 15:02 UTC (permalink / raw)
To: linux-omap; +Cc: Peter 'p2' De Schrijver
Signed-off-by: Peter 'p2' De Schrijver <peter.de-schrijver@nokia.com>
---
arch/arm/mach-omap2/debobs.c | 214 ++++++++++++++++++++++++++++++++++++++++++
1 files changed, 214 insertions(+), 0 deletions(-)
create mode 100644 arch/arm/mach-omap2/debobs.c
diff --git a/arch/arm/mach-omap2/debobs.c b/arch/arm/mach-omap2/debobs.c
new file mode 100644
index 0000000..1bde1f4
--- /dev/null
+++ b/arch/arm/mach-omap2/debobs.c
@@ -0,0 +1,214 @@
+/*
+ * arch/arm/mach-omap2/debobs.c
+ *
+ * Handle debobs pads
+ *
+ * Copyright (C) 2008 Nokia Corporation
+ *
+ * Written by Peter De Schrijver <peter.de-schrijver@nokia.com>
+ *
+ * This file is subject to the terms and conditions of the GNU General
+ * Public License. See the file "COPYING" in the main directory of this
+ * archive for more details.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/debugfs.h>
+#include <linux/uaccess.h>
+#include <linux/module.h>
+#include <mach/control.h>
+#include <mach/mux.h>
+#include <mach/gpio.h>
+#include <mach/board.h>
+
+#define ETK_GPIO_BEGIN 12
+#define ETK_GPIO(i) (ETK_GPIO_BEGIN + i)
+#define NUM_OF_DEBOBS_PADS 18
+
+enum debobs_pad_mode {
+ GPIO = 0,
+ OBS = 1,
+ ETK = 2,
+ NO_MODE = 3,
+};
+
+static char *debobs_pad_mode_names[] = {
+ [GPIO] = "GPIO",
+ [OBS] = "OBS",
+ [ETK] = "ETK",
+};
+
+struct obs {
+ u16 offset;
+ u8 value;
+ u8 mask;
+};
+
+struct debobs_pad {
+ enum debobs_pad_mode mode;
+ struct obs core_obs;
+ struct obs wakeup_obs;
+};
+
+static struct debobs_pad debobs_pads[NUM_OF_DEBOBS_PADS];
+
+static int debobs_mode_open(struct inode *inode, struct file *file)
+{
+ file->private_data = inode->i_private;
+
+ return 0;
+}
+
+static ssize_t debobs_mode_read(struct file *file, char __user *user_buf,
+ size_t count, loff_t *ppos)
+{
+ char buffer[10];
+ int size;
+ int pad_number = (int)file->private_data;
+ struct debobs_pad *e = &debobs_pads[pad_number];
+
+ size = snprintf(buffer, sizeof(buffer), "%s\n",
+ debobs_pad_mode_names[e->mode]);
+ return simple_read_from_buffer(user_buf, count, ppos, buffer, size);
+}
+
+static ssize_t debobs_mode_write(struct file *file, const char __user *user_buf,
+ size_t count, loff_t *ppos)
+{
+ char buffer[10];
+ int buf_size, i, pad_number;
+ u16 muxmode = OMAP34XX_MUX_MODE7;
+
+ memset(buffer, 0, sizeof(buffer));
+ buf_size = min(count, (sizeof(buffer)-1));
+
+ if (copy_from_user(buffer, user_buf, buf_size))
+ return -EFAULT;
+
+ pad_number = (int)file->private_data;
+
+ for (i = 0; i < NO_MODE; i++) {
+ if (!strnicmp(debobs_pad_mode_names[i],
+ buffer,
+ strlen(debobs_pad_mode_names[i]))) {
+ switch (i) {
+ case ETK:
+ muxmode = OMAP34XX_MUX_MODE0;
+ break;
+ case GPIO:
+ muxmode = OMAP34XX_MUX_MODE4;
+ break;
+ case OBS:
+ muxmode = OMAP34XX_MUX_MODE7;
+ break;
+ }
+ omap_ctrl_writew(muxmode,
+ OMAP343X_PADCONF_ETK(pad_number));
+ debobs_pads[pad_number].mode = i;
+
+ return count;
+ }
+ }
+
+ return -EINVAL;
+}
+
+static const struct file_operations debobs_mode_fops = {
+ .open = debobs_mode_open,
+ .read = debobs_mode_read,
+ .write = debobs_mode_write,
+};
+
+static int debobs_get(void *data, u64 *val)
+{
+ struct obs *o = data;
+
+ *val = o->value;
+
+ return 0;
+}
+
+static int debobs_set(void *data, u64 val)
+{
+ struct obs *o = data;
+
+ val &= BIT(o->mask) - 1;
+
+ omap_ctrl_writeb(val, o->offset);
+ o->value = val;
+
+ return 0;
+}
+
+DEFINE_SIMPLE_ATTRIBUTE(debobs_fops, debobs_get, debobs_set, "%llu\n");
+
+static inline int __init _new_debobs_pad(struct debobs_pad *pad, char *name,
+ int number, struct dentry *root)
+{
+ struct dentry *d;
+ struct obs *o;
+
+ d = debugfs_create_dir(name, root);
+ if (IS_ERR(d))
+ return PTR_ERR(d);
+
+ omap_ctrl_writew(OMAP34XX_MUX_MODE4, OMAP343X_PADCONF_ETK(number));
+ omap_set_gpio_direction(ETK_GPIO(number), 1);
+ gpio_export(ETK_GPIO(number), 1);
+ (void) debugfs_create_file("mode", S_IRUGO | S_IWUGO, d,
+ (void *)number, &debobs_mode_fops);
+
+ o = &pad->core_obs;
+ o->offset = OMAP343X_CONTROL_DEBOBS(number);
+ o->value = omap_ctrl_readw(o->offset);
+ o->mask = 7;
+ (void) debugfs_create_file("coreobs", S_IRUGO | S_IWUGO, d, o,
+ &debobs_fops);
+
+ o = &pad->wakeup_obs;
+ o->offset = OMAP343X_CONTROL_WKUP_DEBOBSMUX(number);
+ o->value = omap_ctrl_readb(o->offset);
+ o->mask = 5;
+ (void) debugfs_create_file("wakeupobs", S_IRUGO | S_IWUGO, d, o,
+ &debobs_fops);
+
+ return 0;
+}
+
+static int __init init_debobs(void)
+{
+ struct dentry *debobs_root;
+ int i, err;
+ char name[10];
+
+ debobs_root = debugfs_create_dir("debobs", NULL);
+ if (IS_ERR(debobs_root))
+ return PTR_ERR(debobs_root);
+
+ for (i = 0; i < NUM_OF_DEBOBS_PADS; i++) {
+ if (!omap_request_gpio(ETK_GPIO(i))) {
+ snprintf(name, sizeof(name), "hw_dbg%d", i);
+ err = _new_debobs_pad(&debobs_pads[i], name, i,
+ debobs_root);
+ if (err) {
+ omap_free_gpio(ETK_GPIO(i));
+ return err;
+ }
+ }
+ }
+
+ return 0;
+}
+
+late_initcall_sync(init_debobs);
--
1.5.6.3
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH] Add debobs Kconfig item
2008-09-17 15:02 ` [PATCH] Debobs and ETK padconf implementation Peter 'p2' De Schrijver
@ 2008-09-17 15:02 ` Peter 'p2' De Schrijver
2008-09-25 8:58 ` Kevin Hilman
2008-09-25 8:56 ` [PATCH] Debobs and ETK padconf implementation Kevin Hilman
1 sibling, 1 reply; 15+ messages in thread
From: Peter 'p2' De Schrijver @ 2008-09-17 15:02 UTC (permalink / raw)
To: linux-omap; +Cc: Peter 'p2' De Schrijver
Signed-off-by: Peter 'p2' De Schrijver <peter.de-schrijver@nokia.com>
---
arch/arm/mach-omap2/Kconfig | 10 +++++++++-
arch/arm/mach-omap2/Makefile | 3 +++
2 files changed, 12 insertions(+), 1 deletions(-)
diff --git a/arch/arm/mach-omap2/Kconfig b/arch/arm/mach-omap2/Kconfig
index d0bbbf8..639af08 100644
--- a/arch/arm/mach-omap2/Kconfig
+++ b/arch/arm/mach-omap2/Kconfig
@@ -151,4 +151,12 @@ config OMAP3_OFF_MODE
depends on ARCH_OMAP3
default n
help
- Use off mode for powerdomains.
\ No newline at end of file
+ Use off mode for powerdomains.
+
+config OMAP3_DEBOBS
+ bool "OMAP 3430 Debug observability support"
+ depends on ARCH_OMAP3 && DEBUG_FS
+ default n
+ help
+ Use ETK pads for debug observability
+
diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
index 23fc127..88d3af0 100644
--- a/arch/arm/mach-omap2/Makefile
+++ b/arch/arm/mach-omap2/Makefile
@@ -40,6 +40,9 @@ obj-$(CONFIG_OMAP_MBOX_FWK) += mailbox_mach.o
mailbox_mach-objs := mailbox.o
mmu_mach-objs := mmu.o
+# Debobs
+obj-$(CONFIG_OMAP3_DEBOBS) += debobs.o
+
# Specific board support
obj-$(CONFIG_MACH_OMAP_GENERIC) += board-generic.o
obj-$(CONFIG_MACH_OMAP_H4) += board-h4.o board-h4-mmc.o
--
1.5.6.3
^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [PATCH] Debobs and ETK padconf implementation
2008-09-17 15:02 ` [PATCH] Debobs and ETK padconf implementation Peter 'p2' De Schrijver
2008-09-17 15:02 ` [PATCH] Add debobs Kconfig item Peter 'p2' De Schrijver
@ 2008-09-25 8:56 ` Kevin Hilman
2008-09-25 11:35 ` Peter 'p2' De Schrijver
1 sibling, 1 reply; 15+ messages in thread
From: Kevin Hilman @ 2008-09-25 8:56 UTC (permalink / raw)
To: Peter 'p2' De Schrijver; +Cc: linux-omap
"Peter 'p2' De Schrijver" <peter.de-schrijver@nokia.com> writes:
> Signed-off-by: Peter 'p2' De Schrijver <peter.de-schrijver@nokia.com>
> ---
> arch/arm/mach-omap2/debobs.c | 214 ++++++++++++++++++++++++++++++++++++++++++
> 1 files changed, 214 insertions(+), 0 deletions(-)
> create mode 100644 arch/arm/mach-omap2/debobs.c
>
> diff --git a/arch/arm/mach-omap2/debobs.c b/arch/arm/mach-omap2/debobs.c
> new file mode 100644
> index 0000000..1bde1f4
> --- /dev/null
> +++ b/arch/arm/mach-omap2/debobs.c
> @@ -0,0 +1,214 @@
> +/*
> + * arch/arm/mach-omap2/debobs.c
> + *
> + * Handle debobs pads
> + *
> + * Copyright (C) 2008 Nokia Corporation
> + *
> + * Written by Peter De Schrijver <peter.de-schrijver@nokia.com>
> + *
> + * This file is subject to the terms and conditions of the GNU General
> + * Public License. See the file "COPYING" in the main directory of this
> + * archive for more details.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program; if not, write to the Free Software
> + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
> + */
> +
> +
> +#include <linux/kernel.h>
> +#include <linux/init.h>
> +#include <linux/debugfs.h>
> +#include <linux/uaccess.h>
> +#include <linux/module.h>
> +#include <mach/control.h>
> +#include <mach/mux.h>
> +#include <mach/gpio.h>
> +#include <mach/board.h>
> +
> +#define ETK_GPIO_BEGIN 12
> +#define ETK_GPIO(i) (ETK_GPIO_BEGIN + i)
> +#define NUM_OF_DEBOBS_PADS 18
> +
> +enum debobs_pad_mode {
> + GPIO = 0,
> + OBS = 1,
> + ETK = 2,
> + NO_MODE = 3,
> +};
> +
> +static char *debobs_pad_mode_names[] = {
> + [GPIO] = "GPIO",
> + [OBS] = "OBS",
> + [ETK] = "ETK",
> +};
> +
> +struct obs {
> + u16 offset;
> + u8 value;
> + u8 mask;
> +};
> +
> +struct debobs_pad {
> + enum debobs_pad_mode mode;
> + struct obs core_obs;
> + struct obs wakeup_obs;
> +};
> +
> +static struct debobs_pad debobs_pads[NUM_OF_DEBOBS_PADS];
> +
> +static int debobs_mode_open(struct inode *inode, struct file *file)
> +{
> + file->private_data = inode->i_private;
> +
> + return 0;
> +}
> +
> +static ssize_t debobs_mode_read(struct file *file, char __user *user_buf,
> + size_t count, loff_t *ppos)
> +{
> + char buffer[10];
> + int size;
> + int pad_number = (int)file->private_data;
> + struct debobs_pad *e = &debobs_pads[pad_number];
> +
> + size = snprintf(buffer, sizeof(buffer), "%s\n",
> + debobs_pad_mode_names[e->mode]);
> + return simple_read_from_buffer(user_buf, count, ppos, buffer, size);
> +}
> +
> +static ssize_t debobs_mode_write(struct file *file, const char __user *user_buf,
> + size_t count, loff_t *ppos)
> +{
> + char buffer[10];
> + int buf_size, i, pad_number;
> + u16 muxmode = OMAP34XX_MUX_MODE7;
> +
> + memset(buffer, 0, sizeof(buffer));
> + buf_size = min(count, (sizeof(buffer)-1));
> +
> + if (copy_from_user(buffer, user_buf, buf_size))
> + return -EFAULT;
> +
> + pad_number = (int)file->private_data;
> +
> + for (i = 0; i < NO_MODE; i++) {
> + if (!strnicmp(debobs_pad_mode_names[i],
> + buffer,
> + strlen(debobs_pad_mode_names[i]))) {
> + switch (i) {
> + case ETK:
> + muxmode = OMAP34XX_MUX_MODE0;
> + break;
> + case GPIO:
> + muxmode = OMAP34XX_MUX_MODE4;
> + break;
> + case OBS:
> + muxmode = OMAP34XX_MUX_MODE7;
> + break;
> + }
> + omap_ctrl_writew(muxmode,
> + OMAP343X_PADCONF_ETK(pad_number));
> + debobs_pads[pad_number].mode = i;
> +
> + return count;
> + }
> + }
> +
> + return -EINVAL;
> +}
> +
> +static const struct file_operations debobs_mode_fops = {
> + .open = debobs_mode_open,
> + .read = debobs_mode_read,
> + .write = debobs_mode_write,
> +};
> +
> +static int debobs_get(void *data, u64 *val)
> +{
> + struct obs *o = data;
> +
> + *val = o->value;
> +
> + return 0;
> +}
> +
> +static int debobs_set(void *data, u64 val)
> +{
> + struct obs *o = data;
> +
> + val &= BIT(o->mask) - 1;
> +
> + omap_ctrl_writeb(val, o->offset);
> + o->value = val;
> +
> + return 0;
> +}
> +
> +DEFINE_SIMPLE_ATTRIBUTE(debobs_fops, debobs_get, debobs_set, "%llu\n");
> +
> +static inline int __init _new_debobs_pad(struct debobs_pad *pad, char *name,
> + int number, struct dentry *root)
> +{
> + struct dentry *d;
> + struct obs *o;
> +
> + d = debugfs_create_dir(name, root);
> + if (IS_ERR(d))
> + return PTR_ERR(d);
> +
> + omap_ctrl_writew(OMAP34XX_MUX_MODE4, OMAP343X_PADCONF_ETK(number));
> + omap_set_gpio_direction(ETK_GPIO(number), 1);
> + gpio_export(ETK_GPIO(number), 1);
> + (void) debugfs_create_file("mode", S_IRUGO | S_IWUGO, d,
> + (void *)number, &debobs_mode_fops);
> +
> + o = &pad->core_obs;
> + o->offset = OMAP343X_CONTROL_DEBOBS(number);
> + o->value = omap_ctrl_readw(o->offset);
> + o->mask = 7;
> + (void) debugfs_create_file("coreobs", S_IRUGO | S_IWUGO, d, o,
> + &debobs_fops);
> +
> + o = &pad->wakeup_obs;
> + o->offset = OMAP343X_CONTROL_WKUP_DEBOBSMUX(number);
> + o->value = omap_ctrl_readb(o->offset);
> + o->mask = 5;
> + (void) debugfs_create_file("wakeupobs", S_IRUGO | S_IWUGO, d, o,
> + &debobs_fops);
> +
> + return 0;
> +}
> +
> +static int __init init_debobs(void)
> +{
> + struct dentry *debobs_root;
> + int i, err;
> + char name[10];
> +
> + debobs_root = debugfs_create_dir("debobs", NULL);
> + if (IS_ERR(debobs_root))
> + return PTR_ERR(debobs_root);
> +
> + for (i = 0; i < NUM_OF_DEBOBS_PADS; i++) {
> + if (!omap_request_gpio(ETK_GPIO(i))) {
The cross-platform gpiolib calls should be used here.
> + snprintf(name, sizeof(name), "hw_dbg%d", i);
> + err = _new_debobs_pad(&debobs_pads[i], name, i,
> + debobs_root);
> + if (err) {
> + omap_free_gpio(ETK_GPIO(i));
> + return err;
> + }
> + }
> + }
In the successful case, future calls to gpio_request() to use these
lines will fail, since the line is reserved by the omap_request_gpio()
call.
> + return 0;
> +}
> +
> +late_initcall_sync(init_debobs);
> --
> 1.5.6.3
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH] Add debobs Kconfig item
2008-09-17 15:02 ` [PATCH] Add debobs Kconfig item Peter 'p2' De Schrijver
@ 2008-09-25 8:58 ` Kevin Hilman
0 siblings, 0 replies; 15+ messages in thread
From: Kevin Hilman @ 2008-09-25 8:58 UTC (permalink / raw)
To: Peter 'p2' De Schrijver; +Cc: linux-omap
"Peter 'p2' De Schrijver" <peter.de-schrijver@nokia.com> writes:
> Signed-off-by: Peter 'p2' De Schrijver <peter.de-schrijver@nokia.com>
> ---
> arch/arm/mach-omap2/Kconfig | 10 +++++++++-
> arch/arm/mach-omap2/Makefile | 3 +++
> 2 files changed, 12 insertions(+), 1 deletions(-)
>
> diff --git a/arch/arm/mach-omap2/Kconfig b/arch/arm/mach-omap2/Kconfig
> index d0bbbf8..639af08 100644
> --- a/arch/arm/mach-omap2/Kconfig
> +++ b/arch/arm/mach-omap2/Kconfig
> @@ -151,4 +151,12 @@ config OMAP3_OFF_MODE
> depends on ARCH_OMAP3
> default n
> help
> - Use off mode for powerdomains.
> \ No newline at end of file
> + Use off mode for powerdomains.
> +
> +config OMAP3_DEBOBS
> + bool "OMAP 3430 Debug observability support"
> + depends on ARCH_OMAP3 && DEBUG_FS
> + default n
> + help
> + Use ETK pads for debug observability
> +
This should go into arch/arm/plat-omap/Kconfig, under the 'OMAP
Feature Selections' list.
Kevin
> diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
> index 23fc127..88d3af0 100644
> --- a/arch/arm/mach-omap2/Makefile
> +++ b/arch/arm/mach-omap2/Makefile
> @@ -40,6 +40,9 @@ obj-$(CONFIG_OMAP_MBOX_FWK) += mailbox_mach.o
> mailbox_mach-objs := mailbox.o
> mmu_mach-objs := mmu.o
>
> +# Debobs
> +obj-$(CONFIG_OMAP3_DEBOBS) += debobs.o
> +
> # Specific board support
> obj-$(CONFIG_MACH_OMAP_GENERIC) += board-generic.o
> obj-$(CONFIG_MACH_OMAP_H4) += board-h4.o board-h4-mmc.o
> --
> 1.5.6.3
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH] Debobs and ETK padconf implementation
2008-09-25 8:56 ` [PATCH] Debobs and ETK padconf implementation Kevin Hilman
@ 2008-09-25 11:35 ` Peter 'p2' De Schrijver
2008-09-25 11:40 ` Kevin Hilman
0 siblings, 1 reply; 15+ messages in thread
From: Peter 'p2' De Schrijver @ 2008-09-25 11:35 UTC (permalink / raw)
To: ext Kevin Hilman; +Cc: linux-omap
>
> The cross-platform gpiolib calls should be used here.
>
> > + snprintf(name, sizeof(name), "hw_dbg%d", i);
> > + err = _new_debobs_pad(&debobs_pads[i], name, i,
> > + debobs_root);
> > + if (err) {
> > + omap_free_gpio(ETK_GPIO(i));
> > + return err;
> > + }
> > + }
> > + }
>
> In the successful case, future calls to gpio_request() to use these
> lines will fail, since the line is reserved by the omap_request_gpio()
> call.
>
Yes. That's intended. If debobs sucessfully claims the GPIO line, noone
else should be allowed to claim it, unless debobs releases it again.
Cheers,
Peter.
--
goa is a state of mind
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH] Debobs and ETK padconf implementation
2008-09-25 11:35 ` Peter 'p2' De Schrijver
@ 2008-09-25 11:40 ` Kevin Hilman
2008-09-25 11:52 ` Peter 'p2' De Schrijver
0 siblings, 1 reply; 15+ messages in thread
From: Kevin Hilman @ 2008-09-25 11:40 UTC (permalink / raw)
To: Peter 'p2' De Schrijver; +Cc: linux-omap
"Peter 'p2' De Schrijver" <peter.de-schrijver@nokia.com> writes:
>>
>> The cross-platform gpiolib calls should be used here.
>>
>> > + snprintf(name, sizeof(name), "hw_dbg%d", i);
>> > + err = _new_debobs_pad(&debobs_pads[i], name, i,
>> > + debobs_root);
>> > + if (err) {
>> > + omap_free_gpio(ETK_GPIO(i));
>> > + return err;
>> > + }
>> > + }
>> > + }
>>
>> In the successful case, future calls to gpio_request() to use these
>> lines will fail, since the line is reserved by the omap_request_gpio()
>> call.
>>
>
> Yes. That's intended. If debobs sucessfully claims the GPIO line, noone
> else should be allowed to claim it, unless debobs releases it again.
>
In that case, what is the proposed method for other kernel code to use
the debobs lines?
Kevin
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH] Debobs and ETK padconf implementation
2008-09-25 11:40 ` Kevin Hilman
@ 2008-09-25 11:52 ` Peter 'p2' De Schrijver
2008-09-25 12:06 ` Peter 'p2' De Schrijver
2008-09-25 12:31 ` Kevin Hilman
0 siblings, 2 replies; 15+ messages in thread
From: Peter 'p2' De Schrijver @ 2008-09-25 11:52 UTC (permalink / raw)
To: ext Kevin Hilman; +Cc: linux-omap
On Thu, Sep 25, 2008 at 02:40:19PM +0300, ext Kevin Hilman wrote:
> "Peter 'p2' De Schrijver" <peter.de-schrijver@nokia.com> writes:
>
> >>
> >> The cross-platform gpiolib calls should be used here.
> >>
> >> > + snprintf(name, sizeof(name), "hw_dbg%d", i);
> >> > + err = _new_debobs_pad(&debobs_pads[i], name, i,
> >> > + debobs_root);
> >> > + if (err) {
> >> > + omap_free_gpio(ETK_GPIO(i));
> >> > + return err;
> >> > + }
> >> > + }
> >> > + }
> >>
> >> In the successful case, future calls to gpio_request() to use these
> >> lines will fail, since the line is reserved by the omap_request_gpio()
> >> call.
> >>
> >
> > Yes. That's intended. If debobs sucessfully claims the GPIO line, noone
> > else should be allowed to claim it, unless debobs releases it again.
> >
>
> In that case, what is the proposed method for other kernel code to use
> the debobs lines?
Hmm, good point :) My idea was to use the gpiolib calls on GPIO12 -
GPIO29, but then there is no way for a user to know if the GPIO was
assigned to debobs or not... Maybe debobs should register as gpiolib
'chip' and reexport those lines ? Would that make sense ?
Cheers,
Peter.
--
goa is a state of mind
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH] Debobs and ETK padconf implementation
2008-09-25 11:52 ` Peter 'p2' De Schrijver
@ 2008-09-25 12:06 ` Peter 'p2' De Schrijver
2008-09-25 12:31 ` Kevin Hilman
1 sibling, 0 replies; 15+ messages in thread
From: Peter 'p2' De Schrijver @ 2008-09-25 12:06 UTC (permalink / raw)
To: ext Kevin Hilman; +Cc: linux-omap
> > In that case, what is the proposed method for other kernel code to use
> > the debobs lines?
>
> Hmm, good point :) My idea was to use the gpiolib calls on GPIO12 -
> GPIO29, but then there is no way for a user to know if the GPIO was
> assigned to debobs or not... Maybe debobs should register as gpiolib
> 'chip' and reexport those lines ? Would that make sense ?
>
Actually, debobs should be claiming IO pads, not GPIOs. Unfortunately
there is no way to do that currently :(
Cheers,
Peter.
--
goa is a state of mind
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH] Debobs and ETK padconf implementation
2008-09-25 11:52 ` Peter 'p2' De Schrijver
2008-09-25 12:06 ` Peter 'p2' De Schrijver
@ 2008-09-25 12:31 ` Kevin Hilman
2008-09-25 17:04 ` David Brownell
1 sibling, 1 reply; 15+ messages in thread
From: Kevin Hilman @ 2008-09-25 12:31 UTC (permalink / raw)
To: Peter 'p2' De Schrijver; +Cc: linux-omap
"Peter 'p2' De Schrijver" <peter.de-schrijver@nokia.com> writes:
> On Thu, Sep 25, 2008 at 02:40:19PM +0300, ext Kevin Hilman wrote:
>> "Peter 'p2' De Schrijver" <peter.de-schrijver@nokia.com> writes:
>>
>> >>
>> >> The cross-platform gpiolib calls should be used here.
>> >>
>> >> > + snprintf(name, sizeof(name), "hw_dbg%d", i);
>> >> > + err = _new_debobs_pad(&debobs_pads[i], name, i,
>> >> > + debobs_root);
>> >> > + if (err) {
>> >> > + omap_free_gpio(ETK_GPIO(i));
>> >> > + return err;
>> >> > + }
>> >> > + }
>> >> > + }
>> >>
>> >> In the successful case, future calls to gpio_request() to use these
>> >> lines will fail, since the line is reserved by the omap_request_gpio()
>> >> call.
>> >>
>> >
>> > Yes. That's intended. If debobs sucessfully claims the GPIO line, noone
>> > else should be allowed to claim it, unless debobs releases it again.
>> >
>>
>> In that case, what is the proposed method for other kernel code to use
>> the debobs lines?
>
> Hmm, good point :) My idea was to use the gpiolib calls on GPIO12 -
> GPIO29, but then there is no way for a user to know if the GPIO was
> assigned to debobs or not... Maybe debobs should register as gpiolib
> 'chip' and reexport those lines ? Would that make sense ?
I think debobs should simply 'gpio_export' each pin. It does not need
to hold them.
Later on, if other kernel code comes along and does a gpio_request() I
think the /sysfs entry for that line will disappear until it has been
gpio_free'd.
Kevin
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH] Debobs and ETK padconf implementation
2008-09-25 12:31 ` Kevin Hilman
@ 2008-09-25 17:04 ` David Brownell
2008-09-25 20:28 ` Kevin Hilman
0 siblings, 1 reply; 15+ messages in thread
From: David Brownell @ 2008-09-25 17:04 UTC (permalink / raw)
To: Kevin Hilman; +Cc: Peter 'p2' De Schrijver, linux-omap
On Thursday 25 September 2008, Kevin Hilman wrote:
>
> >> In that case, what is the proposed method for other kernel code to use
> >> the debobs lines?
> >
> > Hmm, good point :) My idea was to use the gpiolib calls on GPIO12 -
> > GPIO29, but then there is no way for a user to know if the GPIO was
> > assigned to debobs or not... Maybe debobs should register as gpiolib
> > 'chip' and reexport those lines ? Would that make sense ?
>
> I think debobs should simply 'gpio_export' each pin. It does not need
> to hold them.
Peter said the right abstraction here was pads (pins/balls?) not
GPIOs, so I'm not sure this is relevant any more, but ...
You can't gpio_export() to userspace, via sysfs, without having
first done a gpio_request(). And then later a gpio_free() will
release that export. So that won't work.
- Dave
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH] Debobs and ETK padconf implementation
2008-09-25 17:04 ` David Brownell
@ 2008-09-25 20:28 ` Kevin Hilman
2008-09-25 20:37 ` David Brownell
0 siblings, 1 reply; 15+ messages in thread
From: Kevin Hilman @ 2008-09-25 20:28 UTC (permalink / raw)
To: David Brownell; +Cc: Peter 'p2' De Schrijver, linux-omap
David Brownell wrote:
> On Thursday 25 September 2008, Kevin Hilman wrote:
>>>> In that case, what is the proposed method for other kernel code to use
>>>> the debobs lines?
>>> Hmm, good point :) My idea was to use the gpiolib calls on GPIO12 -
>>> GPIO29, but then there is no way for a user to know if the GPIO was
>>> assigned to debobs or not... Maybe debobs should register as gpiolib
>>> 'chip' and reexport those lines ? Would that make sense ?
>>
>> I think debobs should simply 'gpio_export' each pin. It does not need
>> to hold them.
>
> Peter said the right abstraction here was pads (pins/balls?) not
> GPIOs, so I'm not sure this is relevant any more, but ...
>
> You can't gpio_export() to userspace, via sysfs, without having
> first done a gpio_request(). And then later a gpio_free() will
> release that export. So that won't work.
Thanks Dave, I was kind of hoping you would chime in on this one :)
OK, then I guess Peter's idea of a gpio_chip type abstraction makes more
sense.
But I'm still not sure how to best deal with the possibiltity that the
pin might not always be a GPIO, but might be reconfigured/re-mux'd by
this debobs interface as a debug observability pin. My initial thought
was to have the debobs interface gpio_request() the line if it was in
observability mode so that nobody else could use it as a GPIO line, then
gpio_free() it when it was put back into GPIO mode thus making it
available to other users as a GPIO. While that may work, it seems
counter-intuitive and rather kludgy. Not sure what the best way is...
Kevin
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH] Debobs and ETK padconf implementation
2008-09-25 20:28 ` Kevin Hilman
@ 2008-09-25 20:37 ` David Brownell
0 siblings, 0 replies; 15+ messages in thread
From: David Brownell @ 2008-09-25 20:37 UTC (permalink / raw)
To: Kevin Hilman; +Cc: Peter 'p2' De Schrijver, linux-omap
On Thursday 25 September 2008, Kevin Hilman wrote:
> But I'm still not sure how to best deal with the possibiltity that the
> pin might not always be a GPIO, but might be reconfigured/re-mux'd by
> this debobs interface as a debug observability pin.
Some platforms have interfaces to reserve and unreserve pins.
Normally used to ensure drivers can't do things like remux
address bus pins, but I suppose it could also be used for this
sort of thing too.
> My initial thought
> was to have the debobs interface gpio_request() the line if it was in
> observability mode so that nobody else could use it as a GPIO line, then
> gpio_free() it when it was put back into GPIO mode thus making it
> available to other users as a GPIO. While that may work, it seems
> counter-intuitive and rather kludgy. Not sure what the best way is..
GPIOs are all that get managed with GPIO calls.
The pinmux calls use enums for pins, which could be used as
identifiers with some reservation scheme that copes with
other non-GPIO usages.
The worst case, design wise, is OMAP1 chips where many GPIOs
can come out on several pins ... and conversely, many pins
could be connected to any of several GPIOs (or MPUIOs).
- Dave
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2008-09-25 20:37 UTC | newest]
Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-09-17 15:02 [PATCH] debobs support for OMAP3430 Peter 'p2' De Schrijver
2008-09-17 15:02 ` [PATCH] Add definitions for ETK pads and debobs registers Peter 'p2' De Schrijver
2008-09-17 15:02 ` [PATCH] Debobs and ETK padconf implementation Peter 'p2' De Schrijver
2008-09-17 15:02 ` [PATCH] Add debobs Kconfig item Peter 'p2' De Schrijver
2008-09-25 8:58 ` Kevin Hilman
2008-09-25 8:56 ` [PATCH] Debobs and ETK padconf implementation Kevin Hilman
2008-09-25 11:35 ` Peter 'p2' De Schrijver
2008-09-25 11:40 ` Kevin Hilman
2008-09-25 11:52 ` Peter 'p2' De Schrijver
2008-09-25 12:06 ` Peter 'p2' De Schrijver
2008-09-25 12:31 ` Kevin Hilman
2008-09-25 17:04 ` David Brownell
2008-09-25 20:28 ` Kevin Hilman
2008-09-25 20:37 ` David Brownell
-- strict thread matches above, loose matches on Subject: below --
2008-09-16 9:51 [PATCH] debobs support for OMAP3430 Peter 'p2' De Schrijver
2008-09-16 9:51 ` [PATCH] Add definitions for ETK pads and debobs registers Peter 'p2' De Schrijver
2008-09-16 9:51 ` [PATCH] Debobs and ETK padconf implementation Peter 'p2' De Schrijver
2008-09-16 9:51 ` [PATCH] Add debobs Kconfig item Peter 'p2' De Schrijver
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox