Heinz wrote:Hi.
I tested some commands on uboot. Whel run command ledtest i can power on all leds (include WiFi leds)
When I press WiFi button then can wifi led power on/off, wps button turn on/off wps led, reset button turn on/off power led, led button turn on/off all leds.
I find in GPL tarball Archer_C2600_v1_GPL\openwrt\qca\src\u-boot\drivers\pci\pci-ipq.c
[...]int ipq_pcie_led_init(void)
{
int i = 0;
void* iobase = 0;
pci_dev_t devno = -1;
pcie_params_t *cfg;
for (i = 0; i < PCI_MAX_DEVICES; i++) {
cfg = &gboard_param->pcie_cfg[i];
if (cfg->linkup) {
pci_hose_scan(&pci_hose[i]);
}
}
for (i = 0; i < PCI_MAX_DEVICES; i ++) {
devno = pci_find_device(PCI_VENDOR_ID_ATHEROS, ATH_PCIE_BEELINER, i);
if (devno != -1) {
iobase = pci_map_bar(devno, PCI_BASE_ADDRESS_0, PCI_REGION_MEM);
writel(readl(iobase + 0x85000) | (1<<ATH_BEELINER_LED), iobase + 0x85000);
writel(readl(iobase + 0x85018) | (1<<ATH_BEELINER_LED), iobase + 0x85018);
}
}
return 0;
}
int ipq_pcie_led_out_one(int on, int id)
{
void* iobase = 0;
pci_dev_t devno = -1;
devno = pci_find_device(PCI_VENDOR_ID_ATHEROS, ATH_PCIE_BEELINER, id);
if (devno != -1) {
iobase = pci_map_bar(devno, PCI_BASE_ADDRESS_0, PCI_REGION_MEM);
if (on) {
writel(readl(iobase + 0x85000) & (~(1<<ATH_BEELINER_LED)), iobase + 0x85000);
} else {
writel(readl(iobase + 0x85000) | (1<<ATH_BEELINER_LED), iobase + 0x85000);
}
}
return 0;
}
int ipq_pcie_led_out(int on)
{
int i = 0;
void* iobase = 0;
pci_dev_t devno = -1;
for (i = 0; i < PCI_MAX_DEVICES; i ++) {
devno = pci_find_device(PCI_VENDOR_ID_ATHEROS, ATH_PCIE_BEELINER, i);
if (devno != -1) {
iobase = pci_map_bar(devno, PCI_BASE_ADDRESS_0, PCI_REGION_MEM);
if (on) {
writel(readl(iobase + 0x85000) & (~(1<<ATH_BEELINER_LED)), iobase + 0x85000);
} else {
writel(readl(iobase + 0x85000) | (1<<ATH_BEELINER_LED), iobase + 0x85000);
}
}
}
return 0;
}[...]
This look like wifi leds is on address 0x85000 on each wireless PCI card.
Maybe is possible to add this address to ath10k driver?
Great find. I hacked the ath10k driver in the kernel to do the exact same thing (Just a proof of concept, I only tested the code on a v1.1 C2600 I recently got, so play with it at your own risk...):
diff --git a/drivers/net/wireless/ath/ath10k/pci.c b/drivers/net/wireless/ath/ath10k/pci.c
index 6094372307aa..93b5a6480dfb 100644
--- a/drivers/net/wireless/ath/ath10k/pci.c
+++ b/drivers/net/wireless/ath/ath10k/pci.c
@@ -50,6 +50,7 @@ MODULE_PARM_DESC(reset_mode, "0: auto, 1: warm only (default: 0)");
/* how long wait to wait for target to initialise, in ms */
#define ATH10K_PCI_TARGET_WAIT 3000
#define ATH10K_PCI_NUM_WARM_RESET_ATTEMPTS 3
+#define ATH_BEELINER_LED 17
static const struct pci_device_id ath10k_pci_id_table[] = {
{ PCI_VDEVICE(ATHEROS, QCA988X_2_0_DEVICE_ID) }, /* PCI-E QCA988X V2 */
@@ -2537,6 +2538,11 @@ static int ath10k_pci_hif_power_up(struct ath10k *ar)
ath10k_err(ar, "could not wake up target CPU: %d\n", ret);
goto err_ce;
}
+ if (ar->hw_rev == ATH10K_HW_QCA99X0) {
+ ath10k_pci_write32(ar, 0x85000, ath10k_pci_read32(ar, 0x85000) | (1<<ATH_BEELINER_LED));
+ ath10k_pci_write32(ar, 0x85018, ath10k_pci_read32(ar, 0x85018) | (1<<ATH_BEELINER_LED));
+ ath10k_pci_write32(ar, 0x85000, ath10k_pci_read32(ar, 0x85000) & (~(1<<ATH_BEELINER_LED)));
+ }
return 0;
And the wireless leds light up after flush the new firmware. It does not blink though, and I am not sure if it suppose to.