summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEvan Lojewski <github@meklort.com>2020-11-28 09:39:47 -0700
committerGitHub <noreply@github.com>2020-11-28 09:39:47 -0700
commit957d84dad2862e489c07db175ef9cbd468bc7d77 (patch)
treeee2663d91b2c6743bb1bac9ce3467bc3056d232d
parenta028c7834b501b3fdbd4f69e30d57b946e673bf4 (diff)
downloadbcm5719-ortega-957d84dad2862e489c07db175ef9cbd468bc7d77.tar.gz
bcm5719-ortega-957d84dad2862e489c07db175ef9cbd468bc7d77.zip
stage1: Ensure the link does not drop on driver load/unload. (#186)
-rw-r--r--stage1/init_hw.c23
1 files changed, 20 insertions, 3 deletions
diff --git a/stage1/init_hw.c b/stage1/init_hw.c
index 40328fa..1788fbb 100644
--- a/stage1/init_hw.c
+++ b/stage1/init_hw.c
@@ -328,13 +328,29 @@ void init_pci(volatile DEVICE_t *device, const NVRAMContents_t *nvram)
// RegDEVICEPciClassCodeRevision_t partially from REG_CHIP_ID
}
-void init_gen(const NVRAMContents_t *nvram)
+void init_gen(volatile DEVICE_t *device, const NVRAMContents_t *nvram)
{
- int function = DEVICE.Status.bits.FunctionNumber;
+ int function = device->Status.bits.FunctionNumber;
+ RegGENGenCfg_t cfg;
+
uint32_t cfg_feature;
uint32_t cfg_hw;
uint32_t cfg_hw2;
+ cfg.r32 = 0; // Talos II has 0x2a0194
+ cfg.bits.LEDMode = GEN_GEN_CFG_LED_MODE_PHY_1;
+ cfg.bits.ASFEnable = 1;
+ cfg.bits.APEEnable = 1;
+
+ if (MII_getPhy(device) >= DEVICE_MII_COMMUNICATION_PHY_ADDRESS_SGMII_0)
+ {
+ cfg.bits.PHYType = GEN_GEN_CFG_PHY_TYPE_FIBER;
+ }
+ else
+ {
+ cfg.bits.PHYType = GEN_GEN_CFG_PHY_TYPE_COPPER;
+ }
+
switch (function)
{
default:
@@ -363,6 +379,7 @@ void init_gen(const NVRAMContents_t *nvram)
break;
}
+ GEN.GenCfg.r32 = cfg.r32;
GEN.GenCfgFeature.r32 = cfg_feature;
GEN.GenCfgHw.r32 = cfg_hw;
GEN.GenCfgHw2.r32 = cfg_hw2;
@@ -386,7 +403,7 @@ void load_nvm_config(volatile DEVICE_t *device, const NVRAMContents_t *nvram)
// REG_PCI_SUBSYSTEM_ID, vendor, class, rev
init_pci(device, nvram);
- init_gen(nvram);
+ init_gen(device, nvram);
}
void init_hw(volatile DEVICE_t *device)
OpenPOWER on IntegriCloud