clock-gate based power management now seems to be more or less working

This commit is contained in:
bunnie 2021-05-31 23:14:35 +08:00
parent d9e56fd321
commit 2f9fa57bdd
5 changed files with 22 additions and 18 deletions

View file

@ -3,7 +3,7 @@
<device schemaVersion="1.1" xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="CMSIS-SVD.xsd" > <device schemaVersion="1.1" xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="CMSIS-SVD.xsd" >
<vendor>litex</vendor> <vendor>litex</vendor>
<name>SOC</name> <name>SOC</name>
<description><![CDATA[Litex SoC 2021-05-31 04:52:07]]></description> <description><![CDATA[Litex SoC 2021-05-31 22:08:00]]></description>
<addressUnitBits>8</addressUnitBits> <addressUnitBits>8</addressUnitBits>
<width>32</width> <width>32</width>
@ -1185,10 +1185,10 @@ register to disable individual events.]]></description>
<register> <register>
<name>GIT_GITREV</name> <name>GIT_GITREV</name>
<description><![CDATA[First 32-bits of the git revision. This documentation was built from git rev <description><![CDATA[First 32-bits of the git revision. This documentation was built from git rev
``ed015a96``, so this value is 3976288918, which should be enough to check out ``84421c8b``, so this value is 2218925195, which should be enough to check out
the exact git version used to build this firmware.]]></description> the exact git version used to build this firmware.]]></description>
<addressOffset>0x0014</addressOffset> <addressOffset>0x0014</addressOffset>
<resetValue>0xed015a96</resetValue> <resetValue>0x84421c8b</resetValue>
<size>32</size> <size>32</size>
<fields> <fields>
<field> <field>
@ -1205,7 +1205,7 @@ the exact git version used to build this firmware.]]></description>
is ``1``, then the repository this was built from has one additional commit is ``1``, then the repository this was built from has one additional commit
beyond the tag indicated in `MAJOR`, `MINOR`, and `REVISION`.]]></description> beyond the tag indicated in `MAJOR`, `MINOR`, and `REVISION`.]]></description>
<addressOffset>0x0018</addressOffset> <addressOffset>0x0018</addressOffset>
<resetValue>0x19</resetValue> <resetValue>0x1b</resetValue>
<size>32</size> <size>32</size>
<fields> <fields>
<field> <field>
@ -3284,7 +3284,7 @@ inject too fast.]]></description>
<name>SEED1</name> <name>SEED1</name>
<description><![CDATA[Bits 32-63 of `SEED_SEED`. Seed used for the build]]></description> <description><![CDATA[Bits 32-63 of `SEED_SEED`. Seed used for the build]]></description>
<addressOffset>0x0000</addressOffset> <addressOffset>0x0000</addressOffset>
<resetValue>0x1980d59a</resetValue> <resetValue>0x4fe3a4bd</resetValue>
<size>32</size> <size>32</size>
<fields> <fields>
<field> <field>
@ -3299,7 +3299,7 @@ inject too fast.]]></description>
<name>SEED0</name> <name>SEED0</name>
<description><![CDATA[Bits 0-31 of `SEED_SEED`.]]></description> <description><![CDATA[Bits 0-31 of `SEED_SEED`.]]></description>
<addressOffset>0x0004</addressOffset> <addressOffset>0x0004</addressOffset>
<resetValue>0x3d397cb2</resetValue> <resetValue>0x7df06eb2</resetValue>
<size>32</size> <size>32</size>
<fields> <fields>
<field> <field>

View file

