2013-03-26 12:01:34

by Arend van Spriel

[permalink] [raw]
Subject: Re: brcmsmac in kernel driver on a Samsung NC110

On 03/26/2013 12:43 PM, John Talbut wrote:
> On 26/03/13 11:29, Arend van Spriel wrote:
>> On 03/26/2013 12:13 PM, John Talbut wrote:
>>>
>>> On 26/03/13 10:53, Arend van Spriel wrote:
>>>> On 03/26/2013 11:34 AM, John Talbut wrote:
>>>>> Kernel log attached.
>>>>>
>>>>
>>>> Now this is weird. I do not see any BCMA log messages. Can you give
>>>> output of following command:
>>>>
>>>> $ lspci -n -s 1:0.0
>>>
>>> 01:00.0 0280: 14e4:4357 (rev 01)
>>
>> Ok, no problem there.
>>
>> digging further in sysfs. Can you execute the following commands:
>>
>> if it exists:
>> $ ls /sys/bus/bcma
>> $ ls /sys/bus/bcma/devices
>> $ ls /sys/bus/bcma/drivers
>>
>> if it exists also following:
>> $ ls -l /sys/bus/bcma/drivers/brcmsmac
>
> root@johnwtnc110:/usr/src/linux-source-3.8# ls /sys/bus/bcma
> devices drivers drivers_autoprobe drivers_probe uevent
> root@johnwtnc110:/usr/src/linux-source-3.8# ls /sys/bus/bcma/devices

The fact that there are no devices detected under bcma is suspicious.
Adding bcma developer to the list. Maybe he knows about issues when
having bcma compiled in kernel image.

Regards,
Arend




2013-03-27 12:07:05

by Arend van Spriel

[permalink] [raw]
Subject: Re: brcmsmac in kernel driver on a Samsung NC110

On 03/27/2013 12:22 PM, Arend van Spriel wrote:
> On 03/27/2013 11:45 AM, John Talbut wrote:
>>
>>
>> On 27/03/13 10:33, Rafał Miłecki wrote:
>>> 2013/3/27 John Talbut <[email protected]>:
>>>> On 27/03/13 07:46, Rafał Miłecki wrote:
>>>>> 2013/3/26 Arend van Spriel <[email protected]>:
>>>>>> On 03/26/2013 08:48 PM, John Talbut wrote:
>>>>>>> echo "14e4 4357" > /sys/bus/pci/drivers/bcma-pci-bridge/new_id
>>>>>>> bash: /sys/bus/pci/drivers/bcma-pci-bridge/new_id: No such file or directory
>>>>>>
>>>>>> This could mean you do not have CONFIG_BCMA_HOST_PCI=y in your .config
>>>>>
>>>>> Exactly. Make sure you have CONFIG_BCMA_HOST_PCI=y and that your
>>>>> host_pci.c is not modified/hacked/whatever.
>>>>>
>>>>> You can compare it with
>>>>> http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/drivers/bcma/host_pci.c
>>>>> bcma_pci_bridge_tbl.
>>>>>
>>>> OK, thanks, I have recompiled the kernel with CONFIG_BCMA_HOST_PCI=y and
>>>> we have some progress.
>>>>
>>>> ls /sys/bus/bcma/devices
>>>> bcma0:0
>>>>
>>>> lspci -d 14e4: -v
>>>> now has a line:
>>>> Kernel driver in use: bcma-pci-bridge
>>>>
>>>> host_pci.c is the same as torvalds.
>>>>
>>>> However, kernel log includes:
>>>> brcmsmac bcma0:0: firmware: agent aborted loading brcm/bcm43xx-0.fw (not
>>>> found?)
>>>> ieee80211 phy0: brcmsmac: Failed to find firmware usually in
>>>> /lib/firmware/brcm
>>>> brcmsmac: brcms_bcma_probe: brcms_attach failed!
>>>
>>> "Failed to find firmware". You didn't tell us if you have firmware installed.
>>> ls /lib/firmware/brcm/
>>> http://wireless.kernel.org/en/users/Drivers/brcm80211#Firmware_installation
>>>
>> Sorry, meant to do that:
>> ls /lib/firmware/brcm/
>> bcm43xx-0.fw bcm43xx_hdr-0.fw
>>

To confirm my suspicion could you try following (as root):

/sys/bus/bcma/drivers/brcmsmac # echo bcma0:0 > bind

This should retrigger brcmsmac to get firmware and use the device.

Regards,
Arend

>
> Do you have a ramdisk during boot? I suspect brcmsmac does request the
> firmware before the root filesystem is mounted.
>
> Gr. AvS
>



2013-03-27 07:46:20

by Rafał Miłecki

[permalink] [raw]
Subject: Re: brcmsmac in kernel driver on a Samsung NC110

2013/3/26 Arend van Spriel <[email protected]>:
> On 03/26/2013 08:48 PM, John Talbut wrote:
>> echo "14e4 4357" > /sys/bus/pci/drivers/bcma-pci-bridge/new_id
>> bash: /sys/bus/pci/drivers/bcma-pci-bridge/new_id: No such file or directory
>
> This could mean you do not have CONFIG_BCMA_HOST_PCI=y in your .config

Exactly. Make sure you have CONFIG_BCMA_HOST_PCI=y and that your
host_pci.c is not modified/hacked/whatever.

You can compare it with
http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/drivers/bcma/host_pci.c
bcma_pci_bridge_tbl.

--
Rafał

2013-03-27 16:15:37

by Arend van Spriel

[permalink] [raw]
Subject: Re: brcmsmac in kernel driver on a Samsung NC110

