From owner-svn-src-all@FreeBSD.ORG Sun Feb 9 20:59:46 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id AC0AD462; Sun, 9 Feb 2014 20:59:46 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 7DAA716BB; Sun, 9 Feb 2014 20:59:46 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s19KxkI3021499; Sun, 9 Feb 2014 20:59:46 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s19Kxk54021498; Sun, 9 Feb 2014 20:59:46 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <201402092059.s19Kxk54021498@svn.freebsd.org> From: Warner Losh Date: Sun, 9 Feb 2014 20:59:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r261685 - head/sys/arm/at91 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 09 Feb 2014 20:59:46 -0000 Author: imp Date: Sun Feb 9 20:59:46 2014 New Revision: 261685 URL: http://svnweb.freebsd.org/changeset/base/261685 Log: Add FDT attachment. Flag lost functionality with FDT_HACKS so we can find it later. Modified: head/sys/arm/at91/at91_rst.c Modified: head/sys/arm/at91/at91_rst.c ============================================================================== --- head/sys/arm/at91/at91_rst.c Sun Feb 9 20:58:03 2014 (r261684) +++ head/sys/arm/at91/at91_rst.c Sun Feb 9 20:59:46 2014 (r261685) @@ -23,6 +23,8 @@ * SUCH DAMAGE. */ +#include "opt_platform.h" + #include __FBSDID("$FreeBSD$"); @@ -39,10 +41,19 @@ __FBSDID("$FreeBSD$"); #include #include +#ifdef FDT +#include +#include +#include +#define FDT_HACKS 1 +#endif + #define RST_TIMEOUT (5) /* Seconds to hold NRST for hard reset */ #define RST_TICK (20) /* sample NRST at hz/RST_TICK intervals */ +#ifndef FDT static int at91_rst_intr(void *arg); +#endif static struct at91_rst_softc { struct resource *mem_res; /* Memory resource */ @@ -93,6 +104,10 @@ at91_rst_cpu_reset(void) static int at91_rst_probe(device_t dev) { +#ifdef FDT + if (!ofw_bus_is_compatible(dev, "atmel,at91sam9260-rstc")) + return (ENXIO); +#endif device_set_desc(dev, "AT91SAM9 Reset Controller"); return (0); @@ -103,7 +118,7 @@ at91_rst_attach(device_t dev) { struct at91_rst_softc *sc; const char *cause; - int rid, err; + int rid, err = 0; at91_rst_sc = sc = device_get_softc(dev); sc->sc_dev = dev; @@ -118,6 +133,8 @@ at91_rst_attach(device_t dev) err = ENOMEM; goto out; } + +#ifndef FDT_HACKS rid = 0; sc->irq_res = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, RF_ACTIVE | RF_SHAREABLE); @@ -132,6 +149,7 @@ at91_rst_attach(device_t dev) at91_rst_intr, NULL, sc, &sc->intrhand); if (err) device_printf(dev, "could not establish interrupt handler.\n"); +#endif WR4(at91_rst_sc, RST_MR, RST_MR_ERSTL(0xd) | RST_MR_URSIEN | RST_MR_KEY); @@ -161,6 +179,7 @@ out: return (err); } +#ifndef FDT_HACKS static void at91_rst_tick(void *argp) { @@ -191,6 +210,7 @@ at91_rst_intr(void *argp) } return (FILTER_STRAY); } +#endif static device_method_t at91_rst_methods[] = { DEVMETHOD(device_probe, at91_rst_probe), @@ -206,5 +226,10 @@ static driver_t at91_rst_driver = { static devclass_t at91_rst_devclass; +#ifdef FDT +DRIVER_MODULE(at91_rst, simplebus, at91_rst_driver, at91_rst_devclass, NULL, + NULL); +#else DRIVER_MODULE(at91_rst, atmelarm, at91_rst_driver, at91_rst_devclass, NULL, NULL); +#endif