[rtems-libbsd commit] Port am335x usb driver to RTEMS.
Sebastian Huber
sebh at rtems.org
Thu Jul 13 05:31:44 UTC 2017
Module: rtems-libbsd
Branch: master
Commit: 9121570cf2ffc84cdd3051728ad9e68ec9cb5e05
Changeset: http://git.rtems.org/rtems-libbsd/commit/?id=9121570cf2ffc84cdd3051728ad9e68ec9cb5e05
Author: Sichen Zhao <1473996754 at qq.com>
Date: Thu Jul 13 10:24:05 2017 +0800
Port am335x usb driver to RTEMS.
Add FDT and umass support for am335x USB driver.
Now RTEMS can mount and open USB disk.
---
freebsd/sys/arm/ti/am335x/am335x_prcm.c | 2 ++
freebsd/sys/arm/ti/ti_cpuid.h | 19 +++++++++++++
libbsd.py | 34 +++++++++++++++++++++++
libbsd_waf.py | 6 ++++
rtemsbsd/include/bsp/nexus-devices.h | 14 ++++++++++
rtemsbsd/include/machine/intr.h | 0
rtemsbsd/include/rtems/bsd/local/fdt_pinctrl_if.h | 0
7 files changed, 75 insertions(+)
diff --git a/freebsd/sys/arm/ti/am335x/am335x_prcm.c b/freebsd/sys/arm/ti/am335x/am335x_prcm.c
index 1d10f7f..a05647d 100644
--- a/freebsd/sys/arm/ti/am335x/am335x_prcm.c
+++ b/freebsd/sys/arm/ti/am335x/am335x_prcm.c
@@ -438,7 +438,9 @@ am335x_prcm_attach(device_t dev)
sc->bsh = rman_get_bushandle(sc->res[0]);
am335x_prcm_sc = sc;
+#ifndef __rtems__
ti_cpu_reset = am335x_prcm_reset;
+#endif /* __rtems__ */
if (am335x_clk_get_sysclk_freq(NULL, &sysclk) != 0)
sysclk = 0;
diff --git a/freebsd/sys/arm/ti/ti_cpuid.h b/freebsd/sys/arm/ti/ti_cpuid.h
index 715f080..213714b 100644
--- a/freebsd/sys/arm/ti/ti_cpuid.h
+++ b/freebsd/sys/arm/ti/ti_cpuid.h
@@ -29,6 +29,9 @@
#ifndef _TI_CPUID_H_
#define _TI_CPUID_H_
+#ifdef __rtems__
+#include <bsp.h>
+#endif /* __rtems__ */
#define OMAP_MAKEREV(d, a, b, c) \
(uint32_t)(((d) << 16) | (((a) & 0xf) << 8) | (((b) & 0xf) << 4) | ((c) & 0xf))
@@ -70,7 +73,23 @@
#define CHIP_OMAP_4 0
#define CHIP_AM335X 1
+#ifdef __rtems__
+#ifdef IS_AM335X
+#define SOC_TI_AM335X
+#else
+#warning Unknown SOC.
+#endif
+
+#if defined(SOC_TI_AM335X)
+#define _ti_chip CHIP_AM335X
+#elif defined(SOC_OMAP4)
+#define _ti_chip CHIP_OMAP_4
+#else
+#define _ti_chip -1
+#endif
+#else /* __rtems__ */
extern int _ti_chip;
+#endif /* __rtems__ */
static __inline int ti_chip(void)
{
diff --git a/libbsd.py b/libbsd.py
index e171a9d..18dfe8a 100644
--- a/libbsd.py
+++ b/libbsd.py
@@ -890,6 +890,39 @@ def dev_usb_storage_add_on(mm):
return mod
#
+# BBB USB
+#
+def dev_usb_controller_bbb(mm):
+ mod = builder.Module('dev_usb_controller_bbb')
+ mod.addDependency(mm['dev_usb'])
+ mod.addKernelSpaceHeaderFiles(
+ [
+ 'sys/arm/ti/ti_cpuid.h',
+ 'sys/arm/ti/ti_prcm.h',
+ 'sys/arm/ti/ti_scm.h',
+ 'sys/arm/ti/tivar.h',
+ 'sys/arm/ti/am335x/am335x_scm.h',
+ 'sys/dev/usb/controller/musb_otg.h',
+ 'sys/sys/timeet.h',
+ 'sys/sys/watchdog.h',
+ 'sys/dev/fdt/fdt_pinctrl.h',
+
+ ]
+ )
+ mod.addKernelSpaceSourceFiles(
+ [
+ 'sys/arm/ti/ti_scm.c',
+ 'sys/arm/ti/am335x/am335x_prcm.c',
+ 'sys/arm/ti/am335x/am335x_usbss.c',
+ 'sys/arm/ti/ti_prcm.c',
+ 'sys/arm/ti/am335x/am335x_musb.c',
+ 'sys/dev/usb/controller/musb_otg.c',
+ ],
+ mm.generator['source']()
+ )
+ return mod
+
+#
# USB Template
#
def dev_usb_template(mm):
@@ -3195,6 +3228,7 @@ def sources(mm):
mm.addModule(cam(mm))
mm.addModule(dev_usb_storage(mm))
#mm.addModule(dev_usb_storage_add_on(mm))
+ mm.addModule(dev_usb_controller_bbb(mm))
#mm.addModule(dev_usb_template(mm))
diff --git a/libbsd_waf.py b/libbsd_waf.py
index 30765de..5d0d5d0 100644
--- a/libbsd_waf.py
+++ b/libbsd_waf.py
@@ -731,6 +731,11 @@ def build(bld):
source = ['freebsd/sys/arm/lpc/if_lpe.c',
'freebsd/sys/arm/lpc/lpc_pwr.c',
+ 'freebsd/sys/arm/ti/am335x/am335x_musb.c',
+ 'freebsd/sys/arm/ti/am335x/am335x_prcm.c',
+ 'freebsd/sys/arm/ti/am335x/am335x_usbss.c',
+ 'freebsd/sys/arm/ti/ti_prcm.c',
+ 'freebsd/sys/arm/ti/ti_scm.c',
'freebsd/sys/arm/xilinx/zy7_slcr.c',
'freebsd/sys/cam/cam.c',
'freebsd/sys/cam/scsi/scsi_all.c',
@@ -896,6 +901,7 @@ def build(bld):
'freebsd/sys/dev/tsec/if_tsec_fdt.c',
'freebsd/sys/dev/usb/controller/dwc_otg.c',
'freebsd/sys/dev/usb/controller/ehci.c',
+ 'freebsd/sys/dev/usb/controller/musb_otg.c',
'freebsd/sys/dev/usb/controller/ohci.c',
'freebsd/sys/dev/usb/controller/usb_controller.c',
'freebsd/sys/dev/usb/input/atp.c',
diff --git a/rtemsbsd/include/bsp/nexus-devices.h b/rtemsbsd/include/bsp/nexus-devices.h
index 1fbf756..09a4cc3 100644
--- a/rtemsbsd/include/bsp/nexus-devices.h
+++ b/rtemsbsd/include/bsp/nexus-devices.h
@@ -46,6 +46,20 @@
RTEMS_BSD_DRIVER_SMC0(0x4e000000, RVPBXA9_IRQ_ETHERNET);
+#elif defined(LIBBSP_ARM_BEAGLE_BSP_H)
+
+#include <bsp/irq.h>
+
+RTEMS_BSD_DEFINE_NEXUS_DEVICE(ofwbus, 0, 0, NULL);
+SYSINIT_DRIVER_REFERENCE(simplebus, ofwbus);
+SYSINIT_DRIVER_REFERENCE(ti_scm, simplebus);
+SYSINIT_DRIVER_REFERENCE(am335x_prcm, simplebus);
+SYSINIT_DRIVER_REFERENCE(usbss, simplebus);
+SYSINIT_DRIVER_REFERENCE(musbotg, usbss);
+
+RTEMS_BSD_DRIVER_USB;
+RTEMS_BSD_DRIVER_USB_MASS;
+
#elif defined(LIBBSP_ARM_LPC32XX_BSP_H)
#include <bsp/irq.h>
diff --git a/rtemsbsd/include/machine/intr.h b/rtemsbsd/include/machine/intr.h
new file mode 100644
index 0000000..e69de29
diff --git a/rtemsbsd/include/rtems/bsd/local/fdt_pinctrl_if.h b/rtemsbsd/include/rtems/bsd/local/fdt_pinctrl_if.h
new file mode 100644
index 0000000..e69de29
More information about the vc
mailing list