On 03/27/2013 01:21 PM, John Talbut wrote:
>
>
> On 27/03/13 12:06, Arend van Spriel wrote:
>> On 03/27/2013 12:22 PM, Arend van Spriel wrote:
>>> On 03/27/2013 11:45 AM, John Talbut wrote:
>>>>
>>>>
>>>> On 27/03/13 10:33, Rafał Miłecki wrote:
>>>>> 2013/3/27 John Talbut <[email protected]>:
>>>>>> On 27/03/13 07:46, Rafał Miłecki wrote:
>>>>>>> 2013/3/26 Arend van Spriel <[email protected]>:
>>>>>>>> On 03/26/2013 08:48 PM, John Talbut wrote:
>>>>>>>>> echo "14e4 4357" > /sys/bus/pci/drivers/bcma-pci-bridge/new_id
>>>>>>>>> bash: /sys/bus/pci/drivers/bcma-pci-bridge/new_id: No such file or directory
>>>>>>>>
>>>>>>>> This could mean you do not have CONFIG_BCMA_HOST_PCI=y in your .config
>>>>>>>
>>>>>>> Exactly. Make sure you have CONFIG_BCMA_HOST_PCI=y and that your
>>>>>>> host_pci.c is not modified/hacked/whatever.
>>>>>>>
>>>>>>> You can compare it with
>>>>>>> http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/drivers/bcma/host_pci.c
>>>>>>> bcma_pci_bridge_tbl.
>>>>>>>
>>>>>> OK, thanks, I have recompiled the kernel with CONFIG_BCMA_HOST_PCI=y and
>>>>>> we have some progress.
>>>>>>
>>>>>> ls /sys/bus/bcma/devices
>>>>>> bcma0:0
>>>>>>
>>>>>> lspci -d 14e4: -v
>>>>>> now has a line:
>>>>>> Kernel driver in use: bcma-pci-bridge
>>>>>>
>>>>>> host_pci.c is the same as torvalds.
>>>>>>
>>>>>> However, kernel log includes:
>>>>>> brcmsmac bcma0:0: firmware: agent aborted loading brcm/bcm43xx-0.fw (not
>>>>>> found?)
>>>>>> ieee80211 phy0: brcmsmac: Failed to find firmware usually in
>>>>>> /lib/firmware/brcm
>>>>>> brcmsmac: brcms_bcma_probe: brcms_attach failed!
>>>>>
>>>>> "Failed to find firmware". You didn't tell us if you have firmware installed.
>>>>> ls /lib/firmware/brcm/
>>>>> http://wireless.kernel.org/en/users/Drivers/brcm80211#Firmware_installation
>>>>>
>>>> Sorry, meant to do that:
>>>> ls /lib/firmware/brcm/
>>>> bcm43xx-0.fw bcm43xx_hdr-0.fw
>>>>
>>
>> To confirm my suspicion could you try following (as root):
>>
>> /sys/bus/bcma/drivers/brcmsmac # echo bcma0:0 > bind
>>
>> This should retrigger brcmsmac to get firmware and use the device.
>>
>> Regards,
>> Arend
>
> Yes.
> cd /sys/bus/bcma/drivers/brcmsmac
> echo bcma0:0 > bind
>
> And I now have wlan0.
>
> So, how to get the firmware loaded after the root filesystem is mounted?

You just did. I admit this is a bit tricky way to do it. The driver
would need to be reworked to defer firmware loading, but there is not
clear API. I believe the general recommendation is to attempt firmware
loading upon IFFUP, because you can assume the actual root filesystem is
mounted upon receiving that notification. Let me try to come up with a
patch.

Regards,
Arend


2013-03-26 19:48:24

by John Talbut

[permalink] [raw]
Subject: Re: brcmsmac in kernel driver on a Samsung NC110

On 26/03/13 19:01, Hauke Mehrtens wrote:
> On 03/26/2013 07:43 PM, John Talbut wrote:
>> On 26/03/13 16:59, Rafał Miłecki wrote:
>>> 2013/3/26 Arend van Spriel<[email protected]>:
>>>> On 03/26/2013 12:43 PM, John Talbut wrote:
>>>>> On 26/03/13 11:29, Arend van Spriel wrote:
>>>>>> On 03/26/2013 12:13 PM, John Talbut wrote:
>>>>>>>
>>>>>>> On 26/03/13 10:53, Arend van Spriel wrote:
>>>>>>>> On 03/26/2013 11:34 AM, John Talbut wrote:
>>>>>>>>> Kernel log attached.
>>>>>>>>>
>>>>>>>>
>>>>>>>> Now this is weird. I do not see any BCMA log messages. Can you give
>>>>>>>> output of following command:
>>>>>>>>
>>>>>>>> $ lspci -n -s 1:0.0
>>>>>>>
>>>>>>> 01:00.0 0280: 14e4:4357 (rev 01)
>>>>>>
>>>>>> Ok, no problem there.
>>>>>>
>>>>>> digging further in sysfs. Can you execute the following commands:
>>>>>>
>>>>>> if it exists:
>>>>>> $ ls /sys/bus/bcma
>>>>>> $ ls /sys/bus/bcma/devices
>>>>>> $ ls /sys/bus/bcma/drivers
>>>>>>
>>>>>> if it exists also following:
>>>>>> $ ls -l /sys/bus/bcma/drivers/brcmsmac
>>>>>
>>>>> root@johnwtnc110:/usr/src/linux-source-3.8# ls /sys/bus/bcma
>>>>> devices drivers drivers_autoprobe drivers_probe uevent
>>>>> root@johnwtnc110:/usr/src/linux-source-3.8# ls /sys/bus/bcma/devices
>>>>
>>>> The fact that there are no devices detected under bcma is suspicious.
>>>> Adding bcma developer to the list. Maybe he knows about issues when
>>>> having bcma compiled in kernel image.
>>>
>>> Thanks Arend. Unfortunately I can't find archive of this thread, so I
>>> can see only quotations above.
>>>
>>> If there is /sys/bus/bcma/ directory, it means bcma had to be loaded
>>> (or just is built into the kernel). However if there are no "bcma"
>>> messages in the dmesg, it's probably because there isn't any device
>>> bcma (currently) handles.
>>>
>>> If you can it yourself: remove all 14e4:* devices and do "modprobe
>>> bcma". You will get /sys/bus/bcma/ without "bcma" messages in dmesg.
>>>
>>> 14e4:4357 is one of the devices handled by bcma, so there are two
>>> options:
>>> 1) It's some old kernel where we didn't have 14e4:4357 in bcma
>>> 2) There is another module that grabbed 14e4:4357 PCI device
>>>
>>> The first option can be verified with "modinfo bcma | grep alias" in
>>> case of bcma as a module. Not sure how to check that for bcma built
>>> in.
>>>
>>> The second option is even easier to verify, just use:
>>> lspci -d 14e4: -v
>>> and check for "Kernel driver in use: "
>>>
>> Thanks Rafał.
>>
>> I have everything built into the kernel which is compiled using the 3.8
>> kernel source from Debian, so not an old kernel.
>>
>> ls /sys/bus/bcma
>> devices drivers drivers_autoprobe drivers_probe uevent
>>
>> lspci -d 14e4: -v
>> 01:00.0 Network controller: Broadcom Corporation BCM43225 802.11b/g/n
>> (rev 01)
>> Subsystem: Wistron NeWeb Corp. Device 04db
>> Flags: bus master, fast devsel, latency 0, IRQ 11
>> Memory at dfe00000 (64-bit, non-prefetchable) [size=16K]
>> Capabilities: [40] Power Management version 3
>> Capabilities: [58] Vendor Specific Information: Len=78 <?>
>> Capabilities: [48] MSI: Enable- Count=1/1 Maskable- 64bit+
>> Capabilities: [d0] Express Endpoint, MSI 00
>> Capabilities: [100] Advanced Error Reporting
>> Capabilities: [13c] Virtual Channel
>> Capabilities: [160] Device Serial Number 00-00-b1-ff-ff-29-00-1b
>> Capabilities: [16c] Power Budgeting <?>
>>
>> John
> Hi,
>
> Could you provide the output of "modinfo bcma | grep alias" as Rafał asked.
>
> The Debian kernel 3.2 contains some patch removing all PCI IDs expect
> 14e4:4331 from bcma, if this is still in your kernel that's the problem.
>
> If this is the case please try this:
>
> echo "14e4 4357" > /sys/bus/pci/drivers/bcma-pci-bridge/new_id
>
> Hauke
>
Hi

