X-Git-Url: https://jxself.org/git/?a=blobdiff_plain;ds=sidebyside;f=ath9k_htc%2Ftarget_firmware%2Fmagpie_fw_dev%2Ftarget%2Fwlan%2Fwlan_pci.c;h=4bf63e3837ef8c2e7acb3c5afcb8369fb36c2bec;hb=1ba1a88647bfe113c885f985d6e383790dec2a1f;hp=d8db1e4ca30a42ce74b90ad9fc0e744e46fb71b4;hpb=6e823d0b6ee854eaf5f0bf28a099a5e6b7c45be2;p=linux-libre-firmware.git diff --git a/ath9k_htc/target_firmware/magpie_fw_dev/target/wlan/wlan_pci.c b/ath9k_htc/target_firmware/magpie_fw_dev/target/wlan/wlan_pci.c index d8db1e4..4bf63e3 100755 --- a/ath9k_htc/target_firmware/magpie_fw_dev/target/wlan/wlan_pci.c +++ b/ath9k_htc/target_firmware/magpie_fw_dev/target/wlan/wlan_pci.c @@ -47,7 +47,7 @@ A_PCI_INIT_FUNC g_pci_init_func; #define EMULATE_PCI_CONFIG #endif -#define PCI_CONFIG_BASE_ADDR 0x14000000 +#define PCI_CONFIG_BASE_ADDR 0x14000000 extern A_PCI_INIT_FUNC g_pci_init_func; adf_drv_info_t* g_wlan_drv = NULL; @@ -67,13 +67,13 @@ void wlan_pci_register_drv(adf_drv_info_t *drv) } #define ATHEROS_VENDOR_ID 0x168c -#define AR5416_DEVID_PCIE 0x24 +#define AR5416_DEVID_PCIE 0x24 void wlan_pci_probe(void) { __adf_softc_t *sc; adf_os_resource_t drv_res = {0}; - adf_os_attach_data_t drv_data = {{0}}; + adf_os_attach_data_t drv_data = {{0}}; int vendor_id; int device_id; @@ -82,17 +82,17 @@ void wlan_pci_probe(void) #if MAGPIE_ENABLE_PCIE == 0 vendor_id = ATHEROS_VENDOR_ID; device_id = AR5416_DEVID_PCIE; -#else +#else vendor_id = wlan_pci_config_read(0, 2); device_id = wlan_pci_config_read(2, 2); -#endif - A_PRINTF(": Vendor id 0x%x Dev id 0x%x\n", vendor_id, device_id); - +#endif + A_PRINTF(": Vendor id 0x%x Dev id 0x%x\n", vendor_id, device_id); + if (vendor_id != ATHEROS_VENDOR_ID) { - A_PRINTF(": Atheros card not found\n"); + A_PRINTF(": Atheros card not found\n"); return; } - + /** * Allocate the sc & zero down */ @@ -101,60 +101,60 @@ void wlan_pci_probe(void) A_PRINTF("Cannot malloc softc\n"); goto mem_fail; } - -#define AR5416_DEVID_PCIE 0x24 + +#define AR5416_DEVID_PCIE 0x24 drv_data.pci.device = AR5416_DEVID_PCIE; drv_data.pci.vendor = 0x168c; drv_data.pci.subvendor = 0; drv_data.pci.subdevice = 0; - + drv_res.start = (a_uint32_t) 0; drv_res.end = 0; drv_res.type = ADF_OS_RESOURCE_TYPE_MEM; - + g_wlan_drv_handle = g_wlan_drv->drv_attach(&drv_res, 1, &drv_data, NULL); - + return; mem_fail: - return; + return; } int wlan_pci_config_write(int offset, a_uint32_t val, int width) { -#if MAGPIE_ENABLE_PCIE == 1 +#if MAGPIE_ENABLE_PCIE == 1 unsigned long addr = ( PCI_CONFIG_BASE_ADDR + offset ) & 0xfffffffc; - A_UINT8 *ptr = (A_UINT8 *)addr; - A_UINT8 *valptr = (A_UINT8 *)&val; + A_UINT8 *ptr = (A_UINT8 *)addr; + A_UINT8 *valptr = (A_UINT8 *)&val; int idx = offset & 0x3; int i; - + for (i = 0; i < width; i++) { ptr[idx + i] = valptr[3-i]; - } + } #endif - - return 0; + + return 0; } int wlan_pci_config_read(int offset, int width) { -#if MAGPIE_ENABLE_PCIE == 0 - return 0; +#if MAGPIE_ENABLE_PCIE == 0 + return 0; #else unsigned long addr = ( PCI_CONFIG_BASE_ADDR + offset ) & 0xfffffffc; unsigned long value = *((unsigned long *)addr); - A_UINT8 *ptr = (A_UINT8 *)&value; + A_UINT8 *ptr = (A_UINT8 *)&value; int idx = offset & 0x3; int result = 0; int i; - + for (i = 0; i < width; i++) { result |= (ptr[ 3 - (idx + i)] << (8*i)); - } - - return result; -#endif + } + + return result; +#endif } void wlan_pci_isr()