Help needed for integration with buildroot


#1

I’d like to add this to a project I’m building with Nerves (nerves-project.org) which uses buildroot. Is there a step by step list of instructions to add support for the IoT hat for Linux distros that don’t ship with out of the box support?

Specifically I need:

  • kernel modules to include
  • overlay(s) to include
  • cmdline.txt and config.txt changes to make

I can try to track this down myself from disparate areas on the site, but I don’t yet have a mental model of the sequence of events that happen on startup to load support. Nudges in the right direction would definitely help :smiley:

There are multiple people asking about support for this, so if I could get it working I think there would be a few other customers coming your way :slight_smile:

Thanks in advance for any help you can send my way!

-Tim


#2

From my initial observation, adding the hat includes the following changes:

When the Raspbian kernel boots, the kernel command line adds
8250.nr_uarts=0

and changes
console=ttyAMA0,115200
to
console=ttyS0,115200

Further dmesg additions:
mmc-bcm2835 20300000.mmc: mmc_debug:0 mmc_debug2:0 mmc-bcm2835 20300000.mmc: DMA channel allocated ... mmc1: queuing unknown CIS tuple 0x80 (7 bytes) usb 1-1: new full-speed USB device number 2 using dwc_otg Indeed it is in host mode hprt0 = 00021501 mmc1: new high speed SDIO card at address 0001 ... usbcore: registered new interface driver brcmfmac random: nonblocking pool is initialized brcmfmac: brcmf_c_preinit_dcmds: Firmware version = wl0: May 27 2016 00:13:38 version 7.45.41.26 (r640327) FWID 01-df77e4a7 brcmfmac: brcmf_cfg80211_reg_notifier: not a ISO3166 code ... brcmfmac: brcmf_cfg80211_reg_notifier: not a ISO3166 code cfg80211: World regulatory domain updated: cfg80211: DFS Master region: unset cfg80211: (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp), (dfs_cac_time) cfg80211: (2402000 KHz - 2472000 KHz @ 40000 KHz), (N/A, 2000 mBm), (N/A) cfg80211: (2457000 KHz - 2482000 KHz @ 40000 KHz), (N/A, 2000 mBm), (N/A) cfg80211: (2474000 KHz - 2494000 KHz @ 20000 KHz), (N/A, 2000 mBm), (N/A) cfg80211: (5170000 KHz - 5250000 KHz @ 80000 KHz, 160000 KHz AUTO), (N/A, 2000 mBm), (N/A) cfg80211: (5250000 KHz - 5330000 KHz @ 80000 KHz, 160000 KHz AUTO), (N/A, 2000 mBm), (0 s) cfg80211: (5490000 KHz - 5730000 KHz @ 160000 KHz), (N/A, 2000 mBm), (0 s) cfg80211: (5735000 KHz - 5835000 KHz @ 80000 KHz), (N/A, 2000 mBm), (N/A) cfg80211: (57240000 KHz - 63720000 KHz @ 2160000 KHz), (N/A, 0 mBm), (N/A) brcmfmac: brcmf_add_if: ERROR: netdev:wlan0 already exists brcmfmac: brcmf_add_if: ignore IF event IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready brcmfmac: power management disabled brcmfmac: power management disabled uart-pl011 20201000.uart: no DMA platform data ... Bluetooth: Core ver 2.21 NET: Registered protocol family 31 Bluetooth: HCI device and connection manager initialized Bluetooth: HCI socket layer initialized Bluetooth: L2CAP socket layer initialized Bluetooth: SCO socket layer initialized Bluetooth: HCI UART driver ver 2.3 Bluetooth: HCI UART protocol H4 registered Bluetooth: HCI UART protocol Three-wire (H5) registered Bluetooth: HCI UART protocol BCM registered Bluetooth: hci0 command 0x1003 tx timeout Bluetooth: hci0 command 0x1001 tx timeout Bluetooth: hci0 command 0x1009 tx timeout Bluetooth: BNEP (Ethernet Emulation) ver 1.3 Bluetooth: BNEP filters: protocol multicast Bluetooth: BNEP socket layer initialized


#3

Ok, so the onboard eeprom contains the overlay information automatically and I don’t think I have to specifically enable anything there. My buildroot dmesg output doesn’t have the mmc1 lines even though I have the 2835 DMA and MMC support compiled in to the kernel. Is there something else that triggers correct behavior? I made the cmdline.txt changes I noted above.


#4

Here’s what I know. I confirmed that cmdline has 8250.nr_uarts=0, the console is set to ttyS0, and that there is a /proc/device-tree/soc/iothat. My linux kernel has

CONFIG_BRCMFMAC=m
CONFIG_BRCMFMAC_USB=y

What else do I need to see the mmc1 sdio output in dmesg? Is there a file or files I need in /lib/firmware? I’m pretty stuck.


#5

For posterity, the magic lies in setting the following kernel config params:

CONFIG_POWER_SUPPLY=y
CONFIG_POWER_RESET=y
CONFIG_POWER_RESET_GPIO=y
CONFIG_BRCMFMAC=y

I’m not sure why that’s it, but many thanks go to the pinn project for this commit: https://github.com/procount/pinn/commit/220780de3286e8750200af44229dc5b5fe17621d