modinfo bcma | grep alias
ERROR: Module bcma not found.

echo "14e4 4357" > /sys/bus/pci/drivers/bcma-pci-bridge/new_id
bash: /sys/bus/pci/drivers/bcma-pci-bridge/new_id: No such file or directory

Because I am not using modules?

I found a reference to this patch:
http://git.grml.org/?p=grml-kernel.git;a=blobdiff;f=linux-3/debian/patches/debian/bcma-Do-not-claim-PCI-device-IDs-also-claimed-by-brc.patch;fp=linux-3/debian/patches/debian/bcma-Do-not-claim-PCI-device-IDs-also-claimed-by-brc.patch;h=0000000000000000000000000000000000000000;hp=f8fd94163e10ff9fa3803d6f7aaae7adb3b2c0f5;hb=dfd70ee5283216f7635b367327a9389b10030d87;hpb=76b7ce681bb74b69aea9b155747c47ec86d4e6c5

This appears to refer to /drivers/bcma/host_pci.c, but the patch does
not appear to be applied to that file in the Debian 3.8 kernel source,
there are lines including:
{ PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4357) },
in the 3.8 version of the file.

John

2013-03-27 11:22:34

by Arend van Spriel

[permalink] [raw]
Subject: Re: brcmsmac in kernel driver on a Samsung NC110

On 03/27/2013 11:45 AM, John Talbut wrote:
>
>
> On 27/03/13 10:33, Rafał Miłecki wrote:
>> 2013/3/27 John Talbut <[email protected]>:
>>> On 27/03/13 07:46, Rafał Miłecki wrote:
>>>> 2013/3/26 Arend van Spriel <[email protected]>:
>>>>> On 03/26/2013 08:48 PM, John Talbut wrote:
>>>>>> echo "14e4 4357" > /sys/bus/pci/drivers/bcma-pci-bridge/new_id
>>>>>> bash: /sys/bus/pci/drivers/bcma-pci-bridge/new_id: No such file or directory
>>>>>
>>>>> This could mean you do not have CONFIG_BCMA_HOST_PCI=y in your .config
>>>>
>>>> Exactly. Make sure you have CONFIG_BCMA_HOST_PCI=y and that your
>>>> host_pci.c is not modified/hacked/whatever.
>>>>
>>>> You can compare it with
>>>> http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/drivers/bcma/host_pci.c
>>>> bcma_pci_bridge_tbl.
>>>>
>>> OK, thanks, I have recompiled the kernel with CONFIG_BCMA_HOST_PCI=y and
>>> we have some progress.
>>>
>>> ls /sys/bus/bcma/devices
>>> bcma0:0
>>>
>>> lspci -d 14e4: -v
>>> now has a line:
>>> Kernel driver in use: bcma-pci-bridge
>>>
>>> host_pci.c is the same as torvalds.
>>>
>>> However, kernel log includes:
>>> brcmsmac bcma0:0: firmware: agent aborted loading brcm/bcm43xx-0.fw (not
>>> found?)
>>> ieee80211 phy0: brcmsmac: Failed to find firmware usually in
>>> /lib/firmware/brcm
>>> brcmsmac: brcms_bcma_probe: brcms_attach failed!
>>
>> "Failed to find firmware". You didn't tell us if you have firmware installed.
>> ls /lib/firmware/brcm/
>> http://wireless.kernel.org/en/users/Drivers/brcm80211#Firmware_installation
>>
> Sorry, meant to do that:
> ls /lib/firmware/brcm/
> bcm43xx-0.fw bcm43xx_hdr-0.fw
>

Do you have a ramdisk during boot? I suspect brcmsmac does request the
firmware before the root filesystem is mounted.

Gr. AvS


2013-03-26 19:01:42

by Hauke Mehrtens

[permalink] [raw]
Subject: Re: brcmsmac in kernel driver on a Samsung NC110

