[Lenny400] Slightly later kernel/distro version

H. Nikolaus Schaller hns at goldelico.com
Fri Sep 1 10:51:07 CEST 2017

Hi Paul,

> Am 31.08.2017 um 23:18 schrieb Paul Boddie <paul at boddie.org.uk>:
> 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,

that is what I would expect.

> although there are some areas where the functionality differs 
> enough that it requires some careful reimplementation or adjustment...

The SoC are not the same but cousins and share a lot of things.

> 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.

Ok, but IMHO PWM is not on highest priority.

> 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 
> way.


> 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.

GPIO and Pinmux this seems to be one of the most essential components besides
Clock & Power & Reset managers. With that it should be possible to see a little
more than Starting kernel ...

Another significant component is MMU. Or is this already done by the MIPS core code?

> 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, 
> however.

Yes, the modern matrix driver should be good enough:


And if not, we could still write our own on top of the gpio library functions
of modern kernels.

I think Num Lock and Caps Lock are to be handled by user-space (X11). The kernel
events only tell that the key was pressed/released.

> Board initialisation needs changing to work with the modern kernel. This 
> mostly seems to involve choosing the appropriate devices and wiring them up 
> correctly.
> Device tree definitions are also needed for the JZ4730 and the Minibook.

I have started something a little - but it is quite empty and probably wrong:



This is an area where I probably can help a lot.

> So far, I have made an attempt to implement all of the above: CGU, PWM, timer, 
> GPIO, board and device tree functionality.

Yes, this is necessary to see it booting (maybe PWM isn't needed here).
Ah, and we need UART for console log (and potentially login:).

> 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.

I'd see this priorities (DMA whenever we really need it):
* UART console
* MMC (to be able to run a rootfs)
* I2C to be able to access RTC and PMU
* USB to have more peripherals and external memory expansion
* LCD to see something and run X11
* Keyboard (gpio-matrix based)
* LED drivers (AFAIR some gpios)
* sound

> 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.

Yes, please share for discussion.

BR and thanks,

More information about the Lenny400 mailing list