[Lenny400] Slightly later kernel/distro version

Paul Boddie paul at boddie.org.uk
Thu Aug 31 23:18:08 CEST 2017

On Monday 28. August 2017 16.57.34 H. Nikolaus Schaller wrote:
> Fine! I have looked into the patches and it appears that there is only
> a handful of areas that is patched. 256 files in roughly 15 areas.
> Main areas are as expected arch/mips/jz4730, drivers/char/jzchar, and
> some other drivers. As well as sound/oss. What I don't know is if
> whe need the jz4740 and jz4750 stuff at all.
> And for a modern 4.* kernel, we can probably use standard yaffs, ubifs
> without any jz specific patches.
> So it could suffice to make "modern" patches for ca. 10 areas...

I've been looking at David's work and have also been looking again at 
supporting the JZ4730 in the modern kernel. Since my last attempt at writing 
then-modern kernel support, I've done some work with other JZ47xx-series 
systems and have perhaps gained a bit more understanding.

Partly related to this other work, and to try and understand how the JZ4730 
does things, I introduced some reorganised code to the 2.6.x kernel 
principally for CPM (clock and power management) and GPIO (general purpose 
input/output) support, also tidying up the way the code supported different 
display panels, and updating the keypad driver to test the GPIO support. Since 
I didn't seem to break anything, I felt that I must now understand the 
hardware a bit more.

So, I have more recently been writing drivers and things for the linux-stable 
branch (4.13-rc5 or so). The JZ4740 maintainers have mostly laid the 
foundations, although there are some areas where the functionality differs 
enough that it requires some careful reimplementation or adjustment...

The relationship between clocks, PLLs and peripherals is different, meaning 
that a special CGU driver is required. I did see something odd about the 
JZ4740 support, but I haven't managed to follow up with the MIPS developers 
about this.

The JZ4730 has dedicated PWM peripherals, meaning that the TCU-based JZ4740 
driver cannot be used and a separate one needs to be introduced.

Also, the JZ4730 doesn't have a TCU (timer/counter unit) but an OST (operating 
system timer) instead, so the timer support needs providing in a different 

The GPIO management is different on the JZ4730. This was something I attempted 
to tackle before, but I have mostly verified my understanding now, and so 
JZ4730 support needs to be introduced to both the GPIO and pinctrl drivers.

It seems possible that a special keypad driver is no longer needed in the 
modern kernel because a generic GPIO keypad driver can be used. The data 
structures for the keypad need changing slightly to work with this. I don't 
know how things like Num Lock and Caps Lock are supported in this arrangement, 

Board initialisation needs changing to work with the modern kernel. This 
mostly seems to involve choosing the appropriate devices and wiring them up 

Device tree definitions are also needed for the JZ4730 and the Minibook.

So far, I have made an attempt to implement all of the above: CGU, PWM, timer, 
GPIO, board and device tree functionality. Remaining things in approximate 
order of descending necessity are likely to be watchdog timer, RTC, 
LCD/framebuffer, MMC, generic DMA (maybe used by the MMC support), I2C, USB, 
sound and NAND functionality.

Without getting as far as LCD/framebuffer support and maybe MMC, I'm doubting 
that I can really test this at the moment. But I wonder if anyone else is 
interested in seeing what I've done and maybe pointing out errors in the way 
I've done some things.


More information about the Lenny400 mailing list