On 03/26/2013 07:43 PM, John Talbut wrote:
> On 26/03/13 16:59, Rafał Miłecki wrote:
>> 2013/3/26 Arend van Spriel<[email protected]>:
>>> On 03/26/2013 12:43 PM, John Talbut wrote:
>>>> On 26/03/13 11:29, Arend van Spriel wrote:
>>>>> On 03/26/2013 12:13 PM, John Talbut wrote:
>>>>>>
>>>>>> On 26/03/13 10:53, Arend van Spriel wrote:
>>>>>>> On 03/26/2013 11:34 AM, John Talbut wrote:
>>>>>>>> Kernel log attached.
>>>>>>>>
>>>>>>>
>>>>>>> Now this is weird. I do not see any BCMA log messages. Can you give
>>>>>>> output of following command:
>>>>>>>
>>>>>>> $ lspci -n -s 1:0.0
>>>>>>
>>>>>> 01:00.0 0280: 14e4:4357 (rev 01)
>>>>>
>>>>> Ok, no problem there.
>>>>>
>>>>> digging further in sysfs. Can you execute the following commands:
>>>>>
>>>>> if it exists:
>>>>> $ ls /sys/bus/bcma
>>>>> $ ls /sys/bus/bcma/devices
>>>>> $ ls /sys/bus/bcma/drivers
>>>>>
>>>>> if it exists also following:
>>>>> $ ls -l /sys/bus/bcma/drivers/brcmsmac
>>>>
>>>> root@johnwtnc110:/usr/src/linux-source-3.8# ls /sys/bus/bcma
>>>> devices drivers drivers_autoprobe drivers_probe uevent
>>>> root@johnwtnc110:/usr/src/linux-source-3.8# ls /sys/bus/bcma/devices
>>>
>>> The fact that there are no devices detected under bcma is suspicious.
>>> Adding bcma developer to the list. Maybe he knows about issues when
>>> having bcma compiled in kernel image.
>>
>> Thanks Arend. Unfortunately I can't find archive of this thread, so I
>> can see only quotations above.
>>
>> If there is /sys/bus/bcma/ directory, it means bcma had to be loaded
>> (or just is built into the kernel). However if there are no "bcma"
>> messages in the dmesg, it's probably because there isn't any device
>> bcma (currently) handles.
>>
>> If you can it yourself: remove all 14e4:* devices and do "modprobe
>> bcma". You will get /sys/bus/bcma/ without "bcma" messages in dmesg.
>>
>> 14e4:4357 is one of the devices handled by bcma, so there are two
>> options:
>> 1) It's some old kernel where we didn't have 14e4:4357 in bcma
>> 2) There is another module that grabbed 14e4:4357 PCI device
>>
>> The first option can be verified with "modinfo bcma | grep alias" in
>> case of bcma as a module. Not sure how to check that for bcma built
>> in.
>>
>> The second option is even easier to verify, just use:
>> lspci -d 14e4: -v
>> and check for "Kernel driver in use: "
>>
> Thanks Rafał.
>
> I have everything built into the kernel which is compiled using the 3.8
> kernel source from Debian, so not an old kernel.
>
> ls /sys/bus/bcma
> devices drivers drivers_autoprobe drivers_probe uevent
>
> lspci -d 14e4: -v
> 01:00.0 Network controller: Broadcom Corporation BCM43225 802.11b/g/n
> (rev 01)
> Subsystem: Wistron NeWeb Corp. Device 04db
> Flags: bus master, fast devsel, latency 0, IRQ 11
> Memory at dfe00000 (64-bit, non-prefetchable) [size=16K]
> Capabilities: [40] Power Management version 3
> Capabilities: [58] Vendor Specific Information: Len=78 <?>
> Capabilities: [48] MSI: Enable- Count=1/1 Maskable- 64bit+
> Capabilities: [d0] Express Endpoint, MSI 00
> Capabilities: [100] Advanced Error Reporting
> Capabilities: [13c] Virtual Channel
> Capabilities: [160] Device Serial Number 00-00-b1-ff-ff-29-00-1b
> Capabilities: [16c] Power Budgeting <?>
>
> John
Hi,

Could you provide the output of "modinfo bcma | grep alias" as Rafał asked.

The Debian kernel 3.2 contains some patch removing all PCI IDs expect
14e4:4331 from bcma, if this is still in your kernel that's the problem.

If this is the case please try this:

echo "14e4 4357" > /sys/bus/pci/drivers/bcma-pci-bridge/new_id

Hauke

2013-03-26 18:43:24

by John Talbut

[permalink] [raw]
Subject: Re: brcmsmac in kernel driver on a Samsung NC110

On 26/03/13 16:59, Rafał Miłecki wrote:
> 2013/3/26 Arend van Spriel<[email protected]>:
>> On 03/26/2013 12:43 PM, John Talbut wrote:
>>> On 26/03/13 11:29, Arend van Spriel wrote:
>>>> On 03/26/2013 12:13 PM, John Talbut wrote:
>>>>>
>>>>> On 26/03/13 10:53, Arend van Spriel wrote:
>>>>>> On 03/26/2013 11:34 AM, John Talbut wrote:
>>>>>>> Kernel log attached.
>>>>>>>
>>>>>>
>>>>>> Now this is weird. I do not see any BCMA log messages. Can you give
>>>>>> output of following command:
>>>>>>
>>>>>> $ lspci -n -s 1:0.0
>>>>>
>>>>> 01:00.0 0280: 14e4:4357 (rev 01)
>>>>
>>>> Ok, no problem there.
>>>>
>>>> digging further in sysfs. Can you execute the following commands:
>>>>
>>>> if it exists:
>>>> $ ls /sys/bus/bcma
>>>> $ ls /sys/bus/bcma/devices
>>>> $ ls /sys/bus/bcma/drivers
>>>>
>>>> if it exists also following:
>>>> $ ls -l /sys/bus/bcma/drivers/brcmsmac
>>>
>>> root@johnwtnc110:/usr/src/linux-source-3.8# ls /sys/bus/bcma
>>> devices drivers drivers_autoprobe drivers_probe uevent
>>> root@johnwtnc110:/usr/src/linux-source-3.8# ls /sys/bus/bcma/devices
>>
>> The fact that there are no devices detected under bcma is suspicious.
>> Adding bcma developer to the list. Maybe he knows about issues when
>> having bcma compiled in kernel image.
>
> Thanks Arend. Unfortunately I can't find archive of this thread, so I
> can see only quotations above.
>
> If there is /sys/bus/bcma/ directory, it means bcma had to be loaded
> (or just is built into the kernel). However if there are no "bcma"
> messages in the dmesg, it's probably because there isn't any device
> bcma (currently) handles.
>
> If you can it yourself: remove all 14e4:* devices and do "modprobe
> bcma". You will get /sys/bus/bcma/ without "bcma" messages in dmesg.
>
> 14e4:4357 is one of the devices handled by bcma, so there are two options:
> 1) It's some old kernel where we didn't have 14e4:4357 in bcma
> 2) There is another module that grabbed 14e4:4357 PCI device
>
> The first option can be verified with "modinfo bcma | grep alias" in
> case of bcma as a module. Not sure how to check that for bcma built
> in.
>
> The second option is even easier to verify, just use:
> lspci -d 14e4: -v
> and check for "Kernel driver in use: "
>
Thanks Rafał.

