Skip to content

sync: rvck #167: spacemit-k1: 使用社区主线内核的8250_of通用驱动替换K1的uart专用驱动#182

Merged
xmzzz merged 10 commits into
OLK-6.6from
sync/rvck-pr-167
Apr 8, 2026
Merged

sync: rvck #167: spacemit-k1: 使用社区主线内核的8250_of通用驱动替换K1的uart专用驱动#182
xmzzz merged 10 commits into
OLK-6.6from
sync/rvck-pr-167

Conversation

@xmzzz
Copy link
Copy Markdown
Contributor

@xmzzz xmzzz commented Apr 8, 2026

Sync commits from rvck PR #167.

Source PR: RVCK-Project/rvck#167

Commits

  • 89a7fe028f51 serial: 8250_of: Use dev_err_probe() instead of dev_warn()
  • 7cbc4e25d9de serial: 8250_of: Use devm_clk_get_enabled()
  • ab798f878589 serial: 8250_of: Drop quirk fot NPCM from 8250_port
  • 6a02fa9c5260 serial: 8250_of: Switch to use uart_read_port_properties()
  • 36adcf8be6ea serial: 8250_of: Add clock_notifier
  • cd047f3762d8 serial: 8250_of: Remove unneeded ->iotype assignment
  • 650b7674e4c6 serial: 8250_of: add support for an optional bus clock
  • 7833d1482330 serial: 8250_of: manage bus clock in suspend/resume
  • 1f53b73360f0 serial: k1: remove k1 uart driver
  • f2188da32428 riscv: k1: dts: change uart driver to 8250_of with compaible 'intel,xscale-uart'

andy-shev and others added 10 commits April 8, 2026 15:14
mainline inclusion
from mainline-v6.7
commit 4678de73932f8f3b835ff3cda76825ed53d4f6b7
category: feature
bugzilla: RVCK-Project/rvck#166

--------------------------------

The probe process may generate EPROBE_DEFER. In this case
dev_err_probe() can still record err information. Otherwise
it may pollute logs on that occasion.

This also helps simplifing code and standardizing the error output.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20230912165607.402580-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Zhang Meng <zhangmeng.kevin@spacemit.com>
Signed-off-by: Mingzheng Xing <xingmingzheng@iscas.ac.cn>
(cherry picked from commit 89a7fe0)
mainline inclusion
from mainline-v6.7
commit 8b2a8c45feae254bebaa65bb875db9107a4dcd39
category: feature
bugzilla: RVCK-Project/rvck#166

--------------------------------

Use devm_clk_get_enabled() to simplify the code.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Andi Shyti <andi.shyti@linux.intel.com>
Link: https://lore.kernel.org/r/20230919195519.3197963-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Zhang Meng <zhangmeng.kevin@spacemit.com>
Signed-off-by: Mingzheng Xing <xingmingzheng@iscas.ac.cn>
(cherry picked from commit 7cbc4e2)
mainline inclusion
from mainline-v6.9
commit cd0eb354d441488feed6685adbeb1acd45db1b8d
category: feature
bugzilla: RVCK-Project/rvck#166

--------------------------------

We are not supposed to spread quirks in 8250_port module especially
when we have a separate driver for the hardware in question.

Move quirk from generic module to the driver that uses it.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Link: https://lore.kernel.org/r/20240215145029.581389-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Zhang Meng <zhangmeng.kevin@spacemit.com>
Signed-off-by: Mingzheng Xing <xingmingzheng@iscas.ac.cn>
(cherry picked from commit ab798f8)
mainline inclusion
from mainline-v6.9
commit 1117a6fdc7c14d6fa336cf135e81e716d20d11c1
category: feature
bugzilla: RVCK-Project/rvck#166

--------------------------------

Since we have now a common helper to read port properties
use it instead of sparse home grown solution.

Reviewed-by: Andi Shyti <andi.shyti@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
Tested-by: Florian Fainelli <florian.fainelli@broadcom.com>
Link: https://lore.kernel.org/r/20240304123035.758700-11-andriy.shevchenko@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Zhang Meng <zhangmeng.kevin@spacemit.com>
Signed-off-by: Mingzheng Xing <xingmingzheng@iscas.ac.cn>
(cherry picked from commit 6a02fa9)
mainline inclusion
from mainline-v6.10
commit 32f6ec282fb0ddb45da1a19145ef9eeef088968d
category: feature
bugzilla: RVCK-Project/rvck#166

--------------------------------

The UART's input clock rate can change at runtime but this is not
handled by the driver.

Add a clock_notifier callback that updates the divisors when the input
clock is updated. The serial8250_update_uartclk() is used to do so.
PRE_RATE_CHANGE and ABORT_RATE_CHANGE notifications are ignored, only
the POST_RATE_CHANGE is used. Not using PRE_RATE_CHANGE notification can
result in a few corrupted bytes during frequency transitions but, IMHO,
it can be acceptable in many use cases.

