kernel: work-in-progress

XXX: Code is a bit out of control and doesn't work (segfaults). I originally
thought I'd just have to write to a couple of registers. There were some
additional setup steps that I didn't foresee and the amount of code has
grown a lot.

Tasks:

 - refactor most of these changes into userspace drivers.
 work on this is in progress.

Change-Id: Id7b9f77f5ab5fa8d1ead6d0f0ab7dd0762e5939e