Index: Makefile
===================================================================
--- Makefile	(revision 1e8830f013665a356aabf353d3ca84e9f94ff7f1)
+++ Makefile	(revision 24600f22abda997e12dd3dc2ec54fde5fde2d789)
@@ -301,8 +301,8 @@
 	freebsd/dev/usb/controller/ehci.c \
 	freebsd/dev/usb/controller/usb_controller.c \
-	freebsd/dev/usb/controller/ohci_lpc3250.c \
 	freebsd/cam/cam.c \
 	freebsd/cam/scsi/scsi_all.c \
 	freebsd/dev/usb/storage/umass.c \
+	rtemsbsd/dev/usb/controller/ohci_lpc3250.c \
 	rtemsbsd/src/rtems-bsd-cam.c \
 	rtemsbsd/src/rtems-bsd-nexus.c \
@@ -350,5 +350,5 @@
 
 install: $(LIB)
-	install -d "$(INSTALL_BASE)/include"
+	install -d $(INSTALL_BASE)/include
 	install -c -m 644 $(LIB) $(INSTALL_BASE)
 	cd rtemsbsd; for i in `find . -name '*.h'` ; do \
Index: freebsd-to-rtems.py
===================================================================
--- freebsd-to-rtems.py	(revision 1e8830f013665a356aabf353d3ca84e9f94ff7f1)
+++ freebsd-to-rtems.py	(revision 24600f22abda997e12dd3dc2ec54fde5fde2d789)
@@ -42,6 +42,7 @@
 isVerbose = False
 isForward = True
-isDryRun = True
+isDryRun = False
 isEarlyExit = False
+isOnlyMakefile = False
 
 def usage():
@@ -50,4 +51,5 @@
   print "  -d|--dry-run     run program but no modifications"
   print "  -e|--early-exit  evaluate arguments, print results, and exit"
+  print "  -m|--makefile    just generate Makefile"
   print "  -R|--reverse     default FreeBSD -> RTEMS, reverse that"
   print "  -r|--rtems       RTEMS directory"
@@ -57,11 +59,13 @@
 # Parse the arguments
 def parseArguments():
-  global RTEMS_DIR, FreeBSD_DIR, isVerbose, isForward, isEarlyExit
+  global RTEMS_DIR, FreeBSD_DIR
+  global isVerbose, isForward, isEarlyExit, isOnlyMakefile
   try:
