summaryrefslogtreecommitdiffstats
path: root/sys/arm/allwinner/a10_sramc.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/arm/allwinner/a10_sramc.c')
-rw-r--r--sys/arm/allwinner/a10_sramc.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/sys/arm/allwinner/a10_sramc.c b/sys/arm/allwinner/a10_sramc.c
index a26afbb..22ba1f7 100644
--- a/sys/arm/allwinner/a10_sramc.c
+++ b/sys/arm/allwinner/a10_sramc.c
@@ -52,6 +52,7 @@ __FBSDID("$FreeBSD$");
#include "a10_sramc.h"
#define SRAM_CTL1_CFG 0x04
+#define CTL1_CFG_SRAMD_MAP_USB0 (1 << 0)
struct a10_sramc_softc {
struct resource *res;
@@ -71,7 +72,7 @@ static int
a10_sramc_probe(device_t dev)
{
- if (ofw_bus_is_compatible(dev, "allwinner,sun4i-sramc")) {
+ if (ofw_bus_is_compatible(dev, "allwinner,sun4i-a10-sram-controller")) {
device_set_desc(dev, "Allwinner sramc module");
return (BUS_PROBE_DEFAULT);
}
@@ -113,7 +114,8 @@ static driver_t a10_sramc_driver = {
static devclass_t a10_sramc_devclass;
-DRIVER_MODULE(a10_sramc, simplebus, a10_sramc_driver, a10_sramc_devclass, 0, 0);
+EARLY_DRIVER_MODULE(a10_sramc, simplebus, a10_sramc_driver, a10_sramc_devclass,
+ 0, 0, BUS_PASS_RESOURCE + BUS_PASS_ORDER_EARLY);
int
a10_map_to_emac(void)
@@ -131,3 +133,20 @@ a10_map_to_emac(void)
return (0);
}
+
+int
+a10_map_to_otg(void)
+{
+ struct a10_sramc_softc *sc = a10_sramc_sc;
+ uint32_t reg_value;
+
+ if (sc == NULL)
+ return (ENXIO);
+
+ /* Map SRAM to OTG */
+ reg_value = sramc_read_4(sc, SRAM_CTL1_CFG);
+ reg_value |= CTL1_CFG_SRAMD_MAP_USB0;
+ sramc_write_4(sc, SRAM_CTL1_CFG, reg_value);
+
+ return (0);
+}
OpenPOWER on IntegriCloud