Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 15 Jul 2011 02:29:11 +0000 (UTC)
From:      Marcel Moolenaar <marcel@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r224051 - head/sys/arm/mv
Message-ID:  <201107150229.p6F2TBV9056290@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: marcel
Date: Fri Jul 15 02:29:10 2011
New Revision: 224051
URL: http://svn.freebsd.org/changeset/base/224051

Log:
  Do not call platform_gpio_init() early. It doesn't work because we do
  not have enough information to reliably setup GPIO pins. Do it when
  we attach the gpio driver. This prevents hangs and the need to fake
  up a softc.

Modified:
  head/sys/arm/mv/gpio.c
  head/sys/arm/mv/mv_machdep.c

Modified: head/sys/arm/mv/gpio.c
==============================================================================
--- head/sys/arm/mv/gpio.c	Fri Jul 15 02:16:13 2011	(r224050)
+++ head/sys/arm/mv/gpio.c	Fri Jul 15 02:29:10 2011	(r224051)
@@ -197,10 +197,7 @@ mv_gpio_attach(device_t dev)
 		}
 	}
 
-	/*
-	 * GPIO lines setup is already done at this stage (see mv_machdep.c).
-	 */
-	return (0);
+	return (platform_gpio_init());
 }
 
 static int
@@ -565,20 +562,6 @@ mv_handle_gpios_prop(phandle_t ctrl, pce
 
 	if (fdt_regsize(ctrl, &gpio_ctrl, &size))
 		return (ENXIO);
-	/*
-	 * Since to set up GPIO we use the same functions as GPIO driver, and
-	 * mv_gpio_softc is NULL at this early stage, we need to create a fake
-	 * softc and set mv_gpio_softc pointer to that newly created object.
-	 * After successful GPIO setup, the [shared] pointer will be set back
-	 * to NULL.
-	 */
-	mv_gpio_softc = &sc;
-
-	sc.bst = fdtbus_bs_tag;
-	gpio_ctrl += fdt_immr_va;
-
-	if (bus_space_map(sc.bst, gpio_ctrl, size, 0, &sc.bsh) != 0)
-		return (ENXIO);
 
 	if (OF_getprop(ctrl, "pin-count", &pincnt, sizeof(pcell_t)) < 0)
 		return (ENXIO);
@@ -612,8 +595,6 @@ mv_handle_gpios_prop(phandle_t ctrl, pce
 		gpios += gpio_cells + inc;
 	}
 
-	/* Reset pointer. */
-	mv_gpio_softc = NULL;
 	return (0);
 }
 

Modified: head/sys/arm/mv/mv_machdep.c
==============================================================================
--- head/sys/arm/mv/mv_machdep.c	Fri Jul 15 02:16:13 2011	(r224050)
+++ head/sys/arm/mv/mv_machdep.c	Fri Jul 15 02:29:10 2011	(r224051)
@@ -512,13 +512,8 @@ initarm(void *mdp, void *unused __unused
 	if (platform_mpp_init() != 0)
 		while (1);
 
-	/*
-	 * Initialize GPIO as early as possible.
-	 */
-	if (platform_gpio_init() != 0)
-		while (1);
-
 	cninit();
+
 	physmem = memsize / PAGE_SIZE;
 
 	debugf("initarm: console initialized\n");



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201107150229.p6F2TBV9056290>