Chen-Yu Tsai 蔡鎮宇
• Software Engineer @ CloudMosa
• Puffin Web Browser
• Totally not embedded Linux related
• Linux-sunxi community hobbyist
• Contributions to U-boot and Linux
• git log --oneline --author “Chen-Yu Tsai”
• Translations
2015/8/25 2
Disclaimer
I have only done Allwinner/sunxi related stuff.
Linux-sunxi is community/volunteer based.
Your mileage may vary.
2015/8/25 3
Outline
• Current Status
• Where to start
• Tips
• What to expect
• New SoC bringup
• Supporting new boards
• Priorities
• Difficulties
2015/8/25 4
linux-sunxi?
• Cheap hardware
• Development boards
• Documents and SDKs available
• Given by hardware vendors
• Allwinner now provides them on github
• https://github.com/allwinner-zh/
2015/8/25 6
Allwinner
• Community driven
• git lo --no-merges --perl-regexp --grep
'sunxi|sun[0-9]i' | grep -v m68k | wc –l
• 1118
• Extremely active
• Allwinner supplies documents and their source code
• Answers questions
2015/8/25 8
Rockchip
• Basically a fully working system
• MMC/USB
• I2C & SPI
• Full KMS display support
• I2S & audio codecs
• Chromebook based on mainline kernel + dts
• IP blocks mostly from ARM or Synopsys
2015/8/25 9
Rockchip
• Hobbyist maintainer
• git lo --author 'Heiko Stuebner' | wc -l
• 158
• filtered out Samsung related
• Official support
• git lo --author @rock-chips.com | wc -l
• 169
2015/8/25 10
Mediatek
• Basics (machine, clk, pinctrl , uart)
• Drivers for
• I2C, SPI, MMC, PMIC, Audio
• Not seen in DTS yet
2015/8/25 11
Mediatek
• Outside maintainer
• git lo --author 'Matthias Brugger' | wc -l
• 53
• Since 2014/7/22
• Official support
• git lo --author @mediatek.com | wc -l
• 122
• Since 2014/11/4
2015/8/25 12
Start small
• Is it a known, supported IP block?
• Only standard resources?
• MMIO, IRQ, clocks, resets
• Ex: USB host
• Hardware glue? Quirks?
• Is the core supported?
• Is it a library?
• Write a glue driver
• Modify / port
• Ex: SATA AHCI, STMMAC
2015/8/25 18
Start simple
• Clocks can be done one at a time
• Driver describes clock controls
• Driver or DTS describes relationship between clocks
• Both methods are used
• Pinctrl / GPIO
• Transcribe datasheets
2015/8/25 19
Look around and Ask
• Subscribe to mailing lists
• Look at how other contributors write code
• Learn what reviewers ask for
• Look at how other platforms do it
• mediatek pinctrl driver is very similar to sunxi
• Documentation is sometimes lacking
• When in doubt, ask
• Release often
• No one is going to review unsent code
2015/8/25 20
Maintainers are busy
• Sometimes you don’t get feedback
• Maintainers often write code as well
• Lots of mailing list traffic
• Ping or resend
2015/8/25 24
Didn’t get your patches in
this release?
• You can do better
• Write better code
• Respond to reviewers
• Keep working
• Release cycle is predictable
• Sometimes it’s not your fault
• Maintainer missed your patch or pull request
• It happens
• Maintainer went on vacation
• Maintainer missing (?)
2015/8/25 25
Supporting new boards
• Need schematics or hardware description
• What peripherals are connected to the board?
• What external ICs are there?
• PMICs, audio codecs, sensors, storage…
• Extra GPIOs?
• LEDs
• Write a .dts file
• Test that everything works
• Fairly easy!
2015/8/25 29
Paid work
• Not really much say
• Getting products shipped is all that matters
• Still
• You should try
• What benefits the most platforms / boards?
• Must have vs. want?
• MMC vs USB vs audio
2015/8/25 31
Community hackers
• Expertise / prior experience
• Did clocks before, do it again
• Interest
• Me: I want WiFi! I want SMP!
• Low hanging fruit
• Me: Network is DWMAC based, only need glue code
• Popular demand
• DMA engine
• Audio
2015/8/25 32
Documents
• NDA?
• Incorrect
• How do you know it’s incorrect?
• Missing sections
• Completely non-existent
• No board schematics
• Should you risk it going up in smoke?
2015/8/25 34
Porting vendor code
• Is often bad
• Because of time to market concerns
• Quite old
• Android kernel still at 3.4?
• Custom frameworks
• Obsoleted by common frameworks
• Clocks, resets, pinctrl, gpio, PHY, regmap, …
• Binary blobs
• No source code
2015/8/25 35
GPL violations
• There shouldn’t be binary-only blobs in the kernel
• http://linux-sunxi.org/GPL_Violations
• http://www.xda-developers.com/have-you-paid-
your-linux-kernel-source-license-fee/
2015/8/25 37