* [PATCH 0/3] linux-2.6-windriver: Beagleboard revision detection and gpio write-protect mapping
@ 2011-01-21 16:37 Darren Hart
2011-01-21 16:37 ` [PATCH 1/3] omap: Beagle: revision detection Robert Nelson
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Darren Hart @ 2011-01-21 16:37 UTC (permalink / raw)
To: poky, bruce.ashfield, tom.zanussi
The existing board detection doesn't work for all board types. The GPIO pins are
mapped differently, particularly the SD card write-protect lines. These patches
fix a boot hang on the Beagleboard xM due to the xM using a micro SD which
doesn't have WP lines.
The following patches already exist in mainline and apply without modification
to the linux-2.6-windriver git tree.
Please merge dvhart/beagleboard-standard with beagleboard-standard.
Pull URL: git://git.pokylinux.org/linux-2.6-windriver-contrib.git
Branch: dvhart/beagleboard-standard
Browse: http://git.pokylinux.org/cgit.cgi/linux-2.6-windriver-contrib/log/?h=dvhart/beagleboard-standard
Thanks,
Darren Hart <dvhart@linux.intel.com>
---
Robert Nelson (3):
omap: Beagle: revision detection
omap: Beagle: only Cx boards use pin 23 for write protect
omap: Beagle: no gpio_wp pin connection on xM
arch/arm/mach-omap2/board-omap3beagle.c | 93 ++++++++++++++++++++++++++++++-
1 files changed, 92 insertions(+), 1 deletions(-)
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/3] omap: Beagle: revision detection
2011-01-21 16:37 [PATCH 0/3] linux-2.6-windriver: Beagleboard revision detection and gpio write-protect mapping Darren Hart
@ 2011-01-21 16:37 ` Robert Nelson
2011-01-21 16:37 ` [PATCH 2/3] omap: Beagle: only Cx boards use pin 23 for write protect Robert Nelson
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Robert Nelson @ 2011-01-21 16:37 UTC (permalink / raw)
To: poky, bruce.ashfield, tom.zanussi
Due to the omap3530 ES3.0 Silicon being used on both the
B5/B6 and C1/2/3 Beagle we can't use the cpu_is_omap34xx()
routines to differentiate the Beagle Boards.
However gpio pins 171,172,173 where setup for this prupose, so
lets use them.
Changes:
for older U-Boot's, use omap_mux_init_gpio()
keep Beagle Rev in board-omap3beagle.c
gpio_free on gpio request failure
Tested on Beagle Revisions: B5, C2, C4, and xMA
Signed-off-by: Robert Nelson <robertcnelson@gmail.com>
Acked-by: Jarkko Nikula <jhnikula@gmail.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
---
arch/arm/mach-omap2/board-omap3beagle.c | 88 +++++++++++++++++++++++++++++++
1 files changed, 88 insertions(+), 0 deletions(-)
diff --git a/arch/arm/mach-omap2/board-omap3beagle.c b/arch/arm/mach-omap2/board-omap3beagle.c
index 962d377..734aa93 100644
--- a/arch/arm/mach-omap2/board-omap3beagle.c
+++ b/arch/arm/mach-omap2/board-omap3beagle.c
@@ -52,6 +52,93 @@
#define NAND_BLOCK_SIZE SZ_128K
+/*
+ * OMAP3 Beagle revision
+ * Run time detection of Beagle revision is done by reading GPIO.
+ * GPIO ID -
+ * AXBX = GPIO173, GPIO172, GPIO171: 1 1 1
+ * C1_3 = GPIO173, GPIO172, GPIO171: 1 1 0
+ * C4 = GPIO173, GPIO172, GPIO171: 1 0 1
+ * XM = GPIO173, GPIO172, GPIO171: 0 0 0
+ */
+enum {
+ OMAP3BEAGLE_BOARD_UNKN = 0,
+ OMAP3BEAGLE_BOARD_AXBX,
+ OMAP3BEAGLE_BOARD_C1_3,
+ OMAP3BEAGLE_BOARD_C4,
+ OMAP3BEAGLE_BOARD_XM,
+};
+
+static u8 omap3_beagle_version;
+
+static u8 omap3_beagle_get_rev(void)
+{
+ return omap3_beagle_version;
+}
+
+static void __init omap3_beagle_init_rev(void)
+{
+ int ret;
+ u16 beagle_rev = 0;
+
+ omap_mux_init_gpio(171, OMAP_PIN_INPUT_PULLUP);
+ omap_mux_init_gpio(172, OMAP_PIN_INPUT_PULLUP);
+ omap_mux_init_gpio(173, OMAP_PIN_INPUT_PULLUP);
+
+ ret = gpio_request(171, "rev_id_0");
+ if (ret < 0)
+ goto fail0;
+
+ ret = gpio_request(172, "rev_id_1");
+ if (ret < 0)
+ goto fail1;
+
+ ret = gpio_request(173, "rev_id_2");
+ if (ret < 0)
+ goto fail2;
+
+ gpio_direction_input(171);
+ gpio_direction_input(172);
+ gpio_direction_input(173);
+
+ beagle_rev = gpio_get_value(171) | (gpio_get_value(172) << 1)
+ | (gpio_get_value(173) << 2);
+
+ switch (beagle_rev) {
+ case 7:
+ printk(KERN_INFO "OMAP3 Beagle Rev: Ax/Bx\n");
+ omap3_beagle_version = OMAP3BEAGLE_BOARD_AXBX;
+ break;
+ case 6:
+ printk(KERN_INFO "OMAP3 Beagle Rev: C1/C2/C3\n");
+ omap3_beagle_version = OMAP3BEAGLE_BOARD_C1_3;
+ break;
+ case 5:
+ printk(KERN_INFO "OMAP3 Beagle Rev: C4\n");
+ omap3_beagle_version = OMAP3BEAGLE_BOARD_C4;
+ break;
+ case 0:
+ printk(KERN_INFO "OMAP3 Beagle Rev: xM\n");
+ omap3_beagle_version = OMAP3BEAGLE_BOARD_XM;
+ break;
+ default:
+ printk(KERN_INFO "OMAP3 Beagle Rev: unknown %hd\n", beagle_rev);
+ omap3_beagle_version = OMAP3BEAGLE_BOARD_UNKN;
+ }
+
+ return;
+
+fail2:
+ gpio_free(172);
+fail1:
+ gpio_free(171);
+fail0:
+ printk(KERN_ERR "Unable to get revision detection GPIO pins\n");
+ omap3_beagle_version = OMAP3BEAGLE_BOARD_UNKN;
+
+ return;
+}
+
static struct mtd_partition omap3beagle_nand_partitions[] = {
/* All the partition sizes are listed in terms of NAND block size */
{
@@ -439,6 +526,7 @@ static struct omap_musb_board_data musb_board_data = {
static void __init omap3_beagle_init(void)
{
omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
+ omap3_beagle_init_rev();
omap3_beagle_i2c_init();
platform_add_devices(omap3_beagle_devices,
ARRAY_SIZE(omap3_beagle_devices));
--
1.7.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/3] omap: Beagle: only Cx boards use pin 23 for write protect
2011-01-21 16:37 [PATCH 0/3] linux-2.6-windriver: Beagleboard revision detection and gpio write-protect mapping Darren Hart
2011-01-21 16:37 ` [PATCH 1/3] omap: Beagle: revision detection Robert Nelson
@ 2011-01-21 16:37 ` Robert Nelson
2011-01-21 16:37 ` [PATCH 3/3] omap: Beagle: no gpio_wp pin connection on xM Robert Nelson
2011-01-21 18:05 ` [PATCH 0/3] linux-2.6-windriver: Beagleboard revision detection and gpio write-protect mapping Bruce Ashfield
3 siblings, 0 replies; 5+ messages in thread
From: Robert Nelson @ 2011-01-21 16:37 UTC (permalink / raw)
To: poky, bruce.ashfield, tom.zanussi
system_rev comes from u-boot and is a constant 0x20, so
Bx boards also fall in this 'if' and will get setup with the
wrong gpio_wp pin. Switch to using the Beagle revision routine
to correcly set pin 23 only for C1/2/3 and C4 Boards. Bx boards
will then use the correct default pin setting.
Signed-off-by: Robert Nelson <robertcnelson@gmail.com>
Acked-by: Jarkko Nikula <jhnikula@gmail.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
---
arch/arm/mach-omap2/board-omap3beagle.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/arch/arm/mach-omap2/board-omap3beagle.c b/arch/arm/mach-omap2/board-omap3beagle.c
index 734aa93..f80d2cd 100644
--- a/arch/arm/mach-omap2/board-omap3beagle.c
+++ b/arch/arm/mach-omap2/board-omap3beagle.c
@@ -226,7 +226,8 @@ static struct gpio_led gpio_leds[];
static int beagle_twl_gpio_setup(struct device *dev,
unsigned gpio, unsigned ngpio)
{
- if (system_rev >= 0x20 && system_rev <= 0x34301000) {
+ if ((omap3_beagle_get_rev() == OMAP3BEAGLE_BOARD_C1_3) ||
+ (omap3_beagle_get_rev() == OMAP3BEAGLE_BOARD_C4)) {
omap_mux_init_gpio(23, OMAP_PIN_INPUT);
mmc[0].gpio_wp = 23;
} else {
--
1.7.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 3/3] omap: Beagle: no gpio_wp pin connection on xM
2011-01-21 16:37 [PATCH 0/3] linux-2.6-windriver: Beagleboard revision detection and gpio write-protect mapping Darren Hart
2011-01-21 16:37 ` [PATCH 1/3] omap: Beagle: revision detection Robert Nelson
2011-01-21 16:37 ` [PATCH 2/3] omap: Beagle: only Cx boards use pin 23 for write protect Robert Nelson
@ 2011-01-21 16:37 ` Robert Nelson
2011-01-21 18:05 ` [PATCH 0/3] linux-2.6-windriver: Beagleboard revision detection and gpio write-protect mapping Bruce Ashfield
3 siblings, 0 replies; 5+ messages in thread
From: Robert Nelson @ 2011-01-21 16:37 UTC (permalink / raw)
To: poky, bruce.ashfield, tom.zanussi
The omap3630 based BeagleBoard xM uses a MicroSD card slot with
no write protection.
Signed-off-by: Robert Nelson <robertcnelson@gmail.com>
Acked-by: Jarkko Nikula <jhnikula@gmail.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
---
arch/arm/mach-omap2/board-omap3beagle.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/arch/arm/mach-omap2/board-omap3beagle.c b/arch/arm/mach-omap2/board-omap3beagle.c
index f80d2cd..5bcf6ee 100644
--- a/arch/arm/mach-omap2/board-omap3beagle.c
+++ b/arch/arm/mach-omap2/board-omap3beagle.c
@@ -226,7 +226,9 @@ static struct gpio_led gpio_leds[];
static int beagle_twl_gpio_setup(struct device *dev,
unsigned gpio, unsigned ngpio)
{
- if ((omap3_beagle_get_rev() == OMAP3BEAGLE_BOARD_C1_3) ||
+ if (omap3_beagle_get_rev() == OMAP3BEAGLE_BOARD_XM) {
+ mmc[0].gpio_wp = -EINVAL;
+ } else if ((omap3_beagle_get_rev() == OMAP3BEAGLE_BOARD_C1_3) ||
(omap3_beagle_get_rev() == OMAP3BEAGLE_BOARD_C4)) {
omap_mux_init_gpio(23, OMAP_PIN_INPUT);
mmc[0].gpio_wp = 23;
--
1.7.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 0/3] linux-2.6-windriver: Beagleboard revision detection and gpio write-protect mapping
2011-01-21 16:37 [PATCH 0/3] linux-2.6-windriver: Beagleboard revision detection and gpio write-protect mapping Darren Hart
` (2 preceding siblings ...)
2011-01-21 16:37 ` [PATCH 3/3] omap: Beagle: no gpio_wp pin connection on xM Robert Nelson
@ 2011-01-21 18:05 ` Bruce Ashfield
3 siblings, 0 replies; 5+ messages in thread
From: Bruce Ashfield @ 2011-01-21 18:05 UTC (permalink / raw)
To: Darren Hart; +Cc: poky
On Fri, Jan 21, 2011 at 11:37 AM, Darren Hart <dvhart@linux.intel.com> wrote:
> The existing board detection doesn't work for all board types. The GPIO pins are
> mapped differently, particularly the SD card write-protect lines. These patches
> fix a boot hang on the Beagleboard xM due to the xM using a micro SD which
> doesn't have WP lines.
>
> The following patches already exist in mainline and apply without modification
> to the linux-2.6-windriver git tree.
>
> Please merge dvhart/beagleboard-standard with beagleboard-standard.
Grabbed them and amended with the upstream commit IDs for tracking.
SRCREV bumps shortly. My build worked here.
Bruce
>
> Pull URL: git://git.pokylinux.org/linux-2.6-windriver-contrib.git
> Branch: dvhart/beagleboard-standard
> Browse: http://git.pokylinux.org/cgit.cgi/linux-2.6-windriver-contrib/log/?h=dvhart/beagleboard-standard
>
> Thanks,
> Darren Hart <dvhart@linux.intel.com>
> ---
>
>
> Robert Nelson (3):
> omap: Beagle: revision detection
> omap: Beagle: only Cx boards use pin 23 for write protect
> omap: Beagle: no gpio_wp pin connection on xM
>
> arch/arm/mach-omap2/board-omap3beagle.c | 93 ++++++++++++++++++++++++++++++-
> 1 files changed, 92 insertions(+), 1 deletions(-)
>
> _______________________________________________
> poky mailing list
> poky@yoctoproject.org
> https://lists.yoctoproject.org/listinfo/poky
>
--
"Thou shalt not follow the NULL pointer, for chaos and madness await
thee at its end"
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2011-01-21 18:05 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-21 16:37 [PATCH 0/3] linux-2.6-windriver: Beagleboard revision detection and gpio write-protect mapping Darren Hart
2011-01-21 16:37 ` [PATCH 1/3] omap: Beagle: revision detection Robert Nelson
2011-01-21 16:37 ` [PATCH 2/3] omap: Beagle: only Cx boards use pin 23 for write protect Robert Nelson
2011-01-21 16:37 ` [PATCH 3/3] omap: Beagle: no gpio_wp pin connection on xM Robert Nelson
2011-01-21 18:05 ` [PATCH 0/3] linux-2.6-windriver: Beagleboard revision detection and gpio write-protect mapping Bruce Ashfield
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.