I have everything built into the kernel which is compiled using the 3.8
kernel source from Debian, so not an old kernel.

ls /sys/bus/bcma
devices drivers drivers_autoprobe drivers_probe uevent

lspci -d 14e4: -v
01:00.0 Network controller: Broadcom Corporation BCM43225 802.11b/g/n
(rev 01)
Subsystem: Wistron NeWeb Corp. Device 04db
Flags: bus master, fast devsel, latency 0, IRQ 11
Memory at dfe00000 (64-bit, non-prefetchable) [size=16K]
Capabilities: [40] Power Management version 3
Capabilities: [58] Vendor Specific Information: Len=78 <?>
Capabilities: [48] MSI: Enable- Count=1/1 Maskable- 64bit+
Capabilities: [d0] Express Endpoint, MSI 00
Capabilities: [100] Advanced Error Reporting
Capabilities: [13c] Virtual Channel
Capabilities: [160] Device Serial Number 00-00-b1-ff-ff-29-00-1b
Capabilities: [16c] Power Budgeting <?>

John


2013-03-28 10:03:06

by John Talbut

[permalink] [raw]
Subject: Re: brcmsmac in kernel driver on a Samsung NC110

On 27/03/13 16:15, Arend van Spriel wrote:
>> cd /sys/bus/bcma/drivers/brcmsmac
>> echo bcma0:0 > bind
>>
>> And I now have wlan0.
>>
>> So, how to get the firmware loaded after the root filesystem is mounted?
>
> You just did. I admit this is a bit tricky way to do it. The driver
> would need to be reworked to defer firmware loading, but there is not
> clear API. I believe the general recommendation is to attempt firmware
> loading upon IFFUP, because you can assume the actual root filesystem is
> mounted upon receiving that notification. Let me try to come up with a
> patch.
>
With dependency based booting it would seem to me that it should be
possible to make the creation of this driver dependent on the root
filesystem being mounted. Alternatively the firmware could be included
in the initramfs.

Or the firmware could be incorporated into the driver.

Anyway, thanks for your help, and Rafał and Hauke. I have put the
information at http://wiki.debian.org/brcm80211.

Regards

John

2013-03-27 12:01:11

by John Talbut

[permalink] [raw]
Subject: Re: brcmsmac in kernel driver on a Samsung NC110



On 27/03/13 11:22, Arend van Spriel wrote:
> On 03/27/2013 11:45 AM, John Talbut wrote:
>>
>>
>> On 27/03/13 10:33, Rafał Miłecki wrote:
>>> 2013/3/27 John Talbut <[email protected]>:
>>>> On 27/03/13 07:46, Rafał Miłecki wrote:
>>>>> 2013/3/26 Arend van Spriel <[email protected]>:
>>>>>> On 03/26/2013 08:48 PM, John Talbut wrote:
>>>>>>> echo "14e4 4357" > /sys/bus/pci/drivers/bcma-pci-bridge/new_id
>>>>>>> bash: /sys/bus/pci/drivers/bcma-pci-bridge/new_id: No such file or directory
>>>>>>
>>>>>> This could mean you do not have CONFIG_BCMA_HOST_PCI=y in your .config
>>>>>
>>>>> Exactly. Make sure you have CONFIG_BCMA_HOST_PCI=y and that your
>>>>> host_pci.c is not modified/hacked/whatever.
>>>>>
>>>>> You can compare it with
>>>>> http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/drivers/bcma/host_pci.c
>>>>> bcma_pci_bridge_tbl.
>>>>>
>>>> OK, thanks, I have recompiled the kernel with CONFIG_BCMA_HOST_PCI=y and
>>>> we have some progress.
>>>>
>>>> ls /sys/bus/bcma/devices
>>>> bcma0:0
>>>>
>>>> lspci -d 14e4: -v
>>>> now has a line:
>>>> Kernel driver in use: bcma-pci-bridge
>>>>
>>>> host_pci.c is the same as torvalds.
>>>>
>>>> However, kernel log includes:
>>>> brcmsmac bcma0:0: firmware: agent aborted loading brcm/bcm43xx-0.fw (not
>>>> found?)
>>>> ieee80211 phy0: brcmsmac: Failed to find firmware usually in
>>>> /lib/firmware/brcm
>>>> brcmsmac: brcms_bcma_probe: brcms_attach failed!
>>>
>>> "Failed to find firmware". You didn't tell us if you have firmware installed.
>>> ls /lib/firmware/brcm/
>>> http://wireless.kernel.org/en/users/Drivers/brcm80211#Firmware_installation
>>>
>> Sorry, meant to do that:
>> ls /lib/firmware/brcm/
>> bcm43xx-0.fw bcm43xx_hdr-0.fw
>>
>
> Do you have a ramdisk during boot? I suspect brcmsmac does request the
> firmware before the root filesystem is mounted.
>
> Gr. AvS
>

Yes. Everything apart from the boot partition is encrypted, so,
presumably, if it tries to fetch the firmware before the root filesystem
is decripted and mounted it will not find it. How do I prove that this
is what is happening and get round it?

Regards

John

2013-03-26 22:00:52

by Arend van Spriel

[permalink] [raw]
Subject: Re: brcmsmac in kernel driver on a Samsung NC110

On 03/26/2013 08:48 PM, John Talbut wrote:
> On 26/03/13 19:01, Hauke Mehrtens wrote:
>> Hi,
>>
>> Could you provide the output of "modinfo bcma | grep alias" as Rafał asked.
>>
>> The Debian kernel 3.2 contains some patch removing all PCI IDs expect
>> 14e4:4331 from bcma, if this is still in your kernel that's the problem.
>>
>> If this is the case please try this:
>>
>> echo "14e4 4357" > /sys/bus/pci/drivers/bcma-pci-bridge/new_id
>>
>> Hauke
>>
> Hi
>
> modinfo bcma | grep alias
> ERROR: Module bcma not found.

That is because you have it compiled into the kernel.

