Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
SlideShare a Scribd company logo
Allwinner Kernel
Upstreaming Experiences
Chen-Yu Tsai (wens) 蔡鎮宇
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
Current Status
Let’s look at some ARM SoC vendors
2015/8/25 5
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
• Headless server w/ MMC/SATA/USB storage
• I2C & SPI
• LCD/HDMI/VGA display w/ simplefb
• Audio WIP
2015/8/25 7
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
Where to start
2015/8/25 13
Getting it to boot
• Machine definition (arch/arm/mach-*)
• Basic DTS
• UART
2015/8/25 14
Infrastructure
• Clocks
• Pinctrl
• Reusable
2015/8/25 15
Peripherals
• Storage
• MMC
• SATA
• USB
• PMIC
• I2C
• SPI
• …
• Common vs custom IP?
2015/8/25 16
Tips
The kernel is very big and moves very fast
2015/8/25 17
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
What to expect
Not getting merged is not the end of the world
2015/8/25 21
Code issues
• Code style
• Indentation
• Comments
• Error path
• Bugs
• Resource leak?
2015/8/25 22
NACK
• Wrong design
• Ex: rfkill dt support
• Deprecated functions
• Ex: platform_data
• Occasional disagreement
• “simplefb: add clock handling code”
2015/8/25 23
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
New SoC bringup
2015/8/25 26
New SoC
1. Getting it to Boot
• Machine definition (arch/arm/mach-*)
• Basic DTS
• UART
2. Clocks / Pinctrl
3. Peripherals
• IP blocks don’t often change
• Existing drivers should work
• Quite satisfying!
2015/8/25 27
Supporting new boards
2015/8/25 28
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
Priorities
2015/8/25 30
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
Difficulties
2015/8/25 33
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
Binary drivers
• Third-party IP vendors
• GPUs
• VPUs
• …
• NDAs
2015/8/25 36
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
Questions?
2015/8/25 38

More Related Content

Allwinner Kernel Upstreaming Experiences

  • 2. 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
  • 3. Disclaimer I have only done Allwinner/sunxi related stuff. Linux-sunxi is community/volunteer based. Your mileage may vary. 2015/8/25 3
  • 4. Outline • Current Status • Where to start • Tips • What to expect • New SoC bringup • Supporting new boards • Priorities • Difficulties 2015/8/25 4
  • 5. Current Status Let’s look at some ARM SoC vendors 2015/8/25 5
  • 6. 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
  • 7. Allwinner • Headless server w/ MMC/SATA/USB storage • I2C & SPI • LCD/HDMI/VGA display w/ simplefb • Audio WIP 2015/8/25 7
  • 8. 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
  • 9. 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
  • 10. 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
  • 11. Mediatek • Basics (machine, clk, pinctrl , uart) • Drivers for • I2C, SPI, MMC, PMIC, Audio • Not seen in DTS yet 2015/8/25 11
  • 12. 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
  • 14. Getting it to boot • Machine definition (arch/arm/mach-*) • Basic DTS • UART 2015/8/25 14
  • 16. Peripherals • Storage • MMC • SATA • USB • PMIC • I2C • SPI • … • Common vs custom IP? 2015/8/25 16
  • 17. Tips The kernel is very big and moves very fast 2015/8/25 17
  • 18. 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
  • 19. 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
  • 20. 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
  • 21. What to expect Not getting merged is not the end of the world 2015/8/25 21
  • 22. Code issues • Code style • Indentation • Comments • Error path • Bugs • Resource leak? 2015/8/25 22
  • 23. NACK • Wrong design • Ex: rfkill dt support • Deprecated functions • Ex: platform_data • Occasional disagreement • “simplefb: add clock handling code” 2015/8/25 23
  • 24. 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
  • 25. 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
  • 27. New SoC 1. Getting it to Boot • Machine definition (arch/arm/mach-*) • Basic DTS • UART 2. Clocks / Pinctrl 3. Peripherals • IP blocks don’t often change • Existing drivers should work • Quite satisfying! 2015/8/25 27
  • 29. 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
  • 31. 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
  • 32. 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
  • 34. 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
  • 35. 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
  • 36. Binary drivers • Third-party IP vendors • GPUs • VPUs • … • NDAs 2015/8/25 36
  • 37. 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