mirror of
https://github.com/logicog/RTLPlayground.git
synced 2026-10-29 17:54:14 +08:00
desolve machine_init.c similar to what we did for machine.c
This commit is contained in:
1 parent
c9e8403c6e
commit
7673ef8322
20 files changed
+128
-109
No files matched your search
@@ -41,8 +41,8 @@ __code const struct machine machine = {
|
||||
* at 2.5G only) and LED-ID2 carries the SFP single LED. The "solid"
|
||||
* conditions (LINK/speed) barely drive the LEDs here and ACT is what
|
||||
* actually lights them, which is why the white LED used to glow faintly at
|
||||
* non-2.5G speeds; the fix for that is LED_GLB_IO_EN bit 6, set in
|
||||
* machine_init.c. */
|
||||
* non-2.5G speeds; the fix for that is LED_GLB_IO_EN bit 6, set in the
|
||||
* shared machine_custom_init() hook (machine/2G5F4_10G2_V1_01_init.c). */
|
||||
.led_sets = { { LEDS_2G5 | LEDS_1G | LEDS_100M | LEDS_10M | LEDS_LINK | LEDS_ACT | LEDS_10G,
|
||||
LEDS_2G5 | LEDS_LINK | LEDS_10G,
|
||||
LEDS_1G | LEDS_LINK,
|
||||
|
||||
Symlink
+1
@@ -0,0 +1 @@
|
||||
KP_9000_6XH_X2_init.c
|
||||
@@ -0,0 +1,6 @@
|
||||
#include "machine_init_defs.h"
|
||||
|
||||
void machine_custom_init(void) __banked
|
||||
{
|
||||
REG_SET(RTL837X_REG_LED_GLB_IO_EN, 0x7624155b);
|
||||
}
|
||||
Symlink
+1
@@ -0,0 +1 @@
|
||||
KP_9000_6XH_X2_init.c
|
||||
Symlink
+1
@@ -0,0 +1 @@
|
||||
KP_9000_6XH_X2_init.c
|
||||
+1
@@ -0,0 +1 @@
|
||||
KP_9000_6XH_X2_init.c
|
||||
+1
@@ -0,0 +1 @@
|
||||
KP_9000_6XH_X2_init.c
|
||||
@@ -0,0 +1,6 @@
|
||||
#include "machine_init_defs.h"
|
||||
|
||||
void machine_custom_init(void) __banked
|
||||
{
|
||||
reg_bit_set(RTL837X_REG_LED_GLB_IO_EN, 6);
|
||||
}
|
||||
Symlink
+1
@@ -0,0 +1 @@
|
||||
KP_9000_6XH_X2_init.c
|
||||
Symlink
+1
@@ -0,0 +1 @@
|
||||
KP_9000_6XH_X2_init.c
|
||||
@@ -0,0 +1,18 @@
|
||||
#include "machine_init_defs.h"
|
||||
|
||||
static __code const struct { uint16_t reg; uint32_t val; } custom_init_regs[] = {
|
||||
{ RTL837X_REG_LED3_0_SET1, 0x00100000UL },
|
||||
{ RTL837X_REG_LED1_0_SET1, 0x01400155UL },
|
||||
{ RTL837X_REG_LED1_0_SET0, 0x01740141UL },
|
||||
{ RTL837X_REG_LED_GLB_IO_EN, 0x7f24977fUL },
|
||||
{ RTL837X_PIN_MUX_0, 0x20db6880UL },
|
||||
};
|
||||
|
||||
void machine_custom_init(void) __banked
|
||||
{
|
||||
uint8_t i;
|
||||
// REG_SET is a multi-statement macro without a do-while wrapper: braces required
|
||||
for (i = 0; i < sizeof(custom_init_regs) / sizeof(custom_init_regs[0]); i++) {
|
||||
REG_SET(custom_init_regs[i].reg, custom_init_regs[i].val);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
#include "machine_init_defs.h"
|
||||
|
||||
void machine_custom_init(void) __banked
|
||||
{
|
||||
reg_bit_set(RTL837X_REG_LED_GLB_IO_EN, 6);
|
||||
reg_bit_set(RTL837X_REG_LED_MODE, 17);
|
||||
reg_bit_clear(RTL837X_REG_LED_MODE, 9);
|
||||
reg_bit_clear(RTL837X_REG_LED_MODE, 7);
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
SWTG024AS_V2_0_init.c
|
||||
@@ -0,0 +1,20 @@
|
||||
#include "machine_init_defs.h"
|
||||
|
||||
void machine_custom_init(void) __banked
|
||||
{
|
||||
uint16_t pval;
|
||||
|
||||
reg_bit_set(RTL837X_REG_LED_GLB_IO_EN, 6);
|
||||
reg_bit_set(RTL837X_REG_LED_MODE, 17);
|
||||
reg_bit_clear(RTL837X_REG_LED_MODE, 9);
|
||||
reg_bit_clear(RTL837X_REG_LED_MODE, 7);
|
||||
|
||||
// OEM firmware sets these companion SDS0 polarity bits for the RTL8221B.
|
||||
sds_read(0, 0, 0);
|
||||
pval = SFR_DATA_U16;
|
||||
sds_write_v(0, 0, 0, pval | 0x100);
|
||||
|
||||
sds_read(0, 6, 2);
|
||||
pval = SFR_DATA_U16;
|
||||
sds_write_v(0, 6, 2, pval | 0x4000);
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
#include "machine_init_defs.h"
|
||||
|
||||
void machine_custom_init(void) __banked
|
||||
{
|
||||
// For this device, the reset value of RTL837X_PIN_MUX_0 is 0x30000000,
|
||||
// which would disables all LEDS, enable them manually:
|
||||
REG_SET(RTL837X_PIN_MUX_0, 0x30db68bf);
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
/*
|
||||
* Fallback boot hook for boards without a machine/<MACHINE>_init.c.
|
||||
*/
|
||||
#include "machine_init_defs.h"
|
||||
|
||||
void machine_custom_init(void) __banked { }
|
||||
@@ -0,0 +1,10 @@
|
||||
#ifndef _MACHINE_INIT_DEFS_H_
|
||||
#define _MACHINE_INIT_DEFS_H_
|
||||
|
||||
|
||||
#include "machine_defs.h"
|
||||
|
||||
#pragma codeseg BANK2
|
||||
#pragma constseg BANK2
|
||||
|
||||
#endif
|
||||
Reference in new issue
Block a user