> echo "14e4 4357" > /sys/bus/pci/drivers/bcma-pci-bridge/new_id
> bash: /sys/bus/pci/drivers/bcma-pci-bridge/new_id: No such file or directory

This could mean you do not have CONFIG_BCMA_HOST_PCI=y in your .config

> Because I am not using modules?
>
> I found a reference to this patch:
> http://git.grml.org/?p=grml-kernel.git;a=blobdiff;f=linux-3/debian/patches/debian/bcma-Do-not-claim-PCI-device-IDs-also-claimed-by-brc.patch;fp=linux-3/debian/patches/debian/bcma-Do-not-claim-PCI-device-IDs-also-claimed-by-brc.patch;h=0000000000000000000000000000000000000000;hp=f8fd94163e10ff9fa3803d6f7aaae7adb3b2c0f5;hb=dfd70ee5283216f7635b367327a9389b10030d87;hpb=76b7ce681bb74b69aea9b155747c47ec86d4e6c5
>
> This appears to refer to /drivers/bcma/host_pci.c, but the patch does
> not appear to be applied to that file in the Debian 3.8 kernel source,
> there are lines including:
> { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4357) },
> in the 3.8 version of the file.

That patch was from the days that brcmsmac did not use bcma. In 3.8 you
do not need that patch.

Gr. AvS


2013-03-27 10:33:20

by Rafał Miłecki

[permalink] [raw]
Subject: Re: brcmsmac in kernel driver on a Samsung NC110

2013/3/27 John Talbut <[email protected]>:
> On 27/03/13 07:46, Rafał Miłecki wrote:
>> 2013/3/26 Arend van Spriel <[email protected]>:
>>> On 03/26/2013 08:48 PM, John Talbut wrote:
>>>> echo "14e4 4357" > /sys/bus/pci/drivers/bcma-pci-bridge/new_id
>>>> bash: /sys/bus/pci/drivers/bcma-pci-bridge/new_id: No such file or directory
>>>
>>> This could mean you do not have CONFIG_BCMA_HOST_PCI=y in your .config
>>
>> Exactly. Make sure you have CONFIG_BCMA_HOST_PCI=y and that your
>> host_pci.c is not modified/hacked/whatever.
>>
>> You can compare it with
>> http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/drivers/bcma/host_pci.c
>> bcma_pci_bridge_tbl.
>>
> OK, thanks, I have recompiled the kernel with CONFIG_BCMA_HOST_PCI=y and
> we have some progress.
>
> ls /sys/bus/bcma/devices
> bcma0:0
>
> lspci -d 14e4: -v
> now has a line:
> Kernel driver in use: bcma-pci-bridge
>
> host_pci.c is the same as torvalds.
>
> However, kernel log includes:
> brcmsmac bcma0:0: firmware: agent aborted loading brcm/bcm43xx-0.fw (not
> found?)
> ieee80211 phy0: brcmsmac: Failed to find firmware usually in
> /lib/firmware/brcm
> brcmsmac: brcms_bcma_probe: brcms_attach failed!

"Failed to find firmware". You didn't tell us if you have firmware installed.
ls /lib/firmware/brcm/
http://wireless.kernel.org/en/users/Drivers/brcm80211#Firmware_installation

--
Rafał

2013-03-26 14:55:45

by John Talbut

[permalink] [raw]
Subject: Re: brcmsmac in kernel driver on a Samsung NC110

On 26/03/13 12:01, Arend van Spriel wrote:
> On 03/26/2013 12:43 PM, John Talbut wrote:
>> On 26/03/13 11:29, Arend van Spriel wrote:
>>> On 03/26/2013 12:13 PM, John Talbut wrote:
>>>>
>>>> On 26/03/13 10:53, Arend van Spriel wrote:
>>>>> On 03/26/2013 11:34 AM, John Talbut wrote:
>>>>>> Kernel log attached.
>>>>>>
>>>>>
>>>>> Now this is weird. I do not see any BCMA log messages. Can you give
>>>>> output of following command:
>>>>>
>>>>> $ lspci -n -s 1:0.0
>>>>
>>>> 01:00.0 0280: 14e4:4357 (rev 01)
>>>
>>> Ok, no problem there.
>>>
>>> digging further in sysfs. Can you execute the following commands:
>>>
>>> if it exists:
>>> $ ls /sys/bus/bcma
>>> $ ls /sys/bus/bcma/devices
>>> $ ls /sys/bus/bcma/drivers
>>>
>>> if it exists also following:
>>> $ ls -l /sys/bus/bcma/drivers/brcmsmac
>>
>> root@johnwtnc110:/usr/src/linux-source-3.8# ls /sys/bus/bcma
>> devices drivers drivers_autoprobe drivers_probe uevent
>> root@johnwtnc110:/usr/src/linux-source-3.8# ls /sys/bus/bcma/devices
>
> The fact that there are no devices detected under bcma is suspicious.
> Adding bcma developer to the list. Maybe he knows about issues when
> having bcma compiled in kernel image.
>
> Regards,
> Arend

I have just noticed that with a previous version of the kernel which I
had compiled with
# CONFIG_BCMA is not set

there are references to brcmsmac in the kernel log. It complains about
failing to find the firmware, though.

Regards
John

2013-03-27 10:46:00

by John Talbut

[permalink] [raw]
Subject: Re: brcmsmac in kernel driver on a Samsung NC110



