diff mbox

brcmfmac: Add sg parameters dts parsing

Message ID 20171201075542.GA31376@aremote07.aus.cypress.com (mailing list archive)
State Changes Requested
Delegated to: Kalle Valo
Headers show

Commit Message

Chi-Hsien Lin Dec. 1, 2017, 7:55 a.m. UTC
broken_sg_support, sd_head_align, and sd_sgentry_align are used in
brcmfmac code but not configurable in dts file. Add the parsing logic.
Now they can be configured like below in dts:
	brcm,broken_sg_support;
	brcm,sd_head_align = /bits/ 16 <4>;
	brcm,sd_sgentry_align = /bits/ 16 <4>;

Signed-off-by: Chi-hsien Lin <chi-hsien.lin@cypress.com>
---
 drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

Comments

Arend van Spriel Dec. 1, 2017, 8:38 a.m. UTC | #1
On 12/1/2017 8:55 AM, Chi-Hsien Lin wrote:
> broken_sg_support, sd_head_align, and sd_sgentry_align are used in
> brcmfmac code but not configurable in dts file. Add the parsing logic.
> Now they can be configured like below in dts:
> 	brcm,broken_sg_support;
> 	brcm,sd_head_align =/bits/  16 <4>;
> 	brcm,sd_sgentry_align =/bits/  16 <4>;

Hi Chi-Hsien,

For device tree support you should submit a separate commit on the dt 
binding specification. For broadcom fullmac chipsets binding spec can be 
found in 
Documentation/devicetree/bindings/net/wireless/brcm,bcm43xx-fmac.txt.

The alignment properties are to be specified in bytes, not bits.

Regards,
Arend
Kalle Valo Dec. 2, 2017, 2:45 p.m. UTC | #2
Arend van Spriel <arend.vanspriel@broadcom.com> writes:

> On 12/1/2017 8:55 AM, Chi-Hsien Lin wrote:
>> broken_sg_support, sd_head_align, and sd_sgentry_align are used in
>> brcmfmac code but not configurable in dts file. Add the parsing logic.
>> Now they can be configured like below in dts:
>> 	brcm,broken_sg_support;
>> 	brcm,sd_head_align =/bits/  16 <4>;
>> 	brcm,sd_sgentry_align =/bits/  16 <4>;
>
> Hi Chi-Hsien,
>
> For device tree support you should submit a separate commit on the dt
> binding specification. For broadcom fullmac chipsets binding spec can
> be found in
> Documentation/devicetree/bindings/net/wireless/brcm,bcm43xx-fmac.txt.

And remember to CC the device tree mailing list. I need an ack from the
DT maintainers before I can apply the patch.
diff mbox

Patch

diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c
index aee6e59..023f8ea 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c
@@ -30,14 +30,22 @@  void brcmf_of_probe(struct device *dev, enum brcmf_bus_type bus_type,
 	struct device_node *np = dev->of_node;
 	int irq;
 	u32 irqf;
-	u32 val;
+	u32 val32;
+	u16 val16;
 
 	if (!np || bus_type != BRCMF_BUSTYPE_SDIO ||
 	    !of_device_is_compatible(np, "brcm,bcm4329-fmac"))
 		return;
 
-	if (of_property_read_u32(np, "brcm,drive-strength", &val) == 0)
-		sdio->drive_strength = val;
+	if (of_property_read_u32(np, "brcm,drive-strength", &val32) == 0)
+		sdio->drive_strength = val32;
+
+	sdio->broken_sg_support = of_property_read_bool(np,
+							"brcm,broken_sg_support");
+	if (of_property_read_u16(np, "brcm,sd_head_align", &val16) == 0)
+		sdio->sd_head_align = val16;
+	if (of_property_read_u16(np, "brcm,sd_sgentry_align", &val16) == 0)
+		sdio->sd_sgentry_align = val16;
 
 	/* make sure there are interrupts defined in the node */
 	if (!of_find_property(np, "interrupts", NULL))