summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEvan Lojewski <github@meklort.com>2020-12-13 12:02:36 -0700
committerGitHub <noreply@github.com>2020-12-13 12:02:36 -0700
commit0a181e22a50bbfd8200109b5d85a0010971c69ea (patch)
tree8f6b171db9fd3d7565bb0f986101fcbea38c101d
parent987ba8bdfce8e1ecc90f5bfb692e36d11a65a6ee (diff)
downloadbcm5719-ortega-0a181e22a50bbfd8200109b5d85a0010971c69ea.tar.gz
bcm5719-ortega-0a181e22a50bbfd8200109b5d85a0010971c69ea.zip
mii: Add Auto-Power Down register as defined in the tg3 driver. (#190)
-rw-r--r--ipxact/bcm5719.xml36
-rw-r--r--libs/MII/include/bcm5719_MII.h100
-rw-r--r--libs/bcm5719/bcm5719_sym.s2
-rw-r--r--simulator/bcm5719_MII.cpp4
-rw-r--r--simulator/bcm5719_MII_sim.cpp11
5 files changed, 149 insertions, 4 deletions
diff --git a/ipxact/bcm5719.xml b/ipxact/bcm5719.xml
index 5cb2b1c..4315328 100644
--- a/ipxact/bcm5719.xml
+++ b/ipxact/bcm5719.xml
@@ -3181,6 +3181,42 @@
</ipxact:field>
</ipxact:register>
<ipxact:register>
+ <ipxact:name>Auto Power Down</ipxact:name>
+ <ipxact:description>Note: Shadow Register Selector: a</ipxact:description>
+ <ipxact:addressOffset>0xa1c</ipxact:addressOffset>
+ <!-- LINK: registerDefinitionGroup: see 6.11.3, Register definition group -->
+ <ipxact:size>16</ipxact:size>
+ <ipxact:volatile>true</ipxact:volatile>
+ <ipxact:field>
+ <ipxact:name>Wakeup Time 84ms</ipxact:name>
+ <ipxact:description></ipxact:description>
+ <ipxact:bitOffset>0</ipxact:bitOffset>
+ <ipxact:bitWidth>1</ipxact:bitWidth>
+ <ipxact:access>read-write</ipxact:access>
+ </ipxact:field>
+ <ipxact:field>
+ <ipxact:name>Enable</ipxact:name>
+ <ipxact:description></ipxact:description>
+ <ipxact:bitOffset>5</ipxact:bitOffset>
+ <ipxact:bitWidth>1</ipxact:bitWidth>
+ <ipxact:access>read-write</ipxact:access>
+ </ipxact:field>
+ <ipxact:field>
+ <ipxact:name>Shadow Register Selector</ipxact:name>
+ <ipxact:description>Writes to the selected shadow register are done by first setting up the register. Reads can be done immediately after selecting the shadow register.</ipxact:description>
+ <ipxact:bitOffset>10</ipxact:bitOffset>
+ <ipxact:bitWidth>5</ipxact:bitWidth>
+ <ipxact:access>read-write</ipxact:access>
+ </ipxact:field>
+ <ipxact:field>
+ <ipxact:name>Write Enable</ipxact:name>
+ <ipxact:description>Write bits [9:0]</ipxact:description>
+ <ipxact:bitOffset>15</ipxact:bitOffset>
+ <ipxact:bitWidth>1</ipxact:bitWidth>
+ <ipxact:access>read-write</ipxact:access>
+ </ipxact:field>
+ </ipxact:register>
+ <ipxact:register>
<ipxact:name>Test 1</ipxact:name>
<ipxact:description></ipxact:description>
<ipxact:addressOffset>0x1e</ipxact:addressOffset>
diff --git a/libs/MII/include/bcm5719_MII.h b/libs/MII/include/bcm5719_MII.h
index b1f7ea6..81a8bb8 100644
--- a/libs/MII/include/bcm5719_MII.h
+++ b/libs/MII/include/bcm5719_MII.h
@@ -4211,6 +4211,88 @@ typedef register_container RegMIIMiscellaneousControl_t {
#endif /* CXX_SIMULATOR */
} RegMIIMiscellaneousControl_t;
+#define REG_MII_AUTO_POWER_DOWN ((volatile BCM5719_MII_H_uint16_t*)0xa1c) /* Note: Shadow Register Selector: a */
+#define MII_AUTO_POWER_DOWN_WAKEUP_TIME_84MS_SHIFT 0u
+#define MII_AUTO_POWER_DOWN_WAKEUP_TIME_84MS_MASK 0x1u
+#define GET_MII_AUTO_POWER_DOWN_WAKEUP_TIME_84MS(__reg__) (((__reg__) & 0x1) >> 0u)
+#define SET_MII_AUTO_POWER_DOWN_WAKEUP_TIME_84MS(__val__) (((__val__) << 0u) & 0x1u)
+#define MII_AUTO_POWER_DOWN_ENABLE_SHIFT 5u
+#define MII_AUTO_POWER_DOWN_ENABLE_MASK 0x20u
+#define GET_MII_AUTO_POWER_DOWN_ENABLE(__reg__) (((__reg__) & 0x20) >> 5u)
+#define SET_MII_AUTO_POWER_DOWN_ENABLE(__val__) (((__val__) << 5u) & 0x20u)
+#define MII_AUTO_POWER_DOWN_SHADOW_REGISTER_SELECTOR_SHIFT 10u
+#define MII_AUTO_POWER_DOWN_SHADOW_REGISTER_SELECTOR_MASK 0x7c00u
+#define GET_MII_AUTO_POWER_DOWN_SHADOW_REGISTER_SELECTOR(__reg__) (((__reg__) & 0x7c00) >> 10u)
+#define SET_MII_AUTO_POWER_DOWN_SHADOW_REGISTER_SELECTOR(__val__) (((__val__) << 10u) & 0x7c00u)
+#define MII_AUTO_POWER_DOWN_WRITE_ENABLE_SHIFT 15u
+#define MII_AUTO_POWER_DOWN_WRITE_ENABLE_MASK 0x8000u
+#define GET_MII_AUTO_POWER_DOWN_WRITE_ENABLE(__reg__) (((__reg__) & 0x8000) >> 15u)
+#define SET_MII_AUTO_POWER_DOWN_WRITE_ENABLE(__val__) (((__val__) << 15u) & 0x8000u)
+
+/** @brief Register definition for @ref MII_t.AutoPowerDown. */
+typedef register_container RegMIIAutoPowerDown_t {
+ /** @brief 16bit direct register access. */
+ BCM5719_MII_H_uint16_t r16;
+
+ BITFIELD_BEGIN(BCM5719_MII_H_uint16_t, bits)
+#if defined(__LITTLE_ENDIAN__)
+ /** @brief */
+ BITFIELD_MEMBER(BCM5719_MII_H_uint16_t, WakeupTime84ms, 0, 1)
+ /** @brief Padding */
+ BITFIELD_MEMBER(BCM5719_MII_H_uint16_t, reserved_4_1, 1, 4)
+ /** @brief */
+ BITFIELD_MEMBER(BCM5719_MII_H_uint16_t, Enable, 5, 1)
+ /** @brief Padding */
+ BITFIELD_MEMBER(BCM5719_MII_H_uint16_t, reserved_9_6, 6, 4)
+ /** @brief Writes to the selected shadow register are done by first setting up the register. Reads can be done immediately after selecting the shadow register. */
+ BITFIELD_MEMBER(BCM5719_MII_H_uint16_t, ShadowRegisterSelector, 10, 5)
+ /** @brief Write bits [9:0] */
+ BITFIELD_MEMBER(BCM5719_MII_H_uint16_t, WriteEnable, 15, 1)
+#elif defined(__BIG_ENDIAN__)
+ /** @brief Write bits [9:0] */
+ BITFIELD_MEMBER(BCM5719_MII_H_uint16_t, WriteEnable, 15, 1)
+ /** @brief Writes to the selected shadow register are done by first setting up the register. Reads can be done immediately after selecting the shadow register. */
+ BITFIELD_MEMBER(BCM5719_MII_H_uint16_t, ShadowRegisterSelector, 10, 5)
+ /** @brief Padding */
+ BITFIELD_MEMBER(BCM5719_MII_H_uint16_t, reserved_9_6, 6, 4)
+ /** @brief */
+ BITFIELD_MEMBER(BCM5719_MII_H_uint16_t, Enable, 5, 1)
+ /** @brief Padding */
+ BITFIELD_MEMBER(BCM5719_MII_H_uint16_t, reserved_4_1, 1, 4)
+ /** @brief */
+ BITFIELD_MEMBER(BCM5719_MII_H_uint16_t, WakeupTime84ms, 0, 1)
+#else
+#error Unknown Endian
+#endif
+ BITFIELD_END(BCM5719_MII_H_uint16_t, bits)
+#ifdef CXX_SIMULATOR
+ /** @brief Register name for use with the simulator. */
+ const char* getName(void) { return "AutoPowerDown"; }
+
+ /** @brief Print register value. */
+ void print(void) { r16.print(); }
+
+ RegMIIAutoPowerDown_t()
+ {
+ /** @brief constructor for @ref MII_t.AutoPowerDown. */
+ r16.setName("AutoPowerDown");
+ bits.WakeupTime84ms.setBaseRegister(&r16);
+ bits.WakeupTime84ms.setName("WakeupTime84ms");
+ bits.Enable.setBaseRegister(&r16);
+ bits.Enable.setName("Enable");
+ bits.ShadowRegisterSelector.setBaseRegister(&r16);
+ bits.ShadowRegisterSelector.setName("ShadowRegisterSelector");
+ bits.WriteEnable.setBaseRegister(&r16);
+ bits.WriteEnable.setName("WriteEnable");
+ }
+ RegMIIAutoPowerDown_t& operator=(const RegMIIAutoPowerDown_t& other)
+ {
+ r16 = other.r16;
+ return *this;
+ }
+#endif /* CXX_SIMULATOR */
+} RegMIIAutoPowerDown_t;
+
/** @brief Component definition for @ref MII. */
typedef struct MII_t {
/** @brief */
@@ -4363,6 +4445,12 @@ typedef struct MII_t {
/** @brief Note: Shadow Register Selector: 7 */
RegMIIMiscellaneousControl_t MiscellaneousControl;
+ /** @brief Reserved bytes to pad out data structure. */
+ BCM5719_MII_H_uint16_t reserved_1817[771];
+
+ /** @brief Note: Shadow Register Selector: a */
+ RegMIIAutoPowerDown_t AutoPowerDown;
+
#ifdef CXX_SIMULATOR
typedef uint32_t (*callback_t)(uint32_t, uint32_t, void*);
callback_t mIndexReadCallback;
@@ -4459,6 +4547,11 @@ typedef struct MII_t {
reserved_1309[i].setComponentOffset(0x51d + (i * 2));
}
MiscellaneousControl.r16.setComponentOffset(0x718);
+ for(int i = 0; i < 771; i++)
+ {
+ reserved_1817[i].setComponentOffset(0x719 + (i * 2));
+ }
+ AutoPowerDown.r16.setComponentOffset(0xa1c);
}
void print()
{
@@ -4548,6 +4641,11 @@ typedef struct MII_t {
reserved_1309[i].print();
}
MiscellaneousControl.print();
+ for(int i = 0; i < 771; i++)
+ {
+ reserved_1817[i].print();
+ }
+ AutoPowerDown.print();
}
uint32_t read(int offset) { return mIndexReadCallback(0, offset, mIndexReadCallbackArgs); }
void write(int offset, uint32_t value) { (void)mIndexWriteCallback(value, offset, mIndexWriteCallbackArgs); }
@@ -4569,7 +4667,7 @@ extern volatile MII_t MII;
#undef BITFIELD_END
#ifndef CXX_SIMULATOR
-_Static_assert(sizeof(MII_t) == 3636, "sizeof(MII_t) must be 3636");
+_Static_assert(sizeof(MII_t) == 5180, "sizeof(MII_t) must be 5180");
#endif
#endif /* !BCM5719_MII_H */
diff --git a/libs/bcm5719/bcm5719_sym.s b/libs/bcm5719/bcm5719_sym.s
index 3371f9a..af99284 100644
--- a/libs/bcm5719/bcm5719_sym.s
+++ b/libs/bcm5719/bcm5719_sym.s
@@ -100,6 +100,6 @@
.global MII
.equ MII, 0x0
-.size MII, 0x71a
+.size MII, 0xa1e
diff --git a/simulator/bcm5719_MII.cpp b/simulator/bcm5719_MII.cpp
index a072f9c..db769bf 100644
--- a/simulator/bcm5719_MII.cpp
+++ b/simulator/bcm5719_MII.cpp
@@ -10,7 +10,7 @@
///
////////////////////////////////////////////////////////////////////////////////
///
-/// @copyright Copyright (c) 2018, Evan Lojewski
+/// @copyright Copyright (c) 2020, Evan Lojewski
/// @cond
///
/// All rights reserved.
@@ -125,5 +125,7 @@ void init_bcm5719_MII(void)
/** @brief Bitmap for @ref MII_t.MiscellaneousControl. */
+ /** @brief Bitmap for @ref MII_t.AutoPowerDown. */
+
}
diff --git a/simulator/bcm5719_MII_sim.cpp b/simulator/bcm5719_MII_sim.cpp
index 3d92349..912e2c4 100644
--- a/simulator/bcm5719_MII_sim.cpp
+++ b/simulator/bcm5719_MII_sim.cpp
@@ -10,7 +10,7 @@
///
////////////////////////////////////////////////////////////////////////////////
///
-/// @copyright Copyright (c) 2018, Evan Lojewski
+/// @copyright Copyright (c) 2020, Evan Lojewski
/// @cond
///
/// All rights reserved.
@@ -293,5 +293,14 @@ void init_bcm5719_MII_sim(void *base)
MII.MiscellaneousControl.r16.installReadCallback(read_from_ram, (uint8_t *)base);
MII.MiscellaneousControl.r16.installWriteCallback(write_to_ram, (uint8_t *)base);
+ for(int i = 0; i < 771; i++)
+ {
+ MII.reserved_1817[i].installReadCallback(read_from_ram, (uint8_t *)base);
+ MII.reserved_1817[i].installWriteCallback(write_to_ram, (uint8_t *)base);
+ }
+ /** @brief Bitmap for @ref MII_t.AutoPowerDown. */
+ MII.AutoPowerDown.r16.installReadCallback(read_from_ram, (uint8_t *)base);
+ MII.AutoPowerDown.r16.installWriteCallback(write_to_ram, (uint8_t *)base);
+
}
OpenPOWER on IntegriCloud