On 27/03/13 10:33, Rafał Miłecki wrote:
> 2013/3/27 John Talbut <[email protected]>:
>> On 27/03/13 07:46, Rafał Miłecki wrote:
>>> 2013/3/26 Arend van Spriel <[email protected]>:
>>>> On 03/26/2013 08:48 PM, John Talbut wrote:
>>>>> echo "14e4 4357" > /sys/bus/pci/drivers/bcma-pci-bridge/new_id
>>>>> bash: /sys/bus/pci/drivers/bcma-pci-bridge/new_id: No such file or directory
>>>>
>>>> This could mean you do not have CONFIG_BCMA_HOST_PCI=y in your .config
>>>
>>> Exactly. Make sure you have CONFIG_BCMA_HOST_PCI=y and that your
>>> host_pci.c is not modified/hacked/whatever.
>>>
>>> You can compare it with
>>> http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/drivers/bcma/host_pci.c
>>> bcma_pci_bridge_tbl.
>>>
>> OK, thanks, I have recompiled the kernel with CONFIG_BCMA_HOST_PCI=y and
>> we have some progress.
>>
>> ls /sys/bus/bcma/devices
>> bcma0:0
>>
>> lspci -d 14e4: -v
>> now has a line:
>> Kernel driver in use: bcma-pci-bridge
>>
>> host_pci.c is the same as torvalds.
>>
>> However, kernel log includes:
>> brcmsmac bcma0:0: firmware: agent aborted loading brcm/bcm43xx-0.fw (not
>> found?)
>> ieee80211 phy0: brcmsmac: Failed to find firmware usually in
>> /lib/firmware/brcm
>> brcmsmac: brcms_bcma_probe: brcms_attach failed!
>
> "Failed to find firmware". You didn't tell us if you have firmware installed.
> ls /lib/firmware/brcm/
> http://wireless.kernel.org/en/users/Drivers/brcm80211#Firmware_installation
>
Sorry, meant to do that:
ls /lib/firmware/brcm/
bcm43xx-0.fw bcm43xx_hdr-0.fw

2013-03-26 16:59:51

by Rafał Miłecki

[permalink] [raw]
Subject: Re: brcmsmac in kernel driver on a Samsung NC110

2013/3/26 Arend van Spriel <[email protected]>:
> On 03/26/2013 12:43 PM, John Talbut wrote:
>> On 26/03/13 11:29, Arend van Spriel wrote:
>>> On 03/26/2013 12:13 PM, John Talbut wrote:
>>>>
>>>> On 26/03/13 10:53, Arend van Spriel wrote:
>>>>> On 03/26/2013 11:34 AM, John Talbut wrote:
>>>>>> Kernel log attached.
>>>>>>
>>>>>
>>>>> Now this is weird. I do not see any BCMA log messages. Can you give
>>>>> output of following command:
>>>>>
>>>>> $ lspci -n -s 1:0.0
>>>>
>>>> 01:00.0 0280: 14e4:4357 (rev 01)
>>>
>>> Ok, no problem there.
>>>
>>> digging further in sysfs. Can you execute the following commands:
>>>
>>> if it exists:
>>> $ ls /sys/bus/bcma
>>> $ ls /sys/bus/bcma/devices
>>> $ ls /sys/bus/bcma/drivers
>>>
>>> if it exists also following:
>>> $ ls -l /sys/bus/bcma/drivers/brcmsmac
>>
>> root@johnwtnc110:/usr/src/linux-source-3.8# ls /sys/bus/bcma
>> devices drivers drivers_autoprobe drivers_probe uevent
>> root@johnwtnc110:/usr/src/linux-source-3.8# ls /sys/bus/bcma/devices
>
> The fact that there are no devices detected under bcma is suspicious.
> Adding bcma developer to the list. Maybe he knows about issues when
> having bcma compiled in kernel image.

Thanks Arend. Unfortunately I can't find archive of this thread, so I
can see only quotations above.

If there is /sys/bus/bcma/ directory, it means bcma had to be loaded
(or just is built into the kernel). However if there are no "bcma"
messages in the dmesg, it's probably because there isn't any device
bcma (currently) handles.

If you can it yourself: remove all 14e4:* devices and do "modprobe
bcma". You will get /sys/bus/bcma/ without "bcma" messages in dmesg.

14e4:4357 is one of the devices handled by bcma, so there are two options:
1) It's some old kernel where we didn't have 14e4:4357 in bcma
2) There is another module that grabbed 14e4:4357 PCI device

The first option can be verified with "modinfo bcma | grep alias" in
case of bcma as a module. Not sure how to check that for bcma built
in.

The second option is even easier to verify, just use:
lspci -d 14e4: -v
and check for "Kernel driver in use: "

--
Rafał

2013-03-28 11:23:25

by Arend van Spriel

[permalink] [raw]
Subject: Re: brcmsmac in kernel driver on a Samsung NC110

On 03/28/2013 11:03 AM, John Talbut wrote:
> On 27/03/13 16:15, Arend van Spriel wrote:
>>> cd /sys/bus/bcma/drivers/brcmsmac
>>> echo bcma0:0 > bind
>>>
>>> And I now have wlan0.
>>>
>>> So, how to get the firmware loaded after the root filesystem is mounted?
>>
>> You just did. I admit this is a bit tricky way to do it. The driver
>> would need to be reworked to defer firmware loading, but there is not
>> clear API. I believe the general recommendation is to attempt firmware
>> loading upon IFFUP, because you can assume the actual root filesystem is
>> mounted upon receiving that notification. Let me try to come up with a
>> patch.
>>
> With dependency based booting it would seem to me that it should be
> possible to make the creation of this driver dependent on the root
> filesystem being mounted. Alternatively the firmware could be included
> in the initramfs.

It actually needs a user-space helper. As I understood things there is
no way for the kernel to know whether user-space has everything in place
to handle the firmware request.

> Or the firmware could be incorporated into the driver.
>
> Anyway, thanks for your help, and Rafał and Hauke. I have put the
> information at http://wiki.debian.org/brcm80211.

I tried to get a patch to you yesterday. Did you get that?

Gr. AvS



2013-03-26 17:01:16

by Rafał Miłecki

[permalink] [raw]
Subject: Re: brcmsmac in kernel driver on a Samsung NC110