-    opts, args = getopt.getopt(sys.argv[1:], "?hdeRr:f:v",
+    opts, args = getopt.getopt(sys.argv[1:], "?hdemRr:f:v",
                  ["help",
                   "help",
                   "dry-run"
                   "early-exit"
+                  "makefile"
                   "reverse"
                   "rtems="
@@ -85,4 +89,6 @@
     elif o in ("-e", "--early-exit"):
       isEarlyExit = True
+    elif o in ("-m", "--makefile"):
+      isOnlyMakefile = True
     elif o in ("-R", "--reverse"):
       isForward = False
@@ -97,9 +103,10 @@
 
 parseArguments()
-print "Verbose:           " + ("no", "yes")[isVerbose]
-print "Dry Run:           " + ("no", "yes")[isDryRun]
-print "RTEMS Directory:   " + RTEMS_DIR
-print "FreeBSD Directory: " + FreeBSD_DIR
-print "Direction:         " + ("reverse", "forward")[isForward]
+print "Verbose:                " + ("no", "yes")[isVerbose]
+print "Dry Run:                " + ("no", "yes")[isDryRun]
+print "Only Generate Makefile: " + ("no", "yes")[isOnlyMakefile]
+print "RTEMS Directory:        " + RTEMS_DIR
+print "FreeBSD Directory:      " + FreeBSD_DIR
+print "Direction:              " + ("reverse", "forward")[isForward]
 
 # Check directory argument was set and exist
@@ -117,12 +124,4 @@
 wasDirectorySet( "FreeBSD", FreeBSD_DIR )
  
-if os.path.isdir( FreeBSD_DIR ) != True:
-    print "FreeBSD Directory (" + FreeBSD_DIR + ") does not exist"
-    sys.exit(2)
- 
-if FreeBSD_DIR == RTEMS_DIR:
-    print "FreeBSD and RTEMS Directories are the same"
-    sys.exit(2)
-
 # Are we generating or reverting?
 if isForward == True:
@@ -130,4 +129,7 @@
 else:
     print "Reverting from", RTEMS_DIR
+    if isOnlyMakefile == True:
+        print "Only Makefile Mode and Reverse are contradictory"
+        sys.exit(2)
 
 if isEarlyExit == True:
@@ -324,5 +326,5 @@
 				data += ' \\\n\t' + f
 		for f in rtems_sourceFiles:
-			f = 'rtemsbsd/src/' + f
+			f = 'rtemsbsd/' + f
 			data += ' \\\n\t' + f
 
@@ -410,37 +412,38 @@
 	]
 rtems_sourceFiles = [
-	'rtems-bsd-cam.c',
-	'rtems-bsd-nexus.c',
-	'rtems-bsd-autoconf.c',
-        'rtems-bsd-delay.c',
-	'rtems-bsd-mutex.c',
-	'rtems-bsd-thread.c',
-	'rtems-bsd-condvar.c',
-        'rtems-bsd-lock.c',
-	'rtems-bsd-sx.c',
-        'rtems-bsd-rmlock.c',
-        'rtems-bsd-rwlock.c',
-        'rtems-bsd-generic.c',
-        'rtems-bsd-panic.c',
-        'rtems-bsd-synch.c',
-	'rtems-bsd-signal.c',
-	'rtems-bsd-callout.c',
-	'rtems-bsd-init.c',
-        'rtems-bsd-init-with-irq.c',
-	'rtems-bsd-assert.c',
-        'rtems-bsd-prot.c',
-        'rtems-bsd-resource.c',
-        'rtems-bsd-jail.c',
-	'rtems-bsd-shell.c',
-        'rtems-bsd-syscalls.c',
-        #rtems-bsd-socket.c',
-        #rtems-bsd-mbuf.c',
-	'rtems-bsd-malloc.c',
-        'rtems-bsd-support.c',
-	'rtems-bsd-bus-dma.c',
-        'rtems-bsd-sysctl.c',
-        'rtems-bsd-sysctlbyname.c',
-        'rtems-bsd-sysctlnametomib.c',
-        'rtems-bsd-uma.c',
+	'dev/usb/controller/ohci_lpc3250.c',
+	'src/rtems-bsd-cam.c',
+	'src/rtems-bsd-nexus.c',
+	'src/rtems-bsd-autoconf.c',
+        'src/rtems-bsd-delay.c',
+	'src/rtems-bsd-mutex.c',
+	'src/rtems-bsd-thread.c',
+	'src/rtems-bsd-condvar.c',
+        'src/rtems-bsd-lock.c',
+	'src/rtems-bsd-sx.c',
+        'src/rtems-bsd-rmlock.c',
+        'src/rtems-bsd-rwlock.c',
+        'src/rtems-bsd-generic.c',
+        'src/rtems-bsd-panic.c',
+        'src/rtems-bsd-synch.c',
+	'src/rtems-bsd-signal.c',
+	'src/rtems-bsd-callout.c',
+	'src/rtems-bsd-init.c',
+        'src/rtems-bsd-init-with-irq.c',
+	'src/rtems-bsd-assert.c',
+        'src/rtems-bsd-prot.c',
+        'src/rtems-bsd-resource.c',
+        'src/rtems-bsd-jail.c',
+	'src/rtems-bsd-shell.c',
+        'src/rtems-bsd-syscalls.c',
+        #'src/rtems-bsd-socket.c',
+        #'src/rtems-bsd-mbuf.c',
+	'src/rtems-bsd-malloc.c',
+        'src/rtems-bsd-support.c',
+	'src/rtems-bsd-bus-dma.c',
+        'src/rtems-bsd-sysctl.c',
+        'src/rtems-bsd-sysctlbyname.c',
+        'src/rtems-bsd-sysctlnametomib.c',
+        'src/rtems-bsd-uma.c',
 	]
 # RTEMS files handled separately from modules
@@ -450,4 +453,5 @@
 
 local = Module('local')
+# RTEMS has its own local/pmap.h
 local.addHeaderFiles(
 	[
@@ -513,5 +517,4 @@
 		'local/opt_wlan.h',
         	'local/opt_zero.h',
-        	'local/pmap.h',
 		'local/usbdevs_data.h',
 		'local/usbdevs.h',
@@ -632,5 +635,4 @@
 		'dev/usb/controller/ehci.c',
 		'dev/usb/controller/usb_controller.c',
-		'dev/usb/controller/ohci_lpc3250.c',
 	]
 )
@@ -1711,5 +1713,6 @@
 # Perform the actual file manipulation
 if isForward == True:
-    mm.copyFiles()
+    if isOnlyMakefile == False:
+        mm.copyFiles()
     mm.createMakefile()
 else:
Index: eebsd/dev/usb/controller/ohci_lpc3250.c
===================================================================
--- freebsd/dev/usb/controller/ohci_lpc3250.c	(revision 1e8830f013665a356aabf353d3ca84e9f94ff7f1)
+++ 	(revision )
@@ -1,361 +1,0 @@
-#include <freebsd/machine/rtems-bsd-config.h>
-
-#include <freebsd/machine/rtems-bsd-config.h>
-
-#include <bsp.h>
-
-#ifdef LIBBSP_ARM_LPC3250_BSP_H
-
-#include <bsp/irq.h>
-
-#include <freebsd/sys/cdefs.h>
-#include <freebsd/sys/stdint.h>
-#include <freebsd/sys/stddef.h>
-#include <freebsd/sys/param.h>
-#include <freebsd/sys/queue.h>
-#include <freebsd/sys/types.h>
-#include <freebsd/sys/systm.h>
-#include <freebsd/sys/kernel.h>
-#include <freebsd/sys/bus.h>
-#include <freebsd/sys/linker_set.h>
-#include <freebsd/sys/module.h>
-#include <freebsd/sys/lock.h>
-#include <freebsd/sys/mutex.h>
-#include <freebsd/sys/condvar.h>
-#include <freebsd/sys/sysctl.h>
-#include <freebsd/sys/sx.h>
-#include <freebsd/sys/unistd.h>
-#include <freebsd/sys/callout.h>
-#include <freebsd/sys/malloc.h>
-#include <freebsd/sys/priv.h>
-
-#include <freebsd/dev/usb/usb.h>
-#include <freebsd/dev/usb/usbdi.h>
-
-#include <freebsd/dev/usb/usb_core.h>
-#include <freebsd/dev/usb/usb_busdma.h>
-#include <freebsd/dev/usb/usb_process.h>
-#include <freebsd/dev/usb/usb_util.h>
-
-#include <freebsd/dev/usb/usb_controller.h>
-#include <freebsd/dev/usb/usb_bus.h>
-#include <freebsd/dev/usb/controller/ohci.h>
-
-typedef struct
-{
-  uint16_t VendorID;
-  uint16_t ProductID;
-  uint16_t VersionID;
-} isp130x_PhyDetails_Typ;
-
-static void
-i2c_wait_for_receive_fifo_not_empty(void)
-{
-  while ((OTGI2CSTS & OTG_I2C_RFE) != 0) {
-		/* Wait */
-	}
-}
-
-static uint8_t
-isp1301_read(uint8_t reg)
-{
-  OTGI2CCTL = OTG_I2C_RESET;
-
-  OTGI2CTX = ISP1301_I2C_ADDR | OTG_I2C_START;
-
-  OTGI2CTX = reg;
-
-  OTGI2CTX = ISP1301_I2C_ADDR | OTG_I2C_READ | OTG_I2C_START;
-
-  OTGI2CTX = OTG_I2C_STOP;
-
-	i2c_wait_for_receive_fifo_not_empty();
-
-  return (uint8_t) OTGI2CRX;
-}
-
-static void
-i2c_wait_for_transaction_done(void)
-{
-  while ((OTGI2CSTS & OTG_I2C_TDI) == 0) {
-		/* Wait */
-	}
-
-  OTGI2CSTS = OTG_I2C_TDI;
-}
-
-static void
-isp1301_write(uint8_t reg, uint8_t val)
-{
-
-  OTGI2CCTL = OTG_I2C_RESET;
-
-  OTGI2CTX = ISP1301_I2C_ADDR | OTG_I2C_START;
-
-  OTGI2CTX = reg;
-
-  OTGI2CTX = val | OTG_I2C_STOP;
-
-	i2c_wait_for_transaction_done();
-}
-
-static void
-isp1301_dump(void)
-{
-	BSD_PRINTF(
-		"ISP1301: mc1 %02x, mc2 %02x, otgctrl %02x, otgsts %02x, isrc %02x, iltch %02x, ienl %02x, ienh %02x\n",
-		isp1301_read(ISP1301_MODE_CONTROL_1),
-		isp1301_read(ISP1301_MODE_CONTROL_2),
-    isp1301_read(ISP1301_OTG_CONTROL_1),
-		isp1301_read(ISP1301_OTG_STATUS),
-    isp1301_read(ISP1301_I2C_INTERRUPT_SOURCE),
-    isp1301_read(ISP1301_I2C_INTERRUPT_LATCH),
-    isp1301_read(ISP1301_I2C_INTERRUPT_FALLING),
-    isp1301_read(ISP1301_I2C_INTERRUPT_RISING)
-	);
-}
-
-
-static isp130x_PhyDetails_Typ
- isp130x_GetPhyDetails(void)
-{
-  isp130x_PhyDetails_Typ PhyDetails;
-
-  PhyDetails.VendorID  = (uint16_t)((isp1301_read(ISP1301_I2C_VENDOR_ID_HIGH) << 8) |
-                                     isp1301_read(ISP1301_I2C_VENDOR_ID_LOW));
-
-  PhyDetails.ProductID = (uint16_t)((isp1301_read(ISP1301_I2C_PRODUCT_ID_HIGH) << 8) |
-                                     isp1301_read(ISP1301_I2C_PRODUCT_ID_LOW));
-
-  PhyDetails.VersionID = (uint16_t)((isp1301_read(ISP1301_I2C_VERSION_ID_HIGH) << 8) |
-                                     isp1301_read(ISP1301_I2C_VERSION_ID_LOW));
-
-  return PhyDetails;
-}
-
-
-static void
-isp1301_configure(void)
-{
-    isp130x_PhyDetails_Typ PhyDetails = isp130x_GetPhyDetails();
-
-    BSD_PRINTF("ISP130x: vendor 0x%04x, product 0x%04x, version 0x%04x\n",
-               PhyDetails.VendorID,
-               PhyDetails.ProductID,
-               PhyDetails.VersionID);
-
-	isp1301_write(ISP1301_MODE_CONTROL_1_CLEAR, 0xff);
-  isp1301_write(ISP1301_MODE_CONTROL_1_SET, MC1_SPEED_REG);
-	isp1301_write(ISP1301_MODE_CONTROL_2_CLEAR, 0xff);
-
-    switch (PhyDetails.ProductID)
-    {
-      case ISP1301_PRODUCT_ID:
-        isp1301_write(ISP1301_MODE_CONTROL_2_SET, MC2_BI_DI |
-                                                  MC2_PSW_EN |
-                                                  MC2_SPD_SUSP_CTRL);
-        break;
-
-      case ISP1302_PRODUCT_ID:
-        // Do not set 'SPD_SUSP_CTRL' bit as per ISP1301 this bit is reserved in
-        // ISP1302, setting it will cause problems.
-        isp1301_write(ISP1301_MODE_CONTROL_2_SET, MC2_BI_DI |
-                                                  MC2_PSW_EN);
-
-        // ISP1302 has an additonal register we should initialise it..
-        isp1301_write(ISP1302_MISC_CONTROL_CLEAR, 0xff);
-        isp1301_write(ISP1302_MISC_CONTROL_SET, MISC_UART_2V8_EN);
-
-        break;
-
-      default:
-        break;
-    }
-
-    isp1301_write(ISP1301_OTG_CONTROL_CLEAR, 0xff);
-  isp1301_write(ISP1301_MODE_CONTROL_1_SET, MC1_DAT_SE0);
-  isp1301_write(ISP1301_OTG_CONTROL_SET, OTG1_DM_PULLDOWN | OTG1_DP_PULLDOWN);
-  isp1301_write(ISP1301_I2C_INTERRUPT_LATCH_CLEAR, 0xff);
-  isp1301_write(ISP1301_I2C_INTERRUPT_FALLING_CLEAR, 0xff);
-  isp1301_write(ISP1301_I2C_INTERRUPT_RISING_CLEAR, 0xff);
-}
-
-static void
-isp1301_vbus_on(void)
-{
-  isp1301_write(ISP1301_OTG_CONTROL_SET, OTG1_VBUS_DRV);
-}
-
-static int
-ohci_lpc32xx_suspend(device_t self)
-{
-	ohci_softc_t *e = device_get_softc(self);
-	int eno = bus_generic_suspend(self);
-
-	if (eno != 0) {
-		return (eno);
-	}
-
-	ohci_suspend(e);
-
-	return (0);
-}
-
-static int
-ohci_lpc32xx_resume(device_t self)
-{
-	ohci_softc_t *e = device_get_softc(self);
-
-	ohci_resume(e);
-
-	bus_generic_resume(self);
-
-	return (0);
-}
-
-
-static int
-ohci_lpc32xx_probe(device_t self)
-{
-  device_set_desc(self, "LPC3250 OHCI controller");
-
-	return (0);
-}
-
-static int
-ohci_lpc32xx_detach(device_t self)
-{
-	ohci_softc_t *e = device_get_softc(self);
-
-	BSD_PRINTF("FIXME\n");
-
-	return (0);
-}
-
-static int
-ohci_lpc32xx_attach(device_t self)
-{
-	rtems_status_code sc = RTEMS_SUCCESSFUL;
-	ohci_softc_t *e = device_get_softc(self);
-	usb_error_t ue = USB_ERR_NORMAL_COMPLETION;
-	int eno = 0;
-
-	memset(e, 0, sizeof(*e));
-
-	/* Initialize some bus fields */
-	e->sc_bus.parent = self;
-	e->sc_bus.devices = e->sc_devices;
-	e->sc_bus.devices_max = OHCI_MAX_DEVICES;
-
-	/* Get all DMA memory */
-	if (usb_bus_mem_alloc_all(&e->sc_bus, USB_GET_DMA_TAG(self), &ohci_iterate_hw_softc)) {
-		return (ENOMEM);
-	}
-	e->sc_dev = self;
-
-	/* Child device */
-	e->sc_bus.bdev = device_add_child(self, "usbus", -1);
-	if (e->sc_bus.bdev == NULL) {
-		device_printf(self, "Could not add USB device\n");
-		goto error;
-	}
-	device_set_ivars(e->sc_bus.bdev, &e->sc_bus);
-  device_set_desc(e->sc_bus.bdev, "LPC3250 OHCI bus");
-	snprintf(e->sc_vendor, sizeof(e->sc_vendor), "NXP");
-
-	/* Register space */
-	e->sc_io_tag = 0U;
-  e->sc_io_hdl = OTGUSB_BASE;
-	e->sc_io_size = 0x5cU;
-
-	/* Enable USB PLL */
-  USBDIVCTRL = 0xc;
-  USBCTRL = USBCLK_SLAVE_HCLK_EN
-    | USBCLK_PC_BUS_KEEPER
-    | USBCLK_CLKEN1
-    | USBCLK_POWER_UP
-    | USBCLK_P_2
-    | USBCLK_N_1
-    | (191U << USBCLK_M_SHIFT);
-  while ((USBCTRL & USBCLK_PLL_LOCK) == 0) {
-		/* Wait */
-	}
-  USBCTRL |= USBCLK_CLKEN2;
-
-	/* Enable USB host and AHB clocks */
-  OTGCLKCTRL = 0x1c;
-  while ((OTGCLKSTAT & 0x1c) != 0x1c) {
-		/* Wait */
-	}
-
-	isp1301_configure();
-
-  USBCTRL |= USBCLK_HOST_NEED_CLK_EN;
-
-  OTGCLKCTRL = 0x1d;
-  while ((OTGCLKSTAT & 0x1d) != 0x1d) {
-		/* Wait */
-	}
-
-	/* Set OTG Status and Control Register */
-  OTGSTAT = 0x1;
-
-	isp1301_vbus_on();
-
-	/* Install interrupt handler */
-	sc = rtems_interrupt_server_handler_install(
-		RTEMS_ID_NONE,
-    IRQ_USB_HOST,
-		"USB",
-		RTEMS_INTERRUPT_UNIQUE,
-		(rtems_interrupt_handler) ohci_interrupt,
-		e
-	);
-	BSD_ASSERT_SC(sc);
-
-	/* OHCI intitialization */
-	ue = ohci_init(e);
-	if (ue != USB_ERR_NORMAL_COMPLETION) {
-		goto error;
-	}
-
-	/* Probe and attach child */
-	eno = device_probe_and_attach(e->sc_bus.bdev);
-	if (eno != 0) {
-		goto error;
-	}
-
-	return (0);
-
-error:
-	ohci_lpc32xx_detach(self);
-	return (ENXIO);
-}
-
-static device_method_t ohci_methods [] = {
-	/* Device interface */
-	DEVMETHOD(device_probe, ohci_lpc32xx_probe),
-	DEVMETHOD(device_attach, ohci_lpc32xx_attach),
-	DEVMETHOD(device_detach, ohci_lpc32xx_detach),
-	DEVMETHOD(device_suspend, ohci_lpc32xx_suspend),
-	DEVMETHOD(device_resume, ohci_lpc32xx_resume),
-	DEVMETHOD(device_shutdown, bus_generic_shutdown),
-
-	/* Bus interface */
-	DEVMETHOD(bus_print_child, bus_generic_print_child),
-
-	{0, 0}
-};
-
-static driver_t ohci_driver = {
-	.name = "ohci",
-	.methods = ohci_methods,
-	.size = sizeof(struct ohci_softc)
-};
-
-static devclass_t ohci_devclass;
-
-DRIVER_MODULE(ohci, nexus, ohci_driver, ohci_devclass, 0, 0);
-MODULE_DEPEND(ohci, usb, 1, 1, 1);
-
-#endif /* LIBBSP_ARM_LPC3250_BSP_H */
Index: rtemsbsd/dev/usb/controller/ohci_lpc3250.c
===================================================================
--- rtemsbsd/dev/usb/controller/ohci_lpc3250.c	(revision 24600f22abda997e12dd3dc2ec54fde5fde2d789)
+++ rtemsbsd/dev/usb/controller/ohci_lpc3250.c	(revision 24600f22abda997e12dd3dc2ec54fde5fde2d789)
@@ -0,0 +1,361 @@
+#include <freebsd/machine/rtems-bsd-config.h>
+
+#include <freebsd/machine/rtems-bsd-config.h>
+
+#include <bsp.h>
+
+#ifdef LIBBSP_ARM_LPC3250_BSP_H
+
+#include <bsp/irq.h>
+
+#include <freebsd/sys/cdefs.h>
+#include <freebsd/sys/stdint.h>
+#include <freebsd/sys/stddef.h>
+#include <freebsd/sys/param.h>
+#include <freebsd/sys/queue.h>
+#include <freebsd/sys/types.h>
+#include <freebsd/sys/systm.h>
+#include <freebsd/sys/kernel.h>
+#include <freebsd/sys/bus.h>
+#include <freebsd/sys/linker_set.h>
+#include <freebsd/sys/module.h>
+#include <freebsd/sys/lock.h>
+#include <freebsd/sys/mutex.h>
+#include <freebsd/sys/condvar.h>
+#include <freebsd/sys/sysctl.h>
+#include <freebsd/sys/sx.h>
+#include <freebsd/sys/unistd.h>
+#include <freebsd/sys/callout.h>
+#include <freebsd/sys/malloc.h>
+#include <freebsd/sys/priv.h>
+
+#include <freebsd/dev/usb/usb.h>
+#include <freebsd/dev/usb/usbdi.h>
+
+#include <freebsd/dev/usb/usb_core.h>
+#include <freebsd/dev/usb/usb_busdma.h>
+#include <freebsd/dev/usb/usb_process.h>
+#include <freebsd/dev/usb/usb_util.h>
+
+#include <freebsd/dev/usb/usb_controller.h>
+#include <freebsd/dev/usb/usb_bus.h>
+#include <freebsd/dev/usb/controller/ohci.h>
+
+typedef struct
+{
+  uint16_t VendorID;
+  uint16_t ProductID;
+  uint16_t VersionID;
+} isp130x_PhyDetails_Typ;
+
+static void
+i2c_wait_for_receive_fifo_not_empty(void)
+{
+  while ((OTGI2CSTS & OTG_I2C_RFE) != 0) {
+		/* Wait */
+	}
+}
+
+static uint8_t
+isp1301_read(uint8_t reg)
+{
+  OTGI2CCTL = OTG_I2C_RESET;
+
+  OTGI2CTX = ISP1301_I2C_ADDR | OTG_I2C_START;
+
+  OTGI2CTX = reg;
+
+  OTGI2CTX = ISP1301_I2C_ADDR | OTG_I2C_READ | OTG_I2C_START;
+
+  OTGI2CTX = OTG_I2C_STOP;
+
+	i2c_wait_for_receive_fifo_not_empty();
+
+  return (uint8_t) OTGI2CRX;
+}
+
+static void
+i2c_wait_for_transaction_done(void)
+{
+  while ((OTGI2CSTS & OTG_I2C_TDI) == 0) {
+		/* Wait */
+	}
+
+  OTGI2CSTS = OTG_I2C_TDI;
+}
+
+static void
+isp1301_write(uint8_t reg, uint8_t val)
+{
+
+  OTGI2CCTL = OTG_I2C_RESET;
+
+  OTGI2CTX = ISP1301_I2C_ADDR | OTG_I2C_START;
+
+  OTGI2CTX = reg;
+
+  OTGI2CTX = val | OTG_I2C_STOP;
+
+	i2c_wait_for_transaction_done();
+}
+
+static void
+isp1301_dump(void)
+{
+	BSD_PRINTF(
+		"ISP1301: mc1 %02x, mc2 %02x, otgctrl %02x, otgsts %02x, isrc %02x, iltch %02x, ienl %02x, ienh %02x\n",
+		isp1301_read(ISP1301_MODE_CONTROL_1),
+		isp1301_read(ISP1301_MODE_CONTROL_2),
+    isp1301_read(ISP1301_OTG_CONTROL_1),
+		isp1301_read(ISP1301_OTG_STATUS),
+    isp1301_read(ISP1301_I2C_INTERRUPT_SOURCE),
+    isp1301_read(ISP1301_I2C_INTERRUPT_LATCH),
+    isp1301_read(ISP1301_I2C_INTERRUPT_FALLING),
+    isp1301_read(ISP1301_I2C_INTERRUPT_RISING)
+	);
+}
+
+
+static isp130x_PhyDetails_Typ
+ isp130x_GetPhyDetails(void)
+{
+  isp130x_PhyDetails_Typ PhyDetails;
+
+  PhyDetails.VendorID  = (uint16_t)((isp1301_read(ISP1301_I2C_VENDOR_ID_HIGH) << 8) |
+                                     isp1301_read(ISP1301_I2C_VENDOR_ID_LOW));
+
+  PhyDetails.ProductID = (uint16_t)((isp1301_read(ISP1301_I2C_PRODUCT_ID_HIGH) << 8) |
+                                     isp1301_read(ISP1301_I2C_PRODUCT_ID_LOW));
+
+  PhyDetails.VersionID = (uint16_t)((isp1301_read(ISP1301_I2C_VERSION_ID_HIGH) << 8) |
+                                     isp1301_read(ISP1301_I2C_VERSION_ID_LOW));
+
+  return PhyDetails;
+}
+
+
+static void
+isp1301_configure(void)
+{
+    isp130x_PhyDetails_Typ PhyDetails = isp130x_GetPhyDetails();
+
+    BSD_PRINTF("ISP130x: vendor 0x%04x, product 0x%04x, version 0x%04x\n",
+               PhyDetails.VendorID,
+               PhyDetails.ProductID,
+               PhyDetails.VersionID);
+
+	isp1301_write(ISP1301_MODE_CONTROL_1_CLEAR, 0xff);
+  isp1301_write(ISP1301_MODE_CONTROL_1_SET, MC1_SPEED_REG);
+	isp1301_write(ISP1301_MODE_CONTROL_2_CLEAR, 0xff);
+
+    switch (PhyDetails.ProductID)
+    {
+      case ISP1301_PRODUCT_ID:
+        isp1301_write(ISP1301_MODE_CONTROL_2_SET, MC2_BI_DI |
+                                                  MC2_PSW_EN |
+                                                  MC2_SPD_SUSP_CTRL);
+        break;
+
+      case ISP1302_PRODUCT_ID:
+        // Do not set 'SPD_SUSP_CTRL' bit as per ISP1301 this bit is reserved in
+        // ISP1302, setting it will cause problems.
+        isp1301_write(ISP1301_MODE_CONTROL_2_SET, MC2_BI_DI |
+                                                  MC2_PSW_EN);
+
+        // ISP1302 has an additonal register we should initialise it..
+        isp1301_write(ISP1302_MISC_CONTROL_CLEAR, 0xff);
+        isp1301_write(ISP1302_MISC_CONTROL_SET, MISC_UART_2V8_EN);
+
+        break;
+
+      default:
+        break;
+    }
+
+    isp1301_write(ISP1301_OTG_CONTROL_CLEAR, 0xff);
+  isp1301_write(ISP1301_MODE_CONTROL_1_SET, MC1_DAT_SE0);
+  isp1301_write(ISP1301_OTG_CONTROL_SET, OTG1_DM_PULLDOWN | OTG1_DP_PULLDOWN);
+  isp1301_write(ISP1301_I2C_INTERRUPT_LATCH_CLEAR, 0xff);
+  isp1301_write(ISP1301_I2C_INTERRUPT_FALLING_CLEAR, 0xff);
+  isp1301_write(ISP1301_I2C_INTERRUPT_RISING_CLEAR, 0xff);
+}
+
+static void
+isp1301_vbus_on(void)
+{
+  isp1301_write(ISP1301_OTG_CONTROL_SET, OTG1_VBUS_DRV);
+}
+
+static int
+ohci_lpc32xx_suspend(device_t self)
+{
+	ohci_softc_t *e = device_get_softc(self);
+	int eno = bus_generic_suspend(self);
+
+	if (eno != 0) {
+		return (eno);
+	}
+
+	ohci_suspend(e);
+
+	return (0);
+}
+
+static int
+ohci_lpc32xx_resume(device_t self)
+{
+	ohci_softc_t *e = device_get_softc(self);
+
+	ohci_resume(e);
+
+	bus_generic_resume(self);
+
+	return (0);
+}
+
+
+static int
+ohci_lpc32xx_probe(device_t self)
+{
+  device_set_desc(self, "LPC3250 OHCI controller");
+
+	return (0);
+}
+
+static int
+ohci_lpc32xx_detach(device_t self)
+{
+	ohci_softc_t *e = device_get_softc(self);
+
+	BSD_PRINTF("FIXME\n");
+
+	return (0);
+}
+
+static int
+ohci_lpc32xx_attach(device_t self)
+{
+	rtems_status_code sc = RTEMS_SUCCESSFUL;
+	ohci_softc_t *e = device_get_softc(self);
+	usb_error_t ue = USB_ERR_NORMAL_COMPLETION;
+	int eno = 0;
+
+	memset(e, 0, sizeof(*e));
+
+	/* Initialize some bus fields */
+	e->sc_bus.parent = self;
+	e->sc_bus.devices = e->sc_devices;
+	e->sc_bus.devices_max = OHCI_MAX_DEVICES;
+
+	/* Get all DMA memory */
+	if (usb_bus_mem_alloc_all(&e->sc_bus, USB_GET_DMA_TAG(self), &ohci_iterate_hw_softc)) {
+		return (ENOMEM);
+	}
+	e->sc_dev = self;
+
+	/* Child device */
+	e->sc_bus.bdev = device_add_child(self, "usbus", -1);
+	if (e->sc_bus.bdev == NULL) {
+		device_printf(self, "Could not add USB device\n");
+		goto error;
+	}
+	device_set_ivars(e->sc_bus.bdev, &e->sc_bus);
+  device_set_desc(e->sc_bus.bdev, "LPC3250 OHCI bus");
+	snprintf(e->sc_vendor, sizeof(e->sc_vendor), "NXP");
+
+	/* Register space */
+	e->sc_io_tag = 0U;
+  e->sc_io_hdl = OTGUSB_BASE;
+	e->sc_io_size = 0x5cU;
+
+	/* Enable USB PLL */
+  USBDIVCTRL = 0xc;
+  USBCTRL = USBCLK_SLAVE_HCLK_EN
+    | USBCLK_PC_BUS_KEEPER
+    | USBCLK_CLKEN1
+    | USBCLK_POWER_UP
+    | USBCLK_P_2
+    | USBCLK_N_1
+    | (191U << USBCLK_M_SHIFT);
+  while ((USBCTRL & USBCLK_PLL_LOCK) == 0) {
+		/* Wait */
+	}
+  USBCTRL |= USBCLK_CLKEN2;
+
+	/* Enable USB host and AHB clocks */
+  OTGCLKCTRL = 0x1c;
+  while ((OTGCLKSTAT & 0x1c) != 0x1c) {
+		/* Wait */
+	}
+
+	isp1301_configure();
+
+  USBCTRL |= USBCLK_HOST_NEED_CLK_EN;
+
+  OTGCLKCTRL = 0x1d;
+  while ((OTGCLKSTAT & 0x1d) != 0x1d) {
+		/* Wait */
+	}
+
+	/* Set OTG Status and Control Register */
+  OTGSTAT = 0x1;
+
+	isp1301_vbus_on();
+
+	/* Install interrupt handler */
+	sc = rtems_interrupt_server_handler_install(
+		RTEMS_ID_NONE,
+    IRQ_USB_HOST,
+		"USB",
+		RTEMS_INTERRUPT_UNIQUE,
+		(rtems_interrupt_handler) ohci_interrupt,
+		e
+	);
+	BSD_ASSERT_SC(sc);
+
+	/* OHCI intitialization */
+	ue = ohci_init(e);
+	if (ue != USB_ERR_NORMAL_COMPLETION) {
+		goto error;
+	}
+
+	/* Probe and attach child */
+	eno = device_probe_and_attach(e->sc_bus.bdev);
+	if (eno != 0) {
+		goto error;
+	}
+
+	return (0);
+
+error:
+	ohci_lpc32xx_detach(self);
+	return (ENXIO);
+}
+
+static device_method_t ohci_methods [] = {
+	/* Device interface */
+	DEVMETHOD(device_probe, ohci_lpc32xx_probe),
+	DEVMETHOD(device_attach, ohci_lpc32xx_attach),
+	DEVMETHOD(device_detach, ohci_lpc32xx_detach),
+	DEVMETHOD(device_suspend, ohci_lpc32xx_suspend),
+	DEVMETHOD(device_resume, ohci_lpc32xx_resume),
+	DEVMETHOD(device_shutdown, bus_generic_shutdown),
+
+	/* Bus interface */
+	DEVMETHOD(bus_print_child, bus_generic_print_child),
+
+	{0, 0}
+};
+
+static driver_t ohci_driver = {
+	.name = "ohci",
+	.methods = ohci_methods,
+	.size = sizeof(struct ohci_softc)
+};
+
+static devclass_t ohci_devclass;
+
+DRIVER_MODULE(ohci, nexus, ohci_driver, ohci_devclass, 0, 0);
+MODULE_DEPEND(ohci, usb, 1, 1, 1);
+
+#endif /* LIBBSP_ARM_LPC3250_BSP_H */
Index: rtemsbsd/freebsd/local/pmap.h
===================================================================
--- rtemsbsd/freebsd/local/pmap.h	(revision 24600f22abda997e12dd3dc2ec54fde5fde2d789)
+++ rtemsbsd/freebsd/local/pmap.h	(revision 24600f22abda997e12dd3dc2ec54fde5fde2d789)
@@ -0,0 +1,29 @@
+/**
+ * @file
+ *
+ * @ingroup rtems_bsd_machine
+ *
+ * @brief TODO.
+ */
+
+/*
+ * Copyright (c) 2009, 2010 embedded brains GmbH.  All rights reserved.
+ *
+ *  embedded brains GmbH
+ *  Obere Lagerstr. 30
+ *  82178 Puchheim
+ *  Germany
+ *  <rtems@embedded-brains.de>
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.com/license/LICENSE.
+ */
+
+#ifndef _RTEMS_BSD_MACHINE_PMAP_H
+#define _RTEMS_BSD_MACHINE_PMAP_H
+
+struct  md_page {
+};
+
+#endif /* !_RTEMS_BSD_MACHINE_PMAP_H */
Index: emsbsd/local/pmap.h
===================================================================
--- rtemsbsd/local/pmap.h	(revision 1e8830f013665a356aabf353d3ca84e9f94ff7f1)
+++ 	(revision )
@@ -1,29 +1,0 @@
-/**
- * @file
- *
- * @ingroup rtems_bsd_machine
- *
- * @brief TODO.
- */
-
-/*
- * Copyright (c) 2009, 2010 embedded brains GmbH.  All rights reserved.
- *
- *  embedded brains GmbH
- *  Obere Lagerstr. 30
- *  82178 Puchheim
- *  Germany
- *  <rtems@embedded-brains.de>
- *
- * The license and distribution terms for this file may be
- * found in the file LICENSE in this distribution or at
- * http://www.rtems.com/license/LICENSE.
- */
-
-#ifndef _RTEMS_BSD_MACHINE_PMAP_H
-#define _RTEMS_BSD_MACHINE_PMAP_H
-
-struct  md_page {
-};
-
-#endif /* !_RTEMS_BSD_MACHINE_PMAP_H */