It has been tested on a DAVINCI/OMAP-L138 processor.

Signed-off-by: Bastien Curutchet <bastien.curutchet@bootlin.com>
Reviewed-by: Herve Codina <herve.codina@bootlin.com>
Link: https://lore.kernel.org/r/20240405120552.35991-1-bastien.curutchet@bootlin.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Zhang Meng <zhangmeng.kevin@spacemit.com>
Signed-off-by: Mingzheng Xing <xingmingzheng@iscas.ac.cn>
(cherry picked from commit 36adcf8)
mainline inclusion
from mainline-v6.10
commit fe310f75327edbc042c7cc0df32c6b9ec29eb93a
category: feature
bugzilla: RVCK-Project/rvck#166

--------------------------------

If ->iobase is set the default will be UPIO_PORT for ->iotype after
the uart_read_and_validate_port_properties() call. Hence no need
to assign that explicitly.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20250124161530.398361-5-andriy.shevchenko@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Zhang Meng <zhangmeng.kevin@spacemit.com>
Signed-off-by: Mingzheng Xing <xingmingzheng@iscas.ac.cn>
(cherry picked from commit cd047f3)
mainline inclusion
from mainline-v6.16
commit 81e4de4ba298d73fce72c70eddeb86b151640c27
category: feature
bugzilla: RVCK-Project/rvck#166

--------------------------------

The SpacemiT UART requires a bus clock to be enabled, in addition to
it's "normal" core clock.  Look up the optional bus clock by name,
and if that's found, look up the core clock using the name "core".

Supplying a bus clock is optional.  If no bus clock is needed, the
the first/only clock is used for the core clock.

Signed-off-by: Alex Elder <elder@riscstar.com>
Link: https://lore.kernel.org/r/20250409192213.1130181-3-elder@riscstar.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Zhang Meng <zhangmeng.kevin@spacemit.com>
Signed-off-by: Mingzheng Xing <xingmingzheng@iscas.ac.cn>
(cherry picked from commit 650b767)
mainline inclusion
from mainline-v6.16
commit 926040da60642335969ff99fa2ba67e4e0bb2618
category: feature
bugzilla: RVCK-Project/rvck#166

--------------------------------

Save the bus clock pointer in the of_serial_info structure, and use
that to disable the bus clock on suspend and re-enable it on resume.

Signed-off-by: Alex Elder <elder@riscstar.com>
Reviewed-by: Andy Shevchenko <andy@kernel.org>
Reviewed-by: Yixun Lan <dlan@gentoo.org>
Link: https://lore.kernel.org/r/20250411203828.1491595-4-elder@riscstar.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Zhang Meng <zhangmeng.kevin@spacemit.com>
Signed-off-by: Mingzheng Xing <xingmingzheng@iscas.ac.cn>
(cherry picked from commit 7833d14)
community inclusion
category: feature
bugzilla: RVCK-Project/rvck#166

--------------------------------

Remove the UART driver exclusive to K1, the 8250_of driver is ok

Signed-off-by: Zhang Meng <zhangmeng.kevin@spacemit.com>
Signed-off-by: Mingzheng Xing <xingmingzheng@iscas.ac.cn>
(cherry picked from commit 1f53b73)
…scale-uart'

community inclusion
category: feature
bugzilla: RVCK-Project/rvck#166

--------------------------------

The 8250_of driver is ok for spacemit k1

Signed-off-by: Zhang Meng <zhangmeng.kevin@spacemit.com>
Signed-off-by: Mingzheng Xing <xingmingzheng@iscas.ac.cn>
(cherry picked from commit f2188da)
@xmzzz xmzzz merged commit e1d9d21 into OLK-6.6 Apr 8, 2026
1 check passed
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 8, 2026


开始测试 log: https://github.com/RVCK-Project/rvck-olk/actions/runs/24122924657

参数解析结果
args value
repository RVCK-Project/rvck-olk
head ref pull/182/head
base ref OLK-6.6
LAVA repo RVCK-Project/lavaci
LAVA Template lava-job-template/qemu/qemu-ltp.yaml
Testcase path lava-testcases/common-test/ltp/ltp.yaml
need run job kunit-test,kernel-build,check-patch,lava-trigger

测试完成

详细结果:

RVCK result

check result
kunit-test success
kernel-build failure
lava-trigger skipped
check-patch success

Kunit Test Result

[07:29:30] Testing complete. Ran 454 tests: passed: 442, skipped: 12

Kernel Build Result

Kernel build failed.

Check Patch Result

Total Errors 0
Total Warnings 19

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants