Date: Sat, 6 Jun 2015 16:38:40 +0000 (UTC) From: Justin Hibbits <jhibbits@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r284083 - head/sys/dev/nand Message-ID: <201506061638.t56Gce9u036273@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jhibbits Date: Sat Jun 6 16:38:40 2015 New Revision: 284083 URL: https://svnweb.freebsd.org/changeset/base/284083 Log: Map the LAW for the RouterBoard's NAND LBC memory. Without creating a LAW entry, any access to the NAND hangs the CPU. The original intent was to add a quirk to map all of the RouterBoard's LBC address space in one shot, which would fix it for both NAND and the CF, and that's probably still in the cards. However, for now, this makes NAND usable without a separate hack. Things left before the RouterBoard can run standalone: * Add partitions to the NAND (not specified by the FDT, which we currently require). * Create a YAFFS partition for the kernel. The Mikrotik boot loader requires a 4MB partition at the beginning of NAND, with a file called 'kernel' in the root. Modified: head/sys/dev/nand/nfc_rb.c Modified: head/sys/dev/nand/nfc_rb.c ============================================================================== --- head/sys/dev/nand/nfc_rb.c Sat Jun 6 16:36:13 2015 (r284082) +++ head/sys/dev/nand/nfc_rb.c Sat Jun 6 16:38:40 2015 (r284083) @@ -49,6 +49,9 @@ __FBSDID("$FreeBSD$"); #include <dev/nand/nand.h> #include <dev/nand/nandbus.h> + +#include <powerpc/mpc85xx/mpc85xx.h> + #include "nfc_if.h" #include "gpio_if.h" @@ -128,6 +131,7 @@ rb_nand_attach(device_t dev) struct rb_nand_softc *sc; phandle_t node; uint32_t ale[2],cle[2],nce[2],rdy[2]; + u_long size,start; int err; sc = device_get_softc(dev); @@ -168,6 +172,14 @@ rb_nand_attach(device_t dev) return (ENXIO); } + start = rman_get_start(sc->sc_mem); + size = rman_get_size(sc->sc_mem); + if (law_enable(OCP85XX_TGTIF_LBC, start, size) != 0) { + bus_release_resource(dev, SYS_RES_MEMORY, sc->rid, sc->sc_mem); + device_printf(dev, "could not allocate local address window.\n"); + return (ENXIO); + } + nand_init(&sc->nand_dev, dev, NAND_ECC_SOFT, 0, 0, NULL, NULL); err = nandbus_create(dev);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201506061638.t56Gce9u036273>