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.
This commit is contained in:
jhibbits 2015-06-06 16:38:40 +00:00
parent 8563211eff
commit 400239ed81

View File

@ -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);