serial: clk: bcm2835: Strange effects when using aux-uart in console

Martin Sperl kernel at martin.sperl.org
Sat Feb 13 03:53:26 PST 2016


> On 13.02.2016, at 11:01, Stefan Wahren <stefan.wahren at i2se.com> wrote:
> diff --git a/drivers/clk/bcm/clk-bcm2835.c b/drivers/clk/bcm/clk-bcm2835.c
> index 637f8ae..03d95c1 100644
> --- a/drivers/clk/bcm/clk-bcm2835.c
> +++ b/drivers/clk/bcm/clk-bcm2835.c
> @@ -1638,6 +1675,9 @@ static int bcm2835_clock_set_rate(struct clk_hw *hw,
> 	enum bcm2835_clock_mash_type mash = divmash_get_mash(dm);
> 	u32 ctl;
> 
> +	if (cprman_read(cprman, data->ctl_reg) & CM_BUSY)
> +		pr_warn("%s: clk still busy from %d\n", __func__, cprman->func_code);
> +
> 	spin_lock(&cprman->regs_lock);
> 
> 	/* if div and mash are identical, then there is nothing to do */
> @@ -1663,6 +1703,11 @@ static int bcm2835_clock_set_rate(struct clk_hw *hw,
> unlock_exit:
> 	spin_unlock(&cprman->regs_lock);
> 
> +	cprman->func_code = 10;
> +
> +	if (cprman_read(cprman, data->ctl_reg) & CM_BUSY)
> +		pr_warn("%s: clk now busy from %d\n", __func__, cprman->func_code);
> +
> 	return 0;
> }
> 

Seems as if you apply it on top of (parts of) my patchset - not on top of a 
clean 4.5-rc3.

Anyway - after some fixing I get the following outputs -
the amba-pl011 driver is still patched with debug messages:

After boot with aux-uart as tty:
root at raspcm:~# dmesg  | grep bcm2835
[    0.018172] bcm2835: system timer (irq = 27)
[    0.711388] bcm2835-aux-uart 20215040.serial: could not get clk: -517
[    1.649124] bcm2835-rng 20104000.rng: hwrng registered
[    2.051190] bcm2835_clock_on: clk still busy from 6
[    2.056159] bcm2835_clock_on: clk now busy from 9
[    8.062743] bcm2835-wdt 20100000.watchdog: Broadcom BCM2835 watchdog timer
[   12.042105] bcm2835-i2s 20203000.i2s: can't request region for resource [mem 0x20101098-0x20101099]
[   12.191701] bcm2835-i2s: probe of 20203000.i2s failed with error -16

Loading the module:
root at raspcm:~# modprobe amba-pl011
[  106.685812] Serial: AMBA PL011 UART driver
[  106.693702] uart-pl011 20201000.uart: pl011_setup_port: f0201000 20201000
[  106.702109] 20201000.uart: ttyAMA0 at MMIO 0x20201000 (irq = 81, base_baud = 0) is a PL011 rev2
root at raspcm:~#

and starting getty:
root at raspcm:~# /sbin/getty -a root -L ttyAMA0 115200 vt100
[  137.851123] pl011_startup - start
[  137.854538] pl011_hwinit - prepare-enable
[  137.858772] bcm2835_clock_on: clk still busy from 6
[  137.863755] bcm2835_clock_on: clk now busy from 9
[  137.868590] pl011_hwinit - prepare-enable - ret = 0
[  137.875249] uart-pl011 20201000.uart: no DMA platform data
[  137.880940] pl011_startup - exit
[  137.888840] pl011_shutdown - start
[  137.892360] pl011_shutdown - disable_unprepare
[  137.896933] bcm2835_clock_off: clk still busy from 9
[  137.902112] pl011_shutdown - exit
[  137.907233] pl011_startup - start
[  137.910713] pl011_hwinit - prepare-enable
[  137.914808] bcm2835_pll_on: PLL still locked from 1
[  138.019876] bcm2835-clk 20101000.cprman: plld: couldn't lock PLL
[  138.026000] pl011_hwinit - prepare-enable - ret = -110
[  138.031266] pl011_startup - error = -110 - disable_unprepare
[  138.037048] ------------[ cut here ]------------
[  138.041777] WARNING: CPU: 0 PID: 2377 at drivers/clk/clk.c:680 clk_core_disable+0x34/0xf0()
[  138.051063] ---[ end trace dd2f225b2af4c32c ]---
[  138.055859] ------------[ cut here ]------------
[  138.060627] WARNING: CPU: 0 PID: 2377 at drivers/clk/clk.c:575 clk_core_unprepare+0x34/0x110()
[  138.070321] ---[ end trace dd2f225b2af4c32d ]---

No HDMI output - this time no “flashing” - just no signal.
Machine is crashed - the attached AXIS USB network card (0b95:772b)
just transmits identical packets on the network without stopping…

I have also disabled the DMA-engine in the amba-pl011 driver
(in the driver itself add: #undef CONFIG_DMA_ENGINE) and then I get:
root at raspcm:/build/linux# /sbin/getty -a root -L ttyAMA0 115200 vt100
[   97.010287] pl011_startup - start
[   97.013698] pl011_hwinit - prepare-enable
[   97.017931] bcm2835_clock_on: clk still busy from 6
[   97.022905] bcm2835_clock_on: clk now busy from 9
[   97.027755] pl011_hwinit - prepare-enable - ret = 0
[   97.034378] pl011_startup - exit
[   97.041197] pl011_shutdown - start
[   97.044728] pl011_shutdown - disable_unprepare
[   97.049386] bcm2835_clock_off: clk still busy from 9
[   97.054458] pl011_shutdown - exit
[   97.059633] pl011_startup - start
[   97.063033] pl011_hwinit - prepare-enable
[   97.067533] bcm2835_pll_on: PLL still locked from 1
[   97.172655] bcm2835-clk 20101000.cprman: plld: couldn't lock PLL
[   97.178838] pl011_hwinit - prepare-enable - ret = -110
[   97.184075] pl011_startup - error = -110 - disable_unprepare
[   97.189905] ------------[ cut here ]------------
[   97.194640] WARNING: CPU: 0 PID: 2442 at drivers/clk/clk.c:680 clk_core_disab
le+0x34/0xf0()
[   97.203924] ---[ end trace 3e878f70606eba69 ]---
[   97.208692] ------------[ cut here ]------------
[   97.213429] WARNING: CPU: 0 PID: 2442 at drivers/clk/clk.c:575 clk_core_unpre
pare+0x34/0x110()
[   97.223096] ---[ end trace 3e878f70606eba6a ]—

Not sure why the pl011 driver runs the startup/shutdown/startup
loop.

Martin







More information about the linux-arm-kernel mailing list