mbox series

[RFC,RFT,0/4] ARM: OMAP1: clock: Convert to CCF

Message ID 20220310233307.99220-1-jmkrzyszt@gmail.com
Headers show
Series ARM: OMAP1: clock: Convert to CCF | expand

Message

Janusz Krzysztofik March 10, 2022, 11:33 p.m. UTC
The main motivation behind this series is planned resurection of OMAP1
camera driver.  Since OMAP1 clock internals have never been visible to
drivers, that driver used to use v4l2-clk to expose a pixel clock for a
sensor.  The v4l2-clk code has been recently depreciated and removed from
the media subtree, hence the need for an alternative solution.

Janusz Krzysztofik (4):
  ARM: OMAP1: clock: Remove unused code
  ARM: OMAP1: clock: Remove noop code
  ARM: OMAP1: Prepare for conversion of OMAP1 clocks to CCF
  ARM: OMAP1: clock: Convert to CCF

 arch/arm/Kconfig                 |   2 +-
 arch/arm/mach-omap1/clock.c      | 791 ++++++++++++-------------------
 arch/arm/mach-omap1/clock.h      | 191 ++------
 arch/arm/mach-omap1/clock_data.c | 491 ++++++++-----------
 arch/arm/mach-omap1/io.c         |   5 -
 arch/arm/mach-omap1/mcbsp.c      |   8 +-
 arch/arm/mach-omap1/ocpi.c       |   4 +-
 arch/arm/mach-omap1/serial.c     |   6 +-
 arch/arm/mach-omap1/time.c       |   5 +
 arch/arm/mach-omap1/timer32k.c   |   2 +-
 drivers/usb/host/ohci-omap.c     |   8 +-
 drivers/video/fbdev/omap/lcdc.c  |   6 +-
 12 files changed, 582 insertions(+), 937 deletions(-)

The series has been tested on OMAP1510 based Amstrad Delta board,
where it works best on top of two recently submitted fixes:
ARM: OMAP1: clock: Fix early UART rate issues
ARM: OMAP1: clock: Fix UART rate reporting algorithm

Comments

Tony Lindgren March 12, 2022, 8:14 a.m. UTC | #1
* Janusz Krzysztofik <jmkrzyszt@gmail.com> [220310 23:32]:
> The main motivation behind this series is planned resurection of OMAP1
> camera driver.  Since OMAP1 clock internals have never been visible to
> drivers, that driver used to use v4l2-clk to expose a pixel clock for a
> sensor.  The v4l2-clk code has been recently depreciated and removed from
> the media subtree, hence the need for an alternative solution.

Nice :) This will also help Arnd with building multi-v5 kernels.

Regards,

Tony
Aaro Koskinen March 19, 2022, 6:49 p.m. UTC | #2
Hi,

On Sat, Mar 12, 2022 at 10:14:31AM +0200, Tony Lindgren wrote:
> * Janusz Krzysztofik <jmkrzyszt@gmail.com> [220310 23:32]:
> > The main motivation behind this series is planned resurection of OMAP1
> > camera driver.  Since OMAP1 clock internals have never been visible to
> > drivers, that driver used to use v4l2-clk to expose a pixel clock for a
> > sensor.  The v4l2-clk code has been recently depreciated and removed from
> > the media subtree, hence the need for an alternative solution.
> 
> Nice :) This will also help Arnd with building multi-v5 kernels.