@ -60,9 +60,13 @@ pub fn idle() -> bool {
// Issue `wfi`. This will return as soon as an external interrupt // Issue `wfi`. This will return as soon as an external interrupt
// is available. // is available.
if false { if false {
// "traditional" path for stopping a clock
unsafe { riscv::asm::wfi() }; unsafe { riscv::asm::wfi() };
} else { } else {
// this invokes Precusor-SoC specific path to gate clocks:
// 1. ignore_locked prevents the chip from going into reset if the PLL goes unlocked
wfi_kernel_csr.wfo(utra::wfi::IGNORE_LOCKED_IGNORE_LOCKED, 1); wfi_kernel_csr.wfo(utra::wfi::IGNORE_LOCKED_IGNORE_LOCKED, 1);
// 2. wfi gates all the clocks (stops them) until a SoC-defined interrupt comes in
wfi_kernel_csr.wfo(utra::wfi::WFI_WFI, 1); wfi_kernel_csr.wfo(utra::wfi::WFI_WFI, 1);
} }

View file

@ -3,7 +3,7 @@
<device schemaVersion="1.1" xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="CMSIS-SVD.xsd" > <device schemaVersion="1.1" xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="CMSIS-SVD.xsd" >
<vendor>litex</vendor> <vendor>litex</vendor>
<name>SOC</name> <name>SOC</name>
<description><![CDATA[Litex SoC 2021-05-31 04:52:07]]></description> <description><![CDATA[Litex SoC 2021-05-31 22:08:00]]></description>
<addressUnitBits>8</addressUnitBits> <addressUnitBits>8</addressUnitBits>
<width>32</width> <width>32</width>
@ -1185,10 +1185,10 @@ register to disable individual events.]]></description>
<register> <register>
<name>GIT_GITREV</name> <name>GIT_GITREV</name>
<description><![CDATA[First 32-bits of the git revision. This documentation was built from git rev <description><![CDATA[First 32-bits of the git revision. This documentation was built from git rev
``ed015a96``, so this value is 3976288918, which should be enough to check out ``84421c8b``, so this value is 2218925195, which should be enough to check out
the exact git version used to build this firmware.]]></description> the exact git version used to build this firmware.]]></description>
<addressOffset>0x0014</addressOffset> <addressOffset>0x0014</addressOffset>
<resetValue>0xed015a96</resetValue> <resetValue>0x84421c8b</resetValue>
<size>32</size> <size>32</size>
<fields> <fields>
<field> <field>
@ -1205,7 +1205,7 @@ the exact git version used to build this firmware.]]></description>
is ``1``, then the repository this was built from has one additional commit is ``1``, then the repository this was built from has one additional commit
beyond the tag indicated in `MAJOR`, `MINOR`, and `REVISION`.]]></description> beyond the tag indicated in `MAJOR`, `MINOR`, and `REVISION`.]]></description>
<addressOffset>0x0018</addressOffset> <addressOffset>0x0018</addressOffset>
<resetValue>0x19</resetValue> <resetValue>0x1b</resetValue>
<size>32</size> <size>32</size>
<fields> <fields>
<field> <field>
@ -3284,7 +3284,7 @@ inject too fast.]]></description>
<name>SEED1</name> <name>SEED1</name>
<description><![CDATA[Bits 32-63 of `SEED_SEED`. Seed used for the build]]></description> <description><![CDATA[Bits 32-63 of `SEED_SEED`. Seed used for the build]]></description>
<addressOffset>0x0000</addressOffset> <addressOffset>0x0000</addressOffset>
<resetValue>0x1980d59a</resetValue> <resetValue>0x4fe3a4bd</resetValue>
<size>32</size> <size>32</size>
<fields> <fields>
<field> <field>
@ -3299,7 +3299,7 @@ inject too fast.]]></description>
<name>SEED0</name> <name>SEED0</name>
<description><![CDATA[Bits 0-31 of `SEED_SEED`.]]></description> <description><![CDATA[Bits 0-31 of `SEED_SEED`.]]></description>
<addressOffset>0x0004</addressOffset> <addressOffset>0x0004</addressOffset>
<resetValue>0x3d397cb2</resetValue> <resetValue>0x7df06eb2</resetValue>
<size>32</size> <size>32</size>
<fields> <fields>
<field> <field>

Binary file not shown.

View file

@ -3,7 +3,7 @@
<device schemaVersion="1.1" xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="CMSIS-SVD.xsd" > <device schemaVersion="1.1" xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="CMSIS-SVD.xsd" >
<vendor>litex</vendor> <vendor>litex</vendor>
<name>SOC</name> <name>SOC</name>
<description><![CDATA[Litex SoC 2021-05-31 04:52:07]]></description> <description><![CDATA[Litex SoC 2021-05-31 22:08:00]]></description>
<addressUnitBits>8</addressUnitBits> <addressUnitBits>8</addressUnitBits>
<width>32</width> <width>32</width>
@ -1185,10 +1185,10 @@ register to disable individual events.]]></description>
<register> <register>
<name>GIT_GITREV</name> <name>GIT_GITREV</name>
<description><![CDATA[First 32-bits of the git revision. This documentation was built from git rev <description><![CDATA[First 32-bits of the git revision. This documentation was built from git rev
``ed015a96``, so this value is 3976288918, which should be enough to check out ``84421c8b``, so this value is 2218925195, which should be enough to check out
the exact git version used to build this firmware.]]></description> the exact git version used to build this firmware.]]></description>
<addressOffset>0x0014</addressOffset> <addressOffset>0x0014</addressOffset>
<resetValue>0xed015a96</resetValue> <resetValue>0x84421c8b</resetValue>
<size>32</size> <size>32</size>
<fields> <fields>
<field> <field>
@ -1205,7 +1205,7 @@ the exact git version used to build this firmware.]]></description>
is ``1``, then the repository this was built from has one additional commit is ``1``, then the repository this was built from has one additional commit
beyond the tag indicated in `MAJOR`, `MINOR`, and `REVISION`.]]></description> beyond the tag indicated in `MAJOR`, `MINOR`, and `REVISION`.]]></description>
<addressOffset>0x0018</addressOffset> <addressOffset>0x0018</addressOffset>
<resetValue>0x19</resetValue> <resetValue>0x1b</resetValue>
<size>32</size> <size>32</size>
<fields> <fields>
<field> <field>
@ -3284,7 +3284,7 @@ inject too fast.]]></description>
<name>SEED1</name> <name>SEED1</name>
<description><![CDATA[Bits 32-63 of `SEED_SEED`. Seed used for the build]]></description> <description><![CDATA[Bits 32-63 of `SEED_SEED`. Seed used for the build]]></description>
<addressOffset>0x0000</addressOffset> <addressOffset>0x0000</addressOffset>
<resetValue>0x1980d59a</resetValue> <resetValue>0x4fe3a4bd</resetValue>
<size>32</size> <size>32</size>
<fields> <fields>
<field> <field>
@ -3299,7 +3299,7 @@ inject too fast.]]></description>
<name>SEED0</name> <name>SEED0</name>
<description><![CDATA[Bits 0-31 of `SEED_SEED`.]]></description> <description><![CDATA[Bits 0-31 of `SEED_SEED`.]]></description>
<addressOffset>0x0004</addressOffset> <addressOffset>0x0004</addressOffset>
<resetValue>0x3d397cb2</resetValue> <resetValue>0x7df06eb2</resetValue>
<size>32</size> <size>32</size>
<fields> <fields>
<field> <field>