2013/3/26 John Talbut <[email protected]>:
> On 26/03/13 12:01, Arend van Spriel wrote:
>> On 03/26/2013 12:43 PM, John Talbut wrote:
>>> On 26/03/13 11:29, Arend van Spriel wrote:
>>>> On 03/26/2013 12:13 PM, John Talbut wrote:
>>>>>
>>>>> On 26/03/13 10:53, Arend van Spriel wrote:
>>>>>> On 03/26/2013 11:34 AM, John Talbut wrote:
>>>>>>> Kernel log attached.
>>>>>>>
>>>>>>
>>>>>> Now this is weird. I do not see any BCMA log messages. Can you give
>>>>>> output of following command:
>>>>>>
>>>>>> $ lspci -n -s 1:0.0
>>>>>
>>>>> 01:00.0 0280: 14e4:4357 (rev 01)
>>>>
>>>> Ok, no problem there.
>>>>
>>>> digging further in sysfs. Can you execute the following commands:
>>>>
>>>> if it exists:
>>>> $ ls /sys/bus/bcma
>>>> $ ls /sys/bus/bcma/devices
>>>> $ ls /sys/bus/bcma/drivers
>>>>
>>>> if it exists also following:
>>>> $ ls -l /sys/bus/bcma/drivers/brcmsmac
>>>
>>> root@johnwtnc110:/usr/src/linux-source-3.8# ls /sys/bus/bcma
>>> devices drivers drivers_autoprobe drivers_probe uevent
>>> root@johnwtnc110:/usr/src/linux-source-3.8# ls /sys/bus/bcma/devices
>>
>> The fact that there are no devices detected under bcma is suspicious.
>> Adding bcma developer to the list. Maybe he knows about issues when
>> having bcma compiled in kernel image.
>>
>> Regards,
>> Arend
>
> I have just noticed that with a previous version of the kernel which I
> had compiled with
> # CONFIG_BCMA is not set
>
> there are references to brcmsmac in the kernel log. It complains about
> failing to find the firmware, though.

In earlier kernels brcmsmac was re-implementing "bcma" on it's own. It
was changed, so now brcmsmac operates just on the bcma 80211 core. You
need both: bcma and brcmsmac loaded.

--
Rafał

2013-03-27 12:21:54

by John Talbut

[permalink] [raw]
Subject: Re: brcmsmac in kernel driver on a Samsung NC110



On 27/03/13 12:06, Arend van Spriel wrote:
> On 03/27/2013 12:22 PM, Arend van Spriel wrote:
>> On 03/27/2013 11:45 AM, John Talbut wrote:
>>>
>>>
>>> On 27/03/13 10:33, Rafał Miłecki wrote:
>>>> 2013/3/27 John Talbut <[email protected]>:
>>>>> On 27/03/13 07:46, Rafał Miłecki wrote:
>>>>>> 2013/3/26 Arend van Spriel <[email protected]>:
>>>>>>> On 03/26/2013 08:48 PM, John Talbut wrote:
>>>>>>>> echo "14e4 4357" > /sys/bus/pci/drivers/bcma-pci-bridge/new_id
>>>>>>>> bash: /sys/bus/pci/drivers/bcma-pci-bridge/new_id: No such file or directory
>>>>>>>
>>>>>>> This could mean you do not have CONFIG_BCMA_HOST_PCI=y in your .config
>>>>>>
>>>>>> Exactly. Make sure you have CONFIG_BCMA_HOST_PCI=y and that your
>>>>>> host_pci.c is not modified/hacked/whatever.
>>>>>>
>>>>>> You can compare it with
>>>>>> http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/drivers/bcma/host_pci.c
>>>>>> bcma_pci_bridge_tbl.
>>>>>>
>>>>> OK, thanks, I have recompiled the kernel with CONFIG_BCMA_HOST_PCI=y and
>>>>> we have some progress.
>>>>>
>>>>> ls /sys/bus/bcma/devices
>>>>> bcma0:0
>>>>>
>>>>> lspci -d 14e4: -v
>>>>> now has a line:
>>>>> Kernel driver in use: bcma-pci-bridge
>>>>>
>>>>> host_pci.c is the same as torvalds.
>>>>>
>>>>> However, kernel log includes:
>>>>> brcmsmac bcma0:0: firmware: agent aborted loading brcm/bcm43xx-0.fw (not
>>>>> found?)
>>>>> ieee80211 phy0: brcmsmac: Failed to find firmware usually in
>>>>> /lib/firmware/brcm
>>>>> brcmsmac: brcms_bcma_probe: brcms_attach failed!
>>>>
>>>> "Failed to find firmware". You didn't tell us if you have firmware installed.
>>>> ls /lib/firmware/brcm/
>>>> http://wireless.kernel.org/en/users/Drivers/brcm80211#Firmware_installation
>>>>
>>> Sorry, meant to do that:
>>> ls /lib/firmware/brcm/
>>> bcm43xx-0.fw bcm43xx_hdr-0.fw
>>>
>
> To confirm my suspicion could you try following (as root):
>
> /sys/bus/bcma/drivers/brcmsmac # echo bcma0:0 > bind
>
> This should retrigger brcmsmac to get firmware and use the device.
>
> Regards,
> Arend

Yes.
cd /sys/bus/bcma/drivers/brcmsmac
echo bcma0:0 > bind

And I now have wlan0.

So, how to get the firmware loaded after the root filesystem is mounted?

Regards
John
>
>>
>> Do you have a ramdisk during boot? I suspect brcmsmac does request the
>> firmware before the root filesystem is mounted.
>>
>> Gr. AvS
>>
>
>
>

2013-03-27 10:24:29

by John Talbut

[permalink] [raw]
Subject: Re: brcmsmac in kernel driver on a Samsung NC110

On 27/03/13 07:46, Rafał Miłecki wrote:
> 2013/3/26 Arend van Spriel <[email protected]>:
>> On 03/26/2013 08:48 PM, John Talbut wrote:
>>> echo "14e4 4357" > /sys/bus/pci/drivers/bcma-pci-bridge/new_id
>>> bash: /sys/bus/pci/drivers/bcma-pci-bridge/new_id: No such file or directory
>>
>> This could mean you do not have CONFIG_BCMA_HOST_PCI=y in your .config
>
> Exactly. Make sure you have CONFIG_BCMA_HOST_PCI=y and that your
> host_pci.c is not modified/hacked/whatever.
>
> You can compare it with
> http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/drivers/bcma/host_pci.c
> bcma_pci_bridge_tbl.
>
OK, thanks, I have recompiled the kernel with CONFIG_BCMA_HOST_PCI=y and
we have some progress.

ls /sys/bus/bcma/devices
bcma0:0

lspci -d 14e4: -v
now has a line:
Kernel driver in use: bcma-pci-bridge

host_pci.c is the same as torvalds.

However, kernel log includes:
brcmsmac bcma0:0: firmware: agent aborted loading brcm/bcm43xx-0.fw (not
found?)
ieee80211 phy0: brcmsmac: Failed to find firmware usually in
/lib/firmware/brcm
brcmsmac: brcms_bcma_probe: brcms_attach failed!

And iwconfig shows no wireless extensions.

John