2017-12-01 07:56:08

by Chi-Hsien Lin

[permalink] [raw]
Subject: [PATCH] brcmfmac: Add sg parameters dts parsing

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 <[email protected]>
---
drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)

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))
--
2.1.0


2017-12-02 14:45:19

by Kalle Valo

[permalink] [raw]
Subject: Re: [PATCH] brcmfmac: Add sg parameters dts parsing

Arend van Spriel <[email protected]> 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.

--
Kalle Valo

2017-12-01 08:38:36

by Arend Van Spriel

[permalink] [raw]
Subject: Re: [PATCH] brcmfmac: Add sg parameters dts parsing

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