This will need more testing still... The patch 4 is breaking at least 770
(the display/fb doesn't work anymore).

A.
Aaro Koskinen March 19, 2022, 9:21 p.m. UTC | #3
Hi,

On Sat, Mar 19, 2022 at 08:49:55PM +0200, Aaro Koskinen wrote:
> On Sat, Mar 12, 2022 at 10:14:31AM +0200, Tony Lindgren wrote:
> > * Janusz Krzysztofik <jmkrzyszt@gmail.com> [220310 23:32]:
> > > The main motivation behind this series is planned resurection of OMAP1
> > > camera driver.  Since OMAP1 clock internals have never been visible to
> > > drivers, that driver used to use v4l2-clk to expose a pixel clock for a
> > > sensor.  The v4l2-clk code has been recently depreciated and removed from
> > > the media subtree, hence the need for an alternative solution.
> > 
> > Nice :) This will also help Arnd with building multi-v5 kernels.
> 
> This will need more testing still... The patch 4 is breaking at least 770
> (the display/fb doesn't work anymore).

Patches 1-3 are OK on Nokia 770, OSK and Palm TE.

Patch 4 breaks 770, but OSK and Palm TE are OK.

Below is the problem with 770. As a quick hack, I tried replacing
all clk_enable/disable()s with prepare_enable/disable_unprepare()s in
drivers/video/fbdev/omap/hwa742.c and drivers/video/fbdev/omap/sossi.c
and that seems to help...

[    0.374389] omapfb: lph8923 rev 92 LCD detected, 16 data lines
[    0.374816] omapfb: configured for panel lph8923
[    0.383789] omapfb: LCDC initialized
[    0.384216] ------------[ cut here ]------------
[    0.384368] WARNING: CPU: 0 PID: 1 at drivers/clk/clk.c:1012 clk_core_enable+0x94/0xb0
[    0.384613] Enabling unprepared ck_sossi
[    0.384704] Modules linked in:
[    0.384796] CPU: 0 PID: 1 Comm: swapper Not tainted 5.17.0-rc8-770-los_381206+-00072-gb2406fc1ddd4 #2
[    0.385009] Hardware name: Nokia 770
[    0.385101]  unwind_backtrace from show_stack+0x10/0x14
[    0.385314]  show_stack from __warn+0xac/0xe4
[    0.385528]  __warn from warn_slowpath_fmt+0x90/0xc8
[    0.385711]  warn_slowpath_fmt from clk_core_enable+0x94/0xb0
[    0.385894]  clk_core_enable from clk_core_enable_lock+0x18/0x2c
[    0.386077]  clk_core_enable_lock from sossi_init+0xa0/0x258
[    0.386260]  sossi_init from hwa742_init+0x90/0x538
[    0.386474]  hwa742_init from omapfb_do_probe+0x200/0x68c
[    0.386657]  omapfb_do_probe from mipid_spi_probe+0x1b4/0x230
[    0.386840]  mipid_spi_probe from spi_probe+0x48/0x6c
[    0.387054]  spi_probe from really_probe+0xac/0x2f0
[    0.387237]  really_probe from __driver_probe_device+0x80/0xe4
[    0.387390]  __driver_probe_device from driver_probe_device+0x30/0xd8
[    0.387573]  driver_probe_device from __driver_attach+0x70/0xf0
[    0.387756]  __driver_attach from bus_for_each_dev+0x74/0xc0
[    0.387908]  bus_for_each_dev from bus_add_driver+0x14c/0x1d8
[    0.388061]  bus_add_driver from driver_register+0x74/0x108
[    0.388244]  driver_register from do_one_initcall+0x4c/0x1cc
[    0.388427]  do_one_initcall from kernel_init_freeable+0x170/0x1f4
[    0.388641]  kernel_init_freeable from kernel_init+0x10/0x108
[    0.388824]  kernel_init from ret_from_fork+0x14/0x2c
[    0.388977] Exception stack(0xc0c41fb0 to 0xc0c41ff8)
[    0.389099] 1fa0:                                     00000000 00000000 00000000 00000000
[    0.389282] 1fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[    0.389434] 1fe0: 00000000 00000000 00000000 00000000 00000013 00000000
[    0.389556] ---[ end trace 0000000000000000 ]---
[    0.389709] omapfb omapfb: invalid SoSSI sync pattern: 00000000, 00000000
[    0.389831] ------------[ cut here ]------------
[    0.389923] WARNING: CPU: 0 PID: 1 at drivers/clk/clk.c:953 clk_core_disable+0xb4/0xcc
[    0.390136] ck_sossi already disabled
[    0.390228] Modules linked in:
[    0.390319] CPU: 0 PID: 1 Comm: swapper Tainted: G        W         5.17.0-rc8-770-los_381206+-00072-gb2406fc1ddd4 #2
[    0.390502] Hardware name: Nokia 770
[    0.390594]  unwind_backtrace from show_stack+0x10/0x14
[    0.390808]  show_stack from __warn+0xac/0xe4
[    0.391021]  __warn from warn_slowpath_fmt+0x90/0xc8
[    0.391204]  warn_slowpath_fmt from clk_core_disable+0xb4/0xcc
[    0.391387]  clk_core_disable from clk_core_disable_lock+0x18/0x24
[    0.391540]  clk_core_disable_lock from sossi_init+0x1bc/0x258
[    0.391754]  sossi_init from hwa742_init+0x90/0x538
[    0.391937]  hwa742_init from omapfb_do_probe+0x200/0x68c
[    0.392120]  omapfb_do_probe from mipid_spi_probe+0x1b4/0x230
[    0.392333]  mipid_spi_probe from spi_probe+0x48/0x6c
[    0.392547]  spi_probe from really_probe+0xac/0x2f0
[    0.392730]  really_probe from __driver_probe_device+0x80/0xe4
[    0.392883]  __driver_probe_device from driver_probe_device+0x30/0xd8
[    0.393066]  driver_probe_device from __driver_attach+0x70/0xf0
[    0.393249]  __driver_attach from bus_for_each_dev+0x74/0xc0
[    0.393402]  bus_for_each_dev from bus_add_driver+0x14c/0x1d8
[    0.393585]  bus_add_driver from driver_register+0x74/0x108
[    0.393737]  driver_register from do_one_initcall+0x4c/0x1cc
[    0.393920]  do_one_initcall from kernel_init_freeable+0x170/0x1f4
[    0.394134]  kernel_init_freeable from kernel_init+0x10/0x108
[    0.394317]  kernel_init from ret_from_fork+0x14/0x2c
[    0.394470] Exception stack(0xc0c41fb0 to 0xc0c41ff8)
[    0.394592] 1fa0:                                     00000000 00000000 00000000 00000000
[    0.394775] 1fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[    0.394958] 1fe0: 00000000 00000000 00000000 00000000 00000013 00000000
[    0.395080] ---[ end trace 0000000000000000 ]---
[    0.417907] omapfb omapfb: controller initialization failed (-19)

A.
Janusz Krzysztofik March 20, 2022, 12:15 a.m. UTC | #4
Hi Aaro,

On Saturday, 19 March 2022 22:21:19 CET Aaro Koskinen wrote:
> Hi,
> 
> On Sat, Mar 19, 2022 at 08:49:55PM +0200, Aaro Koskinen wrote:
> > On Sat, Mar 12, 2022 at 10:14:31AM +0200, Tony Lindgren wrote:
> > > * Janusz Krzysztofik <jmkrzyszt@gmail.com> [220310 23:32]:
> > > > The main motivation behind this series is planned resurection of OMAP1
> > > > camera driver.  Since OMAP1 clock internals have never been visible to
> > > > drivers, that driver used to use v4l2-clk to expose a pixel clock for a
> > > > sensor.  The v4l2-clk code has been recently depreciated and removed from
> > > > the media subtree, hence the need for an alternative solution.
> > > 
> > > Nice :) This will also help Arnd with building multi-v5 kernels.
> > 
> > This will need more testing still... The patch 4 is breaking at least 770
> > (the display/fb doesn't work anymore).
> 
> Patches 1-3 are OK on Nokia 770, OSK and Palm TE.
> 
> Patch 4 breaks 770, but OSK and Palm TE are OK.
> 
> Below is the problem with 770. As a quick hack, I tried replacing
> all clk_enable/disable()s with prepare_enable/disable_unprepare()s in
> drivers/video/fbdev/omap/hwa742.c and drivers/video/fbdev/omap/sossi.c
> and that seems to help...
> 
> [    0.374389] omapfb: lph8923 rev 92 LCD detected, 16 data lines
> [    0.374816] omapfb: configured for panel lph8923
> [    0.383789] omapfb: LCDC initialized
> [    0.384216] ------------[ cut here ]------------
> [    0.384368] WARNING: CPU: 0 PID: 1 at drivers/clk/clk.c:1012 clk_core_enable+0x94/0xb0
> [    0.384613] Enabling unprepared ck_sossi

Yes, I've identified still a few drivers that need to be updated, I'll 
prepare v2 of PATCH 3/4 and resubmit.

Thanks,
Janusz

> [    0.384704] Modules linked in:
> [    0.384796] CPU: 0 PID: 1 Comm: swapper Not tainted 5.17.0-rc8-770-los_381206+-00072-gb2406fc1ddd4 #2
> [    0.385009] Hardware name: Nokia 770
> [    0.385101]  unwind_backtrace from show_stack+0x10/0x14
> [    0.385314]  show_stack from __warn+0xac/0xe4
> [    0.385528]  __warn from warn_slowpath_fmt+0x90/0xc8
> [    0.385711]  warn_slowpath_fmt from clk_core_enable+0x94/0xb0
> [    0.385894]  clk_core_enable from clk_core_enable_lock+0x18/0x2c
> [    0.386077]  clk_core_enable_lock from sossi_init+0xa0/0x258
> [    0.386260]  sossi_init from hwa742_init+0x90/0x538
> [    0.386474]  hwa742_init from omapfb_do_probe+0x200/0x68c
> [    0.386657]  omapfb_do_probe from mipid_spi_probe+0x1b4/0x230
> [    0.386840]  mipid_spi_probe from spi_probe+0x48/0x6c
> [    0.387054]  spi_probe from really_probe+0xac/0x2f0
> [    0.387237]  really_probe from __driver_probe_device+0x80/0xe4
> [    0.387390]  __driver_probe_device from driver_probe_device+0x30/0xd8
> [    0.387573]  driver_probe_device from __driver_attach+0x70/0xf0
> [    0.387756]  __driver_attach from bus_for_each_dev+0x74/0xc0
> [    0.387908]  bus_for_each_dev from bus_add_driver+0x14c/0x1d8
> [    0.388061]  bus_add_driver from driver_register+0x74/0x108
> [    0.388244]  driver_register from do_one_initcall+0x4c/0x1cc
> [    0.388427]  do_one_initcall from kernel_init_freeable+0x170/0x1f4
> [    0.388641]  kernel_init_freeable from kernel_init+0x10/0x108
> [    0.388824]  kernel_init from ret_from_fork+0x14/0x2c
> [    0.388977] Exception stack(0xc0c41fb0 to 0xc0c41ff8)
> [    0.389099] 1fa0:                                     00000000 00000000 00000000 00000000
> [    0.389282] 1fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
> [    0.389434] 1fe0: 00000000 00000000 00000000 00000000 00000013 00000000
> [    0.389556] ---[ end trace 0000000000000000 ]---
> [    0.389709] omapfb omapfb: invalid SoSSI sync pattern: 00000000, 00000000
> [    0.389831] ------------[ cut here ]------------
> [    0.389923] WARNING: CPU: 0 PID: 1 at drivers/clk/clk.c:953 clk_core_disable+0xb4/0xcc
> [    0.390136] ck_sossi already disabled
> [    0.390228] Modules linked in:
> [    0.390319] CPU: 0 PID: 1 Comm: swapper Tainted: G        W         5.17.0-rc8-770-los_381206+-00072-gb2406fc1ddd4 #2
> [    0.390502] Hardware name: Nokia 770
> [    0.390594]  unwind_backtrace from show_stack+0x10/0x14
> [    0.390808]  show_stack from __warn+0xac/0xe4
> [    0.391021]  __warn from warn_slowpath_fmt+0x90/0xc8
> [    0.391204]  warn_slowpath_fmt from clk_core_disable+0xb4/0xcc
> [    0.391387]  clk_core_disable from clk_core_disable_lock+0x18/0x24
> [    0.391540]  clk_core_disable_lock from sossi_init+0x1bc/0x258
> [    0.391754]  sossi_init from hwa742_init+0x90/0x538
> [    0.391937]  hwa742_init from omapfb_do_probe+0x200/0x68c
> [    0.392120]  omapfb_do_probe from mipid_spi_probe+0x1b4/0x230
> [    0.392333]  mipid_spi_probe from spi_probe+0x48/0x6c
> [    0.392547]  spi_probe from really_probe+0xac/0x2f0
> [    0.392730]  really_probe from __driver_probe_device+0x80/0xe4
> [    0.392883]  __driver_probe_device from driver_probe_device+0x30/0xd8
> [    0.393066]  driver_probe_device from __driver_attach+0x70/0xf0
> [    0.393249]  __driver_attach from bus_for_each_dev+0x74/0xc0
> [    0.393402]  bus_for_each_dev from bus_add_driver+0x14c/0x1d8
> [    0.393585]  bus_add_driver from driver_register+0x74/0x108
> [    0.393737]  driver_register from do_one_initcall+0x4c/0x1cc
> [    0.393920]  do_one_initcall from kernel_init_freeable+0x170/0x1f4
> [    0.394134]  kernel_init_freeable from kernel_init+0x10/0x108
> [    0.394317]  kernel_init from ret_from_fork+0x14/0x2c
> [    0.394470] Exception stack(0xc0c41fb0 to 0xc0c41ff8)
> [    0.394592] 1fa0:                                     00000000 00000000 00000000 00000000
> [    0.394775] 1fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
> [    0.394958] 1fe0: 00000000 00000000 00000000 00000000 00000013 00000000
> [    0.395080] ---[ end trace 0000000000000000 ]---
> [    0.417907] omapfb omapfb: controller initialization failed (-19)
> 
> A.
>
Arnd Bergmann March 21, 2022, 8:01 a.m. UTC | #5
On Sat, Mar 12, 2022 at 9:14 AM Tony Lindgren <tony@atomide.com> wrote:
>
> * Janusz Krzysztofik <jmkrzyszt@gmail.com> [220310 23:32]:
> > The main motivation behind this series is planned resurection of OMAP1
> > camera driver.  Since OMAP1 clock internals have never been visible to
> > drivers, that driver used to use v4l2-clk to expose a pixel clock for a
> > sensor.  The v4l2-clk code has been recently depreciated and removed from
> > the media subtree, hence the need for an alternative solution.
>
> Nice :) This will also help Arnd with building multi-v5 kernels.

Thanks for looping me in, I missed the thread originally but now
got the replies.

As OMAP1 is the last user of HAVE_LEGACY_CLK on Arm, converting
it would be particularly nice, and it allows me to dig out my omap1
multiplatform patches, which does get us closer to endgame.

The only other ARM9 platforms that are not multiplatform yet are
ep93xx (which can probably be done now as well after its
clk conversion) and s3c24xx (which is scheduled for removal next
year).

When those are out of the way, we only have StrongARM (rpc,
sa1100, footbridge) and XScale (pxa, ixp, iop) remaining.

      Arnd