From e3e12f52b214121840b44c91de5b3e5af5d3eb84 Mon Sep 17 00:00:00 2001 From: hc <hc@nodka.com> Date: Mon, 06 Nov 2023 03:04:41 +0000 Subject: [PATCH] rk3568 rt init --- kernel/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_pcie.c | 43 ++++++++++++++++++++++++++++++++++++++----- 1 files changed, 38 insertions(+), 5 deletions(-) diff --git a/kernel/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_pcie.c b/kernel/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_pcie.c index 96bc798..5c10144 100644 --- a/kernel/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_pcie.c +++ b/kernel/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_pcie.c @@ -3557,17 +3557,28 @@ void dhd_set_bus_params(struct dhd_bus *bus) { - if (bus->dhd->conf->dhd_poll >= 0) { - bus->poll = bus->dhd->conf->dhd_poll; + struct dhd_conf *conf = bus->dhd->conf; + + if (conf->dhd_poll >= 0) { + bus->poll = conf->dhd_poll; if (!bus->pollrate) bus->pollrate = 1; - printf("%s: set polling mode %d\n", __FUNCTION__, bus->dhd->conf->dhd_poll); + printf("%s: set polling mode %d\n", __FUNCTION__, conf->dhd_poll); } - if (bus->dhd->conf->d2h_intr_control >= 0) - bus->d2h_intr_control = bus->dhd->conf->d2h_intr_control; + if (conf->d2h_intr_control >= 0) + bus->d2h_intr_control = conf->d2h_intr_control; printf("d2h_intr_method -> %s(%d); d2h_intr_control -> %s(%d)\n", bus->d2h_intr_method ? "PCIE_MSI" : "PCIE_INTX", bus->d2h_intr_method, bus->d2h_intr_control ? "HOST_IRQ" : "D2H_INTMASK", bus->d2h_intr_control); + + if (conf->aspm != -1) { + bool aspm = conf->aspm ? TRUE : FALSE; + dhd_bus_aspm_enable_rc_ep(bus, aspm); + } + if (conf->l1ss != -1) { + bool l1ss = conf->l1ss ? TRUE : FALSE; + dhd_bus_l1ss_enable_rc_ep(bus, l1ss); + } } /** @@ -17803,3 +17814,25 @@ val = 1; dhd_sbreg_op(dhd, addr, &val, FALSE); } + +#define BUS_SLEEP_WAIT_CNT 3 +#define BUS_SLEEP_WAIT_MS 20 +int +dhd_bus_sleep(dhd_pub_t *dhdp, bool sleep, uint32 *intstatus) +{ + dhd_bus_t *bus = dhdp->bus; + int active, cnt = 0; + + if (bus) { + while ((active = dhd_os_check_wakelock_all(bus->dhd)) && + (cnt < BUS_SLEEP_WAIT_CNT)) { + OSL_SLEEP(BUS_SLEEP_WAIT_MS); + cnt++; + } + } else { + DHD_ERROR(("bus is NULL\n")); + active = -1; + } + + return active; +} -- Gitblit v1.6.2