Skip to content

Commit 0b523ce

Browse files
Raja Manikvalo
authored andcommitted
ath10k: add basic skeleton to support ahb
qca4019 uses ahb instead of pci where it slightly differs in device enumeration, clock control, reset control, etc. Good thing is that ahb also uses copy engine for the data transaction. So, the most of the stuff implemented in pci.c/ce.c are reusable in ahb case too. Device enumeration in ahb case comes through platform driver/device model. All resource details like irq, memory map, clocks, etc for qca4019 can be fetched from of_node of platform device. Simply flow would look like, device tree => platform device (kernel) => platform driver (ath10k) Device tree entry will have all qca4019 resource details and the same info will be passed to kernel. Kernel will prepare new platform device for that entry and expose DT info to of_node in platform device. Later, ath10k would register platform driver with unique compatible name and then kernels binds to corresponding compatible entry & calls ath10k ahb probe functions. From there onwards, ath10k will take control of it and move forward. New bool flag CONFIG_ATH10K_AHB is added in Kconfig to conditionally enable ahb support in ath10k. On enabling this flag, ath10k_pci.ko will have ahb support. This patch adds only basic skeleton and few macros to support ahb in the context of qca4019. Signed-off-by: Raja Mani <[email protected]> Signed-off-by: Kalle Valo <[email protected]>
1 parent 90188f8 commit 0b523ce

File tree

9 files changed

+131
-0
lines changed

9 files changed

+131
-0
lines changed

drivers/net/wireless/ath/ath10k/Kconfig

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@ config ATH10K_PCI
1515
---help---
1616
This module adds support for PCIE bus
1717

18+
config ATH10K_AHB
19+
bool "Atheros ath10k AHB support"
20+
depends on ATH10K_PCI && OF
21+
---help---
22+
This module adds support for AHB bus
23+
1824
config ATH10K_DEBUG
1925
bool "Atheros ath10k debugging"
2026
depends on ATH10K

drivers/net/wireless/ath/ath10k/Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,7 @@ obj-$(CONFIG_ATH10K_PCI) += ath10k_pci.o
2525
ath10k_pci-y += pci.o \
2626
ce.o
2727

28+
ath10k_pci-$(CONFIG_ATH10K_AHB) += ahb.o
29+
2830
# for tracing framework to find trace.h
2931
CFLAGS_trace.o := -I$(src)

drivers/net/wireless/ath/ath10k/ahb.c

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
/*
2+
* Copyright (c) 2016 Qualcomm Atheros, Inc. All rights reserved.
3+
* Copyright (c) 2015 The Linux Foundation. All rights reserved.
4+
*
5+
* Permission to use, copy, modify, and/or distribute this software for any
6+
* purpose with or without fee is hereby granted, provided that the above
7+
* copyright notice and this permission notice appear in all copies.
8+
*
9+
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10+
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11+
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12+
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13+
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14+
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15+
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16+
*/
17+
#include <linux/module.h>
18+
#include "core.h"
19+
#include "debug.h"
20+
#include "ahb.h"
21+
22+
static const struct of_device_id ath10k_ahb_of_match[] = {
23+
/* TODO: enable this entry once everything in place.
24+
* { .compatible = "qcom,ipq4019-wifi",
25+
* .data = (void *)ATH10K_HW_QCA4019 },
26+
*/
27+
{ }
28+
};
29+
30+
MODULE_DEVICE_TABLE(of, ath10k_ahb_of_match);
31+
32+
static int ath10k_ahb_probe(struct platform_device *pdev)
33+
{
34+
return 0;
35+
}
36+
37+
static int ath10k_ahb_remove(struct platform_device *pdev)
38+
{
39+
return 0;
40+
}
41+
42+
static struct platform_driver ath10k_ahb_driver = {
43+
.driver = {
44+
.name = "ath10k_ahb",
45+
.of_match_table = ath10k_ahb_of_match,
46+
},
47+
.probe = ath10k_ahb_probe,
48+
.remove = ath10k_ahb_remove,
49+
};
50+
51+
int ath10k_ahb_init(void)
52+
{
53+
int ret;
54+
55+
printk(KERN_ERR "AHB support is still work in progress\n");
56+
57+
ret = platform_driver_register(&ath10k_ahb_driver);
58+
if (ret)
59+
printk(KERN_ERR "failed to register ath10k ahb driver: %d\n",
60+
ret);
61+
return ret;
62+
}
63+
64+
void ath10k_ahb_exit(void)
65+
{
66+
platform_driver_unregister(&ath10k_ahb_driver);
67+
}

