added driver framework to prepare for driver unification, fixed USB driver, added...
[rpi-open-firmware.git] / arm_loader.cc
index e3281c8..552e693 100644 (file)
@@ -18,7 +18,7 @@ ARM initialization stuff.
 =============================================================================*/\r
 \r
 #include <lib/runtime.h>\r
-#include "hardware.h"\r
+#include <drivers/BCM2708PowerManagement.hpp>\r
 \r
 #define logf(fmt, ...) printf("[ARMLDR:%s]: " fmt, __FUNCTION__, ##__VA_ARGS__);\r
 \r
@@ -44,72 +44,14 @@ extern uint8_t L_arm_code_end;
 /* XXX: What is this? */\r
 #define PM_UNK_CFG_CLR 0xFFFCFFFF\r
 \r
-static bool power_wait_bit(uint32_t bit) {\r
-       for (int i = 0; i < 20; i++) {\r
-               if (PM_PROC & bit) {\r
-                       return true;\r
-               }\r
-               udelay(100);\r
-       }\r
-       return false;\r
-}\r
-\r
 static inline void assert_global_reset() {\r
-       logf("RSTN ...\n");\r
-       PM_PROC |= PM_PASSWORD | PM_PROC_ARMRSTN_SET;\r
-       udelay(300);\r
+       PowerManagementDomain::getDeviceForDomain(kCprPowerDomainARM)->setReset();\r
 }\r
 \r
 static void enable_power() {\r
-       uint32_t pmv;\r
-\r
-       logf("INIT PM_PROC: 0x%X\n", PM_PROC);\r
-\r
-       logf("requesting power up ...\n");\r
-\r
-       /* deassert all reset lines */\r
-       pmv = ((PM_PROC & PM_PROC_ARMRSTN_CLR) & PM_UNK_CFG_CLR) | PM_PASSWORD;\r
-\r
-       PM_PROC = pmv;\r
-\r
-       pmv |= PM_PROC_POWUP_SET;\r
-       udelay(10);\r
-       PM_PROC = pmv;\r
-\r
-       logf("POWUP PM_PROC: 0x%X\n", PM_PROC);\r
-\r
-       /* wait for POWOK */\r
-       logf("waiting for power up ...\n");\r
-       for (int i = 1; i < 5; i++) {\r
-               if (!power_wait_bit(PM_PROC_POWOK_SET)) {\r
-                       /* only go up to 3 */\r
-                       if (i == 4) {\r
-                               panic("timed out waiting for power up, state of PM_PROC is: 0x%X", PM_PROC);\r
-                       }\r
-\r
-                       pmv = (pmv & PM_UNK_CFG_CLR) | (i << PM_PROC_CFG_LSB);\r
-                       logf("timed out, trying different CFG: 0x%X \n", pmv);\r
-                       PM_PROC = pmv;\r
-               }\r
-       }\r
-\r
-       pmv |= PM_PROC_ISPOW_SET;\r
-       PM_PROC = pmv;\r
-\r
-       pmv |= PM_PROC_MEMREP_SET;\r
-       PM_PROC = pmv;\r
-\r
-       logf("waiting for MRDONE ...\n");\r
-       if (!power_wait_bit(PM_PROC_MRDONE_SET)) {\r
-               panic("timed out waiting for MRDONE, state of PM_PROC is: 0x%X", PM_PROC);\r
-       }\r
-\r
-       logf("setting ISFUNC ...\n");\r
-\r
-       pmv |= PM_PROC_ISFUNC_SET;\r
-       PM_PROC = pmv;\r
-\r
-       logf("ARM power domain initialized succesfully, state of PM_PROC is: 0x%X!\n", PM_PROC);\r
+       PowerManagementDomain* armPm = PowerManagementDomain::getDeviceForDomain(kCprPowerDomainARM);\r
+       assert(armPm);\r
+       armPm->start();\r
 }\r
 \r
 static void bresp_cycle_write(uint32_t bits) {\r
This page took 0.025521 seconds and 4 git commands to generate.