drivers/net/wireless/ath/ath10k/ahb.h

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
/*
2+
* Copyright (c) 2016 Qualcomm Atheros, Inc. All rights reserved.
3+
* Copyright (c) 2015 The Linux Foundation. All rights reserved.
4+
*
5+
* Permission to use, copy, modify, and/or distribute this software for any
6+
* purpose with or without fee is hereby granted, provided that the above
7+
* copyright notice and this permission notice appear in all copies.
8+
*
9+
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10+
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11+
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12+
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13+
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14+
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15+
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16+
*/
17+
18+
#ifndef _AHB_H_
19+
#define _AHB_H_
20+
21+
#include <linux/platform_device.h>
22+
23+
#ifdef CONFIG_ATH10K_AHB
24+
25+
int ath10k_ahb_init(void);
26+
void ath10k_ahb_exit(void);
27+
28+
#else /* CONFIG_ATH10K_AHB */
29+
30+
static inline int ath10k_ahb_init(void)
31+
{
32+
return 0;
33+
}
34+
35+
static inline void ath10k_ahb_exit(void)
36+
{
37+
}
38+
39+
#endif /* CONFIG_ATH10K_AHB */
40+
41+
#endif /* _AHB_H_ */

drivers/net/wireless/ath/ath10k/core.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,16 @@ struct ath10k;
6969

7070
enum ath10k_bus {
7171
ATH10K_BUS_PCI,
72+
ATH10K_BUS_AHB,
7273
};
7374

7475
static inline const char *ath10k_bus_str(enum ath10k_bus bus)
7576
{
7677
switch (bus) {
7778
case ATH10K_BUS_PCI:
7879
return "pci";
80+
case ATH10K_BUS_AHB:
81+
return "ahb";
7982
}
8083

8184
return "unknown";

drivers/net/wireless/ath/ath10k/debug.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ enum ath10k_debug_mask {
3737
ATH10K_DBG_TESTMODE = 0x00001000,
3838
ATH10K_DBG_WMI_PRINT = 0x00002000,
3939
ATH10K_DBG_PCI_PS = 0x00004000,
40+
ATH10K_DBG_AHB = 0x00008000,
4041
ATH10K_DBG_ANY = 0xffffffff,
4142
};
4243

drivers/net/wireless/ath/ath10k/hw.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,7 @@ enum ath10k_hw_rev {
200200
ATH10K_HW_QCA6174,
201201
ATH10K_HW_QCA99X0,
202202
ATH10K_HW_QCA9377,
203+
ATH10K_HW_QCA4019,
203204
};
204205

205206
struct ath10k_hw_regs {
@@ -253,6 +254,7 @@ void ath10k_hw_fill_survey_time(struct ath10k *ar, struct survey_info *survey,
253254
#define QCA_REV_6174(ar) ((ar)->hw_rev == ATH10K_HW_QCA6174)
254255
#define QCA_REV_99X0(ar) ((ar)->hw_rev == ATH10K_HW_QCA99X0)
255256
#define QCA_REV_9377(ar) ((ar)->hw_rev == ATH10K_HW_QCA9377)
257+
#define QCA_REV_40XX(ar) ((ar)->hw_rev == ATH10K_HW_QCA4019)
256258

257259
/* Known pecularities:
258260
* - raw appears in nwifi decap, raw and nwifi appear in ethernet decap

drivers/net/wireless/ath/ath10k/pci.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -851,6 +851,7 @@ static u32 ath10k_pci_targ_cpu_to_ce_addr(struct ath10k *ar, u32 addr)
851851
0x7ff) << 21;
852852
break;
853853
case ATH10K_HW_QCA99X0:
854+
case ATH10K_HW_QCA4019:
854855
val = ath10k_pci_read32(ar, PCIE_BAR_REG_ADDRESS);
855856
break;
856857
}
@@ -1529,6 +1530,7 @@ static void ath10k_pci_irq_msi_fw_mask(struct ath10k *ar)
15291530
CORE_CTRL_ADDRESS, val);
15301531
break;
15311532
case ATH10K_HW_QCA99X0:
1533+
case ATH10K_HW_QCA4019:
15321534
/* TODO: Find appropriate register configuration for QCA99X0
15331535
* to mask irq/MSI.
15341536
*/
@@ -1551,6 +1553,7 @@ static void ath10k_pci_irq_msi_fw_unmask(struct ath10k *ar)
15511553
CORE_CTRL_ADDRESS, val);
15521554
break;
15531555
case ATH10K_HW_QCA99X0:
1556+
case ATH10K_HW_QCA4019:
15541557
/* TODO: Find appropriate register configuration for QCA99X0
15551558
* to unmask irq/MSI.
15561559
*/
@@ -3231,13 +3234,18 @@ static int __init ath10k_pci_init(void)
32313234
printk(KERN_ERR "failed to register ath10k pci driver: %d\n",
32323235
ret);
32333236

3237+
ret = ath10k_ahb_init();
3238+
if (ret)
3239+
printk(KERN_ERR "ahb init failed: %d\n", ret);
3240+
32343241
return ret;
32353242
}
32363243
module_init(ath10k_pci_init);
32373244

32383245
static void __exit ath10k_pci_exit(void)
32393246
{
32403247
pci_unregister_driver(&ath10k_pci_driver);
3248+
ath10k_ahb_exit();
32413249
}
32423250

32433251
module_exit(ath10k_pci_exit);

drivers/net/wireless/ath/ath10k/pci.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

2323
#include "hw.h"
2424
#include "ce.h"
25+
#include "ahb.h"
2526

2627
/*
2728
* maximum number of bytes that can be handled atomically by DiagRead/DiagWrite

0 commit comments

Comments
 (0)